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