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