1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_bluetooth_hfp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct CallManagerPeerConnectedRequest {
16 pub id: fidl_fuchsia_bluetooth::PeerId,
17 pub handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for CallManagerPeerConnectedRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct HandsFreeWatchPeerConnectedResponse {
27 pub id: fidl_fuchsia_bluetooth::PeerId,
28 pub handle: fidl::endpoints::ClientEnd<PeerHandlerMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for HandsFreeWatchPeerConnectedResponse
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct HfpRegisterRequest {
38 pub manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HfpRegisterRequest {}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct PeerHandlerGainControlRequest {
45 pub control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49 for PeerHandlerGainControlRequest
50{
51}
52
53#[derive(Debug, PartialEq)]
54pub struct PeerHandlerWatchNextCallResponse {
55 pub call: NextCall,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
59 for PeerHandlerWatchNextCallResponse
60{
61}
62
63#[derive(Debug, Default, PartialEq)]
65pub struct NextCall {
66 pub call: Option<fidl::endpoints::ClientEnd<CallMarker>>,
69 pub remote: Option<String>,
72 pub state: Option<CallState>,
75 pub direction: Option<CallDirection>,
79 #[doc(hidden)]
80 pub __source_breaking: fidl::marker::SourceBreaking,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NextCall {}
84
85#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
86pub struct CallMarker;
87
88impl fidl::endpoints::ProtocolMarker for CallMarker {
89 type Proxy = CallProxy;
90 type RequestStream = CallRequestStream;
91 #[cfg(target_os = "fuchsia")]
92 type SynchronousProxy = CallSynchronousProxy;
93
94 const DEBUG_NAME: &'static str = "(anonymous) Call";
95}
96pub type CallSendDtmfCodeResult = Result<(), i32>;
97
98pub trait CallProxyInterface: Send + Sync {
99 type WatchStateResponseFut: std::future::Future<Output = Result<CallState, fidl::Error>> + Send;
100 fn r#watch_state(&self) -> Self::WatchStateResponseFut;
101 fn r#request_hold(&self) -> Result<(), fidl::Error>;
102 fn r#request_active(&self) -> Result<(), fidl::Error>;
103 fn r#request_terminate(&self) -> Result<(), fidl::Error>;
104 fn r#request_transfer_audio(&self) -> Result<(), fidl::Error>;
105 type SendDtmfCodeResponseFut: std::future::Future<Output = Result<CallSendDtmfCodeResult, fidl::Error>>
106 + Send;
107 fn r#send_dtmf_code(&self, code: DtmfCode) -> Self::SendDtmfCodeResponseFut;
108}
109#[derive(Debug)]
110#[cfg(target_os = "fuchsia")]
111pub struct CallSynchronousProxy {
112 client: fidl::client::sync::Client,
113}
114
115#[cfg(target_os = "fuchsia")]
116impl fidl::endpoints::SynchronousProxy for CallSynchronousProxy {
117 type Proxy = CallProxy;
118 type Protocol = CallMarker;
119
120 fn from_channel(inner: fidl::Channel) -> Self {
121 Self::new(inner)
122 }
123
124 fn into_channel(self) -> fidl::Channel {
125 self.client.into_channel()
126 }
127
128 fn as_channel(&self) -> &fidl::Channel {
129 self.client.as_channel()
130 }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl CallSynchronousProxy {
135 pub fn new(channel: fidl::Channel) -> Self {
136 let protocol_name = <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
137 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
138 }
139
140 pub fn into_channel(self) -> fidl::Channel {
141 self.client.into_channel()
142 }
143
144 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<CallEvent, fidl::Error> {
147 CallEvent::decode(self.client.wait_for_event(deadline)?)
148 }
149
150 pub fn r#watch_state(
153 &self,
154 ___deadline: zx::MonotonicInstant,
155 ) -> Result<CallState, fidl::Error> {
156 let _response =
157 self.client.send_query::<fidl::encoding::EmptyPayload, CallWatchStateResponse>(
158 (),
159 0x5262bcc909bdaeb5,
160 fidl::encoding::DynamicFlags::empty(),
161 ___deadline,
162 )?;
163 Ok(_response.state)
164 }
165
166 pub fn r#request_hold(&self) -> Result<(), fidl::Error> {
168 self.client.send::<fidl::encoding::EmptyPayload>(
169 (),
170 0x35ade403017d20eb,
171 fidl::encoding::DynamicFlags::empty(),
172 )
173 }
174
175 pub fn r#request_active(&self) -> Result<(), fidl::Error> {
179 self.client.send::<fidl::encoding::EmptyPayload>(
180 (),
181 0x248518f967f1fe6e,
182 fidl::encoding::DynamicFlags::empty(),
183 )
184 }
185
186 pub fn r#request_terminate(&self) -> Result<(), fidl::Error> {
188 self.client.send::<fidl::encoding::EmptyPayload>(
189 (),
190 0x4940915197ee4916,
191 fidl::encoding::DynamicFlags::empty(),
192 )
193 }
194
195 pub fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
198 self.client.send::<fidl::encoding::EmptyPayload>(
199 (),
200 0xb0ca6649f2e104c,
201 fidl::encoding::DynamicFlags::empty(),
202 )
203 }
204
205 pub fn r#send_dtmf_code(
212 &self,
213 mut code: DtmfCode,
214 ___deadline: zx::MonotonicInstant,
215 ) -> Result<CallSendDtmfCodeResult, fidl::Error> {
216 let _response = self.client.send_query::<
217 CallSendDtmfCodeRequest,
218 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
219 >(
220 (code,),
221 0x50768933ca33fcd6,
222 fidl::encoding::DynamicFlags::empty(),
223 ___deadline,
224 )?;
225 Ok(_response.map(|x| x))
226 }
227}
228
229#[cfg(target_os = "fuchsia")]
230impl From<CallSynchronousProxy> for zx::Handle {
231 fn from(value: CallSynchronousProxy) -> Self {
232 value.into_channel().into()
233 }
234}
235
236#[cfg(target_os = "fuchsia")]
237impl From<fidl::Channel> for CallSynchronousProxy {
238 fn from(value: fidl::Channel) -> Self {
239 Self::new(value)
240 }
241}
242
243#[cfg(target_os = "fuchsia")]
244impl fidl::endpoints::FromClient for CallSynchronousProxy {
245 type Protocol = CallMarker;
246
247 fn from_client(value: fidl::endpoints::ClientEnd<CallMarker>) -> Self {
248 Self::new(value.into_channel())
249 }
250}
251
252#[derive(Debug, Clone)]
253pub struct CallProxy {
254 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
255}
256
257impl fidl::endpoints::Proxy for CallProxy {
258 type Protocol = CallMarker;
259
260 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
261 Self::new(inner)
262 }
263
264 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
265 self.client.into_channel().map_err(|client| Self { client })
266 }
267
268 fn as_channel(&self) -> &::fidl::AsyncChannel {
269 self.client.as_channel()
270 }
271}
272
273impl CallProxy {
274 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
276 let protocol_name = <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
277 Self { client: fidl::client::Client::new(channel, protocol_name) }
278 }
279
280 pub fn take_event_stream(&self) -> CallEventStream {
286 CallEventStream { event_receiver: self.client.take_event_receiver() }
287 }
288
289 pub fn r#watch_state(
292 &self,
293 ) -> fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>
294 {
295 CallProxyInterface::r#watch_state(self)
296 }
297
298 pub fn r#request_hold(&self) -> Result<(), fidl::Error> {
300 CallProxyInterface::r#request_hold(self)
301 }
302
303 pub fn r#request_active(&self) -> Result<(), fidl::Error> {
307 CallProxyInterface::r#request_active(self)
308 }
309
310 pub fn r#request_terminate(&self) -> Result<(), fidl::Error> {
312 CallProxyInterface::r#request_terminate(self)
313 }
314
315 pub fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
318 CallProxyInterface::r#request_transfer_audio(self)
319 }
320
321 pub fn r#send_dtmf_code(
328 &self,
329 mut code: DtmfCode,
330 ) -> fidl::client::QueryResponseFut<
331 CallSendDtmfCodeResult,
332 fidl::encoding::DefaultFuchsiaResourceDialect,
333 > {
334 CallProxyInterface::r#send_dtmf_code(self, code)
335 }
336}
337
338impl CallProxyInterface for CallProxy {
339 type WatchStateResponseFut =
340 fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>;
341 fn r#watch_state(&self) -> Self::WatchStateResponseFut {
342 fn _decode(
343 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
344 ) -> Result<CallState, fidl::Error> {
345 let _response = fidl::client::decode_transaction_body::<
346 CallWatchStateResponse,
347 fidl::encoding::DefaultFuchsiaResourceDialect,
348 0x5262bcc909bdaeb5,
349 >(_buf?)?;
350 Ok(_response.state)
351 }
352 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CallState>(
353 (),
354 0x5262bcc909bdaeb5,
355 fidl::encoding::DynamicFlags::empty(),
356 _decode,
357 )
358 }
359
360 fn r#request_hold(&self) -> Result<(), fidl::Error> {
361 self.client.send::<fidl::encoding::EmptyPayload>(
362 (),
363 0x35ade403017d20eb,
364 fidl::encoding::DynamicFlags::empty(),
365 )
366 }
367
368 fn r#request_active(&self) -> Result<(), fidl::Error> {
369 self.client.send::<fidl::encoding::EmptyPayload>(
370 (),
371 0x248518f967f1fe6e,
372 fidl::encoding::DynamicFlags::empty(),
373 )
374 }
375
376 fn r#request_terminate(&self) -> Result<(), fidl::Error> {
377 self.client.send::<fidl::encoding::EmptyPayload>(
378 (),
379 0x4940915197ee4916,
380 fidl::encoding::DynamicFlags::empty(),
381 )
382 }
383
384 fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
385 self.client.send::<fidl::encoding::EmptyPayload>(
386 (),
387 0xb0ca6649f2e104c,
388 fidl::encoding::DynamicFlags::empty(),
389 )
390 }
391
392 type SendDtmfCodeResponseFut = fidl::client::QueryResponseFut<
393 CallSendDtmfCodeResult,
394 fidl::encoding::DefaultFuchsiaResourceDialect,
395 >;
396 fn r#send_dtmf_code(&self, mut code: DtmfCode) -> Self::SendDtmfCodeResponseFut {
397 fn _decode(
398 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
399 ) -> Result<CallSendDtmfCodeResult, fidl::Error> {
400 let _response = fidl::client::decode_transaction_body::<
401 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
402 fidl::encoding::DefaultFuchsiaResourceDialect,
403 0x50768933ca33fcd6,
404 >(_buf?)?;
405 Ok(_response.map(|x| x))
406 }
407 self.client.send_query_and_decode::<CallSendDtmfCodeRequest, CallSendDtmfCodeResult>(
408 (code,),
409 0x50768933ca33fcd6,
410 fidl::encoding::DynamicFlags::empty(),
411 _decode,
412 )
413 }
414}
415
416pub struct CallEventStream {
417 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
418}
419
420impl std::marker::Unpin for CallEventStream {}
421
422impl futures::stream::FusedStream for CallEventStream {
423 fn is_terminated(&self) -> bool {
424 self.event_receiver.is_terminated()
425 }
426}
427
428impl futures::Stream for CallEventStream {
429 type Item = Result<CallEvent, fidl::Error>;
430
431 fn poll_next(
432 mut self: std::pin::Pin<&mut Self>,
433 cx: &mut std::task::Context<'_>,
434 ) -> std::task::Poll<Option<Self::Item>> {
435 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
436 &mut self.event_receiver,
437 cx
438 )?) {
439 Some(buf) => std::task::Poll::Ready(Some(CallEvent::decode(buf))),
440 None => std::task::Poll::Ready(None),
441 }
442 }
443}
444
445#[derive(Debug)]
446pub enum CallEvent {}
447
448impl CallEvent {
449 fn decode(
451 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452 ) -> Result<CallEvent, fidl::Error> {
453 let (bytes, _handles) = buf.split_mut();
454 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455 debug_assert_eq!(tx_header.tx_id, 0);
456 match tx_header.ordinal {
457 _ => Err(fidl::Error::UnknownOrdinal {
458 ordinal: tx_header.ordinal,
459 protocol_name: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
460 }),
461 }
462 }
463}
464
465pub struct CallRequestStream {
467 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
468 is_terminated: bool,
469}
470
471impl std::marker::Unpin for CallRequestStream {}
472
473impl futures::stream::FusedStream for CallRequestStream {
474 fn is_terminated(&self) -> bool {
475 self.is_terminated
476 }
477}
478
479impl fidl::endpoints::RequestStream for CallRequestStream {
480 type Protocol = CallMarker;
481 type ControlHandle = CallControlHandle;
482
483 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
484 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
485 }
486
487 fn control_handle(&self) -> Self::ControlHandle {
488 CallControlHandle { inner: self.inner.clone() }
489 }
490
491 fn into_inner(
492 self,
493 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
494 {
495 (self.inner, self.is_terminated)
496 }
497
498 fn from_inner(
499 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
500 is_terminated: bool,
501 ) -> Self {
502 Self { inner, is_terminated }
503 }
504}
505
506impl futures::Stream for CallRequestStream {
507 type Item = Result<CallRequest, fidl::Error>;
508
509 fn poll_next(
510 mut self: std::pin::Pin<&mut Self>,
511 cx: &mut std::task::Context<'_>,
512 ) -> std::task::Poll<Option<Self::Item>> {
513 let this = &mut *self;
514 if this.inner.check_shutdown(cx) {
515 this.is_terminated = true;
516 return std::task::Poll::Ready(None);
517 }
518 if this.is_terminated {
519 panic!("polled CallRequestStream after completion");
520 }
521 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
522 |bytes, handles| {
523 match this.inner.channel().read_etc(cx, bytes, handles) {
524 std::task::Poll::Ready(Ok(())) => {}
525 std::task::Poll::Pending => return std::task::Poll::Pending,
526 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
527 this.is_terminated = true;
528 return std::task::Poll::Ready(None);
529 }
530 std::task::Poll::Ready(Err(e)) => {
531 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
532 e.into(),
533 ))));
534 }
535 }
536
537 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
539
540 std::task::Poll::Ready(Some(match header.ordinal {
541 0x5262bcc909bdaeb5 => {
542 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
543 let mut req = fidl::new_empty!(
544 fidl::encoding::EmptyPayload,
545 fidl::encoding::DefaultFuchsiaResourceDialect
546 );
547 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
548 let control_handle = CallControlHandle { inner: this.inner.clone() };
549 Ok(CallRequest::WatchState {
550 responder: CallWatchStateResponder {
551 control_handle: std::mem::ManuallyDrop::new(control_handle),
552 tx_id: header.tx_id,
553 },
554 })
555 }
556 0x35ade403017d20eb => {
557 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
558 let mut req = fidl::new_empty!(
559 fidl::encoding::EmptyPayload,
560 fidl::encoding::DefaultFuchsiaResourceDialect
561 );
562 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
563 let control_handle = CallControlHandle { inner: this.inner.clone() };
564 Ok(CallRequest::RequestHold { control_handle })
565 }
566 0x248518f967f1fe6e => {
567 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
568 let mut req = fidl::new_empty!(
569 fidl::encoding::EmptyPayload,
570 fidl::encoding::DefaultFuchsiaResourceDialect
571 );
572 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
573 let control_handle = CallControlHandle { inner: this.inner.clone() };
574 Ok(CallRequest::RequestActive { control_handle })
575 }
576 0x4940915197ee4916 => {
577 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
578 let mut req = fidl::new_empty!(
579 fidl::encoding::EmptyPayload,
580 fidl::encoding::DefaultFuchsiaResourceDialect
581 );
582 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
583 let control_handle = CallControlHandle { inner: this.inner.clone() };
584 Ok(CallRequest::RequestTerminate { control_handle })
585 }
586 0xb0ca6649f2e104c => {
587 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
588 let mut req = fidl::new_empty!(
589 fidl::encoding::EmptyPayload,
590 fidl::encoding::DefaultFuchsiaResourceDialect
591 );
592 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
593 let control_handle = CallControlHandle { inner: this.inner.clone() };
594 Ok(CallRequest::RequestTransferAudio { control_handle })
595 }
596 0x50768933ca33fcd6 => {
597 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
598 let mut req = fidl::new_empty!(
599 CallSendDtmfCodeRequest,
600 fidl::encoding::DefaultFuchsiaResourceDialect
601 );
602 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallSendDtmfCodeRequest>(&header, _body_bytes, handles, &mut req)?;
603 let control_handle = CallControlHandle { inner: this.inner.clone() };
604 Ok(CallRequest::SendDtmfCode {
605 code: req.code,
606
607 responder: CallSendDtmfCodeResponder {
608 control_handle: std::mem::ManuallyDrop::new(control_handle),
609 tx_id: header.tx_id,
610 },
611 })
612 }
613 _ => Err(fidl::Error::UnknownOrdinal {
614 ordinal: header.ordinal,
615 protocol_name: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
616 }),
617 }))
618 },
619 )
620 }
621}
622
623#[derive(Debug)]
629pub enum CallRequest {
630 WatchState { responder: CallWatchStateResponder },
633 RequestHold { control_handle: CallControlHandle },
635 RequestActive { control_handle: CallControlHandle },
639 RequestTerminate { control_handle: CallControlHandle },
641 RequestTransferAudio { control_handle: CallControlHandle },
644 SendDtmfCode { code: DtmfCode, responder: CallSendDtmfCodeResponder },
651}
652
653impl CallRequest {
654 #[allow(irrefutable_let_patterns)]
655 pub fn into_watch_state(self) -> Option<(CallWatchStateResponder)> {
656 if let CallRequest::WatchState { responder } = self { Some((responder)) } else { None }
657 }
658
659 #[allow(irrefutable_let_patterns)]
660 pub fn into_request_hold(self) -> Option<(CallControlHandle)> {
661 if let CallRequest::RequestHold { control_handle } = self {
662 Some((control_handle))
663 } else {
664 None
665 }
666 }
667
668 #[allow(irrefutable_let_patterns)]
669 pub fn into_request_active(self) -> Option<(CallControlHandle)> {
670 if let CallRequest::RequestActive { control_handle } = self {
671 Some((control_handle))
672 } else {
673 None
674 }
675 }
676
677 #[allow(irrefutable_let_patterns)]
678 pub fn into_request_terminate(self) -> Option<(CallControlHandle)> {
679 if let CallRequest::RequestTerminate { control_handle } = self {
680 Some((control_handle))
681 } else {
682 None
683 }
684 }
685
686 #[allow(irrefutable_let_patterns)]
687 pub fn into_request_transfer_audio(self) -> Option<(CallControlHandle)> {
688 if let CallRequest::RequestTransferAudio { control_handle } = self {
689 Some((control_handle))
690 } else {
691 None
692 }
693 }
694
695 #[allow(irrefutable_let_patterns)]
696 pub fn into_send_dtmf_code(self) -> Option<(DtmfCode, CallSendDtmfCodeResponder)> {
697 if let CallRequest::SendDtmfCode { code, responder } = self {
698 Some((code, responder))
699 } else {
700 None
701 }
702 }
703
704 pub fn method_name(&self) -> &'static str {
706 match *self {
707 CallRequest::WatchState { .. } => "watch_state",
708 CallRequest::RequestHold { .. } => "request_hold",
709 CallRequest::RequestActive { .. } => "request_active",
710 CallRequest::RequestTerminate { .. } => "request_terminate",
711 CallRequest::RequestTransferAudio { .. } => "request_transfer_audio",
712 CallRequest::SendDtmfCode { .. } => "send_dtmf_code",
713 }
714 }
715}
716
717#[derive(Debug, Clone)]
718pub struct CallControlHandle {
719 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
720}
721
722impl fidl::endpoints::ControlHandle for CallControlHandle {
723 fn shutdown(&self) {
724 self.inner.shutdown()
725 }
726 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
727 self.inner.shutdown_with_epitaph(status)
728 }
729
730 fn is_closed(&self) -> bool {
731 self.inner.channel().is_closed()
732 }
733 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
734 self.inner.channel().on_closed()
735 }
736
737 #[cfg(target_os = "fuchsia")]
738 fn signal_peer(
739 &self,
740 clear_mask: zx::Signals,
741 set_mask: zx::Signals,
742 ) -> Result<(), zx_status::Status> {
743 use fidl::Peered;
744 self.inner.channel().signal_peer(clear_mask, set_mask)
745 }
746}
747
748impl CallControlHandle {}
749
750#[must_use = "FIDL methods require a response to be sent"]
751#[derive(Debug)]
752pub struct CallWatchStateResponder {
753 control_handle: std::mem::ManuallyDrop<CallControlHandle>,
754 tx_id: u32,
755}
756
757impl std::ops::Drop for CallWatchStateResponder {
761 fn drop(&mut self) {
762 self.control_handle.shutdown();
763 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
765 }
766}
767
768impl fidl::endpoints::Responder for CallWatchStateResponder {
769 type ControlHandle = CallControlHandle;
770
771 fn control_handle(&self) -> &CallControlHandle {
772 &self.control_handle
773 }
774
775 fn drop_without_shutdown(mut self) {
776 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
778 std::mem::forget(self);
780 }
781}
782
783impl CallWatchStateResponder {
784 pub fn send(self, mut state: CallState) -> Result<(), fidl::Error> {
788 let _result = self.send_raw(state);
789 if _result.is_err() {
790 self.control_handle.shutdown();
791 }
792 self.drop_without_shutdown();
793 _result
794 }
795
796 pub fn send_no_shutdown_on_err(self, mut state: CallState) -> Result<(), fidl::Error> {
798 let _result = self.send_raw(state);
799 self.drop_without_shutdown();
800 _result
801 }
802
803 fn send_raw(&self, mut state: CallState) -> Result<(), fidl::Error> {
804 self.control_handle.inner.send::<CallWatchStateResponse>(
805 (state,),
806 self.tx_id,
807 0x5262bcc909bdaeb5,
808 fidl::encoding::DynamicFlags::empty(),
809 )
810 }
811}
812
813#[must_use = "FIDL methods require a response to be sent"]
814#[derive(Debug)]
815pub struct CallSendDtmfCodeResponder {
816 control_handle: std::mem::ManuallyDrop<CallControlHandle>,
817 tx_id: u32,
818}
819
820impl std::ops::Drop for CallSendDtmfCodeResponder {
824 fn drop(&mut self) {
825 self.control_handle.shutdown();
826 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
828 }
829}
830
831impl fidl::endpoints::Responder for CallSendDtmfCodeResponder {
832 type ControlHandle = CallControlHandle;
833
834 fn control_handle(&self) -> &CallControlHandle {
835 &self.control_handle
836 }
837
838 fn drop_without_shutdown(mut self) {
839 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
841 std::mem::forget(self);
843 }
844}
845
846impl CallSendDtmfCodeResponder {
847 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
851 let _result = self.send_raw(result);
852 if _result.is_err() {
853 self.control_handle.shutdown();
854 }
855 self.drop_without_shutdown();
856 _result
857 }
858
859 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
861 let _result = self.send_raw(result);
862 self.drop_without_shutdown();
863 _result
864 }
865
866 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
867 self.control_handle
868 .inner
869 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
870 result,
871 self.tx_id,
872 0x50768933ca33fcd6,
873 fidl::encoding::DynamicFlags::empty(),
874 )
875 }
876}
877
878#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
879pub struct CallManagerMarker;
880
881impl fidl::endpoints::ProtocolMarker for CallManagerMarker {
882 type Proxy = CallManagerProxy;
883 type RequestStream = CallManagerRequestStream;
884 #[cfg(target_os = "fuchsia")]
885 type SynchronousProxy = CallManagerSynchronousProxy;
886
887 const DEBUG_NAME: &'static str = "(anonymous) CallManager";
888}
889
890pub trait CallManagerProxyInterface: Send + Sync {
891 type PeerConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
892 fn r#peer_connected(
893 &self,
894 id: &fidl_fuchsia_bluetooth::PeerId,
895 handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
896 ) -> Self::PeerConnectedResponseFut;
897}
898#[derive(Debug)]
899#[cfg(target_os = "fuchsia")]
900pub struct CallManagerSynchronousProxy {
901 client: fidl::client::sync::Client,
902}
903
904#[cfg(target_os = "fuchsia")]
905impl fidl::endpoints::SynchronousProxy for CallManagerSynchronousProxy {
906 type Proxy = CallManagerProxy;
907 type Protocol = CallManagerMarker;
908
909 fn from_channel(inner: fidl::Channel) -> Self {
910 Self::new(inner)
911 }
912
913 fn into_channel(self) -> fidl::Channel {
914 self.client.into_channel()
915 }
916
917 fn as_channel(&self) -> &fidl::Channel {
918 self.client.as_channel()
919 }
920}
921
922#[cfg(target_os = "fuchsia")]
923impl CallManagerSynchronousProxy {
924 pub fn new(channel: fidl::Channel) -> Self {
925 let protocol_name = <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
926 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
927 }
928
929 pub fn into_channel(self) -> fidl::Channel {
930 self.client.into_channel()
931 }
932
933 pub fn wait_for_event(
936 &self,
937 deadline: zx::MonotonicInstant,
938 ) -> Result<CallManagerEvent, fidl::Error> {
939 CallManagerEvent::decode(self.client.wait_for_event(deadline)?)
940 }
941
942 pub fn r#peer_connected(
953 &self,
954 mut id: &fidl_fuchsia_bluetooth::PeerId,
955 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
956 ___deadline: zx::MonotonicInstant,
957 ) -> Result<(), fidl::Error> {
958 let _response = self
959 .client
960 .send_query::<CallManagerPeerConnectedRequest, fidl::encoding::EmptyPayload>(
961 (id, handle),
962 0x1431cc24b2980086,
963 fidl::encoding::DynamicFlags::empty(),
964 ___deadline,
965 )?;
966 Ok(_response)
967 }
968}
969
970#[cfg(target_os = "fuchsia")]
971impl From<CallManagerSynchronousProxy> for zx::Handle {
972 fn from(value: CallManagerSynchronousProxy) -> Self {
973 value.into_channel().into()
974 }
975}
976
977#[cfg(target_os = "fuchsia")]
978impl From<fidl::Channel> for CallManagerSynchronousProxy {
979 fn from(value: fidl::Channel) -> Self {
980 Self::new(value)
981 }
982}
983
984#[cfg(target_os = "fuchsia")]
985impl fidl::endpoints::FromClient for CallManagerSynchronousProxy {
986 type Protocol = CallManagerMarker;
987
988 fn from_client(value: fidl::endpoints::ClientEnd<CallManagerMarker>) -> Self {
989 Self::new(value.into_channel())
990 }
991}
992
993#[derive(Debug, Clone)]
994pub struct CallManagerProxy {
995 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
996}
997
998impl fidl::endpoints::Proxy for CallManagerProxy {
999 type Protocol = CallManagerMarker;
1000
1001 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1002 Self::new(inner)
1003 }
1004
1005 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1006 self.client.into_channel().map_err(|client| Self { client })
1007 }
1008
1009 fn as_channel(&self) -> &::fidl::AsyncChannel {
1010 self.client.as_channel()
1011 }
1012}
1013
1014impl CallManagerProxy {
1015 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1017 let protocol_name = <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1018 Self { client: fidl::client::Client::new(channel, protocol_name) }
1019 }
1020
1021 pub fn take_event_stream(&self) -> CallManagerEventStream {
1027 CallManagerEventStream { event_receiver: self.client.take_event_receiver() }
1028 }
1029
1030 pub fn r#peer_connected(
1041 &self,
1042 mut id: &fidl_fuchsia_bluetooth::PeerId,
1043 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1044 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1045 CallManagerProxyInterface::r#peer_connected(self, id, handle)
1046 }
1047}
1048
1049impl CallManagerProxyInterface for CallManagerProxy {
1050 type PeerConnectedResponseFut =
1051 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1052 fn r#peer_connected(
1053 &self,
1054 mut id: &fidl_fuchsia_bluetooth::PeerId,
1055 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1056 ) -> Self::PeerConnectedResponseFut {
1057 fn _decode(
1058 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1059 ) -> Result<(), fidl::Error> {
1060 let _response = fidl::client::decode_transaction_body::<
1061 fidl::encoding::EmptyPayload,
1062 fidl::encoding::DefaultFuchsiaResourceDialect,
1063 0x1431cc24b2980086,
1064 >(_buf?)?;
1065 Ok(_response)
1066 }
1067 self.client.send_query_and_decode::<CallManagerPeerConnectedRequest, ()>(
1068 (id, handle),
1069 0x1431cc24b2980086,
1070 fidl::encoding::DynamicFlags::empty(),
1071 _decode,
1072 )
1073 }
1074}
1075
1076pub struct CallManagerEventStream {
1077 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1078}
1079
1080impl std::marker::Unpin for CallManagerEventStream {}
1081
1082impl futures::stream::FusedStream for CallManagerEventStream {
1083 fn is_terminated(&self) -> bool {
1084 self.event_receiver.is_terminated()
1085 }
1086}
1087
1088impl futures::Stream for CallManagerEventStream {
1089 type Item = Result<CallManagerEvent, fidl::Error>;
1090
1091 fn poll_next(
1092 mut self: std::pin::Pin<&mut Self>,
1093 cx: &mut std::task::Context<'_>,
1094 ) -> std::task::Poll<Option<Self::Item>> {
1095 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1096 &mut self.event_receiver,
1097 cx
1098 )?) {
1099 Some(buf) => std::task::Poll::Ready(Some(CallManagerEvent::decode(buf))),
1100 None => std::task::Poll::Ready(None),
1101 }
1102 }
1103}
1104
1105#[derive(Debug)]
1106pub enum CallManagerEvent {}
1107
1108impl CallManagerEvent {
1109 fn decode(
1111 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1112 ) -> Result<CallManagerEvent, fidl::Error> {
1113 let (bytes, _handles) = buf.split_mut();
1114 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1115 debug_assert_eq!(tx_header.tx_id, 0);
1116 match tx_header.ordinal {
1117 _ => Err(fidl::Error::UnknownOrdinal {
1118 ordinal: tx_header.ordinal,
1119 protocol_name: <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1120 }),
1121 }
1122 }
1123}
1124
1125pub struct CallManagerRequestStream {
1127 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1128 is_terminated: bool,
1129}
1130
1131impl std::marker::Unpin for CallManagerRequestStream {}
1132
1133impl futures::stream::FusedStream for CallManagerRequestStream {
1134 fn is_terminated(&self) -> bool {
1135 self.is_terminated
1136 }
1137}
1138
1139impl fidl::endpoints::RequestStream for CallManagerRequestStream {
1140 type Protocol = CallManagerMarker;
1141 type ControlHandle = CallManagerControlHandle;
1142
1143 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1144 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1145 }
1146
1147 fn control_handle(&self) -> Self::ControlHandle {
1148 CallManagerControlHandle { inner: self.inner.clone() }
1149 }
1150
1151 fn into_inner(
1152 self,
1153 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1154 {
1155 (self.inner, self.is_terminated)
1156 }
1157
1158 fn from_inner(
1159 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1160 is_terminated: bool,
1161 ) -> Self {
1162 Self { inner, is_terminated }
1163 }
1164}
1165
1166impl futures::Stream for CallManagerRequestStream {
1167 type Item = Result<CallManagerRequest, fidl::Error>;
1168
1169 fn poll_next(
1170 mut self: std::pin::Pin<&mut Self>,
1171 cx: &mut std::task::Context<'_>,
1172 ) -> std::task::Poll<Option<Self::Item>> {
1173 let this = &mut *self;
1174 if this.inner.check_shutdown(cx) {
1175 this.is_terminated = true;
1176 return std::task::Poll::Ready(None);
1177 }
1178 if this.is_terminated {
1179 panic!("polled CallManagerRequestStream after completion");
1180 }
1181 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1182 |bytes, handles| {
1183 match this.inner.channel().read_etc(cx, bytes, handles) {
1184 std::task::Poll::Ready(Ok(())) => {}
1185 std::task::Poll::Pending => return std::task::Poll::Pending,
1186 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1187 this.is_terminated = true;
1188 return std::task::Poll::Ready(None);
1189 }
1190 std::task::Poll::Ready(Err(e)) => {
1191 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1192 e.into(),
1193 ))));
1194 }
1195 }
1196
1197 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1199
1200 std::task::Poll::Ready(Some(match header.ordinal {
1201 0x1431cc24b2980086 => {
1202 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1203 let mut req = fidl::new_empty!(
1204 CallManagerPeerConnectedRequest,
1205 fidl::encoding::DefaultFuchsiaResourceDialect
1206 );
1207 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallManagerPeerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
1208 let control_handle = CallManagerControlHandle { inner: this.inner.clone() };
1209 Ok(CallManagerRequest::PeerConnected {
1210 id: req.id,
1211 handle: req.handle,
1212
1213 responder: CallManagerPeerConnectedResponder {
1214 control_handle: std::mem::ManuallyDrop::new(control_handle),
1215 tx_id: header.tx_id,
1216 },
1217 })
1218 }
1219 _ => Err(fidl::Error::UnknownOrdinal {
1220 ordinal: header.ordinal,
1221 protocol_name:
1222 <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1223 }),
1224 }))
1225 },
1226 )
1227 }
1228}
1229
1230#[derive(Debug)]
1231pub enum CallManagerRequest {
1232 PeerConnected {
1243 id: fidl_fuchsia_bluetooth::PeerId,
1244 handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1245 responder: CallManagerPeerConnectedResponder,
1246 },
1247}
1248
1249impl CallManagerRequest {
1250 #[allow(irrefutable_let_patterns)]
1251 pub fn into_peer_connected(
1252 self,
1253 ) -> Option<(
1254 fidl_fuchsia_bluetooth::PeerId,
1255 fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1256 CallManagerPeerConnectedResponder,
1257 )> {
1258 if let CallManagerRequest::PeerConnected { id, handle, responder } = self {
1259 Some((id, handle, responder))
1260 } else {
1261 None
1262 }
1263 }
1264
1265 pub fn method_name(&self) -> &'static str {
1267 match *self {
1268 CallManagerRequest::PeerConnected { .. } => "peer_connected",
1269 }
1270 }
1271}
1272
1273#[derive(Debug, Clone)]
1274pub struct CallManagerControlHandle {
1275 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1276}
1277
1278impl fidl::endpoints::ControlHandle for CallManagerControlHandle {
1279 fn shutdown(&self) {
1280 self.inner.shutdown()
1281 }
1282 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1283 self.inner.shutdown_with_epitaph(status)
1284 }
1285
1286 fn is_closed(&self) -> bool {
1287 self.inner.channel().is_closed()
1288 }
1289 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1290 self.inner.channel().on_closed()
1291 }
1292
1293 #[cfg(target_os = "fuchsia")]
1294 fn signal_peer(
1295 &self,
1296 clear_mask: zx::Signals,
1297 set_mask: zx::Signals,
1298 ) -> Result<(), zx_status::Status> {
1299 use fidl::Peered;
1300 self.inner.channel().signal_peer(clear_mask, set_mask)
1301 }
1302}
1303
1304impl CallManagerControlHandle {}
1305
1306#[must_use = "FIDL methods require a response to be sent"]
1307#[derive(Debug)]
1308pub struct CallManagerPeerConnectedResponder {
1309 control_handle: std::mem::ManuallyDrop<CallManagerControlHandle>,
1310 tx_id: u32,
1311}
1312
1313impl std::ops::Drop for CallManagerPeerConnectedResponder {
1317 fn drop(&mut self) {
1318 self.control_handle.shutdown();
1319 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1321 }
1322}
1323
1324impl fidl::endpoints::Responder for CallManagerPeerConnectedResponder {
1325 type ControlHandle = CallManagerControlHandle;
1326
1327 fn control_handle(&self) -> &CallManagerControlHandle {
1328 &self.control_handle
1329 }
1330
1331 fn drop_without_shutdown(mut self) {
1332 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1334 std::mem::forget(self);
1336 }
1337}
1338
1339impl CallManagerPeerConnectedResponder {
1340 pub fn send(self) -> Result<(), fidl::Error> {
1344 let _result = self.send_raw();
1345 if _result.is_err() {
1346 self.control_handle.shutdown();
1347 }
1348 self.drop_without_shutdown();
1349 _result
1350 }
1351
1352 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1354 let _result = self.send_raw();
1355 self.drop_without_shutdown();
1356 _result
1357 }
1358
1359 fn send_raw(&self) -> Result<(), fidl::Error> {
1360 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1361 (),
1362 self.tx_id,
1363 0x1431cc24b2980086,
1364 fidl::encoding::DynamicFlags::empty(),
1365 )
1366 }
1367}
1368
1369#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1370pub struct HandsFreeMarker;
1371
1372impl fidl::endpoints::ProtocolMarker for HandsFreeMarker {
1373 type Proxy = HandsFreeProxy;
1374 type RequestStream = HandsFreeRequestStream;
1375 #[cfg(target_os = "fuchsia")]
1376 type SynchronousProxy = HandsFreeSynchronousProxy;
1377
1378 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.HandsFree";
1379}
1380impl fidl::endpoints::DiscoverableProtocolMarker for HandsFreeMarker {}
1381pub type HandsFreeWatchPeerConnectedResult =
1382 Result<(fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>), i32>;
1383
1384pub trait HandsFreeProxyInterface: Send + Sync {
1385 type WatchPeerConnectedResponseFut: std::future::Future<Output = Result<HandsFreeWatchPeerConnectedResult, fidl::Error>>
1386 + Send;
1387 fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut;
1388}
1389#[derive(Debug)]
1390#[cfg(target_os = "fuchsia")]
1391pub struct HandsFreeSynchronousProxy {
1392 client: fidl::client::sync::Client,
1393}
1394
1395#[cfg(target_os = "fuchsia")]
1396impl fidl::endpoints::SynchronousProxy for HandsFreeSynchronousProxy {
1397 type Proxy = HandsFreeProxy;
1398 type Protocol = HandsFreeMarker;
1399
1400 fn from_channel(inner: fidl::Channel) -> Self {
1401 Self::new(inner)
1402 }
1403
1404 fn into_channel(self) -> fidl::Channel {
1405 self.client.into_channel()
1406 }
1407
1408 fn as_channel(&self) -> &fidl::Channel {
1409 self.client.as_channel()
1410 }
1411}
1412
1413#[cfg(target_os = "fuchsia")]
1414impl HandsFreeSynchronousProxy {
1415 pub fn new(channel: fidl::Channel) -> Self {
1416 let protocol_name = <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1417 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1418 }
1419
1420 pub fn into_channel(self) -> fidl::Channel {
1421 self.client.into_channel()
1422 }
1423
1424 pub fn wait_for_event(
1427 &self,
1428 deadline: zx::MonotonicInstant,
1429 ) -> Result<HandsFreeEvent, fidl::Error> {
1430 HandsFreeEvent::decode(self.client.wait_for_event(deadline)?)
1431 }
1432
1433 pub fn r#watch_peer_connected(
1442 &self,
1443 ___deadline: zx::MonotonicInstant,
1444 ) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
1445 let _response = self.client.send_query::<
1446 fidl::encoding::EmptyPayload,
1447 fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
1448 >(
1449 (),
1450 0x1cc503325a8bbc3f,
1451 fidl::encoding::DynamicFlags::empty(),
1452 ___deadline,
1453 )?;
1454 Ok(_response.map(|x| (x.id, x.handle)))
1455 }
1456}
1457
1458#[cfg(target_os = "fuchsia")]
1459impl From<HandsFreeSynchronousProxy> for zx::Handle {
1460 fn from(value: HandsFreeSynchronousProxy) -> Self {
1461 value.into_channel().into()
1462 }
1463}
1464
1465#[cfg(target_os = "fuchsia")]
1466impl From<fidl::Channel> for HandsFreeSynchronousProxy {
1467 fn from(value: fidl::Channel) -> Self {
1468 Self::new(value)
1469 }
1470}
1471
1472#[cfg(target_os = "fuchsia")]
1473impl fidl::endpoints::FromClient for HandsFreeSynchronousProxy {
1474 type Protocol = HandsFreeMarker;
1475
1476 fn from_client(value: fidl::endpoints::ClientEnd<HandsFreeMarker>) -> Self {
1477 Self::new(value.into_channel())
1478 }
1479}
1480
1481#[derive(Debug, Clone)]
1482pub struct HandsFreeProxy {
1483 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1484}
1485
1486impl fidl::endpoints::Proxy for HandsFreeProxy {
1487 type Protocol = HandsFreeMarker;
1488
1489 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1490 Self::new(inner)
1491 }
1492
1493 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1494 self.client.into_channel().map_err(|client| Self { client })
1495 }
1496
1497 fn as_channel(&self) -> &::fidl::AsyncChannel {
1498 self.client.as_channel()
1499 }
1500}
1501
1502impl HandsFreeProxy {
1503 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1505 let protocol_name = <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1506 Self { client: fidl::client::Client::new(channel, protocol_name) }
1507 }
1508
1509 pub fn take_event_stream(&self) -> HandsFreeEventStream {
1515 HandsFreeEventStream { event_receiver: self.client.take_event_receiver() }
1516 }
1517
1518 pub fn r#watch_peer_connected(
1527 &self,
1528 ) -> fidl::client::QueryResponseFut<
1529 HandsFreeWatchPeerConnectedResult,
1530 fidl::encoding::DefaultFuchsiaResourceDialect,
1531 > {
1532 HandsFreeProxyInterface::r#watch_peer_connected(self)
1533 }
1534}
1535
1536impl HandsFreeProxyInterface for HandsFreeProxy {
1537 type WatchPeerConnectedResponseFut = fidl::client::QueryResponseFut<
1538 HandsFreeWatchPeerConnectedResult,
1539 fidl::encoding::DefaultFuchsiaResourceDialect,
1540 >;
1541 fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut {
1542 fn _decode(
1543 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1544 ) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
1545 let _response = fidl::client::decode_transaction_body::<
1546 fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
1547 fidl::encoding::DefaultFuchsiaResourceDialect,
1548 0x1cc503325a8bbc3f,
1549 >(_buf?)?;
1550 Ok(_response.map(|x| (x.id, x.handle)))
1551 }
1552 self.client.send_query_and_decode::<
1553 fidl::encoding::EmptyPayload,
1554 HandsFreeWatchPeerConnectedResult,
1555 >(
1556 (),
1557 0x1cc503325a8bbc3f,
1558 fidl::encoding::DynamicFlags::empty(),
1559 _decode,
1560 )
1561 }
1562}
1563
1564pub struct HandsFreeEventStream {
1565 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1566}
1567
1568impl std::marker::Unpin for HandsFreeEventStream {}
1569
1570impl futures::stream::FusedStream for HandsFreeEventStream {
1571 fn is_terminated(&self) -> bool {
1572 self.event_receiver.is_terminated()
1573 }
1574}
1575
1576impl futures::Stream for HandsFreeEventStream {
1577 type Item = Result<HandsFreeEvent, fidl::Error>;
1578
1579 fn poll_next(
1580 mut self: std::pin::Pin<&mut Self>,
1581 cx: &mut std::task::Context<'_>,
1582 ) -> std::task::Poll<Option<Self::Item>> {
1583 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1584 &mut self.event_receiver,
1585 cx
1586 )?) {
1587 Some(buf) => std::task::Poll::Ready(Some(HandsFreeEvent::decode(buf))),
1588 None => std::task::Poll::Ready(None),
1589 }
1590 }
1591}
1592
1593#[derive(Debug)]
1594pub enum HandsFreeEvent {}
1595
1596impl HandsFreeEvent {
1597 fn decode(
1599 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1600 ) -> Result<HandsFreeEvent, fidl::Error> {
1601 let (bytes, _handles) = buf.split_mut();
1602 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1603 debug_assert_eq!(tx_header.tx_id, 0);
1604 match tx_header.ordinal {
1605 _ => Err(fidl::Error::UnknownOrdinal {
1606 ordinal: tx_header.ordinal,
1607 protocol_name: <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1608 }),
1609 }
1610 }
1611}
1612
1613pub struct HandsFreeRequestStream {
1615 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1616 is_terminated: bool,
1617}
1618
1619impl std::marker::Unpin for HandsFreeRequestStream {}
1620
1621impl futures::stream::FusedStream for HandsFreeRequestStream {
1622 fn is_terminated(&self) -> bool {
1623 self.is_terminated
1624 }
1625}
1626
1627impl fidl::endpoints::RequestStream for HandsFreeRequestStream {
1628 type Protocol = HandsFreeMarker;
1629 type ControlHandle = HandsFreeControlHandle;
1630
1631 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1632 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1633 }
1634
1635 fn control_handle(&self) -> Self::ControlHandle {
1636 HandsFreeControlHandle { inner: self.inner.clone() }
1637 }
1638
1639 fn into_inner(
1640 self,
1641 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1642 {
1643 (self.inner, self.is_terminated)
1644 }
1645
1646 fn from_inner(
1647 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1648 is_terminated: bool,
1649 ) -> Self {
1650 Self { inner, is_terminated }
1651 }
1652}
1653
1654impl futures::Stream for HandsFreeRequestStream {
1655 type Item = Result<HandsFreeRequest, fidl::Error>;
1656
1657 fn poll_next(
1658 mut self: std::pin::Pin<&mut Self>,
1659 cx: &mut std::task::Context<'_>,
1660 ) -> std::task::Poll<Option<Self::Item>> {
1661 let this = &mut *self;
1662 if this.inner.check_shutdown(cx) {
1663 this.is_terminated = true;
1664 return std::task::Poll::Ready(None);
1665 }
1666 if this.is_terminated {
1667 panic!("polled HandsFreeRequestStream after completion");
1668 }
1669 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1670 |bytes, handles| {
1671 match this.inner.channel().read_etc(cx, bytes, handles) {
1672 std::task::Poll::Ready(Ok(())) => {}
1673 std::task::Poll::Pending => return std::task::Poll::Pending,
1674 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1675 this.is_terminated = true;
1676 return std::task::Poll::Ready(None);
1677 }
1678 std::task::Poll::Ready(Err(e)) => {
1679 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1680 e.into(),
1681 ))));
1682 }
1683 }
1684
1685 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1687
1688 std::task::Poll::Ready(Some(match header.ordinal {
1689 0x1cc503325a8bbc3f => {
1690 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1691 let mut req = fidl::new_empty!(
1692 fidl::encoding::EmptyPayload,
1693 fidl::encoding::DefaultFuchsiaResourceDialect
1694 );
1695 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1696 let control_handle = HandsFreeControlHandle { inner: this.inner.clone() };
1697 Ok(HandsFreeRequest::WatchPeerConnected {
1698 responder: HandsFreeWatchPeerConnectedResponder {
1699 control_handle: std::mem::ManuallyDrop::new(control_handle),
1700 tx_id: header.tx_id,
1701 },
1702 })
1703 }
1704 _ => Err(fidl::Error::UnknownOrdinal {
1705 ordinal: header.ordinal,
1706 protocol_name:
1707 <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1708 }),
1709 }))
1710 },
1711 )
1712 }
1713}
1714
1715#[derive(Debug)]
1716pub enum HandsFreeRequest {
1717 WatchPeerConnected { responder: HandsFreeWatchPeerConnectedResponder },
1726}
1727
1728impl HandsFreeRequest {
1729 #[allow(irrefutable_let_patterns)]
1730 pub fn into_watch_peer_connected(self) -> Option<(HandsFreeWatchPeerConnectedResponder)> {
1731 if let HandsFreeRequest::WatchPeerConnected { responder } = self {
1732 Some((responder))
1733 } else {
1734 None
1735 }
1736 }
1737
1738 pub fn method_name(&self) -> &'static str {
1740 match *self {
1741 HandsFreeRequest::WatchPeerConnected { .. } => "watch_peer_connected",
1742 }
1743 }
1744}
1745
1746#[derive(Debug, Clone)]
1747pub struct HandsFreeControlHandle {
1748 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1749}
1750
1751impl fidl::endpoints::ControlHandle for HandsFreeControlHandle {
1752 fn shutdown(&self) {
1753 self.inner.shutdown()
1754 }
1755 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1756 self.inner.shutdown_with_epitaph(status)
1757 }
1758
1759 fn is_closed(&self) -> bool {
1760 self.inner.channel().is_closed()
1761 }
1762 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1763 self.inner.channel().on_closed()
1764 }
1765
1766 #[cfg(target_os = "fuchsia")]
1767 fn signal_peer(
1768 &self,
1769 clear_mask: zx::Signals,
1770 set_mask: zx::Signals,
1771 ) -> Result<(), zx_status::Status> {
1772 use fidl::Peered;
1773 self.inner.channel().signal_peer(clear_mask, set_mask)
1774 }
1775}
1776
1777impl HandsFreeControlHandle {}
1778
1779#[must_use = "FIDL methods require a response to be sent"]
1780#[derive(Debug)]
1781pub struct HandsFreeWatchPeerConnectedResponder {
1782 control_handle: std::mem::ManuallyDrop<HandsFreeControlHandle>,
1783 tx_id: u32,
1784}
1785
1786impl std::ops::Drop for HandsFreeWatchPeerConnectedResponder {
1790 fn drop(&mut self) {
1791 self.control_handle.shutdown();
1792 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1794 }
1795}
1796
1797impl fidl::endpoints::Responder for HandsFreeWatchPeerConnectedResponder {
1798 type ControlHandle = HandsFreeControlHandle;
1799
1800 fn control_handle(&self) -> &HandsFreeControlHandle {
1801 &self.control_handle
1802 }
1803
1804 fn drop_without_shutdown(mut self) {
1805 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1807 std::mem::forget(self);
1809 }
1810}
1811
1812impl HandsFreeWatchPeerConnectedResponder {
1813 pub fn send(
1817 self,
1818 mut result: Result<
1819 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1820 i32,
1821 >,
1822 ) -> Result<(), fidl::Error> {
1823 let _result = self.send_raw(result);
1824 if _result.is_err() {
1825 self.control_handle.shutdown();
1826 }
1827 self.drop_without_shutdown();
1828 _result
1829 }
1830
1831 pub fn send_no_shutdown_on_err(
1833 self,
1834 mut result: Result<
1835 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1836 i32,
1837 >,
1838 ) -> Result<(), fidl::Error> {
1839 let _result = self.send_raw(result);
1840 self.drop_without_shutdown();
1841 _result
1842 }
1843
1844 fn send_raw(
1845 &self,
1846 mut result: Result<
1847 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1848 i32,
1849 >,
1850 ) -> Result<(), fidl::Error> {
1851 self.control_handle.inner.send::<fidl::encoding::ResultType<
1852 HandsFreeWatchPeerConnectedResponse,
1853 i32,
1854 >>(
1855 result,
1856 self.tx_id,
1857 0x1cc503325a8bbc3f,
1858 fidl::encoding::DynamicFlags::empty(),
1859 )
1860 }
1861}
1862
1863#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1864pub struct HeadsetGainMarker;
1865
1866impl fidl::endpoints::ProtocolMarker for HeadsetGainMarker {
1867 type Proxy = HeadsetGainProxy;
1868 type RequestStream = HeadsetGainRequestStream;
1869 #[cfg(target_os = "fuchsia")]
1870 type SynchronousProxy = HeadsetGainSynchronousProxy;
1871
1872 const DEBUG_NAME: &'static str = "(anonymous) HeadsetGain";
1873}
1874
1875pub trait HeadsetGainProxyInterface: Send + Sync {
1876 fn r#set_speaker_gain(&self, requested: u8) -> Result<(), fidl::Error>;
1877 type WatchSpeakerGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
1878 fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut;
1879 fn r#set_microphone_gain(&self, requested: u8) -> Result<(), fidl::Error>;
1880 type WatchMicrophoneGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>>
1881 + Send;
1882 fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut;
1883}
1884#[derive(Debug)]
1885#[cfg(target_os = "fuchsia")]
1886pub struct HeadsetGainSynchronousProxy {
1887 client: fidl::client::sync::Client,
1888}
1889
1890#[cfg(target_os = "fuchsia")]
1891impl fidl::endpoints::SynchronousProxy for HeadsetGainSynchronousProxy {
1892 type Proxy = HeadsetGainProxy;
1893 type Protocol = HeadsetGainMarker;
1894
1895 fn from_channel(inner: fidl::Channel) -> Self {
1896 Self::new(inner)
1897 }
1898
1899 fn into_channel(self) -> fidl::Channel {
1900 self.client.into_channel()
1901 }
1902
1903 fn as_channel(&self) -> &fidl::Channel {
1904 self.client.as_channel()
1905 }
1906}
1907
1908#[cfg(target_os = "fuchsia")]
1909impl HeadsetGainSynchronousProxy {
1910 pub fn new(channel: fidl::Channel) -> Self {
1911 let protocol_name = <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1912 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1913 }
1914
1915 pub fn into_channel(self) -> fidl::Channel {
1916 self.client.into_channel()
1917 }
1918
1919 pub fn wait_for_event(
1922 &self,
1923 deadline: zx::MonotonicInstant,
1924 ) -> Result<HeadsetGainEvent, fidl::Error> {
1925 HeadsetGainEvent::decode(self.client.wait_for_event(deadline)?)
1926 }
1927
1928 pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
1934 self.client.send::<HeadsetGainSetSpeakerGainRequest>(
1935 (requested,),
1936 0x3462191b2a6ae5ce,
1937 fidl::encoding::DynamicFlags::empty(),
1938 )
1939 }
1940
1941 pub fn r#watch_speaker_gain(
1946 &self,
1947 ___deadline: zx::MonotonicInstant,
1948 ) -> Result<u8, fidl::Error> {
1949 let _response = self
1950 .client
1951 .send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchSpeakerGainResponse>(
1952 (),
1953 0x2007abdf2695c747,
1954 fidl::encoding::DynamicFlags::empty(),
1955 ___deadline,
1956 )?;
1957 Ok(_response.gain)
1958 }
1959
1960 pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
1966 self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
1967 (requested,),
1968 0x7ddbb4e63caeef8e,
1969 fidl::encoding::DynamicFlags::empty(),
1970 )
1971 }
1972
1973 pub fn r#watch_microphone_gain(
1978 &self,
1979 ___deadline: zx::MonotonicInstant,
1980 ) -> Result<u8, fidl::Error> {
1981 let _response = self
1982 .client
1983 .send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchMicrophoneGainResponse>(
1984 (),
1985 0x1d171fb432fa55ad,
1986 fidl::encoding::DynamicFlags::empty(),
1987 ___deadline,
1988 )?;
1989 Ok(_response.gain)
1990 }
1991}
1992
1993#[cfg(target_os = "fuchsia")]
1994impl From<HeadsetGainSynchronousProxy> for zx::Handle {
1995 fn from(value: HeadsetGainSynchronousProxy) -> Self {
1996 value.into_channel().into()
1997 }
1998}
1999
2000#[cfg(target_os = "fuchsia")]
2001impl From<fidl::Channel> for HeadsetGainSynchronousProxy {
2002 fn from(value: fidl::Channel) -> Self {
2003 Self::new(value)
2004 }
2005}
2006
2007#[cfg(target_os = "fuchsia")]
2008impl fidl::endpoints::FromClient for HeadsetGainSynchronousProxy {
2009 type Protocol = HeadsetGainMarker;
2010
2011 fn from_client(value: fidl::endpoints::ClientEnd<HeadsetGainMarker>) -> Self {
2012 Self::new(value.into_channel())
2013 }
2014}
2015
2016#[derive(Debug, Clone)]
2017pub struct HeadsetGainProxy {
2018 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2019}
2020
2021impl fidl::endpoints::Proxy for HeadsetGainProxy {
2022 type Protocol = HeadsetGainMarker;
2023
2024 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2025 Self::new(inner)
2026 }
2027
2028 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2029 self.client.into_channel().map_err(|client| Self { client })
2030 }
2031
2032 fn as_channel(&self) -> &::fidl::AsyncChannel {
2033 self.client.as_channel()
2034 }
2035}
2036
2037impl HeadsetGainProxy {
2038 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2040 let protocol_name = <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2041 Self { client: fidl::client::Client::new(channel, protocol_name) }
2042 }
2043
2044 pub fn take_event_stream(&self) -> HeadsetGainEventStream {
2050 HeadsetGainEventStream { event_receiver: self.client.take_event_receiver() }
2051 }
2052
2053 pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2059 HeadsetGainProxyInterface::r#set_speaker_gain(self, requested)
2060 }
2061
2062 pub fn r#watch_speaker_gain(
2067 &self,
2068 ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
2069 HeadsetGainProxyInterface::r#watch_speaker_gain(self)
2070 }
2071
2072 pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2078 HeadsetGainProxyInterface::r#set_microphone_gain(self, requested)
2079 }
2080
2081 pub fn r#watch_microphone_gain(
2086 &self,
2087 ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
2088 HeadsetGainProxyInterface::r#watch_microphone_gain(self)
2089 }
2090}
2091
2092impl HeadsetGainProxyInterface for HeadsetGainProxy {
2093 fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2094 self.client.send::<HeadsetGainSetSpeakerGainRequest>(
2095 (requested,),
2096 0x3462191b2a6ae5ce,
2097 fidl::encoding::DynamicFlags::empty(),
2098 )
2099 }
2100
2101 type WatchSpeakerGainResponseFut =
2102 fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
2103 fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut {
2104 fn _decode(
2105 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2106 ) -> Result<u8, fidl::Error> {
2107 let _response = fidl::client::decode_transaction_body::<
2108 HeadsetGainWatchSpeakerGainResponse,
2109 fidl::encoding::DefaultFuchsiaResourceDialect,
2110 0x2007abdf2695c747,
2111 >(_buf?)?;
2112 Ok(_response.gain)
2113 }
2114 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
2115 (),
2116 0x2007abdf2695c747,
2117 fidl::encoding::DynamicFlags::empty(),
2118 _decode,
2119 )
2120 }
2121
2122 fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2123 self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
2124 (requested,),
2125 0x7ddbb4e63caeef8e,
2126 fidl::encoding::DynamicFlags::empty(),
2127 )
2128 }
2129
2130 type WatchMicrophoneGainResponseFut =
2131 fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
2132 fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut {
2133 fn _decode(
2134 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2135 ) -> Result<u8, fidl::Error> {
2136 let _response = fidl::client::decode_transaction_body::<
2137 HeadsetGainWatchMicrophoneGainResponse,
2138 fidl::encoding::DefaultFuchsiaResourceDialect,
2139 0x1d171fb432fa55ad,
2140 >(_buf?)?;
2141 Ok(_response.gain)
2142 }
2143 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
2144 (),
2145 0x1d171fb432fa55ad,
2146 fidl::encoding::DynamicFlags::empty(),
2147 _decode,
2148 )
2149 }
2150}
2151
2152pub struct HeadsetGainEventStream {
2153 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2154}
2155
2156impl std::marker::Unpin for HeadsetGainEventStream {}
2157
2158impl futures::stream::FusedStream for HeadsetGainEventStream {
2159 fn is_terminated(&self) -> bool {
2160 self.event_receiver.is_terminated()
2161 }
2162}
2163
2164impl futures::Stream for HeadsetGainEventStream {
2165 type Item = Result<HeadsetGainEvent, fidl::Error>;
2166
2167 fn poll_next(
2168 mut self: std::pin::Pin<&mut Self>,
2169 cx: &mut std::task::Context<'_>,
2170 ) -> std::task::Poll<Option<Self::Item>> {
2171 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2172 &mut self.event_receiver,
2173 cx
2174 )?) {
2175 Some(buf) => std::task::Poll::Ready(Some(HeadsetGainEvent::decode(buf))),
2176 None => std::task::Poll::Ready(None),
2177 }
2178 }
2179}
2180
2181#[derive(Debug)]
2182pub enum HeadsetGainEvent {}
2183
2184impl HeadsetGainEvent {
2185 fn decode(
2187 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2188 ) -> Result<HeadsetGainEvent, fidl::Error> {
2189 let (bytes, _handles) = buf.split_mut();
2190 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2191 debug_assert_eq!(tx_header.tx_id, 0);
2192 match tx_header.ordinal {
2193 _ => Err(fidl::Error::UnknownOrdinal {
2194 ordinal: tx_header.ordinal,
2195 protocol_name: <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2196 }),
2197 }
2198 }
2199}
2200
2201pub struct HeadsetGainRequestStream {
2203 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2204 is_terminated: bool,
2205}
2206
2207impl std::marker::Unpin for HeadsetGainRequestStream {}
2208
2209impl futures::stream::FusedStream for HeadsetGainRequestStream {
2210 fn is_terminated(&self) -> bool {
2211 self.is_terminated
2212 }
2213}
2214
2215impl fidl::endpoints::RequestStream for HeadsetGainRequestStream {
2216 type Protocol = HeadsetGainMarker;
2217 type ControlHandle = HeadsetGainControlHandle;
2218
2219 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2220 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2221 }
2222
2223 fn control_handle(&self) -> Self::ControlHandle {
2224 HeadsetGainControlHandle { inner: self.inner.clone() }
2225 }
2226
2227 fn into_inner(
2228 self,
2229 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2230 {
2231 (self.inner, self.is_terminated)
2232 }
2233
2234 fn from_inner(
2235 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2236 is_terminated: bool,
2237 ) -> Self {
2238 Self { inner, is_terminated }
2239 }
2240}
2241
2242impl futures::Stream for HeadsetGainRequestStream {
2243 type Item = Result<HeadsetGainRequest, fidl::Error>;
2244
2245 fn poll_next(
2246 mut self: std::pin::Pin<&mut Self>,
2247 cx: &mut std::task::Context<'_>,
2248 ) -> std::task::Poll<Option<Self::Item>> {
2249 let this = &mut *self;
2250 if this.inner.check_shutdown(cx) {
2251 this.is_terminated = true;
2252 return std::task::Poll::Ready(None);
2253 }
2254 if this.is_terminated {
2255 panic!("polled HeadsetGainRequestStream after completion");
2256 }
2257 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2258 |bytes, handles| {
2259 match this.inner.channel().read_etc(cx, bytes, handles) {
2260 std::task::Poll::Ready(Ok(())) => {}
2261 std::task::Poll::Pending => return std::task::Poll::Pending,
2262 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2263 this.is_terminated = true;
2264 return std::task::Poll::Ready(None);
2265 }
2266 std::task::Poll::Ready(Err(e)) => {
2267 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2268 e.into(),
2269 ))));
2270 }
2271 }
2272
2273 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2275
2276 std::task::Poll::Ready(Some(match header.ordinal {
2277 0x3462191b2a6ae5ce => {
2278 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2279 let mut req = fidl::new_empty!(
2280 HeadsetGainSetSpeakerGainRequest,
2281 fidl::encoding::DefaultFuchsiaResourceDialect
2282 );
2283 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetSpeakerGainRequest>(&header, _body_bytes, handles, &mut req)?;
2284 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2285 Ok(HeadsetGainRequest::SetSpeakerGain {
2286 requested: req.requested,
2287
2288 control_handle,
2289 })
2290 }
2291 0x2007abdf2695c747 => {
2292 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2293 let mut req = fidl::new_empty!(
2294 fidl::encoding::EmptyPayload,
2295 fidl::encoding::DefaultFuchsiaResourceDialect
2296 );
2297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2298 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2299 Ok(HeadsetGainRequest::WatchSpeakerGain {
2300 responder: HeadsetGainWatchSpeakerGainResponder {
2301 control_handle: std::mem::ManuallyDrop::new(control_handle),
2302 tx_id: header.tx_id,
2303 },
2304 })
2305 }
2306 0x7ddbb4e63caeef8e => {
2307 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2308 let mut req = fidl::new_empty!(
2309 HeadsetGainSetMicrophoneGainRequest,
2310 fidl::encoding::DefaultFuchsiaResourceDialect
2311 );
2312 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetMicrophoneGainRequest>(&header, _body_bytes, handles, &mut req)?;
2313 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2314 Ok(HeadsetGainRequest::SetMicrophoneGain {
2315 requested: req.requested,
2316
2317 control_handle,
2318 })
2319 }
2320 0x1d171fb432fa55ad => {
2321 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2322 let mut req = fidl::new_empty!(
2323 fidl::encoding::EmptyPayload,
2324 fidl::encoding::DefaultFuchsiaResourceDialect
2325 );
2326 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2327 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2328 Ok(HeadsetGainRequest::WatchMicrophoneGain {
2329 responder: HeadsetGainWatchMicrophoneGainResponder {
2330 control_handle: std::mem::ManuallyDrop::new(control_handle),
2331 tx_id: header.tx_id,
2332 },
2333 })
2334 }
2335 _ => Err(fidl::Error::UnknownOrdinal {
2336 ordinal: header.ordinal,
2337 protocol_name:
2338 <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2339 }),
2340 }))
2341 },
2342 )
2343 }
2344}
2345
2346#[derive(Debug)]
2370pub enum HeadsetGainRequest {
2371 SetSpeakerGain { requested: u8, control_handle: HeadsetGainControlHandle },
2377 WatchSpeakerGain { responder: HeadsetGainWatchSpeakerGainResponder },
2382 SetMicrophoneGain { requested: u8, control_handle: HeadsetGainControlHandle },
2388 WatchMicrophoneGain { responder: HeadsetGainWatchMicrophoneGainResponder },
2393}
2394
2395impl HeadsetGainRequest {
2396 #[allow(irrefutable_let_patterns)]
2397 pub fn into_set_speaker_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
2398 if let HeadsetGainRequest::SetSpeakerGain { requested, control_handle } = self {
2399 Some((requested, control_handle))
2400 } else {
2401 None
2402 }
2403 }
2404
2405 #[allow(irrefutable_let_patterns)]
2406 pub fn into_watch_speaker_gain(self) -> Option<(HeadsetGainWatchSpeakerGainResponder)> {
2407 if let HeadsetGainRequest::WatchSpeakerGain { responder } = self {
2408 Some((responder))
2409 } else {
2410 None
2411 }
2412 }
2413
2414 #[allow(irrefutable_let_patterns)]
2415 pub fn into_set_microphone_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
2416 if let HeadsetGainRequest::SetMicrophoneGain { requested, control_handle } = self {
2417 Some((requested, control_handle))
2418 } else {
2419 None
2420 }
2421 }
2422
2423 #[allow(irrefutable_let_patterns)]
2424 pub fn into_watch_microphone_gain(self) -> Option<(HeadsetGainWatchMicrophoneGainResponder)> {
2425 if let HeadsetGainRequest::WatchMicrophoneGain { responder } = self {
2426 Some((responder))
2427 } else {
2428 None
2429 }
2430 }
2431
2432 pub fn method_name(&self) -> &'static str {
2434 match *self {
2435 HeadsetGainRequest::SetSpeakerGain { .. } => "set_speaker_gain",
2436 HeadsetGainRequest::WatchSpeakerGain { .. } => "watch_speaker_gain",
2437 HeadsetGainRequest::SetMicrophoneGain { .. } => "set_microphone_gain",
2438 HeadsetGainRequest::WatchMicrophoneGain { .. } => "watch_microphone_gain",
2439 }
2440 }
2441}
2442
2443#[derive(Debug, Clone)]
2444pub struct HeadsetGainControlHandle {
2445 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2446}
2447
2448impl fidl::endpoints::ControlHandle for HeadsetGainControlHandle {
2449 fn shutdown(&self) {
2450 self.inner.shutdown()
2451 }
2452 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2453 self.inner.shutdown_with_epitaph(status)
2454 }
2455
2456 fn is_closed(&self) -> bool {
2457 self.inner.channel().is_closed()
2458 }
2459 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2460 self.inner.channel().on_closed()
2461 }
2462
2463 #[cfg(target_os = "fuchsia")]
2464 fn signal_peer(
2465 &self,
2466 clear_mask: zx::Signals,
2467 set_mask: zx::Signals,
2468 ) -> Result<(), zx_status::Status> {
2469 use fidl::Peered;
2470 self.inner.channel().signal_peer(clear_mask, set_mask)
2471 }
2472}
2473
2474impl HeadsetGainControlHandle {}
2475
2476#[must_use = "FIDL methods require a response to be sent"]
2477#[derive(Debug)]
2478pub struct HeadsetGainWatchSpeakerGainResponder {
2479 control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
2480 tx_id: u32,
2481}
2482
2483impl std::ops::Drop for HeadsetGainWatchSpeakerGainResponder {
2487 fn drop(&mut self) {
2488 self.control_handle.shutdown();
2489 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2491 }
2492}
2493
2494impl fidl::endpoints::Responder for HeadsetGainWatchSpeakerGainResponder {
2495 type ControlHandle = HeadsetGainControlHandle;
2496
2497 fn control_handle(&self) -> &HeadsetGainControlHandle {
2498 &self.control_handle
2499 }
2500
2501 fn drop_without_shutdown(mut self) {
2502 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2504 std::mem::forget(self);
2506 }
2507}
2508
2509impl HeadsetGainWatchSpeakerGainResponder {
2510 pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
2514 let _result = self.send_raw(gain);
2515 if _result.is_err() {
2516 self.control_handle.shutdown();
2517 }
2518 self.drop_without_shutdown();
2519 _result
2520 }
2521
2522 pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
2524 let _result = self.send_raw(gain);
2525 self.drop_without_shutdown();
2526 _result
2527 }
2528
2529 fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
2530 self.control_handle.inner.send::<HeadsetGainWatchSpeakerGainResponse>(
2531 (gain,),
2532 self.tx_id,
2533 0x2007abdf2695c747,
2534 fidl::encoding::DynamicFlags::empty(),
2535 )
2536 }
2537}
2538
2539#[must_use = "FIDL methods require a response to be sent"]
2540#[derive(Debug)]
2541pub struct HeadsetGainWatchMicrophoneGainResponder {
2542 control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
2543 tx_id: u32,
2544}
2545
2546impl std::ops::Drop for HeadsetGainWatchMicrophoneGainResponder {
2550 fn drop(&mut self) {
2551 self.control_handle.shutdown();
2552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2554 }
2555}
2556
2557impl fidl::endpoints::Responder for HeadsetGainWatchMicrophoneGainResponder {
2558 type ControlHandle = HeadsetGainControlHandle;
2559
2560 fn control_handle(&self) -> &HeadsetGainControlHandle {
2561 &self.control_handle
2562 }
2563
2564 fn drop_without_shutdown(mut self) {
2565 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2567 std::mem::forget(self);
2569 }
2570}
2571
2572impl HeadsetGainWatchMicrophoneGainResponder {
2573 pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
2577 let _result = self.send_raw(gain);
2578 if _result.is_err() {
2579 self.control_handle.shutdown();
2580 }
2581 self.drop_without_shutdown();
2582 _result
2583 }
2584
2585 pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
2587 let _result = self.send_raw(gain);
2588 self.drop_without_shutdown();
2589 _result
2590 }
2591
2592 fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
2593 self.control_handle.inner.send::<HeadsetGainWatchMicrophoneGainResponse>(
2594 (gain,),
2595 self.tx_id,
2596 0x1d171fb432fa55ad,
2597 fidl::encoding::DynamicFlags::empty(),
2598 )
2599 }
2600}
2601
2602#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2603pub struct HfpMarker;
2604
2605impl fidl::endpoints::ProtocolMarker for HfpMarker {
2606 type Proxy = HfpProxy;
2607 type RequestStream = HfpRequestStream;
2608 #[cfg(target_os = "fuchsia")]
2609 type SynchronousProxy = HfpSynchronousProxy;
2610
2611 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.Hfp";
2612}
2613impl fidl::endpoints::DiscoverableProtocolMarker for HfpMarker {}
2614
2615pub trait HfpProxyInterface: Send + Sync {
2616 fn r#register(
2617 &self,
2618 manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2619 ) -> Result<(), fidl::Error>;
2620}
2621#[derive(Debug)]
2622#[cfg(target_os = "fuchsia")]
2623pub struct HfpSynchronousProxy {
2624 client: fidl::client::sync::Client,
2625}
2626
2627#[cfg(target_os = "fuchsia")]
2628impl fidl::endpoints::SynchronousProxy for HfpSynchronousProxy {
2629 type Proxy = HfpProxy;
2630 type Protocol = HfpMarker;
2631
2632 fn from_channel(inner: fidl::Channel) -> Self {
2633 Self::new(inner)
2634 }
2635
2636 fn into_channel(self) -> fidl::Channel {
2637 self.client.into_channel()
2638 }
2639
2640 fn as_channel(&self) -> &fidl::Channel {
2641 self.client.as_channel()
2642 }
2643}
2644
2645#[cfg(target_os = "fuchsia")]
2646impl HfpSynchronousProxy {
2647 pub fn new(channel: fidl::Channel) -> Self {
2648 let protocol_name = <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2649 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2650 }
2651
2652 pub fn into_channel(self) -> fidl::Channel {
2653 self.client.into_channel()
2654 }
2655
2656 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<HfpEvent, fidl::Error> {
2659 HfpEvent::decode(self.client.wait_for_event(deadline)?)
2660 }
2661
2662 pub fn r#register(
2670 &self,
2671 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2672 ) -> Result<(), fidl::Error> {
2673 self.client.send::<HfpRegisterRequest>(
2674 (manager,),
2675 0x1b2ea4f6069181ad,
2676 fidl::encoding::DynamicFlags::empty(),
2677 )
2678 }
2679}
2680
2681#[cfg(target_os = "fuchsia")]
2682impl From<HfpSynchronousProxy> for zx::Handle {
2683 fn from(value: HfpSynchronousProxy) -> Self {
2684 value.into_channel().into()
2685 }
2686}
2687
2688#[cfg(target_os = "fuchsia")]
2689impl From<fidl::Channel> for HfpSynchronousProxy {
2690 fn from(value: fidl::Channel) -> Self {
2691 Self::new(value)
2692 }
2693}
2694
2695#[cfg(target_os = "fuchsia")]
2696impl fidl::endpoints::FromClient for HfpSynchronousProxy {
2697 type Protocol = HfpMarker;
2698
2699 fn from_client(value: fidl::endpoints::ClientEnd<HfpMarker>) -> Self {
2700 Self::new(value.into_channel())
2701 }
2702}
2703
2704#[derive(Debug, Clone)]
2705pub struct HfpProxy {
2706 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2707}
2708
2709impl fidl::endpoints::Proxy for HfpProxy {
2710 type Protocol = HfpMarker;
2711
2712 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2713 Self::new(inner)
2714 }
2715
2716 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2717 self.client.into_channel().map_err(|client| Self { client })
2718 }
2719
2720 fn as_channel(&self) -> &::fidl::AsyncChannel {
2721 self.client.as_channel()
2722 }
2723}
2724
2725impl HfpProxy {
2726 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2728 let protocol_name = <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2729 Self { client: fidl::client::Client::new(channel, protocol_name) }
2730 }
2731
2732 pub fn take_event_stream(&self) -> HfpEventStream {
2738 HfpEventStream { event_receiver: self.client.take_event_receiver() }
2739 }
2740
2741 pub fn r#register(
2749 &self,
2750 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2751 ) -> Result<(), fidl::Error> {
2752 HfpProxyInterface::r#register(self, manager)
2753 }
2754}
2755
2756impl HfpProxyInterface for HfpProxy {
2757 fn r#register(
2758 &self,
2759 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2760 ) -> Result<(), fidl::Error> {
2761 self.client.send::<HfpRegisterRequest>(
2762 (manager,),
2763 0x1b2ea4f6069181ad,
2764 fidl::encoding::DynamicFlags::empty(),
2765 )
2766 }
2767}
2768
2769pub struct HfpEventStream {
2770 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2771}
2772
2773impl std::marker::Unpin for HfpEventStream {}
2774
2775impl futures::stream::FusedStream for HfpEventStream {
2776 fn is_terminated(&self) -> bool {
2777 self.event_receiver.is_terminated()
2778 }
2779}
2780
2781impl futures::Stream for HfpEventStream {
2782 type Item = Result<HfpEvent, fidl::Error>;
2783
2784 fn poll_next(
2785 mut self: std::pin::Pin<&mut Self>,
2786 cx: &mut std::task::Context<'_>,
2787 ) -> std::task::Poll<Option<Self::Item>> {
2788 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2789 &mut self.event_receiver,
2790 cx
2791 )?) {
2792 Some(buf) => std::task::Poll::Ready(Some(HfpEvent::decode(buf))),
2793 None => std::task::Poll::Ready(None),
2794 }
2795 }
2796}
2797
2798#[derive(Debug)]
2799pub enum HfpEvent {}
2800
2801impl HfpEvent {
2802 fn decode(
2804 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2805 ) -> Result<HfpEvent, fidl::Error> {
2806 let (bytes, _handles) = buf.split_mut();
2807 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2808 debug_assert_eq!(tx_header.tx_id, 0);
2809 match tx_header.ordinal {
2810 _ => Err(fidl::Error::UnknownOrdinal {
2811 ordinal: tx_header.ordinal,
2812 protocol_name: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2813 }),
2814 }
2815 }
2816}
2817
2818pub struct HfpRequestStream {
2820 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2821 is_terminated: bool,
2822}
2823
2824impl std::marker::Unpin for HfpRequestStream {}
2825
2826impl futures::stream::FusedStream for HfpRequestStream {
2827 fn is_terminated(&self) -> bool {
2828 self.is_terminated
2829 }
2830}
2831
2832impl fidl::endpoints::RequestStream for HfpRequestStream {
2833 type Protocol = HfpMarker;
2834 type ControlHandle = HfpControlHandle;
2835
2836 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2837 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2838 }
2839
2840 fn control_handle(&self) -> Self::ControlHandle {
2841 HfpControlHandle { inner: self.inner.clone() }
2842 }
2843
2844 fn into_inner(
2845 self,
2846 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2847 {
2848 (self.inner, self.is_terminated)
2849 }
2850
2851 fn from_inner(
2852 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2853 is_terminated: bool,
2854 ) -> Self {
2855 Self { inner, is_terminated }
2856 }
2857}
2858
2859impl futures::Stream for HfpRequestStream {
2860 type Item = Result<HfpRequest, fidl::Error>;
2861
2862 fn poll_next(
2863 mut self: std::pin::Pin<&mut Self>,
2864 cx: &mut std::task::Context<'_>,
2865 ) -> std::task::Poll<Option<Self::Item>> {
2866 let this = &mut *self;
2867 if this.inner.check_shutdown(cx) {
2868 this.is_terminated = true;
2869 return std::task::Poll::Ready(None);
2870 }
2871 if this.is_terminated {
2872 panic!("polled HfpRequestStream after completion");
2873 }
2874 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2875 |bytes, handles| {
2876 match this.inner.channel().read_etc(cx, bytes, handles) {
2877 std::task::Poll::Ready(Ok(())) => {}
2878 std::task::Poll::Pending => return std::task::Poll::Pending,
2879 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2880 this.is_terminated = true;
2881 return std::task::Poll::Ready(None);
2882 }
2883 std::task::Poll::Ready(Err(e)) => {
2884 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2885 e.into(),
2886 ))));
2887 }
2888 }
2889
2890 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2892
2893 std::task::Poll::Ready(Some(match header.ordinal {
2894 0x1b2ea4f6069181ad => {
2895 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2896 let mut req = fidl::new_empty!(
2897 HfpRegisterRequest,
2898 fidl::encoding::DefaultFuchsiaResourceDialect
2899 );
2900 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HfpRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
2901 let control_handle = HfpControlHandle { inner: this.inner.clone() };
2902 Ok(HfpRequest::Register { manager: req.manager, control_handle })
2903 }
2904 _ => Err(fidl::Error::UnknownOrdinal {
2905 ordinal: header.ordinal,
2906 protocol_name: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2907 }),
2908 }))
2909 },
2910 )
2911 }
2912}
2913
2914#[derive(Debug)]
2915pub enum HfpRequest {
2916 Register {
2924 manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2925 control_handle: HfpControlHandle,
2926 },
2927}
2928
2929impl HfpRequest {
2930 #[allow(irrefutable_let_patterns)]
2931 pub fn into_register(
2932 self,
2933 ) -> Option<(fidl::endpoints::ClientEnd<CallManagerMarker>, HfpControlHandle)> {
2934 if let HfpRequest::Register { manager, control_handle } = self {
2935 Some((manager, control_handle))
2936 } else {
2937 None
2938 }
2939 }
2940
2941 pub fn method_name(&self) -> &'static str {
2943 match *self {
2944 HfpRequest::Register { .. } => "register",
2945 }
2946 }
2947}
2948
2949#[derive(Debug, Clone)]
2950pub struct HfpControlHandle {
2951 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2952}
2953
2954impl fidl::endpoints::ControlHandle for HfpControlHandle {
2955 fn shutdown(&self) {
2956 self.inner.shutdown()
2957 }
2958 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2959 self.inner.shutdown_with_epitaph(status)
2960 }
2961
2962 fn is_closed(&self) -> bool {
2963 self.inner.channel().is_closed()
2964 }
2965 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2966 self.inner.channel().on_closed()
2967 }
2968
2969 #[cfg(target_os = "fuchsia")]
2970 fn signal_peer(
2971 &self,
2972 clear_mask: zx::Signals,
2973 set_mask: zx::Signals,
2974 ) -> Result<(), zx_status::Status> {
2975 use fidl::Peered;
2976 self.inner.channel().signal_peer(clear_mask, set_mask)
2977 }
2978}
2979
2980impl HfpControlHandle {}
2981
2982#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2983pub struct PeerHandlerMarker;
2984
2985impl fidl::endpoints::ProtocolMarker for PeerHandlerMarker {
2986 type Proxy = PeerHandlerProxy;
2987 type RequestStream = PeerHandlerRequestStream;
2988 #[cfg(target_os = "fuchsia")]
2989 type SynchronousProxy = PeerHandlerSynchronousProxy;
2990
2991 const DEBUG_NAME: &'static str = "(anonymous) PeerHandler";
2992}
2993pub type PeerHandlerRequestOutgoingCallResult = Result<(), i32>;
2994pub type PeerHandlerSetNrecModeResult = Result<(), i32>;
2995
2996pub trait PeerHandlerProxyInterface: Send + Sync {
2997 type WatchNetworkInformationResponseFut: std::future::Future<Output = Result<NetworkInformation, fidl::Error>>
2998 + Send;
2999 fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut;
3000 type WatchNextCallResponseFut: std::future::Future<Output = Result<NextCall, fidl::Error>>
3001 + Send;
3002 fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut;
3003 type RequestOutgoingCallResponseFut: std::future::Future<Output = Result<PeerHandlerRequestOutgoingCallResult, fidl::Error>>
3004 + Send;
3005 fn r#request_outgoing_call(&self, action: &CallAction) -> Self::RequestOutgoingCallResponseFut;
3006 type QueryOperatorResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
3007 + Send;
3008 fn r#query_operator(&self) -> Self::QueryOperatorResponseFut;
3009 type SubscriberNumberInformationResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
3010 + Send;
3011 fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut;
3012 type SetNrecModeResponseFut: std::future::Future<Output = Result<PeerHandlerSetNrecModeResult, fidl::Error>>
3013 + Send;
3014 fn r#set_nrec_mode(&self, enabled: bool) -> Self::SetNrecModeResponseFut;
3015 fn r#report_headset_battery_level(&self, level: u8) -> Result<(), fidl::Error>;
3016 fn r#gain_control(
3017 &self,
3018 control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3019 ) -> Result<(), fidl::Error>;
3020}
3021#[derive(Debug)]
3022#[cfg(target_os = "fuchsia")]
3023pub struct PeerHandlerSynchronousProxy {
3024 client: fidl::client::sync::Client,
3025}
3026
3027#[cfg(target_os = "fuchsia")]
3028impl fidl::endpoints::SynchronousProxy for PeerHandlerSynchronousProxy {
3029 type Proxy = PeerHandlerProxy;
3030 type Protocol = PeerHandlerMarker;
3031
3032 fn from_channel(inner: fidl::Channel) -> Self {
3033 Self::new(inner)
3034 }
3035
3036 fn into_channel(self) -> fidl::Channel {
3037 self.client.into_channel()
3038 }
3039
3040 fn as_channel(&self) -> &fidl::Channel {
3041 self.client.as_channel()
3042 }
3043}
3044
3045#[cfg(target_os = "fuchsia")]
3046impl PeerHandlerSynchronousProxy {
3047 pub fn new(channel: fidl::Channel) -> Self {
3048 let protocol_name = <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3049 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3050 }
3051
3052 pub fn into_channel(self) -> fidl::Channel {
3053 self.client.into_channel()
3054 }
3055
3056 pub fn wait_for_event(
3059 &self,
3060 deadline: zx::MonotonicInstant,
3061 ) -> Result<PeerHandlerEvent, fidl::Error> {
3062 PeerHandlerEvent::decode(self.client.wait_for_event(deadline)?)
3063 }
3064
3065 pub fn r#watch_network_information(
3076 &self,
3077 ___deadline: zx::MonotonicInstant,
3078 ) -> Result<NetworkInformation, fidl::Error> {
3079 let _response = self
3080 .client
3081 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNetworkInformationResponse>(
3082 (),
3083 0x1c9eba597076b7cb,
3084 fidl::encoding::DynamicFlags::empty(),
3085 ___deadline,
3086 )?;
3087 Ok(_response.update)
3088 }
3089
3090 pub fn r#watch_next_call(
3095 &self,
3096 ___deadline: zx::MonotonicInstant,
3097 ) -> Result<NextCall, fidl::Error> {
3098 let _response = self
3099 .client
3100 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNextCallResponse>(
3101 (),
3102 0x5e3b7b4e7c3d359,
3103 fidl::encoding::DynamicFlags::empty(),
3104 ___deadline,
3105 )?;
3106 Ok(_response.call)
3107 }
3108
3109 pub fn r#request_outgoing_call(
3122 &self,
3123 mut action: &CallAction,
3124 ___deadline: zx::MonotonicInstant,
3125 ) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
3126 let _response = self.client.send_query::<
3127 PeerHandlerRequestOutgoingCallRequest,
3128 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3129 >(
3130 (action,),
3131 0x1a2637c743c89ad,
3132 fidl::encoding::DynamicFlags::empty(),
3133 ___deadline,
3134 )?;
3135 Ok(_response.map(|x| x))
3136 }
3137
3138 pub fn r#query_operator(
3142 &self,
3143 ___deadline: zx::MonotonicInstant,
3144 ) -> Result<Option<String>, fidl::Error> {
3145 let _response = self
3146 .client
3147 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerQueryOperatorResponse>(
3148 (),
3149 0x1217eaf5db4c3300,
3150 fidl::encoding::DynamicFlags::empty(),
3151 ___deadline,
3152 )?;
3153 Ok(_response.operator)
3154 }
3155
3156 pub fn r#subscriber_number_information(
3160 &self,
3161 ___deadline: zx::MonotonicInstant,
3162 ) -> Result<Vec<String>, fidl::Error> {
3163 let _response = self.client.send_query::<
3164 fidl::encoding::EmptyPayload,
3165 PeerHandlerSubscriberNumberInformationResponse,
3166 >(
3167 (),
3168 0x15f5235855b02a3a,
3169 fidl::encoding::DynamicFlags::empty(),
3170 ___deadline,
3171 )?;
3172 Ok(_response.numbers)
3173 }
3174
3175 pub fn r#set_nrec_mode(
3180 &self,
3181 mut enabled: bool,
3182 ___deadline: zx::MonotonicInstant,
3183 ) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
3184 let _response = self.client.send_query::<
3185 PeerHandlerSetNrecModeRequest,
3186 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3187 >(
3188 (enabled,),
3189 0x2f8890d0f866672f,
3190 fidl::encoding::DynamicFlags::empty(),
3191 ___deadline,
3192 )?;
3193 Ok(_response.map(|x| x))
3194 }
3195
3196 pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3199 self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
3200 (level,),
3201 0x4e3e8be4680d85b,
3202 fidl::encoding::DynamicFlags::empty(),
3203 )
3204 }
3205
3206 pub fn r#gain_control(
3213 &self,
3214 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3215 ) -> Result<(), fidl::Error> {
3216 self.client.send::<PeerHandlerGainControlRequest>(
3217 (control,),
3218 0x6e043b6d2e0fb917,
3219 fidl::encoding::DynamicFlags::empty(),
3220 )
3221 }
3222}
3223
3224#[cfg(target_os = "fuchsia")]
3225impl From<PeerHandlerSynchronousProxy> for zx::Handle {
3226 fn from(value: PeerHandlerSynchronousProxy) -> Self {
3227 value.into_channel().into()
3228 }
3229}
3230
3231#[cfg(target_os = "fuchsia")]
3232impl From<fidl::Channel> for PeerHandlerSynchronousProxy {
3233 fn from(value: fidl::Channel) -> Self {
3234 Self::new(value)
3235 }
3236}
3237
3238#[cfg(target_os = "fuchsia")]
3239impl fidl::endpoints::FromClient for PeerHandlerSynchronousProxy {
3240 type Protocol = PeerHandlerMarker;
3241
3242 fn from_client(value: fidl::endpoints::ClientEnd<PeerHandlerMarker>) -> Self {
3243 Self::new(value.into_channel())
3244 }
3245}
3246
3247#[derive(Debug, Clone)]
3248pub struct PeerHandlerProxy {
3249 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3250}
3251
3252impl fidl::endpoints::Proxy for PeerHandlerProxy {
3253 type Protocol = PeerHandlerMarker;
3254
3255 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3256 Self::new(inner)
3257 }
3258
3259 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3260 self.client.into_channel().map_err(|client| Self { client })
3261 }
3262
3263 fn as_channel(&self) -> &::fidl::AsyncChannel {
3264 self.client.as_channel()
3265 }
3266}
3267
3268impl PeerHandlerProxy {
3269 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3271 let protocol_name = <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3272 Self { client: fidl::client::Client::new(channel, protocol_name) }
3273 }
3274
3275 pub fn take_event_stream(&self) -> PeerHandlerEventStream {
3281 PeerHandlerEventStream { event_receiver: self.client.take_event_receiver() }
3282 }
3283
3284 pub fn r#watch_network_information(
3295 &self,
3296 ) -> fidl::client::QueryResponseFut<
3297 NetworkInformation,
3298 fidl::encoding::DefaultFuchsiaResourceDialect,
3299 > {
3300 PeerHandlerProxyInterface::r#watch_network_information(self)
3301 }
3302
3303 pub fn r#watch_next_call(
3308 &self,
3309 ) -> fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
3310 {
3311 PeerHandlerProxyInterface::r#watch_next_call(self)
3312 }
3313
3314 pub fn r#request_outgoing_call(
3327 &self,
3328 mut action: &CallAction,
3329 ) -> fidl::client::QueryResponseFut<
3330 PeerHandlerRequestOutgoingCallResult,
3331 fidl::encoding::DefaultFuchsiaResourceDialect,
3332 > {
3333 PeerHandlerProxyInterface::r#request_outgoing_call(self, action)
3334 }
3335
3336 pub fn r#query_operator(
3340 &self,
3341 ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
3342 {
3343 PeerHandlerProxyInterface::r#query_operator(self)
3344 }
3345
3346 pub fn r#subscriber_number_information(
3350 &self,
3351 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
3352 {
3353 PeerHandlerProxyInterface::r#subscriber_number_information(self)
3354 }
3355
3356 pub fn r#set_nrec_mode(
3361 &self,
3362 mut enabled: bool,
3363 ) -> fidl::client::QueryResponseFut<
3364 PeerHandlerSetNrecModeResult,
3365 fidl::encoding::DefaultFuchsiaResourceDialect,
3366 > {
3367 PeerHandlerProxyInterface::r#set_nrec_mode(self, enabled)
3368 }
3369
3370 pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3373 PeerHandlerProxyInterface::r#report_headset_battery_level(self, level)
3374 }
3375
3376 pub fn r#gain_control(
3383 &self,
3384 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3385 ) -> Result<(), fidl::Error> {
3386 PeerHandlerProxyInterface::r#gain_control(self, control)
3387 }
3388}
3389
3390impl PeerHandlerProxyInterface for PeerHandlerProxy {
3391 type WatchNetworkInformationResponseFut = fidl::client::QueryResponseFut<
3392 NetworkInformation,
3393 fidl::encoding::DefaultFuchsiaResourceDialect,
3394 >;
3395 fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut {
3396 fn _decode(
3397 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3398 ) -> Result<NetworkInformation, fidl::Error> {
3399 let _response = fidl::client::decode_transaction_body::<
3400 PeerHandlerWatchNetworkInformationResponse,
3401 fidl::encoding::DefaultFuchsiaResourceDialect,
3402 0x1c9eba597076b7cb,
3403 >(_buf?)?;
3404 Ok(_response.update)
3405 }
3406 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NetworkInformation>(
3407 (),
3408 0x1c9eba597076b7cb,
3409 fidl::encoding::DynamicFlags::empty(),
3410 _decode,
3411 )
3412 }
3413
3414 type WatchNextCallResponseFut =
3415 fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>;
3416 fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut {
3417 fn _decode(
3418 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3419 ) -> Result<NextCall, fidl::Error> {
3420 let _response = fidl::client::decode_transaction_body::<
3421 PeerHandlerWatchNextCallResponse,
3422 fidl::encoding::DefaultFuchsiaResourceDialect,
3423 0x5e3b7b4e7c3d359,
3424 >(_buf?)?;
3425 Ok(_response.call)
3426 }
3427 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NextCall>(
3428 (),
3429 0x5e3b7b4e7c3d359,
3430 fidl::encoding::DynamicFlags::empty(),
3431 _decode,
3432 )
3433 }
3434
3435 type RequestOutgoingCallResponseFut = fidl::client::QueryResponseFut<
3436 PeerHandlerRequestOutgoingCallResult,
3437 fidl::encoding::DefaultFuchsiaResourceDialect,
3438 >;
3439 fn r#request_outgoing_call(
3440 &self,
3441 mut action: &CallAction,
3442 ) -> Self::RequestOutgoingCallResponseFut {
3443 fn _decode(
3444 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3445 ) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
3446 let _response = fidl::client::decode_transaction_body::<
3447 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3448 fidl::encoding::DefaultFuchsiaResourceDialect,
3449 0x1a2637c743c89ad,
3450 >(_buf?)?;
3451 Ok(_response.map(|x| x))
3452 }
3453 self.client.send_query_and_decode::<
3454 PeerHandlerRequestOutgoingCallRequest,
3455 PeerHandlerRequestOutgoingCallResult,
3456 >(
3457 (action,),
3458 0x1a2637c743c89ad,
3459 fidl::encoding::DynamicFlags::empty(),
3460 _decode,
3461 )
3462 }
3463
3464 type QueryOperatorResponseFut = fidl::client::QueryResponseFut<
3465 Option<String>,
3466 fidl::encoding::DefaultFuchsiaResourceDialect,
3467 >;
3468 fn r#query_operator(&self) -> Self::QueryOperatorResponseFut {
3469 fn _decode(
3470 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3471 ) -> Result<Option<String>, fidl::Error> {
3472 let _response = fidl::client::decode_transaction_body::<
3473 PeerHandlerQueryOperatorResponse,
3474 fidl::encoding::DefaultFuchsiaResourceDialect,
3475 0x1217eaf5db4c3300,
3476 >(_buf?)?;
3477 Ok(_response.operator)
3478 }
3479 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
3480 (),
3481 0x1217eaf5db4c3300,
3482 fidl::encoding::DynamicFlags::empty(),
3483 _decode,
3484 )
3485 }
3486
3487 type SubscriberNumberInformationResponseFut =
3488 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3489 fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut {
3490 fn _decode(
3491 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3492 ) -> Result<Vec<String>, fidl::Error> {
3493 let _response = fidl::client::decode_transaction_body::<
3494 PeerHandlerSubscriberNumberInformationResponse,
3495 fidl::encoding::DefaultFuchsiaResourceDialect,
3496 0x15f5235855b02a3a,
3497 >(_buf?)?;
3498 Ok(_response.numbers)
3499 }
3500 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
3501 (),
3502 0x15f5235855b02a3a,
3503 fidl::encoding::DynamicFlags::empty(),
3504 _decode,
3505 )
3506 }
3507
3508 type SetNrecModeResponseFut = fidl::client::QueryResponseFut<
3509 PeerHandlerSetNrecModeResult,
3510 fidl::encoding::DefaultFuchsiaResourceDialect,
3511 >;
3512 fn r#set_nrec_mode(&self, mut enabled: bool) -> Self::SetNrecModeResponseFut {
3513 fn _decode(
3514 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3515 ) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
3516 let _response = fidl::client::decode_transaction_body::<
3517 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3518 fidl::encoding::DefaultFuchsiaResourceDialect,
3519 0x2f8890d0f866672f,
3520 >(_buf?)?;
3521 Ok(_response.map(|x| x))
3522 }
3523 self.client
3524 .send_query_and_decode::<PeerHandlerSetNrecModeRequest, PeerHandlerSetNrecModeResult>(
3525 (enabled,),
3526 0x2f8890d0f866672f,
3527 fidl::encoding::DynamicFlags::empty(),
3528 _decode,
3529 )
3530 }
3531
3532 fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3533 self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
3534 (level,),
3535 0x4e3e8be4680d85b,
3536 fidl::encoding::DynamicFlags::empty(),
3537 )
3538 }
3539
3540 fn r#gain_control(
3541 &self,
3542 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3543 ) -> Result<(), fidl::Error> {
3544 self.client.send::<PeerHandlerGainControlRequest>(
3545 (control,),
3546 0x6e043b6d2e0fb917,
3547 fidl::encoding::DynamicFlags::empty(),
3548 )
3549 }
3550}
3551
3552pub struct PeerHandlerEventStream {
3553 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3554}
3555
3556impl std::marker::Unpin for PeerHandlerEventStream {}
3557
3558impl futures::stream::FusedStream for PeerHandlerEventStream {
3559 fn is_terminated(&self) -> bool {
3560 self.event_receiver.is_terminated()
3561 }
3562}
3563
3564impl futures::Stream for PeerHandlerEventStream {
3565 type Item = Result<PeerHandlerEvent, fidl::Error>;
3566
3567 fn poll_next(
3568 mut self: std::pin::Pin<&mut Self>,
3569 cx: &mut std::task::Context<'_>,
3570 ) -> std::task::Poll<Option<Self::Item>> {
3571 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3572 &mut self.event_receiver,
3573 cx
3574 )?) {
3575 Some(buf) => std::task::Poll::Ready(Some(PeerHandlerEvent::decode(buf))),
3576 None => std::task::Poll::Ready(None),
3577 }
3578 }
3579}
3580
3581#[derive(Debug)]
3582pub enum PeerHandlerEvent {}
3583
3584impl PeerHandlerEvent {
3585 fn decode(
3587 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3588 ) -> Result<PeerHandlerEvent, fidl::Error> {
3589 let (bytes, _handles) = buf.split_mut();
3590 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3591 debug_assert_eq!(tx_header.tx_id, 0);
3592 match tx_header.ordinal {
3593 _ => Err(fidl::Error::UnknownOrdinal {
3594 ordinal: tx_header.ordinal,
3595 protocol_name: <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3596 }),
3597 }
3598 }
3599}
3600
3601pub struct PeerHandlerRequestStream {
3603 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3604 is_terminated: bool,
3605}
3606
3607impl std::marker::Unpin for PeerHandlerRequestStream {}
3608
3609impl futures::stream::FusedStream for PeerHandlerRequestStream {
3610 fn is_terminated(&self) -> bool {
3611 self.is_terminated
3612 }
3613}
3614
3615impl fidl::endpoints::RequestStream for PeerHandlerRequestStream {
3616 type Protocol = PeerHandlerMarker;
3617 type ControlHandle = PeerHandlerControlHandle;
3618
3619 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3620 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3621 }
3622
3623 fn control_handle(&self) -> Self::ControlHandle {
3624 PeerHandlerControlHandle { inner: self.inner.clone() }
3625 }
3626
3627 fn into_inner(
3628 self,
3629 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3630 {
3631 (self.inner, self.is_terminated)
3632 }
3633
3634 fn from_inner(
3635 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3636 is_terminated: bool,
3637 ) -> Self {
3638 Self { inner, is_terminated }
3639 }
3640}
3641
3642impl futures::Stream for PeerHandlerRequestStream {
3643 type Item = Result<PeerHandlerRequest, fidl::Error>;
3644
3645 fn poll_next(
3646 mut self: std::pin::Pin<&mut Self>,
3647 cx: &mut std::task::Context<'_>,
3648 ) -> std::task::Poll<Option<Self::Item>> {
3649 let this = &mut *self;
3650 if this.inner.check_shutdown(cx) {
3651 this.is_terminated = true;
3652 return std::task::Poll::Ready(None);
3653 }
3654 if this.is_terminated {
3655 panic!("polled PeerHandlerRequestStream after completion");
3656 }
3657 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3658 |bytes, handles| {
3659 match this.inner.channel().read_etc(cx, bytes, handles) {
3660 std::task::Poll::Ready(Ok(())) => {}
3661 std::task::Poll::Pending => return std::task::Poll::Pending,
3662 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3663 this.is_terminated = true;
3664 return std::task::Poll::Ready(None);
3665 }
3666 std::task::Poll::Ready(Err(e)) => {
3667 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3668 e.into(),
3669 ))));
3670 }
3671 }
3672
3673 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3675
3676 std::task::Poll::Ready(Some(match header.ordinal {
3677 0x1c9eba597076b7cb => {
3678 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3679 let mut req = fidl::new_empty!(
3680 fidl::encoding::EmptyPayload,
3681 fidl::encoding::DefaultFuchsiaResourceDialect
3682 );
3683 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3684 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3685 Ok(PeerHandlerRequest::WatchNetworkInformation {
3686 responder: PeerHandlerWatchNetworkInformationResponder {
3687 control_handle: std::mem::ManuallyDrop::new(control_handle),
3688 tx_id: header.tx_id,
3689 },
3690 })
3691 }
3692 0x5e3b7b4e7c3d359 => {
3693 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3694 let mut req = fidl::new_empty!(
3695 fidl::encoding::EmptyPayload,
3696 fidl::encoding::DefaultFuchsiaResourceDialect
3697 );
3698 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3699 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3700 Ok(PeerHandlerRequest::WatchNextCall {
3701 responder: PeerHandlerWatchNextCallResponder {
3702 control_handle: std::mem::ManuallyDrop::new(control_handle),
3703 tx_id: header.tx_id,
3704 },
3705 })
3706 }
3707 0x1a2637c743c89ad => {
3708 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3709 let mut req = fidl::new_empty!(
3710 PeerHandlerRequestOutgoingCallRequest,
3711 fidl::encoding::DefaultFuchsiaResourceDialect
3712 );
3713 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerRequestOutgoingCallRequest>(&header, _body_bytes, handles, &mut req)?;
3714 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3715 Ok(PeerHandlerRequest::RequestOutgoingCall {
3716 action: req.action,
3717
3718 responder: PeerHandlerRequestOutgoingCallResponder {
3719 control_handle: std::mem::ManuallyDrop::new(control_handle),
3720 tx_id: header.tx_id,
3721 },
3722 })
3723 }
3724 0x1217eaf5db4c3300 => {
3725 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3726 let mut req = fidl::new_empty!(
3727 fidl::encoding::EmptyPayload,
3728 fidl::encoding::DefaultFuchsiaResourceDialect
3729 );
3730 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3731 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3732 Ok(PeerHandlerRequest::QueryOperator {
3733 responder: PeerHandlerQueryOperatorResponder {
3734 control_handle: std::mem::ManuallyDrop::new(control_handle),
3735 tx_id: header.tx_id,
3736 },
3737 })
3738 }
3739 0x15f5235855b02a3a => {
3740 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3741 let mut req = fidl::new_empty!(
3742 fidl::encoding::EmptyPayload,
3743 fidl::encoding::DefaultFuchsiaResourceDialect
3744 );
3745 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3746 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3747 Ok(PeerHandlerRequest::SubscriberNumberInformation {
3748 responder: PeerHandlerSubscriberNumberInformationResponder {
3749 control_handle: std::mem::ManuallyDrop::new(control_handle),
3750 tx_id: header.tx_id,
3751 },
3752 })
3753 }
3754 0x2f8890d0f866672f => {
3755 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3756 let mut req = fidl::new_empty!(
3757 PeerHandlerSetNrecModeRequest,
3758 fidl::encoding::DefaultFuchsiaResourceDialect
3759 );
3760 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerSetNrecModeRequest>(&header, _body_bytes, handles, &mut req)?;
3761 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3762 Ok(PeerHandlerRequest::SetNrecMode {
3763 enabled: req.enabled,
3764
3765 responder: PeerHandlerSetNrecModeResponder {
3766 control_handle: std::mem::ManuallyDrop::new(control_handle),
3767 tx_id: header.tx_id,
3768 },
3769 })
3770 }
3771 0x4e3e8be4680d85b => {
3772 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3773 let mut req = fidl::new_empty!(
3774 PeerHandlerReportHeadsetBatteryLevelRequest,
3775 fidl::encoding::DefaultFuchsiaResourceDialect
3776 );
3777 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerReportHeadsetBatteryLevelRequest>(&header, _body_bytes, handles, &mut req)?;
3778 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3779 Ok(PeerHandlerRequest::ReportHeadsetBatteryLevel {
3780 level: req.level,
3781
3782 control_handle,
3783 })
3784 }
3785 0x6e043b6d2e0fb917 => {
3786 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3787 let mut req = fidl::new_empty!(
3788 PeerHandlerGainControlRequest,
3789 fidl::encoding::DefaultFuchsiaResourceDialect
3790 );
3791 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
3792 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3793 Ok(PeerHandlerRequest::GainControl { control: req.control, control_handle })
3794 }
3795 _ => Err(fidl::Error::UnknownOrdinal {
3796 ordinal: header.ordinal,
3797 protocol_name:
3798 <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3799 }),
3800 }))
3801 },
3802 )
3803 }
3804}
3805
3806#[derive(Debug)]
3815pub enum PeerHandlerRequest {
3816 WatchNetworkInformation { responder: PeerHandlerWatchNetworkInformationResponder },
3827 WatchNextCall { responder: PeerHandlerWatchNextCallResponder },
3832 RequestOutgoingCall { action: CallAction, responder: PeerHandlerRequestOutgoingCallResponder },
3845 QueryOperator { responder: PeerHandlerQueryOperatorResponder },
3849 SubscriberNumberInformation { responder: PeerHandlerSubscriberNumberInformationResponder },
3853 SetNrecMode { enabled: bool, responder: PeerHandlerSetNrecModeResponder },
3858 ReportHeadsetBatteryLevel { level: u8, control_handle: PeerHandlerControlHandle },
3861 GainControl {
3868 control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3869 control_handle: PeerHandlerControlHandle,
3870 },
3871}
3872
3873impl PeerHandlerRequest {
3874 #[allow(irrefutable_let_patterns)]
3875 pub fn into_watch_network_information(
3876 self,
3877 ) -> Option<(PeerHandlerWatchNetworkInformationResponder)> {
3878 if let PeerHandlerRequest::WatchNetworkInformation { responder } = self {
3879 Some((responder))
3880 } else {
3881 None
3882 }
3883 }
3884
3885 #[allow(irrefutable_let_patterns)]
3886 pub fn into_watch_next_call(self) -> Option<(PeerHandlerWatchNextCallResponder)> {
3887 if let PeerHandlerRequest::WatchNextCall { responder } = self {
3888 Some((responder))
3889 } else {
3890 None
3891 }
3892 }
3893
3894 #[allow(irrefutable_let_patterns)]
3895 pub fn into_request_outgoing_call(
3896 self,
3897 ) -> Option<(CallAction, PeerHandlerRequestOutgoingCallResponder)> {
3898 if let PeerHandlerRequest::RequestOutgoingCall { action, responder } = self {
3899 Some((action, responder))
3900 } else {
3901 None
3902 }
3903 }
3904
3905 #[allow(irrefutable_let_patterns)]
3906 pub fn into_query_operator(self) -> Option<(PeerHandlerQueryOperatorResponder)> {
3907 if let PeerHandlerRequest::QueryOperator { responder } = self {
3908 Some((responder))
3909 } else {
3910 None
3911 }
3912 }
3913
3914 #[allow(irrefutable_let_patterns)]
3915 pub fn into_subscriber_number_information(
3916 self,
3917 ) -> Option<(PeerHandlerSubscriberNumberInformationResponder)> {
3918 if let PeerHandlerRequest::SubscriberNumberInformation { responder } = self {
3919 Some((responder))
3920 } else {
3921 None
3922 }
3923 }
3924
3925 #[allow(irrefutable_let_patterns)]
3926 pub fn into_set_nrec_mode(self) -> Option<(bool, PeerHandlerSetNrecModeResponder)> {
3927 if let PeerHandlerRequest::SetNrecMode { enabled, responder } = self {
3928 Some((enabled, responder))
3929 } else {
3930 None
3931 }
3932 }
3933
3934 #[allow(irrefutable_let_patterns)]
3935 pub fn into_report_headset_battery_level(self) -> Option<(u8, PeerHandlerControlHandle)> {
3936 if let PeerHandlerRequest::ReportHeadsetBatteryLevel { level, control_handle } = self {
3937 Some((level, control_handle))
3938 } else {
3939 None
3940 }
3941 }
3942
3943 #[allow(irrefutable_let_patterns)]
3944 pub fn into_gain_control(
3945 self,
3946 ) -> Option<(fidl::endpoints::ClientEnd<HeadsetGainMarker>, PeerHandlerControlHandle)> {
3947 if let PeerHandlerRequest::GainControl { control, control_handle } = self {
3948 Some((control, control_handle))
3949 } else {
3950 None
3951 }
3952 }
3953
3954 pub fn method_name(&self) -> &'static str {
3956 match *self {
3957 PeerHandlerRequest::WatchNetworkInformation { .. } => "watch_network_information",
3958 PeerHandlerRequest::WatchNextCall { .. } => "watch_next_call",
3959 PeerHandlerRequest::RequestOutgoingCall { .. } => "request_outgoing_call",
3960 PeerHandlerRequest::QueryOperator { .. } => "query_operator",
3961 PeerHandlerRequest::SubscriberNumberInformation { .. } => {
3962 "subscriber_number_information"
3963 }
3964 PeerHandlerRequest::SetNrecMode { .. } => "set_nrec_mode",
3965 PeerHandlerRequest::ReportHeadsetBatteryLevel { .. } => "report_headset_battery_level",
3966 PeerHandlerRequest::GainControl { .. } => "gain_control",
3967 }
3968 }
3969}
3970
3971#[derive(Debug, Clone)]
3972pub struct PeerHandlerControlHandle {
3973 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3974}
3975
3976impl fidl::endpoints::ControlHandle for PeerHandlerControlHandle {
3977 fn shutdown(&self) {
3978 self.inner.shutdown()
3979 }
3980 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3981 self.inner.shutdown_with_epitaph(status)
3982 }
3983
3984 fn is_closed(&self) -> bool {
3985 self.inner.channel().is_closed()
3986 }
3987 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3988 self.inner.channel().on_closed()
3989 }
3990
3991 #[cfg(target_os = "fuchsia")]
3992 fn signal_peer(
3993 &self,
3994 clear_mask: zx::Signals,
3995 set_mask: zx::Signals,
3996 ) -> Result<(), zx_status::Status> {
3997 use fidl::Peered;
3998 self.inner.channel().signal_peer(clear_mask, set_mask)
3999 }
4000}
4001
4002impl PeerHandlerControlHandle {}
4003
4004#[must_use = "FIDL methods require a response to be sent"]
4005#[derive(Debug)]
4006pub struct PeerHandlerWatchNetworkInformationResponder {
4007 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4008 tx_id: u32,
4009}
4010
4011impl std::ops::Drop for PeerHandlerWatchNetworkInformationResponder {
4015 fn drop(&mut self) {
4016 self.control_handle.shutdown();
4017 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4019 }
4020}
4021
4022impl fidl::endpoints::Responder for PeerHandlerWatchNetworkInformationResponder {
4023 type ControlHandle = PeerHandlerControlHandle;
4024
4025 fn control_handle(&self) -> &PeerHandlerControlHandle {
4026 &self.control_handle
4027 }
4028
4029 fn drop_without_shutdown(mut self) {
4030 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4032 std::mem::forget(self);
4034 }
4035}
4036
4037impl PeerHandlerWatchNetworkInformationResponder {
4038 pub fn send(self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
4042 let _result = self.send_raw(update);
4043 if _result.is_err() {
4044 self.control_handle.shutdown();
4045 }
4046 self.drop_without_shutdown();
4047 _result
4048 }
4049
4050 pub fn send_no_shutdown_on_err(
4052 self,
4053 mut update: &NetworkInformation,
4054 ) -> Result<(), fidl::Error> {
4055 let _result = self.send_raw(update);
4056 self.drop_without_shutdown();
4057 _result
4058 }
4059
4060 fn send_raw(&self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
4061 self.control_handle.inner.send::<PeerHandlerWatchNetworkInformationResponse>(
4062 (update,),
4063 self.tx_id,
4064 0x1c9eba597076b7cb,
4065 fidl::encoding::DynamicFlags::empty(),
4066 )
4067 }
4068}
4069
4070#[must_use = "FIDL methods require a response to be sent"]
4071#[derive(Debug)]
4072pub struct PeerHandlerWatchNextCallResponder {
4073 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4074 tx_id: u32,
4075}
4076
4077impl std::ops::Drop for PeerHandlerWatchNextCallResponder {
4081 fn drop(&mut self) {
4082 self.control_handle.shutdown();
4083 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4085 }
4086}
4087
4088impl fidl::endpoints::Responder for PeerHandlerWatchNextCallResponder {
4089 type ControlHandle = PeerHandlerControlHandle;
4090
4091 fn control_handle(&self) -> &PeerHandlerControlHandle {
4092 &self.control_handle
4093 }
4094
4095 fn drop_without_shutdown(mut self) {
4096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4098 std::mem::forget(self);
4100 }
4101}
4102
4103impl PeerHandlerWatchNextCallResponder {
4104 pub fn send(self, mut call: NextCall) -> Result<(), fidl::Error> {
4108 let _result = self.send_raw(call);
4109 if _result.is_err() {
4110 self.control_handle.shutdown();
4111 }
4112 self.drop_without_shutdown();
4113 _result
4114 }
4115
4116 pub fn send_no_shutdown_on_err(self, mut call: NextCall) -> Result<(), fidl::Error> {
4118 let _result = self.send_raw(call);
4119 self.drop_without_shutdown();
4120 _result
4121 }
4122
4123 fn send_raw(&self, mut call: NextCall) -> Result<(), fidl::Error> {
4124 self.control_handle.inner.send::<PeerHandlerWatchNextCallResponse>(
4125 (&mut call,),
4126 self.tx_id,
4127 0x5e3b7b4e7c3d359,
4128 fidl::encoding::DynamicFlags::empty(),
4129 )
4130 }
4131}
4132
4133#[must_use = "FIDL methods require a response to be sent"]
4134#[derive(Debug)]
4135pub struct PeerHandlerRequestOutgoingCallResponder {
4136 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4137 tx_id: u32,
4138}
4139
4140impl std::ops::Drop for PeerHandlerRequestOutgoingCallResponder {
4144 fn drop(&mut self) {
4145 self.control_handle.shutdown();
4146 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4148 }
4149}
4150
4151impl fidl::endpoints::Responder for PeerHandlerRequestOutgoingCallResponder {
4152 type ControlHandle = PeerHandlerControlHandle;
4153
4154 fn control_handle(&self) -> &PeerHandlerControlHandle {
4155 &self.control_handle
4156 }
4157
4158 fn drop_without_shutdown(mut self) {
4159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4161 std::mem::forget(self);
4163 }
4164}
4165
4166impl PeerHandlerRequestOutgoingCallResponder {
4167 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4171 let _result = self.send_raw(result);
4172 if _result.is_err() {
4173 self.control_handle.shutdown();
4174 }
4175 self.drop_without_shutdown();
4176 _result
4177 }
4178
4179 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4181 let _result = self.send_raw(result);
4182 self.drop_without_shutdown();
4183 _result
4184 }
4185
4186 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4187 self.control_handle
4188 .inner
4189 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4190 result,
4191 self.tx_id,
4192 0x1a2637c743c89ad,
4193 fidl::encoding::DynamicFlags::empty(),
4194 )
4195 }
4196}
4197
4198#[must_use = "FIDL methods require a response to be sent"]
4199#[derive(Debug)]
4200pub struct PeerHandlerQueryOperatorResponder {
4201 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4202 tx_id: u32,
4203}
4204
4205impl std::ops::Drop for PeerHandlerQueryOperatorResponder {
4209 fn drop(&mut self) {
4210 self.control_handle.shutdown();
4211 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4213 }
4214}
4215
4216impl fidl::endpoints::Responder for PeerHandlerQueryOperatorResponder {
4217 type ControlHandle = PeerHandlerControlHandle;
4218
4219 fn control_handle(&self) -> &PeerHandlerControlHandle {
4220 &self.control_handle
4221 }
4222
4223 fn drop_without_shutdown(mut self) {
4224 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4226 std::mem::forget(self);
4228 }
4229}
4230
4231impl PeerHandlerQueryOperatorResponder {
4232 pub fn send(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4236 let _result = self.send_raw(operator);
4237 if _result.is_err() {
4238 self.control_handle.shutdown();
4239 }
4240 self.drop_without_shutdown();
4241 _result
4242 }
4243
4244 pub fn send_no_shutdown_on_err(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4246 let _result = self.send_raw(operator);
4247 self.drop_without_shutdown();
4248 _result
4249 }
4250
4251 fn send_raw(&self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4252 self.control_handle.inner.send::<PeerHandlerQueryOperatorResponse>(
4253 (operator,),
4254 self.tx_id,
4255 0x1217eaf5db4c3300,
4256 fidl::encoding::DynamicFlags::empty(),
4257 )
4258 }
4259}
4260
4261#[must_use = "FIDL methods require a response to be sent"]
4262#[derive(Debug)]
4263pub struct PeerHandlerSubscriberNumberInformationResponder {
4264 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4265 tx_id: u32,
4266}
4267
4268impl std::ops::Drop for PeerHandlerSubscriberNumberInformationResponder {
4272 fn drop(&mut self) {
4273 self.control_handle.shutdown();
4274 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4276 }
4277}
4278
4279impl fidl::endpoints::Responder for PeerHandlerSubscriberNumberInformationResponder {
4280 type ControlHandle = PeerHandlerControlHandle;
4281
4282 fn control_handle(&self) -> &PeerHandlerControlHandle {
4283 &self.control_handle
4284 }
4285
4286 fn drop_without_shutdown(mut self) {
4287 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4289 std::mem::forget(self);
4291 }
4292}
4293
4294impl PeerHandlerSubscriberNumberInformationResponder {
4295 pub fn send(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4299 let _result = self.send_raw(numbers);
4300 if _result.is_err() {
4301 self.control_handle.shutdown();
4302 }
4303 self.drop_without_shutdown();
4304 _result
4305 }
4306
4307 pub fn send_no_shutdown_on_err(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4309 let _result = self.send_raw(numbers);
4310 self.drop_without_shutdown();
4311 _result
4312 }
4313
4314 fn send_raw(&self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4315 self.control_handle.inner.send::<PeerHandlerSubscriberNumberInformationResponse>(
4316 (numbers,),
4317 self.tx_id,
4318 0x15f5235855b02a3a,
4319 fidl::encoding::DynamicFlags::empty(),
4320 )
4321 }
4322}
4323
4324#[must_use = "FIDL methods require a response to be sent"]
4325#[derive(Debug)]
4326pub struct PeerHandlerSetNrecModeResponder {
4327 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4328 tx_id: u32,
4329}
4330
4331impl std::ops::Drop for PeerHandlerSetNrecModeResponder {
4335 fn drop(&mut self) {
4336 self.control_handle.shutdown();
4337 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4339 }
4340}
4341
4342impl fidl::endpoints::Responder for PeerHandlerSetNrecModeResponder {
4343 type ControlHandle = PeerHandlerControlHandle;
4344
4345 fn control_handle(&self) -> &PeerHandlerControlHandle {
4346 &self.control_handle
4347 }
4348
4349 fn drop_without_shutdown(mut self) {
4350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4352 std::mem::forget(self);
4354 }
4355}
4356
4357impl PeerHandlerSetNrecModeResponder {
4358 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4362 let _result = self.send_raw(result);
4363 if _result.is_err() {
4364 self.control_handle.shutdown();
4365 }
4366 self.drop_without_shutdown();
4367 _result
4368 }
4369
4370 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4372 let _result = self.send_raw(result);
4373 self.drop_without_shutdown();
4374 _result
4375 }
4376
4377 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4378 self.control_handle
4379 .inner
4380 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4381 result,
4382 self.tx_id,
4383 0x2f8890d0f866672f,
4384 fidl::encoding::DynamicFlags::empty(),
4385 )
4386 }
4387}
4388
4389mod internal {
4390 use super::*;
4391
4392 impl fidl::encoding::ResourceTypeMarker for CallManagerPeerConnectedRequest {
4393 type Borrowed<'a> = &'a mut Self;
4394 fn take_or_borrow<'a>(
4395 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4396 ) -> Self::Borrowed<'a> {
4397 value
4398 }
4399 }
4400
4401 unsafe impl fidl::encoding::TypeMarker for CallManagerPeerConnectedRequest {
4402 type Owned = Self;
4403
4404 #[inline(always)]
4405 fn inline_align(_context: fidl::encoding::Context) -> usize {
4406 8
4407 }
4408
4409 #[inline(always)]
4410 fn inline_size(_context: fidl::encoding::Context) -> usize {
4411 16
4412 }
4413 }
4414
4415 unsafe impl
4416 fidl::encoding::Encode<
4417 CallManagerPeerConnectedRequest,
4418 fidl::encoding::DefaultFuchsiaResourceDialect,
4419 > for &mut CallManagerPeerConnectedRequest
4420 {
4421 #[inline]
4422 unsafe fn encode(
4423 self,
4424 encoder: &mut fidl::encoding::Encoder<
4425 '_,
4426 fidl::encoding::DefaultFuchsiaResourceDialect,
4427 >,
4428 offset: usize,
4429 _depth: fidl::encoding::Depth,
4430 ) -> fidl::Result<()> {
4431 encoder.debug_check_bounds::<CallManagerPeerConnectedRequest>(offset);
4432 fidl::encoding::Encode::<CallManagerPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4434 (
4435 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4436 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
4437 ),
4438 encoder, offset, _depth
4439 )
4440 }
4441 }
4442 unsafe impl<
4443 T0: fidl::encoding::Encode<
4444 fidl_fuchsia_bluetooth::PeerId,
4445 fidl::encoding::DefaultFuchsiaResourceDialect,
4446 >,
4447 T1: fidl::encoding::Encode<
4448 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4449 fidl::encoding::DefaultFuchsiaResourceDialect,
4450 >,
4451 >
4452 fidl::encoding::Encode<
4453 CallManagerPeerConnectedRequest,
4454 fidl::encoding::DefaultFuchsiaResourceDialect,
4455 > for (T0, T1)
4456 {
4457 #[inline]
4458 unsafe fn encode(
4459 self,
4460 encoder: &mut fidl::encoding::Encoder<
4461 '_,
4462 fidl::encoding::DefaultFuchsiaResourceDialect,
4463 >,
4464 offset: usize,
4465 depth: fidl::encoding::Depth,
4466 ) -> fidl::Result<()> {
4467 encoder.debug_check_bounds::<CallManagerPeerConnectedRequest>(offset);
4468 unsafe {
4471 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4472 (ptr as *mut u64).write_unaligned(0);
4473 }
4474 self.0.encode(encoder, offset + 0, depth)?;
4476 self.1.encode(encoder, offset + 8, depth)?;
4477 Ok(())
4478 }
4479 }
4480
4481 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4482 for CallManagerPeerConnectedRequest
4483 {
4484 #[inline(always)]
4485 fn new_empty() -> Self {
4486 Self {
4487 id: fidl::new_empty!(
4488 fidl_fuchsia_bluetooth::PeerId,
4489 fidl::encoding::DefaultFuchsiaResourceDialect
4490 ),
4491 handle: fidl::new_empty!(
4492 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4493 fidl::encoding::DefaultFuchsiaResourceDialect
4494 ),
4495 }
4496 }
4497
4498 #[inline]
4499 unsafe fn decode(
4500 &mut self,
4501 decoder: &mut fidl::encoding::Decoder<
4502 '_,
4503 fidl::encoding::DefaultFuchsiaResourceDialect,
4504 >,
4505 offset: usize,
4506 _depth: fidl::encoding::Depth,
4507 ) -> fidl::Result<()> {
4508 decoder.debug_check_bounds::<Self>(offset);
4509 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4511 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4512 let mask = 0xffffffff00000000u64;
4513 let maskedval = padval & mask;
4514 if maskedval != 0 {
4515 return Err(fidl::Error::NonZeroPadding {
4516 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4517 });
4518 }
4519 fidl::decode!(
4520 fidl_fuchsia_bluetooth::PeerId,
4521 fidl::encoding::DefaultFuchsiaResourceDialect,
4522 &mut self.id,
4523 decoder,
4524 offset + 0,
4525 _depth
4526 )?;
4527 fidl::decode!(
4528 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4529 fidl::encoding::DefaultFuchsiaResourceDialect,
4530 &mut self.handle,
4531 decoder,
4532 offset + 8,
4533 _depth
4534 )?;
4535 Ok(())
4536 }
4537 }
4538
4539 impl fidl::encoding::ResourceTypeMarker for HandsFreeWatchPeerConnectedResponse {
4540 type Borrowed<'a> = &'a mut Self;
4541 fn take_or_borrow<'a>(
4542 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4543 ) -> Self::Borrowed<'a> {
4544 value
4545 }
4546 }
4547
4548 unsafe impl fidl::encoding::TypeMarker for HandsFreeWatchPeerConnectedResponse {
4549 type Owned = Self;
4550
4551 #[inline(always)]
4552 fn inline_align(_context: fidl::encoding::Context) -> usize {
4553 8
4554 }
4555
4556 #[inline(always)]
4557 fn inline_size(_context: fidl::encoding::Context) -> usize {
4558 16
4559 }
4560 }
4561
4562 unsafe impl
4563 fidl::encoding::Encode<
4564 HandsFreeWatchPeerConnectedResponse,
4565 fidl::encoding::DefaultFuchsiaResourceDialect,
4566 > for &mut HandsFreeWatchPeerConnectedResponse
4567 {
4568 #[inline]
4569 unsafe fn encode(
4570 self,
4571 encoder: &mut fidl::encoding::Encoder<
4572 '_,
4573 fidl::encoding::DefaultFuchsiaResourceDialect,
4574 >,
4575 offset: usize,
4576 _depth: fidl::encoding::Depth,
4577 ) -> fidl::Result<()> {
4578 encoder.debug_check_bounds::<HandsFreeWatchPeerConnectedResponse>(offset);
4579 fidl::encoding::Encode::<HandsFreeWatchPeerConnectedResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4581 (
4582 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4583 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
4584 ),
4585 encoder, offset, _depth
4586 )
4587 }
4588 }
4589 unsafe impl<
4590 T0: fidl::encoding::Encode<
4591 fidl_fuchsia_bluetooth::PeerId,
4592 fidl::encoding::DefaultFuchsiaResourceDialect,
4593 >,
4594 T1: fidl::encoding::Encode<
4595 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4596 fidl::encoding::DefaultFuchsiaResourceDialect,
4597 >,
4598 >
4599 fidl::encoding::Encode<
4600 HandsFreeWatchPeerConnectedResponse,
4601 fidl::encoding::DefaultFuchsiaResourceDialect,
4602 > for (T0, T1)
4603 {
4604 #[inline]
4605 unsafe fn encode(
4606 self,
4607 encoder: &mut fidl::encoding::Encoder<
4608 '_,
4609 fidl::encoding::DefaultFuchsiaResourceDialect,
4610 >,
4611 offset: usize,
4612 depth: fidl::encoding::Depth,
4613 ) -> fidl::Result<()> {
4614 encoder.debug_check_bounds::<HandsFreeWatchPeerConnectedResponse>(offset);
4615 unsafe {
4618 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4619 (ptr as *mut u64).write_unaligned(0);
4620 }
4621 self.0.encode(encoder, offset + 0, depth)?;
4623 self.1.encode(encoder, offset + 8, depth)?;
4624 Ok(())
4625 }
4626 }
4627
4628 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4629 for HandsFreeWatchPeerConnectedResponse
4630 {
4631 #[inline(always)]
4632 fn new_empty() -> Self {
4633 Self {
4634 id: fidl::new_empty!(
4635 fidl_fuchsia_bluetooth::PeerId,
4636 fidl::encoding::DefaultFuchsiaResourceDialect
4637 ),
4638 handle: fidl::new_empty!(
4639 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4640 fidl::encoding::DefaultFuchsiaResourceDialect
4641 ),
4642 }
4643 }
4644
4645 #[inline]
4646 unsafe fn decode(
4647 &mut self,
4648 decoder: &mut fidl::encoding::Decoder<
4649 '_,
4650 fidl::encoding::DefaultFuchsiaResourceDialect,
4651 >,
4652 offset: usize,
4653 _depth: fidl::encoding::Depth,
4654 ) -> fidl::Result<()> {
4655 decoder.debug_check_bounds::<Self>(offset);
4656 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4658 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4659 let mask = 0xffffffff00000000u64;
4660 let maskedval = padval & mask;
4661 if maskedval != 0 {
4662 return Err(fidl::Error::NonZeroPadding {
4663 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4664 });
4665 }
4666 fidl::decode!(
4667 fidl_fuchsia_bluetooth::PeerId,
4668 fidl::encoding::DefaultFuchsiaResourceDialect,
4669 &mut self.id,
4670 decoder,
4671 offset + 0,
4672 _depth
4673 )?;
4674 fidl::decode!(
4675 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4676 fidl::encoding::DefaultFuchsiaResourceDialect,
4677 &mut self.handle,
4678 decoder,
4679 offset + 8,
4680 _depth
4681 )?;
4682 Ok(())
4683 }
4684 }
4685
4686 impl fidl::encoding::ResourceTypeMarker for HfpRegisterRequest {
4687 type Borrowed<'a> = &'a mut Self;
4688 fn take_or_borrow<'a>(
4689 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4690 ) -> Self::Borrowed<'a> {
4691 value
4692 }
4693 }
4694
4695 unsafe impl fidl::encoding::TypeMarker for HfpRegisterRequest {
4696 type Owned = Self;
4697
4698 #[inline(always)]
4699 fn inline_align(_context: fidl::encoding::Context) -> usize {
4700 4
4701 }
4702
4703 #[inline(always)]
4704 fn inline_size(_context: fidl::encoding::Context) -> usize {
4705 4
4706 }
4707 }
4708
4709 unsafe impl
4710 fidl::encoding::Encode<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4711 for &mut HfpRegisterRequest
4712 {
4713 #[inline]
4714 unsafe fn encode(
4715 self,
4716 encoder: &mut fidl::encoding::Encoder<
4717 '_,
4718 fidl::encoding::DefaultFuchsiaResourceDialect,
4719 >,
4720 offset: usize,
4721 _depth: fidl::encoding::Depth,
4722 ) -> fidl::Result<()> {
4723 encoder.debug_check_bounds::<HfpRegisterRequest>(offset);
4724 fidl::encoding::Encode::<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4726 (
4727 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
4728 ),
4729 encoder, offset, _depth
4730 )
4731 }
4732 }
4733 unsafe impl<
4734 T0: fidl::encoding::Encode<
4735 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4736 fidl::encoding::DefaultFuchsiaResourceDialect,
4737 >,
4738 > fidl::encoding::Encode<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4739 for (T0,)
4740 {
4741 #[inline]
4742 unsafe fn encode(
4743 self,
4744 encoder: &mut fidl::encoding::Encoder<
4745 '_,
4746 fidl::encoding::DefaultFuchsiaResourceDialect,
4747 >,
4748 offset: usize,
4749 depth: fidl::encoding::Depth,
4750 ) -> fidl::Result<()> {
4751 encoder.debug_check_bounds::<HfpRegisterRequest>(offset);
4752 self.0.encode(encoder, offset + 0, depth)?;
4756 Ok(())
4757 }
4758 }
4759
4760 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4761 for HfpRegisterRequest
4762 {
4763 #[inline(always)]
4764 fn new_empty() -> Self {
4765 Self {
4766 manager: fidl::new_empty!(
4767 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4768 fidl::encoding::DefaultFuchsiaResourceDialect
4769 ),
4770 }
4771 }
4772
4773 #[inline]
4774 unsafe fn decode(
4775 &mut self,
4776 decoder: &mut fidl::encoding::Decoder<
4777 '_,
4778 fidl::encoding::DefaultFuchsiaResourceDialect,
4779 >,
4780 offset: usize,
4781 _depth: fidl::encoding::Depth,
4782 ) -> fidl::Result<()> {
4783 decoder.debug_check_bounds::<Self>(offset);
4784 fidl::decode!(
4786 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4787 fidl::encoding::DefaultFuchsiaResourceDialect,
4788 &mut self.manager,
4789 decoder,
4790 offset + 0,
4791 _depth
4792 )?;
4793 Ok(())
4794 }
4795 }
4796
4797 impl fidl::encoding::ResourceTypeMarker for PeerHandlerGainControlRequest {
4798 type Borrowed<'a> = &'a mut Self;
4799 fn take_or_borrow<'a>(
4800 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4801 ) -> Self::Borrowed<'a> {
4802 value
4803 }
4804 }
4805
4806 unsafe impl fidl::encoding::TypeMarker for PeerHandlerGainControlRequest {
4807 type Owned = Self;
4808
4809 #[inline(always)]
4810 fn inline_align(_context: fidl::encoding::Context) -> usize {
4811 4
4812 }
4813
4814 #[inline(always)]
4815 fn inline_size(_context: fidl::encoding::Context) -> usize {
4816 4
4817 }
4818 }
4819
4820 unsafe impl
4821 fidl::encoding::Encode<
4822 PeerHandlerGainControlRequest,
4823 fidl::encoding::DefaultFuchsiaResourceDialect,
4824 > for &mut PeerHandlerGainControlRequest
4825 {
4826 #[inline]
4827 unsafe fn encode(
4828 self,
4829 encoder: &mut fidl::encoding::Encoder<
4830 '_,
4831 fidl::encoding::DefaultFuchsiaResourceDialect,
4832 >,
4833 offset: usize,
4834 _depth: fidl::encoding::Depth,
4835 ) -> fidl::Result<()> {
4836 encoder.debug_check_bounds::<PeerHandlerGainControlRequest>(offset);
4837 fidl::encoding::Encode::<PeerHandlerGainControlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4839 (
4840 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
4841 ),
4842 encoder, offset, _depth
4843 )
4844 }
4845 }
4846 unsafe impl<
4847 T0: fidl::encoding::Encode<
4848 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4849 fidl::encoding::DefaultFuchsiaResourceDialect,
4850 >,
4851 >
4852 fidl::encoding::Encode<
4853 PeerHandlerGainControlRequest,
4854 fidl::encoding::DefaultFuchsiaResourceDialect,
4855 > for (T0,)
4856 {
4857 #[inline]
4858 unsafe fn encode(
4859 self,
4860 encoder: &mut fidl::encoding::Encoder<
4861 '_,
4862 fidl::encoding::DefaultFuchsiaResourceDialect,
4863 >,
4864 offset: usize,
4865 depth: fidl::encoding::Depth,
4866 ) -> fidl::Result<()> {
4867 encoder.debug_check_bounds::<PeerHandlerGainControlRequest>(offset);
4868 self.0.encode(encoder, offset + 0, depth)?;
4872 Ok(())
4873 }
4874 }
4875
4876 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4877 for PeerHandlerGainControlRequest
4878 {
4879 #[inline(always)]
4880 fn new_empty() -> Self {
4881 Self {
4882 control: fidl::new_empty!(
4883 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4884 fidl::encoding::DefaultFuchsiaResourceDialect
4885 ),
4886 }
4887 }
4888
4889 #[inline]
4890 unsafe fn decode(
4891 &mut self,
4892 decoder: &mut fidl::encoding::Decoder<
4893 '_,
4894 fidl::encoding::DefaultFuchsiaResourceDialect,
4895 >,
4896 offset: usize,
4897 _depth: fidl::encoding::Depth,
4898 ) -> fidl::Result<()> {
4899 decoder.debug_check_bounds::<Self>(offset);
4900 fidl::decode!(
4902 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4903 fidl::encoding::DefaultFuchsiaResourceDialect,
4904 &mut self.control,
4905 decoder,
4906 offset + 0,
4907 _depth
4908 )?;
4909 Ok(())
4910 }
4911 }
4912
4913 impl fidl::encoding::ResourceTypeMarker for PeerHandlerWatchNextCallResponse {
4914 type Borrowed<'a> = &'a mut Self;
4915 fn take_or_borrow<'a>(
4916 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4917 ) -> Self::Borrowed<'a> {
4918 value
4919 }
4920 }
4921
4922 unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNextCallResponse {
4923 type Owned = Self;
4924
4925 #[inline(always)]
4926 fn inline_align(_context: fidl::encoding::Context) -> usize {
4927 8
4928 }
4929
4930 #[inline(always)]
4931 fn inline_size(_context: fidl::encoding::Context) -> usize {
4932 16
4933 }
4934 }
4935
4936 unsafe impl
4937 fidl::encoding::Encode<
4938 PeerHandlerWatchNextCallResponse,
4939 fidl::encoding::DefaultFuchsiaResourceDialect,
4940 > for &mut PeerHandlerWatchNextCallResponse
4941 {
4942 #[inline]
4943 unsafe fn encode(
4944 self,
4945 encoder: &mut fidl::encoding::Encoder<
4946 '_,
4947 fidl::encoding::DefaultFuchsiaResourceDialect,
4948 >,
4949 offset: usize,
4950 _depth: fidl::encoding::Depth,
4951 ) -> fidl::Result<()> {
4952 encoder.debug_check_bounds::<PeerHandlerWatchNextCallResponse>(offset);
4953 fidl::encoding::Encode::<
4955 PeerHandlerWatchNextCallResponse,
4956 fidl::encoding::DefaultFuchsiaResourceDialect,
4957 >::encode(
4958 (<NextCall as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.call),),
4959 encoder,
4960 offset,
4961 _depth,
4962 )
4963 }
4964 }
4965 unsafe impl<T0: fidl::encoding::Encode<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>>
4966 fidl::encoding::Encode<
4967 PeerHandlerWatchNextCallResponse,
4968 fidl::encoding::DefaultFuchsiaResourceDialect,
4969 > for (T0,)
4970 {
4971 #[inline]
4972 unsafe fn encode(
4973 self,
4974 encoder: &mut fidl::encoding::Encoder<
4975 '_,
4976 fidl::encoding::DefaultFuchsiaResourceDialect,
4977 >,
4978 offset: usize,
4979 depth: fidl::encoding::Depth,
4980 ) -> fidl::Result<()> {
4981 encoder.debug_check_bounds::<PeerHandlerWatchNextCallResponse>(offset);
4982 self.0.encode(encoder, offset + 0, depth)?;
4986 Ok(())
4987 }
4988 }
4989
4990 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4991 for PeerHandlerWatchNextCallResponse
4992 {
4993 #[inline(always)]
4994 fn new_empty() -> Self {
4995 Self { call: fidl::new_empty!(NextCall, fidl::encoding::DefaultFuchsiaResourceDialect) }
4996 }
4997
4998 #[inline]
4999 unsafe fn decode(
5000 &mut self,
5001 decoder: &mut fidl::encoding::Decoder<
5002 '_,
5003 fidl::encoding::DefaultFuchsiaResourceDialect,
5004 >,
5005 offset: usize,
5006 _depth: fidl::encoding::Depth,
5007 ) -> fidl::Result<()> {
5008 decoder.debug_check_bounds::<Self>(offset);
5009 fidl::decode!(
5011 NextCall,
5012 fidl::encoding::DefaultFuchsiaResourceDialect,
5013 &mut self.call,
5014 decoder,
5015 offset + 0,
5016 _depth
5017 )?;
5018 Ok(())
5019 }
5020 }
5021
5022 impl NextCall {
5023 #[inline(always)]
5024 fn max_ordinal_present(&self) -> u64 {
5025 if let Some(_) = self.direction {
5026 return 4;
5027 }
5028 if let Some(_) = self.state {
5029 return 3;
5030 }
5031 if let Some(_) = self.remote {
5032 return 2;
5033 }
5034 if let Some(_) = self.call {
5035 return 1;
5036 }
5037 0
5038 }
5039 }
5040
5041 impl fidl::encoding::ResourceTypeMarker for NextCall {
5042 type Borrowed<'a> = &'a mut Self;
5043 fn take_or_borrow<'a>(
5044 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5045 ) -> Self::Borrowed<'a> {
5046 value
5047 }
5048 }
5049
5050 unsafe impl fidl::encoding::TypeMarker for NextCall {
5051 type Owned = Self;
5052
5053 #[inline(always)]
5054 fn inline_align(_context: fidl::encoding::Context) -> usize {
5055 8
5056 }
5057
5058 #[inline(always)]
5059 fn inline_size(_context: fidl::encoding::Context) -> usize {
5060 16
5061 }
5062 }
5063
5064 unsafe impl fidl::encoding::Encode<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
5065 for &mut NextCall
5066 {
5067 unsafe fn encode(
5068 self,
5069 encoder: &mut fidl::encoding::Encoder<
5070 '_,
5071 fidl::encoding::DefaultFuchsiaResourceDialect,
5072 >,
5073 offset: usize,
5074 mut depth: fidl::encoding::Depth,
5075 ) -> fidl::Result<()> {
5076 encoder.debug_check_bounds::<NextCall>(offset);
5077 let max_ordinal: u64 = self.max_ordinal_present();
5079 encoder.write_num(max_ordinal, offset);
5080 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5081 if max_ordinal == 0 {
5083 return Ok(());
5084 }
5085 depth.increment()?;
5086 let envelope_size = 8;
5087 let bytes_len = max_ordinal as usize * envelope_size;
5088 #[allow(unused_variables)]
5089 let offset = encoder.out_of_line_offset(bytes_len);
5090 let mut _prev_end_offset: usize = 0;
5091 if 1 > max_ordinal {
5092 return Ok(());
5093 }
5094
5095 let cur_offset: usize = (1 - 1) * envelope_size;
5098
5099 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5101
5102 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5107 self.call.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5108 encoder, offset + cur_offset, depth
5109 )?;
5110
5111 _prev_end_offset = cur_offset + envelope_size;
5112 if 2 > max_ordinal {
5113 return Ok(());
5114 }
5115
5116 let cur_offset: usize = (2 - 1) * envelope_size;
5119
5120 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5122
5123 fidl::encoding::encode_in_envelope_optional::<
5128 fidl::encoding::BoundedString<256>,
5129 fidl::encoding::DefaultFuchsiaResourceDialect,
5130 >(
5131 self.remote.as_ref().map(
5132 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
5133 ),
5134 encoder,
5135 offset + cur_offset,
5136 depth,
5137 )?;
5138
5139 _prev_end_offset = cur_offset + envelope_size;
5140 if 3 > max_ordinal {
5141 return Ok(());
5142 }
5143
5144 let cur_offset: usize = (3 - 1) * envelope_size;
5147
5148 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5150
5151 fidl::encoding::encode_in_envelope_optional::<
5156 CallState,
5157 fidl::encoding::DefaultFuchsiaResourceDialect,
5158 >(
5159 self.state.as_ref().map(<CallState as fidl::encoding::ValueTypeMarker>::borrow),
5160 encoder,
5161 offset + cur_offset,
5162 depth,
5163 )?;
5164
5165 _prev_end_offset = cur_offset + envelope_size;
5166 if 4 > max_ordinal {
5167 return Ok(());
5168 }
5169
5170 let cur_offset: usize = (4 - 1) * envelope_size;
5173
5174 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5176
5177 fidl::encoding::encode_in_envelope_optional::<
5182 CallDirection,
5183 fidl::encoding::DefaultFuchsiaResourceDialect,
5184 >(
5185 self.direction
5186 .as_ref()
5187 .map(<CallDirection as fidl::encoding::ValueTypeMarker>::borrow),
5188 encoder,
5189 offset + cur_offset,
5190 depth,
5191 )?;
5192
5193 _prev_end_offset = cur_offset + envelope_size;
5194
5195 Ok(())
5196 }
5197 }
5198
5199 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NextCall {
5200 #[inline(always)]
5201 fn new_empty() -> Self {
5202 Self::default()
5203 }
5204
5205 unsafe fn decode(
5206 &mut self,
5207 decoder: &mut fidl::encoding::Decoder<
5208 '_,
5209 fidl::encoding::DefaultFuchsiaResourceDialect,
5210 >,
5211 offset: usize,
5212 mut depth: fidl::encoding::Depth,
5213 ) -> fidl::Result<()> {
5214 decoder.debug_check_bounds::<Self>(offset);
5215 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5216 None => return Err(fidl::Error::NotNullable),
5217 Some(len) => len,
5218 };
5219 if len == 0 {
5221 return Ok(());
5222 };
5223 depth.increment()?;
5224 let envelope_size = 8;
5225 let bytes_len = len * envelope_size;
5226 let offset = decoder.out_of_line_offset(bytes_len)?;
5227 let mut _next_ordinal_to_read = 0;
5229 let mut next_offset = offset;
5230 let end_offset = offset + bytes_len;
5231 _next_ordinal_to_read += 1;
5232 if next_offset >= end_offset {
5233 return Ok(());
5234 }
5235
5236 while _next_ordinal_to_read < 1 {
5238 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5239 _next_ordinal_to_read += 1;
5240 next_offset += envelope_size;
5241 }
5242
5243 let next_out_of_line = decoder.next_out_of_line();
5244 let handles_before = decoder.remaining_handles();
5245 if let Some((inlined, num_bytes, num_handles)) =
5246 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5247 {
5248 let member_inline_size = <fidl::encoding::Endpoint<
5249 fidl::endpoints::ClientEnd<CallMarker>,
5250 > as fidl::encoding::TypeMarker>::inline_size(
5251 decoder.context
5252 );
5253 if inlined != (member_inline_size <= 4) {
5254 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5255 }
5256 let inner_offset;
5257 let mut inner_depth = depth.clone();
5258 if inlined {
5259 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5260 inner_offset = next_offset;
5261 } else {
5262 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5263 inner_depth.increment()?;
5264 }
5265 let val_ref = self.call.get_or_insert_with(|| {
5266 fidl::new_empty!(
5267 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
5268 fidl::encoding::DefaultFuchsiaResourceDialect
5269 )
5270 });
5271 fidl::decode!(
5272 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
5273 fidl::encoding::DefaultFuchsiaResourceDialect,
5274 val_ref,
5275 decoder,
5276 inner_offset,
5277 inner_depth
5278 )?;
5279 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5280 {
5281 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5282 }
5283 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5284 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5285 }
5286 }
5287
5288 next_offset += envelope_size;
5289 _next_ordinal_to_read += 1;
5290 if next_offset >= end_offset {
5291 return Ok(());
5292 }
5293
5294 while _next_ordinal_to_read < 2 {
5296 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5297 _next_ordinal_to_read += 1;
5298 next_offset += envelope_size;
5299 }
5300
5301 let next_out_of_line = decoder.next_out_of_line();
5302 let handles_before = decoder.remaining_handles();
5303 if let Some((inlined, num_bytes, num_handles)) =
5304 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5305 {
5306 let member_inline_size =
5307 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5308 decoder.context,
5309 );
5310 if inlined != (member_inline_size <= 4) {
5311 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5312 }
5313 let inner_offset;
5314 let mut inner_depth = depth.clone();
5315 if inlined {
5316 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5317 inner_offset = next_offset;
5318 } else {
5319 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5320 inner_depth.increment()?;
5321 }
5322 let val_ref = self.remote.get_or_insert_with(|| {
5323 fidl::new_empty!(
5324 fidl::encoding::BoundedString<256>,
5325 fidl::encoding::DefaultFuchsiaResourceDialect
5326 )
5327 });
5328 fidl::decode!(
5329 fidl::encoding::BoundedString<256>,
5330 fidl::encoding::DefaultFuchsiaResourceDialect,
5331 val_ref,
5332 decoder,
5333 inner_offset,
5334 inner_depth
5335 )?;
5336 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5337 {
5338 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5339 }
5340 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5341 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5342 }
5343 }
5344
5345 next_offset += envelope_size;
5346 _next_ordinal_to_read += 1;
5347 if next_offset >= end_offset {
5348 return Ok(());
5349 }
5350
5351 while _next_ordinal_to_read < 3 {
5353 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5354 _next_ordinal_to_read += 1;
5355 next_offset += envelope_size;
5356 }
5357
5358 let next_out_of_line = decoder.next_out_of_line();
5359 let handles_before = decoder.remaining_handles();
5360 if let Some((inlined, num_bytes, num_handles)) =
5361 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5362 {
5363 let member_inline_size =
5364 <CallState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5365 if inlined != (member_inline_size <= 4) {
5366 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5367 }
5368 let inner_offset;
5369 let mut inner_depth = depth.clone();
5370 if inlined {
5371 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5372 inner_offset = next_offset;
5373 } else {
5374 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5375 inner_depth.increment()?;
5376 }
5377 let val_ref = self.state.get_or_insert_with(|| {
5378 fidl::new_empty!(CallState, fidl::encoding::DefaultFuchsiaResourceDialect)
5379 });
5380 fidl::decode!(
5381 CallState,
5382 fidl::encoding::DefaultFuchsiaResourceDialect,
5383 val_ref,
5384 decoder,
5385 inner_offset,
5386 inner_depth
5387 )?;
5388 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5389 {
5390 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5391 }
5392 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5393 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5394 }
5395 }
5396
5397 next_offset += envelope_size;
5398 _next_ordinal_to_read += 1;
5399 if next_offset >= end_offset {
5400 return Ok(());
5401 }
5402
5403 while _next_ordinal_to_read < 4 {
5405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5406 _next_ordinal_to_read += 1;
5407 next_offset += envelope_size;
5408 }
5409
5410 let next_out_of_line = decoder.next_out_of_line();
5411 let handles_before = decoder.remaining_handles();
5412 if let Some((inlined, num_bytes, num_handles)) =
5413 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5414 {
5415 let member_inline_size =
5416 <CallDirection as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5417 if inlined != (member_inline_size <= 4) {
5418 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5419 }
5420 let inner_offset;
5421 let mut inner_depth = depth.clone();
5422 if inlined {
5423 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5424 inner_offset = next_offset;
5425 } else {
5426 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5427 inner_depth.increment()?;
5428 }
5429 let val_ref = self.direction.get_or_insert_with(|| {
5430 fidl::new_empty!(CallDirection, fidl::encoding::DefaultFuchsiaResourceDialect)
5431 });
5432 fidl::decode!(
5433 CallDirection,
5434 fidl::encoding::DefaultFuchsiaResourceDialect,
5435 val_ref,
5436 decoder,
5437 inner_offset,
5438 inner_depth
5439 )?;
5440 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5441 {
5442 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5443 }
5444 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5445 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5446 }
5447 }
5448
5449 next_offset += envelope_size;
5450
5451 while next_offset < end_offset {
5453 _next_ordinal_to_read += 1;
5454 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5455 next_offset += envelope_size;
5456 }
5457
5458 Ok(())
5459 }
5460 }
5461}