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#[derive(Debug, Clone)]
244pub struct CallProxy {
245 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
246}
247
248impl fidl::endpoints::Proxy for CallProxy {
249 type Protocol = CallMarker;
250
251 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
252 Self::new(inner)
253 }
254
255 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
256 self.client.into_channel().map_err(|client| Self { client })
257 }
258
259 fn as_channel(&self) -> &::fidl::AsyncChannel {
260 self.client.as_channel()
261 }
262}
263
264impl CallProxy {
265 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
267 let protocol_name = <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
268 Self { client: fidl::client::Client::new(channel, protocol_name) }
269 }
270
271 pub fn take_event_stream(&self) -> CallEventStream {
277 CallEventStream { event_receiver: self.client.take_event_receiver() }
278 }
279
280 pub fn r#watch_state(
283 &self,
284 ) -> fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>
285 {
286 CallProxyInterface::r#watch_state(self)
287 }
288
289 pub fn r#request_hold(&self) -> Result<(), fidl::Error> {
291 CallProxyInterface::r#request_hold(self)
292 }
293
294 pub fn r#request_active(&self) -> Result<(), fidl::Error> {
298 CallProxyInterface::r#request_active(self)
299 }
300
301 pub fn r#request_terminate(&self) -> Result<(), fidl::Error> {
303 CallProxyInterface::r#request_terminate(self)
304 }
305
306 pub fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
309 CallProxyInterface::r#request_transfer_audio(self)
310 }
311
312 pub fn r#send_dtmf_code(
319 &self,
320 mut code: DtmfCode,
321 ) -> fidl::client::QueryResponseFut<
322 CallSendDtmfCodeResult,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 > {
325 CallProxyInterface::r#send_dtmf_code(self, code)
326 }
327}
328
329impl CallProxyInterface for CallProxy {
330 type WatchStateResponseFut =
331 fidl::client::QueryResponseFut<CallState, fidl::encoding::DefaultFuchsiaResourceDialect>;
332 fn r#watch_state(&self) -> Self::WatchStateResponseFut {
333 fn _decode(
334 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
335 ) -> Result<CallState, fidl::Error> {
336 let _response = fidl::client::decode_transaction_body::<
337 CallWatchStateResponse,
338 fidl::encoding::DefaultFuchsiaResourceDialect,
339 0x5262bcc909bdaeb5,
340 >(_buf?)?;
341 Ok(_response.state)
342 }
343 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CallState>(
344 (),
345 0x5262bcc909bdaeb5,
346 fidl::encoding::DynamicFlags::empty(),
347 _decode,
348 )
349 }
350
351 fn r#request_hold(&self) -> Result<(), fidl::Error> {
352 self.client.send::<fidl::encoding::EmptyPayload>(
353 (),
354 0x35ade403017d20eb,
355 fidl::encoding::DynamicFlags::empty(),
356 )
357 }
358
359 fn r#request_active(&self) -> Result<(), fidl::Error> {
360 self.client.send::<fidl::encoding::EmptyPayload>(
361 (),
362 0x248518f967f1fe6e,
363 fidl::encoding::DynamicFlags::empty(),
364 )
365 }
366
367 fn r#request_terminate(&self) -> Result<(), fidl::Error> {
368 self.client.send::<fidl::encoding::EmptyPayload>(
369 (),
370 0x4940915197ee4916,
371 fidl::encoding::DynamicFlags::empty(),
372 )
373 }
374
375 fn r#request_transfer_audio(&self) -> Result<(), fidl::Error> {
376 self.client.send::<fidl::encoding::EmptyPayload>(
377 (),
378 0xb0ca6649f2e104c,
379 fidl::encoding::DynamicFlags::empty(),
380 )
381 }
382
383 type SendDtmfCodeResponseFut = fidl::client::QueryResponseFut<
384 CallSendDtmfCodeResult,
385 fidl::encoding::DefaultFuchsiaResourceDialect,
386 >;
387 fn r#send_dtmf_code(&self, mut code: DtmfCode) -> Self::SendDtmfCodeResponseFut {
388 fn _decode(
389 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390 ) -> Result<CallSendDtmfCodeResult, fidl::Error> {
391 let _response = fidl::client::decode_transaction_body::<
392 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
393 fidl::encoding::DefaultFuchsiaResourceDialect,
394 0x50768933ca33fcd6,
395 >(_buf?)?;
396 Ok(_response.map(|x| x))
397 }
398 self.client.send_query_and_decode::<CallSendDtmfCodeRequest, CallSendDtmfCodeResult>(
399 (code,),
400 0x50768933ca33fcd6,
401 fidl::encoding::DynamicFlags::empty(),
402 _decode,
403 )
404 }
405}
406
407pub struct CallEventStream {
408 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
409}
410
411impl std::marker::Unpin for CallEventStream {}
412
413impl futures::stream::FusedStream for CallEventStream {
414 fn is_terminated(&self) -> bool {
415 self.event_receiver.is_terminated()
416 }
417}
418
419impl futures::Stream for CallEventStream {
420 type Item = Result<CallEvent, fidl::Error>;
421
422 fn poll_next(
423 mut self: std::pin::Pin<&mut Self>,
424 cx: &mut std::task::Context<'_>,
425 ) -> std::task::Poll<Option<Self::Item>> {
426 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
427 &mut self.event_receiver,
428 cx
429 )?) {
430 Some(buf) => std::task::Poll::Ready(Some(CallEvent::decode(buf))),
431 None => std::task::Poll::Ready(None),
432 }
433 }
434}
435
436#[derive(Debug)]
437pub enum CallEvent {}
438
439impl CallEvent {
440 fn decode(
442 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
443 ) -> Result<CallEvent, fidl::Error> {
444 let (bytes, _handles) = buf.split_mut();
445 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
446 debug_assert_eq!(tx_header.tx_id, 0);
447 match tx_header.ordinal {
448 _ => Err(fidl::Error::UnknownOrdinal {
449 ordinal: tx_header.ordinal,
450 protocol_name: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
451 }),
452 }
453 }
454}
455
456pub struct CallRequestStream {
458 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
459 is_terminated: bool,
460}
461
462impl std::marker::Unpin for CallRequestStream {}
463
464impl futures::stream::FusedStream for CallRequestStream {
465 fn is_terminated(&self) -> bool {
466 self.is_terminated
467 }
468}
469
470impl fidl::endpoints::RequestStream for CallRequestStream {
471 type Protocol = CallMarker;
472 type ControlHandle = CallControlHandle;
473
474 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
475 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
476 }
477
478 fn control_handle(&self) -> Self::ControlHandle {
479 CallControlHandle { inner: self.inner.clone() }
480 }
481
482 fn into_inner(
483 self,
484 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
485 {
486 (self.inner, self.is_terminated)
487 }
488
489 fn from_inner(
490 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
491 is_terminated: bool,
492 ) -> Self {
493 Self { inner, is_terminated }
494 }
495}
496
497impl futures::Stream for CallRequestStream {
498 type Item = Result<CallRequest, fidl::Error>;
499
500 fn poll_next(
501 mut self: std::pin::Pin<&mut Self>,
502 cx: &mut std::task::Context<'_>,
503 ) -> std::task::Poll<Option<Self::Item>> {
504 let this = &mut *self;
505 if this.inner.check_shutdown(cx) {
506 this.is_terminated = true;
507 return std::task::Poll::Ready(None);
508 }
509 if this.is_terminated {
510 panic!("polled CallRequestStream after completion");
511 }
512 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
513 |bytes, handles| {
514 match this.inner.channel().read_etc(cx, bytes, handles) {
515 std::task::Poll::Ready(Ok(())) => {}
516 std::task::Poll::Pending => return std::task::Poll::Pending,
517 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
518 this.is_terminated = true;
519 return std::task::Poll::Ready(None);
520 }
521 std::task::Poll::Ready(Err(e)) => {
522 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
523 e.into(),
524 ))))
525 }
526 }
527
528 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
530
531 std::task::Poll::Ready(Some(match header.ordinal {
532 0x5262bcc909bdaeb5 => {
533 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
534 let mut req = fidl::new_empty!(
535 fidl::encoding::EmptyPayload,
536 fidl::encoding::DefaultFuchsiaResourceDialect
537 );
538 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
539 let control_handle = CallControlHandle { inner: this.inner.clone() };
540 Ok(CallRequest::WatchState {
541 responder: CallWatchStateResponder {
542 control_handle: std::mem::ManuallyDrop::new(control_handle),
543 tx_id: header.tx_id,
544 },
545 })
546 }
547 0x35ade403017d20eb => {
548 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
549 let mut req = fidl::new_empty!(
550 fidl::encoding::EmptyPayload,
551 fidl::encoding::DefaultFuchsiaResourceDialect
552 );
553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
554 let control_handle = CallControlHandle { inner: this.inner.clone() };
555 Ok(CallRequest::RequestHold { control_handle })
556 }
557 0x248518f967f1fe6e => {
558 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
559 let mut req = fidl::new_empty!(
560 fidl::encoding::EmptyPayload,
561 fidl::encoding::DefaultFuchsiaResourceDialect
562 );
563 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
564 let control_handle = CallControlHandle { inner: this.inner.clone() };
565 Ok(CallRequest::RequestActive { control_handle })
566 }
567 0x4940915197ee4916 => {
568 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
569 let mut req = fidl::new_empty!(
570 fidl::encoding::EmptyPayload,
571 fidl::encoding::DefaultFuchsiaResourceDialect
572 );
573 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
574 let control_handle = CallControlHandle { inner: this.inner.clone() };
575 Ok(CallRequest::RequestTerminate { control_handle })
576 }
577 0xb0ca6649f2e104c => {
578 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
579 let mut req = fidl::new_empty!(
580 fidl::encoding::EmptyPayload,
581 fidl::encoding::DefaultFuchsiaResourceDialect
582 );
583 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
584 let control_handle = CallControlHandle { inner: this.inner.clone() };
585 Ok(CallRequest::RequestTransferAudio { control_handle })
586 }
587 0x50768933ca33fcd6 => {
588 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
589 let mut req = fidl::new_empty!(
590 CallSendDtmfCodeRequest,
591 fidl::encoding::DefaultFuchsiaResourceDialect
592 );
593 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallSendDtmfCodeRequest>(&header, _body_bytes, handles, &mut req)?;
594 let control_handle = CallControlHandle { inner: this.inner.clone() };
595 Ok(CallRequest::SendDtmfCode {
596 code: req.code,
597
598 responder: CallSendDtmfCodeResponder {
599 control_handle: std::mem::ManuallyDrop::new(control_handle),
600 tx_id: header.tx_id,
601 },
602 })
603 }
604 _ => Err(fidl::Error::UnknownOrdinal {
605 ordinal: header.ordinal,
606 protocol_name: <CallMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
607 }),
608 }))
609 },
610 )
611 }
612}
613
614#[derive(Debug)]
616pub enum CallRequest {
617 WatchState { responder: CallWatchStateResponder },
620 RequestHold { control_handle: CallControlHandle },
622 RequestActive { control_handle: CallControlHandle },
626 RequestTerminate { control_handle: CallControlHandle },
628 RequestTransferAudio { control_handle: CallControlHandle },
631 SendDtmfCode { code: DtmfCode, responder: CallSendDtmfCodeResponder },
638}
639
640impl CallRequest {
641 #[allow(irrefutable_let_patterns)]
642 pub fn into_watch_state(self) -> Option<(CallWatchStateResponder)> {
643 if let CallRequest::WatchState { responder } = self {
644 Some((responder))
645 } else {
646 None
647 }
648 }
649
650 #[allow(irrefutable_let_patterns)]
651 pub fn into_request_hold(self) -> Option<(CallControlHandle)> {
652 if let CallRequest::RequestHold { control_handle } = self {
653 Some((control_handle))
654 } else {
655 None
656 }
657 }
658
659 #[allow(irrefutable_let_patterns)]
660 pub fn into_request_active(self) -> Option<(CallControlHandle)> {
661 if let CallRequest::RequestActive { control_handle } = self {
662 Some((control_handle))
663 } else {
664 None
665 }
666 }
667
668 #[allow(irrefutable_let_patterns)]
669 pub fn into_request_terminate(self) -> Option<(CallControlHandle)> {
670 if let CallRequest::RequestTerminate { control_handle } = self {
671 Some((control_handle))
672 } else {
673 None
674 }
675 }
676
677 #[allow(irrefutable_let_patterns)]
678 pub fn into_request_transfer_audio(self) -> Option<(CallControlHandle)> {
679 if let CallRequest::RequestTransferAudio { control_handle } = self {
680 Some((control_handle))
681 } else {
682 None
683 }
684 }
685
686 #[allow(irrefutable_let_patterns)]
687 pub fn into_send_dtmf_code(self) -> Option<(DtmfCode, CallSendDtmfCodeResponder)> {
688 if let CallRequest::SendDtmfCode { code, responder } = self {
689 Some((code, responder))
690 } else {
691 None
692 }
693 }
694
695 pub fn method_name(&self) -> &'static str {
697 match *self {
698 CallRequest::WatchState { .. } => "watch_state",
699 CallRequest::RequestHold { .. } => "request_hold",
700 CallRequest::RequestActive { .. } => "request_active",
701 CallRequest::RequestTerminate { .. } => "request_terminate",
702 CallRequest::RequestTransferAudio { .. } => "request_transfer_audio",
703 CallRequest::SendDtmfCode { .. } => "send_dtmf_code",
704 }
705 }
706}
707
708#[derive(Debug, Clone)]
709pub struct CallControlHandle {
710 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
711}
712
713impl fidl::endpoints::ControlHandle for CallControlHandle {
714 fn shutdown(&self) {
715 self.inner.shutdown()
716 }
717 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
718 self.inner.shutdown_with_epitaph(status)
719 }
720
721 fn is_closed(&self) -> bool {
722 self.inner.channel().is_closed()
723 }
724 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
725 self.inner.channel().on_closed()
726 }
727
728 #[cfg(target_os = "fuchsia")]
729 fn signal_peer(
730 &self,
731 clear_mask: zx::Signals,
732 set_mask: zx::Signals,
733 ) -> Result<(), zx_status::Status> {
734 use fidl::Peered;
735 self.inner.channel().signal_peer(clear_mask, set_mask)
736 }
737}
738
739impl CallControlHandle {}
740
741#[must_use = "FIDL methods require a response to be sent"]
742#[derive(Debug)]
743pub struct CallWatchStateResponder {
744 control_handle: std::mem::ManuallyDrop<CallControlHandle>,
745 tx_id: u32,
746}
747
748impl std::ops::Drop for CallWatchStateResponder {
752 fn drop(&mut self) {
753 self.control_handle.shutdown();
754 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
756 }
757}
758
759impl fidl::endpoints::Responder for CallWatchStateResponder {
760 type ControlHandle = CallControlHandle;
761
762 fn control_handle(&self) -> &CallControlHandle {
763 &self.control_handle
764 }
765
766 fn drop_without_shutdown(mut self) {
767 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
769 std::mem::forget(self);
771 }
772}
773
774impl CallWatchStateResponder {
775 pub fn send(self, mut state: CallState) -> Result<(), fidl::Error> {
779 let _result = self.send_raw(state);
780 if _result.is_err() {
781 self.control_handle.shutdown();
782 }
783 self.drop_without_shutdown();
784 _result
785 }
786
787 pub fn send_no_shutdown_on_err(self, mut state: CallState) -> Result<(), fidl::Error> {
789 let _result = self.send_raw(state);
790 self.drop_without_shutdown();
791 _result
792 }
793
794 fn send_raw(&self, mut state: CallState) -> Result<(), fidl::Error> {
795 self.control_handle.inner.send::<CallWatchStateResponse>(
796 (state,),
797 self.tx_id,
798 0x5262bcc909bdaeb5,
799 fidl::encoding::DynamicFlags::empty(),
800 )
801 }
802}
803
804#[must_use = "FIDL methods require a response to be sent"]
805#[derive(Debug)]
806pub struct CallSendDtmfCodeResponder {
807 control_handle: std::mem::ManuallyDrop<CallControlHandle>,
808 tx_id: u32,
809}
810
811impl std::ops::Drop for CallSendDtmfCodeResponder {
815 fn drop(&mut self) {
816 self.control_handle.shutdown();
817 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
819 }
820}
821
822impl fidl::endpoints::Responder for CallSendDtmfCodeResponder {
823 type ControlHandle = CallControlHandle;
824
825 fn control_handle(&self) -> &CallControlHandle {
826 &self.control_handle
827 }
828
829 fn drop_without_shutdown(mut self) {
830 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
832 std::mem::forget(self);
834 }
835}
836
837impl CallSendDtmfCodeResponder {
838 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
842 let _result = self.send_raw(result);
843 if _result.is_err() {
844 self.control_handle.shutdown();
845 }
846 self.drop_without_shutdown();
847 _result
848 }
849
850 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
852 let _result = self.send_raw(result);
853 self.drop_without_shutdown();
854 _result
855 }
856
857 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
858 self.control_handle
859 .inner
860 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
861 result,
862 self.tx_id,
863 0x50768933ca33fcd6,
864 fidl::encoding::DynamicFlags::empty(),
865 )
866 }
867}
868
869#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
870pub struct CallManagerMarker;
871
872impl fidl::endpoints::ProtocolMarker for CallManagerMarker {
873 type Proxy = CallManagerProxy;
874 type RequestStream = CallManagerRequestStream;
875 #[cfg(target_os = "fuchsia")]
876 type SynchronousProxy = CallManagerSynchronousProxy;
877
878 const DEBUG_NAME: &'static str = "(anonymous) CallManager";
879}
880
881pub trait CallManagerProxyInterface: Send + Sync {
882 type PeerConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
883 fn r#peer_connected(
884 &self,
885 id: &fidl_fuchsia_bluetooth::PeerId,
886 handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
887 ) -> Self::PeerConnectedResponseFut;
888}
889#[derive(Debug)]
890#[cfg(target_os = "fuchsia")]
891pub struct CallManagerSynchronousProxy {
892 client: fidl::client::sync::Client,
893}
894
895#[cfg(target_os = "fuchsia")]
896impl fidl::endpoints::SynchronousProxy for CallManagerSynchronousProxy {
897 type Proxy = CallManagerProxy;
898 type Protocol = CallManagerMarker;
899
900 fn from_channel(inner: fidl::Channel) -> Self {
901 Self::new(inner)
902 }
903
904 fn into_channel(self) -> fidl::Channel {
905 self.client.into_channel()
906 }
907
908 fn as_channel(&self) -> &fidl::Channel {
909 self.client.as_channel()
910 }
911}
912
913#[cfg(target_os = "fuchsia")]
914impl CallManagerSynchronousProxy {
915 pub fn new(channel: fidl::Channel) -> Self {
916 let protocol_name = <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
917 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
918 }
919
920 pub fn into_channel(self) -> fidl::Channel {
921 self.client.into_channel()
922 }
923
924 pub fn wait_for_event(
927 &self,
928 deadline: zx::MonotonicInstant,
929 ) -> Result<CallManagerEvent, fidl::Error> {
930 CallManagerEvent::decode(self.client.wait_for_event(deadline)?)
931 }
932
933 pub fn r#peer_connected(
944 &self,
945 mut id: &fidl_fuchsia_bluetooth::PeerId,
946 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
947 ___deadline: zx::MonotonicInstant,
948 ) -> Result<(), fidl::Error> {
949 let _response = self
950 .client
951 .send_query::<CallManagerPeerConnectedRequest, fidl::encoding::EmptyPayload>(
952 (id, handle),
953 0x1431cc24b2980086,
954 fidl::encoding::DynamicFlags::empty(),
955 ___deadline,
956 )?;
957 Ok(_response)
958 }
959}
960
961#[cfg(target_os = "fuchsia")]
962impl From<CallManagerSynchronousProxy> for zx::Handle {
963 fn from(value: CallManagerSynchronousProxy) -> Self {
964 value.into_channel().into()
965 }
966}
967
968#[cfg(target_os = "fuchsia")]
969impl From<fidl::Channel> for CallManagerSynchronousProxy {
970 fn from(value: fidl::Channel) -> Self {
971 Self::new(value)
972 }
973}
974
975#[derive(Debug, Clone)]
976pub struct CallManagerProxy {
977 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
978}
979
980impl fidl::endpoints::Proxy for CallManagerProxy {
981 type Protocol = CallManagerMarker;
982
983 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
984 Self::new(inner)
985 }
986
987 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
988 self.client.into_channel().map_err(|client| Self { client })
989 }
990
991 fn as_channel(&self) -> &::fidl::AsyncChannel {
992 self.client.as_channel()
993 }
994}
995
996impl CallManagerProxy {
997 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
999 let protocol_name = <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1000 Self { client: fidl::client::Client::new(channel, protocol_name) }
1001 }
1002
1003 pub fn take_event_stream(&self) -> CallManagerEventStream {
1009 CallManagerEventStream { event_receiver: self.client.take_event_receiver() }
1010 }
1011
1012 pub fn r#peer_connected(
1023 &self,
1024 mut id: &fidl_fuchsia_bluetooth::PeerId,
1025 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1026 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1027 CallManagerProxyInterface::r#peer_connected(self, id, handle)
1028 }
1029}
1030
1031impl CallManagerProxyInterface for CallManagerProxy {
1032 type PeerConnectedResponseFut =
1033 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1034 fn r#peer_connected(
1035 &self,
1036 mut id: &fidl_fuchsia_bluetooth::PeerId,
1037 mut handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1038 ) -> Self::PeerConnectedResponseFut {
1039 fn _decode(
1040 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1041 ) -> Result<(), fidl::Error> {
1042 let _response = fidl::client::decode_transaction_body::<
1043 fidl::encoding::EmptyPayload,
1044 fidl::encoding::DefaultFuchsiaResourceDialect,
1045 0x1431cc24b2980086,
1046 >(_buf?)?;
1047 Ok(_response)
1048 }
1049 self.client.send_query_and_decode::<CallManagerPeerConnectedRequest, ()>(
1050 (id, handle),
1051 0x1431cc24b2980086,
1052 fidl::encoding::DynamicFlags::empty(),
1053 _decode,
1054 )
1055 }
1056}
1057
1058pub struct CallManagerEventStream {
1059 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1060}
1061
1062impl std::marker::Unpin for CallManagerEventStream {}
1063
1064impl futures::stream::FusedStream for CallManagerEventStream {
1065 fn is_terminated(&self) -> bool {
1066 self.event_receiver.is_terminated()
1067 }
1068}
1069
1070impl futures::Stream for CallManagerEventStream {
1071 type Item = Result<CallManagerEvent, fidl::Error>;
1072
1073 fn poll_next(
1074 mut self: std::pin::Pin<&mut Self>,
1075 cx: &mut std::task::Context<'_>,
1076 ) -> std::task::Poll<Option<Self::Item>> {
1077 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1078 &mut self.event_receiver,
1079 cx
1080 )?) {
1081 Some(buf) => std::task::Poll::Ready(Some(CallManagerEvent::decode(buf))),
1082 None => std::task::Poll::Ready(None),
1083 }
1084 }
1085}
1086
1087#[derive(Debug)]
1088pub enum CallManagerEvent {}
1089
1090impl CallManagerEvent {
1091 fn decode(
1093 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1094 ) -> Result<CallManagerEvent, fidl::Error> {
1095 let (bytes, _handles) = buf.split_mut();
1096 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1097 debug_assert_eq!(tx_header.tx_id, 0);
1098 match tx_header.ordinal {
1099 _ => Err(fidl::Error::UnknownOrdinal {
1100 ordinal: tx_header.ordinal,
1101 protocol_name: <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1102 }),
1103 }
1104 }
1105}
1106
1107pub struct CallManagerRequestStream {
1109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1110 is_terminated: bool,
1111}
1112
1113impl std::marker::Unpin for CallManagerRequestStream {}
1114
1115impl futures::stream::FusedStream for CallManagerRequestStream {
1116 fn is_terminated(&self) -> bool {
1117 self.is_terminated
1118 }
1119}
1120
1121impl fidl::endpoints::RequestStream for CallManagerRequestStream {
1122 type Protocol = CallManagerMarker;
1123 type ControlHandle = CallManagerControlHandle;
1124
1125 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1126 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1127 }
1128
1129 fn control_handle(&self) -> Self::ControlHandle {
1130 CallManagerControlHandle { inner: self.inner.clone() }
1131 }
1132
1133 fn into_inner(
1134 self,
1135 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1136 {
1137 (self.inner, self.is_terminated)
1138 }
1139
1140 fn from_inner(
1141 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1142 is_terminated: bool,
1143 ) -> Self {
1144 Self { inner, is_terminated }
1145 }
1146}
1147
1148impl futures::Stream for CallManagerRequestStream {
1149 type Item = Result<CallManagerRequest, fidl::Error>;
1150
1151 fn poll_next(
1152 mut self: std::pin::Pin<&mut Self>,
1153 cx: &mut std::task::Context<'_>,
1154 ) -> std::task::Poll<Option<Self::Item>> {
1155 let this = &mut *self;
1156 if this.inner.check_shutdown(cx) {
1157 this.is_terminated = true;
1158 return std::task::Poll::Ready(None);
1159 }
1160 if this.is_terminated {
1161 panic!("polled CallManagerRequestStream after completion");
1162 }
1163 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1164 |bytes, handles| {
1165 match this.inner.channel().read_etc(cx, bytes, handles) {
1166 std::task::Poll::Ready(Ok(())) => {}
1167 std::task::Poll::Pending => return std::task::Poll::Pending,
1168 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1169 this.is_terminated = true;
1170 return std::task::Poll::Ready(None);
1171 }
1172 std::task::Poll::Ready(Err(e)) => {
1173 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1174 e.into(),
1175 ))))
1176 }
1177 }
1178
1179 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1181
1182 std::task::Poll::Ready(Some(match header.ordinal {
1183 0x1431cc24b2980086 => {
1184 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1185 let mut req = fidl::new_empty!(
1186 CallManagerPeerConnectedRequest,
1187 fidl::encoding::DefaultFuchsiaResourceDialect
1188 );
1189 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CallManagerPeerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
1190 let control_handle = CallManagerControlHandle { inner: this.inner.clone() };
1191 Ok(CallManagerRequest::PeerConnected {
1192 id: req.id,
1193 handle: req.handle,
1194
1195 responder: CallManagerPeerConnectedResponder {
1196 control_handle: std::mem::ManuallyDrop::new(control_handle),
1197 tx_id: header.tx_id,
1198 },
1199 })
1200 }
1201 _ => Err(fidl::Error::UnknownOrdinal {
1202 ordinal: header.ordinal,
1203 protocol_name:
1204 <CallManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1205 }),
1206 }))
1207 },
1208 )
1209 }
1210}
1211
1212#[derive(Debug)]
1213pub enum CallManagerRequest {
1214 PeerConnected {
1225 id: fidl_fuchsia_bluetooth::PeerId,
1226 handle: fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1227 responder: CallManagerPeerConnectedResponder,
1228 },
1229}
1230
1231impl CallManagerRequest {
1232 #[allow(irrefutable_let_patterns)]
1233 pub fn into_peer_connected(
1234 self,
1235 ) -> Option<(
1236 fidl_fuchsia_bluetooth::PeerId,
1237 fidl::endpoints::ServerEnd<PeerHandlerMarker>,
1238 CallManagerPeerConnectedResponder,
1239 )> {
1240 if let CallManagerRequest::PeerConnected { id, handle, responder } = self {
1241 Some((id, handle, responder))
1242 } else {
1243 None
1244 }
1245 }
1246
1247 pub fn method_name(&self) -> &'static str {
1249 match *self {
1250 CallManagerRequest::PeerConnected { .. } => "peer_connected",
1251 }
1252 }
1253}
1254
1255#[derive(Debug, Clone)]
1256pub struct CallManagerControlHandle {
1257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1258}
1259
1260impl fidl::endpoints::ControlHandle for CallManagerControlHandle {
1261 fn shutdown(&self) {
1262 self.inner.shutdown()
1263 }
1264 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1265 self.inner.shutdown_with_epitaph(status)
1266 }
1267
1268 fn is_closed(&self) -> bool {
1269 self.inner.channel().is_closed()
1270 }
1271 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1272 self.inner.channel().on_closed()
1273 }
1274
1275 #[cfg(target_os = "fuchsia")]
1276 fn signal_peer(
1277 &self,
1278 clear_mask: zx::Signals,
1279 set_mask: zx::Signals,
1280 ) -> Result<(), zx_status::Status> {
1281 use fidl::Peered;
1282 self.inner.channel().signal_peer(clear_mask, set_mask)
1283 }
1284}
1285
1286impl CallManagerControlHandle {}
1287
1288#[must_use = "FIDL methods require a response to be sent"]
1289#[derive(Debug)]
1290pub struct CallManagerPeerConnectedResponder {
1291 control_handle: std::mem::ManuallyDrop<CallManagerControlHandle>,
1292 tx_id: u32,
1293}
1294
1295impl std::ops::Drop for CallManagerPeerConnectedResponder {
1299 fn drop(&mut self) {
1300 self.control_handle.shutdown();
1301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1303 }
1304}
1305
1306impl fidl::endpoints::Responder for CallManagerPeerConnectedResponder {
1307 type ControlHandle = CallManagerControlHandle;
1308
1309 fn control_handle(&self) -> &CallManagerControlHandle {
1310 &self.control_handle
1311 }
1312
1313 fn drop_without_shutdown(mut self) {
1314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1316 std::mem::forget(self);
1318 }
1319}
1320
1321impl CallManagerPeerConnectedResponder {
1322 pub fn send(self) -> Result<(), fidl::Error> {
1326 let _result = self.send_raw();
1327 if _result.is_err() {
1328 self.control_handle.shutdown();
1329 }
1330 self.drop_without_shutdown();
1331 _result
1332 }
1333
1334 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1336 let _result = self.send_raw();
1337 self.drop_without_shutdown();
1338 _result
1339 }
1340
1341 fn send_raw(&self) -> Result<(), fidl::Error> {
1342 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1343 (),
1344 self.tx_id,
1345 0x1431cc24b2980086,
1346 fidl::encoding::DynamicFlags::empty(),
1347 )
1348 }
1349}
1350
1351#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1352pub struct HandsFreeMarker;
1353
1354impl fidl::endpoints::ProtocolMarker for HandsFreeMarker {
1355 type Proxy = HandsFreeProxy;
1356 type RequestStream = HandsFreeRequestStream;
1357 #[cfg(target_os = "fuchsia")]
1358 type SynchronousProxy = HandsFreeSynchronousProxy;
1359
1360 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.HandsFree";
1361}
1362impl fidl::endpoints::DiscoverableProtocolMarker for HandsFreeMarker {}
1363pub type HandsFreeWatchPeerConnectedResult =
1364 Result<(fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>), i32>;
1365
1366pub trait HandsFreeProxyInterface: Send + Sync {
1367 type WatchPeerConnectedResponseFut: std::future::Future<Output = Result<HandsFreeWatchPeerConnectedResult, fidl::Error>>
1368 + Send;
1369 fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut;
1370}
1371#[derive(Debug)]
1372#[cfg(target_os = "fuchsia")]
1373pub struct HandsFreeSynchronousProxy {
1374 client: fidl::client::sync::Client,
1375}
1376
1377#[cfg(target_os = "fuchsia")]
1378impl fidl::endpoints::SynchronousProxy for HandsFreeSynchronousProxy {
1379 type Proxy = HandsFreeProxy;
1380 type Protocol = HandsFreeMarker;
1381
1382 fn from_channel(inner: fidl::Channel) -> Self {
1383 Self::new(inner)
1384 }
1385
1386 fn into_channel(self) -> fidl::Channel {
1387 self.client.into_channel()
1388 }
1389
1390 fn as_channel(&self) -> &fidl::Channel {
1391 self.client.as_channel()
1392 }
1393}
1394
1395#[cfg(target_os = "fuchsia")]
1396impl HandsFreeSynchronousProxy {
1397 pub fn new(channel: fidl::Channel) -> Self {
1398 let protocol_name = <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1399 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1400 }
1401
1402 pub fn into_channel(self) -> fidl::Channel {
1403 self.client.into_channel()
1404 }
1405
1406 pub fn wait_for_event(
1409 &self,
1410 deadline: zx::MonotonicInstant,
1411 ) -> Result<HandsFreeEvent, fidl::Error> {
1412 HandsFreeEvent::decode(self.client.wait_for_event(deadline)?)
1413 }
1414
1415 pub fn r#watch_peer_connected(
1424 &self,
1425 ___deadline: zx::MonotonicInstant,
1426 ) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
1427 let _response = self.client.send_query::<
1428 fidl::encoding::EmptyPayload,
1429 fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
1430 >(
1431 (),
1432 0x1cc503325a8bbc3f,
1433 fidl::encoding::DynamicFlags::empty(),
1434 ___deadline,
1435 )?;
1436 Ok(_response.map(|x| (x.id, x.handle)))
1437 }
1438}
1439
1440#[cfg(target_os = "fuchsia")]
1441impl From<HandsFreeSynchronousProxy> for zx::Handle {
1442 fn from(value: HandsFreeSynchronousProxy) -> Self {
1443 value.into_channel().into()
1444 }
1445}
1446
1447#[cfg(target_os = "fuchsia")]
1448impl From<fidl::Channel> for HandsFreeSynchronousProxy {
1449 fn from(value: fidl::Channel) -> Self {
1450 Self::new(value)
1451 }
1452}
1453
1454#[derive(Debug, Clone)]
1455pub struct HandsFreeProxy {
1456 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1457}
1458
1459impl fidl::endpoints::Proxy for HandsFreeProxy {
1460 type Protocol = HandsFreeMarker;
1461
1462 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1463 Self::new(inner)
1464 }
1465
1466 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1467 self.client.into_channel().map_err(|client| Self { client })
1468 }
1469
1470 fn as_channel(&self) -> &::fidl::AsyncChannel {
1471 self.client.as_channel()
1472 }
1473}
1474
1475impl HandsFreeProxy {
1476 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1478 let protocol_name = <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1479 Self { client: fidl::client::Client::new(channel, protocol_name) }
1480 }
1481
1482 pub fn take_event_stream(&self) -> HandsFreeEventStream {
1488 HandsFreeEventStream { event_receiver: self.client.take_event_receiver() }
1489 }
1490
1491 pub fn r#watch_peer_connected(
1500 &self,
1501 ) -> fidl::client::QueryResponseFut<
1502 HandsFreeWatchPeerConnectedResult,
1503 fidl::encoding::DefaultFuchsiaResourceDialect,
1504 > {
1505 HandsFreeProxyInterface::r#watch_peer_connected(self)
1506 }
1507}
1508
1509impl HandsFreeProxyInterface for HandsFreeProxy {
1510 type WatchPeerConnectedResponseFut = fidl::client::QueryResponseFut<
1511 HandsFreeWatchPeerConnectedResult,
1512 fidl::encoding::DefaultFuchsiaResourceDialect,
1513 >;
1514 fn r#watch_peer_connected(&self) -> Self::WatchPeerConnectedResponseFut {
1515 fn _decode(
1516 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1517 ) -> Result<HandsFreeWatchPeerConnectedResult, fidl::Error> {
1518 let _response = fidl::client::decode_transaction_body::<
1519 fidl::encoding::ResultType<HandsFreeWatchPeerConnectedResponse, i32>,
1520 fidl::encoding::DefaultFuchsiaResourceDialect,
1521 0x1cc503325a8bbc3f,
1522 >(_buf?)?;
1523 Ok(_response.map(|x| (x.id, x.handle)))
1524 }
1525 self.client.send_query_and_decode::<
1526 fidl::encoding::EmptyPayload,
1527 HandsFreeWatchPeerConnectedResult,
1528 >(
1529 (),
1530 0x1cc503325a8bbc3f,
1531 fidl::encoding::DynamicFlags::empty(),
1532 _decode,
1533 )
1534 }
1535}
1536
1537pub struct HandsFreeEventStream {
1538 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1539}
1540
1541impl std::marker::Unpin for HandsFreeEventStream {}
1542
1543impl futures::stream::FusedStream for HandsFreeEventStream {
1544 fn is_terminated(&self) -> bool {
1545 self.event_receiver.is_terminated()
1546 }
1547}
1548
1549impl futures::Stream for HandsFreeEventStream {
1550 type Item = Result<HandsFreeEvent, fidl::Error>;
1551
1552 fn poll_next(
1553 mut self: std::pin::Pin<&mut Self>,
1554 cx: &mut std::task::Context<'_>,
1555 ) -> std::task::Poll<Option<Self::Item>> {
1556 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1557 &mut self.event_receiver,
1558 cx
1559 )?) {
1560 Some(buf) => std::task::Poll::Ready(Some(HandsFreeEvent::decode(buf))),
1561 None => std::task::Poll::Ready(None),
1562 }
1563 }
1564}
1565
1566#[derive(Debug)]
1567pub enum HandsFreeEvent {}
1568
1569impl HandsFreeEvent {
1570 fn decode(
1572 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1573 ) -> Result<HandsFreeEvent, fidl::Error> {
1574 let (bytes, _handles) = buf.split_mut();
1575 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1576 debug_assert_eq!(tx_header.tx_id, 0);
1577 match tx_header.ordinal {
1578 _ => Err(fidl::Error::UnknownOrdinal {
1579 ordinal: tx_header.ordinal,
1580 protocol_name: <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1581 }),
1582 }
1583 }
1584}
1585
1586pub struct HandsFreeRequestStream {
1588 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1589 is_terminated: bool,
1590}
1591
1592impl std::marker::Unpin for HandsFreeRequestStream {}
1593
1594impl futures::stream::FusedStream for HandsFreeRequestStream {
1595 fn is_terminated(&self) -> bool {
1596 self.is_terminated
1597 }
1598}
1599
1600impl fidl::endpoints::RequestStream for HandsFreeRequestStream {
1601 type Protocol = HandsFreeMarker;
1602 type ControlHandle = HandsFreeControlHandle;
1603
1604 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1605 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1606 }
1607
1608 fn control_handle(&self) -> Self::ControlHandle {
1609 HandsFreeControlHandle { inner: self.inner.clone() }
1610 }
1611
1612 fn into_inner(
1613 self,
1614 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1615 {
1616 (self.inner, self.is_terminated)
1617 }
1618
1619 fn from_inner(
1620 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1621 is_terminated: bool,
1622 ) -> Self {
1623 Self { inner, is_terminated }
1624 }
1625}
1626
1627impl futures::Stream for HandsFreeRequestStream {
1628 type Item = Result<HandsFreeRequest, fidl::Error>;
1629
1630 fn poll_next(
1631 mut self: std::pin::Pin<&mut Self>,
1632 cx: &mut std::task::Context<'_>,
1633 ) -> std::task::Poll<Option<Self::Item>> {
1634 let this = &mut *self;
1635 if this.inner.check_shutdown(cx) {
1636 this.is_terminated = true;
1637 return std::task::Poll::Ready(None);
1638 }
1639 if this.is_terminated {
1640 panic!("polled HandsFreeRequestStream after completion");
1641 }
1642 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1643 |bytes, handles| {
1644 match this.inner.channel().read_etc(cx, bytes, handles) {
1645 std::task::Poll::Ready(Ok(())) => {}
1646 std::task::Poll::Pending => return std::task::Poll::Pending,
1647 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1648 this.is_terminated = true;
1649 return std::task::Poll::Ready(None);
1650 }
1651 std::task::Poll::Ready(Err(e)) => {
1652 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1653 e.into(),
1654 ))))
1655 }
1656 }
1657
1658 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1660
1661 std::task::Poll::Ready(Some(match header.ordinal {
1662 0x1cc503325a8bbc3f => {
1663 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1664 let mut req = fidl::new_empty!(
1665 fidl::encoding::EmptyPayload,
1666 fidl::encoding::DefaultFuchsiaResourceDialect
1667 );
1668 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1669 let control_handle = HandsFreeControlHandle { inner: this.inner.clone() };
1670 Ok(HandsFreeRequest::WatchPeerConnected {
1671 responder: HandsFreeWatchPeerConnectedResponder {
1672 control_handle: std::mem::ManuallyDrop::new(control_handle),
1673 tx_id: header.tx_id,
1674 },
1675 })
1676 }
1677 _ => Err(fidl::Error::UnknownOrdinal {
1678 ordinal: header.ordinal,
1679 protocol_name:
1680 <HandsFreeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1681 }),
1682 }))
1683 },
1684 )
1685 }
1686}
1687
1688#[derive(Debug)]
1689pub enum HandsFreeRequest {
1690 WatchPeerConnected { responder: HandsFreeWatchPeerConnectedResponder },
1699}
1700
1701impl HandsFreeRequest {
1702 #[allow(irrefutable_let_patterns)]
1703 pub fn into_watch_peer_connected(self) -> Option<(HandsFreeWatchPeerConnectedResponder)> {
1704 if let HandsFreeRequest::WatchPeerConnected { responder } = self {
1705 Some((responder))
1706 } else {
1707 None
1708 }
1709 }
1710
1711 pub fn method_name(&self) -> &'static str {
1713 match *self {
1714 HandsFreeRequest::WatchPeerConnected { .. } => "watch_peer_connected",
1715 }
1716 }
1717}
1718
1719#[derive(Debug, Clone)]
1720pub struct HandsFreeControlHandle {
1721 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1722}
1723
1724impl fidl::endpoints::ControlHandle for HandsFreeControlHandle {
1725 fn shutdown(&self) {
1726 self.inner.shutdown()
1727 }
1728 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1729 self.inner.shutdown_with_epitaph(status)
1730 }
1731
1732 fn is_closed(&self) -> bool {
1733 self.inner.channel().is_closed()
1734 }
1735 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1736 self.inner.channel().on_closed()
1737 }
1738
1739 #[cfg(target_os = "fuchsia")]
1740 fn signal_peer(
1741 &self,
1742 clear_mask: zx::Signals,
1743 set_mask: zx::Signals,
1744 ) -> Result<(), zx_status::Status> {
1745 use fidl::Peered;
1746 self.inner.channel().signal_peer(clear_mask, set_mask)
1747 }
1748}
1749
1750impl HandsFreeControlHandle {}
1751
1752#[must_use = "FIDL methods require a response to be sent"]
1753#[derive(Debug)]
1754pub struct HandsFreeWatchPeerConnectedResponder {
1755 control_handle: std::mem::ManuallyDrop<HandsFreeControlHandle>,
1756 tx_id: u32,
1757}
1758
1759impl std::ops::Drop for HandsFreeWatchPeerConnectedResponder {
1763 fn drop(&mut self) {
1764 self.control_handle.shutdown();
1765 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1767 }
1768}
1769
1770impl fidl::endpoints::Responder for HandsFreeWatchPeerConnectedResponder {
1771 type ControlHandle = HandsFreeControlHandle;
1772
1773 fn control_handle(&self) -> &HandsFreeControlHandle {
1774 &self.control_handle
1775 }
1776
1777 fn drop_without_shutdown(mut self) {
1778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1780 std::mem::forget(self);
1782 }
1783}
1784
1785impl HandsFreeWatchPeerConnectedResponder {
1786 pub fn send(
1790 self,
1791 mut result: Result<
1792 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1793 i32,
1794 >,
1795 ) -> Result<(), fidl::Error> {
1796 let _result = self.send_raw(result);
1797 if _result.is_err() {
1798 self.control_handle.shutdown();
1799 }
1800 self.drop_without_shutdown();
1801 _result
1802 }
1803
1804 pub fn send_no_shutdown_on_err(
1806 self,
1807 mut result: Result<
1808 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1809 i32,
1810 >,
1811 ) -> Result<(), fidl::Error> {
1812 let _result = self.send_raw(result);
1813 self.drop_without_shutdown();
1814 _result
1815 }
1816
1817 fn send_raw(
1818 &self,
1819 mut result: Result<
1820 (&fidl_fuchsia_bluetooth::PeerId, fidl::endpoints::ClientEnd<PeerHandlerMarker>),
1821 i32,
1822 >,
1823 ) -> Result<(), fidl::Error> {
1824 self.control_handle.inner.send::<fidl::encoding::ResultType<
1825 HandsFreeWatchPeerConnectedResponse,
1826 i32,
1827 >>(
1828 result,
1829 self.tx_id,
1830 0x1cc503325a8bbc3f,
1831 fidl::encoding::DynamicFlags::empty(),
1832 )
1833 }
1834}
1835
1836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1837pub struct HeadsetGainMarker;
1838
1839impl fidl::endpoints::ProtocolMarker for HeadsetGainMarker {
1840 type Proxy = HeadsetGainProxy;
1841 type RequestStream = HeadsetGainRequestStream;
1842 #[cfg(target_os = "fuchsia")]
1843 type SynchronousProxy = HeadsetGainSynchronousProxy;
1844
1845 const DEBUG_NAME: &'static str = "(anonymous) HeadsetGain";
1846}
1847
1848pub trait HeadsetGainProxyInterface: Send + Sync {
1849 fn r#set_speaker_gain(&self, requested: u8) -> Result<(), fidl::Error>;
1850 type WatchSpeakerGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>> + Send;
1851 fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut;
1852 fn r#set_microphone_gain(&self, requested: u8) -> Result<(), fidl::Error>;
1853 type WatchMicrophoneGainResponseFut: std::future::Future<Output = Result<u8, fidl::Error>>
1854 + Send;
1855 fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut;
1856}
1857#[derive(Debug)]
1858#[cfg(target_os = "fuchsia")]
1859pub struct HeadsetGainSynchronousProxy {
1860 client: fidl::client::sync::Client,
1861}
1862
1863#[cfg(target_os = "fuchsia")]
1864impl fidl::endpoints::SynchronousProxy for HeadsetGainSynchronousProxy {
1865 type Proxy = HeadsetGainProxy;
1866 type Protocol = HeadsetGainMarker;
1867
1868 fn from_channel(inner: fidl::Channel) -> Self {
1869 Self::new(inner)
1870 }
1871
1872 fn into_channel(self) -> fidl::Channel {
1873 self.client.into_channel()
1874 }
1875
1876 fn as_channel(&self) -> &fidl::Channel {
1877 self.client.as_channel()
1878 }
1879}
1880
1881#[cfg(target_os = "fuchsia")]
1882impl HeadsetGainSynchronousProxy {
1883 pub fn new(channel: fidl::Channel) -> Self {
1884 let protocol_name = <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1885 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1886 }
1887
1888 pub fn into_channel(self) -> fidl::Channel {
1889 self.client.into_channel()
1890 }
1891
1892 pub fn wait_for_event(
1895 &self,
1896 deadline: zx::MonotonicInstant,
1897 ) -> Result<HeadsetGainEvent, fidl::Error> {
1898 HeadsetGainEvent::decode(self.client.wait_for_event(deadline)?)
1899 }
1900
1901 pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
1907 self.client.send::<HeadsetGainSetSpeakerGainRequest>(
1908 (requested,),
1909 0x3462191b2a6ae5ce,
1910 fidl::encoding::DynamicFlags::empty(),
1911 )
1912 }
1913
1914 pub fn r#watch_speaker_gain(
1919 &self,
1920 ___deadline: zx::MonotonicInstant,
1921 ) -> Result<u8, fidl::Error> {
1922 let _response = self
1923 .client
1924 .send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchSpeakerGainResponse>(
1925 (),
1926 0x2007abdf2695c747,
1927 fidl::encoding::DynamicFlags::empty(),
1928 ___deadline,
1929 )?;
1930 Ok(_response.gain)
1931 }
1932
1933 pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
1939 self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
1940 (requested,),
1941 0x7ddbb4e63caeef8e,
1942 fidl::encoding::DynamicFlags::empty(),
1943 )
1944 }
1945
1946 pub fn r#watch_microphone_gain(
1951 &self,
1952 ___deadline: zx::MonotonicInstant,
1953 ) -> Result<u8, fidl::Error> {
1954 let _response = self
1955 .client
1956 .send_query::<fidl::encoding::EmptyPayload, HeadsetGainWatchMicrophoneGainResponse>(
1957 (),
1958 0x1d171fb432fa55ad,
1959 fidl::encoding::DynamicFlags::empty(),
1960 ___deadline,
1961 )?;
1962 Ok(_response.gain)
1963 }
1964}
1965
1966#[cfg(target_os = "fuchsia")]
1967impl From<HeadsetGainSynchronousProxy> for zx::Handle {
1968 fn from(value: HeadsetGainSynchronousProxy) -> Self {
1969 value.into_channel().into()
1970 }
1971}
1972
1973#[cfg(target_os = "fuchsia")]
1974impl From<fidl::Channel> for HeadsetGainSynchronousProxy {
1975 fn from(value: fidl::Channel) -> Self {
1976 Self::new(value)
1977 }
1978}
1979
1980#[derive(Debug, Clone)]
1981pub struct HeadsetGainProxy {
1982 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1983}
1984
1985impl fidl::endpoints::Proxy for HeadsetGainProxy {
1986 type Protocol = HeadsetGainMarker;
1987
1988 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1989 Self::new(inner)
1990 }
1991
1992 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1993 self.client.into_channel().map_err(|client| Self { client })
1994 }
1995
1996 fn as_channel(&self) -> &::fidl::AsyncChannel {
1997 self.client.as_channel()
1998 }
1999}
2000
2001impl HeadsetGainProxy {
2002 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2004 let protocol_name = <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2005 Self { client: fidl::client::Client::new(channel, protocol_name) }
2006 }
2007
2008 pub fn take_event_stream(&self) -> HeadsetGainEventStream {
2014 HeadsetGainEventStream { event_receiver: self.client.take_event_receiver() }
2015 }
2016
2017 pub fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2023 HeadsetGainProxyInterface::r#set_speaker_gain(self, requested)
2024 }
2025
2026 pub fn r#watch_speaker_gain(
2031 &self,
2032 ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
2033 HeadsetGainProxyInterface::r#watch_speaker_gain(self)
2034 }
2035
2036 pub fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2042 HeadsetGainProxyInterface::r#set_microphone_gain(self, requested)
2043 }
2044
2045 pub fn r#watch_microphone_gain(
2050 &self,
2051 ) -> fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect> {
2052 HeadsetGainProxyInterface::r#watch_microphone_gain(self)
2053 }
2054}
2055
2056impl HeadsetGainProxyInterface for HeadsetGainProxy {
2057 fn r#set_speaker_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2058 self.client.send::<HeadsetGainSetSpeakerGainRequest>(
2059 (requested,),
2060 0x3462191b2a6ae5ce,
2061 fidl::encoding::DynamicFlags::empty(),
2062 )
2063 }
2064
2065 type WatchSpeakerGainResponseFut =
2066 fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
2067 fn r#watch_speaker_gain(&self) -> Self::WatchSpeakerGainResponseFut {
2068 fn _decode(
2069 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2070 ) -> Result<u8, fidl::Error> {
2071 let _response = fidl::client::decode_transaction_body::<
2072 HeadsetGainWatchSpeakerGainResponse,
2073 fidl::encoding::DefaultFuchsiaResourceDialect,
2074 0x2007abdf2695c747,
2075 >(_buf?)?;
2076 Ok(_response.gain)
2077 }
2078 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
2079 (),
2080 0x2007abdf2695c747,
2081 fidl::encoding::DynamicFlags::empty(),
2082 _decode,
2083 )
2084 }
2085
2086 fn r#set_microphone_gain(&self, mut requested: u8) -> Result<(), fidl::Error> {
2087 self.client.send::<HeadsetGainSetMicrophoneGainRequest>(
2088 (requested,),
2089 0x7ddbb4e63caeef8e,
2090 fidl::encoding::DynamicFlags::empty(),
2091 )
2092 }
2093
2094 type WatchMicrophoneGainResponseFut =
2095 fidl::client::QueryResponseFut<u8, fidl::encoding::DefaultFuchsiaResourceDialect>;
2096 fn r#watch_microphone_gain(&self) -> Self::WatchMicrophoneGainResponseFut {
2097 fn _decode(
2098 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2099 ) -> Result<u8, fidl::Error> {
2100 let _response = fidl::client::decode_transaction_body::<
2101 HeadsetGainWatchMicrophoneGainResponse,
2102 fidl::encoding::DefaultFuchsiaResourceDialect,
2103 0x1d171fb432fa55ad,
2104 >(_buf?)?;
2105 Ok(_response.gain)
2106 }
2107 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u8>(
2108 (),
2109 0x1d171fb432fa55ad,
2110 fidl::encoding::DynamicFlags::empty(),
2111 _decode,
2112 )
2113 }
2114}
2115
2116pub struct HeadsetGainEventStream {
2117 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2118}
2119
2120impl std::marker::Unpin for HeadsetGainEventStream {}
2121
2122impl futures::stream::FusedStream for HeadsetGainEventStream {
2123 fn is_terminated(&self) -> bool {
2124 self.event_receiver.is_terminated()
2125 }
2126}
2127
2128impl futures::Stream for HeadsetGainEventStream {
2129 type Item = Result<HeadsetGainEvent, fidl::Error>;
2130
2131 fn poll_next(
2132 mut self: std::pin::Pin<&mut Self>,
2133 cx: &mut std::task::Context<'_>,
2134 ) -> std::task::Poll<Option<Self::Item>> {
2135 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2136 &mut self.event_receiver,
2137 cx
2138 )?) {
2139 Some(buf) => std::task::Poll::Ready(Some(HeadsetGainEvent::decode(buf))),
2140 None => std::task::Poll::Ready(None),
2141 }
2142 }
2143}
2144
2145#[derive(Debug)]
2146pub enum HeadsetGainEvent {}
2147
2148impl HeadsetGainEvent {
2149 fn decode(
2151 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2152 ) -> Result<HeadsetGainEvent, fidl::Error> {
2153 let (bytes, _handles) = buf.split_mut();
2154 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2155 debug_assert_eq!(tx_header.tx_id, 0);
2156 match tx_header.ordinal {
2157 _ => Err(fidl::Error::UnknownOrdinal {
2158 ordinal: tx_header.ordinal,
2159 protocol_name: <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2160 }),
2161 }
2162 }
2163}
2164
2165pub struct HeadsetGainRequestStream {
2167 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2168 is_terminated: bool,
2169}
2170
2171impl std::marker::Unpin for HeadsetGainRequestStream {}
2172
2173impl futures::stream::FusedStream for HeadsetGainRequestStream {
2174 fn is_terminated(&self) -> bool {
2175 self.is_terminated
2176 }
2177}
2178
2179impl fidl::endpoints::RequestStream for HeadsetGainRequestStream {
2180 type Protocol = HeadsetGainMarker;
2181 type ControlHandle = HeadsetGainControlHandle;
2182
2183 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2184 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2185 }
2186
2187 fn control_handle(&self) -> Self::ControlHandle {
2188 HeadsetGainControlHandle { inner: self.inner.clone() }
2189 }
2190
2191 fn into_inner(
2192 self,
2193 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2194 {
2195 (self.inner, self.is_terminated)
2196 }
2197
2198 fn from_inner(
2199 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2200 is_terminated: bool,
2201 ) -> Self {
2202 Self { inner, is_terminated }
2203 }
2204}
2205
2206impl futures::Stream for HeadsetGainRequestStream {
2207 type Item = Result<HeadsetGainRequest, fidl::Error>;
2208
2209 fn poll_next(
2210 mut self: std::pin::Pin<&mut Self>,
2211 cx: &mut std::task::Context<'_>,
2212 ) -> std::task::Poll<Option<Self::Item>> {
2213 let this = &mut *self;
2214 if this.inner.check_shutdown(cx) {
2215 this.is_terminated = true;
2216 return std::task::Poll::Ready(None);
2217 }
2218 if this.is_terminated {
2219 panic!("polled HeadsetGainRequestStream after completion");
2220 }
2221 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2222 |bytes, handles| {
2223 match this.inner.channel().read_etc(cx, bytes, handles) {
2224 std::task::Poll::Ready(Ok(())) => {}
2225 std::task::Poll::Pending => return std::task::Poll::Pending,
2226 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2227 this.is_terminated = true;
2228 return std::task::Poll::Ready(None);
2229 }
2230 std::task::Poll::Ready(Err(e)) => {
2231 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2232 e.into(),
2233 ))))
2234 }
2235 }
2236
2237 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2239
2240 std::task::Poll::Ready(Some(match header.ordinal {
2241 0x3462191b2a6ae5ce => {
2242 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2243 let mut req = fidl::new_empty!(
2244 HeadsetGainSetSpeakerGainRequest,
2245 fidl::encoding::DefaultFuchsiaResourceDialect
2246 );
2247 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetSpeakerGainRequest>(&header, _body_bytes, handles, &mut req)?;
2248 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2249 Ok(HeadsetGainRequest::SetSpeakerGain {
2250 requested: req.requested,
2251
2252 control_handle,
2253 })
2254 }
2255 0x2007abdf2695c747 => {
2256 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2257 let mut req = fidl::new_empty!(
2258 fidl::encoding::EmptyPayload,
2259 fidl::encoding::DefaultFuchsiaResourceDialect
2260 );
2261 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2262 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2263 Ok(HeadsetGainRequest::WatchSpeakerGain {
2264 responder: HeadsetGainWatchSpeakerGainResponder {
2265 control_handle: std::mem::ManuallyDrop::new(control_handle),
2266 tx_id: header.tx_id,
2267 },
2268 })
2269 }
2270 0x7ddbb4e63caeef8e => {
2271 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2272 let mut req = fidl::new_empty!(
2273 HeadsetGainSetMicrophoneGainRequest,
2274 fidl::encoding::DefaultFuchsiaResourceDialect
2275 );
2276 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HeadsetGainSetMicrophoneGainRequest>(&header, _body_bytes, handles, &mut req)?;
2277 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2278 Ok(HeadsetGainRequest::SetMicrophoneGain {
2279 requested: req.requested,
2280
2281 control_handle,
2282 })
2283 }
2284 0x1d171fb432fa55ad => {
2285 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2286 let mut req = fidl::new_empty!(
2287 fidl::encoding::EmptyPayload,
2288 fidl::encoding::DefaultFuchsiaResourceDialect
2289 );
2290 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2291 let control_handle = HeadsetGainControlHandle { inner: this.inner.clone() };
2292 Ok(HeadsetGainRequest::WatchMicrophoneGain {
2293 responder: HeadsetGainWatchMicrophoneGainResponder {
2294 control_handle: std::mem::ManuallyDrop::new(control_handle),
2295 tx_id: header.tx_id,
2296 },
2297 })
2298 }
2299 _ => Err(fidl::Error::UnknownOrdinal {
2300 ordinal: header.ordinal,
2301 protocol_name:
2302 <HeadsetGainMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2303 }),
2304 }))
2305 },
2306 )
2307 }
2308}
2309
2310#[derive(Debug)]
2334pub enum HeadsetGainRequest {
2335 SetSpeakerGain { requested: u8, control_handle: HeadsetGainControlHandle },
2341 WatchSpeakerGain { responder: HeadsetGainWatchSpeakerGainResponder },
2346 SetMicrophoneGain { requested: u8, control_handle: HeadsetGainControlHandle },
2352 WatchMicrophoneGain { responder: HeadsetGainWatchMicrophoneGainResponder },
2357}
2358
2359impl HeadsetGainRequest {
2360 #[allow(irrefutable_let_patterns)]
2361 pub fn into_set_speaker_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
2362 if let HeadsetGainRequest::SetSpeakerGain { requested, control_handle } = self {
2363 Some((requested, control_handle))
2364 } else {
2365 None
2366 }
2367 }
2368
2369 #[allow(irrefutable_let_patterns)]
2370 pub fn into_watch_speaker_gain(self) -> Option<(HeadsetGainWatchSpeakerGainResponder)> {
2371 if let HeadsetGainRequest::WatchSpeakerGain { responder } = self {
2372 Some((responder))
2373 } else {
2374 None
2375 }
2376 }
2377
2378 #[allow(irrefutable_let_patterns)]
2379 pub fn into_set_microphone_gain(self) -> Option<(u8, HeadsetGainControlHandle)> {
2380 if let HeadsetGainRequest::SetMicrophoneGain { requested, control_handle } = self {
2381 Some((requested, control_handle))
2382 } else {
2383 None
2384 }
2385 }
2386
2387 #[allow(irrefutable_let_patterns)]
2388 pub fn into_watch_microphone_gain(self) -> Option<(HeadsetGainWatchMicrophoneGainResponder)> {
2389 if let HeadsetGainRequest::WatchMicrophoneGain { responder } = self {
2390 Some((responder))
2391 } else {
2392 None
2393 }
2394 }
2395
2396 pub fn method_name(&self) -> &'static str {
2398 match *self {
2399 HeadsetGainRequest::SetSpeakerGain { .. } => "set_speaker_gain",
2400 HeadsetGainRequest::WatchSpeakerGain { .. } => "watch_speaker_gain",
2401 HeadsetGainRequest::SetMicrophoneGain { .. } => "set_microphone_gain",
2402 HeadsetGainRequest::WatchMicrophoneGain { .. } => "watch_microphone_gain",
2403 }
2404 }
2405}
2406
2407#[derive(Debug, Clone)]
2408pub struct HeadsetGainControlHandle {
2409 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2410}
2411
2412impl fidl::endpoints::ControlHandle for HeadsetGainControlHandle {
2413 fn shutdown(&self) {
2414 self.inner.shutdown()
2415 }
2416 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2417 self.inner.shutdown_with_epitaph(status)
2418 }
2419
2420 fn is_closed(&self) -> bool {
2421 self.inner.channel().is_closed()
2422 }
2423 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2424 self.inner.channel().on_closed()
2425 }
2426
2427 #[cfg(target_os = "fuchsia")]
2428 fn signal_peer(
2429 &self,
2430 clear_mask: zx::Signals,
2431 set_mask: zx::Signals,
2432 ) -> Result<(), zx_status::Status> {
2433 use fidl::Peered;
2434 self.inner.channel().signal_peer(clear_mask, set_mask)
2435 }
2436}
2437
2438impl HeadsetGainControlHandle {}
2439
2440#[must_use = "FIDL methods require a response to be sent"]
2441#[derive(Debug)]
2442pub struct HeadsetGainWatchSpeakerGainResponder {
2443 control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
2444 tx_id: u32,
2445}
2446
2447impl std::ops::Drop for HeadsetGainWatchSpeakerGainResponder {
2451 fn drop(&mut self) {
2452 self.control_handle.shutdown();
2453 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2455 }
2456}
2457
2458impl fidl::endpoints::Responder for HeadsetGainWatchSpeakerGainResponder {
2459 type ControlHandle = HeadsetGainControlHandle;
2460
2461 fn control_handle(&self) -> &HeadsetGainControlHandle {
2462 &self.control_handle
2463 }
2464
2465 fn drop_without_shutdown(mut self) {
2466 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2468 std::mem::forget(self);
2470 }
2471}
2472
2473impl HeadsetGainWatchSpeakerGainResponder {
2474 pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
2478 let _result = self.send_raw(gain);
2479 if _result.is_err() {
2480 self.control_handle.shutdown();
2481 }
2482 self.drop_without_shutdown();
2483 _result
2484 }
2485
2486 pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
2488 let _result = self.send_raw(gain);
2489 self.drop_without_shutdown();
2490 _result
2491 }
2492
2493 fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
2494 self.control_handle.inner.send::<HeadsetGainWatchSpeakerGainResponse>(
2495 (gain,),
2496 self.tx_id,
2497 0x2007abdf2695c747,
2498 fidl::encoding::DynamicFlags::empty(),
2499 )
2500 }
2501}
2502
2503#[must_use = "FIDL methods require a response to be sent"]
2504#[derive(Debug)]
2505pub struct HeadsetGainWatchMicrophoneGainResponder {
2506 control_handle: std::mem::ManuallyDrop<HeadsetGainControlHandle>,
2507 tx_id: u32,
2508}
2509
2510impl std::ops::Drop for HeadsetGainWatchMicrophoneGainResponder {
2514 fn drop(&mut self) {
2515 self.control_handle.shutdown();
2516 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2518 }
2519}
2520
2521impl fidl::endpoints::Responder for HeadsetGainWatchMicrophoneGainResponder {
2522 type ControlHandle = HeadsetGainControlHandle;
2523
2524 fn control_handle(&self) -> &HeadsetGainControlHandle {
2525 &self.control_handle
2526 }
2527
2528 fn drop_without_shutdown(mut self) {
2529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2531 std::mem::forget(self);
2533 }
2534}
2535
2536impl HeadsetGainWatchMicrophoneGainResponder {
2537 pub fn send(self, mut gain: u8) -> Result<(), fidl::Error> {
2541 let _result = self.send_raw(gain);
2542 if _result.is_err() {
2543 self.control_handle.shutdown();
2544 }
2545 self.drop_without_shutdown();
2546 _result
2547 }
2548
2549 pub fn send_no_shutdown_on_err(self, mut gain: u8) -> Result<(), fidl::Error> {
2551 let _result = self.send_raw(gain);
2552 self.drop_without_shutdown();
2553 _result
2554 }
2555
2556 fn send_raw(&self, mut gain: u8) -> Result<(), fidl::Error> {
2557 self.control_handle.inner.send::<HeadsetGainWatchMicrophoneGainResponse>(
2558 (gain,),
2559 self.tx_id,
2560 0x1d171fb432fa55ad,
2561 fidl::encoding::DynamicFlags::empty(),
2562 )
2563 }
2564}
2565
2566#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2567pub struct HfpMarker;
2568
2569impl fidl::endpoints::ProtocolMarker for HfpMarker {
2570 type Proxy = HfpProxy;
2571 type RequestStream = HfpRequestStream;
2572 #[cfg(target_os = "fuchsia")]
2573 type SynchronousProxy = HfpSynchronousProxy;
2574
2575 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.hfp.Hfp";
2576}
2577impl fidl::endpoints::DiscoverableProtocolMarker for HfpMarker {}
2578
2579pub trait HfpProxyInterface: Send + Sync {
2580 fn r#register(
2581 &self,
2582 manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2583 ) -> Result<(), fidl::Error>;
2584}
2585#[derive(Debug)]
2586#[cfg(target_os = "fuchsia")]
2587pub struct HfpSynchronousProxy {
2588 client: fidl::client::sync::Client,
2589}
2590
2591#[cfg(target_os = "fuchsia")]
2592impl fidl::endpoints::SynchronousProxy for HfpSynchronousProxy {
2593 type Proxy = HfpProxy;
2594 type Protocol = HfpMarker;
2595
2596 fn from_channel(inner: fidl::Channel) -> Self {
2597 Self::new(inner)
2598 }
2599
2600 fn into_channel(self) -> fidl::Channel {
2601 self.client.into_channel()
2602 }
2603
2604 fn as_channel(&self) -> &fidl::Channel {
2605 self.client.as_channel()
2606 }
2607}
2608
2609#[cfg(target_os = "fuchsia")]
2610impl HfpSynchronousProxy {
2611 pub fn new(channel: fidl::Channel) -> Self {
2612 let protocol_name = <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2613 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2614 }
2615
2616 pub fn into_channel(self) -> fidl::Channel {
2617 self.client.into_channel()
2618 }
2619
2620 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<HfpEvent, fidl::Error> {
2623 HfpEvent::decode(self.client.wait_for_event(deadline)?)
2624 }
2625
2626 pub fn r#register(
2634 &self,
2635 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2636 ) -> Result<(), fidl::Error> {
2637 self.client.send::<HfpRegisterRequest>(
2638 (manager,),
2639 0x1b2ea4f6069181ad,
2640 fidl::encoding::DynamicFlags::empty(),
2641 )
2642 }
2643}
2644
2645#[cfg(target_os = "fuchsia")]
2646impl From<HfpSynchronousProxy> for zx::Handle {
2647 fn from(value: HfpSynchronousProxy) -> Self {
2648 value.into_channel().into()
2649 }
2650}
2651
2652#[cfg(target_os = "fuchsia")]
2653impl From<fidl::Channel> for HfpSynchronousProxy {
2654 fn from(value: fidl::Channel) -> Self {
2655 Self::new(value)
2656 }
2657}
2658
2659#[derive(Debug, Clone)]
2660pub struct HfpProxy {
2661 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2662}
2663
2664impl fidl::endpoints::Proxy for HfpProxy {
2665 type Protocol = HfpMarker;
2666
2667 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2668 Self::new(inner)
2669 }
2670
2671 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2672 self.client.into_channel().map_err(|client| Self { client })
2673 }
2674
2675 fn as_channel(&self) -> &::fidl::AsyncChannel {
2676 self.client.as_channel()
2677 }
2678}
2679
2680impl HfpProxy {
2681 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2683 let protocol_name = <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2684 Self { client: fidl::client::Client::new(channel, protocol_name) }
2685 }
2686
2687 pub fn take_event_stream(&self) -> HfpEventStream {
2693 HfpEventStream { event_receiver: self.client.take_event_receiver() }
2694 }
2695
2696 pub fn r#register(
2704 &self,
2705 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2706 ) -> Result<(), fidl::Error> {
2707 HfpProxyInterface::r#register(self, manager)
2708 }
2709}
2710
2711impl HfpProxyInterface for HfpProxy {
2712 fn r#register(
2713 &self,
2714 mut manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2715 ) -> Result<(), fidl::Error> {
2716 self.client.send::<HfpRegisterRequest>(
2717 (manager,),
2718 0x1b2ea4f6069181ad,
2719 fidl::encoding::DynamicFlags::empty(),
2720 )
2721 }
2722}
2723
2724pub struct HfpEventStream {
2725 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2726}
2727
2728impl std::marker::Unpin for HfpEventStream {}
2729
2730impl futures::stream::FusedStream for HfpEventStream {
2731 fn is_terminated(&self) -> bool {
2732 self.event_receiver.is_terminated()
2733 }
2734}
2735
2736impl futures::Stream for HfpEventStream {
2737 type Item = Result<HfpEvent, fidl::Error>;
2738
2739 fn poll_next(
2740 mut self: std::pin::Pin<&mut Self>,
2741 cx: &mut std::task::Context<'_>,
2742 ) -> std::task::Poll<Option<Self::Item>> {
2743 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2744 &mut self.event_receiver,
2745 cx
2746 )?) {
2747 Some(buf) => std::task::Poll::Ready(Some(HfpEvent::decode(buf))),
2748 None => std::task::Poll::Ready(None),
2749 }
2750 }
2751}
2752
2753#[derive(Debug)]
2754pub enum HfpEvent {}
2755
2756impl HfpEvent {
2757 fn decode(
2759 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2760 ) -> Result<HfpEvent, fidl::Error> {
2761 let (bytes, _handles) = buf.split_mut();
2762 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2763 debug_assert_eq!(tx_header.tx_id, 0);
2764 match tx_header.ordinal {
2765 _ => Err(fidl::Error::UnknownOrdinal {
2766 ordinal: tx_header.ordinal,
2767 protocol_name: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2768 }),
2769 }
2770 }
2771}
2772
2773pub struct HfpRequestStream {
2775 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2776 is_terminated: bool,
2777}
2778
2779impl std::marker::Unpin for HfpRequestStream {}
2780
2781impl futures::stream::FusedStream for HfpRequestStream {
2782 fn is_terminated(&self) -> bool {
2783 self.is_terminated
2784 }
2785}
2786
2787impl fidl::endpoints::RequestStream for HfpRequestStream {
2788 type Protocol = HfpMarker;
2789 type ControlHandle = HfpControlHandle;
2790
2791 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2792 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2793 }
2794
2795 fn control_handle(&self) -> Self::ControlHandle {
2796 HfpControlHandle { inner: self.inner.clone() }
2797 }
2798
2799 fn into_inner(
2800 self,
2801 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2802 {
2803 (self.inner, self.is_terminated)
2804 }
2805
2806 fn from_inner(
2807 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2808 is_terminated: bool,
2809 ) -> Self {
2810 Self { inner, is_terminated }
2811 }
2812}
2813
2814impl futures::Stream for HfpRequestStream {
2815 type Item = Result<HfpRequest, fidl::Error>;
2816
2817 fn poll_next(
2818 mut self: std::pin::Pin<&mut Self>,
2819 cx: &mut std::task::Context<'_>,
2820 ) -> std::task::Poll<Option<Self::Item>> {
2821 let this = &mut *self;
2822 if this.inner.check_shutdown(cx) {
2823 this.is_terminated = true;
2824 return std::task::Poll::Ready(None);
2825 }
2826 if this.is_terminated {
2827 panic!("polled HfpRequestStream after completion");
2828 }
2829 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2830 |bytes, handles| {
2831 match this.inner.channel().read_etc(cx, bytes, handles) {
2832 std::task::Poll::Ready(Ok(())) => {}
2833 std::task::Poll::Pending => return std::task::Poll::Pending,
2834 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2835 this.is_terminated = true;
2836 return std::task::Poll::Ready(None);
2837 }
2838 std::task::Poll::Ready(Err(e)) => {
2839 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2840 e.into(),
2841 ))))
2842 }
2843 }
2844
2845 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2847
2848 std::task::Poll::Ready(Some(match header.ordinal {
2849 0x1b2ea4f6069181ad => {
2850 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2851 let mut req = fidl::new_empty!(
2852 HfpRegisterRequest,
2853 fidl::encoding::DefaultFuchsiaResourceDialect
2854 );
2855 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HfpRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
2856 let control_handle = HfpControlHandle { inner: this.inner.clone() };
2857 Ok(HfpRequest::Register { manager: req.manager, control_handle })
2858 }
2859 _ => Err(fidl::Error::UnknownOrdinal {
2860 ordinal: header.ordinal,
2861 protocol_name: <HfpMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2862 }),
2863 }))
2864 },
2865 )
2866 }
2867}
2868
2869#[derive(Debug)]
2870pub enum HfpRequest {
2871 Register {
2879 manager: fidl::endpoints::ClientEnd<CallManagerMarker>,
2880 control_handle: HfpControlHandle,
2881 },
2882}
2883
2884impl HfpRequest {
2885 #[allow(irrefutable_let_patterns)]
2886 pub fn into_register(
2887 self,
2888 ) -> Option<(fidl::endpoints::ClientEnd<CallManagerMarker>, HfpControlHandle)> {
2889 if let HfpRequest::Register { manager, control_handle } = self {
2890 Some((manager, control_handle))
2891 } else {
2892 None
2893 }
2894 }
2895
2896 pub fn method_name(&self) -> &'static str {
2898 match *self {
2899 HfpRequest::Register { .. } => "register",
2900 }
2901 }
2902}
2903
2904#[derive(Debug, Clone)]
2905pub struct HfpControlHandle {
2906 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2907}
2908
2909impl fidl::endpoints::ControlHandle for HfpControlHandle {
2910 fn shutdown(&self) {
2911 self.inner.shutdown()
2912 }
2913 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2914 self.inner.shutdown_with_epitaph(status)
2915 }
2916
2917 fn is_closed(&self) -> bool {
2918 self.inner.channel().is_closed()
2919 }
2920 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2921 self.inner.channel().on_closed()
2922 }
2923
2924 #[cfg(target_os = "fuchsia")]
2925 fn signal_peer(
2926 &self,
2927 clear_mask: zx::Signals,
2928 set_mask: zx::Signals,
2929 ) -> Result<(), zx_status::Status> {
2930 use fidl::Peered;
2931 self.inner.channel().signal_peer(clear_mask, set_mask)
2932 }
2933}
2934
2935impl HfpControlHandle {}
2936
2937#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2938pub struct PeerHandlerMarker;
2939
2940impl fidl::endpoints::ProtocolMarker for PeerHandlerMarker {
2941 type Proxy = PeerHandlerProxy;
2942 type RequestStream = PeerHandlerRequestStream;
2943 #[cfg(target_os = "fuchsia")]
2944 type SynchronousProxy = PeerHandlerSynchronousProxy;
2945
2946 const DEBUG_NAME: &'static str = "(anonymous) PeerHandler";
2947}
2948pub type PeerHandlerRequestOutgoingCallResult = Result<(), i32>;
2949pub type PeerHandlerSetNrecModeResult = Result<(), i32>;
2950
2951pub trait PeerHandlerProxyInterface: Send + Sync {
2952 type WatchNetworkInformationResponseFut: std::future::Future<Output = Result<NetworkInformation, fidl::Error>>
2953 + Send;
2954 fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut;
2955 type WatchNextCallResponseFut: std::future::Future<Output = Result<NextCall, fidl::Error>>
2956 + Send;
2957 fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut;
2958 type RequestOutgoingCallResponseFut: std::future::Future<Output = Result<PeerHandlerRequestOutgoingCallResult, fidl::Error>>
2959 + Send;
2960 fn r#request_outgoing_call(&self, action: &CallAction) -> Self::RequestOutgoingCallResponseFut;
2961 type QueryOperatorResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
2962 + Send;
2963 fn r#query_operator(&self) -> Self::QueryOperatorResponseFut;
2964 type SubscriberNumberInformationResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
2965 + Send;
2966 fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut;
2967 type SetNrecModeResponseFut: std::future::Future<Output = Result<PeerHandlerSetNrecModeResult, fidl::Error>>
2968 + Send;
2969 fn r#set_nrec_mode(&self, enabled: bool) -> Self::SetNrecModeResponseFut;
2970 fn r#report_headset_battery_level(&self, level: u8) -> Result<(), fidl::Error>;
2971 fn r#gain_control(
2972 &self,
2973 control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
2974 ) -> Result<(), fidl::Error>;
2975}
2976#[derive(Debug)]
2977#[cfg(target_os = "fuchsia")]
2978pub struct PeerHandlerSynchronousProxy {
2979 client: fidl::client::sync::Client,
2980}
2981
2982#[cfg(target_os = "fuchsia")]
2983impl fidl::endpoints::SynchronousProxy for PeerHandlerSynchronousProxy {
2984 type Proxy = PeerHandlerProxy;
2985 type Protocol = PeerHandlerMarker;
2986
2987 fn from_channel(inner: fidl::Channel) -> Self {
2988 Self::new(inner)
2989 }
2990
2991 fn into_channel(self) -> fidl::Channel {
2992 self.client.into_channel()
2993 }
2994
2995 fn as_channel(&self) -> &fidl::Channel {
2996 self.client.as_channel()
2997 }
2998}
2999
3000#[cfg(target_os = "fuchsia")]
3001impl PeerHandlerSynchronousProxy {
3002 pub fn new(channel: fidl::Channel) -> Self {
3003 let protocol_name = <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3004 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3005 }
3006
3007 pub fn into_channel(self) -> fidl::Channel {
3008 self.client.into_channel()
3009 }
3010
3011 pub fn wait_for_event(
3014 &self,
3015 deadline: zx::MonotonicInstant,
3016 ) -> Result<PeerHandlerEvent, fidl::Error> {
3017 PeerHandlerEvent::decode(self.client.wait_for_event(deadline)?)
3018 }
3019
3020 pub fn r#watch_network_information(
3031 &self,
3032 ___deadline: zx::MonotonicInstant,
3033 ) -> Result<NetworkInformation, fidl::Error> {
3034 let _response = self
3035 .client
3036 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNetworkInformationResponse>(
3037 (),
3038 0x1c9eba597076b7cb,
3039 fidl::encoding::DynamicFlags::empty(),
3040 ___deadline,
3041 )?;
3042 Ok(_response.update)
3043 }
3044
3045 pub fn r#watch_next_call(
3050 &self,
3051 ___deadline: zx::MonotonicInstant,
3052 ) -> Result<NextCall, fidl::Error> {
3053 let _response = self
3054 .client
3055 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerWatchNextCallResponse>(
3056 (),
3057 0x5e3b7b4e7c3d359,
3058 fidl::encoding::DynamicFlags::empty(),
3059 ___deadline,
3060 )?;
3061 Ok(_response.call)
3062 }
3063
3064 pub fn r#request_outgoing_call(
3077 &self,
3078 mut action: &CallAction,
3079 ___deadline: zx::MonotonicInstant,
3080 ) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
3081 let _response = self.client.send_query::<
3082 PeerHandlerRequestOutgoingCallRequest,
3083 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3084 >(
3085 (action,),
3086 0x1a2637c743c89ad,
3087 fidl::encoding::DynamicFlags::empty(),
3088 ___deadline,
3089 )?;
3090 Ok(_response.map(|x| x))
3091 }
3092
3093 pub fn r#query_operator(
3097 &self,
3098 ___deadline: zx::MonotonicInstant,
3099 ) -> Result<Option<String>, fidl::Error> {
3100 let _response = self
3101 .client
3102 .send_query::<fidl::encoding::EmptyPayload, PeerHandlerQueryOperatorResponse>(
3103 (),
3104 0x1217eaf5db4c3300,
3105 fidl::encoding::DynamicFlags::empty(),
3106 ___deadline,
3107 )?;
3108 Ok(_response.operator)
3109 }
3110
3111 pub fn r#subscriber_number_information(
3115 &self,
3116 ___deadline: zx::MonotonicInstant,
3117 ) -> Result<Vec<String>, fidl::Error> {
3118 let _response = self.client.send_query::<
3119 fidl::encoding::EmptyPayload,
3120 PeerHandlerSubscriberNumberInformationResponse,
3121 >(
3122 (),
3123 0x15f5235855b02a3a,
3124 fidl::encoding::DynamicFlags::empty(),
3125 ___deadline,
3126 )?;
3127 Ok(_response.numbers)
3128 }
3129
3130 pub fn r#set_nrec_mode(
3135 &self,
3136 mut enabled: bool,
3137 ___deadline: zx::MonotonicInstant,
3138 ) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
3139 let _response = self.client.send_query::<
3140 PeerHandlerSetNrecModeRequest,
3141 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3142 >(
3143 (enabled,),
3144 0x2f8890d0f866672f,
3145 fidl::encoding::DynamicFlags::empty(),
3146 ___deadline,
3147 )?;
3148 Ok(_response.map(|x| x))
3149 }
3150
3151 pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3154 self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
3155 (level,),
3156 0x4e3e8be4680d85b,
3157 fidl::encoding::DynamicFlags::empty(),
3158 )
3159 }
3160
3161 pub fn r#gain_control(
3168 &self,
3169 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3170 ) -> Result<(), fidl::Error> {
3171 self.client.send::<PeerHandlerGainControlRequest>(
3172 (control,),
3173 0x6e043b6d2e0fb917,
3174 fidl::encoding::DynamicFlags::empty(),
3175 )
3176 }
3177}
3178
3179#[cfg(target_os = "fuchsia")]
3180impl From<PeerHandlerSynchronousProxy> for zx::Handle {
3181 fn from(value: PeerHandlerSynchronousProxy) -> Self {
3182 value.into_channel().into()
3183 }
3184}
3185
3186#[cfg(target_os = "fuchsia")]
3187impl From<fidl::Channel> for PeerHandlerSynchronousProxy {
3188 fn from(value: fidl::Channel) -> Self {
3189 Self::new(value)
3190 }
3191}
3192
3193#[derive(Debug, Clone)]
3194pub struct PeerHandlerProxy {
3195 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3196}
3197
3198impl fidl::endpoints::Proxy for PeerHandlerProxy {
3199 type Protocol = PeerHandlerMarker;
3200
3201 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3202 Self::new(inner)
3203 }
3204
3205 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3206 self.client.into_channel().map_err(|client| Self { client })
3207 }
3208
3209 fn as_channel(&self) -> &::fidl::AsyncChannel {
3210 self.client.as_channel()
3211 }
3212}
3213
3214impl PeerHandlerProxy {
3215 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3217 let protocol_name = <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3218 Self { client: fidl::client::Client::new(channel, protocol_name) }
3219 }
3220
3221 pub fn take_event_stream(&self) -> PeerHandlerEventStream {
3227 PeerHandlerEventStream { event_receiver: self.client.take_event_receiver() }
3228 }
3229
3230 pub fn r#watch_network_information(
3241 &self,
3242 ) -> fidl::client::QueryResponseFut<
3243 NetworkInformation,
3244 fidl::encoding::DefaultFuchsiaResourceDialect,
3245 > {
3246 PeerHandlerProxyInterface::r#watch_network_information(self)
3247 }
3248
3249 pub fn r#watch_next_call(
3254 &self,
3255 ) -> fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
3256 {
3257 PeerHandlerProxyInterface::r#watch_next_call(self)
3258 }
3259
3260 pub fn r#request_outgoing_call(
3273 &self,
3274 mut action: &CallAction,
3275 ) -> fidl::client::QueryResponseFut<
3276 PeerHandlerRequestOutgoingCallResult,
3277 fidl::encoding::DefaultFuchsiaResourceDialect,
3278 > {
3279 PeerHandlerProxyInterface::r#request_outgoing_call(self, action)
3280 }
3281
3282 pub fn r#query_operator(
3286 &self,
3287 ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
3288 {
3289 PeerHandlerProxyInterface::r#query_operator(self)
3290 }
3291
3292 pub fn r#subscriber_number_information(
3296 &self,
3297 ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
3298 {
3299 PeerHandlerProxyInterface::r#subscriber_number_information(self)
3300 }
3301
3302 pub fn r#set_nrec_mode(
3307 &self,
3308 mut enabled: bool,
3309 ) -> fidl::client::QueryResponseFut<
3310 PeerHandlerSetNrecModeResult,
3311 fidl::encoding::DefaultFuchsiaResourceDialect,
3312 > {
3313 PeerHandlerProxyInterface::r#set_nrec_mode(self, enabled)
3314 }
3315
3316 pub fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3319 PeerHandlerProxyInterface::r#report_headset_battery_level(self, level)
3320 }
3321
3322 pub fn r#gain_control(
3329 &self,
3330 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3331 ) -> Result<(), fidl::Error> {
3332 PeerHandlerProxyInterface::r#gain_control(self, control)
3333 }
3334}
3335
3336impl PeerHandlerProxyInterface for PeerHandlerProxy {
3337 type WatchNetworkInformationResponseFut = fidl::client::QueryResponseFut<
3338 NetworkInformation,
3339 fidl::encoding::DefaultFuchsiaResourceDialect,
3340 >;
3341 fn r#watch_network_information(&self) -> Self::WatchNetworkInformationResponseFut {
3342 fn _decode(
3343 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3344 ) -> Result<NetworkInformation, fidl::Error> {
3345 let _response = fidl::client::decode_transaction_body::<
3346 PeerHandlerWatchNetworkInformationResponse,
3347 fidl::encoding::DefaultFuchsiaResourceDialect,
3348 0x1c9eba597076b7cb,
3349 >(_buf?)?;
3350 Ok(_response.update)
3351 }
3352 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NetworkInformation>(
3353 (),
3354 0x1c9eba597076b7cb,
3355 fidl::encoding::DynamicFlags::empty(),
3356 _decode,
3357 )
3358 }
3359
3360 type WatchNextCallResponseFut =
3361 fidl::client::QueryResponseFut<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>;
3362 fn r#watch_next_call(&self) -> Self::WatchNextCallResponseFut {
3363 fn _decode(
3364 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3365 ) -> Result<NextCall, fidl::Error> {
3366 let _response = fidl::client::decode_transaction_body::<
3367 PeerHandlerWatchNextCallResponse,
3368 fidl::encoding::DefaultFuchsiaResourceDialect,
3369 0x5e3b7b4e7c3d359,
3370 >(_buf?)?;
3371 Ok(_response.call)
3372 }
3373 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, NextCall>(
3374 (),
3375 0x5e3b7b4e7c3d359,
3376 fidl::encoding::DynamicFlags::empty(),
3377 _decode,
3378 )
3379 }
3380
3381 type RequestOutgoingCallResponseFut = fidl::client::QueryResponseFut<
3382 PeerHandlerRequestOutgoingCallResult,
3383 fidl::encoding::DefaultFuchsiaResourceDialect,
3384 >;
3385 fn r#request_outgoing_call(
3386 &self,
3387 mut action: &CallAction,
3388 ) -> Self::RequestOutgoingCallResponseFut {
3389 fn _decode(
3390 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3391 ) -> Result<PeerHandlerRequestOutgoingCallResult, fidl::Error> {
3392 let _response = fidl::client::decode_transaction_body::<
3393 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3394 fidl::encoding::DefaultFuchsiaResourceDialect,
3395 0x1a2637c743c89ad,
3396 >(_buf?)?;
3397 Ok(_response.map(|x| x))
3398 }
3399 self.client.send_query_and_decode::<
3400 PeerHandlerRequestOutgoingCallRequest,
3401 PeerHandlerRequestOutgoingCallResult,
3402 >(
3403 (action,),
3404 0x1a2637c743c89ad,
3405 fidl::encoding::DynamicFlags::empty(),
3406 _decode,
3407 )
3408 }
3409
3410 type QueryOperatorResponseFut = fidl::client::QueryResponseFut<
3411 Option<String>,
3412 fidl::encoding::DefaultFuchsiaResourceDialect,
3413 >;
3414 fn r#query_operator(&self) -> Self::QueryOperatorResponseFut {
3415 fn _decode(
3416 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3417 ) -> Result<Option<String>, fidl::Error> {
3418 let _response = fidl::client::decode_transaction_body::<
3419 PeerHandlerQueryOperatorResponse,
3420 fidl::encoding::DefaultFuchsiaResourceDialect,
3421 0x1217eaf5db4c3300,
3422 >(_buf?)?;
3423 Ok(_response.operator)
3424 }
3425 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<String>>(
3426 (),
3427 0x1217eaf5db4c3300,
3428 fidl::encoding::DynamicFlags::empty(),
3429 _decode,
3430 )
3431 }
3432
3433 type SubscriberNumberInformationResponseFut =
3434 fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3435 fn r#subscriber_number_information(&self) -> Self::SubscriberNumberInformationResponseFut {
3436 fn _decode(
3437 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3438 ) -> Result<Vec<String>, fidl::Error> {
3439 let _response = fidl::client::decode_transaction_body::<
3440 PeerHandlerSubscriberNumberInformationResponse,
3441 fidl::encoding::DefaultFuchsiaResourceDialect,
3442 0x15f5235855b02a3a,
3443 >(_buf?)?;
3444 Ok(_response.numbers)
3445 }
3446 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
3447 (),
3448 0x15f5235855b02a3a,
3449 fidl::encoding::DynamicFlags::empty(),
3450 _decode,
3451 )
3452 }
3453
3454 type SetNrecModeResponseFut = fidl::client::QueryResponseFut<
3455 PeerHandlerSetNrecModeResult,
3456 fidl::encoding::DefaultFuchsiaResourceDialect,
3457 >;
3458 fn r#set_nrec_mode(&self, mut enabled: bool) -> Self::SetNrecModeResponseFut {
3459 fn _decode(
3460 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3461 ) -> Result<PeerHandlerSetNrecModeResult, fidl::Error> {
3462 let _response = fidl::client::decode_transaction_body::<
3463 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3464 fidl::encoding::DefaultFuchsiaResourceDialect,
3465 0x2f8890d0f866672f,
3466 >(_buf?)?;
3467 Ok(_response.map(|x| x))
3468 }
3469 self.client
3470 .send_query_and_decode::<PeerHandlerSetNrecModeRequest, PeerHandlerSetNrecModeResult>(
3471 (enabled,),
3472 0x2f8890d0f866672f,
3473 fidl::encoding::DynamicFlags::empty(),
3474 _decode,
3475 )
3476 }
3477
3478 fn r#report_headset_battery_level(&self, mut level: u8) -> Result<(), fidl::Error> {
3479 self.client.send::<PeerHandlerReportHeadsetBatteryLevelRequest>(
3480 (level,),
3481 0x4e3e8be4680d85b,
3482 fidl::encoding::DynamicFlags::empty(),
3483 )
3484 }
3485
3486 fn r#gain_control(
3487 &self,
3488 mut control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3489 ) -> Result<(), fidl::Error> {
3490 self.client.send::<PeerHandlerGainControlRequest>(
3491 (control,),
3492 0x6e043b6d2e0fb917,
3493 fidl::encoding::DynamicFlags::empty(),
3494 )
3495 }
3496}
3497
3498pub struct PeerHandlerEventStream {
3499 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3500}
3501
3502impl std::marker::Unpin for PeerHandlerEventStream {}
3503
3504impl futures::stream::FusedStream for PeerHandlerEventStream {
3505 fn is_terminated(&self) -> bool {
3506 self.event_receiver.is_terminated()
3507 }
3508}
3509
3510impl futures::Stream for PeerHandlerEventStream {
3511 type Item = Result<PeerHandlerEvent, fidl::Error>;
3512
3513 fn poll_next(
3514 mut self: std::pin::Pin<&mut Self>,
3515 cx: &mut std::task::Context<'_>,
3516 ) -> std::task::Poll<Option<Self::Item>> {
3517 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3518 &mut self.event_receiver,
3519 cx
3520 )?) {
3521 Some(buf) => std::task::Poll::Ready(Some(PeerHandlerEvent::decode(buf))),
3522 None => std::task::Poll::Ready(None),
3523 }
3524 }
3525}
3526
3527#[derive(Debug)]
3528pub enum PeerHandlerEvent {}
3529
3530impl PeerHandlerEvent {
3531 fn decode(
3533 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3534 ) -> Result<PeerHandlerEvent, fidl::Error> {
3535 let (bytes, _handles) = buf.split_mut();
3536 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3537 debug_assert_eq!(tx_header.tx_id, 0);
3538 match tx_header.ordinal {
3539 _ => Err(fidl::Error::UnknownOrdinal {
3540 ordinal: tx_header.ordinal,
3541 protocol_name: <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3542 }),
3543 }
3544 }
3545}
3546
3547pub struct PeerHandlerRequestStream {
3549 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3550 is_terminated: bool,
3551}
3552
3553impl std::marker::Unpin for PeerHandlerRequestStream {}
3554
3555impl futures::stream::FusedStream for PeerHandlerRequestStream {
3556 fn is_terminated(&self) -> bool {
3557 self.is_terminated
3558 }
3559}
3560
3561impl fidl::endpoints::RequestStream for PeerHandlerRequestStream {
3562 type Protocol = PeerHandlerMarker;
3563 type ControlHandle = PeerHandlerControlHandle;
3564
3565 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3566 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3567 }
3568
3569 fn control_handle(&self) -> Self::ControlHandle {
3570 PeerHandlerControlHandle { inner: self.inner.clone() }
3571 }
3572
3573 fn into_inner(
3574 self,
3575 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3576 {
3577 (self.inner, self.is_terminated)
3578 }
3579
3580 fn from_inner(
3581 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3582 is_terminated: bool,
3583 ) -> Self {
3584 Self { inner, is_terminated }
3585 }
3586}
3587
3588impl futures::Stream for PeerHandlerRequestStream {
3589 type Item = Result<PeerHandlerRequest, fidl::Error>;
3590
3591 fn poll_next(
3592 mut self: std::pin::Pin<&mut Self>,
3593 cx: &mut std::task::Context<'_>,
3594 ) -> std::task::Poll<Option<Self::Item>> {
3595 let this = &mut *self;
3596 if this.inner.check_shutdown(cx) {
3597 this.is_terminated = true;
3598 return std::task::Poll::Ready(None);
3599 }
3600 if this.is_terminated {
3601 panic!("polled PeerHandlerRequestStream after completion");
3602 }
3603 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3604 |bytes, handles| {
3605 match this.inner.channel().read_etc(cx, bytes, handles) {
3606 std::task::Poll::Ready(Ok(())) => {}
3607 std::task::Poll::Pending => return std::task::Poll::Pending,
3608 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3609 this.is_terminated = true;
3610 return std::task::Poll::Ready(None);
3611 }
3612 std::task::Poll::Ready(Err(e)) => {
3613 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3614 e.into(),
3615 ))))
3616 }
3617 }
3618
3619 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3621
3622 std::task::Poll::Ready(Some(match header.ordinal {
3623 0x1c9eba597076b7cb => {
3624 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3625 let mut req = fidl::new_empty!(
3626 fidl::encoding::EmptyPayload,
3627 fidl::encoding::DefaultFuchsiaResourceDialect
3628 );
3629 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3630 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3631 Ok(PeerHandlerRequest::WatchNetworkInformation {
3632 responder: PeerHandlerWatchNetworkInformationResponder {
3633 control_handle: std::mem::ManuallyDrop::new(control_handle),
3634 tx_id: header.tx_id,
3635 },
3636 })
3637 }
3638 0x5e3b7b4e7c3d359 => {
3639 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3640 let mut req = fidl::new_empty!(
3641 fidl::encoding::EmptyPayload,
3642 fidl::encoding::DefaultFuchsiaResourceDialect
3643 );
3644 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3645 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3646 Ok(PeerHandlerRequest::WatchNextCall {
3647 responder: PeerHandlerWatchNextCallResponder {
3648 control_handle: std::mem::ManuallyDrop::new(control_handle),
3649 tx_id: header.tx_id,
3650 },
3651 })
3652 }
3653 0x1a2637c743c89ad => {
3654 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3655 let mut req = fidl::new_empty!(
3656 PeerHandlerRequestOutgoingCallRequest,
3657 fidl::encoding::DefaultFuchsiaResourceDialect
3658 );
3659 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerRequestOutgoingCallRequest>(&header, _body_bytes, handles, &mut req)?;
3660 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3661 Ok(PeerHandlerRequest::RequestOutgoingCall {
3662 action: req.action,
3663
3664 responder: PeerHandlerRequestOutgoingCallResponder {
3665 control_handle: std::mem::ManuallyDrop::new(control_handle),
3666 tx_id: header.tx_id,
3667 },
3668 })
3669 }
3670 0x1217eaf5db4c3300 => {
3671 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3672 let mut req = fidl::new_empty!(
3673 fidl::encoding::EmptyPayload,
3674 fidl::encoding::DefaultFuchsiaResourceDialect
3675 );
3676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3677 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3678 Ok(PeerHandlerRequest::QueryOperator {
3679 responder: PeerHandlerQueryOperatorResponder {
3680 control_handle: std::mem::ManuallyDrop::new(control_handle),
3681 tx_id: header.tx_id,
3682 },
3683 })
3684 }
3685 0x15f5235855b02a3a => {
3686 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3687 let mut req = fidl::new_empty!(
3688 fidl::encoding::EmptyPayload,
3689 fidl::encoding::DefaultFuchsiaResourceDialect
3690 );
3691 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3692 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3693 Ok(PeerHandlerRequest::SubscriberNumberInformation {
3694 responder: PeerHandlerSubscriberNumberInformationResponder {
3695 control_handle: std::mem::ManuallyDrop::new(control_handle),
3696 tx_id: header.tx_id,
3697 },
3698 })
3699 }
3700 0x2f8890d0f866672f => {
3701 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3702 let mut req = fidl::new_empty!(
3703 PeerHandlerSetNrecModeRequest,
3704 fidl::encoding::DefaultFuchsiaResourceDialect
3705 );
3706 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerSetNrecModeRequest>(&header, _body_bytes, handles, &mut req)?;
3707 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3708 Ok(PeerHandlerRequest::SetNrecMode {
3709 enabled: req.enabled,
3710
3711 responder: PeerHandlerSetNrecModeResponder {
3712 control_handle: std::mem::ManuallyDrop::new(control_handle),
3713 tx_id: header.tx_id,
3714 },
3715 })
3716 }
3717 0x4e3e8be4680d85b => {
3718 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3719 let mut req = fidl::new_empty!(
3720 PeerHandlerReportHeadsetBatteryLevelRequest,
3721 fidl::encoding::DefaultFuchsiaResourceDialect
3722 );
3723 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerReportHeadsetBatteryLevelRequest>(&header, _body_bytes, handles, &mut req)?;
3724 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3725 Ok(PeerHandlerRequest::ReportHeadsetBatteryLevel {
3726 level: req.level,
3727
3728 control_handle,
3729 })
3730 }
3731 0x6e043b6d2e0fb917 => {
3732 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3733 let mut req = fidl::new_empty!(
3734 PeerHandlerGainControlRequest,
3735 fidl::encoding::DefaultFuchsiaResourceDialect
3736 );
3737 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerHandlerGainControlRequest>(&header, _body_bytes, handles, &mut req)?;
3738 let control_handle = PeerHandlerControlHandle { inner: this.inner.clone() };
3739 Ok(PeerHandlerRequest::GainControl { control: req.control, control_handle })
3740 }
3741 _ => Err(fidl::Error::UnknownOrdinal {
3742 ordinal: header.ordinal,
3743 protocol_name:
3744 <PeerHandlerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3745 }),
3746 }))
3747 },
3748 )
3749 }
3750}
3751
3752#[derive(Debug)]
3761pub enum PeerHandlerRequest {
3762 WatchNetworkInformation { responder: PeerHandlerWatchNetworkInformationResponder },
3773 WatchNextCall { responder: PeerHandlerWatchNextCallResponder },
3778 RequestOutgoingCall { action: CallAction, responder: PeerHandlerRequestOutgoingCallResponder },
3791 QueryOperator { responder: PeerHandlerQueryOperatorResponder },
3795 SubscriberNumberInformation { responder: PeerHandlerSubscriberNumberInformationResponder },
3799 SetNrecMode { enabled: bool, responder: PeerHandlerSetNrecModeResponder },
3804 ReportHeadsetBatteryLevel { level: u8, control_handle: PeerHandlerControlHandle },
3807 GainControl {
3814 control: fidl::endpoints::ClientEnd<HeadsetGainMarker>,
3815 control_handle: PeerHandlerControlHandle,
3816 },
3817}
3818
3819impl PeerHandlerRequest {
3820 #[allow(irrefutable_let_patterns)]
3821 pub fn into_watch_network_information(
3822 self,
3823 ) -> Option<(PeerHandlerWatchNetworkInformationResponder)> {
3824 if let PeerHandlerRequest::WatchNetworkInformation { responder } = self {
3825 Some((responder))
3826 } else {
3827 None
3828 }
3829 }
3830
3831 #[allow(irrefutable_let_patterns)]
3832 pub fn into_watch_next_call(self) -> Option<(PeerHandlerWatchNextCallResponder)> {
3833 if let PeerHandlerRequest::WatchNextCall { responder } = self {
3834 Some((responder))
3835 } else {
3836 None
3837 }
3838 }
3839
3840 #[allow(irrefutable_let_patterns)]
3841 pub fn into_request_outgoing_call(
3842 self,
3843 ) -> Option<(CallAction, PeerHandlerRequestOutgoingCallResponder)> {
3844 if let PeerHandlerRequest::RequestOutgoingCall { action, responder } = self {
3845 Some((action, responder))
3846 } else {
3847 None
3848 }
3849 }
3850
3851 #[allow(irrefutable_let_patterns)]
3852 pub fn into_query_operator(self) -> Option<(PeerHandlerQueryOperatorResponder)> {
3853 if let PeerHandlerRequest::QueryOperator { responder } = self {
3854 Some((responder))
3855 } else {
3856 None
3857 }
3858 }
3859
3860 #[allow(irrefutable_let_patterns)]
3861 pub fn into_subscriber_number_information(
3862 self,
3863 ) -> Option<(PeerHandlerSubscriberNumberInformationResponder)> {
3864 if let PeerHandlerRequest::SubscriberNumberInformation { responder } = self {
3865 Some((responder))
3866 } else {
3867 None
3868 }
3869 }
3870
3871 #[allow(irrefutable_let_patterns)]
3872 pub fn into_set_nrec_mode(self) -> Option<(bool, PeerHandlerSetNrecModeResponder)> {
3873 if let PeerHandlerRequest::SetNrecMode { enabled, responder } = self {
3874 Some((enabled, responder))
3875 } else {
3876 None
3877 }
3878 }
3879
3880 #[allow(irrefutable_let_patterns)]
3881 pub fn into_report_headset_battery_level(self) -> Option<(u8, PeerHandlerControlHandle)> {
3882 if let PeerHandlerRequest::ReportHeadsetBatteryLevel { level, control_handle } = self {
3883 Some((level, control_handle))
3884 } else {
3885 None
3886 }
3887 }
3888
3889 #[allow(irrefutable_let_patterns)]
3890 pub fn into_gain_control(
3891 self,
3892 ) -> Option<(fidl::endpoints::ClientEnd<HeadsetGainMarker>, PeerHandlerControlHandle)> {
3893 if let PeerHandlerRequest::GainControl { control, control_handle } = self {
3894 Some((control, control_handle))
3895 } else {
3896 None
3897 }
3898 }
3899
3900 pub fn method_name(&self) -> &'static str {
3902 match *self {
3903 PeerHandlerRequest::WatchNetworkInformation { .. } => "watch_network_information",
3904 PeerHandlerRequest::WatchNextCall { .. } => "watch_next_call",
3905 PeerHandlerRequest::RequestOutgoingCall { .. } => "request_outgoing_call",
3906 PeerHandlerRequest::QueryOperator { .. } => "query_operator",
3907 PeerHandlerRequest::SubscriberNumberInformation { .. } => {
3908 "subscriber_number_information"
3909 }
3910 PeerHandlerRequest::SetNrecMode { .. } => "set_nrec_mode",
3911 PeerHandlerRequest::ReportHeadsetBatteryLevel { .. } => "report_headset_battery_level",
3912 PeerHandlerRequest::GainControl { .. } => "gain_control",
3913 }
3914 }
3915}
3916
3917#[derive(Debug, Clone)]
3918pub struct PeerHandlerControlHandle {
3919 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3920}
3921
3922impl fidl::endpoints::ControlHandle for PeerHandlerControlHandle {
3923 fn shutdown(&self) {
3924 self.inner.shutdown()
3925 }
3926 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3927 self.inner.shutdown_with_epitaph(status)
3928 }
3929
3930 fn is_closed(&self) -> bool {
3931 self.inner.channel().is_closed()
3932 }
3933 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3934 self.inner.channel().on_closed()
3935 }
3936
3937 #[cfg(target_os = "fuchsia")]
3938 fn signal_peer(
3939 &self,
3940 clear_mask: zx::Signals,
3941 set_mask: zx::Signals,
3942 ) -> Result<(), zx_status::Status> {
3943 use fidl::Peered;
3944 self.inner.channel().signal_peer(clear_mask, set_mask)
3945 }
3946}
3947
3948impl PeerHandlerControlHandle {}
3949
3950#[must_use = "FIDL methods require a response to be sent"]
3951#[derive(Debug)]
3952pub struct PeerHandlerWatchNetworkInformationResponder {
3953 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
3954 tx_id: u32,
3955}
3956
3957impl std::ops::Drop for PeerHandlerWatchNetworkInformationResponder {
3961 fn drop(&mut self) {
3962 self.control_handle.shutdown();
3963 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3965 }
3966}
3967
3968impl fidl::endpoints::Responder for PeerHandlerWatchNetworkInformationResponder {
3969 type ControlHandle = PeerHandlerControlHandle;
3970
3971 fn control_handle(&self) -> &PeerHandlerControlHandle {
3972 &self.control_handle
3973 }
3974
3975 fn drop_without_shutdown(mut self) {
3976 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3978 std::mem::forget(self);
3980 }
3981}
3982
3983impl PeerHandlerWatchNetworkInformationResponder {
3984 pub fn send(self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
3988 let _result = self.send_raw(update);
3989 if _result.is_err() {
3990 self.control_handle.shutdown();
3991 }
3992 self.drop_without_shutdown();
3993 _result
3994 }
3995
3996 pub fn send_no_shutdown_on_err(
3998 self,
3999 mut update: &NetworkInformation,
4000 ) -> Result<(), fidl::Error> {
4001 let _result = self.send_raw(update);
4002 self.drop_without_shutdown();
4003 _result
4004 }
4005
4006 fn send_raw(&self, mut update: &NetworkInformation) -> Result<(), fidl::Error> {
4007 self.control_handle.inner.send::<PeerHandlerWatchNetworkInformationResponse>(
4008 (update,),
4009 self.tx_id,
4010 0x1c9eba597076b7cb,
4011 fidl::encoding::DynamicFlags::empty(),
4012 )
4013 }
4014}
4015
4016#[must_use = "FIDL methods require a response to be sent"]
4017#[derive(Debug)]
4018pub struct PeerHandlerWatchNextCallResponder {
4019 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4020 tx_id: u32,
4021}
4022
4023impl std::ops::Drop for PeerHandlerWatchNextCallResponder {
4027 fn drop(&mut self) {
4028 self.control_handle.shutdown();
4029 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4031 }
4032}
4033
4034impl fidl::endpoints::Responder for PeerHandlerWatchNextCallResponder {
4035 type ControlHandle = PeerHandlerControlHandle;
4036
4037 fn control_handle(&self) -> &PeerHandlerControlHandle {
4038 &self.control_handle
4039 }
4040
4041 fn drop_without_shutdown(mut self) {
4042 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4044 std::mem::forget(self);
4046 }
4047}
4048
4049impl PeerHandlerWatchNextCallResponder {
4050 pub fn send(self, mut call: NextCall) -> Result<(), fidl::Error> {
4054 let _result = self.send_raw(call);
4055 if _result.is_err() {
4056 self.control_handle.shutdown();
4057 }
4058 self.drop_without_shutdown();
4059 _result
4060 }
4061
4062 pub fn send_no_shutdown_on_err(self, mut call: NextCall) -> Result<(), fidl::Error> {
4064 let _result = self.send_raw(call);
4065 self.drop_without_shutdown();
4066 _result
4067 }
4068
4069 fn send_raw(&self, mut call: NextCall) -> Result<(), fidl::Error> {
4070 self.control_handle.inner.send::<PeerHandlerWatchNextCallResponse>(
4071 (&mut call,),
4072 self.tx_id,
4073 0x5e3b7b4e7c3d359,
4074 fidl::encoding::DynamicFlags::empty(),
4075 )
4076 }
4077}
4078
4079#[must_use = "FIDL methods require a response to be sent"]
4080#[derive(Debug)]
4081pub struct PeerHandlerRequestOutgoingCallResponder {
4082 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4083 tx_id: u32,
4084}
4085
4086impl std::ops::Drop for PeerHandlerRequestOutgoingCallResponder {
4090 fn drop(&mut self) {
4091 self.control_handle.shutdown();
4092 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4094 }
4095}
4096
4097impl fidl::endpoints::Responder for PeerHandlerRequestOutgoingCallResponder {
4098 type ControlHandle = PeerHandlerControlHandle;
4099
4100 fn control_handle(&self) -> &PeerHandlerControlHandle {
4101 &self.control_handle
4102 }
4103
4104 fn drop_without_shutdown(mut self) {
4105 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4107 std::mem::forget(self);
4109 }
4110}
4111
4112impl PeerHandlerRequestOutgoingCallResponder {
4113 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4117 let _result = self.send_raw(result);
4118 if _result.is_err() {
4119 self.control_handle.shutdown();
4120 }
4121 self.drop_without_shutdown();
4122 _result
4123 }
4124
4125 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4127 let _result = self.send_raw(result);
4128 self.drop_without_shutdown();
4129 _result
4130 }
4131
4132 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4133 self.control_handle
4134 .inner
4135 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4136 result,
4137 self.tx_id,
4138 0x1a2637c743c89ad,
4139 fidl::encoding::DynamicFlags::empty(),
4140 )
4141 }
4142}
4143
4144#[must_use = "FIDL methods require a response to be sent"]
4145#[derive(Debug)]
4146pub struct PeerHandlerQueryOperatorResponder {
4147 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4148 tx_id: u32,
4149}
4150
4151impl std::ops::Drop for PeerHandlerQueryOperatorResponder {
4155 fn drop(&mut self) {
4156 self.control_handle.shutdown();
4157 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4159 }
4160}
4161
4162impl fidl::endpoints::Responder for PeerHandlerQueryOperatorResponder {
4163 type ControlHandle = PeerHandlerControlHandle;
4164
4165 fn control_handle(&self) -> &PeerHandlerControlHandle {
4166 &self.control_handle
4167 }
4168
4169 fn drop_without_shutdown(mut self) {
4170 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4172 std::mem::forget(self);
4174 }
4175}
4176
4177impl PeerHandlerQueryOperatorResponder {
4178 pub fn send(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4182 let _result = self.send_raw(operator);
4183 if _result.is_err() {
4184 self.control_handle.shutdown();
4185 }
4186 self.drop_without_shutdown();
4187 _result
4188 }
4189
4190 pub fn send_no_shutdown_on_err(self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4192 let _result = self.send_raw(operator);
4193 self.drop_without_shutdown();
4194 _result
4195 }
4196
4197 fn send_raw(&self, mut operator: Option<&str>) -> Result<(), fidl::Error> {
4198 self.control_handle.inner.send::<PeerHandlerQueryOperatorResponse>(
4199 (operator,),
4200 self.tx_id,
4201 0x1217eaf5db4c3300,
4202 fidl::encoding::DynamicFlags::empty(),
4203 )
4204 }
4205}
4206
4207#[must_use = "FIDL methods require a response to be sent"]
4208#[derive(Debug)]
4209pub struct PeerHandlerSubscriberNumberInformationResponder {
4210 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4211 tx_id: u32,
4212}
4213
4214impl std::ops::Drop for PeerHandlerSubscriberNumberInformationResponder {
4218 fn drop(&mut self) {
4219 self.control_handle.shutdown();
4220 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4222 }
4223}
4224
4225impl fidl::endpoints::Responder for PeerHandlerSubscriberNumberInformationResponder {
4226 type ControlHandle = PeerHandlerControlHandle;
4227
4228 fn control_handle(&self) -> &PeerHandlerControlHandle {
4229 &self.control_handle
4230 }
4231
4232 fn drop_without_shutdown(mut self) {
4233 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4235 std::mem::forget(self);
4237 }
4238}
4239
4240impl PeerHandlerSubscriberNumberInformationResponder {
4241 pub fn send(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4245 let _result = self.send_raw(numbers);
4246 if _result.is_err() {
4247 self.control_handle.shutdown();
4248 }
4249 self.drop_without_shutdown();
4250 _result
4251 }
4252
4253 pub fn send_no_shutdown_on_err(self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4255 let _result = self.send_raw(numbers);
4256 self.drop_without_shutdown();
4257 _result
4258 }
4259
4260 fn send_raw(&self, mut numbers: &[String]) -> Result<(), fidl::Error> {
4261 self.control_handle.inner.send::<PeerHandlerSubscriberNumberInformationResponse>(
4262 (numbers,),
4263 self.tx_id,
4264 0x15f5235855b02a3a,
4265 fidl::encoding::DynamicFlags::empty(),
4266 )
4267 }
4268}
4269
4270#[must_use = "FIDL methods require a response to be sent"]
4271#[derive(Debug)]
4272pub struct PeerHandlerSetNrecModeResponder {
4273 control_handle: std::mem::ManuallyDrop<PeerHandlerControlHandle>,
4274 tx_id: u32,
4275}
4276
4277impl std::ops::Drop for PeerHandlerSetNrecModeResponder {
4281 fn drop(&mut self) {
4282 self.control_handle.shutdown();
4283 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4285 }
4286}
4287
4288impl fidl::endpoints::Responder for PeerHandlerSetNrecModeResponder {
4289 type ControlHandle = PeerHandlerControlHandle;
4290
4291 fn control_handle(&self) -> &PeerHandlerControlHandle {
4292 &self.control_handle
4293 }
4294
4295 fn drop_without_shutdown(mut self) {
4296 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4298 std::mem::forget(self);
4300 }
4301}
4302
4303impl PeerHandlerSetNrecModeResponder {
4304 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4308 let _result = self.send_raw(result);
4309 if _result.is_err() {
4310 self.control_handle.shutdown();
4311 }
4312 self.drop_without_shutdown();
4313 _result
4314 }
4315
4316 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4318 let _result = self.send_raw(result);
4319 self.drop_without_shutdown();
4320 _result
4321 }
4322
4323 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4324 self.control_handle
4325 .inner
4326 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4327 result,
4328 self.tx_id,
4329 0x2f8890d0f866672f,
4330 fidl::encoding::DynamicFlags::empty(),
4331 )
4332 }
4333}
4334
4335mod internal {
4336 use super::*;
4337
4338 impl fidl::encoding::ResourceTypeMarker for CallManagerPeerConnectedRequest {
4339 type Borrowed<'a> = &'a mut Self;
4340 fn take_or_borrow<'a>(
4341 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4342 ) -> Self::Borrowed<'a> {
4343 value
4344 }
4345 }
4346
4347 unsafe impl fidl::encoding::TypeMarker for CallManagerPeerConnectedRequest {
4348 type Owned = Self;
4349
4350 #[inline(always)]
4351 fn inline_align(_context: fidl::encoding::Context) -> usize {
4352 8
4353 }
4354
4355 #[inline(always)]
4356 fn inline_size(_context: fidl::encoding::Context) -> usize {
4357 16
4358 }
4359 }
4360
4361 unsafe impl
4362 fidl::encoding::Encode<
4363 CallManagerPeerConnectedRequest,
4364 fidl::encoding::DefaultFuchsiaResourceDialect,
4365 > for &mut CallManagerPeerConnectedRequest
4366 {
4367 #[inline]
4368 unsafe fn encode(
4369 self,
4370 encoder: &mut fidl::encoding::Encoder<
4371 '_,
4372 fidl::encoding::DefaultFuchsiaResourceDialect,
4373 >,
4374 offset: usize,
4375 _depth: fidl::encoding::Depth,
4376 ) -> fidl::Result<()> {
4377 encoder.debug_check_bounds::<CallManagerPeerConnectedRequest>(offset);
4378 fidl::encoding::Encode::<CallManagerPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4380 (
4381 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4382 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
4383 ),
4384 encoder, offset, _depth
4385 )
4386 }
4387 }
4388 unsafe impl<
4389 T0: fidl::encoding::Encode<
4390 fidl_fuchsia_bluetooth::PeerId,
4391 fidl::encoding::DefaultFuchsiaResourceDialect,
4392 >,
4393 T1: fidl::encoding::Encode<
4394 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4395 fidl::encoding::DefaultFuchsiaResourceDialect,
4396 >,
4397 >
4398 fidl::encoding::Encode<
4399 CallManagerPeerConnectedRequest,
4400 fidl::encoding::DefaultFuchsiaResourceDialect,
4401 > for (T0, T1)
4402 {
4403 #[inline]
4404 unsafe fn encode(
4405 self,
4406 encoder: &mut fidl::encoding::Encoder<
4407 '_,
4408 fidl::encoding::DefaultFuchsiaResourceDialect,
4409 >,
4410 offset: usize,
4411 depth: fidl::encoding::Depth,
4412 ) -> fidl::Result<()> {
4413 encoder.debug_check_bounds::<CallManagerPeerConnectedRequest>(offset);
4414 unsafe {
4417 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4418 (ptr as *mut u64).write_unaligned(0);
4419 }
4420 self.0.encode(encoder, offset + 0, depth)?;
4422 self.1.encode(encoder, offset + 8, depth)?;
4423 Ok(())
4424 }
4425 }
4426
4427 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4428 for CallManagerPeerConnectedRequest
4429 {
4430 #[inline(always)]
4431 fn new_empty() -> Self {
4432 Self {
4433 id: fidl::new_empty!(
4434 fidl_fuchsia_bluetooth::PeerId,
4435 fidl::encoding::DefaultFuchsiaResourceDialect
4436 ),
4437 handle: fidl::new_empty!(
4438 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4439 fidl::encoding::DefaultFuchsiaResourceDialect
4440 ),
4441 }
4442 }
4443
4444 #[inline]
4445 unsafe fn decode(
4446 &mut self,
4447 decoder: &mut fidl::encoding::Decoder<
4448 '_,
4449 fidl::encoding::DefaultFuchsiaResourceDialect,
4450 >,
4451 offset: usize,
4452 _depth: fidl::encoding::Depth,
4453 ) -> fidl::Result<()> {
4454 decoder.debug_check_bounds::<Self>(offset);
4455 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4457 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4458 let mask = 0xffffffff00000000u64;
4459 let maskedval = padval & mask;
4460 if maskedval != 0 {
4461 return Err(fidl::Error::NonZeroPadding {
4462 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4463 });
4464 }
4465 fidl::decode!(
4466 fidl_fuchsia_bluetooth::PeerId,
4467 fidl::encoding::DefaultFuchsiaResourceDialect,
4468 &mut self.id,
4469 decoder,
4470 offset + 0,
4471 _depth
4472 )?;
4473 fidl::decode!(
4474 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerHandlerMarker>>,
4475 fidl::encoding::DefaultFuchsiaResourceDialect,
4476 &mut self.handle,
4477 decoder,
4478 offset + 8,
4479 _depth
4480 )?;
4481 Ok(())
4482 }
4483 }
4484
4485 impl fidl::encoding::ResourceTypeMarker for HandsFreeWatchPeerConnectedResponse {
4486 type Borrowed<'a> = &'a mut Self;
4487 fn take_or_borrow<'a>(
4488 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4489 ) -> Self::Borrowed<'a> {
4490 value
4491 }
4492 }
4493
4494 unsafe impl fidl::encoding::TypeMarker for HandsFreeWatchPeerConnectedResponse {
4495 type Owned = Self;
4496
4497 #[inline(always)]
4498 fn inline_align(_context: fidl::encoding::Context) -> usize {
4499 8
4500 }
4501
4502 #[inline(always)]
4503 fn inline_size(_context: fidl::encoding::Context) -> usize {
4504 16
4505 }
4506 }
4507
4508 unsafe impl
4509 fidl::encoding::Encode<
4510 HandsFreeWatchPeerConnectedResponse,
4511 fidl::encoding::DefaultFuchsiaResourceDialect,
4512 > for &mut HandsFreeWatchPeerConnectedResponse
4513 {
4514 #[inline]
4515 unsafe fn encode(
4516 self,
4517 encoder: &mut fidl::encoding::Encoder<
4518 '_,
4519 fidl::encoding::DefaultFuchsiaResourceDialect,
4520 >,
4521 offset: usize,
4522 _depth: fidl::encoding::Depth,
4523 ) -> fidl::Result<()> {
4524 encoder.debug_check_bounds::<HandsFreeWatchPeerConnectedResponse>(offset);
4525 fidl::encoding::Encode::<HandsFreeWatchPeerConnectedResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4527 (
4528 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4529 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
4530 ),
4531 encoder, offset, _depth
4532 )
4533 }
4534 }
4535 unsafe impl<
4536 T0: fidl::encoding::Encode<
4537 fidl_fuchsia_bluetooth::PeerId,
4538 fidl::encoding::DefaultFuchsiaResourceDialect,
4539 >,
4540 T1: fidl::encoding::Encode<
4541 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4542 fidl::encoding::DefaultFuchsiaResourceDialect,
4543 >,
4544 >
4545 fidl::encoding::Encode<
4546 HandsFreeWatchPeerConnectedResponse,
4547 fidl::encoding::DefaultFuchsiaResourceDialect,
4548 > for (T0, T1)
4549 {
4550 #[inline]
4551 unsafe fn encode(
4552 self,
4553 encoder: &mut fidl::encoding::Encoder<
4554 '_,
4555 fidl::encoding::DefaultFuchsiaResourceDialect,
4556 >,
4557 offset: usize,
4558 depth: fidl::encoding::Depth,
4559 ) -> fidl::Result<()> {
4560 encoder.debug_check_bounds::<HandsFreeWatchPeerConnectedResponse>(offset);
4561 unsafe {
4564 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4565 (ptr as *mut u64).write_unaligned(0);
4566 }
4567 self.0.encode(encoder, offset + 0, depth)?;
4569 self.1.encode(encoder, offset + 8, depth)?;
4570 Ok(())
4571 }
4572 }
4573
4574 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4575 for HandsFreeWatchPeerConnectedResponse
4576 {
4577 #[inline(always)]
4578 fn new_empty() -> Self {
4579 Self {
4580 id: fidl::new_empty!(
4581 fidl_fuchsia_bluetooth::PeerId,
4582 fidl::encoding::DefaultFuchsiaResourceDialect
4583 ),
4584 handle: fidl::new_empty!(
4585 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4586 fidl::encoding::DefaultFuchsiaResourceDialect
4587 ),
4588 }
4589 }
4590
4591 #[inline]
4592 unsafe fn decode(
4593 &mut self,
4594 decoder: &mut fidl::encoding::Decoder<
4595 '_,
4596 fidl::encoding::DefaultFuchsiaResourceDialect,
4597 >,
4598 offset: usize,
4599 _depth: fidl::encoding::Depth,
4600 ) -> fidl::Result<()> {
4601 decoder.debug_check_bounds::<Self>(offset);
4602 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4604 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4605 let mask = 0xffffffff00000000u64;
4606 let maskedval = padval & mask;
4607 if maskedval != 0 {
4608 return Err(fidl::Error::NonZeroPadding {
4609 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4610 });
4611 }
4612 fidl::decode!(
4613 fidl_fuchsia_bluetooth::PeerId,
4614 fidl::encoding::DefaultFuchsiaResourceDialect,
4615 &mut self.id,
4616 decoder,
4617 offset + 0,
4618 _depth
4619 )?;
4620 fidl::decode!(
4621 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PeerHandlerMarker>>,
4622 fidl::encoding::DefaultFuchsiaResourceDialect,
4623 &mut self.handle,
4624 decoder,
4625 offset + 8,
4626 _depth
4627 )?;
4628 Ok(())
4629 }
4630 }
4631
4632 impl fidl::encoding::ResourceTypeMarker for HfpRegisterRequest {
4633 type Borrowed<'a> = &'a mut Self;
4634 fn take_or_borrow<'a>(
4635 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4636 ) -> Self::Borrowed<'a> {
4637 value
4638 }
4639 }
4640
4641 unsafe impl fidl::encoding::TypeMarker for HfpRegisterRequest {
4642 type Owned = Self;
4643
4644 #[inline(always)]
4645 fn inline_align(_context: fidl::encoding::Context) -> usize {
4646 4
4647 }
4648
4649 #[inline(always)]
4650 fn inline_size(_context: fidl::encoding::Context) -> usize {
4651 4
4652 }
4653 }
4654
4655 unsafe impl
4656 fidl::encoding::Encode<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4657 for &mut HfpRegisterRequest
4658 {
4659 #[inline]
4660 unsafe fn encode(
4661 self,
4662 encoder: &mut fidl::encoding::Encoder<
4663 '_,
4664 fidl::encoding::DefaultFuchsiaResourceDialect,
4665 >,
4666 offset: usize,
4667 _depth: fidl::encoding::Depth,
4668 ) -> fidl::Result<()> {
4669 encoder.debug_check_bounds::<HfpRegisterRequest>(offset);
4670 fidl::encoding::Encode::<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4672 (
4673 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
4674 ),
4675 encoder, offset, _depth
4676 )
4677 }
4678 }
4679 unsafe impl<
4680 T0: fidl::encoding::Encode<
4681 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4682 fidl::encoding::DefaultFuchsiaResourceDialect,
4683 >,
4684 >
4685 fidl::encoding::Encode<HfpRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
4686 for (T0,)
4687 {
4688 #[inline]
4689 unsafe fn encode(
4690 self,
4691 encoder: &mut fidl::encoding::Encoder<
4692 '_,
4693 fidl::encoding::DefaultFuchsiaResourceDialect,
4694 >,
4695 offset: usize,
4696 depth: fidl::encoding::Depth,
4697 ) -> fidl::Result<()> {
4698 encoder.debug_check_bounds::<HfpRegisterRequest>(offset);
4699 self.0.encode(encoder, offset + 0, depth)?;
4703 Ok(())
4704 }
4705 }
4706
4707 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4708 for HfpRegisterRequest
4709 {
4710 #[inline(always)]
4711 fn new_empty() -> Self {
4712 Self {
4713 manager: fidl::new_empty!(
4714 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4715 fidl::encoding::DefaultFuchsiaResourceDialect
4716 ),
4717 }
4718 }
4719
4720 #[inline]
4721 unsafe fn decode(
4722 &mut self,
4723 decoder: &mut fidl::encoding::Decoder<
4724 '_,
4725 fidl::encoding::DefaultFuchsiaResourceDialect,
4726 >,
4727 offset: usize,
4728 _depth: fidl::encoding::Depth,
4729 ) -> fidl::Result<()> {
4730 decoder.debug_check_bounds::<Self>(offset);
4731 fidl::decode!(
4733 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallManagerMarker>>,
4734 fidl::encoding::DefaultFuchsiaResourceDialect,
4735 &mut self.manager,
4736 decoder,
4737 offset + 0,
4738 _depth
4739 )?;
4740 Ok(())
4741 }
4742 }
4743
4744 impl fidl::encoding::ResourceTypeMarker for PeerHandlerGainControlRequest {
4745 type Borrowed<'a> = &'a mut Self;
4746 fn take_or_borrow<'a>(
4747 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4748 ) -> Self::Borrowed<'a> {
4749 value
4750 }
4751 }
4752
4753 unsafe impl fidl::encoding::TypeMarker for PeerHandlerGainControlRequest {
4754 type Owned = Self;
4755
4756 #[inline(always)]
4757 fn inline_align(_context: fidl::encoding::Context) -> usize {
4758 4
4759 }
4760
4761 #[inline(always)]
4762 fn inline_size(_context: fidl::encoding::Context) -> usize {
4763 4
4764 }
4765 }
4766
4767 unsafe impl
4768 fidl::encoding::Encode<
4769 PeerHandlerGainControlRequest,
4770 fidl::encoding::DefaultFuchsiaResourceDialect,
4771 > for &mut PeerHandlerGainControlRequest
4772 {
4773 #[inline]
4774 unsafe fn encode(
4775 self,
4776 encoder: &mut fidl::encoding::Encoder<
4777 '_,
4778 fidl::encoding::DefaultFuchsiaResourceDialect,
4779 >,
4780 offset: usize,
4781 _depth: fidl::encoding::Depth,
4782 ) -> fidl::Result<()> {
4783 encoder.debug_check_bounds::<PeerHandlerGainControlRequest>(offset);
4784 fidl::encoding::Encode::<PeerHandlerGainControlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4786 (
4787 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
4788 ),
4789 encoder, offset, _depth
4790 )
4791 }
4792 }
4793 unsafe impl<
4794 T0: fidl::encoding::Encode<
4795 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4796 fidl::encoding::DefaultFuchsiaResourceDialect,
4797 >,
4798 >
4799 fidl::encoding::Encode<
4800 PeerHandlerGainControlRequest,
4801 fidl::encoding::DefaultFuchsiaResourceDialect,
4802 > for (T0,)
4803 {
4804 #[inline]
4805 unsafe fn encode(
4806 self,
4807 encoder: &mut fidl::encoding::Encoder<
4808 '_,
4809 fidl::encoding::DefaultFuchsiaResourceDialect,
4810 >,
4811 offset: usize,
4812 depth: fidl::encoding::Depth,
4813 ) -> fidl::Result<()> {
4814 encoder.debug_check_bounds::<PeerHandlerGainControlRequest>(offset);
4815 self.0.encode(encoder, offset + 0, depth)?;
4819 Ok(())
4820 }
4821 }
4822
4823 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4824 for PeerHandlerGainControlRequest
4825 {
4826 #[inline(always)]
4827 fn new_empty() -> Self {
4828 Self {
4829 control: fidl::new_empty!(
4830 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4831 fidl::encoding::DefaultFuchsiaResourceDialect
4832 ),
4833 }
4834 }
4835
4836 #[inline]
4837 unsafe fn decode(
4838 &mut self,
4839 decoder: &mut fidl::encoding::Decoder<
4840 '_,
4841 fidl::encoding::DefaultFuchsiaResourceDialect,
4842 >,
4843 offset: usize,
4844 _depth: fidl::encoding::Depth,
4845 ) -> fidl::Result<()> {
4846 decoder.debug_check_bounds::<Self>(offset);
4847 fidl::decode!(
4849 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HeadsetGainMarker>>,
4850 fidl::encoding::DefaultFuchsiaResourceDialect,
4851 &mut self.control,
4852 decoder,
4853 offset + 0,
4854 _depth
4855 )?;
4856 Ok(())
4857 }
4858 }
4859
4860 impl fidl::encoding::ResourceTypeMarker for PeerHandlerWatchNextCallResponse {
4861 type Borrowed<'a> = &'a mut Self;
4862 fn take_or_borrow<'a>(
4863 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4864 ) -> Self::Borrowed<'a> {
4865 value
4866 }
4867 }
4868
4869 unsafe impl fidl::encoding::TypeMarker for PeerHandlerWatchNextCallResponse {
4870 type Owned = Self;
4871
4872 #[inline(always)]
4873 fn inline_align(_context: fidl::encoding::Context) -> usize {
4874 8
4875 }
4876
4877 #[inline(always)]
4878 fn inline_size(_context: fidl::encoding::Context) -> usize {
4879 16
4880 }
4881 }
4882
4883 unsafe impl
4884 fidl::encoding::Encode<
4885 PeerHandlerWatchNextCallResponse,
4886 fidl::encoding::DefaultFuchsiaResourceDialect,
4887 > for &mut PeerHandlerWatchNextCallResponse
4888 {
4889 #[inline]
4890 unsafe fn encode(
4891 self,
4892 encoder: &mut fidl::encoding::Encoder<
4893 '_,
4894 fidl::encoding::DefaultFuchsiaResourceDialect,
4895 >,
4896 offset: usize,
4897 _depth: fidl::encoding::Depth,
4898 ) -> fidl::Result<()> {
4899 encoder.debug_check_bounds::<PeerHandlerWatchNextCallResponse>(offset);
4900 fidl::encoding::Encode::<
4902 PeerHandlerWatchNextCallResponse,
4903 fidl::encoding::DefaultFuchsiaResourceDialect,
4904 >::encode(
4905 (<NextCall as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.call),),
4906 encoder,
4907 offset,
4908 _depth,
4909 )
4910 }
4911 }
4912 unsafe impl<T0: fidl::encoding::Encode<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>>
4913 fidl::encoding::Encode<
4914 PeerHandlerWatchNextCallResponse,
4915 fidl::encoding::DefaultFuchsiaResourceDialect,
4916 > for (T0,)
4917 {
4918 #[inline]
4919 unsafe fn encode(
4920 self,
4921 encoder: &mut fidl::encoding::Encoder<
4922 '_,
4923 fidl::encoding::DefaultFuchsiaResourceDialect,
4924 >,
4925 offset: usize,
4926 depth: fidl::encoding::Depth,
4927 ) -> fidl::Result<()> {
4928 encoder.debug_check_bounds::<PeerHandlerWatchNextCallResponse>(offset);
4929 self.0.encode(encoder, offset + 0, depth)?;
4933 Ok(())
4934 }
4935 }
4936
4937 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4938 for PeerHandlerWatchNextCallResponse
4939 {
4940 #[inline(always)]
4941 fn new_empty() -> Self {
4942 Self { call: fidl::new_empty!(NextCall, fidl::encoding::DefaultFuchsiaResourceDialect) }
4943 }
4944
4945 #[inline]
4946 unsafe fn decode(
4947 &mut self,
4948 decoder: &mut fidl::encoding::Decoder<
4949 '_,
4950 fidl::encoding::DefaultFuchsiaResourceDialect,
4951 >,
4952 offset: usize,
4953 _depth: fidl::encoding::Depth,
4954 ) -> fidl::Result<()> {
4955 decoder.debug_check_bounds::<Self>(offset);
4956 fidl::decode!(
4958 NextCall,
4959 fidl::encoding::DefaultFuchsiaResourceDialect,
4960 &mut self.call,
4961 decoder,
4962 offset + 0,
4963 _depth
4964 )?;
4965 Ok(())
4966 }
4967 }
4968
4969 impl NextCall {
4970 #[inline(always)]
4971 fn max_ordinal_present(&self) -> u64 {
4972 if let Some(_) = self.direction {
4973 return 4;
4974 }
4975 if let Some(_) = self.state {
4976 return 3;
4977 }
4978 if let Some(_) = self.remote {
4979 return 2;
4980 }
4981 if let Some(_) = self.call {
4982 return 1;
4983 }
4984 0
4985 }
4986 }
4987
4988 impl fidl::encoding::ResourceTypeMarker for NextCall {
4989 type Borrowed<'a> = &'a mut Self;
4990 fn take_or_borrow<'a>(
4991 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4992 ) -> Self::Borrowed<'a> {
4993 value
4994 }
4995 }
4996
4997 unsafe impl fidl::encoding::TypeMarker for NextCall {
4998 type Owned = Self;
4999
5000 #[inline(always)]
5001 fn inline_align(_context: fidl::encoding::Context) -> usize {
5002 8
5003 }
5004
5005 #[inline(always)]
5006 fn inline_size(_context: fidl::encoding::Context) -> usize {
5007 16
5008 }
5009 }
5010
5011 unsafe impl fidl::encoding::Encode<NextCall, fidl::encoding::DefaultFuchsiaResourceDialect>
5012 for &mut NextCall
5013 {
5014 unsafe fn encode(
5015 self,
5016 encoder: &mut fidl::encoding::Encoder<
5017 '_,
5018 fidl::encoding::DefaultFuchsiaResourceDialect,
5019 >,
5020 offset: usize,
5021 mut depth: fidl::encoding::Depth,
5022 ) -> fidl::Result<()> {
5023 encoder.debug_check_bounds::<NextCall>(offset);
5024 let max_ordinal: u64 = self.max_ordinal_present();
5026 encoder.write_num(max_ordinal, offset);
5027 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5028 if max_ordinal == 0 {
5030 return Ok(());
5031 }
5032 depth.increment()?;
5033 let envelope_size = 8;
5034 let bytes_len = max_ordinal as usize * envelope_size;
5035 #[allow(unused_variables)]
5036 let offset = encoder.out_of_line_offset(bytes_len);
5037 let mut _prev_end_offset: usize = 0;
5038 if 1 > max_ordinal {
5039 return Ok(());
5040 }
5041
5042 let cur_offset: usize = (1 - 1) * envelope_size;
5045
5046 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5048
5049 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5054 self.call.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5055 encoder, offset + cur_offset, depth
5056 )?;
5057
5058 _prev_end_offset = cur_offset + envelope_size;
5059 if 2 > max_ordinal {
5060 return Ok(());
5061 }
5062
5063 let cur_offset: usize = (2 - 1) * envelope_size;
5066
5067 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5069
5070 fidl::encoding::encode_in_envelope_optional::<
5075 fidl::encoding::BoundedString<256>,
5076 fidl::encoding::DefaultFuchsiaResourceDialect,
5077 >(
5078 self.remote.as_ref().map(
5079 <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
5080 ),
5081 encoder,
5082 offset + cur_offset,
5083 depth,
5084 )?;
5085
5086 _prev_end_offset = cur_offset + envelope_size;
5087 if 3 > max_ordinal {
5088 return Ok(());
5089 }
5090
5091 let cur_offset: usize = (3 - 1) * envelope_size;
5094
5095 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5097
5098 fidl::encoding::encode_in_envelope_optional::<
5103 CallState,
5104 fidl::encoding::DefaultFuchsiaResourceDialect,
5105 >(
5106 self.state.as_ref().map(<CallState as fidl::encoding::ValueTypeMarker>::borrow),
5107 encoder,
5108 offset + cur_offset,
5109 depth,
5110 )?;
5111
5112 _prev_end_offset = cur_offset + envelope_size;
5113 if 4 > max_ordinal {
5114 return Ok(());
5115 }
5116
5117 let cur_offset: usize = (4 - 1) * envelope_size;
5120
5121 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5123
5124 fidl::encoding::encode_in_envelope_optional::<
5129 CallDirection,
5130 fidl::encoding::DefaultFuchsiaResourceDialect,
5131 >(
5132 self.direction
5133 .as_ref()
5134 .map(<CallDirection as fidl::encoding::ValueTypeMarker>::borrow),
5135 encoder,
5136 offset + cur_offset,
5137 depth,
5138 )?;
5139
5140 _prev_end_offset = cur_offset + envelope_size;
5141
5142 Ok(())
5143 }
5144 }
5145
5146 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for NextCall {
5147 #[inline(always)]
5148 fn new_empty() -> Self {
5149 Self::default()
5150 }
5151
5152 unsafe fn decode(
5153 &mut self,
5154 decoder: &mut fidl::encoding::Decoder<
5155 '_,
5156 fidl::encoding::DefaultFuchsiaResourceDialect,
5157 >,
5158 offset: usize,
5159 mut depth: fidl::encoding::Depth,
5160 ) -> fidl::Result<()> {
5161 decoder.debug_check_bounds::<Self>(offset);
5162 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5163 None => return Err(fidl::Error::NotNullable),
5164 Some(len) => len,
5165 };
5166 if len == 0 {
5168 return Ok(());
5169 };
5170 depth.increment()?;
5171 let envelope_size = 8;
5172 let bytes_len = len * envelope_size;
5173 let offset = decoder.out_of_line_offset(bytes_len)?;
5174 let mut _next_ordinal_to_read = 0;
5176 let mut next_offset = offset;
5177 let end_offset = offset + bytes_len;
5178 _next_ordinal_to_read += 1;
5179 if next_offset >= end_offset {
5180 return Ok(());
5181 }
5182
5183 while _next_ordinal_to_read < 1 {
5185 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5186 _next_ordinal_to_read += 1;
5187 next_offset += envelope_size;
5188 }
5189
5190 let next_out_of_line = decoder.next_out_of_line();
5191 let handles_before = decoder.remaining_handles();
5192 if let Some((inlined, num_bytes, num_handles)) =
5193 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5194 {
5195 let member_inline_size = <fidl::encoding::Endpoint<
5196 fidl::endpoints::ClientEnd<CallMarker>,
5197 > as fidl::encoding::TypeMarker>::inline_size(
5198 decoder.context
5199 );
5200 if inlined != (member_inline_size <= 4) {
5201 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5202 }
5203 let inner_offset;
5204 let mut inner_depth = depth.clone();
5205 if inlined {
5206 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5207 inner_offset = next_offset;
5208 } else {
5209 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5210 inner_depth.increment()?;
5211 }
5212 let val_ref = self.call.get_or_insert_with(|| {
5213 fidl::new_empty!(
5214 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
5215 fidl::encoding::DefaultFuchsiaResourceDialect
5216 )
5217 });
5218 fidl::decode!(
5219 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CallMarker>>,
5220 fidl::encoding::DefaultFuchsiaResourceDialect,
5221 val_ref,
5222 decoder,
5223 inner_offset,
5224 inner_depth
5225 )?;
5226 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5227 {
5228 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5229 }
5230 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5231 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5232 }
5233 }
5234
5235 next_offset += envelope_size;
5236 _next_ordinal_to_read += 1;
5237 if next_offset >= end_offset {
5238 return Ok(());
5239 }
5240
5241 while _next_ordinal_to_read < 2 {
5243 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5244 _next_ordinal_to_read += 1;
5245 next_offset += envelope_size;
5246 }
5247
5248 let next_out_of_line = decoder.next_out_of_line();
5249 let handles_before = decoder.remaining_handles();
5250 if let Some((inlined, num_bytes, num_handles)) =
5251 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5252 {
5253 let member_inline_size =
5254 <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
5255 decoder.context,
5256 );
5257 if inlined != (member_inline_size <= 4) {
5258 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5259 }
5260 let inner_offset;
5261 let mut inner_depth = depth.clone();
5262 if inlined {
5263 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5264 inner_offset = next_offset;
5265 } else {
5266 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5267 inner_depth.increment()?;
5268 }
5269 let val_ref = self.remote.get_or_insert_with(|| {
5270 fidl::new_empty!(
5271 fidl::encoding::BoundedString<256>,
5272 fidl::encoding::DefaultFuchsiaResourceDialect
5273 )
5274 });
5275 fidl::decode!(
5276 fidl::encoding::BoundedString<256>,
5277 fidl::encoding::DefaultFuchsiaResourceDialect,
5278 val_ref,
5279 decoder,
5280 inner_offset,
5281 inner_depth
5282 )?;
5283 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5284 {
5285 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5286 }
5287 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5288 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5289 }
5290 }
5291
5292 next_offset += envelope_size;
5293 _next_ordinal_to_read += 1;
5294 if next_offset >= end_offset {
5295 return Ok(());
5296 }
5297
5298 while _next_ordinal_to_read < 3 {
5300 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5301 _next_ordinal_to_read += 1;
5302 next_offset += envelope_size;
5303 }
5304
5305 let next_out_of_line = decoder.next_out_of_line();
5306 let handles_before = decoder.remaining_handles();
5307 if let Some((inlined, num_bytes, num_handles)) =
5308 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5309 {
5310 let member_inline_size =
5311 <CallState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5312 if inlined != (member_inline_size <= 4) {
5313 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5314 }
5315 let inner_offset;
5316 let mut inner_depth = depth.clone();
5317 if inlined {
5318 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5319 inner_offset = next_offset;
5320 } else {
5321 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5322 inner_depth.increment()?;
5323 }
5324 let val_ref = self.state.get_or_insert_with(|| {
5325 fidl::new_empty!(CallState, fidl::encoding::DefaultFuchsiaResourceDialect)
5326 });
5327 fidl::decode!(
5328 CallState,
5329 fidl::encoding::DefaultFuchsiaResourceDialect,
5330 val_ref,
5331 decoder,
5332 inner_offset,
5333 inner_depth
5334 )?;
5335 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5336 {
5337 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5338 }
5339 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5340 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5341 }
5342 }
5343
5344 next_offset += envelope_size;
5345 _next_ordinal_to_read += 1;
5346 if next_offset >= end_offset {
5347 return Ok(());
5348 }
5349
5350 while _next_ordinal_to_read < 4 {
5352 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5353 _next_ordinal_to_read += 1;
5354 next_offset += envelope_size;
5355 }
5356
5357 let next_out_of_line = decoder.next_out_of_line();
5358 let handles_before = decoder.remaining_handles();
5359 if let Some((inlined, num_bytes, num_handles)) =
5360 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5361 {
5362 let member_inline_size =
5363 <CallDirection as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5364 if inlined != (member_inline_size <= 4) {
5365 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5366 }
5367 let inner_offset;
5368 let mut inner_depth = depth.clone();
5369 if inlined {
5370 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5371 inner_offset = next_offset;
5372 } else {
5373 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5374 inner_depth.increment()?;
5375 }
5376 let val_ref = self.direction.get_or_insert_with(|| {
5377 fidl::new_empty!(CallDirection, fidl::encoding::DefaultFuchsiaResourceDialect)
5378 });
5379 fidl::decode!(
5380 CallDirection,
5381 fidl::encoding::DefaultFuchsiaResourceDialect,
5382 val_ref,
5383 decoder,
5384 inner_offset,
5385 inner_depth
5386 )?;
5387 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5388 {
5389 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5390 }
5391 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5392 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5393 }
5394 }
5395
5396 next_offset += envelope_size;
5397
5398 while next_offset < end_offset {
5400 _next_ordinal_to_read += 1;
5401 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5402 next_offset += envelope_size;
5403 }
5404
5405 Ok(())
5406 }
5407 }
5408}