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_le__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AdvertisedPeripheralOnConnectedRequest {
16 pub peer: Peer,
17 pub connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for AdvertisedPeripheralOnConnectedRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct CentralConnectPeripheralRequest {
27 pub identifier: String,
28 pub options: ConnectionOptions,
29 pub gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for CentralConnectPeripheralRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct CentralConnectRequest {
39 pub id: fidl_fuchsia_bluetooth::PeerId,
40 pub options: ConnectionOptions,
41 pub handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CentralConnectRequest {}
45
46#[derive(Debug, PartialEq)]
47pub struct CentralScanRequest {
48 pub options: ScanOptions,
49 pub result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CentralScanRequest {}
53
54#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct ChannelListenerAcceptRequest {
56 pub channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60 for ChannelListenerAcceptRequest
61{
62}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct ConnectionRequestGattClientRequest {
66 pub client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70 for ConnectionRequestGattClientRequest
71{
72}
73
74#[derive(Debug, PartialEq)]
75pub struct PeripheralAdvertiseRequest {
76 pub parameters: AdvertisingParameters,
77 pub advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
81 for PeripheralAdvertiseRequest
82{
83}
84
85#[derive(Debug, PartialEq)]
86pub struct PeripheralOnPeerConnectedRequest {
87 pub peer: Peer,
88 pub connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92 for PeripheralOnPeerConnectedRequest
93{
94}
95
96#[derive(Debug, PartialEq)]
97pub struct PeripheralStartAdvertisingRequest {
98 pub parameters: AdvertisingParameters,
99 pub handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103 for PeripheralStartAdvertisingRequest
104{
105}
106
107#[derive(Debug, Default, PartialEq)]
108pub struct CentralCreateConnectedIsochronousGroupRequest {
109 pub cig_parameters: Option<CigParameters>,
111 pub cis_requested_parameters: Option<Vec<CisRequestedParameters>>,
113 pub cig: Option<fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>>,
115 #[doc(hidden)]
116 pub __source_breaking: fidl::marker::SourceBreaking,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
120 for CentralCreateConnectedIsochronousGroupRequest
121{
122}
123
124#[derive(Debug, Default, PartialEq)]
125pub struct ChannelListenerRegistryListenL2capRequest {
126 pub parameters: Option<AcceptedChannelParameters>,
128 pub listener: Option<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
130 #[doc(hidden)]
131 pub __source_breaking: fidl::marker::SourceBreaking,
132}
133
134impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
135 for ChannelListenerRegistryListenL2capRequest
136{
137}
138
139#[derive(Debug, Default, PartialEq)]
140pub struct CisRequestedParameters {
141 pub cis_id: Option<u8>,
145 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
148 pub max_sdu_size_outgoing: Option<u16>,
153 pub max_sdu_size_incoming: Option<u16>,
158 #[doc(hidden)]
159 pub __source_breaking: fidl::marker::SourceBreaking,
160}
161
162impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CisRequestedParameters {}
163
164#[derive(Debug, Default, PartialEq)]
165pub struct ConnectionAcceptCisRequest {
166 pub cig_id: Option<u8>,
168 pub cis_id: Option<u8>,
170 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
177 #[doc(hidden)]
178 pub __source_breaking: fidl::marker::SourceBreaking,
179}
180
181impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
182 for ConnectionAcceptCisRequest
183{
184}
185
186#[derive(Debug, Default, PartialEq)]
187pub struct ConnectionConnectL2capRequest {
188 pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
190 pub channel: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
192 pub psm: Option<u16>,
194 #[doc(hidden)]
195 pub __source_breaking: fidl::marker::SourceBreaking,
196}
197
198impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
199 for ConnectionConnectL2capRequest
200{
201}
202
203#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
204pub struct AdvertisedPeripheralMarker;
205
206impl fidl::endpoints::ProtocolMarker for AdvertisedPeripheralMarker {
207 type Proxy = AdvertisedPeripheralProxy;
208 type RequestStream = AdvertisedPeripheralRequestStream;
209 #[cfg(target_os = "fuchsia")]
210 type SynchronousProxy = AdvertisedPeripheralSynchronousProxy;
211
212 const DEBUG_NAME: &'static str = "(anonymous) AdvertisedPeripheral";
213}
214
215pub trait AdvertisedPeripheralProxyInterface: Send + Sync {
216 type OnConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
217 fn r#on_connected(
218 &self,
219 peer: &Peer,
220 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
221 ) -> Self::OnConnectedResponseFut;
222}
223#[derive(Debug)]
224#[cfg(target_os = "fuchsia")]
225pub struct AdvertisedPeripheralSynchronousProxy {
226 client: fidl::client::sync::Client,
227}
228
229#[cfg(target_os = "fuchsia")]
230impl fidl::endpoints::SynchronousProxy for AdvertisedPeripheralSynchronousProxy {
231 type Proxy = AdvertisedPeripheralProxy;
232 type Protocol = AdvertisedPeripheralMarker;
233
234 fn from_channel(inner: fidl::Channel) -> Self {
235 Self::new(inner)
236 }
237
238 fn into_channel(self) -> fidl::Channel {
239 self.client.into_channel()
240 }
241
242 fn as_channel(&self) -> &fidl::Channel {
243 self.client.as_channel()
244 }
245}
246
247#[cfg(target_os = "fuchsia")]
248impl AdvertisedPeripheralSynchronousProxy {
249 pub fn new(channel: fidl::Channel) -> Self {
250 let protocol_name =
251 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
252 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
253 }
254
255 pub fn into_channel(self) -> fidl::Channel {
256 self.client.into_channel()
257 }
258
259 pub fn wait_for_event(
262 &self,
263 deadline: zx::MonotonicInstant,
264 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
265 AdvertisedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
266 }
267
268 pub fn r#on_connected(
286 &self,
287 mut peer: &Peer,
288 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
289 ___deadline: zx::MonotonicInstant,
290 ) -> Result<(), fidl::Error> {
291 let _response = self
292 .client
293 .send_query::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::EmptyPayload>(
294 (peer, connection),
295 0x607b7716457eb178,
296 fidl::encoding::DynamicFlags::empty(),
297 ___deadline,
298 )?;
299 Ok(_response)
300 }
301}
302
303#[cfg(target_os = "fuchsia")]
304impl From<AdvertisedPeripheralSynchronousProxy> for zx::Handle {
305 fn from(value: AdvertisedPeripheralSynchronousProxy) -> Self {
306 value.into_channel().into()
307 }
308}
309
310#[cfg(target_os = "fuchsia")]
311impl From<fidl::Channel> for AdvertisedPeripheralSynchronousProxy {
312 fn from(value: fidl::Channel) -> Self {
313 Self::new(value)
314 }
315}
316
317#[cfg(target_os = "fuchsia")]
318impl fidl::endpoints::FromClient for AdvertisedPeripheralSynchronousProxy {
319 type Protocol = AdvertisedPeripheralMarker;
320
321 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>) -> Self {
322 Self::new(value.into_channel())
323 }
324}
325
326#[derive(Debug, Clone)]
327pub struct AdvertisedPeripheralProxy {
328 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
329}
330
331impl fidl::endpoints::Proxy for AdvertisedPeripheralProxy {
332 type Protocol = AdvertisedPeripheralMarker;
333
334 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
335 Self::new(inner)
336 }
337
338 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
339 self.client.into_channel().map_err(|client| Self { client })
340 }
341
342 fn as_channel(&self) -> &::fidl::AsyncChannel {
343 self.client.as_channel()
344 }
345}
346
347impl AdvertisedPeripheralProxy {
348 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
350 let protocol_name =
351 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
352 Self { client: fidl::client::Client::new(channel, protocol_name) }
353 }
354
355 pub fn take_event_stream(&self) -> AdvertisedPeripheralEventStream {
361 AdvertisedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
362 }
363
364 pub fn r#on_connected(
382 &self,
383 mut peer: &Peer,
384 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
385 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
386 AdvertisedPeripheralProxyInterface::r#on_connected(self, peer, connection)
387 }
388}
389
390impl AdvertisedPeripheralProxyInterface for AdvertisedPeripheralProxy {
391 type OnConnectedResponseFut =
392 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
393 fn r#on_connected(
394 &self,
395 mut peer: &Peer,
396 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
397 ) -> Self::OnConnectedResponseFut {
398 fn _decode(
399 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
400 ) -> Result<(), fidl::Error> {
401 let _response = fidl::client::decode_transaction_body::<
402 fidl::encoding::EmptyPayload,
403 fidl::encoding::DefaultFuchsiaResourceDialect,
404 0x607b7716457eb178,
405 >(_buf?)?;
406 Ok(_response)
407 }
408 self.client.send_query_and_decode::<AdvertisedPeripheralOnConnectedRequest, ()>(
409 (peer, connection),
410 0x607b7716457eb178,
411 fidl::encoding::DynamicFlags::empty(),
412 _decode,
413 )
414 }
415}
416
417pub struct AdvertisedPeripheralEventStream {
418 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
419}
420
421impl std::marker::Unpin for AdvertisedPeripheralEventStream {}
422
423impl futures::stream::FusedStream for AdvertisedPeripheralEventStream {
424 fn is_terminated(&self) -> bool {
425 self.event_receiver.is_terminated()
426 }
427}
428
429impl futures::Stream for AdvertisedPeripheralEventStream {
430 type Item = Result<AdvertisedPeripheralEvent, fidl::Error>;
431
432 fn poll_next(
433 mut self: std::pin::Pin<&mut Self>,
434 cx: &mut std::task::Context<'_>,
435 ) -> std::task::Poll<Option<Self::Item>> {
436 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
437 &mut self.event_receiver,
438 cx
439 )?) {
440 Some(buf) => std::task::Poll::Ready(Some(AdvertisedPeripheralEvent::decode(buf))),
441 None => std::task::Poll::Ready(None),
442 }
443 }
444}
445
446#[derive(Debug)]
447pub enum AdvertisedPeripheralEvent {}
448
449impl AdvertisedPeripheralEvent {
450 fn decode(
452 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
453 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
454 let (bytes, _handles) = buf.split_mut();
455 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
456 debug_assert_eq!(tx_header.tx_id, 0);
457 match tx_header.ordinal {
458 _ => Err(fidl::Error::UnknownOrdinal {
459 ordinal: tx_header.ordinal,
460 protocol_name:
461 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
462 }),
463 }
464 }
465}
466
467pub struct AdvertisedPeripheralRequestStream {
469 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
470 is_terminated: bool,
471}
472
473impl std::marker::Unpin for AdvertisedPeripheralRequestStream {}
474
475impl futures::stream::FusedStream for AdvertisedPeripheralRequestStream {
476 fn is_terminated(&self) -> bool {
477 self.is_terminated
478 }
479}
480
481impl fidl::endpoints::RequestStream for AdvertisedPeripheralRequestStream {
482 type Protocol = AdvertisedPeripheralMarker;
483 type ControlHandle = AdvertisedPeripheralControlHandle;
484
485 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
486 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
487 }
488
489 fn control_handle(&self) -> Self::ControlHandle {
490 AdvertisedPeripheralControlHandle { inner: self.inner.clone() }
491 }
492
493 fn into_inner(
494 self,
495 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
496 {
497 (self.inner, self.is_terminated)
498 }
499
500 fn from_inner(
501 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
502 is_terminated: bool,
503 ) -> Self {
504 Self { inner, is_terminated }
505 }
506}
507
508impl futures::Stream for AdvertisedPeripheralRequestStream {
509 type Item = Result<AdvertisedPeripheralRequest, fidl::Error>;
510
511 fn poll_next(
512 mut self: std::pin::Pin<&mut Self>,
513 cx: &mut std::task::Context<'_>,
514 ) -> std::task::Poll<Option<Self::Item>> {
515 let this = &mut *self;
516 if this.inner.check_shutdown(cx) {
517 this.is_terminated = true;
518 return std::task::Poll::Ready(None);
519 }
520 if this.is_terminated {
521 panic!("polled AdvertisedPeripheralRequestStream after completion");
522 }
523 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
524 |bytes, handles| {
525 match this.inner.channel().read_etc(cx, bytes, handles) {
526 std::task::Poll::Ready(Ok(())) => {}
527 std::task::Poll::Pending => return std::task::Poll::Pending,
528 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
529 this.is_terminated = true;
530 return std::task::Poll::Ready(None);
531 }
532 std::task::Poll::Ready(Err(e)) => {
533 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
534 e.into(),
535 ))))
536 }
537 }
538
539 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
541
542 std::task::Poll::Ready(Some(match header.ordinal {
543 0x607b7716457eb178 => {
544 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
545 let mut req = fidl::new_empty!(AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
546 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdvertisedPeripheralOnConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
547 let control_handle = AdvertisedPeripheralControlHandle {
548 inner: this.inner.clone(),
549 };
550 Ok(AdvertisedPeripheralRequest::OnConnected {peer: req.peer,
551connection: req.connection,
552
553 responder: AdvertisedPeripheralOnConnectedResponder {
554 control_handle: std::mem::ManuallyDrop::new(control_handle),
555 tx_id: header.tx_id,
556 },
557 })
558 }
559 _ => Err(fidl::Error::UnknownOrdinal {
560 ordinal: header.ordinal,
561 protocol_name: <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
562 }),
563 }))
564 },
565 )
566 }
567}
568
569#[derive(Debug)]
574pub enum AdvertisedPeripheralRequest {
575 OnConnected {
593 peer: Peer,
594 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
595 responder: AdvertisedPeripheralOnConnectedResponder,
596 },
597}
598
599impl AdvertisedPeripheralRequest {
600 #[allow(irrefutable_let_patterns)]
601 pub fn into_on_connected(
602 self,
603 ) -> Option<(
604 Peer,
605 fidl::endpoints::ClientEnd<ConnectionMarker>,
606 AdvertisedPeripheralOnConnectedResponder,
607 )> {
608 if let AdvertisedPeripheralRequest::OnConnected { peer, connection, responder } = self {
609 Some((peer, connection, responder))
610 } else {
611 None
612 }
613 }
614
615 pub fn method_name(&self) -> &'static str {
617 match *self {
618 AdvertisedPeripheralRequest::OnConnected { .. } => "on_connected",
619 }
620 }
621}
622
623#[derive(Debug, Clone)]
624pub struct AdvertisedPeripheralControlHandle {
625 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
626}
627
628impl fidl::endpoints::ControlHandle for AdvertisedPeripheralControlHandle {
629 fn shutdown(&self) {
630 self.inner.shutdown()
631 }
632 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
633 self.inner.shutdown_with_epitaph(status)
634 }
635
636 fn is_closed(&self) -> bool {
637 self.inner.channel().is_closed()
638 }
639 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
640 self.inner.channel().on_closed()
641 }
642
643 #[cfg(target_os = "fuchsia")]
644 fn signal_peer(
645 &self,
646 clear_mask: zx::Signals,
647 set_mask: zx::Signals,
648 ) -> Result<(), zx_status::Status> {
649 use fidl::Peered;
650 self.inner.channel().signal_peer(clear_mask, set_mask)
651 }
652}
653
654impl AdvertisedPeripheralControlHandle {}
655
656#[must_use = "FIDL methods require a response to be sent"]
657#[derive(Debug)]
658pub struct AdvertisedPeripheralOnConnectedResponder {
659 control_handle: std::mem::ManuallyDrop<AdvertisedPeripheralControlHandle>,
660 tx_id: u32,
661}
662
663impl std::ops::Drop for AdvertisedPeripheralOnConnectedResponder {
667 fn drop(&mut self) {
668 self.control_handle.shutdown();
669 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
671 }
672}
673
674impl fidl::endpoints::Responder for AdvertisedPeripheralOnConnectedResponder {
675 type ControlHandle = AdvertisedPeripheralControlHandle;
676
677 fn control_handle(&self) -> &AdvertisedPeripheralControlHandle {
678 &self.control_handle
679 }
680
681 fn drop_without_shutdown(mut self) {
682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
684 std::mem::forget(self);
686 }
687}
688
689impl AdvertisedPeripheralOnConnectedResponder {
690 pub fn send(self) -> Result<(), fidl::Error> {
694 let _result = self.send_raw();
695 if _result.is_err() {
696 self.control_handle.shutdown();
697 }
698 self.drop_without_shutdown();
699 _result
700 }
701
702 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
704 let _result = self.send_raw();
705 self.drop_without_shutdown();
706 _result
707 }
708
709 fn send_raw(&self) -> Result<(), fidl::Error> {
710 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
711 (),
712 self.tx_id,
713 0x607b7716457eb178,
714 fidl::encoding::DynamicFlags::empty(),
715 )
716 }
717}
718
719#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
720pub struct AdvertisingHandleMarker;
721
722impl fidl::endpoints::ProtocolMarker for AdvertisingHandleMarker {
723 type Proxy = AdvertisingHandleProxy;
724 type RequestStream = AdvertisingHandleRequestStream;
725 #[cfg(target_os = "fuchsia")]
726 type SynchronousProxy = AdvertisingHandleSynchronousProxy;
727
728 const DEBUG_NAME: &'static str = "(anonymous) AdvertisingHandle";
729}
730
731pub trait AdvertisingHandleProxyInterface: Send + Sync {}
732#[derive(Debug)]
733#[cfg(target_os = "fuchsia")]
734pub struct AdvertisingHandleSynchronousProxy {
735 client: fidl::client::sync::Client,
736}
737
738#[cfg(target_os = "fuchsia")]
739impl fidl::endpoints::SynchronousProxy for AdvertisingHandleSynchronousProxy {
740 type Proxy = AdvertisingHandleProxy;
741 type Protocol = AdvertisingHandleMarker;
742
743 fn from_channel(inner: fidl::Channel) -> Self {
744 Self::new(inner)
745 }
746
747 fn into_channel(self) -> fidl::Channel {
748 self.client.into_channel()
749 }
750
751 fn as_channel(&self) -> &fidl::Channel {
752 self.client.as_channel()
753 }
754}
755
756#[cfg(target_os = "fuchsia")]
757impl AdvertisingHandleSynchronousProxy {
758 pub fn new(channel: fidl::Channel) -> Self {
759 let protocol_name =
760 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
761 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
762 }
763
764 pub fn into_channel(self) -> fidl::Channel {
765 self.client.into_channel()
766 }
767
768 pub fn wait_for_event(
771 &self,
772 deadline: zx::MonotonicInstant,
773 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
774 AdvertisingHandleEvent::decode(self.client.wait_for_event(deadline)?)
775 }
776}
777
778#[cfg(target_os = "fuchsia")]
779impl From<AdvertisingHandleSynchronousProxy> for zx::Handle {
780 fn from(value: AdvertisingHandleSynchronousProxy) -> Self {
781 value.into_channel().into()
782 }
783}
784
785#[cfg(target_os = "fuchsia")]
786impl From<fidl::Channel> for AdvertisingHandleSynchronousProxy {
787 fn from(value: fidl::Channel) -> Self {
788 Self::new(value)
789 }
790}
791
792#[cfg(target_os = "fuchsia")]
793impl fidl::endpoints::FromClient for AdvertisingHandleSynchronousProxy {
794 type Protocol = AdvertisingHandleMarker;
795
796 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisingHandleMarker>) -> Self {
797 Self::new(value.into_channel())
798 }
799}
800
801#[derive(Debug, Clone)]
802pub struct AdvertisingHandleProxy {
803 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
804}
805
806impl fidl::endpoints::Proxy for AdvertisingHandleProxy {
807 type Protocol = AdvertisingHandleMarker;
808
809 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
810 Self::new(inner)
811 }
812
813 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
814 self.client.into_channel().map_err(|client| Self { client })
815 }
816
817 fn as_channel(&self) -> &::fidl::AsyncChannel {
818 self.client.as_channel()
819 }
820}
821
822impl AdvertisingHandleProxy {
823 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
825 let protocol_name =
826 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
827 Self { client: fidl::client::Client::new(channel, protocol_name) }
828 }
829
830 pub fn take_event_stream(&self) -> AdvertisingHandleEventStream {
836 AdvertisingHandleEventStream { event_receiver: self.client.take_event_receiver() }
837 }
838}
839
840impl AdvertisingHandleProxyInterface for AdvertisingHandleProxy {}
841
842pub struct AdvertisingHandleEventStream {
843 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
844}
845
846impl std::marker::Unpin for AdvertisingHandleEventStream {}
847
848impl futures::stream::FusedStream for AdvertisingHandleEventStream {
849 fn is_terminated(&self) -> bool {
850 self.event_receiver.is_terminated()
851 }
852}
853
854impl futures::Stream for AdvertisingHandleEventStream {
855 type Item = Result<AdvertisingHandleEvent, fidl::Error>;
856
857 fn poll_next(
858 mut self: std::pin::Pin<&mut Self>,
859 cx: &mut std::task::Context<'_>,
860 ) -> std::task::Poll<Option<Self::Item>> {
861 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
862 &mut self.event_receiver,
863 cx
864 )?) {
865 Some(buf) => std::task::Poll::Ready(Some(AdvertisingHandleEvent::decode(buf))),
866 None => std::task::Poll::Ready(None),
867 }
868 }
869}
870
871#[derive(Debug)]
872pub enum AdvertisingHandleEvent {}
873
874impl AdvertisingHandleEvent {
875 fn decode(
877 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
878 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
879 let (bytes, _handles) = buf.split_mut();
880 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
881 debug_assert_eq!(tx_header.tx_id, 0);
882 match tx_header.ordinal {
883 _ => Err(fidl::Error::UnknownOrdinal {
884 ordinal: tx_header.ordinal,
885 protocol_name:
886 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
887 }),
888 }
889 }
890}
891
892pub struct AdvertisingHandleRequestStream {
894 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
895 is_terminated: bool,
896}
897
898impl std::marker::Unpin for AdvertisingHandleRequestStream {}
899
900impl futures::stream::FusedStream for AdvertisingHandleRequestStream {
901 fn is_terminated(&self) -> bool {
902 self.is_terminated
903 }
904}
905
906impl fidl::endpoints::RequestStream for AdvertisingHandleRequestStream {
907 type Protocol = AdvertisingHandleMarker;
908 type ControlHandle = AdvertisingHandleControlHandle;
909
910 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
911 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
912 }
913
914 fn control_handle(&self) -> Self::ControlHandle {
915 AdvertisingHandleControlHandle { inner: self.inner.clone() }
916 }
917
918 fn into_inner(
919 self,
920 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
921 {
922 (self.inner, self.is_terminated)
923 }
924
925 fn from_inner(
926 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
927 is_terminated: bool,
928 ) -> Self {
929 Self { inner, is_terminated }
930 }
931}
932
933impl futures::Stream for AdvertisingHandleRequestStream {
934 type Item = Result<AdvertisingHandleRequest, fidl::Error>;
935
936 fn poll_next(
937 mut self: std::pin::Pin<&mut Self>,
938 cx: &mut std::task::Context<'_>,
939 ) -> std::task::Poll<Option<Self::Item>> {
940 let this = &mut *self;
941 if this.inner.check_shutdown(cx) {
942 this.is_terminated = true;
943 return std::task::Poll::Ready(None);
944 }
945 if this.is_terminated {
946 panic!("polled AdvertisingHandleRequestStream after completion");
947 }
948 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
949 |bytes, handles| {
950 match this.inner.channel().read_etc(cx, bytes, handles) {
951 std::task::Poll::Ready(Ok(())) => {}
952 std::task::Poll::Pending => return std::task::Poll::Pending,
953 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
954 this.is_terminated = true;
955 return std::task::Poll::Ready(None);
956 }
957 std::task::Poll::Ready(Err(e)) => {
958 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
959 e.into(),
960 ))))
961 }
962 }
963
964 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
966
967 std::task::Poll::Ready(Some(match header.ordinal {
968 _ => Err(fidl::Error::UnknownOrdinal {
969 ordinal: header.ordinal,
970 protocol_name:
971 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
972 }),
973 }))
974 },
975 )
976 }
977}
978
979#[derive(Debug)]
983pub enum AdvertisingHandleRequest {}
984
985impl AdvertisingHandleRequest {
986 pub fn method_name(&self) -> &'static str {
988 match *self {}
989 }
990}
991
992#[derive(Debug, Clone)]
993pub struct AdvertisingHandleControlHandle {
994 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
995}
996
997impl fidl::endpoints::ControlHandle for AdvertisingHandleControlHandle {
998 fn shutdown(&self) {
999 self.inner.shutdown()
1000 }
1001 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1002 self.inner.shutdown_with_epitaph(status)
1003 }
1004
1005 fn is_closed(&self) -> bool {
1006 self.inner.channel().is_closed()
1007 }
1008 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1009 self.inner.channel().on_closed()
1010 }
1011
1012 #[cfg(target_os = "fuchsia")]
1013 fn signal_peer(
1014 &self,
1015 clear_mask: zx::Signals,
1016 set_mask: zx::Signals,
1017 ) -> Result<(), zx_status::Status> {
1018 use fidl::Peered;
1019 self.inner.channel().signal_peer(clear_mask, set_mask)
1020 }
1021}
1022
1023impl AdvertisingHandleControlHandle {}
1024
1025#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1026pub struct CentralMarker;
1027
1028impl fidl::endpoints::ProtocolMarker for CentralMarker {
1029 type Proxy = CentralProxy;
1030 type RequestStream = CentralRequestStream;
1031 #[cfg(target_os = "fuchsia")]
1032 type SynchronousProxy = CentralSynchronousProxy;
1033
1034 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Central";
1035}
1036impl fidl::endpoints::DiscoverableProtocolMarker for CentralMarker {}
1037pub type CentralCreateConnectedIsochronousGroupResult =
1038 Result<CentralCreateConnectedIsochronousGroupResponse, CreateCigError>;
1039
1040pub trait CentralProxyInterface: Send + Sync {
1041 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
1042 + Send;
1043 fn r#listen_l2cap(
1044 &self,
1045 payload: ChannelListenerRegistryListenL2capRequest,
1046 ) -> Self::ListenL2capResponseFut;
1047 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1048 fn r#scan(
1049 &self,
1050 options: &ScanOptions,
1051 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1052 ) -> Self::ScanResponseFut;
1053 fn r#connect(
1054 &self,
1055 id: &fidl_fuchsia_bluetooth::PeerId,
1056 options: &ConnectionOptions,
1057 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1058 ) -> Result<(), fidl::Error>;
1059 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
1060 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
1061 > + Send;
1062 fn r#create_connected_isochronous_group(
1063 &self,
1064 payload: CentralCreateConnectedIsochronousGroupRequest,
1065 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
1066 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
1067 + Send;
1068 fn r#get_peripherals(
1069 &self,
1070 service_uuids: Option<&[String]>,
1071 ) -> Self::GetPeripheralsResponseFut;
1072 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
1073 + Send;
1074 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
1075 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1076 + Send;
1077 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
1078 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
1079 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1080 + Send;
1081 fn r#connect_peripheral(
1082 &self,
1083 identifier: &str,
1084 options: &ConnectionOptions,
1085 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1086 ) -> Self::ConnectPeripheralResponseFut;
1087 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1088 + Send;
1089 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
1090}
1091#[derive(Debug)]
1092#[cfg(target_os = "fuchsia")]
1093pub struct CentralSynchronousProxy {
1094 client: fidl::client::sync::Client,
1095}
1096
1097#[cfg(target_os = "fuchsia")]
1098impl fidl::endpoints::SynchronousProxy for CentralSynchronousProxy {
1099 type Proxy = CentralProxy;
1100 type Protocol = CentralMarker;
1101
1102 fn from_channel(inner: fidl::Channel) -> Self {
1103 Self::new(inner)
1104 }
1105
1106 fn into_channel(self) -> fidl::Channel {
1107 self.client.into_channel()
1108 }
1109
1110 fn as_channel(&self) -> &fidl::Channel {
1111 self.client.as_channel()
1112 }
1113}
1114
1115#[cfg(target_os = "fuchsia")]
1116impl CentralSynchronousProxy {
1117 pub fn new(channel: fidl::Channel) -> Self {
1118 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1119 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1120 }
1121
1122 pub fn into_channel(self) -> fidl::Channel {
1123 self.client.into_channel()
1124 }
1125
1126 pub fn wait_for_event(
1129 &self,
1130 deadline: zx::MonotonicInstant,
1131 ) -> Result<CentralEvent, fidl::Error> {
1132 CentralEvent::decode(self.client.wait_for_event(deadline)?)
1133 }
1134
1135 pub fn r#listen_l2cap(
1145 &self,
1146 mut payload: ChannelListenerRegistryListenL2capRequest,
1147 ___deadline: zx::MonotonicInstant,
1148 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1149 let _response = self.client.send_query::<
1150 ChannelListenerRegistryListenL2capRequest,
1151 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1152 >(
1153 &mut payload,
1154 0x39c6e9001d102338,
1155 fidl::encoding::DynamicFlags::empty(),
1156 ___deadline,
1157 )?;
1158 Ok(_response.map(|x| x))
1159 }
1160
1161 pub fn r#scan(
1188 &self,
1189 mut options: &ScanOptions,
1190 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1191 ___deadline: zx::MonotonicInstant,
1192 ) -> Result<(), fidl::Error> {
1193 let _response =
1194 self.client.send_query::<CentralScanRequest, fidl::encoding::EmptyPayload>(
1195 (options, result_watcher),
1196 0x41f7121798dfe15f,
1197 fidl::encoding::DynamicFlags::empty(),
1198 ___deadline,
1199 )?;
1200 Ok(_response)
1201 }
1202
1203 pub fn r#connect(
1225 &self,
1226 mut id: &fidl_fuchsia_bluetooth::PeerId,
1227 mut options: &ConnectionOptions,
1228 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1229 ) -> Result<(), fidl::Error> {
1230 self.client.send::<CentralConnectRequest>(
1231 (id, options, handle),
1232 0x31a3065f2a6913c4,
1233 fidl::encoding::DynamicFlags::empty(),
1234 )
1235 }
1236
1237 pub fn r#create_connected_isochronous_group(
1246 &self,
1247 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1248 ___deadline: zx::MonotonicInstant,
1249 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1250 let _response = self
1251 .client
1252 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
1253 CentralCreateConnectedIsochronousGroupResponse,
1254 CreateCigError,
1255 >>(
1256 &mut payload,
1257 0x60323e70ae22e13,
1258 fidl::encoding::DynamicFlags::empty(),
1259 ___deadline,
1260 )?;
1261 Ok(_response.map(|x| x))
1262 }
1263
1264 pub fn r#get_peripherals(
1270 &self,
1271 mut service_uuids: Option<&[String]>,
1272 ___deadline: zx::MonotonicInstant,
1273 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1274 let _response =
1275 self.client.send_query::<CentralGetPeripheralsRequest, CentralGetPeripheralsResponse>(
1276 (service_uuids,),
1277 0x37ba777499c683a8,
1278 fidl::encoding::DynamicFlags::empty(),
1279 ___deadline,
1280 )?;
1281 Ok(_response.peripherals)
1282 }
1283
1284 pub fn r#get_peripheral(
1290 &self,
1291 mut identifier: &str,
1292 ___deadline: zx::MonotonicInstant,
1293 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1294 let _response =
1295 self.client.send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse>(
1296 (identifier,),
1297 0x97f5a2f2d9c13da,
1298 fidl::encoding::DynamicFlags::empty(),
1299 ___deadline,
1300 )?;
1301 Ok(_response.peripheral)
1302 }
1303
1304 pub fn r#start_scan(
1313 &self,
1314 mut filter: Option<&ScanFilter>,
1315 ___deadline: zx::MonotonicInstant,
1316 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1317 let _response =
1318 self.client.send_query::<CentralStartScanRequest, CentralStartScanResponse>(
1319 (filter,),
1320 0xeb4cf0cd0e1132b,
1321 fidl::encoding::DynamicFlags::empty(),
1322 ___deadline,
1323 )?;
1324 Ok(_response.status)
1325 }
1326
1327 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1329 self.client.send::<fidl::encoding::EmptyPayload>(
1330 (),
1331 0x5f79ee6a0bb037a0,
1332 fidl::encoding::DynamicFlags::empty(),
1333 )
1334 }
1335
1336 pub fn r#connect_peripheral(
1343 &self,
1344 mut identifier: &str,
1345 mut options: &ConnectionOptions,
1346 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1347 ___deadline: zx::MonotonicInstant,
1348 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1349 let _response = self
1350 .client
1351 .send_query::<CentralConnectPeripheralRequest, CentralConnectPeripheralResponse>(
1352 (identifier, options, gatt_client),
1353 0x714d6c32d066d75a,
1354 fidl::encoding::DynamicFlags::empty(),
1355 ___deadline,
1356 )?;
1357 Ok(_response.status)
1358 }
1359
1360 pub fn r#disconnect_peripheral(
1362 &self,
1363 mut identifier: &str,
1364 ___deadline: zx::MonotonicInstant,
1365 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1366 let _response = self
1367 .client
1368 .send_query::<CentralDisconnectPeripheralRequest, CentralDisconnectPeripheralResponse>(
1369 (identifier,),
1370 0xa9430da197362fd,
1371 fidl::encoding::DynamicFlags::empty(),
1372 ___deadline,
1373 )?;
1374 Ok(_response.status)
1375 }
1376}
1377
1378#[cfg(target_os = "fuchsia")]
1379impl From<CentralSynchronousProxy> for zx::Handle {
1380 fn from(value: CentralSynchronousProxy) -> Self {
1381 value.into_channel().into()
1382 }
1383}
1384
1385#[cfg(target_os = "fuchsia")]
1386impl From<fidl::Channel> for CentralSynchronousProxy {
1387 fn from(value: fidl::Channel) -> Self {
1388 Self::new(value)
1389 }
1390}
1391
1392#[cfg(target_os = "fuchsia")]
1393impl fidl::endpoints::FromClient for CentralSynchronousProxy {
1394 type Protocol = CentralMarker;
1395
1396 fn from_client(value: fidl::endpoints::ClientEnd<CentralMarker>) -> Self {
1397 Self::new(value.into_channel())
1398 }
1399}
1400
1401#[derive(Debug, Clone)]
1402pub struct CentralProxy {
1403 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1404}
1405
1406impl fidl::endpoints::Proxy for CentralProxy {
1407 type Protocol = CentralMarker;
1408
1409 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1410 Self::new(inner)
1411 }
1412
1413 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1414 self.client.into_channel().map_err(|client| Self { client })
1415 }
1416
1417 fn as_channel(&self) -> &::fidl::AsyncChannel {
1418 self.client.as_channel()
1419 }
1420}
1421
1422impl CentralProxy {
1423 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1425 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1426 Self { client: fidl::client::Client::new(channel, protocol_name) }
1427 }
1428
1429 pub fn take_event_stream(&self) -> CentralEventStream {
1435 CentralEventStream { event_receiver: self.client.take_event_receiver() }
1436 }
1437
1438 pub fn r#listen_l2cap(
1448 &self,
1449 mut payload: ChannelListenerRegistryListenL2capRequest,
1450 ) -> fidl::client::QueryResponseFut<
1451 ChannelListenerRegistryListenL2capResult,
1452 fidl::encoding::DefaultFuchsiaResourceDialect,
1453 > {
1454 CentralProxyInterface::r#listen_l2cap(self, payload)
1455 }
1456
1457 pub fn r#scan(
1484 &self,
1485 mut options: &ScanOptions,
1486 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1487 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1488 CentralProxyInterface::r#scan(self, options, result_watcher)
1489 }
1490
1491 pub fn r#connect(
1513 &self,
1514 mut id: &fidl_fuchsia_bluetooth::PeerId,
1515 mut options: &ConnectionOptions,
1516 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1517 ) -> Result<(), fidl::Error> {
1518 CentralProxyInterface::r#connect(self, id, options, handle)
1519 }
1520
1521 pub fn r#create_connected_isochronous_group(
1530 &self,
1531 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1532 ) -> fidl::client::QueryResponseFut<
1533 CentralCreateConnectedIsochronousGroupResult,
1534 fidl::encoding::DefaultFuchsiaResourceDialect,
1535 > {
1536 CentralProxyInterface::r#create_connected_isochronous_group(self, payload)
1537 }
1538
1539 pub fn r#get_peripherals(
1545 &self,
1546 mut service_uuids: Option<&[String]>,
1547 ) -> fidl::client::QueryResponseFut<
1548 Vec<RemoteDevice>,
1549 fidl::encoding::DefaultFuchsiaResourceDialect,
1550 > {
1551 CentralProxyInterface::r#get_peripherals(self, service_uuids)
1552 }
1553
1554 pub fn r#get_peripheral(
1560 &self,
1561 mut identifier: &str,
1562 ) -> fidl::client::QueryResponseFut<
1563 Option<Box<RemoteDevice>>,
1564 fidl::encoding::DefaultFuchsiaResourceDialect,
1565 > {
1566 CentralProxyInterface::r#get_peripheral(self, identifier)
1567 }
1568
1569 pub fn r#start_scan(
1578 &self,
1579 mut filter: Option<&ScanFilter>,
1580 ) -> fidl::client::QueryResponseFut<
1581 fidl_fuchsia_bluetooth::Status,
1582 fidl::encoding::DefaultFuchsiaResourceDialect,
1583 > {
1584 CentralProxyInterface::r#start_scan(self, filter)
1585 }
1586
1587 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1589 CentralProxyInterface::r#stop_scan(self)
1590 }
1591
1592 pub fn r#connect_peripheral(
1599 &self,
1600 mut identifier: &str,
1601 mut options: &ConnectionOptions,
1602 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1603 ) -> fidl::client::QueryResponseFut<
1604 fidl_fuchsia_bluetooth::Status,
1605 fidl::encoding::DefaultFuchsiaResourceDialect,
1606 > {
1607 CentralProxyInterface::r#connect_peripheral(self, identifier, options, gatt_client)
1608 }
1609
1610 pub fn r#disconnect_peripheral(
1612 &self,
1613 mut identifier: &str,
1614 ) -> fidl::client::QueryResponseFut<
1615 fidl_fuchsia_bluetooth::Status,
1616 fidl::encoding::DefaultFuchsiaResourceDialect,
1617 > {
1618 CentralProxyInterface::r#disconnect_peripheral(self, identifier)
1619 }
1620}
1621
1622impl CentralProxyInterface for CentralProxy {
1623 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
1624 ChannelListenerRegistryListenL2capResult,
1625 fidl::encoding::DefaultFuchsiaResourceDialect,
1626 >;
1627 fn r#listen_l2cap(
1628 &self,
1629 mut payload: ChannelListenerRegistryListenL2capRequest,
1630 ) -> Self::ListenL2capResponseFut {
1631 fn _decode(
1632 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1633 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1634 let _response = fidl::client::decode_transaction_body::<
1635 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1636 fidl::encoding::DefaultFuchsiaResourceDialect,
1637 0x39c6e9001d102338,
1638 >(_buf?)?;
1639 Ok(_response.map(|x| x))
1640 }
1641 self.client.send_query_and_decode::<
1642 ChannelListenerRegistryListenL2capRequest,
1643 ChannelListenerRegistryListenL2capResult,
1644 >(
1645 &mut payload,
1646 0x39c6e9001d102338,
1647 fidl::encoding::DynamicFlags::empty(),
1648 _decode,
1649 )
1650 }
1651
1652 type ScanResponseFut =
1653 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1654 fn r#scan(
1655 &self,
1656 mut options: &ScanOptions,
1657 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1658 ) -> Self::ScanResponseFut {
1659 fn _decode(
1660 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1661 ) -> Result<(), fidl::Error> {
1662 let _response = fidl::client::decode_transaction_body::<
1663 fidl::encoding::EmptyPayload,
1664 fidl::encoding::DefaultFuchsiaResourceDialect,
1665 0x41f7121798dfe15f,
1666 >(_buf?)?;
1667 Ok(_response)
1668 }
1669 self.client.send_query_and_decode::<CentralScanRequest, ()>(
1670 (options, result_watcher),
1671 0x41f7121798dfe15f,
1672 fidl::encoding::DynamicFlags::empty(),
1673 _decode,
1674 )
1675 }
1676
1677 fn r#connect(
1678 &self,
1679 mut id: &fidl_fuchsia_bluetooth::PeerId,
1680 mut options: &ConnectionOptions,
1681 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1682 ) -> Result<(), fidl::Error> {
1683 self.client.send::<CentralConnectRequest>(
1684 (id, options, handle),
1685 0x31a3065f2a6913c4,
1686 fidl::encoding::DynamicFlags::empty(),
1687 )
1688 }
1689
1690 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
1691 CentralCreateConnectedIsochronousGroupResult,
1692 fidl::encoding::DefaultFuchsiaResourceDialect,
1693 >;
1694 fn r#create_connected_isochronous_group(
1695 &self,
1696 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1697 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
1698 fn _decode(
1699 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1700 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1701 let _response = fidl::client::decode_transaction_body::<
1702 fidl::encoding::ResultType<
1703 CentralCreateConnectedIsochronousGroupResponse,
1704 CreateCigError,
1705 >,
1706 fidl::encoding::DefaultFuchsiaResourceDialect,
1707 0x60323e70ae22e13,
1708 >(_buf?)?;
1709 Ok(_response.map(|x| x))
1710 }
1711 self.client.send_query_and_decode::<
1712 CentralCreateConnectedIsochronousGroupRequest,
1713 CentralCreateConnectedIsochronousGroupResult,
1714 >(
1715 &mut payload,
1716 0x60323e70ae22e13,
1717 fidl::encoding::DynamicFlags::empty(),
1718 _decode,
1719 )
1720 }
1721
1722 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
1723 Vec<RemoteDevice>,
1724 fidl::encoding::DefaultFuchsiaResourceDialect,
1725 >;
1726 fn r#get_peripherals(
1727 &self,
1728 mut service_uuids: Option<&[String]>,
1729 ) -> Self::GetPeripheralsResponseFut {
1730 fn _decode(
1731 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1732 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1733 let _response = fidl::client::decode_transaction_body::<
1734 CentralGetPeripheralsResponse,
1735 fidl::encoding::DefaultFuchsiaResourceDialect,
1736 0x37ba777499c683a8,
1737 >(_buf?)?;
1738 Ok(_response.peripherals)
1739 }
1740 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
1741 (service_uuids,),
1742 0x37ba777499c683a8,
1743 fidl::encoding::DynamicFlags::empty(),
1744 _decode,
1745 )
1746 }
1747
1748 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
1749 Option<Box<RemoteDevice>>,
1750 fidl::encoding::DefaultFuchsiaResourceDialect,
1751 >;
1752 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
1753 fn _decode(
1754 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1755 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1756 let _response = fidl::client::decode_transaction_body::<
1757 CentralGetPeripheralResponse,
1758 fidl::encoding::DefaultFuchsiaResourceDialect,
1759 0x97f5a2f2d9c13da,
1760 >(_buf?)?;
1761 Ok(_response.peripheral)
1762 }
1763 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
1764 (identifier,),
1765 0x97f5a2f2d9c13da,
1766 fidl::encoding::DynamicFlags::empty(),
1767 _decode,
1768 )
1769 }
1770
1771 type StartScanResponseFut = fidl::client::QueryResponseFut<
1772 fidl_fuchsia_bluetooth::Status,
1773 fidl::encoding::DefaultFuchsiaResourceDialect,
1774 >;
1775 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
1776 fn _decode(
1777 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1778 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1779 let _response = fidl::client::decode_transaction_body::<
1780 CentralStartScanResponse,
1781 fidl::encoding::DefaultFuchsiaResourceDialect,
1782 0xeb4cf0cd0e1132b,
1783 >(_buf?)?;
1784 Ok(_response.status)
1785 }
1786 self.client
1787 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
1788 (filter,),
1789 0xeb4cf0cd0e1132b,
1790 fidl::encoding::DynamicFlags::empty(),
1791 _decode,
1792 )
1793 }
1794
1795 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1796 self.client.send::<fidl::encoding::EmptyPayload>(
1797 (),
1798 0x5f79ee6a0bb037a0,
1799 fidl::encoding::DynamicFlags::empty(),
1800 )
1801 }
1802
1803 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1804 fidl_fuchsia_bluetooth::Status,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 >;
1807 fn r#connect_peripheral(
1808 &self,
1809 mut identifier: &str,
1810 mut options: &ConnectionOptions,
1811 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1812 ) -> Self::ConnectPeripheralResponseFut {
1813 fn _decode(
1814 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1815 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1816 let _response = fidl::client::decode_transaction_body::<
1817 CentralConnectPeripheralResponse,
1818 fidl::encoding::DefaultFuchsiaResourceDialect,
1819 0x714d6c32d066d75a,
1820 >(_buf?)?;
1821 Ok(_response.status)
1822 }
1823 self.client.send_query_and_decode::<
1824 CentralConnectPeripheralRequest,
1825 fidl_fuchsia_bluetooth::Status,
1826 >(
1827 (identifier, options, gatt_client,),
1828 0x714d6c32d066d75a,
1829 fidl::encoding::DynamicFlags::empty(),
1830 _decode,
1831 )
1832 }
1833
1834 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1835 fidl_fuchsia_bluetooth::Status,
1836 fidl::encoding::DefaultFuchsiaResourceDialect,
1837 >;
1838 fn r#disconnect_peripheral(
1839 &self,
1840 mut identifier: &str,
1841 ) -> Self::DisconnectPeripheralResponseFut {
1842 fn _decode(
1843 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1844 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1845 let _response = fidl::client::decode_transaction_body::<
1846 CentralDisconnectPeripheralResponse,
1847 fidl::encoding::DefaultFuchsiaResourceDialect,
1848 0xa9430da197362fd,
1849 >(_buf?)?;
1850 Ok(_response.status)
1851 }
1852 self.client.send_query_and_decode::<
1853 CentralDisconnectPeripheralRequest,
1854 fidl_fuchsia_bluetooth::Status,
1855 >(
1856 (identifier,),
1857 0xa9430da197362fd,
1858 fidl::encoding::DynamicFlags::empty(),
1859 _decode,
1860 )
1861 }
1862}
1863
1864pub struct CentralEventStream {
1865 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1866}
1867
1868impl std::marker::Unpin for CentralEventStream {}
1869
1870impl futures::stream::FusedStream for CentralEventStream {
1871 fn is_terminated(&self) -> bool {
1872 self.event_receiver.is_terminated()
1873 }
1874}
1875
1876impl futures::Stream for CentralEventStream {
1877 type Item = Result<CentralEvent, fidl::Error>;
1878
1879 fn poll_next(
1880 mut self: std::pin::Pin<&mut Self>,
1881 cx: &mut std::task::Context<'_>,
1882 ) -> std::task::Poll<Option<Self::Item>> {
1883 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1884 &mut self.event_receiver,
1885 cx
1886 )?) {
1887 Some(buf) => std::task::Poll::Ready(Some(CentralEvent::decode(buf))),
1888 None => std::task::Poll::Ready(None),
1889 }
1890 }
1891}
1892
1893#[derive(Debug)]
1894pub enum CentralEvent {
1895 OnScanStateChanged { scanning: bool },
1896 OnDeviceDiscovered { device: RemoteDevice },
1897 OnPeripheralDisconnected { identifier: String },
1898}
1899
1900impl CentralEvent {
1901 #[allow(irrefutable_let_patterns)]
1902 pub fn into_on_scan_state_changed(self) -> Option<bool> {
1903 if let CentralEvent::OnScanStateChanged { scanning } = self {
1904 Some((scanning))
1905 } else {
1906 None
1907 }
1908 }
1909 #[allow(irrefutable_let_patterns)]
1910 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
1911 if let CentralEvent::OnDeviceDiscovered { device } = self {
1912 Some((device))
1913 } else {
1914 None
1915 }
1916 }
1917 #[allow(irrefutable_let_patterns)]
1918 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
1919 if let CentralEvent::OnPeripheralDisconnected { identifier } = self {
1920 Some((identifier))
1921 } else {
1922 None
1923 }
1924 }
1925
1926 fn decode(
1928 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1929 ) -> Result<CentralEvent, fidl::Error> {
1930 let (bytes, _handles) = buf.split_mut();
1931 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1932 debug_assert_eq!(tx_header.tx_id, 0);
1933 match tx_header.ordinal {
1934 0x5f8edc23cad04d3f => {
1935 let mut out = fidl::new_empty!(
1936 CentralOnScanStateChangedRequest,
1937 fidl::encoding::DefaultFuchsiaResourceDialect
1938 );
1939 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1940 Ok((CentralEvent::OnScanStateChanged { scanning: out.scanning }))
1941 }
1942 0x708dadf20d66db6 => {
1943 let mut out = fidl::new_empty!(
1944 CentralOnDeviceDiscoveredRequest,
1945 fidl::encoding::DefaultFuchsiaResourceDialect
1946 );
1947 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1948 Ok((CentralEvent::OnDeviceDiscovered { device: out.device }))
1949 }
1950 0x4e4c6b979b2126df => {
1951 let mut out = fidl::new_empty!(
1952 CentralOnPeripheralDisconnectedRequest,
1953 fidl::encoding::DefaultFuchsiaResourceDialect
1954 );
1955 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1956 Ok((CentralEvent::OnPeripheralDisconnected { identifier: out.identifier }))
1957 }
1958 _ => Err(fidl::Error::UnknownOrdinal {
1959 ordinal: tx_header.ordinal,
1960 protocol_name: <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1961 }),
1962 }
1963 }
1964}
1965
1966pub struct CentralRequestStream {
1968 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1969 is_terminated: bool,
1970}
1971
1972impl std::marker::Unpin for CentralRequestStream {}
1973
1974impl futures::stream::FusedStream for CentralRequestStream {
1975 fn is_terminated(&self) -> bool {
1976 self.is_terminated
1977 }
1978}
1979
1980impl fidl::endpoints::RequestStream for CentralRequestStream {
1981 type Protocol = CentralMarker;
1982 type ControlHandle = CentralControlHandle;
1983
1984 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1985 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1986 }
1987
1988 fn control_handle(&self) -> Self::ControlHandle {
1989 CentralControlHandle { inner: self.inner.clone() }
1990 }
1991
1992 fn into_inner(
1993 self,
1994 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1995 {
1996 (self.inner, self.is_terminated)
1997 }
1998
1999 fn from_inner(
2000 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2001 is_terminated: bool,
2002 ) -> Self {
2003 Self { inner, is_terminated }
2004 }
2005}
2006
2007impl futures::Stream for CentralRequestStream {
2008 type Item = Result<CentralRequest, fidl::Error>;
2009
2010 fn poll_next(
2011 mut self: std::pin::Pin<&mut Self>,
2012 cx: &mut std::task::Context<'_>,
2013 ) -> std::task::Poll<Option<Self::Item>> {
2014 let this = &mut *self;
2015 if this.inner.check_shutdown(cx) {
2016 this.is_terminated = true;
2017 return std::task::Poll::Ready(None);
2018 }
2019 if this.is_terminated {
2020 panic!("polled CentralRequestStream after completion");
2021 }
2022 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2023 |bytes, handles| {
2024 match this.inner.channel().read_etc(cx, bytes, handles) {
2025 std::task::Poll::Ready(Ok(())) => {}
2026 std::task::Poll::Pending => return std::task::Poll::Pending,
2027 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2028 this.is_terminated = true;
2029 return std::task::Poll::Ready(None);
2030 }
2031 std::task::Poll::Ready(Err(e)) => {
2032 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2033 e.into(),
2034 ))))
2035 }
2036 }
2037
2038 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2040
2041 std::task::Poll::Ready(Some(match header.ordinal {
2042 0x39c6e9001d102338 => {
2043 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2044 let mut req = fidl::new_empty!(
2045 ChannelListenerRegistryListenL2capRequest,
2046 fidl::encoding::DefaultFuchsiaResourceDialect
2047 );
2048 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
2049 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2050 Ok(CentralRequest::ListenL2cap {
2051 payload: req,
2052 responder: CentralListenL2capResponder {
2053 control_handle: std::mem::ManuallyDrop::new(control_handle),
2054 tx_id: header.tx_id,
2055 },
2056 })
2057 }
2058 0x41f7121798dfe15f => {
2059 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2060 let mut req = fidl::new_empty!(
2061 CentralScanRequest,
2062 fidl::encoding::DefaultFuchsiaResourceDialect
2063 );
2064 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
2065 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2066 Ok(CentralRequest::Scan {
2067 options: req.options,
2068 result_watcher: req.result_watcher,
2069
2070 responder: CentralScanResponder {
2071 control_handle: std::mem::ManuallyDrop::new(control_handle),
2072 tx_id: header.tx_id,
2073 },
2074 })
2075 }
2076 0x31a3065f2a6913c4 => {
2077 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2078 let mut req = fidl::new_empty!(
2079 CentralConnectRequest,
2080 fidl::encoding::DefaultFuchsiaResourceDialect
2081 );
2082 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2083 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2084 Ok(CentralRequest::Connect {
2085 id: req.id,
2086 options: req.options,
2087 handle: req.handle,
2088
2089 control_handle,
2090 })
2091 }
2092 0x60323e70ae22e13 => {
2093 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2094 let mut req = fidl::new_empty!(
2095 CentralCreateConnectedIsochronousGroupRequest,
2096 fidl::encoding::DefaultFuchsiaResourceDialect
2097 );
2098 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
2099 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2100 Ok(CentralRequest::CreateConnectedIsochronousGroup {
2101 payload: req,
2102 responder: CentralCreateConnectedIsochronousGroupResponder {
2103 control_handle: std::mem::ManuallyDrop::new(control_handle),
2104 tx_id: header.tx_id,
2105 },
2106 })
2107 }
2108 0x37ba777499c683a8 => {
2109 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2110 let mut req = fidl::new_empty!(
2111 CentralGetPeripheralsRequest,
2112 fidl::encoding::DefaultFuchsiaResourceDialect
2113 );
2114 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
2115 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2116 Ok(CentralRequest::GetPeripherals {
2117 service_uuids: req.service_uuids,
2118
2119 responder: CentralGetPeripheralsResponder {
2120 control_handle: std::mem::ManuallyDrop::new(control_handle),
2121 tx_id: header.tx_id,
2122 },
2123 })
2124 }
2125 0x97f5a2f2d9c13da => {
2126 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2127 let mut req = fidl::new_empty!(
2128 CentralGetPeripheralRequest,
2129 fidl::encoding::DefaultFuchsiaResourceDialect
2130 );
2131 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2132 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2133 Ok(CentralRequest::GetPeripheral {
2134 identifier: req.identifier,
2135
2136 responder: CentralGetPeripheralResponder {
2137 control_handle: std::mem::ManuallyDrop::new(control_handle),
2138 tx_id: header.tx_id,
2139 },
2140 })
2141 }
2142 0xeb4cf0cd0e1132b => {
2143 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2144 let mut req = fidl::new_empty!(
2145 CentralStartScanRequest,
2146 fidl::encoding::DefaultFuchsiaResourceDialect
2147 );
2148 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
2149 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2150 Ok(CentralRequest::StartScan {
2151 filter: req.filter,
2152
2153 responder: CentralStartScanResponder {
2154 control_handle: std::mem::ManuallyDrop::new(control_handle),
2155 tx_id: header.tx_id,
2156 },
2157 })
2158 }
2159 0x5f79ee6a0bb037a0 => {
2160 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2161 let mut req = fidl::new_empty!(
2162 fidl::encoding::EmptyPayload,
2163 fidl::encoding::DefaultFuchsiaResourceDialect
2164 );
2165 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2166 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2167 Ok(CentralRequest::StopScan { control_handle })
2168 }
2169 0x714d6c32d066d75a => {
2170 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2171 let mut req = fidl::new_empty!(
2172 CentralConnectPeripheralRequest,
2173 fidl::encoding::DefaultFuchsiaResourceDialect
2174 );
2175 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2176 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2177 Ok(CentralRequest::ConnectPeripheral {
2178 identifier: req.identifier,
2179 options: req.options,
2180 gatt_client: req.gatt_client,
2181
2182 responder: CentralConnectPeripheralResponder {
2183 control_handle: std::mem::ManuallyDrop::new(control_handle),
2184 tx_id: header.tx_id,
2185 },
2186 })
2187 }
2188 0xa9430da197362fd => {
2189 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2190 let mut req = fidl::new_empty!(
2191 CentralDisconnectPeripheralRequest,
2192 fidl::encoding::DefaultFuchsiaResourceDialect
2193 );
2194 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2195 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2196 Ok(CentralRequest::DisconnectPeripheral {
2197 identifier: req.identifier,
2198
2199 responder: CentralDisconnectPeripheralResponder {
2200 control_handle: std::mem::ManuallyDrop::new(control_handle),
2201 tx_id: header.tx_id,
2202 },
2203 })
2204 }
2205 _ => Err(fidl::Error::UnknownOrdinal {
2206 ordinal: header.ordinal,
2207 protocol_name:
2208 <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2209 }),
2210 }))
2211 },
2212 )
2213 }
2214}
2215
2216#[derive(Debug)]
2217pub enum CentralRequest {
2218 ListenL2cap {
2228 payload: ChannelListenerRegistryListenL2capRequest,
2229 responder: CentralListenL2capResponder,
2230 },
2231 Scan {
2258 options: ScanOptions,
2259 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2260 responder: CentralScanResponder,
2261 },
2262 Connect {
2284 id: fidl_fuchsia_bluetooth::PeerId,
2285 options: ConnectionOptions,
2286 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
2287 control_handle: CentralControlHandle,
2288 },
2289 CreateConnectedIsochronousGroup {
2298 payload: CentralCreateConnectedIsochronousGroupRequest,
2299 responder: CentralCreateConnectedIsochronousGroupResponder,
2300 },
2301 GetPeripherals { service_uuids: Option<Vec<String>>, responder: CentralGetPeripheralsResponder },
2307 GetPeripheral { identifier: String, responder: CentralGetPeripheralResponder },
2313 StartScan { filter: Option<Box<ScanFilter>>, responder: CentralStartScanResponder },
2322 StopScan { control_handle: CentralControlHandle },
2324 ConnectPeripheral {
2331 identifier: String,
2332 options: ConnectionOptions,
2333 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2334 responder: CentralConnectPeripheralResponder,
2335 },
2336 DisconnectPeripheral { identifier: String, responder: CentralDisconnectPeripheralResponder },
2338}
2339
2340impl CentralRequest {
2341 #[allow(irrefutable_let_patterns)]
2342 pub fn into_listen_l2cap(
2343 self,
2344 ) -> Option<(ChannelListenerRegistryListenL2capRequest, CentralListenL2capResponder)> {
2345 if let CentralRequest::ListenL2cap { payload, responder } = self {
2346 Some((payload, responder))
2347 } else {
2348 None
2349 }
2350 }
2351
2352 #[allow(irrefutable_let_patterns)]
2353 pub fn into_scan(
2354 self,
2355 ) -> Option<(
2356 ScanOptions,
2357 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2358 CentralScanResponder,
2359 )> {
2360 if let CentralRequest::Scan { options, result_watcher, responder } = self {
2361 Some((options, result_watcher, responder))
2362 } else {
2363 None
2364 }
2365 }
2366
2367 #[allow(irrefutable_let_patterns)]
2368 pub fn into_connect(
2369 self,
2370 ) -> Option<(
2371 fidl_fuchsia_bluetooth::PeerId,
2372 ConnectionOptions,
2373 fidl::endpoints::ServerEnd<ConnectionMarker>,
2374 CentralControlHandle,
2375 )> {
2376 if let CentralRequest::Connect { id, options, handle, control_handle } = self {
2377 Some((id, options, handle, control_handle))
2378 } else {
2379 None
2380 }
2381 }
2382
2383 #[allow(irrefutable_let_patterns)]
2384 pub fn into_create_connected_isochronous_group(
2385 self,
2386 ) -> Option<(
2387 CentralCreateConnectedIsochronousGroupRequest,
2388 CentralCreateConnectedIsochronousGroupResponder,
2389 )> {
2390 if let CentralRequest::CreateConnectedIsochronousGroup { payload, responder } = self {
2391 Some((payload, responder))
2392 } else {
2393 None
2394 }
2395 }
2396
2397 #[allow(irrefutable_let_patterns)]
2398 pub fn into_get_peripherals(
2399 self,
2400 ) -> Option<(Option<Vec<String>>, CentralGetPeripheralsResponder)> {
2401 if let CentralRequest::GetPeripherals { service_uuids, responder } = self {
2402 Some((service_uuids, responder))
2403 } else {
2404 None
2405 }
2406 }
2407
2408 #[allow(irrefutable_let_patterns)]
2409 pub fn into_get_peripheral(self) -> Option<(String, CentralGetPeripheralResponder)> {
2410 if let CentralRequest::GetPeripheral { identifier, responder } = self {
2411 Some((identifier, responder))
2412 } else {
2413 None
2414 }
2415 }
2416
2417 #[allow(irrefutable_let_patterns)]
2418 pub fn into_start_scan(self) -> Option<(Option<Box<ScanFilter>>, CentralStartScanResponder)> {
2419 if let CentralRequest::StartScan { filter, responder } = self {
2420 Some((filter, responder))
2421 } else {
2422 None
2423 }
2424 }
2425
2426 #[allow(irrefutable_let_patterns)]
2427 pub fn into_stop_scan(self) -> Option<(CentralControlHandle)> {
2428 if let CentralRequest::StopScan { control_handle } = self {
2429 Some((control_handle))
2430 } else {
2431 None
2432 }
2433 }
2434
2435 #[allow(irrefutable_let_patterns)]
2436 pub fn into_connect_peripheral(
2437 self,
2438 ) -> Option<(
2439 String,
2440 ConnectionOptions,
2441 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2442 CentralConnectPeripheralResponder,
2443 )> {
2444 if let CentralRequest::ConnectPeripheral { identifier, options, gatt_client, responder } =
2445 self
2446 {
2447 Some((identifier, options, gatt_client, responder))
2448 } else {
2449 None
2450 }
2451 }
2452
2453 #[allow(irrefutable_let_patterns)]
2454 pub fn into_disconnect_peripheral(
2455 self,
2456 ) -> Option<(String, CentralDisconnectPeripheralResponder)> {
2457 if let CentralRequest::DisconnectPeripheral { identifier, responder } = self {
2458 Some((identifier, responder))
2459 } else {
2460 None
2461 }
2462 }
2463
2464 pub fn method_name(&self) -> &'static str {
2466 match *self {
2467 CentralRequest::ListenL2cap { .. } => "listen_l2cap",
2468 CentralRequest::Scan { .. } => "scan",
2469 CentralRequest::Connect { .. } => "connect",
2470 CentralRequest::CreateConnectedIsochronousGroup { .. } => {
2471 "create_connected_isochronous_group"
2472 }
2473 CentralRequest::GetPeripherals { .. } => "get_peripherals",
2474 CentralRequest::GetPeripheral { .. } => "get_peripheral",
2475 CentralRequest::StartScan { .. } => "start_scan",
2476 CentralRequest::StopScan { .. } => "stop_scan",
2477 CentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
2478 CentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
2479 }
2480 }
2481}
2482
2483#[derive(Debug, Clone)]
2484pub struct CentralControlHandle {
2485 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2486}
2487
2488impl fidl::endpoints::ControlHandle for CentralControlHandle {
2489 fn shutdown(&self) {
2490 self.inner.shutdown()
2491 }
2492 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2493 self.inner.shutdown_with_epitaph(status)
2494 }
2495
2496 fn is_closed(&self) -> bool {
2497 self.inner.channel().is_closed()
2498 }
2499 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2500 self.inner.channel().on_closed()
2501 }
2502
2503 #[cfg(target_os = "fuchsia")]
2504 fn signal_peer(
2505 &self,
2506 clear_mask: zx::Signals,
2507 set_mask: zx::Signals,
2508 ) -> Result<(), zx_status::Status> {
2509 use fidl::Peered;
2510 self.inner.channel().signal_peer(clear_mask, set_mask)
2511 }
2512}
2513
2514impl CentralControlHandle {
2515 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
2516 self.inner.send::<CentralOnScanStateChangedRequest>(
2517 (scanning,),
2518 0,
2519 0x5f8edc23cad04d3f,
2520 fidl::encoding::DynamicFlags::empty(),
2521 )
2522 }
2523
2524 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
2525 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
2526 (device,),
2527 0,
2528 0x708dadf20d66db6,
2529 fidl::encoding::DynamicFlags::empty(),
2530 )
2531 }
2532
2533 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
2534 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
2535 (identifier,),
2536 0,
2537 0x4e4c6b979b2126df,
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 CentralListenL2capResponder {
2546 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2547 tx_id: u32,
2548}
2549
2550impl std::ops::Drop for CentralListenL2capResponder {
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 CentralListenL2capResponder {
2562 type ControlHandle = CentralControlHandle;
2563
2564 fn control_handle(&self) -> &CentralControlHandle {
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 CentralListenL2capResponder {
2577 pub fn send(
2581 self,
2582 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2583 ) -> Result<(), fidl::Error> {
2584 let _result = self.send_raw(result);
2585 if _result.is_err() {
2586 self.control_handle.shutdown();
2587 }
2588 self.drop_without_shutdown();
2589 _result
2590 }
2591
2592 pub fn send_no_shutdown_on_err(
2594 self,
2595 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2596 ) -> Result<(), fidl::Error> {
2597 let _result = self.send_raw(result);
2598 self.drop_without_shutdown();
2599 _result
2600 }
2601
2602 fn send_raw(
2603 &self,
2604 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2605 ) -> Result<(), fidl::Error> {
2606 self.control_handle.inner.send::<fidl::encoding::ResultType<
2607 ChannelListenerRegistryListenL2capResponse,
2608 i32,
2609 >>(
2610 result,
2611 self.tx_id,
2612 0x39c6e9001d102338,
2613 fidl::encoding::DynamicFlags::empty(),
2614 )
2615 }
2616}
2617
2618#[must_use = "FIDL methods require a response to be sent"]
2619#[derive(Debug)]
2620pub struct CentralScanResponder {
2621 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2622 tx_id: u32,
2623}
2624
2625impl std::ops::Drop for CentralScanResponder {
2629 fn drop(&mut self) {
2630 self.control_handle.shutdown();
2631 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2633 }
2634}
2635
2636impl fidl::endpoints::Responder for CentralScanResponder {
2637 type ControlHandle = CentralControlHandle;
2638
2639 fn control_handle(&self) -> &CentralControlHandle {
2640 &self.control_handle
2641 }
2642
2643 fn drop_without_shutdown(mut self) {
2644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2646 std::mem::forget(self);
2648 }
2649}
2650
2651impl CentralScanResponder {
2652 pub fn send(self) -> Result<(), fidl::Error> {
2656 let _result = self.send_raw();
2657 if _result.is_err() {
2658 self.control_handle.shutdown();
2659 }
2660 self.drop_without_shutdown();
2661 _result
2662 }
2663
2664 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2666 let _result = self.send_raw();
2667 self.drop_without_shutdown();
2668 _result
2669 }
2670
2671 fn send_raw(&self) -> Result<(), fidl::Error> {
2672 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2673 (),
2674 self.tx_id,
2675 0x41f7121798dfe15f,
2676 fidl::encoding::DynamicFlags::empty(),
2677 )
2678 }
2679}
2680
2681#[must_use = "FIDL methods require a response to be sent"]
2682#[derive(Debug)]
2683pub struct CentralCreateConnectedIsochronousGroupResponder {
2684 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2685 tx_id: u32,
2686}
2687
2688impl std::ops::Drop for CentralCreateConnectedIsochronousGroupResponder {
2692 fn drop(&mut self) {
2693 self.control_handle.shutdown();
2694 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2696 }
2697}
2698
2699impl fidl::endpoints::Responder for CentralCreateConnectedIsochronousGroupResponder {
2700 type ControlHandle = CentralControlHandle;
2701
2702 fn control_handle(&self) -> &CentralControlHandle {
2703 &self.control_handle
2704 }
2705
2706 fn drop_without_shutdown(mut self) {
2707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2709 std::mem::forget(self);
2711 }
2712}
2713
2714impl CentralCreateConnectedIsochronousGroupResponder {
2715 pub fn send(
2719 self,
2720 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2721 ) -> Result<(), fidl::Error> {
2722 let _result = self.send_raw(result);
2723 if _result.is_err() {
2724 self.control_handle.shutdown();
2725 }
2726 self.drop_without_shutdown();
2727 _result
2728 }
2729
2730 pub fn send_no_shutdown_on_err(
2732 self,
2733 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2734 ) -> Result<(), fidl::Error> {
2735 let _result = self.send_raw(result);
2736 self.drop_without_shutdown();
2737 _result
2738 }
2739
2740 fn send_raw(
2741 &self,
2742 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2743 ) -> Result<(), fidl::Error> {
2744 self.control_handle.inner.send::<fidl::encoding::ResultType<
2745 CentralCreateConnectedIsochronousGroupResponse,
2746 CreateCigError,
2747 >>(
2748 result,
2749 self.tx_id,
2750 0x60323e70ae22e13,
2751 fidl::encoding::DynamicFlags::empty(),
2752 )
2753 }
2754}
2755
2756#[must_use = "FIDL methods require a response to be sent"]
2757#[derive(Debug)]
2758pub struct CentralGetPeripheralsResponder {
2759 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2760 tx_id: u32,
2761}
2762
2763impl std::ops::Drop for CentralGetPeripheralsResponder {
2767 fn drop(&mut self) {
2768 self.control_handle.shutdown();
2769 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2771 }
2772}
2773
2774impl fidl::endpoints::Responder for CentralGetPeripheralsResponder {
2775 type ControlHandle = CentralControlHandle;
2776
2777 fn control_handle(&self) -> &CentralControlHandle {
2778 &self.control_handle
2779 }
2780
2781 fn drop_without_shutdown(mut self) {
2782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2784 std::mem::forget(self);
2786 }
2787}
2788
2789impl CentralGetPeripheralsResponder {
2790 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2794 let _result = self.send_raw(peripherals);
2795 if _result.is_err() {
2796 self.control_handle.shutdown();
2797 }
2798 self.drop_without_shutdown();
2799 _result
2800 }
2801
2802 pub fn send_no_shutdown_on_err(
2804 self,
2805 mut peripherals: &[RemoteDevice],
2806 ) -> Result<(), fidl::Error> {
2807 let _result = self.send_raw(peripherals);
2808 self.drop_without_shutdown();
2809 _result
2810 }
2811
2812 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2813 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
2814 (peripherals,),
2815 self.tx_id,
2816 0x37ba777499c683a8,
2817 fidl::encoding::DynamicFlags::empty(),
2818 )
2819 }
2820}
2821
2822#[must_use = "FIDL methods require a response to be sent"]
2823#[derive(Debug)]
2824pub struct CentralGetPeripheralResponder {
2825 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2826 tx_id: u32,
2827}
2828
2829impl std::ops::Drop for CentralGetPeripheralResponder {
2833 fn drop(&mut self) {
2834 self.control_handle.shutdown();
2835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2837 }
2838}
2839
2840impl fidl::endpoints::Responder for CentralGetPeripheralResponder {
2841 type ControlHandle = CentralControlHandle;
2842
2843 fn control_handle(&self) -> &CentralControlHandle {
2844 &self.control_handle
2845 }
2846
2847 fn drop_without_shutdown(mut self) {
2848 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2850 std::mem::forget(self);
2852 }
2853}
2854
2855impl CentralGetPeripheralResponder {
2856 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2860 let _result = self.send_raw(peripheral);
2861 if _result.is_err() {
2862 self.control_handle.shutdown();
2863 }
2864 self.drop_without_shutdown();
2865 _result
2866 }
2867
2868 pub fn send_no_shutdown_on_err(
2870 self,
2871 mut peripheral: Option<&RemoteDevice>,
2872 ) -> Result<(), fidl::Error> {
2873 let _result = self.send_raw(peripheral);
2874 self.drop_without_shutdown();
2875 _result
2876 }
2877
2878 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2879 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
2880 (peripheral,),
2881 self.tx_id,
2882 0x97f5a2f2d9c13da,
2883 fidl::encoding::DynamicFlags::empty(),
2884 )
2885 }
2886}
2887
2888#[must_use = "FIDL methods require a response to be sent"]
2889#[derive(Debug)]
2890pub struct CentralStartScanResponder {
2891 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2892 tx_id: u32,
2893}
2894
2895impl std::ops::Drop for CentralStartScanResponder {
2899 fn drop(&mut self) {
2900 self.control_handle.shutdown();
2901 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2903 }
2904}
2905
2906impl fidl::endpoints::Responder for CentralStartScanResponder {
2907 type ControlHandle = CentralControlHandle;
2908
2909 fn control_handle(&self) -> &CentralControlHandle {
2910 &self.control_handle
2911 }
2912
2913 fn drop_without_shutdown(mut self) {
2914 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2916 std::mem::forget(self);
2918 }
2919}
2920
2921impl CentralStartScanResponder {
2922 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2926 let _result = self.send_raw(status);
2927 if _result.is_err() {
2928 self.control_handle.shutdown();
2929 }
2930 self.drop_without_shutdown();
2931 _result
2932 }
2933
2934 pub fn send_no_shutdown_on_err(
2936 self,
2937 mut status: &fidl_fuchsia_bluetooth::Status,
2938 ) -> Result<(), fidl::Error> {
2939 let _result = self.send_raw(status);
2940 self.drop_without_shutdown();
2941 _result
2942 }
2943
2944 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2945 self.control_handle.inner.send::<CentralStartScanResponse>(
2946 (status,),
2947 self.tx_id,
2948 0xeb4cf0cd0e1132b,
2949 fidl::encoding::DynamicFlags::empty(),
2950 )
2951 }
2952}
2953
2954#[must_use = "FIDL methods require a response to be sent"]
2955#[derive(Debug)]
2956pub struct CentralConnectPeripheralResponder {
2957 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2958 tx_id: u32,
2959}
2960
2961impl std::ops::Drop for CentralConnectPeripheralResponder {
2965 fn drop(&mut self) {
2966 self.control_handle.shutdown();
2967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2969 }
2970}
2971
2972impl fidl::endpoints::Responder for CentralConnectPeripheralResponder {
2973 type ControlHandle = CentralControlHandle;
2974
2975 fn control_handle(&self) -> &CentralControlHandle {
2976 &self.control_handle
2977 }
2978
2979 fn drop_without_shutdown(mut self) {
2980 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2982 std::mem::forget(self);
2984 }
2985}
2986
2987impl CentralConnectPeripheralResponder {
2988 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2992 let _result = self.send_raw(status);
2993 if _result.is_err() {
2994 self.control_handle.shutdown();
2995 }
2996 self.drop_without_shutdown();
2997 _result
2998 }
2999
3000 pub fn send_no_shutdown_on_err(
3002 self,
3003 mut status: &fidl_fuchsia_bluetooth::Status,
3004 ) -> Result<(), fidl::Error> {
3005 let _result = self.send_raw(status);
3006 self.drop_without_shutdown();
3007 _result
3008 }
3009
3010 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3011 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
3012 (status,),
3013 self.tx_id,
3014 0x714d6c32d066d75a,
3015 fidl::encoding::DynamicFlags::empty(),
3016 )
3017 }
3018}
3019
3020#[must_use = "FIDL methods require a response to be sent"]
3021#[derive(Debug)]
3022pub struct CentralDisconnectPeripheralResponder {
3023 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3024 tx_id: u32,
3025}
3026
3027impl std::ops::Drop for CentralDisconnectPeripheralResponder {
3031 fn drop(&mut self) {
3032 self.control_handle.shutdown();
3033 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3035 }
3036}
3037
3038impl fidl::endpoints::Responder for CentralDisconnectPeripheralResponder {
3039 type ControlHandle = CentralControlHandle;
3040
3041 fn control_handle(&self) -> &CentralControlHandle {
3042 &self.control_handle
3043 }
3044
3045 fn drop_without_shutdown(mut self) {
3046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3048 std::mem::forget(self);
3050 }
3051}
3052
3053impl CentralDisconnectPeripheralResponder {
3054 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3058 let _result = self.send_raw(status);
3059 if _result.is_err() {
3060 self.control_handle.shutdown();
3061 }
3062 self.drop_without_shutdown();
3063 _result
3064 }
3065
3066 pub fn send_no_shutdown_on_err(
3068 self,
3069 mut status: &fidl_fuchsia_bluetooth::Status,
3070 ) -> Result<(), fidl::Error> {
3071 let _result = self.send_raw(status);
3072 self.drop_without_shutdown();
3073 _result
3074 }
3075
3076 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3077 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
3078 (status,),
3079 self.tx_id,
3080 0xa9430da197362fd,
3081 fidl::encoding::DynamicFlags::empty(),
3082 )
3083 }
3084}
3085
3086#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3087pub struct ChannelListenerMarker;
3088
3089impl fidl::endpoints::ProtocolMarker for ChannelListenerMarker {
3090 type Proxy = ChannelListenerProxy;
3091 type RequestStream = ChannelListenerRequestStream;
3092 #[cfg(target_os = "fuchsia")]
3093 type SynchronousProxy = ChannelListenerSynchronousProxy;
3094
3095 const DEBUG_NAME: &'static str = "(anonymous) ChannelListener";
3096}
3097
3098pub trait ChannelListenerProxyInterface: Send + Sync {
3099 type AcceptResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3100 fn r#accept(
3101 &self,
3102 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3103 ) -> Self::AcceptResponseFut;
3104}
3105#[derive(Debug)]
3106#[cfg(target_os = "fuchsia")]
3107pub struct ChannelListenerSynchronousProxy {
3108 client: fidl::client::sync::Client,
3109}
3110
3111#[cfg(target_os = "fuchsia")]
3112impl fidl::endpoints::SynchronousProxy for ChannelListenerSynchronousProxy {
3113 type Proxy = ChannelListenerProxy;
3114 type Protocol = ChannelListenerMarker;
3115
3116 fn from_channel(inner: fidl::Channel) -> Self {
3117 Self::new(inner)
3118 }
3119
3120 fn into_channel(self) -> fidl::Channel {
3121 self.client.into_channel()
3122 }
3123
3124 fn as_channel(&self) -> &fidl::Channel {
3125 self.client.as_channel()
3126 }
3127}
3128
3129#[cfg(target_os = "fuchsia")]
3130impl ChannelListenerSynchronousProxy {
3131 pub fn new(channel: fidl::Channel) -> Self {
3132 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3133 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3134 }
3135
3136 pub fn into_channel(self) -> fidl::Channel {
3137 self.client.into_channel()
3138 }
3139
3140 pub fn wait_for_event(
3143 &self,
3144 deadline: zx::MonotonicInstant,
3145 ) -> Result<ChannelListenerEvent, fidl::Error> {
3146 ChannelListenerEvent::decode(self.client.wait_for_event(deadline)?)
3147 }
3148
3149 pub fn r#accept(
3150 &self,
3151 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3152 ___deadline: zx::MonotonicInstant,
3153 ) -> Result<(), fidl::Error> {
3154 let _response = self.client.send_query::<
3155 ChannelListenerAcceptRequest,
3156 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3157 >(
3158 (channel,),
3159 0x6f535bd36b20fc7b,
3160 fidl::encoding::DynamicFlags::FLEXIBLE,
3161 ___deadline,
3162 )?
3163 .into_result::<ChannelListenerMarker>("accept")?;
3164 Ok(_response)
3165 }
3166}
3167
3168#[cfg(target_os = "fuchsia")]
3169impl From<ChannelListenerSynchronousProxy> for zx::Handle {
3170 fn from(value: ChannelListenerSynchronousProxy) -> Self {
3171 value.into_channel().into()
3172 }
3173}
3174
3175#[cfg(target_os = "fuchsia")]
3176impl From<fidl::Channel> for ChannelListenerSynchronousProxy {
3177 fn from(value: fidl::Channel) -> Self {
3178 Self::new(value)
3179 }
3180}
3181
3182#[cfg(target_os = "fuchsia")]
3183impl fidl::endpoints::FromClient for ChannelListenerSynchronousProxy {
3184 type Protocol = ChannelListenerMarker;
3185
3186 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerMarker>) -> Self {
3187 Self::new(value.into_channel())
3188 }
3189}
3190
3191#[derive(Debug, Clone)]
3192pub struct ChannelListenerProxy {
3193 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3194}
3195
3196impl fidl::endpoints::Proxy for ChannelListenerProxy {
3197 type Protocol = ChannelListenerMarker;
3198
3199 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3200 Self::new(inner)
3201 }
3202
3203 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3204 self.client.into_channel().map_err(|client| Self { client })
3205 }
3206
3207 fn as_channel(&self) -> &::fidl::AsyncChannel {
3208 self.client.as_channel()
3209 }
3210}
3211
3212impl ChannelListenerProxy {
3213 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3215 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3216 Self { client: fidl::client::Client::new(channel, protocol_name) }
3217 }
3218
3219 pub fn take_event_stream(&self) -> ChannelListenerEventStream {
3225 ChannelListenerEventStream { event_receiver: self.client.take_event_receiver() }
3226 }
3227
3228 pub fn r#accept(
3229 &self,
3230 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3231 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3232 ChannelListenerProxyInterface::r#accept(self, channel)
3233 }
3234}
3235
3236impl ChannelListenerProxyInterface for ChannelListenerProxy {
3237 type AcceptResponseFut =
3238 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3239 fn r#accept(
3240 &self,
3241 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3242 ) -> Self::AcceptResponseFut {
3243 fn _decode(
3244 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3245 ) -> Result<(), fidl::Error> {
3246 let _response = fidl::client::decode_transaction_body::<
3247 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3248 fidl::encoding::DefaultFuchsiaResourceDialect,
3249 0x6f535bd36b20fc7b,
3250 >(_buf?)?
3251 .into_result::<ChannelListenerMarker>("accept")?;
3252 Ok(_response)
3253 }
3254 self.client.send_query_and_decode::<ChannelListenerAcceptRequest, ()>(
3255 (channel,),
3256 0x6f535bd36b20fc7b,
3257 fidl::encoding::DynamicFlags::FLEXIBLE,
3258 _decode,
3259 )
3260 }
3261}
3262
3263pub struct ChannelListenerEventStream {
3264 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3265}
3266
3267impl std::marker::Unpin for ChannelListenerEventStream {}
3268
3269impl futures::stream::FusedStream for ChannelListenerEventStream {
3270 fn is_terminated(&self) -> bool {
3271 self.event_receiver.is_terminated()
3272 }
3273}
3274
3275impl futures::Stream for ChannelListenerEventStream {
3276 type Item = Result<ChannelListenerEvent, fidl::Error>;
3277
3278 fn poll_next(
3279 mut self: std::pin::Pin<&mut Self>,
3280 cx: &mut std::task::Context<'_>,
3281 ) -> std::task::Poll<Option<Self::Item>> {
3282 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3283 &mut self.event_receiver,
3284 cx
3285 )?) {
3286 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerEvent::decode(buf))),
3287 None => std::task::Poll::Ready(None),
3288 }
3289 }
3290}
3291
3292#[derive(Debug)]
3293pub enum ChannelListenerEvent {
3294 #[non_exhaustive]
3295 _UnknownEvent {
3296 ordinal: u64,
3298 },
3299}
3300
3301impl ChannelListenerEvent {
3302 fn decode(
3304 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3305 ) -> Result<ChannelListenerEvent, fidl::Error> {
3306 let (bytes, _handles) = buf.split_mut();
3307 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3308 debug_assert_eq!(tx_header.tx_id, 0);
3309 match tx_header.ordinal {
3310 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3311 Ok(ChannelListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3312 }
3313 _ => Err(fidl::Error::UnknownOrdinal {
3314 ordinal: tx_header.ordinal,
3315 protocol_name:
3316 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3317 }),
3318 }
3319 }
3320}
3321
3322pub struct ChannelListenerRequestStream {
3324 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3325 is_terminated: bool,
3326}
3327
3328impl std::marker::Unpin for ChannelListenerRequestStream {}
3329
3330impl futures::stream::FusedStream for ChannelListenerRequestStream {
3331 fn is_terminated(&self) -> bool {
3332 self.is_terminated
3333 }
3334}
3335
3336impl fidl::endpoints::RequestStream for ChannelListenerRequestStream {
3337 type Protocol = ChannelListenerMarker;
3338 type ControlHandle = ChannelListenerControlHandle;
3339
3340 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3341 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3342 }
3343
3344 fn control_handle(&self) -> Self::ControlHandle {
3345 ChannelListenerControlHandle { inner: self.inner.clone() }
3346 }
3347
3348 fn into_inner(
3349 self,
3350 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3351 {
3352 (self.inner, self.is_terminated)
3353 }
3354
3355 fn from_inner(
3356 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3357 is_terminated: bool,
3358 ) -> Self {
3359 Self { inner, is_terminated }
3360 }
3361}
3362
3363impl futures::Stream for ChannelListenerRequestStream {
3364 type Item = Result<ChannelListenerRequest, fidl::Error>;
3365
3366 fn poll_next(
3367 mut self: std::pin::Pin<&mut Self>,
3368 cx: &mut std::task::Context<'_>,
3369 ) -> std::task::Poll<Option<Self::Item>> {
3370 let this = &mut *self;
3371 if this.inner.check_shutdown(cx) {
3372 this.is_terminated = true;
3373 return std::task::Poll::Ready(None);
3374 }
3375 if this.is_terminated {
3376 panic!("polled ChannelListenerRequestStream after completion");
3377 }
3378 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3379 |bytes, handles| {
3380 match this.inner.channel().read_etc(cx, bytes, handles) {
3381 std::task::Poll::Ready(Ok(())) => {}
3382 std::task::Poll::Pending => return std::task::Poll::Pending,
3383 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3384 this.is_terminated = true;
3385 return std::task::Poll::Ready(None);
3386 }
3387 std::task::Poll::Ready(Err(e)) => {
3388 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3389 e.into(),
3390 ))))
3391 }
3392 }
3393
3394 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3396
3397 std::task::Poll::Ready(Some(match header.ordinal {
3398 0x6f535bd36b20fc7b => {
3399 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3400 let mut req = fidl::new_empty!(
3401 ChannelListenerAcceptRequest,
3402 fidl::encoding::DefaultFuchsiaResourceDialect
3403 );
3404 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
3405 let control_handle =
3406 ChannelListenerControlHandle { inner: this.inner.clone() };
3407 Ok(ChannelListenerRequest::Accept {
3408 channel: req.channel,
3409
3410 responder: ChannelListenerAcceptResponder {
3411 control_handle: std::mem::ManuallyDrop::new(control_handle),
3412 tx_id: header.tx_id,
3413 },
3414 })
3415 }
3416 _ if header.tx_id == 0
3417 && header
3418 .dynamic_flags()
3419 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3420 {
3421 Ok(ChannelListenerRequest::_UnknownMethod {
3422 ordinal: header.ordinal,
3423 control_handle: ChannelListenerControlHandle {
3424 inner: this.inner.clone(),
3425 },
3426 method_type: fidl::MethodType::OneWay,
3427 })
3428 }
3429 _ if header
3430 .dynamic_flags()
3431 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3432 {
3433 this.inner.send_framework_err(
3434 fidl::encoding::FrameworkErr::UnknownMethod,
3435 header.tx_id,
3436 header.ordinal,
3437 header.dynamic_flags(),
3438 (bytes, handles),
3439 )?;
3440 Ok(ChannelListenerRequest::_UnknownMethod {
3441 ordinal: header.ordinal,
3442 control_handle: ChannelListenerControlHandle {
3443 inner: this.inner.clone(),
3444 },
3445 method_type: fidl::MethodType::TwoWay,
3446 })
3447 }
3448 _ => Err(fidl::Error::UnknownOrdinal {
3449 ordinal: header.ordinal,
3450 protocol_name:
3451 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3452 }),
3453 }))
3454 },
3455 )
3456 }
3457}
3458
3459#[derive(Debug)]
3466pub enum ChannelListenerRequest {
3467 Accept {
3468 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3469 responder: ChannelListenerAcceptResponder,
3470 },
3471 #[non_exhaustive]
3473 _UnknownMethod {
3474 ordinal: u64,
3476 control_handle: ChannelListenerControlHandle,
3477 method_type: fidl::MethodType,
3478 },
3479}
3480
3481impl ChannelListenerRequest {
3482 #[allow(irrefutable_let_patterns)]
3483 pub fn into_accept(
3484 self,
3485 ) -> Option<(
3486 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3487 ChannelListenerAcceptResponder,
3488 )> {
3489 if let ChannelListenerRequest::Accept { channel, responder } = self {
3490 Some((channel, responder))
3491 } else {
3492 None
3493 }
3494 }
3495
3496 pub fn method_name(&self) -> &'static str {
3498 match *self {
3499 ChannelListenerRequest::Accept { .. } => "accept",
3500 ChannelListenerRequest::_UnknownMethod {
3501 method_type: fidl::MethodType::OneWay,
3502 ..
3503 } => "unknown one-way method",
3504 ChannelListenerRequest::_UnknownMethod {
3505 method_type: fidl::MethodType::TwoWay,
3506 ..
3507 } => "unknown two-way method",
3508 }
3509 }
3510}
3511
3512#[derive(Debug, Clone)]
3513pub struct ChannelListenerControlHandle {
3514 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3515}
3516
3517impl fidl::endpoints::ControlHandle for ChannelListenerControlHandle {
3518 fn shutdown(&self) {
3519 self.inner.shutdown()
3520 }
3521 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3522 self.inner.shutdown_with_epitaph(status)
3523 }
3524
3525 fn is_closed(&self) -> bool {
3526 self.inner.channel().is_closed()
3527 }
3528 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3529 self.inner.channel().on_closed()
3530 }
3531
3532 #[cfg(target_os = "fuchsia")]
3533 fn signal_peer(
3534 &self,
3535 clear_mask: zx::Signals,
3536 set_mask: zx::Signals,
3537 ) -> Result<(), zx_status::Status> {
3538 use fidl::Peered;
3539 self.inner.channel().signal_peer(clear_mask, set_mask)
3540 }
3541}
3542
3543impl ChannelListenerControlHandle {}
3544
3545#[must_use = "FIDL methods require a response to be sent"]
3546#[derive(Debug)]
3547pub struct ChannelListenerAcceptResponder {
3548 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3549 tx_id: u32,
3550}
3551
3552impl std::ops::Drop for ChannelListenerAcceptResponder {
3556 fn drop(&mut self) {
3557 self.control_handle.shutdown();
3558 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3560 }
3561}
3562
3563impl fidl::endpoints::Responder for ChannelListenerAcceptResponder {
3564 type ControlHandle = ChannelListenerControlHandle;
3565
3566 fn control_handle(&self) -> &ChannelListenerControlHandle {
3567 &self.control_handle
3568 }
3569
3570 fn drop_without_shutdown(mut self) {
3571 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3573 std::mem::forget(self);
3575 }
3576}
3577
3578impl ChannelListenerAcceptResponder {
3579 pub fn send(self) -> Result<(), fidl::Error> {
3583 let _result = self.send_raw();
3584 if _result.is_err() {
3585 self.control_handle.shutdown();
3586 }
3587 self.drop_without_shutdown();
3588 _result
3589 }
3590
3591 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3593 let _result = self.send_raw();
3594 self.drop_without_shutdown();
3595 _result
3596 }
3597
3598 fn send_raw(&self) -> Result<(), fidl::Error> {
3599 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3600 fidl::encoding::Flexible::new(()),
3601 self.tx_id,
3602 0x6f535bd36b20fc7b,
3603 fidl::encoding::DynamicFlags::FLEXIBLE,
3604 )
3605 }
3606}
3607
3608#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3609pub struct ChannelListenerRegistryMarker;
3610
3611impl fidl::endpoints::ProtocolMarker for ChannelListenerRegistryMarker {
3612 type Proxy = ChannelListenerRegistryProxy;
3613 type RequestStream = ChannelListenerRegistryRequestStream;
3614 #[cfg(target_os = "fuchsia")]
3615 type SynchronousProxy = ChannelListenerRegistrySynchronousProxy;
3616
3617 const DEBUG_NAME: &'static str = "(anonymous) ChannelListenerRegistry";
3618}
3619pub type ChannelListenerRegistryListenL2capResult =
3620 Result<ChannelListenerRegistryListenL2capResponse, i32>;
3621
3622pub trait ChannelListenerRegistryProxyInterface: Send + Sync {
3623 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
3624 + Send;
3625 fn r#listen_l2cap(
3626 &self,
3627 payload: ChannelListenerRegistryListenL2capRequest,
3628 ) -> Self::ListenL2capResponseFut;
3629}
3630#[derive(Debug)]
3631#[cfg(target_os = "fuchsia")]
3632pub struct ChannelListenerRegistrySynchronousProxy {
3633 client: fidl::client::sync::Client,
3634}
3635
3636#[cfg(target_os = "fuchsia")]
3637impl fidl::endpoints::SynchronousProxy for ChannelListenerRegistrySynchronousProxy {
3638 type Proxy = ChannelListenerRegistryProxy;
3639 type Protocol = ChannelListenerRegistryMarker;
3640
3641 fn from_channel(inner: fidl::Channel) -> Self {
3642 Self::new(inner)
3643 }
3644
3645 fn into_channel(self) -> fidl::Channel {
3646 self.client.into_channel()
3647 }
3648
3649 fn as_channel(&self) -> &fidl::Channel {
3650 self.client.as_channel()
3651 }
3652}
3653
3654#[cfg(target_os = "fuchsia")]
3655impl ChannelListenerRegistrySynchronousProxy {
3656 pub fn new(channel: fidl::Channel) -> Self {
3657 let protocol_name =
3658 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3659 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3660 }
3661
3662 pub fn into_channel(self) -> fidl::Channel {
3663 self.client.into_channel()
3664 }
3665
3666 pub fn wait_for_event(
3669 &self,
3670 deadline: zx::MonotonicInstant,
3671 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3672 ChannelListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
3673 }
3674
3675 pub fn r#listen_l2cap(
3685 &self,
3686 mut payload: ChannelListenerRegistryListenL2capRequest,
3687 ___deadline: zx::MonotonicInstant,
3688 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3689 let _response = self.client.send_query::<
3690 ChannelListenerRegistryListenL2capRequest,
3691 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3692 >(
3693 &mut payload,
3694 0x39c6e9001d102338,
3695 fidl::encoding::DynamicFlags::empty(),
3696 ___deadline,
3697 )?;
3698 Ok(_response.map(|x| x))
3699 }
3700}
3701
3702#[cfg(target_os = "fuchsia")]
3703impl From<ChannelListenerRegistrySynchronousProxy> for zx::Handle {
3704 fn from(value: ChannelListenerRegistrySynchronousProxy) -> Self {
3705 value.into_channel().into()
3706 }
3707}
3708
3709#[cfg(target_os = "fuchsia")]
3710impl From<fidl::Channel> for ChannelListenerRegistrySynchronousProxy {
3711 fn from(value: fidl::Channel) -> Self {
3712 Self::new(value)
3713 }
3714}
3715
3716#[cfg(target_os = "fuchsia")]
3717impl fidl::endpoints::FromClient for ChannelListenerRegistrySynchronousProxy {
3718 type Protocol = ChannelListenerRegistryMarker;
3719
3720 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerRegistryMarker>) -> Self {
3721 Self::new(value.into_channel())
3722 }
3723}
3724
3725#[derive(Debug, Clone)]
3726pub struct ChannelListenerRegistryProxy {
3727 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3728}
3729
3730impl fidl::endpoints::Proxy for ChannelListenerRegistryProxy {
3731 type Protocol = ChannelListenerRegistryMarker;
3732
3733 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3734 Self::new(inner)
3735 }
3736
3737 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3738 self.client.into_channel().map_err(|client| Self { client })
3739 }
3740
3741 fn as_channel(&self) -> &::fidl::AsyncChannel {
3742 self.client.as_channel()
3743 }
3744}
3745
3746impl ChannelListenerRegistryProxy {
3747 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3749 let protocol_name =
3750 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3751 Self { client: fidl::client::Client::new(channel, protocol_name) }
3752 }
3753
3754 pub fn take_event_stream(&self) -> ChannelListenerRegistryEventStream {
3760 ChannelListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
3761 }
3762
3763 pub fn r#listen_l2cap(
3773 &self,
3774 mut payload: ChannelListenerRegistryListenL2capRequest,
3775 ) -> fidl::client::QueryResponseFut<
3776 ChannelListenerRegistryListenL2capResult,
3777 fidl::encoding::DefaultFuchsiaResourceDialect,
3778 > {
3779 ChannelListenerRegistryProxyInterface::r#listen_l2cap(self, payload)
3780 }
3781}
3782
3783impl ChannelListenerRegistryProxyInterface for ChannelListenerRegistryProxy {
3784 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
3785 ChannelListenerRegistryListenL2capResult,
3786 fidl::encoding::DefaultFuchsiaResourceDialect,
3787 >;
3788 fn r#listen_l2cap(
3789 &self,
3790 mut payload: ChannelListenerRegistryListenL2capRequest,
3791 ) -> Self::ListenL2capResponseFut {
3792 fn _decode(
3793 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3794 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3795 let _response = fidl::client::decode_transaction_body::<
3796 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3797 fidl::encoding::DefaultFuchsiaResourceDialect,
3798 0x39c6e9001d102338,
3799 >(_buf?)?;
3800 Ok(_response.map(|x| x))
3801 }
3802 self.client.send_query_and_decode::<
3803 ChannelListenerRegistryListenL2capRequest,
3804 ChannelListenerRegistryListenL2capResult,
3805 >(
3806 &mut payload,
3807 0x39c6e9001d102338,
3808 fidl::encoding::DynamicFlags::empty(),
3809 _decode,
3810 )
3811 }
3812}
3813
3814pub struct ChannelListenerRegistryEventStream {
3815 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3816}
3817
3818impl std::marker::Unpin for ChannelListenerRegistryEventStream {}
3819
3820impl futures::stream::FusedStream for ChannelListenerRegistryEventStream {
3821 fn is_terminated(&self) -> bool {
3822 self.event_receiver.is_terminated()
3823 }
3824}
3825
3826impl futures::Stream for ChannelListenerRegistryEventStream {
3827 type Item = Result<ChannelListenerRegistryEvent, fidl::Error>;
3828
3829 fn poll_next(
3830 mut self: std::pin::Pin<&mut Self>,
3831 cx: &mut std::task::Context<'_>,
3832 ) -> std::task::Poll<Option<Self::Item>> {
3833 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3834 &mut self.event_receiver,
3835 cx
3836 )?) {
3837 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerRegistryEvent::decode(buf))),
3838 None => std::task::Poll::Ready(None),
3839 }
3840 }
3841}
3842
3843#[derive(Debug)]
3844pub enum ChannelListenerRegistryEvent {}
3845
3846impl ChannelListenerRegistryEvent {
3847 fn decode(
3849 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3850 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3851 let (bytes, _handles) = buf.split_mut();
3852 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3853 debug_assert_eq!(tx_header.tx_id, 0);
3854 match tx_header.ordinal {
3855 _ => Err(fidl::Error::UnknownOrdinal {
3856 ordinal: tx_header.ordinal,
3857 protocol_name:
3858 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3859 }),
3860 }
3861 }
3862}
3863
3864pub struct ChannelListenerRegistryRequestStream {
3866 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3867 is_terminated: bool,
3868}
3869
3870impl std::marker::Unpin for ChannelListenerRegistryRequestStream {}
3871
3872impl futures::stream::FusedStream for ChannelListenerRegistryRequestStream {
3873 fn is_terminated(&self) -> bool {
3874 self.is_terminated
3875 }
3876}
3877
3878impl fidl::endpoints::RequestStream for ChannelListenerRegistryRequestStream {
3879 type Protocol = ChannelListenerRegistryMarker;
3880 type ControlHandle = ChannelListenerRegistryControlHandle;
3881
3882 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3883 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3884 }
3885
3886 fn control_handle(&self) -> Self::ControlHandle {
3887 ChannelListenerRegistryControlHandle { inner: self.inner.clone() }
3888 }
3889
3890 fn into_inner(
3891 self,
3892 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3893 {
3894 (self.inner, self.is_terminated)
3895 }
3896
3897 fn from_inner(
3898 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3899 is_terminated: bool,
3900 ) -> Self {
3901 Self { inner, is_terminated }
3902 }
3903}
3904
3905impl futures::Stream for ChannelListenerRegistryRequestStream {
3906 type Item = Result<ChannelListenerRegistryRequest, fidl::Error>;
3907
3908 fn poll_next(
3909 mut self: std::pin::Pin<&mut Self>,
3910 cx: &mut std::task::Context<'_>,
3911 ) -> std::task::Poll<Option<Self::Item>> {
3912 let this = &mut *self;
3913 if this.inner.check_shutdown(cx) {
3914 this.is_terminated = true;
3915 return std::task::Poll::Ready(None);
3916 }
3917 if this.is_terminated {
3918 panic!("polled ChannelListenerRegistryRequestStream after completion");
3919 }
3920 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3921 |bytes, handles| {
3922 match this.inner.channel().read_etc(cx, bytes, handles) {
3923 std::task::Poll::Ready(Ok(())) => {}
3924 std::task::Poll::Pending => return std::task::Poll::Pending,
3925 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3926 this.is_terminated = true;
3927 return std::task::Poll::Ready(None);
3928 }
3929 std::task::Poll::Ready(Err(e)) => {
3930 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3931 e.into(),
3932 ))))
3933 }
3934 }
3935
3936 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3938
3939 std::task::Poll::Ready(Some(match header.ordinal {
3940 0x39c6e9001d102338 => {
3941 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3942 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3943 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
3944 let control_handle = ChannelListenerRegistryControlHandle {
3945 inner: this.inner.clone(),
3946 };
3947 Ok(ChannelListenerRegistryRequest::ListenL2cap {payload: req,
3948 responder: ChannelListenerRegistryListenL2capResponder {
3949 control_handle: std::mem::ManuallyDrop::new(control_handle),
3950 tx_id: header.tx_id,
3951 },
3952 })
3953 }
3954 _ => Err(fidl::Error::UnknownOrdinal {
3955 ordinal: header.ordinal,
3956 protocol_name: <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3957 }),
3958 }))
3959 },
3960 )
3961 }
3962}
3963
3964#[derive(Debug)]
3967pub enum ChannelListenerRegistryRequest {
3968 ListenL2cap {
3978 payload: ChannelListenerRegistryListenL2capRequest,
3979 responder: ChannelListenerRegistryListenL2capResponder,
3980 },
3981}
3982
3983impl ChannelListenerRegistryRequest {
3984 #[allow(irrefutable_let_patterns)]
3985 pub fn into_listen_l2cap(
3986 self,
3987 ) -> Option<(
3988 ChannelListenerRegistryListenL2capRequest,
3989 ChannelListenerRegistryListenL2capResponder,
3990 )> {
3991 if let ChannelListenerRegistryRequest::ListenL2cap { payload, responder } = self {
3992 Some((payload, responder))
3993 } else {
3994 None
3995 }
3996 }
3997
3998 pub fn method_name(&self) -> &'static str {
4000 match *self {
4001 ChannelListenerRegistryRequest::ListenL2cap { .. } => "listen_l2cap",
4002 }
4003 }
4004}
4005
4006#[derive(Debug, Clone)]
4007pub struct ChannelListenerRegistryControlHandle {
4008 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4009}
4010
4011impl fidl::endpoints::ControlHandle for ChannelListenerRegistryControlHandle {
4012 fn shutdown(&self) {
4013 self.inner.shutdown()
4014 }
4015 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4016 self.inner.shutdown_with_epitaph(status)
4017 }
4018
4019 fn is_closed(&self) -> bool {
4020 self.inner.channel().is_closed()
4021 }
4022 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4023 self.inner.channel().on_closed()
4024 }
4025
4026 #[cfg(target_os = "fuchsia")]
4027 fn signal_peer(
4028 &self,
4029 clear_mask: zx::Signals,
4030 set_mask: zx::Signals,
4031 ) -> Result<(), zx_status::Status> {
4032 use fidl::Peered;
4033 self.inner.channel().signal_peer(clear_mask, set_mask)
4034 }
4035}
4036
4037impl ChannelListenerRegistryControlHandle {}
4038
4039#[must_use = "FIDL methods require a response to be sent"]
4040#[derive(Debug)]
4041pub struct ChannelListenerRegistryListenL2capResponder {
4042 control_handle: std::mem::ManuallyDrop<ChannelListenerRegistryControlHandle>,
4043 tx_id: u32,
4044}
4045
4046impl std::ops::Drop for ChannelListenerRegistryListenL2capResponder {
4050 fn drop(&mut self) {
4051 self.control_handle.shutdown();
4052 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4054 }
4055}
4056
4057impl fidl::endpoints::Responder for ChannelListenerRegistryListenL2capResponder {
4058 type ControlHandle = ChannelListenerRegistryControlHandle;
4059
4060 fn control_handle(&self) -> &ChannelListenerRegistryControlHandle {
4061 &self.control_handle
4062 }
4063
4064 fn drop_without_shutdown(mut self) {
4065 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4067 std::mem::forget(self);
4069 }
4070}
4071
4072impl ChannelListenerRegistryListenL2capResponder {
4073 pub fn send(
4077 self,
4078 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4079 ) -> Result<(), fidl::Error> {
4080 let _result = self.send_raw(result);
4081 if _result.is_err() {
4082 self.control_handle.shutdown();
4083 }
4084 self.drop_without_shutdown();
4085 _result
4086 }
4087
4088 pub fn send_no_shutdown_on_err(
4090 self,
4091 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4092 ) -> Result<(), fidl::Error> {
4093 let _result = self.send_raw(result);
4094 self.drop_without_shutdown();
4095 _result
4096 }
4097
4098 fn send_raw(
4099 &self,
4100 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4101 ) -> Result<(), fidl::Error> {
4102 self.control_handle.inner.send::<fidl::encoding::ResultType<
4103 ChannelListenerRegistryListenL2capResponse,
4104 i32,
4105 >>(
4106 result,
4107 self.tx_id,
4108 0x39c6e9001d102338,
4109 fidl::encoding::DynamicFlags::empty(),
4110 )
4111 }
4112}
4113
4114#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4115pub struct CodecDelayMarker;
4116
4117impl fidl::endpoints::ProtocolMarker for CodecDelayMarker {
4118 type Proxy = CodecDelayProxy;
4119 type RequestStream = CodecDelayRequestStream;
4120 #[cfg(target_os = "fuchsia")]
4121 type SynchronousProxy = CodecDelaySynchronousProxy;
4122
4123 const DEBUG_NAME: &'static str = "(anonymous) CodecDelay";
4124}
4125pub type CodecDelayGetCodecLocalDelayRangeResult =
4126 Result<CodecDelayGetCodecLocalDelayRangeResponse, i32>;
4127
4128pub trait CodecDelayProxyInterface: Send + Sync {
4129 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
4130 + Send;
4131 fn r#get_codec_local_delay_range(
4132 &self,
4133 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4134 ) -> Self::GetCodecLocalDelayRangeResponseFut;
4135}
4136#[derive(Debug)]
4137#[cfg(target_os = "fuchsia")]
4138pub struct CodecDelaySynchronousProxy {
4139 client: fidl::client::sync::Client,
4140}
4141
4142#[cfg(target_os = "fuchsia")]
4143impl fidl::endpoints::SynchronousProxy for CodecDelaySynchronousProxy {
4144 type Proxy = CodecDelayProxy;
4145 type Protocol = CodecDelayMarker;
4146
4147 fn from_channel(inner: fidl::Channel) -> Self {
4148 Self::new(inner)
4149 }
4150
4151 fn into_channel(self) -> fidl::Channel {
4152 self.client.into_channel()
4153 }
4154
4155 fn as_channel(&self) -> &fidl::Channel {
4156 self.client.as_channel()
4157 }
4158}
4159
4160#[cfg(target_os = "fuchsia")]
4161impl CodecDelaySynchronousProxy {
4162 pub fn new(channel: fidl::Channel) -> Self {
4163 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4164 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4165 }
4166
4167 pub fn into_channel(self) -> fidl::Channel {
4168 self.client.into_channel()
4169 }
4170
4171 pub fn wait_for_event(
4174 &self,
4175 deadline: zx::MonotonicInstant,
4176 ) -> Result<CodecDelayEvent, fidl::Error> {
4177 CodecDelayEvent::decode(self.client.wait_for_event(deadline)?)
4178 }
4179
4180 pub fn r#get_codec_local_delay_range(
4188 &self,
4189 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4190 ___deadline: zx::MonotonicInstant,
4191 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4192 let _response = self.client.send_query::<
4193 CodecDelayGetCodecLocalDelayRangeRequest,
4194 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4195 >(
4196 payload,
4197 0x1cf34fdeed80b4d,
4198 fidl::encoding::DynamicFlags::empty(),
4199 ___deadline,
4200 )?;
4201 Ok(_response.map(|x| x))
4202 }
4203}
4204
4205#[cfg(target_os = "fuchsia")]
4206impl From<CodecDelaySynchronousProxy> for zx::Handle {
4207 fn from(value: CodecDelaySynchronousProxy) -> Self {
4208 value.into_channel().into()
4209 }
4210}
4211
4212#[cfg(target_os = "fuchsia")]
4213impl From<fidl::Channel> for CodecDelaySynchronousProxy {
4214 fn from(value: fidl::Channel) -> Self {
4215 Self::new(value)
4216 }
4217}
4218
4219#[cfg(target_os = "fuchsia")]
4220impl fidl::endpoints::FromClient for CodecDelaySynchronousProxy {
4221 type Protocol = CodecDelayMarker;
4222
4223 fn from_client(value: fidl::endpoints::ClientEnd<CodecDelayMarker>) -> Self {
4224 Self::new(value.into_channel())
4225 }
4226}
4227
4228#[derive(Debug, Clone)]
4229pub struct CodecDelayProxy {
4230 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4231}
4232
4233impl fidl::endpoints::Proxy for CodecDelayProxy {
4234 type Protocol = CodecDelayMarker;
4235
4236 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4237 Self::new(inner)
4238 }
4239
4240 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4241 self.client.into_channel().map_err(|client| Self { client })
4242 }
4243
4244 fn as_channel(&self) -> &::fidl::AsyncChannel {
4245 self.client.as_channel()
4246 }
4247}
4248
4249impl CodecDelayProxy {
4250 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4252 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4253 Self { client: fidl::client::Client::new(channel, protocol_name) }
4254 }
4255
4256 pub fn take_event_stream(&self) -> CodecDelayEventStream {
4262 CodecDelayEventStream { event_receiver: self.client.take_event_receiver() }
4263 }
4264
4265 pub fn r#get_codec_local_delay_range(
4273 &self,
4274 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4275 ) -> fidl::client::QueryResponseFut<
4276 CodecDelayGetCodecLocalDelayRangeResult,
4277 fidl::encoding::DefaultFuchsiaResourceDialect,
4278 > {
4279 CodecDelayProxyInterface::r#get_codec_local_delay_range(self, payload)
4280 }
4281}
4282
4283impl CodecDelayProxyInterface for CodecDelayProxy {
4284 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
4285 CodecDelayGetCodecLocalDelayRangeResult,
4286 fidl::encoding::DefaultFuchsiaResourceDialect,
4287 >;
4288 fn r#get_codec_local_delay_range(
4289 &self,
4290 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4291 ) -> Self::GetCodecLocalDelayRangeResponseFut {
4292 fn _decode(
4293 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4294 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4295 let _response = fidl::client::decode_transaction_body::<
4296 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4297 fidl::encoding::DefaultFuchsiaResourceDialect,
4298 0x1cf34fdeed80b4d,
4299 >(_buf?)?;
4300 Ok(_response.map(|x| x))
4301 }
4302 self.client.send_query_and_decode::<
4303 CodecDelayGetCodecLocalDelayRangeRequest,
4304 CodecDelayGetCodecLocalDelayRangeResult,
4305 >(
4306 payload,
4307 0x1cf34fdeed80b4d,
4308 fidl::encoding::DynamicFlags::empty(),
4309 _decode,
4310 )
4311 }
4312}
4313
4314pub struct CodecDelayEventStream {
4315 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4316}
4317
4318impl std::marker::Unpin for CodecDelayEventStream {}
4319
4320impl futures::stream::FusedStream for CodecDelayEventStream {
4321 fn is_terminated(&self) -> bool {
4322 self.event_receiver.is_terminated()
4323 }
4324}
4325
4326impl futures::Stream for CodecDelayEventStream {
4327 type Item = Result<CodecDelayEvent, fidl::Error>;
4328
4329 fn poll_next(
4330 mut self: std::pin::Pin<&mut Self>,
4331 cx: &mut std::task::Context<'_>,
4332 ) -> std::task::Poll<Option<Self::Item>> {
4333 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4334 &mut self.event_receiver,
4335 cx
4336 )?) {
4337 Some(buf) => std::task::Poll::Ready(Some(CodecDelayEvent::decode(buf))),
4338 None => std::task::Poll::Ready(None),
4339 }
4340 }
4341}
4342
4343#[derive(Debug)]
4344pub enum CodecDelayEvent {}
4345
4346impl CodecDelayEvent {
4347 fn decode(
4349 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4350 ) -> Result<CodecDelayEvent, fidl::Error> {
4351 let (bytes, _handles) = buf.split_mut();
4352 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4353 debug_assert_eq!(tx_header.tx_id, 0);
4354 match tx_header.ordinal {
4355 _ => Err(fidl::Error::UnknownOrdinal {
4356 ordinal: tx_header.ordinal,
4357 protocol_name: <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4358 }),
4359 }
4360 }
4361}
4362
4363pub struct CodecDelayRequestStream {
4365 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4366 is_terminated: bool,
4367}
4368
4369impl std::marker::Unpin for CodecDelayRequestStream {}
4370
4371impl futures::stream::FusedStream for CodecDelayRequestStream {
4372 fn is_terminated(&self) -> bool {
4373 self.is_terminated
4374 }
4375}
4376
4377impl fidl::endpoints::RequestStream for CodecDelayRequestStream {
4378 type Protocol = CodecDelayMarker;
4379 type ControlHandle = CodecDelayControlHandle;
4380
4381 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4382 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4383 }
4384
4385 fn control_handle(&self) -> Self::ControlHandle {
4386 CodecDelayControlHandle { inner: self.inner.clone() }
4387 }
4388
4389 fn into_inner(
4390 self,
4391 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4392 {
4393 (self.inner, self.is_terminated)
4394 }
4395
4396 fn from_inner(
4397 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4398 is_terminated: bool,
4399 ) -> Self {
4400 Self { inner, is_terminated }
4401 }
4402}
4403
4404impl futures::Stream for CodecDelayRequestStream {
4405 type Item = Result<CodecDelayRequest, fidl::Error>;
4406
4407 fn poll_next(
4408 mut self: std::pin::Pin<&mut Self>,
4409 cx: &mut std::task::Context<'_>,
4410 ) -> std::task::Poll<Option<Self::Item>> {
4411 let this = &mut *self;
4412 if this.inner.check_shutdown(cx) {
4413 this.is_terminated = true;
4414 return std::task::Poll::Ready(None);
4415 }
4416 if this.is_terminated {
4417 panic!("polled CodecDelayRequestStream after completion");
4418 }
4419 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4420 |bytes, handles| {
4421 match this.inner.channel().read_etc(cx, bytes, handles) {
4422 std::task::Poll::Ready(Ok(())) => {}
4423 std::task::Poll::Pending => return std::task::Poll::Pending,
4424 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4425 this.is_terminated = true;
4426 return std::task::Poll::Ready(None);
4427 }
4428 std::task::Poll::Ready(Err(e)) => {
4429 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4430 e.into(),
4431 ))))
4432 }
4433 }
4434
4435 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4437
4438 std::task::Poll::Ready(Some(match header.ordinal {
4439 0x1cf34fdeed80b4d => {
4440 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4441 let mut req = fidl::new_empty!(
4442 CodecDelayGetCodecLocalDelayRangeRequest,
4443 fidl::encoding::DefaultFuchsiaResourceDialect
4444 );
4445 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
4446 let control_handle = CodecDelayControlHandle { inner: this.inner.clone() };
4447 Ok(CodecDelayRequest::GetCodecLocalDelayRange {
4448 payload: req,
4449 responder: CodecDelayGetCodecLocalDelayRangeResponder {
4450 control_handle: std::mem::ManuallyDrop::new(control_handle),
4451 tx_id: header.tx_id,
4452 },
4453 })
4454 }
4455 _ => Err(fidl::Error::UnknownOrdinal {
4456 ordinal: header.ordinal,
4457 protocol_name:
4458 <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4459 }),
4460 }))
4461 },
4462 )
4463 }
4464}
4465
4466#[derive(Debug)]
4469pub enum CodecDelayRequest {
4470 GetCodecLocalDelayRange {
4478 payload: CodecDelayGetCodecLocalDelayRangeRequest,
4479 responder: CodecDelayGetCodecLocalDelayRangeResponder,
4480 },
4481}
4482
4483impl CodecDelayRequest {
4484 #[allow(irrefutable_let_patterns)]
4485 pub fn into_get_codec_local_delay_range(
4486 self,
4487 ) -> Option<(
4488 CodecDelayGetCodecLocalDelayRangeRequest,
4489 CodecDelayGetCodecLocalDelayRangeResponder,
4490 )> {
4491 if let CodecDelayRequest::GetCodecLocalDelayRange { payload, responder } = self {
4492 Some((payload, responder))
4493 } else {
4494 None
4495 }
4496 }
4497
4498 pub fn method_name(&self) -> &'static str {
4500 match *self {
4501 CodecDelayRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
4502 }
4503 }
4504}
4505
4506#[derive(Debug, Clone)]
4507pub struct CodecDelayControlHandle {
4508 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4509}
4510
4511impl fidl::endpoints::ControlHandle for CodecDelayControlHandle {
4512 fn shutdown(&self) {
4513 self.inner.shutdown()
4514 }
4515 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4516 self.inner.shutdown_with_epitaph(status)
4517 }
4518
4519 fn is_closed(&self) -> bool {
4520 self.inner.channel().is_closed()
4521 }
4522 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4523 self.inner.channel().on_closed()
4524 }
4525
4526 #[cfg(target_os = "fuchsia")]
4527 fn signal_peer(
4528 &self,
4529 clear_mask: zx::Signals,
4530 set_mask: zx::Signals,
4531 ) -> Result<(), zx_status::Status> {
4532 use fidl::Peered;
4533 self.inner.channel().signal_peer(clear_mask, set_mask)
4534 }
4535}
4536
4537impl CodecDelayControlHandle {}
4538
4539#[must_use = "FIDL methods require a response to be sent"]
4540#[derive(Debug)]
4541pub struct CodecDelayGetCodecLocalDelayRangeResponder {
4542 control_handle: std::mem::ManuallyDrop<CodecDelayControlHandle>,
4543 tx_id: u32,
4544}
4545
4546impl std::ops::Drop for CodecDelayGetCodecLocalDelayRangeResponder {
4550 fn drop(&mut self) {
4551 self.control_handle.shutdown();
4552 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4554 }
4555}
4556
4557impl fidl::endpoints::Responder for CodecDelayGetCodecLocalDelayRangeResponder {
4558 type ControlHandle = CodecDelayControlHandle;
4559
4560 fn control_handle(&self) -> &CodecDelayControlHandle {
4561 &self.control_handle
4562 }
4563
4564 fn drop_without_shutdown(mut self) {
4565 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4567 std::mem::forget(self);
4569 }
4570}
4571
4572impl CodecDelayGetCodecLocalDelayRangeResponder {
4573 pub fn send(
4577 self,
4578 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4579 ) -> Result<(), fidl::Error> {
4580 let _result = self.send_raw(result);
4581 if _result.is_err() {
4582 self.control_handle.shutdown();
4583 }
4584 self.drop_without_shutdown();
4585 _result
4586 }
4587
4588 pub fn send_no_shutdown_on_err(
4590 self,
4591 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4592 ) -> Result<(), fidl::Error> {
4593 let _result = self.send_raw(result);
4594 self.drop_without_shutdown();
4595 _result
4596 }
4597
4598 fn send_raw(
4599 &self,
4600 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4601 ) -> Result<(), fidl::Error> {
4602 self.control_handle.inner.send::<fidl::encoding::ResultType<
4603 CodecDelayGetCodecLocalDelayRangeResponse,
4604 i32,
4605 >>(
4606 result,
4607 self.tx_id,
4608 0x1cf34fdeed80b4d,
4609 fidl::encoding::DynamicFlags::empty(),
4610 )
4611 }
4612}
4613
4614#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4615pub struct ConnectedIsochronousGroupMarker;
4616
4617impl fidl::endpoints::ProtocolMarker for ConnectedIsochronousGroupMarker {
4618 type Proxy = ConnectedIsochronousGroupProxy;
4619 type RequestStream = ConnectedIsochronousGroupRequestStream;
4620 #[cfg(target_os = "fuchsia")]
4621 type SynchronousProxy = ConnectedIsochronousGroupSynchronousProxy;
4622
4623 const DEBUG_NAME: &'static str = "(anonymous) ConnectedIsochronousGroup";
4624}
4625pub type ConnectedIsochronousGroupEstablishStreamsResult = Result<(), EstablishStreamsError>;
4626
4627pub trait ConnectedIsochronousGroupProxyInterface: Send + Sync {
4628 type EstablishStreamsResponseFut: std::future::Future<
4629 Output = Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error>,
4630 > + Send;
4631 fn r#establish_streams(
4632 &self,
4633 payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4634 ) -> Self::EstablishStreamsResponseFut;
4635 fn r#remove(&self) -> Result<(), fidl::Error>;
4636}
4637#[derive(Debug)]
4638#[cfg(target_os = "fuchsia")]
4639pub struct ConnectedIsochronousGroupSynchronousProxy {
4640 client: fidl::client::sync::Client,
4641}
4642
4643#[cfg(target_os = "fuchsia")]
4644impl fidl::endpoints::SynchronousProxy for ConnectedIsochronousGroupSynchronousProxy {
4645 type Proxy = ConnectedIsochronousGroupProxy;
4646 type Protocol = ConnectedIsochronousGroupMarker;
4647
4648 fn from_channel(inner: fidl::Channel) -> Self {
4649 Self::new(inner)
4650 }
4651
4652 fn into_channel(self) -> fidl::Channel {
4653 self.client.into_channel()
4654 }
4655
4656 fn as_channel(&self) -> &fidl::Channel {
4657 self.client.as_channel()
4658 }
4659}
4660
4661#[cfg(target_os = "fuchsia")]
4662impl ConnectedIsochronousGroupSynchronousProxy {
4663 pub fn new(channel: fidl::Channel) -> Self {
4664 let protocol_name =
4665 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4666 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4667 }
4668
4669 pub fn into_channel(self) -> fidl::Channel {
4670 self.client.into_channel()
4671 }
4672
4673 pub fn wait_for_event(
4676 &self,
4677 deadline: zx::MonotonicInstant,
4678 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4679 ConnectedIsochronousGroupEvent::decode(self.client.wait_for_event(deadline)?)
4680 }
4681
4682 pub fn r#establish_streams(
4691 &self,
4692 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4693 ___deadline: zx::MonotonicInstant,
4694 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4695 let _response = self.client.send_query::<
4696 ConnectedIsochronousGroupEstablishStreamsRequest,
4697 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EstablishStreamsError>,
4698 >(
4699 payload,
4700 0xc7296c5edb4dacc,
4701 fidl::encoding::DynamicFlags::FLEXIBLE,
4702 ___deadline,
4703 )?
4704 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4705 Ok(_response.map(|x| x))
4706 }
4707
4708 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4711 self.client.send::<fidl::encoding::EmptyPayload>(
4712 (),
4713 0xbed433babd20503,
4714 fidl::encoding::DynamicFlags::FLEXIBLE,
4715 )
4716 }
4717}
4718
4719#[cfg(target_os = "fuchsia")]
4720impl From<ConnectedIsochronousGroupSynchronousProxy> for zx::Handle {
4721 fn from(value: ConnectedIsochronousGroupSynchronousProxy) -> Self {
4722 value.into_channel().into()
4723 }
4724}
4725
4726#[cfg(target_os = "fuchsia")]
4727impl From<fidl::Channel> for ConnectedIsochronousGroupSynchronousProxy {
4728 fn from(value: fidl::Channel) -> Self {
4729 Self::new(value)
4730 }
4731}
4732
4733#[cfg(target_os = "fuchsia")]
4734impl fidl::endpoints::FromClient for ConnectedIsochronousGroupSynchronousProxy {
4735 type Protocol = ConnectedIsochronousGroupMarker;
4736
4737 fn from_client(value: fidl::endpoints::ClientEnd<ConnectedIsochronousGroupMarker>) -> Self {
4738 Self::new(value.into_channel())
4739 }
4740}
4741
4742#[derive(Debug, Clone)]
4743pub struct ConnectedIsochronousGroupProxy {
4744 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4745}
4746
4747impl fidl::endpoints::Proxy for ConnectedIsochronousGroupProxy {
4748 type Protocol = ConnectedIsochronousGroupMarker;
4749
4750 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4751 Self::new(inner)
4752 }
4753
4754 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4755 self.client.into_channel().map_err(|client| Self { client })
4756 }
4757
4758 fn as_channel(&self) -> &::fidl::AsyncChannel {
4759 self.client.as_channel()
4760 }
4761}
4762
4763impl ConnectedIsochronousGroupProxy {
4764 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4766 let protocol_name =
4767 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4768 Self { client: fidl::client::Client::new(channel, protocol_name) }
4769 }
4770
4771 pub fn take_event_stream(&self) -> ConnectedIsochronousGroupEventStream {
4777 ConnectedIsochronousGroupEventStream { event_receiver: self.client.take_event_receiver() }
4778 }
4779
4780 pub fn r#establish_streams(
4789 &self,
4790 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4791 ) -> fidl::client::QueryResponseFut<
4792 ConnectedIsochronousGroupEstablishStreamsResult,
4793 fidl::encoding::DefaultFuchsiaResourceDialect,
4794 > {
4795 ConnectedIsochronousGroupProxyInterface::r#establish_streams(self, payload)
4796 }
4797
4798 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4801 ConnectedIsochronousGroupProxyInterface::r#remove(self)
4802 }
4803}
4804
4805impl ConnectedIsochronousGroupProxyInterface for ConnectedIsochronousGroupProxy {
4806 type EstablishStreamsResponseFut = fidl::client::QueryResponseFut<
4807 ConnectedIsochronousGroupEstablishStreamsResult,
4808 fidl::encoding::DefaultFuchsiaResourceDialect,
4809 >;
4810 fn r#establish_streams(
4811 &self,
4812 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4813 ) -> Self::EstablishStreamsResponseFut {
4814 fn _decode(
4815 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4816 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4817 let _response = fidl::client::decode_transaction_body::<
4818 fidl::encoding::FlexibleResultType<
4819 fidl::encoding::EmptyStruct,
4820 EstablishStreamsError,
4821 >,
4822 fidl::encoding::DefaultFuchsiaResourceDialect,
4823 0xc7296c5edb4dacc,
4824 >(_buf?)?
4825 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4826 Ok(_response.map(|x| x))
4827 }
4828 self.client.send_query_and_decode::<
4829 ConnectedIsochronousGroupEstablishStreamsRequest,
4830 ConnectedIsochronousGroupEstablishStreamsResult,
4831 >(
4832 payload,
4833 0xc7296c5edb4dacc,
4834 fidl::encoding::DynamicFlags::FLEXIBLE,
4835 _decode,
4836 )
4837 }
4838
4839 fn r#remove(&self) -> Result<(), fidl::Error> {
4840 self.client.send::<fidl::encoding::EmptyPayload>(
4841 (),
4842 0xbed433babd20503,
4843 fidl::encoding::DynamicFlags::FLEXIBLE,
4844 )
4845 }
4846}
4847
4848pub struct ConnectedIsochronousGroupEventStream {
4849 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4850}
4851
4852impl std::marker::Unpin for ConnectedIsochronousGroupEventStream {}
4853
4854impl futures::stream::FusedStream for ConnectedIsochronousGroupEventStream {
4855 fn is_terminated(&self) -> bool {
4856 self.event_receiver.is_terminated()
4857 }
4858}
4859
4860impl futures::Stream for ConnectedIsochronousGroupEventStream {
4861 type Item = Result<ConnectedIsochronousGroupEvent, fidl::Error>;
4862
4863 fn poll_next(
4864 mut self: std::pin::Pin<&mut Self>,
4865 cx: &mut std::task::Context<'_>,
4866 ) -> std::task::Poll<Option<Self::Item>> {
4867 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4868 &mut self.event_receiver,
4869 cx
4870 )?) {
4871 Some(buf) => std::task::Poll::Ready(Some(ConnectedIsochronousGroupEvent::decode(buf))),
4872 None => std::task::Poll::Ready(None),
4873 }
4874 }
4875}
4876
4877#[derive(Debug)]
4878pub enum ConnectedIsochronousGroupEvent {
4879 #[non_exhaustive]
4880 _UnknownEvent {
4881 ordinal: u64,
4883 },
4884}
4885
4886impl ConnectedIsochronousGroupEvent {
4887 fn decode(
4889 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4890 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4891 let (bytes, _handles) = buf.split_mut();
4892 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4893 debug_assert_eq!(tx_header.tx_id, 0);
4894 match tx_header.ordinal {
4895 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4896 Ok(ConnectedIsochronousGroupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4897 }
4898 _ => Err(fidl::Error::UnknownOrdinal {
4899 ordinal: tx_header.ordinal,
4900 protocol_name:
4901 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4902 }),
4903 }
4904 }
4905}
4906
4907pub struct ConnectedIsochronousGroupRequestStream {
4909 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4910 is_terminated: bool,
4911}
4912
4913impl std::marker::Unpin for ConnectedIsochronousGroupRequestStream {}
4914
4915impl futures::stream::FusedStream for ConnectedIsochronousGroupRequestStream {
4916 fn is_terminated(&self) -> bool {
4917 self.is_terminated
4918 }
4919}
4920
4921impl fidl::endpoints::RequestStream for ConnectedIsochronousGroupRequestStream {
4922 type Protocol = ConnectedIsochronousGroupMarker;
4923 type ControlHandle = ConnectedIsochronousGroupControlHandle;
4924
4925 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4926 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4927 }
4928
4929 fn control_handle(&self) -> Self::ControlHandle {
4930 ConnectedIsochronousGroupControlHandle { inner: self.inner.clone() }
4931 }
4932
4933 fn into_inner(
4934 self,
4935 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4936 {
4937 (self.inner, self.is_terminated)
4938 }
4939
4940 fn from_inner(
4941 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4942 is_terminated: bool,
4943 ) -> Self {
4944 Self { inner, is_terminated }
4945 }
4946}
4947
4948impl futures::Stream for ConnectedIsochronousGroupRequestStream {
4949 type Item = Result<ConnectedIsochronousGroupRequest, fidl::Error>;
4950
4951 fn poll_next(
4952 mut self: std::pin::Pin<&mut Self>,
4953 cx: &mut std::task::Context<'_>,
4954 ) -> std::task::Poll<Option<Self::Item>> {
4955 let this = &mut *self;
4956 if this.inner.check_shutdown(cx) {
4957 this.is_terminated = true;
4958 return std::task::Poll::Ready(None);
4959 }
4960 if this.is_terminated {
4961 panic!("polled ConnectedIsochronousGroupRequestStream after completion");
4962 }
4963 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4964 |bytes, handles| {
4965 match this.inner.channel().read_etc(cx, bytes, handles) {
4966 std::task::Poll::Ready(Ok(())) => {}
4967 std::task::Poll::Pending => return std::task::Poll::Pending,
4968 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4969 this.is_terminated = true;
4970 return std::task::Poll::Ready(None);
4971 }
4972 std::task::Poll::Ready(Err(e)) => {
4973 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4974 e.into(),
4975 ))))
4976 }
4977 }
4978
4979 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4981
4982 std::task::Poll::Ready(Some(match header.ordinal {
4983 0xc7296c5edb4dacc => {
4984 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4985 let mut req = fidl::new_empty!(ConnectedIsochronousGroupEstablishStreamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4986 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectedIsochronousGroupEstablishStreamsRequest>(&header, _body_bytes, handles, &mut req)?;
4987 let control_handle = ConnectedIsochronousGroupControlHandle {
4988 inner: this.inner.clone(),
4989 };
4990 Ok(ConnectedIsochronousGroupRequest::EstablishStreams {payload: req,
4991 responder: ConnectedIsochronousGroupEstablishStreamsResponder {
4992 control_handle: std::mem::ManuallyDrop::new(control_handle),
4993 tx_id: header.tx_id,
4994 },
4995 })
4996 }
4997 0xbed433babd20503 => {
4998 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4999 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5000 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5001 let control_handle = ConnectedIsochronousGroupControlHandle {
5002 inner: this.inner.clone(),
5003 };
5004 Ok(ConnectedIsochronousGroupRequest::Remove {
5005 control_handle,
5006 })
5007 }
5008 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5009 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5010 ordinal: header.ordinal,
5011 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5012 method_type: fidl::MethodType::OneWay,
5013 })
5014 }
5015 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5016 this.inner.send_framework_err(
5017 fidl::encoding::FrameworkErr::UnknownMethod,
5018 header.tx_id,
5019 header.ordinal,
5020 header.dynamic_flags(),
5021 (bytes, handles),
5022 )?;
5023 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5024 ordinal: header.ordinal,
5025 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5026 method_type: fidl::MethodType::TwoWay,
5027 })
5028 }
5029 _ => Err(fidl::Error::UnknownOrdinal {
5030 ordinal: header.ordinal,
5031 protocol_name: <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5032 }),
5033 }))
5034 },
5035 )
5036 }
5037}
5038
5039#[derive(Debug)]
5040pub enum ConnectedIsochronousGroupRequest {
5041 EstablishStreams {
5050 payload: ConnectedIsochronousGroupEstablishStreamsRequest,
5051 responder: ConnectedIsochronousGroupEstablishStreamsResponder,
5052 },
5053 Remove { control_handle: ConnectedIsochronousGroupControlHandle },
5056 #[non_exhaustive]
5058 _UnknownMethod {
5059 ordinal: u64,
5061 control_handle: ConnectedIsochronousGroupControlHandle,
5062 method_type: fidl::MethodType,
5063 },
5064}
5065
5066impl ConnectedIsochronousGroupRequest {
5067 #[allow(irrefutable_let_patterns)]
5068 pub fn into_establish_streams(
5069 self,
5070 ) -> Option<(
5071 ConnectedIsochronousGroupEstablishStreamsRequest,
5072 ConnectedIsochronousGroupEstablishStreamsResponder,
5073 )> {
5074 if let ConnectedIsochronousGroupRequest::EstablishStreams { payload, responder } = self {
5075 Some((payload, responder))
5076 } else {
5077 None
5078 }
5079 }
5080
5081 #[allow(irrefutable_let_patterns)]
5082 pub fn into_remove(self) -> Option<(ConnectedIsochronousGroupControlHandle)> {
5083 if let ConnectedIsochronousGroupRequest::Remove { control_handle } = self {
5084 Some((control_handle))
5085 } else {
5086 None
5087 }
5088 }
5089
5090 pub fn method_name(&self) -> &'static str {
5092 match *self {
5093 ConnectedIsochronousGroupRequest::EstablishStreams { .. } => "establish_streams",
5094 ConnectedIsochronousGroupRequest::Remove { .. } => "remove",
5095 ConnectedIsochronousGroupRequest::_UnknownMethod {
5096 method_type: fidl::MethodType::OneWay,
5097 ..
5098 } => "unknown one-way method",
5099 ConnectedIsochronousGroupRequest::_UnknownMethod {
5100 method_type: fidl::MethodType::TwoWay,
5101 ..
5102 } => "unknown two-way method",
5103 }
5104 }
5105}
5106
5107#[derive(Debug, Clone)]
5108pub struct ConnectedIsochronousGroupControlHandle {
5109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5110}
5111
5112impl fidl::endpoints::ControlHandle for ConnectedIsochronousGroupControlHandle {
5113 fn shutdown(&self) {
5114 self.inner.shutdown()
5115 }
5116 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5117 self.inner.shutdown_with_epitaph(status)
5118 }
5119
5120 fn is_closed(&self) -> bool {
5121 self.inner.channel().is_closed()
5122 }
5123 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5124 self.inner.channel().on_closed()
5125 }
5126
5127 #[cfg(target_os = "fuchsia")]
5128 fn signal_peer(
5129 &self,
5130 clear_mask: zx::Signals,
5131 set_mask: zx::Signals,
5132 ) -> Result<(), zx_status::Status> {
5133 use fidl::Peered;
5134 self.inner.channel().signal_peer(clear_mask, set_mask)
5135 }
5136}
5137
5138impl ConnectedIsochronousGroupControlHandle {}
5139
5140#[must_use = "FIDL methods require a response to be sent"]
5141#[derive(Debug)]
5142pub struct ConnectedIsochronousGroupEstablishStreamsResponder {
5143 control_handle: std::mem::ManuallyDrop<ConnectedIsochronousGroupControlHandle>,
5144 tx_id: u32,
5145}
5146
5147impl std::ops::Drop for ConnectedIsochronousGroupEstablishStreamsResponder {
5151 fn drop(&mut self) {
5152 self.control_handle.shutdown();
5153 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5155 }
5156}
5157
5158impl fidl::endpoints::Responder for ConnectedIsochronousGroupEstablishStreamsResponder {
5159 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5160
5161 fn control_handle(&self) -> &ConnectedIsochronousGroupControlHandle {
5162 &self.control_handle
5163 }
5164
5165 fn drop_without_shutdown(mut self) {
5166 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5168 std::mem::forget(self);
5170 }
5171}
5172
5173impl ConnectedIsochronousGroupEstablishStreamsResponder {
5174 pub fn send(self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5178 let _result = self.send_raw(result);
5179 if _result.is_err() {
5180 self.control_handle.shutdown();
5181 }
5182 self.drop_without_shutdown();
5183 _result
5184 }
5185
5186 pub fn send_no_shutdown_on_err(
5188 self,
5189 mut result: Result<(), EstablishStreamsError>,
5190 ) -> Result<(), fidl::Error> {
5191 let _result = self.send_raw(result);
5192 self.drop_without_shutdown();
5193 _result
5194 }
5195
5196 fn send_raw(&self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5197 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5198 fidl::encoding::EmptyStruct,
5199 EstablishStreamsError,
5200 >>(
5201 fidl::encoding::FlexibleResult::new(result),
5202 self.tx_id,
5203 0xc7296c5edb4dacc,
5204 fidl::encoding::DynamicFlags::FLEXIBLE,
5205 )
5206 }
5207}
5208
5209#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5210pub struct ConnectionMarker;
5211
5212impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
5213 type Proxy = ConnectionProxy;
5214 type RequestStream = ConnectionRequestStream;
5215 #[cfg(target_os = "fuchsia")]
5216 type SynchronousProxy = ConnectionSynchronousProxy;
5217
5218 const DEBUG_NAME: &'static str = "(anonymous) Connection";
5219}
5220
5221pub trait ConnectionProxyInterface: Send + Sync {
5222 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
5223 + Send;
5224 fn r#get_codec_local_delay_range(
5225 &self,
5226 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5227 ) -> Self::GetCodecLocalDelayRangeResponseFut;
5228 fn r#request_gatt_client(
5229 &self,
5230 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5231 ) -> Result<(), fidl::Error>;
5232 fn r#accept_cis(&self, payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error>;
5233 fn r#connect_l2cap(&self, payload: ConnectionConnectL2capRequest) -> Result<(), fidl::Error>;
5234}
5235#[derive(Debug)]
5236#[cfg(target_os = "fuchsia")]
5237pub struct ConnectionSynchronousProxy {
5238 client: fidl::client::sync::Client,
5239}
5240
5241#[cfg(target_os = "fuchsia")]
5242impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
5243 type Proxy = ConnectionProxy;
5244 type Protocol = ConnectionMarker;
5245
5246 fn from_channel(inner: fidl::Channel) -> Self {
5247 Self::new(inner)
5248 }
5249
5250 fn into_channel(self) -> fidl::Channel {
5251 self.client.into_channel()
5252 }
5253
5254 fn as_channel(&self) -> &fidl::Channel {
5255 self.client.as_channel()
5256 }
5257}
5258
5259#[cfg(target_os = "fuchsia")]
5260impl ConnectionSynchronousProxy {
5261 pub fn new(channel: fidl::Channel) -> Self {
5262 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5263 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5264 }
5265
5266 pub fn into_channel(self) -> fidl::Channel {
5267 self.client.into_channel()
5268 }
5269
5270 pub fn wait_for_event(
5273 &self,
5274 deadline: zx::MonotonicInstant,
5275 ) -> Result<ConnectionEvent, fidl::Error> {
5276 ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
5277 }
5278
5279 pub fn r#get_codec_local_delay_range(
5287 &self,
5288 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5289 ___deadline: zx::MonotonicInstant,
5290 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5291 let _response = self.client.send_query::<
5292 CodecDelayGetCodecLocalDelayRangeRequest,
5293 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5294 >(
5295 payload,
5296 0x1cf34fdeed80b4d,
5297 fidl::encoding::DynamicFlags::empty(),
5298 ___deadline,
5299 )?;
5300 Ok(_response.map(|x| x))
5301 }
5302
5303 pub fn r#request_gatt_client(
5307 &self,
5308 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5309 ) -> Result<(), fidl::Error> {
5310 self.client.send::<ConnectionRequestGattClientRequest>(
5311 (client,),
5312 0x2a670e0fec6ccc6b,
5313 fidl::encoding::DynamicFlags::empty(),
5314 )
5315 }
5316
5317 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5332 self.client.send::<ConnectionAcceptCisRequest>(
5333 &mut payload,
5334 0x7e6338c237088144,
5335 fidl::encoding::DynamicFlags::empty(),
5336 )
5337 }
5338
5339 pub fn r#connect_l2cap(
5341 &self,
5342 mut payload: ConnectionConnectL2capRequest,
5343 ) -> Result<(), fidl::Error> {
5344 self.client.send::<ConnectionConnectL2capRequest>(
5345 &mut payload,
5346 0x12351316feaebce9,
5347 fidl::encoding::DynamicFlags::empty(),
5348 )
5349 }
5350}
5351
5352#[cfg(target_os = "fuchsia")]
5353impl From<ConnectionSynchronousProxy> for zx::Handle {
5354 fn from(value: ConnectionSynchronousProxy) -> Self {
5355 value.into_channel().into()
5356 }
5357}
5358
5359#[cfg(target_os = "fuchsia")]
5360impl From<fidl::Channel> for ConnectionSynchronousProxy {
5361 fn from(value: fidl::Channel) -> Self {
5362 Self::new(value)
5363 }
5364}
5365
5366#[cfg(target_os = "fuchsia")]
5367impl fidl::endpoints::FromClient for ConnectionSynchronousProxy {
5368 type Protocol = ConnectionMarker;
5369
5370 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionMarker>) -> Self {
5371 Self::new(value.into_channel())
5372 }
5373}
5374
5375#[derive(Debug, Clone)]
5376pub struct ConnectionProxy {
5377 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5378}
5379
5380impl fidl::endpoints::Proxy for ConnectionProxy {
5381 type Protocol = ConnectionMarker;
5382
5383 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5384 Self::new(inner)
5385 }
5386
5387 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5388 self.client.into_channel().map_err(|client| Self { client })
5389 }
5390
5391 fn as_channel(&self) -> &::fidl::AsyncChannel {
5392 self.client.as_channel()
5393 }
5394}
5395
5396impl ConnectionProxy {
5397 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5399 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5400 Self { client: fidl::client::Client::new(channel, protocol_name) }
5401 }
5402
5403 pub fn take_event_stream(&self) -> ConnectionEventStream {
5409 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
5410 }
5411
5412 pub fn r#get_codec_local_delay_range(
5420 &self,
5421 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5422 ) -> fidl::client::QueryResponseFut<
5423 CodecDelayGetCodecLocalDelayRangeResult,
5424 fidl::encoding::DefaultFuchsiaResourceDialect,
5425 > {
5426 ConnectionProxyInterface::r#get_codec_local_delay_range(self, payload)
5427 }
5428
5429 pub fn r#request_gatt_client(
5433 &self,
5434 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5435 ) -> Result<(), fidl::Error> {
5436 ConnectionProxyInterface::r#request_gatt_client(self, client)
5437 }
5438
5439 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5454 ConnectionProxyInterface::r#accept_cis(self, payload)
5455 }
5456
5457 pub fn r#connect_l2cap(
5459 &self,
5460 mut payload: ConnectionConnectL2capRequest,
5461 ) -> Result<(), fidl::Error> {
5462 ConnectionProxyInterface::r#connect_l2cap(self, payload)
5463 }
5464}
5465
5466impl ConnectionProxyInterface for ConnectionProxy {
5467 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
5468 CodecDelayGetCodecLocalDelayRangeResult,
5469 fidl::encoding::DefaultFuchsiaResourceDialect,
5470 >;
5471 fn r#get_codec_local_delay_range(
5472 &self,
5473 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5474 ) -> Self::GetCodecLocalDelayRangeResponseFut {
5475 fn _decode(
5476 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5477 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5478 let _response = fidl::client::decode_transaction_body::<
5479 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5480 fidl::encoding::DefaultFuchsiaResourceDialect,
5481 0x1cf34fdeed80b4d,
5482 >(_buf?)?;
5483 Ok(_response.map(|x| x))
5484 }
5485 self.client.send_query_and_decode::<
5486 CodecDelayGetCodecLocalDelayRangeRequest,
5487 CodecDelayGetCodecLocalDelayRangeResult,
5488 >(
5489 payload,
5490 0x1cf34fdeed80b4d,
5491 fidl::encoding::DynamicFlags::empty(),
5492 _decode,
5493 )
5494 }
5495
5496 fn r#request_gatt_client(
5497 &self,
5498 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5499 ) -> Result<(), fidl::Error> {
5500 self.client.send::<ConnectionRequestGattClientRequest>(
5501 (client,),
5502 0x2a670e0fec6ccc6b,
5503 fidl::encoding::DynamicFlags::empty(),
5504 )
5505 }
5506
5507 fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5508 self.client.send::<ConnectionAcceptCisRequest>(
5509 &mut payload,
5510 0x7e6338c237088144,
5511 fidl::encoding::DynamicFlags::empty(),
5512 )
5513 }
5514
5515 fn r#connect_l2cap(
5516 &self,
5517 mut payload: ConnectionConnectL2capRequest,
5518 ) -> Result<(), fidl::Error> {
5519 self.client.send::<ConnectionConnectL2capRequest>(
5520 &mut payload,
5521 0x12351316feaebce9,
5522 fidl::encoding::DynamicFlags::empty(),
5523 )
5524 }
5525}
5526
5527pub struct ConnectionEventStream {
5528 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5529}
5530
5531impl std::marker::Unpin for ConnectionEventStream {}
5532
5533impl futures::stream::FusedStream for ConnectionEventStream {
5534 fn is_terminated(&self) -> bool {
5535 self.event_receiver.is_terminated()
5536 }
5537}
5538
5539impl futures::Stream for ConnectionEventStream {
5540 type Item = Result<ConnectionEvent, fidl::Error>;
5541
5542 fn poll_next(
5543 mut self: std::pin::Pin<&mut Self>,
5544 cx: &mut std::task::Context<'_>,
5545 ) -> std::task::Poll<Option<Self::Item>> {
5546 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5547 &mut self.event_receiver,
5548 cx
5549 )?) {
5550 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
5551 None => std::task::Poll::Ready(None),
5552 }
5553 }
5554}
5555
5556#[derive(Debug)]
5557pub enum ConnectionEvent {}
5558
5559impl ConnectionEvent {
5560 fn decode(
5562 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5563 ) -> Result<ConnectionEvent, fidl::Error> {
5564 let (bytes, _handles) = buf.split_mut();
5565 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5566 debug_assert_eq!(tx_header.tx_id, 0);
5567 match tx_header.ordinal {
5568 _ => Err(fidl::Error::UnknownOrdinal {
5569 ordinal: tx_header.ordinal,
5570 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5571 }),
5572 }
5573 }
5574}
5575
5576pub struct ConnectionRequestStream {
5578 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5579 is_terminated: bool,
5580}
5581
5582impl std::marker::Unpin for ConnectionRequestStream {}
5583
5584impl futures::stream::FusedStream for ConnectionRequestStream {
5585 fn is_terminated(&self) -> bool {
5586 self.is_terminated
5587 }
5588}
5589
5590impl fidl::endpoints::RequestStream for ConnectionRequestStream {
5591 type Protocol = ConnectionMarker;
5592 type ControlHandle = ConnectionControlHandle;
5593
5594 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5595 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5596 }
5597
5598 fn control_handle(&self) -> Self::ControlHandle {
5599 ConnectionControlHandle { inner: self.inner.clone() }
5600 }
5601
5602 fn into_inner(
5603 self,
5604 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5605 {
5606 (self.inner, self.is_terminated)
5607 }
5608
5609 fn from_inner(
5610 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5611 is_terminated: bool,
5612 ) -> Self {
5613 Self { inner, is_terminated }
5614 }
5615}
5616
5617impl futures::Stream for ConnectionRequestStream {
5618 type Item = Result<ConnectionRequest, fidl::Error>;
5619
5620 fn poll_next(
5621 mut self: std::pin::Pin<&mut Self>,
5622 cx: &mut std::task::Context<'_>,
5623 ) -> std::task::Poll<Option<Self::Item>> {
5624 let this = &mut *self;
5625 if this.inner.check_shutdown(cx) {
5626 this.is_terminated = true;
5627 return std::task::Poll::Ready(None);
5628 }
5629 if this.is_terminated {
5630 panic!("polled ConnectionRequestStream after completion");
5631 }
5632 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5633 |bytes, handles| {
5634 match this.inner.channel().read_etc(cx, bytes, handles) {
5635 std::task::Poll::Ready(Ok(())) => {}
5636 std::task::Poll::Pending => return std::task::Poll::Pending,
5637 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5638 this.is_terminated = true;
5639 return std::task::Poll::Ready(None);
5640 }
5641 std::task::Poll::Ready(Err(e)) => {
5642 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5643 e.into(),
5644 ))))
5645 }
5646 }
5647
5648 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5650
5651 std::task::Poll::Ready(Some(match header.ordinal {
5652 0x1cf34fdeed80b4d => {
5653 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5654 let mut req = fidl::new_empty!(
5655 CodecDelayGetCodecLocalDelayRangeRequest,
5656 fidl::encoding::DefaultFuchsiaResourceDialect
5657 );
5658 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
5659 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5660 Ok(ConnectionRequest::GetCodecLocalDelayRange {
5661 payload: req,
5662 responder: ConnectionGetCodecLocalDelayRangeResponder {
5663 control_handle: std::mem::ManuallyDrop::new(control_handle),
5664 tx_id: header.tx_id,
5665 },
5666 })
5667 }
5668 0x2a670e0fec6ccc6b => {
5669 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5670 let mut req = fidl::new_empty!(
5671 ConnectionRequestGattClientRequest,
5672 fidl::encoding::DefaultFuchsiaResourceDialect
5673 );
5674 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionRequestGattClientRequest>(&header, _body_bytes, handles, &mut req)?;
5675 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5676 Ok(ConnectionRequest::RequestGattClient {
5677 client: req.client,
5678
5679 control_handle,
5680 })
5681 }
5682 0x7e6338c237088144 => {
5683 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5684 let mut req = fidl::new_empty!(
5685 ConnectionAcceptCisRequest,
5686 fidl::encoding::DefaultFuchsiaResourceDialect
5687 );
5688 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptCisRequest>(&header, _body_bytes, handles, &mut req)?;
5689 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5690 Ok(ConnectionRequest::AcceptCis { payload: req, control_handle })
5691 }
5692 0x12351316feaebce9 => {
5693 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5694 let mut req = fidl::new_empty!(
5695 ConnectionConnectL2capRequest,
5696 fidl::encoding::DefaultFuchsiaResourceDialect
5697 );
5698 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionConnectL2capRequest>(&header, _body_bytes, handles, &mut req)?;
5699 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5700 Ok(ConnectionRequest::ConnectL2cap { payload: req, control_handle })
5701 }
5702 _ => Err(fidl::Error::UnknownOrdinal {
5703 ordinal: header.ordinal,
5704 protocol_name:
5705 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5706 }),
5707 }))
5708 },
5709 )
5710 }
5711}
5712
5713#[derive(Debug)]
5719pub enum ConnectionRequest {
5720 GetCodecLocalDelayRange {
5728 payload: CodecDelayGetCodecLocalDelayRangeRequest,
5729 responder: ConnectionGetCodecLocalDelayRangeResponder,
5730 },
5731 RequestGattClient {
5735 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5736 control_handle: ConnectionControlHandle,
5737 },
5738 AcceptCis { payload: ConnectionAcceptCisRequest, control_handle: ConnectionControlHandle },
5753 ConnectL2cap { payload: ConnectionConnectL2capRequest, control_handle: ConnectionControlHandle },
5755}
5756
5757impl ConnectionRequest {
5758 #[allow(irrefutable_let_patterns)]
5759 pub fn into_get_codec_local_delay_range(
5760 self,
5761 ) -> Option<(
5762 CodecDelayGetCodecLocalDelayRangeRequest,
5763 ConnectionGetCodecLocalDelayRangeResponder,
5764 )> {
5765 if let ConnectionRequest::GetCodecLocalDelayRange { payload, responder } = self {
5766 Some((payload, responder))
5767 } else {
5768 None
5769 }
5770 }
5771
5772 #[allow(irrefutable_let_patterns)]
5773 pub fn into_request_gatt_client(
5774 self,
5775 ) -> Option<(
5776 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5777 ConnectionControlHandle,
5778 )> {
5779 if let ConnectionRequest::RequestGattClient { client, control_handle } = self {
5780 Some((client, control_handle))
5781 } else {
5782 None
5783 }
5784 }
5785
5786 #[allow(irrefutable_let_patterns)]
5787 pub fn into_accept_cis(self) -> Option<(ConnectionAcceptCisRequest, ConnectionControlHandle)> {
5788 if let ConnectionRequest::AcceptCis { payload, control_handle } = self {
5789 Some((payload, control_handle))
5790 } else {
5791 None
5792 }
5793 }
5794
5795 #[allow(irrefutable_let_patterns)]
5796 pub fn into_connect_l2cap(
5797 self,
5798 ) -> Option<(ConnectionConnectL2capRequest, ConnectionControlHandle)> {
5799 if let ConnectionRequest::ConnectL2cap { payload, control_handle } = self {
5800 Some((payload, control_handle))
5801 } else {
5802 None
5803 }
5804 }
5805
5806 pub fn method_name(&self) -> &'static str {
5808 match *self {
5809 ConnectionRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
5810 ConnectionRequest::RequestGattClient { .. } => "request_gatt_client",
5811 ConnectionRequest::AcceptCis { .. } => "accept_cis",
5812 ConnectionRequest::ConnectL2cap { .. } => "connect_l2cap",
5813 }
5814 }
5815}
5816
5817#[derive(Debug, Clone)]
5818pub struct ConnectionControlHandle {
5819 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5820}
5821
5822impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
5823 fn shutdown(&self) {
5824 self.inner.shutdown()
5825 }
5826 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5827 self.inner.shutdown_with_epitaph(status)
5828 }
5829
5830 fn is_closed(&self) -> bool {
5831 self.inner.channel().is_closed()
5832 }
5833 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5834 self.inner.channel().on_closed()
5835 }
5836
5837 #[cfg(target_os = "fuchsia")]
5838 fn signal_peer(
5839 &self,
5840 clear_mask: zx::Signals,
5841 set_mask: zx::Signals,
5842 ) -> Result<(), zx_status::Status> {
5843 use fidl::Peered;
5844 self.inner.channel().signal_peer(clear_mask, set_mask)
5845 }
5846}
5847
5848impl ConnectionControlHandle {}
5849
5850#[must_use = "FIDL methods require a response to be sent"]
5851#[derive(Debug)]
5852pub struct ConnectionGetCodecLocalDelayRangeResponder {
5853 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
5854 tx_id: u32,
5855}
5856
5857impl std::ops::Drop for ConnectionGetCodecLocalDelayRangeResponder {
5861 fn drop(&mut self) {
5862 self.control_handle.shutdown();
5863 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5865 }
5866}
5867
5868impl fidl::endpoints::Responder for ConnectionGetCodecLocalDelayRangeResponder {
5869 type ControlHandle = ConnectionControlHandle;
5870
5871 fn control_handle(&self) -> &ConnectionControlHandle {
5872 &self.control_handle
5873 }
5874
5875 fn drop_without_shutdown(mut self) {
5876 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5878 std::mem::forget(self);
5880 }
5881}
5882
5883impl ConnectionGetCodecLocalDelayRangeResponder {
5884 pub fn send(
5888 self,
5889 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5890 ) -> Result<(), fidl::Error> {
5891 let _result = self.send_raw(result);
5892 if _result.is_err() {
5893 self.control_handle.shutdown();
5894 }
5895 self.drop_without_shutdown();
5896 _result
5897 }
5898
5899 pub fn send_no_shutdown_on_err(
5901 self,
5902 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5903 ) -> Result<(), fidl::Error> {
5904 let _result = self.send_raw(result);
5905 self.drop_without_shutdown();
5906 _result
5907 }
5908
5909 fn send_raw(
5910 &self,
5911 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5912 ) -> Result<(), fidl::Error> {
5913 self.control_handle.inner.send::<fidl::encoding::ResultType<
5914 CodecDelayGetCodecLocalDelayRangeResponse,
5915 i32,
5916 >>(
5917 result,
5918 self.tx_id,
5919 0x1cf34fdeed80b4d,
5920 fidl::encoding::DynamicFlags::empty(),
5921 )
5922 }
5923}
5924
5925#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5926pub struct IsochronousStreamMarker;
5927
5928impl fidl::endpoints::ProtocolMarker for IsochronousStreamMarker {
5929 type Proxy = IsochronousStreamProxy;
5930 type RequestStream = IsochronousStreamRequestStream;
5931 #[cfg(target_os = "fuchsia")]
5932 type SynchronousProxy = IsochronousStreamSynchronousProxy;
5933
5934 const DEBUG_NAME: &'static str = "(anonymous) IsochronousStream";
5935}
5936pub type IsochronousStreamSetupDataPathResult = Result<(), i32>;
5937pub type IsochronousStreamWriteResult = Result<(), i32>;
5938
5939pub trait IsochronousStreamProxyInterface: Send + Sync {
5940 type SetupDataPathResponseFut: std::future::Future<Output = Result<IsochronousStreamSetupDataPathResult, fidl::Error>>
5941 + Send;
5942 fn r#setup_data_path(
5943 &self,
5944 payload: &IsochronousStreamSetupDataPathRequest,
5945 ) -> Self::SetupDataPathResponseFut;
5946 type ReadResponseFut: std::future::Future<Output = Result<IsochronousStreamReadResponse, fidl::Error>>
5947 + Send;
5948 fn r#read(&self) -> Self::ReadResponseFut;
5949 type WriteResponseFut: std::future::Future<Output = Result<IsochronousStreamWriteResult, fidl::Error>>
5950 + Send;
5951 fn r#write(&self, payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut;
5952}
5953#[derive(Debug)]
5954#[cfg(target_os = "fuchsia")]
5955pub struct IsochronousStreamSynchronousProxy {
5956 client: fidl::client::sync::Client,
5957}
5958
5959#[cfg(target_os = "fuchsia")]
5960impl fidl::endpoints::SynchronousProxy for IsochronousStreamSynchronousProxy {
5961 type Proxy = IsochronousStreamProxy;
5962 type Protocol = IsochronousStreamMarker;
5963
5964 fn from_channel(inner: fidl::Channel) -> Self {
5965 Self::new(inner)
5966 }
5967
5968 fn into_channel(self) -> fidl::Channel {
5969 self.client.into_channel()
5970 }
5971
5972 fn as_channel(&self) -> &fidl::Channel {
5973 self.client.as_channel()
5974 }
5975}
5976
5977#[cfg(target_os = "fuchsia")]
5978impl IsochronousStreamSynchronousProxy {
5979 pub fn new(channel: fidl::Channel) -> Self {
5980 let protocol_name =
5981 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5982 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5983 }
5984
5985 pub fn into_channel(self) -> fidl::Channel {
5986 self.client.into_channel()
5987 }
5988
5989 pub fn wait_for_event(
5992 &self,
5993 deadline: zx::MonotonicInstant,
5994 ) -> Result<IsochronousStreamEvent, fidl::Error> {
5995 IsochronousStreamEvent::decode(self.client.wait_for_event(deadline)?)
5996 }
5997
5998 pub fn r#setup_data_path(
6010 &self,
6011 mut payload: &IsochronousStreamSetupDataPathRequest,
6012 ___deadline: zx::MonotonicInstant,
6013 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
6014 let _response = self.client.send_query::<
6015 IsochronousStreamSetupDataPathRequest,
6016 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6017 >(
6018 payload,
6019 0x7ec1e2b9cc6d2fbe,
6020 fidl::encoding::DynamicFlags::FLEXIBLE,
6021 ___deadline,
6022 )?
6023 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
6024 Ok(_response.map(|x| x))
6025 }
6026
6027 pub fn r#read(
6033 &self,
6034 ___deadline: zx::MonotonicInstant,
6035 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
6036 let _response = self.client.send_query::<
6037 fidl::encoding::EmptyPayload,
6038 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
6039 >(
6040 (),
6041 0x6d7d8b4950ed3a32,
6042 fidl::encoding::DynamicFlags::FLEXIBLE,
6043 ___deadline,
6044 )?
6045 .into_result::<IsochronousStreamMarker>("read")?;
6046 Ok(_response)
6047 }
6048
6049 pub fn r#write(
6053 &self,
6054 mut payload: &IsochronousStreamWriteRequest,
6055 ___deadline: zx::MonotonicInstant,
6056 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
6057 let _response = self.client.send_query::<
6058 IsochronousStreamWriteRequest,
6059 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6060 >(
6061 payload,
6062 0x5282e90b667d0d43,
6063 fidl::encoding::DynamicFlags::FLEXIBLE,
6064 ___deadline,
6065 )?
6066 .into_result::<IsochronousStreamMarker>("write")?;
6067 Ok(_response.map(|x| x))
6068 }
6069}
6070
6071#[cfg(target_os = "fuchsia")]
6072impl From<IsochronousStreamSynchronousProxy> for zx::Handle {
6073 fn from(value: IsochronousStreamSynchronousProxy) -> Self {
6074 value.into_channel().into()
6075 }
6076}
6077
6078#[cfg(target_os = "fuchsia")]
6079impl From<fidl::Channel> for IsochronousStreamSynchronousProxy {
6080 fn from(value: fidl::Channel) -> Self {
6081 Self::new(value)
6082 }
6083}
6084
6085#[cfg(target_os = "fuchsia")]
6086impl fidl::endpoints::FromClient for IsochronousStreamSynchronousProxy {
6087 type Protocol = IsochronousStreamMarker;
6088
6089 fn from_client(value: fidl::endpoints::ClientEnd<IsochronousStreamMarker>) -> Self {
6090 Self::new(value.into_channel())
6091 }
6092}
6093
6094#[derive(Debug, Clone)]
6095pub struct IsochronousStreamProxy {
6096 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6097}
6098
6099impl fidl::endpoints::Proxy for IsochronousStreamProxy {
6100 type Protocol = IsochronousStreamMarker;
6101
6102 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6103 Self::new(inner)
6104 }
6105
6106 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6107 self.client.into_channel().map_err(|client| Self { client })
6108 }
6109
6110 fn as_channel(&self) -> &::fidl::AsyncChannel {
6111 self.client.as_channel()
6112 }
6113}
6114
6115impl IsochronousStreamProxy {
6116 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6118 let protocol_name =
6119 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6120 Self { client: fidl::client::Client::new(channel, protocol_name) }
6121 }
6122
6123 pub fn take_event_stream(&self) -> IsochronousStreamEventStream {
6129 IsochronousStreamEventStream { event_receiver: self.client.take_event_receiver() }
6130 }
6131
6132 pub fn r#setup_data_path(
6144 &self,
6145 mut payload: &IsochronousStreamSetupDataPathRequest,
6146 ) -> fidl::client::QueryResponseFut<
6147 IsochronousStreamSetupDataPathResult,
6148 fidl::encoding::DefaultFuchsiaResourceDialect,
6149 > {
6150 IsochronousStreamProxyInterface::r#setup_data_path(self, payload)
6151 }
6152
6153 pub fn r#read(
6159 &self,
6160 ) -> fidl::client::QueryResponseFut<
6161 IsochronousStreamReadResponse,
6162 fidl::encoding::DefaultFuchsiaResourceDialect,
6163 > {
6164 IsochronousStreamProxyInterface::r#read(self)
6165 }
6166
6167 pub fn r#write(
6171 &self,
6172 mut payload: &IsochronousStreamWriteRequest,
6173 ) -> fidl::client::QueryResponseFut<
6174 IsochronousStreamWriteResult,
6175 fidl::encoding::DefaultFuchsiaResourceDialect,
6176 > {
6177 IsochronousStreamProxyInterface::r#write(self, payload)
6178 }
6179}
6180
6181impl IsochronousStreamProxyInterface for IsochronousStreamProxy {
6182 type SetupDataPathResponseFut = fidl::client::QueryResponseFut<
6183 IsochronousStreamSetupDataPathResult,
6184 fidl::encoding::DefaultFuchsiaResourceDialect,
6185 >;
6186 fn r#setup_data_path(
6187 &self,
6188 mut payload: &IsochronousStreamSetupDataPathRequest,
6189 ) -> Self::SetupDataPathResponseFut {
6190 fn _decode(
6191 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6192 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
6193 let _response = fidl::client::decode_transaction_body::<
6194 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6195 fidl::encoding::DefaultFuchsiaResourceDialect,
6196 0x7ec1e2b9cc6d2fbe,
6197 >(_buf?)?
6198 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
6199 Ok(_response.map(|x| x))
6200 }
6201 self.client.send_query_and_decode::<
6202 IsochronousStreamSetupDataPathRequest,
6203 IsochronousStreamSetupDataPathResult,
6204 >(
6205 payload,
6206 0x7ec1e2b9cc6d2fbe,
6207 fidl::encoding::DynamicFlags::FLEXIBLE,
6208 _decode,
6209 )
6210 }
6211
6212 type ReadResponseFut = fidl::client::QueryResponseFut<
6213 IsochronousStreamReadResponse,
6214 fidl::encoding::DefaultFuchsiaResourceDialect,
6215 >;
6216 fn r#read(&self) -> Self::ReadResponseFut {
6217 fn _decode(
6218 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6219 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
6220 let _response = fidl::client::decode_transaction_body::<
6221 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
6222 fidl::encoding::DefaultFuchsiaResourceDialect,
6223 0x6d7d8b4950ed3a32,
6224 >(_buf?)?
6225 .into_result::<IsochronousStreamMarker>("read")?;
6226 Ok(_response)
6227 }
6228 self.client
6229 .send_query_and_decode::<fidl::encoding::EmptyPayload, IsochronousStreamReadResponse>(
6230 (),
6231 0x6d7d8b4950ed3a32,
6232 fidl::encoding::DynamicFlags::FLEXIBLE,
6233 _decode,
6234 )
6235 }
6236
6237 type WriteResponseFut = fidl::client::QueryResponseFut<
6238 IsochronousStreamWriteResult,
6239 fidl::encoding::DefaultFuchsiaResourceDialect,
6240 >;
6241 fn r#write(&self, mut payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut {
6242 fn _decode(
6243 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6244 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
6245 let _response = fidl::client::decode_transaction_body::<
6246 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6247 fidl::encoding::DefaultFuchsiaResourceDialect,
6248 0x5282e90b667d0d43,
6249 >(_buf?)?
6250 .into_result::<IsochronousStreamMarker>("write")?;
6251 Ok(_response.map(|x| x))
6252 }
6253 self.client
6254 .send_query_and_decode::<IsochronousStreamWriteRequest, IsochronousStreamWriteResult>(
6255 payload,
6256 0x5282e90b667d0d43,
6257 fidl::encoding::DynamicFlags::FLEXIBLE,
6258 _decode,
6259 )
6260 }
6261}
6262
6263pub struct IsochronousStreamEventStream {
6264 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6265}
6266
6267impl std::marker::Unpin for IsochronousStreamEventStream {}
6268
6269impl futures::stream::FusedStream for IsochronousStreamEventStream {
6270 fn is_terminated(&self) -> bool {
6271 self.event_receiver.is_terminated()
6272 }
6273}
6274
6275impl futures::Stream for IsochronousStreamEventStream {
6276 type Item = Result<IsochronousStreamEvent, fidl::Error>;
6277
6278 fn poll_next(
6279 mut self: std::pin::Pin<&mut Self>,
6280 cx: &mut std::task::Context<'_>,
6281 ) -> std::task::Poll<Option<Self::Item>> {
6282 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6283 &mut self.event_receiver,
6284 cx
6285 )?) {
6286 Some(buf) => std::task::Poll::Ready(Some(IsochronousStreamEvent::decode(buf))),
6287 None => std::task::Poll::Ready(None),
6288 }
6289 }
6290}
6291
6292#[derive(Debug)]
6293pub enum IsochronousStreamEvent {
6294 OnEstablished {
6295 payload: IsochronousStreamOnEstablishedRequest,
6296 },
6297 #[non_exhaustive]
6298 _UnknownEvent {
6299 ordinal: u64,
6301 },
6302}
6303
6304impl IsochronousStreamEvent {
6305 #[allow(irrefutable_let_patterns)]
6306 pub fn into_on_established(self) -> Option<IsochronousStreamOnEstablishedRequest> {
6307 if let IsochronousStreamEvent::OnEstablished { payload } = self {
6308 Some((payload))
6309 } else {
6310 None
6311 }
6312 }
6313
6314 fn decode(
6316 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6317 ) -> Result<IsochronousStreamEvent, fidl::Error> {
6318 let (bytes, _handles) = buf.split_mut();
6319 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6320 debug_assert_eq!(tx_header.tx_id, 0);
6321 match tx_header.ordinal {
6322 0x341c50e9d10f3421 => {
6323 let mut out = fidl::new_empty!(
6324 IsochronousStreamOnEstablishedRequest,
6325 fidl::encoding::DefaultFuchsiaResourceDialect
6326 );
6327 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6328 Ok((IsochronousStreamEvent::OnEstablished { payload: out }))
6329 }
6330 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6331 Ok(IsochronousStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6332 }
6333 _ => Err(fidl::Error::UnknownOrdinal {
6334 ordinal: tx_header.ordinal,
6335 protocol_name:
6336 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6337 }),
6338 }
6339 }
6340}
6341
6342pub struct IsochronousStreamRequestStream {
6344 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6345 is_terminated: bool,
6346}
6347
6348impl std::marker::Unpin for IsochronousStreamRequestStream {}
6349
6350impl futures::stream::FusedStream for IsochronousStreamRequestStream {
6351 fn is_terminated(&self) -> bool {
6352 self.is_terminated
6353 }
6354}
6355
6356impl fidl::endpoints::RequestStream for IsochronousStreamRequestStream {
6357 type Protocol = IsochronousStreamMarker;
6358 type ControlHandle = IsochronousStreamControlHandle;
6359
6360 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6361 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6362 }
6363
6364 fn control_handle(&self) -> Self::ControlHandle {
6365 IsochronousStreamControlHandle { inner: self.inner.clone() }
6366 }
6367
6368 fn into_inner(
6369 self,
6370 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6371 {
6372 (self.inner, self.is_terminated)
6373 }
6374
6375 fn from_inner(
6376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6377 is_terminated: bool,
6378 ) -> Self {
6379 Self { inner, is_terminated }
6380 }
6381}
6382
6383impl futures::Stream for IsochronousStreamRequestStream {
6384 type Item = Result<IsochronousStreamRequest, fidl::Error>;
6385
6386 fn poll_next(
6387 mut self: std::pin::Pin<&mut Self>,
6388 cx: &mut std::task::Context<'_>,
6389 ) -> std::task::Poll<Option<Self::Item>> {
6390 let this = &mut *self;
6391 if this.inner.check_shutdown(cx) {
6392 this.is_terminated = true;
6393 return std::task::Poll::Ready(None);
6394 }
6395 if this.is_terminated {
6396 panic!("polled IsochronousStreamRequestStream after completion");
6397 }
6398 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6399 |bytes, handles| {
6400 match this.inner.channel().read_etc(cx, bytes, handles) {
6401 std::task::Poll::Ready(Ok(())) => {}
6402 std::task::Poll::Pending => return std::task::Poll::Pending,
6403 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6404 this.is_terminated = true;
6405 return std::task::Poll::Ready(None);
6406 }
6407 std::task::Poll::Ready(Err(e)) => {
6408 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6409 e.into(),
6410 ))))
6411 }
6412 }
6413
6414 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6416
6417 std::task::Poll::Ready(Some(match header.ordinal {
6418 0x7ec1e2b9cc6d2fbe => {
6419 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6420 let mut req = fidl::new_empty!(
6421 IsochronousStreamSetupDataPathRequest,
6422 fidl::encoding::DefaultFuchsiaResourceDialect
6423 );
6424 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamSetupDataPathRequest>(&header, _body_bytes, handles, &mut req)?;
6425 let control_handle =
6426 IsochronousStreamControlHandle { inner: this.inner.clone() };
6427 Ok(IsochronousStreamRequest::SetupDataPath {
6428 payload: req,
6429 responder: IsochronousStreamSetupDataPathResponder {
6430 control_handle: std::mem::ManuallyDrop::new(control_handle),
6431 tx_id: header.tx_id,
6432 },
6433 })
6434 }
6435 0x6d7d8b4950ed3a32 => {
6436 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6437 let mut req = fidl::new_empty!(
6438 fidl::encoding::EmptyPayload,
6439 fidl::encoding::DefaultFuchsiaResourceDialect
6440 );
6441 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6442 let control_handle =
6443 IsochronousStreamControlHandle { inner: this.inner.clone() };
6444 Ok(IsochronousStreamRequest::Read {
6445 responder: IsochronousStreamReadResponder {
6446 control_handle: std::mem::ManuallyDrop::new(control_handle),
6447 tx_id: header.tx_id,
6448 },
6449 })
6450 }
6451 0x5282e90b667d0d43 => {
6452 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6453 let mut req = fidl::new_empty!(
6454 IsochronousStreamWriteRequest,
6455 fidl::encoding::DefaultFuchsiaResourceDialect
6456 );
6457 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamWriteRequest>(&header, _body_bytes, handles, &mut req)?;
6458 let control_handle =
6459 IsochronousStreamControlHandle { inner: this.inner.clone() };
6460 Ok(IsochronousStreamRequest::Write {
6461 payload: req,
6462 responder: IsochronousStreamWriteResponder {
6463 control_handle: std::mem::ManuallyDrop::new(control_handle),
6464 tx_id: header.tx_id,
6465 },
6466 })
6467 }
6468 _ if header.tx_id == 0
6469 && header
6470 .dynamic_flags()
6471 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6472 {
6473 Ok(IsochronousStreamRequest::_UnknownMethod {
6474 ordinal: header.ordinal,
6475 control_handle: IsochronousStreamControlHandle {
6476 inner: this.inner.clone(),
6477 },
6478 method_type: fidl::MethodType::OneWay,
6479 })
6480 }
6481 _ if header
6482 .dynamic_flags()
6483 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6484 {
6485 this.inner.send_framework_err(
6486 fidl::encoding::FrameworkErr::UnknownMethod,
6487 header.tx_id,
6488 header.ordinal,
6489 header.dynamic_flags(),
6490 (bytes, handles),
6491 )?;
6492 Ok(IsochronousStreamRequest::_UnknownMethod {
6493 ordinal: header.ordinal,
6494 control_handle: IsochronousStreamControlHandle {
6495 inner: this.inner.clone(),
6496 },
6497 method_type: fidl::MethodType::TwoWay,
6498 })
6499 }
6500 _ => Err(fidl::Error::UnknownOrdinal {
6501 ordinal: header.ordinal,
6502 protocol_name:
6503 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6504 }),
6505 }))
6506 },
6507 )
6508 }
6509}
6510
6511#[derive(Debug)]
6512pub enum IsochronousStreamRequest {
6513 SetupDataPath {
6525 payload: IsochronousStreamSetupDataPathRequest,
6526 responder: IsochronousStreamSetupDataPathResponder,
6527 },
6528 Read { responder: IsochronousStreamReadResponder },
6534 Write { payload: IsochronousStreamWriteRequest, responder: IsochronousStreamWriteResponder },
6538 #[non_exhaustive]
6540 _UnknownMethod {
6541 ordinal: u64,
6543 control_handle: IsochronousStreamControlHandle,
6544 method_type: fidl::MethodType,
6545 },
6546}
6547
6548impl IsochronousStreamRequest {
6549 #[allow(irrefutable_let_patterns)]
6550 pub fn into_setup_data_path(
6551 self,
6552 ) -> Option<(IsochronousStreamSetupDataPathRequest, IsochronousStreamSetupDataPathResponder)>
6553 {
6554 if let IsochronousStreamRequest::SetupDataPath { payload, responder } = self {
6555 Some((payload, responder))
6556 } else {
6557 None
6558 }
6559 }
6560
6561 #[allow(irrefutable_let_patterns)]
6562 pub fn into_read(self) -> Option<(IsochronousStreamReadResponder)> {
6563 if let IsochronousStreamRequest::Read { responder } = self {
6564 Some((responder))
6565 } else {
6566 None
6567 }
6568 }
6569
6570 #[allow(irrefutable_let_patterns)]
6571 pub fn into_write(
6572 self,
6573 ) -> Option<(IsochronousStreamWriteRequest, IsochronousStreamWriteResponder)> {
6574 if let IsochronousStreamRequest::Write { payload, responder } = self {
6575 Some((payload, responder))
6576 } else {
6577 None
6578 }
6579 }
6580
6581 pub fn method_name(&self) -> &'static str {
6583 match *self {
6584 IsochronousStreamRequest::SetupDataPath { .. } => "setup_data_path",
6585 IsochronousStreamRequest::Read { .. } => "read",
6586 IsochronousStreamRequest::Write { .. } => "write",
6587 IsochronousStreamRequest::_UnknownMethod {
6588 method_type: fidl::MethodType::OneWay,
6589 ..
6590 } => "unknown one-way method",
6591 IsochronousStreamRequest::_UnknownMethod {
6592 method_type: fidl::MethodType::TwoWay,
6593 ..
6594 } => "unknown two-way method",
6595 }
6596 }
6597}
6598
6599#[derive(Debug, Clone)]
6600pub struct IsochronousStreamControlHandle {
6601 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6602}
6603
6604impl fidl::endpoints::ControlHandle for IsochronousStreamControlHandle {
6605 fn shutdown(&self) {
6606 self.inner.shutdown()
6607 }
6608 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6609 self.inner.shutdown_with_epitaph(status)
6610 }
6611
6612 fn is_closed(&self) -> bool {
6613 self.inner.channel().is_closed()
6614 }
6615 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6616 self.inner.channel().on_closed()
6617 }
6618
6619 #[cfg(target_os = "fuchsia")]
6620 fn signal_peer(
6621 &self,
6622 clear_mask: zx::Signals,
6623 set_mask: zx::Signals,
6624 ) -> Result<(), zx_status::Status> {
6625 use fidl::Peered;
6626 self.inner.channel().signal_peer(clear_mask, set_mask)
6627 }
6628}
6629
6630impl IsochronousStreamControlHandle {
6631 pub fn send_on_established(
6632 &self,
6633 mut payload: &IsochronousStreamOnEstablishedRequest,
6634 ) -> Result<(), fidl::Error> {
6635 self.inner.send::<IsochronousStreamOnEstablishedRequest>(
6636 payload,
6637 0,
6638 0x341c50e9d10f3421,
6639 fidl::encoding::DynamicFlags::FLEXIBLE,
6640 )
6641 }
6642}
6643
6644#[must_use = "FIDL methods require a response to be sent"]
6645#[derive(Debug)]
6646pub struct IsochronousStreamSetupDataPathResponder {
6647 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6648 tx_id: u32,
6649}
6650
6651impl std::ops::Drop for IsochronousStreamSetupDataPathResponder {
6655 fn drop(&mut self) {
6656 self.control_handle.shutdown();
6657 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6659 }
6660}
6661
6662impl fidl::endpoints::Responder for IsochronousStreamSetupDataPathResponder {
6663 type ControlHandle = IsochronousStreamControlHandle;
6664
6665 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6666 &self.control_handle
6667 }
6668
6669 fn drop_without_shutdown(mut self) {
6670 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6672 std::mem::forget(self);
6674 }
6675}
6676
6677impl IsochronousStreamSetupDataPathResponder {
6678 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6682 let _result = self.send_raw(result);
6683 if _result.is_err() {
6684 self.control_handle.shutdown();
6685 }
6686 self.drop_without_shutdown();
6687 _result
6688 }
6689
6690 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6692 let _result = self.send_raw(result);
6693 self.drop_without_shutdown();
6694 _result
6695 }
6696
6697 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6698 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6699 fidl::encoding::EmptyStruct,
6700 i32,
6701 >>(
6702 fidl::encoding::FlexibleResult::new(result),
6703 self.tx_id,
6704 0x7ec1e2b9cc6d2fbe,
6705 fidl::encoding::DynamicFlags::FLEXIBLE,
6706 )
6707 }
6708}
6709
6710#[must_use = "FIDL methods require a response to be sent"]
6711#[derive(Debug)]
6712pub struct IsochronousStreamReadResponder {
6713 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6714 tx_id: u32,
6715}
6716
6717impl std::ops::Drop for IsochronousStreamReadResponder {
6721 fn drop(&mut self) {
6722 self.control_handle.shutdown();
6723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6725 }
6726}
6727
6728impl fidl::endpoints::Responder for IsochronousStreamReadResponder {
6729 type ControlHandle = IsochronousStreamControlHandle;
6730
6731 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6732 &self.control_handle
6733 }
6734
6735 fn drop_without_shutdown(mut self) {
6736 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6738 std::mem::forget(self);
6740 }
6741}
6742
6743impl IsochronousStreamReadResponder {
6744 pub fn send(self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
6748 let _result = self.send_raw(payload);
6749 if _result.is_err() {
6750 self.control_handle.shutdown();
6751 }
6752 self.drop_without_shutdown();
6753 _result
6754 }
6755
6756 pub fn send_no_shutdown_on_err(
6758 self,
6759 mut payload: &IsochronousStreamReadResponse,
6760 ) -> Result<(), fidl::Error> {
6761 let _result = self.send_raw(payload);
6762 self.drop_without_shutdown();
6763 _result
6764 }
6765
6766 fn send_raw(&self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
6767 self.control_handle
6768 .inner
6769 .send::<fidl::encoding::FlexibleType<IsochronousStreamReadResponse>>(
6770 fidl::encoding::Flexible::new(payload),
6771 self.tx_id,
6772 0x6d7d8b4950ed3a32,
6773 fidl::encoding::DynamicFlags::FLEXIBLE,
6774 )
6775 }
6776}
6777
6778#[must_use = "FIDL methods require a response to be sent"]
6779#[derive(Debug)]
6780pub struct IsochronousStreamWriteResponder {
6781 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6782 tx_id: u32,
6783}
6784
6785impl std::ops::Drop for IsochronousStreamWriteResponder {
6789 fn drop(&mut self) {
6790 self.control_handle.shutdown();
6791 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6793 }
6794}
6795
6796impl fidl::endpoints::Responder for IsochronousStreamWriteResponder {
6797 type ControlHandle = IsochronousStreamControlHandle;
6798
6799 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6800 &self.control_handle
6801 }
6802
6803 fn drop_without_shutdown(mut self) {
6804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6806 std::mem::forget(self);
6808 }
6809}
6810
6811impl IsochronousStreamWriteResponder {
6812 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6816 let _result = self.send_raw(result);
6817 if _result.is_err() {
6818 self.control_handle.shutdown();
6819 }
6820 self.drop_without_shutdown();
6821 _result
6822 }
6823
6824 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6826 let _result = self.send_raw(result);
6827 self.drop_without_shutdown();
6828 _result
6829 }
6830
6831 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6832 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6833 fidl::encoding::EmptyStruct,
6834 i32,
6835 >>(
6836 fidl::encoding::FlexibleResult::new(result),
6837 self.tx_id,
6838 0x5282e90b667d0d43,
6839 fidl::encoding::DynamicFlags::FLEXIBLE,
6840 )
6841 }
6842}
6843
6844#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6845pub struct PeripheralMarker;
6846
6847impl fidl::endpoints::ProtocolMarker for PeripheralMarker {
6848 type Proxy = PeripheralProxy;
6849 type RequestStream = PeripheralRequestStream;
6850 #[cfg(target_os = "fuchsia")]
6851 type SynchronousProxy = PeripheralSynchronousProxy;
6852
6853 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Peripheral";
6854}
6855impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralMarker {}
6856pub type PeripheralAdvertiseResult = Result<(), PeripheralError>;
6857pub type PeripheralStartAdvertisingResult = Result<(), PeripheralError>;
6858
6859pub trait PeripheralProxyInterface: Send + Sync {
6860 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
6861 + Send;
6862 fn r#listen_l2cap(
6863 &self,
6864 payload: ChannelListenerRegistryListenL2capRequest,
6865 ) -> Self::ListenL2capResponseFut;
6866 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
6867 + Send;
6868 fn r#advertise(
6869 &self,
6870 parameters: &AdvertisingParameters,
6871 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
6872 ) -> Self::AdvertiseResponseFut;
6873 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
6874 + Send;
6875 fn r#start_advertising(
6876 &self,
6877 parameters: &AdvertisingParameters,
6878 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
6879 ) -> Self::StartAdvertisingResponseFut;
6880}
6881#[derive(Debug)]
6882#[cfg(target_os = "fuchsia")]
6883pub struct PeripheralSynchronousProxy {
6884 client: fidl::client::sync::Client,
6885}
6886
6887#[cfg(target_os = "fuchsia")]
6888impl fidl::endpoints::SynchronousProxy for PeripheralSynchronousProxy {
6889 type Proxy = PeripheralProxy;
6890 type Protocol = PeripheralMarker;
6891
6892 fn from_channel(inner: fidl::Channel) -> Self {
6893 Self::new(inner)
6894 }
6895
6896 fn into_channel(self) -> fidl::Channel {
6897 self.client.into_channel()
6898 }
6899
6900 fn as_channel(&self) -> &fidl::Channel {
6901 self.client.as_channel()
6902 }
6903}
6904
6905#[cfg(target_os = "fuchsia")]
6906impl PeripheralSynchronousProxy {
6907 pub fn new(channel: fidl::Channel) -> Self {
6908 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6909 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6910 }
6911
6912 pub fn into_channel(self) -> fidl::Channel {
6913 self.client.into_channel()
6914 }
6915
6916 pub fn wait_for_event(
6919 &self,
6920 deadline: zx::MonotonicInstant,
6921 ) -> Result<PeripheralEvent, fidl::Error> {
6922 PeripheralEvent::decode(self.client.wait_for_event(deadline)?)
6923 }
6924
6925 pub fn r#listen_l2cap(
6935 &self,
6936 mut payload: ChannelListenerRegistryListenL2capRequest,
6937 ___deadline: zx::MonotonicInstant,
6938 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
6939 let _response = self.client.send_query::<
6940 ChannelListenerRegistryListenL2capRequest,
6941 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
6942 >(
6943 &mut payload,
6944 0x39c6e9001d102338,
6945 fidl::encoding::DynamicFlags::empty(),
6946 ___deadline,
6947 )?;
6948 Ok(_response.map(|x| x))
6949 }
6950
6951 pub fn r#advertise(
6979 &self,
6980 mut parameters: &AdvertisingParameters,
6981 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
6982 ___deadline: zx::MonotonicInstant,
6983 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
6984 let _response = self.client.send_query::<
6985 PeripheralAdvertiseRequest,
6986 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
6987 >(
6988 (parameters, advertised_peripheral,),
6989 0x2d9ec9260c32c17f,
6990 fidl::encoding::DynamicFlags::empty(),
6991 ___deadline,
6992 )?;
6993 Ok(_response.map(|x| x))
6994 }
6995
6996 pub fn r#start_advertising(
7017 &self,
7018 mut parameters: &AdvertisingParameters,
7019 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7020 ___deadline: zx::MonotonicInstant,
7021 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
7022 let _response = self.client.send_query::<
7023 PeripheralStartAdvertisingRequest,
7024 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7025 >(
7026 (parameters, handle,),
7027 0x5875c1c575f00f7d,
7028 fidl::encoding::DynamicFlags::empty(),
7029 ___deadline,
7030 )?;
7031 Ok(_response.map(|x| x))
7032 }
7033}
7034
7035#[cfg(target_os = "fuchsia")]
7036impl From<PeripheralSynchronousProxy> for zx::Handle {
7037 fn from(value: PeripheralSynchronousProxy) -> Self {
7038 value.into_channel().into()
7039 }
7040}
7041
7042#[cfg(target_os = "fuchsia")]
7043impl From<fidl::Channel> for PeripheralSynchronousProxy {
7044 fn from(value: fidl::Channel) -> Self {
7045 Self::new(value)
7046 }
7047}
7048
7049#[cfg(target_os = "fuchsia")]
7050impl fidl::endpoints::FromClient for PeripheralSynchronousProxy {
7051 type Protocol = PeripheralMarker;
7052
7053 fn from_client(value: fidl::endpoints::ClientEnd<PeripheralMarker>) -> Self {
7054 Self::new(value.into_channel())
7055 }
7056}
7057
7058#[derive(Debug, Clone)]
7059pub struct PeripheralProxy {
7060 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7061}
7062
7063impl fidl::endpoints::Proxy for PeripheralProxy {
7064 type Protocol = PeripheralMarker;
7065
7066 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7067 Self::new(inner)
7068 }
7069
7070 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7071 self.client.into_channel().map_err(|client| Self { client })
7072 }
7073
7074 fn as_channel(&self) -> &::fidl::AsyncChannel {
7075 self.client.as_channel()
7076 }
7077}
7078
7079impl PeripheralProxy {
7080 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7082 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7083 Self { client: fidl::client::Client::new(channel, protocol_name) }
7084 }
7085
7086 pub fn take_event_stream(&self) -> PeripheralEventStream {
7092 PeripheralEventStream { event_receiver: self.client.take_event_receiver() }
7093 }
7094
7095 pub fn r#listen_l2cap(
7105 &self,
7106 mut payload: ChannelListenerRegistryListenL2capRequest,
7107 ) -> fidl::client::QueryResponseFut<
7108 ChannelListenerRegistryListenL2capResult,
7109 fidl::encoding::DefaultFuchsiaResourceDialect,
7110 > {
7111 PeripheralProxyInterface::r#listen_l2cap(self, payload)
7112 }
7113
7114 pub fn r#advertise(
7142 &self,
7143 mut parameters: &AdvertisingParameters,
7144 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7145 ) -> fidl::client::QueryResponseFut<
7146 PeripheralAdvertiseResult,
7147 fidl::encoding::DefaultFuchsiaResourceDialect,
7148 > {
7149 PeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
7150 }
7151
7152 pub fn r#start_advertising(
7173 &self,
7174 mut parameters: &AdvertisingParameters,
7175 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7176 ) -> fidl::client::QueryResponseFut<
7177 PeripheralStartAdvertisingResult,
7178 fidl::encoding::DefaultFuchsiaResourceDialect,
7179 > {
7180 PeripheralProxyInterface::r#start_advertising(self, parameters, handle)
7181 }
7182}
7183
7184impl PeripheralProxyInterface for PeripheralProxy {
7185 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
7186 ChannelListenerRegistryListenL2capResult,
7187 fidl::encoding::DefaultFuchsiaResourceDialect,
7188 >;
7189 fn r#listen_l2cap(
7190 &self,
7191 mut payload: ChannelListenerRegistryListenL2capRequest,
7192 ) -> Self::ListenL2capResponseFut {
7193 fn _decode(
7194 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7195 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
7196 let _response = fidl::client::decode_transaction_body::<
7197 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
7198 fidl::encoding::DefaultFuchsiaResourceDialect,
7199 0x39c6e9001d102338,
7200 >(_buf?)?;
7201 Ok(_response.map(|x| x))
7202 }
7203 self.client.send_query_and_decode::<
7204 ChannelListenerRegistryListenL2capRequest,
7205 ChannelListenerRegistryListenL2capResult,
7206 >(
7207 &mut payload,
7208 0x39c6e9001d102338,
7209 fidl::encoding::DynamicFlags::empty(),
7210 _decode,
7211 )
7212 }
7213
7214 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
7215 PeripheralAdvertiseResult,
7216 fidl::encoding::DefaultFuchsiaResourceDialect,
7217 >;
7218 fn r#advertise(
7219 &self,
7220 mut parameters: &AdvertisingParameters,
7221 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7222 ) -> Self::AdvertiseResponseFut {
7223 fn _decode(
7224 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7225 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
7226 let _response = fidl::client::decode_transaction_body::<
7227 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7228 fidl::encoding::DefaultFuchsiaResourceDialect,
7229 0x2d9ec9260c32c17f,
7230 >(_buf?)?;
7231 Ok(_response.map(|x| x))
7232 }
7233 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
7234 (parameters, advertised_peripheral),
7235 0x2d9ec9260c32c17f,
7236 fidl::encoding::DynamicFlags::empty(),
7237 _decode,
7238 )
7239 }
7240
7241 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
7242 PeripheralStartAdvertisingResult,
7243 fidl::encoding::DefaultFuchsiaResourceDialect,
7244 >;
7245 fn r#start_advertising(
7246 &self,
7247 mut parameters: &AdvertisingParameters,
7248 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7249 ) -> Self::StartAdvertisingResponseFut {
7250 fn _decode(
7251 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7252 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
7253 let _response = fidl::client::decode_transaction_body::<
7254 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7255 fidl::encoding::DefaultFuchsiaResourceDialect,
7256 0x5875c1c575f00f7d,
7257 >(_buf?)?;
7258 Ok(_response.map(|x| x))
7259 }
7260 self.client.send_query_and_decode::<
7261 PeripheralStartAdvertisingRequest,
7262 PeripheralStartAdvertisingResult,
7263 >(
7264 (parameters, handle,),
7265 0x5875c1c575f00f7d,
7266 fidl::encoding::DynamicFlags::empty(),
7267 _decode,
7268 )
7269 }
7270}
7271
7272pub struct PeripheralEventStream {
7273 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7274}
7275
7276impl std::marker::Unpin for PeripheralEventStream {}
7277
7278impl futures::stream::FusedStream for PeripheralEventStream {
7279 fn is_terminated(&self) -> bool {
7280 self.event_receiver.is_terminated()
7281 }
7282}
7283
7284impl futures::Stream for PeripheralEventStream {
7285 type Item = Result<PeripheralEvent, fidl::Error>;
7286
7287 fn poll_next(
7288 mut self: std::pin::Pin<&mut Self>,
7289 cx: &mut std::task::Context<'_>,
7290 ) -> std::task::Poll<Option<Self::Item>> {
7291 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7292 &mut self.event_receiver,
7293 cx
7294 )?) {
7295 Some(buf) => std::task::Poll::Ready(Some(PeripheralEvent::decode(buf))),
7296 None => std::task::Poll::Ready(None),
7297 }
7298 }
7299}
7300
7301#[derive(Debug)]
7302pub enum PeripheralEvent {
7303 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
7304}
7305
7306impl PeripheralEvent {
7307 #[allow(irrefutable_let_patterns)]
7308 pub fn into_on_peer_connected(
7309 self,
7310 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
7311 if let PeripheralEvent::OnPeerConnected { peer, connection } = self {
7312 Some((peer, connection))
7313 } else {
7314 None
7315 }
7316 }
7317
7318 fn decode(
7320 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7321 ) -> Result<PeripheralEvent, fidl::Error> {
7322 let (bytes, _handles) = buf.split_mut();
7323 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7324 debug_assert_eq!(tx_header.tx_id, 0);
7325 match tx_header.ordinal {
7326 0x16135d464299e356 => {
7327 let mut out = fidl::new_empty!(
7328 PeripheralOnPeerConnectedRequest,
7329 fidl::encoding::DefaultFuchsiaResourceDialect
7330 );
7331 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7332 Ok((PeripheralEvent::OnPeerConnected {
7333 peer: out.peer,
7334 connection: out.connection,
7335 }))
7336 }
7337 _ => Err(fidl::Error::UnknownOrdinal {
7338 ordinal: tx_header.ordinal,
7339 protocol_name: <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7340 }),
7341 }
7342 }
7343}
7344
7345pub struct PeripheralRequestStream {
7347 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7348 is_terminated: bool,
7349}
7350
7351impl std::marker::Unpin for PeripheralRequestStream {}
7352
7353impl futures::stream::FusedStream for PeripheralRequestStream {
7354 fn is_terminated(&self) -> bool {
7355 self.is_terminated
7356 }
7357}
7358
7359impl fidl::endpoints::RequestStream for PeripheralRequestStream {
7360 type Protocol = PeripheralMarker;
7361 type ControlHandle = PeripheralControlHandle;
7362
7363 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7364 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7365 }
7366
7367 fn control_handle(&self) -> Self::ControlHandle {
7368 PeripheralControlHandle { inner: self.inner.clone() }
7369 }
7370
7371 fn into_inner(
7372 self,
7373 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7374 {
7375 (self.inner, self.is_terminated)
7376 }
7377
7378 fn from_inner(
7379 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7380 is_terminated: bool,
7381 ) -> Self {
7382 Self { inner, is_terminated }
7383 }
7384}
7385
7386impl futures::Stream for PeripheralRequestStream {
7387 type Item = Result<PeripheralRequest, fidl::Error>;
7388
7389 fn poll_next(
7390 mut self: std::pin::Pin<&mut Self>,
7391 cx: &mut std::task::Context<'_>,
7392 ) -> std::task::Poll<Option<Self::Item>> {
7393 let this = &mut *self;
7394 if this.inner.check_shutdown(cx) {
7395 this.is_terminated = true;
7396 return std::task::Poll::Ready(None);
7397 }
7398 if this.is_terminated {
7399 panic!("polled PeripheralRequestStream after completion");
7400 }
7401 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7402 |bytes, handles| {
7403 match this.inner.channel().read_etc(cx, bytes, handles) {
7404 std::task::Poll::Ready(Ok(())) => {}
7405 std::task::Poll::Pending => return std::task::Poll::Pending,
7406 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7407 this.is_terminated = true;
7408 return std::task::Poll::Ready(None);
7409 }
7410 std::task::Poll::Ready(Err(e)) => {
7411 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7412 e.into(),
7413 ))))
7414 }
7415 }
7416
7417 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7419
7420 std::task::Poll::Ready(Some(match header.ordinal {
7421 0x39c6e9001d102338 => {
7422 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7423 let mut req = fidl::new_empty!(
7424 ChannelListenerRegistryListenL2capRequest,
7425 fidl::encoding::DefaultFuchsiaResourceDialect
7426 );
7427 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
7428 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7429 Ok(PeripheralRequest::ListenL2cap {
7430 payload: req,
7431 responder: PeripheralListenL2capResponder {
7432 control_handle: std::mem::ManuallyDrop::new(control_handle),
7433 tx_id: header.tx_id,
7434 },
7435 })
7436 }
7437 0x2d9ec9260c32c17f => {
7438 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7439 let mut req = fidl::new_empty!(
7440 PeripheralAdvertiseRequest,
7441 fidl::encoding::DefaultFuchsiaResourceDialect
7442 );
7443 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
7444 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7445 Ok(PeripheralRequest::Advertise {
7446 parameters: req.parameters,
7447 advertised_peripheral: req.advertised_peripheral,
7448
7449 responder: PeripheralAdvertiseResponder {
7450 control_handle: std::mem::ManuallyDrop::new(control_handle),
7451 tx_id: header.tx_id,
7452 },
7453 })
7454 }
7455 0x5875c1c575f00f7d => {
7456 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7457 let mut req = fidl::new_empty!(
7458 PeripheralStartAdvertisingRequest,
7459 fidl::encoding::DefaultFuchsiaResourceDialect
7460 );
7461 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
7462 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7463 Ok(PeripheralRequest::StartAdvertising {
7464 parameters: req.parameters,
7465 handle: req.handle,
7466
7467 responder: PeripheralStartAdvertisingResponder {
7468 control_handle: std::mem::ManuallyDrop::new(control_handle),
7469 tx_id: header.tx_id,
7470 },
7471 })
7472 }
7473 _ => Err(fidl::Error::UnknownOrdinal {
7474 ordinal: header.ordinal,
7475 protocol_name:
7476 <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7477 }),
7478 }))
7479 },
7480 )
7481 }
7482}
7483
7484#[derive(Debug)]
7485pub enum PeripheralRequest {
7486 ListenL2cap {
7496 payload: ChannelListenerRegistryListenL2capRequest,
7497 responder: PeripheralListenL2capResponder,
7498 },
7499 Advertise {
7527 parameters: AdvertisingParameters,
7528 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7529 responder: PeripheralAdvertiseResponder,
7530 },
7531 StartAdvertising {
7552 parameters: AdvertisingParameters,
7553 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7554 responder: PeripheralStartAdvertisingResponder,
7555 },
7556}
7557
7558impl PeripheralRequest {
7559 #[allow(irrefutable_let_patterns)]
7560 pub fn into_listen_l2cap(
7561 self,
7562 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PeripheralListenL2capResponder)> {
7563 if let PeripheralRequest::ListenL2cap { payload, responder } = self {
7564 Some((payload, responder))
7565 } else {
7566 None
7567 }
7568 }
7569
7570 #[allow(irrefutable_let_patterns)]
7571 pub fn into_advertise(
7572 self,
7573 ) -> Option<(
7574 AdvertisingParameters,
7575 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7576 PeripheralAdvertiseResponder,
7577 )> {
7578 if let PeripheralRequest::Advertise { parameters, advertised_peripheral, responder } = self
7579 {
7580 Some((parameters, advertised_peripheral, responder))
7581 } else {
7582 None
7583 }
7584 }
7585
7586 #[allow(irrefutable_let_patterns)]
7587 pub fn into_start_advertising(
7588 self,
7589 ) -> Option<(
7590 AdvertisingParameters,
7591 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7592 PeripheralStartAdvertisingResponder,
7593 )> {
7594 if let PeripheralRequest::StartAdvertising { parameters, handle, responder } = self {
7595 Some((parameters, handle, responder))
7596 } else {
7597 None
7598 }
7599 }
7600
7601 pub fn method_name(&self) -> &'static str {
7603 match *self {
7604 PeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
7605 PeripheralRequest::Advertise { .. } => "advertise",
7606 PeripheralRequest::StartAdvertising { .. } => "start_advertising",
7607 }
7608 }
7609}
7610
7611#[derive(Debug, Clone)]
7612pub struct PeripheralControlHandle {
7613 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7614}
7615
7616impl fidl::endpoints::ControlHandle for PeripheralControlHandle {
7617 fn shutdown(&self) {
7618 self.inner.shutdown()
7619 }
7620 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7621 self.inner.shutdown_with_epitaph(status)
7622 }
7623
7624 fn is_closed(&self) -> bool {
7625 self.inner.channel().is_closed()
7626 }
7627 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7628 self.inner.channel().on_closed()
7629 }
7630
7631 #[cfg(target_os = "fuchsia")]
7632 fn signal_peer(
7633 &self,
7634 clear_mask: zx::Signals,
7635 set_mask: zx::Signals,
7636 ) -> Result<(), zx_status::Status> {
7637 use fidl::Peered;
7638 self.inner.channel().signal_peer(clear_mask, set_mask)
7639 }
7640}
7641
7642impl PeripheralControlHandle {
7643 pub fn send_on_peer_connected(
7644 &self,
7645 mut peer: &Peer,
7646 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
7647 ) -> Result<(), fidl::Error> {
7648 self.inner.send::<PeripheralOnPeerConnectedRequest>(
7649 (peer, connection),
7650 0,
7651 0x16135d464299e356,
7652 fidl::encoding::DynamicFlags::empty(),
7653 )
7654 }
7655}
7656
7657#[must_use = "FIDL methods require a response to be sent"]
7658#[derive(Debug)]
7659pub struct PeripheralListenL2capResponder {
7660 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7661 tx_id: u32,
7662}
7663
7664impl std::ops::Drop for PeripheralListenL2capResponder {
7668 fn drop(&mut self) {
7669 self.control_handle.shutdown();
7670 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7672 }
7673}
7674
7675impl fidl::endpoints::Responder for PeripheralListenL2capResponder {
7676 type ControlHandle = PeripheralControlHandle;
7677
7678 fn control_handle(&self) -> &PeripheralControlHandle {
7679 &self.control_handle
7680 }
7681
7682 fn drop_without_shutdown(mut self) {
7683 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7685 std::mem::forget(self);
7687 }
7688}
7689
7690impl PeripheralListenL2capResponder {
7691 pub fn send(
7695 self,
7696 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7697 ) -> Result<(), fidl::Error> {
7698 let _result = self.send_raw(result);
7699 if _result.is_err() {
7700 self.control_handle.shutdown();
7701 }
7702 self.drop_without_shutdown();
7703 _result
7704 }
7705
7706 pub fn send_no_shutdown_on_err(
7708 self,
7709 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7710 ) -> Result<(), fidl::Error> {
7711 let _result = self.send_raw(result);
7712 self.drop_without_shutdown();
7713 _result
7714 }
7715
7716 fn send_raw(
7717 &self,
7718 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7719 ) -> Result<(), fidl::Error> {
7720 self.control_handle.inner.send::<fidl::encoding::ResultType<
7721 ChannelListenerRegistryListenL2capResponse,
7722 i32,
7723 >>(
7724 result,
7725 self.tx_id,
7726 0x39c6e9001d102338,
7727 fidl::encoding::DynamicFlags::empty(),
7728 )
7729 }
7730}
7731
7732#[must_use = "FIDL methods require a response to be sent"]
7733#[derive(Debug)]
7734pub struct PeripheralAdvertiseResponder {
7735 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7736 tx_id: u32,
7737}
7738
7739impl std::ops::Drop for PeripheralAdvertiseResponder {
7743 fn drop(&mut self) {
7744 self.control_handle.shutdown();
7745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7747 }
7748}
7749
7750impl fidl::endpoints::Responder for PeripheralAdvertiseResponder {
7751 type ControlHandle = PeripheralControlHandle;
7752
7753 fn control_handle(&self) -> &PeripheralControlHandle {
7754 &self.control_handle
7755 }
7756
7757 fn drop_without_shutdown(mut self) {
7758 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7760 std::mem::forget(self);
7762 }
7763}
7764
7765impl PeripheralAdvertiseResponder {
7766 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7770 let _result = self.send_raw(result);
7771 if _result.is_err() {
7772 self.control_handle.shutdown();
7773 }
7774 self.drop_without_shutdown();
7775 _result
7776 }
7777
7778 pub fn send_no_shutdown_on_err(
7780 self,
7781 mut result: Result<(), PeripheralError>,
7782 ) -> Result<(), fidl::Error> {
7783 let _result = self.send_raw(result);
7784 self.drop_without_shutdown();
7785 _result
7786 }
7787
7788 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7789 self.control_handle.inner.send::<fidl::encoding::ResultType<
7790 fidl::encoding::EmptyStruct,
7791 PeripheralError,
7792 >>(
7793 result,
7794 self.tx_id,
7795 0x2d9ec9260c32c17f,
7796 fidl::encoding::DynamicFlags::empty(),
7797 )
7798 }
7799}
7800
7801#[must_use = "FIDL methods require a response to be sent"]
7802#[derive(Debug)]
7803pub struct PeripheralStartAdvertisingResponder {
7804 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7805 tx_id: u32,
7806}
7807
7808impl std::ops::Drop for PeripheralStartAdvertisingResponder {
7812 fn drop(&mut self) {
7813 self.control_handle.shutdown();
7814 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7816 }
7817}
7818
7819impl fidl::endpoints::Responder for PeripheralStartAdvertisingResponder {
7820 type ControlHandle = PeripheralControlHandle;
7821
7822 fn control_handle(&self) -> &PeripheralControlHandle {
7823 &self.control_handle
7824 }
7825
7826 fn drop_without_shutdown(mut self) {
7827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7829 std::mem::forget(self);
7831 }
7832}
7833
7834impl PeripheralStartAdvertisingResponder {
7835 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7839 let _result = self.send_raw(result);
7840 if _result.is_err() {
7841 self.control_handle.shutdown();
7842 }
7843 self.drop_without_shutdown();
7844 _result
7845 }
7846
7847 pub fn send_no_shutdown_on_err(
7849 self,
7850 mut result: Result<(), PeripheralError>,
7851 ) -> Result<(), fidl::Error> {
7852 let _result = self.send_raw(result);
7853 self.drop_without_shutdown();
7854 _result
7855 }
7856
7857 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7858 self.control_handle.inner.send::<fidl::encoding::ResultType<
7859 fidl::encoding::EmptyStruct,
7860 PeripheralError,
7861 >>(
7862 result,
7863 self.tx_id,
7864 0x5875c1c575f00f7d,
7865 fidl::encoding::DynamicFlags::empty(),
7866 )
7867 }
7868}
7869
7870#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7871pub struct PrivilegedPeripheralMarker;
7872
7873impl fidl::endpoints::ProtocolMarker for PrivilegedPeripheralMarker {
7874 type Proxy = PrivilegedPeripheralProxy;
7875 type RequestStream = PrivilegedPeripheralRequestStream;
7876 #[cfg(target_os = "fuchsia")]
7877 type SynchronousProxy = PrivilegedPeripheralSynchronousProxy;
7878
7879 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedPeripheral";
7880}
7881impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedPeripheralMarker {}
7882
7883pub trait PrivilegedPeripheralProxyInterface: Send + Sync {
7884 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
7885 + Send;
7886 fn r#listen_l2cap(
7887 &self,
7888 payload: ChannelListenerRegistryListenL2capRequest,
7889 ) -> Self::ListenL2capResponseFut;
7890 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
7891 + Send;
7892 fn r#advertise(
7893 &self,
7894 parameters: &AdvertisingParameters,
7895 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7896 ) -> Self::AdvertiseResponseFut;
7897 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
7898 + Send;
7899 fn r#start_advertising(
7900 &self,
7901 parameters: &AdvertisingParameters,
7902 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7903 ) -> Self::StartAdvertisingResponseFut;
7904}
7905#[derive(Debug)]
7906#[cfg(target_os = "fuchsia")]
7907pub struct PrivilegedPeripheralSynchronousProxy {
7908 client: fidl::client::sync::Client,
7909}
7910
7911#[cfg(target_os = "fuchsia")]
7912impl fidl::endpoints::SynchronousProxy for PrivilegedPeripheralSynchronousProxy {
7913 type Proxy = PrivilegedPeripheralProxy;
7914 type Protocol = PrivilegedPeripheralMarker;
7915
7916 fn from_channel(inner: fidl::Channel) -> Self {
7917 Self::new(inner)
7918 }
7919
7920 fn into_channel(self) -> fidl::Channel {
7921 self.client.into_channel()
7922 }
7923
7924 fn as_channel(&self) -> &fidl::Channel {
7925 self.client.as_channel()
7926 }
7927}
7928
7929#[cfg(target_os = "fuchsia")]
7930impl PrivilegedPeripheralSynchronousProxy {
7931 pub fn new(channel: fidl::Channel) -> Self {
7932 let protocol_name =
7933 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7934 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7935 }
7936
7937 pub fn into_channel(self) -> fidl::Channel {
7938 self.client.into_channel()
7939 }
7940
7941 pub fn wait_for_event(
7944 &self,
7945 deadline: zx::MonotonicInstant,
7946 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
7947 PrivilegedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
7948 }
7949
7950 pub fn r#listen_l2cap(
7960 &self,
7961 mut payload: ChannelListenerRegistryListenL2capRequest,
7962 ___deadline: zx::MonotonicInstant,
7963 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
7964 let _response = self.client.send_query::<
7965 ChannelListenerRegistryListenL2capRequest,
7966 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
7967 >(
7968 &mut payload,
7969 0x39c6e9001d102338,
7970 fidl::encoding::DynamicFlags::empty(),
7971 ___deadline,
7972 )?;
7973 Ok(_response.map(|x| x))
7974 }
7975
7976 pub fn r#advertise(
8004 &self,
8005 mut parameters: &AdvertisingParameters,
8006 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8007 ___deadline: zx::MonotonicInstant,
8008 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
8009 let _response = self.client.send_query::<
8010 PeripheralAdvertiseRequest,
8011 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8012 >(
8013 (parameters, advertised_peripheral,),
8014 0x2d9ec9260c32c17f,
8015 fidl::encoding::DynamicFlags::empty(),
8016 ___deadline,
8017 )?;
8018 Ok(_response.map(|x| x))
8019 }
8020
8021 pub fn r#start_advertising(
8042 &self,
8043 mut parameters: &AdvertisingParameters,
8044 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8045 ___deadline: zx::MonotonicInstant,
8046 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
8047 let _response = self.client.send_query::<
8048 PeripheralStartAdvertisingRequest,
8049 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8050 >(
8051 (parameters, handle,),
8052 0x5875c1c575f00f7d,
8053 fidl::encoding::DynamicFlags::empty(),
8054 ___deadline,
8055 )?;
8056 Ok(_response.map(|x| x))
8057 }
8058}
8059
8060#[cfg(target_os = "fuchsia")]
8061impl From<PrivilegedPeripheralSynchronousProxy> for zx::Handle {
8062 fn from(value: PrivilegedPeripheralSynchronousProxy) -> Self {
8063 value.into_channel().into()
8064 }
8065}
8066
8067#[cfg(target_os = "fuchsia")]
8068impl From<fidl::Channel> for PrivilegedPeripheralSynchronousProxy {
8069 fn from(value: fidl::Channel) -> Self {
8070 Self::new(value)
8071 }
8072}
8073
8074#[cfg(target_os = "fuchsia")]
8075impl fidl::endpoints::FromClient for PrivilegedPeripheralSynchronousProxy {
8076 type Protocol = PrivilegedPeripheralMarker;
8077
8078 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedPeripheralMarker>) -> Self {
8079 Self::new(value.into_channel())
8080 }
8081}
8082
8083#[derive(Debug, Clone)]
8084pub struct PrivilegedPeripheralProxy {
8085 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8086}
8087
8088impl fidl::endpoints::Proxy for PrivilegedPeripheralProxy {
8089 type Protocol = PrivilegedPeripheralMarker;
8090
8091 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8092 Self::new(inner)
8093 }
8094
8095 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8096 self.client.into_channel().map_err(|client| Self { client })
8097 }
8098
8099 fn as_channel(&self) -> &::fidl::AsyncChannel {
8100 self.client.as_channel()
8101 }
8102}
8103
8104impl PrivilegedPeripheralProxy {
8105 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8107 let protocol_name =
8108 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8109 Self { client: fidl::client::Client::new(channel, protocol_name) }
8110 }
8111
8112 pub fn take_event_stream(&self) -> PrivilegedPeripheralEventStream {
8118 PrivilegedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
8119 }
8120
8121 pub fn r#listen_l2cap(
8131 &self,
8132 mut payload: ChannelListenerRegistryListenL2capRequest,
8133 ) -> fidl::client::QueryResponseFut<
8134 ChannelListenerRegistryListenL2capResult,
8135 fidl::encoding::DefaultFuchsiaResourceDialect,
8136 > {
8137 PrivilegedPeripheralProxyInterface::r#listen_l2cap(self, payload)
8138 }
8139
8140 pub fn r#advertise(
8168 &self,
8169 mut parameters: &AdvertisingParameters,
8170 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8171 ) -> fidl::client::QueryResponseFut<
8172 PeripheralAdvertiseResult,
8173 fidl::encoding::DefaultFuchsiaResourceDialect,
8174 > {
8175 PrivilegedPeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
8176 }
8177
8178 pub fn r#start_advertising(
8199 &self,
8200 mut parameters: &AdvertisingParameters,
8201 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8202 ) -> fidl::client::QueryResponseFut<
8203 PeripheralStartAdvertisingResult,
8204 fidl::encoding::DefaultFuchsiaResourceDialect,
8205 > {
8206 PrivilegedPeripheralProxyInterface::r#start_advertising(self, parameters, handle)
8207 }
8208}
8209
8210impl PrivilegedPeripheralProxyInterface for PrivilegedPeripheralProxy {
8211 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
8212 ChannelListenerRegistryListenL2capResult,
8213 fidl::encoding::DefaultFuchsiaResourceDialect,
8214 >;
8215 fn r#listen_l2cap(
8216 &self,
8217 mut payload: ChannelListenerRegistryListenL2capRequest,
8218 ) -> Self::ListenL2capResponseFut {
8219 fn _decode(
8220 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8221 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8222 let _response = fidl::client::decode_transaction_body::<
8223 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
8224 fidl::encoding::DefaultFuchsiaResourceDialect,
8225 0x39c6e9001d102338,
8226 >(_buf?)?;
8227 Ok(_response.map(|x| x))
8228 }
8229 self.client.send_query_and_decode::<
8230 ChannelListenerRegistryListenL2capRequest,
8231 ChannelListenerRegistryListenL2capResult,
8232 >(
8233 &mut payload,
8234 0x39c6e9001d102338,
8235 fidl::encoding::DynamicFlags::empty(),
8236 _decode,
8237 )
8238 }
8239
8240 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
8241 PeripheralAdvertiseResult,
8242 fidl::encoding::DefaultFuchsiaResourceDialect,
8243 >;
8244 fn r#advertise(
8245 &self,
8246 mut parameters: &AdvertisingParameters,
8247 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8248 ) -> Self::AdvertiseResponseFut {
8249 fn _decode(
8250 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8251 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
8252 let _response = fidl::client::decode_transaction_body::<
8253 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8254 fidl::encoding::DefaultFuchsiaResourceDialect,
8255 0x2d9ec9260c32c17f,
8256 >(_buf?)?;
8257 Ok(_response.map(|x| x))
8258 }
8259 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
8260 (parameters, advertised_peripheral),
8261 0x2d9ec9260c32c17f,
8262 fidl::encoding::DynamicFlags::empty(),
8263 _decode,
8264 )
8265 }
8266
8267 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
8268 PeripheralStartAdvertisingResult,
8269 fidl::encoding::DefaultFuchsiaResourceDialect,
8270 >;
8271 fn r#start_advertising(
8272 &self,
8273 mut parameters: &AdvertisingParameters,
8274 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8275 ) -> Self::StartAdvertisingResponseFut {
8276 fn _decode(
8277 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8278 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
8279 let _response = fidl::client::decode_transaction_body::<
8280 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8281 fidl::encoding::DefaultFuchsiaResourceDialect,
8282 0x5875c1c575f00f7d,
8283 >(_buf?)?;
8284 Ok(_response.map(|x| x))
8285 }
8286 self.client.send_query_and_decode::<
8287 PeripheralStartAdvertisingRequest,
8288 PeripheralStartAdvertisingResult,
8289 >(
8290 (parameters, handle,),
8291 0x5875c1c575f00f7d,
8292 fidl::encoding::DynamicFlags::empty(),
8293 _decode,
8294 )
8295 }
8296}
8297
8298pub struct PrivilegedPeripheralEventStream {
8299 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8300}
8301
8302impl std::marker::Unpin for PrivilegedPeripheralEventStream {}
8303
8304impl futures::stream::FusedStream for PrivilegedPeripheralEventStream {
8305 fn is_terminated(&self) -> bool {
8306 self.event_receiver.is_terminated()
8307 }
8308}
8309
8310impl futures::Stream for PrivilegedPeripheralEventStream {
8311 type Item = Result<PrivilegedPeripheralEvent, fidl::Error>;
8312
8313 fn poll_next(
8314 mut self: std::pin::Pin<&mut Self>,
8315 cx: &mut std::task::Context<'_>,
8316 ) -> std::task::Poll<Option<Self::Item>> {
8317 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8318 &mut self.event_receiver,
8319 cx
8320 )?) {
8321 Some(buf) => std::task::Poll::Ready(Some(PrivilegedPeripheralEvent::decode(buf))),
8322 None => std::task::Poll::Ready(None),
8323 }
8324 }
8325}
8326
8327#[derive(Debug)]
8328pub enum PrivilegedPeripheralEvent {
8329 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
8330}
8331
8332impl PrivilegedPeripheralEvent {
8333 #[allow(irrefutable_let_patterns)]
8334 pub fn into_on_peer_connected(
8335 self,
8336 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
8337 if let PrivilegedPeripheralEvent::OnPeerConnected { peer, connection } = self {
8338 Some((peer, connection))
8339 } else {
8340 None
8341 }
8342 }
8343
8344 fn decode(
8346 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8347 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
8348 let (bytes, _handles) = buf.split_mut();
8349 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8350 debug_assert_eq!(tx_header.tx_id, 0);
8351 match tx_header.ordinal {
8352 0x16135d464299e356 => {
8353 let mut out = fidl::new_empty!(
8354 PeripheralOnPeerConnectedRequest,
8355 fidl::encoding::DefaultFuchsiaResourceDialect
8356 );
8357 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8358 Ok((PrivilegedPeripheralEvent::OnPeerConnected {
8359 peer: out.peer,
8360 connection: out.connection,
8361 }))
8362 }
8363 _ => Err(fidl::Error::UnknownOrdinal {
8364 ordinal: tx_header.ordinal,
8365 protocol_name:
8366 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8367 }),
8368 }
8369 }
8370}
8371
8372pub struct PrivilegedPeripheralRequestStream {
8374 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8375 is_terminated: bool,
8376}
8377
8378impl std::marker::Unpin for PrivilegedPeripheralRequestStream {}
8379
8380impl futures::stream::FusedStream for PrivilegedPeripheralRequestStream {
8381 fn is_terminated(&self) -> bool {
8382 self.is_terminated
8383 }
8384}
8385
8386impl fidl::endpoints::RequestStream for PrivilegedPeripheralRequestStream {
8387 type Protocol = PrivilegedPeripheralMarker;
8388 type ControlHandle = PrivilegedPeripheralControlHandle;
8389
8390 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8391 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8392 }
8393
8394 fn control_handle(&self) -> Self::ControlHandle {
8395 PrivilegedPeripheralControlHandle { inner: self.inner.clone() }
8396 }
8397
8398 fn into_inner(
8399 self,
8400 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8401 {
8402 (self.inner, self.is_terminated)
8403 }
8404
8405 fn from_inner(
8406 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8407 is_terminated: bool,
8408 ) -> Self {
8409 Self { inner, is_terminated }
8410 }
8411}
8412
8413impl futures::Stream for PrivilegedPeripheralRequestStream {
8414 type Item = Result<PrivilegedPeripheralRequest, fidl::Error>;
8415
8416 fn poll_next(
8417 mut self: std::pin::Pin<&mut Self>,
8418 cx: &mut std::task::Context<'_>,
8419 ) -> std::task::Poll<Option<Self::Item>> {
8420 let this = &mut *self;
8421 if this.inner.check_shutdown(cx) {
8422 this.is_terminated = true;
8423 return std::task::Poll::Ready(None);
8424 }
8425 if this.is_terminated {
8426 panic!("polled PrivilegedPeripheralRequestStream after completion");
8427 }
8428 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8429 |bytes, handles| {
8430 match this.inner.channel().read_etc(cx, bytes, handles) {
8431 std::task::Poll::Ready(Ok(())) => {}
8432 std::task::Poll::Pending => return std::task::Poll::Pending,
8433 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8434 this.is_terminated = true;
8435 return std::task::Poll::Ready(None);
8436 }
8437 std::task::Poll::Ready(Err(e)) => {
8438 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8439 e.into(),
8440 ))))
8441 }
8442 }
8443
8444 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8446
8447 std::task::Poll::Ready(Some(match header.ordinal {
8448 0x39c6e9001d102338 => {
8449 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8450 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8451 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
8452 let control_handle = PrivilegedPeripheralControlHandle {
8453 inner: this.inner.clone(),
8454 };
8455 Ok(PrivilegedPeripheralRequest::ListenL2cap {payload: req,
8456 responder: PrivilegedPeripheralListenL2capResponder {
8457 control_handle: std::mem::ManuallyDrop::new(control_handle),
8458 tx_id: header.tx_id,
8459 },
8460 })
8461 }
8462 0x2d9ec9260c32c17f => {
8463 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8464 let mut req = fidl::new_empty!(PeripheralAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8465 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
8466 let control_handle = PrivilegedPeripheralControlHandle {
8467 inner: this.inner.clone(),
8468 };
8469 Ok(PrivilegedPeripheralRequest::Advertise {parameters: req.parameters,
8470advertised_peripheral: req.advertised_peripheral,
8471
8472 responder: PrivilegedPeripheralAdvertiseResponder {
8473 control_handle: std::mem::ManuallyDrop::new(control_handle),
8474 tx_id: header.tx_id,
8475 },
8476 })
8477 }
8478 0x5875c1c575f00f7d => {
8479 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8480 let mut req = fidl::new_empty!(PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8481 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
8482 let control_handle = PrivilegedPeripheralControlHandle {
8483 inner: this.inner.clone(),
8484 };
8485 Ok(PrivilegedPeripheralRequest::StartAdvertising {parameters: req.parameters,
8486handle: req.handle,
8487
8488 responder: PrivilegedPeripheralStartAdvertisingResponder {
8489 control_handle: std::mem::ManuallyDrop::new(control_handle),
8490 tx_id: header.tx_id,
8491 },
8492 })
8493 }
8494 _ => Err(fidl::Error::UnknownOrdinal {
8495 ordinal: header.ordinal,
8496 protocol_name: <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8497 }),
8498 }))
8499 },
8500 )
8501 }
8502}
8503
8504#[derive(Debug)]
8512pub enum PrivilegedPeripheralRequest {
8513 ListenL2cap {
8523 payload: ChannelListenerRegistryListenL2capRequest,
8524 responder: PrivilegedPeripheralListenL2capResponder,
8525 },
8526 Advertise {
8554 parameters: AdvertisingParameters,
8555 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8556 responder: PrivilegedPeripheralAdvertiseResponder,
8557 },
8558 StartAdvertising {
8579 parameters: AdvertisingParameters,
8580 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8581 responder: PrivilegedPeripheralStartAdvertisingResponder,
8582 },
8583}
8584
8585impl PrivilegedPeripheralRequest {
8586 #[allow(irrefutable_let_patterns)]
8587 pub fn into_listen_l2cap(
8588 self,
8589 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedPeripheralListenL2capResponder)>
8590 {
8591 if let PrivilegedPeripheralRequest::ListenL2cap { payload, responder } = self {
8592 Some((payload, responder))
8593 } else {
8594 None
8595 }
8596 }
8597
8598 #[allow(irrefutable_let_patterns)]
8599 pub fn into_advertise(
8600 self,
8601 ) -> Option<(
8602 AdvertisingParameters,
8603 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8604 PrivilegedPeripheralAdvertiseResponder,
8605 )> {
8606 if let PrivilegedPeripheralRequest::Advertise {
8607 parameters,
8608 advertised_peripheral,
8609 responder,
8610 } = self
8611 {
8612 Some((parameters, advertised_peripheral, responder))
8613 } else {
8614 None
8615 }
8616 }
8617
8618 #[allow(irrefutable_let_patterns)]
8619 pub fn into_start_advertising(
8620 self,
8621 ) -> Option<(
8622 AdvertisingParameters,
8623 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8624 PrivilegedPeripheralStartAdvertisingResponder,
8625 )> {
8626 if let PrivilegedPeripheralRequest::StartAdvertising { parameters, handle, responder } =
8627 self
8628 {
8629 Some((parameters, handle, responder))
8630 } else {
8631 None
8632 }
8633 }
8634
8635 pub fn method_name(&self) -> &'static str {
8637 match *self {
8638 PrivilegedPeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
8639 PrivilegedPeripheralRequest::Advertise { .. } => "advertise",
8640 PrivilegedPeripheralRequest::StartAdvertising { .. } => "start_advertising",
8641 }
8642 }
8643}
8644
8645#[derive(Debug, Clone)]
8646pub struct PrivilegedPeripheralControlHandle {
8647 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8648}
8649
8650impl fidl::endpoints::ControlHandle for PrivilegedPeripheralControlHandle {
8651 fn shutdown(&self) {
8652 self.inner.shutdown()
8653 }
8654 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8655 self.inner.shutdown_with_epitaph(status)
8656 }
8657
8658 fn is_closed(&self) -> bool {
8659 self.inner.channel().is_closed()
8660 }
8661 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8662 self.inner.channel().on_closed()
8663 }
8664
8665 #[cfg(target_os = "fuchsia")]
8666 fn signal_peer(
8667 &self,
8668 clear_mask: zx::Signals,
8669 set_mask: zx::Signals,
8670 ) -> Result<(), zx_status::Status> {
8671 use fidl::Peered;
8672 self.inner.channel().signal_peer(clear_mask, set_mask)
8673 }
8674}
8675
8676impl PrivilegedPeripheralControlHandle {
8677 pub fn send_on_peer_connected(
8678 &self,
8679 mut peer: &Peer,
8680 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
8681 ) -> Result<(), fidl::Error> {
8682 self.inner.send::<PeripheralOnPeerConnectedRequest>(
8683 (peer, connection),
8684 0,
8685 0x16135d464299e356,
8686 fidl::encoding::DynamicFlags::empty(),
8687 )
8688 }
8689}
8690
8691#[must_use = "FIDL methods require a response to be sent"]
8692#[derive(Debug)]
8693pub struct PrivilegedPeripheralListenL2capResponder {
8694 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8695 tx_id: u32,
8696}
8697
8698impl std::ops::Drop for PrivilegedPeripheralListenL2capResponder {
8702 fn drop(&mut self) {
8703 self.control_handle.shutdown();
8704 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8706 }
8707}
8708
8709impl fidl::endpoints::Responder for PrivilegedPeripheralListenL2capResponder {
8710 type ControlHandle = PrivilegedPeripheralControlHandle;
8711
8712 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8713 &self.control_handle
8714 }
8715
8716 fn drop_without_shutdown(mut self) {
8717 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8719 std::mem::forget(self);
8721 }
8722}
8723
8724impl PrivilegedPeripheralListenL2capResponder {
8725 pub fn send(
8729 self,
8730 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8731 ) -> Result<(), fidl::Error> {
8732 let _result = self.send_raw(result);
8733 if _result.is_err() {
8734 self.control_handle.shutdown();
8735 }
8736 self.drop_without_shutdown();
8737 _result
8738 }
8739
8740 pub fn send_no_shutdown_on_err(
8742 self,
8743 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8744 ) -> Result<(), fidl::Error> {
8745 let _result = self.send_raw(result);
8746 self.drop_without_shutdown();
8747 _result
8748 }
8749
8750 fn send_raw(
8751 &self,
8752 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8753 ) -> Result<(), fidl::Error> {
8754 self.control_handle.inner.send::<fidl::encoding::ResultType<
8755 ChannelListenerRegistryListenL2capResponse,
8756 i32,
8757 >>(
8758 result,
8759 self.tx_id,
8760 0x39c6e9001d102338,
8761 fidl::encoding::DynamicFlags::empty(),
8762 )
8763 }
8764}
8765
8766#[must_use = "FIDL methods require a response to be sent"]
8767#[derive(Debug)]
8768pub struct PrivilegedPeripheralAdvertiseResponder {
8769 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8770 tx_id: u32,
8771}
8772
8773impl std::ops::Drop for PrivilegedPeripheralAdvertiseResponder {
8777 fn drop(&mut self) {
8778 self.control_handle.shutdown();
8779 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8781 }
8782}
8783
8784impl fidl::endpoints::Responder for PrivilegedPeripheralAdvertiseResponder {
8785 type ControlHandle = PrivilegedPeripheralControlHandle;
8786
8787 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8788 &self.control_handle
8789 }
8790
8791 fn drop_without_shutdown(mut self) {
8792 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8794 std::mem::forget(self);
8796 }
8797}
8798
8799impl PrivilegedPeripheralAdvertiseResponder {
8800 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8804 let _result = self.send_raw(result);
8805 if _result.is_err() {
8806 self.control_handle.shutdown();
8807 }
8808 self.drop_without_shutdown();
8809 _result
8810 }
8811
8812 pub fn send_no_shutdown_on_err(
8814 self,
8815 mut result: Result<(), PeripheralError>,
8816 ) -> Result<(), fidl::Error> {
8817 let _result = self.send_raw(result);
8818 self.drop_without_shutdown();
8819 _result
8820 }
8821
8822 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8823 self.control_handle.inner.send::<fidl::encoding::ResultType<
8824 fidl::encoding::EmptyStruct,
8825 PeripheralError,
8826 >>(
8827 result,
8828 self.tx_id,
8829 0x2d9ec9260c32c17f,
8830 fidl::encoding::DynamicFlags::empty(),
8831 )
8832 }
8833}
8834
8835#[must_use = "FIDL methods require a response to be sent"]
8836#[derive(Debug)]
8837pub struct PrivilegedPeripheralStartAdvertisingResponder {
8838 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8839 tx_id: u32,
8840}
8841
8842impl std::ops::Drop for PrivilegedPeripheralStartAdvertisingResponder {
8846 fn drop(&mut self) {
8847 self.control_handle.shutdown();
8848 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8850 }
8851}
8852
8853impl fidl::endpoints::Responder for PrivilegedPeripheralStartAdvertisingResponder {
8854 type ControlHandle = PrivilegedPeripheralControlHandle;
8855
8856 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8857 &self.control_handle
8858 }
8859
8860 fn drop_without_shutdown(mut self) {
8861 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8863 std::mem::forget(self);
8865 }
8866}
8867
8868impl PrivilegedPeripheralStartAdvertisingResponder {
8869 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8873 let _result = self.send_raw(result);
8874 if _result.is_err() {
8875 self.control_handle.shutdown();
8876 }
8877 self.drop_without_shutdown();
8878 _result
8879 }
8880
8881 pub fn send_no_shutdown_on_err(
8883 self,
8884 mut result: Result<(), PeripheralError>,
8885 ) -> Result<(), fidl::Error> {
8886 let _result = self.send_raw(result);
8887 self.drop_without_shutdown();
8888 _result
8889 }
8890
8891 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8892 self.control_handle.inner.send::<fidl::encoding::ResultType<
8893 fidl::encoding::EmptyStruct,
8894 PeripheralError,
8895 >>(
8896 result,
8897 self.tx_id,
8898 0x5875c1c575f00f7d,
8899 fidl::encoding::DynamicFlags::empty(),
8900 )
8901 }
8902}
8903
8904#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8905pub struct ScanResultWatcherMarker;
8906
8907impl fidl::endpoints::ProtocolMarker for ScanResultWatcherMarker {
8908 type Proxy = ScanResultWatcherProxy;
8909 type RequestStream = ScanResultWatcherRequestStream;
8910 #[cfg(target_os = "fuchsia")]
8911 type SynchronousProxy = ScanResultWatcherSynchronousProxy;
8912
8913 const DEBUG_NAME: &'static str = "(anonymous) ScanResultWatcher";
8914}
8915
8916pub trait ScanResultWatcherProxyInterface: Send + Sync {
8917 type WatchResponseFut: std::future::Future<Output = Result<Vec<Peer>, fidl::Error>> + Send;
8918 fn r#watch(&self) -> Self::WatchResponseFut;
8919}
8920#[derive(Debug)]
8921#[cfg(target_os = "fuchsia")]
8922pub struct ScanResultWatcherSynchronousProxy {
8923 client: fidl::client::sync::Client,
8924}
8925
8926#[cfg(target_os = "fuchsia")]
8927impl fidl::endpoints::SynchronousProxy for ScanResultWatcherSynchronousProxy {
8928 type Proxy = ScanResultWatcherProxy;
8929 type Protocol = ScanResultWatcherMarker;
8930
8931 fn from_channel(inner: fidl::Channel) -> Self {
8932 Self::new(inner)
8933 }
8934
8935 fn into_channel(self) -> fidl::Channel {
8936 self.client.into_channel()
8937 }
8938
8939 fn as_channel(&self) -> &fidl::Channel {
8940 self.client.as_channel()
8941 }
8942}
8943
8944#[cfg(target_os = "fuchsia")]
8945impl ScanResultWatcherSynchronousProxy {
8946 pub fn new(channel: fidl::Channel) -> Self {
8947 let protocol_name =
8948 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8949 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8950 }
8951
8952 pub fn into_channel(self) -> fidl::Channel {
8953 self.client.into_channel()
8954 }
8955
8956 pub fn wait_for_event(
8959 &self,
8960 deadline: zx::MonotonicInstant,
8961 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
8962 ScanResultWatcherEvent::decode(self.client.wait_for_event(deadline)?)
8963 }
8964
8965 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Peer>, fidl::Error> {
8975 let _response = self
8976 .client
8977 .send_query::<fidl::encoding::EmptyPayload, ScanResultWatcherWatchResponse>(
8978 (),
8979 0x713a122e949f301a,
8980 fidl::encoding::DynamicFlags::empty(),
8981 ___deadline,
8982 )?;
8983 Ok(_response.updated)
8984 }
8985}
8986
8987#[cfg(target_os = "fuchsia")]
8988impl From<ScanResultWatcherSynchronousProxy> for zx::Handle {
8989 fn from(value: ScanResultWatcherSynchronousProxy) -> Self {
8990 value.into_channel().into()
8991 }
8992}
8993
8994#[cfg(target_os = "fuchsia")]
8995impl From<fidl::Channel> for ScanResultWatcherSynchronousProxy {
8996 fn from(value: fidl::Channel) -> Self {
8997 Self::new(value)
8998 }
8999}
9000
9001#[cfg(target_os = "fuchsia")]
9002impl fidl::endpoints::FromClient for ScanResultWatcherSynchronousProxy {
9003 type Protocol = ScanResultWatcherMarker;
9004
9005 fn from_client(value: fidl::endpoints::ClientEnd<ScanResultWatcherMarker>) -> Self {
9006 Self::new(value.into_channel())
9007 }
9008}
9009
9010#[derive(Debug, Clone)]
9011pub struct ScanResultWatcherProxy {
9012 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9013}
9014
9015impl fidl::endpoints::Proxy for ScanResultWatcherProxy {
9016 type Protocol = ScanResultWatcherMarker;
9017
9018 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9019 Self::new(inner)
9020 }
9021
9022 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9023 self.client.into_channel().map_err(|client| Self { client })
9024 }
9025
9026 fn as_channel(&self) -> &::fidl::AsyncChannel {
9027 self.client.as_channel()
9028 }
9029}
9030
9031impl ScanResultWatcherProxy {
9032 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9034 let protocol_name =
9035 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9036 Self { client: fidl::client::Client::new(channel, protocol_name) }
9037 }
9038
9039 pub fn take_event_stream(&self) -> ScanResultWatcherEventStream {
9045 ScanResultWatcherEventStream { event_receiver: self.client.take_event_receiver() }
9046 }
9047
9048 pub fn r#watch(
9058 &self,
9059 ) -> fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>
9060 {
9061 ScanResultWatcherProxyInterface::r#watch(self)
9062 }
9063}
9064
9065impl ScanResultWatcherProxyInterface for ScanResultWatcherProxy {
9066 type WatchResponseFut =
9067 fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>;
9068 fn r#watch(&self) -> Self::WatchResponseFut {
9069 fn _decode(
9070 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9071 ) -> Result<Vec<Peer>, fidl::Error> {
9072 let _response = fidl::client::decode_transaction_body::<
9073 ScanResultWatcherWatchResponse,
9074 fidl::encoding::DefaultFuchsiaResourceDialect,
9075 0x713a122e949f301a,
9076 >(_buf?)?;
9077 Ok(_response.updated)
9078 }
9079 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Peer>>(
9080 (),
9081 0x713a122e949f301a,
9082 fidl::encoding::DynamicFlags::empty(),
9083 _decode,
9084 )
9085 }
9086}
9087
9088pub struct ScanResultWatcherEventStream {
9089 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9090}
9091
9092impl std::marker::Unpin for ScanResultWatcherEventStream {}
9093
9094impl futures::stream::FusedStream for ScanResultWatcherEventStream {
9095 fn is_terminated(&self) -> bool {
9096 self.event_receiver.is_terminated()
9097 }
9098}
9099
9100impl futures::Stream for ScanResultWatcherEventStream {
9101 type Item = Result<ScanResultWatcherEvent, fidl::Error>;
9102
9103 fn poll_next(
9104 mut self: std::pin::Pin<&mut Self>,
9105 cx: &mut std::task::Context<'_>,
9106 ) -> std::task::Poll<Option<Self::Item>> {
9107 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9108 &mut self.event_receiver,
9109 cx
9110 )?) {
9111 Some(buf) => std::task::Poll::Ready(Some(ScanResultWatcherEvent::decode(buf))),
9112 None => std::task::Poll::Ready(None),
9113 }
9114 }
9115}
9116
9117#[derive(Debug)]
9118pub enum ScanResultWatcherEvent {}
9119
9120impl ScanResultWatcherEvent {
9121 fn decode(
9123 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9124 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
9125 let (bytes, _handles) = buf.split_mut();
9126 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9127 debug_assert_eq!(tx_header.tx_id, 0);
9128 match tx_header.ordinal {
9129 _ => Err(fidl::Error::UnknownOrdinal {
9130 ordinal: tx_header.ordinal,
9131 protocol_name:
9132 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9133 }),
9134 }
9135 }
9136}
9137
9138pub struct ScanResultWatcherRequestStream {
9140 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9141 is_terminated: bool,
9142}
9143
9144impl std::marker::Unpin for ScanResultWatcherRequestStream {}
9145
9146impl futures::stream::FusedStream for ScanResultWatcherRequestStream {
9147 fn is_terminated(&self) -> bool {
9148 self.is_terminated
9149 }
9150}
9151
9152impl fidl::endpoints::RequestStream for ScanResultWatcherRequestStream {
9153 type Protocol = ScanResultWatcherMarker;
9154 type ControlHandle = ScanResultWatcherControlHandle;
9155
9156 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9157 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9158 }
9159
9160 fn control_handle(&self) -> Self::ControlHandle {
9161 ScanResultWatcherControlHandle { inner: self.inner.clone() }
9162 }
9163
9164 fn into_inner(
9165 self,
9166 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9167 {
9168 (self.inner, self.is_terminated)
9169 }
9170
9171 fn from_inner(
9172 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9173 is_terminated: bool,
9174 ) -> Self {
9175 Self { inner, is_terminated }
9176 }
9177}
9178
9179impl futures::Stream for ScanResultWatcherRequestStream {
9180 type Item = Result<ScanResultWatcherRequest, fidl::Error>;
9181
9182 fn poll_next(
9183 mut self: std::pin::Pin<&mut Self>,
9184 cx: &mut std::task::Context<'_>,
9185 ) -> std::task::Poll<Option<Self::Item>> {
9186 let this = &mut *self;
9187 if this.inner.check_shutdown(cx) {
9188 this.is_terminated = true;
9189 return std::task::Poll::Ready(None);
9190 }
9191 if this.is_terminated {
9192 panic!("polled ScanResultWatcherRequestStream after completion");
9193 }
9194 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9195 |bytes, handles| {
9196 match this.inner.channel().read_etc(cx, bytes, handles) {
9197 std::task::Poll::Ready(Ok(())) => {}
9198 std::task::Poll::Pending => return std::task::Poll::Pending,
9199 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9200 this.is_terminated = true;
9201 return std::task::Poll::Ready(None);
9202 }
9203 std::task::Poll::Ready(Err(e)) => {
9204 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9205 e.into(),
9206 ))))
9207 }
9208 }
9209
9210 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9212
9213 std::task::Poll::Ready(Some(match header.ordinal {
9214 0x713a122e949f301a => {
9215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9216 let mut req = fidl::new_empty!(
9217 fidl::encoding::EmptyPayload,
9218 fidl::encoding::DefaultFuchsiaResourceDialect
9219 );
9220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9221 let control_handle =
9222 ScanResultWatcherControlHandle { inner: this.inner.clone() };
9223 Ok(ScanResultWatcherRequest::Watch {
9224 responder: ScanResultWatcherWatchResponder {
9225 control_handle: std::mem::ManuallyDrop::new(control_handle),
9226 tx_id: header.tx_id,
9227 },
9228 })
9229 }
9230 _ => Err(fidl::Error::UnknownOrdinal {
9231 ordinal: header.ordinal,
9232 protocol_name:
9233 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9234 }),
9235 }))
9236 },
9237 )
9238 }
9239}
9240
9241#[derive(Debug)]
9247pub enum ScanResultWatcherRequest {
9248 Watch { responder: ScanResultWatcherWatchResponder },
9258}
9259
9260impl ScanResultWatcherRequest {
9261 #[allow(irrefutable_let_patterns)]
9262 pub fn into_watch(self) -> Option<(ScanResultWatcherWatchResponder)> {
9263 if let ScanResultWatcherRequest::Watch { responder } = self {
9264 Some((responder))
9265 } else {
9266 None
9267 }
9268 }
9269
9270 pub fn method_name(&self) -> &'static str {
9272 match *self {
9273 ScanResultWatcherRequest::Watch { .. } => "watch",
9274 }
9275 }
9276}
9277
9278#[derive(Debug, Clone)]
9279pub struct ScanResultWatcherControlHandle {
9280 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9281}
9282
9283impl fidl::endpoints::ControlHandle for ScanResultWatcherControlHandle {
9284 fn shutdown(&self) {
9285 self.inner.shutdown()
9286 }
9287 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9288 self.inner.shutdown_with_epitaph(status)
9289 }
9290
9291 fn is_closed(&self) -> bool {
9292 self.inner.channel().is_closed()
9293 }
9294 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9295 self.inner.channel().on_closed()
9296 }
9297
9298 #[cfg(target_os = "fuchsia")]
9299 fn signal_peer(
9300 &self,
9301 clear_mask: zx::Signals,
9302 set_mask: zx::Signals,
9303 ) -> Result<(), zx_status::Status> {
9304 use fidl::Peered;
9305 self.inner.channel().signal_peer(clear_mask, set_mask)
9306 }
9307}
9308
9309impl ScanResultWatcherControlHandle {}
9310
9311#[must_use = "FIDL methods require a response to be sent"]
9312#[derive(Debug)]
9313pub struct ScanResultWatcherWatchResponder {
9314 control_handle: std::mem::ManuallyDrop<ScanResultWatcherControlHandle>,
9315 tx_id: u32,
9316}
9317
9318impl std::ops::Drop for ScanResultWatcherWatchResponder {
9322 fn drop(&mut self) {
9323 self.control_handle.shutdown();
9324 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9326 }
9327}
9328
9329impl fidl::endpoints::Responder for ScanResultWatcherWatchResponder {
9330 type ControlHandle = ScanResultWatcherControlHandle;
9331
9332 fn control_handle(&self) -> &ScanResultWatcherControlHandle {
9333 &self.control_handle
9334 }
9335
9336 fn drop_without_shutdown(mut self) {
9337 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9339 std::mem::forget(self);
9341 }
9342}
9343
9344impl ScanResultWatcherWatchResponder {
9345 pub fn send(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9349 let _result = self.send_raw(updated);
9350 if _result.is_err() {
9351 self.control_handle.shutdown();
9352 }
9353 self.drop_without_shutdown();
9354 _result
9355 }
9356
9357 pub fn send_no_shutdown_on_err(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9359 let _result = self.send_raw(updated);
9360 self.drop_without_shutdown();
9361 _result
9362 }
9363
9364 fn send_raw(&self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9365 self.control_handle.inner.send::<ScanResultWatcherWatchResponse>(
9366 (updated,),
9367 self.tx_id,
9368 0x713a122e949f301a,
9369 fidl::encoding::DynamicFlags::empty(),
9370 )
9371 }
9372}
9373
9374mod internal {
9375 use super::*;
9376
9377 impl fidl::encoding::ResourceTypeMarker for AdvertisedPeripheralOnConnectedRequest {
9378 type Borrowed<'a> = &'a mut Self;
9379 fn take_or_borrow<'a>(
9380 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9381 ) -> Self::Borrowed<'a> {
9382 value
9383 }
9384 }
9385
9386 unsafe impl fidl::encoding::TypeMarker for AdvertisedPeripheralOnConnectedRequest {
9387 type Owned = Self;
9388
9389 #[inline(always)]
9390 fn inline_align(_context: fidl::encoding::Context) -> usize {
9391 8
9392 }
9393
9394 #[inline(always)]
9395 fn inline_size(_context: fidl::encoding::Context) -> usize {
9396 24
9397 }
9398 }
9399
9400 unsafe impl
9401 fidl::encoding::Encode<
9402 AdvertisedPeripheralOnConnectedRequest,
9403 fidl::encoding::DefaultFuchsiaResourceDialect,
9404 > for &mut AdvertisedPeripheralOnConnectedRequest
9405 {
9406 #[inline]
9407 unsafe fn encode(
9408 self,
9409 encoder: &mut fidl::encoding::Encoder<
9410 '_,
9411 fidl::encoding::DefaultFuchsiaResourceDialect,
9412 >,
9413 offset: usize,
9414 _depth: fidl::encoding::Depth,
9415 ) -> fidl::Result<()> {
9416 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
9417 fidl::encoding::Encode::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9419 (
9420 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
9421 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
9422 ),
9423 encoder, offset, _depth
9424 )
9425 }
9426 }
9427 unsafe impl<
9428 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
9429 T1: fidl::encoding::Encode<
9430 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9431 fidl::encoding::DefaultFuchsiaResourceDialect,
9432 >,
9433 >
9434 fidl::encoding::Encode<
9435 AdvertisedPeripheralOnConnectedRequest,
9436 fidl::encoding::DefaultFuchsiaResourceDialect,
9437 > for (T0, T1)
9438 {
9439 #[inline]
9440 unsafe fn encode(
9441 self,
9442 encoder: &mut fidl::encoding::Encoder<
9443 '_,
9444 fidl::encoding::DefaultFuchsiaResourceDialect,
9445 >,
9446 offset: usize,
9447 depth: fidl::encoding::Depth,
9448 ) -> fidl::Result<()> {
9449 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
9450 unsafe {
9453 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9454 (ptr as *mut u64).write_unaligned(0);
9455 }
9456 self.0.encode(encoder, offset + 0, depth)?;
9458 self.1.encode(encoder, offset + 16, depth)?;
9459 Ok(())
9460 }
9461 }
9462
9463 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9464 for AdvertisedPeripheralOnConnectedRequest
9465 {
9466 #[inline(always)]
9467 fn new_empty() -> Self {
9468 Self {
9469 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
9470 connection: fidl::new_empty!(
9471 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9472 fidl::encoding::DefaultFuchsiaResourceDialect
9473 ),
9474 }
9475 }
9476
9477 #[inline]
9478 unsafe fn decode(
9479 &mut self,
9480 decoder: &mut fidl::encoding::Decoder<
9481 '_,
9482 fidl::encoding::DefaultFuchsiaResourceDialect,
9483 >,
9484 offset: usize,
9485 _depth: fidl::encoding::Depth,
9486 ) -> fidl::Result<()> {
9487 decoder.debug_check_bounds::<Self>(offset);
9488 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9490 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9491 let mask = 0xffffffff00000000u64;
9492 let maskedval = padval & mask;
9493 if maskedval != 0 {
9494 return Err(fidl::Error::NonZeroPadding {
9495 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9496 });
9497 }
9498 fidl::decode!(
9499 Peer,
9500 fidl::encoding::DefaultFuchsiaResourceDialect,
9501 &mut self.peer,
9502 decoder,
9503 offset + 0,
9504 _depth
9505 )?;
9506 fidl::decode!(
9507 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9508 fidl::encoding::DefaultFuchsiaResourceDialect,
9509 &mut self.connection,
9510 decoder,
9511 offset + 16,
9512 _depth
9513 )?;
9514 Ok(())
9515 }
9516 }
9517
9518 impl fidl::encoding::ResourceTypeMarker for CentralConnectPeripheralRequest {
9519 type Borrowed<'a> = &'a mut Self;
9520 fn take_or_borrow<'a>(
9521 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9522 ) -> Self::Borrowed<'a> {
9523 value
9524 }
9525 }
9526
9527 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralRequest {
9528 type Owned = Self;
9529
9530 #[inline(always)]
9531 fn inline_align(_context: fidl::encoding::Context) -> usize {
9532 8
9533 }
9534
9535 #[inline(always)]
9536 fn inline_size(_context: fidl::encoding::Context) -> usize {
9537 40
9538 }
9539 }
9540
9541 unsafe impl
9542 fidl::encoding::Encode<
9543 CentralConnectPeripheralRequest,
9544 fidl::encoding::DefaultFuchsiaResourceDialect,
9545 > for &mut CentralConnectPeripheralRequest
9546 {
9547 #[inline]
9548 unsafe fn encode(
9549 self,
9550 encoder: &mut fidl::encoding::Encoder<
9551 '_,
9552 fidl::encoding::DefaultFuchsiaResourceDialect,
9553 >,
9554 offset: usize,
9555 _depth: fidl::encoding::Depth,
9556 ) -> fidl::Result<()> {
9557 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
9558 fidl::encoding::Encode::<
9560 CentralConnectPeripheralRequest,
9561 fidl::encoding::DefaultFuchsiaResourceDialect,
9562 >::encode(
9563 (
9564 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
9565 &self.identifier,
9566 ),
9567 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9568 <fidl::encoding::Endpoint<
9569 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9570 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9571 &mut self.gatt_client
9572 ),
9573 ),
9574 encoder,
9575 offset,
9576 _depth,
9577 )
9578 }
9579 }
9580 unsafe impl<
9581 T0: fidl::encoding::Encode<
9582 fidl::encoding::BoundedString<16>,
9583 fidl::encoding::DefaultFuchsiaResourceDialect,
9584 >,
9585 T1: fidl::encoding::Encode<
9586 ConnectionOptions,
9587 fidl::encoding::DefaultFuchsiaResourceDialect,
9588 >,
9589 T2: fidl::encoding::Encode<
9590 fidl::encoding::Endpoint<
9591 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9592 >,
9593 fidl::encoding::DefaultFuchsiaResourceDialect,
9594 >,
9595 >
9596 fidl::encoding::Encode<
9597 CentralConnectPeripheralRequest,
9598 fidl::encoding::DefaultFuchsiaResourceDialect,
9599 > for (T0, T1, T2)
9600 {
9601 #[inline]
9602 unsafe fn encode(
9603 self,
9604 encoder: &mut fidl::encoding::Encoder<
9605 '_,
9606 fidl::encoding::DefaultFuchsiaResourceDialect,
9607 >,
9608 offset: usize,
9609 depth: fidl::encoding::Depth,
9610 ) -> fidl::Result<()> {
9611 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
9612 unsafe {
9615 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9616 (ptr as *mut u64).write_unaligned(0);
9617 }
9618 self.0.encode(encoder, offset + 0, depth)?;
9620 self.1.encode(encoder, offset + 16, depth)?;
9621 self.2.encode(encoder, offset + 32, depth)?;
9622 Ok(())
9623 }
9624 }
9625
9626 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9627 for CentralConnectPeripheralRequest
9628 {
9629 #[inline(always)]
9630 fn new_empty() -> Self {
9631 Self {
9632 identifier: fidl::new_empty!(
9633 fidl::encoding::BoundedString<16>,
9634 fidl::encoding::DefaultFuchsiaResourceDialect
9635 ),
9636 options: fidl::new_empty!(
9637 ConnectionOptions,
9638 fidl::encoding::DefaultFuchsiaResourceDialect
9639 ),
9640 gatt_client: fidl::new_empty!(
9641 fidl::encoding::Endpoint<
9642 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9643 >,
9644 fidl::encoding::DefaultFuchsiaResourceDialect
9645 ),
9646 }
9647 }
9648
9649 #[inline]
9650 unsafe fn decode(
9651 &mut self,
9652 decoder: &mut fidl::encoding::Decoder<
9653 '_,
9654 fidl::encoding::DefaultFuchsiaResourceDialect,
9655 >,
9656 offset: usize,
9657 _depth: fidl::encoding::Depth,
9658 ) -> fidl::Result<()> {
9659 decoder.debug_check_bounds::<Self>(offset);
9660 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9662 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9663 let mask = 0xffffffff00000000u64;
9664 let maskedval = padval & mask;
9665 if maskedval != 0 {
9666 return Err(fidl::Error::NonZeroPadding {
9667 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9668 });
9669 }
9670 fidl::decode!(
9671 fidl::encoding::BoundedString<16>,
9672 fidl::encoding::DefaultFuchsiaResourceDialect,
9673 &mut self.identifier,
9674 decoder,
9675 offset + 0,
9676 _depth
9677 )?;
9678 fidl::decode!(
9679 ConnectionOptions,
9680 fidl::encoding::DefaultFuchsiaResourceDialect,
9681 &mut self.options,
9682 decoder,
9683 offset + 16,
9684 _depth
9685 )?;
9686 fidl::decode!(
9687 fidl::encoding::Endpoint<
9688 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9689 >,
9690 fidl::encoding::DefaultFuchsiaResourceDialect,
9691 &mut self.gatt_client,
9692 decoder,
9693 offset + 32,
9694 _depth
9695 )?;
9696 Ok(())
9697 }
9698 }
9699
9700 impl fidl::encoding::ResourceTypeMarker for CentralConnectRequest {
9701 type Borrowed<'a> = &'a mut Self;
9702 fn take_or_borrow<'a>(
9703 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9704 ) -> Self::Borrowed<'a> {
9705 value
9706 }
9707 }
9708
9709 unsafe impl fidl::encoding::TypeMarker for CentralConnectRequest {
9710 type Owned = Self;
9711
9712 #[inline(always)]
9713 fn inline_align(_context: fidl::encoding::Context) -> usize {
9714 8
9715 }
9716
9717 #[inline(always)]
9718 fn inline_size(_context: fidl::encoding::Context) -> usize {
9719 32
9720 }
9721 }
9722
9723 unsafe impl
9724 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9725 for &mut CentralConnectRequest
9726 {
9727 #[inline]
9728 unsafe fn encode(
9729 self,
9730 encoder: &mut fidl::encoding::Encoder<
9731 '_,
9732 fidl::encoding::DefaultFuchsiaResourceDialect,
9733 >,
9734 offset: usize,
9735 _depth: fidl::encoding::Depth,
9736 ) -> fidl::Result<()> {
9737 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
9738 fidl::encoding::Encode::<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9740 (
9741 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
9742 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9743 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
9744 ),
9745 encoder, offset, _depth
9746 )
9747 }
9748 }
9749 unsafe impl<
9750 T0: fidl::encoding::Encode<
9751 fidl_fuchsia_bluetooth::PeerId,
9752 fidl::encoding::DefaultFuchsiaResourceDialect,
9753 >,
9754 T1: fidl::encoding::Encode<
9755 ConnectionOptions,
9756 fidl::encoding::DefaultFuchsiaResourceDialect,
9757 >,
9758 T2: fidl::encoding::Encode<
9759 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9760 fidl::encoding::DefaultFuchsiaResourceDialect,
9761 >,
9762 >
9763 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9764 for (T0, T1, T2)
9765 {
9766 #[inline]
9767 unsafe fn encode(
9768 self,
9769 encoder: &mut fidl::encoding::Encoder<
9770 '_,
9771 fidl::encoding::DefaultFuchsiaResourceDialect,
9772 >,
9773 offset: usize,
9774 depth: fidl::encoding::Depth,
9775 ) -> fidl::Result<()> {
9776 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
9777 unsafe {
9780 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
9781 (ptr as *mut u64).write_unaligned(0);
9782 }
9783 self.0.encode(encoder, offset + 0, depth)?;
9785 self.1.encode(encoder, offset + 8, depth)?;
9786 self.2.encode(encoder, offset + 24, depth)?;
9787 Ok(())
9788 }
9789 }
9790
9791 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9792 for CentralConnectRequest
9793 {
9794 #[inline(always)]
9795 fn new_empty() -> Self {
9796 Self {
9797 id: fidl::new_empty!(
9798 fidl_fuchsia_bluetooth::PeerId,
9799 fidl::encoding::DefaultFuchsiaResourceDialect
9800 ),
9801 options: fidl::new_empty!(
9802 ConnectionOptions,
9803 fidl::encoding::DefaultFuchsiaResourceDialect
9804 ),
9805 handle: fidl::new_empty!(
9806 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9807 fidl::encoding::DefaultFuchsiaResourceDialect
9808 ),
9809 }
9810 }
9811
9812 #[inline]
9813 unsafe fn decode(
9814 &mut self,
9815 decoder: &mut fidl::encoding::Decoder<
9816 '_,
9817 fidl::encoding::DefaultFuchsiaResourceDialect,
9818 >,
9819 offset: usize,
9820 _depth: fidl::encoding::Depth,
9821 ) -> fidl::Result<()> {
9822 decoder.debug_check_bounds::<Self>(offset);
9823 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
9825 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9826 let mask = 0xffffffff00000000u64;
9827 let maskedval = padval & mask;
9828 if maskedval != 0 {
9829 return Err(fidl::Error::NonZeroPadding {
9830 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
9831 });
9832 }
9833 fidl::decode!(
9834 fidl_fuchsia_bluetooth::PeerId,
9835 fidl::encoding::DefaultFuchsiaResourceDialect,
9836 &mut self.id,
9837 decoder,
9838 offset + 0,
9839 _depth
9840 )?;
9841 fidl::decode!(
9842 ConnectionOptions,
9843 fidl::encoding::DefaultFuchsiaResourceDialect,
9844 &mut self.options,
9845 decoder,
9846 offset + 8,
9847 _depth
9848 )?;
9849 fidl::decode!(
9850 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9851 fidl::encoding::DefaultFuchsiaResourceDialect,
9852 &mut self.handle,
9853 decoder,
9854 offset + 24,
9855 _depth
9856 )?;
9857 Ok(())
9858 }
9859 }
9860
9861 impl fidl::encoding::ResourceTypeMarker for CentralScanRequest {
9862 type Borrowed<'a> = &'a mut Self;
9863 fn take_or_borrow<'a>(
9864 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9865 ) -> Self::Borrowed<'a> {
9866 value
9867 }
9868 }
9869
9870 unsafe impl fidl::encoding::TypeMarker for CentralScanRequest {
9871 type Owned = Self;
9872
9873 #[inline(always)]
9874 fn inline_align(_context: fidl::encoding::Context) -> usize {
9875 8
9876 }
9877
9878 #[inline(always)]
9879 fn inline_size(_context: fidl::encoding::Context) -> usize {
9880 24
9881 }
9882 }
9883
9884 unsafe impl
9885 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9886 for &mut CentralScanRequest
9887 {
9888 #[inline]
9889 unsafe fn encode(
9890 self,
9891 encoder: &mut fidl::encoding::Encoder<
9892 '_,
9893 fidl::encoding::DefaultFuchsiaResourceDialect,
9894 >,
9895 offset: usize,
9896 _depth: fidl::encoding::Depth,
9897 ) -> fidl::Result<()> {
9898 encoder.debug_check_bounds::<CentralScanRequest>(offset);
9899 fidl::encoding::Encode::<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9901 (
9902 <ScanOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9903 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_watcher),
9904 ),
9905 encoder, offset, _depth
9906 )
9907 }
9908 }
9909 unsafe impl<
9910 T0: fidl::encoding::Encode<ScanOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
9911 T1: fidl::encoding::Encode<
9912 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9913 fidl::encoding::DefaultFuchsiaResourceDialect,
9914 >,
9915 >
9916 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9917 for (T0, T1)
9918 {
9919 #[inline]
9920 unsafe fn encode(
9921 self,
9922 encoder: &mut fidl::encoding::Encoder<
9923 '_,
9924 fidl::encoding::DefaultFuchsiaResourceDialect,
9925 >,
9926 offset: usize,
9927 depth: fidl::encoding::Depth,
9928 ) -> fidl::Result<()> {
9929 encoder.debug_check_bounds::<CentralScanRequest>(offset);
9930 unsafe {
9933 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9934 (ptr as *mut u64).write_unaligned(0);
9935 }
9936 self.0.encode(encoder, offset + 0, depth)?;
9938 self.1.encode(encoder, offset + 16, depth)?;
9939 Ok(())
9940 }
9941 }
9942
9943 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9944 for CentralScanRequest
9945 {
9946 #[inline(always)]
9947 fn new_empty() -> Self {
9948 Self {
9949 options: fidl::new_empty!(
9950 ScanOptions,
9951 fidl::encoding::DefaultFuchsiaResourceDialect
9952 ),
9953 result_watcher: fidl::new_empty!(
9954 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9955 fidl::encoding::DefaultFuchsiaResourceDialect
9956 ),
9957 }
9958 }
9959
9960 #[inline]
9961 unsafe fn decode(
9962 &mut self,
9963 decoder: &mut fidl::encoding::Decoder<
9964 '_,
9965 fidl::encoding::DefaultFuchsiaResourceDialect,
9966 >,
9967 offset: usize,
9968 _depth: fidl::encoding::Depth,
9969 ) -> fidl::Result<()> {
9970 decoder.debug_check_bounds::<Self>(offset);
9971 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9973 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9974 let mask = 0xffffffff00000000u64;
9975 let maskedval = padval & mask;
9976 if maskedval != 0 {
9977 return Err(fidl::Error::NonZeroPadding {
9978 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9979 });
9980 }
9981 fidl::decode!(
9982 ScanOptions,
9983 fidl::encoding::DefaultFuchsiaResourceDialect,
9984 &mut self.options,
9985 decoder,
9986 offset + 0,
9987 _depth
9988 )?;
9989 fidl::decode!(
9990 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9991 fidl::encoding::DefaultFuchsiaResourceDialect,
9992 &mut self.result_watcher,
9993 decoder,
9994 offset + 16,
9995 _depth
9996 )?;
9997 Ok(())
9998 }
9999 }
10000
10001 impl fidl::encoding::ResourceTypeMarker for ChannelListenerAcceptRequest {
10002 type Borrowed<'a> = &'a mut Self;
10003 fn take_or_borrow<'a>(
10004 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10005 ) -> Self::Borrowed<'a> {
10006 value
10007 }
10008 }
10009
10010 unsafe impl fidl::encoding::TypeMarker for ChannelListenerAcceptRequest {
10011 type Owned = Self;
10012
10013 #[inline(always)]
10014 fn inline_align(_context: fidl::encoding::Context) -> usize {
10015 4
10016 }
10017
10018 #[inline(always)]
10019 fn inline_size(_context: fidl::encoding::Context) -> usize {
10020 4
10021 }
10022 }
10023
10024 unsafe impl
10025 fidl::encoding::Encode<
10026 ChannelListenerAcceptRequest,
10027 fidl::encoding::DefaultFuchsiaResourceDialect,
10028 > for &mut ChannelListenerAcceptRequest
10029 {
10030 #[inline]
10031 unsafe fn encode(
10032 self,
10033 encoder: &mut fidl::encoding::Encoder<
10034 '_,
10035 fidl::encoding::DefaultFuchsiaResourceDialect,
10036 >,
10037 offset: usize,
10038 _depth: fidl::encoding::Depth,
10039 ) -> fidl::Result<()> {
10040 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
10041 fidl::encoding::Encode::<
10043 ChannelListenerAcceptRequest,
10044 fidl::encoding::DefaultFuchsiaResourceDialect,
10045 >::encode(
10046 (<fidl::encoding::Endpoint<
10047 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
10048 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10049 &mut self.channel
10050 ),),
10051 encoder,
10052 offset,
10053 _depth,
10054 )
10055 }
10056 }
10057 unsafe impl<
10058 T0: fidl::encoding::Encode<
10059 fidl::encoding::Endpoint<
10060 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
10061 >,
10062 fidl::encoding::DefaultFuchsiaResourceDialect,
10063 >,
10064 >
10065 fidl::encoding::Encode<
10066 ChannelListenerAcceptRequest,
10067 fidl::encoding::DefaultFuchsiaResourceDialect,
10068 > for (T0,)
10069 {
10070 #[inline]
10071 unsafe fn encode(
10072 self,
10073 encoder: &mut fidl::encoding::Encoder<
10074 '_,
10075 fidl::encoding::DefaultFuchsiaResourceDialect,
10076 >,
10077 offset: usize,
10078 depth: fidl::encoding::Depth,
10079 ) -> fidl::Result<()> {
10080 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
10081 self.0.encode(encoder, offset + 0, depth)?;
10085 Ok(())
10086 }
10087 }
10088
10089 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10090 for ChannelListenerAcceptRequest
10091 {
10092 #[inline(always)]
10093 fn new_empty() -> Self {
10094 Self {
10095 channel: fidl::new_empty!(
10096 fidl::encoding::Endpoint<
10097 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
10098 >,
10099 fidl::encoding::DefaultFuchsiaResourceDialect
10100 ),
10101 }
10102 }
10103
10104 #[inline]
10105 unsafe fn decode(
10106 &mut self,
10107 decoder: &mut fidl::encoding::Decoder<
10108 '_,
10109 fidl::encoding::DefaultFuchsiaResourceDialect,
10110 >,
10111 offset: usize,
10112 _depth: fidl::encoding::Depth,
10113 ) -> fidl::Result<()> {
10114 decoder.debug_check_bounds::<Self>(offset);
10115 fidl::decode!(
10117 fidl::encoding::Endpoint<
10118 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
10119 >,
10120 fidl::encoding::DefaultFuchsiaResourceDialect,
10121 &mut self.channel,
10122 decoder,
10123 offset + 0,
10124 _depth
10125 )?;
10126 Ok(())
10127 }
10128 }
10129
10130 impl fidl::encoding::ResourceTypeMarker for ConnectionRequestGattClientRequest {
10131 type Borrowed<'a> = &'a mut Self;
10132 fn take_or_borrow<'a>(
10133 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10134 ) -> Self::Borrowed<'a> {
10135 value
10136 }
10137 }
10138
10139 unsafe impl fidl::encoding::TypeMarker for ConnectionRequestGattClientRequest {
10140 type Owned = Self;
10141
10142 #[inline(always)]
10143 fn inline_align(_context: fidl::encoding::Context) -> usize {
10144 4
10145 }
10146
10147 #[inline(always)]
10148 fn inline_size(_context: fidl::encoding::Context) -> usize {
10149 4
10150 }
10151 }
10152
10153 unsafe impl
10154 fidl::encoding::Encode<
10155 ConnectionRequestGattClientRequest,
10156 fidl::encoding::DefaultFuchsiaResourceDialect,
10157 > for &mut ConnectionRequestGattClientRequest
10158 {
10159 #[inline]
10160 unsafe fn encode(
10161 self,
10162 encoder: &mut fidl::encoding::Encoder<
10163 '_,
10164 fidl::encoding::DefaultFuchsiaResourceDialect,
10165 >,
10166 offset: usize,
10167 _depth: fidl::encoding::Depth,
10168 ) -> fidl::Result<()> {
10169 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
10170 fidl::encoding::Encode::<
10172 ConnectionRequestGattClientRequest,
10173 fidl::encoding::DefaultFuchsiaResourceDialect,
10174 >::encode(
10175 (<fidl::encoding::Endpoint<
10176 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10177 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10178 &mut self.client
10179 ),),
10180 encoder,
10181 offset,
10182 _depth,
10183 )
10184 }
10185 }
10186 unsafe impl<
10187 T0: fidl::encoding::Encode<
10188 fidl::encoding::Endpoint<
10189 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10190 >,
10191 fidl::encoding::DefaultFuchsiaResourceDialect,
10192 >,
10193 >
10194 fidl::encoding::Encode<
10195 ConnectionRequestGattClientRequest,
10196 fidl::encoding::DefaultFuchsiaResourceDialect,
10197 > for (T0,)
10198 {
10199 #[inline]
10200 unsafe fn encode(
10201 self,
10202 encoder: &mut fidl::encoding::Encoder<
10203 '_,
10204 fidl::encoding::DefaultFuchsiaResourceDialect,
10205 >,
10206 offset: usize,
10207 depth: fidl::encoding::Depth,
10208 ) -> fidl::Result<()> {
10209 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
10210 self.0.encode(encoder, offset + 0, depth)?;
10214 Ok(())
10215 }
10216 }
10217
10218 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10219 for ConnectionRequestGattClientRequest
10220 {
10221 #[inline(always)]
10222 fn new_empty() -> Self {
10223 Self {
10224 client: fidl::new_empty!(
10225 fidl::encoding::Endpoint<
10226 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10227 >,
10228 fidl::encoding::DefaultFuchsiaResourceDialect
10229 ),
10230 }
10231 }
10232
10233 #[inline]
10234 unsafe fn decode(
10235 &mut self,
10236 decoder: &mut fidl::encoding::Decoder<
10237 '_,
10238 fidl::encoding::DefaultFuchsiaResourceDialect,
10239 >,
10240 offset: usize,
10241 _depth: fidl::encoding::Depth,
10242 ) -> fidl::Result<()> {
10243 decoder.debug_check_bounds::<Self>(offset);
10244 fidl::decode!(
10246 fidl::encoding::Endpoint<
10247 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10248 >,
10249 fidl::encoding::DefaultFuchsiaResourceDialect,
10250 &mut self.client,
10251 decoder,
10252 offset + 0,
10253 _depth
10254 )?;
10255 Ok(())
10256 }
10257 }
10258
10259 impl fidl::encoding::ResourceTypeMarker for PeripheralAdvertiseRequest {
10260 type Borrowed<'a> = &'a mut Self;
10261 fn take_or_borrow<'a>(
10262 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10263 ) -> Self::Borrowed<'a> {
10264 value
10265 }
10266 }
10267
10268 unsafe impl fidl::encoding::TypeMarker for PeripheralAdvertiseRequest {
10269 type Owned = Self;
10270
10271 #[inline(always)]
10272 fn inline_align(_context: fidl::encoding::Context) -> usize {
10273 8
10274 }
10275
10276 #[inline(always)]
10277 fn inline_size(_context: fidl::encoding::Context) -> usize {
10278 24
10279 }
10280 }
10281
10282 unsafe impl
10283 fidl::encoding::Encode<
10284 PeripheralAdvertiseRequest,
10285 fidl::encoding::DefaultFuchsiaResourceDialect,
10286 > for &mut PeripheralAdvertiseRequest
10287 {
10288 #[inline]
10289 unsafe fn encode(
10290 self,
10291 encoder: &mut fidl::encoding::Encoder<
10292 '_,
10293 fidl::encoding::DefaultFuchsiaResourceDialect,
10294 >,
10295 offset: usize,
10296 _depth: fidl::encoding::Depth,
10297 ) -> fidl::Result<()> {
10298 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
10299 fidl::encoding::Encode::<
10301 PeripheralAdvertiseRequest,
10302 fidl::encoding::DefaultFuchsiaResourceDialect,
10303 >::encode(
10304 (
10305 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(
10306 &self.parameters,
10307 ),
10308 <fidl::encoding::Endpoint<
10309 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
10310 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10311 &mut self.advertised_peripheral,
10312 ),
10313 ),
10314 encoder,
10315 offset,
10316 _depth,
10317 )
10318 }
10319 }
10320 unsafe impl<
10321 T0: fidl::encoding::Encode<
10322 AdvertisingParameters,
10323 fidl::encoding::DefaultFuchsiaResourceDialect,
10324 >,
10325 T1: fidl::encoding::Encode<
10326 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
10327 fidl::encoding::DefaultFuchsiaResourceDialect,
10328 >,
10329 >
10330 fidl::encoding::Encode<
10331 PeripheralAdvertiseRequest,
10332 fidl::encoding::DefaultFuchsiaResourceDialect,
10333 > for (T0, T1)
10334 {
10335 #[inline]
10336 unsafe fn encode(
10337 self,
10338 encoder: &mut fidl::encoding::Encoder<
10339 '_,
10340 fidl::encoding::DefaultFuchsiaResourceDialect,
10341 >,
10342 offset: usize,
10343 depth: fidl::encoding::Depth,
10344 ) -> fidl::Result<()> {
10345 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
10346 unsafe {
10349 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10350 (ptr as *mut u64).write_unaligned(0);
10351 }
10352 self.0.encode(encoder, offset + 0, depth)?;
10354 self.1.encode(encoder, offset + 16, depth)?;
10355 Ok(())
10356 }
10357 }
10358
10359 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10360 for PeripheralAdvertiseRequest
10361 {
10362 #[inline(always)]
10363 fn new_empty() -> Self {
10364 Self {
10365 parameters: fidl::new_empty!(
10366 AdvertisingParameters,
10367 fidl::encoding::DefaultFuchsiaResourceDialect
10368 ),
10369 advertised_peripheral: fidl::new_empty!(
10370 fidl::encoding::Endpoint<
10371 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
10372 >,
10373 fidl::encoding::DefaultFuchsiaResourceDialect
10374 ),
10375 }
10376 }
10377
10378 #[inline]
10379 unsafe fn decode(
10380 &mut self,
10381 decoder: &mut fidl::encoding::Decoder<
10382 '_,
10383 fidl::encoding::DefaultFuchsiaResourceDialect,
10384 >,
10385 offset: usize,
10386 _depth: fidl::encoding::Depth,
10387 ) -> fidl::Result<()> {
10388 decoder.debug_check_bounds::<Self>(offset);
10389 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10391 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10392 let mask = 0xffffffff00000000u64;
10393 let maskedval = padval & mask;
10394 if maskedval != 0 {
10395 return Err(fidl::Error::NonZeroPadding {
10396 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10397 });
10398 }
10399 fidl::decode!(
10400 AdvertisingParameters,
10401 fidl::encoding::DefaultFuchsiaResourceDialect,
10402 &mut self.parameters,
10403 decoder,
10404 offset + 0,
10405 _depth
10406 )?;
10407 fidl::decode!(
10408 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
10409 fidl::encoding::DefaultFuchsiaResourceDialect,
10410 &mut self.advertised_peripheral,
10411 decoder,
10412 offset + 16,
10413 _depth
10414 )?;
10415 Ok(())
10416 }
10417 }
10418
10419 impl fidl::encoding::ResourceTypeMarker for PeripheralOnPeerConnectedRequest {
10420 type Borrowed<'a> = &'a mut Self;
10421 fn take_or_borrow<'a>(
10422 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10423 ) -> Self::Borrowed<'a> {
10424 value
10425 }
10426 }
10427
10428 unsafe impl fidl::encoding::TypeMarker for PeripheralOnPeerConnectedRequest {
10429 type Owned = Self;
10430
10431 #[inline(always)]
10432 fn inline_align(_context: fidl::encoding::Context) -> usize {
10433 8
10434 }
10435
10436 #[inline(always)]
10437 fn inline_size(_context: fidl::encoding::Context) -> usize {
10438 24
10439 }
10440 }
10441
10442 unsafe impl
10443 fidl::encoding::Encode<
10444 PeripheralOnPeerConnectedRequest,
10445 fidl::encoding::DefaultFuchsiaResourceDialect,
10446 > for &mut PeripheralOnPeerConnectedRequest
10447 {
10448 #[inline]
10449 unsafe fn encode(
10450 self,
10451 encoder: &mut fidl::encoding::Encoder<
10452 '_,
10453 fidl::encoding::DefaultFuchsiaResourceDialect,
10454 >,
10455 offset: usize,
10456 _depth: fidl::encoding::Depth,
10457 ) -> fidl::Result<()> {
10458 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
10459 fidl::encoding::Encode::<PeripheralOnPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10461 (
10462 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
10463 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
10464 ),
10465 encoder, offset, _depth
10466 )
10467 }
10468 }
10469 unsafe impl<
10470 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
10471 T1: fidl::encoding::Encode<
10472 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10473 fidl::encoding::DefaultFuchsiaResourceDialect,
10474 >,
10475 >
10476 fidl::encoding::Encode<
10477 PeripheralOnPeerConnectedRequest,
10478 fidl::encoding::DefaultFuchsiaResourceDialect,
10479 > for (T0, T1)
10480 {
10481 #[inline]
10482 unsafe fn encode(
10483 self,
10484 encoder: &mut fidl::encoding::Encoder<
10485 '_,
10486 fidl::encoding::DefaultFuchsiaResourceDialect,
10487 >,
10488 offset: usize,
10489 depth: fidl::encoding::Depth,
10490 ) -> fidl::Result<()> {
10491 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
10492 unsafe {
10495 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10496 (ptr as *mut u64).write_unaligned(0);
10497 }
10498 self.0.encode(encoder, offset + 0, depth)?;
10500 self.1.encode(encoder, offset + 16, depth)?;
10501 Ok(())
10502 }
10503 }
10504
10505 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10506 for PeripheralOnPeerConnectedRequest
10507 {
10508 #[inline(always)]
10509 fn new_empty() -> Self {
10510 Self {
10511 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
10512 connection: fidl::new_empty!(
10513 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10514 fidl::encoding::DefaultFuchsiaResourceDialect
10515 ),
10516 }
10517 }
10518
10519 #[inline]
10520 unsafe fn decode(
10521 &mut self,
10522 decoder: &mut fidl::encoding::Decoder<
10523 '_,
10524 fidl::encoding::DefaultFuchsiaResourceDialect,
10525 >,
10526 offset: usize,
10527 _depth: fidl::encoding::Depth,
10528 ) -> fidl::Result<()> {
10529 decoder.debug_check_bounds::<Self>(offset);
10530 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10532 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10533 let mask = 0xffffffff00000000u64;
10534 let maskedval = padval & mask;
10535 if maskedval != 0 {
10536 return Err(fidl::Error::NonZeroPadding {
10537 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10538 });
10539 }
10540 fidl::decode!(
10541 Peer,
10542 fidl::encoding::DefaultFuchsiaResourceDialect,
10543 &mut self.peer,
10544 decoder,
10545 offset + 0,
10546 _depth
10547 )?;
10548 fidl::decode!(
10549 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10550 fidl::encoding::DefaultFuchsiaResourceDialect,
10551 &mut self.connection,
10552 decoder,
10553 offset + 16,
10554 _depth
10555 )?;
10556 Ok(())
10557 }
10558 }
10559
10560 impl fidl::encoding::ResourceTypeMarker for PeripheralStartAdvertisingRequest {
10561 type Borrowed<'a> = &'a mut Self;
10562 fn take_or_borrow<'a>(
10563 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10564 ) -> Self::Borrowed<'a> {
10565 value
10566 }
10567 }
10568
10569 unsafe impl fidl::encoding::TypeMarker for PeripheralStartAdvertisingRequest {
10570 type Owned = Self;
10571
10572 #[inline(always)]
10573 fn inline_align(_context: fidl::encoding::Context) -> usize {
10574 8
10575 }
10576
10577 #[inline(always)]
10578 fn inline_size(_context: fidl::encoding::Context) -> usize {
10579 24
10580 }
10581 }
10582
10583 unsafe impl
10584 fidl::encoding::Encode<
10585 PeripheralStartAdvertisingRequest,
10586 fidl::encoding::DefaultFuchsiaResourceDialect,
10587 > for &mut PeripheralStartAdvertisingRequest
10588 {
10589 #[inline]
10590 unsafe fn encode(
10591 self,
10592 encoder: &mut fidl::encoding::Encoder<
10593 '_,
10594 fidl::encoding::DefaultFuchsiaResourceDialect,
10595 >,
10596 offset: usize,
10597 _depth: fidl::encoding::Depth,
10598 ) -> fidl::Result<()> {
10599 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
10600 fidl::encoding::Encode::<PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10602 (
10603 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
10604 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
10605 ),
10606 encoder, offset, _depth
10607 )
10608 }
10609 }
10610 unsafe impl<
10611 T0: fidl::encoding::Encode<
10612 AdvertisingParameters,
10613 fidl::encoding::DefaultFuchsiaResourceDialect,
10614 >,
10615 T1: fidl::encoding::Encode<
10616 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10617 fidl::encoding::DefaultFuchsiaResourceDialect,
10618 >,
10619 >
10620 fidl::encoding::Encode<
10621 PeripheralStartAdvertisingRequest,
10622 fidl::encoding::DefaultFuchsiaResourceDialect,
10623 > for (T0, T1)
10624 {
10625 #[inline]
10626 unsafe fn encode(
10627 self,
10628 encoder: &mut fidl::encoding::Encoder<
10629 '_,
10630 fidl::encoding::DefaultFuchsiaResourceDialect,
10631 >,
10632 offset: usize,
10633 depth: fidl::encoding::Depth,
10634 ) -> fidl::Result<()> {
10635 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
10636 unsafe {
10639 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10640 (ptr as *mut u64).write_unaligned(0);
10641 }
10642 self.0.encode(encoder, offset + 0, depth)?;
10644 self.1.encode(encoder, offset + 16, depth)?;
10645 Ok(())
10646 }
10647 }
10648
10649 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10650 for PeripheralStartAdvertisingRequest
10651 {
10652 #[inline(always)]
10653 fn new_empty() -> Self {
10654 Self {
10655 parameters: fidl::new_empty!(
10656 AdvertisingParameters,
10657 fidl::encoding::DefaultFuchsiaResourceDialect
10658 ),
10659 handle: fidl::new_empty!(
10660 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10661 fidl::encoding::DefaultFuchsiaResourceDialect
10662 ),
10663 }
10664 }
10665
10666 #[inline]
10667 unsafe fn decode(
10668 &mut self,
10669 decoder: &mut fidl::encoding::Decoder<
10670 '_,
10671 fidl::encoding::DefaultFuchsiaResourceDialect,
10672 >,
10673 offset: usize,
10674 _depth: fidl::encoding::Depth,
10675 ) -> fidl::Result<()> {
10676 decoder.debug_check_bounds::<Self>(offset);
10677 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10679 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10680 let mask = 0xffffffff00000000u64;
10681 let maskedval = padval & mask;
10682 if maskedval != 0 {
10683 return Err(fidl::Error::NonZeroPadding {
10684 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10685 });
10686 }
10687 fidl::decode!(
10688 AdvertisingParameters,
10689 fidl::encoding::DefaultFuchsiaResourceDialect,
10690 &mut self.parameters,
10691 decoder,
10692 offset + 0,
10693 _depth
10694 )?;
10695 fidl::decode!(
10696 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10697 fidl::encoding::DefaultFuchsiaResourceDialect,
10698 &mut self.handle,
10699 decoder,
10700 offset + 16,
10701 _depth
10702 )?;
10703 Ok(())
10704 }
10705 }
10706
10707 impl CentralCreateConnectedIsochronousGroupRequest {
10708 #[inline(always)]
10709 fn max_ordinal_present(&self) -> u64 {
10710 if let Some(_) = self.cig {
10711 return 3;
10712 }
10713 if let Some(_) = self.cis_requested_parameters {
10714 return 2;
10715 }
10716 if let Some(_) = self.cig_parameters {
10717 return 1;
10718 }
10719 0
10720 }
10721 }
10722
10723 impl fidl::encoding::ResourceTypeMarker for CentralCreateConnectedIsochronousGroupRequest {
10724 type Borrowed<'a> = &'a mut Self;
10725 fn take_or_borrow<'a>(
10726 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10727 ) -> Self::Borrowed<'a> {
10728 value
10729 }
10730 }
10731
10732 unsafe impl fidl::encoding::TypeMarker for CentralCreateConnectedIsochronousGroupRequest {
10733 type Owned = Self;
10734
10735 #[inline(always)]
10736 fn inline_align(_context: fidl::encoding::Context) -> usize {
10737 8
10738 }
10739
10740 #[inline(always)]
10741 fn inline_size(_context: fidl::encoding::Context) -> usize {
10742 16
10743 }
10744 }
10745
10746 unsafe impl
10747 fidl::encoding::Encode<
10748 CentralCreateConnectedIsochronousGroupRequest,
10749 fidl::encoding::DefaultFuchsiaResourceDialect,
10750 > for &mut CentralCreateConnectedIsochronousGroupRequest
10751 {
10752 unsafe fn encode(
10753 self,
10754 encoder: &mut fidl::encoding::Encoder<
10755 '_,
10756 fidl::encoding::DefaultFuchsiaResourceDialect,
10757 >,
10758 offset: usize,
10759 mut depth: fidl::encoding::Depth,
10760 ) -> fidl::Result<()> {
10761 encoder.debug_check_bounds::<CentralCreateConnectedIsochronousGroupRequest>(offset);
10762 let max_ordinal: u64 = self.max_ordinal_present();
10764 encoder.write_num(max_ordinal, offset);
10765 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10766 if max_ordinal == 0 {
10768 return Ok(());
10769 }
10770 depth.increment()?;
10771 let envelope_size = 8;
10772 let bytes_len = max_ordinal as usize * envelope_size;
10773 #[allow(unused_variables)]
10774 let offset = encoder.out_of_line_offset(bytes_len);
10775 let mut _prev_end_offset: usize = 0;
10776 if 1 > max_ordinal {
10777 return Ok(());
10778 }
10779
10780 let cur_offset: usize = (1 - 1) * envelope_size;
10783
10784 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10786
10787 fidl::encoding::encode_in_envelope_optional::<
10792 CigParameters,
10793 fidl::encoding::DefaultFuchsiaResourceDialect,
10794 >(
10795 self.cig_parameters
10796 .as_ref()
10797 .map(<CigParameters as fidl::encoding::ValueTypeMarker>::borrow),
10798 encoder,
10799 offset + cur_offset,
10800 depth,
10801 )?;
10802
10803 _prev_end_offset = cur_offset + envelope_size;
10804 if 2 > max_ordinal {
10805 return Ok(());
10806 }
10807
10808 let cur_offset: usize = (2 - 1) * envelope_size;
10811
10812 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10814
10815 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10820 self.cis_requested_parameters.as_mut().map(<fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10821 encoder, offset + cur_offset, depth
10822 )?;
10823
10824 _prev_end_offset = cur_offset + envelope_size;
10825 if 3 > max_ordinal {
10826 return Ok(());
10827 }
10828
10829 let cur_offset: usize = (3 - 1) * envelope_size;
10832
10833 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10835
10836 fidl::encoding::encode_in_envelope_optional::<
10841 fidl::encoding::Endpoint<
10842 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10843 >,
10844 fidl::encoding::DefaultFuchsiaResourceDialect,
10845 >(
10846 self.cig.as_mut().map(
10847 <fidl::encoding::Endpoint<
10848 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10849 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10850 ),
10851 encoder,
10852 offset + cur_offset,
10853 depth,
10854 )?;
10855
10856 _prev_end_offset = cur_offset + envelope_size;
10857
10858 Ok(())
10859 }
10860 }
10861
10862 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10863 for CentralCreateConnectedIsochronousGroupRequest
10864 {
10865 #[inline(always)]
10866 fn new_empty() -> Self {
10867 Self::default()
10868 }
10869
10870 unsafe fn decode(
10871 &mut self,
10872 decoder: &mut fidl::encoding::Decoder<
10873 '_,
10874 fidl::encoding::DefaultFuchsiaResourceDialect,
10875 >,
10876 offset: usize,
10877 mut depth: fidl::encoding::Depth,
10878 ) -> fidl::Result<()> {
10879 decoder.debug_check_bounds::<Self>(offset);
10880 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10881 None => return Err(fidl::Error::NotNullable),
10882 Some(len) => len,
10883 };
10884 if len == 0 {
10886 return Ok(());
10887 };
10888 depth.increment()?;
10889 let envelope_size = 8;
10890 let bytes_len = len * envelope_size;
10891 let offset = decoder.out_of_line_offset(bytes_len)?;
10892 let mut _next_ordinal_to_read = 0;
10894 let mut next_offset = offset;
10895 let end_offset = offset + bytes_len;
10896 _next_ordinal_to_read += 1;
10897 if next_offset >= end_offset {
10898 return Ok(());
10899 }
10900
10901 while _next_ordinal_to_read < 1 {
10903 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10904 _next_ordinal_to_read += 1;
10905 next_offset += envelope_size;
10906 }
10907
10908 let next_out_of_line = decoder.next_out_of_line();
10909 let handles_before = decoder.remaining_handles();
10910 if let Some((inlined, num_bytes, num_handles)) =
10911 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10912 {
10913 let member_inline_size =
10914 <CigParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10915 if inlined != (member_inline_size <= 4) {
10916 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10917 }
10918 let inner_offset;
10919 let mut inner_depth = depth.clone();
10920 if inlined {
10921 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10922 inner_offset = next_offset;
10923 } else {
10924 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10925 inner_depth.increment()?;
10926 }
10927 let val_ref = self.cig_parameters.get_or_insert_with(|| {
10928 fidl::new_empty!(CigParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
10929 });
10930 fidl::decode!(
10931 CigParameters,
10932 fidl::encoding::DefaultFuchsiaResourceDialect,
10933 val_ref,
10934 decoder,
10935 inner_offset,
10936 inner_depth
10937 )?;
10938 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10939 {
10940 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10941 }
10942 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10943 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10944 }
10945 }
10946
10947 next_offset += envelope_size;
10948 _next_ordinal_to_read += 1;
10949 if next_offset >= end_offset {
10950 return Ok(());
10951 }
10952
10953 while _next_ordinal_to_read < 2 {
10955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10956 _next_ordinal_to_read += 1;
10957 next_offset += envelope_size;
10958 }
10959
10960 let next_out_of_line = decoder.next_out_of_line();
10961 let handles_before = decoder.remaining_handles();
10962 if let Some((inlined, num_bytes, num_handles)) =
10963 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10964 {
10965 let member_inline_size = <fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10966 if inlined != (member_inline_size <= 4) {
10967 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10968 }
10969 let inner_offset;
10970 let mut inner_depth = depth.clone();
10971 if inlined {
10972 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10973 inner_offset = next_offset;
10974 } else {
10975 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10976 inner_depth.increment()?;
10977 }
10978 let val_ref =
10979 self.cis_requested_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect));
10980 fidl::decode!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10981 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10982 {
10983 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10984 }
10985 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10986 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10987 }
10988 }
10989
10990 next_offset += envelope_size;
10991 _next_ordinal_to_read += 1;
10992 if next_offset >= end_offset {
10993 return Ok(());
10994 }
10995
10996 while _next_ordinal_to_read < 3 {
10998 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10999 _next_ordinal_to_read += 1;
11000 next_offset += envelope_size;
11001 }
11002
11003 let next_out_of_line = decoder.next_out_of_line();
11004 let handles_before = decoder.remaining_handles();
11005 if let Some((inlined, num_bytes, num_handles)) =
11006 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11007 {
11008 let member_inline_size = <fidl::encoding::Endpoint<
11009 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
11010 > as fidl::encoding::TypeMarker>::inline_size(
11011 decoder.context
11012 );
11013 if inlined != (member_inline_size <= 4) {
11014 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11015 }
11016 let inner_offset;
11017 let mut inner_depth = depth.clone();
11018 if inlined {
11019 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11020 inner_offset = next_offset;
11021 } else {
11022 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11023 inner_depth.increment()?;
11024 }
11025 let val_ref = self.cig.get_or_insert_with(|| {
11026 fidl::new_empty!(
11027 fidl::encoding::Endpoint<
11028 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
11029 >,
11030 fidl::encoding::DefaultFuchsiaResourceDialect
11031 )
11032 });
11033 fidl::decode!(
11034 fidl::encoding::Endpoint<
11035 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
11036 >,
11037 fidl::encoding::DefaultFuchsiaResourceDialect,
11038 val_ref,
11039 decoder,
11040 inner_offset,
11041 inner_depth
11042 )?;
11043 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11044 {
11045 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11046 }
11047 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11048 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11049 }
11050 }
11051
11052 next_offset += envelope_size;
11053
11054 while next_offset < end_offset {
11056 _next_ordinal_to_read += 1;
11057 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11058 next_offset += envelope_size;
11059 }
11060
11061 Ok(())
11062 }
11063 }
11064
11065 impl ChannelListenerRegistryListenL2capRequest {
11066 #[inline(always)]
11067 fn max_ordinal_present(&self) -> u64 {
11068 if let Some(_) = self.listener {
11069 return 2;
11070 }
11071 if let Some(_) = self.parameters {
11072 return 1;
11073 }
11074 0
11075 }
11076 }
11077
11078 impl fidl::encoding::ResourceTypeMarker for ChannelListenerRegistryListenL2capRequest {
11079 type Borrowed<'a> = &'a mut Self;
11080 fn take_or_borrow<'a>(
11081 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11082 ) -> Self::Borrowed<'a> {
11083 value
11084 }
11085 }
11086
11087 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capRequest {
11088 type Owned = Self;
11089
11090 #[inline(always)]
11091 fn inline_align(_context: fidl::encoding::Context) -> usize {
11092 8
11093 }
11094
11095 #[inline(always)]
11096 fn inline_size(_context: fidl::encoding::Context) -> usize {
11097 16
11098 }
11099 }
11100
11101 unsafe impl
11102 fidl::encoding::Encode<
11103 ChannelListenerRegistryListenL2capRequest,
11104 fidl::encoding::DefaultFuchsiaResourceDialect,
11105 > for &mut ChannelListenerRegistryListenL2capRequest
11106 {
11107 unsafe fn encode(
11108 self,
11109 encoder: &mut fidl::encoding::Encoder<
11110 '_,
11111 fidl::encoding::DefaultFuchsiaResourceDialect,
11112 >,
11113 offset: usize,
11114 mut depth: fidl::encoding::Depth,
11115 ) -> fidl::Result<()> {
11116 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capRequest>(offset);
11117 let max_ordinal: u64 = self.max_ordinal_present();
11119 encoder.write_num(max_ordinal, offset);
11120 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11121 if max_ordinal == 0 {
11123 return Ok(());
11124 }
11125 depth.increment()?;
11126 let envelope_size = 8;
11127 let bytes_len = max_ordinal as usize * envelope_size;
11128 #[allow(unused_variables)]
11129 let offset = encoder.out_of_line_offset(bytes_len);
11130 let mut _prev_end_offset: usize = 0;
11131 if 1 > max_ordinal {
11132 return Ok(());
11133 }
11134
11135 let cur_offset: usize = (1 - 1) * envelope_size;
11138
11139 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11141
11142 fidl::encoding::encode_in_envelope_optional::<
11147 AcceptedChannelParameters,
11148 fidl::encoding::DefaultFuchsiaResourceDialect,
11149 >(
11150 self.parameters
11151 .as_ref()
11152 .map(<AcceptedChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
11153 encoder,
11154 offset + cur_offset,
11155 depth,
11156 )?;
11157
11158 _prev_end_offset = cur_offset + envelope_size;
11159 if 2 > max_ordinal {
11160 return Ok(());
11161 }
11162
11163 let cur_offset: usize = (2 - 1) * envelope_size;
11166
11167 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11169
11170 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11175 self.listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11176 encoder, offset + cur_offset, depth
11177 )?;
11178
11179 _prev_end_offset = cur_offset + envelope_size;
11180
11181 Ok(())
11182 }
11183 }
11184
11185 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11186 for ChannelListenerRegistryListenL2capRequest
11187 {
11188 #[inline(always)]
11189 fn new_empty() -> Self {
11190 Self::default()
11191 }
11192
11193 unsafe fn decode(
11194 &mut self,
11195 decoder: &mut fidl::encoding::Decoder<
11196 '_,
11197 fidl::encoding::DefaultFuchsiaResourceDialect,
11198 >,
11199 offset: usize,
11200 mut depth: fidl::encoding::Depth,
11201 ) -> fidl::Result<()> {
11202 decoder.debug_check_bounds::<Self>(offset);
11203 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11204 None => return Err(fidl::Error::NotNullable),
11205 Some(len) => len,
11206 };
11207 if len == 0 {
11209 return Ok(());
11210 };
11211 depth.increment()?;
11212 let envelope_size = 8;
11213 let bytes_len = len * envelope_size;
11214 let offset = decoder.out_of_line_offset(bytes_len)?;
11215 let mut _next_ordinal_to_read = 0;
11217 let mut next_offset = offset;
11218 let end_offset = offset + bytes_len;
11219 _next_ordinal_to_read += 1;
11220 if next_offset >= end_offset {
11221 return Ok(());
11222 }
11223
11224 while _next_ordinal_to_read < 1 {
11226 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11227 _next_ordinal_to_read += 1;
11228 next_offset += envelope_size;
11229 }
11230
11231 let next_out_of_line = decoder.next_out_of_line();
11232 let handles_before = decoder.remaining_handles();
11233 if let Some((inlined, num_bytes, num_handles)) =
11234 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11235 {
11236 let member_inline_size =
11237 <AcceptedChannelParameters as fidl::encoding::TypeMarker>::inline_size(
11238 decoder.context,
11239 );
11240 if inlined != (member_inline_size <= 4) {
11241 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11242 }
11243 let inner_offset;
11244 let mut inner_depth = depth.clone();
11245 if inlined {
11246 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11247 inner_offset = next_offset;
11248 } else {
11249 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11250 inner_depth.increment()?;
11251 }
11252 let val_ref = self.parameters.get_or_insert_with(|| {
11253 fidl::new_empty!(
11254 AcceptedChannelParameters,
11255 fidl::encoding::DefaultFuchsiaResourceDialect
11256 )
11257 });
11258 fidl::decode!(
11259 AcceptedChannelParameters,
11260 fidl::encoding::DefaultFuchsiaResourceDialect,
11261 val_ref,
11262 decoder,
11263 inner_offset,
11264 inner_depth
11265 )?;
11266 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11267 {
11268 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11269 }
11270 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11271 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11272 }
11273 }
11274
11275 next_offset += envelope_size;
11276 _next_ordinal_to_read += 1;
11277 if next_offset >= end_offset {
11278 return Ok(());
11279 }
11280
11281 while _next_ordinal_to_read < 2 {
11283 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11284 _next_ordinal_to_read += 1;
11285 next_offset += envelope_size;
11286 }
11287
11288 let next_out_of_line = decoder.next_out_of_line();
11289 let handles_before = decoder.remaining_handles();
11290 if let Some((inlined, num_bytes, num_handles)) =
11291 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11292 {
11293 let member_inline_size = <fidl::encoding::Endpoint<
11294 fidl::endpoints::ClientEnd<ChannelListenerMarker>,
11295 > as fidl::encoding::TypeMarker>::inline_size(
11296 decoder.context
11297 );
11298 if inlined != (member_inline_size <= 4) {
11299 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11300 }
11301 let inner_offset;
11302 let mut inner_depth = depth.clone();
11303 if inlined {
11304 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11305 inner_offset = next_offset;
11306 } else {
11307 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11308 inner_depth.increment()?;
11309 }
11310 let val_ref = self.listener.get_or_insert_with(|| {
11311 fidl::new_empty!(
11312 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
11313 fidl::encoding::DefaultFuchsiaResourceDialect
11314 )
11315 });
11316 fidl::decode!(
11317 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
11318 fidl::encoding::DefaultFuchsiaResourceDialect,
11319 val_ref,
11320 decoder,
11321 inner_offset,
11322 inner_depth
11323 )?;
11324 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11325 {
11326 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11327 }
11328 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11329 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11330 }
11331 }
11332
11333 next_offset += envelope_size;
11334
11335 while next_offset < end_offset {
11337 _next_ordinal_to_read += 1;
11338 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11339 next_offset += envelope_size;
11340 }
11341
11342 Ok(())
11343 }
11344 }
11345
11346 impl CisRequestedParameters {
11347 #[inline(always)]
11348 fn max_ordinal_present(&self) -> u64 {
11349 if let Some(_) = self.max_sdu_size_incoming {
11350 return 4;
11351 }
11352 if let Some(_) = self.max_sdu_size_outgoing {
11353 return 3;
11354 }
11355 if let Some(_) = self.connection_stream {
11356 return 2;
11357 }
11358 if let Some(_) = self.cis_id {
11359 return 1;
11360 }
11361 0
11362 }
11363 }
11364
11365 impl fidl::encoding::ResourceTypeMarker for CisRequestedParameters {
11366 type Borrowed<'a> = &'a mut Self;
11367 fn take_or_borrow<'a>(
11368 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11369 ) -> Self::Borrowed<'a> {
11370 value
11371 }
11372 }
11373
11374 unsafe impl fidl::encoding::TypeMarker for CisRequestedParameters {
11375 type Owned = Self;
11376
11377 #[inline(always)]
11378 fn inline_align(_context: fidl::encoding::Context) -> usize {
11379 8
11380 }
11381
11382 #[inline(always)]
11383 fn inline_size(_context: fidl::encoding::Context) -> usize {
11384 16
11385 }
11386 }
11387
11388 unsafe impl
11389 fidl::encoding::Encode<
11390 CisRequestedParameters,
11391 fidl::encoding::DefaultFuchsiaResourceDialect,
11392 > for &mut CisRequestedParameters
11393 {
11394 unsafe fn encode(
11395 self,
11396 encoder: &mut fidl::encoding::Encoder<
11397 '_,
11398 fidl::encoding::DefaultFuchsiaResourceDialect,
11399 >,
11400 offset: usize,
11401 mut depth: fidl::encoding::Depth,
11402 ) -> fidl::Result<()> {
11403 encoder.debug_check_bounds::<CisRequestedParameters>(offset);
11404 let max_ordinal: u64 = self.max_ordinal_present();
11406 encoder.write_num(max_ordinal, offset);
11407 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11408 if max_ordinal == 0 {
11410 return Ok(());
11411 }
11412 depth.increment()?;
11413 let envelope_size = 8;
11414 let bytes_len = max_ordinal as usize * envelope_size;
11415 #[allow(unused_variables)]
11416 let offset = encoder.out_of_line_offset(bytes_len);
11417 let mut _prev_end_offset: usize = 0;
11418 if 1 > max_ordinal {
11419 return Ok(());
11420 }
11421
11422 let cur_offset: usize = (1 - 1) * envelope_size;
11425
11426 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11428
11429 fidl::encoding::encode_in_envelope_optional::<
11434 u8,
11435 fidl::encoding::DefaultFuchsiaResourceDialect,
11436 >(
11437 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11438 encoder,
11439 offset + cur_offset,
11440 depth,
11441 )?;
11442
11443 _prev_end_offset = cur_offset + envelope_size;
11444 if 2 > max_ordinal {
11445 return Ok(());
11446 }
11447
11448 let cur_offset: usize = (2 - 1) * envelope_size;
11451
11452 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11454
11455 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11460 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11461 encoder, offset + cur_offset, depth
11462 )?;
11463
11464 _prev_end_offset = cur_offset + envelope_size;
11465 if 3 > max_ordinal {
11466 return Ok(());
11467 }
11468
11469 let cur_offset: usize = (3 - 1) * envelope_size;
11472
11473 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11475
11476 fidl::encoding::encode_in_envelope_optional::<
11481 u16,
11482 fidl::encoding::DefaultFuchsiaResourceDialect,
11483 >(
11484 self.max_sdu_size_outgoing
11485 .as_ref()
11486 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
11487 encoder,
11488 offset + cur_offset,
11489 depth,
11490 )?;
11491
11492 _prev_end_offset = cur_offset + envelope_size;
11493 if 4 > max_ordinal {
11494 return Ok(());
11495 }
11496
11497 let cur_offset: usize = (4 - 1) * envelope_size;
11500
11501 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11503
11504 fidl::encoding::encode_in_envelope_optional::<
11509 u16,
11510 fidl::encoding::DefaultFuchsiaResourceDialect,
11511 >(
11512 self.max_sdu_size_incoming
11513 .as_ref()
11514 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
11515 encoder,
11516 offset + cur_offset,
11517 depth,
11518 )?;
11519
11520 _prev_end_offset = cur_offset + envelope_size;
11521
11522 Ok(())
11523 }
11524 }
11525
11526 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11527 for CisRequestedParameters
11528 {
11529 #[inline(always)]
11530 fn new_empty() -> Self {
11531 Self::default()
11532 }
11533
11534 unsafe fn decode(
11535 &mut self,
11536 decoder: &mut fidl::encoding::Decoder<
11537 '_,
11538 fidl::encoding::DefaultFuchsiaResourceDialect,
11539 >,
11540 offset: usize,
11541 mut depth: fidl::encoding::Depth,
11542 ) -> fidl::Result<()> {
11543 decoder.debug_check_bounds::<Self>(offset);
11544 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11545 None => return Err(fidl::Error::NotNullable),
11546 Some(len) => len,
11547 };
11548 if len == 0 {
11550 return Ok(());
11551 };
11552 depth.increment()?;
11553 let envelope_size = 8;
11554 let bytes_len = len * envelope_size;
11555 let offset = decoder.out_of_line_offset(bytes_len)?;
11556 let mut _next_ordinal_to_read = 0;
11558 let mut next_offset = offset;
11559 let end_offset = offset + bytes_len;
11560 _next_ordinal_to_read += 1;
11561 if next_offset >= end_offset {
11562 return Ok(());
11563 }
11564
11565 while _next_ordinal_to_read < 1 {
11567 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11568 _next_ordinal_to_read += 1;
11569 next_offset += envelope_size;
11570 }
11571
11572 let next_out_of_line = decoder.next_out_of_line();
11573 let handles_before = decoder.remaining_handles();
11574 if let Some((inlined, num_bytes, num_handles)) =
11575 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11576 {
11577 let member_inline_size =
11578 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11579 if inlined != (member_inline_size <= 4) {
11580 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11581 }
11582 let inner_offset;
11583 let mut inner_depth = depth.clone();
11584 if inlined {
11585 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11586 inner_offset = next_offset;
11587 } else {
11588 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11589 inner_depth.increment()?;
11590 }
11591 let val_ref = self.cis_id.get_or_insert_with(|| {
11592 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
11593 });
11594 fidl::decode!(
11595 u8,
11596 fidl::encoding::DefaultFuchsiaResourceDialect,
11597 val_ref,
11598 decoder,
11599 inner_offset,
11600 inner_depth
11601 )?;
11602 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11603 {
11604 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11605 }
11606 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11607 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11608 }
11609 }
11610
11611 next_offset += envelope_size;
11612 _next_ordinal_to_read += 1;
11613 if next_offset >= end_offset {
11614 return Ok(());
11615 }
11616
11617 while _next_ordinal_to_read < 2 {
11619 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11620 _next_ordinal_to_read += 1;
11621 next_offset += envelope_size;
11622 }
11623
11624 let next_out_of_line = decoder.next_out_of_line();
11625 let handles_before = decoder.remaining_handles();
11626 if let Some((inlined, num_bytes, num_handles)) =
11627 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11628 {
11629 let member_inline_size = <fidl::encoding::Endpoint<
11630 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
11631 > as fidl::encoding::TypeMarker>::inline_size(
11632 decoder.context
11633 );
11634 if inlined != (member_inline_size <= 4) {
11635 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11636 }
11637 let inner_offset;
11638 let mut inner_depth = depth.clone();
11639 if inlined {
11640 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11641 inner_offset = next_offset;
11642 } else {
11643 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11644 inner_depth.increment()?;
11645 }
11646 let val_ref = self.connection_stream.get_or_insert_with(|| {
11647 fidl::new_empty!(
11648 fidl::encoding::Endpoint<
11649 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
11650 >,
11651 fidl::encoding::DefaultFuchsiaResourceDialect
11652 )
11653 });
11654 fidl::decode!(
11655 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
11656 fidl::encoding::DefaultFuchsiaResourceDialect,
11657 val_ref,
11658 decoder,
11659 inner_offset,
11660 inner_depth
11661 )?;
11662 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11663 {
11664 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11665 }
11666 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11667 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11668 }
11669 }
11670
11671 next_offset += envelope_size;
11672 _next_ordinal_to_read += 1;
11673 if next_offset >= end_offset {
11674 return Ok(());
11675 }
11676
11677 while _next_ordinal_to_read < 3 {
11679 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11680 _next_ordinal_to_read += 1;
11681 next_offset += envelope_size;
11682 }
11683
11684 let next_out_of_line = decoder.next_out_of_line();
11685 let handles_before = decoder.remaining_handles();
11686 if let Some((inlined, num_bytes, num_handles)) =
11687 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11688 {
11689 let member_inline_size =
11690 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11691 if inlined != (member_inline_size <= 4) {
11692 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11693 }
11694 let inner_offset;
11695 let mut inner_depth = depth.clone();
11696 if inlined {
11697 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11698 inner_offset = next_offset;
11699 } else {
11700 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11701 inner_depth.increment()?;
11702 }
11703 let val_ref = self.max_sdu_size_outgoing.get_or_insert_with(|| {
11704 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
11705 });
11706 fidl::decode!(
11707 u16,
11708 fidl::encoding::DefaultFuchsiaResourceDialect,
11709 val_ref,
11710 decoder,
11711 inner_offset,
11712 inner_depth
11713 )?;
11714 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11715 {
11716 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11717 }
11718 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11719 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11720 }
11721 }
11722
11723 next_offset += envelope_size;
11724 _next_ordinal_to_read += 1;
11725 if next_offset >= end_offset {
11726 return Ok(());
11727 }
11728
11729 while _next_ordinal_to_read < 4 {
11731 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11732 _next_ordinal_to_read += 1;
11733 next_offset += envelope_size;
11734 }
11735
11736 let next_out_of_line = decoder.next_out_of_line();
11737 let handles_before = decoder.remaining_handles();
11738 if let Some((inlined, num_bytes, num_handles)) =
11739 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11740 {
11741 let member_inline_size =
11742 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11743 if inlined != (member_inline_size <= 4) {
11744 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11745 }
11746 let inner_offset;
11747 let mut inner_depth = depth.clone();
11748 if inlined {
11749 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11750 inner_offset = next_offset;
11751 } else {
11752 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11753 inner_depth.increment()?;
11754 }
11755 let val_ref = self.max_sdu_size_incoming.get_or_insert_with(|| {
11756 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
11757 });
11758 fidl::decode!(
11759 u16,
11760 fidl::encoding::DefaultFuchsiaResourceDialect,
11761 val_ref,
11762 decoder,
11763 inner_offset,
11764 inner_depth
11765 )?;
11766 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11767 {
11768 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11769 }
11770 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11771 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11772 }
11773 }
11774
11775 next_offset += envelope_size;
11776
11777 while next_offset < end_offset {
11779 _next_ordinal_to_read += 1;
11780 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11781 next_offset += envelope_size;
11782 }
11783
11784 Ok(())
11785 }
11786 }
11787
11788 impl ConnectionAcceptCisRequest {
11789 #[inline(always)]
11790 fn max_ordinal_present(&self) -> u64 {
11791 if let Some(_) = self.connection_stream {
11792 return 3;
11793 }
11794 if let Some(_) = self.cis_id {
11795 return 2;
11796 }
11797 if let Some(_) = self.cig_id {
11798 return 1;
11799 }
11800 0
11801 }
11802 }
11803
11804 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptCisRequest {
11805 type Borrowed<'a> = &'a mut Self;
11806 fn take_or_borrow<'a>(
11807 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11808 ) -> Self::Borrowed<'a> {
11809 value
11810 }
11811 }
11812
11813 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptCisRequest {
11814 type Owned = Self;
11815
11816 #[inline(always)]
11817 fn inline_align(_context: fidl::encoding::Context) -> usize {
11818 8
11819 }
11820
11821 #[inline(always)]
11822 fn inline_size(_context: fidl::encoding::Context) -> usize {
11823 16
11824 }
11825 }
11826
11827 unsafe impl
11828 fidl::encoding::Encode<
11829 ConnectionAcceptCisRequest,
11830 fidl::encoding::DefaultFuchsiaResourceDialect,
11831 > for &mut ConnectionAcceptCisRequest
11832 {
11833 unsafe fn encode(
11834 self,
11835 encoder: &mut fidl::encoding::Encoder<
11836 '_,
11837 fidl::encoding::DefaultFuchsiaResourceDialect,
11838 >,
11839 offset: usize,
11840 mut depth: fidl::encoding::Depth,
11841 ) -> fidl::Result<()> {
11842 encoder.debug_check_bounds::<ConnectionAcceptCisRequest>(offset);
11843 let max_ordinal: u64 = self.max_ordinal_present();
11845 encoder.write_num(max_ordinal, offset);
11846 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11847 if max_ordinal == 0 {
11849 return Ok(());
11850 }
11851 depth.increment()?;
11852 let envelope_size = 8;
11853 let bytes_len = max_ordinal as usize * envelope_size;
11854 #[allow(unused_variables)]
11855 let offset = encoder.out_of_line_offset(bytes_len);
11856 let mut _prev_end_offset: usize = 0;
11857 if 1 > max_ordinal {
11858 return Ok(());
11859 }
11860
11861 let cur_offset: usize = (1 - 1) * envelope_size;
11864
11865 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11867
11868 fidl::encoding::encode_in_envelope_optional::<
11873 u8,
11874 fidl::encoding::DefaultFuchsiaResourceDialect,
11875 >(
11876 self.cig_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11877 encoder,
11878 offset + cur_offset,
11879 depth,
11880 )?;
11881
11882 _prev_end_offset = cur_offset + envelope_size;
11883 if 2 > max_ordinal {
11884 return Ok(());
11885 }
11886
11887 let cur_offset: usize = (2 - 1) * envelope_size;
11890
11891 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11893
11894 fidl::encoding::encode_in_envelope_optional::<
11899 u8,
11900 fidl::encoding::DefaultFuchsiaResourceDialect,
11901 >(
11902 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11903 encoder,
11904 offset + cur_offset,
11905 depth,
11906 )?;
11907
11908 _prev_end_offset = cur_offset + envelope_size;
11909 if 3 > max_ordinal {
11910 return Ok(());
11911 }
11912
11913 let cur_offset: usize = (3 - 1) * envelope_size;
11916
11917 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11919
11920 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11925 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11926 encoder, offset + cur_offset, depth
11927 )?;
11928
11929 _prev_end_offset = cur_offset + envelope_size;
11930
11931 Ok(())
11932 }
11933 }
11934
11935 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11936 for ConnectionAcceptCisRequest
11937 {
11938 #[inline(always)]
11939 fn new_empty() -> Self {
11940 Self::default()
11941 }
11942
11943 unsafe fn decode(
11944 &mut self,
11945 decoder: &mut fidl::encoding::Decoder<
11946 '_,
11947 fidl::encoding::DefaultFuchsiaResourceDialect,
11948 >,
11949 offset: usize,
11950 mut depth: fidl::encoding::Depth,
11951 ) -> fidl::Result<()> {
11952 decoder.debug_check_bounds::<Self>(offset);
11953 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11954 None => return Err(fidl::Error::NotNullable),
11955 Some(len) => len,
11956 };
11957 if len == 0 {
11959 return Ok(());
11960 };
11961 depth.increment()?;
11962 let envelope_size = 8;
11963 let bytes_len = len * envelope_size;
11964 let offset = decoder.out_of_line_offset(bytes_len)?;
11965 let mut _next_ordinal_to_read = 0;
11967 let mut next_offset = offset;
11968 let end_offset = offset + bytes_len;
11969 _next_ordinal_to_read += 1;
11970 if next_offset >= end_offset {
11971 return Ok(());
11972 }
11973
11974 while _next_ordinal_to_read < 1 {
11976 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11977 _next_ordinal_to_read += 1;
11978 next_offset += envelope_size;
11979 }
11980
11981 let next_out_of_line = decoder.next_out_of_line();
11982 let handles_before = decoder.remaining_handles();
11983 if let Some((inlined, num_bytes, num_handles)) =
11984 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11985 {
11986 let member_inline_size =
11987 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11988 if inlined != (member_inline_size <= 4) {
11989 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11990 }
11991 let inner_offset;
11992 let mut inner_depth = depth.clone();
11993 if inlined {
11994 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11995 inner_offset = next_offset;
11996 } else {
11997 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11998 inner_depth.increment()?;
11999 }
12000 let val_ref = self.cig_id.get_or_insert_with(|| {
12001 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
12002 });
12003 fidl::decode!(
12004 u8,
12005 fidl::encoding::DefaultFuchsiaResourceDialect,
12006 val_ref,
12007 decoder,
12008 inner_offset,
12009 inner_depth
12010 )?;
12011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12012 {
12013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12014 }
12015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12017 }
12018 }
12019
12020 next_offset += envelope_size;
12021 _next_ordinal_to_read += 1;
12022 if next_offset >= end_offset {
12023 return Ok(());
12024 }
12025
12026 while _next_ordinal_to_read < 2 {
12028 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12029 _next_ordinal_to_read += 1;
12030 next_offset += envelope_size;
12031 }
12032
12033 let next_out_of_line = decoder.next_out_of_line();
12034 let handles_before = decoder.remaining_handles();
12035 if let Some((inlined, num_bytes, num_handles)) =
12036 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12037 {
12038 let member_inline_size =
12039 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12040 if inlined != (member_inline_size <= 4) {
12041 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12042 }
12043 let inner_offset;
12044 let mut inner_depth = depth.clone();
12045 if inlined {
12046 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12047 inner_offset = next_offset;
12048 } else {
12049 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12050 inner_depth.increment()?;
12051 }
12052 let val_ref = self.cis_id.get_or_insert_with(|| {
12053 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
12054 });
12055 fidl::decode!(
12056 u8,
12057 fidl::encoding::DefaultFuchsiaResourceDialect,
12058 val_ref,
12059 decoder,
12060 inner_offset,
12061 inner_depth
12062 )?;
12063 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12064 {
12065 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12066 }
12067 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12068 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12069 }
12070 }
12071
12072 next_offset += envelope_size;
12073 _next_ordinal_to_read += 1;
12074 if next_offset >= end_offset {
12075 return Ok(());
12076 }
12077
12078 while _next_ordinal_to_read < 3 {
12080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12081 _next_ordinal_to_read += 1;
12082 next_offset += envelope_size;
12083 }
12084
12085 let next_out_of_line = decoder.next_out_of_line();
12086 let handles_before = decoder.remaining_handles();
12087 if let Some((inlined, num_bytes, num_handles)) =
12088 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12089 {
12090 let member_inline_size = <fidl::encoding::Endpoint<
12091 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
12092 > as fidl::encoding::TypeMarker>::inline_size(
12093 decoder.context
12094 );
12095 if inlined != (member_inline_size <= 4) {
12096 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12097 }
12098 let inner_offset;
12099 let mut inner_depth = depth.clone();
12100 if inlined {
12101 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12102 inner_offset = next_offset;
12103 } else {
12104 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12105 inner_depth.increment()?;
12106 }
12107 let val_ref = self.connection_stream.get_or_insert_with(|| {
12108 fidl::new_empty!(
12109 fidl::encoding::Endpoint<
12110 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
12111 >,
12112 fidl::encoding::DefaultFuchsiaResourceDialect
12113 )
12114 });
12115 fidl::decode!(
12116 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
12117 fidl::encoding::DefaultFuchsiaResourceDialect,
12118 val_ref,
12119 decoder,
12120 inner_offset,
12121 inner_depth
12122 )?;
12123 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12124 {
12125 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12126 }
12127 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12128 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12129 }
12130 }
12131
12132 next_offset += envelope_size;
12133
12134 while next_offset < end_offset {
12136 _next_ordinal_to_read += 1;
12137 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12138 next_offset += envelope_size;
12139 }
12140
12141 Ok(())
12142 }
12143 }
12144
12145 impl ConnectionConnectL2capRequest {
12146 #[inline(always)]
12147 fn max_ordinal_present(&self) -> u64 {
12148 if let Some(_) = self.psm {
12149 return 3;
12150 }
12151 if let Some(_) = self.channel {
12152 return 2;
12153 }
12154 if let Some(_) = self.parameters {
12155 return 1;
12156 }
12157 0
12158 }
12159 }
12160
12161 impl fidl::encoding::ResourceTypeMarker for ConnectionConnectL2capRequest {
12162 type Borrowed<'a> = &'a mut Self;
12163 fn take_or_borrow<'a>(
12164 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12165 ) -> Self::Borrowed<'a> {
12166 value
12167 }
12168 }
12169
12170 unsafe impl fidl::encoding::TypeMarker for ConnectionConnectL2capRequest {
12171 type Owned = Self;
12172
12173 #[inline(always)]
12174 fn inline_align(_context: fidl::encoding::Context) -> usize {
12175 8
12176 }
12177
12178 #[inline(always)]
12179 fn inline_size(_context: fidl::encoding::Context) -> usize {
12180 16
12181 }
12182 }
12183
12184 unsafe impl
12185 fidl::encoding::Encode<
12186 ConnectionConnectL2capRequest,
12187 fidl::encoding::DefaultFuchsiaResourceDialect,
12188 > for &mut ConnectionConnectL2capRequest
12189 {
12190 unsafe fn encode(
12191 self,
12192 encoder: &mut fidl::encoding::Encoder<
12193 '_,
12194 fidl::encoding::DefaultFuchsiaResourceDialect,
12195 >,
12196 offset: usize,
12197 mut depth: fidl::encoding::Depth,
12198 ) -> fidl::Result<()> {
12199 encoder.debug_check_bounds::<ConnectionConnectL2capRequest>(offset);
12200 let max_ordinal: u64 = self.max_ordinal_present();
12202 encoder.write_num(max_ordinal, offset);
12203 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12204 if max_ordinal == 0 {
12206 return Ok(());
12207 }
12208 depth.increment()?;
12209 let envelope_size = 8;
12210 let bytes_len = max_ordinal as usize * envelope_size;
12211 #[allow(unused_variables)]
12212 let offset = encoder.out_of_line_offset(bytes_len);
12213 let mut _prev_end_offset: usize = 0;
12214 if 1 > max_ordinal {
12215 return Ok(());
12216 }
12217
12218 let cur_offset: usize = (1 - 1) * envelope_size;
12221
12222 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12224
12225 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
12230 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
12231 encoder, offset + cur_offset, depth
12232 )?;
12233
12234 _prev_end_offset = cur_offset + envelope_size;
12235 if 2 > max_ordinal {
12236 return Ok(());
12237 }
12238
12239 let cur_offset: usize = (2 - 1) * envelope_size;
12242
12243 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12245
12246 fidl::encoding::encode_in_envelope_optional::<
12251 fidl::encoding::Endpoint<
12252 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12253 >,
12254 fidl::encoding::DefaultFuchsiaResourceDialect,
12255 >(
12256 self.channel.as_mut().map(
12257 <fidl::encoding::Endpoint<
12258 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12259 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12260 ),
12261 encoder,
12262 offset + cur_offset,
12263 depth,
12264 )?;
12265
12266 _prev_end_offset = cur_offset + envelope_size;
12267 if 3 > max_ordinal {
12268 return Ok(());
12269 }
12270
12271 let cur_offset: usize = (3 - 1) * envelope_size;
12274
12275 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12277
12278 fidl::encoding::encode_in_envelope_optional::<
12283 u16,
12284 fidl::encoding::DefaultFuchsiaResourceDialect,
12285 >(
12286 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
12287 encoder,
12288 offset + cur_offset,
12289 depth,
12290 )?;
12291
12292 _prev_end_offset = cur_offset + envelope_size;
12293
12294 Ok(())
12295 }
12296 }
12297
12298 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12299 for ConnectionConnectL2capRequest
12300 {
12301 #[inline(always)]
12302 fn new_empty() -> Self {
12303 Self::default()
12304 }
12305
12306 unsafe fn decode(
12307 &mut self,
12308 decoder: &mut fidl::encoding::Decoder<
12309 '_,
12310 fidl::encoding::DefaultFuchsiaResourceDialect,
12311 >,
12312 offset: usize,
12313 mut depth: fidl::encoding::Depth,
12314 ) -> fidl::Result<()> {
12315 decoder.debug_check_bounds::<Self>(offset);
12316 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12317 None => return Err(fidl::Error::NotNullable),
12318 Some(len) => len,
12319 };
12320 if len == 0 {
12322 return Ok(());
12323 };
12324 depth.increment()?;
12325 let envelope_size = 8;
12326 let bytes_len = len * envelope_size;
12327 let offset = decoder.out_of_line_offset(bytes_len)?;
12328 let mut _next_ordinal_to_read = 0;
12330 let mut next_offset = offset;
12331 let end_offset = offset + bytes_len;
12332 _next_ordinal_to_read += 1;
12333 if next_offset >= end_offset {
12334 return Ok(());
12335 }
12336
12337 while _next_ordinal_to_read < 1 {
12339 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12340 _next_ordinal_to_read += 1;
12341 next_offset += envelope_size;
12342 }
12343
12344 let next_out_of_line = decoder.next_out_of_line();
12345 let handles_before = decoder.remaining_handles();
12346 if let Some((inlined, num_bytes, num_handles)) =
12347 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12348 {
12349 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12350 if inlined != (member_inline_size <= 4) {
12351 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12352 }
12353 let inner_offset;
12354 let mut inner_depth = depth.clone();
12355 if inlined {
12356 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12357 inner_offset = next_offset;
12358 } else {
12359 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12360 inner_depth.increment()?;
12361 }
12362 let val_ref = self.parameters.get_or_insert_with(|| {
12363 fidl::new_empty!(
12364 fidl_fuchsia_bluetooth::ChannelParameters,
12365 fidl::encoding::DefaultFuchsiaResourceDialect
12366 )
12367 });
12368 fidl::decode!(
12369 fidl_fuchsia_bluetooth::ChannelParameters,
12370 fidl::encoding::DefaultFuchsiaResourceDialect,
12371 val_ref,
12372 decoder,
12373 inner_offset,
12374 inner_depth
12375 )?;
12376 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12377 {
12378 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12379 }
12380 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12381 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12382 }
12383 }
12384
12385 next_offset += envelope_size;
12386 _next_ordinal_to_read += 1;
12387 if next_offset >= end_offset {
12388 return Ok(());
12389 }
12390
12391 while _next_ordinal_to_read < 2 {
12393 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12394 _next_ordinal_to_read += 1;
12395 next_offset += envelope_size;
12396 }
12397
12398 let next_out_of_line = decoder.next_out_of_line();
12399 let handles_before = decoder.remaining_handles();
12400 if let Some((inlined, num_bytes, num_handles)) =
12401 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12402 {
12403 let member_inline_size = <fidl::encoding::Endpoint<
12404 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12405 > as fidl::encoding::TypeMarker>::inline_size(
12406 decoder.context
12407 );
12408 if inlined != (member_inline_size <= 4) {
12409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12410 }
12411 let inner_offset;
12412 let mut inner_depth = depth.clone();
12413 if inlined {
12414 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12415 inner_offset = next_offset;
12416 } else {
12417 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12418 inner_depth.increment()?;
12419 }
12420 let val_ref = self.channel.get_or_insert_with(|| {
12421 fidl::new_empty!(
12422 fidl::encoding::Endpoint<
12423 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12424 >,
12425 fidl::encoding::DefaultFuchsiaResourceDialect
12426 )
12427 });
12428 fidl::decode!(
12429 fidl::encoding::Endpoint<
12430 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12431 >,
12432 fidl::encoding::DefaultFuchsiaResourceDialect,
12433 val_ref,
12434 decoder,
12435 inner_offset,
12436 inner_depth
12437 )?;
12438 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12439 {
12440 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12441 }
12442 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12443 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12444 }
12445 }
12446
12447 next_offset += envelope_size;
12448 _next_ordinal_to_read += 1;
12449 if next_offset >= end_offset {
12450 return Ok(());
12451 }
12452
12453 while _next_ordinal_to_read < 3 {
12455 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12456 _next_ordinal_to_read += 1;
12457 next_offset += envelope_size;
12458 }
12459
12460 let next_out_of_line = decoder.next_out_of_line();
12461 let handles_before = decoder.remaining_handles();
12462 if let Some((inlined, num_bytes, num_handles)) =
12463 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12464 {
12465 let member_inline_size =
12466 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12467 if inlined != (member_inline_size <= 4) {
12468 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12469 }
12470 let inner_offset;
12471 let mut inner_depth = depth.clone();
12472 if inlined {
12473 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12474 inner_offset = next_offset;
12475 } else {
12476 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12477 inner_depth.increment()?;
12478 }
12479 let val_ref = self.psm.get_or_insert_with(|| {
12480 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
12481 });
12482 fidl::decode!(
12483 u16,
12484 fidl::encoding::DefaultFuchsiaResourceDialect,
12485 val_ref,
12486 decoder,
12487 inner_offset,
12488 inner_depth
12489 )?;
12490 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12491 {
12492 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12493 }
12494 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12495 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12496 }
12497 }
12498
12499 next_offset += envelope_size;
12500
12501 while next_offset < end_offset {
12503 _next_ordinal_to_read += 1;
12504 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12505 next_offset += envelope_size;
12506 }
12507
12508 Ok(())
12509 }
12510 }
12511}