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 CentralSyncToPeriodicAdvertisingRequest {
126 pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
130 pub advertising_sid: Option<u8>,
134 pub sync: Option<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
138 pub config: Option<PeriodicAdvertisingSyncConfiguration>,
139 #[doc(hidden)]
140 pub __source_breaking: fidl::marker::SourceBreaking,
141}
142
143impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
144 for CentralSyncToPeriodicAdvertisingRequest
145{
146}
147
148#[derive(Debug, Default, PartialEq)]
149pub struct ChannelListenerConnectedRequest {
150 pub channel: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
152 pub ext_offload: Option<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>>,
156 #[doc(hidden)]
157 pub __source_breaking: fidl::marker::SourceBreaking,
158}
159
160impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
161 for ChannelListenerConnectedRequest
162{
163}
164
165#[derive(Debug, Default, PartialEq)]
166pub struct ChannelListenerRegistryListenL2capRequest {
167 pub parameters: Option<AcceptedChannelParameters>,
169 pub listener: Option<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
171 #[doc(hidden)]
172 pub __source_breaking: fidl::marker::SourceBreaking,
173}
174
175impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
176 for ChannelListenerRegistryListenL2capRequest
177{
178}
179
180#[derive(Debug, Default, PartialEq)]
181pub struct CisRequestedParameters {
182 pub cis_id: Option<u8>,
186 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
189 pub max_sdu_size_outgoing: Option<u16>,
194 pub max_sdu_size_incoming: Option<u16>,
199 #[doc(hidden)]
200 pub __source_breaking: fidl::marker::SourceBreaking,
201}
202
203impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CisRequestedParameters {}
204
205#[derive(Debug, Default, PartialEq)]
206pub struct ConnectionAcceptCisRequest {
207 pub cig_id: Option<u8>,
209 pub cis_id: Option<u8>,
211 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
218 #[doc(hidden)]
219 pub __source_breaking: fidl::marker::SourceBreaking,
220}
221
222impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
223 for ConnectionAcceptCisRequest
224{
225}
226
227#[derive(Debug, Default, PartialEq)]
228pub struct ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
229 pub sync: Option<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
233 pub config: Option<PeriodicAdvertisingSyncConfiguration>,
234 #[doc(hidden)]
235 pub __source_breaking: fidl::marker::SourceBreaking,
236}
237
238impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
239 for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
240{
241}
242
243#[derive(Debug, Default, PartialEq)]
244pub struct ConnectionConnectL2capRequest {
245 pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
247 pub channel: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
249 pub psm: Option<u16>,
251 pub ext_offload: Option<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>>,
256 #[doc(hidden)]
257 pub __source_breaking: fidl::marker::SourceBreaking,
258}
259
260impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
261 for ConnectionConnectL2capRequest
262{
263}
264
265#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
266pub struct AdvertisedPeripheralMarker;
267
268impl fidl::endpoints::ProtocolMarker for AdvertisedPeripheralMarker {
269 type Proxy = AdvertisedPeripheralProxy;
270 type RequestStream = AdvertisedPeripheralRequestStream;
271 #[cfg(target_os = "fuchsia")]
272 type SynchronousProxy = AdvertisedPeripheralSynchronousProxy;
273
274 const DEBUG_NAME: &'static str = "(anonymous) AdvertisedPeripheral";
275}
276
277pub trait AdvertisedPeripheralProxyInterface: Send + Sync {
278 type OnConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
279 fn r#on_connected(
280 &self,
281 peer: &Peer,
282 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
283 ) -> Self::OnConnectedResponseFut;
284}
285#[derive(Debug)]
286#[cfg(target_os = "fuchsia")]
287pub struct AdvertisedPeripheralSynchronousProxy {
288 client: fidl::client::sync::Client,
289}
290
291#[cfg(target_os = "fuchsia")]
292impl fidl::endpoints::SynchronousProxy for AdvertisedPeripheralSynchronousProxy {
293 type Proxy = AdvertisedPeripheralProxy;
294 type Protocol = AdvertisedPeripheralMarker;
295
296 fn from_channel(inner: fidl::Channel) -> Self {
297 Self::new(inner)
298 }
299
300 fn into_channel(self) -> fidl::Channel {
301 self.client.into_channel()
302 }
303
304 fn as_channel(&self) -> &fidl::Channel {
305 self.client.as_channel()
306 }
307}
308
309#[cfg(target_os = "fuchsia")]
310impl AdvertisedPeripheralSynchronousProxy {
311 pub fn new(channel: fidl::Channel) -> Self {
312 Self { client: fidl::client::sync::Client::new(channel) }
313 }
314
315 pub fn into_channel(self) -> fidl::Channel {
316 self.client.into_channel()
317 }
318
319 pub fn wait_for_event(
322 &self,
323 deadline: zx::MonotonicInstant,
324 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
325 AdvertisedPeripheralEvent::decode(
326 self.client.wait_for_event::<AdvertisedPeripheralMarker>(deadline)?,
327 )
328 }
329
330 pub fn r#on_connected(
348 &self,
349 mut peer: &Peer,
350 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
351 ___deadline: zx::MonotonicInstant,
352 ) -> Result<(), fidl::Error> {
353 let _response = self.client.send_query::<
354 AdvertisedPeripheralOnConnectedRequest,
355 fidl::encoding::EmptyPayload,
356 AdvertisedPeripheralMarker,
357 >(
358 (peer, connection,),
359 0x607b7716457eb178,
360 fidl::encoding::DynamicFlags::empty(),
361 ___deadline,
362 )?;
363 Ok(_response)
364 }
365}
366
367#[cfg(target_os = "fuchsia")]
368impl From<AdvertisedPeripheralSynchronousProxy> for zx::NullableHandle {
369 fn from(value: AdvertisedPeripheralSynchronousProxy) -> Self {
370 value.into_channel().into()
371 }
372}
373
374#[cfg(target_os = "fuchsia")]
375impl From<fidl::Channel> for AdvertisedPeripheralSynchronousProxy {
376 fn from(value: fidl::Channel) -> Self {
377 Self::new(value)
378 }
379}
380
381#[cfg(target_os = "fuchsia")]
382impl fidl::endpoints::FromClient for AdvertisedPeripheralSynchronousProxy {
383 type Protocol = AdvertisedPeripheralMarker;
384
385 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>) -> Self {
386 Self::new(value.into_channel())
387 }
388}
389
390#[derive(Debug, Clone)]
391pub struct AdvertisedPeripheralProxy {
392 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
393}
394
395impl fidl::endpoints::Proxy for AdvertisedPeripheralProxy {
396 type Protocol = AdvertisedPeripheralMarker;
397
398 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
399 Self::new(inner)
400 }
401
402 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
403 self.client.into_channel().map_err(|client| Self { client })
404 }
405
406 fn as_channel(&self) -> &::fidl::AsyncChannel {
407 self.client.as_channel()
408 }
409}
410
411impl AdvertisedPeripheralProxy {
412 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
414 let protocol_name =
415 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
416 Self { client: fidl::client::Client::new(channel, protocol_name) }
417 }
418
419 pub fn take_event_stream(&self) -> AdvertisedPeripheralEventStream {
425 AdvertisedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
426 }
427
428 pub fn r#on_connected(
446 &self,
447 mut peer: &Peer,
448 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
449 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
450 AdvertisedPeripheralProxyInterface::r#on_connected(self, peer, connection)
451 }
452}
453
454impl AdvertisedPeripheralProxyInterface for AdvertisedPeripheralProxy {
455 type OnConnectedResponseFut =
456 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
457 fn r#on_connected(
458 &self,
459 mut peer: &Peer,
460 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
461 ) -> Self::OnConnectedResponseFut {
462 fn _decode(
463 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
464 ) -> Result<(), fidl::Error> {
465 let _response = fidl::client::decode_transaction_body::<
466 fidl::encoding::EmptyPayload,
467 fidl::encoding::DefaultFuchsiaResourceDialect,
468 0x607b7716457eb178,
469 >(_buf?)?;
470 Ok(_response)
471 }
472 self.client.send_query_and_decode::<AdvertisedPeripheralOnConnectedRequest, ()>(
473 (peer, connection),
474 0x607b7716457eb178,
475 fidl::encoding::DynamicFlags::empty(),
476 _decode,
477 )
478 }
479}
480
481pub struct AdvertisedPeripheralEventStream {
482 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl std::marker::Unpin for AdvertisedPeripheralEventStream {}
486
487impl futures::stream::FusedStream for AdvertisedPeripheralEventStream {
488 fn is_terminated(&self) -> bool {
489 self.event_receiver.is_terminated()
490 }
491}
492
493impl futures::Stream for AdvertisedPeripheralEventStream {
494 type Item = Result<AdvertisedPeripheralEvent, fidl::Error>;
495
496 fn poll_next(
497 mut self: std::pin::Pin<&mut Self>,
498 cx: &mut std::task::Context<'_>,
499 ) -> std::task::Poll<Option<Self::Item>> {
500 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
501 &mut self.event_receiver,
502 cx
503 )?) {
504 Some(buf) => std::task::Poll::Ready(Some(AdvertisedPeripheralEvent::decode(buf))),
505 None => std::task::Poll::Ready(None),
506 }
507 }
508}
509
510#[derive(Debug)]
511pub enum AdvertisedPeripheralEvent {}
512
513impl AdvertisedPeripheralEvent {
514 fn decode(
516 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
517 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
518 let (bytes, _handles) = buf.split_mut();
519 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
520 debug_assert_eq!(tx_header.tx_id, 0);
521 match tx_header.ordinal {
522 _ => Err(fidl::Error::UnknownOrdinal {
523 ordinal: tx_header.ordinal,
524 protocol_name:
525 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
526 }),
527 }
528 }
529}
530
531pub struct AdvertisedPeripheralRequestStream {
533 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
534 is_terminated: bool,
535}
536
537impl std::marker::Unpin for AdvertisedPeripheralRequestStream {}
538
539impl futures::stream::FusedStream for AdvertisedPeripheralRequestStream {
540 fn is_terminated(&self) -> bool {
541 self.is_terminated
542 }
543}
544
545impl fidl::endpoints::RequestStream for AdvertisedPeripheralRequestStream {
546 type Protocol = AdvertisedPeripheralMarker;
547 type ControlHandle = AdvertisedPeripheralControlHandle;
548
549 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
550 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
551 }
552
553 fn control_handle(&self) -> Self::ControlHandle {
554 AdvertisedPeripheralControlHandle { inner: self.inner.clone() }
555 }
556
557 fn into_inner(
558 self,
559 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
560 {
561 (self.inner, self.is_terminated)
562 }
563
564 fn from_inner(
565 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
566 is_terminated: bool,
567 ) -> Self {
568 Self { inner, is_terminated }
569 }
570}
571
572impl futures::Stream for AdvertisedPeripheralRequestStream {
573 type Item = Result<AdvertisedPeripheralRequest, fidl::Error>;
574
575 fn poll_next(
576 mut self: std::pin::Pin<&mut Self>,
577 cx: &mut std::task::Context<'_>,
578 ) -> std::task::Poll<Option<Self::Item>> {
579 let this = &mut *self;
580 if this.inner.check_shutdown(cx) {
581 this.is_terminated = true;
582 return std::task::Poll::Ready(None);
583 }
584 if this.is_terminated {
585 panic!("polled AdvertisedPeripheralRequestStream after completion");
586 }
587 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
588 |bytes, handles| {
589 match this.inner.channel().read_etc(cx, bytes, handles) {
590 std::task::Poll::Ready(Ok(())) => {}
591 std::task::Poll::Pending => return std::task::Poll::Pending,
592 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
593 this.is_terminated = true;
594 return std::task::Poll::Ready(None);
595 }
596 std::task::Poll::Ready(Err(e)) => {
597 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
598 e.into(),
599 ))));
600 }
601 }
602
603 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
605
606 std::task::Poll::Ready(Some(match header.ordinal {
607 0x607b7716457eb178 => {
608 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
609 let mut req = fidl::new_empty!(AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
610 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdvertisedPeripheralOnConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
611 let control_handle = AdvertisedPeripheralControlHandle {
612 inner: this.inner.clone(),
613 };
614 Ok(AdvertisedPeripheralRequest::OnConnected {peer: req.peer,
615connection: req.connection,
616
617 responder: AdvertisedPeripheralOnConnectedResponder {
618 control_handle: std::mem::ManuallyDrop::new(control_handle),
619 tx_id: header.tx_id,
620 },
621 })
622 }
623 _ => Err(fidl::Error::UnknownOrdinal {
624 ordinal: header.ordinal,
625 protocol_name: <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
626 }),
627 }))
628 },
629 )
630 }
631}
632
633#[derive(Debug)]
638pub enum AdvertisedPeripheralRequest {
639 OnConnected {
657 peer: Peer,
658 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
659 responder: AdvertisedPeripheralOnConnectedResponder,
660 },
661}
662
663impl AdvertisedPeripheralRequest {
664 #[allow(irrefutable_let_patterns)]
665 pub fn into_on_connected(
666 self,
667 ) -> Option<(
668 Peer,
669 fidl::endpoints::ClientEnd<ConnectionMarker>,
670 AdvertisedPeripheralOnConnectedResponder,
671 )> {
672 if let AdvertisedPeripheralRequest::OnConnected { peer, connection, responder } = self {
673 Some((peer, connection, responder))
674 } else {
675 None
676 }
677 }
678
679 pub fn method_name(&self) -> &'static str {
681 match *self {
682 AdvertisedPeripheralRequest::OnConnected { .. } => "on_connected",
683 }
684 }
685}
686
687#[derive(Debug, Clone)]
688pub struct AdvertisedPeripheralControlHandle {
689 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
690}
691
692impl fidl::endpoints::ControlHandle for AdvertisedPeripheralControlHandle {
693 fn shutdown(&self) {
694 self.inner.shutdown()
695 }
696
697 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
698 self.inner.shutdown_with_epitaph(status)
699 }
700
701 fn is_closed(&self) -> bool {
702 self.inner.channel().is_closed()
703 }
704 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
705 self.inner.channel().on_closed()
706 }
707
708 #[cfg(target_os = "fuchsia")]
709 fn signal_peer(
710 &self,
711 clear_mask: zx::Signals,
712 set_mask: zx::Signals,
713 ) -> Result<(), zx_status::Status> {
714 use fidl::Peered;
715 self.inner.channel().signal_peer(clear_mask, set_mask)
716 }
717}
718
719impl AdvertisedPeripheralControlHandle {}
720
721#[must_use = "FIDL methods require a response to be sent"]
722#[derive(Debug)]
723pub struct AdvertisedPeripheralOnConnectedResponder {
724 control_handle: std::mem::ManuallyDrop<AdvertisedPeripheralControlHandle>,
725 tx_id: u32,
726}
727
728impl std::ops::Drop for AdvertisedPeripheralOnConnectedResponder {
732 fn drop(&mut self) {
733 self.control_handle.shutdown();
734 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
736 }
737}
738
739impl fidl::endpoints::Responder for AdvertisedPeripheralOnConnectedResponder {
740 type ControlHandle = AdvertisedPeripheralControlHandle;
741
742 fn control_handle(&self) -> &AdvertisedPeripheralControlHandle {
743 &self.control_handle
744 }
745
746 fn drop_without_shutdown(mut self) {
747 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
749 std::mem::forget(self);
751 }
752}
753
754impl AdvertisedPeripheralOnConnectedResponder {
755 pub fn send(self) -> Result<(), fidl::Error> {
759 let _result = self.send_raw();
760 if _result.is_err() {
761 self.control_handle.shutdown();
762 }
763 self.drop_without_shutdown();
764 _result
765 }
766
767 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
769 let _result = self.send_raw();
770 self.drop_without_shutdown();
771 _result
772 }
773
774 fn send_raw(&self) -> Result<(), fidl::Error> {
775 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
776 (),
777 self.tx_id,
778 0x607b7716457eb178,
779 fidl::encoding::DynamicFlags::empty(),
780 )
781 }
782}
783
784#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
785pub struct AdvertisingHandleMarker;
786
787impl fidl::endpoints::ProtocolMarker for AdvertisingHandleMarker {
788 type Proxy = AdvertisingHandleProxy;
789 type RequestStream = AdvertisingHandleRequestStream;
790 #[cfg(target_os = "fuchsia")]
791 type SynchronousProxy = AdvertisingHandleSynchronousProxy;
792
793 const DEBUG_NAME: &'static str = "(anonymous) AdvertisingHandle";
794}
795
796pub trait AdvertisingHandleProxyInterface: Send + Sync {}
797#[derive(Debug)]
798#[cfg(target_os = "fuchsia")]
799pub struct AdvertisingHandleSynchronousProxy {
800 client: fidl::client::sync::Client,
801}
802
803#[cfg(target_os = "fuchsia")]
804impl fidl::endpoints::SynchronousProxy for AdvertisingHandleSynchronousProxy {
805 type Proxy = AdvertisingHandleProxy;
806 type Protocol = AdvertisingHandleMarker;
807
808 fn from_channel(inner: fidl::Channel) -> Self {
809 Self::new(inner)
810 }
811
812 fn into_channel(self) -> fidl::Channel {
813 self.client.into_channel()
814 }
815
816 fn as_channel(&self) -> &fidl::Channel {
817 self.client.as_channel()
818 }
819}
820
821#[cfg(target_os = "fuchsia")]
822impl AdvertisingHandleSynchronousProxy {
823 pub fn new(channel: fidl::Channel) -> Self {
824 Self { client: fidl::client::sync::Client::new(channel) }
825 }
826
827 pub fn into_channel(self) -> fidl::Channel {
828 self.client.into_channel()
829 }
830
831 pub fn wait_for_event(
834 &self,
835 deadline: zx::MonotonicInstant,
836 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
837 AdvertisingHandleEvent::decode(
838 self.client.wait_for_event::<AdvertisingHandleMarker>(deadline)?,
839 )
840 }
841}
842
843#[cfg(target_os = "fuchsia")]
844impl From<AdvertisingHandleSynchronousProxy> for zx::NullableHandle {
845 fn from(value: AdvertisingHandleSynchronousProxy) -> Self {
846 value.into_channel().into()
847 }
848}
849
850#[cfg(target_os = "fuchsia")]
851impl From<fidl::Channel> for AdvertisingHandleSynchronousProxy {
852 fn from(value: fidl::Channel) -> Self {
853 Self::new(value)
854 }
855}
856
857#[cfg(target_os = "fuchsia")]
858impl fidl::endpoints::FromClient for AdvertisingHandleSynchronousProxy {
859 type Protocol = AdvertisingHandleMarker;
860
861 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisingHandleMarker>) -> Self {
862 Self::new(value.into_channel())
863 }
864}
865
866#[derive(Debug, Clone)]
867pub struct AdvertisingHandleProxy {
868 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
869}
870
871impl fidl::endpoints::Proxy for AdvertisingHandleProxy {
872 type Protocol = AdvertisingHandleMarker;
873
874 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
875 Self::new(inner)
876 }
877
878 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
879 self.client.into_channel().map_err(|client| Self { client })
880 }
881
882 fn as_channel(&self) -> &::fidl::AsyncChannel {
883 self.client.as_channel()
884 }
885}
886
887impl AdvertisingHandleProxy {
888 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
890 let protocol_name =
891 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
892 Self { client: fidl::client::Client::new(channel, protocol_name) }
893 }
894
895 pub fn take_event_stream(&self) -> AdvertisingHandleEventStream {
901 AdvertisingHandleEventStream { event_receiver: self.client.take_event_receiver() }
902 }
903}
904
905impl AdvertisingHandleProxyInterface for AdvertisingHandleProxy {}
906
907pub struct AdvertisingHandleEventStream {
908 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
909}
910
911impl std::marker::Unpin for AdvertisingHandleEventStream {}
912
913impl futures::stream::FusedStream for AdvertisingHandleEventStream {
914 fn is_terminated(&self) -> bool {
915 self.event_receiver.is_terminated()
916 }
917}
918
919impl futures::Stream for AdvertisingHandleEventStream {
920 type Item = Result<AdvertisingHandleEvent, fidl::Error>;
921
922 fn poll_next(
923 mut self: std::pin::Pin<&mut Self>,
924 cx: &mut std::task::Context<'_>,
925 ) -> std::task::Poll<Option<Self::Item>> {
926 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
927 &mut self.event_receiver,
928 cx
929 )?) {
930 Some(buf) => std::task::Poll::Ready(Some(AdvertisingHandleEvent::decode(buf))),
931 None => std::task::Poll::Ready(None),
932 }
933 }
934}
935
936#[derive(Debug)]
937pub enum AdvertisingHandleEvent {}
938
939impl AdvertisingHandleEvent {
940 fn decode(
942 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
943 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
944 let (bytes, _handles) = buf.split_mut();
945 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
946 debug_assert_eq!(tx_header.tx_id, 0);
947 match tx_header.ordinal {
948 _ => Err(fidl::Error::UnknownOrdinal {
949 ordinal: tx_header.ordinal,
950 protocol_name:
951 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
952 }),
953 }
954 }
955}
956
957pub struct AdvertisingHandleRequestStream {
959 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
960 is_terminated: bool,
961}
962
963impl std::marker::Unpin for AdvertisingHandleRequestStream {}
964
965impl futures::stream::FusedStream for AdvertisingHandleRequestStream {
966 fn is_terminated(&self) -> bool {
967 self.is_terminated
968 }
969}
970
971impl fidl::endpoints::RequestStream for AdvertisingHandleRequestStream {
972 type Protocol = AdvertisingHandleMarker;
973 type ControlHandle = AdvertisingHandleControlHandle;
974
975 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
976 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
977 }
978
979 fn control_handle(&self) -> Self::ControlHandle {
980 AdvertisingHandleControlHandle { inner: self.inner.clone() }
981 }
982
983 fn into_inner(
984 self,
985 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
986 {
987 (self.inner, self.is_terminated)
988 }
989
990 fn from_inner(
991 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
992 is_terminated: bool,
993 ) -> Self {
994 Self { inner, is_terminated }
995 }
996}
997
998impl futures::Stream for AdvertisingHandleRequestStream {
999 type Item = Result<AdvertisingHandleRequest, fidl::Error>;
1000
1001 fn poll_next(
1002 mut self: std::pin::Pin<&mut Self>,
1003 cx: &mut std::task::Context<'_>,
1004 ) -> std::task::Poll<Option<Self::Item>> {
1005 let this = &mut *self;
1006 if this.inner.check_shutdown(cx) {
1007 this.is_terminated = true;
1008 return std::task::Poll::Ready(None);
1009 }
1010 if this.is_terminated {
1011 panic!("polled AdvertisingHandleRequestStream after completion");
1012 }
1013 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1014 |bytes, handles| {
1015 match this.inner.channel().read_etc(cx, bytes, handles) {
1016 std::task::Poll::Ready(Ok(())) => {}
1017 std::task::Poll::Pending => return std::task::Poll::Pending,
1018 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1019 this.is_terminated = true;
1020 return std::task::Poll::Ready(None);
1021 }
1022 std::task::Poll::Ready(Err(e)) => {
1023 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1024 e.into(),
1025 ))));
1026 }
1027 }
1028
1029 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1031
1032 std::task::Poll::Ready(Some(match header.ordinal {
1033 _ => Err(fidl::Error::UnknownOrdinal {
1034 ordinal: header.ordinal,
1035 protocol_name:
1036 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1037 }),
1038 }))
1039 },
1040 )
1041 }
1042}
1043
1044#[derive(Debug)]
1048pub enum AdvertisingHandleRequest {}
1049
1050impl AdvertisingHandleRequest {
1051 pub fn method_name(&self) -> &'static str {
1053 match *self {}
1054 }
1055}
1056
1057#[derive(Debug, Clone)]
1058pub struct AdvertisingHandleControlHandle {
1059 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1060}
1061
1062impl fidl::endpoints::ControlHandle for AdvertisingHandleControlHandle {
1063 fn shutdown(&self) {
1064 self.inner.shutdown()
1065 }
1066
1067 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1068 self.inner.shutdown_with_epitaph(status)
1069 }
1070
1071 fn is_closed(&self) -> bool {
1072 self.inner.channel().is_closed()
1073 }
1074 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1075 self.inner.channel().on_closed()
1076 }
1077
1078 #[cfg(target_os = "fuchsia")]
1079 fn signal_peer(
1080 &self,
1081 clear_mask: zx::Signals,
1082 set_mask: zx::Signals,
1083 ) -> Result<(), zx_status::Status> {
1084 use fidl::Peered;
1085 self.inner.channel().signal_peer(clear_mask, set_mask)
1086 }
1087}
1088
1089impl AdvertisingHandleControlHandle {}
1090
1091#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1092pub struct CentralMarker;
1093
1094impl fidl::endpoints::ProtocolMarker for CentralMarker {
1095 type Proxy = CentralProxy;
1096 type RequestStream = CentralRequestStream;
1097 #[cfg(target_os = "fuchsia")]
1098 type SynchronousProxy = CentralSynchronousProxy;
1099
1100 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Central";
1101}
1102impl fidl::endpoints::DiscoverableProtocolMarker for CentralMarker {}
1103pub type CentralCreateConnectedIsochronousGroupResult =
1104 Result<CentralCreateConnectedIsochronousGroupResponse, CreateCigError>;
1105
1106pub trait CentralProxyInterface: Send + Sync {
1107 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
1108 + Send;
1109 fn r#listen_l2cap(
1110 &self,
1111 payload: ChannelListenerRegistryListenL2capRequest,
1112 ) -> Self::ListenL2capResponseFut;
1113 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1114 fn r#scan(
1115 &self,
1116 options: &ScanOptions,
1117 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1118 ) -> Self::ScanResponseFut;
1119 fn r#connect(
1120 &self,
1121 id: &fidl_fuchsia_bluetooth::PeerId,
1122 options: &ConnectionOptions,
1123 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1124 ) -> Result<(), fidl::Error>;
1125 fn r#sync_to_periodic_advertising(
1126 &self,
1127 payload: CentralSyncToPeriodicAdvertisingRequest,
1128 ) -> Result<(), fidl::Error>;
1129 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
1130 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
1131 > + Send;
1132 fn r#create_connected_isochronous_group(
1133 &self,
1134 payload: CentralCreateConnectedIsochronousGroupRequest,
1135 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
1136 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
1137 + Send;
1138 fn r#get_peripherals(
1139 &self,
1140 service_uuids: Option<&[String]>,
1141 ) -> Self::GetPeripheralsResponseFut;
1142 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
1143 + Send;
1144 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
1145 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1146 + Send;
1147 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
1148 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
1149 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1150 + Send;
1151 fn r#connect_peripheral(
1152 &self,
1153 identifier: &str,
1154 options: &ConnectionOptions,
1155 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1156 ) -> Self::ConnectPeripheralResponseFut;
1157 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1158 + Send;
1159 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
1160}
1161#[derive(Debug)]
1162#[cfg(target_os = "fuchsia")]
1163pub struct CentralSynchronousProxy {
1164 client: fidl::client::sync::Client,
1165}
1166
1167#[cfg(target_os = "fuchsia")]
1168impl fidl::endpoints::SynchronousProxy for CentralSynchronousProxy {
1169 type Proxy = CentralProxy;
1170 type Protocol = CentralMarker;
1171
1172 fn from_channel(inner: fidl::Channel) -> Self {
1173 Self::new(inner)
1174 }
1175
1176 fn into_channel(self) -> fidl::Channel {
1177 self.client.into_channel()
1178 }
1179
1180 fn as_channel(&self) -> &fidl::Channel {
1181 self.client.as_channel()
1182 }
1183}
1184
1185#[cfg(target_os = "fuchsia")]
1186impl CentralSynchronousProxy {
1187 pub fn new(channel: fidl::Channel) -> Self {
1188 Self { client: fidl::client::sync::Client::new(channel) }
1189 }
1190
1191 pub fn into_channel(self) -> fidl::Channel {
1192 self.client.into_channel()
1193 }
1194
1195 pub fn wait_for_event(
1198 &self,
1199 deadline: zx::MonotonicInstant,
1200 ) -> Result<CentralEvent, fidl::Error> {
1201 CentralEvent::decode(self.client.wait_for_event::<CentralMarker>(deadline)?)
1202 }
1203
1204 pub fn r#listen_l2cap(
1214 &self,
1215 mut payload: ChannelListenerRegistryListenL2capRequest,
1216 ___deadline: zx::MonotonicInstant,
1217 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1218 let _response = self.client.send_query::<
1219 ChannelListenerRegistryListenL2capRequest,
1220 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1221 CentralMarker,
1222 >(
1223 &mut payload,
1224 0x39c6e9001d102338,
1225 fidl::encoding::DynamicFlags::empty(),
1226 ___deadline,
1227 )?;
1228 Ok(_response.map(|x| x))
1229 }
1230
1231 pub fn r#scan(
1258 &self,
1259 mut options: &ScanOptions,
1260 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1261 ___deadline: zx::MonotonicInstant,
1262 ) -> Result<(), fidl::Error> {
1263 let _response = self
1264 .client
1265 .send_query::<CentralScanRequest, fidl::encoding::EmptyPayload, CentralMarker>(
1266 (options, result_watcher),
1267 0x41f7121798dfe15f,
1268 fidl::encoding::DynamicFlags::empty(),
1269 ___deadline,
1270 )?;
1271 Ok(_response)
1272 }
1273
1274 pub fn r#connect(
1296 &self,
1297 mut id: &fidl_fuchsia_bluetooth::PeerId,
1298 mut options: &ConnectionOptions,
1299 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1300 ) -> Result<(), fidl::Error> {
1301 self.client.send::<CentralConnectRequest>(
1302 (id, options, handle),
1303 0x31a3065f2a6913c4,
1304 fidl::encoding::DynamicFlags::empty(),
1305 )
1306 }
1307
1308 pub fn r#sync_to_periodic_advertising(
1311 &self,
1312 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1313 ) -> Result<(), fidl::Error> {
1314 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1315 &mut payload,
1316 0x1db6df126a00c5b9,
1317 fidl::encoding::DynamicFlags::empty(),
1318 )
1319 }
1320
1321 pub fn r#create_connected_isochronous_group(
1330 &self,
1331 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1332 ___deadline: zx::MonotonicInstant,
1333 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1334 let _response = self
1335 .client
1336 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
1337 CentralCreateConnectedIsochronousGroupResponse,
1338 CreateCigError,
1339 >, CentralMarker>(
1340 &mut payload,
1341 0x60323e70ae22e13,
1342 fidl::encoding::DynamicFlags::empty(),
1343 ___deadline,
1344 )?;
1345 Ok(_response.map(|x| x))
1346 }
1347
1348 pub fn r#get_peripherals(
1354 &self,
1355 mut service_uuids: Option<&[String]>,
1356 ___deadline: zx::MonotonicInstant,
1357 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1358 let _response = self.client.send_query::<
1359 CentralGetPeripheralsRequest,
1360 CentralGetPeripheralsResponse,
1361 CentralMarker,
1362 >(
1363 (service_uuids,),
1364 0x37ba777499c683a8,
1365 fidl::encoding::DynamicFlags::empty(),
1366 ___deadline,
1367 )?;
1368 Ok(_response.peripherals)
1369 }
1370
1371 pub fn r#get_peripheral(
1377 &self,
1378 mut identifier: &str,
1379 ___deadline: zx::MonotonicInstant,
1380 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1381 let _response = self
1382 .client
1383 .send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse, CentralMarker>(
1384 (identifier,),
1385 0x97f5a2f2d9c13da,
1386 fidl::encoding::DynamicFlags::empty(),
1387 ___deadline,
1388 )?;
1389 Ok(_response.peripheral)
1390 }
1391
1392 pub fn r#start_scan(
1401 &self,
1402 mut filter: Option<&ScanFilter>,
1403 ___deadline: zx::MonotonicInstant,
1404 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1405 let _response = self
1406 .client
1407 .send_query::<CentralStartScanRequest, CentralStartScanResponse, CentralMarker>(
1408 (filter,),
1409 0xeb4cf0cd0e1132b,
1410 fidl::encoding::DynamicFlags::empty(),
1411 ___deadline,
1412 )?;
1413 Ok(_response.status)
1414 }
1415
1416 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1418 self.client.send::<fidl::encoding::EmptyPayload>(
1419 (),
1420 0x5f79ee6a0bb037a0,
1421 fidl::encoding::DynamicFlags::empty(),
1422 )
1423 }
1424
1425 pub fn r#connect_peripheral(
1432 &self,
1433 mut identifier: &str,
1434 mut options: &ConnectionOptions,
1435 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1436 ___deadline: zx::MonotonicInstant,
1437 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1438 let _response = self.client.send_query::<
1439 CentralConnectPeripheralRequest,
1440 CentralConnectPeripheralResponse,
1441 CentralMarker,
1442 >(
1443 (identifier, options, gatt_client,),
1444 0x714d6c32d066d75a,
1445 fidl::encoding::DynamicFlags::empty(),
1446 ___deadline,
1447 )?;
1448 Ok(_response.status)
1449 }
1450
1451 pub fn r#disconnect_peripheral(
1453 &self,
1454 mut identifier: &str,
1455 ___deadline: zx::MonotonicInstant,
1456 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1457 let _response = self.client.send_query::<
1458 CentralDisconnectPeripheralRequest,
1459 CentralDisconnectPeripheralResponse,
1460 CentralMarker,
1461 >(
1462 (identifier,),
1463 0xa9430da197362fd,
1464 fidl::encoding::DynamicFlags::empty(),
1465 ___deadline,
1466 )?;
1467 Ok(_response.status)
1468 }
1469}
1470
1471#[cfg(target_os = "fuchsia")]
1472impl From<CentralSynchronousProxy> for zx::NullableHandle {
1473 fn from(value: CentralSynchronousProxy) -> Self {
1474 value.into_channel().into()
1475 }
1476}
1477
1478#[cfg(target_os = "fuchsia")]
1479impl From<fidl::Channel> for CentralSynchronousProxy {
1480 fn from(value: fidl::Channel) -> Self {
1481 Self::new(value)
1482 }
1483}
1484
1485#[cfg(target_os = "fuchsia")]
1486impl fidl::endpoints::FromClient for CentralSynchronousProxy {
1487 type Protocol = CentralMarker;
1488
1489 fn from_client(value: fidl::endpoints::ClientEnd<CentralMarker>) -> Self {
1490 Self::new(value.into_channel())
1491 }
1492}
1493
1494#[derive(Debug, Clone)]
1495pub struct CentralProxy {
1496 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1497}
1498
1499impl fidl::endpoints::Proxy for CentralProxy {
1500 type Protocol = CentralMarker;
1501
1502 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1503 Self::new(inner)
1504 }
1505
1506 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1507 self.client.into_channel().map_err(|client| Self { client })
1508 }
1509
1510 fn as_channel(&self) -> &::fidl::AsyncChannel {
1511 self.client.as_channel()
1512 }
1513}
1514
1515impl CentralProxy {
1516 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1518 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1519 Self { client: fidl::client::Client::new(channel, protocol_name) }
1520 }
1521
1522 pub fn take_event_stream(&self) -> CentralEventStream {
1528 CentralEventStream { event_receiver: self.client.take_event_receiver() }
1529 }
1530
1531 pub fn r#listen_l2cap(
1541 &self,
1542 mut payload: ChannelListenerRegistryListenL2capRequest,
1543 ) -> fidl::client::QueryResponseFut<
1544 ChannelListenerRegistryListenL2capResult,
1545 fidl::encoding::DefaultFuchsiaResourceDialect,
1546 > {
1547 CentralProxyInterface::r#listen_l2cap(self, payload)
1548 }
1549
1550 pub fn r#scan(
1577 &self,
1578 mut options: &ScanOptions,
1579 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1580 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1581 CentralProxyInterface::r#scan(self, options, result_watcher)
1582 }
1583
1584 pub fn r#connect(
1606 &self,
1607 mut id: &fidl_fuchsia_bluetooth::PeerId,
1608 mut options: &ConnectionOptions,
1609 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1610 ) -> Result<(), fidl::Error> {
1611 CentralProxyInterface::r#connect(self, id, options, handle)
1612 }
1613
1614 pub fn r#sync_to_periodic_advertising(
1617 &self,
1618 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1619 ) -> Result<(), fidl::Error> {
1620 CentralProxyInterface::r#sync_to_periodic_advertising(self, payload)
1621 }
1622
1623 pub fn r#create_connected_isochronous_group(
1632 &self,
1633 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1634 ) -> fidl::client::QueryResponseFut<
1635 CentralCreateConnectedIsochronousGroupResult,
1636 fidl::encoding::DefaultFuchsiaResourceDialect,
1637 > {
1638 CentralProxyInterface::r#create_connected_isochronous_group(self, payload)
1639 }
1640
1641 pub fn r#get_peripherals(
1647 &self,
1648 mut service_uuids: Option<&[String]>,
1649 ) -> fidl::client::QueryResponseFut<
1650 Vec<RemoteDevice>,
1651 fidl::encoding::DefaultFuchsiaResourceDialect,
1652 > {
1653 CentralProxyInterface::r#get_peripherals(self, service_uuids)
1654 }
1655
1656 pub fn r#get_peripheral(
1662 &self,
1663 mut identifier: &str,
1664 ) -> fidl::client::QueryResponseFut<
1665 Option<Box<RemoteDevice>>,
1666 fidl::encoding::DefaultFuchsiaResourceDialect,
1667 > {
1668 CentralProxyInterface::r#get_peripheral(self, identifier)
1669 }
1670
1671 pub fn r#start_scan(
1680 &self,
1681 mut filter: Option<&ScanFilter>,
1682 ) -> fidl::client::QueryResponseFut<
1683 fidl_fuchsia_bluetooth::Status,
1684 fidl::encoding::DefaultFuchsiaResourceDialect,
1685 > {
1686 CentralProxyInterface::r#start_scan(self, filter)
1687 }
1688
1689 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1691 CentralProxyInterface::r#stop_scan(self)
1692 }
1693
1694 pub fn r#connect_peripheral(
1701 &self,
1702 mut identifier: &str,
1703 mut options: &ConnectionOptions,
1704 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1705 ) -> fidl::client::QueryResponseFut<
1706 fidl_fuchsia_bluetooth::Status,
1707 fidl::encoding::DefaultFuchsiaResourceDialect,
1708 > {
1709 CentralProxyInterface::r#connect_peripheral(self, identifier, options, gatt_client)
1710 }
1711
1712 pub fn r#disconnect_peripheral(
1714 &self,
1715 mut identifier: &str,
1716 ) -> fidl::client::QueryResponseFut<
1717 fidl_fuchsia_bluetooth::Status,
1718 fidl::encoding::DefaultFuchsiaResourceDialect,
1719 > {
1720 CentralProxyInterface::r#disconnect_peripheral(self, identifier)
1721 }
1722}
1723
1724impl CentralProxyInterface for CentralProxy {
1725 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
1726 ChannelListenerRegistryListenL2capResult,
1727 fidl::encoding::DefaultFuchsiaResourceDialect,
1728 >;
1729 fn r#listen_l2cap(
1730 &self,
1731 mut payload: ChannelListenerRegistryListenL2capRequest,
1732 ) -> Self::ListenL2capResponseFut {
1733 fn _decode(
1734 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1735 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1736 let _response = fidl::client::decode_transaction_body::<
1737 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1738 fidl::encoding::DefaultFuchsiaResourceDialect,
1739 0x39c6e9001d102338,
1740 >(_buf?)?;
1741 Ok(_response.map(|x| x))
1742 }
1743 self.client.send_query_and_decode::<
1744 ChannelListenerRegistryListenL2capRequest,
1745 ChannelListenerRegistryListenL2capResult,
1746 >(
1747 &mut payload,
1748 0x39c6e9001d102338,
1749 fidl::encoding::DynamicFlags::empty(),
1750 _decode,
1751 )
1752 }
1753
1754 type ScanResponseFut =
1755 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1756 fn r#scan(
1757 &self,
1758 mut options: &ScanOptions,
1759 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1760 ) -> Self::ScanResponseFut {
1761 fn _decode(
1762 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1763 ) -> Result<(), fidl::Error> {
1764 let _response = fidl::client::decode_transaction_body::<
1765 fidl::encoding::EmptyPayload,
1766 fidl::encoding::DefaultFuchsiaResourceDialect,
1767 0x41f7121798dfe15f,
1768 >(_buf?)?;
1769 Ok(_response)
1770 }
1771 self.client.send_query_and_decode::<CentralScanRequest, ()>(
1772 (options, result_watcher),
1773 0x41f7121798dfe15f,
1774 fidl::encoding::DynamicFlags::empty(),
1775 _decode,
1776 )
1777 }
1778
1779 fn r#connect(
1780 &self,
1781 mut id: &fidl_fuchsia_bluetooth::PeerId,
1782 mut options: &ConnectionOptions,
1783 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1784 ) -> Result<(), fidl::Error> {
1785 self.client.send::<CentralConnectRequest>(
1786 (id, options, handle),
1787 0x31a3065f2a6913c4,
1788 fidl::encoding::DynamicFlags::empty(),
1789 )
1790 }
1791
1792 fn r#sync_to_periodic_advertising(
1793 &self,
1794 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1795 ) -> Result<(), fidl::Error> {
1796 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1797 &mut payload,
1798 0x1db6df126a00c5b9,
1799 fidl::encoding::DynamicFlags::empty(),
1800 )
1801 }
1802
1803 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
1804 CentralCreateConnectedIsochronousGroupResult,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 >;
1807 fn r#create_connected_isochronous_group(
1808 &self,
1809 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1810 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
1811 fn _decode(
1812 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1813 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1814 let _response = fidl::client::decode_transaction_body::<
1815 fidl::encoding::ResultType<
1816 CentralCreateConnectedIsochronousGroupResponse,
1817 CreateCigError,
1818 >,
1819 fidl::encoding::DefaultFuchsiaResourceDialect,
1820 0x60323e70ae22e13,
1821 >(_buf?)?;
1822 Ok(_response.map(|x| x))
1823 }
1824 self.client.send_query_and_decode::<
1825 CentralCreateConnectedIsochronousGroupRequest,
1826 CentralCreateConnectedIsochronousGroupResult,
1827 >(
1828 &mut payload,
1829 0x60323e70ae22e13,
1830 fidl::encoding::DynamicFlags::empty(),
1831 _decode,
1832 )
1833 }
1834
1835 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
1836 Vec<RemoteDevice>,
1837 fidl::encoding::DefaultFuchsiaResourceDialect,
1838 >;
1839 fn r#get_peripherals(
1840 &self,
1841 mut service_uuids: Option<&[String]>,
1842 ) -> Self::GetPeripheralsResponseFut {
1843 fn _decode(
1844 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1845 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1846 let _response = fidl::client::decode_transaction_body::<
1847 CentralGetPeripheralsResponse,
1848 fidl::encoding::DefaultFuchsiaResourceDialect,
1849 0x37ba777499c683a8,
1850 >(_buf?)?;
1851 Ok(_response.peripherals)
1852 }
1853 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
1854 (service_uuids,),
1855 0x37ba777499c683a8,
1856 fidl::encoding::DynamicFlags::empty(),
1857 _decode,
1858 )
1859 }
1860
1861 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
1862 Option<Box<RemoteDevice>>,
1863 fidl::encoding::DefaultFuchsiaResourceDialect,
1864 >;
1865 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
1866 fn _decode(
1867 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1868 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1869 let _response = fidl::client::decode_transaction_body::<
1870 CentralGetPeripheralResponse,
1871 fidl::encoding::DefaultFuchsiaResourceDialect,
1872 0x97f5a2f2d9c13da,
1873 >(_buf?)?;
1874 Ok(_response.peripheral)
1875 }
1876 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
1877 (identifier,),
1878 0x97f5a2f2d9c13da,
1879 fidl::encoding::DynamicFlags::empty(),
1880 _decode,
1881 )
1882 }
1883
1884 type StartScanResponseFut = fidl::client::QueryResponseFut<
1885 fidl_fuchsia_bluetooth::Status,
1886 fidl::encoding::DefaultFuchsiaResourceDialect,
1887 >;
1888 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
1889 fn _decode(
1890 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1891 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1892 let _response = fidl::client::decode_transaction_body::<
1893 CentralStartScanResponse,
1894 fidl::encoding::DefaultFuchsiaResourceDialect,
1895 0xeb4cf0cd0e1132b,
1896 >(_buf?)?;
1897 Ok(_response.status)
1898 }
1899 self.client
1900 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
1901 (filter,),
1902 0xeb4cf0cd0e1132b,
1903 fidl::encoding::DynamicFlags::empty(),
1904 _decode,
1905 )
1906 }
1907
1908 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1909 self.client.send::<fidl::encoding::EmptyPayload>(
1910 (),
1911 0x5f79ee6a0bb037a0,
1912 fidl::encoding::DynamicFlags::empty(),
1913 )
1914 }
1915
1916 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1917 fidl_fuchsia_bluetooth::Status,
1918 fidl::encoding::DefaultFuchsiaResourceDialect,
1919 >;
1920 fn r#connect_peripheral(
1921 &self,
1922 mut identifier: &str,
1923 mut options: &ConnectionOptions,
1924 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1925 ) -> Self::ConnectPeripheralResponseFut {
1926 fn _decode(
1927 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1928 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1929 let _response = fidl::client::decode_transaction_body::<
1930 CentralConnectPeripheralResponse,
1931 fidl::encoding::DefaultFuchsiaResourceDialect,
1932 0x714d6c32d066d75a,
1933 >(_buf?)?;
1934 Ok(_response.status)
1935 }
1936 self.client.send_query_and_decode::<
1937 CentralConnectPeripheralRequest,
1938 fidl_fuchsia_bluetooth::Status,
1939 >(
1940 (identifier, options, gatt_client,),
1941 0x714d6c32d066d75a,
1942 fidl::encoding::DynamicFlags::empty(),
1943 _decode,
1944 )
1945 }
1946
1947 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1948 fidl_fuchsia_bluetooth::Status,
1949 fidl::encoding::DefaultFuchsiaResourceDialect,
1950 >;
1951 fn r#disconnect_peripheral(
1952 &self,
1953 mut identifier: &str,
1954 ) -> Self::DisconnectPeripheralResponseFut {
1955 fn _decode(
1956 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1957 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1958 let _response = fidl::client::decode_transaction_body::<
1959 CentralDisconnectPeripheralResponse,
1960 fidl::encoding::DefaultFuchsiaResourceDialect,
1961 0xa9430da197362fd,
1962 >(_buf?)?;
1963 Ok(_response.status)
1964 }
1965 self.client.send_query_and_decode::<
1966 CentralDisconnectPeripheralRequest,
1967 fidl_fuchsia_bluetooth::Status,
1968 >(
1969 (identifier,),
1970 0xa9430da197362fd,
1971 fidl::encoding::DynamicFlags::empty(),
1972 _decode,
1973 )
1974 }
1975}
1976
1977pub struct CentralEventStream {
1978 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1979}
1980
1981impl std::marker::Unpin for CentralEventStream {}
1982
1983impl futures::stream::FusedStream for CentralEventStream {
1984 fn is_terminated(&self) -> bool {
1985 self.event_receiver.is_terminated()
1986 }
1987}
1988
1989impl futures::Stream for CentralEventStream {
1990 type Item = Result<CentralEvent, fidl::Error>;
1991
1992 fn poll_next(
1993 mut self: std::pin::Pin<&mut Self>,
1994 cx: &mut std::task::Context<'_>,
1995 ) -> std::task::Poll<Option<Self::Item>> {
1996 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1997 &mut self.event_receiver,
1998 cx
1999 )?) {
2000 Some(buf) => std::task::Poll::Ready(Some(CentralEvent::decode(buf))),
2001 None => std::task::Poll::Ready(None),
2002 }
2003 }
2004}
2005
2006#[derive(Debug)]
2007pub enum CentralEvent {
2008 OnScanStateChanged { scanning: bool },
2009 OnDeviceDiscovered { device: RemoteDevice },
2010 OnPeripheralDisconnected { identifier: String },
2011}
2012
2013impl CentralEvent {
2014 #[allow(irrefutable_let_patterns)]
2015 pub fn into_on_scan_state_changed(self) -> Option<bool> {
2016 if let CentralEvent::OnScanStateChanged { scanning } = self {
2017 Some((scanning))
2018 } else {
2019 None
2020 }
2021 }
2022 #[allow(irrefutable_let_patterns)]
2023 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
2024 if let CentralEvent::OnDeviceDiscovered { device } = self { Some((device)) } else { None }
2025 }
2026 #[allow(irrefutable_let_patterns)]
2027 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
2028 if let CentralEvent::OnPeripheralDisconnected { identifier } = self {
2029 Some((identifier))
2030 } else {
2031 None
2032 }
2033 }
2034
2035 fn decode(
2037 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2038 ) -> Result<CentralEvent, fidl::Error> {
2039 let (bytes, _handles) = buf.split_mut();
2040 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2041 debug_assert_eq!(tx_header.tx_id, 0);
2042 match tx_header.ordinal {
2043 0x5f8edc23cad04d3f => {
2044 let mut out = fidl::new_empty!(
2045 CentralOnScanStateChangedRequest,
2046 fidl::encoding::DefaultFuchsiaResourceDialect
2047 );
2048 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2049 Ok((CentralEvent::OnScanStateChanged { scanning: out.scanning }))
2050 }
2051 0x708dadf20d66db6 => {
2052 let mut out = fidl::new_empty!(
2053 CentralOnDeviceDiscoveredRequest,
2054 fidl::encoding::DefaultFuchsiaResourceDialect
2055 );
2056 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2057 Ok((CentralEvent::OnDeviceDiscovered { device: out.device }))
2058 }
2059 0x4e4c6b979b2126df => {
2060 let mut out = fidl::new_empty!(
2061 CentralOnPeripheralDisconnectedRequest,
2062 fidl::encoding::DefaultFuchsiaResourceDialect
2063 );
2064 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2065 Ok((CentralEvent::OnPeripheralDisconnected { identifier: out.identifier }))
2066 }
2067 _ => Err(fidl::Error::UnknownOrdinal {
2068 ordinal: tx_header.ordinal,
2069 protocol_name: <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2070 }),
2071 }
2072 }
2073}
2074
2075pub struct CentralRequestStream {
2077 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2078 is_terminated: bool,
2079}
2080
2081impl std::marker::Unpin for CentralRequestStream {}
2082
2083impl futures::stream::FusedStream for CentralRequestStream {
2084 fn is_terminated(&self) -> bool {
2085 self.is_terminated
2086 }
2087}
2088
2089impl fidl::endpoints::RequestStream for CentralRequestStream {
2090 type Protocol = CentralMarker;
2091 type ControlHandle = CentralControlHandle;
2092
2093 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2094 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2095 }
2096
2097 fn control_handle(&self) -> Self::ControlHandle {
2098 CentralControlHandle { inner: self.inner.clone() }
2099 }
2100
2101 fn into_inner(
2102 self,
2103 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2104 {
2105 (self.inner, self.is_terminated)
2106 }
2107
2108 fn from_inner(
2109 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2110 is_terminated: bool,
2111 ) -> Self {
2112 Self { inner, is_terminated }
2113 }
2114}
2115
2116impl futures::Stream for CentralRequestStream {
2117 type Item = Result<CentralRequest, fidl::Error>;
2118
2119 fn poll_next(
2120 mut self: std::pin::Pin<&mut Self>,
2121 cx: &mut std::task::Context<'_>,
2122 ) -> std::task::Poll<Option<Self::Item>> {
2123 let this = &mut *self;
2124 if this.inner.check_shutdown(cx) {
2125 this.is_terminated = true;
2126 return std::task::Poll::Ready(None);
2127 }
2128 if this.is_terminated {
2129 panic!("polled CentralRequestStream after completion");
2130 }
2131 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2132 |bytes, handles| {
2133 match this.inner.channel().read_etc(cx, bytes, handles) {
2134 std::task::Poll::Ready(Ok(())) => {}
2135 std::task::Poll::Pending => return std::task::Poll::Pending,
2136 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2137 this.is_terminated = true;
2138 return std::task::Poll::Ready(None);
2139 }
2140 std::task::Poll::Ready(Err(e)) => {
2141 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2142 e.into(),
2143 ))));
2144 }
2145 }
2146
2147 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2149
2150 std::task::Poll::Ready(Some(match header.ordinal {
2151 0x39c6e9001d102338 => {
2152 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2153 let mut req = fidl::new_empty!(
2154 ChannelListenerRegistryListenL2capRequest,
2155 fidl::encoding::DefaultFuchsiaResourceDialect
2156 );
2157 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
2158 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2159 Ok(CentralRequest::ListenL2cap {
2160 payload: req,
2161 responder: CentralListenL2capResponder {
2162 control_handle: std::mem::ManuallyDrop::new(control_handle),
2163 tx_id: header.tx_id,
2164 },
2165 })
2166 }
2167 0x41f7121798dfe15f => {
2168 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2169 let mut req = fidl::new_empty!(
2170 CentralScanRequest,
2171 fidl::encoding::DefaultFuchsiaResourceDialect
2172 );
2173 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
2174 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2175 Ok(CentralRequest::Scan {
2176 options: req.options,
2177 result_watcher: req.result_watcher,
2178
2179 responder: CentralScanResponder {
2180 control_handle: std::mem::ManuallyDrop::new(control_handle),
2181 tx_id: header.tx_id,
2182 },
2183 })
2184 }
2185 0x31a3065f2a6913c4 => {
2186 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2187 let mut req = fidl::new_empty!(
2188 CentralConnectRequest,
2189 fidl::encoding::DefaultFuchsiaResourceDialect
2190 );
2191 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2192 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2193 Ok(CentralRequest::Connect {
2194 id: req.id,
2195 options: req.options,
2196 handle: req.handle,
2197
2198 control_handle,
2199 })
2200 }
2201 0x1db6df126a00c5b9 => {
2202 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2203 let mut req = fidl::new_empty!(
2204 CentralSyncToPeriodicAdvertisingRequest,
2205 fidl::encoding::DefaultFuchsiaResourceDialect
2206 );
2207 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralSyncToPeriodicAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
2208 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2209 Ok(CentralRequest::SyncToPeriodicAdvertising {
2210 payload: req,
2211 control_handle,
2212 })
2213 }
2214 0x60323e70ae22e13 => {
2215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2216 let mut req = fidl::new_empty!(
2217 CentralCreateConnectedIsochronousGroupRequest,
2218 fidl::encoding::DefaultFuchsiaResourceDialect
2219 );
2220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
2221 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2222 Ok(CentralRequest::CreateConnectedIsochronousGroup {
2223 payload: req,
2224 responder: CentralCreateConnectedIsochronousGroupResponder {
2225 control_handle: std::mem::ManuallyDrop::new(control_handle),
2226 tx_id: header.tx_id,
2227 },
2228 })
2229 }
2230 0x37ba777499c683a8 => {
2231 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2232 let mut req = fidl::new_empty!(
2233 CentralGetPeripheralsRequest,
2234 fidl::encoding::DefaultFuchsiaResourceDialect
2235 );
2236 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
2237 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2238 Ok(CentralRequest::GetPeripherals {
2239 service_uuids: req.service_uuids,
2240
2241 responder: CentralGetPeripheralsResponder {
2242 control_handle: std::mem::ManuallyDrop::new(control_handle),
2243 tx_id: header.tx_id,
2244 },
2245 })
2246 }
2247 0x97f5a2f2d9c13da => {
2248 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2249 let mut req = fidl::new_empty!(
2250 CentralGetPeripheralRequest,
2251 fidl::encoding::DefaultFuchsiaResourceDialect
2252 );
2253 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2254 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2255 Ok(CentralRequest::GetPeripheral {
2256 identifier: req.identifier,
2257
2258 responder: CentralGetPeripheralResponder {
2259 control_handle: std::mem::ManuallyDrop::new(control_handle),
2260 tx_id: header.tx_id,
2261 },
2262 })
2263 }
2264 0xeb4cf0cd0e1132b => {
2265 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2266 let mut req = fidl::new_empty!(
2267 CentralStartScanRequest,
2268 fidl::encoding::DefaultFuchsiaResourceDialect
2269 );
2270 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
2271 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2272 Ok(CentralRequest::StartScan {
2273 filter: req.filter,
2274
2275 responder: CentralStartScanResponder {
2276 control_handle: std::mem::ManuallyDrop::new(control_handle),
2277 tx_id: header.tx_id,
2278 },
2279 })
2280 }
2281 0x5f79ee6a0bb037a0 => {
2282 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2283 let mut req = fidl::new_empty!(
2284 fidl::encoding::EmptyPayload,
2285 fidl::encoding::DefaultFuchsiaResourceDialect
2286 );
2287 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2288 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2289 Ok(CentralRequest::StopScan { control_handle })
2290 }
2291 0x714d6c32d066d75a => {
2292 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2293 let mut req = fidl::new_empty!(
2294 CentralConnectPeripheralRequest,
2295 fidl::encoding::DefaultFuchsiaResourceDialect
2296 );
2297 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2298 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2299 Ok(CentralRequest::ConnectPeripheral {
2300 identifier: req.identifier,
2301 options: req.options,
2302 gatt_client: req.gatt_client,
2303
2304 responder: CentralConnectPeripheralResponder {
2305 control_handle: std::mem::ManuallyDrop::new(control_handle),
2306 tx_id: header.tx_id,
2307 },
2308 })
2309 }
2310 0xa9430da197362fd => {
2311 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2312 let mut req = fidl::new_empty!(
2313 CentralDisconnectPeripheralRequest,
2314 fidl::encoding::DefaultFuchsiaResourceDialect
2315 );
2316 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2317 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2318 Ok(CentralRequest::DisconnectPeripheral {
2319 identifier: req.identifier,
2320
2321 responder: CentralDisconnectPeripheralResponder {
2322 control_handle: std::mem::ManuallyDrop::new(control_handle),
2323 tx_id: header.tx_id,
2324 },
2325 })
2326 }
2327 _ => Err(fidl::Error::UnknownOrdinal {
2328 ordinal: header.ordinal,
2329 protocol_name:
2330 <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2331 }),
2332 }))
2333 },
2334 )
2335 }
2336}
2337
2338#[derive(Debug)]
2339pub enum CentralRequest {
2340 ListenL2cap {
2350 payload: ChannelListenerRegistryListenL2capRequest,
2351 responder: CentralListenL2capResponder,
2352 },
2353 Scan {
2380 options: ScanOptions,
2381 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2382 responder: CentralScanResponder,
2383 },
2384 Connect {
2406 id: fidl_fuchsia_bluetooth::PeerId,
2407 options: ConnectionOptions,
2408 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
2409 control_handle: CentralControlHandle,
2410 },
2411 SyncToPeriodicAdvertising {
2414 payload: CentralSyncToPeriodicAdvertisingRequest,
2415 control_handle: CentralControlHandle,
2416 },
2417 CreateConnectedIsochronousGroup {
2426 payload: CentralCreateConnectedIsochronousGroupRequest,
2427 responder: CentralCreateConnectedIsochronousGroupResponder,
2428 },
2429 GetPeripherals { service_uuids: Option<Vec<String>>, responder: CentralGetPeripheralsResponder },
2435 GetPeripheral { identifier: String, responder: CentralGetPeripheralResponder },
2441 StartScan { filter: Option<Box<ScanFilter>>, responder: CentralStartScanResponder },
2450 StopScan { control_handle: CentralControlHandle },
2452 ConnectPeripheral {
2459 identifier: String,
2460 options: ConnectionOptions,
2461 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2462 responder: CentralConnectPeripheralResponder,
2463 },
2464 DisconnectPeripheral { identifier: String, responder: CentralDisconnectPeripheralResponder },
2466}
2467
2468impl CentralRequest {
2469 #[allow(irrefutable_let_patterns)]
2470 pub fn into_listen_l2cap(
2471 self,
2472 ) -> Option<(ChannelListenerRegistryListenL2capRequest, CentralListenL2capResponder)> {
2473 if let CentralRequest::ListenL2cap { payload, responder } = self {
2474 Some((payload, responder))
2475 } else {
2476 None
2477 }
2478 }
2479
2480 #[allow(irrefutable_let_patterns)]
2481 pub fn into_scan(
2482 self,
2483 ) -> Option<(
2484 ScanOptions,
2485 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2486 CentralScanResponder,
2487 )> {
2488 if let CentralRequest::Scan { options, result_watcher, responder } = self {
2489 Some((options, result_watcher, responder))
2490 } else {
2491 None
2492 }
2493 }
2494
2495 #[allow(irrefutable_let_patterns)]
2496 pub fn into_connect(
2497 self,
2498 ) -> Option<(
2499 fidl_fuchsia_bluetooth::PeerId,
2500 ConnectionOptions,
2501 fidl::endpoints::ServerEnd<ConnectionMarker>,
2502 CentralControlHandle,
2503 )> {
2504 if let CentralRequest::Connect { id, options, handle, control_handle } = self {
2505 Some((id, options, handle, control_handle))
2506 } else {
2507 None
2508 }
2509 }
2510
2511 #[allow(irrefutable_let_patterns)]
2512 pub fn into_sync_to_periodic_advertising(
2513 self,
2514 ) -> Option<(CentralSyncToPeriodicAdvertisingRequest, CentralControlHandle)> {
2515 if let CentralRequest::SyncToPeriodicAdvertising { payload, control_handle } = self {
2516 Some((payload, control_handle))
2517 } else {
2518 None
2519 }
2520 }
2521
2522 #[allow(irrefutable_let_patterns)]
2523 pub fn into_create_connected_isochronous_group(
2524 self,
2525 ) -> Option<(
2526 CentralCreateConnectedIsochronousGroupRequest,
2527 CentralCreateConnectedIsochronousGroupResponder,
2528 )> {
2529 if let CentralRequest::CreateConnectedIsochronousGroup { payload, responder } = self {
2530 Some((payload, responder))
2531 } else {
2532 None
2533 }
2534 }
2535
2536 #[allow(irrefutable_let_patterns)]
2537 pub fn into_get_peripherals(
2538 self,
2539 ) -> Option<(Option<Vec<String>>, CentralGetPeripheralsResponder)> {
2540 if let CentralRequest::GetPeripherals { service_uuids, responder } = self {
2541 Some((service_uuids, responder))
2542 } else {
2543 None
2544 }
2545 }
2546
2547 #[allow(irrefutable_let_patterns)]
2548 pub fn into_get_peripheral(self) -> Option<(String, CentralGetPeripheralResponder)> {
2549 if let CentralRequest::GetPeripheral { identifier, responder } = self {
2550 Some((identifier, responder))
2551 } else {
2552 None
2553 }
2554 }
2555
2556 #[allow(irrefutable_let_patterns)]
2557 pub fn into_start_scan(self) -> Option<(Option<Box<ScanFilter>>, CentralStartScanResponder)> {
2558 if let CentralRequest::StartScan { filter, responder } = self {
2559 Some((filter, responder))
2560 } else {
2561 None
2562 }
2563 }
2564
2565 #[allow(irrefutable_let_patterns)]
2566 pub fn into_stop_scan(self) -> Option<(CentralControlHandle)> {
2567 if let CentralRequest::StopScan { control_handle } = self {
2568 Some((control_handle))
2569 } else {
2570 None
2571 }
2572 }
2573
2574 #[allow(irrefutable_let_patterns)]
2575 pub fn into_connect_peripheral(
2576 self,
2577 ) -> Option<(
2578 String,
2579 ConnectionOptions,
2580 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2581 CentralConnectPeripheralResponder,
2582 )> {
2583 if let CentralRequest::ConnectPeripheral { identifier, options, gatt_client, responder } =
2584 self
2585 {
2586 Some((identifier, options, gatt_client, responder))
2587 } else {
2588 None
2589 }
2590 }
2591
2592 #[allow(irrefutable_let_patterns)]
2593 pub fn into_disconnect_peripheral(
2594 self,
2595 ) -> Option<(String, CentralDisconnectPeripheralResponder)> {
2596 if let CentralRequest::DisconnectPeripheral { identifier, responder } = self {
2597 Some((identifier, responder))
2598 } else {
2599 None
2600 }
2601 }
2602
2603 pub fn method_name(&self) -> &'static str {
2605 match *self {
2606 CentralRequest::ListenL2cap { .. } => "listen_l2cap",
2607 CentralRequest::Scan { .. } => "scan",
2608 CentralRequest::Connect { .. } => "connect",
2609 CentralRequest::SyncToPeriodicAdvertising { .. } => "sync_to_periodic_advertising",
2610 CentralRequest::CreateConnectedIsochronousGroup { .. } => {
2611 "create_connected_isochronous_group"
2612 }
2613 CentralRequest::GetPeripherals { .. } => "get_peripherals",
2614 CentralRequest::GetPeripheral { .. } => "get_peripheral",
2615 CentralRequest::StartScan { .. } => "start_scan",
2616 CentralRequest::StopScan { .. } => "stop_scan",
2617 CentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
2618 CentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
2619 }
2620 }
2621}
2622
2623#[derive(Debug, Clone)]
2624pub struct CentralControlHandle {
2625 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2626}
2627
2628impl fidl::endpoints::ControlHandle for CentralControlHandle {
2629 fn shutdown(&self) {
2630 self.inner.shutdown()
2631 }
2632
2633 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2634 self.inner.shutdown_with_epitaph(status)
2635 }
2636
2637 fn is_closed(&self) -> bool {
2638 self.inner.channel().is_closed()
2639 }
2640 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2641 self.inner.channel().on_closed()
2642 }
2643
2644 #[cfg(target_os = "fuchsia")]
2645 fn signal_peer(
2646 &self,
2647 clear_mask: zx::Signals,
2648 set_mask: zx::Signals,
2649 ) -> Result<(), zx_status::Status> {
2650 use fidl::Peered;
2651 self.inner.channel().signal_peer(clear_mask, set_mask)
2652 }
2653}
2654
2655impl CentralControlHandle {
2656 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
2657 self.inner.send::<CentralOnScanStateChangedRequest>(
2658 (scanning,),
2659 0,
2660 0x5f8edc23cad04d3f,
2661 fidl::encoding::DynamicFlags::empty(),
2662 )
2663 }
2664
2665 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
2666 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
2667 (device,),
2668 0,
2669 0x708dadf20d66db6,
2670 fidl::encoding::DynamicFlags::empty(),
2671 )
2672 }
2673
2674 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
2675 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
2676 (identifier,),
2677 0,
2678 0x4e4c6b979b2126df,
2679 fidl::encoding::DynamicFlags::empty(),
2680 )
2681 }
2682}
2683
2684#[must_use = "FIDL methods require a response to be sent"]
2685#[derive(Debug)]
2686pub struct CentralListenL2capResponder {
2687 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2688 tx_id: u32,
2689}
2690
2691impl std::ops::Drop for CentralListenL2capResponder {
2695 fn drop(&mut self) {
2696 self.control_handle.shutdown();
2697 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2699 }
2700}
2701
2702impl fidl::endpoints::Responder for CentralListenL2capResponder {
2703 type ControlHandle = CentralControlHandle;
2704
2705 fn control_handle(&self) -> &CentralControlHandle {
2706 &self.control_handle
2707 }
2708
2709 fn drop_without_shutdown(mut self) {
2710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2712 std::mem::forget(self);
2714 }
2715}
2716
2717impl CentralListenL2capResponder {
2718 pub fn send(
2722 self,
2723 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2724 ) -> Result<(), fidl::Error> {
2725 let _result = self.send_raw(result);
2726 if _result.is_err() {
2727 self.control_handle.shutdown();
2728 }
2729 self.drop_without_shutdown();
2730 _result
2731 }
2732
2733 pub fn send_no_shutdown_on_err(
2735 self,
2736 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2737 ) -> Result<(), fidl::Error> {
2738 let _result = self.send_raw(result);
2739 self.drop_without_shutdown();
2740 _result
2741 }
2742
2743 fn send_raw(
2744 &self,
2745 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2746 ) -> Result<(), fidl::Error> {
2747 self.control_handle.inner.send::<fidl::encoding::ResultType<
2748 ChannelListenerRegistryListenL2capResponse,
2749 i32,
2750 >>(
2751 result,
2752 self.tx_id,
2753 0x39c6e9001d102338,
2754 fidl::encoding::DynamicFlags::empty(),
2755 )
2756 }
2757}
2758
2759#[must_use = "FIDL methods require a response to be sent"]
2760#[derive(Debug)]
2761pub struct CentralScanResponder {
2762 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2763 tx_id: u32,
2764}
2765
2766impl std::ops::Drop for CentralScanResponder {
2770 fn drop(&mut self) {
2771 self.control_handle.shutdown();
2772 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2774 }
2775}
2776
2777impl fidl::endpoints::Responder for CentralScanResponder {
2778 type ControlHandle = CentralControlHandle;
2779
2780 fn control_handle(&self) -> &CentralControlHandle {
2781 &self.control_handle
2782 }
2783
2784 fn drop_without_shutdown(mut self) {
2785 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2787 std::mem::forget(self);
2789 }
2790}
2791
2792impl CentralScanResponder {
2793 pub fn send(self) -> Result<(), fidl::Error> {
2797 let _result = self.send_raw();
2798 if _result.is_err() {
2799 self.control_handle.shutdown();
2800 }
2801 self.drop_without_shutdown();
2802 _result
2803 }
2804
2805 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2807 let _result = self.send_raw();
2808 self.drop_without_shutdown();
2809 _result
2810 }
2811
2812 fn send_raw(&self) -> Result<(), fidl::Error> {
2813 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2814 (),
2815 self.tx_id,
2816 0x41f7121798dfe15f,
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 CentralCreateConnectedIsochronousGroupResponder {
2825 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2826 tx_id: u32,
2827}
2828
2829impl std::ops::Drop for CentralCreateConnectedIsochronousGroupResponder {
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 CentralCreateConnectedIsochronousGroupResponder {
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 CentralCreateConnectedIsochronousGroupResponder {
2856 pub fn send(
2860 self,
2861 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2862 ) -> Result<(), fidl::Error> {
2863 let _result = self.send_raw(result);
2864 if _result.is_err() {
2865 self.control_handle.shutdown();
2866 }
2867 self.drop_without_shutdown();
2868 _result
2869 }
2870
2871 pub fn send_no_shutdown_on_err(
2873 self,
2874 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2875 ) -> Result<(), fidl::Error> {
2876 let _result = self.send_raw(result);
2877 self.drop_without_shutdown();
2878 _result
2879 }
2880
2881 fn send_raw(
2882 &self,
2883 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2884 ) -> Result<(), fidl::Error> {
2885 self.control_handle.inner.send::<fidl::encoding::ResultType<
2886 CentralCreateConnectedIsochronousGroupResponse,
2887 CreateCigError,
2888 >>(
2889 result,
2890 self.tx_id,
2891 0x60323e70ae22e13,
2892 fidl::encoding::DynamicFlags::empty(),
2893 )
2894 }
2895}
2896
2897#[must_use = "FIDL methods require a response to be sent"]
2898#[derive(Debug)]
2899pub struct CentralGetPeripheralsResponder {
2900 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2901 tx_id: u32,
2902}
2903
2904impl std::ops::Drop for CentralGetPeripheralsResponder {
2908 fn drop(&mut self) {
2909 self.control_handle.shutdown();
2910 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2912 }
2913}
2914
2915impl fidl::endpoints::Responder for CentralGetPeripheralsResponder {
2916 type ControlHandle = CentralControlHandle;
2917
2918 fn control_handle(&self) -> &CentralControlHandle {
2919 &self.control_handle
2920 }
2921
2922 fn drop_without_shutdown(mut self) {
2923 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2925 std::mem::forget(self);
2927 }
2928}
2929
2930impl CentralGetPeripheralsResponder {
2931 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2935 let _result = self.send_raw(peripherals);
2936 if _result.is_err() {
2937 self.control_handle.shutdown();
2938 }
2939 self.drop_without_shutdown();
2940 _result
2941 }
2942
2943 pub fn send_no_shutdown_on_err(
2945 self,
2946 mut peripherals: &[RemoteDevice],
2947 ) -> Result<(), fidl::Error> {
2948 let _result = self.send_raw(peripherals);
2949 self.drop_without_shutdown();
2950 _result
2951 }
2952
2953 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2954 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
2955 (peripherals,),
2956 self.tx_id,
2957 0x37ba777499c683a8,
2958 fidl::encoding::DynamicFlags::empty(),
2959 )
2960 }
2961}
2962
2963#[must_use = "FIDL methods require a response to be sent"]
2964#[derive(Debug)]
2965pub struct CentralGetPeripheralResponder {
2966 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2967 tx_id: u32,
2968}
2969
2970impl std::ops::Drop for CentralGetPeripheralResponder {
2974 fn drop(&mut self) {
2975 self.control_handle.shutdown();
2976 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2978 }
2979}
2980
2981impl fidl::endpoints::Responder for CentralGetPeripheralResponder {
2982 type ControlHandle = CentralControlHandle;
2983
2984 fn control_handle(&self) -> &CentralControlHandle {
2985 &self.control_handle
2986 }
2987
2988 fn drop_without_shutdown(mut self) {
2989 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2991 std::mem::forget(self);
2993 }
2994}
2995
2996impl CentralGetPeripheralResponder {
2997 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
3001 let _result = self.send_raw(peripheral);
3002 if _result.is_err() {
3003 self.control_handle.shutdown();
3004 }
3005 self.drop_without_shutdown();
3006 _result
3007 }
3008
3009 pub fn send_no_shutdown_on_err(
3011 self,
3012 mut peripheral: Option<&RemoteDevice>,
3013 ) -> Result<(), fidl::Error> {
3014 let _result = self.send_raw(peripheral);
3015 self.drop_without_shutdown();
3016 _result
3017 }
3018
3019 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
3020 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
3021 (peripheral,),
3022 self.tx_id,
3023 0x97f5a2f2d9c13da,
3024 fidl::encoding::DynamicFlags::empty(),
3025 )
3026 }
3027}
3028
3029#[must_use = "FIDL methods require a response to be sent"]
3030#[derive(Debug)]
3031pub struct CentralStartScanResponder {
3032 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3033 tx_id: u32,
3034}
3035
3036impl std::ops::Drop for CentralStartScanResponder {
3040 fn drop(&mut self) {
3041 self.control_handle.shutdown();
3042 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3044 }
3045}
3046
3047impl fidl::endpoints::Responder for CentralStartScanResponder {
3048 type ControlHandle = CentralControlHandle;
3049
3050 fn control_handle(&self) -> &CentralControlHandle {
3051 &self.control_handle
3052 }
3053
3054 fn drop_without_shutdown(mut self) {
3055 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3057 std::mem::forget(self);
3059 }
3060}
3061
3062impl CentralStartScanResponder {
3063 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3067 let _result = self.send_raw(status);
3068 if _result.is_err() {
3069 self.control_handle.shutdown();
3070 }
3071 self.drop_without_shutdown();
3072 _result
3073 }
3074
3075 pub fn send_no_shutdown_on_err(
3077 self,
3078 mut status: &fidl_fuchsia_bluetooth::Status,
3079 ) -> Result<(), fidl::Error> {
3080 let _result = self.send_raw(status);
3081 self.drop_without_shutdown();
3082 _result
3083 }
3084
3085 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3086 self.control_handle.inner.send::<CentralStartScanResponse>(
3087 (status,),
3088 self.tx_id,
3089 0xeb4cf0cd0e1132b,
3090 fidl::encoding::DynamicFlags::empty(),
3091 )
3092 }
3093}
3094
3095#[must_use = "FIDL methods require a response to be sent"]
3096#[derive(Debug)]
3097pub struct CentralConnectPeripheralResponder {
3098 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3099 tx_id: u32,
3100}
3101
3102impl std::ops::Drop for CentralConnectPeripheralResponder {
3106 fn drop(&mut self) {
3107 self.control_handle.shutdown();
3108 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3110 }
3111}
3112
3113impl fidl::endpoints::Responder for CentralConnectPeripheralResponder {
3114 type ControlHandle = CentralControlHandle;
3115
3116 fn control_handle(&self) -> &CentralControlHandle {
3117 &self.control_handle
3118 }
3119
3120 fn drop_without_shutdown(mut self) {
3121 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3123 std::mem::forget(self);
3125 }
3126}
3127
3128impl CentralConnectPeripheralResponder {
3129 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3133 let _result = self.send_raw(status);
3134 if _result.is_err() {
3135 self.control_handle.shutdown();
3136 }
3137 self.drop_without_shutdown();
3138 _result
3139 }
3140
3141 pub fn send_no_shutdown_on_err(
3143 self,
3144 mut status: &fidl_fuchsia_bluetooth::Status,
3145 ) -> Result<(), fidl::Error> {
3146 let _result = self.send_raw(status);
3147 self.drop_without_shutdown();
3148 _result
3149 }
3150
3151 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3152 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
3153 (status,),
3154 self.tx_id,
3155 0x714d6c32d066d75a,
3156 fidl::encoding::DynamicFlags::empty(),
3157 )
3158 }
3159}
3160
3161#[must_use = "FIDL methods require a response to be sent"]
3162#[derive(Debug)]
3163pub struct CentralDisconnectPeripheralResponder {
3164 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3165 tx_id: u32,
3166}
3167
3168impl std::ops::Drop for CentralDisconnectPeripheralResponder {
3172 fn drop(&mut self) {
3173 self.control_handle.shutdown();
3174 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3176 }
3177}
3178
3179impl fidl::endpoints::Responder for CentralDisconnectPeripheralResponder {
3180 type ControlHandle = CentralControlHandle;
3181
3182 fn control_handle(&self) -> &CentralControlHandle {
3183 &self.control_handle
3184 }
3185
3186 fn drop_without_shutdown(mut self) {
3187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3189 std::mem::forget(self);
3191 }
3192}
3193
3194impl CentralDisconnectPeripheralResponder {
3195 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3199 let _result = self.send_raw(status);
3200 if _result.is_err() {
3201 self.control_handle.shutdown();
3202 }
3203 self.drop_without_shutdown();
3204 _result
3205 }
3206
3207 pub fn send_no_shutdown_on_err(
3209 self,
3210 mut status: &fidl_fuchsia_bluetooth::Status,
3211 ) -> Result<(), fidl::Error> {
3212 let _result = self.send_raw(status);
3213 self.drop_without_shutdown();
3214 _result
3215 }
3216
3217 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3218 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
3219 (status,),
3220 self.tx_id,
3221 0xa9430da197362fd,
3222 fidl::encoding::DynamicFlags::empty(),
3223 )
3224 }
3225}
3226
3227#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3228pub struct ChannelListenerMarker;
3229
3230impl fidl::endpoints::ProtocolMarker for ChannelListenerMarker {
3231 type Proxy = ChannelListenerProxy;
3232 type RequestStream = ChannelListenerRequestStream;
3233 #[cfg(target_os = "fuchsia")]
3234 type SynchronousProxy = ChannelListenerSynchronousProxy;
3235
3236 const DEBUG_NAME: &'static str = "(anonymous) ChannelListener";
3237}
3238
3239pub trait ChannelListenerProxyInterface: Send + Sync {
3240 type AcceptResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3241 fn r#accept(
3242 &self,
3243 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3244 ) -> Self::AcceptResponseFut;
3245 type ConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3246 fn r#connected(&self, payload: ChannelListenerConnectedRequest) -> Self::ConnectedResponseFut;
3247}
3248#[derive(Debug)]
3249#[cfg(target_os = "fuchsia")]
3250pub struct ChannelListenerSynchronousProxy {
3251 client: fidl::client::sync::Client,
3252}
3253
3254#[cfg(target_os = "fuchsia")]
3255impl fidl::endpoints::SynchronousProxy for ChannelListenerSynchronousProxy {
3256 type Proxy = ChannelListenerProxy;
3257 type Protocol = ChannelListenerMarker;
3258
3259 fn from_channel(inner: fidl::Channel) -> Self {
3260 Self::new(inner)
3261 }
3262
3263 fn into_channel(self) -> fidl::Channel {
3264 self.client.into_channel()
3265 }
3266
3267 fn as_channel(&self) -> &fidl::Channel {
3268 self.client.as_channel()
3269 }
3270}
3271
3272#[cfg(target_os = "fuchsia")]
3273impl ChannelListenerSynchronousProxy {
3274 pub fn new(channel: fidl::Channel) -> Self {
3275 Self { client: fidl::client::sync::Client::new(channel) }
3276 }
3277
3278 pub fn into_channel(self) -> fidl::Channel {
3279 self.client.into_channel()
3280 }
3281
3282 pub fn wait_for_event(
3285 &self,
3286 deadline: zx::MonotonicInstant,
3287 ) -> Result<ChannelListenerEvent, fidl::Error> {
3288 ChannelListenerEvent::decode(self.client.wait_for_event::<ChannelListenerMarker>(deadline)?)
3289 }
3290
3291 pub fn r#accept(
3292 &self,
3293 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3294 ___deadline: zx::MonotonicInstant,
3295 ) -> Result<(), fidl::Error> {
3296 let _response = self.client.send_query::<
3297 ChannelListenerAcceptRequest,
3298 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3299 ChannelListenerMarker,
3300 >(
3301 (channel,),
3302 0x6f535bd36b20fc7b,
3303 fidl::encoding::DynamicFlags::FLEXIBLE,
3304 ___deadline,
3305 )?
3306 .into_result::<ChannelListenerMarker>("accept")?;
3307 Ok(_response)
3308 }
3309
3310 pub fn r#connected(
3312 &self,
3313 mut payload: ChannelListenerConnectedRequest,
3314 ___deadline: zx::MonotonicInstant,
3315 ) -> Result<(), fidl::Error> {
3316 let _response = self.client.send_query::<
3317 ChannelListenerConnectedRequest,
3318 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3319 ChannelListenerMarker,
3320 >(
3321 &mut payload,
3322 0xf40756858f21866,
3323 fidl::encoding::DynamicFlags::FLEXIBLE,
3324 ___deadline,
3325 )?
3326 .into_result::<ChannelListenerMarker>("connected")?;
3327 Ok(_response)
3328 }
3329}
3330
3331#[cfg(target_os = "fuchsia")]
3332impl From<ChannelListenerSynchronousProxy> for zx::NullableHandle {
3333 fn from(value: ChannelListenerSynchronousProxy) -> Self {
3334 value.into_channel().into()
3335 }
3336}
3337
3338#[cfg(target_os = "fuchsia")]
3339impl From<fidl::Channel> for ChannelListenerSynchronousProxy {
3340 fn from(value: fidl::Channel) -> Self {
3341 Self::new(value)
3342 }
3343}
3344
3345#[cfg(target_os = "fuchsia")]
3346impl fidl::endpoints::FromClient for ChannelListenerSynchronousProxy {
3347 type Protocol = ChannelListenerMarker;
3348
3349 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerMarker>) -> Self {
3350 Self::new(value.into_channel())
3351 }
3352}
3353
3354#[derive(Debug, Clone)]
3355pub struct ChannelListenerProxy {
3356 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3357}
3358
3359impl fidl::endpoints::Proxy for ChannelListenerProxy {
3360 type Protocol = ChannelListenerMarker;
3361
3362 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3363 Self::new(inner)
3364 }
3365
3366 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3367 self.client.into_channel().map_err(|client| Self { client })
3368 }
3369
3370 fn as_channel(&self) -> &::fidl::AsyncChannel {
3371 self.client.as_channel()
3372 }
3373}
3374
3375impl ChannelListenerProxy {
3376 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3378 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3379 Self { client: fidl::client::Client::new(channel, protocol_name) }
3380 }
3381
3382 pub fn take_event_stream(&self) -> ChannelListenerEventStream {
3388 ChannelListenerEventStream { event_receiver: self.client.take_event_receiver() }
3389 }
3390
3391 pub fn r#accept(
3392 &self,
3393 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3394 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3395 ChannelListenerProxyInterface::r#accept(self, channel)
3396 }
3397
3398 pub fn r#connected(
3400 &self,
3401 mut payload: ChannelListenerConnectedRequest,
3402 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3403 ChannelListenerProxyInterface::r#connected(self, payload)
3404 }
3405}
3406
3407impl ChannelListenerProxyInterface for ChannelListenerProxy {
3408 type AcceptResponseFut =
3409 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3410 fn r#accept(
3411 &self,
3412 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3413 ) -> Self::AcceptResponseFut {
3414 fn _decode(
3415 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3416 ) -> Result<(), fidl::Error> {
3417 let _response = fidl::client::decode_transaction_body::<
3418 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3419 fidl::encoding::DefaultFuchsiaResourceDialect,
3420 0x6f535bd36b20fc7b,
3421 >(_buf?)?
3422 .into_result::<ChannelListenerMarker>("accept")?;
3423 Ok(_response)
3424 }
3425 self.client.send_query_and_decode::<ChannelListenerAcceptRequest, ()>(
3426 (channel,),
3427 0x6f535bd36b20fc7b,
3428 fidl::encoding::DynamicFlags::FLEXIBLE,
3429 _decode,
3430 )
3431 }
3432
3433 type ConnectedResponseFut =
3434 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3435 fn r#connected(
3436 &self,
3437 mut payload: ChannelListenerConnectedRequest,
3438 ) -> Self::ConnectedResponseFut {
3439 fn _decode(
3440 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3441 ) -> Result<(), fidl::Error> {
3442 let _response = fidl::client::decode_transaction_body::<
3443 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3444 fidl::encoding::DefaultFuchsiaResourceDialect,
3445 0xf40756858f21866,
3446 >(_buf?)?
3447 .into_result::<ChannelListenerMarker>("connected")?;
3448 Ok(_response)
3449 }
3450 self.client.send_query_and_decode::<ChannelListenerConnectedRequest, ()>(
3451 &mut payload,
3452 0xf40756858f21866,
3453 fidl::encoding::DynamicFlags::FLEXIBLE,
3454 _decode,
3455 )
3456 }
3457}
3458
3459pub struct ChannelListenerEventStream {
3460 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3461}
3462
3463impl std::marker::Unpin for ChannelListenerEventStream {}
3464
3465impl futures::stream::FusedStream for ChannelListenerEventStream {
3466 fn is_terminated(&self) -> bool {
3467 self.event_receiver.is_terminated()
3468 }
3469}
3470
3471impl futures::Stream for ChannelListenerEventStream {
3472 type Item = Result<ChannelListenerEvent, fidl::Error>;
3473
3474 fn poll_next(
3475 mut self: std::pin::Pin<&mut Self>,
3476 cx: &mut std::task::Context<'_>,
3477 ) -> std::task::Poll<Option<Self::Item>> {
3478 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3479 &mut self.event_receiver,
3480 cx
3481 )?) {
3482 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerEvent::decode(buf))),
3483 None => std::task::Poll::Ready(None),
3484 }
3485 }
3486}
3487
3488#[derive(Debug)]
3489pub enum ChannelListenerEvent {
3490 #[non_exhaustive]
3491 _UnknownEvent {
3492 ordinal: u64,
3494 },
3495}
3496
3497impl ChannelListenerEvent {
3498 fn decode(
3500 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3501 ) -> Result<ChannelListenerEvent, fidl::Error> {
3502 let (bytes, _handles) = buf.split_mut();
3503 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3504 debug_assert_eq!(tx_header.tx_id, 0);
3505 match tx_header.ordinal {
3506 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3507 Ok(ChannelListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3508 }
3509 _ => Err(fidl::Error::UnknownOrdinal {
3510 ordinal: tx_header.ordinal,
3511 protocol_name:
3512 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3513 }),
3514 }
3515 }
3516}
3517
3518pub struct ChannelListenerRequestStream {
3520 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3521 is_terminated: bool,
3522}
3523
3524impl std::marker::Unpin for ChannelListenerRequestStream {}
3525
3526impl futures::stream::FusedStream for ChannelListenerRequestStream {
3527 fn is_terminated(&self) -> bool {
3528 self.is_terminated
3529 }
3530}
3531
3532impl fidl::endpoints::RequestStream for ChannelListenerRequestStream {
3533 type Protocol = ChannelListenerMarker;
3534 type ControlHandle = ChannelListenerControlHandle;
3535
3536 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3537 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3538 }
3539
3540 fn control_handle(&self) -> Self::ControlHandle {
3541 ChannelListenerControlHandle { inner: self.inner.clone() }
3542 }
3543
3544 fn into_inner(
3545 self,
3546 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3547 {
3548 (self.inner, self.is_terminated)
3549 }
3550
3551 fn from_inner(
3552 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3553 is_terminated: bool,
3554 ) -> Self {
3555 Self { inner, is_terminated }
3556 }
3557}
3558
3559impl futures::Stream for ChannelListenerRequestStream {
3560 type Item = Result<ChannelListenerRequest, fidl::Error>;
3561
3562 fn poll_next(
3563 mut self: std::pin::Pin<&mut Self>,
3564 cx: &mut std::task::Context<'_>,
3565 ) -> std::task::Poll<Option<Self::Item>> {
3566 let this = &mut *self;
3567 if this.inner.check_shutdown(cx) {
3568 this.is_terminated = true;
3569 return std::task::Poll::Ready(None);
3570 }
3571 if this.is_terminated {
3572 panic!("polled ChannelListenerRequestStream after completion");
3573 }
3574 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3575 |bytes, handles| {
3576 match this.inner.channel().read_etc(cx, bytes, handles) {
3577 std::task::Poll::Ready(Ok(())) => {}
3578 std::task::Poll::Pending => return std::task::Poll::Pending,
3579 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3580 this.is_terminated = true;
3581 return std::task::Poll::Ready(None);
3582 }
3583 std::task::Poll::Ready(Err(e)) => {
3584 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3585 e.into(),
3586 ))));
3587 }
3588 }
3589
3590 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3592
3593 std::task::Poll::Ready(Some(match header.ordinal {
3594 0x6f535bd36b20fc7b => {
3595 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3596 let mut req = fidl::new_empty!(
3597 ChannelListenerAcceptRequest,
3598 fidl::encoding::DefaultFuchsiaResourceDialect
3599 );
3600 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
3601 let control_handle =
3602 ChannelListenerControlHandle { inner: this.inner.clone() };
3603 Ok(ChannelListenerRequest::Accept {
3604 channel: req.channel,
3605
3606 responder: ChannelListenerAcceptResponder {
3607 control_handle: std::mem::ManuallyDrop::new(control_handle),
3608 tx_id: header.tx_id,
3609 },
3610 })
3611 }
3612 0xf40756858f21866 => {
3613 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3614 let mut req = fidl::new_empty!(
3615 ChannelListenerConnectedRequest,
3616 fidl::encoding::DefaultFuchsiaResourceDialect
3617 );
3618 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
3619 let control_handle =
3620 ChannelListenerControlHandle { inner: this.inner.clone() };
3621 Ok(ChannelListenerRequest::Connected {
3622 payload: req,
3623 responder: ChannelListenerConnectedResponder {
3624 control_handle: std::mem::ManuallyDrop::new(control_handle),
3625 tx_id: header.tx_id,
3626 },
3627 })
3628 }
3629 _ if header.tx_id == 0
3630 && header
3631 .dynamic_flags()
3632 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3633 {
3634 Ok(ChannelListenerRequest::_UnknownMethod {
3635 ordinal: header.ordinal,
3636 control_handle: ChannelListenerControlHandle {
3637 inner: this.inner.clone(),
3638 },
3639 method_type: fidl::MethodType::OneWay,
3640 })
3641 }
3642 _ if header
3643 .dynamic_flags()
3644 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3645 {
3646 this.inner.send_framework_err(
3647 fidl::encoding::FrameworkErr::UnknownMethod,
3648 header.tx_id,
3649 header.ordinal,
3650 header.dynamic_flags(),
3651 (bytes, handles),
3652 )?;
3653 Ok(ChannelListenerRequest::_UnknownMethod {
3654 ordinal: header.ordinal,
3655 control_handle: ChannelListenerControlHandle {
3656 inner: this.inner.clone(),
3657 },
3658 method_type: fidl::MethodType::TwoWay,
3659 })
3660 }
3661 _ => Err(fidl::Error::UnknownOrdinal {
3662 ordinal: header.ordinal,
3663 protocol_name:
3664 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3665 }),
3666 }))
3667 },
3668 )
3669 }
3670}
3671
3672#[derive(Debug)]
3679pub enum ChannelListenerRequest {
3680 Accept {
3681 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3682 responder: ChannelListenerAcceptResponder,
3683 },
3684 Connected {
3686 payload: ChannelListenerConnectedRequest,
3687 responder: ChannelListenerConnectedResponder,
3688 },
3689 #[non_exhaustive]
3691 _UnknownMethod {
3692 ordinal: u64,
3694 control_handle: ChannelListenerControlHandle,
3695 method_type: fidl::MethodType,
3696 },
3697}
3698
3699impl ChannelListenerRequest {
3700 #[allow(irrefutable_let_patterns)]
3701 pub fn into_accept(
3702 self,
3703 ) -> Option<(
3704 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3705 ChannelListenerAcceptResponder,
3706 )> {
3707 if let ChannelListenerRequest::Accept { channel, responder } = self {
3708 Some((channel, responder))
3709 } else {
3710 None
3711 }
3712 }
3713
3714 #[allow(irrefutable_let_patterns)]
3715 pub fn into_connected(
3716 self,
3717 ) -> Option<(ChannelListenerConnectedRequest, ChannelListenerConnectedResponder)> {
3718 if let ChannelListenerRequest::Connected { payload, responder } = self {
3719 Some((payload, responder))
3720 } else {
3721 None
3722 }
3723 }
3724
3725 pub fn method_name(&self) -> &'static str {
3727 match *self {
3728 ChannelListenerRequest::Accept { .. } => "accept",
3729 ChannelListenerRequest::Connected { .. } => "connected",
3730 ChannelListenerRequest::_UnknownMethod {
3731 method_type: fidl::MethodType::OneWay,
3732 ..
3733 } => "unknown one-way method",
3734 ChannelListenerRequest::_UnknownMethod {
3735 method_type: fidl::MethodType::TwoWay,
3736 ..
3737 } => "unknown two-way method",
3738 }
3739 }
3740}
3741
3742#[derive(Debug, Clone)]
3743pub struct ChannelListenerControlHandle {
3744 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3745}
3746
3747impl fidl::endpoints::ControlHandle for ChannelListenerControlHandle {
3748 fn shutdown(&self) {
3749 self.inner.shutdown()
3750 }
3751
3752 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3753 self.inner.shutdown_with_epitaph(status)
3754 }
3755
3756 fn is_closed(&self) -> bool {
3757 self.inner.channel().is_closed()
3758 }
3759 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3760 self.inner.channel().on_closed()
3761 }
3762
3763 #[cfg(target_os = "fuchsia")]
3764 fn signal_peer(
3765 &self,
3766 clear_mask: zx::Signals,
3767 set_mask: zx::Signals,
3768 ) -> Result<(), zx_status::Status> {
3769 use fidl::Peered;
3770 self.inner.channel().signal_peer(clear_mask, set_mask)
3771 }
3772}
3773
3774impl ChannelListenerControlHandle {}
3775
3776#[must_use = "FIDL methods require a response to be sent"]
3777#[derive(Debug)]
3778pub struct ChannelListenerAcceptResponder {
3779 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3780 tx_id: u32,
3781}
3782
3783impl std::ops::Drop for ChannelListenerAcceptResponder {
3787 fn drop(&mut self) {
3788 self.control_handle.shutdown();
3789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3791 }
3792}
3793
3794impl fidl::endpoints::Responder for ChannelListenerAcceptResponder {
3795 type ControlHandle = ChannelListenerControlHandle;
3796
3797 fn control_handle(&self) -> &ChannelListenerControlHandle {
3798 &self.control_handle
3799 }
3800
3801 fn drop_without_shutdown(mut self) {
3802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3804 std::mem::forget(self);
3806 }
3807}
3808
3809impl ChannelListenerAcceptResponder {
3810 pub fn send(self) -> Result<(), fidl::Error> {
3814 let _result = self.send_raw();
3815 if _result.is_err() {
3816 self.control_handle.shutdown();
3817 }
3818 self.drop_without_shutdown();
3819 _result
3820 }
3821
3822 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3824 let _result = self.send_raw();
3825 self.drop_without_shutdown();
3826 _result
3827 }
3828
3829 fn send_raw(&self) -> Result<(), fidl::Error> {
3830 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3831 fidl::encoding::Flexible::new(()),
3832 self.tx_id,
3833 0x6f535bd36b20fc7b,
3834 fidl::encoding::DynamicFlags::FLEXIBLE,
3835 )
3836 }
3837}
3838
3839#[must_use = "FIDL methods require a response to be sent"]
3840#[derive(Debug)]
3841pub struct ChannelListenerConnectedResponder {
3842 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3843 tx_id: u32,
3844}
3845
3846impl std::ops::Drop for ChannelListenerConnectedResponder {
3850 fn drop(&mut self) {
3851 self.control_handle.shutdown();
3852 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3854 }
3855}
3856
3857impl fidl::endpoints::Responder for ChannelListenerConnectedResponder {
3858 type ControlHandle = ChannelListenerControlHandle;
3859
3860 fn control_handle(&self) -> &ChannelListenerControlHandle {
3861 &self.control_handle
3862 }
3863
3864 fn drop_without_shutdown(mut self) {
3865 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3867 std::mem::forget(self);
3869 }
3870}
3871
3872impl ChannelListenerConnectedResponder {
3873 pub fn send(self) -> Result<(), fidl::Error> {
3877 let _result = self.send_raw();
3878 if _result.is_err() {
3879 self.control_handle.shutdown();
3880 }
3881 self.drop_without_shutdown();
3882 _result
3883 }
3884
3885 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3887 let _result = self.send_raw();
3888 self.drop_without_shutdown();
3889 _result
3890 }
3891
3892 fn send_raw(&self) -> Result<(), fidl::Error> {
3893 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3894 fidl::encoding::Flexible::new(()),
3895 self.tx_id,
3896 0xf40756858f21866,
3897 fidl::encoding::DynamicFlags::FLEXIBLE,
3898 )
3899 }
3900}
3901
3902#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3903pub struct ChannelListenerRegistryMarker;
3904
3905impl fidl::endpoints::ProtocolMarker for ChannelListenerRegistryMarker {
3906 type Proxy = ChannelListenerRegistryProxy;
3907 type RequestStream = ChannelListenerRegistryRequestStream;
3908 #[cfg(target_os = "fuchsia")]
3909 type SynchronousProxy = ChannelListenerRegistrySynchronousProxy;
3910
3911 const DEBUG_NAME: &'static str = "(anonymous) ChannelListenerRegistry";
3912}
3913pub type ChannelListenerRegistryListenL2capResult =
3914 Result<ChannelListenerRegistryListenL2capResponse, i32>;
3915
3916pub trait ChannelListenerRegistryProxyInterface: Send + Sync {
3917 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
3918 + Send;
3919 fn r#listen_l2cap(
3920 &self,
3921 payload: ChannelListenerRegistryListenL2capRequest,
3922 ) -> Self::ListenL2capResponseFut;
3923}
3924#[derive(Debug)]
3925#[cfg(target_os = "fuchsia")]
3926pub struct ChannelListenerRegistrySynchronousProxy {
3927 client: fidl::client::sync::Client,
3928}
3929
3930#[cfg(target_os = "fuchsia")]
3931impl fidl::endpoints::SynchronousProxy for ChannelListenerRegistrySynchronousProxy {
3932 type Proxy = ChannelListenerRegistryProxy;
3933 type Protocol = ChannelListenerRegistryMarker;
3934
3935 fn from_channel(inner: fidl::Channel) -> Self {
3936 Self::new(inner)
3937 }
3938
3939 fn into_channel(self) -> fidl::Channel {
3940 self.client.into_channel()
3941 }
3942
3943 fn as_channel(&self) -> &fidl::Channel {
3944 self.client.as_channel()
3945 }
3946}
3947
3948#[cfg(target_os = "fuchsia")]
3949impl ChannelListenerRegistrySynchronousProxy {
3950 pub fn new(channel: fidl::Channel) -> Self {
3951 Self { client: fidl::client::sync::Client::new(channel) }
3952 }
3953
3954 pub fn into_channel(self) -> fidl::Channel {
3955 self.client.into_channel()
3956 }
3957
3958 pub fn wait_for_event(
3961 &self,
3962 deadline: zx::MonotonicInstant,
3963 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3964 ChannelListenerRegistryEvent::decode(
3965 self.client.wait_for_event::<ChannelListenerRegistryMarker>(deadline)?,
3966 )
3967 }
3968
3969 pub fn r#listen_l2cap(
3979 &self,
3980 mut payload: ChannelListenerRegistryListenL2capRequest,
3981 ___deadline: zx::MonotonicInstant,
3982 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3983 let _response = self.client.send_query::<
3984 ChannelListenerRegistryListenL2capRequest,
3985 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3986 ChannelListenerRegistryMarker,
3987 >(
3988 &mut payload,
3989 0x39c6e9001d102338,
3990 fidl::encoding::DynamicFlags::empty(),
3991 ___deadline,
3992 )?;
3993 Ok(_response.map(|x| x))
3994 }
3995}
3996
3997#[cfg(target_os = "fuchsia")]
3998impl From<ChannelListenerRegistrySynchronousProxy> for zx::NullableHandle {
3999 fn from(value: ChannelListenerRegistrySynchronousProxy) -> Self {
4000 value.into_channel().into()
4001 }
4002}
4003
4004#[cfg(target_os = "fuchsia")]
4005impl From<fidl::Channel> for ChannelListenerRegistrySynchronousProxy {
4006 fn from(value: fidl::Channel) -> Self {
4007 Self::new(value)
4008 }
4009}
4010
4011#[cfg(target_os = "fuchsia")]
4012impl fidl::endpoints::FromClient for ChannelListenerRegistrySynchronousProxy {
4013 type Protocol = ChannelListenerRegistryMarker;
4014
4015 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerRegistryMarker>) -> Self {
4016 Self::new(value.into_channel())
4017 }
4018}
4019
4020#[derive(Debug, Clone)]
4021pub struct ChannelListenerRegistryProxy {
4022 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4023}
4024
4025impl fidl::endpoints::Proxy for ChannelListenerRegistryProxy {
4026 type Protocol = ChannelListenerRegistryMarker;
4027
4028 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4029 Self::new(inner)
4030 }
4031
4032 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4033 self.client.into_channel().map_err(|client| Self { client })
4034 }
4035
4036 fn as_channel(&self) -> &::fidl::AsyncChannel {
4037 self.client.as_channel()
4038 }
4039}
4040
4041impl ChannelListenerRegistryProxy {
4042 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4044 let protocol_name =
4045 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4046 Self { client: fidl::client::Client::new(channel, protocol_name) }
4047 }
4048
4049 pub fn take_event_stream(&self) -> ChannelListenerRegistryEventStream {
4055 ChannelListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
4056 }
4057
4058 pub fn r#listen_l2cap(
4068 &self,
4069 mut payload: ChannelListenerRegistryListenL2capRequest,
4070 ) -> fidl::client::QueryResponseFut<
4071 ChannelListenerRegistryListenL2capResult,
4072 fidl::encoding::DefaultFuchsiaResourceDialect,
4073 > {
4074 ChannelListenerRegistryProxyInterface::r#listen_l2cap(self, payload)
4075 }
4076}
4077
4078impl ChannelListenerRegistryProxyInterface for ChannelListenerRegistryProxy {
4079 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
4080 ChannelListenerRegistryListenL2capResult,
4081 fidl::encoding::DefaultFuchsiaResourceDialect,
4082 >;
4083 fn r#listen_l2cap(
4084 &self,
4085 mut payload: ChannelListenerRegistryListenL2capRequest,
4086 ) -> Self::ListenL2capResponseFut {
4087 fn _decode(
4088 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4089 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
4090 let _response = fidl::client::decode_transaction_body::<
4091 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
4092 fidl::encoding::DefaultFuchsiaResourceDialect,
4093 0x39c6e9001d102338,
4094 >(_buf?)?;
4095 Ok(_response.map(|x| x))
4096 }
4097 self.client.send_query_and_decode::<
4098 ChannelListenerRegistryListenL2capRequest,
4099 ChannelListenerRegistryListenL2capResult,
4100 >(
4101 &mut payload,
4102 0x39c6e9001d102338,
4103 fidl::encoding::DynamicFlags::empty(),
4104 _decode,
4105 )
4106 }
4107}
4108
4109pub struct ChannelListenerRegistryEventStream {
4110 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4111}
4112
4113impl std::marker::Unpin for ChannelListenerRegistryEventStream {}
4114
4115impl futures::stream::FusedStream for ChannelListenerRegistryEventStream {
4116 fn is_terminated(&self) -> bool {
4117 self.event_receiver.is_terminated()
4118 }
4119}
4120
4121impl futures::Stream for ChannelListenerRegistryEventStream {
4122 type Item = Result<ChannelListenerRegistryEvent, fidl::Error>;
4123
4124 fn poll_next(
4125 mut self: std::pin::Pin<&mut Self>,
4126 cx: &mut std::task::Context<'_>,
4127 ) -> std::task::Poll<Option<Self::Item>> {
4128 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4129 &mut self.event_receiver,
4130 cx
4131 )?) {
4132 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerRegistryEvent::decode(buf))),
4133 None => std::task::Poll::Ready(None),
4134 }
4135 }
4136}
4137
4138#[derive(Debug)]
4139pub enum ChannelListenerRegistryEvent {}
4140
4141impl ChannelListenerRegistryEvent {
4142 fn decode(
4144 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4145 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
4146 let (bytes, _handles) = buf.split_mut();
4147 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4148 debug_assert_eq!(tx_header.tx_id, 0);
4149 match tx_header.ordinal {
4150 _ => Err(fidl::Error::UnknownOrdinal {
4151 ordinal: tx_header.ordinal,
4152 protocol_name:
4153 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4154 }),
4155 }
4156 }
4157}
4158
4159pub struct ChannelListenerRegistryRequestStream {
4161 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4162 is_terminated: bool,
4163}
4164
4165impl std::marker::Unpin for ChannelListenerRegistryRequestStream {}
4166
4167impl futures::stream::FusedStream for ChannelListenerRegistryRequestStream {
4168 fn is_terminated(&self) -> bool {
4169 self.is_terminated
4170 }
4171}
4172
4173impl fidl::endpoints::RequestStream for ChannelListenerRegistryRequestStream {
4174 type Protocol = ChannelListenerRegistryMarker;
4175 type ControlHandle = ChannelListenerRegistryControlHandle;
4176
4177 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4178 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4179 }
4180
4181 fn control_handle(&self) -> Self::ControlHandle {
4182 ChannelListenerRegistryControlHandle { inner: self.inner.clone() }
4183 }
4184
4185 fn into_inner(
4186 self,
4187 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4188 {
4189 (self.inner, self.is_terminated)
4190 }
4191
4192 fn from_inner(
4193 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4194 is_terminated: bool,
4195 ) -> Self {
4196 Self { inner, is_terminated }
4197 }
4198}
4199
4200impl futures::Stream for ChannelListenerRegistryRequestStream {
4201 type Item = Result<ChannelListenerRegistryRequest, fidl::Error>;
4202
4203 fn poll_next(
4204 mut self: std::pin::Pin<&mut Self>,
4205 cx: &mut std::task::Context<'_>,
4206 ) -> std::task::Poll<Option<Self::Item>> {
4207 let this = &mut *self;
4208 if this.inner.check_shutdown(cx) {
4209 this.is_terminated = true;
4210 return std::task::Poll::Ready(None);
4211 }
4212 if this.is_terminated {
4213 panic!("polled ChannelListenerRegistryRequestStream after completion");
4214 }
4215 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4216 |bytes, handles| {
4217 match this.inner.channel().read_etc(cx, bytes, handles) {
4218 std::task::Poll::Ready(Ok(())) => {}
4219 std::task::Poll::Pending => return std::task::Poll::Pending,
4220 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4221 this.is_terminated = true;
4222 return std::task::Poll::Ready(None);
4223 }
4224 std::task::Poll::Ready(Err(e)) => {
4225 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4226 e.into(),
4227 ))));
4228 }
4229 }
4230
4231 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4233
4234 std::task::Poll::Ready(Some(match header.ordinal {
4235 0x39c6e9001d102338 => {
4236 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4237 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4238 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
4239 let control_handle = ChannelListenerRegistryControlHandle {
4240 inner: this.inner.clone(),
4241 };
4242 Ok(ChannelListenerRegistryRequest::ListenL2cap {payload: req,
4243 responder: ChannelListenerRegistryListenL2capResponder {
4244 control_handle: std::mem::ManuallyDrop::new(control_handle),
4245 tx_id: header.tx_id,
4246 },
4247 })
4248 }
4249 _ => Err(fidl::Error::UnknownOrdinal {
4250 ordinal: header.ordinal,
4251 protocol_name: <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4252 }),
4253 }))
4254 },
4255 )
4256 }
4257}
4258
4259#[derive(Debug)]
4262pub enum ChannelListenerRegistryRequest {
4263 ListenL2cap {
4273 payload: ChannelListenerRegistryListenL2capRequest,
4274 responder: ChannelListenerRegistryListenL2capResponder,
4275 },
4276}
4277
4278impl ChannelListenerRegistryRequest {
4279 #[allow(irrefutable_let_patterns)]
4280 pub fn into_listen_l2cap(
4281 self,
4282 ) -> Option<(
4283 ChannelListenerRegistryListenL2capRequest,
4284 ChannelListenerRegistryListenL2capResponder,
4285 )> {
4286 if let ChannelListenerRegistryRequest::ListenL2cap { payload, responder } = self {
4287 Some((payload, responder))
4288 } else {
4289 None
4290 }
4291 }
4292
4293 pub fn method_name(&self) -> &'static str {
4295 match *self {
4296 ChannelListenerRegistryRequest::ListenL2cap { .. } => "listen_l2cap",
4297 }
4298 }
4299}
4300
4301#[derive(Debug, Clone)]
4302pub struct ChannelListenerRegistryControlHandle {
4303 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4304}
4305
4306impl fidl::endpoints::ControlHandle for ChannelListenerRegistryControlHandle {
4307 fn shutdown(&self) {
4308 self.inner.shutdown()
4309 }
4310
4311 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4312 self.inner.shutdown_with_epitaph(status)
4313 }
4314
4315 fn is_closed(&self) -> bool {
4316 self.inner.channel().is_closed()
4317 }
4318 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4319 self.inner.channel().on_closed()
4320 }
4321
4322 #[cfg(target_os = "fuchsia")]
4323 fn signal_peer(
4324 &self,
4325 clear_mask: zx::Signals,
4326 set_mask: zx::Signals,
4327 ) -> Result<(), zx_status::Status> {
4328 use fidl::Peered;
4329 self.inner.channel().signal_peer(clear_mask, set_mask)
4330 }
4331}
4332
4333impl ChannelListenerRegistryControlHandle {}
4334
4335#[must_use = "FIDL methods require a response to be sent"]
4336#[derive(Debug)]
4337pub struct ChannelListenerRegistryListenL2capResponder {
4338 control_handle: std::mem::ManuallyDrop<ChannelListenerRegistryControlHandle>,
4339 tx_id: u32,
4340}
4341
4342impl std::ops::Drop for ChannelListenerRegistryListenL2capResponder {
4346 fn drop(&mut self) {
4347 self.control_handle.shutdown();
4348 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4350 }
4351}
4352
4353impl fidl::endpoints::Responder for ChannelListenerRegistryListenL2capResponder {
4354 type ControlHandle = ChannelListenerRegistryControlHandle;
4355
4356 fn control_handle(&self) -> &ChannelListenerRegistryControlHandle {
4357 &self.control_handle
4358 }
4359
4360 fn drop_without_shutdown(mut self) {
4361 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4363 std::mem::forget(self);
4365 }
4366}
4367
4368impl ChannelListenerRegistryListenL2capResponder {
4369 pub fn send(
4373 self,
4374 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4375 ) -> Result<(), fidl::Error> {
4376 let _result = self.send_raw(result);
4377 if _result.is_err() {
4378 self.control_handle.shutdown();
4379 }
4380 self.drop_without_shutdown();
4381 _result
4382 }
4383
4384 pub fn send_no_shutdown_on_err(
4386 self,
4387 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4388 ) -> Result<(), fidl::Error> {
4389 let _result = self.send_raw(result);
4390 self.drop_without_shutdown();
4391 _result
4392 }
4393
4394 fn send_raw(
4395 &self,
4396 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4397 ) -> Result<(), fidl::Error> {
4398 self.control_handle.inner.send::<fidl::encoding::ResultType<
4399 ChannelListenerRegistryListenL2capResponse,
4400 i32,
4401 >>(
4402 result,
4403 self.tx_id,
4404 0x39c6e9001d102338,
4405 fidl::encoding::DynamicFlags::empty(),
4406 )
4407 }
4408}
4409
4410#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4411pub struct ChannelOffloadExtMarker;
4412
4413impl fidl::endpoints::ProtocolMarker for ChannelOffloadExtMarker {
4414 type Proxy = ChannelOffloadExtProxy;
4415 type RequestStream = ChannelOffloadExtRequestStream;
4416 #[cfg(target_os = "fuchsia")]
4417 type SynchronousProxy = ChannelOffloadExtSynchronousProxy;
4418
4419 const DEBUG_NAME: &'static str = "(anonymous) ChannelOffloadExt";
4420}
4421pub type ChannelOffloadExtStartOffloadResult = Result<ChannelOffloadExtStartOffloadResponse, i32>;
4422
4423pub trait ChannelOffloadExtProxyInterface: Send + Sync {
4424 type StartOffloadResponseFut: std::future::Future<Output = Result<ChannelOffloadExtStartOffloadResult, fidl::Error>>
4425 + Send;
4426 fn r#start_offload(
4427 &self,
4428 payload: &ChannelOffloadExtStartOffloadRequest,
4429 ) -> Self::StartOffloadResponseFut;
4430}
4431#[derive(Debug)]
4432#[cfg(target_os = "fuchsia")]
4433pub struct ChannelOffloadExtSynchronousProxy {
4434 client: fidl::client::sync::Client,
4435}
4436
4437#[cfg(target_os = "fuchsia")]
4438impl fidl::endpoints::SynchronousProxy for ChannelOffloadExtSynchronousProxy {
4439 type Proxy = ChannelOffloadExtProxy;
4440 type Protocol = ChannelOffloadExtMarker;
4441
4442 fn from_channel(inner: fidl::Channel) -> Self {
4443 Self::new(inner)
4444 }
4445
4446 fn into_channel(self) -> fidl::Channel {
4447 self.client.into_channel()
4448 }
4449
4450 fn as_channel(&self) -> &fidl::Channel {
4451 self.client.as_channel()
4452 }
4453}
4454
4455#[cfg(target_os = "fuchsia")]
4456impl ChannelOffloadExtSynchronousProxy {
4457 pub fn new(channel: fidl::Channel) -> Self {
4458 Self { client: fidl::client::sync::Client::new(channel) }
4459 }
4460
4461 pub fn into_channel(self) -> fidl::Channel {
4462 self.client.into_channel()
4463 }
4464
4465 pub fn wait_for_event(
4468 &self,
4469 deadline: zx::MonotonicInstant,
4470 ) -> Result<ChannelOffloadExtEvent, fidl::Error> {
4471 ChannelOffloadExtEvent::decode(
4472 self.client.wait_for_event::<ChannelOffloadExtMarker>(deadline)?,
4473 )
4474 }
4475
4476 pub fn r#start_offload(
4486 &self,
4487 mut payload: &ChannelOffloadExtStartOffloadRequest,
4488 ___deadline: zx::MonotonicInstant,
4489 ) -> Result<ChannelOffloadExtStartOffloadResult, fidl::Error> {
4490 let _response = self.client.send_query::<
4491 ChannelOffloadExtStartOffloadRequest,
4492 fidl::encoding::FlexibleResultType<ChannelOffloadExtStartOffloadResponse, i32>,
4493 ChannelOffloadExtMarker,
4494 >(
4495 payload,
4496 0x2dd620feea793fe8,
4497 fidl::encoding::DynamicFlags::FLEXIBLE,
4498 ___deadline,
4499 )?
4500 .into_result::<ChannelOffloadExtMarker>("start_offload")?;
4501 Ok(_response.map(|x| x))
4502 }
4503}
4504
4505#[cfg(target_os = "fuchsia")]
4506impl From<ChannelOffloadExtSynchronousProxy> for zx::NullableHandle {
4507 fn from(value: ChannelOffloadExtSynchronousProxy) -> Self {
4508 value.into_channel().into()
4509 }
4510}
4511
4512#[cfg(target_os = "fuchsia")]
4513impl From<fidl::Channel> for ChannelOffloadExtSynchronousProxy {
4514 fn from(value: fidl::Channel) -> Self {
4515 Self::new(value)
4516 }
4517}
4518
4519#[cfg(target_os = "fuchsia")]
4520impl fidl::endpoints::FromClient for ChannelOffloadExtSynchronousProxy {
4521 type Protocol = ChannelOffloadExtMarker;
4522
4523 fn from_client(value: fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>) -> Self {
4524 Self::new(value.into_channel())
4525 }
4526}
4527
4528#[derive(Debug, Clone)]
4529pub struct ChannelOffloadExtProxy {
4530 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4531}
4532
4533impl fidl::endpoints::Proxy for ChannelOffloadExtProxy {
4534 type Protocol = ChannelOffloadExtMarker;
4535
4536 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4537 Self::new(inner)
4538 }
4539
4540 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4541 self.client.into_channel().map_err(|client| Self { client })
4542 }
4543
4544 fn as_channel(&self) -> &::fidl::AsyncChannel {
4545 self.client.as_channel()
4546 }
4547}
4548
4549impl ChannelOffloadExtProxy {
4550 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4552 let protocol_name =
4553 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4554 Self { client: fidl::client::Client::new(channel, protocol_name) }
4555 }
4556
4557 pub fn take_event_stream(&self) -> ChannelOffloadExtEventStream {
4563 ChannelOffloadExtEventStream { event_receiver: self.client.take_event_receiver() }
4564 }
4565
4566 pub fn r#start_offload(
4576 &self,
4577 mut payload: &ChannelOffloadExtStartOffloadRequest,
4578 ) -> fidl::client::QueryResponseFut<
4579 ChannelOffloadExtStartOffloadResult,
4580 fidl::encoding::DefaultFuchsiaResourceDialect,
4581 > {
4582 ChannelOffloadExtProxyInterface::r#start_offload(self, payload)
4583 }
4584}
4585
4586impl ChannelOffloadExtProxyInterface for ChannelOffloadExtProxy {
4587 type StartOffloadResponseFut = fidl::client::QueryResponseFut<
4588 ChannelOffloadExtStartOffloadResult,
4589 fidl::encoding::DefaultFuchsiaResourceDialect,
4590 >;
4591 fn r#start_offload(
4592 &self,
4593 mut payload: &ChannelOffloadExtStartOffloadRequest,
4594 ) -> Self::StartOffloadResponseFut {
4595 fn _decode(
4596 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4597 ) -> Result<ChannelOffloadExtStartOffloadResult, fidl::Error> {
4598 let _response = fidl::client::decode_transaction_body::<
4599 fidl::encoding::FlexibleResultType<ChannelOffloadExtStartOffloadResponse, i32>,
4600 fidl::encoding::DefaultFuchsiaResourceDialect,
4601 0x2dd620feea793fe8,
4602 >(_buf?)?
4603 .into_result::<ChannelOffloadExtMarker>("start_offload")?;
4604 Ok(_response.map(|x| x))
4605 }
4606 self.client.send_query_and_decode::<
4607 ChannelOffloadExtStartOffloadRequest,
4608 ChannelOffloadExtStartOffloadResult,
4609 >(
4610 payload,
4611 0x2dd620feea793fe8,
4612 fidl::encoding::DynamicFlags::FLEXIBLE,
4613 _decode,
4614 )
4615 }
4616}
4617
4618pub struct ChannelOffloadExtEventStream {
4619 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4620}
4621
4622impl std::marker::Unpin for ChannelOffloadExtEventStream {}
4623
4624impl futures::stream::FusedStream for ChannelOffloadExtEventStream {
4625 fn is_terminated(&self) -> bool {
4626 self.event_receiver.is_terminated()
4627 }
4628}
4629
4630impl futures::Stream for ChannelOffloadExtEventStream {
4631 type Item = Result<ChannelOffloadExtEvent, fidl::Error>;
4632
4633 fn poll_next(
4634 mut self: std::pin::Pin<&mut Self>,
4635 cx: &mut std::task::Context<'_>,
4636 ) -> std::task::Poll<Option<Self::Item>> {
4637 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4638 &mut self.event_receiver,
4639 cx
4640 )?) {
4641 Some(buf) => std::task::Poll::Ready(Some(ChannelOffloadExtEvent::decode(buf))),
4642 None => std::task::Poll::Ready(None),
4643 }
4644 }
4645}
4646
4647#[derive(Debug)]
4648pub enum ChannelOffloadExtEvent {
4649 #[non_exhaustive]
4650 _UnknownEvent {
4651 ordinal: u64,
4653 },
4654}
4655
4656impl ChannelOffloadExtEvent {
4657 fn decode(
4659 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4660 ) -> Result<ChannelOffloadExtEvent, fidl::Error> {
4661 let (bytes, _handles) = buf.split_mut();
4662 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4663 debug_assert_eq!(tx_header.tx_id, 0);
4664 match tx_header.ordinal {
4665 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4666 Ok(ChannelOffloadExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4667 }
4668 _ => Err(fidl::Error::UnknownOrdinal {
4669 ordinal: tx_header.ordinal,
4670 protocol_name:
4671 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4672 }),
4673 }
4674 }
4675}
4676
4677pub struct ChannelOffloadExtRequestStream {
4679 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4680 is_terminated: bool,
4681}
4682
4683impl std::marker::Unpin for ChannelOffloadExtRequestStream {}
4684
4685impl futures::stream::FusedStream for ChannelOffloadExtRequestStream {
4686 fn is_terminated(&self) -> bool {
4687 self.is_terminated
4688 }
4689}
4690
4691impl fidl::endpoints::RequestStream for ChannelOffloadExtRequestStream {
4692 type Protocol = ChannelOffloadExtMarker;
4693 type ControlHandle = ChannelOffloadExtControlHandle;
4694
4695 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4696 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4697 }
4698
4699 fn control_handle(&self) -> Self::ControlHandle {
4700 ChannelOffloadExtControlHandle { inner: self.inner.clone() }
4701 }
4702
4703 fn into_inner(
4704 self,
4705 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4706 {
4707 (self.inner, self.is_terminated)
4708 }
4709
4710 fn from_inner(
4711 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4712 is_terminated: bool,
4713 ) -> Self {
4714 Self { inner, is_terminated }
4715 }
4716}
4717
4718impl futures::Stream for ChannelOffloadExtRequestStream {
4719 type Item = Result<ChannelOffloadExtRequest, fidl::Error>;
4720
4721 fn poll_next(
4722 mut self: std::pin::Pin<&mut Self>,
4723 cx: &mut std::task::Context<'_>,
4724 ) -> std::task::Poll<Option<Self::Item>> {
4725 let this = &mut *self;
4726 if this.inner.check_shutdown(cx) {
4727 this.is_terminated = true;
4728 return std::task::Poll::Ready(None);
4729 }
4730 if this.is_terminated {
4731 panic!("polled ChannelOffloadExtRequestStream after completion");
4732 }
4733 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4734 |bytes, handles| {
4735 match this.inner.channel().read_etc(cx, bytes, handles) {
4736 std::task::Poll::Ready(Ok(())) => {}
4737 std::task::Poll::Pending => return std::task::Poll::Pending,
4738 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4739 this.is_terminated = true;
4740 return std::task::Poll::Ready(None);
4741 }
4742 std::task::Poll::Ready(Err(e)) => {
4743 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4744 e.into(),
4745 ))));
4746 }
4747 }
4748
4749 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4751
4752 std::task::Poll::Ready(Some(match header.ordinal {
4753 0x2dd620feea793fe8 => {
4754 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4755 let mut req = fidl::new_empty!(
4756 ChannelOffloadExtStartOffloadRequest,
4757 fidl::encoding::DefaultFuchsiaResourceDialect
4758 );
4759 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOffloadExtStartOffloadRequest>(&header, _body_bytes, handles, &mut req)?;
4760 let control_handle =
4761 ChannelOffloadExtControlHandle { inner: this.inner.clone() };
4762 Ok(ChannelOffloadExtRequest::StartOffload {
4763 payload: req,
4764 responder: ChannelOffloadExtStartOffloadResponder {
4765 control_handle: std::mem::ManuallyDrop::new(control_handle),
4766 tx_id: header.tx_id,
4767 },
4768 })
4769 }
4770 _ if header.tx_id == 0
4771 && header
4772 .dynamic_flags()
4773 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4774 {
4775 Ok(ChannelOffloadExtRequest::_UnknownMethod {
4776 ordinal: header.ordinal,
4777 control_handle: ChannelOffloadExtControlHandle {
4778 inner: this.inner.clone(),
4779 },
4780 method_type: fidl::MethodType::OneWay,
4781 })
4782 }
4783 _ if header
4784 .dynamic_flags()
4785 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4786 {
4787 this.inner.send_framework_err(
4788 fidl::encoding::FrameworkErr::UnknownMethod,
4789 header.tx_id,
4790 header.ordinal,
4791 header.dynamic_flags(),
4792 (bytes, handles),
4793 )?;
4794 Ok(ChannelOffloadExtRequest::_UnknownMethod {
4795 ordinal: header.ordinal,
4796 control_handle: ChannelOffloadExtControlHandle {
4797 inner: this.inner.clone(),
4798 },
4799 method_type: fidl::MethodType::TwoWay,
4800 })
4801 }
4802 _ => Err(fidl::Error::UnknownOrdinal {
4803 ordinal: header.ordinal,
4804 protocol_name:
4805 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4806 }),
4807 }))
4808 },
4809 )
4810 }
4811}
4812
4813#[derive(Debug)]
4817pub enum ChannelOffloadExtRequest {
4818 StartOffload {
4828 payload: ChannelOffloadExtStartOffloadRequest,
4829 responder: ChannelOffloadExtStartOffloadResponder,
4830 },
4831 #[non_exhaustive]
4833 _UnknownMethod {
4834 ordinal: u64,
4836 control_handle: ChannelOffloadExtControlHandle,
4837 method_type: fidl::MethodType,
4838 },
4839}
4840
4841impl ChannelOffloadExtRequest {
4842 #[allow(irrefutable_let_patterns)]
4843 pub fn into_start_offload(
4844 self,
4845 ) -> Option<(ChannelOffloadExtStartOffloadRequest, ChannelOffloadExtStartOffloadResponder)>
4846 {
4847 if let ChannelOffloadExtRequest::StartOffload { payload, responder } = self {
4848 Some((payload, responder))
4849 } else {
4850 None
4851 }
4852 }
4853
4854 pub fn method_name(&self) -> &'static str {
4856 match *self {
4857 ChannelOffloadExtRequest::StartOffload { .. } => "start_offload",
4858 ChannelOffloadExtRequest::_UnknownMethod {
4859 method_type: fidl::MethodType::OneWay,
4860 ..
4861 } => "unknown one-way method",
4862 ChannelOffloadExtRequest::_UnknownMethod {
4863 method_type: fidl::MethodType::TwoWay,
4864 ..
4865 } => "unknown two-way method",
4866 }
4867 }
4868}
4869
4870#[derive(Debug, Clone)]
4871pub struct ChannelOffloadExtControlHandle {
4872 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4873}
4874
4875impl fidl::endpoints::ControlHandle for ChannelOffloadExtControlHandle {
4876 fn shutdown(&self) {
4877 self.inner.shutdown()
4878 }
4879
4880 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4881 self.inner.shutdown_with_epitaph(status)
4882 }
4883
4884 fn is_closed(&self) -> bool {
4885 self.inner.channel().is_closed()
4886 }
4887 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4888 self.inner.channel().on_closed()
4889 }
4890
4891 #[cfg(target_os = "fuchsia")]
4892 fn signal_peer(
4893 &self,
4894 clear_mask: zx::Signals,
4895 set_mask: zx::Signals,
4896 ) -> Result<(), zx_status::Status> {
4897 use fidl::Peered;
4898 self.inner.channel().signal_peer(clear_mask, set_mask)
4899 }
4900}
4901
4902impl ChannelOffloadExtControlHandle {}
4903
4904#[must_use = "FIDL methods require a response to be sent"]
4905#[derive(Debug)]
4906pub struct ChannelOffloadExtStartOffloadResponder {
4907 control_handle: std::mem::ManuallyDrop<ChannelOffloadExtControlHandle>,
4908 tx_id: u32,
4909}
4910
4911impl std::ops::Drop for ChannelOffloadExtStartOffloadResponder {
4915 fn drop(&mut self) {
4916 self.control_handle.shutdown();
4917 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4919 }
4920}
4921
4922impl fidl::endpoints::Responder for ChannelOffloadExtStartOffloadResponder {
4923 type ControlHandle = ChannelOffloadExtControlHandle;
4924
4925 fn control_handle(&self) -> &ChannelOffloadExtControlHandle {
4926 &self.control_handle
4927 }
4928
4929 fn drop_without_shutdown(mut self) {
4930 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4932 std::mem::forget(self);
4934 }
4935}
4936
4937impl ChannelOffloadExtStartOffloadResponder {
4938 pub fn send(
4942 self,
4943 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4944 ) -> Result<(), fidl::Error> {
4945 let _result = self.send_raw(result);
4946 if _result.is_err() {
4947 self.control_handle.shutdown();
4948 }
4949 self.drop_without_shutdown();
4950 _result
4951 }
4952
4953 pub fn send_no_shutdown_on_err(
4955 self,
4956 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4957 ) -> Result<(), fidl::Error> {
4958 let _result = self.send_raw(result);
4959 self.drop_without_shutdown();
4960 _result
4961 }
4962
4963 fn send_raw(
4964 &self,
4965 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4966 ) -> Result<(), fidl::Error> {
4967 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4968 ChannelOffloadExtStartOffloadResponse,
4969 i32,
4970 >>(
4971 fidl::encoding::FlexibleResult::new(result),
4972 self.tx_id,
4973 0x2dd620feea793fe8,
4974 fidl::encoding::DynamicFlags::FLEXIBLE,
4975 )
4976 }
4977}
4978
4979#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4980pub struct CodecDelayMarker;
4981
4982impl fidl::endpoints::ProtocolMarker for CodecDelayMarker {
4983 type Proxy = CodecDelayProxy;
4984 type RequestStream = CodecDelayRequestStream;
4985 #[cfg(target_os = "fuchsia")]
4986 type SynchronousProxy = CodecDelaySynchronousProxy;
4987
4988 const DEBUG_NAME: &'static str = "(anonymous) CodecDelay";
4989}
4990pub type CodecDelayGetCodecLocalDelayRangeResult =
4991 Result<CodecDelayGetCodecLocalDelayRangeResponse, i32>;
4992
4993pub trait CodecDelayProxyInterface: Send + Sync {
4994 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
4995 + Send;
4996 fn r#get_codec_local_delay_range(
4997 &self,
4998 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4999 ) -> Self::GetCodecLocalDelayRangeResponseFut;
5000}
5001#[derive(Debug)]
5002#[cfg(target_os = "fuchsia")]
5003pub struct CodecDelaySynchronousProxy {
5004 client: fidl::client::sync::Client,
5005}
5006
5007#[cfg(target_os = "fuchsia")]
5008impl fidl::endpoints::SynchronousProxy for CodecDelaySynchronousProxy {
5009 type Proxy = CodecDelayProxy;
5010 type Protocol = CodecDelayMarker;
5011
5012 fn from_channel(inner: fidl::Channel) -> Self {
5013 Self::new(inner)
5014 }
5015
5016 fn into_channel(self) -> fidl::Channel {
5017 self.client.into_channel()
5018 }
5019
5020 fn as_channel(&self) -> &fidl::Channel {
5021 self.client.as_channel()
5022 }
5023}
5024
5025#[cfg(target_os = "fuchsia")]
5026impl CodecDelaySynchronousProxy {
5027 pub fn new(channel: fidl::Channel) -> Self {
5028 Self { client: fidl::client::sync::Client::new(channel) }
5029 }
5030
5031 pub fn into_channel(self) -> fidl::Channel {
5032 self.client.into_channel()
5033 }
5034
5035 pub fn wait_for_event(
5038 &self,
5039 deadline: zx::MonotonicInstant,
5040 ) -> Result<CodecDelayEvent, fidl::Error> {
5041 CodecDelayEvent::decode(self.client.wait_for_event::<CodecDelayMarker>(deadline)?)
5042 }
5043
5044 pub fn r#get_codec_local_delay_range(
5052 &self,
5053 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5054 ___deadline: zx::MonotonicInstant,
5055 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5056 let _response = self.client.send_query::<
5057 CodecDelayGetCodecLocalDelayRangeRequest,
5058 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5059 CodecDelayMarker,
5060 >(
5061 payload,
5062 0x1cf34fdeed80b4d,
5063 fidl::encoding::DynamicFlags::empty(),
5064 ___deadline,
5065 )?;
5066 Ok(_response.map(|x| x))
5067 }
5068}
5069
5070#[cfg(target_os = "fuchsia")]
5071impl From<CodecDelaySynchronousProxy> for zx::NullableHandle {
5072 fn from(value: CodecDelaySynchronousProxy) -> Self {
5073 value.into_channel().into()
5074 }
5075}
5076
5077#[cfg(target_os = "fuchsia")]
5078impl From<fidl::Channel> for CodecDelaySynchronousProxy {
5079 fn from(value: fidl::Channel) -> Self {
5080 Self::new(value)
5081 }
5082}
5083
5084#[cfg(target_os = "fuchsia")]
5085impl fidl::endpoints::FromClient for CodecDelaySynchronousProxy {
5086 type Protocol = CodecDelayMarker;
5087
5088 fn from_client(value: fidl::endpoints::ClientEnd<CodecDelayMarker>) -> Self {
5089 Self::new(value.into_channel())
5090 }
5091}
5092
5093#[derive(Debug, Clone)]
5094pub struct CodecDelayProxy {
5095 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5096}
5097
5098impl fidl::endpoints::Proxy for CodecDelayProxy {
5099 type Protocol = CodecDelayMarker;
5100
5101 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5102 Self::new(inner)
5103 }
5104
5105 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5106 self.client.into_channel().map_err(|client| Self { client })
5107 }
5108
5109 fn as_channel(&self) -> &::fidl::AsyncChannel {
5110 self.client.as_channel()
5111 }
5112}
5113
5114impl CodecDelayProxy {
5115 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5117 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5118 Self { client: fidl::client::Client::new(channel, protocol_name) }
5119 }
5120
5121 pub fn take_event_stream(&self) -> CodecDelayEventStream {
5127 CodecDelayEventStream { event_receiver: self.client.take_event_receiver() }
5128 }
5129
5130 pub fn r#get_codec_local_delay_range(
5138 &self,
5139 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5140 ) -> fidl::client::QueryResponseFut<
5141 CodecDelayGetCodecLocalDelayRangeResult,
5142 fidl::encoding::DefaultFuchsiaResourceDialect,
5143 > {
5144 CodecDelayProxyInterface::r#get_codec_local_delay_range(self, payload)
5145 }
5146}
5147
5148impl CodecDelayProxyInterface for CodecDelayProxy {
5149 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
5150 CodecDelayGetCodecLocalDelayRangeResult,
5151 fidl::encoding::DefaultFuchsiaResourceDialect,
5152 >;
5153 fn r#get_codec_local_delay_range(
5154 &self,
5155 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5156 ) -> Self::GetCodecLocalDelayRangeResponseFut {
5157 fn _decode(
5158 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5159 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5160 let _response = fidl::client::decode_transaction_body::<
5161 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5162 fidl::encoding::DefaultFuchsiaResourceDialect,
5163 0x1cf34fdeed80b4d,
5164 >(_buf?)?;
5165 Ok(_response.map(|x| x))
5166 }
5167 self.client.send_query_and_decode::<
5168 CodecDelayGetCodecLocalDelayRangeRequest,
5169 CodecDelayGetCodecLocalDelayRangeResult,
5170 >(
5171 payload,
5172 0x1cf34fdeed80b4d,
5173 fidl::encoding::DynamicFlags::empty(),
5174 _decode,
5175 )
5176 }
5177}
5178
5179pub struct CodecDelayEventStream {
5180 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5181}
5182
5183impl std::marker::Unpin for CodecDelayEventStream {}
5184
5185impl futures::stream::FusedStream for CodecDelayEventStream {
5186 fn is_terminated(&self) -> bool {
5187 self.event_receiver.is_terminated()
5188 }
5189}
5190
5191impl futures::Stream for CodecDelayEventStream {
5192 type Item = Result<CodecDelayEvent, fidl::Error>;
5193
5194 fn poll_next(
5195 mut self: std::pin::Pin<&mut Self>,
5196 cx: &mut std::task::Context<'_>,
5197 ) -> std::task::Poll<Option<Self::Item>> {
5198 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5199 &mut self.event_receiver,
5200 cx
5201 )?) {
5202 Some(buf) => std::task::Poll::Ready(Some(CodecDelayEvent::decode(buf))),
5203 None => std::task::Poll::Ready(None),
5204 }
5205 }
5206}
5207
5208#[derive(Debug)]
5209pub enum CodecDelayEvent {}
5210
5211impl CodecDelayEvent {
5212 fn decode(
5214 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5215 ) -> Result<CodecDelayEvent, fidl::Error> {
5216 let (bytes, _handles) = buf.split_mut();
5217 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5218 debug_assert_eq!(tx_header.tx_id, 0);
5219 match tx_header.ordinal {
5220 _ => Err(fidl::Error::UnknownOrdinal {
5221 ordinal: tx_header.ordinal,
5222 protocol_name: <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5223 }),
5224 }
5225 }
5226}
5227
5228pub struct CodecDelayRequestStream {
5230 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5231 is_terminated: bool,
5232}
5233
5234impl std::marker::Unpin for CodecDelayRequestStream {}
5235
5236impl futures::stream::FusedStream for CodecDelayRequestStream {
5237 fn is_terminated(&self) -> bool {
5238 self.is_terminated
5239 }
5240}
5241
5242impl fidl::endpoints::RequestStream for CodecDelayRequestStream {
5243 type Protocol = CodecDelayMarker;
5244 type ControlHandle = CodecDelayControlHandle;
5245
5246 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5247 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5248 }
5249
5250 fn control_handle(&self) -> Self::ControlHandle {
5251 CodecDelayControlHandle { inner: self.inner.clone() }
5252 }
5253
5254 fn into_inner(
5255 self,
5256 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5257 {
5258 (self.inner, self.is_terminated)
5259 }
5260
5261 fn from_inner(
5262 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5263 is_terminated: bool,
5264 ) -> Self {
5265 Self { inner, is_terminated }
5266 }
5267}
5268
5269impl futures::Stream for CodecDelayRequestStream {
5270 type Item = Result<CodecDelayRequest, fidl::Error>;
5271
5272 fn poll_next(
5273 mut self: std::pin::Pin<&mut Self>,
5274 cx: &mut std::task::Context<'_>,
5275 ) -> std::task::Poll<Option<Self::Item>> {
5276 let this = &mut *self;
5277 if this.inner.check_shutdown(cx) {
5278 this.is_terminated = true;
5279 return std::task::Poll::Ready(None);
5280 }
5281 if this.is_terminated {
5282 panic!("polled CodecDelayRequestStream after completion");
5283 }
5284 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5285 |bytes, handles| {
5286 match this.inner.channel().read_etc(cx, bytes, handles) {
5287 std::task::Poll::Ready(Ok(())) => {}
5288 std::task::Poll::Pending => return std::task::Poll::Pending,
5289 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5290 this.is_terminated = true;
5291 return std::task::Poll::Ready(None);
5292 }
5293 std::task::Poll::Ready(Err(e)) => {
5294 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5295 e.into(),
5296 ))));
5297 }
5298 }
5299
5300 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5302
5303 std::task::Poll::Ready(Some(match header.ordinal {
5304 0x1cf34fdeed80b4d => {
5305 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5306 let mut req = fidl::new_empty!(
5307 CodecDelayGetCodecLocalDelayRangeRequest,
5308 fidl::encoding::DefaultFuchsiaResourceDialect
5309 );
5310 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
5311 let control_handle = CodecDelayControlHandle { inner: this.inner.clone() };
5312 Ok(CodecDelayRequest::GetCodecLocalDelayRange {
5313 payload: req,
5314 responder: CodecDelayGetCodecLocalDelayRangeResponder {
5315 control_handle: std::mem::ManuallyDrop::new(control_handle),
5316 tx_id: header.tx_id,
5317 },
5318 })
5319 }
5320 _ => Err(fidl::Error::UnknownOrdinal {
5321 ordinal: header.ordinal,
5322 protocol_name:
5323 <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5324 }),
5325 }))
5326 },
5327 )
5328 }
5329}
5330
5331#[derive(Debug)]
5334pub enum CodecDelayRequest {
5335 GetCodecLocalDelayRange {
5343 payload: CodecDelayGetCodecLocalDelayRangeRequest,
5344 responder: CodecDelayGetCodecLocalDelayRangeResponder,
5345 },
5346}
5347
5348impl CodecDelayRequest {
5349 #[allow(irrefutable_let_patterns)]
5350 pub fn into_get_codec_local_delay_range(
5351 self,
5352 ) -> Option<(
5353 CodecDelayGetCodecLocalDelayRangeRequest,
5354 CodecDelayGetCodecLocalDelayRangeResponder,
5355 )> {
5356 if let CodecDelayRequest::GetCodecLocalDelayRange { payload, responder } = self {
5357 Some((payload, responder))
5358 } else {
5359 None
5360 }
5361 }
5362
5363 pub fn method_name(&self) -> &'static str {
5365 match *self {
5366 CodecDelayRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
5367 }
5368 }
5369}
5370
5371#[derive(Debug, Clone)]
5372pub struct CodecDelayControlHandle {
5373 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5374}
5375
5376impl fidl::endpoints::ControlHandle for CodecDelayControlHandle {
5377 fn shutdown(&self) {
5378 self.inner.shutdown()
5379 }
5380
5381 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5382 self.inner.shutdown_with_epitaph(status)
5383 }
5384
5385 fn is_closed(&self) -> bool {
5386 self.inner.channel().is_closed()
5387 }
5388 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5389 self.inner.channel().on_closed()
5390 }
5391
5392 #[cfg(target_os = "fuchsia")]
5393 fn signal_peer(
5394 &self,
5395 clear_mask: zx::Signals,
5396 set_mask: zx::Signals,
5397 ) -> Result<(), zx_status::Status> {
5398 use fidl::Peered;
5399 self.inner.channel().signal_peer(clear_mask, set_mask)
5400 }
5401}
5402
5403impl CodecDelayControlHandle {}
5404
5405#[must_use = "FIDL methods require a response to be sent"]
5406#[derive(Debug)]
5407pub struct CodecDelayGetCodecLocalDelayRangeResponder {
5408 control_handle: std::mem::ManuallyDrop<CodecDelayControlHandle>,
5409 tx_id: u32,
5410}
5411
5412impl std::ops::Drop for CodecDelayGetCodecLocalDelayRangeResponder {
5416 fn drop(&mut self) {
5417 self.control_handle.shutdown();
5418 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5420 }
5421}
5422
5423impl fidl::endpoints::Responder for CodecDelayGetCodecLocalDelayRangeResponder {
5424 type ControlHandle = CodecDelayControlHandle;
5425
5426 fn control_handle(&self) -> &CodecDelayControlHandle {
5427 &self.control_handle
5428 }
5429
5430 fn drop_without_shutdown(mut self) {
5431 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5433 std::mem::forget(self);
5435 }
5436}
5437
5438impl CodecDelayGetCodecLocalDelayRangeResponder {
5439 pub fn send(
5443 self,
5444 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5445 ) -> Result<(), fidl::Error> {
5446 let _result = self.send_raw(result);
5447 if _result.is_err() {
5448 self.control_handle.shutdown();
5449 }
5450 self.drop_without_shutdown();
5451 _result
5452 }
5453
5454 pub fn send_no_shutdown_on_err(
5456 self,
5457 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5458 ) -> Result<(), fidl::Error> {
5459 let _result = self.send_raw(result);
5460 self.drop_without_shutdown();
5461 _result
5462 }
5463
5464 fn send_raw(
5465 &self,
5466 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5467 ) -> Result<(), fidl::Error> {
5468 self.control_handle.inner.send::<fidl::encoding::ResultType<
5469 CodecDelayGetCodecLocalDelayRangeResponse,
5470 i32,
5471 >>(
5472 result,
5473 self.tx_id,
5474 0x1cf34fdeed80b4d,
5475 fidl::encoding::DynamicFlags::empty(),
5476 )
5477 }
5478}
5479
5480#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5481pub struct ConnectedIsochronousGroupMarker;
5482
5483impl fidl::endpoints::ProtocolMarker for ConnectedIsochronousGroupMarker {
5484 type Proxy = ConnectedIsochronousGroupProxy;
5485 type RequestStream = ConnectedIsochronousGroupRequestStream;
5486 #[cfg(target_os = "fuchsia")]
5487 type SynchronousProxy = ConnectedIsochronousGroupSynchronousProxy;
5488
5489 const DEBUG_NAME: &'static str = "(anonymous) ConnectedIsochronousGroup";
5490}
5491pub type ConnectedIsochronousGroupEstablishStreamsResult = Result<(), EstablishStreamsError>;
5492
5493pub trait ConnectedIsochronousGroupProxyInterface: Send + Sync {
5494 type EstablishStreamsResponseFut: std::future::Future<
5495 Output = Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error>,
5496 > + Send;
5497 fn r#establish_streams(
5498 &self,
5499 payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5500 ) -> Self::EstablishStreamsResponseFut;
5501 fn r#remove(&self) -> Result<(), fidl::Error>;
5502}
5503#[derive(Debug)]
5504#[cfg(target_os = "fuchsia")]
5505pub struct ConnectedIsochronousGroupSynchronousProxy {
5506 client: fidl::client::sync::Client,
5507}
5508
5509#[cfg(target_os = "fuchsia")]
5510impl fidl::endpoints::SynchronousProxy for ConnectedIsochronousGroupSynchronousProxy {
5511 type Proxy = ConnectedIsochronousGroupProxy;
5512 type Protocol = ConnectedIsochronousGroupMarker;
5513
5514 fn from_channel(inner: fidl::Channel) -> Self {
5515 Self::new(inner)
5516 }
5517
5518 fn into_channel(self) -> fidl::Channel {
5519 self.client.into_channel()
5520 }
5521
5522 fn as_channel(&self) -> &fidl::Channel {
5523 self.client.as_channel()
5524 }
5525}
5526
5527#[cfg(target_os = "fuchsia")]
5528impl ConnectedIsochronousGroupSynchronousProxy {
5529 pub fn new(channel: fidl::Channel) -> Self {
5530 Self { client: fidl::client::sync::Client::new(channel) }
5531 }
5532
5533 pub fn into_channel(self) -> fidl::Channel {
5534 self.client.into_channel()
5535 }
5536
5537 pub fn wait_for_event(
5540 &self,
5541 deadline: zx::MonotonicInstant,
5542 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
5543 ConnectedIsochronousGroupEvent::decode(
5544 self.client.wait_for_event::<ConnectedIsochronousGroupMarker>(deadline)?,
5545 )
5546 }
5547
5548 pub fn r#establish_streams(
5557 &self,
5558 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5559 ___deadline: zx::MonotonicInstant,
5560 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
5561 let _response = self.client.send_query::<
5562 ConnectedIsochronousGroupEstablishStreamsRequest,
5563 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EstablishStreamsError>,
5564 ConnectedIsochronousGroupMarker,
5565 >(
5566 payload,
5567 0xc7296c5edb4dacc,
5568 fidl::encoding::DynamicFlags::FLEXIBLE,
5569 ___deadline,
5570 )?
5571 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
5572 Ok(_response.map(|x| x))
5573 }
5574
5575 pub fn r#remove(&self) -> Result<(), fidl::Error> {
5578 self.client.send::<fidl::encoding::EmptyPayload>(
5579 (),
5580 0xbed433babd20503,
5581 fidl::encoding::DynamicFlags::FLEXIBLE,
5582 )
5583 }
5584}
5585
5586#[cfg(target_os = "fuchsia")]
5587impl From<ConnectedIsochronousGroupSynchronousProxy> for zx::NullableHandle {
5588 fn from(value: ConnectedIsochronousGroupSynchronousProxy) -> Self {
5589 value.into_channel().into()
5590 }
5591}
5592
5593#[cfg(target_os = "fuchsia")]
5594impl From<fidl::Channel> for ConnectedIsochronousGroupSynchronousProxy {
5595 fn from(value: fidl::Channel) -> Self {
5596 Self::new(value)
5597 }
5598}
5599
5600#[cfg(target_os = "fuchsia")]
5601impl fidl::endpoints::FromClient for ConnectedIsochronousGroupSynchronousProxy {
5602 type Protocol = ConnectedIsochronousGroupMarker;
5603
5604 fn from_client(value: fidl::endpoints::ClientEnd<ConnectedIsochronousGroupMarker>) -> Self {
5605 Self::new(value.into_channel())
5606 }
5607}
5608
5609#[derive(Debug, Clone)]
5610pub struct ConnectedIsochronousGroupProxy {
5611 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5612}
5613
5614impl fidl::endpoints::Proxy for ConnectedIsochronousGroupProxy {
5615 type Protocol = ConnectedIsochronousGroupMarker;
5616
5617 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5618 Self::new(inner)
5619 }
5620
5621 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5622 self.client.into_channel().map_err(|client| Self { client })
5623 }
5624
5625 fn as_channel(&self) -> &::fidl::AsyncChannel {
5626 self.client.as_channel()
5627 }
5628}
5629
5630impl ConnectedIsochronousGroupProxy {
5631 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5633 let protocol_name =
5634 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5635 Self { client: fidl::client::Client::new(channel, protocol_name) }
5636 }
5637
5638 pub fn take_event_stream(&self) -> ConnectedIsochronousGroupEventStream {
5644 ConnectedIsochronousGroupEventStream { event_receiver: self.client.take_event_receiver() }
5645 }
5646
5647 pub fn r#establish_streams(
5656 &self,
5657 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5658 ) -> fidl::client::QueryResponseFut<
5659 ConnectedIsochronousGroupEstablishStreamsResult,
5660 fidl::encoding::DefaultFuchsiaResourceDialect,
5661 > {
5662 ConnectedIsochronousGroupProxyInterface::r#establish_streams(self, payload)
5663 }
5664
5665 pub fn r#remove(&self) -> Result<(), fidl::Error> {
5668 ConnectedIsochronousGroupProxyInterface::r#remove(self)
5669 }
5670}
5671
5672impl ConnectedIsochronousGroupProxyInterface for ConnectedIsochronousGroupProxy {
5673 type EstablishStreamsResponseFut = fidl::client::QueryResponseFut<
5674 ConnectedIsochronousGroupEstablishStreamsResult,
5675 fidl::encoding::DefaultFuchsiaResourceDialect,
5676 >;
5677 fn r#establish_streams(
5678 &self,
5679 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5680 ) -> Self::EstablishStreamsResponseFut {
5681 fn _decode(
5682 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5683 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
5684 let _response = fidl::client::decode_transaction_body::<
5685 fidl::encoding::FlexibleResultType<
5686 fidl::encoding::EmptyStruct,
5687 EstablishStreamsError,
5688 >,
5689 fidl::encoding::DefaultFuchsiaResourceDialect,
5690 0xc7296c5edb4dacc,
5691 >(_buf?)?
5692 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
5693 Ok(_response.map(|x| x))
5694 }
5695 self.client.send_query_and_decode::<
5696 ConnectedIsochronousGroupEstablishStreamsRequest,
5697 ConnectedIsochronousGroupEstablishStreamsResult,
5698 >(
5699 payload,
5700 0xc7296c5edb4dacc,
5701 fidl::encoding::DynamicFlags::FLEXIBLE,
5702 _decode,
5703 )
5704 }
5705
5706 fn r#remove(&self) -> Result<(), fidl::Error> {
5707 self.client.send::<fidl::encoding::EmptyPayload>(
5708 (),
5709 0xbed433babd20503,
5710 fidl::encoding::DynamicFlags::FLEXIBLE,
5711 )
5712 }
5713}
5714
5715pub struct ConnectedIsochronousGroupEventStream {
5716 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5717}
5718
5719impl std::marker::Unpin for ConnectedIsochronousGroupEventStream {}
5720
5721impl futures::stream::FusedStream for ConnectedIsochronousGroupEventStream {
5722 fn is_terminated(&self) -> bool {
5723 self.event_receiver.is_terminated()
5724 }
5725}
5726
5727impl futures::Stream for ConnectedIsochronousGroupEventStream {
5728 type Item = Result<ConnectedIsochronousGroupEvent, fidl::Error>;
5729
5730 fn poll_next(
5731 mut self: std::pin::Pin<&mut Self>,
5732 cx: &mut std::task::Context<'_>,
5733 ) -> std::task::Poll<Option<Self::Item>> {
5734 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5735 &mut self.event_receiver,
5736 cx
5737 )?) {
5738 Some(buf) => std::task::Poll::Ready(Some(ConnectedIsochronousGroupEvent::decode(buf))),
5739 None => std::task::Poll::Ready(None),
5740 }
5741 }
5742}
5743
5744#[derive(Debug)]
5745pub enum ConnectedIsochronousGroupEvent {
5746 #[non_exhaustive]
5747 _UnknownEvent {
5748 ordinal: u64,
5750 },
5751}
5752
5753impl ConnectedIsochronousGroupEvent {
5754 fn decode(
5756 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5757 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
5758 let (bytes, _handles) = buf.split_mut();
5759 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5760 debug_assert_eq!(tx_header.tx_id, 0);
5761 match tx_header.ordinal {
5762 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5763 Ok(ConnectedIsochronousGroupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5764 }
5765 _ => Err(fidl::Error::UnknownOrdinal {
5766 ordinal: tx_header.ordinal,
5767 protocol_name:
5768 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5769 }),
5770 }
5771 }
5772}
5773
5774pub struct ConnectedIsochronousGroupRequestStream {
5776 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5777 is_terminated: bool,
5778}
5779
5780impl std::marker::Unpin for ConnectedIsochronousGroupRequestStream {}
5781
5782impl futures::stream::FusedStream for ConnectedIsochronousGroupRequestStream {
5783 fn is_terminated(&self) -> bool {
5784 self.is_terminated
5785 }
5786}
5787
5788impl fidl::endpoints::RequestStream for ConnectedIsochronousGroupRequestStream {
5789 type Protocol = ConnectedIsochronousGroupMarker;
5790 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5791
5792 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5793 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5794 }
5795
5796 fn control_handle(&self) -> Self::ControlHandle {
5797 ConnectedIsochronousGroupControlHandle { inner: self.inner.clone() }
5798 }
5799
5800 fn into_inner(
5801 self,
5802 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5803 {
5804 (self.inner, self.is_terminated)
5805 }
5806
5807 fn from_inner(
5808 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5809 is_terminated: bool,
5810 ) -> Self {
5811 Self { inner, is_terminated }
5812 }
5813}
5814
5815impl futures::Stream for ConnectedIsochronousGroupRequestStream {
5816 type Item = Result<ConnectedIsochronousGroupRequest, fidl::Error>;
5817
5818 fn poll_next(
5819 mut self: std::pin::Pin<&mut Self>,
5820 cx: &mut std::task::Context<'_>,
5821 ) -> std::task::Poll<Option<Self::Item>> {
5822 let this = &mut *self;
5823 if this.inner.check_shutdown(cx) {
5824 this.is_terminated = true;
5825 return std::task::Poll::Ready(None);
5826 }
5827 if this.is_terminated {
5828 panic!("polled ConnectedIsochronousGroupRequestStream after completion");
5829 }
5830 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5831 |bytes, handles| {
5832 match this.inner.channel().read_etc(cx, bytes, handles) {
5833 std::task::Poll::Ready(Ok(())) => {}
5834 std::task::Poll::Pending => return std::task::Poll::Pending,
5835 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5836 this.is_terminated = true;
5837 return std::task::Poll::Ready(None);
5838 }
5839 std::task::Poll::Ready(Err(e)) => {
5840 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5841 e.into(),
5842 ))));
5843 }
5844 }
5845
5846 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5848
5849 std::task::Poll::Ready(Some(match header.ordinal {
5850 0xc7296c5edb4dacc => {
5851 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5852 let mut req = fidl::new_empty!(ConnectedIsochronousGroupEstablishStreamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5853 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectedIsochronousGroupEstablishStreamsRequest>(&header, _body_bytes, handles, &mut req)?;
5854 let control_handle = ConnectedIsochronousGroupControlHandle {
5855 inner: this.inner.clone(),
5856 };
5857 Ok(ConnectedIsochronousGroupRequest::EstablishStreams {payload: req,
5858 responder: ConnectedIsochronousGroupEstablishStreamsResponder {
5859 control_handle: std::mem::ManuallyDrop::new(control_handle),
5860 tx_id: header.tx_id,
5861 },
5862 })
5863 }
5864 0xbed433babd20503 => {
5865 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5866 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5867 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5868 let control_handle = ConnectedIsochronousGroupControlHandle {
5869 inner: this.inner.clone(),
5870 };
5871 Ok(ConnectedIsochronousGroupRequest::Remove {
5872 control_handle,
5873 })
5874 }
5875 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5876 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5877 ordinal: header.ordinal,
5878 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5879 method_type: fidl::MethodType::OneWay,
5880 })
5881 }
5882 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5883 this.inner.send_framework_err(
5884 fidl::encoding::FrameworkErr::UnknownMethod,
5885 header.tx_id,
5886 header.ordinal,
5887 header.dynamic_flags(),
5888 (bytes, handles),
5889 )?;
5890 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5891 ordinal: header.ordinal,
5892 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5893 method_type: fidl::MethodType::TwoWay,
5894 })
5895 }
5896 _ => Err(fidl::Error::UnknownOrdinal {
5897 ordinal: header.ordinal,
5898 protocol_name: <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5899 }),
5900 }))
5901 },
5902 )
5903 }
5904}
5905
5906#[derive(Debug)]
5907pub enum ConnectedIsochronousGroupRequest {
5908 EstablishStreams {
5917 payload: ConnectedIsochronousGroupEstablishStreamsRequest,
5918 responder: ConnectedIsochronousGroupEstablishStreamsResponder,
5919 },
5920 Remove { control_handle: ConnectedIsochronousGroupControlHandle },
5923 #[non_exhaustive]
5925 _UnknownMethod {
5926 ordinal: u64,
5928 control_handle: ConnectedIsochronousGroupControlHandle,
5929 method_type: fidl::MethodType,
5930 },
5931}
5932
5933impl ConnectedIsochronousGroupRequest {
5934 #[allow(irrefutable_let_patterns)]
5935 pub fn into_establish_streams(
5936 self,
5937 ) -> Option<(
5938 ConnectedIsochronousGroupEstablishStreamsRequest,
5939 ConnectedIsochronousGroupEstablishStreamsResponder,
5940 )> {
5941 if let ConnectedIsochronousGroupRequest::EstablishStreams { payload, responder } = self {
5942 Some((payload, responder))
5943 } else {
5944 None
5945 }
5946 }
5947
5948 #[allow(irrefutable_let_patterns)]
5949 pub fn into_remove(self) -> Option<(ConnectedIsochronousGroupControlHandle)> {
5950 if let ConnectedIsochronousGroupRequest::Remove { control_handle } = self {
5951 Some((control_handle))
5952 } else {
5953 None
5954 }
5955 }
5956
5957 pub fn method_name(&self) -> &'static str {
5959 match *self {
5960 ConnectedIsochronousGroupRequest::EstablishStreams { .. } => "establish_streams",
5961 ConnectedIsochronousGroupRequest::Remove { .. } => "remove",
5962 ConnectedIsochronousGroupRequest::_UnknownMethod {
5963 method_type: fidl::MethodType::OneWay,
5964 ..
5965 } => "unknown one-way method",
5966 ConnectedIsochronousGroupRequest::_UnknownMethod {
5967 method_type: fidl::MethodType::TwoWay,
5968 ..
5969 } => "unknown two-way method",
5970 }
5971 }
5972}
5973
5974#[derive(Debug, Clone)]
5975pub struct ConnectedIsochronousGroupControlHandle {
5976 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5977}
5978
5979impl fidl::endpoints::ControlHandle for ConnectedIsochronousGroupControlHandle {
5980 fn shutdown(&self) {
5981 self.inner.shutdown()
5982 }
5983
5984 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5985 self.inner.shutdown_with_epitaph(status)
5986 }
5987
5988 fn is_closed(&self) -> bool {
5989 self.inner.channel().is_closed()
5990 }
5991 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5992 self.inner.channel().on_closed()
5993 }
5994
5995 #[cfg(target_os = "fuchsia")]
5996 fn signal_peer(
5997 &self,
5998 clear_mask: zx::Signals,
5999 set_mask: zx::Signals,
6000 ) -> Result<(), zx_status::Status> {
6001 use fidl::Peered;
6002 self.inner.channel().signal_peer(clear_mask, set_mask)
6003 }
6004}
6005
6006impl ConnectedIsochronousGroupControlHandle {}
6007
6008#[must_use = "FIDL methods require a response to be sent"]
6009#[derive(Debug)]
6010pub struct ConnectedIsochronousGroupEstablishStreamsResponder {
6011 control_handle: std::mem::ManuallyDrop<ConnectedIsochronousGroupControlHandle>,
6012 tx_id: u32,
6013}
6014
6015impl std::ops::Drop for ConnectedIsochronousGroupEstablishStreamsResponder {
6019 fn drop(&mut self) {
6020 self.control_handle.shutdown();
6021 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6023 }
6024}
6025
6026impl fidl::endpoints::Responder for ConnectedIsochronousGroupEstablishStreamsResponder {
6027 type ControlHandle = ConnectedIsochronousGroupControlHandle;
6028
6029 fn control_handle(&self) -> &ConnectedIsochronousGroupControlHandle {
6030 &self.control_handle
6031 }
6032
6033 fn drop_without_shutdown(mut self) {
6034 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6036 std::mem::forget(self);
6038 }
6039}
6040
6041impl ConnectedIsochronousGroupEstablishStreamsResponder {
6042 pub fn send(self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
6046 let _result = self.send_raw(result);
6047 if _result.is_err() {
6048 self.control_handle.shutdown();
6049 }
6050 self.drop_without_shutdown();
6051 _result
6052 }
6053
6054 pub fn send_no_shutdown_on_err(
6056 self,
6057 mut result: Result<(), EstablishStreamsError>,
6058 ) -> Result<(), fidl::Error> {
6059 let _result = self.send_raw(result);
6060 self.drop_without_shutdown();
6061 _result
6062 }
6063
6064 fn send_raw(&self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
6065 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6066 fidl::encoding::EmptyStruct,
6067 EstablishStreamsError,
6068 >>(
6069 fidl::encoding::FlexibleResult::new(result),
6070 self.tx_id,
6071 0xc7296c5edb4dacc,
6072 fidl::encoding::DynamicFlags::FLEXIBLE,
6073 )
6074 }
6075}
6076
6077#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6078pub struct ConnectionMarker;
6079
6080impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
6081 type Proxy = ConnectionProxy;
6082 type RequestStream = ConnectionRequestStream;
6083 #[cfg(target_os = "fuchsia")]
6084 type SynchronousProxy = ConnectionSynchronousProxy;
6085
6086 const DEBUG_NAME: &'static str = "(anonymous) Connection";
6087}
6088pub type ConnectionTransferPeriodicAdvertisingSyncResult =
6089 Result<(), PeriodicAdvertisingSyncTransferError>;
6090pub type ConnectionAcceptPeriodicAdvertisingSyncTransferResult =
6091 Result<(), PeriodicAdvertisingSyncTransferError>;
6092
6093pub trait ConnectionProxyInterface: Send + Sync {
6094 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
6095 + Send;
6096 fn r#get_codec_local_delay_range(
6097 &self,
6098 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6099 ) -> Self::GetCodecLocalDelayRangeResponseFut;
6100 fn r#request_gatt_client(
6101 &self,
6102 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6103 ) -> Result<(), fidl::Error>;
6104 fn r#accept_cis(&self, payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error>;
6105 fn r#connect_l2cap(&self, payload: ConnectionConnectL2capRequest) -> Result<(), fidl::Error>;
6106 type TransferPeriodicAdvertisingSyncResponseFut: std::future::Future<
6107 Output = Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error>,
6108 > + Send;
6109 fn r#transfer_periodic_advertising_sync(
6110 &self,
6111 payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6112 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut;
6113 type AcceptPeriodicAdvertisingSyncTransferResponseFut: std::future::Future<
6114 Output = Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error>,
6115 > + Send;
6116 fn r#accept_periodic_advertising_sync_transfer(
6117 &self,
6118 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6119 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut;
6120}
6121#[derive(Debug)]
6122#[cfg(target_os = "fuchsia")]
6123pub struct ConnectionSynchronousProxy {
6124 client: fidl::client::sync::Client,
6125}
6126
6127#[cfg(target_os = "fuchsia")]
6128impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
6129 type Proxy = ConnectionProxy;
6130 type Protocol = ConnectionMarker;
6131
6132 fn from_channel(inner: fidl::Channel) -> Self {
6133 Self::new(inner)
6134 }
6135
6136 fn into_channel(self) -> fidl::Channel {
6137 self.client.into_channel()
6138 }
6139
6140 fn as_channel(&self) -> &fidl::Channel {
6141 self.client.as_channel()
6142 }
6143}
6144
6145#[cfg(target_os = "fuchsia")]
6146impl ConnectionSynchronousProxy {
6147 pub fn new(channel: fidl::Channel) -> Self {
6148 Self { client: fidl::client::sync::Client::new(channel) }
6149 }
6150
6151 pub fn into_channel(self) -> fidl::Channel {
6152 self.client.into_channel()
6153 }
6154
6155 pub fn wait_for_event(
6158 &self,
6159 deadline: zx::MonotonicInstant,
6160 ) -> Result<ConnectionEvent, fidl::Error> {
6161 ConnectionEvent::decode(self.client.wait_for_event::<ConnectionMarker>(deadline)?)
6162 }
6163
6164 pub fn r#get_codec_local_delay_range(
6172 &self,
6173 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6174 ___deadline: zx::MonotonicInstant,
6175 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
6176 let _response = self.client.send_query::<
6177 CodecDelayGetCodecLocalDelayRangeRequest,
6178 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6179 ConnectionMarker,
6180 >(
6181 payload,
6182 0x1cf34fdeed80b4d,
6183 fidl::encoding::DynamicFlags::empty(),
6184 ___deadline,
6185 )?;
6186 Ok(_response.map(|x| x))
6187 }
6188
6189 pub fn r#request_gatt_client(
6193 &self,
6194 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6195 ) -> Result<(), fidl::Error> {
6196 self.client.send::<ConnectionRequestGattClientRequest>(
6197 (client,),
6198 0x2a670e0fec6ccc6b,
6199 fidl::encoding::DynamicFlags::empty(),
6200 )
6201 }
6202
6203 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6218 self.client.send::<ConnectionAcceptCisRequest>(
6219 &mut payload,
6220 0x7e6338c237088144,
6221 fidl::encoding::DynamicFlags::empty(),
6222 )
6223 }
6224
6225 pub fn r#connect_l2cap(
6227 &self,
6228 mut payload: ConnectionConnectL2capRequest,
6229 ) -> Result<(), fidl::Error> {
6230 self.client.send::<ConnectionConnectL2capRequest>(
6231 &mut payload,
6232 0x12351316feaebce9,
6233 fidl::encoding::DynamicFlags::empty(),
6234 )
6235 }
6236
6237 pub fn r#transfer_periodic_advertising_sync(
6240 &self,
6241 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6242 ___deadline: zx::MonotonicInstant,
6243 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
6244 let _response = self.client.send_query::<
6245 ConnectionTransferPeriodicAdvertisingSyncRequest,
6246 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
6247 ConnectionMarker,
6248 >(
6249 payload,
6250 0x1117a10b5ba1e219,
6251 fidl::encoding::DynamicFlags::empty(),
6252 ___deadline,
6253 )?;
6254 Ok(_response.map(|x| x))
6255 }
6256
6257 pub fn r#accept_periodic_advertising_sync_transfer(
6260 &self,
6261 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6262 ___deadline: zx::MonotonicInstant,
6263 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
6264 let _response = self.client.send_query::<
6265 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6266 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
6267 ConnectionMarker,
6268 >(
6269 &mut payload,
6270 0x441a31a7effa7e2b,
6271 fidl::encoding::DynamicFlags::empty(),
6272 ___deadline,
6273 )?;
6274 Ok(_response.map(|x| x))
6275 }
6276}
6277
6278#[cfg(target_os = "fuchsia")]
6279impl From<ConnectionSynchronousProxy> for zx::NullableHandle {
6280 fn from(value: ConnectionSynchronousProxy) -> Self {
6281 value.into_channel().into()
6282 }
6283}
6284
6285#[cfg(target_os = "fuchsia")]
6286impl From<fidl::Channel> for ConnectionSynchronousProxy {
6287 fn from(value: fidl::Channel) -> Self {
6288 Self::new(value)
6289 }
6290}
6291
6292#[cfg(target_os = "fuchsia")]
6293impl fidl::endpoints::FromClient for ConnectionSynchronousProxy {
6294 type Protocol = ConnectionMarker;
6295
6296 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionMarker>) -> Self {
6297 Self::new(value.into_channel())
6298 }
6299}
6300
6301#[derive(Debug, Clone)]
6302pub struct ConnectionProxy {
6303 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6304}
6305
6306impl fidl::endpoints::Proxy for ConnectionProxy {
6307 type Protocol = ConnectionMarker;
6308
6309 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6310 Self::new(inner)
6311 }
6312
6313 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6314 self.client.into_channel().map_err(|client| Self { client })
6315 }
6316
6317 fn as_channel(&self) -> &::fidl::AsyncChannel {
6318 self.client.as_channel()
6319 }
6320}
6321
6322impl ConnectionProxy {
6323 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6325 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6326 Self { client: fidl::client::Client::new(channel, protocol_name) }
6327 }
6328
6329 pub fn take_event_stream(&self) -> ConnectionEventStream {
6335 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
6336 }
6337
6338 pub fn r#get_codec_local_delay_range(
6346 &self,
6347 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6348 ) -> fidl::client::QueryResponseFut<
6349 CodecDelayGetCodecLocalDelayRangeResult,
6350 fidl::encoding::DefaultFuchsiaResourceDialect,
6351 > {
6352 ConnectionProxyInterface::r#get_codec_local_delay_range(self, payload)
6353 }
6354
6355 pub fn r#request_gatt_client(
6359 &self,
6360 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6361 ) -> Result<(), fidl::Error> {
6362 ConnectionProxyInterface::r#request_gatt_client(self, client)
6363 }
6364
6365 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6380 ConnectionProxyInterface::r#accept_cis(self, payload)
6381 }
6382
6383 pub fn r#connect_l2cap(
6385 &self,
6386 mut payload: ConnectionConnectL2capRequest,
6387 ) -> Result<(), fidl::Error> {
6388 ConnectionProxyInterface::r#connect_l2cap(self, payload)
6389 }
6390
6391 pub fn r#transfer_periodic_advertising_sync(
6394 &self,
6395 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6396 ) -> fidl::client::QueryResponseFut<
6397 ConnectionTransferPeriodicAdvertisingSyncResult,
6398 fidl::encoding::DefaultFuchsiaResourceDialect,
6399 > {
6400 ConnectionProxyInterface::r#transfer_periodic_advertising_sync(self, payload)
6401 }
6402
6403 pub fn r#accept_periodic_advertising_sync_transfer(
6406 &self,
6407 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6408 ) -> fidl::client::QueryResponseFut<
6409 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6410 fidl::encoding::DefaultFuchsiaResourceDialect,
6411 > {
6412 ConnectionProxyInterface::r#accept_periodic_advertising_sync_transfer(self, payload)
6413 }
6414}
6415
6416impl ConnectionProxyInterface for ConnectionProxy {
6417 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
6418 CodecDelayGetCodecLocalDelayRangeResult,
6419 fidl::encoding::DefaultFuchsiaResourceDialect,
6420 >;
6421 fn r#get_codec_local_delay_range(
6422 &self,
6423 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6424 ) -> Self::GetCodecLocalDelayRangeResponseFut {
6425 fn _decode(
6426 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6427 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
6428 let _response = fidl::client::decode_transaction_body::<
6429 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6430 fidl::encoding::DefaultFuchsiaResourceDialect,
6431 0x1cf34fdeed80b4d,
6432 >(_buf?)?;
6433 Ok(_response.map(|x| x))
6434 }
6435 self.client.send_query_and_decode::<
6436 CodecDelayGetCodecLocalDelayRangeRequest,
6437 CodecDelayGetCodecLocalDelayRangeResult,
6438 >(
6439 payload,
6440 0x1cf34fdeed80b4d,
6441 fidl::encoding::DynamicFlags::empty(),
6442 _decode,
6443 )
6444 }
6445
6446 fn r#request_gatt_client(
6447 &self,
6448 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6449 ) -> Result<(), fidl::Error> {
6450 self.client.send::<ConnectionRequestGattClientRequest>(
6451 (client,),
6452 0x2a670e0fec6ccc6b,
6453 fidl::encoding::DynamicFlags::empty(),
6454 )
6455 }
6456
6457 fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6458 self.client.send::<ConnectionAcceptCisRequest>(
6459 &mut payload,
6460 0x7e6338c237088144,
6461 fidl::encoding::DynamicFlags::empty(),
6462 )
6463 }
6464
6465 fn r#connect_l2cap(
6466 &self,
6467 mut payload: ConnectionConnectL2capRequest,
6468 ) -> Result<(), fidl::Error> {
6469 self.client.send::<ConnectionConnectL2capRequest>(
6470 &mut payload,
6471 0x12351316feaebce9,
6472 fidl::encoding::DynamicFlags::empty(),
6473 )
6474 }
6475
6476 type TransferPeriodicAdvertisingSyncResponseFut = fidl::client::QueryResponseFut<
6477 ConnectionTransferPeriodicAdvertisingSyncResult,
6478 fidl::encoding::DefaultFuchsiaResourceDialect,
6479 >;
6480 fn r#transfer_periodic_advertising_sync(
6481 &self,
6482 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6483 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut {
6484 fn _decode(
6485 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6486 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
6487 let _response = fidl::client::decode_transaction_body::<
6488 fidl::encoding::ResultType<
6489 fidl::encoding::EmptyStruct,
6490 PeriodicAdvertisingSyncTransferError,
6491 >,
6492 fidl::encoding::DefaultFuchsiaResourceDialect,
6493 0x1117a10b5ba1e219,
6494 >(_buf?)?;
6495 Ok(_response.map(|x| x))
6496 }
6497 self.client.send_query_and_decode::<
6498 ConnectionTransferPeriodicAdvertisingSyncRequest,
6499 ConnectionTransferPeriodicAdvertisingSyncResult,
6500 >(
6501 payload,
6502 0x1117a10b5ba1e219,
6503 fidl::encoding::DynamicFlags::empty(),
6504 _decode,
6505 )
6506 }
6507
6508 type AcceptPeriodicAdvertisingSyncTransferResponseFut = fidl::client::QueryResponseFut<
6509 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6510 fidl::encoding::DefaultFuchsiaResourceDialect,
6511 >;
6512 fn r#accept_periodic_advertising_sync_transfer(
6513 &self,
6514 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6515 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut {
6516 fn _decode(
6517 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6518 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
6519 let _response = fidl::client::decode_transaction_body::<
6520 fidl::encoding::ResultType<
6521 fidl::encoding::EmptyStruct,
6522 PeriodicAdvertisingSyncTransferError,
6523 >,
6524 fidl::encoding::DefaultFuchsiaResourceDialect,
6525 0x441a31a7effa7e2b,
6526 >(_buf?)?;
6527 Ok(_response.map(|x| x))
6528 }
6529 self.client.send_query_and_decode::<
6530 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6531 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6532 >(
6533 &mut payload,
6534 0x441a31a7effa7e2b,
6535 fidl::encoding::DynamicFlags::empty(),
6536 _decode,
6537 )
6538 }
6539}
6540
6541pub struct ConnectionEventStream {
6542 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6543}
6544
6545impl std::marker::Unpin for ConnectionEventStream {}
6546
6547impl futures::stream::FusedStream for ConnectionEventStream {
6548 fn is_terminated(&self) -> bool {
6549 self.event_receiver.is_terminated()
6550 }
6551}
6552
6553impl futures::Stream for ConnectionEventStream {
6554 type Item = Result<ConnectionEvent, fidl::Error>;
6555
6556 fn poll_next(
6557 mut self: std::pin::Pin<&mut Self>,
6558 cx: &mut std::task::Context<'_>,
6559 ) -> std::task::Poll<Option<Self::Item>> {
6560 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6561 &mut self.event_receiver,
6562 cx
6563 )?) {
6564 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
6565 None => std::task::Poll::Ready(None),
6566 }
6567 }
6568}
6569
6570#[derive(Debug)]
6571pub enum ConnectionEvent {}
6572
6573impl ConnectionEvent {
6574 fn decode(
6576 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6577 ) -> Result<ConnectionEvent, fidl::Error> {
6578 let (bytes, _handles) = buf.split_mut();
6579 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6580 debug_assert_eq!(tx_header.tx_id, 0);
6581 match tx_header.ordinal {
6582 _ => Err(fidl::Error::UnknownOrdinal {
6583 ordinal: tx_header.ordinal,
6584 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6585 }),
6586 }
6587 }
6588}
6589
6590pub struct ConnectionRequestStream {
6592 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6593 is_terminated: bool,
6594}
6595
6596impl std::marker::Unpin for ConnectionRequestStream {}
6597
6598impl futures::stream::FusedStream for ConnectionRequestStream {
6599 fn is_terminated(&self) -> bool {
6600 self.is_terminated
6601 }
6602}
6603
6604impl fidl::endpoints::RequestStream for ConnectionRequestStream {
6605 type Protocol = ConnectionMarker;
6606 type ControlHandle = ConnectionControlHandle;
6607
6608 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6609 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6610 }
6611
6612 fn control_handle(&self) -> Self::ControlHandle {
6613 ConnectionControlHandle { inner: self.inner.clone() }
6614 }
6615
6616 fn into_inner(
6617 self,
6618 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6619 {
6620 (self.inner, self.is_terminated)
6621 }
6622
6623 fn from_inner(
6624 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6625 is_terminated: bool,
6626 ) -> Self {
6627 Self { inner, is_terminated }
6628 }
6629}
6630
6631impl futures::Stream for ConnectionRequestStream {
6632 type Item = Result<ConnectionRequest, fidl::Error>;
6633
6634 fn poll_next(
6635 mut self: std::pin::Pin<&mut Self>,
6636 cx: &mut std::task::Context<'_>,
6637 ) -> std::task::Poll<Option<Self::Item>> {
6638 let this = &mut *self;
6639 if this.inner.check_shutdown(cx) {
6640 this.is_terminated = true;
6641 return std::task::Poll::Ready(None);
6642 }
6643 if this.is_terminated {
6644 panic!("polled ConnectionRequestStream after completion");
6645 }
6646 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6647 |bytes, handles| {
6648 match this.inner.channel().read_etc(cx, bytes, handles) {
6649 std::task::Poll::Ready(Ok(())) => {}
6650 std::task::Poll::Pending => return std::task::Poll::Pending,
6651 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6652 this.is_terminated = true;
6653 return std::task::Poll::Ready(None);
6654 }
6655 std::task::Poll::Ready(Err(e)) => {
6656 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6657 e.into(),
6658 ))));
6659 }
6660 }
6661
6662 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6664
6665 std::task::Poll::Ready(Some(match header.ordinal {
6666 0x1cf34fdeed80b4d => {
6667 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6668 let mut req = fidl::new_empty!(
6669 CodecDelayGetCodecLocalDelayRangeRequest,
6670 fidl::encoding::DefaultFuchsiaResourceDialect
6671 );
6672 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
6673 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6674 Ok(ConnectionRequest::GetCodecLocalDelayRange {
6675 payload: req,
6676 responder: ConnectionGetCodecLocalDelayRangeResponder {
6677 control_handle: std::mem::ManuallyDrop::new(control_handle),
6678 tx_id: header.tx_id,
6679 },
6680 })
6681 }
6682 0x2a670e0fec6ccc6b => {
6683 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6684 let mut req = fidl::new_empty!(
6685 ConnectionRequestGattClientRequest,
6686 fidl::encoding::DefaultFuchsiaResourceDialect
6687 );
6688 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionRequestGattClientRequest>(&header, _body_bytes, handles, &mut req)?;
6689 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6690 Ok(ConnectionRequest::RequestGattClient {
6691 client: req.client,
6692
6693 control_handle,
6694 })
6695 }
6696 0x7e6338c237088144 => {
6697 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6698 let mut req = fidl::new_empty!(
6699 ConnectionAcceptCisRequest,
6700 fidl::encoding::DefaultFuchsiaResourceDialect
6701 );
6702 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptCisRequest>(&header, _body_bytes, handles, &mut req)?;
6703 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6704 Ok(ConnectionRequest::AcceptCis { payload: req, control_handle })
6705 }
6706 0x12351316feaebce9 => {
6707 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6708 let mut req = fidl::new_empty!(
6709 ConnectionConnectL2capRequest,
6710 fidl::encoding::DefaultFuchsiaResourceDialect
6711 );
6712 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionConnectL2capRequest>(&header, _body_bytes, handles, &mut req)?;
6713 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6714 Ok(ConnectionRequest::ConnectL2cap { payload: req, control_handle })
6715 }
6716 0x1117a10b5ba1e219 => {
6717 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6718 let mut req = fidl::new_empty!(
6719 ConnectionTransferPeriodicAdvertisingSyncRequest,
6720 fidl::encoding::DefaultFuchsiaResourceDialect
6721 );
6722 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionTransferPeriodicAdvertisingSyncRequest>(&header, _body_bytes, handles, &mut req)?;
6723 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6724 Ok(ConnectionRequest::TransferPeriodicAdvertisingSync {
6725 payload: req,
6726 responder: ConnectionTransferPeriodicAdvertisingSyncResponder {
6727 control_handle: std::mem::ManuallyDrop::new(control_handle),
6728 tx_id: header.tx_id,
6729 },
6730 })
6731 }
6732 0x441a31a7effa7e2b => {
6733 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6734 let mut req = fidl::new_empty!(
6735 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6736 fidl::encoding::DefaultFuchsiaResourceDialect
6737 );
6738 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(&header, _body_bytes, handles, &mut req)?;
6739 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6740 Ok(ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer {
6741 payload: req,
6742 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6743 control_handle: std::mem::ManuallyDrop::new(control_handle),
6744 tx_id: header.tx_id,
6745 },
6746 })
6747 }
6748 _ => Err(fidl::Error::UnknownOrdinal {
6749 ordinal: header.ordinal,
6750 protocol_name:
6751 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6752 }),
6753 }))
6754 },
6755 )
6756 }
6757}
6758
6759#[derive(Debug)]
6765pub enum ConnectionRequest {
6766 GetCodecLocalDelayRange {
6774 payload: CodecDelayGetCodecLocalDelayRangeRequest,
6775 responder: ConnectionGetCodecLocalDelayRangeResponder,
6776 },
6777 RequestGattClient {
6781 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6782 control_handle: ConnectionControlHandle,
6783 },
6784 AcceptCis { payload: ConnectionAcceptCisRequest, control_handle: ConnectionControlHandle },
6799 ConnectL2cap { payload: ConnectionConnectL2capRequest, control_handle: ConnectionControlHandle },
6801 TransferPeriodicAdvertisingSync {
6804 payload: ConnectionTransferPeriodicAdvertisingSyncRequest,
6805 responder: ConnectionTransferPeriodicAdvertisingSyncResponder,
6806 },
6807 AcceptPeriodicAdvertisingSyncTransfer {
6810 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6811 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6812 },
6813}
6814
6815impl ConnectionRequest {
6816 #[allow(irrefutable_let_patterns)]
6817 pub fn into_get_codec_local_delay_range(
6818 self,
6819 ) -> Option<(
6820 CodecDelayGetCodecLocalDelayRangeRequest,
6821 ConnectionGetCodecLocalDelayRangeResponder,
6822 )> {
6823 if let ConnectionRequest::GetCodecLocalDelayRange { payload, responder } = self {
6824 Some((payload, responder))
6825 } else {
6826 None
6827 }
6828 }
6829
6830 #[allow(irrefutable_let_patterns)]
6831 pub fn into_request_gatt_client(
6832 self,
6833 ) -> Option<(
6834 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6835 ConnectionControlHandle,
6836 )> {
6837 if let ConnectionRequest::RequestGattClient { client, control_handle } = self {
6838 Some((client, control_handle))
6839 } else {
6840 None
6841 }
6842 }
6843
6844 #[allow(irrefutable_let_patterns)]
6845 pub fn into_accept_cis(self) -> Option<(ConnectionAcceptCisRequest, ConnectionControlHandle)> {
6846 if let ConnectionRequest::AcceptCis { payload, control_handle } = self {
6847 Some((payload, control_handle))
6848 } else {
6849 None
6850 }
6851 }
6852
6853 #[allow(irrefutable_let_patterns)]
6854 pub fn into_connect_l2cap(
6855 self,
6856 ) -> Option<(ConnectionConnectL2capRequest, ConnectionControlHandle)> {
6857 if let ConnectionRequest::ConnectL2cap { payload, control_handle } = self {
6858 Some((payload, control_handle))
6859 } else {
6860 None
6861 }
6862 }
6863
6864 #[allow(irrefutable_let_patterns)]
6865 pub fn into_transfer_periodic_advertising_sync(
6866 self,
6867 ) -> Option<(
6868 ConnectionTransferPeriodicAdvertisingSyncRequest,
6869 ConnectionTransferPeriodicAdvertisingSyncResponder,
6870 )> {
6871 if let ConnectionRequest::TransferPeriodicAdvertisingSync { payload, responder } = self {
6872 Some((payload, responder))
6873 } else {
6874 None
6875 }
6876 }
6877
6878 #[allow(irrefutable_let_patterns)]
6879 pub fn into_accept_periodic_advertising_sync_transfer(
6880 self,
6881 ) -> Option<(
6882 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6883 ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6884 )> {
6885 if let ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { payload, responder } =
6886 self
6887 {
6888 Some((payload, responder))
6889 } else {
6890 None
6891 }
6892 }
6893
6894 pub fn method_name(&self) -> &'static str {
6896 match *self {
6897 ConnectionRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
6898 ConnectionRequest::RequestGattClient { .. } => "request_gatt_client",
6899 ConnectionRequest::AcceptCis { .. } => "accept_cis",
6900 ConnectionRequest::ConnectL2cap { .. } => "connect_l2cap",
6901 ConnectionRequest::TransferPeriodicAdvertisingSync { .. } => {
6902 "transfer_periodic_advertising_sync"
6903 }
6904 ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { .. } => {
6905 "accept_periodic_advertising_sync_transfer"
6906 }
6907 }
6908 }
6909}
6910
6911#[derive(Debug, Clone)]
6912pub struct ConnectionControlHandle {
6913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6914}
6915
6916impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
6917 fn shutdown(&self) {
6918 self.inner.shutdown()
6919 }
6920
6921 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6922 self.inner.shutdown_with_epitaph(status)
6923 }
6924
6925 fn is_closed(&self) -> bool {
6926 self.inner.channel().is_closed()
6927 }
6928 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6929 self.inner.channel().on_closed()
6930 }
6931
6932 #[cfg(target_os = "fuchsia")]
6933 fn signal_peer(
6934 &self,
6935 clear_mask: zx::Signals,
6936 set_mask: zx::Signals,
6937 ) -> Result<(), zx_status::Status> {
6938 use fidl::Peered;
6939 self.inner.channel().signal_peer(clear_mask, set_mask)
6940 }
6941}
6942
6943impl ConnectionControlHandle {}
6944
6945#[must_use = "FIDL methods require a response to be sent"]
6946#[derive(Debug)]
6947pub struct ConnectionGetCodecLocalDelayRangeResponder {
6948 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
6949 tx_id: u32,
6950}
6951
6952impl std::ops::Drop for ConnectionGetCodecLocalDelayRangeResponder {
6956 fn drop(&mut self) {
6957 self.control_handle.shutdown();
6958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6960 }
6961}
6962
6963impl fidl::endpoints::Responder for ConnectionGetCodecLocalDelayRangeResponder {
6964 type ControlHandle = ConnectionControlHandle;
6965
6966 fn control_handle(&self) -> &ConnectionControlHandle {
6967 &self.control_handle
6968 }
6969
6970 fn drop_without_shutdown(mut self) {
6971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6973 std::mem::forget(self);
6975 }
6976}
6977
6978impl ConnectionGetCodecLocalDelayRangeResponder {
6979 pub fn send(
6983 self,
6984 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6985 ) -> Result<(), fidl::Error> {
6986 let _result = self.send_raw(result);
6987 if _result.is_err() {
6988 self.control_handle.shutdown();
6989 }
6990 self.drop_without_shutdown();
6991 _result
6992 }
6993
6994 pub fn send_no_shutdown_on_err(
6996 self,
6997 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6998 ) -> Result<(), fidl::Error> {
6999 let _result = self.send_raw(result);
7000 self.drop_without_shutdown();
7001 _result
7002 }
7003
7004 fn send_raw(
7005 &self,
7006 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
7007 ) -> Result<(), fidl::Error> {
7008 self.control_handle.inner.send::<fidl::encoding::ResultType<
7009 CodecDelayGetCodecLocalDelayRangeResponse,
7010 i32,
7011 >>(
7012 result,
7013 self.tx_id,
7014 0x1cf34fdeed80b4d,
7015 fidl::encoding::DynamicFlags::empty(),
7016 )
7017 }
7018}
7019
7020#[must_use = "FIDL methods require a response to be sent"]
7021#[derive(Debug)]
7022pub struct ConnectionTransferPeriodicAdvertisingSyncResponder {
7023 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
7024 tx_id: u32,
7025}
7026
7027impl std::ops::Drop for ConnectionTransferPeriodicAdvertisingSyncResponder {
7031 fn drop(&mut self) {
7032 self.control_handle.shutdown();
7033 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7035 }
7036}
7037
7038impl fidl::endpoints::Responder for ConnectionTransferPeriodicAdvertisingSyncResponder {
7039 type ControlHandle = ConnectionControlHandle;
7040
7041 fn control_handle(&self) -> &ConnectionControlHandle {
7042 &self.control_handle
7043 }
7044
7045 fn drop_without_shutdown(mut self) {
7046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7048 std::mem::forget(self);
7050 }
7051}
7052
7053impl ConnectionTransferPeriodicAdvertisingSyncResponder {
7054 pub fn send(
7058 self,
7059 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7060 ) -> Result<(), fidl::Error> {
7061 let _result = self.send_raw(result);
7062 if _result.is_err() {
7063 self.control_handle.shutdown();
7064 }
7065 self.drop_without_shutdown();
7066 _result
7067 }
7068
7069 pub fn send_no_shutdown_on_err(
7071 self,
7072 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7073 ) -> Result<(), fidl::Error> {
7074 let _result = self.send_raw(result);
7075 self.drop_without_shutdown();
7076 _result
7077 }
7078
7079 fn send_raw(
7080 &self,
7081 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7082 ) -> Result<(), fidl::Error> {
7083 self.control_handle.inner.send::<fidl::encoding::ResultType<
7084 fidl::encoding::EmptyStruct,
7085 PeriodicAdvertisingSyncTransferError,
7086 >>(
7087 result,
7088 self.tx_id,
7089 0x1117a10b5ba1e219,
7090 fidl::encoding::DynamicFlags::empty(),
7091 )
7092 }
7093}
7094
7095#[must_use = "FIDL methods require a response to be sent"]
7096#[derive(Debug)]
7097pub struct ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7098 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
7099 tx_id: u32,
7100}
7101
7102impl std::ops::Drop for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7106 fn drop(&mut self) {
7107 self.control_handle.shutdown();
7108 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7110 }
7111}
7112
7113impl fidl::endpoints::Responder for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7114 type ControlHandle = ConnectionControlHandle;
7115
7116 fn control_handle(&self) -> &ConnectionControlHandle {
7117 &self.control_handle
7118 }
7119
7120 fn drop_without_shutdown(mut self) {
7121 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7123 std::mem::forget(self);
7125 }
7126}
7127
7128impl ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7129 pub fn send(
7133 self,
7134 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7135 ) -> Result<(), fidl::Error> {
7136 let _result = self.send_raw(result);
7137 if _result.is_err() {
7138 self.control_handle.shutdown();
7139 }
7140 self.drop_without_shutdown();
7141 _result
7142 }
7143
7144 pub fn send_no_shutdown_on_err(
7146 self,
7147 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7148 ) -> Result<(), fidl::Error> {
7149 let _result = self.send_raw(result);
7150 self.drop_without_shutdown();
7151 _result
7152 }
7153
7154 fn send_raw(
7155 &self,
7156 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7157 ) -> Result<(), fidl::Error> {
7158 self.control_handle.inner.send::<fidl::encoding::ResultType<
7159 fidl::encoding::EmptyStruct,
7160 PeriodicAdvertisingSyncTransferError,
7161 >>(
7162 result,
7163 self.tx_id,
7164 0x441a31a7effa7e2b,
7165 fidl::encoding::DynamicFlags::empty(),
7166 )
7167 }
7168}
7169
7170#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7171pub struct IsochronousStreamMarker;
7172
7173impl fidl::endpoints::ProtocolMarker for IsochronousStreamMarker {
7174 type Proxy = IsochronousStreamProxy;
7175 type RequestStream = IsochronousStreamRequestStream;
7176 #[cfg(target_os = "fuchsia")]
7177 type SynchronousProxy = IsochronousStreamSynchronousProxy;
7178
7179 const DEBUG_NAME: &'static str = "(anonymous) IsochronousStream";
7180}
7181pub type IsochronousStreamSetupDataPathResult = Result<(), i32>;
7182pub type IsochronousStreamWriteResult = Result<(), i32>;
7183
7184pub trait IsochronousStreamProxyInterface: Send + Sync {
7185 type SetupDataPathResponseFut: std::future::Future<Output = Result<IsochronousStreamSetupDataPathResult, fidl::Error>>
7186 + Send;
7187 fn r#setup_data_path(
7188 &self,
7189 payload: &IsochronousStreamSetupDataPathRequest,
7190 ) -> Self::SetupDataPathResponseFut;
7191 type ReadResponseFut: std::future::Future<Output = Result<IsochronousStreamReadResponse, fidl::Error>>
7192 + Send;
7193 fn r#read(&self) -> Self::ReadResponseFut;
7194 type WriteResponseFut: std::future::Future<Output = Result<IsochronousStreamWriteResult, fidl::Error>>
7195 + Send;
7196 fn r#write(&self, payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut;
7197}
7198#[derive(Debug)]
7199#[cfg(target_os = "fuchsia")]
7200pub struct IsochronousStreamSynchronousProxy {
7201 client: fidl::client::sync::Client,
7202}
7203
7204#[cfg(target_os = "fuchsia")]
7205impl fidl::endpoints::SynchronousProxy for IsochronousStreamSynchronousProxy {
7206 type Proxy = IsochronousStreamProxy;
7207 type Protocol = IsochronousStreamMarker;
7208
7209 fn from_channel(inner: fidl::Channel) -> Self {
7210 Self::new(inner)
7211 }
7212
7213 fn into_channel(self) -> fidl::Channel {
7214 self.client.into_channel()
7215 }
7216
7217 fn as_channel(&self) -> &fidl::Channel {
7218 self.client.as_channel()
7219 }
7220}
7221
7222#[cfg(target_os = "fuchsia")]
7223impl IsochronousStreamSynchronousProxy {
7224 pub fn new(channel: fidl::Channel) -> Self {
7225 Self { client: fidl::client::sync::Client::new(channel) }
7226 }
7227
7228 pub fn into_channel(self) -> fidl::Channel {
7229 self.client.into_channel()
7230 }
7231
7232 pub fn wait_for_event(
7235 &self,
7236 deadline: zx::MonotonicInstant,
7237 ) -> Result<IsochronousStreamEvent, fidl::Error> {
7238 IsochronousStreamEvent::decode(
7239 self.client.wait_for_event::<IsochronousStreamMarker>(deadline)?,
7240 )
7241 }
7242
7243 pub fn r#setup_data_path(
7255 &self,
7256 mut payload: &IsochronousStreamSetupDataPathRequest,
7257 ___deadline: zx::MonotonicInstant,
7258 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
7259 let _response = self.client.send_query::<
7260 IsochronousStreamSetupDataPathRequest,
7261 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7262 IsochronousStreamMarker,
7263 >(
7264 payload,
7265 0x7ec1e2b9cc6d2fbe,
7266 fidl::encoding::DynamicFlags::FLEXIBLE,
7267 ___deadline,
7268 )?
7269 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
7270 Ok(_response.map(|x| x))
7271 }
7272
7273 pub fn r#read(
7279 &self,
7280 ___deadline: zx::MonotonicInstant,
7281 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
7282 let _response = self.client.send_query::<
7283 fidl::encoding::EmptyPayload,
7284 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
7285 IsochronousStreamMarker,
7286 >(
7287 (),
7288 0x6d7d8b4950ed3a32,
7289 fidl::encoding::DynamicFlags::FLEXIBLE,
7290 ___deadline,
7291 )?
7292 .into_result::<IsochronousStreamMarker>("read")?;
7293 Ok(_response)
7294 }
7295
7296 pub fn r#write(
7300 &self,
7301 mut payload: &IsochronousStreamWriteRequest,
7302 ___deadline: zx::MonotonicInstant,
7303 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
7304 let _response = self.client.send_query::<
7305 IsochronousStreamWriteRequest,
7306 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7307 IsochronousStreamMarker,
7308 >(
7309 payload,
7310 0x5282e90b667d0d43,
7311 fidl::encoding::DynamicFlags::FLEXIBLE,
7312 ___deadline,
7313 )?
7314 .into_result::<IsochronousStreamMarker>("write")?;
7315 Ok(_response.map(|x| x))
7316 }
7317}
7318
7319#[cfg(target_os = "fuchsia")]
7320impl From<IsochronousStreamSynchronousProxy> for zx::NullableHandle {
7321 fn from(value: IsochronousStreamSynchronousProxy) -> Self {
7322 value.into_channel().into()
7323 }
7324}
7325
7326#[cfg(target_os = "fuchsia")]
7327impl From<fidl::Channel> for IsochronousStreamSynchronousProxy {
7328 fn from(value: fidl::Channel) -> Self {
7329 Self::new(value)
7330 }
7331}
7332
7333#[cfg(target_os = "fuchsia")]
7334impl fidl::endpoints::FromClient for IsochronousStreamSynchronousProxy {
7335 type Protocol = IsochronousStreamMarker;
7336
7337 fn from_client(value: fidl::endpoints::ClientEnd<IsochronousStreamMarker>) -> Self {
7338 Self::new(value.into_channel())
7339 }
7340}
7341
7342#[derive(Debug, Clone)]
7343pub struct IsochronousStreamProxy {
7344 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7345}
7346
7347impl fidl::endpoints::Proxy for IsochronousStreamProxy {
7348 type Protocol = IsochronousStreamMarker;
7349
7350 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7351 Self::new(inner)
7352 }
7353
7354 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7355 self.client.into_channel().map_err(|client| Self { client })
7356 }
7357
7358 fn as_channel(&self) -> &::fidl::AsyncChannel {
7359 self.client.as_channel()
7360 }
7361}
7362
7363impl IsochronousStreamProxy {
7364 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7366 let protocol_name =
7367 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7368 Self { client: fidl::client::Client::new(channel, protocol_name) }
7369 }
7370
7371 pub fn take_event_stream(&self) -> IsochronousStreamEventStream {
7377 IsochronousStreamEventStream { event_receiver: self.client.take_event_receiver() }
7378 }
7379
7380 pub fn r#setup_data_path(
7392 &self,
7393 mut payload: &IsochronousStreamSetupDataPathRequest,
7394 ) -> fidl::client::QueryResponseFut<
7395 IsochronousStreamSetupDataPathResult,
7396 fidl::encoding::DefaultFuchsiaResourceDialect,
7397 > {
7398 IsochronousStreamProxyInterface::r#setup_data_path(self, payload)
7399 }
7400
7401 pub fn r#read(
7407 &self,
7408 ) -> fidl::client::QueryResponseFut<
7409 IsochronousStreamReadResponse,
7410 fidl::encoding::DefaultFuchsiaResourceDialect,
7411 > {
7412 IsochronousStreamProxyInterface::r#read(self)
7413 }
7414
7415 pub fn r#write(
7419 &self,
7420 mut payload: &IsochronousStreamWriteRequest,
7421 ) -> fidl::client::QueryResponseFut<
7422 IsochronousStreamWriteResult,
7423 fidl::encoding::DefaultFuchsiaResourceDialect,
7424 > {
7425 IsochronousStreamProxyInterface::r#write(self, payload)
7426 }
7427}
7428
7429impl IsochronousStreamProxyInterface for IsochronousStreamProxy {
7430 type SetupDataPathResponseFut = fidl::client::QueryResponseFut<
7431 IsochronousStreamSetupDataPathResult,
7432 fidl::encoding::DefaultFuchsiaResourceDialect,
7433 >;
7434 fn r#setup_data_path(
7435 &self,
7436 mut payload: &IsochronousStreamSetupDataPathRequest,
7437 ) -> Self::SetupDataPathResponseFut {
7438 fn _decode(
7439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7440 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
7441 let _response = fidl::client::decode_transaction_body::<
7442 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7443 fidl::encoding::DefaultFuchsiaResourceDialect,
7444 0x7ec1e2b9cc6d2fbe,
7445 >(_buf?)?
7446 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
7447 Ok(_response.map(|x| x))
7448 }
7449 self.client.send_query_and_decode::<
7450 IsochronousStreamSetupDataPathRequest,
7451 IsochronousStreamSetupDataPathResult,
7452 >(
7453 payload,
7454 0x7ec1e2b9cc6d2fbe,
7455 fidl::encoding::DynamicFlags::FLEXIBLE,
7456 _decode,
7457 )
7458 }
7459
7460 type ReadResponseFut = fidl::client::QueryResponseFut<
7461 IsochronousStreamReadResponse,
7462 fidl::encoding::DefaultFuchsiaResourceDialect,
7463 >;
7464 fn r#read(&self) -> Self::ReadResponseFut {
7465 fn _decode(
7466 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7467 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
7468 let _response = fidl::client::decode_transaction_body::<
7469 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
7470 fidl::encoding::DefaultFuchsiaResourceDialect,
7471 0x6d7d8b4950ed3a32,
7472 >(_buf?)?
7473 .into_result::<IsochronousStreamMarker>("read")?;
7474 Ok(_response)
7475 }
7476 self.client
7477 .send_query_and_decode::<fidl::encoding::EmptyPayload, IsochronousStreamReadResponse>(
7478 (),
7479 0x6d7d8b4950ed3a32,
7480 fidl::encoding::DynamicFlags::FLEXIBLE,
7481 _decode,
7482 )
7483 }
7484
7485 type WriteResponseFut = fidl::client::QueryResponseFut<
7486 IsochronousStreamWriteResult,
7487 fidl::encoding::DefaultFuchsiaResourceDialect,
7488 >;
7489 fn r#write(&self, mut payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut {
7490 fn _decode(
7491 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7492 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
7493 let _response = fidl::client::decode_transaction_body::<
7494 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7495 fidl::encoding::DefaultFuchsiaResourceDialect,
7496 0x5282e90b667d0d43,
7497 >(_buf?)?
7498 .into_result::<IsochronousStreamMarker>("write")?;
7499 Ok(_response.map(|x| x))
7500 }
7501 self.client
7502 .send_query_and_decode::<IsochronousStreamWriteRequest, IsochronousStreamWriteResult>(
7503 payload,
7504 0x5282e90b667d0d43,
7505 fidl::encoding::DynamicFlags::FLEXIBLE,
7506 _decode,
7507 )
7508 }
7509}
7510
7511pub struct IsochronousStreamEventStream {
7512 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7513}
7514
7515impl std::marker::Unpin for IsochronousStreamEventStream {}
7516
7517impl futures::stream::FusedStream for IsochronousStreamEventStream {
7518 fn is_terminated(&self) -> bool {
7519 self.event_receiver.is_terminated()
7520 }
7521}
7522
7523impl futures::Stream for IsochronousStreamEventStream {
7524 type Item = Result<IsochronousStreamEvent, fidl::Error>;
7525
7526 fn poll_next(
7527 mut self: std::pin::Pin<&mut Self>,
7528 cx: &mut std::task::Context<'_>,
7529 ) -> std::task::Poll<Option<Self::Item>> {
7530 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7531 &mut self.event_receiver,
7532 cx
7533 )?) {
7534 Some(buf) => std::task::Poll::Ready(Some(IsochronousStreamEvent::decode(buf))),
7535 None => std::task::Poll::Ready(None),
7536 }
7537 }
7538}
7539
7540#[derive(Debug)]
7541pub enum IsochronousStreamEvent {
7542 OnEstablished {
7543 payload: IsochronousStreamOnEstablishedRequest,
7544 },
7545 #[non_exhaustive]
7546 _UnknownEvent {
7547 ordinal: u64,
7549 },
7550}
7551
7552impl IsochronousStreamEvent {
7553 #[allow(irrefutable_let_patterns)]
7554 pub fn into_on_established(self) -> Option<IsochronousStreamOnEstablishedRequest> {
7555 if let IsochronousStreamEvent::OnEstablished { payload } = self {
7556 Some((payload))
7557 } else {
7558 None
7559 }
7560 }
7561
7562 fn decode(
7564 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7565 ) -> Result<IsochronousStreamEvent, fidl::Error> {
7566 let (bytes, _handles) = buf.split_mut();
7567 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7568 debug_assert_eq!(tx_header.tx_id, 0);
7569 match tx_header.ordinal {
7570 0x341c50e9d10f3421 => {
7571 let mut out = fidl::new_empty!(
7572 IsochronousStreamOnEstablishedRequest,
7573 fidl::encoding::DefaultFuchsiaResourceDialect
7574 );
7575 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7576 Ok((IsochronousStreamEvent::OnEstablished { payload: out }))
7577 }
7578 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7579 Ok(IsochronousStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7580 }
7581 _ => Err(fidl::Error::UnknownOrdinal {
7582 ordinal: tx_header.ordinal,
7583 protocol_name:
7584 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7585 }),
7586 }
7587 }
7588}
7589
7590pub struct IsochronousStreamRequestStream {
7592 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7593 is_terminated: bool,
7594}
7595
7596impl std::marker::Unpin for IsochronousStreamRequestStream {}
7597
7598impl futures::stream::FusedStream for IsochronousStreamRequestStream {
7599 fn is_terminated(&self) -> bool {
7600 self.is_terminated
7601 }
7602}
7603
7604impl fidl::endpoints::RequestStream for IsochronousStreamRequestStream {
7605 type Protocol = IsochronousStreamMarker;
7606 type ControlHandle = IsochronousStreamControlHandle;
7607
7608 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7609 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7610 }
7611
7612 fn control_handle(&self) -> Self::ControlHandle {
7613 IsochronousStreamControlHandle { inner: self.inner.clone() }
7614 }
7615
7616 fn into_inner(
7617 self,
7618 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7619 {
7620 (self.inner, self.is_terminated)
7621 }
7622
7623 fn from_inner(
7624 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7625 is_terminated: bool,
7626 ) -> Self {
7627 Self { inner, is_terminated }
7628 }
7629}
7630
7631impl futures::Stream for IsochronousStreamRequestStream {
7632 type Item = Result<IsochronousStreamRequest, fidl::Error>;
7633
7634 fn poll_next(
7635 mut self: std::pin::Pin<&mut Self>,
7636 cx: &mut std::task::Context<'_>,
7637 ) -> std::task::Poll<Option<Self::Item>> {
7638 let this = &mut *self;
7639 if this.inner.check_shutdown(cx) {
7640 this.is_terminated = true;
7641 return std::task::Poll::Ready(None);
7642 }
7643 if this.is_terminated {
7644 panic!("polled IsochronousStreamRequestStream after completion");
7645 }
7646 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7647 |bytes, handles| {
7648 match this.inner.channel().read_etc(cx, bytes, handles) {
7649 std::task::Poll::Ready(Ok(())) => {}
7650 std::task::Poll::Pending => return std::task::Poll::Pending,
7651 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7652 this.is_terminated = true;
7653 return std::task::Poll::Ready(None);
7654 }
7655 std::task::Poll::Ready(Err(e)) => {
7656 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7657 e.into(),
7658 ))));
7659 }
7660 }
7661
7662 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7664
7665 std::task::Poll::Ready(Some(match header.ordinal {
7666 0x7ec1e2b9cc6d2fbe => {
7667 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7668 let mut req = fidl::new_empty!(
7669 IsochronousStreamSetupDataPathRequest,
7670 fidl::encoding::DefaultFuchsiaResourceDialect
7671 );
7672 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamSetupDataPathRequest>(&header, _body_bytes, handles, &mut req)?;
7673 let control_handle =
7674 IsochronousStreamControlHandle { inner: this.inner.clone() };
7675 Ok(IsochronousStreamRequest::SetupDataPath {
7676 payload: req,
7677 responder: IsochronousStreamSetupDataPathResponder {
7678 control_handle: std::mem::ManuallyDrop::new(control_handle),
7679 tx_id: header.tx_id,
7680 },
7681 })
7682 }
7683 0x6d7d8b4950ed3a32 => {
7684 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7685 let mut req = fidl::new_empty!(
7686 fidl::encoding::EmptyPayload,
7687 fidl::encoding::DefaultFuchsiaResourceDialect
7688 );
7689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7690 let control_handle =
7691 IsochronousStreamControlHandle { inner: this.inner.clone() };
7692 Ok(IsochronousStreamRequest::Read {
7693 responder: IsochronousStreamReadResponder {
7694 control_handle: std::mem::ManuallyDrop::new(control_handle),
7695 tx_id: header.tx_id,
7696 },
7697 })
7698 }
7699 0x5282e90b667d0d43 => {
7700 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7701 let mut req = fidl::new_empty!(
7702 IsochronousStreamWriteRequest,
7703 fidl::encoding::DefaultFuchsiaResourceDialect
7704 );
7705 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamWriteRequest>(&header, _body_bytes, handles, &mut req)?;
7706 let control_handle =
7707 IsochronousStreamControlHandle { inner: this.inner.clone() };
7708 Ok(IsochronousStreamRequest::Write {
7709 payload: req,
7710 responder: IsochronousStreamWriteResponder {
7711 control_handle: std::mem::ManuallyDrop::new(control_handle),
7712 tx_id: header.tx_id,
7713 },
7714 })
7715 }
7716 _ if header.tx_id == 0
7717 && header
7718 .dynamic_flags()
7719 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7720 {
7721 Ok(IsochronousStreamRequest::_UnknownMethod {
7722 ordinal: header.ordinal,
7723 control_handle: IsochronousStreamControlHandle {
7724 inner: this.inner.clone(),
7725 },
7726 method_type: fidl::MethodType::OneWay,
7727 })
7728 }
7729 _ if header
7730 .dynamic_flags()
7731 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7732 {
7733 this.inner.send_framework_err(
7734 fidl::encoding::FrameworkErr::UnknownMethod,
7735 header.tx_id,
7736 header.ordinal,
7737 header.dynamic_flags(),
7738 (bytes, handles),
7739 )?;
7740 Ok(IsochronousStreamRequest::_UnknownMethod {
7741 ordinal: header.ordinal,
7742 control_handle: IsochronousStreamControlHandle {
7743 inner: this.inner.clone(),
7744 },
7745 method_type: fidl::MethodType::TwoWay,
7746 })
7747 }
7748 _ => Err(fidl::Error::UnknownOrdinal {
7749 ordinal: header.ordinal,
7750 protocol_name:
7751 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7752 }),
7753 }))
7754 },
7755 )
7756 }
7757}
7758
7759#[derive(Debug)]
7760pub enum IsochronousStreamRequest {
7761 SetupDataPath {
7773 payload: IsochronousStreamSetupDataPathRequest,
7774 responder: IsochronousStreamSetupDataPathResponder,
7775 },
7776 Read { responder: IsochronousStreamReadResponder },
7782 Write { payload: IsochronousStreamWriteRequest, responder: IsochronousStreamWriteResponder },
7786 #[non_exhaustive]
7788 _UnknownMethod {
7789 ordinal: u64,
7791 control_handle: IsochronousStreamControlHandle,
7792 method_type: fidl::MethodType,
7793 },
7794}
7795
7796impl IsochronousStreamRequest {
7797 #[allow(irrefutable_let_patterns)]
7798 pub fn into_setup_data_path(
7799 self,
7800 ) -> Option<(IsochronousStreamSetupDataPathRequest, IsochronousStreamSetupDataPathResponder)>
7801 {
7802 if let IsochronousStreamRequest::SetupDataPath { payload, responder } = self {
7803 Some((payload, responder))
7804 } else {
7805 None
7806 }
7807 }
7808
7809 #[allow(irrefutable_let_patterns)]
7810 pub fn into_read(self) -> Option<(IsochronousStreamReadResponder)> {
7811 if let IsochronousStreamRequest::Read { responder } = self {
7812 Some((responder))
7813 } else {
7814 None
7815 }
7816 }
7817
7818 #[allow(irrefutable_let_patterns)]
7819 pub fn into_write(
7820 self,
7821 ) -> Option<(IsochronousStreamWriteRequest, IsochronousStreamWriteResponder)> {
7822 if let IsochronousStreamRequest::Write { payload, responder } = self {
7823 Some((payload, responder))
7824 } else {
7825 None
7826 }
7827 }
7828
7829 pub fn method_name(&self) -> &'static str {
7831 match *self {
7832 IsochronousStreamRequest::SetupDataPath { .. } => "setup_data_path",
7833 IsochronousStreamRequest::Read { .. } => "read",
7834 IsochronousStreamRequest::Write { .. } => "write",
7835 IsochronousStreamRequest::_UnknownMethod {
7836 method_type: fidl::MethodType::OneWay,
7837 ..
7838 } => "unknown one-way method",
7839 IsochronousStreamRequest::_UnknownMethod {
7840 method_type: fidl::MethodType::TwoWay,
7841 ..
7842 } => "unknown two-way method",
7843 }
7844 }
7845}
7846
7847#[derive(Debug, Clone)]
7848pub struct IsochronousStreamControlHandle {
7849 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7850}
7851
7852impl fidl::endpoints::ControlHandle for IsochronousStreamControlHandle {
7853 fn shutdown(&self) {
7854 self.inner.shutdown()
7855 }
7856
7857 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7858 self.inner.shutdown_with_epitaph(status)
7859 }
7860
7861 fn is_closed(&self) -> bool {
7862 self.inner.channel().is_closed()
7863 }
7864 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7865 self.inner.channel().on_closed()
7866 }
7867
7868 #[cfg(target_os = "fuchsia")]
7869 fn signal_peer(
7870 &self,
7871 clear_mask: zx::Signals,
7872 set_mask: zx::Signals,
7873 ) -> Result<(), zx_status::Status> {
7874 use fidl::Peered;
7875 self.inner.channel().signal_peer(clear_mask, set_mask)
7876 }
7877}
7878
7879impl IsochronousStreamControlHandle {
7880 pub fn send_on_established(
7881 &self,
7882 mut payload: &IsochronousStreamOnEstablishedRequest,
7883 ) -> Result<(), fidl::Error> {
7884 self.inner.send::<IsochronousStreamOnEstablishedRequest>(
7885 payload,
7886 0,
7887 0x341c50e9d10f3421,
7888 fidl::encoding::DynamicFlags::FLEXIBLE,
7889 )
7890 }
7891}
7892
7893#[must_use = "FIDL methods require a response to be sent"]
7894#[derive(Debug)]
7895pub struct IsochronousStreamSetupDataPathResponder {
7896 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7897 tx_id: u32,
7898}
7899
7900impl std::ops::Drop for IsochronousStreamSetupDataPathResponder {
7904 fn drop(&mut self) {
7905 self.control_handle.shutdown();
7906 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7908 }
7909}
7910
7911impl fidl::endpoints::Responder for IsochronousStreamSetupDataPathResponder {
7912 type ControlHandle = IsochronousStreamControlHandle;
7913
7914 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7915 &self.control_handle
7916 }
7917
7918 fn drop_without_shutdown(mut self) {
7919 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7921 std::mem::forget(self);
7923 }
7924}
7925
7926impl IsochronousStreamSetupDataPathResponder {
7927 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7931 let _result = self.send_raw(result);
7932 if _result.is_err() {
7933 self.control_handle.shutdown();
7934 }
7935 self.drop_without_shutdown();
7936 _result
7937 }
7938
7939 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7941 let _result = self.send_raw(result);
7942 self.drop_without_shutdown();
7943 _result
7944 }
7945
7946 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7947 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7948 fidl::encoding::EmptyStruct,
7949 i32,
7950 >>(
7951 fidl::encoding::FlexibleResult::new(result),
7952 self.tx_id,
7953 0x7ec1e2b9cc6d2fbe,
7954 fidl::encoding::DynamicFlags::FLEXIBLE,
7955 )
7956 }
7957}
7958
7959#[must_use = "FIDL methods require a response to be sent"]
7960#[derive(Debug)]
7961pub struct IsochronousStreamReadResponder {
7962 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7963 tx_id: u32,
7964}
7965
7966impl std::ops::Drop for IsochronousStreamReadResponder {
7970 fn drop(&mut self) {
7971 self.control_handle.shutdown();
7972 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7974 }
7975}
7976
7977impl fidl::endpoints::Responder for IsochronousStreamReadResponder {
7978 type ControlHandle = IsochronousStreamControlHandle;
7979
7980 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7981 &self.control_handle
7982 }
7983
7984 fn drop_without_shutdown(mut self) {
7985 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7987 std::mem::forget(self);
7989 }
7990}
7991
7992impl IsochronousStreamReadResponder {
7993 pub fn send(self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
7997 let _result = self.send_raw(payload);
7998 if _result.is_err() {
7999 self.control_handle.shutdown();
8000 }
8001 self.drop_without_shutdown();
8002 _result
8003 }
8004
8005 pub fn send_no_shutdown_on_err(
8007 self,
8008 mut payload: &IsochronousStreamReadResponse,
8009 ) -> Result<(), fidl::Error> {
8010 let _result = self.send_raw(payload);
8011 self.drop_without_shutdown();
8012 _result
8013 }
8014
8015 fn send_raw(&self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
8016 self.control_handle
8017 .inner
8018 .send::<fidl::encoding::FlexibleType<IsochronousStreamReadResponse>>(
8019 fidl::encoding::Flexible::new(payload),
8020 self.tx_id,
8021 0x6d7d8b4950ed3a32,
8022 fidl::encoding::DynamicFlags::FLEXIBLE,
8023 )
8024 }
8025}
8026
8027#[must_use = "FIDL methods require a response to be sent"]
8028#[derive(Debug)]
8029pub struct IsochronousStreamWriteResponder {
8030 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
8031 tx_id: u32,
8032}
8033
8034impl std::ops::Drop for IsochronousStreamWriteResponder {
8038 fn drop(&mut self) {
8039 self.control_handle.shutdown();
8040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8042 }
8043}
8044
8045impl fidl::endpoints::Responder for IsochronousStreamWriteResponder {
8046 type ControlHandle = IsochronousStreamControlHandle;
8047
8048 fn control_handle(&self) -> &IsochronousStreamControlHandle {
8049 &self.control_handle
8050 }
8051
8052 fn drop_without_shutdown(mut self) {
8053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8055 std::mem::forget(self);
8057 }
8058}
8059
8060impl IsochronousStreamWriteResponder {
8061 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8065 let _result = self.send_raw(result);
8066 if _result.is_err() {
8067 self.control_handle.shutdown();
8068 }
8069 self.drop_without_shutdown();
8070 _result
8071 }
8072
8073 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8075 let _result = self.send_raw(result);
8076 self.drop_without_shutdown();
8077 _result
8078 }
8079
8080 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8081 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8082 fidl::encoding::EmptyStruct,
8083 i32,
8084 >>(
8085 fidl::encoding::FlexibleResult::new(result),
8086 self.tx_id,
8087 0x5282e90b667d0d43,
8088 fidl::encoding::DynamicFlags::FLEXIBLE,
8089 )
8090 }
8091}
8092
8093#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8094pub struct PeriodicAdvertisingSyncMarker;
8095
8096impl fidl::endpoints::ProtocolMarker for PeriodicAdvertisingSyncMarker {
8097 type Proxy = PeriodicAdvertisingSyncProxy;
8098 type RequestStream = PeriodicAdvertisingSyncRequestStream;
8099 #[cfg(target_os = "fuchsia")]
8100 type SynchronousProxy = PeriodicAdvertisingSyncSynchronousProxy;
8101
8102 const DEBUG_NAME: &'static str = "(anonymous) PeriodicAdvertisingSync";
8103}
8104pub type PeriodicAdvertisingSyncSyncToSubeventsResult = Result<(), i32>;
8105
8106pub trait PeriodicAdvertisingSyncProxyInterface: Send + Sync {
8107 type WatchAdvertisingReportResponseFut: std::future::Future<
8108 Output = Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error>,
8109 > + Send;
8110 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut;
8111 type SyncToSubeventsResponseFut: std::future::Future<
8112 Output = Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error>,
8113 > + Send;
8114 fn r#sync_to_subevents(
8115 &self,
8116 payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8117 ) -> Self::SyncToSubeventsResponseFut;
8118 fn r#cancel(&self) -> Result<(), fidl::Error>;
8119}
8120#[derive(Debug)]
8121#[cfg(target_os = "fuchsia")]
8122pub struct PeriodicAdvertisingSyncSynchronousProxy {
8123 client: fidl::client::sync::Client,
8124}
8125
8126#[cfg(target_os = "fuchsia")]
8127impl fidl::endpoints::SynchronousProxy for PeriodicAdvertisingSyncSynchronousProxy {
8128 type Proxy = PeriodicAdvertisingSyncProxy;
8129 type Protocol = PeriodicAdvertisingSyncMarker;
8130
8131 fn from_channel(inner: fidl::Channel) -> Self {
8132 Self::new(inner)
8133 }
8134
8135 fn into_channel(self) -> fidl::Channel {
8136 self.client.into_channel()
8137 }
8138
8139 fn as_channel(&self) -> &fidl::Channel {
8140 self.client.as_channel()
8141 }
8142}
8143
8144#[cfg(target_os = "fuchsia")]
8145impl PeriodicAdvertisingSyncSynchronousProxy {
8146 pub fn new(channel: fidl::Channel) -> Self {
8147 Self { client: fidl::client::sync::Client::new(channel) }
8148 }
8149
8150 pub fn into_channel(self) -> fidl::Channel {
8151 self.client.into_channel()
8152 }
8153
8154 pub fn wait_for_event(
8157 &self,
8158 deadline: zx::MonotonicInstant,
8159 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
8160 PeriodicAdvertisingSyncEvent::decode(
8161 self.client.wait_for_event::<PeriodicAdvertisingSyncMarker>(deadline)?,
8162 )
8163 }
8164
8165 pub fn r#watch_advertising_report(
8168 &self,
8169 ___deadline: zx::MonotonicInstant,
8170 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
8171 let _response = self.client.send_query::<
8172 fidl::encoding::EmptyPayload,
8173 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
8174 PeriodicAdvertisingSyncMarker,
8175 >(
8176 (),
8177 0x2ea610fea0e7d337,
8178 fidl::encoding::DynamicFlags::FLEXIBLE,
8179 ___deadline,
8180 )?
8181 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
8182 Ok(_response)
8183 }
8184
8185 pub fn r#sync_to_subevents(
8188 &self,
8189 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8190 ___deadline: zx::MonotonicInstant,
8191 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
8192 let _response = self.client.send_query::<
8193 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8194 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
8195 PeriodicAdvertisingSyncMarker,
8196 >(
8197 payload,
8198 0x653c5dab1f1d80ed,
8199 fidl::encoding::DynamicFlags::FLEXIBLE,
8200 ___deadline,
8201 )?
8202 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
8203 Ok(_response.map(|x| x))
8204 }
8205
8206 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
8211 self.client.send::<fidl::encoding::EmptyPayload>(
8212 (),
8213 0xd617c037eaf5d92,
8214 fidl::encoding::DynamicFlags::FLEXIBLE,
8215 )
8216 }
8217}
8218
8219#[cfg(target_os = "fuchsia")]
8220impl From<PeriodicAdvertisingSyncSynchronousProxy> for zx::NullableHandle {
8221 fn from(value: PeriodicAdvertisingSyncSynchronousProxy) -> Self {
8222 value.into_channel().into()
8223 }
8224}
8225
8226#[cfg(target_os = "fuchsia")]
8227impl From<fidl::Channel> for PeriodicAdvertisingSyncSynchronousProxy {
8228 fn from(value: fidl::Channel) -> Self {
8229 Self::new(value)
8230 }
8231}
8232
8233#[cfg(target_os = "fuchsia")]
8234impl fidl::endpoints::FromClient for PeriodicAdvertisingSyncSynchronousProxy {
8235 type Protocol = PeriodicAdvertisingSyncMarker;
8236
8237 fn from_client(value: fidl::endpoints::ClientEnd<PeriodicAdvertisingSyncMarker>) -> Self {
8238 Self::new(value.into_channel())
8239 }
8240}
8241
8242#[derive(Debug, Clone)]
8243pub struct PeriodicAdvertisingSyncProxy {
8244 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8245}
8246
8247impl fidl::endpoints::Proxy for PeriodicAdvertisingSyncProxy {
8248 type Protocol = PeriodicAdvertisingSyncMarker;
8249
8250 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8251 Self::new(inner)
8252 }
8253
8254 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8255 self.client.into_channel().map_err(|client| Self { client })
8256 }
8257
8258 fn as_channel(&self) -> &::fidl::AsyncChannel {
8259 self.client.as_channel()
8260 }
8261}
8262
8263impl PeriodicAdvertisingSyncProxy {
8264 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8266 let protocol_name =
8267 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8268 Self { client: fidl::client::Client::new(channel, protocol_name) }
8269 }
8270
8271 pub fn take_event_stream(&self) -> PeriodicAdvertisingSyncEventStream {
8277 PeriodicAdvertisingSyncEventStream { event_receiver: self.client.take_event_receiver() }
8278 }
8279
8280 pub fn r#watch_advertising_report(
8283 &self,
8284 ) -> fidl::client::QueryResponseFut<
8285 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8286 fidl::encoding::DefaultFuchsiaResourceDialect,
8287 > {
8288 PeriodicAdvertisingSyncProxyInterface::r#watch_advertising_report(self)
8289 }
8290
8291 pub fn r#sync_to_subevents(
8294 &self,
8295 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8296 ) -> fidl::client::QueryResponseFut<
8297 PeriodicAdvertisingSyncSyncToSubeventsResult,
8298 fidl::encoding::DefaultFuchsiaResourceDialect,
8299 > {
8300 PeriodicAdvertisingSyncProxyInterface::r#sync_to_subevents(self, payload)
8301 }
8302
8303 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
8308 PeriodicAdvertisingSyncProxyInterface::r#cancel(self)
8309 }
8310}
8311
8312impl PeriodicAdvertisingSyncProxyInterface for PeriodicAdvertisingSyncProxy {
8313 type WatchAdvertisingReportResponseFut = fidl::client::QueryResponseFut<
8314 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8315 fidl::encoding::DefaultFuchsiaResourceDialect,
8316 >;
8317 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut {
8318 fn _decode(
8319 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8320 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
8321 let _response = fidl::client::decode_transaction_body::<
8322 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
8323 fidl::encoding::DefaultFuchsiaResourceDialect,
8324 0x2ea610fea0e7d337,
8325 >(_buf?)?
8326 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
8327 Ok(_response)
8328 }
8329 self.client.send_query_and_decode::<
8330 fidl::encoding::EmptyPayload,
8331 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8332 >(
8333 (),
8334 0x2ea610fea0e7d337,
8335 fidl::encoding::DynamicFlags::FLEXIBLE,
8336 _decode,
8337 )
8338 }
8339
8340 type SyncToSubeventsResponseFut = fidl::client::QueryResponseFut<
8341 PeriodicAdvertisingSyncSyncToSubeventsResult,
8342 fidl::encoding::DefaultFuchsiaResourceDialect,
8343 >;
8344 fn r#sync_to_subevents(
8345 &self,
8346 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8347 ) -> Self::SyncToSubeventsResponseFut {
8348 fn _decode(
8349 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8350 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
8351 let _response = fidl::client::decode_transaction_body::<
8352 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
8353 fidl::encoding::DefaultFuchsiaResourceDialect,
8354 0x653c5dab1f1d80ed,
8355 >(_buf?)?
8356 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
8357 Ok(_response.map(|x| x))
8358 }
8359 self.client.send_query_and_decode::<
8360 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8361 PeriodicAdvertisingSyncSyncToSubeventsResult,
8362 >(
8363 payload,
8364 0x653c5dab1f1d80ed,
8365 fidl::encoding::DynamicFlags::FLEXIBLE,
8366 _decode,
8367 )
8368 }
8369
8370 fn r#cancel(&self) -> Result<(), fidl::Error> {
8371 self.client.send::<fidl::encoding::EmptyPayload>(
8372 (),
8373 0xd617c037eaf5d92,
8374 fidl::encoding::DynamicFlags::FLEXIBLE,
8375 )
8376 }
8377}
8378
8379pub struct PeriodicAdvertisingSyncEventStream {
8380 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8381}
8382
8383impl std::marker::Unpin for PeriodicAdvertisingSyncEventStream {}
8384
8385impl futures::stream::FusedStream for PeriodicAdvertisingSyncEventStream {
8386 fn is_terminated(&self) -> bool {
8387 self.event_receiver.is_terminated()
8388 }
8389}
8390
8391impl futures::Stream for PeriodicAdvertisingSyncEventStream {
8392 type Item = Result<PeriodicAdvertisingSyncEvent, fidl::Error>;
8393
8394 fn poll_next(
8395 mut self: std::pin::Pin<&mut Self>,
8396 cx: &mut std::task::Context<'_>,
8397 ) -> std::task::Poll<Option<Self::Item>> {
8398 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8399 &mut self.event_receiver,
8400 cx
8401 )?) {
8402 Some(buf) => std::task::Poll::Ready(Some(PeriodicAdvertisingSyncEvent::decode(buf))),
8403 None => std::task::Poll::Ready(None),
8404 }
8405 }
8406}
8407
8408#[derive(Debug)]
8409pub enum PeriodicAdvertisingSyncEvent {
8410 OnEstablished {
8411 payload: PeriodicAdvertisingSyncOnEstablishedRequest,
8412 },
8413 OnError {
8414 error: PeriodicAdvertisingSyncError,
8415 },
8416 #[non_exhaustive]
8417 _UnknownEvent {
8418 ordinal: u64,
8420 },
8421}
8422
8423impl PeriodicAdvertisingSyncEvent {
8424 #[allow(irrefutable_let_patterns)]
8425 pub fn into_on_established(self) -> Option<PeriodicAdvertisingSyncOnEstablishedRequest> {
8426 if let PeriodicAdvertisingSyncEvent::OnEstablished { payload } = self {
8427 Some((payload))
8428 } else {
8429 None
8430 }
8431 }
8432 #[allow(irrefutable_let_patterns)]
8433 pub fn into_on_error(self) -> Option<PeriodicAdvertisingSyncError> {
8434 if let PeriodicAdvertisingSyncEvent::OnError { error } = self {
8435 Some((error))
8436 } else {
8437 None
8438 }
8439 }
8440
8441 fn decode(
8443 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8444 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
8445 let (bytes, _handles) = buf.split_mut();
8446 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8447 debug_assert_eq!(tx_header.tx_id, 0);
8448 match tx_header.ordinal {
8449 0x4a5c307761c40fdc => {
8450 let mut out = fidl::new_empty!(
8451 PeriodicAdvertisingSyncOnEstablishedRequest,
8452 fidl::encoding::DefaultFuchsiaResourceDialect
8453 );
8454 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8455 Ok((PeriodicAdvertisingSyncEvent::OnEstablished { payload: out }))
8456 }
8457 0x1c051673126ce4a => {
8458 let mut out = fidl::new_empty!(
8459 PeriodicAdvertisingSyncOnErrorRequest,
8460 fidl::encoding::DefaultFuchsiaResourceDialect
8461 );
8462 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8463 Ok((PeriodicAdvertisingSyncEvent::OnError { error: out.error }))
8464 }
8465 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8466 Ok(PeriodicAdvertisingSyncEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8467 }
8468 _ => Err(fidl::Error::UnknownOrdinal {
8469 ordinal: tx_header.ordinal,
8470 protocol_name:
8471 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8472 }),
8473 }
8474 }
8475}
8476
8477pub struct PeriodicAdvertisingSyncRequestStream {
8479 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8480 is_terminated: bool,
8481}
8482
8483impl std::marker::Unpin for PeriodicAdvertisingSyncRequestStream {}
8484
8485impl futures::stream::FusedStream for PeriodicAdvertisingSyncRequestStream {
8486 fn is_terminated(&self) -> bool {
8487 self.is_terminated
8488 }
8489}
8490
8491impl fidl::endpoints::RequestStream for PeriodicAdvertisingSyncRequestStream {
8492 type Protocol = PeriodicAdvertisingSyncMarker;
8493 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8494
8495 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8496 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8497 }
8498
8499 fn control_handle(&self) -> Self::ControlHandle {
8500 PeriodicAdvertisingSyncControlHandle { inner: self.inner.clone() }
8501 }
8502
8503 fn into_inner(
8504 self,
8505 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8506 {
8507 (self.inner, self.is_terminated)
8508 }
8509
8510 fn from_inner(
8511 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8512 is_terminated: bool,
8513 ) -> Self {
8514 Self { inner, is_terminated }
8515 }
8516}
8517
8518impl futures::Stream for PeriodicAdvertisingSyncRequestStream {
8519 type Item = Result<PeriodicAdvertisingSyncRequest, fidl::Error>;
8520
8521 fn poll_next(
8522 mut self: std::pin::Pin<&mut Self>,
8523 cx: &mut std::task::Context<'_>,
8524 ) -> std::task::Poll<Option<Self::Item>> {
8525 let this = &mut *self;
8526 if this.inner.check_shutdown(cx) {
8527 this.is_terminated = true;
8528 return std::task::Poll::Ready(None);
8529 }
8530 if this.is_terminated {
8531 panic!("polled PeriodicAdvertisingSyncRequestStream after completion");
8532 }
8533 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8534 |bytes, handles| {
8535 match this.inner.channel().read_etc(cx, bytes, handles) {
8536 std::task::Poll::Ready(Ok(())) => {}
8537 std::task::Poll::Pending => return std::task::Poll::Pending,
8538 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8539 this.is_terminated = true;
8540 return std::task::Poll::Ready(None);
8541 }
8542 std::task::Poll::Ready(Err(e)) => {
8543 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8544 e.into(),
8545 ))));
8546 }
8547 }
8548
8549 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8551
8552 std::task::Poll::Ready(Some(match header.ordinal {
8553 0x2ea610fea0e7d337 => {
8554 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8555 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8556 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8557 let control_handle = PeriodicAdvertisingSyncControlHandle {
8558 inner: this.inner.clone(),
8559 };
8560 Ok(PeriodicAdvertisingSyncRequest::WatchAdvertisingReport {
8561 responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8562 control_handle: std::mem::ManuallyDrop::new(control_handle),
8563 tx_id: header.tx_id,
8564 },
8565 })
8566 }
8567 0x653c5dab1f1d80ed => {
8568 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8569 let mut req = fidl::new_empty!(PeriodicAdvertisingSyncSyncToSubeventsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8570 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncSyncToSubeventsRequest>(&header, _body_bytes, handles, &mut req)?;
8571 let control_handle = PeriodicAdvertisingSyncControlHandle {
8572 inner: this.inner.clone(),
8573 };
8574 Ok(PeriodicAdvertisingSyncRequest::SyncToSubevents {payload: req,
8575 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder {
8576 control_handle: std::mem::ManuallyDrop::new(control_handle),
8577 tx_id: header.tx_id,
8578 },
8579 })
8580 }
8581 0xd617c037eaf5d92 => {
8582 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8583 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8584 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8585 let control_handle = PeriodicAdvertisingSyncControlHandle {
8586 inner: this.inner.clone(),
8587 };
8588 Ok(PeriodicAdvertisingSyncRequest::Cancel {
8589 control_handle,
8590 })
8591 }
8592 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8593 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
8594 ordinal: header.ordinal,
8595 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
8596 method_type: fidl::MethodType::OneWay,
8597 })
8598 }
8599 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8600 this.inner.send_framework_err(
8601 fidl::encoding::FrameworkErr::UnknownMethod,
8602 header.tx_id,
8603 header.ordinal,
8604 header.dynamic_flags(),
8605 (bytes, handles),
8606 )?;
8607 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
8608 ordinal: header.ordinal,
8609 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
8610 method_type: fidl::MethodType::TwoWay,
8611 })
8612 }
8613 _ => Err(fidl::Error::UnknownOrdinal {
8614 ordinal: header.ordinal,
8615 protocol_name: <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8616 }),
8617 }))
8618 },
8619 )
8620 }
8621}
8622
8623#[derive(Debug)]
8625pub enum PeriodicAdvertisingSyncRequest {
8626 WatchAdvertisingReport { responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder },
8629 SyncToSubevents {
8632 payload: PeriodicAdvertisingSyncSyncToSubeventsRequest,
8633 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder,
8634 },
8635 Cancel { control_handle: PeriodicAdvertisingSyncControlHandle },
8640 #[non_exhaustive]
8642 _UnknownMethod {
8643 ordinal: u64,
8645 control_handle: PeriodicAdvertisingSyncControlHandle,
8646 method_type: fidl::MethodType,
8647 },
8648}
8649
8650impl PeriodicAdvertisingSyncRequest {
8651 #[allow(irrefutable_let_patterns)]
8652 pub fn into_watch_advertising_report(
8653 self,
8654 ) -> Option<(PeriodicAdvertisingSyncWatchAdvertisingReportResponder)> {
8655 if let PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { responder } = self {
8656 Some((responder))
8657 } else {
8658 None
8659 }
8660 }
8661
8662 #[allow(irrefutable_let_patterns)]
8663 pub fn into_sync_to_subevents(
8664 self,
8665 ) -> Option<(
8666 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8667 PeriodicAdvertisingSyncSyncToSubeventsResponder,
8668 )> {
8669 if let PeriodicAdvertisingSyncRequest::SyncToSubevents { payload, responder } = self {
8670 Some((payload, responder))
8671 } else {
8672 None
8673 }
8674 }
8675
8676 #[allow(irrefutable_let_patterns)]
8677 pub fn into_cancel(self) -> Option<(PeriodicAdvertisingSyncControlHandle)> {
8678 if let PeriodicAdvertisingSyncRequest::Cancel { control_handle } = self {
8679 Some((control_handle))
8680 } else {
8681 None
8682 }
8683 }
8684
8685 pub fn method_name(&self) -> &'static str {
8687 match *self {
8688 PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { .. } => {
8689 "watch_advertising_report"
8690 }
8691 PeriodicAdvertisingSyncRequest::SyncToSubevents { .. } => "sync_to_subevents",
8692 PeriodicAdvertisingSyncRequest::Cancel { .. } => "cancel",
8693 PeriodicAdvertisingSyncRequest::_UnknownMethod {
8694 method_type: fidl::MethodType::OneWay,
8695 ..
8696 } => "unknown one-way method",
8697 PeriodicAdvertisingSyncRequest::_UnknownMethod {
8698 method_type: fidl::MethodType::TwoWay,
8699 ..
8700 } => "unknown two-way method",
8701 }
8702 }
8703}
8704
8705#[derive(Debug, Clone)]
8706pub struct PeriodicAdvertisingSyncControlHandle {
8707 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8708}
8709
8710impl fidl::endpoints::ControlHandle for PeriodicAdvertisingSyncControlHandle {
8711 fn shutdown(&self) {
8712 self.inner.shutdown()
8713 }
8714
8715 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8716 self.inner.shutdown_with_epitaph(status)
8717 }
8718
8719 fn is_closed(&self) -> bool {
8720 self.inner.channel().is_closed()
8721 }
8722 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8723 self.inner.channel().on_closed()
8724 }
8725
8726 #[cfg(target_os = "fuchsia")]
8727 fn signal_peer(
8728 &self,
8729 clear_mask: zx::Signals,
8730 set_mask: zx::Signals,
8731 ) -> Result<(), zx_status::Status> {
8732 use fidl::Peered;
8733 self.inner.channel().signal_peer(clear_mask, set_mask)
8734 }
8735}
8736
8737impl PeriodicAdvertisingSyncControlHandle {
8738 pub fn send_on_established(
8739 &self,
8740 mut payload: &PeriodicAdvertisingSyncOnEstablishedRequest,
8741 ) -> Result<(), fidl::Error> {
8742 self.inner.send::<PeriodicAdvertisingSyncOnEstablishedRequest>(
8743 payload,
8744 0,
8745 0x4a5c307761c40fdc,
8746 fidl::encoding::DynamicFlags::FLEXIBLE,
8747 )
8748 }
8749
8750 pub fn send_on_error(
8751 &self,
8752 mut error: PeriodicAdvertisingSyncError,
8753 ) -> Result<(), fidl::Error> {
8754 self.inner.send::<PeriodicAdvertisingSyncOnErrorRequest>(
8755 (error,),
8756 0,
8757 0x1c051673126ce4a,
8758 fidl::encoding::DynamicFlags::FLEXIBLE,
8759 )
8760 }
8761}
8762
8763#[must_use = "FIDL methods require a response to be sent"]
8764#[derive(Debug)]
8765pub struct PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8766 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
8767 tx_id: u32,
8768}
8769
8770impl std::ops::Drop for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8774 fn drop(&mut self) {
8775 self.control_handle.shutdown();
8776 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8778 }
8779}
8780
8781impl fidl::endpoints::Responder for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8782 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8783
8784 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8785 &self.control_handle
8786 }
8787
8788 fn drop_without_shutdown(mut self) {
8789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8791 std::mem::forget(self);
8793 }
8794}
8795
8796impl PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8797 pub fn send(
8801 self,
8802 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8803 ) -> Result<(), fidl::Error> {
8804 let _result = self.send_raw(payload);
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 payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8816 ) -> Result<(), fidl::Error> {
8817 let _result = self.send_raw(payload);
8818 self.drop_without_shutdown();
8819 _result
8820 }
8821
8822 fn send_raw(
8823 &self,
8824 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8825 ) -> Result<(), fidl::Error> {
8826 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8827 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8828 >>(
8829 fidl::encoding::Flexible::new(payload),
8830 self.tx_id,
8831 0x2ea610fea0e7d337,
8832 fidl::encoding::DynamicFlags::FLEXIBLE,
8833 )
8834 }
8835}
8836
8837#[must_use = "FIDL methods require a response to be sent"]
8838#[derive(Debug)]
8839pub struct PeriodicAdvertisingSyncSyncToSubeventsResponder {
8840 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
8841 tx_id: u32,
8842}
8843
8844impl std::ops::Drop for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8848 fn drop(&mut self) {
8849 self.control_handle.shutdown();
8850 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8852 }
8853}
8854
8855impl fidl::endpoints::Responder for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8856 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8857
8858 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8859 &self.control_handle
8860 }
8861
8862 fn drop_without_shutdown(mut self) {
8863 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8865 std::mem::forget(self);
8867 }
8868}
8869
8870impl PeriodicAdvertisingSyncSyncToSubeventsResponder {
8871 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8875 let _result = self.send_raw(result);
8876 if _result.is_err() {
8877 self.control_handle.shutdown();
8878 }
8879 self.drop_without_shutdown();
8880 _result
8881 }
8882
8883 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8885 let _result = self.send_raw(result);
8886 self.drop_without_shutdown();
8887 _result
8888 }
8889
8890 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8891 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8892 fidl::encoding::EmptyStruct,
8893 i32,
8894 >>(
8895 fidl::encoding::FlexibleResult::new(result),
8896 self.tx_id,
8897 0x653c5dab1f1d80ed,
8898 fidl::encoding::DynamicFlags::FLEXIBLE,
8899 )
8900 }
8901}
8902
8903#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8904pub struct PeripheralMarker;
8905
8906impl fidl::endpoints::ProtocolMarker for PeripheralMarker {
8907 type Proxy = PeripheralProxy;
8908 type RequestStream = PeripheralRequestStream;
8909 #[cfg(target_os = "fuchsia")]
8910 type SynchronousProxy = PeripheralSynchronousProxy;
8911
8912 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Peripheral";
8913}
8914impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralMarker {}
8915pub type PeripheralAdvertiseResult = Result<(), PeripheralError>;
8916pub type PeripheralStartAdvertisingResult = Result<(), PeripheralError>;
8917
8918pub trait PeripheralProxyInterface: Send + Sync {
8919 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
8920 + Send;
8921 fn r#listen_l2cap(
8922 &self,
8923 payload: ChannelListenerRegistryListenL2capRequest,
8924 ) -> Self::ListenL2capResponseFut;
8925 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
8926 + Send;
8927 fn r#advertise(
8928 &self,
8929 parameters: &AdvertisingParameters,
8930 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8931 ) -> Self::AdvertiseResponseFut;
8932 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
8933 + Send;
8934 fn r#start_advertising(
8935 &self,
8936 parameters: &AdvertisingParameters,
8937 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8938 ) -> Self::StartAdvertisingResponseFut;
8939}
8940#[derive(Debug)]
8941#[cfg(target_os = "fuchsia")]
8942pub struct PeripheralSynchronousProxy {
8943 client: fidl::client::sync::Client,
8944}
8945
8946#[cfg(target_os = "fuchsia")]
8947impl fidl::endpoints::SynchronousProxy for PeripheralSynchronousProxy {
8948 type Proxy = PeripheralProxy;
8949 type Protocol = PeripheralMarker;
8950
8951 fn from_channel(inner: fidl::Channel) -> Self {
8952 Self::new(inner)
8953 }
8954
8955 fn into_channel(self) -> fidl::Channel {
8956 self.client.into_channel()
8957 }
8958
8959 fn as_channel(&self) -> &fidl::Channel {
8960 self.client.as_channel()
8961 }
8962}
8963
8964#[cfg(target_os = "fuchsia")]
8965impl PeripheralSynchronousProxy {
8966 pub fn new(channel: fidl::Channel) -> Self {
8967 Self { client: fidl::client::sync::Client::new(channel) }
8968 }
8969
8970 pub fn into_channel(self) -> fidl::Channel {
8971 self.client.into_channel()
8972 }
8973
8974 pub fn wait_for_event(
8977 &self,
8978 deadline: zx::MonotonicInstant,
8979 ) -> Result<PeripheralEvent, fidl::Error> {
8980 PeripheralEvent::decode(self.client.wait_for_event::<PeripheralMarker>(deadline)?)
8981 }
8982
8983 pub fn r#listen_l2cap(
8993 &self,
8994 mut payload: ChannelListenerRegistryListenL2capRequest,
8995 ___deadline: zx::MonotonicInstant,
8996 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8997 let _response = self.client.send_query::<
8998 ChannelListenerRegistryListenL2capRequest,
8999 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
9000 PeripheralMarker,
9001 >(
9002 &mut payload,
9003 0x39c6e9001d102338,
9004 fidl::encoding::DynamicFlags::empty(),
9005 ___deadline,
9006 )?;
9007 Ok(_response.map(|x| x))
9008 }
9009
9010 pub fn r#advertise(
9038 &self,
9039 mut parameters: &AdvertisingParameters,
9040 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9041 ___deadline: zx::MonotonicInstant,
9042 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9043 let _response = self.client.send_query::<
9044 PeripheralAdvertiseRequest,
9045 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9046 PeripheralMarker,
9047 >(
9048 (parameters, advertised_peripheral,),
9049 0x2d9ec9260c32c17f,
9050 fidl::encoding::DynamicFlags::empty(),
9051 ___deadline,
9052 )?;
9053 Ok(_response.map(|x| x))
9054 }
9055
9056 pub fn r#start_advertising(
9077 &self,
9078 mut parameters: &AdvertisingParameters,
9079 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9080 ___deadline: zx::MonotonicInstant,
9081 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9082 let _response = self.client.send_query::<
9083 PeripheralStartAdvertisingRequest,
9084 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9085 PeripheralMarker,
9086 >(
9087 (parameters, handle,),
9088 0x5875c1c575f00f7d,
9089 fidl::encoding::DynamicFlags::empty(),
9090 ___deadline,
9091 )?;
9092 Ok(_response.map(|x| x))
9093 }
9094}
9095
9096#[cfg(target_os = "fuchsia")]
9097impl From<PeripheralSynchronousProxy> for zx::NullableHandle {
9098 fn from(value: PeripheralSynchronousProxy) -> Self {
9099 value.into_channel().into()
9100 }
9101}
9102
9103#[cfg(target_os = "fuchsia")]
9104impl From<fidl::Channel> for PeripheralSynchronousProxy {
9105 fn from(value: fidl::Channel) -> Self {
9106 Self::new(value)
9107 }
9108}
9109
9110#[cfg(target_os = "fuchsia")]
9111impl fidl::endpoints::FromClient for PeripheralSynchronousProxy {
9112 type Protocol = PeripheralMarker;
9113
9114 fn from_client(value: fidl::endpoints::ClientEnd<PeripheralMarker>) -> Self {
9115 Self::new(value.into_channel())
9116 }
9117}
9118
9119#[derive(Debug, Clone)]
9120pub struct PeripheralProxy {
9121 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9122}
9123
9124impl fidl::endpoints::Proxy for PeripheralProxy {
9125 type Protocol = PeripheralMarker;
9126
9127 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9128 Self::new(inner)
9129 }
9130
9131 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9132 self.client.into_channel().map_err(|client| Self { client })
9133 }
9134
9135 fn as_channel(&self) -> &::fidl::AsyncChannel {
9136 self.client.as_channel()
9137 }
9138}
9139
9140impl PeripheralProxy {
9141 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9143 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9144 Self { client: fidl::client::Client::new(channel, protocol_name) }
9145 }
9146
9147 pub fn take_event_stream(&self) -> PeripheralEventStream {
9153 PeripheralEventStream { event_receiver: self.client.take_event_receiver() }
9154 }
9155
9156 pub fn r#listen_l2cap(
9166 &self,
9167 mut payload: ChannelListenerRegistryListenL2capRequest,
9168 ) -> fidl::client::QueryResponseFut<
9169 ChannelListenerRegistryListenL2capResult,
9170 fidl::encoding::DefaultFuchsiaResourceDialect,
9171 > {
9172 PeripheralProxyInterface::r#listen_l2cap(self, payload)
9173 }
9174
9175 pub fn r#advertise(
9203 &self,
9204 mut parameters: &AdvertisingParameters,
9205 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9206 ) -> fidl::client::QueryResponseFut<
9207 PeripheralAdvertiseResult,
9208 fidl::encoding::DefaultFuchsiaResourceDialect,
9209 > {
9210 PeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
9211 }
9212
9213 pub fn r#start_advertising(
9234 &self,
9235 mut parameters: &AdvertisingParameters,
9236 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9237 ) -> fidl::client::QueryResponseFut<
9238 PeripheralStartAdvertisingResult,
9239 fidl::encoding::DefaultFuchsiaResourceDialect,
9240 > {
9241 PeripheralProxyInterface::r#start_advertising(self, parameters, handle)
9242 }
9243}
9244
9245impl PeripheralProxyInterface for PeripheralProxy {
9246 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
9247 ChannelListenerRegistryListenL2capResult,
9248 fidl::encoding::DefaultFuchsiaResourceDialect,
9249 >;
9250 fn r#listen_l2cap(
9251 &self,
9252 mut payload: ChannelListenerRegistryListenL2capRequest,
9253 ) -> Self::ListenL2capResponseFut {
9254 fn _decode(
9255 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9256 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
9257 let _response = fidl::client::decode_transaction_body::<
9258 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
9259 fidl::encoding::DefaultFuchsiaResourceDialect,
9260 0x39c6e9001d102338,
9261 >(_buf?)?;
9262 Ok(_response.map(|x| x))
9263 }
9264 self.client.send_query_and_decode::<
9265 ChannelListenerRegistryListenL2capRequest,
9266 ChannelListenerRegistryListenL2capResult,
9267 >(
9268 &mut payload,
9269 0x39c6e9001d102338,
9270 fidl::encoding::DynamicFlags::empty(),
9271 _decode,
9272 )
9273 }
9274
9275 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
9276 PeripheralAdvertiseResult,
9277 fidl::encoding::DefaultFuchsiaResourceDialect,
9278 >;
9279 fn r#advertise(
9280 &self,
9281 mut parameters: &AdvertisingParameters,
9282 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9283 ) -> Self::AdvertiseResponseFut {
9284 fn _decode(
9285 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9286 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9287 let _response = fidl::client::decode_transaction_body::<
9288 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9289 fidl::encoding::DefaultFuchsiaResourceDialect,
9290 0x2d9ec9260c32c17f,
9291 >(_buf?)?;
9292 Ok(_response.map(|x| x))
9293 }
9294 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
9295 (parameters, advertised_peripheral),
9296 0x2d9ec9260c32c17f,
9297 fidl::encoding::DynamicFlags::empty(),
9298 _decode,
9299 )
9300 }
9301
9302 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
9303 PeripheralStartAdvertisingResult,
9304 fidl::encoding::DefaultFuchsiaResourceDialect,
9305 >;
9306 fn r#start_advertising(
9307 &self,
9308 mut parameters: &AdvertisingParameters,
9309 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9310 ) -> Self::StartAdvertisingResponseFut {
9311 fn _decode(
9312 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9313 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9314 let _response = fidl::client::decode_transaction_body::<
9315 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9316 fidl::encoding::DefaultFuchsiaResourceDialect,
9317 0x5875c1c575f00f7d,
9318 >(_buf?)?;
9319 Ok(_response.map(|x| x))
9320 }
9321 self.client.send_query_and_decode::<
9322 PeripheralStartAdvertisingRequest,
9323 PeripheralStartAdvertisingResult,
9324 >(
9325 (parameters, handle,),
9326 0x5875c1c575f00f7d,
9327 fidl::encoding::DynamicFlags::empty(),
9328 _decode,
9329 )
9330 }
9331}
9332
9333pub struct PeripheralEventStream {
9334 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9335}
9336
9337impl std::marker::Unpin for PeripheralEventStream {}
9338
9339impl futures::stream::FusedStream for PeripheralEventStream {
9340 fn is_terminated(&self) -> bool {
9341 self.event_receiver.is_terminated()
9342 }
9343}
9344
9345impl futures::Stream for PeripheralEventStream {
9346 type Item = Result<PeripheralEvent, fidl::Error>;
9347
9348 fn poll_next(
9349 mut self: std::pin::Pin<&mut Self>,
9350 cx: &mut std::task::Context<'_>,
9351 ) -> std::task::Poll<Option<Self::Item>> {
9352 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9353 &mut self.event_receiver,
9354 cx
9355 )?) {
9356 Some(buf) => std::task::Poll::Ready(Some(PeripheralEvent::decode(buf))),
9357 None => std::task::Poll::Ready(None),
9358 }
9359 }
9360}
9361
9362#[derive(Debug)]
9363pub enum PeripheralEvent {
9364 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
9365}
9366
9367impl PeripheralEvent {
9368 #[allow(irrefutable_let_patterns)]
9369 pub fn into_on_peer_connected(
9370 self,
9371 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
9372 if let PeripheralEvent::OnPeerConnected { peer, connection } = self {
9373 Some((peer, connection))
9374 } else {
9375 None
9376 }
9377 }
9378
9379 fn decode(
9381 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9382 ) -> Result<PeripheralEvent, fidl::Error> {
9383 let (bytes, _handles) = buf.split_mut();
9384 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9385 debug_assert_eq!(tx_header.tx_id, 0);
9386 match tx_header.ordinal {
9387 0x16135d464299e356 => {
9388 let mut out = fidl::new_empty!(
9389 PeripheralOnPeerConnectedRequest,
9390 fidl::encoding::DefaultFuchsiaResourceDialect
9391 );
9392 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
9393 Ok((PeripheralEvent::OnPeerConnected {
9394 peer: out.peer,
9395 connection: out.connection,
9396 }))
9397 }
9398 _ => Err(fidl::Error::UnknownOrdinal {
9399 ordinal: tx_header.ordinal,
9400 protocol_name: <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9401 }),
9402 }
9403 }
9404}
9405
9406pub struct PeripheralRequestStream {
9408 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9409 is_terminated: bool,
9410}
9411
9412impl std::marker::Unpin for PeripheralRequestStream {}
9413
9414impl futures::stream::FusedStream for PeripheralRequestStream {
9415 fn is_terminated(&self) -> bool {
9416 self.is_terminated
9417 }
9418}
9419
9420impl fidl::endpoints::RequestStream for PeripheralRequestStream {
9421 type Protocol = PeripheralMarker;
9422 type ControlHandle = PeripheralControlHandle;
9423
9424 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9425 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9426 }
9427
9428 fn control_handle(&self) -> Self::ControlHandle {
9429 PeripheralControlHandle { inner: self.inner.clone() }
9430 }
9431
9432 fn into_inner(
9433 self,
9434 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9435 {
9436 (self.inner, self.is_terminated)
9437 }
9438
9439 fn from_inner(
9440 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9441 is_terminated: bool,
9442 ) -> Self {
9443 Self { inner, is_terminated }
9444 }
9445}
9446
9447impl futures::Stream for PeripheralRequestStream {
9448 type Item = Result<PeripheralRequest, fidl::Error>;
9449
9450 fn poll_next(
9451 mut self: std::pin::Pin<&mut Self>,
9452 cx: &mut std::task::Context<'_>,
9453 ) -> std::task::Poll<Option<Self::Item>> {
9454 let this = &mut *self;
9455 if this.inner.check_shutdown(cx) {
9456 this.is_terminated = true;
9457 return std::task::Poll::Ready(None);
9458 }
9459 if this.is_terminated {
9460 panic!("polled PeripheralRequestStream after completion");
9461 }
9462 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9463 |bytes, handles| {
9464 match this.inner.channel().read_etc(cx, bytes, handles) {
9465 std::task::Poll::Ready(Ok(())) => {}
9466 std::task::Poll::Pending => return std::task::Poll::Pending,
9467 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9468 this.is_terminated = true;
9469 return std::task::Poll::Ready(None);
9470 }
9471 std::task::Poll::Ready(Err(e)) => {
9472 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9473 e.into(),
9474 ))));
9475 }
9476 }
9477
9478 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9480
9481 std::task::Poll::Ready(Some(match header.ordinal {
9482 0x39c6e9001d102338 => {
9483 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9484 let mut req = fidl::new_empty!(
9485 ChannelListenerRegistryListenL2capRequest,
9486 fidl::encoding::DefaultFuchsiaResourceDialect
9487 );
9488 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
9489 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9490 Ok(PeripheralRequest::ListenL2cap {
9491 payload: req,
9492 responder: PeripheralListenL2capResponder {
9493 control_handle: std::mem::ManuallyDrop::new(control_handle),
9494 tx_id: header.tx_id,
9495 },
9496 })
9497 }
9498 0x2d9ec9260c32c17f => {
9499 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9500 let mut req = fidl::new_empty!(
9501 PeripheralAdvertiseRequest,
9502 fidl::encoding::DefaultFuchsiaResourceDialect
9503 );
9504 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
9505 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9506 Ok(PeripheralRequest::Advertise {
9507 parameters: req.parameters,
9508 advertised_peripheral: req.advertised_peripheral,
9509
9510 responder: PeripheralAdvertiseResponder {
9511 control_handle: std::mem::ManuallyDrop::new(control_handle),
9512 tx_id: header.tx_id,
9513 },
9514 })
9515 }
9516 0x5875c1c575f00f7d => {
9517 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9518 let mut req = fidl::new_empty!(
9519 PeripheralStartAdvertisingRequest,
9520 fidl::encoding::DefaultFuchsiaResourceDialect
9521 );
9522 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
9523 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9524 Ok(PeripheralRequest::StartAdvertising {
9525 parameters: req.parameters,
9526 handle: req.handle,
9527
9528 responder: PeripheralStartAdvertisingResponder {
9529 control_handle: std::mem::ManuallyDrop::new(control_handle),
9530 tx_id: header.tx_id,
9531 },
9532 })
9533 }
9534 _ => Err(fidl::Error::UnknownOrdinal {
9535 ordinal: header.ordinal,
9536 protocol_name:
9537 <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9538 }),
9539 }))
9540 },
9541 )
9542 }
9543}
9544
9545#[derive(Debug)]
9546pub enum PeripheralRequest {
9547 ListenL2cap {
9557 payload: ChannelListenerRegistryListenL2capRequest,
9558 responder: PeripheralListenL2capResponder,
9559 },
9560 Advertise {
9588 parameters: AdvertisingParameters,
9589 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9590 responder: PeripheralAdvertiseResponder,
9591 },
9592 StartAdvertising {
9613 parameters: AdvertisingParameters,
9614 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9615 responder: PeripheralStartAdvertisingResponder,
9616 },
9617}
9618
9619impl PeripheralRequest {
9620 #[allow(irrefutable_let_patterns)]
9621 pub fn into_listen_l2cap(
9622 self,
9623 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PeripheralListenL2capResponder)> {
9624 if let PeripheralRequest::ListenL2cap { payload, responder } = self {
9625 Some((payload, responder))
9626 } else {
9627 None
9628 }
9629 }
9630
9631 #[allow(irrefutable_let_patterns)]
9632 pub fn into_advertise(
9633 self,
9634 ) -> Option<(
9635 AdvertisingParameters,
9636 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9637 PeripheralAdvertiseResponder,
9638 )> {
9639 if let PeripheralRequest::Advertise { parameters, advertised_peripheral, responder } = self
9640 {
9641 Some((parameters, advertised_peripheral, responder))
9642 } else {
9643 None
9644 }
9645 }
9646
9647 #[allow(irrefutable_let_patterns)]
9648 pub fn into_start_advertising(
9649 self,
9650 ) -> Option<(
9651 AdvertisingParameters,
9652 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9653 PeripheralStartAdvertisingResponder,
9654 )> {
9655 if let PeripheralRequest::StartAdvertising { parameters, handle, responder } = self {
9656 Some((parameters, handle, responder))
9657 } else {
9658 None
9659 }
9660 }
9661
9662 pub fn method_name(&self) -> &'static str {
9664 match *self {
9665 PeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
9666 PeripheralRequest::Advertise { .. } => "advertise",
9667 PeripheralRequest::StartAdvertising { .. } => "start_advertising",
9668 }
9669 }
9670}
9671
9672#[derive(Debug, Clone)]
9673pub struct PeripheralControlHandle {
9674 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9675}
9676
9677impl fidl::endpoints::ControlHandle for PeripheralControlHandle {
9678 fn shutdown(&self) {
9679 self.inner.shutdown()
9680 }
9681
9682 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9683 self.inner.shutdown_with_epitaph(status)
9684 }
9685
9686 fn is_closed(&self) -> bool {
9687 self.inner.channel().is_closed()
9688 }
9689 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9690 self.inner.channel().on_closed()
9691 }
9692
9693 #[cfg(target_os = "fuchsia")]
9694 fn signal_peer(
9695 &self,
9696 clear_mask: zx::Signals,
9697 set_mask: zx::Signals,
9698 ) -> Result<(), zx_status::Status> {
9699 use fidl::Peered;
9700 self.inner.channel().signal_peer(clear_mask, set_mask)
9701 }
9702}
9703
9704impl PeripheralControlHandle {
9705 pub fn send_on_peer_connected(
9706 &self,
9707 mut peer: &Peer,
9708 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
9709 ) -> Result<(), fidl::Error> {
9710 self.inner.send::<PeripheralOnPeerConnectedRequest>(
9711 (peer, connection),
9712 0,
9713 0x16135d464299e356,
9714 fidl::encoding::DynamicFlags::empty(),
9715 )
9716 }
9717}
9718
9719#[must_use = "FIDL methods require a response to be sent"]
9720#[derive(Debug)]
9721pub struct PeripheralListenL2capResponder {
9722 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9723 tx_id: u32,
9724}
9725
9726impl std::ops::Drop for PeripheralListenL2capResponder {
9730 fn drop(&mut self) {
9731 self.control_handle.shutdown();
9732 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9734 }
9735}
9736
9737impl fidl::endpoints::Responder for PeripheralListenL2capResponder {
9738 type ControlHandle = PeripheralControlHandle;
9739
9740 fn control_handle(&self) -> &PeripheralControlHandle {
9741 &self.control_handle
9742 }
9743
9744 fn drop_without_shutdown(mut self) {
9745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9747 std::mem::forget(self);
9749 }
9750}
9751
9752impl PeripheralListenL2capResponder {
9753 pub fn send(
9757 self,
9758 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9759 ) -> Result<(), fidl::Error> {
9760 let _result = self.send_raw(result);
9761 if _result.is_err() {
9762 self.control_handle.shutdown();
9763 }
9764 self.drop_without_shutdown();
9765 _result
9766 }
9767
9768 pub fn send_no_shutdown_on_err(
9770 self,
9771 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9772 ) -> Result<(), fidl::Error> {
9773 let _result = self.send_raw(result);
9774 self.drop_without_shutdown();
9775 _result
9776 }
9777
9778 fn send_raw(
9779 &self,
9780 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9781 ) -> Result<(), fidl::Error> {
9782 self.control_handle.inner.send::<fidl::encoding::ResultType<
9783 ChannelListenerRegistryListenL2capResponse,
9784 i32,
9785 >>(
9786 result,
9787 self.tx_id,
9788 0x39c6e9001d102338,
9789 fidl::encoding::DynamicFlags::empty(),
9790 )
9791 }
9792}
9793
9794#[must_use = "FIDL methods require a response to be sent"]
9795#[derive(Debug)]
9796pub struct PeripheralAdvertiseResponder {
9797 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9798 tx_id: u32,
9799}
9800
9801impl std::ops::Drop for PeripheralAdvertiseResponder {
9805 fn drop(&mut self) {
9806 self.control_handle.shutdown();
9807 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9809 }
9810}
9811
9812impl fidl::endpoints::Responder for PeripheralAdvertiseResponder {
9813 type ControlHandle = PeripheralControlHandle;
9814
9815 fn control_handle(&self) -> &PeripheralControlHandle {
9816 &self.control_handle
9817 }
9818
9819 fn drop_without_shutdown(mut self) {
9820 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9822 std::mem::forget(self);
9824 }
9825}
9826
9827impl PeripheralAdvertiseResponder {
9828 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9832 let _result = self.send_raw(result);
9833 if _result.is_err() {
9834 self.control_handle.shutdown();
9835 }
9836 self.drop_without_shutdown();
9837 _result
9838 }
9839
9840 pub fn send_no_shutdown_on_err(
9842 self,
9843 mut result: Result<(), PeripheralError>,
9844 ) -> Result<(), fidl::Error> {
9845 let _result = self.send_raw(result);
9846 self.drop_without_shutdown();
9847 _result
9848 }
9849
9850 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9851 self.control_handle.inner.send::<fidl::encoding::ResultType<
9852 fidl::encoding::EmptyStruct,
9853 PeripheralError,
9854 >>(
9855 result,
9856 self.tx_id,
9857 0x2d9ec9260c32c17f,
9858 fidl::encoding::DynamicFlags::empty(),
9859 )
9860 }
9861}
9862
9863#[must_use = "FIDL methods require a response to be sent"]
9864#[derive(Debug)]
9865pub struct PeripheralStartAdvertisingResponder {
9866 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9867 tx_id: u32,
9868}
9869
9870impl std::ops::Drop for PeripheralStartAdvertisingResponder {
9874 fn drop(&mut self) {
9875 self.control_handle.shutdown();
9876 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9878 }
9879}
9880
9881impl fidl::endpoints::Responder for PeripheralStartAdvertisingResponder {
9882 type ControlHandle = PeripheralControlHandle;
9883
9884 fn control_handle(&self) -> &PeripheralControlHandle {
9885 &self.control_handle
9886 }
9887
9888 fn drop_without_shutdown(mut self) {
9889 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9891 std::mem::forget(self);
9893 }
9894}
9895
9896impl PeripheralStartAdvertisingResponder {
9897 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9901 let _result = self.send_raw(result);
9902 if _result.is_err() {
9903 self.control_handle.shutdown();
9904 }
9905 self.drop_without_shutdown();
9906 _result
9907 }
9908
9909 pub fn send_no_shutdown_on_err(
9911 self,
9912 mut result: Result<(), PeripheralError>,
9913 ) -> Result<(), fidl::Error> {
9914 let _result = self.send_raw(result);
9915 self.drop_without_shutdown();
9916 _result
9917 }
9918
9919 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9920 self.control_handle.inner.send::<fidl::encoding::ResultType<
9921 fidl::encoding::EmptyStruct,
9922 PeripheralError,
9923 >>(
9924 result,
9925 self.tx_id,
9926 0x5875c1c575f00f7d,
9927 fidl::encoding::DynamicFlags::empty(),
9928 )
9929 }
9930}
9931
9932#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9933pub struct PrivilegedCentralMarker;
9934
9935impl fidl::endpoints::ProtocolMarker for PrivilegedCentralMarker {
9936 type Proxy = PrivilegedCentralProxy;
9937 type RequestStream = PrivilegedCentralRequestStream;
9938 #[cfg(target_os = "fuchsia")]
9939 type SynchronousProxy = PrivilegedCentralSynchronousProxy;
9940
9941 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedCentral";
9942}
9943impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedCentralMarker {}
9944
9945pub trait PrivilegedCentralProxyInterface: Send + Sync {
9946 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
9947 + Send;
9948 fn r#listen_l2cap(
9949 &self,
9950 payload: ChannelListenerRegistryListenL2capRequest,
9951 ) -> Self::ListenL2capResponseFut;
9952 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9953 fn r#scan(
9954 &self,
9955 options: &ScanOptions,
9956 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
9957 ) -> Self::ScanResponseFut;
9958 fn r#connect(
9959 &self,
9960 id: &fidl_fuchsia_bluetooth::PeerId,
9961 options: &ConnectionOptions,
9962 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
9963 ) -> Result<(), fidl::Error>;
9964 fn r#sync_to_periodic_advertising(
9965 &self,
9966 payload: CentralSyncToPeriodicAdvertisingRequest,
9967 ) -> Result<(), fidl::Error>;
9968 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
9969 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
9970 > + Send;
9971 fn r#create_connected_isochronous_group(
9972 &self,
9973 payload: CentralCreateConnectedIsochronousGroupRequest,
9974 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
9975 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
9976 + Send;
9977 fn r#get_peripherals(
9978 &self,
9979 service_uuids: Option<&[String]>,
9980 ) -> Self::GetPeripheralsResponseFut;
9981 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
9982 + Send;
9983 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
9984 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9985 + Send;
9986 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
9987 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
9988 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9989 + Send;
9990 fn r#connect_peripheral(
9991 &self,
9992 identifier: &str,
9993 options: &ConnectionOptions,
9994 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9995 ) -> Self::ConnectPeripheralResponseFut;
9996 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9997 + Send;
9998 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
9999}
10000#[derive(Debug)]
10001#[cfg(target_os = "fuchsia")]
10002pub struct PrivilegedCentralSynchronousProxy {
10003 client: fidl::client::sync::Client,
10004}
10005
10006#[cfg(target_os = "fuchsia")]
10007impl fidl::endpoints::SynchronousProxy for PrivilegedCentralSynchronousProxy {
10008 type Proxy = PrivilegedCentralProxy;
10009 type Protocol = PrivilegedCentralMarker;
10010
10011 fn from_channel(inner: fidl::Channel) -> Self {
10012 Self::new(inner)
10013 }
10014
10015 fn into_channel(self) -> fidl::Channel {
10016 self.client.into_channel()
10017 }
10018
10019 fn as_channel(&self) -> &fidl::Channel {
10020 self.client.as_channel()
10021 }
10022}
10023
10024#[cfg(target_os = "fuchsia")]
10025impl PrivilegedCentralSynchronousProxy {
10026 pub fn new(channel: fidl::Channel) -> Self {
10027 Self { client: fidl::client::sync::Client::new(channel) }
10028 }
10029
10030 pub fn into_channel(self) -> fidl::Channel {
10031 self.client.into_channel()
10032 }
10033
10034 pub fn wait_for_event(
10037 &self,
10038 deadline: zx::MonotonicInstant,
10039 ) -> Result<PrivilegedCentralEvent, fidl::Error> {
10040 PrivilegedCentralEvent::decode(
10041 self.client.wait_for_event::<PrivilegedCentralMarker>(deadline)?,
10042 )
10043 }
10044
10045 pub fn r#listen_l2cap(
10055 &self,
10056 mut payload: ChannelListenerRegistryListenL2capRequest,
10057 ___deadline: zx::MonotonicInstant,
10058 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
10059 let _response = self.client.send_query::<
10060 ChannelListenerRegistryListenL2capRequest,
10061 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
10062 PrivilegedCentralMarker,
10063 >(
10064 &mut payload,
10065 0x39c6e9001d102338,
10066 fidl::encoding::DynamicFlags::empty(),
10067 ___deadline,
10068 )?;
10069 Ok(_response.map(|x| x))
10070 }
10071
10072 pub fn r#scan(
10099 &self,
10100 mut options: &ScanOptions,
10101 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10102 ___deadline: zx::MonotonicInstant,
10103 ) -> Result<(), fidl::Error> {
10104 let _response = self.client.send_query::<
10105 CentralScanRequest,
10106 fidl::encoding::EmptyPayload,
10107 PrivilegedCentralMarker,
10108 >(
10109 (options, result_watcher,),
10110 0x41f7121798dfe15f,
10111 fidl::encoding::DynamicFlags::empty(),
10112 ___deadline,
10113 )?;
10114 Ok(_response)
10115 }
10116
10117 pub fn r#connect(
10139 &self,
10140 mut id: &fidl_fuchsia_bluetooth::PeerId,
10141 mut options: &ConnectionOptions,
10142 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10143 ) -> Result<(), fidl::Error> {
10144 self.client.send::<CentralConnectRequest>(
10145 (id, options, handle),
10146 0x31a3065f2a6913c4,
10147 fidl::encoding::DynamicFlags::empty(),
10148 )
10149 }
10150
10151 pub fn r#sync_to_periodic_advertising(
10154 &self,
10155 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10156 ) -> Result<(), fidl::Error> {
10157 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
10158 &mut payload,
10159 0x1db6df126a00c5b9,
10160 fidl::encoding::DynamicFlags::empty(),
10161 )
10162 }
10163
10164 pub fn r#create_connected_isochronous_group(
10173 &self,
10174 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10175 ___deadline: zx::MonotonicInstant,
10176 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
10177 let _response = self
10178 .client
10179 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
10180 CentralCreateConnectedIsochronousGroupResponse,
10181 CreateCigError,
10182 >, PrivilegedCentralMarker>(
10183 &mut payload,
10184 0x60323e70ae22e13,
10185 fidl::encoding::DynamicFlags::empty(),
10186 ___deadline,
10187 )?;
10188 Ok(_response.map(|x| x))
10189 }
10190
10191 pub fn r#get_peripherals(
10197 &self,
10198 mut service_uuids: Option<&[String]>,
10199 ___deadline: zx::MonotonicInstant,
10200 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
10201 let _response = self.client.send_query::<
10202 CentralGetPeripheralsRequest,
10203 CentralGetPeripheralsResponse,
10204 PrivilegedCentralMarker,
10205 >(
10206 (service_uuids,),
10207 0x37ba777499c683a8,
10208 fidl::encoding::DynamicFlags::empty(),
10209 ___deadline,
10210 )?;
10211 Ok(_response.peripherals)
10212 }
10213
10214 pub fn r#get_peripheral(
10220 &self,
10221 mut identifier: &str,
10222 ___deadline: zx::MonotonicInstant,
10223 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
10224 let _response = self.client.send_query::<
10225 CentralGetPeripheralRequest,
10226 CentralGetPeripheralResponse,
10227 PrivilegedCentralMarker,
10228 >(
10229 (identifier,),
10230 0x97f5a2f2d9c13da,
10231 fidl::encoding::DynamicFlags::empty(),
10232 ___deadline,
10233 )?;
10234 Ok(_response.peripheral)
10235 }
10236
10237 pub fn r#start_scan(
10246 &self,
10247 mut filter: Option<&ScanFilter>,
10248 ___deadline: zx::MonotonicInstant,
10249 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10250 let _response = self.client.send_query::<
10251 CentralStartScanRequest,
10252 CentralStartScanResponse,
10253 PrivilegedCentralMarker,
10254 >(
10255 (filter,),
10256 0xeb4cf0cd0e1132b,
10257 fidl::encoding::DynamicFlags::empty(),
10258 ___deadline,
10259 )?;
10260 Ok(_response.status)
10261 }
10262
10263 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10265 self.client.send::<fidl::encoding::EmptyPayload>(
10266 (),
10267 0x5f79ee6a0bb037a0,
10268 fidl::encoding::DynamicFlags::empty(),
10269 )
10270 }
10271
10272 pub fn r#connect_peripheral(
10279 &self,
10280 mut identifier: &str,
10281 mut options: &ConnectionOptions,
10282 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10283 ___deadline: zx::MonotonicInstant,
10284 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10285 let _response = self.client.send_query::<
10286 CentralConnectPeripheralRequest,
10287 CentralConnectPeripheralResponse,
10288 PrivilegedCentralMarker,
10289 >(
10290 (identifier, options, gatt_client,),
10291 0x714d6c32d066d75a,
10292 fidl::encoding::DynamicFlags::empty(),
10293 ___deadline,
10294 )?;
10295 Ok(_response.status)
10296 }
10297
10298 pub fn r#disconnect_peripheral(
10300 &self,
10301 mut identifier: &str,
10302 ___deadline: zx::MonotonicInstant,
10303 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10304 let _response = self.client.send_query::<
10305 CentralDisconnectPeripheralRequest,
10306 CentralDisconnectPeripheralResponse,
10307 PrivilegedCentralMarker,
10308 >(
10309 (identifier,),
10310 0xa9430da197362fd,
10311 fidl::encoding::DynamicFlags::empty(),
10312 ___deadline,
10313 )?;
10314 Ok(_response.status)
10315 }
10316}
10317
10318#[cfg(target_os = "fuchsia")]
10319impl From<PrivilegedCentralSynchronousProxy> for zx::NullableHandle {
10320 fn from(value: PrivilegedCentralSynchronousProxy) -> Self {
10321 value.into_channel().into()
10322 }
10323}
10324
10325#[cfg(target_os = "fuchsia")]
10326impl From<fidl::Channel> for PrivilegedCentralSynchronousProxy {
10327 fn from(value: fidl::Channel) -> Self {
10328 Self::new(value)
10329 }
10330}
10331
10332#[cfg(target_os = "fuchsia")]
10333impl fidl::endpoints::FromClient for PrivilegedCentralSynchronousProxy {
10334 type Protocol = PrivilegedCentralMarker;
10335
10336 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedCentralMarker>) -> Self {
10337 Self::new(value.into_channel())
10338 }
10339}
10340
10341#[derive(Debug, Clone)]
10342pub struct PrivilegedCentralProxy {
10343 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10344}
10345
10346impl fidl::endpoints::Proxy for PrivilegedCentralProxy {
10347 type Protocol = PrivilegedCentralMarker;
10348
10349 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10350 Self::new(inner)
10351 }
10352
10353 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10354 self.client.into_channel().map_err(|client| Self { client })
10355 }
10356
10357 fn as_channel(&self) -> &::fidl::AsyncChannel {
10358 self.client.as_channel()
10359 }
10360}
10361
10362impl PrivilegedCentralProxy {
10363 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10365 let protocol_name =
10366 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10367 Self { client: fidl::client::Client::new(channel, protocol_name) }
10368 }
10369
10370 pub fn take_event_stream(&self) -> PrivilegedCentralEventStream {
10376 PrivilegedCentralEventStream { event_receiver: self.client.take_event_receiver() }
10377 }
10378
10379 pub fn r#listen_l2cap(
10389 &self,
10390 mut payload: ChannelListenerRegistryListenL2capRequest,
10391 ) -> fidl::client::QueryResponseFut<
10392 ChannelListenerRegistryListenL2capResult,
10393 fidl::encoding::DefaultFuchsiaResourceDialect,
10394 > {
10395 PrivilegedCentralProxyInterface::r#listen_l2cap(self, payload)
10396 }
10397
10398 pub fn r#scan(
10425 &self,
10426 mut options: &ScanOptions,
10427 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10428 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10429 PrivilegedCentralProxyInterface::r#scan(self, options, result_watcher)
10430 }
10431
10432 pub fn r#connect(
10454 &self,
10455 mut id: &fidl_fuchsia_bluetooth::PeerId,
10456 mut options: &ConnectionOptions,
10457 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10458 ) -> Result<(), fidl::Error> {
10459 PrivilegedCentralProxyInterface::r#connect(self, id, options, handle)
10460 }
10461
10462 pub fn r#sync_to_periodic_advertising(
10465 &self,
10466 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10467 ) -> Result<(), fidl::Error> {
10468 PrivilegedCentralProxyInterface::r#sync_to_periodic_advertising(self, payload)
10469 }
10470
10471 pub fn r#create_connected_isochronous_group(
10480 &self,
10481 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10482 ) -> fidl::client::QueryResponseFut<
10483 CentralCreateConnectedIsochronousGroupResult,
10484 fidl::encoding::DefaultFuchsiaResourceDialect,
10485 > {
10486 PrivilegedCentralProxyInterface::r#create_connected_isochronous_group(self, payload)
10487 }
10488
10489 pub fn r#get_peripherals(
10495 &self,
10496 mut service_uuids: Option<&[String]>,
10497 ) -> fidl::client::QueryResponseFut<
10498 Vec<RemoteDevice>,
10499 fidl::encoding::DefaultFuchsiaResourceDialect,
10500 > {
10501 PrivilegedCentralProxyInterface::r#get_peripherals(self, service_uuids)
10502 }
10503
10504 pub fn r#get_peripheral(
10510 &self,
10511 mut identifier: &str,
10512 ) -> fidl::client::QueryResponseFut<
10513 Option<Box<RemoteDevice>>,
10514 fidl::encoding::DefaultFuchsiaResourceDialect,
10515 > {
10516 PrivilegedCentralProxyInterface::r#get_peripheral(self, identifier)
10517 }
10518
10519 pub fn r#start_scan(
10528 &self,
10529 mut filter: Option<&ScanFilter>,
10530 ) -> fidl::client::QueryResponseFut<
10531 fidl_fuchsia_bluetooth::Status,
10532 fidl::encoding::DefaultFuchsiaResourceDialect,
10533 > {
10534 PrivilegedCentralProxyInterface::r#start_scan(self, filter)
10535 }
10536
10537 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10539 PrivilegedCentralProxyInterface::r#stop_scan(self)
10540 }
10541
10542 pub fn r#connect_peripheral(
10549 &self,
10550 mut identifier: &str,
10551 mut options: &ConnectionOptions,
10552 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10553 ) -> fidl::client::QueryResponseFut<
10554 fidl_fuchsia_bluetooth::Status,
10555 fidl::encoding::DefaultFuchsiaResourceDialect,
10556 > {
10557 PrivilegedCentralProxyInterface::r#connect_peripheral(
10558 self,
10559 identifier,
10560 options,
10561 gatt_client,
10562 )
10563 }
10564
10565 pub fn r#disconnect_peripheral(
10567 &self,
10568 mut identifier: &str,
10569 ) -> fidl::client::QueryResponseFut<
10570 fidl_fuchsia_bluetooth::Status,
10571 fidl::encoding::DefaultFuchsiaResourceDialect,
10572 > {
10573 PrivilegedCentralProxyInterface::r#disconnect_peripheral(self, identifier)
10574 }
10575}
10576
10577impl PrivilegedCentralProxyInterface for PrivilegedCentralProxy {
10578 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
10579 ChannelListenerRegistryListenL2capResult,
10580 fidl::encoding::DefaultFuchsiaResourceDialect,
10581 >;
10582 fn r#listen_l2cap(
10583 &self,
10584 mut payload: ChannelListenerRegistryListenL2capRequest,
10585 ) -> Self::ListenL2capResponseFut {
10586 fn _decode(
10587 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10588 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
10589 let _response = fidl::client::decode_transaction_body::<
10590 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
10591 fidl::encoding::DefaultFuchsiaResourceDialect,
10592 0x39c6e9001d102338,
10593 >(_buf?)?;
10594 Ok(_response.map(|x| x))
10595 }
10596 self.client.send_query_and_decode::<
10597 ChannelListenerRegistryListenL2capRequest,
10598 ChannelListenerRegistryListenL2capResult,
10599 >(
10600 &mut payload,
10601 0x39c6e9001d102338,
10602 fidl::encoding::DynamicFlags::empty(),
10603 _decode,
10604 )
10605 }
10606
10607 type ScanResponseFut =
10608 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10609 fn r#scan(
10610 &self,
10611 mut options: &ScanOptions,
10612 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10613 ) -> Self::ScanResponseFut {
10614 fn _decode(
10615 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10616 ) -> Result<(), fidl::Error> {
10617 let _response = fidl::client::decode_transaction_body::<
10618 fidl::encoding::EmptyPayload,
10619 fidl::encoding::DefaultFuchsiaResourceDialect,
10620 0x41f7121798dfe15f,
10621 >(_buf?)?;
10622 Ok(_response)
10623 }
10624 self.client.send_query_and_decode::<CentralScanRequest, ()>(
10625 (options, result_watcher),
10626 0x41f7121798dfe15f,
10627 fidl::encoding::DynamicFlags::empty(),
10628 _decode,
10629 )
10630 }
10631
10632 fn r#connect(
10633 &self,
10634 mut id: &fidl_fuchsia_bluetooth::PeerId,
10635 mut options: &ConnectionOptions,
10636 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10637 ) -> Result<(), fidl::Error> {
10638 self.client.send::<CentralConnectRequest>(
10639 (id, options, handle),
10640 0x31a3065f2a6913c4,
10641 fidl::encoding::DynamicFlags::empty(),
10642 )
10643 }
10644
10645 fn r#sync_to_periodic_advertising(
10646 &self,
10647 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10648 ) -> Result<(), fidl::Error> {
10649 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
10650 &mut payload,
10651 0x1db6df126a00c5b9,
10652 fidl::encoding::DynamicFlags::empty(),
10653 )
10654 }
10655
10656 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
10657 CentralCreateConnectedIsochronousGroupResult,
10658 fidl::encoding::DefaultFuchsiaResourceDialect,
10659 >;
10660 fn r#create_connected_isochronous_group(
10661 &self,
10662 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10663 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
10664 fn _decode(
10665 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10666 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
10667 let _response = fidl::client::decode_transaction_body::<
10668 fidl::encoding::ResultType<
10669 CentralCreateConnectedIsochronousGroupResponse,
10670 CreateCigError,
10671 >,
10672 fidl::encoding::DefaultFuchsiaResourceDialect,
10673 0x60323e70ae22e13,
10674 >(_buf?)?;
10675 Ok(_response.map(|x| x))
10676 }
10677 self.client.send_query_and_decode::<
10678 CentralCreateConnectedIsochronousGroupRequest,
10679 CentralCreateConnectedIsochronousGroupResult,
10680 >(
10681 &mut payload,
10682 0x60323e70ae22e13,
10683 fidl::encoding::DynamicFlags::empty(),
10684 _decode,
10685 )
10686 }
10687
10688 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
10689 Vec<RemoteDevice>,
10690 fidl::encoding::DefaultFuchsiaResourceDialect,
10691 >;
10692 fn r#get_peripherals(
10693 &self,
10694 mut service_uuids: Option<&[String]>,
10695 ) -> Self::GetPeripheralsResponseFut {
10696 fn _decode(
10697 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10698 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
10699 let _response = fidl::client::decode_transaction_body::<
10700 CentralGetPeripheralsResponse,
10701 fidl::encoding::DefaultFuchsiaResourceDialect,
10702 0x37ba777499c683a8,
10703 >(_buf?)?;
10704 Ok(_response.peripherals)
10705 }
10706 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
10707 (service_uuids,),
10708 0x37ba777499c683a8,
10709 fidl::encoding::DynamicFlags::empty(),
10710 _decode,
10711 )
10712 }
10713
10714 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
10715 Option<Box<RemoteDevice>>,
10716 fidl::encoding::DefaultFuchsiaResourceDialect,
10717 >;
10718 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
10719 fn _decode(
10720 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10721 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
10722 let _response = fidl::client::decode_transaction_body::<
10723 CentralGetPeripheralResponse,
10724 fidl::encoding::DefaultFuchsiaResourceDialect,
10725 0x97f5a2f2d9c13da,
10726 >(_buf?)?;
10727 Ok(_response.peripheral)
10728 }
10729 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
10730 (identifier,),
10731 0x97f5a2f2d9c13da,
10732 fidl::encoding::DynamicFlags::empty(),
10733 _decode,
10734 )
10735 }
10736
10737 type StartScanResponseFut = fidl::client::QueryResponseFut<
10738 fidl_fuchsia_bluetooth::Status,
10739 fidl::encoding::DefaultFuchsiaResourceDialect,
10740 >;
10741 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
10742 fn _decode(
10743 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10744 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10745 let _response = fidl::client::decode_transaction_body::<
10746 CentralStartScanResponse,
10747 fidl::encoding::DefaultFuchsiaResourceDialect,
10748 0xeb4cf0cd0e1132b,
10749 >(_buf?)?;
10750 Ok(_response.status)
10751 }
10752 self.client
10753 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
10754 (filter,),
10755 0xeb4cf0cd0e1132b,
10756 fidl::encoding::DynamicFlags::empty(),
10757 _decode,
10758 )
10759 }
10760
10761 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10762 self.client.send::<fidl::encoding::EmptyPayload>(
10763 (),
10764 0x5f79ee6a0bb037a0,
10765 fidl::encoding::DynamicFlags::empty(),
10766 )
10767 }
10768
10769 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
10770 fidl_fuchsia_bluetooth::Status,
10771 fidl::encoding::DefaultFuchsiaResourceDialect,
10772 >;
10773 fn r#connect_peripheral(
10774 &self,
10775 mut identifier: &str,
10776 mut options: &ConnectionOptions,
10777 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10778 ) -> Self::ConnectPeripheralResponseFut {
10779 fn _decode(
10780 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10781 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10782 let _response = fidl::client::decode_transaction_body::<
10783 CentralConnectPeripheralResponse,
10784 fidl::encoding::DefaultFuchsiaResourceDialect,
10785 0x714d6c32d066d75a,
10786 >(_buf?)?;
10787 Ok(_response.status)
10788 }
10789 self.client.send_query_and_decode::<
10790 CentralConnectPeripheralRequest,
10791 fidl_fuchsia_bluetooth::Status,
10792 >(
10793 (identifier, options, gatt_client,),
10794 0x714d6c32d066d75a,
10795 fidl::encoding::DynamicFlags::empty(),
10796 _decode,
10797 )
10798 }
10799
10800 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
10801 fidl_fuchsia_bluetooth::Status,
10802 fidl::encoding::DefaultFuchsiaResourceDialect,
10803 >;
10804 fn r#disconnect_peripheral(
10805 &self,
10806 mut identifier: &str,
10807 ) -> Self::DisconnectPeripheralResponseFut {
10808 fn _decode(
10809 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10810 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10811 let _response = fidl::client::decode_transaction_body::<
10812 CentralDisconnectPeripheralResponse,
10813 fidl::encoding::DefaultFuchsiaResourceDialect,
10814 0xa9430da197362fd,
10815 >(_buf?)?;
10816 Ok(_response.status)
10817 }
10818 self.client.send_query_and_decode::<
10819 CentralDisconnectPeripheralRequest,
10820 fidl_fuchsia_bluetooth::Status,
10821 >(
10822 (identifier,),
10823 0xa9430da197362fd,
10824 fidl::encoding::DynamicFlags::empty(),
10825 _decode,
10826 )
10827 }
10828}
10829
10830pub struct PrivilegedCentralEventStream {
10831 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10832}
10833
10834impl std::marker::Unpin for PrivilegedCentralEventStream {}
10835
10836impl futures::stream::FusedStream for PrivilegedCentralEventStream {
10837 fn is_terminated(&self) -> bool {
10838 self.event_receiver.is_terminated()
10839 }
10840}
10841
10842impl futures::Stream for PrivilegedCentralEventStream {
10843 type Item = Result<PrivilegedCentralEvent, fidl::Error>;
10844
10845 fn poll_next(
10846 mut self: std::pin::Pin<&mut Self>,
10847 cx: &mut std::task::Context<'_>,
10848 ) -> std::task::Poll<Option<Self::Item>> {
10849 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10850 &mut self.event_receiver,
10851 cx
10852 )?) {
10853 Some(buf) => std::task::Poll::Ready(Some(PrivilegedCentralEvent::decode(buf))),
10854 None => std::task::Poll::Ready(None),
10855 }
10856 }
10857}
10858
10859#[derive(Debug)]
10860pub enum PrivilegedCentralEvent {
10861 OnScanStateChanged { scanning: bool },
10862 OnDeviceDiscovered { device: RemoteDevice },
10863 OnPeripheralDisconnected { identifier: String },
10864}
10865
10866impl PrivilegedCentralEvent {
10867 #[allow(irrefutable_let_patterns)]
10868 pub fn into_on_scan_state_changed(self) -> Option<bool> {
10869 if let PrivilegedCentralEvent::OnScanStateChanged { scanning } = self {
10870 Some((scanning))
10871 } else {
10872 None
10873 }
10874 }
10875 #[allow(irrefutable_let_patterns)]
10876 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
10877 if let PrivilegedCentralEvent::OnDeviceDiscovered { device } = self {
10878 Some((device))
10879 } else {
10880 None
10881 }
10882 }
10883 #[allow(irrefutable_let_patterns)]
10884 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
10885 if let PrivilegedCentralEvent::OnPeripheralDisconnected { identifier } = self {
10886 Some((identifier))
10887 } else {
10888 None
10889 }
10890 }
10891
10892 fn decode(
10894 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10895 ) -> Result<PrivilegedCentralEvent, fidl::Error> {
10896 let (bytes, _handles) = buf.split_mut();
10897 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10898 debug_assert_eq!(tx_header.tx_id, 0);
10899 match tx_header.ordinal {
10900 0x5f8edc23cad04d3f => {
10901 let mut out = fidl::new_empty!(
10902 CentralOnScanStateChangedRequest,
10903 fidl::encoding::DefaultFuchsiaResourceDialect
10904 );
10905 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10906 Ok((PrivilegedCentralEvent::OnScanStateChanged { scanning: out.scanning }))
10907 }
10908 0x708dadf20d66db6 => {
10909 let mut out = fidl::new_empty!(
10910 CentralOnDeviceDiscoveredRequest,
10911 fidl::encoding::DefaultFuchsiaResourceDialect
10912 );
10913 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10914 Ok((PrivilegedCentralEvent::OnDeviceDiscovered { device: out.device }))
10915 }
10916 0x4e4c6b979b2126df => {
10917 let mut out = fidl::new_empty!(
10918 CentralOnPeripheralDisconnectedRequest,
10919 fidl::encoding::DefaultFuchsiaResourceDialect
10920 );
10921 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10922 Ok((PrivilegedCentralEvent::OnPeripheralDisconnected {
10923 identifier: out.identifier,
10924 }))
10925 }
10926 _ => Err(fidl::Error::UnknownOrdinal {
10927 ordinal: tx_header.ordinal,
10928 protocol_name:
10929 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10930 }),
10931 }
10932 }
10933}
10934
10935pub struct PrivilegedCentralRequestStream {
10937 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10938 is_terminated: bool,
10939}
10940
10941impl std::marker::Unpin for PrivilegedCentralRequestStream {}
10942
10943impl futures::stream::FusedStream for PrivilegedCentralRequestStream {
10944 fn is_terminated(&self) -> bool {
10945 self.is_terminated
10946 }
10947}
10948
10949impl fidl::endpoints::RequestStream for PrivilegedCentralRequestStream {
10950 type Protocol = PrivilegedCentralMarker;
10951 type ControlHandle = PrivilegedCentralControlHandle;
10952
10953 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10954 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10955 }
10956
10957 fn control_handle(&self) -> Self::ControlHandle {
10958 PrivilegedCentralControlHandle { inner: self.inner.clone() }
10959 }
10960
10961 fn into_inner(
10962 self,
10963 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10964 {
10965 (self.inner, self.is_terminated)
10966 }
10967
10968 fn from_inner(
10969 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10970 is_terminated: bool,
10971 ) -> Self {
10972 Self { inner, is_terminated }
10973 }
10974}
10975
10976impl futures::Stream for PrivilegedCentralRequestStream {
10977 type Item = Result<PrivilegedCentralRequest, fidl::Error>;
10978
10979 fn poll_next(
10980 mut self: std::pin::Pin<&mut Self>,
10981 cx: &mut std::task::Context<'_>,
10982 ) -> std::task::Poll<Option<Self::Item>> {
10983 let this = &mut *self;
10984 if this.inner.check_shutdown(cx) {
10985 this.is_terminated = true;
10986 return std::task::Poll::Ready(None);
10987 }
10988 if this.is_terminated {
10989 panic!("polled PrivilegedCentralRequestStream after completion");
10990 }
10991 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10992 |bytes, handles| {
10993 match this.inner.channel().read_etc(cx, bytes, handles) {
10994 std::task::Poll::Ready(Ok(())) => {}
10995 std::task::Poll::Pending => return std::task::Poll::Pending,
10996 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10997 this.is_terminated = true;
10998 return std::task::Poll::Ready(None);
10999 }
11000 std::task::Poll::Ready(Err(e)) => {
11001 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11002 e.into(),
11003 ))));
11004 }
11005 }
11006
11007 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11009
11010 std::task::Poll::Ready(Some(match header.ordinal {
11011 0x39c6e9001d102338 => {
11012 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11013 let mut req = fidl::new_empty!(
11014 ChannelListenerRegistryListenL2capRequest,
11015 fidl::encoding::DefaultFuchsiaResourceDialect
11016 );
11017 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
11018 let control_handle =
11019 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11020 Ok(PrivilegedCentralRequest::ListenL2cap {
11021 payload: req,
11022 responder: PrivilegedCentralListenL2capResponder {
11023 control_handle: std::mem::ManuallyDrop::new(control_handle),
11024 tx_id: header.tx_id,
11025 },
11026 })
11027 }
11028 0x41f7121798dfe15f => {
11029 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11030 let mut req = fidl::new_empty!(
11031 CentralScanRequest,
11032 fidl::encoding::DefaultFuchsiaResourceDialect
11033 );
11034 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
11035 let control_handle =
11036 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11037 Ok(PrivilegedCentralRequest::Scan {
11038 options: req.options,
11039 result_watcher: req.result_watcher,
11040
11041 responder: PrivilegedCentralScanResponder {
11042 control_handle: std::mem::ManuallyDrop::new(control_handle),
11043 tx_id: header.tx_id,
11044 },
11045 })
11046 }
11047 0x31a3065f2a6913c4 => {
11048 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11049 let mut req = fidl::new_empty!(
11050 CentralConnectRequest,
11051 fidl::encoding::DefaultFuchsiaResourceDialect
11052 );
11053 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
11054 let control_handle =
11055 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11056 Ok(PrivilegedCentralRequest::Connect {
11057 id: req.id,
11058 options: req.options,
11059 handle: req.handle,
11060
11061 control_handle,
11062 })
11063 }
11064 0x1db6df126a00c5b9 => {
11065 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11066 let mut req = fidl::new_empty!(
11067 CentralSyncToPeriodicAdvertisingRequest,
11068 fidl::encoding::DefaultFuchsiaResourceDialect
11069 );
11070 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralSyncToPeriodicAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
11071 let control_handle =
11072 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11073 Ok(PrivilegedCentralRequest::SyncToPeriodicAdvertising {
11074 payload: req,
11075 control_handle,
11076 })
11077 }
11078 0x60323e70ae22e13 => {
11079 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11080 let mut req = fidl::new_empty!(
11081 CentralCreateConnectedIsochronousGroupRequest,
11082 fidl::encoding::DefaultFuchsiaResourceDialect
11083 );
11084 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
11085 let control_handle =
11086 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11087 Ok(PrivilegedCentralRequest::CreateConnectedIsochronousGroup {
11088 payload: req,
11089 responder: PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11090 control_handle: std::mem::ManuallyDrop::new(control_handle),
11091 tx_id: header.tx_id,
11092 },
11093 })
11094 }
11095 0x37ba777499c683a8 => {
11096 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11097 let mut req = fidl::new_empty!(
11098 CentralGetPeripheralsRequest,
11099 fidl::encoding::DefaultFuchsiaResourceDialect
11100 );
11101 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
11102 let control_handle =
11103 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11104 Ok(PrivilegedCentralRequest::GetPeripherals {
11105 service_uuids: req.service_uuids,
11106
11107 responder: PrivilegedCentralGetPeripheralsResponder {
11108 control_handle: std::mem::ManuallyDrop::new(control_handle),
11109 tx_id: header.tx_id,
11110 },
11111 })
11112 }
11113 0x97f5a2f2d9c13da => {
11114 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11115 let mut req = fidl::new_empty!(
11116 CentralGetPeripheralRequest,
11117 fidl::encoding::DefaultFuchsiaResourceDialect
11118 );
11119 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11120 let control_handle =
11121 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11122 Ok(PrivilegedCentralRequest::GetPeripheral {
11123 identifier: req.identifier,
11124
11125 responder: PrivilegedCentralGetPeripheralResponder {
11126 control_handle: std::mem::ManuallyDrop::new(control_handle),
11127 tx_id: header.tx_id,
11128 },
11129 })
11130 }
11131 0xeb4cf0cd0e1132b => {
11132 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11133 let mut req = fidl::new_empty!(
11134 CentralStartScanRequest,
11135 fidl::encoding::DefaultFuchsiaResourceDialect
11136 );
11137 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
11138 let control_handle =
11139 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11140 Ok(PrivilegedCentralRequest::StartScan {
11141 filter: req.filter,
11142
11143 responder: PrivilegedCentralStartScanResponder {
11144 control_handle: std::mem::ManuallyDrop::new(control_handle),
11145 tx_id: header.tx_id,
11146 },
11147 })
11148 }
11149 0x5f79ee6a0bb037a0 => {
11150 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11151 let mut req = fidl::new_empty!(
11152 fidl::encoding::EmptyPayload,
11153 fidl::encoding::DefaultFuchsiaResourceDialect
11154 );
11155 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11156 let control_handle =
11157 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11158 Ok(PrivilegedCentralRequest::StopScan { control_handle })
11159 }
11160 0x714d6c32d066d75a => {
11161 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11162 let mut req = fidl::new_empty!(
11163 CentralConnectPeripheralRequest,
11164 fidl::encoding::DefaultFuchsiaResourceDialect
11165 );
11166 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11167 let control_handle =
11168 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11169 Ok(PrivilegedCentralRequest::ConnectPeripheral {
11170 identifier: req.identifier,
11171 options: req.options,
11172 gatt_client: req.gatt_client,
11173
11174 responder: PrivilegedCentralConnectPeripheralResponder {
11175 control_handle: std::mem::ManuallyDrop::new(control_handle),
11176 tx_id: header.tx_id,
11177 },
11178 })
11179 }
11180 0xa9430da197362fd => {
11181 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11182 let mut req = fidl::new_empty!(
11183 CentralDisconnectPeripheralRequest,
11184 fidl::encoding::DefaultFuchsiaResourceDialect
11185 );
11186 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11187 let control_handle =
11188 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11189 Ok(PrivilegedCentralRequest::DisconnectPeripheral {
11190 identifier: req.identifier,
11191
11192 responder: PrivilegedCentralDisconnectPeripheralResponder {
11193 control_handle: std::mem::ManuallyDrop::new(control_handle),
11194 tx_id: header.tx_id,
11195 },
11196 })
11197 }
11198 _ => Err(fidl::Error::UnknownOrdinal {
11199 ordinal: header.ordinal,
11200 protocol_name:
11201 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11202 }),
11203 }))
11204 },
11205 )
11206 }
11207}
11208
11209#[derive(Debug)]
11213pub enum PrivilegedCentralRequest {
11214 ListenL2cap {
11224 payload: ChannelListenerRegistryListenL2capRequest,
11225 responder: PrivilegedCentralListenL2capResponder,
11226 },
11227 Scan {
11254 options: ScanOptions,
11255 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
11256 responder: PrivilegedCentralScanResponder,
11257 },
11258 Connect {
11280 id: fidl_fuchsia_bluetooth::PeerId,
11281 options: ConnectionOptions,
11282 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
11283 control_handle: PrivilegedCentralControlHandle,
11284 },
11285 SyncToPeriodicAdvertising {
11288 payload: CentralSyncToPeriodicAdvertisingRequest,
11289 control_handle: PrivilegedCentralControlHandle,
11290 },
11291 CreateConnectedIsochronousGroup {
11300 payload: CentralCreateConnectedIsochronousGroupRequest,
11301 responder: PrivilegedCentralCreateConnectedIsochronousGroupResponder,
11302 },
11303 GetPeripherals {
11309 service_uuids: Option<Vec<String>>,
11310 responder: PrivilegedCentralGetPeripheralsResponder,
11311 },
11312 GetPeripheral { identifier: String, responder: PrivilegedCentralGetPeripheralResponder },
11318 StartScan { filter: Option<Box<ScanFilter>>, responder: PrivilegedCentralStartScanResponder },
11327 StopScan { control_handle: PrivilegedCentralControlHandle },
11329 ConnectPeripheral {
11336 identifier: String,
11337 options: ConnectionOptions,
11338 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
11339 responder: PrivilegedCentralConnectPeripheralResponder,
11340 },
11341 DisconnectPeripheral {
11343 identifier: String,
11344 responder: PrivilegedCentralDisconnectPeripheralResponder,
11345 },
11346}
11347
11348impl PrivilegedCentralRequest {
11349 #[allow(irrefutable_let_patterns)]
11350 pub fn into_listen_l2cap(
11351 self,
11352 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedCentralListenL2capResponder)>
11353 {
11354 if let PrivilegedCentralRequest::ListenL2cap { payload, responder } = self {
11355 Some((payload, responder))
11356 } else {
11357 None
11358 }
11359 }
11360
11361 #[allow(irrefutable_let_patterns)]
11362 pub fn into_scan(
11363 self,
11364 ) -> Option<(
11365 ScanOptions,
11366 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
11367 PrivilegedCentralScanResponder,
11368 )> {
11369 if let PrivilegedCentralRequest::Scan { options, result_watcher, responder } = self {
11370 Some((options, result_watcher, responder))
11371 } else {
11372 None
11373 }
11374 }
11375
11376 #[allow(irrefutable_let_patterns)]
11377 pub fn into_connect(
11378 self,
11379 ) -> Option<(
11380 fidl_fuchsia_bluetooth::PeerId,
11381 ConnectionOptions,
11382 fidl::endpoints::ServerEnd<ConnectionMarker>,
11383 PrivilegedCentralControlHandle,
11384 )> {
11385 if let PrivilegedCentralRequest::Connect { id, options, handle, control_handle } = self {
11386 Some((id, options, handle, control_handle))
11387 } else {
11388 None
11389 }
11390 }
11391
11392 #[allow(irrefutable_let_patterns)]
11393 pub fn into_sync_to_periodic_advertising(
11394 self,
11395 ) -> Option<(CentralSyncToPeriodicAdvertisingRequest, PrivilegedCentralControlHandle)> {
11396 if let PrivilegedCentralRequest::SyncToPeriodicAdvertising { payload, control_handle } =
11397 self
11398 {
11399 Some((payload, control_handle))
11400 } else {
11401 None
11402 }
11403 }
11404
11405 #[allow(irrefutable_let_patterns)]
11406 pub fn into_create_connected_isochronous_group(
11407 self,
11408 ) -> Option<(
11409 CentralCreateConnectedIsochronousGroupRequest,
11410 PrivilegedCentralCreateConnectedIsochronousGroupResponder,
11411 )> {
11412 if let PrivilegedCentralRequest::CreateConnectedIsochronousGroup { payload, responder } =
11413 self
11414 {
11415 Some((payload, responder))
11416 } else {
11417 None
11418 }
11419 }
11420
11421 #[allow(irrefutable_let_patterns)]
11422 pub fn into_get_peripherals(
11423 self,
11424 ) -> Option<(Option<Vec<String>>, PrivilegedCentralGetPeripheralsResponder)> {
11425 if let PrivilegedCentralRequest::GetPeripherals { service_uuids, responder } = self {
11426 Some((service_uuids, responder))
11427 } else {
11428 None
11429 }
11430 }
11431
11432 #[allow(irrefutable_let_patterns)]
11433 pub fn into_get_peripheral(self) -> Option<(String, PrivilegedCentralGetPeripheralResponder)> {
11434 if let PrivilegedCentralRequest::GetPeripheral { identifier, responder } = self {
11435 Some((identifier, responder))
11436 } else {
11437 None
11438 }
11439 }
11440
11441 #[allow(irrefutable_let_patterns)]
11442 pub fn into_start_scan(
11443 self,
11444 ) -> Option<(Option<Box<ScanFilter>>, PrivilegedCentralStartScanResponder)> {
11445 if let PrivilegedCentralRequest::StartScan { filter, responder } = self {
11446 Some((filter, responder))
11447 } else {
11448 None
11449 }
11450 }
11451
11452 #[allow(irrefutable_let_patterns)]
11453 pub fn into_stop_scan(self) -> Option<(PrivilegedCentralControlHandle)> {
11454 if let PrivilegedCentralRequest::StopScan { control_handle } = self {
11455 Some((control_handle))
11456 } else {
11457 None
11458 }
11459 }
11460
11461 #[allow(irrefutable_let_patterns)]
11462 pub fn into_connect_peripheral(
11463 self,
11464 ) -> Option<(
11465 String,
11466 ConnectionOptions,
11467 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
11468 PrivilegedCentralConnectPeripheralResponder,
11469 )> {
11470 if let PrivilegedCentralRequest::ConnectPeripheral {
11471 identifier,
11472 options,
11473 gatt_client,
11474 responder,
11475 } = self
11476 {
11477 Some((identifier, options, gatt_client, responder))
11478 } else {
11479 None
11480 }
11481 }
11482
11483 #[allow(irrefutable_let_patterns)]
11484 pub fn into_disconnect_peripheral(
11485 self,
11486 ) -> Option<(String, PrivilegedCentralDisconnectPeripheralResponder)> {
11487 if let PrivilegedCentralRequest::DisconnectPeripheral { identifier, responder } = self {
11488 Some((identifier, responder))
11489 } else {
11490 None
11491 }
11492 }
11493
11494 pub fn method_name(&self) -> &'static str {
11496 match *self {
11497 PrivilegedCentralRequest::ListenL2cap { .. } => "listen_l2cap",
11498 PrivilegedCentralRequest::Scan { .. } => "scan",
11499 PrivilegedCentralRequest::Connect { .. } => "connect",
11500 PrivilegedCentralRequest::SyncToPeriodicAdvertising { .. } => {
11501 "sync_to_periodic_advertising"
11502 }
11503 PrivilegedCentralRequest::CreateConnectedIsochronousGroup { .. } => {
11504 "create_connected_isochronous_group"
11505 }
11506 PrivilegedCentralRequest::GetPeripherals { .. } => "get_peripherals",
11507 PrivilegedCentralRequest::GetPeripheral { .. } => "get_peripheral",
11508 PrivilegedCentralRequest::StartScan { .. } => "start_scan",
11509 PrivilegedCentralRequest::StopScan { .. } => "stop_scan",
11510 PrivilegedCentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
11511 PrivilegedCentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
11512 }
11513 }
11514}
11515
11516#[derive(Debug, Clone)]
11517pub struct PrivilegedCentralControlHandle {
11518 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11519}
11520
11521impl fidl::endpoints::ControlHandle for PrivilegedCentralControlHandle {
11522 fn shutdown(&self) {
11523 self.inner.shutdown()
11524 }
11525
11526 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11527 self.inner.shutdown_with_epitaph(status)
11528 }
11529
11530 fn is_closed(&self) -> bool {
11531 self.inner.channel().is_closed()
11532 }
11533 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11534 self.inner.channel().on_closed()
11535 }
11536
11537 #[cfg(target_os = "fuchsia")]
11538 fn signal_peer(
11539 &self,
11540 clear_mask: zx::Signals,
11541 set_mask: zx::Signals,
11542 ) -> Result<(), zx_status::Status> {
11543 use fidl::Peered;
11544 self.inner.channel().signal_peer(clear_mask, set_mask)
11545 }
11546}
11547
11548impl PrivilegedCentralControlHandle {
11549 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
11550 self.inner.send::<CentralOnScanStateChangedRequest>(
11551 (scanning,),
11552 0,
11553 0x5f8edc23cad04d3f,
11554 fidl::encoding::DynamicFlags::empty(),
11555 )
11556 }
11557
11558 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
11559 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
11560 (device,),
11561 0,
11562 0x708dadf20d66db6,
11563 fidl::encoding::DynamicFlags::empty(),
11564 )
11565 }
11566
11567 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
11568 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
11569 (identifier,),
11570 0,
11571 0x4e4c6b979b2126df,
11572 fidl::encoding::DynamicFlags::empty(),
11573 )
11574 }
11575}
11576
11577#[must_use = "FIDL methods require a response to be sent"]
11578#[derive(Debug)]
11579pub struct PrivilegedCentralListenL2capResponder {
11580 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11581 tx_id: u32,
11582}
11583
11584impl std::ops::Drop for PrivilegedCentralListenL2capResponder {
11588 fn drop(&mut self) {
11589 self.control_handle.shutdown();
11590 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11592 }
11593}
11594
11595impl fidl::endpoints::Responder for PrivilegedCentralListenL2capResponder {
11596 type ControlHandle = PrivilegedCentralControlHandle;
11597
11598 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11599 &self.control_handle
11600 }
11601
11602 fn drop_without_shutdown(mut self) {
11603 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11605 std::mem::forget(self);
11607 }
11608}
11609
11610impl PrivilegedCentralListenL2capResponder {
11611 pub fn send(
11615 self,
11616 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11617 ) -> Result<(), fidl::Error> {
11618 let _result = self.send_raw(result);
11619 if _result.is_err() {
11620 self.control_handle.shutdown();
11621 }
11622 self.drop_without_shutdown();
11623 _result
11624 }
11625
11626 pub fn send_no_shutdown_on_err(
11628 self,
11629 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11630 ) -> Result<(), fidl::Error> {
11631 let _result = self.send_raw(result);
11632 self.drop_without_shutdown();
11633 _result
11634 }
11635
11636 fn send_raw(
11637 &self,
11638 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11639 ) -> Result<(), fidl::Error> {
11640 self.control_handle.inner.send::<fidl::encoding::ResultType<
11641 ChannelListenerRegistryListenL2capResponse,
11642 i32,
11643 >>(
11644 result,
11645 self.tx_id,
11646 0x39c6e9001d102338,
11647 fidl::encoding::DynamicFlags::empty(),
11648 )
11649 }
11650}
11651
11652#[must_use = "FIDL methods require a response to be sent"]
11653#[derive(Debug)]
11654pub struct PrivilegedCentralScanResponder {
11655 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11656 tx_id: u32,
11657}
11658
11659impl std::ops::Drop for PrivilegedCentralScanResponder {
11663 fn drop(&mut self) {
11664 self.control_handle.shutdown();
11665 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11667 }
11668}
11669
11670impl fidl::endpoints::Responder for PrivilegedCentralScanResponder {
11671 type ControlHandle = PrivilegedCentralControlHandle;
11672
11673 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11674 &self.control_handle
11675 }
11676
11677 fn drop_without_shutdown(mut self) {
11678 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11680 std::mem::forget(self);
11682 }
11683}
11684
11685impl PrivilegedCentralScanResponder {
11686 pub fn send(self) -> Result<(), fidl::Error> {
11690 let _result = self.send_raw();
11691 if _result.is_err() {
11692 self.control_handle.shutdown();
11693 }
11694 self.drop_without_shutdown();
11695 _result
11696 }
11697
11698 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11700 let _result = self.send_raw();
11701 self.drop_without_shutdown();
11702 _result
11703 }
11704
11705 fn send_raw(&self) -> Result<(), fidl::Error> {
11706 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11707 (),
11708 self.tx_id,
11709 0x41f7121798dfe15f,
11710 fidl::encoding::DynamicFlags::empty(),
11711 )
11712 }
11713}
11714
11715#[must_use = "FIDL methods require a response to be sent"]
11716#[derive(Debug)]
11717pub struct PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11718 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11719 tx_id: u32,
11720}
11721
11722impl std::ops::Drop for PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11726 fn drop(&mut self) {
11727 self.control_handle.shutdown();
11728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11730 }
11731}
11732
11733impl fidl::endpoints::Responder for PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11734 type ControlHandle = PrivilegedCentralControlHandle;
11735
11736 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11737 &self.control_handle
11738 }
11739
11740 fn drop_without_shutdown(mut self) {
11741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11743 std::mem::forget(self);
11745 }
11746}
11747
11748impl PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11749 pub fn send(
11753 self,
11754 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11755 ) -> Result<(), fidl::Error> {
11756 let _result = self.send_raw(result);
11757 if _result.is_err() {
11758 self.control_handle.shutdown();
11759 }
11760 self.drop_without_shutdown();
11761 _result
11762 }
11763
11764 pub fn send_no_shutdown_on_err(
11766 self,
11767 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11768 ) -> Result<(), fidl::Error> {
11769 let _result = self.send_raw(result);
11770 self.drop_without_shutdown();
11771 _result
11772 }
11773
11774 fn send_raw(
11775 &self,
11776 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11777 ) -> Result<(), fidl::Error> {
11778 self.control_handle.inner.send::<fidl::encoding::ResultType<
11779 CentralCreateConnectedIsochronousGroupResponse,
11780 CreateCigError,
11781 >>(
11782 result,
11783 self.tx_id,
11784 0x60323e70ae22e13,
11785 fidl::encoding::DynamicFlags::empty(),
11786 )
11787 }
11788}
11789
11790#[must_use = "FIDL methods require a response to be sent"]
11791#[derive(Debug)]
11792pub struct PrivilegedCentralGetPeripheralsResponder {
11793 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11794 tx_id: u32,
11795}
11796
11797impl std::ops::Drop for PrivilegedCentralGetPeripheralsResponder {
11801 fn drop(&mut self) {
11802 self.control_handle.shutdown();
11803 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11805 }
11806}
11807
11808impl fidl::endpoints::Responder for PrivilegedCentralGetPeripheralsResponder {
11809 type ControlHandle = PrivilegedCentralControlHandle;
11810
11811 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11812 &self.control_handle
11813 }
11814
11815 fn drop_without_shutdown(mut self) {
11816 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11818 std::mem::forget(self);
11820 }
11821}
11822
11823impl PrivilegedCentralGetPeripheralsResponder {
11824 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
11828 let _result = self.send_raw(peripherals);
11829 if _result.is_err() {
11830 self.control_handle.shutdown();
11831 }
11832 self.drop_without_shutdown();
11833 _result
11834 }
11835
11836 pub fn send_no_shutdown_on_err(
11838 self,
11839 mut peripherals: &[RemoteDevice],
11840 ) -> Result<(), fidl::Error> {
11841 let _result = self.send_raw(peripherals);
11842 self.drop_without_shutdown();
11843 _result
11844 }
11845
11846 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
11847 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
11848 (peripherals,),
11849 self.tx_id,
11850 0x37ba777499c683a8,
11851 fidl::encoding::DynamicFlags::empty(),
11852 )
11853 }
11854}
11855
11856#[must_use = "FIDL methods require a response to be sent"]
11857#[derive(Debug)]
11858pub struct PrivilegedCentralGetPeripheralResponder {
11859 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11860 tx_id: u32,
11861}
11862
11863impl std::ops::Drop for PrivilegedCentralGetPeripheralResponder {
11867 fn drop(&mut self) {
11868 self.control_handle.shutdown();
11869 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11871 }
11872}
11873
11874impl fidl::endpoints::Responder for PrivilegedCentralGetPeripheralResponder {
11875 type ControlHandle = PrivilegedCentralControlHandle;
11876
11877 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11878 &self.control_handle
11879 }
11880
11881 fn drop_without_shutdown(mut self) {
11882 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11884 std::mem::forget(self);
11886 }
11887}
11888
11889impl PrivilegedCentralGetPeripheralResponder {
11890 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
11894 let _result = self.send_raw(peripheral);
11895 if _result.is_err() {
11896 self.control_handle.shutdown();
11897 }
11898 self.drop_without_shutdown();
11899 _result
11900 }
11901
11902 pub fn send_no_shutdown_on_err(
11904 self,
11905 mut peripheral: Option<&RemoteDevice>,
11906 ) -> Result<(), fidl::Error> {
11907 let _result = self.send_raw(peripheral);
11908 self.drop_without_shutdown();
11909 _result
11910 }
11911
11912 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
11913 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
11914 (peripheral,),
11915 self.tx_id,
11916 0x97f5a2f2d9c13da,
11917 fidl::encoding::DynamicFlags::empty(),
11918 )
11919 }
11920}
11921
11922#[must_use = "FIDL methods require a response to be sent"]
11923#[derive(Debug)]
11924pub struct PrivilegedCentralStartScanResponder {
11925 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11926 tx_id: u32,
11927}
11928
11929impl std::ops::Drop for PrivilegedCentralStartScanResponder {
11933 fn drop(&mut self) {
11934 self.control_handle.shutdown();
11935 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11937 }
11938}
11939
11940impl fidl::endpoints::Responder for PrivilegedCentralStartScanResponder {
11941 type ControlHandle = PrivilegedCentralControlHandle;
11942
11943 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11944 &self.control_handle
11945 }
11946
11947 fn drop_without_shutdown(mut self) {
11948 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11950 std::mem::forget(self);
11952 }
11953}
11954
11955impl PrivilegedCentralStartScanResponder {
11956 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
11960 let _result = self.send_raw(status);
11961 if _result.is_err() {
11962 self.control_handle.shutdown();
11963 }
11964 self.drop_without_shutdown();
11965 _result
11966 }
11967
11968 pub fn send_no_shutdown_on_err(
11970 self,
11971 mut status: &fidl_fuchsia_bluetooth::Status,
11972 ) -> Result<(), fidl::Error> {
11973 let _result = self.send_raw(status);
11974 self.drop_without_shutdown();
11975 _result
11976 }
11977
11978 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
11979 self.control_handle.inner.send::<CentralStartScanResponse>(
11980 (status,),
11981 self.tx_id,
11982 0xeb4cf0cd0e1132b,
11983 fidl::encoding::DynamicFlags::empty(),
11984 )
11985 }
11986}
11987
11988#[must_use = "FIDL methods require a response to be sent"]
11989#[derive(Debug)]
11990pub struct PrivilegedCentralConnectPeripheralResponder {
11991 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11992 tx_id: u32,
11993}
11994
11995impl std::ops::Drop for PrivilegedCentralConnectPeripheralResponder {
11999 fn drop(&mut self) {
12000 self.control_handle.shutdown();
12001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12003 }
12004}
12005
12006impl fidl::endpoints::Responder for PrivilegedCentralConnectPeripheralResponder {
12007 type ControlHandle = PrivilegedCentralControlHandle;
12008
12009 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
12010 &self.control_handle
12011 }
12012
12013 fn drop_without_shutdown(mut self) {
12014 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12016 std::mem::forget(self);
12018 }
12019}
12020
12021impl PrivilegedCentralConnectPeripheralResponder {
12022 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12026 let _result = self.send_raw(status);
12027 if _result.is_err() {
12028 self.control_handle.shutdown();
12029 }
12030 self.drop_without_shutdown();
12031 _result
12032 }
12033
12034 pub fn send_no_shutdown_on_err(
12036 self,
12037 mut status: &fidl_fuchsia_bluetooth::Status,
12038 ) -> Result<(), fidl::Error> {
12039 let _result = self.send_raw(status);
12040 self.drop_without_shutdown();
12041 _result
12042 }
12043
12044 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12045 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
12046 (status,),
12047 self.tx_id,
12048 0x714d6c32d066d75a,
12049 fidl::encoding::DynamicFlags::empty(),
12050 )
12051 }
12052}
12053
12054#[must_use = "FIDL methods require a response to be sent"]
12055#[derive(Debug)]
12056pub struct PrivilegedCentralDisconnectPeripheralResponder {
12057 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
12058 tx_id: u32,
12059}
12060
12061impl std::ops::Drop for PrivilegedCentralDisconnectPeripheralResponder {
12065 fn drop(&mut self) {
12066 self.control_handle.shutdown();
12067 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12069 }
12070}
12071
12072impl fidl::endpoints::Responder for PrivilegedCentralDisconnectPeripheralResponder {
12073 type ControlHandle = PrivilegedCentralControlHandle;
12074
12075 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
12076 &self.control_handle
12077 }
12078
12079 fn drop_without_shutdown(mut self) {
12080 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12082 std::mem::forget(self);
12084 }
12085}
12086
12087impl PrivilegedCentralDisconnectPeripheralResponder {
12088 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12092 let _result = self.send_raw(status);
12093 if _result.is_err() {
12094 self.control_handle.shutdown();
12095 }
12096 self.drop_without_shutdown();
12097 _result
12098 }
12099
12100 pub fn send_no_shutdown_on_err(
12102 self,
12103 mut status: &fidl_fuchsia_bluetooth::Status,
12104 ) -> Result<(), fidl::Error> {
12105 let _result = self.send_raw(status);
12106 self.drop_without_shutdown();
12107 _result
12108 }
12109
12110 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12111 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
12112 (status,),
12113 self.tx_id,
12114 0xa9430da197362fd,
12115 fidl::encoding::DynamicFlags::empty(),
12116 )
12117 }
12118}
12119
12120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12121pub struct PrivilegedPeripheralMarker;
12122
12123impl fidl::endpoints::ProtocolMarker for PrivilegedPeripheralMarker {
12124 type Proxy = PrivilegedPeripheralProxy;
12125 type RequestStream = PrivilegedPeripheralRequestStream;
12126 #[cfg(target_os = "fuchsia")]
12127 type SynchronousProxy = PrivilegedPeripheralSynchronousProxy;
12128
12129 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedPeripheral";
12130}
12131impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedPeripheralMarker {}
12132
12133pub trait PrivilegedPeripheralProxyInterface: Send + Sync {
12134 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
12135 + Send;
12136 fn r#listen_l2cap(
12137 &self,
12138 payload: ChannelListenerRegistryListenL2capRequest,
12139 ) -> Self::ListenL2capResponseFut;
12140 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
12141 + Send;
12142 fn r#advertise(
12143 &self,
12144 parameters: &AdvertisingParameters,
12145 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12146 ) -> Self::AdvertiseResponseFut;
12147 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
12148 + Send;
12149 fn r#start_advertising(
12150 &self,
12151 parameters: &AdvertisingParameters,
12152 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12153 ) -> Self::StartAdvertisingResponseFut;
12154}
12155#[derive(Debug)]
12156#[cfg(target_os = "fuchsia")]
12157pub struct PrivilegedPeripheralSynchronousProxy {
12158 client: fidl::client::sync::Client,
12159}
12160
12161#[cfg(target_os = "fuchsia")]
12162impl fidl::endpoints::SynchronousProxy for PrivilegedPeripheralSynchronousProxy {
12163 type Proxy = PrivilegedPeripheralProxy;
12164 type Protocol = PrivilegedPeripheralMarker;
12165
12166 fn from_channel(inner: fidl::Channel) -> Self {
12167 Self::new(inner)
12168 }
12169
12170 fn into_channel(self) -> fidl::Channel {
12171 self.client.into_channel()
12172 }
12173
12174 fn as_channel(&self) -> &fidl::Channel {
12175 self.client.as_channel()
12176 }
12177}
12178
12179#[cfg(target_os = "fuchsia")]
12180impl PrivilegedPeripheralSynchronousProxy {
12181 pub fn new(channel: fidl::Channel) -> Self {
12182 Self { client: fidl::client::sync::Client::new(channel) }
12183 }
12184
12185 pub fn into_channel(self) -> fidl::Channel {
12186 self.client.into_channel()
12187 }
12188
12189 pub fn wait_for_event(
12192 &self,
12193 deadline: zx::MonotonicInstant,
12194 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
12195 PrivilegedPeripheralEvent::decode(
12196 self.client.wait_for_event::<PrivilegedPeripheralMarker>(deadline)?,
12197 )
12198 }
12199
12200 pub fn r#listen_l2cap(
12210 &self,
12211 mut payload: ChannelListenerRegistryListenL2capRequest,
12212 ___deadline: zx::MonotonicInstant,
12213 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
12214 let _response = self.client.send_query::<
12215 ChannelListenerRegistryListenL2capRequest,
12216 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
12217 PrivilegedPeripheralMarker,
12218 >(
12219 &mut payload,
12220 0x39c6e9001d102338,
12221 fidl::encoding::DynamicFlags::empty(),
12222 ___deadline,
12223 )?;
12224 Ok(_response.map(|x| x))
12225 }
12226
12227 pub fn r#advertise(
12255 &self,
12256 mut parameters: &AdvertisingParameters,
12257 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12258 ___deadline: zx::MonotonicInstant,
12259 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
12260 let _response = self.client.send_query::<
12261 PeripheralAdvertiseRequest,
12262 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12263 PrivilegedPeripheralMarker,
12264 >(
12265 (parameters, advertised_peripheral,),
12266 0x2d9ec9260c32c17f,
12267 fidl::encoding::DynamicFlags::empty(),
12268 ___deadline,
12269 )?;
12270 Ok(_response.map(|x| x))
12271 }
12272
12273 pub fn r#start_advertising(
12294 &self,
12295 mut parameters: &AdvertisingParameters,
12296 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12297 ___deadline: zx::MonotonicInstant,
12298 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
12299 let _response = self.client.send_query::<
12300 PeripheralStartAdvertisingRequest,
12301 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12302 PrivilegedPeripheralMarker,
12303 >(
12304 (parameters, handle,),
12305 0x5875c1c575f00f7d,
12306 fidl::encoding::DynamicFlags::empty(),
12307 ___deadline,
12308 )?;
12309 Ok(_response.map(|x| x))
12310 }
12311}
12312
12313#[cfg(target_os = "fuchsia")]
12314impl From<PrivilegedPeripheralSynchronousProxy> for zx::NullableHandle {
12315 fn from(value: PrivilegedPeripheralSynchronousProxy) -> Self {
12316 value.into_channel().into()
12317 }
12318}
12319
12320#[cfg(target_os = "fuchsia")]
12321impl From<fidl::Channel> for PrivilegedPeripheralSynchronousProxy {
12322 fn from(value: fidl::Channel) -> Self {
12323 Self::new(value)
12324 }
12325}
12326
12327#[cfg(target_os = "fuchsia")]
12328impl fidl::endpoints::FromClient for PrivilegedPeripheralSynchronousProxy {
12329 type Protocol = PrivilegedPeripheralMarker;
12330
12331 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedPeripheralMarker>) -> Self {
12332 Self::new(value.into_channel())
12333 }
12334}
12335
12336#[derive(Debug, Clone)]
12337pub struct PrivilegedPeripheralProxy {
12338 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12339}
12340
12341impl fidl::endpoints::Proxy for PrivilegedPeripheralProxy {
12342 type Protocol = PrivilegedPeripheralMarker;
12343
12344 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12345 Self::new(inner)
12346 }
12347
12348 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12349 self.client.into_channel().map_err(|client| Self { client })
12350 }
12351
12352 fn as_channel(&self) -> &::fidl::AsyncChannel {
12353 self.client.as_channel()
12354 }
12355}
12356
12357impl PrivilegedPeripheralProxy {
12358 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12360 let protocol_name =
12361 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12362 Self { client: fidl::client::Client::new(channel, protocol_name) }
12363 }
12364
12365 pub fn take_event_stream(&self) -> PrivilegedPeripheralEventStream {
12371 PrivilegedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
12372 }
12373
12374 pub fn r#listen_l2cap(
12384 &self,
12385 mut payload: ChannelListenerRegistryListenL2capRequest,
12386 ) -> fidl::client::QueryResponseFut<
12387 ChannelListenerRegistryListenL2capResult,
12388 fidl::encoding::DefaultFuchsiaResourceDialect,
12389 > {
12390 PrivilegedPeripheralProxyInterface::r#listen_l2cap(self, payload)
12391 }
12392
12393 pub fn r#advertise(
12421 &self,
12422 mut parameters: &AdvertisingParameters,
12423 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12424 ) -> fidl::client::QueryResponseFut<
12425 PeripheralAdvertiseResult,
12426 fidl::encoding::DefaultFuchsiaResourceDialect,
12427 > {
12428 PrivilegedPeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
12429 }
12430
12431 pub fn r#start_advertising(
12452 &self,
12453 mut parameters: &AdvertisingParameters,
12454 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12455 ) -> fidl::client::QueryResponseFut<
12456 PeripheralStartAdvertisingResult,
12457 fidl::encoding::DefaultFuchsiaResourceDialect,
12458 > {
12459 PrivilegedPeripheralProxyInterface::r#start_advertising(self, parameters, handle)
12460 }
12461}
12462
12463impl PrivilegedPeripheralProxyInterface for PrivilegedPeripheralProxy {
12464 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
12465 ChannelListenerRegistryListenL2capResult,
12466 fidl::encoding::DefaultFuchsiaResourceDialect,
12467 >;
12468 fn r#listen_l2cap(
12469 &self,
12470 mut payload: ChannelListenerRegistryListenL2capRequest,
12471 ) -> Self::ListenL2capResponseFut {
12472 fn _decode(
12473 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12474 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
12475 let _response = fidl::client::decode_transaction_body::<
12476 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
12477 fidl::encoding::DefaultFuchsiaResourceDialect,
12478 0x39c6e9001d102338,
12479 >(_buf?)?;
12480 Ok(_response.map(|x| x))
12481 }
12482 self.client.send_query_and_decode::<
12483 ChannelListenerRegistryListenL2capRequest,
12484 ChannelListenerRegistryListenL2capResult,
12485 >(
12486 &mut payload,
12487 0x39c6e9001d102338,
12488 fidl::encoding::DynamicFlags::empty(),
12489 _decode,
12490 )
12491 }
12492
12493 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
12494 PeripheralAdvertiseResult,
12495 fidl::encoding::DefaultFuchsiaResourceDialect,
12496 >;
12497 fn r#advertise(
12498 &self,
12499 mut parameters: &AdvertisingParameters,
12500 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12501 ) -> Self::AdvertiseResponseFut {
12502 fn _decode(
12503 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12504 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
12505 let _response = fidl::client::decode_transaction_body::<
12506 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12507 fidl::encoding::DefaultFuchsiaResourceDialect,
12508 0x2d9ec9260c32c17f,
12509 >(_buf?)?;
12510 Ok(_response.map(|x| x))
12511 }
12512 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
12513 (parameters, advertised_peripheral),
12514 0x2d9ec9260c32c17f,
12515 fidl::encoding::DynamicFlags::empty(),
12516 _decode,
12517 )
12518 }
12519
12520 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
12521 PeripheralStartAdvertisingResult,
12522 fidl::encoding::DefaultFuchsiaResourceDialect,
12523 >;
12524 fn r#start_advertising(
12525 &self,
12526 mut parameters: &AdvertisingParameters,
12527 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12528 ) -> Self::StartAdvertisingResponseFut {
12529 fn _decode(
12530 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12531 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
12532 let _response = fidl::client::decode_transaction_body::<
12533 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12534 fidl::encoding::DefaultFuchsiaResourceDialect,
12535 0x5875c1c575f00f7d,
12536 >(_buf?)?;
12537 Ok(_response.map(|x| x))
12538 }
12539 self.client.send_query_and_decode::<
12540 PeripheralStartAdvertisingRequest,
12541 PeripheralStartAdvertisingResult,
12542 >(
12543 (parameters, handle,),
12544 0x5875c1c575f00f7d,
12545 fidl::encoding::DynamicFlags::empty(),
12546 _decode,
12547 )
12548 }
12549}
12550
12551pub struct PrivilegedPeripheralEventStream {
12552 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12553}
12554
12555impl std::marker::Unpin for PrivilegedPeripheralEventStream {}
12556
12557impl futures::stream::FusedStream for PrivilegedPeripheralEventStream {
12558 fn is_terminated(&self) -> bool {
12559 self.event_receiver.is_terminated()
12560 }
12561}
12562
12563impl futures::Stream for PrivilegedPeripheralEventStream {
12564 type Item = Result<PrivilegedPeripheralEvent, fidl::Error>;
12565
12566 fn poll_next(
12567 mut self: std::pin::Pin<&mut Self>,
12568 cx: &mut std::task::Context<'_>,
12569 ) -> std::task::Poll<Option<Self::Item>> {
12570 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12571 &mut self.event_receiver,
12572 cx
12573 )?) {
12574 Some(buf) => std::task::Poll::Ready(Some(PrivilegedPeripheralEvent::decode(buf))),
12575 None => std::task::Poll::Ready(None),
12576 }
12577 }
12578}
12579
12580#[derive(Debug)]
12581pub enum PrivilegedPeripheralEvent {
12582 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
12583}
12584
12585impl PrivilegedPeripheralEvent {
12586 #[allow(irrefutable_let_patterns)]
12587 pub fn into_on_peer_connected(
12588 self,
12589 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
12590 if let PrivilegedPeripheralEvent::OnPeerConnected { peer, connection } = self {
12591 Some((peer, connection))
12592 } else {
12593 None
12594 }
12595 }
12596
12597 fn decode(
12599 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12600 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
12601 let (bytes, _handles) = buf.split_mut();
12602 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12603 debug_assert_eq!(tx_header.tx_id, 0);
12604 match tx_header.ordinal {
12605 0x16135d464299e356 => {
12606 let mut out = fidl::new_empty!(
12607 PeripheralOnPeerConnectedRequest,
12608 fidl::encoding::DefaultFuchsiaResourceDialect
12609 );
12610 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
12611 Ok((PrivilegedPeripheralEvent::OnPeerConnected {
12612 peer: out.peer,
12613 connection: out.connection,
12614 }))
12615 }
12616 _ => Err(fidl::Error::UnknownOrdinal {
12617 ordinal: tx_header.ordinal,
12618 protocol_name:
12619 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12620 }),
12621 }
12622 }
12623}
12624
12625pub struct PrivilegedPeripheralRequestStream {
12627 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12628 is_terminated: bool,
12629}
12630
12631impl std::marker::Unpin for PrivilegedPeripheralRequestStream {}
12632
12633impl futures::stream::FusedStream for PrivilegedPeripheralRequestStream {
12634 fn is_terminated(&self) -> bool {
12635 self.is_terminated
12636 }
12637}
12638
12639impl fidl::endpoints::RequestStream for PrivilegedPeripheralRequestStream {
12640 type Protocol = PrivilegedPeripheralMarker;
12641 type ControlHandle = PrivilegedPeripheralControlHandle;
12642
12643 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12644 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12645 }
12646
12647 fn control_handle(&self) -> Self::ControlHandle {
12648 PrivilegedPeripheralControlHandle { inner: self.inner.clone() }
12649 }
12650
12651 fn into_inner(
12652 self,
12653 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12654 {
12655 (self.inner, self.is_terminated)
12656 }
12657
12658 fn from_inner(
12659 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12660 is_terminated: bool,
12661 ) -> Self {
12662 Self { inner, is_terminated }
12663 }
12664}
12665
12666impl futures::Stream for PrivilegedPeripheralRequestStream {
12667 type Item = Result<PrivilegedPeripheralRequest, fidl::Error>;
12668
12669 fn poll_next(
12670 mut self: std::pin::Pin<&mut Self>,
12671 cx: &mut std::task::Context<'_>,
12672 ) -> std::task::Poll<Option<Self::Item>> {
12673 let this = &mut *self;
12674 if this.inner.check_shutdown(cx) {
12675 this.is_terminated = true;
12676 return std::task::Poll::Ready(None);
12677 }
12678 if this.is_terminated {
12679 panic!("polled PrivilegedPeripheralRequestStream after completion");
12680 }
12681 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12682 |bytes, handles| {
12683 match this.inner.channel().read_etc(cx, bytes, handles) {
12684 std::task::Poll::Ready(Ok(())) => {}
12685 std::task::Poll::Pending => return std::task::Poll::Pending,
12686 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12687 this.is_terminated = true;
12688 return std::task::Poll::Ready(None);
12689 }
12690 std::task::Poll::Ready(Err(e)) => {
12691 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12692 e.into(),
12693 ))));
12694 }
12695 }
12696
12697 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12699
12700 std::task::Poll::Ready(Some(match header.ordinal {
12701 0x39c6e9001d102338 => {
12702 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12703 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12704 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
12705 let control_handle = PrivilegedPeripheralControlHandle {
12706 inner: this.inner.clone(),
12707 };
12708 Ok(PrivilegedPeripheralRequest::ListenL2cap {payload: req,
12709 responder: PrivilegedPeripheralListenL2capResponder {
12710 control_handle: std::mem::ManuallyDrop::new(control_handle),
12711 tx_id: header.tx_id,
12712 },
12713 })
12714 }
12715 0x2d9ec9260c32c17f => {
12716 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12717 let mut req = fidl::new_empty!(PeripheralAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12718 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
12719 let control_handle = PrivilegedPeripheralControlHandle {
12720 inner: this.inner.clone(),
12721 };
12722 Ok(PrivilegedPeripheralRequest::Advertise {parameters: req.parameters,
12723advertised_peripheral: req.advertised_peripheral,
12724
12725 responder: PrivilegedPeripheralAdvertiseResponder {
12726 control_handle: std::mem::ManuallyDrop::new(control_handle),
12727 tx_id: header.tx_id,
12728 },
12729 })
12730 }
12731 0x5875c1c575f00f7d => {
12732 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12733 let mut req = fidl::new_empty!(PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12734 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
12735 let control_handle = PrivilegedPeripheralControlHandle {
12736 inner: this.inner.clone(),
12737 };
12738 Ok(PrivilegedPeripheralRequest::StartAdvertising {parameters: req.parameters,
12739handle: req.handle,
12740
12741 responder: PrivilegedPeripheralStartAdvertisingResponder {
12742 control_handle: std::mem::ManuallyDrop::new(control_handle),
12743 tx_id: header.tx_id,
12744 },
12745 })
12746 }
12747 _ => Err(fidl::Error::UnknownOrdinal {
12748 ordinal: header.ordinal,
12749 protocol_name: <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12750 }),
12751 }))
12752 },
12753 )
12754 }
12755}
12756
12757#[derive(Debug)]
12765pub enum PrivilegedPeripheralRequest {
12766 ListenL2cap {
12776 payload: ChannelListenerRegistryListenL2capRequest,
12777 responder: PrivilegedPeripheralListenL2capResponder,
12778 },
12779 Advertise {
12807 parameters: AdvertisingParameters,
12808 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12809 responder: PrivilegedPeripheralAdvertiseResponder,
12810 },
12811 StartAdvertising {
12832 parameters: AdvertisingParameters,
12833 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12834 responder: PrivilegedPeripheralStartAdvertisingResponder,
12835 },
12836}
12837
12838impl PrivilegedPeripheralRequest {
12839 #[allow(irrefutable_let_patterns)]
12840 pub fn into_listen_l2cap(
12841 self,
12842 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedPeripheralListenL2capResponder)>
12843 {
12844 if let PrivilegedPeripheralRequest::ListenL2cap { payload, responder } = self {
12845 Some((payload, responder))
12846 } else {
12847 None
12848 }
12849 }
12850
12851 #[allow(irrefutable_let_patterns)]
12852 pub fn into_advertise(
12853 self,
12854 ) -> Option<(
12855 AdvertisingParameters,
12856 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12857 PrivilegedPeripheralAdvertiseResponder,
12858 )> {
12859 if let PrivilegedPeripheralRequest::Advertise {
12860 parameters,
12861 advertised_peripheral,
12862 responder,
12863 } = self
12864 {
12865 Some((parameters, advertised_peripheral, responder))
12866 } else {
12867 None
12868 }
12869 }
12870
12871 #[allow(irrefutable_let_patterns)]
12872 pub fn into_start_advertising(
12873 self,
12874 ) -> Option<(
12875 AdvertisingParameters,
12876 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12877 PrivilegedPeripheralStartAdvertisingResponder,
12878 )> {
12879 if let PrivilegedPeripheralRequest::StartAdvertising { parameters, handle, responder } =
12880 self
12881 {
12882 Some((parameters, handle, responder))
12883 } else {
12884 None
12885 }
12886 }
12887
12888 pub fn method_name(&self) -> &'static str {
12890 match *self {
12891 PrivilegedPeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
12892 PrivilegedPeripheralRequest::Advertise { .. } => "advertise",
12893 PrivilegedPeripheralRequest::StartAdvertising { .. } => "start_advertising",
12894 }
12895 }
12896}
12897
12898#[derive(Debug, Clone)]
12899pub struct PrivilegedPeripheralControlHandle {
12900 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12901}
12902
12903impl fidl::endpoints::ControlHandle for PrivilegedPeripheralControlHandle {
12904 fn shutdown(&self) {
12905 self.inner.shutdown()
12906 }
12907
12908 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12909 self.inner.shutdown_with_epitaph(status)
12910 }
12911
12912 fn is_closed(&self) -> bool {
12913 self.inner.channel().is_closed()
12914 }
12915 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12916 self.inner.channel().on_closed()
12917 }
12918
12919 #[cfg(target_os = "fuchsia")]
12920 fn signal_peer(
12921 &self,
12922 clear_mask: zx::Signals,
12923 set_mask: zx::Signals,
12924 ) -> Result<(), zx_status::Status> {
12925 use fidl::Peered;
12926 self.inner.channel().signal_peer(clear_mask, set_mask)
12927 }
12928}
12929
12930impl PrivilegedPeripheralControlHandle {
12931 pub fn send_on_peer_connected(
12932 &self,
12933 mut peer: &Peer,
12934 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
12935 ) -> Result<(), fidl::Error> {
12936 self.inner.send::<PeripheralOnPeerConnectedRequest>(
12937 (peer, connection),
12938 0,
12939 0x16135d464299e356,
12940 fidl::encoding::DynamicFlags::empty(),
12941 )
12942 }
12943}
12944
12945#[must_use = "FIDL methods require a response to be sent"]
12946#[derive(Debug)]
12947pub struct PrivilegedPeripheralListenL2capResponder {
12948 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
12949 tx_id: u32,
12950}
12951
12952impl std::ops::Drop for PrivilegedPeripheralListenL2capResponder {
12956 fn drop(&mut self) {
12957 self.control_handle.shutdown();
12958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12960 }
12961}
12962
12963impl fidl::endpoints::Responder for PrivilegedPeripheralListenL2capResponder {
12964 type ControlHandle = PrivilegedPeripheralControlHandle;
12965
12966 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
12967 &self.control_handle
12968 }
12969
12970 fn drop_without_shutdown(mut self) {
12971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12973 std::mem::forget(self);
12975 }
12976}
12977
12978impl PrivilegedPeripheralListenL2capResponder {
12979 pub fn send(
12983 self,
12984 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
12985 ) -> Result<(), fidl::Error> {
12986 let _result = self.send_raw(result);
12987 if _result.is_err() {
12988 self.control_handle.shutdown();
12989 }
12990 self.drop_without_shutdown();
12991 _result
12992 }
12993
12994 pub fn send_no_shutdown_on_err(
12996 self,
12997 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
12998 ) -> Result<(), fidl::Error> {
12999 let _result = self.send_raw(result);
13000 self.drop_without_shutdown();
13001 _result
13002 }
13003
13004 fn send_raw(
13005 &self,
13006 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
13007 ) -> Result<(), fidl::Error> {
13008 self.control_handle.inner.send::<fidl::encoding::ResultType<
13009 ChannelListenerRegistryListenL2capResponse,
13010 i32,
13011 >>(
13012 result,
13013 self.tx_id,
13014 0x39c6e9001d102338,
13015 fidl::encoding::DynamicFlags::empty(),
13016 )
13017 }
13018}
13019
13020#[must_use = "FIDL methods require a response to be sent"]
13021#[derive(Debug)]
13022pub struct PrivilegedPeripheralAdvertiseResponder {
13023 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
13024 tx_id: u32,
13025}
13026
13027impl std::ops::Drop for PrivilegedPeripheralAdvertiseResponder {
13031 fn drop(&mut self) {
13032 self.control_handle.shutdown();
13033 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13035 }
13036}
13037
13038impl fidl::endpoints::Responder for PrivilegedPeripheralAdvertiseResponder {
13039 type ControlHandle = PrivilegedPeripheralControlHandle;
13040
13041 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
13042 &self.control_handle
13043 }
13044
13045 fn drop_without_shutdown(mut self) {
13046 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13048 std::mem::forget(self);
13050 }
13051}
13052
13053impl PrivilegedPeripheralAdvertiseResponder {
13054 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13058 let _result = self.send_raw(result);
13059 if _result.is_err() {
13060 self.control_handle.shutdown();
13061 }
13062 self.drop_without_shutdown();
13063 _result
13064 }
13065
13066 pub fn send_no_shutdown_on_err(
13068 self,
13069 mut result: Result<(), PeripheralError>,
13070 ) -> Result<(), fidl::Error> {
13071 let _result = self.send_raw(result);
13072 self.drop_without_shutdown();
13073 _result
13074 }
13075
13076 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13077 self.control_handle.inner.send::<fidl::encoding::ResultType<
13078 fidl::encoding::EmptyStruct,
13079 PeripheralError,
13080 >>(
13081 result,
13082 self.tx_id,
13083 0x2d9ec9260c32c17f,
13084 fidl::encoding::DynamicFlags::empty(),
13085 )
13086 }
13087}
13088
13089#[must_use = "FIDL methods require a response to be sent"]
13090#[derive(Debug)]
13091pub struct PrivilegedPeripheralStartAdvertisingResponder {
13092 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
13093 tx_id: u32,
13094}
13095
13096impl std::ops::Drop for PrivilegedPeripheralStartAdvertisingResponder {
13100 fn drop(&mut self) {
13101 self.control_handle.shutdown();
13102 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13104 }
13105}
13106
13107impl fidl::endpoints::Responder for PrivilegedPeripheralStartAdvertisingResponder {
13108 type ControlHandle = PrivilegedPeripheralControlHandle;
13109
13110 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
13111 &self.control_handle
13112 }
13113
13114 fn drop_without_shutdown(mut self) {
13115 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13117 std::mem::forget(self);
13119 }
13120}
13121
13122impl PrivilegedPeripheralStartAdvertisingResponder {
13123 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13127 let _result = self.send_raw(result);
13128 if _result.is_err() {
13129 self.control_handle.shutdown();
13130 }
13131 self.drop_without_shutdown();
13132 _result
13133 }
13134
13135 pub fn send_no_shutdown_on_err(
13137 self,
13138 mut result: Result<(), PeripheralError>,
13139 ) -> Result<(), fidl::Error> {
13140 let _result = self.send_raw(result);
13141 self.drop_without_shutdown();
13142 _result
13143 }
13144
13145 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13146 self.control_handle.inner.send::<fidl::encoding::ResultType<
13147 fidl::encoding::EmptyStruct,
13148 PeripheralError,
13149 >>(
13150 result,
13151 self.tx_id,
13152 0x5875c1c575f00f7d,
13153 fidl::encoding::DynamicFlags::empty(),
13154 )
13155 }
13156}
13157
13158#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13159pub struct ScanResultWatcherMarker;
13160
13161impl fidl::endpoints::ProtocolMarker for ScanResultWatcherMarker {
13162 type Proxy = ScanResultWatcherProxy;
13163 type RequestStream = ScanResultWatcherRequestStream;
13164 #[cfg(target_os = "fuchsia")]
13165 type SynchronousProxy = ScanResultWatcherSynchronousProxy;
13166
13167 const DEBUG_NAME: &'static str = "(anonymous) ScanResultWatcher";
13168}
13169
13170pub trait ScanResultWatcherProxyInterface: Send + Sync {
13171 type WatchResponseFut: std::future::Future<Output = Result<Vec<Peer>, fidl::Error>> + Send;
13172 fn r#watch(&self) -> Self::WatchResponseFut;
13173}
13174#[derive(Debug)]
13175#[cfg(target_os = "fuchsia")]
13176pub struct ScanResultWatcherSynchronousProxy {
13177 client: fidl::client::sync::Client,
13178}
13179
13180#[cfg(target_os = "fuchsia")]
13181impl fidl::endpoints::SynchronousProxy for ScanResultWatcherSynchronousProxy {
13182 type Proxy = ScanResultWatcherProxy;
13183 type Protocol = ScanResultWatcherMarker;
13184
13185 fn from_channel(inner: fidl::Channel) -> Self {
13186 Self::new(inner)
13187 }
13188
13189 fn into_channel(self) -> fidl::Channel {
13190 self.client.into_channel()
13191 }
13192
13193 fn as_channel(&self) -> &fidl::Channel {
13194 self.client.as_channel()
13195 }
13196}
13197
13198#[cfg(target_os = "fuchsia")]
13199impl ScanResultWatcherSynchronousProxy {
13200 pub fn new(channel: fidl::Channel) -> Self {
13201 Self { client: fidl::client::sync::Client::new(channel) }
13202 }
13203
13204 pub fn into_channel(self) -> fidl::Channel {
13205 self.client.into_channel()
13206 }
13207
13208 pub fn wait_for_event(
13211 &self,
13212 deadline: zx::MonotonicInstant,
13213 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
13214 ScanResultWatcherEvent::decode(
13215 self.client.wait_for_event::<ScanResultWatcherMarker>(deadline)?,
13216 )
13217 }
13218
13219 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Peer>, fidl::Error> {
13229 let _response = self.client.send_query::<
13230 fidl::encoding::EmptyPayload,
13231 ScanResultWatcherWatchResponse,
13232 ScanResultWatcherMarker,
13233 >(
13234 (),
13235 0x713a122e949f301a,
13236 fidl::encoding::DynamicFlags::empty(),
13237 ___deadline,
13238 )?;
13239 Ok(_response.updated)
13240 }
13241}
13242
13243#[cfg(target_os = "fuchsia")]
13244impl From<ScanResultWatcherSynchronousProxy> for zx::NullableHandle {
13245 fn from(value: ScanResultWatcherSynchronousProxy) -> Self {
13246 value.into_channel().into()
13247 }
13248}
13249
13250#[cfg(target_os = "fuchsia")]
13251impl From<fidl::Channel> for ScanResultWatcherSynchronousProxy {
13252 fn from(value: fidl::Channel) -> Self {
13253 Self::new(value)
13254 }
13255}
13256
13257#[cfg(target_os = "fuchsia")]
13258impl fidl::endpoints::FromClient for ScanResultWatcherSynchronousProxy {
13259 type Protocol = ScanResultWatcherMarker;
13260
13261 fn from_client(value: fidl::endpoints::ClientEnd<ScanResultWatcherMarker>) -> Self {
13262 Self::new(value.into_channel())
13263 }
13264}
13265
13266#[derive(Debug, Clone)]
13267pub struct ScanResultWatcherProxy {
13268 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
13269}
13270
13271impl fidl::endpoints::Proxy for ScanResultWatcherProxy {
13272 type Protocol = ScanResultWatcherMarker;
13273
13274 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
13275 Self::new(inner)
13276 }
13277
13278 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
13279 self.client.into_channel().map_err(|client| Self { client })
13280 }
13281
13282 fn as_channel(&self) -> &::fidl::AsyncChannel {
13283 self.client.as_channel()
13284 }
13285}
13286
13287impl ScanResultWatcherProxy {
13288 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
13290 let protocol_name =
13291 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13292 Self { client: fidl::client::Client::new(channel, protocol_name) }
13293 }
13294
13295 pub fn take_event_stream(&self) -> ScanResultWatcherEventStream {
13301 ScanResultWatcherEventStream { event_receiver: self.client.take_event_receiver() }
13302 }
13303
13304 pub fn r#watch(
13314 &self,
13315 ) -> fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>
13316 {
13317 ScanResultWatcherProxyInterface::r#watch(self)
13318 }
13319}
13320
13321impl ScanResultWatcherProxyInterface for ScanResultWatcherProxy {
13322 type WatchResponseFut =
13323 fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>;
13324 fn r#watch(&self) -> Self::WatchResponseFut {
13325 fn _decode(
13326 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
13327 ) -> Result<Vec<Peer>, fidl::Error> {
13328 let _response = fidl::client::decode_transaction_body::<
13329 ScanResultWatcherWatchResponse,
13330 fidl::encoding::DefaultFuchsiaResourceDialect,
13331 0x713a122e949f301a,
13332 >(_buf?)?;
13333 Ok(_response.updated)
13334 }
13335 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Peer>>(
13336 (),
13337 0x713a122e949f301a,
13338 fidl::encoding::DynamicFlags::empty(),
13339 _decode,
13340 )
13341 }
13342}
13343
13344pub struct ScanResultWatcherEventStream {
13345 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
13346}
13347
13348impl std::marker::Unpin for ScanResultWatcherEventStream {}
13349
13350impl futures::stream::FusedStream for ScanResultWatcherEventStream {
13351 fn is_terminated(&self) -> bool {
13352 self.event_receiver.is_terminated()
13353 }
13354}
13355
13356impl futures::Stream for ScanResultWatcherEventStream {
13357 type Item = Result<ScanResultWatcherEvent, fidl::Error>;
13358
13359 fn poll_next(
13360 mut self: std::pin::Pin<&mut Self>,
13361 cx: &mut std::task::Context<'_>,
13362 ) -> std::task::Poll<Option<Self::Item>> {
13363 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
13364 &mut self.event_receiver,
13365 cx
13366 )?) {
13367 Some(buf) => std::task::Poll::Ready(Some(ScanResultWatcherEvent::decode(buf))),
13368 None => std::task::Poll::Ready(None),
13369 }
13370 }
13371}
13372
13373#[derive(Debug)]
13374pub enum ScanResultWatcherEvent {}
13375
13376impl ScanResultWatcherEvent {
13377 fn decode(
13379 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
13380 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
13381 let (bytes, _handles) = buf.split_mut();
13382 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13383 debug_assert_eq!(tx_header.tx_id, 0);
13384 match tx_header.ordinal {
13385 _ => Err(fidl::Error::UnknownOrdinal {
13386 ordinal: tx_header.ordinal,
13387 protocol_name:
13388 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13389 }),
13390 }
13391 }
13392}
13393
13394pub struct ScanResultWatcherRequestStream {
13396 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13397 is_terminated: bool,
13398}
13399
13400impl std::marker::Unpin for ScanResultWatcherRequestStream {}
13401
13402impl futures::stream::FusedStream for ScanResultWatcherRequestStream {
13403 fn is_terminated(&self) -> bool {
13404 self.is_terminated
13405 }
13406}
13407
13408impl fidl::endpoints::RequestStream for ScanResultWatcherRequestStream {
13409 type Protocol = ScanResultWatcherMarker;
13410 type ControlHandle = ScanResultWatcherControlHandle;
13411
13412 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
13413 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
13414 }
13415
13416 fn control_handle(&self) -> Self::ControlHandle {
13417 ScanResultWatcherControlHandle { inner: self.inner.clone() }
13418 }
13419
13420 fn into_inner(
13421 self,
13422 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13423 {
13424 (self.inner, self.is_terminated)
13425 }
13426
13427 fn from_inner(
13428 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13429 is_terminated: bool,
13430 ) -> Self {
13431 Self { inner, is_terminated }
13432 }
13433}
13434
13435impl futures::Stream for ScanResultWatcherRequestStream {
13436 type Item = Result<ScanResultWatcherRequest, fidl::Error>;
13437
13438 fn poll_next(
13439 mut self: std::pin::Pin<&mut Self>,
13440 cx: &mut std::task::Context<'_>,
13441 ) -> std::task::Poll<Option<Self::Item>> {
13442 let this = &mut *self;
13443 if this.inner.check_shutdown(cx) {
13444 this.is_terminated = true;
13445 return std::task::Poll::Ready(None);
13446 }
13447 if this.is_terminated {
13448 panic!("polled ScanResultWatcherRequestStream after completion");
13449 }
13450 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13451 |bytes, handles| {
13452 match this.inner.channel().read_etc(cx, bytes, handles) {
13453 std::task::Poll::Ready(Ok(())) => {}
13454 std::task::Poll::Pending => return std::task::Poll::Pending,
13455 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13456 this.is_terminated = true;
13457 return std::task::Poll::Ready(None);
13458 }
13459 std::task::Poll::Ready(Err(e)) => {
13460 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13461 e.into(),
13462 ))));
13463 }
13464 }
13465
13466 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13468
13469 std::task::Poll::Ready(Some(match header.ordinal {
13470 0x713a122e949f301a => {
13471 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
13472 let mut req = fidl::new_empty!(
13473 fidl::encoding::EmptyPayload,
13474 fidl::encoding::DefaultFuchsiaResourceDialect
13475 );
13476 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
13477 let control_handle =
13478 ScanResultWatcherControlHandle { inner: this.inner.clone() };
13479 Ok(ScanResultWatcherRequest::Watch {
13480 responder: ScanResultWatcherWatchResponder {
13481 control_handle: std::mem::ManuallyDrop::new(control_handle),
13482 tx_id: header.tx_id,
13483 },
13484 })
13485 }
13486 _ => Err(fidl::Error::UnknownOrdinal {
13487 ordinal: header.ordinal,
13488 protocol_name:
13489 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13490 }),
13491 }))
13492 },
13493 )
13494 }
13495}
13496
13497#[derive(Debug)]
13503pub enum ScanResultWatcherRequest {
13504 Watch { responder: ScanResultWatcherWatchResponder },
13514}
13515
13516impl ScanResultWatcherRequest {
13517 #[allow(irrefutable_let_patterns)]
13518 pub fn into_watch(self) -> Option<(ScanResultWatcherWatchResponder)> {
13519 if let ScanResultWatcherRequest::Watch { responder } = self {
13520 Some((responder))
13521 } else {
13522 None
13523 }
13524 }
13525
13526 pub fn method_name(&self) -> &'static str {
13528 match *self {
13529 ScanResultWatcherRequest::Watch { .. } => "watch",
13530 }
13531 }
13532}
13533
13534#[derive(Debug, Clone)]
13535pub struct ScanResultWatcherControlHandle {
13536 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13537}
13538
13539impl fidl::endpoints::ControlHandle for ScanResultWatcherControlHandle {
13540 fn shutdown(&self) {
13541 self.inner.shutdown()
13542 }
13543
13544 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
13545 self.inner.shutdown_with_epitaph(status)
13546 }
13547
13548 fn is_closed(&self) -> bool {
13549 self.inner.channel().is_closed()
13550 }
13551 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13552 self.inner.channel().on_closed()
13553 }
13554
13555 #[cfg(target_os = "fuchsia")]
13556 fn signal_peer(
13557 &self,
13558 clear_mask: zx::Signals,
13559 set_mask: zx::Signals,
13560 ) -> Result<(), zx_status::Status> {
13561 use fidl::Peered;
13562 self.inner.channel().signal_peer(clear_mask, set_mask)
13563 }
13564}
13565
13566impl ScanResultWatcherControlHandle {}
13567
13568#[must_use = "FIDL methods require a response to be sent"]
13569#[derive(Debug)]
13570pub struct ScanResultWatcherWatchResponder {
13571 control_handle: std::mem::ManuallyDrop<ScanResultWatcherControlHandle>,
13572 tx_id: u32,
13573}
13574
13575impl std::ops::Drop for ScanResultWatcherWatchResponder {
13579 fn drop(&mut self) {
13580 self.control_handle.shutdown();
13581 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13583 }
13584}
13585
13586impl fidl::endpoints::Responder for ScanResultWatcherWatchResponder {
13587 type ControlHandle = ScanResultWatcherControlHandle;
13588
13589 fn control_handle(&self) -> &ScanResultWatcherControlHandle {
13590 &self.control_handle
13591 }
13592
13593 fn drop_without_shutdown(mut self) {
13594 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13596 std::mem::forget(self);
13598 }
13599}
13600
13601impl ScanResultWatcherWatchResponder {
13602 pub fn send(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13606 let _result = self.send_raw(updated);
13607 if _result.is_err() {
13608 self.control_handle.shutdown();
13609 }
13610 self.drop_without_shutdown();
13611 _result
13612 }
13613
13614 pub fn send_no_shutdown_on_err(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13616 let _result = self.send_raw(updated);
13617 self.drop_without_shutdown();
13618 _result
13619 }
13620
13621 fn send_raw(&self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13622 self.control_handle.inner.send::<ScanResultWatcherWatchResponse>(
13623 (updated,),
13624 self.tx_id,
13625 0x713a122e949f301a,
13626 fidl::encoding::DynamicFlags::empty(),
13627 )
13628 }
13629}
13630
13631mod internal {
13632 use super::*;
13633
13634 impl fidl::encoding::ResourceTypeMarker for AdvertisedPeripheralOnConnectedRequest {
13635 type Borrowed<'a> = &'a mut Self;
13636 fn take_or_borrow<'a>(
13637 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13638 ) -> Self::Borrowed<'a> {
13639 value
13640 }
13641 }
13642
13643 unsafe impl fidl::encoding::TypeMarker for AdvertisedPeripheralOnConnectedRequest {
13644 type Owned = Self;
13645
13646 #[inline(always)]
13647 fn inline_align(_context: fidl::encoding::Context) -> usize {
13648 8
13649 }
13650
13651 #[inline(always)]
13652 fn inline_size(_context: fidl::encoding::Context) -> usize {
13653 24
13654 }
13655 }
13656
13657 unsafe impl
13658 fidl::encoding::Encode<
13659 AdvertisedPeripheralOnConnectedRequest,
13660 fidl::encoding::DefaultFuchsiaResourceDialect,
13661 > for &mut AdvertisedPeripheralOnConnectedRequest
13662 {
13663 #[inline]
13664 unsafe fn encode(
13665 self,
13666 encoder: &mut fidl::encoding::Encoder<
13667 '_,
13668 fidl::encoding::DefaultFuchsiaResourceDialect,
13669 >,
13670 offset: usize,
13671 _depth: fidl::encoding::Depth,
13672 ) -> fidl::Result<()> {
13673 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
13674 fidl::encoding::Encode::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13676 (
13677 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
13678 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
13679 ),
13680 encoder, offset, _depth
13681 )
13682 }
13683 }
13684 unsafe impl<
13685 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
13686 T1: fidl::encoding::Encode<
13687 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13688 fidl::encoding::DefaultFuchsiaResourceDialect,
13689 >,
13690 >
13691 fidl::encoding::Encode<
13692 AdvertisedPeripheralOnConnectedRequest,
13693 fidl::encoding::DefaultFuchsiaResourceDialect,
13694 > for (T0, T1)
13695 {
13696 #[inline]
13697 unsafe fn encode(
13698 self,
13699 encoder: &mut fidl::encoding::Encoder<
13700 '_,
13701 fidl::encoding::DefaultFuchsiaResourceDialect,
13702 >,
13703 offset: usize,
13704 depth: fidl::encoding::Depth,
13705 ) -> fidl::Result<()> {
13706 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
13707 unsafe {
13710 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13711 (ptr as *mut u64).write_unaligned(0);
13712 }
13713 self.0.encode(encoder, offset + 0, depth)?;
13715 self.1.encode(encoder, offset + 16, depth)?;
13716 Ok(())
13717 }
13718 }
13719
13720 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13721 for AdvertisedPeripheralOnConnectedRequest
13722 {
13723 #[inline(always)]
13724 fn new_empty() -> Self {
13725 Self {
13726 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
13727 connection: fidl::new_empty!(
13728 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13729 fidl::encoding::DefaultFuchsiaResourceDialect
13730 ),
13731 }
13732 }
13733
13734 #[inline]
13735 unsafe fn decode(
13736 &mut self,
13737 decoder: &mut fidl::encoding::Decoder<
13738 '_,
13739 fidl::encoding::DefaultFuchsiaResourceDialect,
13740 >,
13741 offset: usize,
13742 _depth: fidl::encoding::Depth,
13743 ) -> fidl::Result<()> {
13744 decoder.debug_check_bounds::<Self>(offset);
13745 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13747 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13748 let mask = 0xffffffff00000000u64;
13749 let maskedval = padval & mask;
13750 if maskedval != 0 {
13751 return Err(fidl::Error::NonZeroPadding {
13752 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13753 });
13754 }
13755 fidl::decode!(
13756 Peer,
13757 fidl::encoding::DefaultFuchsiaResourceDialect,
13758 &mut self.peer,
13759 decoder,
13760 offset + 0,
13761 _depth
13762 )?;
13763 fidl::decode!(
13764 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13765 fidl::encoding::DefaultFuchsiaResourceDialect,
13766 &mut self.connection,
13767 decoder,
13768 offset + 16,
13769 _depth
13770 )?;
13771 Ok(())
13772 }
13773 }
13774
13775 impl fidl::encoding::ResourceTypeMarker for CentralConnectPeripheralRequest {
13776 type Borrowed<'a> = &'a mut Self;
13777 fn take_or_borrow<'a>(
13778 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13779 ) -> Self::Borrowed<'a> {
13780 value
13781 }
13782 }
13783
13784 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralRequest {
13785 type Owned = Self;
13786
13787 #[inline(always)]
13788 fn inline_align(_context: fidl::encoding::Context) -> usize {
13789 8
13790 }
13791
13792 #[inline(always)]
13793 fn inline_size(_context: fidl::encoding::Context) -> usize {
13794 40
13795 }
13796 }
13797
13798 unsafe impl
13799 fidl::encoding::Encode<
13800 CentralConnectPeripheralRequest,
13801 fidl::encoding::DefaultFuchsiaResourceDialect,
13802 > for &mut CentralConnectPeripheralRequest
13803 {
13804 #[inline]
13805 unsafe fn encode(
13806 self,
13807 encoder: &mut fidl::encoding::Encoder<
13808 '_,
13809 fidl::encoding::DefaultFuchsiaResourceDialect,
13810 >,
13811 offset: usize,
13812 _depth: fidl::encoding::Depth,
13813 ) -> fidl::Result<()> {
13814 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
13815 fidl::encoding::Encode::<
13817 CentralConnectPeripheralRequest,
13818 fidl::encoding::DefaultFuchsiaResourceDialect,
13819 >::encode(
13820 (
13821 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
13822 &self.identifier,
13823 ),
13824 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
13825 <fidl::encoding::Endpoint<
13826 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13827 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13828 &mut self.gatt_client
13829 ),
13830 ),
13831 encoder,
13832 offset,
13833 _depth,
13834 )
13835 }
13836 }
13837 unsafe impl<
13838 T0: fidl::encoding::Encode<
13839 fidl::encoding::BoundedString<16>,
13840 fidl::encoding::DefaultFuchsiaResourceDialect,
13841 >,
13842 T1: fidl::encoding::Encode<ConnectionOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
13843 T2: fidl::encoding::Encode<
13844 fidl::encoding::Endpoint<
13845 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13846 >,
13847 fidl::encoding::DefaultFuchsiaResourceDialect,
13848 >,
13849 >
13850 fidl::encoding::Encode<
13851 CentralConnectPeripheralRequest,
13852 fidl::encoding::DefaultFuchsiaResourceDialect,
13853 > for (T0, T1, T2)
13854 {
13855 #[inline]
13856 unsafe fn encode(
13857 self,
13858 encoder: &mut fidl::encoding::Encoder<
13859 '_,
13860 fidl::encoding::DefaultFuchsiaResourceDialect,
13861 >,
13862 offset: usize,
13863 depth: fidl::encoding::Depth,
13864 ) -> fidl::Result<()> {
13865 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
13866 unsafe {
13869 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13870 (ptr as *mut u64).write_unaligned(0);
13871 }
13872 self.0.encode(encoder, offset + 0, depth)?;
13874 self.1.encode(encoder, offset + 16, depth)?;
13875 self.2.encode(encoder, offset + 32, depth)?;
13876 Ok(())
13877 }
13878 }
13879
13880 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13881 for CentralConnectPeripheralRequest
13882 {
13883 #[inline(always)]
13884 fn new_empty() -> Self {
13885 Self {
13886 identifier: fidl::new_empty!(
13887 fidl::encoding::BoundedString<16>,
13888 fidl::encoding::DefaultFuchsiaResourceDialect
13889 ),
13890 options: fidl::new_empty!(
13891 ConnectionOptions,
13892 fidl::encoding::DefaultFuchsiaResourceDialect
13893 ),
13894 gatt_client: fidl::new_empty!(
13895 fidl::encoding::Endpoint<
13896 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13897 >,
13898 fidl::encoding::DefaultFuchsiaResourceDialect
13899 ),
13900 }
13901 }
13902
13903 #[inline]
13904 unsafe fn decode(
13905 &mut self,
13906 decoder: &mut fidl::encoding::Decoder<
13907 '_,
13908 fidl::encoding::DefaultFuchsiaResourceDialect,
13909 >,
13910 offset: usize,
13911 _depth: fidl::encoding::Depth,
13912 ) -> fidl::Result<()> {
13913 decoder.debug_check_bounds::<Self>(offset);
13914 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13916 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13917 let mask = 0xffffffff00000000u64;
13918 let maskedval = padval & mask;
13919 if maskedval != 0 {
13920 return Err(fidl::Error::NonZeroPadding {
13921 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13922 });
13923 }
13924 fidl::decode!(
13925 fidl::encoding::BoundedString<16>,
13926 fidl::encoding::DefaultFuchsiaResourceDialect,
13927 &mut self.identifier,
13928 decoder,
13929 offset + 0,
13930 _depth
13931 )?;
13932 fidl::decode!(
13933 ConnectionOptions,
13934 fidl::encoding::DefaultFuchsiaResourceDialect,
13935 &mut self.options,
13936 decoder,
13937 offset + 16,
13938 _depth
13939 )?;
13940 fidl::decode!(
13941 fidl::encoding::Endpoint<
13942 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13943 >,
13944 fidl::encoding::DefaultFuchsiaResourceDialect,
13945 &mut self.gatt_client,
13946 decoder,
13947 offset + 32,
13948 _depth
13949 )?;
13950 Ok(())
13951 }
13952 }
13953
13954 impl fidl::encoding::ResourceTypeMarker for CentralConnectRequest {
13955 type Borrowed<'a> = &'a mut Self;
13956 fn take_or_borrow<'a>(
13957 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13958 ) -> Self::Borrowed<'a> {
13959 value
13960 }
13961 }
13962
13963 unsafe impl fidl::encoding::TypeMarker for CentralConnectRequest {
13964 type Owned = Self;
13965
13966 #[inline(always)]
13967 fn inline_align(_context: fidl::encoding::Context) -> usize {
13968 8
13969 }
13970
13971 #[inline(always)]
13972 fn inline_size(_context: fidl::encoding::Context) -> usize {
13973 32
13974 }
13975 }
13976
13977 unsafe impl
13978 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13979 for &mut CentralConnectRequest
13980 {
13981 #[inline]
13982 unsafe fn encode(
13983 self,
13984 encoder: &mut fidl::encoding::Encoder<
13985 '_,
13986 fidl::encoding::DefaultFuchsiaResourceDialect,
13987 >,
13988 offset: usize,
13989 _depth: fidl::encoding::Depth,
13990 ) -> fidl::Result<()> {
13991 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
13992 fidl::encoding::Encode::<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13994 (
13995 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
13996 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
13997 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
13998 ),
13999 encoder, offset, _depth
14000 )
14001 }
14002 }
14003 unsafe impl<
14004 T0: fidl::encoding::Encode<
14005 fidl_fuchsia_bluetooth::PeerId,
14006 fidl::encoding::DefaultFuchsiaResourceDialect,
14007 >,
14008 T1: fidl::encoding::Encode<ConnectionOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
14009 T2: fidl::encoding::Encode<
14010 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
14011 fidl::encoding::DefaultFuchsiaResourceDialect,
14012 >,
14013 >
14014 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
14015 for (T0, T1, T2)
14016 {
14017 #[inline]
14018 unsafe fn encode(
14019 self,
14020 encoder: &mut fidl::encoding::Encoder<
14021 '_,
14022 fidl::encoding::DefaultFuchsiaResourceDialect,
14023 >,
14024 offset: usize,
14025 depth: fidl::encoding::Depth,
14026 ) -> fidl::Result<()> {
14027 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
14028 unsafe {
14031 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
14032 (ptr as *mut u64).write_unaligned(0);
14033 }
14034 self.0.encode(encoder, offset + 0, depth)?;
14036 self.1.encode(encoder, offset + 8, depth)?;
14037 self.2.encode(encoder, offset + 24, depth)?;
14038 Ok(())
14039 }
14040 }
14041
14042 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14043 for CentralConnectRequest
14044 {
14045 #[inline(always)]
14046 fn new_empty() -> Self {
14047 Self {
14048 id: fidl::new_empty!(
14049 fidl_fuchsia_bluetooth::PeerId,
14050 fidl::encoding::DefaultFuchsiaResourceDialect
14051 ),
14052 options: fidl::new_empty!(
14053 ConnectionOptions,
14054 fidl::encoding::DefaultFuchsiaResourceDialect
14055 ),
14056 handle: fidl::new_empty!(
14057 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
14058 fidl::encoding::DefaultFuchsiaResourceDialect
14059 ),
14060 }
14061 }
14062
14063 #[inline]
14064 unsafe fn decode(
14065 &mut self,
14066 decoder: &mut fidl::encoding::Decoder<
14067 '_,
14068 fidl::encoding::DefaultFuchsiaResourceDialect,
14069 >,
14070 offset: usize,
14071 _depth: fidl::encoding::Depth,
14072 ) -> fidl::Result<()> {
14073 decoder.debug_check_bounds::<Self>(offset);
14074 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14076 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14077 let mask = 0xffffffff00000000u64;
14078 let maskedval = padval & mask;
14079 if maskedval != 0 {
14080 return Err(fidl::Error::NonZeroPadding {
14081 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14082 });
14083 }
14084 fidl::decode!(
14085 fidl_fuchsia_bluetooth::PeerId,
14086 fidl::encoding::DefaultFuchsiaResourceDialect,
14087 &mut self.id,
14088 decoder,
14089 offset + 0,
14090 _depth
14091 )?;
14092 fidl::decode!(
14093 ConnectionOptions,
14094 fidl::encoding::DefaultFuchsiaResourceDialect,
14095 &mut self.options,
14096 decoder,
14097 offset + 8,
14098 _depth
14099 )?;
14100 fidl::decode!(
14101 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
14102 fidl::encoding::DefaultFuchsiaResourceDialect,
14103 &mut self.handle,
14104 decoder,
14105 offset + 24,
14106 _depth
14107 )?;
14108 Ok(())
14109 }
14110 }
14111
14112 impl fidl::encoding::ResourceTypeMarker for CentralScanRequest {
14113 type Borrowed<'a> = &'a mut Self;
14114 fn take_or_borrow<'a>(
14115 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14116 ) -> Self::Borrowed<'a> {
14117 value
14118 }
14119 }
14120
14121 unsafe impl fidl::encoding::TypeMarker for CentralScanRequest {
14122 type Owned = Self;
14123
14124 #[inline(always)]
14125 fn inline_align(_context: fidl::encoding::Context) -> usize {
14126 8
14127 }
14128
14129 #[inline(always)]
14130 fn inline_size(_context: fidl::encoding::Context) -> usize {
14131 24
14132 }
14133 }
14134
14135 unsafe impl
14136 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
14137 for &mut CentralScanRequest
14138 {
14139 #[inline]
14140 unsafe fn encode(
14141 self,
14142 encoder: &mut fidl::encoding::Encoder<
14143 '_,
14144 fidl::encoding::DefaultFuchsiaResourceDialect,
14145 >,
14146 offset: usize,
14147 _depth: fidl::encoding::Depth,
14148 ) -> fidl::Result<()> {
14149 encoder.debug_check_bounds::<CentralScanRequest>(offset);
14150 fidl::encoding::Encode::<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14152 (
14153 <ScanOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
14154 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_watcher),
14155 ),
14156 encoder, offset, _depth
14157 )
14158 }
14159 }
14160 unsafe impl<
14161 T0: fidl::encoding::Encode<ScanOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
14162 T1: fidl::encoding::Encode<
14163 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14164 fidl::encoding::DefaultFuchsiaResourceDialect,
14165 >,
14166 > fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
14167 for (T0, T1)
14168 {
14169 #[inline]
14170 unsafe fn encode(
14171 self,
14172 encoder: &mut fidl::encoding::Encoder<
14173 '_,
14174 fidl::encoding::DefaultFuchsiaResourceDialect,
14175 >,
14176 offset: usize,
14177 depth: fidl::encoding::Depth,
14178 ) -> fidl::Result<()> {
14179 encoder.debug_check_bounds::<CentralScanRequest>(offset);
14180 unsafe {
14183 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14184 (ptr as *mut u64).write_unaligned(0);
14185 }
14186 self.0.encode(encoder, offset + 0, depth)?;
14188 self.1.encode(encoder, offset + 16, depth)?;
14189 Ok(())
14190 }
14191 }
14192
14193 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14194 for CentralScanRequest
14195 {
14196 #[inline(always)]
14197 fn new_empty() -> Self {
14198 Self {
14199 options: fidl::new_empty!(
14200 ScanOptions,
14201 fidl::encoding::DefaultFuchsiaResourceDialect
14202 ),
14203 result_watcher: fidl::new_empty!(
14204 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14205 fidl::encoding::DefaultFuchsiaResourceDialect
14206 ),
14207 }
14208 }
14209
14210 #[inline]
14211 unsafe fn decode(
14212 &mut self,
14213 decoder: &mut fidl::encoding::Decoder<
14214 '_,
14215 fidl::encoding::DefaultFuchsiaResourceDialect,
14216 >,
14217 offset: usize,
14218 _depth: fidl::encoding::Depth,
14219 ) -> fidl::Result<()> {
14220 decoder.debug_check_bounds::<Self>(offset);
14221 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14223 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14224 let mask = 0xffffffff00000000u64;
14225 let maskedval = padval & mask;
14226 if maskedval != 0 {
14227 return Err(fidl::Error::NonZeroPadding {
14228 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14229 });
14230 }
14231 fidl::decode!(
14232 ScanOptions,
14233 fidl::encoding::DefaultFuchsiaResourceDialect,
14234 &mut self.options,
14235 decoder,
14236 offset + 0,
14237 _depth
14238 )?;
14239 fidl::decode!(
14240 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14241 fidl::encoding::DefaultFuchsiaResourceDialect,
14242 &mut self.result_watcher,
14243 decoder,
14244 offset + 16,
14245 _depth
14246 )?;
14247 Ok(())
14248 }
14249 }
14250
14251 impl fidl::encoding::ResourceTypeMarker for ChannelListenerAcceptRequest {
14252 type Borrowed<'a> = &'a mut Self;
14253 fn take_or_borrow<'a>(
14254 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14255 ) -> Self::Borrowed<'a> {
14256 value
14257 }
14258 }
14259
14260 unsafe impl fidl::encoding::TypeMarker for ChannelListenerAcceptRequest {
14261 type Owned = Self;
14262
14263 #[inline(always)]
14264 fn inline_align(_context: fidl::encoding::Context) -> usize {
14265 4
14266 }
14267
14268 #[inline(always)]
14269 fn inline_size(_context: fidl::encoding::Context) -> usize {
14270 4
14271 }
14272 }
14273
14274 unsafe impl
14275 fidl::encoding::Encode<
14276 ChannelListenerAcceptRequest,
14277 fidl::encoding::DefaultFuchsiaResourceDialect,
14278 > for &mut ChannelListenerAcceptRequest
14279 {
14280 #[inline]
14281 unsafe fn encode(
14282 self,
14283 encoder: &mut fidl::encoding::Encoder<
14284 '_,
14285 fidl::encoding::DefaultFuchsiaResourceDialect,
14286 >,
14287 offset: usize,
14288 _depth: fidl::encoding::Depth,
14289 ) -> fidl::Result<()> {
14290 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
14291 fidl::encoding::Encode::<
14293 ChannelListenerAcceptRequest,
14294 fidl::encoding::DefaultFuchsiaResourceDialect,
14295 >::encode(
14296 (<fidl::encoding::Endpoint<
14297 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14298 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14299 &mut self.channel
14300 ),),
14301 encoder,
14302 offset,
14303 _depth,
14304 )
14305 }
14306 }
14307 unsafe impl<
14308 T0: fidl::encoding::Encode<
14309 fidl::encoding::Endpoint<
14310 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14311 >,
14312 fidl::encoding::DefaultFuchsiaResourceDialect,
14313 >,
14314 >
14315 fidl::encoding::Encode<
14316 ChannelListenerAcceptRequest,
14317 fidl::encoding::DefaultFuchsiaResourceDialect,
14318 > for (T0,)
14319 {
14320 #[inline]
14321 unsafe fn encode(
14322 self,
14323 encoder: &mut fidl::encoding::Encoder<
14324 '_,
14325 fidl::encoding::DefaultFuchsiaResourceDialect,
14326 >,
14327 offset: usize,
14328 depth: fidl::encoding::Depth,
14329 ) -> fidl::Result<()> {
14330 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
14331 self.0.encode(encoder, offset + 0, depth)?;
14335 Ok(())
14336 }
14337 }
14338
14339 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14340 for ChannelListenerAcceptRequest
14341 {
14342 #[inline(always)]
14343 fn new_empty() -> Self {
14344 Self {
14345 channel: fidl::new_empty!(
14346 fidl::encoding::Endpoint<
14347 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14348 >,
14349 fidl::encoding::DefaultFuchsiaResourceDialect
14350 ),
14351 }
14352 }
14353
14354 #[inline]
14355 unsafe fn decode(
14356 &mut self,
14357 decoder: &mut fidl::encoding::Decoder<
14358 '_,
14359 fidl::encoding::DefaultFuchsiaResourceDialect,
14360 >,
14361 offset: usize,
14362 _depth: fidl::encoding::Depth,
14363 ) -> fidl::Result<()> {
14364 decoder.debug_check_bounds::<Self>(offset);
14365 fidl::decode!(
14367 fidl::encoding::Endpoint<
14368 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14369 >,
14370 fidl::encoding::DefaultFuchsiaResourceDialect,
14371 &mut self.channel,
14372 decoder,
14373 offset + 0,
14374 _depth
14375 )?;
14376 Ok(())
14377 }
14378 }
14379
14380 impl fidl::encoding::ResourceTypeMarker for ConnectionRequestGattClientRequest {
14381 type Borrowed<'a> = &'a mut Self;
14382 fn take_or_borrow<'a>(
14383 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14384 ) -> Self::Borrowed<'a> {
14385 value
14386 }
14387 }
14388
14389 unsafe impl fidl::encoding::TypeMarker for ConnectionRequestGattClientRequest {
14390 type Owned = Self;
14391
14392 #[inline(always)]
14393 fn inline_align(_context: fidl::encoding::Context) -> usize {
14394 4
14395 }
14396
14397 #[inline(always)]
14398 fn inline_size(_context: fidl::encoding::Context) -> usize {
14399 4
14400 }
14401 }
14402
14403 unsafe impl
14404 fidl::encoding::Encode<
14405 ConnectionRequestGattClientRequest,
14406 fidl::encoding::DefaultFuchsiaResourceDialect,
14407 > for &mut ConnectionRequestGattClientRequest
14408 {
14409 #[inline]
14410 unsafe fn encode(
14411 self,
14412 encoder: &mut fidl::encoding::Encoder<
14413 '_,
14414 fidl::encoding::DefaultFuchsiaResourceDialect,
14415 >,
14416 offset: usize,
14417 _depth: fidl::encoding::Depth,
14418 ) -> fidl::Result<()> {
14419 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
14420 fidl::encoding::Encode::<
14422 ConnectionRequestGattClientRequest,
14423 fidl::encoding::DefaultFuchsiaResourceDialect,
14424 >::encode(
14425 (<fidl::encoding::Endpoint<
14426 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14427 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14428 &mut self.client
14429 ),),
14430 encoder,
14431 offset,
14432 _depth,
14433 )
14434 }
14435 }
14436 unsafe impl<
14437 T0: fidl::encoding::Encode<
14438 fidl::encoding::Endpoint<
14439 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14440 >,
14441 fidl::encoding::DefaultFuchsiaResourceDialect,
14442 >,
14443 >
14444 fidl::encoding::Encode<
14445 ConnectionRequestGattClientRequest,
14446 fidl::encoding::DefaultFuchsiaResourceDialect,
14447 > for (T0,)
14448 {
14449 #[inline]
14450 unsafe fn encode(
14451 self,
14452 encoder: &mut fidl::encoding::Encoder<
14453 '_,
14454 fidl::encoding::DefaultFuchsiaResourceDialect,
14455 >,
14456 offset: usize,
14457 depth: fidl::encoding::Depth,
14458 ) -> fidl::Result<()> {
14459 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
14460 self.0.encode(encoder, offset + 0, depth)?;
14464 Ok(())
14465 }
14466 }
14467
14468 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14469 for ConnectionRequestGattClientRequest
14470 {
14471 #[inline(always)]
14472 fn new_empty() -> Self {
14473 Self {
14474 client: fidl::new_empty!(
14475 fidl::encoding::Endpoint<
14476 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14477 >,
14478 fidl::encoding::DefaultFuchsiaResourceDialect
14479 ),
14480 }
14481 }
14482
14483 #[inline]
14484 unsafe fn decode(
14485 &mut self,
14486 decoder: &mut fidl::encoding::Decoder<
14487 '_,
14488 fidl::encoding::DefaultFuchsiaResourceDialect,
14489 >,
14490 offset: usize,
14491 _depth: fidl::encoding::Depth,
14492 ) -> fidl::Result<()> {
14493 decoder.debug_check_bounds::<Self>(offset);
14494 fidl::decode!(
14496 fidl::encoding::Endpoint<
14497 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14498 >,
14499 fidl::encoding::DefaultFuchsiaResourceDialect,
14500 &mut self.client,
14501 decoder,
14502 offset + 0,
14503 _depth
14504 )?;
14505 Ok(())
14506 }
14507 }
14508
14509 impl fidl::encoding::ResourceTypeMarker for PeripheralAdvertiseRequest {
14510 type Borrowed<'a> = &'a mut Self;
14511 fn take_or_borrow<'a>(
14512 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14513 ) -> Self::Borrowed<'a> {
14514 value
14515 }
14516 }
14517
14518 unsafe impl fidl::encoding::TypeMarker for PeripheralAdvertiseRequest {
14519 type Owned = Self;
14520
14521 #[inline(always)]
14522 fn inline_align(_context: fidl::encoding::Context) -> usize {
14523 8
14524 }
14525
14526 #[inline(always)]
14527 fn inline_size(_context: fidl::encoding::Context) -> usize {
14528 24
14529 }
14530 }
14531
14532 unsafe impl
14533 fidl::encoding::Encode<
14534 PeripheralAdvertiseRequest,
14535 fidl::encoding::DefaultFuchsiaResourceDialect,
14536 > for &mut PeripheralAdvertiseRequest
14537 {
14538 #[inline]
14539 unsafe fn encode(
14540 self,
14541 encoder: &mut fidl::encoding::Encoder<
14542 '_,
14543 fidl::encoding::DefaultFuchsiaResourceDialect,
14544 >,
14545 offset: usize,
14546 _depth: fidl::encoding::Depth,
14547 ) -> fidl::Result<()> {
14548 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
14549 fidl::encoding::Encode::<
14551 PeripheralAdvertiseRequest,
14552 fidl::encoding::DefaultFuchsiaResourceDialect,
14553 >::encode(
14554 (
14555 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(
14556 &self.parameters,
14557 ),
14558 <fidl::encoding::Endpoint<
14559 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
14560 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14561 &mut self.advertised_peripheral,
14562 ),
14563 ),
14564 encoder,
14565 offset,
14566 _depth,
14567 )
14568 }
14569 }
14570 unsafe impl<
14571 T0: fidl::encoding::Encode<
14572 AdvertisingParameters,
14573 fidl::encoding::DefaultFuchsiaResourceDialect,
14574 >,
14575 T1: fidl::encoding::Encode<
14576 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
14577 fidl::encoding::DefaultFuchsiaResourceDialect,
14578 >,
14579 >
14580 fidl::encoding::Encode<
14581 PeripheralAdvertiseRequest,
14582 fidl::encoding::DefaultFuchsiaResourceDialect,
14583 > for (T0, T1)
14584 {
14585 #[inline]
14586 unsafe fn encode(
14587 self,
14588 encoder: &mut fidl::encoding::Encoder<
14589 '_,
14590 fidl::encoding::DefaultFuchsiaResourceDialect,
14591 >,
14592 offset: usize,
14593 depth: fidl::encoding::Depth,
14594 ) -> fidl::Result<()> {
14595 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
14596 unsafe {
14599 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14600 (ptr as *mut u64).write_unaligned(0);
14601 }
14602 self.0.encode(encoder, offset + 0, depth)?;
14604 self.1.encode(encoder, offset + 16, depth)?;
14605 Ok(())
14606 }
14607 }
14608
14609 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14610 for PeripheralAdvertiseRequest
14611 {
14612 #[inline(always)]
14613 fn new_empty() -> Self {
14614 Self {
14615 parameters: fidl::new_empty!(
14616 AdvertisingParameters,
14617 fidl::encoding::DefaultFuchsiaResourceDialect
14618 ),
14619 advertised_peripheral: fidl::new_empty!(
14620 fidl::encoding::Endpoint<
14621 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
14622 >,
14623 fidl::encoding::DefaultFuchsiaResourceDialect
14624 ),
14625 }
14626 }
14627
14628 #[inline]
14629 unsafe fn decode(
14630 &mut self,
14631 decoder: &mut fidl::encoding::Decoder<
14632 '_,
14633 fidl::encoding::DefaultFuchsiaResourceDialect,
14634 >,
14635 offset: usize,
14636 _depth: fidl::encoding::Depth,
14637 ) -> fidl::Result<()> {
14638 decoder.debug_check_bounds::<Self>(offset);
14639 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14641 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14642 let mask = 0xffffffff00000000u64;
14643 let maskedval = padval & mask;
14644 if maskedval != 0 {
14645 return Err(fidl::Error::NonZeroPadding {
14646 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14647 });
14648 }
14649 fidl::decode!(
14650 AdvertisingParameters,
14651 fidl::encoding::DefaultFuchsiaResourceDialect,
14652 &mut self.parameters,
14653 decoder,
14654 offset + 0,
14655 _depth
14656 )?;
14657 fidl::decode!(
14658 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
14659 fidl::encoding::DefaultFuchsiaResourceDialect,
14660 &mut self.advertised_peripheral,
14661 decoder,
14662 offset + 16,
14663 _depth
14664 )?;
14665 Ok(())
14666 }
14667 }
14668
14669 impl fidl::encoding::ResourceTypeMarker for PeripheralOnPeerConnectedRequest {
14670 type Borrowed<'a> = &'a mut Self;
14671 fn take_or_borrow<'a>(
14672 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14673 ) -> Self::Borrowed<'a> {
14674 value
14675 }
14676 }
14677
14678 unsafe impl fidl::encoding::TypeMarker for PeripheralOnPeerConnectedRequest {
14679 type Owned = Self;
14680
14681 #[inline(always)]
14682 fn inline_align(_context: fidl::encoding::Context) -> usize {
14683 8
14684 }
14685
14686 #[inline(always)]
14687 fn inline_size(_context: fidl::encoding::Context) -> usize {
14688 24
14689 }
14690 }
14691
14692 unsafe impl
14693 fidl::encoding::Encode<
14694 PeripheralOnPeerConnectedRequest,
14695 fidl::encoding::DefaultFuchsiaResourceDialect,
14696 > for &mut PeripheralOnPeerConnectedRequest
14697 {
14698 #[inline]
14699 unsafe fn encode(
14700 self,
14701 encoder: &mut fidl::encoding::Encoder<
14702 '_,
14703 fidl::encoding::DefaultFuchsiaResourceDialect,
14704 >,
14705 offset: usize,
14706 _depth: fidl::encoding::Depth,
14707 ) -> fidl::Result<()> {
14708 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
14709 fidl::encoding::Encode::<PeripheralOnPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14711 (
14712 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
14713 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
14714 ),
14715 encoder, offset, _depth
14716 )
14717 }
14718 }
14719 unsafe impl<
14720 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
14721 T1: fidl::encoding::Encode<
14722 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14723 fidl::encoding::DefaultFuchsiaResourceDialect,
14724 >,
14725 >
14726 fidl::encoding::Encode<
14727 PeripheralOnPeerConnectedRequest,
14728 fidl::encoding::DefaultFuchsiaResourceDialect,
14729 > for (T0, T1)
14730 {
14731 #[inline]
14732 unsafe fn encode(
14733 self,
14734 encoder: &mut fidl::encoding::Encoder<
14735 '_,
14736 fidl::encoding::DefaultFuchsiaResourceDialect,
14737 >,
14738 offset: usize,
14739 depth: fidl::encoding::Depth,
14740 ) -> fidl::Result<()> {
14741 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
14742 unsafe {
14745 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14746 (ptr as *mut u64).write_unaligned(0);
14747 }
14748 self.0.encode(encoder, offset + 0, depth)?;
14750 self.1.encode(encoder, offset + 16, depth)?;
14751 Ok(())
14752 }
14753 }
14754
14755 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14756 for PeripheralOnPeerConnectedRequest
14757 {
14758 #[inline(always)]
14759 fn new_empty() -> Self {
14760 Self {
14761 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
14762 connection: fidl::new_empty!(
14763 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14764 fidl::encoding::DefaultFuchsiaResourceDialect
14765 ),
14766 }
14767 }
14768
14769 #[inline]
14770 unsafe fn decode(
14771 &mut self,
14772 decoder: &mut fidl::encoding::Decoder<
14773 '_,
14774 fidl::encoding::DefaultFuchsiaResourceDialect,
14775 >,
14776 offset: usize,
14777 _depth: fidl::encoding::Depth,
14778 ) -> fidl::Result<()> {
14779 decoder.debug_check_bounds::<Self>(offset);
14780 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14782 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14783 let mask = 0xffffffff00000000u64;
14784 let maskedval = padval & mask;
14785 if maskedval != 0 {
14786 return Err(fidl::Error::NonZeroPadding {
14787 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14788 });
14789 }
14790 fidl::decode!(
14791 Peer,
14792 fidl::encoding::DefaultFuchsiaResourceDialect,
14793 &mut self.peer,
14794 decoder,
14795 offset + 0,
14796 _depth
14797 )?;
14798 fidl::decode!(
14799 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14800 fidl::encoding::DefaultFuchsiaResourceDialect,
14801 &mut self.connection,
14802 decoder,
14803 offset + 16,
14804 _depth
14805 )?;
14806 Ok(())
14807 }
14808 }
14809
14810 impl fidl::encoding::ResourceTypeMarker for PeripheralStartAdvertisingRequest {
14811 type Borrowed<'a> = &'a mut Self;
14812 fn take_or_borrow<'a>(
14813 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14814 ) -> Self::Borrowed<'a> {
14815 value
14816 }
14817 }
14818
14819 unsafe impl fidl::encoding::TypeMarker for PeripheralStartAdvertisingRequest {
14820 type Owned = Self;
14821
14822 #[inline(always)]
14823 fn inline_align(_context: fidl::encoding::Context) -> usize {
14824 8
14825 }
14826
14827 #[inline(always)]
14828 fn inline_size(_context: fidl::encoding::Context) -> usize {
14829 24
14830 }
14831 }
14832
14833 unsafe impl
14834 fidl::encoding::Encode<
14835 PeripheralStartAdvertisingRequest,
14836 fidl::encoding::DefaultFuchsiaResourceDialect,
14837 > for &mut PeripheralStartAdvertisingRequest
14838 {
14839 #[inline]
14840 unsafe fn encode(
14841 self,
14842 encoder: &mut fidl::encoding::Encoder<
14843 '_,
14844 fidl::encoding::DefaultFuchsiaResourceDialect,
14845 >,
14846 offset: usize,
14847 _depth: fidl::encoding::Depth,
14848 ) -> fidl::Result<()> {
14849 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
14850 fidl::encoding::Encode::<PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14852 (
14853 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
14854 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
14855 ),
14856 encoder, offset, _depth
14857 )
14858 }
14859 }
14860 unsafe impl<
14861 T0: fidl::encoding::Encode<
14862 AdvertisingParameters,
14863 fidl::encoding::DefaultFuchsiaResourceDialect,
14864 >,
14865 T1: fidl::encoding::Encode<
14866 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14867 fidl::encoding::DefaultFuchsiaResourceDialect,
14868 >,
14869 >
14870 fidl::encoding::Encode<
14871 PeripheralStartAdvertisingRequest,
14872 fidl::encoding::DefaultFuchsiaResourceDialect,
14873 > for (T0, T1)
14874 {
14875 #[inline]
14876 unsafe fn encode(
14877 self,
14878 encoder: &mut fidl::encoding::Encoder<
14879 '_,
14880 fidl::encoding::DefaultFuchsiaResourceDialect,
14881 >,
14882 offset: usize,
14883 depth: fidl::encoding::Depth,
14884 ) -> fidl::Result<()> {
14885 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
14886 unsafe {
14889 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14890 (ptr as *mut u64).write_unaligned(0);
14891 }
14892 self.0.encode(encoder, offset + 0, depth)?;
14894 self.1.encode(encoder, offset + 16, depth)?;
14895 Ok(())
14896 }
14897 }
14898
14899 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14900 for PeripheralStartAdvertisingRequest
14901 {
14902 #[inline(always)]
14903 fn new_empty() -> Self {
14904 Self {
14905 parameters: fidl::new_empty!(
14906 AdvertisingParameters,
14907 fidl::encoding::DefaultFuchsiaResourceDialect
14908 ),
14909 handle: fidl::new_empty!(
14910 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14911 fidl::encoding::DefaultFuchsiaResourceDialect
14912 ),
14913 }
14914 }
14915
14916 #[inline]
14917 unsafe fn decode(
14918 &mut self,
14919 decoder: &mut fidl::encoding::Decoder<
14920 '_,
14921 fidl::encoding::DefaultFuchsiaResourceDialect,
14922 >,
14923 offset: usize,
14924 _depth: fidl::encoding::Depth,
14925 ) -> fidl::Result<()> {
14926 decoder.debug_check_bounds::<Self>(offset);
14927 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14929 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14930 let mask = 0xffffffff00000000u64;
14931 let maskedval = padval & mask;
14932 if maskedval != 0 {
14933 return Err(fidl::Error::NonZeroPadding {
14934 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14935 });
14936 }
14937 fidl::decode!(
14938 AdvertisingParameters,
14939 fidl::encoding::DefaultFuchsiaResourceDialect,
14940 &mut self.parameters,
14941 decoder,
14942 offset + 0,
14943 _depth
14944 )?;
14945 fidl::decode!(
14946 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14947 fidl::encoding::DefaultFuchsiaResourceDialect,
14948 &mut self.handle,
14949 decoder,
14950 offset + 16,
14951 _depth
14952 )?;
14953 Ok(())
14954 }
14955 }
14956
14957 impl CentralCreateConnectedIsochronousGroupRequest {
14958 #[inline(always)]
14959 fn max_ordinal_present(&self) -> u64 {
14960 if let Some(_) = self.cig {
14961 return 3;
14962 }
14963 if let Some(_) = self.cis_requested_parameters {
14964 return 2;
14965 }
14966 if let Some(_) = self.cig_parameters {
14967 return 1;
14968 }
14969 0
14970 }
14971 }
14972
14973 impl fidl::encoding::ResourceTypeMarker for CentralCreateConnectedIsochronousGroupRequest {
14974 type Borrowed<'a> = &'a mut Self;
14975 fn take_or_borrow<'a>(
14976 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14977 ) -> Self::Borrowed<'a> {
14978 value
14979 }
14980 }
14981
14982 unsafe impl fidl::encoding::TypeMarker for CentralCreateConnectedIsochronousGroupRequest {
14983 type Owned = Self;
14984
14985 #[inline(always)]
14986 fn inline_align(_context: fidl::encoding::Context) -> usize {
14987 8
14988 }
14989
14990 #[inline(always)]
14991 fn inline_size(_context: fidl::encoding::Context) -> usize {
14992 16
14993 }
14994 }
14995
14996 unsafe impl
14997 fidl::encoding::Encode<
14998 CentralCreateConnectedIsochronousGroupRequest,
14999 fidl::encoding::DefaultFuchsiaResourceDialect,
15000 > for &mut CentralCreateConnectedIsochronousGroupRequest
15001 {
15002 unsafe fn encode(
15003 self,
15004 encoder: &mut fidl::encoding::Encoder<
15005 '_,
15006 fidl::encoding::DefaultFuchsiaResourceDialect,
15007 >,
15008 offset: usize,
15009 mut depth: fidl::encoding::Depth,
15010 ) -> fidl::Result<()> {
15011 encoder.debug_check_bounds::<CentralCreateConnectedIsochronousGroupRequest>(offset);
15012 let max_ordinal: u64 = self.max_ordinal_present();
15014 encoder.write_num(max_ordinal, offset);
15015 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15016 if max_ordinal == 0 {
15018 return Ok(());
15019 }
15020 depth.increment()?;
15021 let envelope_size = 8;
15022 let bytes_len = max_ordinal as usize * envelope_size;
15023 #[allow(unused_variables)]
15024 let offset = encoder.out_of_line_offset(bytes_len);
15025 let mut _prev_end_offset: usize = 0;
15026 if 1 > max_ordinal {
15027 return Ok(());
15028 }
15029
15030 let cur_offset: usize = (1 - 1) * envelope_size;
15033
15034 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15036
15037 fidl::encoding::encode_in_envelope_optional::<
15042 CigParameters,
15043 fidl::encoding::DefaultFuchsiaResourceDialect,
15044 >(
15045 self.cig_parameters
15046 .as_ref()
15047 .map(<CigParameters as fidl::encoding::ValueTypeMarker>::borrow),
15048 encoder,
15049 offset + cur_offset,
15050 depth,
15051 )?;
15052
15053 _prev_end_offset = cur_offset + envelope_size;
15054 if 2 > max_ordinal {
15055 return Ok(());
15056 }
15057
15058 let cur_offset: usize = (2 - 1) * envelope_size;
15061
15062 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15064
15065 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15070 self.cis_requested_parameters.as_mut().map(<fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15071 encoder, offset + cur_offset, depth
15072 )?;
15073
15074 _prev_end_offset = cur_offset + envelope_size;
15075 if 3 > max_ordinal {
15076 return Ok(());
15077 }
15078
15079 let cur_offset: usize = (3 - 1) * envelope_size;
15082
15083 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15085
15086 fidl::encoding::encode_in_envelope_optional::<
15091 fidl::encoding::Endpoint<
15092 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15093 >,
15094 fidl::encoding::DefaultFuchsiaResourceDialect,
15095 >(
15096 self.cig.as_mut().map(
15097 <fidl::encoding::Endpoint<
15098 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15099 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15100 ),
15101 encoder,
15102 offset + cur_offset,
15103 depth,
15104 )?;
15105
15106 _prev_end_offset = cur_offset + envelope_size;
15107
15108 Ok(())
15109 }
15110 }
15111
15112 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15113 for CentralCreateConnectedIsochronousGroupRequest
15114 {
15115 #[inline(always)]
15116 fn new_empty() -> Self {
15117 Self::default()
15118 }
15119
15120 unsafe fn decode(
15121 &mut self,
15122 decoder: &mut fidl::encoding::Decoder<
15123 '_,
15124 fidl::encoding::DefaultFuchsiaResourceDialect,
15125 >,
15126 offset: usize,
15127 mut depth: fidl::encoding::Depth,
15128 ) -> fidl::Result<()> {
15129 decoder.debug_check_bounds::<Self>(offset);
15130 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15131 None => return Err(fidl::Error::NotNullable),
15132 Some(len) => len,
15133 };
15134 if len == 0 {
15136 return Ok(());
15137 };
15138 depth.increment()?;
15139 let envelope_size = 8;
15140 let bytes_len = len * envelope_size;
15141 let offset = decoder.out_of_line_offset(bytes_len)?;
15142 let mut _next_ordinal_to_read = 0;
15144 let mut next_offset = offset;
15145 let end_offset = offset + bytes_len;
15146 _next_ordinal_to_read += 1;
15147 if next_offset >= end_offset {
15148 return Ok(());
15149 }
15150
15151 while _next_ordinal_to_read < 1 {
15153 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15154 _next_ordinal_to_read += 1;
15155 next_offset += envelope_size;
15156 }
15157
15158 let next_out_of_line = decoder.next_out_of_line();
15159 let handles_before = decoder.remaining_handles();
15160 if let Some((inlined, num_bytes, num_handles)) =
15161 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15162 {
15163 let member_inline_size =
15164 <CigParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15165 if inlined != (member_inline_size <= 4) {
15166 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15167 }
15168 let inner_offset;
15169 let mut inner_depth = depth.clone();
15170 if inlined {
15171 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15172 inner_offset = next_offset;
15173 } else {
15174 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15175 inner_depth.increment()?;
15176 }
15177 let val_ref = self.cig_parameters.get_or_insert_with(|| {
15178 fidl::new_empty!(CigParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
15179 });
15180 fidl::decode!(
15181 CigParameters,
15182 fidl::encoding::DefaultFuchsiaResourceDialect,
15183 val_ref,
15184 decoder,
15185 inner_offset,
15186 inner_depth
15187 )?;
15188 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15189 {
15190 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15191 }
15192 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15193 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15194 }
15195 }
15196
15197 next_offset += envelope_size;
15198 _next_ordinal_to_read += 1;
15199 if next_offset >= end_offset {
15200 return Ok(());
15201 }
15202
15203 while _next_ordinal_to_read < 2 {
15205 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15206 _next_ordinal_to_read += 1;
15207 next_offset += envelope_size;
15208 }
15209
15210 let next_out_of_line = decoder.next_out_of_line();
15211 let handles_before = decoder.remaining_handles();
15212 if let Some((inlined, num_bytes, num_handles)) =
15213 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15214 {
15215 let member_inline_size = <fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15216 if inlined != (member_inline_size <= 4) {
15217 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15218 }
15219 let inner_offset;
15220 let mut inner_depth = depth.clone();
15221 if inlined {
15222 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15223 inner_offset = next_offset;
15224 } else {
15225 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15226 inner_depth.increment()?;
15227 }
15228 let val_ref =
15229 self.cis_requested_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect));
15230 fidl::decode!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15231 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15232 {
15233 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15234 }
15235 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15236 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15237 }
15238 }
15239
15240 next_offset += envelope_size;
15241 _next_ordinal_to_read += 1;
15242 if next_offset >= end_offset {
15243 return Ok(());
15244 }
15245
15246 while _next_ordinal_to_read < 3 {
15248 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15249 _next_ordinal_to_read += 1;
15250 next_offset += envelope_size;
15251 }
15252
15253 let next_out_of_line = decoder.next_out_of_line();
15254 let handles_before = decoder.remaining_handles();
15255 if let Some((inlined, num_bytes, num_handles)) =
15256 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15257 {
15258 let member_inline_size = <fidl::encoding::Endpoint<
15259 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15260 > as fidl::encoding::TypeMarker>::inline_size(
15261 decoder.context
15262 );
15263 if inlined != (member_inline_size <= 4) {
15264 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15265 }
15266 let inner_offset;
15267 let mut inner_depth = depth.clone();
15268 if inlined {
15269 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15270 inner_offset = next_offset;
15271 } else {
15272 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15273 inner_depth.increment()?;
15274 }
15275 let val_ref = self.cig.get_or_insert_with(|| {
15276 fidl::new_empty!(
15277 fidl::encoding::Endpoint<
15278 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15279 >,
15280 fidl::encoding::DefaultFuchsiaResourceDialect
15281 )
15282 });
15283 fidl::decode!(
15284 fidl::encoding::Endpoint<
15285 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15286 >,
15287 fidl::encoding::DefaultFuchsiaResourceDialect,
15288 val_ref,
15289 decoder,
15290 inner_offset,
15291 inner_depth
15292 )?;
15293 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15294 {
15295 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15296 }
15297 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15298 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15299 }
15300 }
15301
15302 next_offset += envelope_size;
15303
15304 while next_offset < end_offset {
15306 _next_ordinal_to_read += 1;
15307 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15308 next_offset += envelope_size;
15309 }
15310
15311 Ok(())
15312 }
15313 }
15314
15315 impl CentralSyncToPeriodicAdvertisingRequest {
15316 #[inline(always)]
15317 fn max_ordinal_present(&self) -> u64 {
15318 if let Some(_) = self.config {
15319 return 4;
15320 }
15321 if let Some(_) = self.sync {
15322 return 3;
15323 }
15324 if let Some(_) = self.advertising_sid {
15325 return 2;
15326 }
15327 if let Some(_) = self.peer_id {
15328 return 1;
15329 }
15330 0
15331 }
15332 }
15333
15334 impl fidl::encoding::ResourceTypeMarker for CentralSyncToPeriodicAdvertisingRequest {
15335 type Borrowed<'a> = &'a mut Self;
15336 fn take_or_borrow<'a>(
15337 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15338 ) -> Self::Borrowed<'a> {
15339 value
15340 }
15341 }
15342
15343 unsafe impl fidl::encoding::TypeMarker for CentralSyncToPeriodicAdvertisingRequest {
15344 type Owned = Self;
15345
15346 #[inline(always)]
15347 fn inline_align(_context: fidl::encoding::Context) -> usize {
15348 8
15349 }
15350
15351 #[inline(always)]
15352 fn inline_size(_context: fidl::encoding::Context) -> usize {
15353 16
15354 }
15355 }
15356
15357 unsafe impl
15358 fidl::encoding::Encode<
15359 CentralSyncToPeriodicAdvertisingRequest,
15360 fidl::encoding::DefaultFuchsiaResourceDialect,
15361 > for &mut CentralSyncToPeriodicAdvertisingRequest
15362 {
15363 unsafe fn encode(
15364 self,
15365 encoder: &mut fidl::encoding::Encoder<
15366 '_,
15367 fidl::encoding::DefaultFuchsiaResourceDialect,
15368 >,
15369 offset: usize,
15370 mut depth: fidl::encoding::Depth,
15371 ) -> fidl::Result<()> {
15372 encoder.debug_check_bounds::<CentralSyncToPeriodicAdvertisingRequest>(offset);
15373 let max_ordinal: u64 = self.max_ordinal_present();
15375 encoder.write_num(max_ordinal, offset);
15376 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15377 if max_ordinal == 0 {
15379 return Ok(());
15380 }
15381 depth.increment()?;
15382 let envelope_size = 8;
15383 let bytes_len = max_ordinal as usize * envelope_size;
15384 #[allow(unused_variables)]
15385 let offset = encoder.out_of_line_offset(bytes_len);
15386 let mut _prev_end_offset: usize = 0;
15387 if 1 > max_ordinal {
15388 return Ok(());
15389 }
15390
15391 let cur_offset: usize = (1 - 1) * envelope_size;
15394
15395 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15397
15398 fidl::encoding::encode_in_envelope_optional::<
15403 fidl_fuchsia_bluetooth::PeerId,
15404 fidl::encoding::DefaultFuchsiaResourceDialect,
15405 >(
15406 self.peer_id.as_ref().map(
15407 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
15408 ),
15409 encoder,
15410 offset + cur_offset,
15411 depth,
15412 )?;
15413
15414 _prev_end_offset = cur_offset + envelope_size;
15415 if 2 > max_ordinal {
15416 return Ok(());
15417 }
15418
15419 let cur_offset: usize = (2 - 1) * envelope_size;
15422
15423 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15425
15426 fidl::encoding::encode_in_envelope_optional::<
15431 u8,
15432 fidl::encoding::DefaultFuchsiaResourceDialect,
15433 >(
15434 self.advertising_sid.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
15435 encoder,
15436 offset + cur_offset,
15437 depth,
15438 )?;
15439
15440 _prev_end_offset = cur_offset + envelope_size;
15441 if 3 > max_ordinal {
15442 return Ok(());
15443 }
15444
15445 let cur_offset: usize = (3 - 1) * envelope_size;
15448
15449 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15451
15452 fidl::encoding::encode_in_envelope_optional::<
15457 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
15458 fidl::encoding::DefaultFuchsiaResourceDialect,
15459 >(
15460 self.sync.as_mut().map(
15461 <fidl::encoding::Endpoint<
15462 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15463 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15464 ),
15465 encoder,
15466 offset + cur_offset,
15467 depth,
15468 )?;
15469
15470 _prev_end_offset = cur_offset + envelope_size;
15471 if 4 > max_ordinal {
15472 return Ok(());
15473 }
15474
15475 let cur_offset: usize = (4 - 1) * envelope_size;
15478
15479 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15481
15482 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
15487 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
15488 encoder, offset + cur_offset, depth
15489 )?;
15490
15491 _prev_end_offset = cur_offset + envelope_size;
15492
15493 Ok(())
15494 }
15495 }
15496
15497 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15498 for CentralSyncToPeriodicAdvertisingRequest
15499 {
15500 #[inline(always)]
15501 fn new_empty() -> Self {
15502 Self::default()
15503 }
15504
15505 unsafe fn decode(
15506 &mut self,
15507 decoder: &mut fidl::encoding::Decoder<
15508 '_,
15509 fidl::encoding::DefaultFuchsiaResourceDialect,
15510 >,
15511 offset: usize,
15512 mut depth: fidl::encoding::Depth,
15513 ) -> fidl::Result<()> {
15514 decoder.debug_check_bounds::<Self>(offset);
15515 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15516 None => return Err(fidl::Error::NotNullable),
15517 Some(len) => len,
15518 };
15519 if len == 0 {
15521 return Ok(());
15522 };
15523 depth.increment()?;
15524 let envelope_size = 8;
15525 let bytes_len = len * envelope_size;
15526 let offset = decoder.out_of_line_offset(bytes_len)?;
15527 let mut _next_ordinal_to_read = 0;
15529 let mut next_offset = offset;
15530 let end_offset = offset + bytes_len;
15531 _next_ordinal_to_read += 1;
15532 if next_offset >= end_offset {
15533 return Ok(());
15534 }
15535
15536 while _next_ordinal_to_read < 1 {
15538 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15539 _next_ordinal_to_read += 1;
15540 next_offset += envelope_size;
15541 }
15542
15543 let next_out_of_line = decoder.next_out_of_line();
15544 let handles_before = decoder.remaining_handles();
15545 if let Some((inlined, num_bytes, num_handles)) =
15546 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15547 {
15548 let member_inline_size =
15549 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
15550 decoder.context,
15551 );
15552 if inlined != (member_inline_size <= 4) {
15553 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15554 }
15555 let inner_offset;
15556 let mut inner_depth = depth.clone();
15557 if inlined {
15558 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15559 inner_offset = next_offset;
15560 } else {
15561 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15562 inner_depth.increment()?;
15563 }
15564 let val_ref = self.peer_id.get_or_insert_with(|| {
15565 fidl::new_empty!(
15566 fidl_fuchsia_bluetooth::PeerId,
15567 fidl::encoding::DefaultFuchsiaResourceDialect
15568 )
15569 });
15570 fidl::decode!(
15571 fidl_fuchsia_bluetooth::PeerId,
15572 fidl::encoding::DefaultFuchsiaResourceDialect,
15573 val_ref,
15574 decoder,
15575 inner_offset,
15576 inner_depth
15577 )?;
15578 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15579 {
15580 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15581 }
15582 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15583 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15584 }
15585 }
15586
15587 next_offset += envelope_size;
15588 _next_ordinal_to_read += 1;
15589 if next_offset >= end_offset {
15590 return Ok(());
15591 }
15592
15593 while _next_ordinal_to_read < 2 {
15595 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15596 _next_ordinal_to_read += 1;
15597 next_offset += envelope_size;
15598 }
15599
15600 let next_out_of_line = decoder.next_out_of_line();
15601 let handles_before = decoder.remaining_handles();
15602 if let Some((inlined, num_bytes, num_handles)) =
15603 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15604 {
15605 let member_inline_size =
15606 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15607 if inlined != (member_inline_size <= 4) {
15608 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15609 }
15610 let inner_offset;
15611 let mut inner_depth = depth.clone();
15612 if inlined {
15613 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15614 inner_offset = next_offset;
15615 } else {
15616 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15617 inner_depth.increment()?;
15618 }
15619 let val_ref = self.advertising_sid.get_or_insert_with(|| {
15620 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
15621 });
15622 fidl::decode!(
15623 u8,
15624 fidl::encoding::DefaultFuchsiaResourceDialect,
15625 val_ref,
15626 decoder,
15627 inner_offset,
15628 inner_depth
15629 )?;
15630 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15631 {
15632 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15633 }
15634 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15635 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15636 }
15637 }
15638
15639 next_offset += envelope_size;
15640 _next_ordinal_to_read += 1;
15641 if next_offset >= end_offset {
15642 return Ok(());
15643 }
15644
15645 while _next_ordinal_to_read < 3 {
15647 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15648 _next_ordinal_to_read += 1;
15649 next_offset += envelope_size;
15650 }
15651
15652 let next_out_of_line = decoder.next_out_of_line();
15653 let handles_before = decoder.remaining_handles();
15654 if let Some((inlined, num_bytes, num_handles)) =
15655 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15656 {
15657 let member_inline_size = <fidl::encoding::Endpoint<
15658 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15659 > as fidl::encoding::TypeMarker>::inline_size(
15660 decoder.context
15661 );
15662 if inlined != (member_inline_size <= 4) {
15663 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15664 }
15665 let inner_offset;
15666 let mut inner_depth = depth.clone();
15667 if inlined {
15668 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15669 inner_offset = next_offset;
15670 } else {
15671 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15672 inner_depth.increment()?;
15673 }
15674 let val_ref = self.sync.get_or_insert_with(|| {
15675 fidl::new_empty!(
15676 fidl::encoding::Endpoint<
15677 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15678 >,
15679 fidl::encoding::DefaultFuchsiaResourceDialect
15680 )
15681 });
15682 fidl::decode!(
15683 fidl::encoding::Endpoint<
15684 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15685 >,
15686 fidl::encoding::DefaultFuchsiaResourceDialect,
15687 val_ref,
15688 decoder,
15689 inner_offset,
15690 inner_depth
15691 )?;
15692 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15693 {
15694 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15695 }
15696 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15697 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15698 }
15699 }
15700
15701 next_offset += envelope_size;
15702 _next_ordinal_to_read += 1;
15703 if next_offset >= end_offset {
15704 return Ok(());
15705 }
15706
15707 while _next_ordinal_to_read < 4 {
15709 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15710 _next_ordinal_to_read += 1;
15711 next_offset += envelope_size;
15712 }
15713
15714 let next_out_of_line = decoder.next_out_of_line();
15715 let handles_before = decoder.remaining_handles();
15716 if let Some((inlined, num_bytes, num_handles)) =
15717 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15718 {
15719 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15720 if inlined != (member_inline_size <= 4) {
15721 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15722 }
15723 let inner_offset;
15724 let mut inner_depth = depth.clone();
15725 if inlined {
15726 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15727 inner_offset = next_offset;
15728 } else {
15729 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15730 inner_depth.increment()?;
15731 }
15732 let val_ref = self.config.get_or_insert_with(|| {
15733 fidl::new_empty!(
15734 PeriodicAdvertisingSyncConfiguration,
15735 fidl::encoding::DefaultFuchsiaResourceDialect
15736 )
15737 });
15738 fidl::decode!(
15739 PeriodicAdvertisingSyncConfiguration,
15740 fidl::encoding::DefaultFuchsiaResourceDialect,
15741 val_ref,
15742 decoder,
15743 inner_offset,
15744 inner_depth
15745 )?;
15746 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15747 {
15748 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15749 }
15750 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15751 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15752 }
15753 }
15754
15755 next_offset += envelope_size;
15756
15757 while next_offset < end_offset {
15759 _next_ordinal_to_read += 1;
15760 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15761 next_offset += envelope_size;
15762 }
15763
15764 Ok(())
15765 }
15766 }
15767
15768 impl ChannelListenerConnectedRequest {
15769 #[inline(always)]
15770 fn max_ordinal_present(&self) -> u64 {
15771 if let Some(_) = self.ext_offload {
15772 return 2;
15773 }
15774 if let Some(_) = self.channel {
15775 return 1;
15776 }
15777 0
15778 }
15779 }
15780
15781 impl fidl::encoding::ResourceTypeMarker for ChannelListenerConnectedRequest {
15782 type Borrowed<'a> = &'a mut Self;
15783 fn take_or_borrow<'a>(
15784 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15785 ) -> Self::Borrowed<'a> {
15786 value
15787 }
15788 }
15789
15790 unsafe impl fidl::encoding::TypeMarker for ChannelListenerConnectedRequest {
15791 type Owned = Self;
15792
15793 #[inline(always)]
15794 fn inline_align(_context: fidl::encoding::Context) -> usize {
15795 8
15796 }
15797
15798 #[inline(always)]
15799 fn inline_size(_context: fidl::encoding::Context) -> usize {
15800 16
15801 }
15802 }
15803
15804 unsafe impl
15805 fidl::encoding::Encode<
15806 ChannelListenerConnectedRequest,
15807 fidl::encoding::DefaultFuchsiaResourceDialect,
15808 > for &mut ChannelListenerConnectedRequest
15809 {
15810 unsafe fn encode(
15811 self,
15812 encoder: &mut fidl::encoding::Encoder<
15813 '_,
15814 fidl::encoding::DefaultFuchsiaResourceDialect,
15815 >,
15816 offset: usize,
15817 mut depth: fidl::encoding::Depth,
15818 ) -> fidl::Result<()> {
15819 encoder.debug_check_bounds::<ChannelListenerConnectedRequest>(offset);
15820 let max_ordinal: u64 = self.max_ordinal_present();
15822 encoder.write_num(max_ordinal, offset);
15823 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15824 if max_ordinal == 0 {
15826 return Ok(());
15827 }
15828 depth.increment()?;
15829 let envelope_size = 8;
15830 let bytes_len = max_ordinal as usize * envelope_size;
15831 #[allow(unused_variables)]
15832 let offset = encoder.out_of_line_offset(bytes_len);
15833 let mut _prev_end_offset: usize = 0;
15834 if 1 > max_ordinal {
15835 return Ok(());
15836 }
15837
15838 let cur_offset: usize = (1 - 1) * envelope_size;
15841
15842 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15844
15845 fidl::encoding::encode_in_envelope_optional::<
15850 fidl::encoding::Endpoint<
15851 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15852 >,
15853 fidl::encoding::DefaultFuchsiaResourceDialect,
15854 >(
15855 self.channel.as_mut().map(
15856 <fidl::encoding::Endpoint<
15857 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15858 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15859 ),
15860 encoder,
15861 offset + cur_offset,
15862 depth,
15863 )?;
15864
15865 _prev_end_offset = cur_offset + envelope_size;
15866 if 2 > max_ordinal {
15867 return Ok(());
15868 }
15869
15870 let cur_offset: usize = (2 - 1) * envelope_size;
15873
15874 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15876
15877 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15882 self.ext_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15883 encoder, offset + cur_offset, depth
15884 )?;
15885
15886 _prev_end_offset = cur_offset + envelope_size;
15887
15888 Ok(())
15889 }
15890 }
15891
15892 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15893 for ChannelListenerConnectedRequest
15894 {
15895 #[inline(always)]
15896 fn new_empty() -> Self {
15897 Self::default()
15898 }
15899
15900 unsafe fn decode(
15901 &mut self,
15902 decoder: &mut fidl::encoding::Decoder<
15903 '_,
15904 fidl::encoding::DefaultFuchsiaResourceDialect,
15905 >,
15906 offset: usize,
15907 mut depth: fidl::encoding::Depth,
15908 ) -> fidl::Result<()> {
15909 decoder.debug_check_bounds::<Self>(offset);
15910 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15911 None => return Err(fidl::Error::NotNullable),
15912 Some(len) => len,
15913 };
15914 if len == 0 {
15916 return Ok(());
15917 };
15918 depth.increment()?;
15919 let envelope_size = 8;
15920 let bytes_len = len * envelope_size;
15921 let offset = decoder.out_of_line_offset(bytes_len)?;
15922 let mut _next_ordinal_to_read = 0;
15924 let mut next_offset = offset;
15925 let end_offset = offset + bytes_len;
15926 _next_ordinal_to_read += 1;
15927 if next_offset >= end_offset {
15928 return Ok(());
15929 }
15930
15931 while _next_ordinal_to_read < 1 {
15933 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15934 _next_ordinal_to_read += 1;
15935 next_offset += envelope_size;
15936 }
15937
15938 let next_out_of_line = decoder.next_out_of_line();
15939 let handles_before = decoder.remaining_handles();
15940 if let Some((inlined, num_bytes, num_handles)) =
15941 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15942 {
15943 let member_inline_size = <fidl::encoding::Endpoint<
15944 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15945 > as fidl::encoding::TypeMarker>::inline_size(
15946 decoder.context
15947 );
15948 if inlined != (member_inline_size <= 4) {
15949 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15950 }
15951 let inner_offset;
15952 let mut inner_depth = depth.clone();
15953 if inlined {
15954 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15955 inner_offset = next_offset;
15956 } else {
15957 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15958 inner_depth.increment()?;
15959 }
15960 let val_ref = self.channel.get_or_insert_with(|| {
15961 fidl::new_empty!(
15962 fidl::encoding::Endpoint<
15963 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15964 >,
15965 fidl::encoding::DefaultFuchsiaResourceDialect
15966 )
15967 });
15968 fidl::decode!(
15969 fidl::encoding::Endpoint<
15970 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15971 >,
15972 fidl::encoding::DefaultFuchsiaResourceDialect,
15973 val_ref,
15974 decoder,
15975 inner_offset,
15976 inner_depth
15977 )?;
15978 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15979 {
15980 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15981 }
15982 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15983 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15984 }
15985 }
15986
15987 next_offset += envelope_size;
15988 _next_ordinal_to_read += 1;
15989 if next_offset >= end_offset {
15990 return Ok(());
15991 }
15992
15993 while _next_ordinal_to_read < 2 {
15995 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15996 _next_ordinal_to_read += 1;
15997 next_offset += envelope_size;
15998 }
15999
16000 let next_out_of_line = decoder.next_out_of_line();
16001 let handles_before = decoder.remaining_handles();
16002 if let Some((inlined, num_bytes, num_handles)) =
16003 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16004 {
16005 let member_inline_size = <fidl::encoding::Endpoint<
16006 fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>,
16007 > as fidl::encoding::TypeMarker>::inline_size(
16008 decoder.context
16009 );
16010 if inlined != (member_inline_size <= 4) {
16011 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16012 }
16013 let inner_offset;
16014 let mut inner_depth = depth.clone();
16015 if inlined {
16016 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16017 inner_offset = next_offset;
16018 } else {
16019 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16020 inner_depth.increment()?;
16021 }
16022 let val_ref = self.ext_offload.get_or_insert_with(|| {
16023 fidl::new_empty!(
16024 fidl::encoding::Endpoint<
16025 fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>,
16026 >,
16027 fidl::encoding::DefaultFuchsiaResourceDialect
16028 )
16029 });
16030 fidl::decode!(
16031 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>>,
16032 fidl::encoding::DefaultFuchsiaResourceDialect,
16033 val_ref,
16034 decoder,
16035 inner_offset,
16036 inner_depth
16037 )?;
16038 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16039 {
16040 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16041 }
16042 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16043 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16044 }
16045 }
16046
16047 next_offset += envelope_size;
16048
16049 while next_offset < end_offset {
16051 _next_ordinal_to_read += 1;
16052 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16053 next_offset += envelope_size;
16054 }
16055
16056 Ok(())
16057 }
16058 }
16059
16060 impl ChannelListenerRegistryListenL2capRequest {
16061 #[inline(always)]
16062 fn max_ordinal_present(&self) -> u64 {
16063 if let Some(_) = self.listener {
16064 return 2;
16065 }
16066 if let Some(_) = self.parameters {
16067 return 1;
16068 }
16069 0
16070 }
16071 }
16072
16073 impl fidl::encoding::ResourceTypeMarker for ChannelListenerRegistryListenL2capRequest {
16074 type Borrowed<'a> = &'a mut Self;
16075 fn take_or_borrow<'a>(
16076 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16077 ) -> Self::Borrowed<'a> {
16078 value
16079 }
16080 }
16081
16082 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capRequest {
16083 type Owned = Self;
16084
16085 #[inline(always)]
16086 fn inline_align(_context: fidl::encoding::Context) -> usize {
16087 8
16088 }
16089
16090 #[inline(always)]
16091 fn inline_size(_context: fidl::encoding::Context) -> usize {
16092 16
16093 }
16094 }
16095
16096 unsafe impl
16097 fidl::encoding::Encode<
16098 ChannelListenerRegistryListenL2capRequest,
16099 fidl::encoding::DefaultFuchsiaResourceDialect,
16100 > for &mut ChannelListenerRegistryListenL2capRequest
16101 {
16102 unsafe fn encode(
16103 self,
16104 encoder: &mut fidl::encoding::Encoder<
16105 '_,
16106 fidl::encoding::DefaultFuchsiaResourceDialect,
16107 >,
16108 offset: usize,
16109 mut depth: fidl::encoding::Depth,
16110 ) -> fidl::Result<()> {
16111 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capRequest>(offset);
16112 let max_ordinal: u64 = self.max_ordinal_present();
16114 encoder.write_num(max_ordinal, offset);
16115 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16116 if max_ordinal == 0 {
16118 return Ok(());
16119 }
16120 depth.increment()?;
16121 let envelope_size = 8;
16122 let bytes_len = max_ordinal as usize * envelope_size;
16123 #[allow(unused_variables)]
16124 let offset = encoder.out_of_line_offset(bytes_len);
16125 let mut _prev_end_offset: usize = 0;
16126 if 1 > max_ordinal {
16127 return Ok(());
16128 }
16129
16130 let cur_offset: usize = (1 - 1) * envelope_size;
16133
16134 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16136
16137 fidl::encoding::encode_in_envelope_optional::<
16142 AcceptedChannelParameters,
16143 fidl::encoding::DefaultFuchsiaResourceDialect,
16144 >(
16145 self.parameters
16146 .as_ref()
16147 .map(<AcceptedChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
16148 encoder,
16149 offset + cur_offset,
16150 depth,
16151 )?;
16152
16153 _prev_end_offset = cur_offset + envelope_size;
16154 if 2 > max_ordinal {
16155 return Ok(());
16156 }
16157
16158 let cur_offset: usize = (2 - 1) * envelope_size;
16161
16162 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16164
16165 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16170 self.listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16171 encoder, offset + cur_offset, depth
16172 )?;
16173
16174 _prev_end_offset = cur_offset + envelope_size;
16175
16176 Ok(())
16177 }
16178 }
16179
16180 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16181 for ChannelListenerRegistryListenL2capRequest
16182 {
16183 #[inline(always)]
16184 fn new_empty() -> Self {
16185 Self::default()
16186 }
16187
16188 unsafe fn decode(
16189 &mut self,
16190 decoder: &mut fidl::encoding::Decoder<
16191 '_,
16192 fidl::encoding::DefaultFuchsiaResourceDialect,
16193 >,
16194 offset: usize,
16195 mut depth: fidl::encoding::Depth,
16196 ) -> fidl::Result<()> {
16197 decoder.debug_check_bounds::<Self>(offset);
16198 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16199 None => return Err(fidl::Error::NotNullable),
16200 Some(len) => len,
16201 };
16202 if len == 0 {
16204 return Ok(());
16205 };
16206 depth.increment()?;
16207 let envelope_size = 8;
16208 let bytes_len = len * envelope_size;
16209 let offset = decoder.out_of_line_offset(bytes_len)?;
16210 let mut _next_ordinal_to_read = 0;
16212 let mut next_offset = offset;
16213 let end_offset = offset + bytes_len;
16214 _next_ordinal_to_read += 1;
16215 if next_offset >= end_offset {
16216 return Ok(());
16217 }
16218
16219 while _next_ordinal_to_read < 1 {
16221 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16222 _next_ordinal_to_read += 1;
16223 next_offset += envelope_size;
16224 }
16225
16226 let next_out_of_line = decoder.next_out_of_line();
16227 let handles_before = decoder.remaining_handles();
16228 if let Some((inlined, num_bytes, num_handles)) =
16229 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16230 {
16231 let member_inline_size =
16232 <AcceptedChannelParameters as fidl::encoding::TypeMarker>::inline_size(
16233 decoder.context,
16234 );
16235 if inlined != (member_inline_size <= 4) {
16236 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16237 }
16238 let inner_offset;
16239 let mut inner_depth = depth.clone();
16240 if inlined {
16241 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16242 inner_offset = next_offset;
16243 } else {
16244 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16245 inner_depth.increment()?;
16246 }
16247 let val_ref = self.parameters.get_or_insert_with(|| {
16248 fidl::new_empty!(
16249 AcceptedChannelParameters,
16250 fidl::encoding::DefaultFuchsiaResourceDialect
16251 )
16252 });
16253 fidl::decode!(
16254 AcceptedChannelParameters,
16255 fidl::encoding::DefaultFuchsiaResourceDialect,
16256 val_ref,
16257 decoder,
16258 inner_offset,
16259 inner_depth
16260 )?;
16261 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16262 {
16263 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16264 }
16265 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16266 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16267 }
16268 }
16269
16270 next_offset += envelope_size;
16271 _next_ordinal_to_read += 1;
16272 if next_offset >= end_offset {
16273 return Ok(());
16274 }
16275
16276 while _next_ordinal_to_read < 2 {
16278 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16279 _next_ordinal_to_read += 1;
16280 next_offset += envelope_size;
16281 }
16282
16283 let next_out_of_line = decoder.next_out_of_line();
16284 let handles_before = decoder.remaining_handles();
16285 if let Some((inlined, num_bytes, num_handles)) =
16286 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16287 {
16288 let member_inline_size = <fidl::encoding::Endpoint<
16289 fidl::endpoints::ClientEnd<ChannelListenerMarker>,
16290 > as fidl::encoding::TypeMarker>::inline_size(
16291 decoder.context
16292 );
16293 if inlined != (member_inline_size <= 4) {
16294 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16295 }
16296 let inner_offset;
16297 let mut inner_depth = depth.clone();
16298 if inlined {
16299 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16300 inner_offset = next_offset;
16301 } else {
16302 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16303 inner_depth.increment()?;
16304 }
16305 let val_ref = self.listener.get_or_insert_with(|| {
16306 fidl::new_empty!(
16307 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
16308 fidl::encoding::DefaultFuchsiaResourceDialect
16309 )
16310 });
16311 fidl::decode!(
16312 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
16313 fidl::encoding::DefaultFuchsiaResourceDialect,
16314 val_ref,
16315 decoder,
16316 inner_offset,
16317 inner_depth
16318 )?;
16319 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16320 {
16321 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16322 }
16323 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16324 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16325 }
16326 }
16327
16328 next_offset += envelope_size;
16329
16330 while next_offset < end_offset {
16332 _next_ordinal_to_read += 1;
16333 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16334 next_offset += envelope_size;
16335 }
16336
16337 Ok(())
16338 }
16339 }
16340
16341 impl CisRequestedParameters {
16342 #[inline(always)]
16343 fn max_ordinal_present(&self) -> u64 {
16344 if let Some(_) = self.max_sdu_size_incoming {
16345 return 4;
16346 }
16347 if let Some(_) = self.max_sdu_size_outgoing {
16348 return 3;
16349 }
16350 if let Some(_) = self.connection_stream {
16351 return 2;
16352 }
16353 if let Some(_) = self.cis_id {
16354 return 1;
16355 }
16356 0
16357 }
16358 }
16359
16360 impl fidl::encoding::ResourceTypeMarker for CisRequestedParameters {
16361 type Borrowed<'a> = &'a mut Self;
16362 fn take_or_borrow<'a>(
16363 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16364 ) -> Self::Borrowed<'a> {
16365 value
16366 }
16367 }
16368
16369 unsafe impl fidl::encoding::TypeMarker for CisRequestedParameters {
16370 type Owned = Self;
16371
16372 #[inline(always)]
16373 fn inline_align(_context: fidl::encoding::Context) -> usize {
16374 8
16375 }
16376
16377 #[inline(always)]
16378 fn inline_size(_context: fidl::encoding::Context) -> usize {
16379 16
16380 }
16381 }
16382
16383 unsafe impl
16384 fidl::encoding::Encode<
16385 CisRequestedParameters,
16386 fidl::encoding::DefaultFuchsiaResourceDialect,
16387 > for &mut CisRequestedParameters
16388 {
16389 unsafe fn encode(
16390 self,
16391 encoder: &mut fidl::encoding::Encoder<
16392 '_,
16393 fidl::encoding::DefaultFuchsiaResourceDialect,
16394 >,
16395 offset: usize,
16396 mut depth: fidl::encoding::Depth,
16397 ) -> fidl::Result<()> {
16398 encoder.debug_check_bounds::<CisRequestedParameters>(offset);
16399 let max_ordinal: u64 = self.max_ordinal_present();
16401 encoder.write_num(max_ordinal, offset);
16402 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16403 if max_ordinal == 0 {
16405 return Ok(());
16406 }
16407 depth.increment()?;
16408 let envelope_size = 8;
16409 let bytes_len = max_ordinal as usize * envelope_size;
16410 #[allow(unused_variables)]
16411 let offset = encoder.out_of_line_offset(bytes_len);
16412 let mut _prev_end_offset: usize = 0;
16413 if 1 > max_ordinal {
16414 return Ok(());
16415 }
16416
16417 let cur_offset: usize = (1 - 1) * envelope_size;
16420
16421 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16423
16424 fidl::encoding::encode_in_envelope_optional::<
16429 u8,
16430 fidl::encoding::DefaultFuchsiaResourceDialect,
16431 >(
16432 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16433 encoder,
16434 offset + cur_offset,
16435 depth,
16436 )?;
16437
16438 _prev_end_offset = cur_offset + envelope_size;
16439 if 2 > max_ordinal {
16440 return Ok(());
16441 }
16442
16443 let cur_offset: usize = (2 - 1) * envelope_size;
16446
16447 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16449
16450 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16455 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16456 encoder, offset + cur_offset, depth
16457 )?;
16458
16459 _prev_end_offset = cur_offset + envelope_size;
16460 if 3 > max_ordinal {
16461 return Ok(());
16462 }
16463
16464 let cur_offset: usize = (3 - 1) * envelope_size;
16467
16468 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16470
16471 fidl::encoding::encode_in_envelope_optional::<
16476 u16,
16477 fidl::encoding::DefaultFuchsiaResourceDialect,
16478 >(
16479 self.max_sdu_size_outgoing
16480 .as_ref()
16481 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
16482 encoder,
16483 offset + cur_offset,
16484 depth,
16485 )?;
16486
16487 _prev_end_offset = cur_offset + envelope_size;
16488 if 4 > max_ordinal {
16489 return Ok(());
16490 }
16491
16492 let cur_offset: usize = (4 - 1) * envelope_size;
16495
16496 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16498
16499 fidl::encoding::encode_in_envelope_optional::<
16504 u16,
16505 fidl::encoding::DefaultFuchsiaResourceDialect,
16506 >(
16507 self.max_sdu_size_incoming
16508 .as_ref()
16509 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
16510 encoder,
16511 offset + cur_offset,
16512 depth,
16513 )?;
16514
16515 _prev_end_offset = cur_offset + envelope_size;
16516
16517 Ok(())
16518 }
16519 }
16520
16521 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16522 for CisRequestedParameters
16523 {
16524 #[inline(always)]
16525 fn new_empty() -> Self {
16526 Self::default()
16527 }
16528
16529 unsafe fn decode(
16530 &mut self,
16531 decoder: &mut fidl::encoding::Decoder<
16532 '_,
16533 fidl::encoding::DefaultFuchsiaResourceDialect,
16534 >,
16535 offset: usize,
16536 mut depth: fidl::encoding::Depth,
16537 ) -> fidl::Result<()> {
16538 decoder.debug_check_bounds::<Self>(offset);
16539 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16540 None => return Err(fidl::Error::NotNullable),
16541 Some(len) => len,
16542 };
16543 if len == 0 {
16545 return Ok(());
16546 };
16547 depth.increment()?;
16548 let envelope_size = 8;
16549 let bytes_len = len * envelope_size;
16550 let offset = decoder.out_of_line_offset(bytes_len)?;
16551 let mut _next_ordinal_to_read = 0;
16553 let mut next_offset = offset;
16554 let end_offset = offset + bytes_len;
16555 _next_ordinal_to_read += 1;
16556 if next_offset >= end_offset {
16557 return Ok(());
16558 }
16559
16560 while _next_ordinal_to_read < 1 {
16562 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16563 _next_ordinal_to_read += 1;
16564 next_offset += envelope_size;
16565 }
16566
16567 let next_out_of_line = decoder.next_out_of_line();
16568 let handles_before = decoder.remaining_handles();
16569 if let Some((inlined, num_bytes, num_handles)) =
16570 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16571 {
16572 let member_inline_size =
16573 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16574 if inlined != (member_inline_size <= 4) {
16575 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16576 }
16577 let inner_offset;
16578 let mut inner_depth = depth.clone();
16579 if inlined {
16580 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16581 inner_offset = next_offset;
16582 } else {
16583 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16584 inner_depth.increment()?;
16585 }
16586 let val_ref = self.cis_id.get_or_insert_with(|| {
16587 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
16588 });
16589 fidl::decode!(
16590 u8,
16591 fidl::encoding::DefaultFuchsiaResourceDialect,
16592 val_ref,
16593 decoder,
16594 inner_offset,
16595 inner_depth
16596 )?;
16597 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16598 {
16599 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16600 }
16601 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16602 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16603 }
16604 }
16605
16606 next_offset += envelope_size;
16607 _next_ordinal_to_read += 1;
16608 if next_offset >= end_offset {
16609 return Ok(());
16610 }
16611
16612 while _next_ordinal_to_read < 2 {
16614 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16615 _next_ordinal_to_read += 1;
16616 next_offset += envelope_size;
16617 }
16618
16619 let next_out_of_line = decoder.next_out_of_line();
16620 let handles_before = decoder.remaining_handles();
16621 if let Some((inlined, num_bytes, num_handles)) =
16622 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16623 {
16624 let member_inline_size = <fidl::encoding::Endpoint<
16625 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
16626 > as fidl::encoding::TypeMarker>::inline_size(
16627 decoder.context
16628 );
16629 if inlined != (member_inline_size <= 4) {
16630 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16631 }
16632 let inner_offset;
16633 let mut inner_depth = depth.clone();
16634 if inlined {
16635 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16636 inner_offset = next_offset;
16637 } else {
16638 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16639 inner_depth.increment()?;
16640 }
16641 let val_ref = self.connection_stream.get_or_insert_with(|| {
16642 fidl::new_empty!(
16643 fidl::encoding::Endpoint<
16644 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
16645 >,
16646 fidl::encoding::DefaultFuchsiaResourceDialect
16647 )
16648 });
16649 fidl::decode!(
16650 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
16651 fidl::encoding::DefaultFuchsiaResourceDialect,
16652 val_ref,
16653 decoder,
16654 inner_offset,
16655 inner_depth
16656 )?;
16657 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16658 {
16659 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16660 }
16661 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16662 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16663 }
16664 }
16665
16666 next_offset += envelope_size;
16667 _next_ordinal_to_read += 1;
16668 if next_offset >= end_offset {
16669 return Ok(());
16670 }
16671
16672 while _next_ordinal_to_read < 3 {
16674 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16675 _next_ordinal_to_read += 1;
16676 next_offset += envelope_size;
16677 }
16678
16679 let next_out_of_line = decoder.next_out_of_line();
16680 let handles_before = decoder.remaining_handles();
16681 if let Some((inlined, num_bytes, num_handles)) =
16682 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16683 {
16684 let member_inline_size =
16685 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16686 if inlined != (member_inline_size <= 4) {
16687 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16688 }
16689 let inner_offset;
16690 let mut inner_depth = depth.clone();
16691 if inlined {
16692 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16693 inner_offset = next_offset;
16694 } else {
16695 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16696 inner_depth.increment()?;
16697 }
16698 let val_ref = self.max_sdu_size_outgoing.get_or_insert_with(|| {
16699 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
16700 });
16701 fidl::decode!(
16702 u16,
16703 fidl::encoding::DefaultFuchsiaResourceDialect,
16704 val_ref,
16705 decoder,
16706 inner_offset,
16707 inner_depth
16708 )?;
16709 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16710 {
16711 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16712 }
16713 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16714 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16715 }
16716 }
16717
16718 next_offset += envelope_size;
16719 _next_ordinal_to_read += 1;
16720 if next_offset >= end_offset {
16721 return Ok(());
16722 }
16723
16724 while _next_ordinal_to_read < 4 {
16726 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16727 _next_ordinal_to_read += 1;
16728 next_offset += envelope_size;
16729 }
16730
16731 let next_out_of_line = decoder.next_out_of_line();
16732 let handles_before = decoder.remaining_handles();
16733 if let Some((inlined, num_bytes, num_handles)) =
16734 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16735 {
16736 let member_inline_size =
16737 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16738 if inlined != (member_inline_size <= 4) {
16739 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16740 }
16741 let inner_offset;
16742 let mut inner_depth = depth.clone();
16743 if inlined {
16744 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16745 inner_offset = next_offset;
16746 } else {
16747 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16748 inner_depth.increment()?;
16749 }
16750 let val_ref = self.max_sdu_size_incoming.get_or_insert_with(|| {
16751 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
16752 });
16753 fidl::decode!(
16754 u16,
16755 fidl::encoding::DefaultFuchsiaResourceDialect,
16756 val_ref,
16757 decoder,
16758 inner_offset,
16759 inner_depth
16760 )?;
16761 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16762 {
16763 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16764 }
16765 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16766 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16767 }
16768 }
16769
16770 next_offset += envelope_size;
16771
16772 while next_offset < end_offset {
16774 _next_ordinal_to_read += 1;
16775 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16776 next_offset += envelope_size;
16777 }
16778
16779 Ok(())
16780 }
16781 }
16782
16783 impl ConnectionAcceptCisRequest {
16784 #[inline(always)]
16785 fn max_ordinal_present(&self) -> u64 {
16786 if let Some(_) = self.connection_stream {
16787 return 3;
16788 }
16789 if let Some(_) = self.cis_id {
16790 return 2;
16791 }
16792 if let Some(_) = self.cig_id {
16793 return 1;
16794 }
16795 0
16796 }
16797 }
16798
16799 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptCisRequest {
16800 type Borrowed<'a> = &'a mut Self;
16801 fn take_or_borrow<'a>(
16802 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16803 ) -> Self::Borrowed<'a> {
16804 value
16805 }
16806 }
16807
16808 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptCisRequest {
16809 type Owned = Self;
16810
16811 #[inline(always)]
16812 fn inline_align(_context: fidl::encoding::Context) -> usize {
16813 8
16814 }
16815
16816 #[inline(always)]
16817 fn inline_size(_context: fidl::encoding::Context) -> usize {
16818 16
16819 }
16820 }
16821
16822 unsafe impl
16823 fidl::encoding::Encode<
16824 ConnectionAcceptCisRequest,
16825 fidl::encoding::DefaultFuchsiaResourceDialect,
16826 > for &mut ConnectionAcceptCisRequest
16827 {
16828 unsafe fn encode(
16829 self,
16830 encoder: &mut fidl::encoding::Encoder<
16831 '_,
16832 fidl::encoding::DefaultFuchsiaResourceDialect,
16833 >,
16834 offset: usize,
16835 mut depth: fidl::encoding::Depth,
16836 ) -> fidl::Result<()> {
16837 encoder.debug_check_bounds::<ConnectionAcceptCisRequest>(offset);
16838 let max_ordinal: u64 = self.max_ordinal_present();
16840 encoder.write_num(max_ordinal, offset);
16841 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16842 if max_ordinal == 0 {
16844 return Ok(());
16845 }
16846 depth.increment()?;
16847 let envelope_size = 8;
16848 let bytes_len = max_ordinal as usize * envelope_size;
16849 #[allow(unused_variables)]
16850 let offset = encoder.out_of_line_offset(bytes_len);
16851 let mut _prev_end_offset: usize = 0;
16852 if 1 > max_ordinal {
16853 return Ok(());
16854 }
16855
16856 let cur_offset: usize = (1 - 1) * envelope_size;
16859
16860 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16862
16863 fidl::encoding::encode_in_envelope_optional::<
16868 u8,
16869 fidl::encoding::DefaultFuchsiaResourceDialect,
16870 >(
16871 self.cig_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16872 encoder,
16873 offset + cur_offset,
16874 depth,
16875 )?;
16876
16877 _prev_end_offset = cur_offset + envelope_size;
16878 if 2 > max_ordinal {
16879 return Ok(());
16880 }
16881
16882 let cur_offset: usize = (2 - 1) * envelope_size;
16885
16886 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16888
16889 fidl::encoding::encode_in_envelope_optional::<
16894 u8,
16895 fidl::encoding::DefaultFuchsiaResourceDialect,
16896 >(
16897 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16898 encoder,
16899 offset + cur_offset,
16900 depth,
16901 )?;
16902
16903 _prev_end_offset = cur_offset + envelope_size;
16904 if 3 > max_ordinal {
16905 return Ok(());
16906 }
16907
16908 let cur_offset: usize = (3 - 1) * envelope_size;
16911
16912 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16914
16915 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16920 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16921 encoder, offset + cur_offset, depth
16922 )?;
16923
16924 _prev_end_offset = cur_offset + envelope_size;
16925
16926 Ok(())
16927 }
16928 }
16929
16930 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16931 for ConnectionAcceptCisRequest
16932 {
16933 #[inline(always)]
16934 fn new_empty() -> Self {
16935 Self::default()
16936 }
16937
16938 unsafe fn decode(
16939 &mut self,
16940 decoder: &mut fidl::encoding::Decoder<
16941 '_,
16942 fidl::encoding::DefaultFuchsiaResourceDialect,
16943 >,
16944 offset: usize,
16945 mut depth: fidl::encoding::Depth,
16946 ) -> fidl::Result<()> {
16947 decoder.debug_check_bounds::<Self>(offset);
16948 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16949 None => return Err(fidl::Error::NotNullable),
16950 Some(len) => len,
16951 };
16952 if len == 0 {
16954 return Ok(());
16955 };
16956 depth.increment()?;
16957 let envelope_size = 8;
16958 let bytes_len = len * envelope_size;
16959 let offset = decoder.out_of_line_offset(bytes_len)?;
16960 let mut _next_ordinal_to_read = 0;
16962 let mut next_offset = offset;
16963 let end_offset = offset + bytes_len;
16964 _next_ordinal_to_read += 1;
16965 if next_offset >= end_offset {
16966 return Ok(());
16967 }
16968
16969 while _next_ordinal_to_read < 1 {
16971 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16972 _next_ordinal_to_read += 1;
16973 next_offset += envelope_size;
16974 }
16975
16976 let next_out_of_line = decoder.next_out_of_line();
16977 let handles_before = decoder.remaining_handles();
16978 if let Some((inlined, num_bytes, num_handles)) =
16979 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16980 {
16981 let member_inline_size =
16982 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16983 if inlined != (member_inline_size <= 4) {
16984 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16985 }
16986 let inner_offset;
16987 let mut inner_depth = depth.clone();
16988 if inlined {
16989 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16990 inner_offset = next_offset;
16991 } else {
16992 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16993 inner_depth.increment()?;
16994 }
16995 let val_ref = self.cig_id.get_or_insert_with(|| {
16996 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
16997 });
16998 fidl::decode!(
16999 u8,
17000 fidl::encoding::DefaultFuchsiaResourceDialect,
17001 val_ref,
17002 decoder,
17003 inner_offset,
17004 inner_depth
17005 )?;
17006 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17007 {
17008 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17009 }
17010 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17011 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17012 }
17013 }
17014
17015 next_offset += envelope_size;
17016 _next_ordinal_to_read += 1;
17017 if next_offset >= end_offset {
17018 return Ok(());
17019 }
17020
17021 while _next_ordinal_to_read < 2 {
17023 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17024 _next_ordinal_to_read += 1;
17025 next_offset += envelope_size;
17026 }
17027
17028 let next_out_of_line = decoder.next_out_of_line();
17029 let handles_before = decoder.remaining_handles();
17030 if let Some((inlined, num_bytes, num_handles)) =
17031 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17032 {
17033 let member_inline_size =
17034 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17035 if inlined != (member_inline_size <= 4) {
17036 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17037 }
17038 let inner_offset;
17039 let mut inner_depth = depth.clone();
17040 if inlined {
17041 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17042 inner_offset = next_offset;
17043 } else {
17044 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17045 inner_depth.increment()?;
17046 }
17047 let val_ref = self.cis_id.get_or_insert_with(|| {
17048 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
17049 });
17050 fidl::decode!(
17051 u8,
17052 fidl::encoding::DefaultFuchsiaResourceDialect,
17053 val_ref,
17054 decoder,
17055 inner_offset,
17056 inner_depth
17057 )?;
17058 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17059 {
17060 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17061 }
17062 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17063 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17064 }
17065 }
17066
17067 next_offset += envelope_size;
17068 _next_ordinal_to_read += 1;
17069 if next_offset >= end_offset {
17070 return Ok(());
17071 }
17072
17073 while _next_ordinal_to_read < 3 {
17075 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17076 _next_ordinal_to_read += 1;
17077 next_offset += envelope_size;
17078 }
17079
17080 let next_out_of_line = decoder.next_out_of_line();
17081 let handles_before = decoder.remaining_handles();
17082 if let Some((inlined, num_bytes, num_handles)) =
17083 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17084 {
17085 let member_inline_size = <fidl::encoding::Endpoint<
17086 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
17087 > as fidl::encoding::TypeMarker>::inline_size(
17088 decoder.context
17089 );
17090 if inlined != (member_inline_size <= 4) {
17091 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17092 }
17093 let inner_offset;
17094 let mut inner_depth = depth.clone();
17095 if inlined {
17096 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17097 inner_offset = next_offset;
17098 } else {
17099 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17100 inner_depth.increment()?;
17101 }
17102 let val_ref = self.connection_stream.get_or_insert_with(|| {
17103 fidl::new_empty!(
17104 fidl::encoding::Endpoint<
17105 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
17106 >,
17107 fidl::encoding::DefaultFuchsiaResourceDialect
17108 )
17109 });
17110 fidl::decode!(
17111 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
17112 fidl::encoding::DefaultFuchsiaResourceDialect,
17113 val_ref,
17114 decoder,
17115 inner_offset,
17116 inner_depth
17117 )?;
17118 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17119 {
17120 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17121 }
17122 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17123 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17124 }
17125 }
17126
17127 next_offset += envelope_size;
17128
17129 while next_offset < end_offset {
17131 _next_ordinal_to_read += 1;
17132 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17133 next_offset += envelope_size;
17134 }
17135
17136 Ok(())
17137 }
17138 }
17139
17140 impl ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17141 #[inline(always)]
17142 fn max_ordinal_present(&self) -> u64 {
17143 if let Some(_) = self.config {
17144 return 2;
17145 }
17146 if let Some(_) = self.sync {
17147 return 1;
17148 }
17149 0
17150 }
17151 }
17152
17153 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17154 type Borrowed<'a> = &'a mut Self;
17155 fn take_or_borrow<'a>(
17156 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17157 ) -> Self::Borrowed<'a> {
17158 value
17159 }
17160 }
17161
17162 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17163 type Owned = Self;
17164
17165 #[inline(always)]
17166 fn inline_align(_context: fidl::encoding::Context) -> usize {
17167 8
17168 }
17169
17170 #[inline(always)]
17171 fn inline_size(_context: fidl::encoding::Context) -> usize {
17172 16
17173 }
17174 }
17175
17176 unsafe impl
17177 fidl::encoding::Encode<
17178 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
17179 fidl::encoding::DefaultFuchsiaResourceDialect,
17180 > for &mut ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
17181 {
17182 unsafe fn encode(
17183 self,
17184 encoder: &mut fidl::encoding::Encoder<
17185 '_,
17186 fidl::encoding::DefaultFuchsiaResourceDialect,
17187 >,
17188 offset: usize,
17189 mut depth: fidl::encoding::Depth,
17190 ) -> fidl::Result<()> {
17191 encoder.debug_check_bounds::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(
17192 offset,
17193 );
17194 let max_ordinal: u64 = self.max_ordinal_present();
17196 encoder.write_num(max_ordinal, offset);
17197 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17198 if max_ordinal == 0 {
17200 return Ok(());
17201 }
17202 depth.increment()?;
17203 let envelope_size = 8;
17204 let bytes_len = max_ordinal as usize * envelope_size;
17205 #[allow(unused_variables)]
17206 let offset = encoder.out_of_line_offset(bytes_len);
17207 let mut _prev_end_offset: usize = 0;
17208 if 1 > max_ordinal {
17209 return Ok(());
17210 }
17211
17212 let cur_offset: usize = (1 - 1) * envelope_size;
17215
17216 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17218
17219 fidl::encoding::encode_in_envelope_optional::<
17224 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
17225 fidl::encoding::DefaultFuchsiaResourceDialect,
17226 >(
17227 self.sync.as_mut().map(
17228 <fidl::encoding::Endpoint<
17229 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17230 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17231 ),
17232 encoder,
17233 offset + cur_offset,
17234 depth,
17235 )?;
17236
17237 _prev_end_offset = cur_offset + envelope_size;
17238 if 2 > max_ordinal {
17239 return Ok(());
17240 }
17241
17242 let cur_offset: usize = (2 - 1) * envelope_size;
17245
17246 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17248
17249 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
17254 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
17255 encoder, offset + cur_offset, depth
17256 )?;
17257
17258 _prev_end_offset = cur_offset + envelope_size;
17259
17260 Ok(())
17261 }
17262 }
17263
17264 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17265 for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
17266 {
17267 #[inline(always)]
17268 fn new_empty() -> Self {
17269 Self::default()
17270 }
17271
17272 unsafe fn decode(
17273 &mut self,
17274 decoder: &mut fidl::encoding::Decoder<
17275 '_,
17276 fidl::encoding::DefaultFuchsiaResourceDialect,
17277 >,
17278 offset: usize,
17279 mut depth: fidl::encoding::Depth,
17280 ) -> fidl::Result<()> {
17281 decoder.debug_check_bounds::<Self>(offset);
17282 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17283 None => return Err(fidl::Error::NotNullable),
17284 Some(len) => len,
17285 };
17286 if len == 0 {
17288 return Ok(());
17289 };
17290 depth.increment()?;
17291 let envelope_size = 8;
17292 let bytes_len = len * envelope_size;
17293 let offset = decoder.out_of_line_offset(bytes_len)?;
17294 let mut _next_ordinal_to_read = 0;
17296 let mut next_offset = offset;
17297 let end_offset = offset + bytes_len;
17298 _next_ordinal_to_read += 1;
17299 if next_offset >= end_offset {
17300 return Ok(());
17301 }
17302
17303 while _next_ordinal_to_read < 1 {
17305 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17306 _next_ordinal_to_read += 1;
17307 next_offset += envelope_size;
17308 }
17309
17310 let next_out_of_line = decoder.next_out_of_line();
17311 let handles_before = decoder.remaining_handles();
17312 if let Some((inlined, num_bytes, num_handles)) =
17313 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17314 {
17315 let member_inline_size = <fidl::encoding::Endpoint<
17316 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17317 > as fidl::encoding::TypeMarker>::inline_size(
17318 decoder.context
17319 );
17320 if inlined != (member_inline_size <= 4) {
17321 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17322 }
17323 let inner_offset;
17324 let mut inner_depth = depth.clone();
17325 if inlined {
17326 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17327 inner_offset = next_offset;
17328 } else {
17329 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17330 inner_depth.increment()?;
17331 }
17332 let val_ref = self.sync.get_or_insert_with(|| {
17333 fidl::new_empty!(
17334 fidl::encoding::Endpoint<
17335 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17336 >,
17337 fidl::encoding::DefaultFuchsiaResourceDialect
17338 )
17339 });
17340 fidl::decode!(
17341 fidl::encoding::Endpoint<
17342 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17343 >,
17344 fidl::encoding::DefaultFuchsiaResourceDialect,
17345 val_ref,
17346 decoder,
17347 inner_offset,
17348 inner_depth
17349 )?;
17350 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17351 {
17352 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17353 }
17354 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17355 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17356 }
17357 }
17358
17359 next_offset += envelope_size;
17360 _next_ordinal_to_read += 1;
17361 if next_offset >= end_offset {
17362 return Ok(());
17363 }
17364
17365 while _next_ordinal_to_read < 2 {
17367 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17368 _next_ordinal_to_read += 1;
17369 next_offset += envelope_size;
17370 }
17371
17372 let next_out_of_line = decoder.next_out_of_line();
17373 let handles_before = decoder.remaining_handles();
17374 if let Some((inlined, num_bytes, num_handles)) =
17375 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17376 {
17377 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17378 if inlined != (member_inline_size <= 4) {
17379 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17380 }
17381 let inner_offset;
17382 let mut inner_depth = depth.clone();
17383 if inlined {
17384 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17385 inner_offset = next_offset;
17386 } else {
17387 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17388 inner_depth.increment()?;
17389 }
17390 let val_ref = self.config.get_or_insert_with(|| {
17391 fidl::new_empty!(
17392 PeriodicAdvertisingSyncConfiguration,
17393 fidl::encoding::DefaultFuchsiaResourceDialect
17394 )
17395 });
17396 fidl::decode!(
17397 PeriodicAdvertisingSyncConfiguration,
17398 fidl::encoding::DefaultFuchsiaResourceDialect,
17399 val_ref,
17400 decoder,
17401 inner_offset,
17402 inner_depth
17403 )?;
17404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17405 {
17406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17407 }
17408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17410 }
17411 }
17412
17413 next_offset += envelope_size;
17414
17415 while next_offset < end_offset {
17417 _next_ordinal_to_read += 1;
17418 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17419 next_offset += envelope_size;
17420 }
17421
17422 Ok(())
17423 }
17424 }
17425
17426 impl ConnectionConnectL2capRequest {
17427 #[inline(always)]
17428 fn max_ordinal_present(&self) -> u64 {
17429 if let Some(_) = self.ext_offload {
17430 return 4;
17431 }
17432 if let Some(_) = self.psm {
17433 return 3;
17434 }
17435 if let Some(_) = self.channel {
17436 return 2;
17437 }
17438 if let Some(_) = self.parameters {
17439 return 1;
17440 }
17441 0
17442 }
17443 }
17444
17445 impl fidl::encoding::ResourceTypeMarker for ConnectionConnectL2capRequest {
17446 type Borrowed<'a> = &'a mut Self;
17447 fn take_or_borrow<'a>(
17448 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17449 ) -> Self::Borrowed<'a> {
17450 value
17451 }
17452 }
17453
17454 unsafe impl fidl::encoding::TypeMarker for ConnectionConnectL2capRequest {
17455 type Owned = Self;
17456
17457 #[inline(always)]
17458 fn inline_align(_context: fidl::encoding::Context) -> usize {
17459 8
17460 }
17461
17462 #[inline(always)]
17463 fn inline_size(_context: fidl::encoding::Context) -> usize {
17464 16
17465 }
17466 }
17467
17468 unsafe impl
17469 fidl::encoding::Encode<
17470 ConnectionConnectL2capRequest,
17471 fidl::encoding::DefaultFuchsiaResourceDialect,
17472 > for &mut ConnectionConnectL2capRequest
17473 {
17474 unsafe fn encode(
17475 self,
17476 encoder: &mut fidl::encoding::Encoder<
17477 '_,
17478 fidl::encoding::DefaultFuchsiaResourceDialect,
17479 >,
17480 offset: usize,
17481 mut depth: fidl::encoding::Depth,
17482 ) -> fidl::Result<()> {
17483 encoder.debug_check_bounds::<ConnectionConnectL2capRequest>(offset);
17484 let max_ordinal: u64 = self.max_ordinal_present();
17486 encoder.write_num(max_ordinal, offset);
17487 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17488 if max_ordinal == 0 {
17490 return Ok(());
17491 }
17492 depth.increment()?;
17493 let envelope_size = 8;
17494 let bytes_len = max_ordinal as usize * envelope_size;
17495 #[allow(unused_variables)]
17496 let offset = encoder.out_of_line_offset(bytes_len);
17497 let mut _prev_end_offset: usize = 0;
17498 if 1 > max_ordinal {
17499 return Ok(());
17500 }
17501
17502 let cur_offset: usize = (1 - 1) * envelope_size;
17505
17506 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17508
17509 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
17514 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
17515 encoder, offset + cur_offset, depth
17516 )?;
17517
17518 _prev_end_offset = cur_offset + envelope_size;
17519 if 2 > max_ordinal {
17520 return Ok(());
17521 }
17522
17523 let cur_offset: usize = (2 - 1) * envelope_size;
17526
17527 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17529
17530 fidl::encoding::encode_in_envelope_optional::<
17535 fidl::encoding::Endpoint<
17536 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17537 >,
17538 fidl::encoding::DefaultFuchsiaResourceDialect,
17539 >(
17540 self.channel.as_mut().map(
17541 <fidl::encoding::Endpoint<
17542 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17543 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17544 ),
17545 encoder,
17546 offset + cur_offset,
17547 depth,
17548 )?;
17549
17550 _prev_end_offset = cur_offset + envelope_size;
17551 if 3 > max_ordinal {
17552 return Ok(());
17553 }
17554
17555 let cur_offset: usize = (3 - 1) * envelope_size;
17558
17559 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17561
17562 fidl::encoding::encode_in_envelope_optional::<
17567 u16,
17568 fidl::encoding::DefaultFuchsiaResourceDialect,
17569 >(
17570 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
17571 encoder,
17572 offset + cur_offset,
17573 depth,
17574 )?;
17575
17576 _prev_end_offset = cur_offset + envelope_size;
17577 if 4 > max_ordinal {
17578 return Ok(());
17579 }
17580
17581 let cur_offset: usize = (4 - 1) * envelope_size;
17584
17585 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17587
17588 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17593 self.ext_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17594 encoder, offset + cur_offset, depth
17595 )?;
17596
17597 _prev_end_offset = cur_offset + envelope_size;
17598
17599 Ok(())
17600 }
17601 }
17602
17603 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17604 for ConnectionConnectL2capRequest
17605 {
17606 #[inline(always)]
17607 fn new_empty() -> Self {
17608 Self::default()
17609 }
17610
17611 unsafe fn decode(
17612 &mut self,
17613 decoder: &mut fidl::encoding::Decoder<
17614 '_,
17615 fidl::encoding::DefaultFuchsiaResourceDialect,
17616 >,
17617 offset: usize,
17618 mut depth: fidl::encoding::Depth,
17619 ) -> fidl::Result<()> {
17620 decoder.debug_check_bounds::<Self>(offset);
17621 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17622 None => return Err(fidl::Error::NotNullable),
17623 Some(len) => len,
17624 };
17625 if len == 0 {
17627 return Ok(());
17628 };
17629 depth.increment()?;
17630 let envelope_size = 8;
17631 let bytes_len = len * envelope_size;
17632 let offset = decoder.out_of_line_offset(bytes_len)?;
17633 let mut _next_ordinal_to_read = 0;
17635 let mut next_offset = offset;
17636 let end_offset = offset + bytes_len;
17637 _next_ordinal_to_read += 1;
17638 if next_offset >= end_offset {
17639 return Ok(());
17640 }
17641
17642 while _next_ordinal_to_read < 1 {
17644 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17645 _next_ordinal_to_read += 1;
17646 next_offset += envelope_size;
17647 }
17648
17649 let next_out_of_line = decoder.next_out_of_line();
17650 let handles_before = decoder.remaining_handles();
17651 if let Some((inlined, num_bytes, num_handles)) =
17652 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17653 {
17654 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17655 if inlined != (member_inline_size <= 4) {
17656 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17657 }
17658 let inner_offset;
17659 let mut inner_depth = depth.clone();
17660 if inlined {
17661 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17662 inner_offset = next_offset;
17663 } else {
17664 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17665 inner_depth.increment()?;
17666 }
17667 let val_ref = self.parameters.get_or_insert_with(|| {
17668 fidl::new_empty!(
17669 fidl_fuchsia_bluetooth::ChannelParameters,
17670 fidl::encoding::DefaultFuchsiaResourceDialect
17671 )
17672 });
17673 fidl::decode!(
17674 fidl_fuchsia_bluetooth::ChannelParameters,
17675 fidl::encoding::DefaultFuchsiaResourceDialect,
17676 val_ref,
17677 decoder,
17678 inner_offset,
17679 inner_depth
17680 )?;
17681 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17682 {
17683 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17684 }
17685 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17686 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17687 }
17688 }
17689
17690 next_offset += envelope_size;
17691 _next_ordinal_to_read += 1;
17692 if next_offset >= end_offset {
17693 return Ok(());
17694 }
17695
17696 while _next_ordinal_to_read < 2 {
17698 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17699 _next_ordinal_to_read += 1;
17700 next_offset += envelope_size;
17701 }
17702
17703 let next_out_of_line = decoder.next_out_of_line();
17704 let handles_before = decoder.remaining_handles();
17705 if let Some((inlined, num_bytes, num_handles)) =
17706 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17707 {
17708 let member_inline_size = <fidl::encoding::Endpoint<
17709 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17710 > as fidl::encoding::TypeMarker>::inline_size(
17711 decoder.context
17712 );
17713 if inlined != (member_inline_size <= 4) {
17714 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17715 }
17716 let inner_offset;
17717 let mut inner_depth = depth.clone();
17718 if inlined {
17719 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17720 inner_offset = next_offset;
17721 } else {
17722 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17723 inner_depth.increment()?;
17724 }
17725 let val_ref = self.channel.get_or_insert_with(|| {
17726 fidl::new_empty!(
17727 fidl::encoding::Endpoint<
17728 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17729 >,
17730 fidl::encoding::DefaultFuchsiaResourceDialect
17731 )
17732 });
17733 fidl::decode!(
17734 fidl::encoding::Endpoint<
17735 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17736 >,
17737 fidl::encoding::DefaultFuchsiaResourceDialect,
17738 val_ref,
17739 decoder,
17740 inner_offset,
17741 inner_depth
17742 )?;
17743 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17744 {
17745 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17746 }
17747 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17748 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17749 }
17750 }
17751
17752 next_offset += envelope_size;
17753 _next_ordinal_to_read += 1;
17754 if next_offset >= end_offset {
17755 return Ok(());
17756 }
17757
17758 while _next_ordinal_to_read < 3 {
17760 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17761 _next_ordinal_to_read += 1;
17762 next_offset += envelope_size;
17763 }
17764
17765 let next_out_of_line = decoder.next_out_of_line();
17766 let handles_before = decoder.remaining_handles();
17767 if let Some((inlined, num_bytes, num_handles)) =
17768 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17769 {
17770 let member_inline_size =
17771 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17772 if inlined != (member_inline_size <= 4) {
17773 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17774 }
17775 let inner_offset;
17776 let mut inner_depth = depth.clone();
17777 if inlined {
17778 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17779 inner_offset = next_offset;
17780 } else {
17781 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17782 inner_depth.increment()?;
17783 }
17784 let val_ref = self.psm.get_or_insert_with(|| {
17785 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
17786 });
17787 fidl::decode!(
17788 u16,
17789 fidl::encoding::DefaultFuchsiaResourceDialect,
17790 val_ref,
17791 decoder,
17792 inner_offset,
17793 inner_depth
17794 )?;
17795 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17796 {
17797 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17798 }
17799 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17800 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17801 }
17802 }
17803
17804 next_offset += envelope_size;
17805 _next_ordinal_to_read += 1;
17806 if next_offset >= end_offset {
17807 return Ok(());
17808 }
17809
17810 while _next_ordinal_to_read < 4 {
17812 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17813 _next_ordinal_to_read += 1;
17814 next_offset += envelope_size;
17815 }
17816
17817 let next_out_of_line = decoder.next_out_of_line();
17818 let handles_before = decoder.remaining_handles();
17819 if let Some((inlined, num_bytes, num_handles)) =
17820 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17821 {
17822 let member_inline_size = <fidl::encoding::Endpoint<
17823 fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>,
17824 > as fidl::encoding::TypeMarker>::inline_size(
17825 decoder.context
17826 );
17827 if inlined != (member_inline_size <= 4) {
17828 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17829 }
17830 let inner_offset;
17831 let mut inner_depth = depth.clone();
17832 if inlined {
17833 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17834 inner_offset = next_offset;
17835 } else {
17836 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17837 inner_depth.increment()?;
17838 }
17839 let val_ref = self.ext_offload.get_or_insert_with(|| {
17840 fidl::new_empty!(
17841 fidl::encoding::Endpoint<
17842 fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>,
17843 >,
17844 fidl::encoding::DefaultFuchsiaResourceDialect
17845 )
17846 });
17847 fidl::decode!(
17848 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>>,
17849 fidl::encoding::DefaultFuchsiaResourceDialect,
17850 val_ref,
17851 decoder,
17852 inner_offset,
17853 inner_depth
17854 )?;
17855 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17856 {
17857 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17858 }
17859 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17860 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17861 }
17862 }
17863
17864 next_offset += envelope_size;
17865
17866 while next_offset < end_offset {
17868 _next_ordinal_to_read += 1;
17869 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17870 next_offset += envelope_size;
17871 }
17872
17873 Ok(())
17874 }
17875 }
17876}