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_internal_a2dp_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControllerSuspendRequest {
16 pub peer_id: Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
17 pub token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerSuspendRequest {}
21
22#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
23pub struct ControllerMarker;
24
25impl fidl::endpoints::ProtocolMarker for ControllerMarker {
26 type Proxy = ControllerProxy;
27 type RequestStream = ControllerRequestStream;
28 #[cfg(target_os = "fuchsia")]
29 type SynchronousProxy = ControllerSynchronousProxy;
30
31 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.internal.a2dp.Controller";
32}
33impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
34
35pub trait ControllerProxyInterface: Send + Sync {
36 type SuspendResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
37 fn r#suspend(
38 &self,
39 peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
40 token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
41 ) -> Self::SuspendResponseFut;
42}
43#[derive(Debug)]
44#[cfg(target_os = "fuchsia")]
45pub struct ControllerSynchronousProxy {
46 client: fidl::client::sync::Client,
47}
48
49#[cfg(target_os = "fuchsia")]
50impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
51 type Proxy = ControllerProxy;
52 type Protocol = ControllerMarker;
53
54 fn from_channel(inner: fidl::Channel) -> Self {
55 Self::new(inner)
56 }
57
58 fn into_channel(self) -> fidl::Channel {
59 self.client.into_channel()
60 }
61
62 fn as_channel(&self) -> &fidl::Channel {
63 self.client.as_channel()
64 }
65}
66
67#[cfg(target_os = "fuchsia")]
68impl ControllerSynchronousProxy {
69 pub fn new(channel: fidl::Channel) -> Self {
70 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
71 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
72 }
73
74 pub fn into_channel(self) -> fidl::Channel {
75 self.client.into_channel()
76 }
77
78 pub fn wait_for_event(
81 &self,
82 deadline: zx::MonotonicInstant,
83 ) -> Result<ControllerEvent, fidl::Error> {
84 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
85 }
86
87 pub fn r#suspend(
108 &self,
109 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
110 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
111 ___deadline: zx::MonotonicInstant,
112 ) -> Result<(), fidl::Error> {
113 let _response =
114 self.client.send_query::<ControllerSuspendRequest, fidl::encoding::EmptyPayload>(
115 (peer_id, token),
116 0xe68646aaf69cb61,
117 fidl::encoding::DynamicFlags::empty(),
118 ___deadline,
119 )?;
120 Ok(_response)
121 }
122}
123
124#[derive(Debug, Clone)]
125pub struct ControllerProxy {
126 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
127}
128
129impl fidl::endpoints::Proxy for ControllerProxy {
130 type Protocol = ControllerMarker;
131
132 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
133 Self::new(inner)
134 }
135
136 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
137 self.client.into_channel().map_err(|client| Self { client })
138 }
139
140 fn as_channel(&self) -> &::fidl::AsyncChannel {
141 self.client.as_channel()
142 }
143}
144
145impl ControllerProxy {
146 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
148 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
149 Self { client: fidl::client::Client::new(channel, protocol_name) }
150 }
151
152 pub fn take_event_stream(&self) -> ControllerEventStream {
158 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
159 }
160
161 pub fn r#suspend(
182 &self,
183 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
184 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
185 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
186 ControllerProxyInterface::r#suspend(self, peer_id, token)
187 }
188}
189
190impl ControllerProxyInterface for ControllerProxy {
191 type SuspendResponseFut =
192 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
193 fn r#suspend(
194 &self,
195 mut peer_id: Option<&fidl_fuchsia_bluetooth::PeerId>,
196 mut token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
197 ) -> Self::SuspendResponseFut {
198 fn _decode(
199 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
200 ) -> Result<(), fidl::Error> {
201 let _response = fidl::client::decode_transaction_body::<
202 fidl::encoding::EmptyPayload,
203 fidl::encoding::DefaultFuchsiaResourceDialect,
204 0xe68646aaf69cb61,
205 >(_buf?)?;
206 Ok(_response)
207 }
208 self.client.send_query_and_decode::<ControllerSuspendRequest, ()>(
209 (peer_id, token),
210 0xe68646aaf69cb61,
211 fidl::encoding::DynamicFlags::empty(),
212 _decode,
213 )
214 }
215}
216
217pub struct ControllerEventStream {
218 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
219}
220
221impl std::marker::Unpin for ControllerEventStream {}
222
223impl futures::stream::FusedStream for ControllerEventStream {
224 fn is_terminated(&self) -> bool {
225 self.event_receiver.is_terminated()
226 }
227}
228
229impl futures::Stream for ControllerEventStream {
230 type Item = Result<ControllerEvent, fidl::Error>;
231
232 fn poll_next(
233 mut self: std::pin::Pin<&mut Self>,
234 cx: &mut std::task::Context<'_>,
235 ) -> std::task::Poll<Option<Self::Item>> {
236 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
237 &mut self.event_receiver,
238 cx
239 )?) {
240 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
241 None => std::task::Poll::Ready(None),
242 }
243 }
244}
245
246#[derive(Debug)]
247pub enum ControllerEvent {}
248
249impl ControllerEvent {
250 fn decode(
252 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
253 ) -> Result<ControllerEvent, fidl::Error> {
254 let (bytes, _handles) = buf.split_mut();
255 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
256 debug_assert_eq!(tx_header.tx_id, 0);
257 match tx_header.ordinal {
258 _ => Err(fidl::Error::UnknownOrdinal {
259 ordinal: tx_header.ordinal,
260 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
261 }),
262 }
263 }
264}
265
266pub struct ControllerRequestStream {
268 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
269 is_terminated: bool,
270}
271
272impl std::marker::Unpin for ControllerRequestStream {}
273
274impl futures::stream::FusedStream for ControllerRequestStream {
275 fn is_terminated(&self) -> bool {
276 self.is_terminated
277 }
278}
279
280impl fidl::endpoints::RequestStream for ControllerRequestStream {
281 type Protocol = ControllerMarker;
282 type ControlHandle = ControllerControlHandle;
283
284 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
285 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
286 }
287
288 fn control_handle(&self) -> Self::ControlHandle {
289 ControllerControlHandle { inner: self.inner.clone() }
290 }
291
292 fn into_inner(
293 self,
294 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
295 {
296 (self.inner, self.is_terminated)
297 }
298
299 fn from_inner(
300 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
301 is_terminated: bool,
302 ) -> Self {
303 Self { inner, is_terminated }
304 }
305}
306
307impl futures::Stream for ControllerRequestStream {
308 type Item = Result<ControllerRequest, fidl::Error>;
309
310 fn poll_next(
311 mut self: std::pin::Pin<&mut Self>,
312 cx: &mut std::task::Context<'_>,
313 ) -> std::task::Poll<Option<Self::Item>> {
314 let this = &mut *self;
315 if this.inner.check_shutdown(cx) {
316 this.is_terminated = true;
317 return std::task::Poll::Ready(None);
318 }
319 if this.is_terminated {
320 panic!("polled ControllerRequestStream after completion");
321 }
322 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
323 |bytes, handles| {
324 match this.inner.channel().read_etc(cx, bytes, handles) {
325 std::task::Poll::Ready(Ok(())) => {}
326 std::task::Poll::Pending => return std::task::Poll::Pending,
327 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
328 this.is_terminated = true;
329 return std::task::Poll::Ready(None);
330 }
331 std::task::Poll::Ready(Err(e)) => {
332 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
333 e.into(),
334 ))))
335 }
336 }
337
338 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
340
341 std::task::Poll::Ready(Some(match header.ordinal {
342 0xe68646aaf69cb61 => {
343 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
344 let mut req = fidl::new_empty!(
345 ControllerSuspendRequest,
346 fidl::encoding::DefaultFuchsiaResourceDialect
347 );
348 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerSuspendRequest>(&header, _body_bytes, handles, &mut req)?;
349 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
350 Ok(ControllerRequest::Suspend {
351 peer_id: req.peer_id,
352 token: req.token,
353
354 responder: ControllerSuspendResponder {
355 control_handle: std::mem::ManuallyDrop::new(control_handle),
356 tx_id: header.tx_id,
357 },
358 })
359 }
360 _ => Err(fidl::Error::UnknownOrdinal {
361 ordinal: header.ordinal,
362 protocol_name:
363 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
364 }),
365 }))
366 },
367 )
368 }
369}
370
371#[derive(Debug)]
373pub enum ControllerRequest {
374 Suspend {
395 peer_id: Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
396 token: fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
397 responder: ControllerSuspendResponder,
398 },
399}
400
401impl ControllerRequest {
402 #[allow(irrefutable_let_patterns)]
403 pub fn into_suspend(
404 self,
405 ) -> Option<(
406 Option<Box<fidl_fuchsia_bluetooth::PeerId>>,
407 fidl::endpoints::ServerEnd<StreamSuspenderMarker>,
408 ControllerSuspendResponder,
409 )> {
410 if let ControllerRequest::Suspend { peer_id, token, responder } = self {
411 Some((peer_id, token, responder))
412 } else {
413 None
414 }
415 }
416
417 pub fn method_name(&self) -> &'static str {
419 match *self {
420 ControllerRequest::Suspend { .. } => "suspend",
421 }
422 }
423}
424
425#[derive(Debug, Clone)]
426pub struct ControllerControlHandle {
427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
428}
429
430impl fidl::endpoints::ControlHandle for ControllerControlHandle {
431 fn shutdown(&self) {
432 self.inner.shutdown()
433 }
434 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
435 self.inner.shutdown_with_epitaph(status)
436 }
437
438 fn is_closed(&self) -> bool {
439 self.inner.channel().is_closed()
440 }
441 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
442 self.inner.channel().on_closed()
443 }
444
445 #[cfg(target_os = "fuchsia")]
446 fn signal_peer(
447 &self,
448 clear_mask: zx::Signals,
449 set_mask: zx::Signals,
450 ) -> Result<(), zx_status::Status> {
451 use fidl::Peered;
452 self.inner.channel().signal_peer(clear_mask, set_mask)
453 }
454}
455
456impl ControllerControlHandle {}
457
458#[must_use = "FIDL methods require a response to be sent"]
459#[derive(Debug)]
460pub struct ControllerSuspendResponder {
461 control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
462 tx_id: u32,
463}
464
465impl std::ops::Drop for ControllerSuspendResponder {
469 fn drop(&mut self) {
470 self.control_handle.shutdown();
471 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
473 }
474}
475
476impl fidl::endpoints::Responder for ControllerSuspendResponder {
477 type ControlHandle = ControllerControlHandle;
478
479 fn control_handle(&self) -> &ControllerControlHandle {
480 &self.control_handle
481 }
482
483 fn drop_without_shutdown(mut self) {
484 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
486 std::mem::forget(self);
488 }
489}
490
491impl ControllerSuspendResponder {
492 pub fn send(self) -> Result<(), fidl::Error> {
496 let _result = self.send_raw();
497 if _result.is_err() {
498 self.control_handle.shutdown();
499 }
500 self.drop_without_shutdown();
501 _result
502 }
503
504 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
506 let _result = self.send_raw();
507 self.drop_without_shutdown();
508 _result
509 }
510
511 fn send_raw(&self) -> Result<(), fidl::Error> {
512 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
513 (),
514 self.tx_id,
515 0xe68646aaf69cb61,
516 fidl::encoding::DynamicFlags::empty(),
517 )
518 }
519}
520
521#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
522pub struct StreamSuspenderMarker;
523
524impl fidl::endpoints::ProtocolMarker for StreamSuspenderMarker {
525 type Proxy = StreamSuspenderProxy;
526 type RequestStream = StreamSuspenderRequestStream;
527 #[cfg(target_os = "fuchsia")]
528 type SynchronousProxy = StreamSuspenderSynchronousProxy;
529
530 const DEBUG_NAME: &'static str = "(anonymous) StreamSuspender";
531}
532
533pub trait StreamSuspenderProxyInterface: Send + Sync {}
534#[derive(Debug)]
535#[cfg(target_os = "fuchsia")]
536pub struct StreamSuspenderSynchronousProxy {
537 client: fidl::client::sync::Client,
538}
539
540#[cfg(target_os = "fuchsia")]
541impl fidl::endpoints::SynchronousProxy for StreamSuspenderSynchronousProxy {
542 type Proxy = StreamSuspenderProxy;
543 type Protocol = StreamSuspenderMarker;
544
545 fn from_channel(inner: fidl::Channel) -> Self {
546 Self::new(inner)
547 }
548
549 fn into_channel(self) -> fidl::Channel {
550 self.client.into_channel()
551 }
552
553 fn as_channel(&self) -> &fidl::Channel {
554 self.client.as_channel()
555 }
556}
557
558#[cfg(target_os = "fuchsia")]
559impl StreamSuspenderSynchronousProxy {
560 pub fn new(channel: fidl::Channel) -> Self {
561 let protocol_name = <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
562 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
563 }
564
565 pub fn into_channel(self) -> fidl::Channel {
566 self.client.into_channel()
567 }
568
569 pub fn wait_for_event(
572 &self,
573 deadline: zx::MonotonicInstant,
574 ) -> Result<StreamSuspenderEvent, fidl::Error> {
575 StreamSuspenderEvent::decode(self.client.wait_for_event(deadline)?)
576 }
577}
578
579#[derive(Debug, Clone)]
580pub struct StreamSuspenderProxy {
581 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
582}
583
584impl fidl::endpoints::Proxy for StreamSuspenderProxy {
585 type Protocol = StreamSuspenderMarker;
586
587 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
588 Self::new(inner)
589 }
590
591 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
592 self.client.into_channel().map_err(|client| Self { client })
593 }
594
595 fn as_channel(&self) -> &::fidl::AsyncChannel {
596 self.client.as_channel()
597 }
598}
599
600impl StreamSuspenderProxy {
601 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
603 let protocol_name = <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
604 Self { client: fidl::client::Client::new(channel, protocol_name) }
605 }
606
607 pub fn take_event_stream(&self) -> StreamSuspenderEventStream {
613 StreamSuspenderEventStream { event_receiver: self.client.take_event_receiver() }
614 }
615}
616
617impl StreamSuspenderProxyInterface for StreamSuspenderProxy {}
618
619pub struct StreamSuspenderEventStream {
620 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
621}
622
623impl std::marker::Unpin for StreamSuspenderEventStream {}
624
625impl futures::stream::FusedStream for StreamSuspenderEventStream {
626 fn is_terminated(&self) -> bool {
627 self.event_receiver.is_terminated()
628 }
629}
630
631impl futures::Stream for StreamSuspenderEventStream {
632 type Item = Result<StreamSuspenderEvent, fidl::Error>;
633
634 fn poll_next(
635 mut self: std::pin::Pin<&mut Self>,
636 cx: &mut std::task::Context<'_>,
637 ) -> std::task::Poll<Option<Self::Item>> {
638 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
639 &mut self.event_receiver,
640 cx
641 )?) {
642 Some(buf) => std::task::Poll::Ready(Some(StreamSuspenderEvent::decode(buf))),
643 None => std::task::Poll::Ready(None),
644 }
645 }
646}
647
648#[derive(Debug)]
649pub enum StreamSuspenderEvent {
650 OnSuspended {},
651}
652
653impl StreamSuspenderEvent {
654 #[allow(irrefutable_let_patterns)]
655 pub fn into_on_suspended(self) -> Option<()> {
656 if let StreamSuspenderEvent::OnSuspended {} = self {
657 Some(())
658 } else {
659 None
660 }
661 }
662
663 fn decode(
665 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
666 ) -> Result<StreamSuspenderEvent, fidl::Error> {
667 let (bytes, _handles) = buf.split_mut();
668 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
669 debug_assert_eq!(tx_header.tx_id, 0);
670 match tx_header.ordinal {
671 0x3f927abc531cba34 => {
672 let mut out = fidl::new_empty!(
673 fidl::encoding::EmptyPayload,
674 fidl::encoding::DefaultFuchsiaResourceDialect
675 );
676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
677 Ok((StreamSuspenderEvent::OnSuspended {}))
678 }
679 _ => Err(fidl::Error::UnknownOrdinal {
680 ordinal: tx_header.ordinal,
681 protocol_name:
682 <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
683 }),
684 }
685 }
686}
687
688pub struct StreamSuspenderRequestStream {
690 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
691 is_terminated: bool,
692}
693
694impl std::marker::Unpin for StreamSuspenderRequestStream {}
695
696impl futures::stream::FusedStream for StreamSuspenderRequestStream {
697 fn is_terminated(&self) -> bool {
698 self.is_terminated
699 }
700}
701
702impl fidl::endpoints::RequestStream for StreamSuspenderRequestStream {
703 type Protocol = StreamSuspenderMarker;
704 type ControlHandle = StreamSuspenderControlHandle;
705
706 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
707 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
708 }
709
710 fn control_handle(&self) -> Self::ControlHandle {
711 StreamSuspenderControlHandle { inner: self.inner.clone() }
712 }
713
714 fn into_inner(
715 self,
716 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
717 {
718 (self.inner, self.is_terminated)
719 }
720
721 fn from_inner(
722 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
723 is_terminated: bool,
724 ) -> Self {
725 Self { inner, is_terminated }
726 }
727}
728
729impl futures::Stream for StreamSuspenderRequestStream {
730 type Item = Result<StreamSuspenderRequest, fidl::Error>;
731
732 fn poll_next(
733 mut self: std::pin::Pin<&mut Self>,
734 cx: &mut std::task::Context<'_>,
735 ) -> std::task::Poll<Option<Self::Item>> {
736 let this = &mut *self;
737 if this.inner.check_shutdown(cx) {
738 this.is_terminated = true;
739 return std::task::Poll::Ready(None);
740 }
741 if this.is_terminated {
742 panic!("polled StreamSuspenderRequestStream after completion");
743 }
744 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
745 |bytes, handles| {
746 match this.inner.channel().read_etc(cx, bytes, handles) {
747 std::task::Poll::Ready(Ok(())) => {}
748 std::task::Poll::Pending => return std::task::Poll::Pending,
749 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
750 this.is_terminated = true;
751 return std::task::Poll::Ready(None);
752 }
753 std::task::Poll::Ready(Err(e)) => {
754 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
755 e.into(),
756 ))))
757 }
758 }
759
760 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
762
763 std::task::Poll::Ready(Some(match header.ordinal {
764 _ => Err(fidl::Error::UnknownOrdinal {
765 ordinal: header.ordinal,
766 protocol_name:
767 <StreamSuspenderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
768 }),
769 }))
770 },
771 )
772 }
773}
774
775#[derive(Debug)]
777pub enum StreamSuspenderRequest {}
778
779impl StreamSuspenderRequest {
780 pub fn method_name(&self) -> &'static str {
782 match *self {}
783 }
784}
785
786#[derive(Debug, Clone)]
787pub struct StreamSuspenderControlHandle {
788 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
789}
790
791impl fidl::endpoints::ControlHandle for StreamSuspenderControlHandle {
792 fn shutdown(&self) {
793 self.inner.shutdown()
794 }
795 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
796 self.inner.shutdown_with_epitaph(status)
797 }
798
799 fn is_closed(&self) -> bool {
800 self.inner.channel().is_closed()
801 }
802 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
803 self.inner.channel().on_closed()
804 }
805
806 #[cfg(target_os = "fuchsia")]
807 fn signal_peer(
808 &self,
809 clear_mask: zx::Signals,
810 set_mask: zx::Signals,
811 ) -> Result<(), zx_status::Status> {
812 use fidl::Peered;
813 self.inner.channel().signal_peer(clear_mask, set_mask)
814 }
815}
816
817impl StreamSuspenderControlHandle {
818 pub fn send_on_suspended(&self) -> Result<(), fidl::Error> {
819 self.inner.send::<fidl::encoding::EmptyPayload>(
820 (),
821 0,
822 0x3f927abc531cba34,
823 fidl::encoding::DynamicFlags::empty(),
824 )
825 }
826}
827
828mod internal {
829 use super::*;
830
831 impl fidl::encoding::ResourceTypeMarker for ControllerSuspendRequest {
832 type Borrowed<'a> = &'a mut Self;
833 fn take_or_borrow<'a>(
834 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
835 ) -> Self::Borrowed<'a> {
836 value
837 }
838 }
839
840 unsafe impl fidl::encoding::TypeMarker for ControllerSuspendRequest {
841 type Owned = Self;
842
843 #[inline(always)]
844 fn inline_align(_context: fidl::encoding::Context) -> usize {
845 8
846 }
847
848 #[inline(always)]
849 fn inline_size(_context: fidl::encoding::Context) -> usize {
850 16
851 }
852 }
853
854 unsafe impl
855 fidl::encoding::Encode<
856 ControllerSuspendRequest,
857 fidl::encoding::DefaultFuchsiaResourceDialect,
858 > for &mut ControllerSuspendRequest
859 {
860 #[inline]
861 unsafe fn encode(
862 self,
863 encoder: &mut fidl::encoding::Encoder<
864 '_,
865 fidl::encoding::DefaultFuchsiaResourceDialect,
866 >,
867 offset: usize,
868 _depth: fidl::encoding::Depth,
869 ) -> fidl::Result<()> {
870 encoder.debug_check_bounds::<ControllerSuspendRequest>(offset);
871 fidl::encoding::Encode::<ControllerSuspendRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
873 (
874 <fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
875 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
876 ),
877 encoder, offset, _depth
878 )
879 }
880 }
881 unsafe impl<
882 T0: fidl::encoding::Encode<
883 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
884 fidl::encoding::DefaultFuchsiaResourceDialect,
885 >,
886 T1: fidl::encoding::Encode<
887 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
888 fidl::encoding::DefaultFuchsiaResourceDialect,
889 >,
890 >
891 fidl::encoding::Encode<
892 ControllerSuspendRequest,
893 fidl::encoding::DefaultFuchsiaResourceDialect,
894 > for (T0, T1)
895 {
896 #[inline]
897 unsafe fn encode(
898 self,
899 encoder: &mut fidl::encoding::Encoder<
900 '_,
901 fidl::encoding::DefaultFuchsiaResourceDialect,
902 >,
903 offset: usize,
904 depth: fidl::encoding::Depth,
905 ) -> fidl::Result<()> {
906 encoder.debug_check_bounds::<ControllerSuspendRequest>(offset);
907 unsafe {
910 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
911 (ptr as *mut u64).write_unaligned(0);
912 }
913 self.0.encode(encoder, offset + 0, depth)?;
915 self.1.encode(encoder, offset + 8, depth)?;
916 Ok(())
917 }
918 }
919
920 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
921 for ControllerSuspendRequest
922 {
923 #[inline(always)]
924 fn new_empty() -> Self {
925 Self {
926 peer_id: fidl::new_empty!(
927 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
928 fidl::encoding::DefaultFuchsiaResourceDialect
929 ),
930 token: fidl::new_empty!(
931 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
932 fidl::encoding::DefaultFuchsiaResourceDialect
933 ),
934 }
935 }
936
937 #[inline]
938 unsafe fn decode(
939 &mut self,
940 decoder: &mut fidl::encoding::Decoder<
941 '_,
942 fidl::encoding::DefaultFuchsiaResourceDialect,
943 >,
944 offset: usize,
945 _depth: fidl::encoding::Depth,
946 ) -> fidl::Result<()> {
947 decoder.debug_check_bounds::<Self>(offset);
948 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
950 let padval = unsafe { (ptr as *const u64).read_unaligned() };
951 let mask = 0xffffffff00000000u64;
952 let maskedval = padval & mask;
953 if maskedval != 0 {
954 return Err(fidl::Error::NonZeroPadding {
955 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
956 });
957 }
958 fidl::decode!(
959 fidl::encoding::Boxed<fidl_fuchsia_bluetooth::PeerId>,
960 fidl::encoding::DefaultFuchsiaResourceDialect,
961 &mut self.peer_id,
962 decoder,
963 offset + 0,
964 _depth
965 )?;
966 fidl::decode!(
967 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamSuspenderMarker>>,
968 fidl::encoding::DefaultFuchsiaResourceDialect,
969 &mut self.token,
970 decoder,
971 offset + 8,
972 _depth
973 )?;
974 Ok(())
975 }
976 }
977}