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 let protocol_name =
313 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
314 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
315 }
316
317 pub fn into_channel(self) -> fidl::Channel {
318 self.client.into_channel()
319 }
320
321 pub fn wait_for_event(
324 &self,
325 deadline: zx::MonotonicInstant,
326 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
327 AdvertisedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
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
354 .client
355 .send_query::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::EmptyPayload>(
356 (peer, connection),
357 0x607b7716457eb178,
358 fidl::encoding::DynamicFlags::empty(),
359 ___deadline,
360 )?;
361 Ok(_response)
362 }
363}
364
365#[cfg(target_os = "fuchsia")]
366impl From<AdvertisedPeripheralSynchronousProxy> for zx::NullableHandle {
367 fn from(value: AdvertisedPeripheralSynchronousProxy) -> Self {
368 value.into_channel().into()
369 }
370}
371
372#[cfg(target_os = "fuchsia")]
373impl From<fidl::Channel> for AdvertisedPeripheralSynchronousProxy {
374 fn from(value: fidl::Channel) -> Self {
375 Self::new(value)
376 }
377}
378
379#[cfg(target_os = "fuchsia")]
380impl fidl::endpoints::FromClient for AdvertisedPeripheralSynchronousProxy {
381 type Protocol = AdvertisedPeripheralMarker;
382
383 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>) -> Self {
384 Self::new(value.into_channel())
385 }
386}
387
388#[derive(Debug, Clone)]
389pub struct AdvertisedPeripheralProxy {
390 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
391}
392
393impl fidl::endpoints::Proxy for AdvertisedPeripheralProxy {
394 type Protocol = AdvertisedPeripheralMarker;
395
396 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
397 Self::new(inner)
398 }
399
400 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
401 self.client.into_channel().map_err(|client| Self { client })
402 }
403
404 fn as_channel(&self) -> &::fidl::AsyncChannel {
405 self.client.as_channel()
406 }
407}
408
409impl AdvertisedPeripheralProxy {
410 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
412 let protocol_name =
413 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
414 Self { client: fidl::client::Client::new(channel, protocol_name) }
415 }
416
417 pub fn take_event_stream(&self) -> AdvertisedPeripheralEventStream {
423 AdvertisedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
424 }
425
426 pub fn r#on_connected(
444 &self,
445 mut peer: &Peer,
446 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
447 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
448 AdvertisedPeripheralProxyInterface::r#on_connected(self, peer, connection)
449 }
450}
451
452impl AdvertisedPeripheralProxyInterface for AdvertisedPeripheralProxy {
453 type OnConnectedResponseFut =
454 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
455 fn r#on_connected(
456 &self,
457 mut peer: &Peer,
458 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
459 ) -> Self::OnConnectedResponseFut {
460 fn _decode(
461 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
462 ) -> Result<(), fidl::Error> {
463 let _response = fidl::client::decode_transaction_body::<
464 fidl::encoding::EmptyPayload,
465 fidl::encoding::DefaultFuchsiaResourceDialect,
466 0x607b7716457eb178,
467 >(_buf?)?;
468 Ok(_response)
469 }
470 self.client.send_query_and_decode::<AdvertisedPeripheralOnConnectedRequest, ()>(
471 (peer, connection),
472 0x607b7716457eb178,
473 fidl::encoding::DynamicFlags::empty(),
474 _decode,
475 )
476 }
477}
478
479pub struct AdvertisedPeripheralEventStream {
480 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
481}
482
483impl std::marker::Unpin for AdvertisedPeripheralEventStream {}
484
485impl futures::stream::FusedStream for AdvertisedPeripheralEventStream {
486 fn is_terminated(&self) -> bool {
487 self.event_receiver.is_terminated()
488 }
489}
490
491impl futures::Stream for AdvertisedPeripheralEventStream {
492 type Item = Result<AdvertisedPeripheralEvent, fidl::Error>;
493
494 fn poll_next(
495 mut self: std::pin::Pin<&mut Self>,
496 cx: &mut std::task::Context<'_>,
497 ) -> std::task::Poll<Option<Self::Item>> {
498 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
499 &mut self.event_receiver,
500 cx
501 )?) {
502 Some(buf) => std::task::Poll::Ready(Some(AdvertisedPeripheralEvent::decode(buf))),
503 None => std::task::Poll::Ready(None),
504 }
505 }
506}
507
508#[derive(Debug)]
509pub enum AdvertisedPeripheralEvent {}
510
511impl AdvertisedPeripheralEvent {
512 fn decode(
514 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
515 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
516 let (bytes, _handles) = buf.split_mut();
517 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
518 debug_assert_eq!(tx_header.tx_id, 0);
519 match tx_header.ordinal {
520 _ => Err(fidl::Error::UnknownOrdinal {
521 ordinal: tx_header.ordinal,
522 protocol_name:
523 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
524 }),
525 }
526 }
527}
528
529pub struct AdvertisedPeripheralRequestStream {
531 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
532 is_terminated: bool,
533}
534
535impl std::marker::Unpin for AdvertisedPeripheralRequestStream {}
536
537impl futures::stream::FusedStream for AdvertisedPeripheralRequestStream {
538 fn is_terminated(&self) -> bool {
539 self.is_terminated
540 }
541}
542
543impl fidl::endpoints::RequestStream for AdvertisedPeripheralRequestStream {
544 type Protocol = AdvertisedPeripheralMarker;
545 type ControlHandle = AdvertisedPeripheralControlHandle;
546
547 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
548 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
549 }
550
551 fn control_handle(&self) -> Self::ControlHandle {
552 AdvertisedPeripheralControlHandle { inner: self.inner.clone() }
553 }
554
555 fn into_inner(
556 self,
557 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
558 {
559 (self.inner, self.is_terminated)
560 }
561
562 fn from_inner(
563 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
564 is_terminated: bool,
565 ) -> Self {
566 Self { inner, is_terminated }
567 }
568}
569
570impl futures::Stream for AdvertisedPeripheralRequestStream {
571 type Item = Result<AdvertisedPeripheralRequest, fidl::Error>;
572
573 fn poll_next(
574 mut self: std::pin::Pin<&mut Self>,
575 cx: &mut std::task::Context<'_>,
576 ) -> std::task::Poll<Option<Self::Item>> {
577 let this = &mut *self;
578 if this.inner.check_shutdown(cx) {
579 this.is_terminated = true;
580 return std::task::Poll::Ready(None);
581 }
582 if this.is_terminated {
583 panic!("polled AdvertisedPeripheralRequestStream after completion");
584 }
585 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
586 |bytes, handles| {
587 match this.inner.channel().read_etc(cx, bytes, handles) {
588 std::task::Poll::Ready(Ok(())) => {}
589 std::task::Poll::Pending => return std::task::Poll::Pending,
590 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
591 this.is_terminated = true;
592 return std::task::Poll::Ready(None);
593 }
594 std::task::Poll::Ready(Err(e)) => {
595 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
596 e.into(),
597 ))));
598 }
599 }
600
601 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
603
604 std::task::Poll::Ready(Some(match header.ordinal {
605 0x607b7716457eb178 => {
606 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
607 let mut req = fidl::new_empty!(AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
608 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdvertisedPeripheralOnConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
609 let control_handle = AdvertisedPeripheralControlHandle {
610 inner: this.inner.clone(),
611 };
612 Ok(AdvertisedPeripheralRequest::OnConnected {peer: req.peer,
613connection: req.connection,
614
615 responder: AdvertisedPeripheralOnConnectedResponder {
616 control_handle: std::mem::ManuallyDrop::new(control_handle),
617 tx_id: header.tx_id,
618 },
619 })
620 }
621 _ => Err(fidl::Error::UnknownOrdinal {
622 ordinal: header.ordinal,
623 protocol_name: <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
624 }),
625 }))
626 },
627 )
628 }
629}
630
631#[derive(Debug)]
636pub enum AdvertisedPeripheralRequest {
637 OnConnected {
655 peer: Peer,
656 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
657 responder: AdvertisedPeripheralOnConnectedResponder,
658 },
659}
660
661impl AdvertisedPeripheralRequest {
662 #[allow(irrefutable_let_patterns)]
663 pub fn into_on_connected(
664 self,
665 ) -> Option<(
666 Peer,
667 fidl::endpoints::ClientEnd<ConnectionMarker>,
668 AdvertisedPeripheralOnConnectedResponder,
669 )> {
670 if let AdvertisedPeripheralRequest::OnConnected { peer, connection, responder } = self {
671 Some((peer, connection, responder))
672 } else {
673 None
674 }
675 }
676
677 pub fn method_name(&self) -> &'static str {
679 match *self {
680 AdvertisedPeripheralRequest::OnConnected { .. } => "on_connected",
681 }
682 }
683}
684
685#[derive(Debug, Clone)]
686pub struct AdvertisedPeripheralControlHandle {
687 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
688}
689
690impl fidl::endpoints::ControlHandle for AdvertisedPeripheralControlHandle {
691 fn shutdown(&self) {
692 self.inner.shutdown()
693 }
694
695 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
696 self.inner.shutdown_with_epitaph(status)
697 }
698
699 fn is_closed(&self) -> bool {
700 self.inner.channel().is_closed()
701 }
702 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
703 self.inner.channel().on_closed()
704 }
705
706 #[cfg(target_os = "fuchsia")]
707 fn signal_peer(
708 &self,
709 clear_mask: zx::Signals,
710 set_mask: zx::Signals,
711 ) -> Result<(), zx_status::Status> {
712 use fidl::Peered;
713 self.inner.channel().signal_peer(clear_mask, set_mask)
714 }
715}
716
717impl AdvertisedPeripheralControlHandle {}
718
719#[must_use = "FIDL methods require a response to be sent"]
720#[derive(Debug)]
721pub struct AdvertisedPeripheralOnConnectedResponder {
722 control_handle: std::mem::ManuallyDrop<AdvertisedPeripheralControlHandle>,
723 tx_id: u32,
724}
725
726impl std::ops::Drop for AdvertisedPeripheralOnConnectedResponder {
730 fn drop(&mut self) {
731 self.control_handle.shutdown();
732 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
734 }
735}
736
737impl fidl::endpoints::Responder for AdvertisedPeripheralOnConnectedResponder {
738 type ControlHandle = AdvertisedPeripheralControlHandle;
739
740 fn control_handle(&self) -> &AdvertisedPeripheralControlHandle {
741 &self.control_handle
742 }
743
744 fn drop_without_shutdown(mut self) {
745 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
747 std::mem::forget(self);
749 }
750}
751
752impl AdvertisedPeripheralOnConnectedResponder {
753 pub fn send(self) -> Result<(), fidl::Error> {
757 let _result = self.send_raw();
758 if _result.is_err() {
759 self.control_handle.shutdown();
760 }
761 self.drop_without_shutdown();
762 _result
763 }
764
765 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
767 let _result = self.send_raw();
768 self.drop_without_shutdown();
769 _result
770 }
771
772 fn send_raw(&self) -> Result<(), fidl::Error> {
773 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
774 (),
775 self.tx_id,
776 0x607b7716457eb178,
777 fidl::encoding::DynamicFlags::empty(),
778 )
779 }
780}
781
782#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
783pub struct AdvertisingHandleMarker;
784
785impl fidl::endpoints::ProtocolMarker for AdvertisingHandleMarker {
786 type Proxy = AdvertisingHandleProxy;
787 type RequestStream = AdvertisingHandleRequestStream;
788 #[cfg(target_os = "fuchsia")]
789 type SynchronousProxy = AdvertisingHandleSynchronousProxy;
790
791 const DEBUG_NAME: &'static str = "(anonymous) AdvertisingHandle";
792}
793
794pub trait AdvertisingHandleProxyInterface: Send + Sync {}
795#[derive(Debug)]
796#[cfg(target_os = "fuchsia")]
797pub struct AdvertisingHandleSynchronousProxy {
798 client: fidl::client::sync::Client,
799}
800
801#[cfg(target_os = "fuchsia")]
802impl fidl::endpoints::SynchronousProxy for AdvertisingHandleSynchronousProxy {
803 type Proxy = AdvertisingHandleProxy;
804 type Protocol = AdvertisingHandleMarker;
805
806 fn from_channel(inner: fidl::Channel) -> Self {
807 Self::new(inner)
808 }
809
810 fn into_channel(self) -> fidl::Channel {
811 self.client.into_channel()
812 }
813
814 fn as_channel(&self) -> &fidl::Channel {
815 self.client.as_channel()
816 }
817}
818
819#[cfg(target_os = "fuchsia")]
820impl AdvertisingHandleSynchronousProxy {
821 pub fn new(channel: fidl::Channel) -> Self {
822 let protocol_name =
823 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
824 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
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(self.client.wait_for_event(deadline)?)
838 }
839}
840
841#[cfg(target_os = "fuchsia")]
842impl From<AdvertisingHandleSynchronousProxy> for zx::NullableHandle {
843 fn from(value: AdvertisingHandleSynchronousProxy) -> Self {
844 value.into_channel().into()
845 }
846}
847
848#[cfg(target_os = "fuchsia")]
849impl From<fidl::Channel> for AdvertisingHandleSynchronousProxy {
850 fn from(value: fidl::Channel) -> Self {
851 Self::new(value)
852 }
853}
854
855#[cfg(target_os = "fuchsia")]
856impl fidl::endpoints::FromClient for AdvertisingHandleSynchronousProxy {
857 type Protocol = AdvertisingHandleMarker;
858
859 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisingHandleMarker>) -> Self {
860 Self::new(value.into_channel())
861 }
862}
863
864#[derive(Debug, Clone)]
865pub struct AdvertisingHandleProxy {
866 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
867}
868
869impl fidl::endpoints::Proxy for AdvertisingHandleProxy {
870 type Protocol = AdvertisingHandleMarker;
871
872 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
873 Self::new(inner)
874 }
875
876 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
877 self.client.into_channel().map_err(|client| Self { client })
878 }
879
880 fn as_channel(&self) -> &::fidl::AsyncChannel {
881 self.client.as_channel()
882 }
883}
884
885impl AdvertisingHandleProxy {
886 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
888 let protocol_name =
889 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
890 Self { client: fidl::client::Client::new(channel, protocol_name) }
891 }
892
893 pub fn take_event_stream(&self) -> AdvertisingHandleEventStream {
899 AdvertisingHandleEventStream { event_receiver: self.client.take_event_receiver() }
900 }
901}
902
903impl AdvertisingHandleProxyInterface for AdvertisingHandleProxy {}
904
905pub struct AdvertisingHandleEventStream {
906 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
907}
908
909impl std::marker::Unpin for AdvertisingHandleEventStream {}
910
911impl futures::stream::FusedStream for AdvertisingHandleEventStream {
912 fn is_terminated(&self) -> bool {
913 self.event_receiver.is_terminated()
914 }
915}
916
917impl futures::Stream for AdvertisingHandleEventStream {
918 type Item = Result<AdvertisingHandleEvent, fidl::Error>;
919
920 fn poll_next(
921 mut self: std::pin::Pin<&mut Self>,
922 cx: &mut std::task::Context<'_>,
923 ) -> std::task::Poll<Option<Self::Item>> {
924 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
925 &mut self.event_receiver,
926 cx
927 )?) {
928 Some(buf) => std::task::Poll::Ready(Some(AdvertisingHandleEvent::decode(buf))),
929 None => std::task::Poll::Ready(None),
930 }
931 }
932}
933
934#[derive(Debug)]
935pub enum AdvertisingHandleEvent {}
936
937impl AdvertisingHandleEvent {
938 fn decode(
940 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
941 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
942 let (bytes, _handles) = buf.split_mut();
943 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
944 debug_assert_eq!(tx_header.tx_id, 0);
945 match tx_header.ordinal {
946 _ => Err(fidl::Error::UnknownOrdinal {
947 ordinal: tx_header.ordinal,
948 protocol_name:
949 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
950 }),
951 }
952 }
953}
954
955pub struct AdvertisingHandleRequestStream {
957 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
958 is_terminated: bool,
959}
960
961impl std::marker::Unpin for AdvertisingHandleRequestStream {}
962
963impl futures::stream::FusedStream for AdvertisingHandleRequestStream {
964 fn is_terminated(&self) -> bool {
965 self.is_terminated
966 }
967}
968
969impl fidl::endpoints::RequestStream for AdvertisingHandleRequestStream {
970 type Protocol = AdvertisingHandleMarker;
971 type ControlHandle = AdvertisingHandleControlHandle;
972
973 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
974 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
975 }
976
977 fn control_handle(&self) -> Self::ControlHandle {
978 AdvertisingHandleControlHandle { inner: self.inner.clone() }
979 }
980
981 fn into_inner(
982 self,
983 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
984 {
985 (self.inner, self.is_terminated)
986 }
987
988 fn from_inner(
989 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
990 is_terminated: bool,
991 ) -> Self {
992 Self { inner, is_terminated }
993 }
994}
995
996impl futures::Stream for AdvertisingHandleRequestStream {
997 type Item = Result<AdvertisingHandleRequest, fidl::Error>;
998
999 fn poll_next(
1000 mut self: std::pin::Pin<&mut Self>,
1001 cx: &mut std::task::Context<'_>,
1002 ) -> std::task::Poll<Option<Self::Item>> {
1003 let this = &mut *self;
1004 if this.inner.check_shutdown(cx) {
1005 this.is_terminated = true;
1006 return std::task::Poll::Ready(None);
1007 }
1008 if this.is_terminated {
1009 panic!("polled AdvertisingHandleRequestStream after completion");
1010 }
1011 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1012 |bytes, handles| {
1013 match this.inner.channel().read_etc(cx, bytes, handles) {
1014 std::task::Poll::Ready(Ok(())) => {}
1015 std::task::Poll::Pending => return std::task::Poll::Pending,
1016 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1017 this.is_terminated = true;
1018 return std::task::Poll::Ready(None);
1019 }
1020 std::task::Poll::Ready(Err(e)) => {
1021 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1022 e.into(),
1023 ))));
1024 }
1025 }
1026
1027 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1029
1030 std::task::Poll::Ready(Some(match header.ordinal {
1031 _ => Err(fidl::Error::UnknownOrdinal {
1032 ordinal: header.ordinal,
1033 protocol_name:
1034 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1035 }),
1036 }))
1037 },
1038 )
1039 }
1040}
1041
1042#[derive(Debug)]
1046pub enum AdvertisingHandleRequest {}
1047
1048impl AdvertisingHandleRequest {
1049 pub fn method_name(&self) -> &'static str {
1051 match *self {}
1052 }
1053}
1054
1055#[derive(Debug, Clone)]
1056pub struct AdvertisingHandleControlHandle {
1057 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1058}
1059
1060impl fidl::endpoints::ControlHandle for AdvertisingHandleControlHandle {
1061 fn shutdown(&self) {
1062 self.inner.shutdown()
1063 }
1064
1065 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1066 self.inner.shutdown_with_epitaph(status)
1067 }
1068
1069 fn is_closed(&self) -> bool {
1070 self.inner.channel().is_closed()
1071 }
1072 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1073 self.inner.channel().on_closed()
1074 }
1075
1076 #[cfg(target_os = "fuchsia")]
1077 fn signal_peer(
1078 &self,
1079 clear_mask: zx::Signals,
1080 set_mask: zx::Signals,
1081 ) -> Result<(), zx_status::Status> {
1082 use fidl::Peered;
1083 self.inner.channel().signal_peer(clear_mask, set_mask)
1084 }
1085}
1086
1087impl AdvertisingHandleControlHandle {}
1088
1089#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1090pub struct CentralMarker;
1091
1092impl fidl::endpoints::ProtocolMarker for CentralMarker {
1093 type Proxy = CentralProxy;
1094 type RequestStream = CentralRequestStream;
1095 #[cfg(target_os = "fuchsia")]
1096 type SynchronousProxy = CentralSynchronousProxy;
1097
1098 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Central";
1099}
1100impl fidl::endpoints::DiscoverableProtocolMarker for CentralMarker {}
1101pub type CentralCreateConnectedIsochronousGroupResult =
1102 Result<CentralCreateConnectedIsochronousGroupResponse, CreateCigError>;
1103
1104pub trait CentralProxyInterface: Send + Sync {
1105 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
1106 + Send;
1107 fn r#listen_l2cap(
1108 &self,
1109 payload: ChannelListenerRegistryListenL2capRequest,
1110 ) -> Self::ListenL2capResponseFut;
1111 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1112 fn r#scan(
1113 &self,
1114 options: &ScanOptions,
1115 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1116 ) -> Self::ScanResponseFut;
1117 fn r#connect(
1118 &self,
1119 id: &fidl_fuchsia_bluetooth::PeerId,
1120 options: &ConnectionOptions,
1121 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1122 ) -> Result<(), fidl::Error>;
1123 fn r#sync_to_periodic_advertising(
1124 &self,
1125 payload: CentralSyncToPeriodicAdvertisingRequest,
1126 ) -> Result<(), fidl::Error>;
1127 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
1128 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
1129 > + Send;
1130 fn r#create_connected_isochronous_group(
1131 &self,
1132 payload: CentralCreateConnectedIsochronousGroupRequest,
1133 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
1134 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
1135 + Send;
1136 fn r#get_peripherals(
1137 &self,
1138 service_uuids: Option<&[String]>,
1139 ) -> Self::GetPeripheralsResponseFut;
1140 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
1141 + Send;
1142 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
1143 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1144 + Send;
1145 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
1146 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
1147 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1148 + Send;
1149 fn r#connect_peripheral(
1150 &self,
1151 identifier: &str,
1152 options: &ConnectionOptions,
1153 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1154 ) -> Self::ConnectPeripheralResponseFut;
1155 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1156 + Send;
1157 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
1158}
1159#[derive(Debug)]
1160#[cfg(target_os = "fuchsia")]
1161pub struct CentralSynchronousProxy {
1162 client: fidl::client::sync::Client,
1163}
1164
1165#[cfg(target_os = "fuchsia")]
1166impl fidl::endpoints::SynchronousProxy for CentralSynchronousProxy {
1167 type Proxy = CentralProxy;
1168 type Protocol = CentralMarker;
1169
1170 fn from_channel(inner: fidl::Channel) -> Self {
1171 Self::new(inner)
1172 }
1173
1174 fn into_channel(self) -> fidl::Channel {
1175 self.client.into_channel()
1176 }
1177
1178 fn as_channel(&self) -> &fidl::Channel {
1179 self.client.as_channel()
1180 }
1181}
1182
1183#[cfg(target_os = "fuchsia")]
1184impl CentralSynchronousProxy {
1185 pub fn new(channel: fidl::Channel) -> Self {
1186 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1187 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1188 }
1189
1190 pub fn into_channel(self) -> fidl::Channel {
1191 self.client.into_channel()
1192 }
1193
1194 pub fn wait_for_event(
1197 &self,
1198 deadline: zx::MonotonicInstant,
1199 ) -> Result<CentralEvent, fidl::Error> {
1200 CentralEvent::decode(self.client.wait_for_event(deadline)?)
1201 }
1202
1203 pub fn r#listen_l2cap(
1213 &self,
1214 mut payload: ChannelListenerRegistryListenL2capRequest,
1215 ___deadline: zx::MonotonicInstant,
1216 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1217 let _response = self.client.send_query::<
1218 ChannelListenerRegistryListenL2capRequest,
1219 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1220 >(
1221 &mut payload,
1222 0x39c6e9001d102338,
1223 fidl::encoding::DynamicFlags::empty(),
1224 ___deadline,
1225 )?;
1226 Ok(_response.map(|x| x))
1227 }
1228
1229 pub fn r#scan(
1256 &self,
1257 mut options: &ScanOptions,
1258 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1259 ___deadline: zx::MonotonicInstant,
1260 ) -> Result<(), fidl::Error> {
1261 let _response =
1262 self.client.send_query::<CentralScanRequest, fidl::encoding::EmptyPayload>(
1263 (options, result_watcher),
1264 0x41f7121798dfe15f,
1265 fidl::encoding::DynamicFlags::empty(),
1266 ___deadline,
1267 )?;
1268 Ok(_response)
1269 }
1270
1271 pub fn r#connect(
1293 &self,
1294 mut id: &fidl_fuchsia_bluetooth::PeerId,
1295 mut options: &ConnectionOptions,
1296 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1297 ) -> Result<(), fidl::Error> {
1298 self.client.send::<CentralConnectRequest>(
1299 (id, options, handle),
1300 0x31a3065f2a6913c4,
1301 fidl::encoding::DynamicFlags::empty(),
1302 )
1303 }
1304
1305 pub fn r#sync_to_periodic_advertising(
1308 &self,
1309 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1310 ) -> Result<(), fidl::Error> {
1311 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1312 &mut payload,
1313 0x1db6df126a00c5b9,
1314 fidl::encoding::DynamicFlags::empty(),
1315 )
1316 }
1317
1318 pub fn r#create_connected_isochronous_group(
1327 &self,
1328 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1329 ___deadline: zx::MonotonicInstant,
1330 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1331 let _response = self
1332 .client
1333 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
1334 CentralCreateConnectedIsochronousGroupResponse,
1335 CreateCigError,
1336 >>(
1337 &mut payload,
1338 0x60323e70ae22e13,
1339 fidl::encoding::DynamicFlags::empty(),
1340 ___deadline,
1341 )?;
1342 Ok(_response.map(|x| x))
1343 }
1344
1345 pub fn r#get_peripherals(
1351 &self,
1352 mut service_uuids: Option<&[String]>,
1353 ___deadline: zx::MonotonicInstant,
1354 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1355 let _response =
1356 self.client.send_query::<CentralGetPeripheralsRequest, CentralGetPeripheralsResponse>(
1357 (service_uuids,),
1358 0x37ba777499c683a8,
1359 fidl::encoding::DynamicFlags::empty(),
1360 ___deadline,
1361 )?;
1362 Ok(_response.peripherals)
1363 }
1364
1365 pub fn r#get_peripheral(
1371 &self,
1372 mut identifier: &str,
1373 ___deadline: zx::MonotonicInstant,
1374 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1375 let _response =
1376 self.client.send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse>(
1377 (identifier,),
1378 0x97f5a2f2d9c13da,
1379 fidl::encoding::DynamicFlags::empty(),
1380 ___deadline,
1381 )?;
1382 Ok(_response.peripheral)
1383 }
1384
1385 pub fn r#start_scan(
1394 &self,
1395 mut filter: Option<&ScanFilter>,
1396 ___deadline: zx::MonotonicInstant,
1397 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1398 let _response =
1399 self.client.send_query::<CentralStartScanRequest, CentralStartScanResponse>(
1400 (filter,),
1401 0xeb4cf0cd0e1132b,
1402 fidl::encoding::DynamicFlags::empty(),
1403 ___deadline,
1404 )?;
1405 Ok(_response.status)
1406 }
1407
1408 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1410 self.client.send::<fidl::encoding::EmptyPayload>(
1411 (),
1412 0x5f79ee6a0bb037a0,
1413 fidl::encoding::DynamicFlags::empty(),
1414 )
1415 }
1416
1417 pub fn r#connect_peripheral(
1424 &self,
1425 mut identifier: &str,
1426 mut options: &ConnectionOptions,
1427 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1428 ___deadline: zx::MonotonicInstant,
1429 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1430 let _response = self
1431 .client
1432 .send_query::<CentralConnectPeripheralRequest, CentralConnectPeripheralResponse>(
1433 (identifier, options, gatt_client),
1434 0x714d6c32d066d75a,
1435 fidl::encoding::DynamicFlags::empty(),
1436 ___deadline,
1437 )?;
1438 Ok(_response.status)
1439 }
1440
1441 pub fn r#disconnect_peripheral(
1443 &self,
1444 mut identifier: &str,
1445 ___deadline: zx::MonotonicInstant,
1446 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1447 let _response = self
1448 .client
1449 .send_query::<CentralDisconnectPeripheralRequest, CentralDisconnectPeripheralResponse>(
1450 (identifier,),
1451 0xa9430da197362fd,
1452 fidl::encoding::DynamicFlags::empty(),
1453 ___deadline,
1454 )?;
1455 Ok(_response.status)
1456 }
1457}
1458
1459#[cfg(target_os = "fuchsia")]
1460impl From<CentralSynchronousProxy> for zx::NullableHandle {
1461 fn from(value: CentralSynchronousProxy) -> Self {
1462 value.into_channel().into()
1463 }
1464}
1465
1466#[cfg(target_os = "fuchsia")]
1467impl From<fidl::Channel> for CentralSynchronousProxy {
1468 fn from(value: fidl::Channel) -> Self {
1469 Self::new(value)
1470 }
1471}
1472
1473#[cfg(target_os = "fuchsia")]
1474impl fidl::endpoints::FromClient for CentralSynchronousProxy {
1475 type Protocol = CentralMarker;
1476
1477 fn from_client(value: fidl::endpoints::ClientEnd<CentralMarker>) -> Self {
1478 Self::new(value.into_channel())
1479 }
1480}
1481
1482#[derive(Debug, Clone)]
1483pub struct CentralProxy {
1484 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1485}
1486
1487impl fidl::endpoints::Proxy for CentralProxy {
1488 type Protocol = CentralMarker;
1489
1490 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1491 Self::new(inner)
1492 }
1493
1494 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1495 self.client.into_channel().map_err(|client| Self { client })
1496 }
1497
1498 fn as_channel(&self) -> &::fidl::AsyncChannel {
1499 self.client.as_channel()
1500 }
1501}
1502
1503impl CentralProxy {
1504 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1506 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1507 Self { client: fidl::client::Client::new(channel, protocol_name) }
1508 }
1509
1510 pub fn take_event_stream(&self) -> CentralEventStream {
1516 CentralEventStream { event_receiver: self.client.take_event_receiver() }
1517 }
1518
1519 pub fn r#listen_l2cap(
1529 &self,
1530 mut payload: ChannelListenerRegistryListenL2capRequest,
1531 ) -> fidl::client::QueryResponseFut<
1532 ChannelListenerRegistryListenL2capResult,
1533 fidl::encoding::DefaultFuchsiaResourceDialect,
1534 > {
1535 CentralProxyInterface::r#listen_l2cap(self, payload)
1536 }
1537
1538 pub fn r#scan(
1565 &self,
1566 mut options: &ScanOptions,
1567 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1568 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1569 CentralProxyInterface::r#scan(self, options, result_watcher)
1570 }
1571
1572 pub fn r#connect(
1594 &self,
1595 mut id: &fidl_fuchsia_bluetooth::PeerId,
1596 mut options: &ConnectionOptions,
1597 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1598 ) -> Result<(), fidl::Error> {
1599 CentralProxyInterface::r#connect(self, id, options, handle)
1600 }
1601
1602 pub fn r#sync_to_periodic_advertising(
1605 &self,
1606 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1607 ) -> Result<(), fidl::Error> {
1608 CentralProxyInterface::r#sync_to_periodic_advertising(self, payload)
1609 }
1610
1611 pub fn r#create_connected_isochronous_group(
1620 &self,
1621 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1622 ) -> fidl::client::QueryResponseFut<
1623 CentralCreateConnectedIsochronousGroupResult,
1624 fidl::encoding::DefaultFuchsiaResourceDialect,
1625 > {
1626 CentralProxyInterface::r#create_connected_isochronous_group(self, payload)
1627 }
1628
1629 pub fn r#get_peripherals(
1635 &self,
1636 mut service_uuids: Option<&[String]>,
1637 ) -> fidl::client::QueryResponseFut<
1638 Vec<RemoteDevice>,
1639 fidl::encoding::DefaultFuchsiaResourceDialect,
1640 > {
1641 CentralProxyInterface::r#get_peripherals(self, service_uuids)
1642 }
1643
1644 pub fn r#get_peripheral(
1650 &self,
1651 mut identifier: &str,
1652 ) -> fidl::client::QueryResponseFut<
1653 Option<Box<RemoteDevice>>,
1654 fidl::encoding::DefaultFuchsiaResourceDialect,
1655 > {
1656 CentralProxyInterface::r#get_peripheral(self, identifier)
1657 }
1658
1659 pub fn r#start_scan(
1668 &self,
1669 mut filter: Option<&ScanFilter>,
1670 ) -> fidl::client::QueryResponseFut<
1671 fidl_fuchsia_bluetooth::Status,
1672 fidl::encoding::DefaultFuchsiaResourceDialect,
1673 > {
1674 CentralProxyInterface::r#start_scan(self, filter)
1675 }
1676
1677 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1679 CentralProxyInterface::r#stop_scan(self)
1680 }
1681
1682 pub fn r#connect_peripheral(
1689 &self,
1690 mut identifier: &str,
1691 mut options: &ConnectionOptions,
1692 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1693 ) -> fidl::client::QueryResponseFut<
1694 fidl_fuchsia_bluetooth::Status,
1695 fidl::encoding::DefaultFuchsiaResourceDialect,
1696 > {
1697 CentralProxyInterface::r#connect_peripheral(self, identifier, options, gatt_client)
1698 }
1699
1700 pub fn r#disconnect_peripheral(
1702 &self,
1703 mut identifier: &str,
1704 ) -> fidl::client::QueryResponseFut<
1705 fidl_fuchsia_bluetooth::Status,
1706 fidl::encoding::DefaultFuchsiaResourceDialect,
1707 > {
1708 CentralProxyInterface::r#disconnect_peripheral(self, identifier)
1709 }
1710}
1711
1712impl CentralProxyInterface for CentralProxy {
1713 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
1714 ChannelListenerRegistryListenL2capResult,
1715 fidl::encoding::DefaultFuchsiaResourceDialect,
1716 >;
1717 fn r#listen_l2cap(
1718 &self,
1719 mut payload: ChannelListenerRegistryListenL2capRequest,
1720 ) -> Self::ListenL2capResponseFut {
1721 fn _decode(
1722 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1723 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1724 let _response = fidl::client::decode_transaction_body::<
1725 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1726 fidl::encoding::DefaultFuchsiaResourceDialect,
1727 0x39c6e9001d102338,
1728 >(_buf?)?;
1729 Ok(_response.map(|x| x))
1730 }
1731 self.client.send_query_and_decode::<
1732 ChannelListenerRegistryListenL2capRequest,
1733 ChannelListenerRegistryListenL2capResult,
1734 >(
1735 &mut payload,
1736 0x39c6e9001d102338,
1737 fidl::encoding::DynamicFlags::empty(),
1738 _decode,
1739 )
1740 }
1741
1742 type ScanResponseFut =
1743 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1744 fn r#scan(
1745 &self,
1746 mut options: &ScanOptions,
1747 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1748 ) -> Self::ScanResponseFut {
1749 fn _decode(
1750 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1751 ) -> Result<(), fidl::Error> {
1752 let _response = fidl::client::decode_transaction_body::<
1753 fidl::encoding::EmptyPayload,
1754 fidl::encoding::DefaultFuchsiaResourceDialect,
1755 0x41f7121798dfe15f,
1756 >(_buf?)?;
1757 Ok(_response)
1758 }
1759 self.client.send_query_and_decode::<CentralScanRequest, ()>(
1760 (options, result_watcher),
1761 0x41f7121798dfe15f,
1762 fidl::encoding::DynamicFlags::empty(),
1763 _decode,
1764 )
1765 }
1766
1767 fn r#connect(
1768 &self,
1769 mut id: &fidl_fuchsia_bluetooth::PeerId,
1770 mut options: &ConnectionOptions,
1771 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1772 ) -> Result<(), fidl::Error> {
1773 self.client.send::<CentralConnectRequest>(
1774 (id, options, handle),
1775 0x31a3065f2a6913c4,
1776 fidl::encoding::DynamicFlags::empty(),
1777 )
1778 }
1779
1780 fn r#sync_to_periodic_advertising(
1781 &self,
1782 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1783 ) -> Result<(), fidl::Error> {
1784 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1785 &mut payload,
1786 0x1db6df126a00c5b9,
1787 fidl::encoding::DynamicFlags::empty(),
1788 )
1789 }
1790
1791 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
1792 CentralCreateConnectedIsochronousGroupResult,
1793 fidl::encoding::DefaultFuchsiaResourceDialect,
1794 >;
1795 fn r#create_connected_isochronous_group(
1796 &self,
1797 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1798 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
1799 fn _decode(
1800 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1801 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1802 let _response = fidl::client::decode_transaction_body::<
1803 fidl::encoding::ResultType<
1804 CentralCreateConnectedIsochronousGroupResponse,
1805 CreateCigError,
1806 >,
1807 fidl::encoding::DefaultFuchsiaResourceDialect,
1808 0x60323e70ae22e13,
1809 >(_buf?)?;
1810 Ok(_response.map(|x| x))
1811 }
1812 self.client.send_query_and_decode::<
1813 CentralCreateConnectedIsochronousGroupRequest,
1814 CentralCreateConnectedIsochronousGroupResult,
1815 >(
1816 &mut payload,
1817 0x60323e70ae22e13,
1818 fidl::encoding::DynamicFlags::empty(),
1819 _decode,
1820 )
1821 }
1822
1823 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
1824 Vec<RemoteDevice>,
1825 fidl::encoding::DefaultFuchsiaResourceDialect,
1826 >;
1827 fn r#get_peripherals(
1828 &self,
1829 mut service_uuids: Option<&[String]>,
1830 ) -> Self::GetPeripheralsResponseFut {
1831 fn _decode(
1832 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1833 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1834 let _response = fidl::client::decode_transaction_body::<
1835 CentralGetPeripheralsResponse,
1836 fidl::encoding::DefaultFuchsiaResourceDialect,
1837 0x37ba777499c683a8,
1838 >(_buf?)?;
1839 Ok(_response.peripherals)
1840 }
1841 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
1842 (service_uuids,),
1843 0x37ba777499c683a8,
1844 fidl::encoding::DynamicFlags::empty(),
1845 _decode,
1846 )
1847 }
1848
1849 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
1850 Option<Box<RemoteDevice>>,
1851 fidl::encoding::DefaultFuchsiaResourceDialect,
1852 >;
1853 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
1854 fn _decode(
1855 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1856 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1857 let _response = fidl::client::decode_transaction_body::<
1858 CentralGetPeripheralResponse,
1859 fidl::encoding::DefaultFuchsiaResourceDialect,
1860 0x97f5a2f2d9c13da,
1861 >(_buf?)?;
1862 Ok(_response.peripheral)
1863 }
1864 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
1865 (identifier,),
1866 0x97f5a2f2d9c13da,
1867 fidl::encoding::DynamicFlags::empty(),
1868 _decode,
1869 )
1870 }
1871
1872 type StartScanResponseFut = fidl::client::QueryResponseFut<
1873 fidl_fuchsia_bluetooth::Status,
1874 fidl::encoding::DefaultFuchsiaResourceDialect,
1875 >;
1876 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
1877 fn _decode(
1878 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1879 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1880 let _response = fidl::client::decode_transaction_body::<
1881 CentralStartScanResponse,
1882 fidl::encoding::DefaultFuchsiaResourceDialect,
1883 0xeb4cf0cd0e1132b,
1884 >(_buf?)?;
1885 Ok(_response.status)
1886 }
1887 self.client
1888 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
1889 (filter,),
1890 0xeb4cf0cd0e1132b,
1891 fidl::encoding::DynamicFlags::empty(),
1892 _decode,
1893 )
1894 }
1895
1896 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1897 self.client.send::<fidl::encoding::EmptyPayload>(
1898 (),
1899 0x5f79ee6a0bb037a0,
1900 fidl::encoding::DynamicFlags::empty(),
1901 )
1902 }
1903
1904 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1905 fidl_fuchsia_bluetooth::Status,
1906 fidl::encoding::DefaultFuchsiaResourceDialect,
1907 >;
1908 fn r#connect_peripheral(
1909 &self,
1910 mut identifier: &str,
1911 mut options: &ConnectionOptions,
1912 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1913 ) -> Self::ConnectPeripheralResponseFut {
1914 fn _decode(
1915 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1916 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1917 let _response = fidl::client::decode_transaction_body::<
1918 CentralConnectPeripheralResponse,
1919 fidl::encoding::DefaultFuchsiaResourceDialect,
1920 0x714d6c32d066d75a,
1921 >(_buf?)?;
1922 Ok(_response.status)
1923 }
1924 self.client.send_query_and_decode::<
1925 CentralConnectPeripheralRequest,
1926 fidl_fuchsia_bluetooth::Status,
1927 >(
1928 (identifier, options, gatt_client,),
1929 0x714d6c32d066d75a,
1930 fidl::encoding::DynamicFlags::empty(),
1931 _decode,
1932 )
1933 }
1934
1935 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1936 fidl_fuchsia_bluetooth::Status,
1937 fidl::encoding::DefaultFuchsiaResourceDialect,
1938 >;
1939 fn r#disconnect_peripheral(
1940 &self,
1941 mut identifier: &str,
1942 ) -> Self::DisconnectPeripheralResponseFut {
1943 fn _decode(
1944 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1945 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1946 let _response = fidl::client::decode_transaction_body::<
1947 CentralDisconnectPeripheralResponse,
1948 fidl::encoding::DefaultFuchsiaResourceDialect,
1949 0xa9430da197362fd,
1950 >(_buf?)?;
1951 Ok(_response.status)
1952 }
1953 self.client.send_query_and_decode::<
1954 CentralDisconnectPeripheralRequest,
1955 fidl_fuchsia_bluetooth::Status,
1956 >(
1957 (identifier,),
1958 0xa9430da197362fd,
1959 fidl::encoding::DynamicFlags::empty(),
1960 _decode,
1961 )
1962 }
1963}
1964
1965pub struct CentralEventStream {
1966 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1967}
1968
1969impl std::marker::Unpin for CentralEventStream {}
1970
1971impl futures::stream::FusedStream for CentralEventStream {
1972 fn is_terminated(&self) -> bool {
1973 self.event_receiver.is_terminated()
1974 }
1975}
1976
1977impl futures::Stream for CentralEventStream {
1978 type Item = Result<CentralEvent, fidl::Error>;
1979
1980 fn poll_next(
1981 mut self: std::pin::Pin<&mut Self>,
1982 cx: &mut std::task::Context<'_>,
1983 ) -> std::task::Poll<Option<Self::Item>> {
1984 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1985 &mut self.event_receiver,
1986 cx
1987 )?) {
1988 Some(buf) => std::task::Poll::Ready(Some(CentralEvent::decode(buf))),
1989 None => std::task::Poll::Ready(None),
1990 }
1991 }
1992}
1993
1994#[derive(Debug)]
1995pub enum CentralEvent {
1996 OnScanStateChanged { scanning: bool },
1997 OnDeviceDiscovered { device: RemoteDevice },
1998 OnPeripheralDisconnected { identifier: String },
1999}
2000
2001impl CentralEvent {
2002 #[allow(irrefutable_let_patterns)]
2003 pub fn into_on_scan_state_changed(self) -> Option<bool> {
2004 if let CentralEvent::OnScanStateChanged { scanning } = self {
2005 Some((scanning))
2006 } else {
2007 None
2008 }
2009 }
2010 #[allow(irrefutable_let_patterns)]
2011 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
2012 if let CentralEvent::OnDeviceDiscovered { device } = self { Some((device)) } else { None }
2013 }
2014 #[allow(irrefutable_let_patterns)]
2015 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
2016 if let CentralEvent::OnPeripheralDisconnected { identifier } = self {
2017 Some((identifier))
2018 } else {
2019 None
2020 }
2021 }
2022
2023 fn decode(
2025 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2026 ) -> Result<CentralEvent, fidl::Error> {
2027 let (bytes, _handles) = buf.split_mut();
2028 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2029 debug_assert_eq!(tx_header.tx_id, 0);
2030 match tx_header.ordinal {
2031 0x5f8edc23cad04d3f => {
2032 let mut out = fidl::new_empty!(
2033 CentralOnScanStateChangedRequest,
2034 fidl::encoding::DefaultFuchsiaResourceDialect
2035 );
2036 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2037 Ok((CentralEvent::OnScanStateChanged { scanning: out.scanning }))
2038 }
2039 0x708dadf20d66db6 => {
2040 let mut out = fidl::new_empty!(
2041 CentralOnDeviceDiscoveredRequest,
2042 fidl::encoding::DefaultFuchsiaResourceDialect
2043 );
2044 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2045 Ok((CentralEvent::OnDeviceDiscovered { device: out.device }))
2046 }
2047 0x4e4c6b979b2126df => {
2048 let mut out = fidl::new_empty!(
2049 CentralOnPeripheralDisconnectedRequest,
2050 fidl::encoding::DefaultFuchsiaResourceDialect
2051 );
2052 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2053 Ok((CentralEvent::OnPeripheralDisconnected { identifier: out.identifier }))
2054 }
2055 _ => Err(fidl::Error::UnknownOrdinal {
2056 ordinal: tx_header.ordinal,
2057 protocol_name: <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2058 }),
2059 }
2060 }
2061}
2062
2063pub struct CentralRequestStream {
2065 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2066 is_terminated: bool,
2067}
2068
2069impl std::marker::Unpin for CentralRequestStream {}
2070
2071impl futures::stream::FusedStream for CentralRequestStream {
2072 fn is_terminated(&self) -> bool {
2073 self.is_terminated
2074 }
2075}
2076
2077impl fidl::endpoints::RequestStream for CentralRequestStream {
2078 type Protocol = CentralMarker;
2079 type ControlHandle = CentralControlHandle;
2080
2081 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2082 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2083 }
2084
2085 fn control_handle(&self) -> Self::ControlHandle {
2086 CentralControlHandle { inner: self.inner.clone() }
2087 }
2088
2089 fn into_inner(
2090 self,
2091 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2092 {
2093 (self.inner, self.is_terminated)
2094 }
2095
2096 fn from_inner(
2097 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2098 is_terminated: bool,
2099 ) -> Self {
2100 Self { inner, is_terminated }
2101 }
2102}
2103
2104impl futures::Stream for CentralRequestStream {
2105 type Item = Result<CentralRequest, fidl::Error>;
2106
2107 fn poll_next(
2108 mut self: std::pin::Pin<&mut Self>,
2109 cx: &mut std::task::Context<'_>,
2110 ) -> std::task::Poll<Option<Self::Item>> {
2111 let this = &mut *self;
2112 if this.inner.check_shutdown(cx) {
2113 this.is_terminated = true;
2114 return std::task::Poll::Ready(None);
2115 }
2116 if this.is_terminated {
2117 panic!("polled CentralRequestStream after completion");
2118 }
2119 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2120 |bytes, handles| {
2121 match this.inner.channel().read_etc(cx, bytes, handles) {
2122 std::task::Poll::Ready(Ok(())) => {}
2123 std::task::Poll::Pending => return std::task::Poll::Pending,
2124 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2125 this.is_terminated = true;
2126 return std::task::Poll::Ready(None);
2127 }
2128 std::task::Poll::Ready(Err(e)) => {
2129 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2130 e.into(),
2131 ))));
2132 }
2133 }
2134
2135 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2137
2138 std::task::Poll::Ready(Some(match header.ordinal {
2139 0x39c6e9001d102338 => {
2140 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2141 let mut req = fidl::new_empty!(
2142 ChannelListenerRegistryListenL2capRequest,
2143 fidl::encoding::DefaultFuchsiaResourceDialect
2144 );
2145 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
2146 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2147 Ok(CentralRequest::ListenL2cap {
2148 payload: req,
2149 responder: CentralListenL2capResponder {
2150 control_handle: std::mem::ManuallyDrop::new(control_handle),
2151 tx_id: header.tx_id,
2152 },
2153 })
2154 }
2155 0x41f7121798dfe15f => {
2156 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2157 let mut req = fidl::new_empty!(
2158 CentralScanRequest,
2159 fidl::encoding::DefaultFuchsiaResourceDialect
2160 );
2161 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
2162 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2163 Ok(CentralRequest::Scan {
2164 options: req.options,
2165 result_watcher: req.result_watcher,
2166
2167 responder: CentralScanResponder {
2168 control_handle: std::mem::ManuallyDrop::new(control_handle),
2169 tx_id: header.tx_id,
2170 },
2171 })
2172 }
2173 0x31a3065f2a6913c4 => {
2174 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2175 let mut req = fidl::new_empty!(
2176 CentralConnectRequest,
2177 fidl::encoding::DefaultFuchsiaResourceDialect
2178 );
2179 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2180 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2181 Ok(CentralRequest::Connect {
2182 id: req.id,
2183 options: req.options,
2184 handle: req.handle,
2185
2186 control_handle,
2187 })
2188 }
2189 0x1db6df126a00c5b9 => {
2190 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2191 let mut req = fidl::new_empty!(
2192 CentralSyncToPeriodicAdvertisingRequest,
2193 fidl::encoding::DefaultFuchsiaResourceDialect
2194 );
2195 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralSyncToPeriodicAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
2196 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2197 Ok(CentralRequest::SyncToPeriodicAdvertising {
2198 payload: req,
2199 control_handle,
2200 })
2201 }
2202 0x60323e70ae22e13 => {
2203 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2204 let mut req = fidl::new_empty!(
2205 CentralCreateConnectedIsochronousGroupRequest,
2206 fidl::encoding::DefaultFuchsiaResourceDialect
2207 );
2208 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
2209 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2210 Ok(CentralRequest::CreateConnectedIsochronousGroup {
2211 payload: req,
2212 responder: CentralCreateConnectedIsochronousGroupResponder {
2213 control_handle: std::mem::ManuallyDrop::new(control_handle),
2214 tx_id: header.tx_id,
2215 },
2216 })
2217 }
2218 0x37ba777499c683a8 => {
2219 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2220 let mut req = fidl::new_empty!(
2221 CentralGetPeripheralsRequest,
2222 fidl::encoding::DefaultFuchsiaResourceDialect
2223 );
2224 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
2225 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2226 Ok(CentralRequest::GetPeripherals {
2227 service_uuids: req.service_uuids,
2228
2229 responder: CentralGetPeripheralsResponder {
2230 control_handle: std::mem::ManuallyDrop::new(control_handle),
2231 tx_id: header.tx_id,
2232 },
2233 })
2234 }
2235 0x97f5a2f2d9c13da => {
2236 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2237 let mut req = fidl::new_empty!(
2238 CentralGetPeripheralRequest,
2239 fidl::encoding::DefaultFuchsiaResourceDialect
2240 );
2241 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2242 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2243 Ok(CentralRequest::GetPeripheral {
2244 identifier: req.identifier,
2245
2246 responder: CentralGetPeripheralResponder {
2247 control_handle: std::mem::ManuallyDrop::new(control_handle),
2248 tx_id: header.tx_id,
2249 },
2250 })
2251 }
2252 0xeb4cf0cd0e1132b => {
2253 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2254 let mut req = fidl::new_empty!(
2255 CentralStartScanRequest,
2256 fidl::encoding::DefaultFuchsiaResourceDialect
2257 );
2258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
2259 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2260 Ok(CentralRequest::StartScan {
2261 filter: req.filter,
2262
2263 responder: CentralStartScanResponder {
2264 control_handle: std::mem::ManuallyDrop::new(control_handle),
2265 tx_id: header.tx_id,
2266 },
2267 })
2268 }
2269 0x5f79ee6a0bb037a0 => {
2270 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2271 let mut req = fidl::new_empty!(
2272 fidl::encoding::EmptyPayload,
2273 fidl::encoding::DefaultFuchsiaResourceDialect
2274 );
2275 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2276 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2277 Ok(CentralRequest::StopScan { control_handle })
2278 }
2279 0x714d6c32d066d75a => {
2280 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2281 let mut req = fidl::new_empty!(
2282 CentralConnectPeripheralRequest,
2283 fidl::encoding::DefaultFuchsiaResourceDialect
2284 );
2285 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2286 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2287 Ok(CentralRequest::ConnectPeripheral {
2288 identifier: req.identifier,
2289 options: req.options,
2290 gatt_client: req.gatt_client,
2291
2292 responder: CentralConnectPeripheralResponder {
2293 control_handle: std::mem::ManuallyDrop::new(control_handle),
2294 tx_id: header.tx_id,
2295 },
2296 })
2297 }
2298 0xa9430da197362fd => {
2299 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2300 let mut req = fidl::new_empty!(
2301 CentralDisconnectPeripheralRequest,
2302 fidl::encoding::DefaultFuchsiaResourceDialect
2303 );
2304 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2305 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2306 Ok(CentralRequest::DisconnectPeripheral {
2307 identifier: req.identifier,
2308
2309 responder: CentralDisconnectPeripheralResponder {
2310 control_handle: std::mem::ManuallyDrop::new(control_handle),
2311 tx_id: header.tx_id,
2312 },
2313 })
2314 }
2315 _ => Err(fidl::Error::UnknownOrdinal {
2316 ordinal: header.ordinal,
2317 protocol_name:
2318 <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2319 }),
2320 }))
2321 },
2322 )
2323 }
2324}
2325
2326#[derive(Debug)]
2327pub enum CentralRequest {
2328 ListenL2cap {
2338 payload: ChannelListenerRegistryListenL2capRequest,
2339 responder: CentralListenL2capResponder,
2340 },
2341 Scan {
2368 options: ScanOptions,
2369 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2370 responder: CentralScanResponder,
2371 },
2372 Connect {
2394 id: fidl_fuchsia_bluetooth::PeerId,
2395 options: ConnectionOptions,
2396 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
2397 control_handle: CentralControlHandle,
2398 },
2399 SyncToPeriodicAdvertising {
2402 payload: CentralSyncToPeriodicAdvertisingRequest,
2403 control_handle: CentralControlHandle,
2404 },
2405 CreateConnectedIsochronousGroup {
2414 payload: CentralCreateConnectedIsochronousGroupRequest,
2415 responder: CentralCreateConnectedIsochronousGroupResponder,
2416 },
2417 GetPeripherals { service_uuids: Option<Vec<String>>, responder: CentralGetPeripheralsResponder },
2423 GetPeripheral { identifier: String, responder: CentralGetPeripheralResponder },
2429 StartScan { filter: Option<Box<ScanFilter>>, responder: CentralStartScanResponder },
2438 StopScan { control_handle: CentralControlHandle },
2440 ConnectPeripheral {
2447 identifier: String,
2448 options: ConnectionOptions,
2449 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2450 responder: CentralConnectPeripheralResponder,
2451 },
2452 DisconnectPeripheral { identifier: String, responder: CentralDisconnectPeripheralResponder },
2454}
2455
2456impl CentralRequest {
2457 #[allow(irrefutable_let_patterns)]
2458 pub fn into_listen_l2cap(
2459 self,
2460 ) -> Option<(ChannelListenerRegistryListenL2capRequest, CentralListenL2capResponder)> {
2461 if let CentralRequest::ListenL2cap { payload, responder } = self {
2462 Some((payload, responder))
2463 } else {
2464 None
2465 }
2466 }
2467
2468 #[allow(irrefutable_let_patterns)]
2469 pub fn into_scan(
2470 self,
2471 ) -> Option<(
2472 ScanOptions,
2473 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2474 CentralScanResponder,
2475 )> {
2476 if let CentralRequest::Scan { options, result_watcher, responder } = self {
2477 Some((options, result_watcher, responder))
2478 } else {
2479 None
2480 }
2481 }
2482
2483 #[allow(irrefutable_let_patterns)]
2484 pub fn into_connect(
2485 self,
2486 ) -> Option<(
2487 fidl_fuchsia_bluetooth::PeerId,
2488 ConnectionOptions,
2489 fidl::endpoints::ServerEnd<ConnectionMarker>,
2490 CentralControlHandle,
2491 )> {
2492 if let CentralRequest::Connect { id, options, handle, control_handle } = self {
2493 Some((id, options, handle, control_handle))
2494 } else {
2495 None
2496 }
2497 }
2498
2499 #[allow(irrefutable_let_patterns)]
2500 pub fn into_sync_to_periodic_advertising(
2501 self,
2502 ) -> Option<(CentralSyncToPeriodicAdvertisingRequest, CentralControlHandle)> {
2503 if let CentralRequest::SyncToPeriodicAdvertising { payload, control_handle } = self {
2504 Some((payload, control_handle))
2505 } else {
2506 None
2507 }
2508 }
2509
2510 #[allow(irrefutable_let_patterns)]
2511 pub fn into_create_connected_isochronous_group(
2512 self,
2513 ) -> Option<(
2514 CentralCreateConnectedIsochronousGroupRequest,
2515 CentralCreateConnectedIsochronousGroupResponder,
2516 )> {
2517 if let CentralRequest::CreateConnectedIsochronousGroup { payload, responder } = self {
2518 Some((payload, responder))
2519 } else {
2520 None
2521 }
2522 }
2523
2524 #[allow(irrefutable_let_patterns)]
2525 pub fn into_get_peripherals(
2526 self,
2527 ) -> Option<(Option<Vec<String>>, CentralGetPeripheralsResponder)> {
2528 if let CentralRequest::GetPeripherals { service_uuids, responder } = self {
2529 Some((service_uuids, responder))
2530 } else {
2531 None
2532 }
2533 }
2534
2535 #[allow(irrefutable_let_patterns)]
2536 pub fn into_get_peripheral(self) -> Option<(String, CentralGetPeripheralResponder)> {
2537 if let CentralRequest::GetPeripheral { identifier, responder } = self {
2538 Some((identifier, responder))
2539 } else {
2540 None
2541 }
2542 }
2543
2544 #[allow(irrefutable_let_patterns)]
2545 pub fn into_start_scan(self) -> Option<(Option<Box<ScanFilter>>, CentralStartScanResponder)> {
2546 if let CentralRequest::StartScan { filter, responder } = self {
2547 Some((filter, responder))
2548 } else {
2549 None
2550 }
2551 }
2552
2553 #[allow(irrefutable_let_patterns)]
2554 pub fn into_stop_scan(self) -> Option<(CentralControlHandle)> {
2555 if let CentralRequest::StopScan { control_handle } = self {
2556 Some((control_handle))
2557 } else {
2558 None
2559 }
2560 }
2561
2562 #[allow(irrefutable_let_patterns)]
2563 pub fn into_connect_peripheral(
2564 self,
2565 ) -> Option<(
2566 String,
2567 ConnectionOptions,
2568 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2569 CentralConnectPeripheralResponder,
2570 )> {
2571 if let CentralRequest::ConnectPeripheral { identifier, options, gatt_client, responder } =
2572 self
2573 {
2574 Some((identifier, options, gatt_client, responder))
2575 } else {
2576 None
2577 }
2578 }
2579
2580 #[allow(irrefutable_let_patterns)]
2581 pub fn into_disconnect_peripheral(
2582 self,
2583 ) -> Option<(String, CentralDisconnectPeripheralResponder)> {
2584 if let CentralRequest::DisconnectPeripheral { identifier, responder } = self {
2585 Some((identifier, responder))
2586 } else {
2587 None
2588 }
2589 }
2590
2591 pub fn method_name(&self) -> &'static str {
2593 match *self {
2594 CentralRequest::ListenL2cap { .. } => "listen_l2cap",
2595 CentralRequest::Scan { .. } => "scan",
2596 CentralRequest::Connect { .. } => "connect",
2597 CentralRequest::SyncToPeriodicAdvertising { .. } => "sync_to_periodic_advertising",
2598 CentralRequest::CreateConnectedIsochronousGroup { .. } => {
2599 "create_connected_isochronous_group"
2600 }
2601 CentralRequest::GetPeripherals { .. } => "get_peripherals",
2602 CentralRequest::GetPeripheral { .. } => "get_peripheral",
2603 CentralRequest::StartScan { .. } => "start_scan",
2604 CentralRequest::StopScan { .. } => "stop_scan",
2605 CentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
2606 CentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
2607 }
2608 }
2609}
2610
2611#[derive(Debug, Clone)]
2612pub struct CentralControlHandle {
2613 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2614}
2615
2616impl fidl::endpoints::ControlHandle for CentralControlHandle {
2617 fn shutdown(&self) {
2618 self.inner.shutdown()
2619 }
2620
2621 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2622 self.inner.shutdown_with_epitaph(status)
2623 }
2624
2625 fn is_closed(&self) -> bool {
2626 self.inner.channel().is_closed()
2627 }
2628 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2629 self.inner.channel().on_closed()
2630 }
2631
2632 #[cfg(target_os = "fuchsia")]
2633 fn signal_peer(
2634 &self,
2635 clear_mask: zx::Signals,
2636 set_mask: zx::Signals,
2637 ) -> Result<(), zx_status::Status> {
2638 use fidl::Peered;
2639 self.inner.channel().signal_peer(clear_mask, set_mask)
2640 }
2641}
2642
2643impl CentralControlHandle {
2644 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
2645 self.inner.send::<CentralOnScanStateChangedRequest>(
2646 (scanning,),
2647 0,
2648 0x5f8edc23cad04d3f,
2649 fidl::encoding::DynamicFlags::empty(),
2650 )
2651 }
2652
2653 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
2654 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
2655 (device,),
2656 0,
2657 0x708dadf20d66db6,
2658 fidl::encoding::DynamicFlags::empty(),
2659 )
2660 }
2661
2662 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
2663 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
2664 (identifier,),
2665 0,
2666 0x4e4c6b979b2126df,
2667 fidl::encoding::DynamicFlags::empty(),
2668 )
2669 }
2670}
2671
2672#[must_use = "FIDL methods require a response to be sent"]
2673#[derive(Debug)]
2674pub struct CentralListenL2capResponder {
2675 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2676 tx_id: u32,
2677}
2678
2679impl std::ops::Drop for CentralListenL2capResponder {
2683 fn drop(&mut self) {
2684 self.control_handle.shutdown();
2685 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2687 }
2688}
2689
2690impl fidl::endpoints::Responder for CentralListenL2capResponder {
2691 type ControlHandle = CentralControlHandle;
2692
2693 fn control_handle(&self) -> &CentralControlHandle {
2694 &self.control_handle
2695 }
2696
2697 fn drop_without_shutdown(mut self) {
2698 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2700 std::mem::forget(self);
2702 }
2703}
2704
2705impl CentralListenL2capResponder {
2706 pub fn send(
2710 self,
2711 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2712 ) -> Result<(), fidl::Error> {
2713 let _result = self.send_raw(result);
2714 if _result.is_err() {
2715 self.control_handle.shutdown();
2716 }
2717 self.drop_without_shutdown();
2718 _result
2719 }
2720
2721 pub fn send_no_shutdown_on_err(
2723 self,
2724 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2725 ) -> Result<(), fidl::Error> {
2726 let _result = self.send_raw(result);
2727 self.drop_without_shutdown();
2728 _result
2729 }
2730
2731 fn send_raw(
2732 &self,
2733 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2734 ) -> Result<(), fidl::Error> {
2735 self.control_handle.inner.send::<fidl::encoding::ResultType<
2736 ChannelListenerRegistryListenL2capResponse,
2737 i32,
2738 >>(
2739 result,
2740 self.tx_id,
2741 0x39c6e9001d102338,
2742 fidl::encoding::DynamicFlags::empty(),
2743 )
2744 }
2745}
2746
2747#[must_use = "FIDL methods require a response to be sent"]
2748#[derive(Debug)]
2749pub struct CentralScanResponder {
2750 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2751 tx_id: u32,
2752}
2753
2754impl std::ops::Drop for CentralScanResponder {
2758 fn drop(&mut self) {
2759 self.control_handle.shutdown();
2760 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2762 }
2763}
2764
2765impl fidl::endpoints::Responder for CentralScanResponder {
2766 type ControlHandle = CentralControlHandle;
2767
2768 fn control_handle(&self) -> &CentralControlHandle {
2769 &self.control_handle
2770 }
2771
2772 fn drop_without_shutdown(mut self) {
2773 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2775 std::mem::forget(self);
2777 }
2778}
2779
2780impl CentralScanResponder {
2781 pub fn send(self) -> Result<(), fidl::Error> {
2785 let _result = self.send_raw();
2786 if _result.is_err() {
2787 self.control_handle.shutdown();
2788 }
2789 self.drop_without_shutdown();
2790 _result
2791 }
2792
2793 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2795 let _result = self.send_raw();
2796 self.drop_without_shutdown();
2797 _result
2798 }
2799
2800 fn send_raw(&self) -> Result<(), fidl::Error> {
2801 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2802 (),
2803 self.tx_id,
2804 0x41f7121798dfe15f,
2805 fidl::encoding::DynamicFlags::empty(),
2806 )
2807 }
2808}
2809
2810#[must_use = "FIDL methods require a response to be sent"]
2811#[derive(Debug)]
2812pub struct CentralCreateConnectedIsochronousGroupResponder {
2813 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2814 tx_id: u32,
2815}
2816
2817impl std::ops::Drop for CentralCreateConnectedIsochronousGroupResponder {
2821 fn drop(&mut self) {
2822 self.control_handle.shutdown();
2823 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2825 }
2826}
2827
2828impl fidl::endpoints::Responder for CentralCreateConnectedIsochronousGroupResponder {
2829 type ControlHandle = CentralControlHandle;
2830
2831 fn control_handle(&self) -> &CentralControlHandle {
2832 &self.control_handle
2833 }
2834
2835 fn drop_without_shutdown(mut self) {
2836 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2838 std::mem::forget(self);
2840 }
2841}
2842
2843impl CentralCreateConnectedIsochronousGroupResponder {
2844 pub fn send(
2848 self,
2849 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2850 ) -> Result<(), fidl::Error> {
2851 let _result = self.send_raw(result);
2852 if _result.is_err() {
2853 self.control_handle.shutdown();
2854 }
2855 self.drop_without_shutdown();
2856 _result
2857 }
2858
2859 pub fn send_no_shutdown_on_err(
2861 self,
2862 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2863 ) -> Result<(), fidl::Error> {
2864 let _result = self.send_raw(result);
2865 self.drop_without_shutdown();
2866 _result
2867 }
2868
2869 fn send_raw(
2870 &self,
2871 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2872 ) -> Result<(), fidl::Error> {
2873 self.control_handle.inner.send::<fidl::encoding::ResultType<
2874 CentralCreateConnectedIsochronousGroupResponse,
2875 CreateCigError,
2876 >>(
2877 result,
2878 self.tx_id,
2879 0x60323e70ae22e13,
2880 fidl::encoding::DynamicFlags::empty(),
2881 )
2882 }
2883}
2884
2885#[must_use = "FIDL methods require a response to be sent"]
2886#[derive(Debug)]
2887pub struct CentralGetPeripheralsResponder {
2888 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2889 tx_id: u32,
2890}
2891
2892impl std::ops::Drop for CentralGetPeripheralsResponder {
2896 fn drop(&mut self) {
2897 self.control_handle.shutdown();
2898 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2900 }
2901}
2902
2903impl fidl::endpoints::Responder for CentralGetPeripheralsResponder {
2904 type ControlHandle = CentralControlHandle;
2905
2906 fn control_handle(&self) -> &CentralControlHandle {
2907 &self.control_handle
2908 }
2909
2910 fn drop_without_shutdown(mut self) {
2911 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2913 std::mem::forget(self);
2915 }
2916}
2917
2918impl CentralGetPeripheralsResponder {
2919 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2923 let _result = self.send_raw(peripherals);
2924 if _result.is_err() {
2925 self.control_handle.shutdown();
2926 }
2927 self.drop_without_shutdown();
2928 _result
2929 }
2930
2931 pub fn send_no_shutdown_on_err(
2933 self,
2934 mut peripherals: &[RemoteDevice],
2935 ) -> Result<(), fidl::Error> {
2936 let _result = self.send_raw(peripherals);
2937 self.drop_without_shutdown();
2938 _result
2939 }
2940
2941 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2942 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
2943 (peripherals,),
2944 self.tx_id,
2945 0x37ba777499c683a8,
2946 fidl::encoding::DynamicFlags::empty(),
2947 )
2948 }
2949}
2950
2951#[must_use = "FIDL methods require a response to be sent"]
2952#[derive(Debug)]
2953pub struct CentralGetPeripheralResponder {
2954 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2955 tx_id: u32,
2956}
2957
2958impl std::ops::Drop for CentralGetPeripheralResponder {
2962 fn drop(&mut self) {
2963 self.control_handle.shutdown();
2964 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2966 }
2967}
2968
2969impl fidl::endpoints::Responder for CentralGetPeripheralResponder {
2970 type ControlHandle = CentralControlHandle;
2971
2972 fn control_handle(&self) -> &CentralControlHandle {
2973 &self.control_handle
2974 }
2975
2976 fn drop_without_shutdown(mut self) {
2977 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2979 std::mem::forget(self);
2981 }
2982}
2983
2984impl CentralGetPeripheralResponder {
2985 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2989 let _result = self.send_raw(peripheral);
2990 if _result.is_err() {
2991 self.control_handle.shutdown();
2992 }
2993 self.drop_without_shutdown();
2994 _result
2995 }
2996
2997 pub fn send_no_shutdown_on_err(
2999 self,
3000 mut peripheral: Option<&RemoteDevice>,
3001 ) -> Result<(), fidl::Error> {
3002 let _result = self.send_raw(peripheral);
3003 self.drop_without_shutdown();
3004 _result
3005 }
3006
3007 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
3008 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
3009 (peripheral,),
3010 self.tx_id,
3011 0x97f5a2f2d9c13da,
3012 fidl::encoding::DynamicFlags::empty(),
3013 )
3014 }
3015}
3016
3017#[must_use = "FIDL methods require a response to be sent"]
3018#[derive(Debug)]
3019pub struct CentralStartScanResponder {
3020 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3021 tx_id: u32,
3022}
3023
3024impl std::ops::Drop for CentralStartScanResponder {
3028 fn drop(&mut self) {
3029 self.control_handle.shutdown();
3030 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3032 }
3033}
3034
3035impl fidl::endpoints::Responder for CentralStartScanResponder {
3036 type ControlHandle = CentralControlHandle;
3037
3038 fn control_handle(&self) -> &CentralControlHandle {
3039 &self.control_handle
3040 }
3041
3042 fn drop_without_shutdown(mut self) {
3043 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3045 std::mem::forget(self);
3047 }
3048}
3049
3050impl CentralStartScanResponder {
3051 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3055 let _result = self.send_raw(status);
3056 if _result.is_err() {
3057 self.control_handle.shutdown();
3058 }
3059 self.drop_without_shutdown();
3060 _result
3061 }
3062
3063 pub fn send_no_shutdown_on_err(
3065 self,
3066 mut status: &fidl_fuchsia_bluetooth::Status,
3067 ) -> Result<(), fidl::Error> {
3068 let _result = self.send_raw(status);
3069 self.drop_without_shutdown();
3070 _result
3071 }
3072
3073 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3074 self.control_handle.inner.send::<CentralStartScanResponse>(
3075 (status,),
3076 self.tx_id,
3077 0xeb4cf0cd0e1132b,
3078 fidl::encoding::DynamicFlags::empty(),
3079 )
3080 }
3081}
3082
3083#[must_use = "FIDL methods require a response to be sent"]
3084#[derive(Debug)]
3085pub struct CentralConnectPeripheralResponder {
3086 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3087 tx_id: u32,
3088}
3089
3090impl std::ops::Drop for CentralConnectPeripheralResponder {
3094 fn drop(&mut self) {
3095 self.control_handle.shutdown();
3096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3098 }
3099}
3100
3101impl fidl::endpoints::Responder for CentralConnectPeripheralResponder {
3102 type ControlHandle = CentralControlHandle;
3103
3104 fn control_handle(&self) -> &CentralControlHandle {
3105 &self.control_handle
3106 }
3107
3108 fn drop_without_shutdown(mut self) {
3109 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3111 std::mem::forget(self);
3113 }
3114}
3115
3116impl CentralConnectPeripheralResponder {
3117 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3121 let _result = self.send_raw(status);
3122 if _result.is_err() {
3123 self.control_handle.shutdown();
3124 }
3125 self.drop_without_shutdown();
3126 _result
3127 }
3128
3129 pub fn send_no_shutdown_on_err(
3131 self,
3132 mut status: &fidl_fuchsia_bluetooth::Status,
3133 ) -> Result<(), fidl::Error> {
3134 let _result = self.send_raw(status);
3135 self.drop_without_shutdown();
3136 _result
3137 }
3138
3139 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3140 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
3141 (status,),
3142 self.tx_id,
3143 0x714d6c32d066d75a,
3144 fidl::encoding::DynamicFlags::empty(),
3145 )
3146 }
3147}
3148
3149#[must_use = "FIDL methods require a response to be sent"]
3150#[derive(Debug)]
3151pub struct CentralDisconnectPeripheralResponder {
3152 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3153 tx_id: u32,
3154}
3155
3156impl std::ops::Drop for CentralDisconnectPeripheralResponder {
3160 fn drop(&mut self) {
3161 self.control_handle.shutdown();
3162 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3164 }
3165}
3166
3167impl fidl::endpoints::Responder for CentralDisconnectPeripheralResponder {
3168 type ControlHandle = CentralControlHandle;
3169
3170 fn control_handle(&self) -> &CentralControlHandle {
3171 &self.control_handle
3172 }
3173
3174 fn drop_without_shutdown(mut self) {
3175 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3177 std::mem::forget(self);
3179 }
3180}
3181
3182impl CentralDisconnectPeripheralResponder {
3183 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3187 let _result = self.send_raw(status);
3188 if _result.is_err() {
3189 self.control_handle.shutdown();
3190 }
3191 self.drop_without_shutdown();
3192 _result
3193 }
3194
3195 pub fn send_no_shutdown_on_err(
3197 self,
3198 mut status: &fidl_fuchsia_bluetooth::Status,
3199 ) -> Result<(), fidl::Error> {
3200 let _result = self.send_raw(status);
3201 self.drop_without_shutdown();
3202 _result
3203 }
3204
3205 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3206 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
3207 (status,),
3208 self.tx_id,
3209 0xa9430da197362fd,
3210 fidl::encoding::DynamicFlags::empty(),
3211 )
3212 }
3213}
3214
3215#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3216pub struct ChannelListenerMarker;
3217
3218impl fidl::endpoints::ProtocolMarker for ChannelListenerMarker {
3219 type Proxy = ChannelListenerProxy;
3220 type RequestStream = ChannelListenerRequestStream;
3221 #[cfg(target_os = "fuchsia")]
3222 type SynchronousProxy = ChannelListenerSynchronousProxy;
3223
3224 const DEBUG_NAME: &'static str = "(anonymous) ChannelListener";
3225}
3226
3227pub trait ChannelListenerProxyInterface: Send + Sync {
3228 type AcceptResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3229 fn r#accept(
3230 &self,
3231 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3232 ) -> Self::AcceptResponseFut;
3233 type ConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3234 fn r#connected(&self, payload: ChannelListenerConnectedRequest) -> Self::ConnectedResponseFut;
3235}
3236#[derive(Debug)]
3237#[cfg(target_os = "fuchsia")]
3238pub struct ChannelListenerSynchronousProxy {
3239 client: fidl::client::sync::Client,
3240}
3241
3242#[cfg(target_os = "fuchsia")]
3243impl fidl::endpoints::SynchronousProxy for ChannelListenerSynchronousProxy {
3244 type Proxy = ChannelListenerProxy;
3245 type Protocol = ChannelListenerMarker;
3246
3247 fn from_channel(inner: fidl::Channel) -> Self {
3248 Self::new(inner)
3249 }
3250
3251 fn into_channel(self) -> fidl::Channel {
3252 self.client.into_channel()
3253 }
3254
3255 fn as_channel(&self) -> &fidl::Channel {
3256 self.client.as_channel()
3257 }
3258}
3259
3260#[cfg(target_os = "fuchsia")]
3261impl ChannelListenerSynchronousProxy {
3262 pub fn new(channel: fidl::Channel) -> Self {
3263 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3264 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3265 }
3266
3267 pub fn into_channel(self) -> fidl::Channel {
3268 self.client.into_channel()
3269 }
3270
3271 pub fn wait_for_event(
3274 &self,
3275 deadline: zx::MonotonicInstant,
3276 ) -> Result<ChannelListenerEvent, fidl::Error> {
3277 ChannelListenerEvent::decode(self.client.wait_for_event(deadline)?)
3278 }
3279
3280 pub fn r#accept(
3281 &self,
3282 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3283 ___deadline: zx::MonotonicInstant,
3284 ) -> Result<(), fidl::Error> {
3285 let _response = self.client.send_query::<
3286 ChannelListenerAcceptRequest,
3287 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3288 >(
3289 (channel,),
3290 0x6f535bd36b20fc7b,
3291 fidl::encoding::DynamicFlags::FLEXIBLE,
3292 ___deadline,
3293 )?
3294 .into_result::<ChannelListenerMarker>("accept")?;
3295 Ok(_response)
3296 }
3297
3298 pub fn r#connected(
3300 &self,
3301 mut payload: ChannelListenerConnectedRequest,
3302 ___deadline: zx::MonotonicInstant,
3303 ) -> Result<(), fidl::Error> {
3304 let _response = self.client.send_query::<
3305 ChannelListenerConnectedRequest,
3306 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3307 >(
3308 &mut payload,
3309 0xf40756858f21866,
3310 fidl::encoding::DynamicFlags::FLEXIBLE,
3311 ___deadline,
3312 )?
3313 .into_result::<ChannelListenerMarker>("connected")?;
3314 Ok(_response)
3315 }
3316}
3317
3318#[cfg(target_os = "fuchsia")]
3319impl From<ChannelListenerSynchronousProxy> for zx::NullableHandle {
3320 fn from(value: ChannelListenerSynchronousProxy) -> Self {
3321 value.into_channel().into()
3322 }
3323}
3324
3325#[cfg(target_os = "fuchsia")]
3326impl From<fidl::Channel> for ChannelListenerSynchronousProxy {
3327 fn from(value: fidl::Channel) -> Self {
3328 Self::new(value)
3329 }
3330}
3331
3332#[cfg(target_os = "fuchsia")]
3333impl fidl::endpoints::FromClient for ChannelListenerSynchronousProxy {
3334 type Protocol = ChannelListenerMarker;
3335
3336 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerMarker>) -> Self {
3337 Self::new(value.into_channel())
3338 }
3339}
3340
3341#[derive(Debug, Clone)]
3342pub struct ChannelListenerProxy {
3343 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3344}
3345
3346impl fidl::endpoints::Proxy for ChannelListenerProxy {
3347 type Protocol = ChannelListenerMarker;
3348
3349 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3350 Self::new(inner)
3351 }
3352
3353 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3354 self.client.into_channel().map_err(|client| Self { client })
3355 }
3356
3357 fn as_channel(&self) -> &::fidl::AsyncChannel {
3358 self.client.as_channel()
3359 }
3360}
3361
3362impl ChannelListenerProxy {
3363 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3365 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3366 Self { client: fidl::client::Client::new(channel, protocol_name) }
3367 }
3368
3369 pub fn take_event_stream(&self) -> ChannelListenerEventStream {
3375 ChannelListenerEventStream { event_receiver: self.client.take_event_receiver() }
3376 }
3377
3378 pub fn r#accept(
3379 &self,
3380 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3381 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3382 ChannelListenerProxyInterface::r#accept(self, channel)
3383 }
3384
3385 pub fn r#connected(
3387 &self,
3388 mut payload: ChannelListenerConnectedRequest,
3389 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3390 ChannelListenerProxyInterface::r#connected(self, payload)
3391 }
3392}
3393
3394impl ChannelListenerProxyInterface for ChannelListenerProxy {
3395 type AcceptResponseFut =
3396 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3397 fn r#accept(
3398 &self,
3399 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3400 ) -> Self::AcceptResponseFut {
3401 fn _decode(
3402 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3403 ) -> Result<(), fidl::Error> {
3404 let _response = fidl::client::decode_transaction_body::<
3405 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3406 fidl::encoding::DefaultFuchsiaResourceDialect,
3407 0x6f535bd36b20fc7b,
3408 >(_buf?)?
3409 .into_result::<ChannelListenerMarker>("accept")?;
3410 Ok(_response)
3411 }
3412 self.client.send_query_and_decode::<ChannelListenerAcceptRequest, ()>(
3413 (channel,),
3414 0x6f535bd36b20fc7b,
3415 fidl::encoding::DynamicFlags::FLEXIBLE,
3416 _decode,
3417 )
3418 }
3419
3420 type ConnectedResponseFut =
3421 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3422 fn r#connected(
3423 &self,
3424 mut payload: ChannelListenerConnectedRequest,
3425 ) -> Self::ConnectedResponseFut {
3426 fn _decode(
3427 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3428 ) -> Result<(), fidl::Error> {
3429 let _response = fidl::client::decode_transaction_body::<
3430 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3431 fidl::encoding::DefaultFuchsiaResourceDialect,
3432 0xf40756858f21866,
3433 >(_buf?)?
3434 .into_result::<ChannelListenerMarker>("connected")?;
3435 Ok(_response)
3436 }
3437 self.client.send_query_and_decode::<ChannelListenerConnectedRequest, ()>(
3438 &mut payload,
3439 0xf40756858f21866,
3440 fidl::encoding::DynamicFlags::FLEXIBLE,
3441 _decode,
3442 )
3443 }
3444}
3445
3446pub struct ChannelListenerEventStream {
3447 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3448}
3449
3450impl std::marker::Unpin for ChannelListenerEventStream {}
3451
3452impl futures::stream::FusedStream for ChannelListenerEventStream {
3453 fn is_terminated(&self) -> bool {
3454 self.event_receiver.is_terminated()
3455 }
3456}
3457
3458impl futures::Stream for ChannelListenerEventStream {
3459 type Item = Result<ChannelListenerEvent, fidl::Error>;
3460
3461 fn poll_next(
3462 mut self: std::pin::Pin<&mut Self>,
3463 cx: &mut std::task::Context<'_>,
3464 ) -> std::task::Poll<Option<Self::Item>> {
3465 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3466 &mut self.event_receiver,
3467 cx
3468 )?) {
3469 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerEvent::decode(buf))),
3470 None => std::task::Poll::Ready(None),
3471 }
3472 }
3473}
3474
3475#[derive(Debug)]
3476pub enum ChannelListenerEvent {
3477 #[non_exhaustive]
3478 _UnknownEvent {
3479 ordinal: u64,
3481 },
3482}
3483
3484impl ChannelListenerEvent {
3485 fn decode(
3487 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3488 ) -> Result<ChannelListenerEvent, fidl::Error> {
3489 let (bytes, _handles) = buf.split_mut();
3490 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3491 debug_assert_eq!(tx_header.tx_id, 0);
3492 match tx_header.ordinal {
3493 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3494 Ok(ChannelListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3495 }
3496 _ => Err(fidl::Error::UnknownOrdinal {
3497 ordinal: tx_header.ordinal,
3498 protocol_name:
3499 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3500 }),
3501 }
3502 }
3503}
3504
3505pub struct ChannelListenerRequestStream {
3507 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3508 is_terminated: bool,
3509}
3510
3511impl std::marker::Unpin for ChannelListenerRequestStream {}
3512
3513impl futures::stream::FusedStream for ChannelListenerRequestStream {
3514 fn is_terminated(&self) -> bool {
3515 self.is_terminated
3516 }
3517}
3518
3519impl fidl::endpoints::RequestStream for ChannelListenerRequestStream {
3520 type Protocol = ChannelListenerMarker;
3521 type ControlHandle = ChannelListenerControlHandle;
3522
3523 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3524 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3525 }
3526
3527 fn control_handle(&self) -> Self::ControlHandle {
3528 ChannelListenerControlHandle { inner: self.inner.clone() }
3529 }
3530
3531 fn into_inner(
3532 self,
3533 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3534 {
3535 (self.inner, self.is_terminated)
3536 }
3537
3538 fn from_inner(
3539 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3540 is_terminated: bool,
3541 ) -> Self {
3542 Self { inner, is_terminated }
3543 }
3544}
3545
3546impl futures::Stream for ChannelListenerRequestStream {
3547 type Item = Result<ChannelListenerRequest, fidl::Error>;
3548
3549 fn poll_next(
3550 mut self: std::pin::Pin<&mut Self>,
3551 cx: &mut std::task::Context<'_>,
3552 ) -> std::task::Poll<Option<Self::Item>> {
3553 let this = &mut *self;
3554 if this.inner.check_shutdown(cx) {
3555 this.is_terminated = true;
3556 return std::task::Poll::Ready(None);
3557 }
3558 if this.is_terminated {
3559 panic!("polled ChannelListenerRequestStream after completion");
3560 }
3561 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3562 |bytes, handles| {
3563 match this.inner.channel().read_etc(cx, bytes, handles) {
3564 std::task::Poll::Ready(Ok(())) => {}
3565 std::task::Poll::Pending => return std::task::Poll::Pending,
3566 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3567 this.is_terminated = true;
3568 return std::task::Poll::Ready(None);
3569 }
3570 std::task::Poll::Ready(Err(e)) => {
3571 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3572 e.into(),
3573 ))));
3574 }
3575 }
3576
3577 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3579
3580 std::task::Poll::Ready(Some(match header.ordinal {
3581 0x6f535bd36b20fc7b => {
3582 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3583 let mut req = fidl::new_empty!(
3584 ChannelListenerAcceptRequest,
3585 fidl::encoding::DefaultFuchsiaResourceDialect
3586 );
3587 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
3588 let control_handle =
3589 ChannelListenerControlHandle { inner: this.inner.clone() };
3590 Ok(ChannelListenerRequest::Accept {
3591 channel: req.channel,
3592
3593 responder: ChannelListenerAcceptResponder {
3594 control_handle: std::mem::ManuallyDrop::new(control_handle),
3595 tx_id: header.tx_id,
3596 },
3597 })
3598 }
3599 0xf40756858f21866 => {
3600 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3601 let mut req = fidl::new_empty!(
3602 ChannelListenerConnectedRequest,
3603 fidl::encoding::DefaultFuchsiaResourceDialect
3604 );
3605 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
3606 let control_handle =
3607 ChannelListenerControlHandle { inner: this.inner.clone() };
3608 Ok(ChannelListenerRequest::Connected {
3609 payload: req,
3610 responder: ChannelListenerConnectedResponder {
3611 control_handle: std::mem::ManuallyDrop::new(control_handle),
3612 tx_id: header.tx_id,
3613 },
3614 })
3615 }
3616 _ if header.tx_id == 0
3617 && header
3618 .dynamic_flags()
3619 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3620 {
3621 Ok(ChannelListenerRequest::_UnknownMethod {
3622 ordinal: header.ordinal,
3623 control_handle: ChannelListenerControlHandle {
3624 inner: this.inner.clone(),
3625 },
3626 method_type: fidl::MethodType::OneWay,
3627 })
3628 }
3629 _ if header
3630 .dynamic_flags()
3631 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3632 {
3633 this.inner.send_framework_err(
3634 fidl::encoding::FrameworkErr::UnknownMethod,
3635 header.tx_id,
3636 header.ordinal,
3637 header.dynamic_flags(),
3638 (bytes, handles),
3639 )?;
3640 Ok(ChannelListenerRequest::_UnknownMethod {
3641 ordinal: header.ordinal,
3642 control_handle: ChannelListenerControlHandle {
3643 inner: this.inner.clone(),
3644 },
3645 method_type: fidl::MethodType::TwoWay,
3646 })
3647 }
3648 _ => Err(fidl::Error::UnknownOrdinal {
3649 ordinal: header.ordinal,
3650 protocol_name:
3651 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3652 }),
3653 }))
3654 },
3655 )
3656 }
3657}
3658
3659#[derive(Debug)]
3666pub enum ChannelListenerRequest {
3667 Accept {
3668 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3669 responder: ChannelListenerAcceptResponder,
3670 },
3671 Connected {
3673 payload: ChannelListenerConnectedRequest,
3674 responder: ChannelListenerConnectedResponder,
3675 },
3676 #[non_exhaustive]
3678 _UnknownMethod {
3679 ordinal: u64,
3681 control_handle: ChannelListenerControlHandle,
3682 method_type: fidl::MethodType,
3683 },
3684}
3685
3686impl ChannelListenerRequest {
3687 #[allow(irrefutable_let_patterns)]
3688 pub fn into_accept(
3689 self,
3690 ) -> Option<(
3691 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3692 ChannelListenerAcceptResponder,
3693 )> {
3694 if let ChannelListenerRequest::Accept { channel, responder } = self {
3695 Some((channel, responder))
3696 } else {
3697 None
3698 }
3699 }
3700
3701 #[allow(irrefutable_let_patterns)]
3702 pub fn into_connected(
3703 self,
3704 ) -> Option<(ChannelListenerConnectedRequest, ChannelListenerConnectedResponder)> {
3705 if let ChannelListenerRequest::Connected { payload, responder } = self {
3706 Some((payload, responder))
3707 } else {
3708 None
3709 }
3710 }
3711
3712 pub fn method_name(&self) -> &'static str {
3714 match *self {
3715 ChannelListenerRequest::Accept { .. } => "accept",
3716 ChannelListenerRequest::Connected { .. } => "connected",
3717 ChannelListenerRequest::_UnknownMethod {
3718 method_type: fidl::MethodType::OneWay,
3719 ..
3720 } => "unknown one-way method",
3721 ChannelListenerRequest::_UnknownMethod {
3722 method_type: fidl::MethodType::TwoWay,
3723 ..
3724 } => "unknown two-way method",
3725 }
3726 }
3727}
3728
3729#[derive(Debug, Clone)]
3730pub struct ChannelListenerControlHandle {
3731 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3732}
3733
3734impl fidl::endpoints::ControlHandle for ChannelListenerControlHandle {
3735 fn shutdown(&self) {
3736 self.inner.shutdown()
3737 }
3738
3739 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3740 self.inner.shutdown_with_epitaph(status)
3741 }
3742
3743 fn is_closed(&self) -> bool {
3744 self.inner.channel().is_closed()
3745 }
3746 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3747 self.inner.channel().on_closed()
3748 }
3749
3750 #[cfg(target_os = "fuchsia")]
3751 fn signal_peer(
3752 &self,
3753 clear_mask: zx::Signals,
3754 set_mask: zx::Signals,
3755 ) -> Result<(), zx_status::Status> {
3756 use fidl::Peered;
3757 self.inner.channel().signal_peer(clear_mask, set_mask)
3758 }
3759}
3760
3761impl ChannelListenerControlHandle {}
3762
3763#[must_use = "FIDL methods require a response to be sent"]
3764#[derive(Debug)]
3765pub struct ChannelListenerAcceptResponder {
3766 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3767 tx_id: u32,
3768}
3769
3770impl std::ops::Drop for ChannelListenerAcceptResponder {
3774 fn drop(&mut self) {
3775 self.control_handle.shutdown();
3776 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3778 }
3779}
3780
3781impl fidl::endpoints::Responder for ChannelListenerAcceptResponder {
3782 type ControlHandle = ChannelListenerControlHandle;
3783
3784 fn control_handle(&self) -> &ChannelListenerControlHandle {
3785 &self.control_handle
3786 }
3787
3788 fn drop_without_shutdown(mut self) {
3789 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3791 std::mem::forget(self);
3793 }
3794}
3795
3796impl ChannelListenerAcceptResponder {
3797 pub fn send(self) -> Result<(), fidl::Error> {
3801 let _result = self.send_raw();
3802 if _result.is_err() {
3803 self.control_handle.shutdown();
3804 }
3805 self.drop_without_shutdown();
3806 _result
3807 }
3808
3809 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3811 let _result = self.send_raw();
3812 self.drop_without_shutdown();
3813 _result
3814 }
3815
3816 fn send_raw(&self) -> Result<(), fidl::Error> {
3817 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3818 fidl::encoding::Flexible::new(()),
3819 self.tx_id,
3820 0x6f535bd36b20fc7b,
3821 fidl::encoding::DynamicFlags::FLEXIBLE,
3822 )
3823 }
3824}
3825
3826#[must_use = "FIDL methods require a response to be sent"]
3827#[derive(Debug)]
3828pub struct ChannelListenerConnectedResponder {
3829 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3830 tx_id: u32,
3831}
3832
3833impl std::ops::Drop for ChannelListenerConnectedResponder {
3837 fn drop(&mut self) {
3838 self.control_handle.shutdown();
3839 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3841 }
3842}
3843
3844impl fidl::endpoints::Responder for ChannelListenerConnectedResponder {
3845 type ControlHandle = ChannelListenerControlHandle;
3846
3847 fn control_handle(&self) -> &ChannelListenerControlHandle {
3848 &self.control_handle
3849 }
3850
3851 fn drop_without_shutdown(mut self) {
3852 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3854 std::mem::forget(self);
3856 }
3857}
3858
3859impl ChannelListenerConnectedResponder {
3860 pub fn send(self) -> Result<(), fidl::Error> {
3864 let _result = self.send_raw();
3865 if _result.is_err() {
3866 self.control_handle.shutdown();
3867 }
3868 self.drop_without_shutdown();
3869 _result
3870 }
3871
3872 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3874 let _result = self.send_raw();
3875 self.drop_without_shutdown();
3876 _result
3877 }
3878
3879 fn send_raw(&self) -> Result<(), fidl::Error> {
3880 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3881 fidl::encoding::Flexible::new(()),
3882 self.tx_id,
3883 0xf40756858f21866,
3884 fidl::encoding::DynamicFlags::FLEXIBLE,
3885 )
3886 }
3887}
3888
3889#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3890pub struct ChannelListenerRegistryMarker;
3891
3892impl fidl::endpoints::ProtocolMarker for ChannelListenerRegistryMarker {
3893 type Proxy = ChannelListenerRegistryProxy;
3894 type RequestStream = ChannelListenerRegistryRequestStream;
3895 #[cfg(target_os = "fuchsia")]
3896 type SynchronousProxy = ChannelListenerRegistrySynchronousProxy;
3897
3898 const DEBUG_NAME: &'static str = "(anonymous) ChannelListenerRegistry";
3899}
3900pub type ChannelListenerRegistryListenL2capResult =
3901 Result<ChannelListenerRegistryListenL2capResponse, i32>;
3902
3903pub trait ChannelListenerRegistryProxyInterface: Send + Sync {
3904 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
3905 + Send;
3906 fn r#listen_l2cap(
3907 &self,
3908 payload: ChannelListenerRegistryListenL2capRequest,
3909 ) -> Self::ListenL2capResponseFut;
3910}
3911#[derive(Debug)]
3912#[cfg(target_os = "fuchsia")]
3913pub struct ChannelListenerRegistrySynchronousProxy {
3914 client: fidl::client::sync::Client,
3915}
3916
3917#[cfg(target_os = "fuchsia")]
3918impl fidl::endpoints::SynchronousProxy for ChannelListenerRegistrySynchronousProxy {
3919 type Proxy = ChannelListenerRegistryProxy;
3920 type Protocol = ChannelListenerRegistryMarker;
3921
3922 fn from_channel(inner: fidl::Channel) -> Self {
3923 Self::new(inner)
3924 }
3925
3926 fn into_channel(self) -> fidl::Channel {
3927 self.client.into_channel()
3928 }
3929
3930 fn as_channel(&self) -> &fidl::Channel {
3931 self.client.as_channel()
3932 }
3933}
3934
3935#[cfg(target_os = "fuchsia")]
3936impl ChannelListenerRegistrySynchronousProxy {
3937 pub fn new(channel: fidl::Channel) -> Self {
3938 let protocol_name =
3939 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3940 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3941 }
3942
3943 pub fn into_channel(self) -> fidl::Channel {
3944 self.client.into_channel()
3945 }
3946
3947 pub fn wait_for_event(
3950 &self,
3951 deadline: zx::MonotonicInstant,
3952 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3953 ChannelListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
3954 }
3955
3956 pub fn r#listen_l2cap(
3966 &self,
3967 mut payload: ChannelListenerRegistryListenL2capRequest,
3968 ___deadline: zx::MonotonicInstant,
3969 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3970 let _response = self.client.send_query::<
3971 ChannelListenerRegistryListenL2capRequest,
3972 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3973 >(
3974 &mut payload,
3975 0x39c6e9001d102338,
3976 fidl::encoding::DynamicFlags::empty(),
3977 ___deadline,
3978 )?;
3979 Ok(_response.map(|x| x))
3980 }
3981}
3982
3983#[cfg(target_os = "fuchsia")]
3984impl From<ChannelListenerRegistrySynchronousProxy> for zx::NullableHandle {
3985 fn from(value: ChannelListenerRegistrySynchronousProxy) -> Self {
3986 value.into_channel().into()
3987 }
3988}
3989
3990#[cfg(target_os = "fuchsia")]
3991impl From<fidl::Channel> for ChannelListenerRegistrySynchronousProxy {
3992 fn from(value: fidl::Channel) -> Self {
3993 Self::new(value)
3994 }
3995}
3996
3997#[cfg(target_os = "fuchsia")]
3998impl fidl::endpoints::FromClient for ChannelListenerRegistrySynchronousProxy {
3999 type Protocol = ChannelListenerRegistryMarker;
4000
4001 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerRegistryMarker>) -> Self {
4002 Self::new(value.into_channel())
4003 }
4004}
4005
4006#[derive(Debug, Clone)]
4007pub struct ChannelListenerRegistryProxy {
4008 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4009}
4010
4011impl fidl::endpoints::Proxy for ChannelListenerRegistryProxy {
4012 type Protocol = ChannelListenerRegistryMarker;
4013
4014 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4015 Self::new(inner)
4016 }
4017
4018 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4019 self.client.into_channel().map_err(|client| Self { client })
4020 }
4021
4022 fn as_channel(&self) -> &::fidl::AsyncChannel {
4023 self.client.as_channel()
4024 }
4025}
4026
4027impl ChannelListenerRegistryProxy {
4028 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4030 let protocol_name =
4031 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4032 Self { client: fidl::client::Client::new(channel, protocol_name) }
4033 }
4034
4035 pub fn take_event_stream(&self) -> ChannelListenerRegistryEventStream {
4041 ChannelListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
4042 }
4043
4044 pub fn r#listen_l2cap(
4054 &self,
4055 mut payload: ChannelListenerRegistryListenL2capRequest,
4056 ) -> fidl::client::QueryResponseFut<
4057 ChannelListenerRegistryListenL2capResult,
4058 fidl::encoding::DefaultFuchsiaResourceDialect,
4059 > {
4060 ChannelListenerRegistryProxyInterface::r#listen_l2cap(self, payload)
4061 }
4062}
4063
4064impl ChannelListenerRegistryProxyInterface for ChannelListenerRegistryProxy {
4065 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
4066 ChannelListenerRegistryListenL2capResult,
4067 fidl::encoding::DefaultFuchsiaResourceDialect,
4068 >;
4069 fn r#listen_l2cap(
4070 &self,
4071 mut payload: ChannelListenerRegistryListenL2capRequest,
4072 ) -> Self::ListenL2capResponseFut {
4073 fn _decode(
4074 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4075 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
4076 let _response = fidl::client::decode_transaction_body::<
4077 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
4078 fidl::encoding::DefaultFuchsiaResourceDialect,
4079 0x39c6e9001d102338,
4080 >(_buf?)?;
4081 Ok(_response.map(|x| x))
4082 }
4083 self.client.send_query_and_decode::<
4084 ChannelListenerRegistryListenL2capRequest,
4085 ChannelListenerRegistryListenL2capResult,
4086 >(
4087 &mut payload,
4088 0x39c6e9001d102338,
4089 fidl::encoding::DynamicFlags::empty(),
4090 _decode,
4091 )
4092 }
4093}
4094
4095pub struct ChannelListenerRegistryEventStream {
4096 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4097}
4098
4099impl std::marker::Unpin for ChannelListenerRegistryEventStream {}
4100
4101impl futures::stream::FusedStream for ChannelListenerRegistryEventStream {
4102 fn is_terminated(&self) -> bool {
4103 self.event_receiver.is_terminated()
4104 }
4105}
4106
4107impl futures::Stream for ChannelListenerRegistryEventStream {
4108 type Item = Result<ChannelListenerRegistryEvent, fidl::Error>;
4109
4110 fn poll_next(
4111 mut self: std::pin::Pin<&mut Self>,
4112 cx: &mut std::task::Context<'_>,
4113 ) -> std::task::Poll<Option<Self::Item>> {
4114 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4115 &mut self.event_receiver,
4116 cx
4117 )?) {
4118 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerRegistryEvent::decode(buf))),
4119 None => std::task::Poll::Ready(None),
4120 }
4121 }
4122}
4123
4124#[derive(Debug)]
4125pub enum ChannelListenerRegistryEvent {}
4126
4127impl ChannelListenerRegistryEvent {
4128 fn decode(
4130 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4131 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
4132 let (bytes, _handles) = buf.split_mut();
4133 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4134 debug_assert_eq!(tx_header.tx_id, 0);
4135 match tx_header.ordinal {
4136 _ => Err(fidl::Error::UnknownOrdinal {
4137 ordinal: tx_header.ordinal,
4138 protocol_name:
4139 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4140 }),
4141 }
4142 }
4143}
4144
4145pub struct ChannelListenerRegistryRequestStream {
4147 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4148 is_terminated: bool,
4149}
4150
4151impl std::marker::Unpin for ChannelListenerRegistryRequestStream {}
4152
4153impl futures::stream::FusedStream for ChannelListenerRegistryRequestStream {
4154 fn is_terminated(&self) -> bool {
4155 self.is_terminated
4156 }
4157}
4158
4159impl fidl::endpoints::RequestStream for ChannelListenerRegistryRequestStream {
4160 type Protocol = ChannelListenerRegistryMarker;
4161 type ControlHandle = ChannelListenerRegistryControlHandle;
4162
4163 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4164 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4165 }
4166
4167 fn control_handle(&self) -> Self::ControlHandle {
4168 ChannelListenerRegistryControlHandle { inner: self.inner.clone() }
4169 }
4170
4171 fn into_inner(
4172 self,
4173 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4174 {
4175 (self.inner, self.is_terminated)
4176 }
4177
4178 fn from_inner(
4179 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4180 is_terminated: bool,
4181 ) -> Self {
4182 Self { inner, is_terminated }
4183 }
4184}
4185
4186impl futures::Stream for ChannelListenerRegistryRequestStream {
4187 type Item = Result<ChannelListenerRegistryRequest, fidl::Error>;
4188
4189 fn poll_next(
4190 mut self: std::pin::Pin<&mut Self>,
4191 cx: &mut std::task::Context<'_>,
4192 ) -> std::task::Poll<Option<Self::Item>> {
4193 let this = &mut *self;
4194 if this.inner.check_shutdown(cx) {
4195 this.is_terminated = true;
4196 return std::task::Poll::Ready(None);
4197 }
4198 if this.is_terminated {
4199 panic!("polled ChannelListenerRegistryRequestStream after completion");
4200 }
4201 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4202 |bytes, handles| {
4203 match this.inner.channel().read_etc(cx, bytes, handles) {
4204 std::task::Poll::Ready(Ok(())) => {}
4205 std::task::Poll::Pending => return std::task::Poll::Pending,
4206 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4207 this.is_terminated = true;
4208 return std::task::Poll::Ready(None);
4209 }
4210 std::task::Poll::Ready(Err(e)) => {
4211 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4212 e.into(),
4213 ))));
4214 }
4215 }
4216
4217 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4219
4220 std::task::Poll::Ready(Some(match header.ordinal {
4221 0x39c6e9001d102338 => {
4222 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4223 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4224 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
4225 let control_handle = ChannelListenerRegistryControlHandle {
4226 inner: this.inner.clone(),
4227 };
4228 Ok(ChannelListenerRegistryRequest::ListenL2cap {payload: req,
4229 responder: ChannelListenerRegistryListenL2capResponder {
4230 control_handle: std::mem::ManuallyDrop::new(control_handle),
4231 tx_id: header.tx_id,
4232 },
4233 })
4234 }
4235 _ => Err(fidl::Error::UnknownOrdinal {
4236 ordinal: header.ordinal,
4237 protocol_name: <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4238 }),
4239 }))
4240 },
4241 )
4242 }
4243}
4244
4245#[derive(Debug)]
4248pub enum ChannelListenerRegistryRequest {
4249 ListenL2cap {
4259 payload: ChannelListenerRegistryListenL2capRequest,
4260 responder: ChannelListenerRegistryListenL2capResponder,
4261 },
4262}
4263
4264impl ChannelListenerRegistryRequest {
4265 #[allow(irrefutable_let_patterns)]
4266 pub fn into_listen_l2cap(
4267 self,
4268 ) -> Option<(
4269 ChannelListenerRegistryListenL2capRequest,
4270 ChannelListenerRegistryListenL2capResponder,
4271 )> {
4272 if let ChannelListenerRegistryRequest::ListenL2cap { payload, responder } = self {
4273 Some((payload, responder))
4274 } else {
4275 None
4276 }
4277 }
4278
4279 pub fn method_name(&self) -> &'static str {
4281 match *self {
4282 ChannelListenerRegistryRequest::ListenL2cap { .. } => "listen_l2cap",
4283 }
4284 }
4285}
4286
4287#[derive(Debug, Clone)]
4288pub struct ChannelListenerRegistryControlHandle {
4289 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4290}
4291
4292impl fidl::endpoints::ControlHandle for ChannelListenerRegistryControlHandle {
4293 fn shutdown(&self) {
4294 self.inner.shutdown()
4295 }
4296
4297 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4298 self.inner.shutdown_with_epitaph(status)
4299 }
4300
4301 fn is_closed(&self) -> bool {
4302 self.inner.channel().is_closed()
4303 }
4304 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4305 self.inner.channel().on_closed()
4306 }
4307
4308 #[cfg(target_os = "fuchsia")]
4309 fn signal_peer(
4310 &self,
4311 clear_mask: zx::Signals,
4312 set_mask: zx::Signals,
4313 ) -> Result<(), zx_status::Status> {
4314 use fidl::Peered;
4315 self.inner.channel().signal_peer(clear_mask, set_mask)
4316 }
4317}
4318
4319impl ChannelListenerRegistryControlHandle {}
4320
4321#[must_use = "FIDL methods require a response to be sent"]
4322#[derive(Debug)]
4323pub struct ChannelListenerRegistryListenL2capResponder {
4324 control_handle: std::mem::ManuallyDrop<ChannelListenerRegistryControlHandle>,
4325 tx_id: u32,
4326}
4327
4328impl std::ops::Drop for ChannelListenerRegistryListenL2capResponder {
4332 fn drop(&mut self) {
4333 self.control_handle.shutdown();
4334 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4336 }
4337}
4338
4339impl fidl::endpoints::Responder for ChannelListenerRegistryListenL2capResponder {
4340 type ControlHandle = ChannelListenerRegistryControlHandle;
4341
4342 fn control_handle(&self) -> &ChannelListenerRegistryControlHandle {
4343 &self.control_handle
4344 }
4345
4346 fn drop_without_shutdown(mut self) {
4347 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4349 std::mem::forget(self);
4351 }
4352}
4353
4354impl ChannelListenerRegistryListenL2capResponder {
4355 pub fn send(
4359 self,
4360 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4361 ) -> Result<(), fidl::Error> {
4362 let _result = self.send_raw(result);
4363 if _result.is_err() {
4364 self.control_handle.shutdown();
4365 }
4366 self.drop_without_shutdown();
4367 _result
4368 }
4369
4370 pub fn send_no_shutdown_on_err(
4372 self,
4373 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4374 ) -> Result<(), fidl::Error> {
4375 let _result = self.send_raw(result);
4376 self.drop_without_shutdown();
4377 _result
4378 }
4379
4380 fn send_raw(
4381 &self,
4382 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4383 ) -> Result<(), fidl::Error> {
4384 self.control_handle.inner.send::<fidl::encoding::ResultType<
4385 ChannelListenerRegistryListenL2capResponse,
4386 i32,
4387 >>(
4388 result,
4389 self.tx_id,
4390 0x39c6e9001d102338,
4391 fidl::encoding::DynamicFlags::empty(),
4392 )
4393 }
4394}
4395
4396#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4397pub struct ChannelOffloadExtMarker;
4398
4399impl fidl::endpoints::ProtocolMarker for ChannelOffloadExtMarker {
4400 type Proxy = ChannelOffloadExtProxy;
4401 type RequestStream = ChannelOffloadExtRequestStream;
4402 #[cfg(target_os = "fuchsia")]
4403 type SynchronousProxy = ChannelOffloadExtSynchronousProxy;
4404
4405 const DEBUG_NAME: &'static str = "(anonymous) ChannelOffloadExt";
4406}
4407pub type ChannelOffloadExtStartOffloadResult = Result<ChannelOffloadExtStartOffloadResponse, i32>;
4408
4409pub trait ChannelOffloadExtProxyInterface: Send + Sync {
4410 type StartOffloadResponseFut: std::future::Future<Output = Result<ChannelOffloadExtStartOffloadResult, fidl::Error>>
4411 + Send;
4412 fn r#start_offload(
4413 &self,
4414 payload: &ChannelOffloadExtStartOffloadRequest,
4415 ) -> Self::StartOffloadResponseFut;
4416}
4417#[derive(Debug)]
4418#[cfg(target_os = "fuchsia")]
4419pub struct ChannelOffloadExtSynchronousProxy {
4420 client: fidl::client::sync::Client,
4421}
4422
4423#[cfg(target_os = "fuchsia")]
4424impl fidl::endpoints::SynchronousProxy for ChannelOffloadExtSynchronousProxy {
4425 type Proxy = ChannelOffloadExtProxy;
4426 type Protocol = ChannelOffloadExtMarker;
4427
4428 fn from_channel(inner: fidl::Channel) -> Self {
4429 Self::new(inner)
4430 }
4431
4432 fn into_channel(self) -> fidl::Channel {
4433 self.client.into_channel()
4434 }
4435
4436 fn as_channel(&self) -> &fidl::Channel {
4437 self.client.as_channel()
4438 }
4439}
4440
4441#[cfg(target_os = "fuchsia")]
4442impl ChannelOffloadExtSynchronousProxy {
4443 pub fn new(channel: fidl::Channel) -> Self {
4444 let protocol_name =
4445 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4446 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4447 }
4448
4449 pub fn into_channel(self) -> fidl::Channel {
4450 self.client.into_channel()
4451 }
4452
4453 pub fn wait_for_event(
4456 &self,
4457 deadline: zx::MonotonicInstant,
4458 ) -> Result<ChannelOffloadExtEvent, fidl::Error> {
4459 ChannelOffloadExtEvent::decode(self.client.wait_for_event(deadline)?)
4460 }
4461
4462 pub fn r#start_offload(
4472 &self,
4473 mut payload: &ChannelOffloadExtStartOffloadRequest,
4474 ___deadline: zx::MonotonicInstant,
4475 ) -> Result<ChannelOffloadExtStartOffloadResult, fidl::Error> {
4476 let _response = self.client.send_query::<
4477 ChannelOffloadExtStartOffloadRequest,
4478 fidl::encoding::FlexibleResultType<ChannelOffloadExtStartOffloadResponse, i32>,
4479 >(
4480 payload,
4481 0x2dd620feea793fe8,
4482 fidl::encoding::DynamicFlags::FLEXIBLE,
4483 ___deadline,
4484 )?
4485 .into_result::<ChannelOffloadExtMarker>("start_offload")?;
4486 Ok(_response.map(|x| x))
4487 }
4488}
4489
4490#[cfg(target_os = "fuchsia")]
4491impl From<ChannelOffloadExtSynchronousProxy> for zx::NullableHandle {
4492 fn from(value: ChannelOffloadExtSynchronousProxy) -> Self {
4493 value.into_channel().into()
4494 }
4495}
4496
4497#[cfg(target_os = "fuchsia")]
4498impl From<fidl::Channel> for ChannelOffloadExtSynchronousProxy {
4499 fn from(value: fidl::Channel) -> Self {
4500 Self::new(value)
4501 }
4502}
4503
4504#[cfg(target_os = "fuchsia")]
4505impl fidl::endpoints::FromClient for ChannelOffloadExtSynchronousProxy {
4506 type Protocol = ChannelOffloadExtMarker;
4507
4508 fn from_client(value: fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>) -> Self {
4509 Self::new(value.into_channel())
4510 }
4511}
4512
4513#[derive(Debug, Clone)]
4514pub struct ChannelOffloadExtProxy {
4515 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4516}
4517
4518impl fidl::endpoints::Proxy for ChannelOffloadExtProxy {
4519 type Protocol = ChannelOffloadExtMarker;
4520
4521 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4522 Self::new(inner)
4523 }
4524
4525 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4526 self.client.into_channel().map_err(|client| Self { client })
4527 }
4528
4529 fn as_channel(&self) -> &::fidl::AsyncChannel {
4530 self.client.as_channel()
4531 }
4532}
4533
4534impl ChannelOffloadExtProxy {
4535 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4537 let protocol_name =
4538 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4539 Self { client: fidl::client::Client::new(channel, protocol_name) }
4540 }
4541
4542 pub fn take_event_stream(&self) -> ChannelOffloadExtEventStream {
4548 ChannelOffloadExtEventStream { event_receiver: self.client.take_event_receiver() }
4549 }
4550
4551 pub fn r#start_offload(
4561 &self,
4562 mut payload: &ChannelOffloadExtStartOffloadRequest,
4563 ) -> fidl::client::QueryResponseFut<
4564 ChannelOffloadExtStartOffloadResult,
4565 fidl::encoding::DefaultFuchsiaResourceDialect,
4566 > {
4567 ChannelOffloadExtProxyInterface::r#start_offload(self, payload)
4568 }
4569}
4570
4571impl ChannelOffloadExtProxyInterface for ChannelOffloadExtProxy {
4572 type StartOffloadResponseFut = fidl::client::QueryResponseFut<
4573 ChannelOffloadExtStartOffloadResult,
4574 fidl::encoding::DefaultFuchsiaResourceDialect,
4575 >;
4576 fn r#start_offload(
4577 &self,
4578 mut payload: &ChannelOffloadExtStartOffloadRequest,
4579 ) -> Self::StartOffloadResponseFut {
4580 fn _decode(
4581 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4582 ) -> Result<ChannelOffloadExtStartOffloadResult, fidl::Error> {
4583 let _response = fidl::client::decode_transaction_body::<
4584 fidl::encoding::FlexibleResultType<ChannelOffloadExtStartOffloadResponse, i32>,
4585 fidl::encoding::DefaultFuchsiaResourceDialect,
4586 0x2dd620feea793fe8,
4587 >(_buf?)?
4588 .into_result::<ChannelOffloadExtMarker>("start_offload")?;
4589 Ok(_response.map(|x| x))
4590 }
4591 self.client.send_query_and_decode::<
4592 ChannelOffloadExtStartOffloadRequest,
4593 ChannelOffloadExtStartOffloadResult,
4594 >(
4595 payload,
4596 0x2dd620feea793fe8,
4597 fidl::encoding::DynamicFlags::FLEXIBLE,
4598 _decode,
4599 )
4600 }
4601}
4602
4603pub struct ChannelOffloadExtEventStream {
4604 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4605}
4606
4607impl std::marker::Unpin for ChannelOffloadExtEventStream {}
4608
4609impl futures::stream::FusedStream for ChannelOffloadExtEventStream {
4610 fn is_terminated(&self) -> bool {
4611 self.event_receiver.is_terminated()
4612 }
4613}
4614
4615impl futures::Stream for ChannelOffloadExtEventStream {
4616 type Item = Result<ChannelOffloadExtEvent, fidl::Error>;
4617
4618 fn poll_next(
4619 mut self: std::pin::Pin<&mut Self>,
4620 cx: &mut std::task::Context<'_>,
4621 ) -> std::task::Poll<Option<Self::Item>> {
4622 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4623 &mut self.event_receiver,
4624 cx
4625 )?) {
4626 Some(buf) => std::task::Poll::Ready(Some(ChannelOffloadExtEvent::decode(buf))),
4627 None => std::task::Poll::Ready(None),
4628 }
4629 }
4630}
4631
4632#[derive(Debug)]
4633pub enum ChannelOffloadExtEvent {
4634 #[non_exhaustive]
4635 _UnknownEvent {
4636 ordinal: u64,
4638 },
4639}
4640
4641impl ChannelOffloadExtEvent {
4642 fn decode(
4644 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4645 ) -> Result<ChannelOffloadExtEvent, fidl::Error> {
4646 let (bytes, _handles) = buf.split_mut();
4647 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4648 debug_assert_eq!(tx_header.tx_id, 0);
4649 match tx_header.ordinal {
4650 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4651 Ok(ChannelOffloadExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4652 }
4653 _ => Err(fidl::Error::UnknownOrdinal {
4654 ordinal: tx_header.ordinal,
4655 protocol_name:
4656 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4657 }),
4658 }
4659 }
4660}
4661
4662pub struct ChannelOffloadExtRequestStream {
4664 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4665 is_terminated: bool,
4666}
4667
4668impl std::marker::Unpin for ChannelOffloadExtRequestStream {}
4669
4670impl futures::stream::FusedStream for ChannelOffloadExtRequestStream {
4671 fn is_terminated(&self) -> bool {
4672 self.is_terminated
4673 }
4674}
4675
4676impl fidl::endpoints::RequestStream for ChannelOffloadExtRequestStream {
4677 type Protocol = ChannelOffloadExtMarker;
4678 type ControlHandle = ChannelOffloadExtControlHandle;
4679
4680 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4681 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4682 }
4683
4684 fn control_handle(&self) -> Self::ControlHandle {
4685 ChannelOffloadExtControlHandle { inner: self.inner.clone() }
4686 }
4687
4688 fn into_inner(
4689 self,
4690 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4691 {
4692 (self.inner, self.is_terminated)
4693 }
4694
4695 fn from_inner(
4696 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4697 is_terminated: bool,
4698 ) -> Self {
4699 Self { inner, is_terminated }
4700 }
4701}
4702
4703impl futures::Stream for ChannelOffloadExtRequestStream {
4704 type Item = Result<ChannelOffloadExtRequest, fidl::Error>;
4705
4706 fn poll_next(
4707 mut self: std::pin::Pin<&mut Self>,
4708 cx: &mut std::task::Context<'_>,
4709 ) -> std::task::Poll<Option<Self::Item>> {
4710 let this = &mut *self;
4711 if this.inner.check_shutdown(cx) {
4712 this.is_terminated = true;
4713 return std::task::Poll::Ready(None);
4714 }
4715 if this.is_terminated {
4716 panic!("polled ChannelOffloadExtRequestStream after completion");
4717 }
4718 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4719 |bytes, handles| {
4720 match this.inner.channel().read_etc(cx, bytes, handles) {
4721 std::task::Poll::Ready(Ok(())) => {}
4722 std::task::Poll::Pending => return std::task::Poll::Pending,
4723 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4724 this.is_terminated = true;
4725 return std::task::Poll::Ready(None);
4726 }
4727 std::task::Poll::Ready(Err(e)) => {
4728 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4729 e.into(),
4730 ))));
4731 }
4732 }
4733
4734 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4736
4737 std::task::Poll::Ready(Some(match header.ordinal {
4738 0x2dd620feea793fe8 => {
4739 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4740 let mut req = fidl::new_empty!(
4741 ChannelOffloadExtStartOffloadRequest,
4742 fidl::encoding::DefaultFuchsiaResourceDialect
4743 );
4744 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelOffloadExtStartOffloadRequest>(&header, _body_bytes, handles, &mut req)?;
4745 let control_handle =
4746 ChannelOffloadExtControlHandle { inner: this.inner.clone() };
4747 Ok(ChannelOffloadExtRequest::StartOffload {
4748 payload: req,
4749 responder: ChannelOffloadExtStartOffloadResponder {
4750 control_handle: std::mem::ManuallyDrop::new(control_handle),
4751 tx_id: header.tx_id,
4752 },
4753 })
4754 }
4755 _ if header.tx_id == 0
4756 && header
4757 .dynamic_flags()
4758 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4759 {
4760 Ok(ChannelOffloadExtRequest::_UnknownMethod {
4761 ordinal: header.ordinal,
4762 control_handle: ChannelOffloadExtControlHandle {
4763 inner: this.inner.clone(),
4764 },
4765 method_type: fidl::MethodType::OneWay,
4766 })
4767 }
4768 _ if header
4769 .dynamic_flags()
4770 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4771 {
4772 this.inner.send_framework_err(
4773 fidl::encoding::FrameworkErr::UnknownMethod,
4774 header.tx_id,
4775 header.ordinal,
4776 header.dynamic_flags(),
4777 (bytes, handles),
4778 )?;
4779 Ok(ChannelOffloadExtRequest::_UnknownMethod {
4780 ordinal: header.ordinal,
4781 control_handle: ChannelOffloadExtControlHandle {
4782 inner: this.inner.clone(),
4783 },
4784 method_type: fidl::MethodType::TwoWay,
4785 })
4786 }
4787 _ => Err(fidl::Error::UnknownOrdinal {
4788 ordinal: header.ordinal,
4789 protocol_name:
4790 <ChannelOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4791 }),
4792 }))
4793 },
4794 )
4795 }
4796}
4797
4798#[derive(Debug)]
4802pub enum ChannelOffloadExtRequest {
4803 StartOffload {
4813 payload: ChannelOffloadExtStartOffloadRequest,
4814 responder: ChannelOffloadExtStartOffloadResponder,
4815 },
4816 #[non_exhaustive]
4818 _UnknownMethod {
4819 ordinal: u64,
4821 control_handle: ChannelOffloadExtControlHandle,
4822 method_type: fidl::MethodType,
4823 },
4824}
4825
4826impl ChannelOffloadExtRequest {
4827 #[allow(irrefutable_let_patterns)]
4828 pub fn into_start_offload(
4829 self,
4830 ) -> Option<(ChannelOffloadExtStartOffloadRequest, ChannelOffloadExtStartOffloadResponder)>
4831 {
4832 if let ChannelOffloadExtRequest::StartOffload { payload, responder } = self {
4833 Some((payload, responder))
4834 } else {
4835 None
4836 }
4837 }
4838
4839 pub fn method_name(&self) -> &'static str {
4841 match *self {
4842 ChannelOffloadExtRequest::StartOffload { .. } => "start_offload",
4843 ChannelOffloadExtRequest::_UnknownMethod {
4844 method_type: fidl::MethodType::OneWay,
4845 ..
4846 } => "unknown one-way method",
4847 ChannelOffloadExtRequest::_UnknownMethod {
4848 method_type: fidl::MethodType::TwoWay,
4849 ..
4850 } => "unknown two-way method",
4851 }
4852 }
4853}
4854
4855#[derive(Debug, Clone)]
4856pub struct ChannelOffloadExtControlHandle {
4857 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4858}
4859
4860impl fidl::endpoints::ControlHandle for ChannelOffloadExtControlHandle {
4861 fn shutdown(&self) {
4862 self.inner.shutdown()
4863 }
4864
4865 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4866 self.inner.shutdown_with_epitaph(status)
4867 }
4868
4869 fn is_closed(&self) -> bool {
4870 self.inner.channel().is_closed()
4871 }
4872 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4873 self.inner.channel().on_closed()
4874 }
4875
4876 #[cfg(target_os = "fuchsia")]
4877 fn signal_peer(
4878 &self,
4879 clear_mask: zx::Signals,
4880 set_mask: zx::Signals,
4881 ) -> Result<(), zx_status::Status> {
4882 use fidl::Peered;
4883 self.inner.channel().signal_peer(clear_mask, set_mask)
4884 }
4885}
4886
4887impl ChannelOffloadExtControlHandle {}
4888
4889#[must_use = "FIDL methods require a response to be sent"]
4890#[derive(Debug)]
4891pub struct ChannelOffloadExtStartOffloadResponder {
4892 control_handle: std::mem::ManuallyDrop<ChannelOffloadExtControlHandle>,
4893 tx_id: u32,
4894}
4895
4896impl std::ops::Drop for ChannelOffloadExtStartOffloadResponder {
4900 fn drop(&mut self) {
4901 self.control_handle.shutdown();
4902 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4904 }
4905}
4906
4907impl fidl::endpoints::Responder for ChannelOffloadExtStartOffloadResponder {
4908 type ControlHandle = ChannelOffloadExtControlHandle;
4909
4910 fn control_handle(&self) -> &ChannelOffloadExtControlHandle {
4911 &self.control_handle
4912 }
4913
4914 fn drop_without_shutdown(mut self) {
4915 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4917 std::mem::forget(self);
4919 }
4920}
4921
4922impl ChannelOffloadExtStartOffloadResponder {
4923 pub fn send(
4927 self,
4928 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4929 ) -> Result<(), fidl::Error> {
4930 let _result = self.send_raw(result);
4931 if _result.is_err() {
4932 self.control_handle.shutdown();
4933 }
4934 self.drop_without_shutdown();
4935 _result
4936 }
4937
4938 pub fn send_no_shutdown_on_err(
4940 self,
4941 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4942 ) -> Result<(), fidl::Error> {
4943 let _result = self.send_raw(result);
4944 self.drop_without_shutdown();
4945 _result
4946 }
4947
4948 fn send_raw(
4949 &self,
4950 mut result: Result<&ChannelOffloadExtStartOffloadResponse, i32>,
4951 ) -> Result<(), fidl::Error> {
4952 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4953 ChannelOffloadExtStartOffloadResponse,
4954 i32,
4955 >>(
4956 fidl::encoding::FlexibleResult::new(result),
4957 self.tx_id,
4958 0x2dd620feea793fe8,
4959 fidl::encoding::DynamicFlags::FLEXIBLE,
4960 )
4961 }
4962}
4963
4964#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4965pub struct CodecDelayMarker;
4966
4967impl fidl::endpoints::ProtocolMarker for CodecDelayMarker {
4968 type Proxy = CodecDelayProxy;
4969 type RequestStream = CodecDelayRequestStream;
4970 #[cfg(target_os = "fuchsia")]
4971 type SynchronousProxy = CodecDelaySynchronousProxy;
4972
4973 const DEBUG_NAME: &'static str = "(anonymous) CodecDelay";
4974}
4975pub type CodecDelayGetCodecLocalDelayRangeResult =
4976 Result<CodecDelayGetCodecLocalDelayRangeResponse, i32>;
4977
4978pub trait CodecDelayProxyInterface: Send + Sync {
4979 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
4980 + Send;
4981 fn r#get_codec_local_delay_range(
4982 &self,
4983 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4984 ) -> Self::GetCodecLocalDelayRangeResponseFut;
4985}
4986#[derive(Debug)]
4987#[cfg(target_os = "fuchsia")]
4988pub struct CodecDelaySynchronousProxy {
4989 client: fidl::client::sync::Client,
4990}
4991
4992#[cfg(target_os = "fuchsia")]
4993impl fidl::endpoints::SynchronousProxy for CodecDelaySynchronousProxy {
4994 type Proxy = CodecDelayProxy;
4995 type Protocol = CodecDelayMarker;
4996
4997 fn from_channel(inner: fidl::Channel) -> Self {
4998 Self::new(inner)
4999 }
5000
5001 fn into_channel(self) -> fidl::Channel {
5002 self.client.into_channel()
5003 }
5004
5005 fn as_channel(&self) -> &fidl::Channel {
5006 self.client.as_channel()
5007 }
5008}
5009
5010#[cfg(target_os = "fuchsia")]
5011impl CodecDelaySynchronousProxy {
5012 pub fn new(channel: fidl::Channel) -> Self {
5013 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5014 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5015 }
5016
5017 pub fn into_channel(self) -> fidl::Channel {
5018 self.client.into_channel()
5019 }
5020
5021 pub fn wait_for_event(
5024 &self,
5025 deadline: zx::MonotonicInstant,
5026 ) -> Result<CodecDelayEvent, fidl::Error> {
5027 CodecDelayEvent::decode(self.client.wait_for_event(deadline)?)
5028 }
5029
5030 pub fn r#get_codec_local_delay_range(
5038 &self,
5039 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5040 ___deadline: zx::MonotonicInstant,
5041 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5042 let _response = self.client.send_query::<
5043 CodecDelayGetCodecLocalDelayRangeRequest,
5044 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5045 >(
5046 payload,
5047 0x1cf34fdeed80b4d,
5048 fidl::encoding::DynamicFlags::empty(),
5049 ___deadline,
5050 )?;
5051 Ok(_response.map(|x| x))
5052 }
5053}
5054
5055#[cfg(target_os = "fuchsia")]
5056impl From<CodecDelaySynchronousProxy> for zx::NullableHandle {
5057 fn from(value: CodecDelaySynchronousProxy) -> Self {
5058 value.into_channel().into()
5059 }
5060}
5061
5062#[cfg(target_os = "fuchsia")]
5063impl From<fidl::Channel> for CodecDelaySynchronousProxy {
5064 fn from(value: fidl::Channel) -> Self {
5065 Self::new(value)
5066 }
5067}
5068
5069#[cfg(target_os = "fuchsia")]
5070impl fidl::endpoints::FromClient for CodecDelaySynchronousProxy {
5071 type Protocol = CodecDelayMarker;
5072
5073 fn from_client(value: fidl::endpoints::ClientEnd<CodecDelayMarker>) -> Self {
5074 Self::new(value.into_channel())
5075 }
5076}
5077
5078#[derive(Debug, Clone)]
5079pub struct CodecDelayProxy {
5080 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5081}
5082
5083impl fidl::endpoints::Proxy for CodecDelayProxy {
5084 type Protocol = CodecDelayMarker;
5085
5086 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5087 Self::new(inner)
5088 }
5089
5090 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5091 self.client.into_channel().map_err(|client| Self { client })
5092 }
5093
5094 fn as_channel(&self) -> &::fidl::AsyncChannel {
5095 self.client.as_channel()
5096 }
5097}
5098
5099impl CodecDelayProxy {
5100 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5102 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5103 Self { client: fidl::client::Client::new(channel, protocol_name) }
5104 }
5105
5106 pub fn take_event_stream(&self) -> CodecDelayEventStream {
5112 CodecDelayEventStream { event_receiver: self.client.take_event_receiver() }
5113 }
5114
5115 pub fn r#get_codec_local_delay_range(
5123 &self,
5124 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5125 ) -> fidl::client::QueryResponseFut<
5126 CodecDelayGetCodecLocalDelayRangeResult,
5127 fidl::encoding::DefaultFuchsiaResourceDialect,
5128 > {
5129 CodecDelayProxyInterface::r#get_codec_local_delay_range(self, payload)
5130 }
5131}
5132
5133impl CodecDelayProxyInterface for CodecDelayProxy {
5134 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
5135 CodecDelayGetCodecLocalDelayRangeResult,
5136 fidl::encoding::DefaultFuchsiaResourceDialect,
5137 >;
5138 fn r#get_codec_local_delay_range(
5139 &self,
5140 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5141 ) -> Self::GetCodecLocalDelayRangeResponseFut {
5142 fn _decode(
5143 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5144 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5145 let _response = fidl::client::decode_transaction_body::<
5146 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5147 fidl::encoding::DefaultFuchsiaResourceDialect,
5148 0x1cf34fdeed80b4d,
5149 >(_buf?)?;
5150 Ok(_response.map(|x| x))
5151 }
5152 self.client.send_query_and_decode::<
5153 CodecDelayGetCodecLocalDelayRangeRequest,
5154 CodecDelayGetCodecLocalDelayRangeResult,
5155 >(
5156 payload,
5157 0x1cf34fdeed80b4d,
5158 fidl::encoding::DynamicFlags::empty(),
5159 _decode,
5160 )
5161 }
5162}
5163
5164pub struct CodecDelayEventStream {
5165 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5166}
5167
5168impl std::marker::Unpin for CodecDelayEventStream {}
5169
5170impl futures::stream::FusedStream for CodecDelayEventStream {
5171 fn is_terminated(&self) -> bool {
5172 self.event_receiver.is_terminated()
5173 }
5174}
5175
5176impl futures::Stream for CodecDelayEventStream {
5177 type Item = Result<CodecDelayEvent, fidl::Error>;
5178
5179 fn poll_next(
5180 mut self: std::pin::Pin<&mut Self>,
5181 cx: &mut std::task::Context<'_>,
5182 ) -> std::task::Poll<Option<Self::Item>> {
5183 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5184 &mut self.event_receiver,
5185 cx
5186 )?) {
5187 Some(buf) => std::task::Poll::Ready(Some(CodecDelayEvent::decode(buf))),
5188 None => std::task::Poll::Ready(None),
5189 }
5190 }
5191}
5192
5193#[derive(Debug)]
5194pub enum CodecDelayEvent {}
5195
5196impl CodecDelayEvent {
5197 fn decode(
5199 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5200 ) -> Result<CodecDelayEvent, fidl::Error> {
5201 let (bytes, _handles) = buf.split_mut();
5202 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5203 debug_assert_eq!(tx_header.tx_id, 0);
5204 match tx_header.ordinal {
5205 _ => Err(fidl::Error::UnknownOrdinal {
5206 ordinal: tx_header.ordinal,
5207 protocol_name: <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5208 }),
5209 }
5210 }
5211}
5212
5213pub struct CodecDelayRequestStream {
5215 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5216 is_terminated: bool,
5217}
5218
5219impl std::marker::Unpin for CodecDelayRequestStream {}
5220
5221impl futures::stream::FusedStream for CodecDelayRequestStream {
5222 fn is_terminated(&self) -> bool {
5223 self.is_terminated
5224 }
5225}
5226
5227impl fidl::endpoints::RequestStream for CodecDelayRequestStream {
5228 type Protocol = CodecDelayMarker;
5229 type ControlHandle = CodecDelayControlHandle;
5230
5231 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5232 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5233 }
5234
5235 fn control_handle(&self) -> Self::ControlHandle {
5236 CodecDelayControlHandle { inner: self.inner.clone() }
5237 }
5238
5239 fn into_inner(
5240 self,
5241 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5242 {
5243 (self.inner, self.is_terminated)
5244 }
5245
5246 fn from_inner(
5247 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5248 is_terminated: bool,
5249 ) -> Self {
5250 Self { inner, is_terminated }
5251 }
5252}
5253
5254impl futures::Stream for CodecDelayRequestStream {
5255 type Item = Result<CodecDelayRequest, fidl::Error>;
5256
5257 fn poll_next(
5258 mut self: std::pin::Pin<&mut Self>,
5259 cx: &mut std::task::Context<'_>,
5260 ) -> std::task::Poll<Option<Self::Item>> {
5261 let this = &mut *self;
5262 if this.inner.check_shutdown(cx) {
5263 this.is_terminated = true;
5264 return std::task::Poll::Ready(None);
5265 }
5266 if this.is_terminated {
5267 panic!("polled CodecDelayRequestStream after completion");
5268 }
5269 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5270 |bytes, handles| {
5271 match this.inner.channel().read_etc(cx, bytes, handles) {
5272 std::task::Poll::Ready(Ok(())) => {}
5273 std::task::Poll::Pending => return std::task::Poll::Pending,
5274 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5275 this.is_terminated = true;
5276 return std::task::Poll::Ready(None);
5277 }
5278 std::task::Poll::Ready(Err(e)) => {
5279 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5280 e.into(),
5281 ))));
5282 }
5283 }
5284
5285 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5287
5288 std::task::Poll::Ready(Some(match header.ordinal {
5289 0x1cf34fdeed80b4d => {
5290 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5291 let mut req = fidl::new_empty!(
5292 CodecDelayGetCodecLocalDelayRangeRequest,
5293 fidl::encoding::DefaultFuchsiaResourceDialect
5294 );
5295 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
5296 let control_handle = CodecDelayControlHandle { inner: this.inner.clone() };
5297 Ok(CodecDelayRequest::GetCodecLocalDelayRange {
5298 payload: req,
5299 responder: CodecDelayGetCodecLocalDelayRangeResponder {
5300 control_handle: std::mem::ManuallyDrop::new(control_handle),
5301 tx_id: header.tx_id,
5302 },
5303 })
5304 }
5305 _ => Err(fidl::Error::UnknownOrdinal {
5306 ordinal: header.ordinal,
5307 protocol_name:
5308 <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5309 }),
5310 }))
5311 },
5312 )
5313 }
5314}
5315
5316#[derive(Debug)]
5319pub enum CodecDelayRequest {
5320 GetCodecLocalDelayRange {
5328 payload: CodecDelayGetCodecLocalDelayRangeRequest,
5329 responder: CodecDelayGetCodecLocalDelayRangeResponder,
5330 },
5331}
5332
5333impl CodecDelayRequest {
5334 #[allow(irrefutable_let_patterns)]
5335 pub fn into_get_codec_local_delay_range(
5336 self,
5337 ) -> Option<(
5338 CodecDelayGetCodecLocalDelayRangeRequest,
5339 CodecDelayGetCodecLocalDelayRangeResponder,
5340 )> {
5341 if let CodecDelayRequest::GetCodecLocalDelayRange { payload, responder } = self {
5342 Some((payload, responder))
5343 } else {
5344 None
5345 }
5346 }
5347
5348 pub fn method_name(&self) -> &'static str {
5350 match *self {
5351 CodecDelayRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
5352 }
5353 }
5354}
5355
5356#[derive(Debug, Clone)]
5357pub struct CodecDelayControlHandle {
5358 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5359}
5360
5361impl fidl::endpoints::ControlHandle for CodecDelayControlHandle {
5362 fn shutdown(&self) {
5363 self.inner.shutdown()
5364 }
5365
5366 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5367 self.inner.shutdown_with_epitaph(status)
5368 }
5369
5370 fn is_closed(&self) -> bool {
5371 self.inner.channel().is_closed()
5372 }
5373 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5374 self.inner.channel().on_closed()
5375 }
5376
5377 #[cfg(target_os = "fuchsia")]
5378 fn signal_peer(
5379 &self,
5380 clear_mask: zx::Signals,
5381 set_mask: zx::Signals,
5382 ) -> Result<(), zx_status::Status> {
5383 use fidl::Peered;
5384 self.inner.channel().signal_peer(clear_mask, set_mask)
5385 }
5386}
5387
5388impl CodecDelayControlHandle {}
5389
5390#[must_use = "FIDL methods require a response to be sent"]
5391#[derive(Debug)]
5392pub struct CodecDelayGetCodecLocalDelayRangeResponder {
5393 control_handle: std::mem::ManuallyDrop<CodecDelayControlHandle>,
5394 tx_id: u32,
5395}
5396
5397impl std::ops::Drop for CodecDelayGetCodecLocalDelayRangeResponder {
5401 fn drop(&mut self) {
5402 self.control_handle.shutdown();
5403 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5405 }
5406}
5407
5408impl fidl::endpoints::Responder for CodecDelayGetCodecLocalDelayRangeResponder {
5409 type ControlHandle = CodecDelayControlHandle;
5410
5411 fn control_handle(&self) -> &CodecDelayControlHandle {
5412 &self.control_handle
5413 }
5414
5415 fn drop_without_shutdown(mut self) {
5416 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5418 std::mem::forget(self);
5420 }
5421}
5422
5423impl CodecDelayGetCodecLocalDelayRangeResponder {
5424 pub fn send(
5428 self,
5429 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5430 ) -> Result<(), fidl::Error> {
5431 let _result = self.send_raw(result);
5432 if _result.is_err() {
5433 self.control_handle.shutdown();
5434 }
5435 self.drop_without_shutdown();
5436 _result
5437 }
5438
5439 pub fn send_no_shutdown_on_err(
5441 self,
5442 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5443 ) -> Result<(), fidl::Error> {
5444 let _result = self.send_raw(result);
5445 self.drop_without_shutdown();
5446 _result
5447 }
5448
5449 fn send_raw(
5450 &self,
5451 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5452 ) -> Result<(), fidl::Error> {
5453 self.control_handle.inner.send::<fidl::encoding::ResultType<
5454 CodecDelayGetCodecLocalDelayRangeResponse,
5455 i32,
5456 >>(
5457 result,
5458 self.tx_id,
5459 0x1cf34fdeed80b4d,
5460 fidl::encoding::DynamicFlags::empty(),
5461 )
5462 }
5463}
5464
5465#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5466pub struct ConnectedIsochronousGroupMarker;
5467
5468impl fidl::endpoints::ProtocolMarker for ConnectedIsochronousGroupMarker {
5469 type Proxy = ConnectedIsochronousGroupProxy;
5470 type RequestStream = ConnectedIsochronousGroupRequestStream;
5471 #[cfg(target_os = "fuchsia")]
5472 type SynchronousProxy = ConnectedIsochronousGroupSynchronousProxy;
5473
5474 const DEBUG_NAME: &'static str = "(anonymous) ConnectedIsochronousGroup";
5475}
5476pub type ConnectedIsochronousGroupEstablishStreamsResult = Result<(), EstablishStreamsError>;
5477
5478pub trait ConnectedIsochronousGroupProxyInterface: Send + Sync {
5479 type EstablishStreamsResponseFut: std::future::Future<
5480 Output = Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error>,
5481 > + Send;
5482 fn r#establish_streams(
5483 &self,
5484 payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5485 ) -> Self::EstablishStreamsResponseFut;
5486 fn r#remove(&self) -> Result<(), fidl::Error>;
5487}
5488#[derive(Debug)]
5489#[cfg(target_os = "fuchsia")]
5490pub struct ConnectedIsochronousGroupSynchronousProxy {
5491 client: fidl::client::sync::Client,
5492}
5493
5494#[cfg(target_os = "fuchsia")]
5495impl fidl::endpoints::SynchronousProxy for ConnectedIsochronousGroupSynchronousProxy {
5496 type Proxy = ConnectedIsochronousGroupProxy;
5497 type Protocol = ConnectedIsochronousGroupMarker;
5498
5499 fn from_channel(inner: fidl::Channel) -> Self {
5500 Self::new(inner)
5501 }
5502
5503 fn into_channel(self) -> fidl::Channel {
5504 self.client.into_channel()
5505 }
5506
5507 fn as_channel(&self) -> &fidl::Channel {
5508 self.client.as_channel()
5509 }
5510}
5511
5512#[cfg(target_os = "fuchsia")]
5513impl ConnectedIsochronousGroupSynchronousProxy {
5514 pub fn new(channel: fidl::Channel) -> Self {
5515 let protocol_name =
5516 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5517 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5518 }
5519
5520 pub fn into_channel(self) -> fidl::Channel {
5521 self.client.into_channel()
5522 }
5523
5524 pub fn wait_for_event(
5527 &self,
5528 deadline: zx::MonotonicInstant,
5529 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
5530 ConnectedIsochronousGroupEvent::decode(self.client.wait_for_event(deadline)?)
5531 }
5532
5533 pub fn r#establish_streams(
5542 &self,
5543 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5544 ___deadline: zx::MonotonicInstant,
5545 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
5546 let _response = self.client.send_query::<
5547 ConnectedIsochronousGroupEstablishStreamsRequest,
5548 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EstablishStreamsError>,
5549 >(
5550 payload,
5551 0xc7296c5edb4dacc,
5552 fidl::encoding::DynamicFlags::FLEXIBLE,
5553 ___deadline,
5554 )?
5555 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
5556 Ok(_response.map(|x| x))
5557 }
5558
5559 pub fn r#remove(&self) -> Result<(), fidl::Error> {
5562 self.client.send::<fidl::encoding::EmptyPayload>(
5563 (),
5564 0xbed433babd20503,
5565 fidl::encoding::DynamicFlags::FLEXIBLE,
5566 )
5567 }
5568}
5569
5570#[cfg(target_os = "fuchsia")]
5571impl From<ConnectedIsochronousGroupSynchronousProxy> for zx::NullableHandle {
5572 fn from(value: ConnectedIsochronousGroupSynchronousProxy) -> Self {
5573 value.into_channel().into()
5574 }
5575}
5576
5577#[cfg(target_os = "fuchsia")]
5578impl From<fidl::Channel> for ConnectedIsochronousGroupSynchronousProxy {
5579 fn from(value: fidl::Channel) -> Self {
5580 Self::new(value)
5581 }
5582}
5583
5584#[cfg(target_os = "fuchsia")]
5585impl fidl::endpoints::FromClient for ConnectedIsochronousGroupSynchronousProxy {
5586 type Protocol = ConnectedIsochronousGroupMarker;
5587
5588 fn from_client(value: fidl::endpoints::ClientEnd<ConnectedIsochronousGroupMarker>) -> Self {
5589 Self::new(value.into_channel())
5590 }
5591}
5592
5593#[derive(Debug, Clone)]
5594pub struct ConnectedIsochronousGroupProxy {
5595 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5596}
5597
5598impl fidl::endpoints::Proxy for ConnectedIsochronousGroupProxy {
5599 type Protocol = ConnectedIsochronousGroupMarker;
5600
5601 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5602 Self::new(inner)
5603 }
5604
5605 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5606 self.client.into_channel().map_err(|client| Self { client })
5607 }
5608
5609 fn as_channel(&self) -> &::fidl::AsyncChannel {
5610 self.client.as_channel()
5611 }
5612}
5613
5614impl ConnectedIsochronousGroupProxy {
5615 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5617 let protocol_name =
5618 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5619 Self { client: fidl::client::Client::new(channel, protocol_name) }
5620 }
5621
5622 pub fn take_event_stream(&self) -> ConnectedIsochronousGroupEventStream {
5628 ConnectedIsochronousGroupEventStream { event_receiver: self.client.take_event_receiver() }
5629 }
5630
5631 pub fn r#establish_streams(
5640 &self,
5641 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5642 ) -> fidl::client::QueryResponseFut<
5643 ConnectedIsochronousGroupEstablishStreamsResult,
5644 fidl::encoding::DefaultFuchsiaResourceDialect,
5645 > {
5646 ConnectedIsochronousGroupProxyInterface::r#establish_streams(self, payload)
5647 }
5648
5649 pub fn r#remove(&self) -> Result<(), fidl::Error> {
5652 ConnectedIsochronousGroupProxyInterface::r#remove(self)
5653 }
5654}
5655
5656impl ConnectedIsochronousGroupProxyInterface for ConnectedIsochronousGroupProxy {
5657 type EstablishStreamsResponseFut = fidl::client::QueryResponseFut<
5658 ConnectedIsochronousGroupEstablishStreamsResult,
5659 fidl::encoding::DefaultFuchsiaResourceDialect,
5660 >;
5661 fn r#establish_streams(
5662 &self,
5663 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
5664 ) -> Self::EstablishStreamsResponseFut {
5665 fn _decode(
5666 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5667 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
5668 let _response = fidl::client::decode_transaction_body::<
5669 fidl::encoding::FlexibleResultType<
5670 fidl::encoding::EmptyStruct,
5671 EstablishStreamsError,
5672 >,
5673 fidl::encoding::DefaultFuchsiaResourceDialect,
5674 0xc7296c5edb4dacc,
5675 >(_buf?)?
5676 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
5677 Ok(_response.map(|x| x))
5678 }
5679 self.client.send_query_and_decode::<
5680 ConnectedIsochronousGroupEstablishStreamsRequest,
5681 ConnectedIsochronousGroupEstablishStreamsResult,
5682 >(
5683 payload,
5684 0xc7296c5edb4dacc,
5685 fidl::encoding::DynamicFlags::FLEXIBLE,
5686 _decode,
5687 )
5688 }
5689
5690 fn r#remove(&self) -> Result<(), fidl::Error> {
5691 self.client.send::<fidl::encoding::EmptyPayload>(
5692 (),
5693 0xbed433babd20503,
5694 fidl::encoding::DynamicFlags::FLEXIBLE,
5695 )
5696 }
5697}
5698
5699pub struct ConnectedIsochronousGroupEventStream {
5700 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5701}
5702
5703impl std::marker::Unpin for ConnectedIsochronousGroupEventStream {}
5704
5705impl futures::stream::FusedStream for ConnectedIsochronousGroupEventStream {
5706 fn is_terminated(&self) -> bool {
5707 self.event_receiver.is_terminated()
5708 }
5709}
5710
5711impl futures::Stream for ConnectedIsochronousGroupEventStream {
5712 type Item = Result<ConnectedIsochronousGroupEvent, fidl::Error>;
5713
5714 fn poll_next(
5715 mut self: std::pin::Pin<&mut Self>,
5716 cx: &mut std::task::Context<'_>,
5717 ) -> std::task::Poll<Option<Self::Item>> {
5718 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5719 &mut self.event_receiver,
5720 cx
5721 )?) {
5722 Some(buf) => std::task::Poll::Ready(Some(ConnectedIsochronousGroupEvent::decode(buf))),
5723 None => std::task::Poll::Ready(None),
5724 }
5725 }
5726}
5727
5728#[derive(Debug)]
5729pub enum ConnectedIsochronousGroupEvent {
5730 #[non_exhaustive]
5731 _UnknownEvent {
5732 ordinal: u64,
5734 },
5735}
5736
5737impl ConnectedIsochronousGroupEvent {
5738 fn decode(
5740 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5741 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
5742 let (bytes, _handles) = buf.split_mut();
5743 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5744 debug_assert_eq!(tx_header.tx_id, 0);
5745 match tx_header.ordinal {
5746 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5747 Ok(ConnectedIsochronousGroupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5748 }
5749 _ => Err(fidl::Error::UnknownOrdinal {
5750 ordinal: tx_header.ordinal,
5751 protocol_name:
5752 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5753 }),
5754 }
5755 }
5756}
5757
5758pub struct ConnectedIsochronousGroupRequestStream {
5760 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5761 is_terminated: bool,
5762}
5763
5764impl std::marker::Unpin for ConnectedIsochronousGroupRequestStream {}
5765
5766impl futures::stream::FusedStream for ConnectedIsochronousGroupRequestStream {
5767 fn is_terminated(&self) -> bool {
5768 self.is_terminated
5769 }
5770}
5771
5772impl fidl::endpoints::RequestStream for ConnectedIsochronousGroupRequestStream {
5773 type Protocol = ConnectedIsochronousGroupMarker;
5774 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5775
5776 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5777 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5778 }
5779
5780 fn control_handle(&self) -> Self::ControlHandle {
5781 ConnectedIsochronousGroupControlHandle { inner: self.inner.clone() }
5782 }
5783
5784 fn into_inner(
5785 self,
5786 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5787 {
5788 (self.inner, self.is_terminated)
5789 }
5790
5791 fn from_inner(
5792 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5793 is_terminated: bool,
5794 ) -> Self {
5795 Self { inner, is_terminated }
5796 }
5797}
5798
5799impl futures::Stream for ConnectedIsochronousGroupRequestStream {
5800 type Item = Result<ConnectedIsochronousGroupRequest, fidl::Error>;
5801
5802 fn poll_next(
5803 mut self: std::pin::Pin<&mut Self>,
5804 cx: &mut std::task::Context<'_>,
5805 ) -> std::task::Poll<Option<Self::Item>> {
5806 let this = &mut *self;
5807 if this.inner.check_shutdown(cx) {
5808 this.is_terminated = true;
5809 return std::task::Poll::Ready(None);
5810 }
5811 if this.is_terminated {
5812 panic!("polled ConnectedIsochronousGroupRequestStream after completion");
5813 }
5814 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5815 |bytes, handles| {
5816 match this.inner.channel().read_etc(cx, bytes, handles) {
5817 std::task::Poll::Ready(Ok(())) => {}
5818 std::task::Poll::Pending => return std::task::Poll::Pending,
5819 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5820 this.is_terminated = true;
5821 return std::task::Poll::Ready(None);
5822 }
5823 std::task::Poll::Ready(Err(e)) => {
5824 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5825 e.into(),
5826 ))));
5827 }
5828 }
5829
5830 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5832
5833 std::task::Poll::Ready(Some(match header.ordinal {
5834 0xc7296c5edb4dacc => {
5835 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5836 let mut req = fidl::new_empty!(ConnectedIsochronousGroupEstablishStreamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5837 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectedIsochronousGroupEstablishStreamsRequest>(&header, _body_bytes, handles, &mut req)?;
5838 let control_handle = ConnectedIsochronousGroupControlHandle {
5839 inner: this.inner.clone(),
5840 };
5841 Ok(ConnectedIsochronousGroupRequest::EstablishStreams {payload: req,
5842 responder: ConnectedIsochronousGroupEstablishStreamsResponder {
5843 control_handle: std::mem::ManuallyDrop::new(control_handle),
5844 tx_id: header.tx_id,
5845 },
5846 })
5847 }
5848 0xbed433babd20503 => {
5849 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5850 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5851 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5852 let control_handle = ConnectedIsochronousGroupControlHandle {
5853 inner: this.inner.clone(),
5854 };
5855 Ok(ConnectedIsochronousGroupRequest::Remove {
5856 control_handle,
5857 })
5858 }
5859 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5860 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5861 ordinal: header.ordinal,
5862 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5863 method_type: fidl::MethodType::OneWay,
5864 })
5865 }
5866 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5867 this.inner.send_framework_err(
5868 fidl::encoding::FrameworkErr::UnknownMethod,
5869 header.tx_id,
5870 header.ordinal,
5871 header.dynamic_flags(),
5872 (bytes, handles),
5873 )?;
5874 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5875 ordinal: header.ordinal,
5876 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5877 method_type: fidl::MethodType::TwoWay,
5878 })
5879 }
5880 _ => Err(fidl::Error::UnknownOrdinal {
5881 ordinal: header.ordinal,
5882 protocol_name: <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5883 }),
5884 }))
5885 },
5886 )
5887 }
5888}
5889
5890#[derive(Debug)]
5891pub enum ConnectedIsochronousGroupRequest {
5892 EstablishStreams {
5901 payload: ConnectedIsochronousGroupEstablishStreamsRequest,
5902 responder: ConnectedIsochronousGroupEstablishStreamsResponder,
5903 },
5904 Remove { control_handle: ConnectedIsochronousGroupControlHandle },
5907 #[non_exhaustive]
5909 _UnknownMethod {
5910 ordinal: u64,
5912 control_handle: ConnectedIsochronousGroupControlHandle,
5913 method_type: fidl::MethodType,
5914 },
5915}
5916
5917impl ConnectedIsochronousGroupRequest {
5918 #[allow(irrefutable_let_patterns)]
5919 pub fn into_establish_streams(
5920 self,
5921 ) -> Option<(
5922 ConnectedIsochronousGroupEstablishStreamsRequest,
5923 ConnectedIsochronousGroupEstablishStreamsResponder,
5924 )> {
5925 if let ConnectedIsochronousGroupRequest::EstablishStreams { payload, responder } = self {
5926 Some((payload, responder))
5927 } else {
5928 None
5929 }
5930 }
5931
5932 #[allow(irrefutable_let_patterns)]
5933 pub fn into_remove(self) -> Option<(ConnectedIsochronousGroupControlHandle)> {
5934 if let ConnectedIsochronousGroupRequest::Remove { control_handle } = self {
5935 Some((control_handle))
5936 } else {
5937 None
5938 }
5939 }
5940
5941 pub fn method_name(&self) -> &'static str {
5943 match *self {
5944 ConnectedIsochronousGroupRequest::EstablishStreams { .. } => "establish_streams",
5945 ConnectedIsochronousGroupRequest::Remove { .. } => "remove",
5946 ConnectedIsochronousGroupRequest::_UnknownMethod {
5947 method_type: fidl::MethodType::OneWay,
5948 ..
5949 } => "unknown one-way method",
5950 ConnectedIsochronousGroupRequest::_UnknownMethod {
5951 method_type: fidl::MethodType::TwoWay,
5952 ..
5953 } => "unknown two-way method",
5954 }
5955 }
5956}
5957
5958#[derive(Debug, Clone)]
5959pub struct ConnectedIsochronousGroupControlHandle {
5960 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5961}
5962
5963impl fidl::endpoints::ControlHandle for ConnectedIsochronousGroupControlHandle {
5964 fn shutdown(&self) {
5965 self.inner.shutdown()
5966 }
5967
5968 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5969 self.inner.shutdown_with_epitaph(status)
5970 }
5971
5972 fn is_closed(&self) -> bool {
5973 self.inner.channel().is_closed()
5974 }
5975 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5976 self.inner.channel().on_closed()
5977 }
5978
5979 #[cfg(target_os = "fuchsia")]
5980 fn signal_peer(
5981 &self,
5982 clear_mask: zx::Signals,
5983 set_mask: zx::Signals,
5984 ) -> Result<(), zx_status::Status> {
5985 use fidl::Peered;
5986 self.inner.channel().signal_peer(clear_mask, set_mask)
5987 }
5988}
5989
5990impl ConnectedIsochronousGroupControlHandle {}
5991
5992#[must_use = "FIDL methods require a response to be sent"]
5993#[derive(Debug)]
5994pub struct ConnectedIsochronousGroupEstablishStreamsResponder {
5995 control_handle: std::mem::ManuallyDrop<ConnectedIsochronousGroupControlHandle>,
5996 tx_id: u32,
5997}
5998
5999impl std::ops::Drop for ConnectedIsochronousGroupEstablishStreamsResponder {
6003 fn drop(&mut self) {
6004 self.control_handle.shutdown();
6005 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6007 }
6008}
6009
6010impl fidl::endpoints::Responder for ConnectedIsochronousGroupEstablishStreamsResponder {
6011 type ControlHandle = ConnectedIsochronousGroupControlHandle;
6012
6013 fn control_handle(&self) -> &ConnectedIsochronousGroupControlHandle {
6014 &self.control_handle
6015 }
6016
6017 fn drop_without_shutdown(mut self) {
6018 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6020 std::mem::forget(self);
6022 }
6023}
6024
6025impl ConnectedIsochronousGroupEstablishStreamsResponder {
6026 pub fn send(self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
6030 let _result = self.send_raw(result);
6031 if _result.is_err() {
6032 self.control_handle.shutdown();
6033 }
6034 self.drop_without_shutdown();
6035 _result
6036 }
6037
6038 pub fn send_no_shutdown_on_err(
6040 self,
6041 mut result: Result<(), EstablishStreamsError>,
6042 ) -> Result<(), fidl::Error> {
6043 let _result = self.send_raw(result);
6044 self.drop_without_shutdown();
6045 _result
6046 }
6047
6048 fn send_raw(&self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
6049 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6050 fidl::encoding::EmptyStruct,
6051 EstablishStreamsError,
6052 >>(
6053 fidl::encoding::FlexibleResult::new(result),
6054 self.tx_id,
6055 0xc7296c5edb4dacc,
6056 fidl::encoding::DynamicFlags::FLEXIBLE,
6057 )
6058 }
6059}
6060
6061#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6062pub struct ConnectionMarker;
6063
6064impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
6065 type Proxy = ConnectionProxy;
6066 type RequestStream = ConnectionRequestStream;
6067 #[cfg(target_os = "fuchsia")]
6068 type SynchronousProxy = ConnectionSynchronousProxy;
6069
6070 const DEBUG_NAME: &'static str = "(anonymous) Connection";
6071}
6072pub type ConnectionTransferPeriodicAdvertisingSyncResult =
6073 Result<(), PeriodicAdvertisingSyncTransferError>;
6074pub type ConnectionAcceptPeriodicAdvertisingSyncTransferResult =
6075 Result<(), PeriodicAdvertisingSyncTransferError>;
6076
6077pub trait ConnectionProxyInterface: Send + Sync {
6078 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
6079 + Send;
6080 fn r#get_codec_local_delay_range(
6081 &self,
6082 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6083 ) -> Self::GetCodecLocalDelayRangeResponseFut;
6084 fn r#request_gatt_client(
6085 &self,
6086 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6087 ) -> Result<(), fidl::Error>;
6088 fn r#accept_cis(&self, payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error>;
6089 fn r#connect_l2cap(&self, payload: ConnectionConnectL2capRequest) -> Result<(), fidl::Error>;
6090 type TransferPeriodicAdvertisingSyncResponseFut: std::future::Future<
6091 Output = Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error>,
6092 > + Send;
6093 fn r#transfer_periodic_advertising_sync(
6094 &self,
6095 payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6096 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut;
6097 type AcceptPeriodicAdvertisingSyncTransferResponseFut: std::future::Future<
6098 Output = Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error>,
6099 > + Send;
6100 fn r#accept_periodic_advertising_sync_transfer(
6101 &self,
6102 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6103 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut;
6104}
6105#[derive(Debug)]
6106#[cfg(target_os = "fuchsia")]
6107pub struct ConnectionSynchronousProxy {
6108 client: fidl::client::sync::Client,
6109}
6110
6111#[cfg(target_os = "fuchsia")]
6112impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
6113 type Proxy = ConnectionProxy;
6114 type Protocol = ConnectionMarker;
6115
6116 fn from_channel(inner: fidl::Channel) -> Self {
6117 Self::new(inner)
6118 }
6119
6120 fn into_channel(self) -> fidl::Channel {
6121 self.client.into_channel()
6122 }
6123
6124 fn as_channel(&self) -> &fidl::Channel {
6125 self.client.as_channel()
6126 }
6127}
6128
6129#[cfg(target_os = "fuchsia")]
6130impl ConnectionSynchronousProxy {
6131 pub fn new(channel: fidl::Channel) -> Self {
6132 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6133 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6134 }
6135
6136 pub fn into_channel(self) -> fidl::Channel {
6137 self.client.into_channel()
6138 }
6139
6140 pub fn wait_for_event(
6143 &self,
6144 deadline: zx::MonotonicInstant,
6145 ) -> Result<ConnectionEvent, fidl::Error> {
6146 ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
6147 }
6148
6149 pub fn r#get_codec_local_delay_range(
6157 &self,
6158 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6159 ___deadline: zx::MonotonicInstant,
6160 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
6161 let _response = self.client.send_query::<
6162 CodecDelayGetCodecLocalDelayRangeRequest,
6163 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6164 >(
6165 payload,
6166 0x1cf34fdeed80b4d,
6167 fidl::encoding::DynamicFlags::empty(),
6168 ___deadline,
6169 )?;
6170 Ok(_response.map(|x| x))
6171 }
6172
6173 pub fn r#request_gatt_client(
6177 &self,
6178 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6179 ) -> Result<(), fidl::Error> {
6180 self.client.send::<ConnectionRequestGattClientRequest>(
6181 (client,),
6182 0x2a670e0fec6ccc6b,
6183 fidl::encoding::DynamicFlags::empty(),
6184 )
6185 }
6186
6187 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6202 self.client.send::<ConnectionAcceptCisRequest>(
6203 &mut payload,
6204 0x7e6338c237088144,
6205 fidl::encoding::DynamicFlags::empty(),
6206 )
6207 }
6208
6209 pub fn r#connect_l2cap(
6211 &self,
6212 mut payload: ConnectionConnectL2capRequest,
6213 ) -> Result<(), fidl::Error> {
6214 self.client.send::<ConnectionConnectL2capRequest>(
6215 &mut payload,
6216 0x12351316feaebce9,
6217 fidl::encoding::DynamicFlags::empty(),
6218 )
6219 }
6220
6221 pub fn r#transfer_periodic_advertising_sync(
6224 &self,
6225 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6226 ___deadline: zx::MonotonicInstant,
6227 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
6228 let _response = self.client.send_query::<
6229 ConnectionTransferPeriodicAdvertisingSyncRequest,
6230 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
6231 >(
6232 payload,
6233 0x1117a10b5ba1e219,
6234 fidl::encoding::DynamicFlags::empty(),
6235 ___deadline,
6236 )?;
6237 Ok(_response.map(|x| x))
6238 }
6239
6240 pub fn r#accept_periodic_advertising_sync_transfer(
6243 &self,
6244 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6245 ___deadline: zx::MonotonicInstant,
6246 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
6247 let _response = self.client.send_query::<
6248 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6249 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
6250 >(
6251 &mut payload,
6252 0x441a31a7effa7e2b,
6253 fidl::encoding::DynamicFlags::empty(),
6254 ___deadline,
6255 )?;
6256 Ok(_response.map(|x| x))
6257 }
6258}
6259
6260#[cfg(target_os = "fuchsia")]
6261impl From<ConnectionSynchronousProxy> for zx::NullableHandle {
6262 fn from(value: ConnectionSynchronousProxy) -> Self {
6263 value.into_channel().into()
6264 }
6265}
6266
6267#[cfg(target_os = "fuchsia")]
6268impl From<fidl::Channel> for ConnectionSynchronousProxy {
6269 fn from(value: fidl::Channel) -> Self {
6270 Self::new(value)
6271 }
6272}
6273
6274#[cfg(target_os = "fuchsia")]
6275impl fidl::endpoints::FromClient for ConnectionSynchronousProxy {
6276 type Protocol = ConnectionMarker;
6277
6278 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionMarker>) -> Self {
6279 Self::new(value.into_channel())
6280 }
6281}
6282
6283#[derive(Debug, Clone)]
6284pub struct ConnectionProxy {
6285 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6286}
6287
6288impl fidl::endpoints::Proxy for ConnectionProxy {
6289 type Protocol = ConnectionMarker;
6290
6291 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6292 Self::new(inner)
6293 }
6294
6295 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6296 self.client.into_channel().map_err(|client| Self { client })
6297 }
6298
6299 fn as_channel(&self) -> &::fidl::AsyncChannel {
6300 self.client.as_channel()
6301 }
6302}
6303
6304impl ConnectionProxy {
6305 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6307 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6308 Self { client: fidl::client::Client::new(channel, protocol_name) }
6309 }
6310
6311 pub fn take_event_stream(&self) -> ConnectionEventStream {
6317 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
6318 }
6319
6320 pub fn r#get_codec_local_delay_range(
6328 &self,
6329 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6330 ) -> fidl::client::QueryResponseFut<
6331 CodecDelayGetCodecLocalDelayRangeResult,
6332 fidl::encoding::DefaultFuchsiaResourceDialect,
6333 > {
6334 ConnectionProxyInterface::r#get_codec_local_delay_range(self, payload)
6335 }
6336
6337 pub fn r#request_gatt_client(
6341 &self,
6342 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6343 ) -> Result<(), fidl::Error> {
6344 ConnectionProxyInterface::r#request_gatt_client(self, client)
6345 }
6346
6347 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6362 ConnectionProxyInterface::r#accept_cis(self, payload)
6363 }
6364
6365 pub fn r#connect_l2cap(
6367 &self,
6368 mut payload: ConnectionConnectL2capRequest,
6369 ) -> Result<(), fidl::Error> {
6370 ConnectionProxyInterface::r#connect_l2cap(self, payload)
6371 }
6372
6373 pub fn r#transfer_periodic_advertising_sync(
6376 &self,
6377 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6378 ) -> fidl::client::QueryResponseFut<
6379 ConnectionTransferPeriodicAdvertisingSyncResult,
6380 fidl::encoding::DefaultFuchsiaResourceDialect,
6381 > {
6382 ConnectionProxyInterface::r#transfer_periodic_advertising_sync(self, payload)
6383 }
6384
6385 pub fn r#accept_periodic_advertising_sync_transfer(
6388 &self,
6389 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6390 ) -> fidl::client::QueryResponseFut<
6391 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6392 fidl::encoding::DefaultFuchsiaResourceDialect,
6393 > {
6394 ConnectionProxyInterface::r#accept_periodic_advertising_sync_transfer(self, payload)
6395 }
6396}
6397
6398impl ConnectionProxyInterface for ConnectionProxy {
6399 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
6400 CodecDelayGetCodecLocalDelayRangeResult,
6401 fidl::encoding::DefaultFuchsiaResourceDialect,
6402 >;
6403 fn r#get_codec_local_delay_range(
6404 &self,
6405 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
6406 ) -> Self::GetCodecLocalDelayRangeResponseFut {
6407 fn _decode(
6408 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6409 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
6410 let _response = fidl::client::decode_transaction_body::<
6411 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6412 fidl::encoding::DefaultFuchsiaResourceDialect,
6413 0x1cf34fdeed80b4d,
6414 >(_buf?)?;
6415 Ok(_response.map(|x| x))
6416 }
6417 self.client.send_query_and_decode::<
6418 CodecDelayGetCodecLocalDelayRangeRequest,
6419 CodecDelayGetCodecLocalDelayRangeResult,
6420 >(
6421 payload,
6422 0x1cf34fdeed80b4d,
6423 fidl::encoding::DynamicFlags::empty(),
6424 _decode,
6425 )
6426 }
6427
6428 fn r#request_gatt_client(
6429 &self,
6430 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6431 ) -> Result<(), fidl::Error> {
6432 self.client.send::<ConnectionRequestGattClientRequest>(
6433 (client,),
6434 0x2a670e0fec6ccc6b,
6435 fidl::encoding::DynamicFlags::empty(),
6436 )
6437 }
6438
6439 fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
6440 self.client.send::<ConnectionAcceptCisRequest>(
6441 &mut payload,
6442 0x7e6338c237088144,
6443 fidl::encoding::DynamicFlags::empty(),
6444 )
6445 }
6446
6447 fn r#connect_l2cap(
6448 &self,
6449 mut payload: ConnectionConnectL2capRequest,
6450 ) -> Result<(), fidl::Error> {
6451 self.client.send::<ConnectionConnectL2capRequest>(
6452 &mut payload,
6453 0x12351316feaebce9,
6454 fidl::encoding::DynamicFlags::empty(),
6455 )
6456 }
6457
6458 type TransferPeriodicAdvertisingSyncResponseFut = fidl::client::QueryResponseFut<
6459 ConnectionTransferPeriodicAdvertisingSyncResult,
6460 fidl::encoding::DefaultFuchsiaResourceDialect,
6461 >;
6462 fn r#transfer_periodic_advertising_sync(
6463 &self,
6464 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
6465 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut {
6466 fn _decode(
6467 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6468 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
6469 let _response = fidl::client::decode_transaction_body::<
6470 fidl::encoding::ResultType<
6471 fidl::encoding::EmptyStruct,
6472 PeriodicAdvertisingSyncTransferError,
6473 >,
6474 fidl::encoding::DefaultFuchsiaResourceDialect,
6475 0x1117a10b5ba1e219,
6476 >(_buf?)?;
6477 Ok(_response.map(|x| x))
6478 }
6479 self.client.send_query_and_decode::<
6480 ConnectionTransferPeriodicAdvertisingSyncRequest,
6481 ConnectionTransferPeriodicAdvertisingSyncResult,
6482 >(
6483 payload,
6484 0x1117a10b5ba1e219,
6485 fidl::encoding::DynamicFlags::empty(),
6486 _decode,
6487 )
6488 }
6489
6490 type AcceptPeriodicAdvertisingSyncTransferResponseFut = fidl::client::QueryResponseFut<
6491 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6492 fidl::encoding::DefaultFuchsiaResourceDialect,
6493 >;
6494 fn r#accept_periodic_advertising_sync_transfer(
6495 &self,
6496 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6497 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut {
6498 fn _decode(
6499 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6500 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
6501 let _response = fidl::client::decode_transaction_body::<
6502 fidl::encoding::ResultType<
6503 fidl::encoding::EmptyStruct,
6504 PeriodicAdvertisingSyncTransferError,
6505 >,
6506 fidl::encoding::DefaultFuchsiaResourceDialect,
6507 0x441a31a7effa7e2b,
6508 >(_buf?)?;
6509 Ok(_response.map(|x| x))
6510 }
6511 self.client.send_query_and_decode::<
6512 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6513 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
6514 >(
6515 &mut payload,
6516 0x441a31a7effa7e2b,
6517 fidl::encoding::DynamicFlags::empty(),
6518 _decode,
6519 )
6520 }
6521}
6522
6523pub struct ConnectionEventStream {
6524 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6525}
6526
6527impl std::marker::Unpin for ConnectionEventStream {}
6528
6529impl futures::stream::FusedStream for ConnectionEventStream {
6530 fn is_terminated(&self) -> bool {
6531 self.event_receiver.is_terminated()
6532 }
6533}
6534
6535impl futures::Stream for ConnectionEventStream {
6536 type Item = Result<ConnectionEvent, fidl::Error>;
6537
6538 fn poll_next(
6539 mut self: std::pin::Pin<&mut Self>,
6540 cx: &mut std::task::Context<'_>,
6541 ) -> std::task::Poll<Option<Self::Item>> {
6542 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6543 &mut self.event_receiver,
6544 cx
6545 )?) {
6546 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
6547 None => std::task::Poll::Ready(None),
6548 }
6549 }
6550}
6551
6552#[derive(Debug)]
6553pub enum ConnectionEvent {}
6554
6555impl ConnectionEvent {
6556 fn decode(
6558 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6559 ) -> Result<ConnectionEvent, fidl::Error> {
6560 let (bytes, _handles) = buf.split_mut();
6561 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6562 debug_assert_eq!(tx_header.tx_id, 0);
6563 match tx_header.ordinal {
6564 _ => Err(fidl::Error::UnknownOrdinal {
6565 ordinal: tx_header.ordinal,
6566 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6567 }),
6568 }
6569 }
6570}
6571
6572pub struct ConnectionRequestStream {
6574 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6575 is_terminated: bool,
6576}
6577
6578impl std::marker::Unpin for ConnectionRequestStream {}
6579
6580impl futures::stream::FusedStream for ConnectionRequestStream {
6581 fn is_terminated(&self) -> bool {
6582 self.is_terminated
6583 }
6584}
6585
6586impl fidl::endpoints::RequestStream for ConnectionRequestStream {
6587 type Protocol = ConnectionMarker;
6588 type ControlHandle = ConnectionControlHandle;
6589
6590 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6591 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6592 }
6593
6594 fn control_handle(&self) -> Self::ControlHandle {
6595 ConnectionControlHandle { inner: self.inner.clone() }
6596 }
6597
6598 fn into_inner(
6599 self,
6600 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6601 {
6602 (self.inner, self.is_terminated)
6603 }
6604
6605 fn from_inner(
6606 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6607 is_terminated: bool,
6608 ) -> Self {
6609 Self { inner, is_terminated }
6610 }
6611}
6612
6613impl futures::Stream for ConnectionRequestStream {
6614 type Item = Result<ConnectionRequest, fidl::Error>;
6615
6616 fn poll_next(
6617 mut self: std::pin::Pin<&mut Self>,
6618 cx: &mut std::task::Context<'_>,
6619 ) -> std::task::Poll<Option<Self::Item>> {
6620 let this = &mut *self;
6621 if this.inner.check_shutdown(cx) {
6622 this.is_terminated = true;
6623 return std::task::Poll::Ready(None);
6624 }
6625 if this.is_terminated {
6626 panic!("polled ConnectionRequestStream after completion");
6627 }
6628 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6629 |bytes, handles| {
6630 match this.inner.channel().read_etc(cx, bytes, handles) {
6631 std::task::Poll::Ready(Ok(())) => {}
6632 std::task::Poll::Pending => return std::task::Poll::Pending,
6633 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6634 this.is_terminated = true;
6635 return std::task::Poll::Ready(None);
6636 }
6637 std::task::Poll::Ready(Err(e)) => {
6638 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6639 e.into(),
6640 ))));
6641 }
6642 }
6643
6644 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6646
6647 std::task::Poll::Ready(Some(match header.ordinal {
6648 0x1cf34fdeed80b4d => {
6649 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6650 let mut req = fidl::new_empty!(
6651 CodecDelayGetCodecLocalDelayRangeRequest,
6652 fidl::encoding::DefaultFuchsiaResourceDialect
6653 );
6654 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
6655 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6656 Ok(ConnectionRequest::GetCodecLocalDelayRange {
6657 payload: req,
6658 responder: ConnectionGetCodecLocalDelayRangeResponder {
6659 control_handle: std::mem::ManuallyDrop::new(control_handle),
6660 tx_id: header.tx_id,
6661 },
6662 })
6663 }
6664 0x2a670e0fec6ccc6b => {
6665 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6666 let mut req = fidl::new_empty!(
6667 ConnectionRequestGattClientRequest,
6668 fidl::encoding::DefaultFuchsiaResourceDialect
6669 );
6670 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionRequestGattClientRequest>(&header, _body_bytes, handles, &mut req)?;
6671 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6672 Ok(ConnectionRequest::RequestGattClient {
6673 client: req.client,
6674
6675 control_handle,
6676 })
6677 }
6678 0x7e6338c237088144 => {
6679 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6680 let mut req = fidl::new_empty!(
6681 ConnectionAcceptCisRequest,
6682 fidl::encoding::DefaultFuchsiaResourceDialect
6683 );
6684 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptCisRequest>(&header, _body_bytes, handles, &mut req)?;
6685 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6686 Ok(ConnectionRequest::AcceptCis { payload: req, control_handle })
6687 }
6688 0x12351316feaebce9 => {
6689 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6690 let mut req = fidl::new_empty!(
6691 ConnectionConnectL2capRequest,
6692 fidl::encoding::DefaultFuchsiaResourceDialect
6693 );
6694 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionConnectL2capRequest>(&header, _body_bytes, handles, &mut req)?;
6695 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6696 Ok(ConnectionRequest::ConnectL2cap { payload: req, control_handle })
6697 }
6698 0x1117a10b5ba1e219 => {
6699 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6700 let mut req = fidl::new_empty!(
6701 ConnectionTransferPeriodicAdvertisingSyncRequest,
6702 fidl::encoding::DefaultFuchsiaResourceDialect
6703 );
6704 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionTransferPeriodicAdvertisingSyncRequest>(&header, _body_bytes, handles, &mut req)?;
6705 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6706 Ok(ConnectionRequest::TransferPeriodicAdvertisingSync {
6707 payload: req,
6708 responder: ConnectionTransferPeriodicAdvertisingSyncResponder {
6709 control_handle: std::mem::ManuallyDrop::new(control_handle),
6710 tx_id: header.tx_id,
6711 },
6712 })
6713 }
6714 0x441a31a7effa7e2b => {
6715 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6716 let mut req = fidl::new_empty!(
6717 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6718 fidl::encoding::DefaultFuchsiaResourceDialect
6719 );
6720 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(&header, _body_bytes, handles, &mut req)?;
6721 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
6722 Ok(ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer {
6723 payload: req,
6724 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6725 control_handle: std::mem::ManuallyDrop::new(control_handle),
6726 tx_id: header.tx_id,
6727 },
6728 })
6729 }
6730 _ => Err(fidl::Error::UnknownOrdinal {
6731 ordinal: header.ordinal,
6732 protocol_name:
6733 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6734 }),
6735 }))
6736 },
6737 )
6738 }
6739}
6740
6741#[derive(Debug)]
6747pub enum ConnectionRequest {
6748 GetCodecLocalDelayRange {
6756 payload: CodecDelayGetCodecLocalDelayRangeRequest,
6757 responder: ConnectionGetCodecLocalDelayRangeResponder,
6758 },
6759 RequestGattClient {
6763 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6764 control_handle: ConnectionControlHandle,
6765 },
6766 AcceptCis { payload: ConnectionAcceptCisRequest, control_handle: ConnectionControlHandle },
6781 ConnectL2cap { payload: ConnectionConnectL2capRequest, control_handle: ConnectionControlHandle },
6783 TransferPeriodicAdvertisingSync {
6786 payload: ConnectionTransferPeriodicAdvertisingSyncRequest,
6787 responder: ConnectionTransferPeriodicAdvertisingSyncResponder,
6788 },
6789 AcceptPeriodicAdvertisingSyncTransfer {
6792 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6793 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6794 },
6795}
6796
6797impl ConnectionRequest {
6798 #[allow(irrefutable_let_patterns)]
6799 pub fn into_get_codec_local_delay_range(
6800 self,
6801 ) -> Option<(
6802 CodecDelayGetCodecLocalDelayRangeRequest,
6803 ConnectionGetCodecLocalDelayRangeResponder,
6804 )> {
6805 if let ConnectionRequest::GetCodecLocalDelayRange { payload, responder } = self {
6806 Some((payload, responder))
6807 } else {
6808 None
6809 }
6810 }
6811
6812 #[allow(irrefutable_let_patterns)]
6813 pub fn into_request_gatt_client(
6814 self,
6815 ) -> Option<(
6816 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6817 ConnectionControlHandle,
6818 )> {
6819 if let ConnectionRequest::RequestGattClient { client, control_handle } = self {
6820 Some((client, control_handle))
6821 } else {
6822 None
6823 }
6824 }
6825
6826 #[allow(irrefutable_let_patterns)]
6827 pub fn into_accept_cis(self) -> Option<(ConnectionAcceptCisRequest, ConnectionControlHandle)> {
6828 if let ConnectionRequest::AcceptCis { payload, control_handle } = self {
6829 Some((payload, control_handle))
6830 } else {
6831 None
6832 }
6833 }
6834
6835 #[allow(irrefutable_let_patterns)]
6836 pub fn into_connect_l2cap(
6837 self,
6838 ) -> Option<(ConnectionConnectL2capRequest, ConnectionControlHandle)> {
6839 if let ConnectionRequest::ConnectL2cap { payload, control_handle } = self {
6840 Some((payload, control_handle))
6841 } else {
6842 None
6843 }
6844 }
6845
6846 #[allow(irrefutable_let_patterns)]
6847 pub fn into_transfer_periodic_advertising_sync(
6848 self,
6849 ) -> Option<(
6850 ConnectionTransferPeriodicAdvertisingSyncRequest,
6851 ConnectionTransferPeriodicAdvertisingSyncResponder,
6852 )> {
6853 if let ConnectionRequest::TransferPeriodicAdvertisingSync { payload, responder } = self {
6854 Some((payload, responder))
6855 } else {
6856 None
6857 }
6858 }
6859
6860 #[allow(irrefutable_let_patterns)]
6861 pub fn into_accept_periodic_advertising_sync_transfer(
6862 self,
6863 ) -> Option<(
6864 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6865 ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6866 )> {
6867 if let ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { payload, responder } =
6868 self
6869 {
6870 Some((payload, responder))
6871 } else {
6872 None
6873 }
6874 }
6875
6876 pub fn method_name(&self) -> &'static str {
6878 match *self {
6879 ConnectionRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
6880 ConnectionRequest::RequestGattClient { .. } => "request_gatt_client",
6881 ConnectionRequest::AcceptCis { .. } => "accept_cis",
6882 ConnectionRequest::ConnectL2cap { .. } => "connect_l2cap",
6883 ConnectionRequest::TransferPeriodicAdvertisingSync { .. } => {
6884 "transfer_periodic_advertising_sync"
6885 }
6886 ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { .. } => {
6887 "accept_periodic_advertising_sync_transfer"
6888 }
6889 }
6890 }
6891}
6892
6893#[derive(Debug, Clone)]
6894pub struct ConnectionControlHandle {
6895 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6896}
6897
6898impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
6899 fn shutdown(&self) {
6900 self.inner.shutdown()
6901 }
6902
6903 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6904 self.inner.shutdown_with_epitaph(status)
6905 }
6906
6907 fn is_closed(&self) -> bool {
6908 self.inner.channel().is_closed()
6909 }
6910 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6911 self.inner.channel().on_closed()
6912 }
6913
6914 #[cfg(target_os = "fuchsia")]
6915 fn signal_peer(
6916 &self,
6917 clear_mask: zx::Signals,
6918 set_mask: zx::Signals,
6919 ) -> Result<(), zx_status::Status> {
6920 use fidl::Peered;
6921 self.inner.channel().signal_peer(clear_mask, set_mask)
6922 }
6923}
6924
6925impl ConnectionControlHandle {}
6926
6927#[must_use = "FIDL methods require a response to be sent"]
6928#[derive(Debug)]
6929pub struct ConnectionGetCodecLocalDelayRangeResponder {
6930 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
6931 tx_id: u32,
6932}
6933
6934impl std::ops::Drop for ConnectionGetCodecLocalDelayRangeResponder {
6938 fn drop(&mut self) {
6939 self.control_handle.shutdown();
6940 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6942 }
6943}
6944
6945impl fidl::endpoints::Responder for ConnectionGetCodecLocalDelayRangeResponder {
6946 type ControlHandle = ConnectionControlHandle;
6947
6948 fn control_handle(&self) -> &ConnectionControlHandle {
6949 &self.control_handle
6950 }
6951
6952 fn drop_without_shutdown(mut self) {
6953 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6955 std::mem::forget(self);
6957 }
6958}
6959
6960impl ConnectionGetCodecLocalDelayRangeResponder {
6961 pub fn send(
6965 self,
6966 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6967 ) -> Result<(), fidl::Error> {
6968 let _result = self.send_raw(result);
6969 if _result.is_err() {
6970 self.control_handle.shutdown();
6971 }
6972 self.drop_without_shutdown();
6973 _result
6974 }
6975
6976 pub fn send_no_shutdown_on_err(
6978 self,
6979 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6980 ) -> Result<(), fidl::Error> {
6981 let _result = self.send_raw(result);
6982 self.drop_without_shutdown();
6983 _result
6984 }
6985
6986 fn send_raw(
6987 &self,
6988 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6989 ) -> Result<(), fidl::Error> {
6990 self.control_handle.inner.send::<fidl::encoding::ResultType<
6991 CodecDelayGetCodecLocalDelayRangeResponse,
6992 i32,
6993 >>(
6994 result,
6995 self.tx_id,
6996 0x1cf34fdeed80b4d,
6997 fidl::encoding::DynamicFlags::empty(),
6998 )
6999 }
7000}
7001
7002#[must_use = "FIDL methods require a response to be sent"]
7003#[derive(Debug)]
7004pub struct ConnectionTransferPeriodicAdvertisingSyncResponder {
7005 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
7006 tx_id: u32,
7007}
7008
7009impl std::ops::Drop for ConnectionTransferPeriodicAdvertisingSyncResponder {
7013 fn drop(&mut self) {
7014 self.control_handle.shutdown();
7015 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7017 }
7018}
7019
7020impl fidl::endpoints::Responder for ConnectionTransferPeriodicAdvertisingSyncResponder {
7021 type ControlHandle = ConnectionControlHandle;
7022
7023 fn control_handle(&self) -> &ConnectionControlHandle {
7024 &self.control_handle
7025 }
7026
7027 fn drop_without_shutdown(mut self) {
7028 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7030 std::mem::forget(self);
7032 }
7033}
7034
7035impl ConnectionTransferPeriodicAdvertisingSyncResponder {
7036 pub fn send(
7040 self,
7041 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7042 ) -> Result<(), fidl::Error> {
7043 let _result = self.send_raw(result);
7044 if _result.is_err() {
7045 self.control_handle.shutdown();
7046 }
7047 self.drop_without_shutdown();
7048 _result
7049 }
7050
7051 pub fn send_no_shutdown_on_err(
7053 self,
7054 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7055 ) -> Result<(), fidl::Error> {
7056 let _result = self.send_raw(result);
7057 self.drop_without_shutdown();
7058 _result
7059 }
7060
7061 fn send_raw(
7062 &self,
7063 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7064 ) -> Result<(), fidl::Error> {
7065 self.control_handle.inner.send::<fidl::encoding::ResultType<
7066 fidl::encoding::EmptyStruct,
7067 PeriodicAdvertisingSyncTransferError,
7068 >>(
7069 result,
7070 self.tx_id,
7071 0x1117a10b5ba1e219,
7072 fidl::encoding::DynamicFlags::empty(),
7073 )
7074 }
7075}
7076
7077#[must_use = "FIDL methods require a response to be sent"]
7078#[derive(Debug)]
7079pub struct ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7080 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
7081 tx_id: u32,
7082}
7083
7084impl std::ops::Drop for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7088 fn drop(&mut self) {
7089 self.control_handle.shutdown();
7090 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7092 }
7093}
7094
7095impl fidl::endpoints::Responder for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7096 type ControlHandle = ConnectionControlHandle;
7097
7098 fn control_handle(&self) -> &ConnectionControlHandle {
7099 &self.control_handle
7100 }
7101
7102 fn drop_without_shutdown(mut self) {
7103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7105 std::mem::forget(self);
7107 }
7108}
7109
7110impl ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
7111 pub fn send(
7115 self,
7116 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7117 ) -> Result<(), fidl::Error> {
7118 let _result = self.send_raw(result);
7119 if _result.is_err() {
7120 self.control_handle.shutdown();
7121 }
7122 self.drop_without_shutdown();
7123 _result
7124 }
7125
7126 pub fn send_no_shutdown_on_err(
7128 self,
7129 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7130 ) -> Result<(), fidl::Error> {
7131 let _result = self.send_raw(result);
7132 self.drop_without_shutdown();
7133 _result
7134 }
7135
7136 fn send_raw(
7137 &self,
7138 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
7139 ) -> Result<(), fidl::Error> {
7140 self.control_handle.inner.send::<fidl::encoding::ResultType<
7141 fidl::encoding::EmptyStruct,
7142 PeriodicAdvertisingSyncTransferError,
7143 >>(
7144 result,
7145 self.tx_id,
7146 0x441a31a7effa7e2b,
7147 fidl::encoding::DynamicFlags::empty(),
7148 )
7149 }
7150}
7151
7152#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7153pub struct IsochronousStreamMarker;
7154
7155impl fidl::endpoints::ProtocolMarker for IsochronousStreamMarker {
7156 type Proxy = IsochronousStreamProxy;
7157 type RequestStream = IsochronousStreamRequestStream;
7158 #[cfg(target_os = "fuchsia")]
7159 type SynchronousProxy = IsochronousStreamSynchronousProxy;
7160
7161 const DEBUG_NAME: &'static str = "(anonymous) IsochronousStream";
7162}
7163pub type IsochronousStreamSetupDataPathResult = Result<(), i32>;
7164pub type IsochronousStreamWriteResult = Result<(), i32>;
7165
7166pub trait IsochronousStreamProxyInterface: Send + Sync {
7167 type SetupDataPathResponseFut: std::future::Future<Output = Result<IsochronousStreamSetupDataPathResult, fidl::Error>>
7168 + Send;
7169 fn r#setup_data_path(
7170 &self,
7171 payload: &IsochronousStreamSetupDataPathRequest,
7172 ) -> Self::SetupDataPathResponseFut;
7173 type ReadResponseFut: std::future::Future<Output = Result<IsochronousStreamReadResponse, fidl::Error>>
7174 + Send;
7175 fn r#read(&self) -> Self::ReadResponseFut;
7176 type WriteResponseFut: std::future::Future<Output = Result<IsochronousStreamWriteResult, fidl::Error>>
7177 + Send;
7178 fn r#write(&self, payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut;
7179}
7180#[derive(Debug)]
7181#[cfg(target_os = "fuchsia")]
7182pub struct IsochronousStreamSynchronousProxy {
7183 client: fidl::client::sync::Client,
7184}
7185
7186#[cfg(target_os = "fuchsia")]
7187impl fidl::endpoints::SynchronousProxy for IsochronousStreamSynchronousProxy {
7188 type Proxy = IsochronousStreamProxy;
7189 type Protocol = IsochronousStreamMarker;
7190
7191 fn from_channel(inner: fidl::Channel) -> Self {
7192 Self::new(inner)
7193 }
7194
7195 fn into_channel(self) -> fidl::Channel {
7196 self.client.into_channel()
7197 }
7198
7199 fn as_channel(&self) -> &fidl::Channel {
7200 self.client.as_channel()
7201 }
7202}
7203
7204#[cfg(target_os = "fuchsia")]
7205impl IsochronousStreamSynchronousProxy {
7206 pub fn new(channel: fidl::Channel) -> Self {
7207 let protocol_name =
7208 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7209 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7210 }
7211
7212 pub fn into_channel(self) -> fidl::Channel {
7213 self.client.into_channel()
7214 }
7215
7216 pub fn wait_for_event(
7219 &self,
7220 deadline: zx::MonotonicInstant,
7221 ) -> Result<IsochronousStreamEvent, fidl::Error> {
7222 IsochronousStreamEvent::decode(self.client.wait_for_event(deadline)?)
7223 }
7224
7225 pub fn r#setup_data_path(
7237 &self,
7238 mut payload: &IsochronousStreamSetupDataPathRequest,
7239 ___deadline: zx::MonotonicInstant,
7240 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
7241 let _response = self.client.send_query::<
7242 IsochronousStreamSetupDataPathRequest,
7243 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7244 >(
7245 payload,
7246 0x7ec1e2b9cc6d2fbe,
7247 fidl::encoding::DynamicFlags::FLEXIBLE,
7248 ___deadline,
7249 )?
7250 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
7251 Ok(_response.map(|x| x))
7252 }
7253
7254 pub fn r#read(
7260 &self,
7261 ___deadline: zx::MonotonicInstant,
7262 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
7263 let _response = self.client.send_query::<
7264 fidl::encoding::EmptyPayload,
7265 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
7266 >(
7267 (),
7268 0x6d7d8b4950ed3a32,
7269 fidl::encoding::DynamicFlags::FLEXIBLE,
7270 ___deadline,
7271 )?
7272 .into_result::<IsochronousStreamMarker>("read")?;
7273 Ok(_response)
7274 }
7275
7276 pub fn r#write(
7280 &self,
7281 mut payload: &IsochronousStreamWriteRequest,
7282 ___deadline: zx::MonotonicInstant,
7283 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
7284 let _response = self.client.send_query::<
7285 IsochronousStreamWriteRequest,
7286 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7287 >(
7288 payload,
7289 0x5282e90b667d0d43,
7290 fidl::encoding::DynamicFlags::FLEXIBLE,
7291 ___deadline,
7292 )?
7293 .into_result::<IsochronousStreamMarker>("write")?;
7294 Ok(_response.map(|x| x))
7295 }
7296}
7297
7298#[cfg(target_os = "fuchsia")]
7299impl From<IsochronousStreamSynchronousProxy> for zx::NullableHandle {
7300 fn from(value: IsochronousStreamSynchronousProxy) -> Self {
7301 value.into_channel().into()
7302 }
7303}
7304
7305#[cfg(target_os = "fuchsia")]
7306impl From<fidl::Channel> for IsochronousStreamSynchronousProxy {
7307 fn from(value: fidl::Channel) -> Self {
7308 Self::new(value)
7309 }
7310}
7311
7312#[cfg(target_os = "fuchsia")]
7313impl fidl::endpoints::FromClient for IsochronousStreamSynchronousProxy {
7314 type Protocol = IsochronousStreamMarker;
7315
7316 fn from_client(value: fidl::endpoints::ClientEnd<IsochronousStreamMarker>) -> Self {
7317 Self::new(value.into_channel())
7318 }
7319}
7320
7321#[derive(Debug, Clone)]
7322pub struct IsochronousStreamProxy {
7323 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7324}
7325
7326impl fidl::endpoints::Proxy for IsochronousStreamProxy {
7327 type Protocol = IsochronousStreamMarker;
7328
7329 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7330 Self::new(inner)
7331 }
7332
7333 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7334 self.client.into_channel().map_err(|client| Self { client })
7335 }
7336
7337 fn as_channel(&self) -> &::fidl::AsyncChannel {
7338 self.client.as_channel()
7339 }
7340}
7341
7342impl IsochronousStreamProxy {
7343 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7345 let protocol_name =
7346 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7347 Self { client: fidl::client::Client::new(channel, protocol_name) }
7348 }
7349
7350 pub fn take_event_stream(&self) -> IsochronousStreamEventStream {
7356 IsochronousStreamEventStream { event_receiver: self.client.take_event_receiver() }
7357 }
7358
7359 pub fn r#setup_data_path(
7371 &self,
7372 mut payload: &IsochronousStreamSetupDataPathRequest,
7373 ) -> fidl::client::QueryResponseFut<
7374 IsochronousStreamSetupDataPathResult,
7375 fidl::encoding::DefaultFuchsiaResourceDialect,
7376 > {
7377 IsochronousStreamProxyInterface::r#setup_data_path(self, payload)
7378 }
7379
7380 pub fn r#read(
7386 &self,
7387 ) -> fidl::client::QueryResponseFut<
7388 IsochronousStreamReadResponse,
7389 fidl::encoding::DefaultFuchsiaResourceDialect,
7390 > {
7391 IsochronousStreamProxyInterface::r#read(self)
7392 }
7393
7394 pub fn r#write(
7398 &self,
7399 mut payload: &IsochronousStreamWriteRequest,
7400 ) -> fidl::client::QueryResponseFut<
7401 IsochronousStreamWriteResult,
7402 fidl::encoding::DefaultFuchsiaResourceDialect,
7403 > {
7404 IsochronousStreamProxyInterface::r#write(self, payload)
7405 }
7406}
7407
7408impl IsochronousStreamProxyInterface for IsochronousStreamProxy {
7409 type SetupDataPathResponseFut = fidl::client::QueryResponseFut<
7410 IsochronousStreamSetupDataPathResult,
7411 fidl::encoding::DefaultFuchsiaResourceDialect,
7412 >;
7413 fn r#setup_data_path(
7414 &self,
7415 mut payload: &IsochronousStreamSetupDataPathRequest,
7416 ) -> Self::SetupDataPathResponseFut {
7417 fn _decode(
7418 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7419 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
7420 let _response = fidl::client::decode_transaction_body::<
7421 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7422 fidl::encoding::DefaultFuchsiaResourceDialect,
7423 0x7ec1e2b9cc6d2fbe,
7424 >(_buf?)?
7425 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
7426 Ok(_response.map(|x| x))
7427 }
7428 self.client.send_query_and_decode::<
7429 IsochronousStreamSetupDataPathRequest,
7430 IsochronousStreamSetupDataPathResult,
7431 >(
7432 payload,
7433 0x7ec1e2b9cc6d2fbe,
7434 fidl::encoding::DynamicFlags::FLEXIBLE,
7435 _decode,
7436 )
7437 }
7438
7439 type ReadResponseFut = fidl::client::QueryResponseFut<
7440 IsochronousStreamReadResponse,
7441 fidl::encoding::DefaultFuchsiaResourceDialect,
7442 >;
7443 fn r#read(&self) -> Self::ReadResponseFut {
7444 fn _decode(
7445 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7446 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
7447 let _response = fidl::client::decode_transaction_body::<
7448 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
7449 fidl::encoding::DefaultFuchsiaResourceDialect,
7450 0x6d7d8b4950ed3a32,
7451 >(_buf?)?
7452 .into_result::<IsochronousStreamMarker>("read")?;
7453 Ok(_response)
7454 }
7455 self.client
7456 .send_query_and_decode::<fidl::encoding::EmptyPayload, IsochronousStreamReadResponse>(
7457 (),
7458 0x6d7d8b4950ed3a32,
7459 fidl::encoding::DynamicFlags::FLEXIBLE,
7460 _decode,
7461 )
7462 }
7463
7464 type WriteResponseFut = fidl::client::QueryResponseFut<
7465 IsochronousStreamWriteResult,
7466 fidl::encoding::DefaultFuchsiaResourceDialect,
7467 >;
7468 fn r#write(&self, mut payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut {
7469 fn _decode(
7470 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7471 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
7472 let _response = fidl::client::decode_transaction_body::<
7473 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7474 fidl::encoding::DefaultFuchsiaResourceDialect,
7475 0x5282e90b667d0d43,
7476 >(_buf?)?
7477 .into_result::<IsochronousStreamMarker>("write")?;
7478 Ok(_response.map(|x| x))
7479 }
7480 self.client
7481 .send_query_and_decode::<IsochronousStreamWriteRequest, IsochronousStreamWriteResult>(
7482 payload,
7483 0x5282e90b667d0d43,
7484 fidl::encoding::DynamicFlags::FLEXIBLE,
7485 _decode,
7486 )
7487 }
7488}
7489
7490pub struct IsochronousStreamEventStream {
7491 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7492}
7493
7494impl std::marker::Unpin for IsochronousStreamEventStream {}
7495
7496impl futures::stream::FusedStream for IsochronousStreamEventStream {
7497 fn is_terminated(&self) -> bool {
7498 self.event_receiver.is_terminated()
7499 }
7500}
7501
7502impl futures::Stream for IsochronousStreamEventStream {
7503 type Item = Result<IsochronousStreamEvent, fidl::Error>;
7504
7505 fn poll_next(
7506 mut self: std::pin::Pin<&mut Self>,
7507 cx: &mut std::task::Context<'_>,
7508 ) -> std::task::Poll<Option<Self::Item>> {
7509 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7510 &mut self.event_receiver,
7511 cx
7512 )?) {
7513 Some(buf) => std::task::Poll::Ready(Some(IsochronousStreamEvent::decode(buf))),
7514 None => std::task::Poll::Ready(None),
7515 }
7516 }
7517}
7518
7519#[derive(Debug)]
7520pub enum IsochronousStreamEvent {
7521 OnEstablished {
7522 payload: IsochronousStreamOnEstablishedRequest,
7523 },
7524 #[non_exhaustive]
7525 _UnknownEvent {
7526 ordinal: u64,
7528 },
7529}
7530
7531impl IsochronousStreamEvent {
7532 #[allow(irrefutable_let_patterns)]
7533 pub fn into_on_established(self) -> Option<IsochronousStreamOnEstablishedRequest> {
7534 if let IsochronousStreamEvent::OnEstablished { payload } = self {
7535 Some((payload))
7536 } else {
7537 None
7538 }
7539 }
7540
7541 fn decode(
7543 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7544 ) -> Result<IsochronousStreamEvent, fidl::Error> {
7545 let (bytes, _handles) = buf.split_mut();
7546 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7547 debug_assert_eq!(tx_header.tx_id, 0);
7548 match tx_header.ordinal {
7549 0x341c50e9d10f3421 => {
7550 let mut out = fidl::new_empty!(
7551 IsochronousStreamOnEstablishedRequest,
7552 fidl::encoding::DefaultFuchsiaResourceDialect
7553 );
7554 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7555 Ok((IsochronousStreamEvent::OnEstablished { payload: out }))
7556 }
7557 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7558 Ok(IsochronousStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7559 }
7560 _ => Err(fidl::Error::UnknownOrdinal {
7561 ordinal: tx_header.ordinal,
7562 protocol_name:
7563 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7564 }),
7565 }
7566 }
7567}
7568
7569pub struct IsochronousStreamRequestStream {
7571 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7572 is_terminated: bool,
7573}
7574
7575impl std::marker::Unpin for IsochronousStreamRequestStream {}
7576
7577impl futures::stream::FusedStream for IsochronousStreamRequestStream {
7578 fn is_terminated(&self) -> bool {
7579 self.is_terminated
7580 }
7581}
7582
7583impl fidl::endpoints::RequestStream for IsochronousStreamRequestStream {
7584 type Protocol = IsochronousStreamMarker;
7585 type ControlHandle = IsochronousStreamControlHandle;
7586
7587 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7588 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7589 }
7590
7591 fn control_handle(&self) -> Self::ControlHandle {
7592 IsochronousStreamControlHandle { inner: self.inner.clone() }
7593 }
7594
7595 fn into_inner(
7596 self,
7597 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7598 {
7599 (self.inner, self.is_terminated)
7600 }
7601
7602 fn from_inner(
7603 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7604 is_terminated: bool,
7605 ) -> Self {
7606 Self { inner, is_terminated }
7607 }
7608}
7609
7610impl futures::Stream for IsochronousStreamRequestStream {
7611 type Item = Result<IsochronousStreamRequest, fidl::Error>;
7612
7613 fn poll_next(
7614 mut self: std::pin::Pin<&mut Self>,
7615 cx: &mut std::task::Context<'_>,
7616 ) -> std::task::Poll<Option<Self::Item>> {
7617 let this = &mut *self;
7618 if this.inner.check_shutdown(cx) {
7619 this.is_terminated = true;
7620 return std::task::Poll::Ready(None);
7621 }
7622 if this.is_terminated {
7623 panic!("polled IsochronousStreamRequestStream after completion");
7624 }
7625 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7626 |bytes, handles| {
7627 match this.inner.channel().read_etc(cx, bytes, handles) {
7628 std::task::Poll::Ready(Ok(())) => {}
7629 std::task::Poll::Pending => return std::task::Poll::Pending,
7630 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7631 this.is_terminated = true;
7632 return std::task::Poll::Ready(None);
7633 }
7634 std::task::Poll::Ready(Err(e)) => {
7635 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7636 e.into(),
7637 ))));
7638 }
7639 }
7640
7641 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7643
7644 std::task::Poll::Ready(Some(match header.ordinal {
7645 0x7ec1e2b9cc6d2fbe => {
7646 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7647 let mut req = fidl::new_empty!(
7648 IsochronousStreamSetupDataPathRequest,
7649 fidl::encoding::DefaultFuchsiaResourceDialect
7650 );
7651 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamSetupDataPathRequest>(&header, _body_bytes, handles, &mut req)?;
7652 let control_handle =
7653 IsochronousStreamControlHandle { inner: this.inner.clone() };
7654 Ok(IsochronousStreamRequest::SetupDataPath {
7655 payload: req,
7656 responder: IsochronousStreamSetupDataPathResponder {
7657 control_handle: std::mem::ManuallyDrop::new(control_handle),
7658 tx_id: header.tx_id,
7659 },
7660 })
7661 }
7662 0x6d7d8b4950ed3a32 => {
7663 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7664 let mut req = fidl::new_empty!(
7665 fidl::encoding::EmptyPayload,
7666 fidl::encoding::DefaultFuchsiaResourceDialect
7667 );
7668 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7669 let control_handle =
7670 IsochronousStreamControlHandle { inner: this.inner.clone() };
7671 Ok(IsochronousStreamRequest::Read {
7672 responder: IsochronousStreamReadResponder {
7673 control_handle: std::mem::ManuallyDrop::new(control_handle),
7674 tx_id: header.tx_id,
7675 },
7676 })
7677 }
7678 0x5282e90b667d0d43 => {
7679 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7680 let mut req = fidl::new_empty!(
7681 IsochronousStreamWriteRequest,
7682 fidl::encoding::DefaultFuchsiaResourceDialect
7683 );
7684 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamWriteRequest>(&header, _body_bytes, handles, &mut req)?;
7685 let control_handle =
7686 IsochronousStreamControlHandle { inner: this.inner.clone() };
7687 Ok(IsochronousStreamRequest::Write {
7688 payload: req,
7689 responder: IsochronousStreamWriteResponder {
7690 control_handle: std::mem::ManuallyDrop::new(control_handle),
7691 tx_id: header.tx_id,
7692 },
7693 })
7694 }
7695 _ if header.tx_id == 0
7696 && header
7697 .dynamic_flags()
7698 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7699 {
7700 Ok(IsochronousStreamRequest::_UnknownMethod {
7701 ordinal: header.ordinal,
7702 control_handle: IsochronousStreamControlHandle {
7703 inner: this.inner.clone(),
7704 },
7705 method_type: fidl::MethodType::OneWay,
7706 })
7707 }
7708 _ if header
7709 .dynamic_flags()
7710 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7711 {
7712 this.inner.send_framework_err(
7713 fidl::encoding::FrameworkErr::UnknownMethod,
7714 header.tx_id,
7715 header.ordinal,
7716 header.dynamic_flags(),
7717 (bytes, handles),
7718 )?;
7719 Ok(IsochronousStreamRequest::_UnknownMethod {
7720 ordinal: header.ordinal,
7721 control_handle: IsochronousStreamControlHandle {
7722 inner: this.inner.clone(),
7723 },
7724 method_type: fidl::MethodType::TwoWay,
7725 })
7726 }
7727 _ => Err(fidl::Error::UnknownOrdinal {
7728 ordinal: header.ordinal,
7729 protocol_name:
7730 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7731 }),
7732 }))
7733 },
7734 )
7735 }
7736}
7737
7738#[derive(Debug)]
7739pub enum IsochronousStreamRequest {
7740 SetupDataPath {
7752 payload: IsochronousStreamSetupDataPathRequest,
7753 responder: IsochronousStreamSetupDataPathResponder,
7754 },
7755 Read { responder: IsochronousStreamReadResponder },
7761 Write { payload: IsochronousStreamWriteRequest, responder: IsochronousStreamWriteResponder },
7765 #[non_exhaustive]
7767 _UnknownMethod {
7768 ordinal: u64,
7770 control_handle: IsochronousStreamControlHandle,
7771 method_type: fidl::MethodType,
7772 },
7773}
7774
7775impl IsochronousStreamRequest {
7776 #[allow(irrefutable_let_patterns)]
7777 pub fn into_setup_data_path(
7778 self,
7779 ) -> Option<(IsochronousStreamSetupDataPathRequest, IsochronousStreamSetupDataPathResponder)>
7780 {
7781 if let IsochronousStreamRequest::SetupDataPath { payload, responder } = self {
7782 Some((payload, responder))
7783 } else {
7784 None
7785 }
7786 }
7787
7788 #[allow(irrefutable_let_patterns)]
7789 pub fn into_read(self) -> Option<(IsochronousStreamReadResponder)> {
7790 if let IsochronousStreamRequest::Read { responder } = self {
7791 Some((responder))
7792 } else {
7793 None
7794 }
7795 }
7796
7797 #[allow(irrefutable_let_patterns)]
7798 pub fn into_write(
7799 self,
7800 ) -> Option<(IsochronousStreamWriteRequest, IsochronousStreamWriteResponder)> {
7801 if let IsochronousStreamRequest::Write { payload, responder } = self {
7802 Some((payload, responder))
7803 } else {
7804 None
7805 }
7806 }
7807
7808 pub fn method_name(&self) -> &'static str {
7810 match *self {
7811 IsochronousStreamRequest::SetupDataPath { .. } => "setup_data_path",
7812 IsochronousStreamRequest::Read { .. } => "read",
7813 IsochronousStreamRequest::Write { .. } => "write",
7814 IsochronousStreamRequest::_UnknownMethod {
7815 method_type: fidl::MethodType::OneWay,
7816 ..
7817 } => "unknown one-way method",
7818 IsochronousStreamRequest::_UnknownMethod {
7819 method_type: fidl::MethodType::TwoWay,
7820 ..
7821 } => "unknown two-way method",
7822 }
7823 }
7824}
7825
7826#[derive(Debug, Clone)]
7827pub struct IsochronousStreamControlHandle {
7828 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7829}
7830
7831impl fidl::endpoints::ControlHandle for IsochronousStreamControlHandle {
7832 fn shutdown(&self) {
7833 self.inner.shutdown()
7834 }
7835
7836 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7837 self.inner.shutdown_with_epitaph(status)
7838 }
7839
7840 fn is_closed(&self) -> bool {
7841 self.inner.channel().is_closed()
7842 }
7843 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7844 self.inner.channel().on_closed()
7845 }
7846
7847 #[cfg(target_os = "fuchsia")]
7848 fn signal_peer(
7849 &self,
7850 clear_mask: zx::Signals,
7851 set_mask: zx::Signals,
7852 ) -> Result<(), zx_status::Status> {
7853 use fidl::Peered;
7854 self.inner.channel().signal_peer(clear_mask, set_mask)
7855 }
7856}
7857
7858impl IsochronousStreamControlHandle {
7859 pub fn send_on_established(
7860 &self,
7861 mut payload: &IsochronousStreamOnEstablishedRequest,
7862 ) -> Result<(), fidl::Error> {
7863 self.inner.send::<IsochronousStreamOnEstablishedRequest>(
7864 payload,
7865 0,
7866 0x341c50e9d10f3421,
7867 fidl::encoding::DynamicFlags::FLEXIBLE,
7868 )
7869 }
7870}
7871
7872#[must_use = "FIDL methods require a response to be sent"]
7873#[derive(Debug)]
7874pub struct IsochronousStreamSetupDataPathResponder {
7875 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7876 tx_id: u32,
7877}
7878
7879impl std::ops::Drop for IsochronousStreamSetupDataPathResponder {
7883 fn drop(&mut self) {
7884 self.control_handle.shutdown();
7885 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7887 }
7888}
7889
7890impl fidl::endpoints::Responder for IsochronousStreamSetupDataPathResponder {
7891 type ControlHandle = IsochronousStreamControlHandle;
7892
7893 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7894 &self.control_handle
7895 }
7896
7897 fn drop_without_shutdown(mut self) {
7898 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7900 std::mem::forget(self);
7902 }
7903}
7904
7905impl IsochronousStreamSetupDataPathResponder {
7906 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7910 let _result = self.send_raw(result);
7911 if _result.is_err() {
7912 self.control_handle.shutdown();
7913 }
7914 self.drop_without_shutdown();
7915 _result
7916 }
7917
7918 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7920 let _result = self.send_raw(result);
7921 self.drop_without_shutdown();
7922 _result
7923 }
7924
7925 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7926 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7927 fidl::encoding::EmptyStruct,
7928 i32,
7929 >>(
7930 fidl::encoding::FlexibleResult::new(result),
7931 self.tx_id,
7932 0x7ec1e2b9cc6d2fbe,
7933 fidl::encoding::DynamicFlags::FLEXIBLE,
7934 )
7935 }
7936}
7937
7938#[must_use = "FIDL methods require a response to be sent"]
7939#[derive(Debug)]
7940pub struct IsochronousStreamReadResponder {
7941 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7942 tx_id: u32,
7943}
7944
7945impl std::ops::Drop for IsochronousStreamReadResponder {
7949 fn drop(&mut self) {
7950 self.control_handle.shutdown();
7951 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7953 }
7954}
7955
7956impl fidl::endpoints::Responder for IsochronousStreamReadResponder {
7957 type ControlHandle = IsochronousStreamControlHandle;
7958
7959 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7960 &self.control_handle
7961 }
7962
7963 fn drop_without_shutdown(mut self) {
7964 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7966 std::mem::forget(self);
7968 }
7969}
7970
7971impl IsochronousStreamReadResponder {
7972 pub fn send(self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
7976 let _result = self.send_raw(payload);
7977 if _result.is_err() {
7978 self.control_handle.shutdown();
7979 }
7980 self.drop_without_shutdown();
7981 _result
7982 }
7983
7984 pub fn send_no_shutdown_on_err(
7986 self,
7987 mut payload: &IsochronousStreamReadResponse,
7988 ) -> Result<(), fidl::Error> {
7989 let _result = self.send_raw(payload);
7990 self.drop_without_shutdown();
7991 _result
7992 }
7993
7994 fn send_raw(&self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
7995 self.control_handle
7996 .inner
7997 .send::<fidl::encoding::FlexibleType<IsochronousStreamReadResponse>>(
7998 fidl::encoding::Flexible::new(payload),
7999 self.tx_id,
8000 0x6d7d8b4950ed3a32,
8001 fidl::encoding::DynamicFlags::FLEXIBLE,
8002 )
8003 }
8004}
8005
8006#[must_use = "FIDL methods require a response to be sent"]
8007#[derive(Debug)]
8008pub struct IsochronousStreamWriteResponder {
8009 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
8010 tx_id: u32,
8011}
8012
8013impl std::ops::Drop for IsochronousStreamWriteResponder {
8017 fn drop(&mut self) {
8018 self.control_handle.shutdown();
8019 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8021 }
8022}
8023
8024impl fidl::endpoints::Responder for IsochronousStreamWriteResponder {
8025 type ControlHandle = IsochronousStreamControlHandle;
8026
8027 fn control_handle(&self) -> &IsochronousStreamControlHandle {
8028 &self.control_handle
8029 }
8030
8031 fn drop_without_shutdown(mut self) {
8032 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8034 std::mem::forget(self);
8036 }
8037}
8038
8039impl IsochronousStreamWriteResponder {
8040 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8044 let _result = self.send_raw(result);
8045 if _result.is_err() {
8046 self.control_handle.shutdown();
8047 }
8048 self.drop_without_shutdown();
8049 _result
8050 }
8051
8052 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8054 let _result = self.send_raw(result);
8055 self.drop_without_shutdown();
8056 _result
8057 }
8058
8059 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8060 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8061 fidl::encoding::EmptyStruct,
8062 i32,
8063 >>(
8064 fidl::encoding::FlexibleResult::new(result),
8065 self.tx_id,
8066 0x5282e90b667d0d43,
8067 fidl::encoding::DynamicFlags::FLEXIBLE,
8068 )
8069 }
8070}
8071
8072#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8073pub struct PeriodicAdvertisingSyncMarker;
8074
8075impl fidl::endpoints::ProtocolMarker for PeriodicAdvertisingSyncMarker {
8076 type Proxy = PeriodicAdvertisingSyncProxy;
8077 type RequestStream = PeriodicAdvertisingSyncRequestStream;
8078 #[cfg(target_os = "fuchsia")]
8079 type SynchronousProxy = PeriodicAdvertisingSyncSynchronousProxy;
8080
8081 const DEBUG_NAME: &'static str = "(anonymous) PeriodicAdvertisingSync";
8082}
8083pub type PeriodicAdvertisingSyncSyncToSubeventsResult = Result<(), i32>;
8084
8085pub trait PeriodicAdvertisingSyncProxyInterface: Send + Sync {
8086 type WatchAdvertisingReportResponseFut: std::future::Future<
8087 Output = Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error>,
8088 > + Send;
8089 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut;
8090 type SyncToSubeventsResponseFut: std::future::Future<
8091 Output = Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error>,
8092 > + Send;
8093 fn r#sync_to_subevents(
8094 &self,
8095 payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8096 ) -> Self::SyncToSubeventsResponseFut;
8097 fn r#cancel(&self) -> Result<(), fidl::Error>;
8098}
8099#[derive(Debug)]
8100#[cfg(target_os = "fuchsia")]
8101pub struct PeriodicAdvertisingSyncSynchronousProxy {
8102 client: fidl::client::sync::Client,
8103}
8104
8105#[cfg(target_os = "fuchsia")]
8106impl fidl::endpoints::SynchronousProxy for PeriodicAdvertisingSyncSynchronousProxy {
8107 type Proxy = PeriodicAdvertisingSyncProxy;
8108 type Protocol = PeriodicAdvertisingSyncMarker;
8109
8110 fn from_channel(inner: fidl::Channel) -> Self {
8111 Self::new(inner)
8112 }
8113
8114 fn into_channel(self) -> fidl::Channel {
8115 self.client.into_channel()
8116 }
8117
8118 fn as_channel(&self) -> &fidl::Channel {
8119 self.client.as_channel()
8120 }
8121}
8122
8123#[cfg(target_os = "fuchsia")]
8124impl PeriodicAdvertisingSyncSynchronousProxy {
8125 pub fn new(channel: fidl::Channel) -> Self {
8126 let protocol_name =
8127 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8128 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8129 }
8130
8131 pub fn into_channel(self) -> fidl::Channel {
8132 self.client.into_channel()
8133 }
8134
8135 pub fn wait_for_event(
8138 &self,
8139 deadline: zx::MonotonicInstant,
8140 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
8141 PeriodicAdvertisingSyncEvent::decode(self.client.wait_for_event(deadline)?)
8142 }
8143
8144 pub fn r#watch_advertising_report(
8147 &self,
8148 ___deadline: zx::MonotonicInstant,
8149 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
8150 let _response = self.client.send_query::<
8151 fidl::encoding::EmptyPayload,
8152 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
8153 >(
8154 (),
8155 0x2ea610fea0e7d337,
8156 fidl::encoding::DynamicFlags::FLEXIBLE,
8157 ___deadline,
8158 )?
8159 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
8160 Ok(_response)
8161 }
8162
8163 pub fn r#sync_to_subevents(
8166 &self,
8167 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8168 ___deadline: zx::MonotonicInstant,
8169 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
8170 let _response = self.client.send_query::<
8171 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8172 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
8173 >(
8174 payload,
8175 0x653c5dab1f1d80ed,
8176 fidl::encoding::DynamicFlags::FLEXIBLE,
8177 ___deadline,
8178 )?
8179 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
8180 Ok(_response.map(|x| x))
8181 }
8182
8183 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
8188 self.client.send::<fidl::encoding::EmptyPayload>(
8189 (),
8190 0xd617c037eaf5d92,
8191 fidl::encoding::DynamicFlags::FLEXIBLE,
8192 )
8193 }
8194}
8195
8196#[cfg(target_os = "fuchsia")]
8197impl From<PeriodicAdvertisingSyncSynchronousProxy> for zx::NullableHandle {
8198 fn from(value: PeriodicAdvertisingSyncSynchronousProxy) -> Self {
8199 value.into_channel().into()
8200 }
8201}
8202
8203#[cfg(target_os = "fuchsia")]
8204impl From<fidl::Channel> for PeriodicAdvertisingSyncSynchronousProxy {
8205 fn from(value: fidl::Channel) -> Self {
8206 Self::new(value)
8207 }
8208}
8209
8210#[cfg(target_os = "fuchsia")]
8211impl fidl::endpoints::FromClient for PeriodicAdvertisingSyncSynchronousProxy {
8212 type Protocol = PeriodicAdvertisingSyncMarker;
8213
8214 fn from_client(value: fidl::endpoints::ClientEnd<PeriodicAdvertisingSyncMarker>) -> Self {
8215 Self::new(value.into_channel())
8216 }
8217}
8218
8219#[derive(Debug, Clone)]
8220pub struct PeriodicAdvertisingSyncProxy {
8221 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8222}
8223
8224impl fidl::endpoints::Proxy for PeriodicAdvertisingSyncProxy {
8225 type Protocol = PeriodicAdvertisingSyncMarker;
8226
8227 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8228 Self::new(inner)
8229 }
8230
8231 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8232 self.client.into_channel().map_err(|client| Self { client })
8233 }
8234
8235 fn as_channel(&self) -> &::fidl::AsyncChannel {
8236 self.client.as_channel()
8237 }
8238}
8239
8240impl PeriodicAdvertisingSyncProxy {
8241 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8243 let protocol_name =
8244 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8245 Self { client: fidl::client::Client::new(channel, protocol_name) }
8246 }
8247
8248 pub fn take_event_stream(&self) -> PeriodicAdvertisingSyncEventStream {
8254 PeriodicAdvertisingSyncEventStream { event_receiver: self.client.take_event_receiver() }
8255 }
8256
8257 pub fn r#watch_advertising_report(
8260 &self,
8261 ) -> fidl::client::QueryResponseFut<
8262 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8263 fidl::encoding::DefaultFuchsiaResourceDialect,
8264 > {
8265 PeriodicAdvertisingSyncProxyInterface::r#watch_advertising_report(self)
8266 }
8267
8268 pub fn r#sync_to_subevents(
8271 &self,
8272 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8273 ) -> fidl::client::QueryResponseFut<
8274 PeriodicAdvertisingSyncSyncToSubeventsResult,
8275 fidl::encoding::DefaultFuchsiaResourceDialect,
8276 > {
8277 PeriodicAdvertisingSyncProxyInterface::r#sync_to_subevents(self, payload)
8278 }
8279
8280 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
8285 PeriodicAdvertisingSyncProxyInterface::r#cancel(self)
8286 }
8287}
8288
8289impl PeriodicAdvertisingSyncProxyInterface for PeriodicAdvertisingSyncProxy {
8290 type WatchAdvertisingReportResponseFut = fidl::client::QueryResponseFut<
8291 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8292 fidl::encoding::DefaultFuchsiaResourceDialect,
8293 >;
8294 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut {
8295 fn _decode(
8296 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8297 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
8298 let _response = fidl::client::decode_transaction_body::<
8299 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
8300 fidl::encoding::DefaultFuchsiaResourceDialect,
8301 0x2ea610fea0e7d337,
8302 >(_buf?)?
8303 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
8304 Ok(_response)
8305 }
8306 self.client.send_query_and_decode::<
8307 fidl::encoding::EmptyPayload,
8308 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8309 >(
8310 (),
8311 0x2ea610fea0e7d337,
8312 fidl::encoding::DynamicFlags::FLEXIBLE,
8313 _decode,
8314 )
8315 }
8316
8317 type SyncToSubeventsResponseFut = fidl::client::QueryResponseFut<
8318 PeriodicAdvertisingSyncSyncToSubeventsResult,
8319 fidl::encoding::DefaultFuchsiaResourceDialect,
8320 >;
8321 fn r#sync_to_subevents(
8322 &self,
8323 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
8324 ) -> Self::SyncToSubeventsResponseFut {
8325 fn _decode(
8326 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8327 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
8328 let _response = fidl::client::decode_transaction_body::<
8329 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
8330 fidl::encoding::DefaultFuchsiaResourceDialect,
8331 0x653c5dab1f1d80ed,
8332 >(_buf?)?
8333 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
8334 Ok(_response.map(|x| x))
8335 }
8336 self.client.send_query_and_decode::<
8337 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8338 PeriodicAdvertisingSyncSyncToSubeventsResult,
8339 >(
8340 payload,
8341 0x653c5dab1f1d80ed,
8342 fidl::encoding::DynamicFlags::FLEXIBLE,
8343 _decode,
8344 )
8345 }
8346
8347 fn r#cancel(&self) -> Result<(), fidl::Error> {
8348 self.client.send::<fidl::encoding::EmptyPayload>(
8349 (),
8350 0xd617c037eaf5d92,
8351 fidl::encoding::DynamicFlags::FLEXIBLE,
8352 )
8353 }
8354}
8355
8356pub struct PeriodicAdvertisingSyncEventStream {
8357 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8358}
8359
8360impl std::marker::Unpin for PeriodicAdvertisingSyncEventStream {}
8361
8362impl futures::stream::FusedStream for PeriodicAdvertisingSyncEventStream {
8363 fn is_terminated(&self) -> bool {
8364 self.event_receiver.is_terminated()
8365 }
8366}
8367
8368impl futures::Stream for PeriodicAdvertisingSyncEventStream {
8369 type Item = Result<PeriodicAdvertisingSyncEvent, fidl::Error>;
8370
8371 fn poll_next(
8372 mut self: std::pin::Pin<&mut Self>,
8373 cx: &mut std::task::Context<'_>,
8374 ) -> std::task::Poll<Option<Self::Item>> {
8375 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8376 &mut self.event_receiver,
8377 cx
8378 )?) {
8379 Some(buf) => std::task::Poll::Ready(Some(PeriodicAdvertisingSyncEvent::decode(buf))),
8380 None => std::task::Poll::Ready(None),
8381 }
8382 }
8383}
8384
8385#[derive(Debug)]
8386pub enum PeriodicAdvertisingSyncEvent {
8387 OnEstablished {
8388 payload: PeriodicAdvertisingSyncOnEstablishedRequest,
8389 },
8390 OnError {
8391 error: PeriodicAdvertisingSyncError,
8392 },
8393 #[non_exhaustive]
8394 _UnknownEvent {
8395 ordinal: u64,
8397 },
8398}
8399
8400impl PeriodicAdvertisingSyncEvent {
8401 #[allow(irrefutable_let_patterns)]
8402 pub fn into_on_established(self) -> Option<PeriodicAdvertisingSyncOnEstablishedRequest> {
8403 if let PeriodicAdvertisingSyncEvent::OnEstablished { payload } = self {
8404 Some((payload))
8405 } else {
8406 None
8407 }
8408 }
8409 #[allow(irrefutable_let_patterns)]
8410 pub fn into_on_error(self) -> Option<PeriodicAdvertisingSyncError> {
8411 if let PeriodicAdvertisingSyncEvent::OnError { error } = self {
8412 Some((error))
8413 } else {
8414 None
8415 }
8416 }
8417
8418 fn decode(
8420 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8421 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
8422 let (bytes, _handles) = buf.split_mut();
8423 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8424 debug_assert_eq!(tx_header.tx_id, 0);
8425 match tx_header.ordinal {
8426 0x4a5c307761c40fdc => {
8427 let mut out = fidl::new_empty!(
8428 PeriodicAdvertisingSyncOnEstablishedRequest,
8429 fidl::encoding::DefaultFuchsiaResourceDialect
8430 );
8431 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8432 Ok((PeriodicAdvertisingSyncEvent::OnEstablished { payload: out }))
8433 }
8434 0x1c051673126ce4a => {
8435 let mut out = fidl::new_empty!(
8436 PeriodicAdvertisingSyncOnErrorRequest,
8437 fidl::encoding::DefaultFuchsiaResourceDialect
8438 );
8439 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8440 Ok((PeriodicAdvertisingSyncEvent::OnError { error: out.error }))
8441 }
8442 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8443 Ok(PeriodicAdvertisingSyncEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8444 }
8445 _ => Err(fidl::Error::UnknownOrdinal {
8446 ordinal: tx_header.ordinal,
8447 protocol_name:
8448 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8449 }),
8450 }
8451 }
8452}
8453
8454pub struct PeriodicAdvertisingSyncRequestStream {
8456 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8457 is_terminated: bool,
8458}
8459
8460impl std::marker::Unpin for PeriodicAdvertisingSyncRequestStream {}
8461
8462impl futures::stream::FusedStream for PeriodicAdvertisingSyncRequestStream {
8463 fn is_terminated(&self) -> bool {
8464 self.is_terminated
8465 }
8466}
8467
8468impl fidl::endpoints::RequestStream for PeriodicAdvertisingSyncRequestStream {
8469 type Protocol = PeriodicAdvertisingSyncMarker;
8470 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8471
8472 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8473 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8474 }
8475
8476 fn control_handle(&self) -> Self::ControlHandle {
8477 PeriodicAdvertisingSyncControlHandle { inner: self.inner.clone() }
8478 }
8479
8480 fn into_inner(
8481 self,
8482 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8483 {
8484 (self.inner, self.is_terminated)
8485 }
8486
8487 fn from_inner(
8488 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8489 is_terminated: bool,
8490 ) -> Self {
8491 Self { inner, is_terminated }
8492 }
8493}
8494
8495impl futures::Stream for PeriodicAdvertisingSyncRequestStream {
8496 type Item = Result<PeriodicAdvertisingSyncRequest, fidl::Error>;
8497
8498 fn poll_next(
8499 mut self: std::pin::Pin<&mut Self>,
8500 cx: &mut std::task::Context<'_>,
8501 ) -> std::task::Poll<Option<Self::Item>> {
8502 let this = &mut *self;
8503 if this.inner.check_shutdown(cx) {
8504 this.is_terminated = true;
8505 return std::task::Poll::Ready(None);
8506 }
8507 if this.is_terminated {
8508 panic!("polled PeriodicAdvertisingSyncRequestStream after completion");
8509 }
8510 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8511 |bytes, handles| {
8512 match this.inner.channel().read_etc(cx, bytes, handles) {
8513 std::task::Poll::Ready(Ok(())) => {}
8514 std::task::Poll::Pending => return std::task::Poll::Pending,
8515 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8516 this.is_terminated = true;
8517 return std::task::Poll::Ready(None);
8518 }
8519 std::task::Poll::Ready(Err(e)) => {
8520 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8521 e.into(),
8522 ))));
8523 }
8524 }
8525
8526 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8528
8529 std::task::Poll::Ready(Some(match header.ordinal {
8530 0x2ea610fea0e7d337 => {
8531 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8532 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8533 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8534 let control_handle = PeriodicAdvertisingSyncControlHandle {
8535 inner: this.inner.clone(),
8536 };
8537 Ok(PeriodicAdvertisingSyncRequest::WatchAdvertisingReport {
8538 responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8539 control_handle: std::mem::ManuallyDrop::new(control_handle),
8540 tx_id: header.tx_id,
8541 },
8542 })
8543 }
8544 0x653c5dab1f1d80ed => {
8545 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8546 let mut req = fidl::new_empty!(PeriodicAdvertisingSyncSyncToSubeventsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8547 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncSyncToSubeventsRequest>(&header, _body_bytes, handles, &mut req)?;
8548 let control_handle = PeriodicAdvertisingSyncControlHandle {
8549 inner: this.inner.clone(),
8550 };
8551 Ok(PeriodicAdvertisingSyncRequest::SyncToSubevents {payload: req,
8552 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder {
8553 control_handle: std::mem::ManuallyDrop::new(control_handle),
8554 tx_id: header.tx_id,
8555 },
8556 })
8557 }
8558 0xd617c037eaf5d92 => {
8559 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8560 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8561 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8562 let control_handle = PeriodicAdvertisingSyncControlHandle {
8563 inner: this.inner.clone(),
8564 };
8565 Ok(PeriodicAdvertisingSyncRequest::Cancel {
8566 control_handle,
8567 })
8568 }
8569 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8570 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
8571 ordinal: header.ordinal,
8572 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
8573 method_type: fidl::MethodType::OneWay,
8574 })
8575 }
8576 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8577 this.inner.send_framework_err(
8578 fidl::encoding::FrameworkErr::UnknownMethod,
8579 header.tx_id,
8580 header.ordinal,
8581 header.dynamic_flags(),
8582 (bytes, handles),
8583 )?;
8584 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
8585 ordinal: header.ordinal,
8586 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
8587 method_type: fidl::MethodType::TwoWay,
8588 })
8589 }
8590 _ => Err(fidl::Error::UnknownOrdinal {
8591 ordinal: header.ordinal,
8592 protocol_name: <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8593 }),
8594 }))
8595 },
8596 )
8597 }
8598}
8599
8600#[derive(Debug)]
8602pub enum PeriodicAdvertisingSyncRequest {
8603 WatchAdvertisingReport { responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder },
8606 SyncToSubevents {
8609 payload: PeriodicAdvertisingSyncSyncToSubeventsRequest,
8610 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder,
8611 },
8612 Cancel { control_handle: PeriodicAdvertisingSyncControlHandle },
8617 #[non_exhaustive]
8619 _UnknownMethod {
8620 ordinal: u64,
8622 control_handle: PeriodicAdvertisingSyncControlHandle,
8623 method_type: fidl::MethodType,
8624 },
8625}
8626
8627impl PeriodicAdvertisingSyncRequest {
8628 #[allow(irrefutable_let_patterns)]
8629 pub fn into_watch_advertising_report(
8630 self,
8631 ) -> Option<(PeriodicAdvertisingSyncWatchAdvertisingReportResponder)> {
8632 if let PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { responder } = self {
8633 Some((responder))
8634 } else {
8635 None
8636 }
8637 }
8638
8639 #[allow(irrefutable_let_patterns)]
8640 pub fn into_sync_to_subevents(
8641 self,
8642 ) -> Option<(
8643 PeriodicAdvertisingSyncSyncToSubeventsRequest,
8644 PeriodicAdvertisingSyncSyncToSubeventsResponder,
8645 )> {
8646 if let PeriodicAdvertisingSyncRequest::SyncToSubevents { payload, responder } = self {
8647 Some((payload, responder))
8648 } else {
8649 None
8650 }
8651 }
8652
8653 #[allow(irrefutable_let_patterns)]
8654 pub fn into_cancel(self) -> Option<(PeriodicAdvertisingSyncControlHandle)> {
8655 if let PeriodicAdvertisingSyncRequest::Cancel { control_handle } = self {
8656 Some((control_handle))
8657 } else {
8658 None
8659 }
8660 }
8661
8662 pub fn method_name(&self) -> &'static str {
8664 match *self {
8665 PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { .. } => {
8666 "watch_advertising_report"
8667 }
8668 PeriodicAdvertisingSyncRequest::SyncToSubevents { .. } => "sync_to_subevents",
8669 PeriodicAdvertisingSyncRequest::Cancel { .. } => "cancel",
8670 PeriodicAdvertisingSyncRequest::_UnknownMethod {
8671 method_type: fidl::MethodType::OneWay,
8672 ..
8673 } => "unknown one-way method",
8674 PeriodicAdvertisingSyncRequest::_UnknownMethod {
8675 method_type: fidl::MethodType::TwoWay,
8676 ..
8677 } => "unknown two-way method",
8678 }
8679 }
8680}
8681
8682#[derive(Debug, Clone)]
8683pub struct PeriodicAdvertisingSyncControlHandle {
8684 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8685}
8686
8687impl fidl::endpoints::ControlHandle for PeriodicAdvertisingSyncControlHandle {
8688 fn shutdown(&self) {
8689 self.inner.shutdown()
8690 }
8691
8692 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8693 self.inner.shutdown_with_epitaph(status)
8694 }
8695
8696 fn is_closed(&self) -> bool {
8697 self.inner.channel().is_closed()
8698 }
8699 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8700 self.inner.channel().on_closed()
8701 }
8702
8703 #[cfg(target_os = "fuchsia")]
8704 fn signal_peer(
8705 &self,
8706 clear_mask: zx::Signals,
8707 set_mask: zx::Signals,
8708 ) -> Result<(), zx_status::Status> {
8709 use fidl::Peered;
8710 self.inner.channel().signal_peer(clear_mask, set_mask)
8711 }
8712}
8713
8714impl PeriodicAdvertisingSyncControlHandle {
8715 pub fn send_on_established(
8716 &self,
8717 mut payload: &PeriodicAdvertisingSyncOnEstablishedRequest,
8718 ) -> Result<(), fidl::Error> {
8719 self.inner.send::<PeriodicAdvertisingSyncOnEstablishedRequest>(
8720 payload,
8721 0,
8722 0x4a5c307761c40fdc,
8723 fidl::encoding::DynamicFlags::FLEXIBLE,
8724 )
8725 }
8726
8727 pub fn send_on_error(
8728 &self,
8729 mut error: PeriodicAdvertisingSyncError,
8730 ) -> Result<(), fidl::Error> {
8731 self.inner.send::<PeriodicAdvertisingSyncOnErrorRequest>(
8732 (error,),
8733 0,
8734 0x1c051673126ce4a,
8735 fidl::encoding::DynamicFlags::FLEXIBLE,
8736 )
8737 }
8738}
8739
8740#[must_use = "FIDL methods require a response to be sent"]
8741#[derive(Debug)]
8742pub struct PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8743 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
8744 tx_id: u32,
8745}
8746
8747impl std::ops::Drop for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8751 fn drop(&mut self) {
8752 self.control_handle.shutdown();
8753 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8755 }
8756}
8757
8758impl fidl::endpoints::Responder for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8759 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8760
8761 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8762 &self.control_handle
8763 }
8764
8765 fn drop_without_shutdown(mut self) {
8766 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8768 std::mem::forget(self);
8770 }
8771}
8772
8773impl PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8774 pub fn send(
8778 self,
8779 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8780 ) -> Result<(), fidl::Error> {
8781 let _result = self.send_raw(payload);
8782 if _result.is_err() {
8783 self.control_handle.shutdown();
8784 }
8785 self.drop_without_shutdown();
8786 _result
8787 }
8788
8789 pub fn send_no_shutdown_on_err(
8791 self,
8792 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8793 ) -> Result<(), fidl::Error> {
8794 let _result = self.send_raw(payload);
8795 self.drop_without_shutdown();
8796 _result
8797 }
8798
8799 fn send_raw(
8800 &self,
8801 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8802 ) -> Result<(), fidl::Error> {
8803 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8804 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8805 >>(
8806 fidl::encoding::Flexible::new(payload),
8807 self.tx_id,
8808 0x2ea610fea0e7d337,
8809 fidl::encoding::DynamicFlags::FLEXIBLE,
8810 )
8811 }
8812}
8813
8814#[must_use = "FIDL methods require a response to be sent"]
8815#[derive(Debug)]
8816pub struct PeriodicAdvertisingSyncSyncToSubeventsResponder {
8817 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
8818 tx_id: u32,
8819}
8820
8821impl std::ops::Drop for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8825 fn drop(&mut self) {
8826 self.control_handle.shutdown();
8827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8829 }
8830}
8831
8832impl fidl::endpoints::Responder for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8833 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8834
8835 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8836 &self.control_handle
8837 }
8838
8839 fn drop_without_shutdown(mut self) {
8840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8842 std::mem::forget(self);
8844 }
8845}
8846
8847impl PeriodicAdvertisingSyncSyncToSubeventsResponder {
8848 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8852 let _result = self.send_raw(result);
8853 if _result.is_err() {
8854 self.control_handle.shutdown();
8855 }
8856 self.drop_without_shutdown();
8857 _result
8858 }
8859
8860 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8862 let _result = self.send_raw(result);
8863 self.drop_without_shutdown();
8864 _result
8865 }
8866
8867 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8868 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8869 fidl::encoding::EmptyStruct,
8870 i32,
8871 >>(
8872 fidl::encoding::FlexibleResult::new(result),
8873 self.tx_id,
8874 0x653c5dab1f1d80ed,
8875 fidl::encoding::DynamicFlags::FLEXIBLE,
8876 )
8877 }
8878}
8879
8880#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8881pub struct PeripheralMarker;
8882
8883impl fidl::endpoints::ProtocolMarker for PeripheralMarker {
8884 type Proxy = PeripheralProxy;
8885 type RequestStream = PeripheralRequestStream;
8886 #[cfg(target_os = "fuchsia")]
8887 type SynchronousProxy = PeripheralSynchronousProxy;
8888
8889 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Peripheral";
8890}
8891impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralMarker {}
8892pub type PeripheralAdvertiseResult = Result<(), PeripheralError>;
8893pub type PeripheralStartAdvertisingResult = Result<(), PeripheralError>;
8894
8895pub trait PeripheralProxyInterface: Send + Sync {
8896 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
8897 + Send;
8898 fn r#listen_l2cap(
8899 &self,
8900 payload: ChannelListenerRegistryListenL2capRequest,
8901 ) -> Self::ListenL2capResponseFut;
8902 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
8903 + Send;
8904 fn r#advertise(
8905 &self,
8906 parameters: &AdvertisingParameters,
8907 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8908 ) -> Self::AdvertiseResponseFut;
8909 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
8910 + Send;
8911 fn r#start_advertising(
8912 &self,
8913 parameters: &AdvertisingParameters,
8914 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8915 ) -> Self::StartAdvertisingResponseFut;
8916}
8917#[derive(Debug)]
8918#[cfg(target_os = "fuchsia")]
8919pub struct PeripheralSynchronousProxy {
8920 client: fidl::client::sync::Client,
8921}
8922
8923#[cfg(target_os = "fuchsia")]
8924impl fidl::endpoints::SynchronousProxy for PeripheralSynchronousProxy {
8925 type Proxy = PeripheralProxy;
8926 type Protocol = PeripheralMarker;
8927
8928 fn from_channel(inner: fidl::Channel) -> Self {
8929 Self::new(inner)
8930 }
8931
8932 fn into_channel(self) -> fidl::Channel {
8933 self.client.into_channel()
8934 }
8935
8936 fn as_channel(&self) -> &fidl::Channel {
8937 self.client.as_channel()
8938 }
8939}
8940
8941#[cfg(target_os = "fuchsia")]
8942impl PeripheralSynchronousProxy {
8943 pub fn new(channel: fidl::Channel) -> Self {
8944 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8945 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8946 }
8947
8948 pub fn into_channel(self) -> fidl::Channel {
8949 self.client.into_channel()
8950 }
8951
8952 pub fn wait_for_event(
8955 &self,
8956 deadline: zx::MonotonicInstant,
8957 ) -> Result<PeripheralEvent, fidl::Error> {
8958 PeripheralEvent::decode(self.client.wait_for_event(deadline)?)
8959 }
8960
8961 pub fn r#listen_l2cap(
8971 &self,
8972 mut payload: ChannelListenerRegistryListenL2capRequest,
8973 ___deadline: zx::MonotonicInstant,
8974 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8975 let _response = self.client.send_query::<
8976 ChannelListenerRegistryListenL2capRequest,
8977 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
8978 >(
8979 &mut payload,
8980 0x39c6e9001d102338,
8981 fidl::encoding::DynamicFlags::empty(),
8982 ___deadline,
8983 )?;
8984 Ok(_response.map(|x| x))
8985 }
8986
8987 pub fn r#advertise(
9015 &self,
9016 mut parameters: &AdvertisingParameters,
9017 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9018 ___deadline: zx::MonotonicInstant,
9019 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9020 let _response = self.client.send_query::<
9021 PeripheralAdvertiseRequest,
9022 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9023 >(
9024 (parameters, advertised_peripheral,),
9025 0x2d9ec9260c32c17f,
9026 fidl::encoding::DynamicFlags::empty(),
9027 ___deadline,
9028 )?;
9029 Ok(_response.map(|x| x))
9030 }
9031
9032 pub fn r#start_advertising(
9053 &self,
9054 mut parameters: &AdvertisingParameters,
9055 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9056 ___deadline: zx::MonotonicInstant,
9057 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9058 let _response = self.client.send_query::<
9059 PeripheralStartAdvertisingRequest,
9060 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9061 >(
9062 (parameters, handle,),
9063 0x5875c1c575f00f7d,
9064 fidl::encoding::DynamicFlags::empty(),
9065 ___deadline,
9066 )?;
9067 Ok(_response.map(|x| x))
9068 }
9069}
9070
9071#[cfg(target_os = "fuchsia")]
9072impl From<PeripheralSynchronousProxy> for zx::NullableHandle {
9073 fn from(value: PeripheralSynchronousProxy) -> Self {
9074 value.into_channel().into()
9075 }
9076}
9077
9078#[cfg(target_os = "fuchsia")]
9079impl From<fidl::Channel> for PeripheralSynchronousProxy {
9080 fn from(value: fidl::Channel) -> Self {
9081 Self::new(value)
9082 }
9083}
9084
9085#[cfg(target_os = "fuchsia")]
9086impl fidl::endpoints::FromClient for PeripheralSynchronousProxy {
9087 type Protocol = PeripheralMarker;
9088
9089 fn from_client(value: fidl::endpoints::ClientEnd<PeripheralMarker>) -> Self {
9090 Self::new(value.into_channel())
9091 }
9092}
9093
9094#[derive(Debug, Clone)]
9095pub struct PeripheralProxy {
9096 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9097}
9098
9099impl fidl::endpoints::Proxy for PeripheralProxy {
9100 type Protocol = PeripheralMarker;
9101
9102 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9103 Self::new(inner)
9104 }
9105
9106 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9107 self.client.into_channel().map_err(|client| Self { client })
9108 }
9109
9110 fn as_channel(&self) -> &::fidl::AsyncChannel {
9111 self.client.as_channel()
9112 }
9113}
9114
9115impl PeripheralProxy {
9116 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9118 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9119 Self { client: fidl::client::Client::new(channel, protocol_name) }
9120 }
9121
9122 pub fn take_event_stream(&self) -> PeripheralEventStream {
9128 PeripheralEventStream { event_receiver: self.client.take_event_receiver() }
9129 }
9130
9131 pub fn r#listen_l2cap(
9141 &self,
9142 mut payload: ChannelListenerRegistryListenL2capRequest,
9143 ) -> fidl::client::QueryResponseFut<
9144 ChannelListenerRegistryListenL2capResult,
9145 fidl::encoding::DefaultFuchsiaResourceDialect,
9146 > {
9147 PeripheralProxyInterface::r#listen_l2cap(self, payload)
9148 }
9149
9150 pub fn r#advertise(
9178 &self,
9179 mut parameters: &AdvertisingParameters,
9180 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9181 ) -> fidl::client::QueryResponseFut<
9182 PeripheralAdvertiseResult,
9183 fidl::encoding::DefaultFuchsiaResourceDialect,
9184 > {
9185 PeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
9186 }
9187
9188 pub fn r#start_advertising(
9209 &self,
9210 mut parameters: &AdvertisingParameters,
9211 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9212 ) -> fidl::client::QueryResponseFut<
9213 PeripheralStartAdvertisingResult,
9214 fidl::encoding::DefaultFuchsiaResourceDialect,
9215 > {
9216 PeripheralProxyInterface::r#start_advertising(self, parameters, handle)
9217 }
9218}
9219
9220impl PeripheralProxyInterface for PeripheralProxy {
9221 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
9222 ChannelListenerRegistryListenL2capResult,
9223 fidl::encoding::DefaultFuchsiaResourceDialect,
9224 >;
9225 fn r#listen_l2cap(
9226 &self,
9227 mut payload: ChannelListenerRegistryListenL2capRequest,
9228 ) -> Self::ListenL2capResponseFut {
9229 fn _decode(
9230 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9231 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
9232 let _response = fidl::client::decode_transaction_body::<
9233 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
9234 fidl::encoding::DefaultFuchsiaResourceDialect,
9235 0x39c6e9001d102338,
9236 >(_buf?)?;
9237 Ok(_response.map(|x| x))
9238 }
9239 self.client.send_query_and_decode::<
9240 ChannelListenerRegistryListenL2capRequest,
9241 ChannelListenerRegistryListenL2capResult,
9242 >(
9243 &mut payload,
9244 0x39c6e9001d102338,
9245 fidl::encoding::DynamicFlags::empty(),
9246 _decode,
9247 )
9248 }
9249
9250 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
9251 PeripheralAdvertiseResult,
9252 fidl::encoding::DefaultFuchsiaResourceDialect,
9253 >;
9254 fn r#advertise(
9255 &self,
9256 mut parameters: &AdvertisingParameters,
9257 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9258 ) -> Self::AdvertiseResponseFut {
9259 fn _decode(
9260 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9261 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9262 let _response = fidl::client::decode_transaction_body::<
9263 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9264 fidl::encoding::DefaultFuchsiaResourceDialect,
9265 0x2d9ec9260c32c17f,
9266 >(_buf?)?;
9267 Ok(_response.map(|x| x))
9268 }
9269 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
9270 (parameters, advertised_peripheral),
9271 0x2d9ec9260c32c17f,
9272 fidl::encoding::DynamicFlags::empty(),
9273 _decode,
9274 )
9275 }
9276
9277 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
9278 PeripheralStartAdvertisingResult,
9279 fidl::encoding::DefaultFuchsiaResourceDialect,
9280 >;
9281 fn r#start_advertising(
9282 &self,
9283 mut parameters: &AdvertisingParameters,
9284 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9285 ) -> Self::StartAdvertisingResponseFut {
9286 fn _decode(
9287 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9288 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9289 let _response = fidl::client::decode_transaction_body::<
9290 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9291 fidl::encoding::DefaultFuchsiaResourceDialect,
9292 0x5875c1c575f00f7d,
9293 >(_buf?)?;
9294 Ok(_response.map(|x| x))
9295 }
9296 self.client.send_query_and_decode::<
9297 PeripheralStartAdvertisingRequest,
9298 PeripheralStartAdvertisingResult,
9299 >(
9300 (parameters, handle,),
9301 0x5875c1c575f00f7d,
9302 fidl::encoding::DynamicFlags::empty(),
9303 _decode,
9304 )
9305 }
9306}
9307
9308pub struct PeripheralEventStream {
9309 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9310}
9311
9312impl std::marker::Unpin for PeripheralEventStream {}
9313
9314impl futures::stream::FusedStream for PeripheralEventStream {
9315 fn is_terminated(&self) -> bool {
9316 self.event_receiver.is_terminated()
9317 }
9318}
9319
9320impl futures::Stream for PeripheralEventStream {
9321 type Item = Result<PeripheralEvent, fidl::Error>;
9322
9323 fn poll_next(
9324 mut self: std::pin::Pin<&mut Self>,
9325 cx: &mut std::task::Context<'_>,
9326 ) -> std::task::Poll<Option<Self::Item>> {
9327 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9328 &mut self.event_receiver,
9329 cx
9330 )?) {
9331 Some(buf) => std::task::Poll::Ready(Some(PeripheralEvent::decode(buf))),
9332 None => std::task::Poll::Ready(None),
9333 }
9334 }
9335}
9336
9337#[derive(Debug)]
9338pub enum PeripheralEvent {
9339 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
9340}
9341
9342impl PeripheralEvent {
9343 #[allow(irrefutable_let_patterns)]
9344 pub fn into_on_peer_connected(
9345 self,
9346 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
9347 if let PeripheralEvent::OnPeerConnected { peer, connection } = self {
9348 Some((peer, connection))
9349 } else {
9350 None
9351 }
9352 }
9353
9354 fn decode(
9356 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9357 ) -> Result<PeripheralEvent, fidl::Error> {
9358 let (bytes, _handles) = buf.split_mut();
9359 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9360 debug_assert_eq!(tx_header.tx_id, 0);
9361 match tx_header.ordinal {
9362 0x16135d464299e356 => {
9363 let mut out = fidl::new_empty!(
9364 PeripheralOnPeerConnectedRequest,
9365 fidl::encoding::DefaultFuchsiaResourceDialect
9366 );
9367 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
9368 Ok((PeripheralEvent::OnPeerConnected {
9369 peer: out.peer,
9370 connection: out.connection,
9371 }))
9372 }
9373 _ => Err(fidl::Error::UnknownOrdinal {
9374 ordinal: tx_header.ordinal,
9375 protocol_name: <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9376 }),
9377 }
9378 }
9379}
9380
9381pub struct PeripheralRequestStream {
9383 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9384 is_terminated: bool,
9385}
9386
9387impl std::marker::Unpin for PeripheralRequestStream {}
9388
9389impl futures::stream::FusedStream for PeripheralRequestStream {
9390 fn is_terminated(&self) -> bool {
9391 self.is_terminated
9392 }
9393}
9394
9395impl fidl::endpoints::RequestStream for PeripheralRequestStream {
9396 type Protocol = PeripheralMarker;
9397 type ControlHandle = PeripheralControlHandle;
9398
9399 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9400 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9401 }
9402
9403 fn control_handle(&self) -> Self::ControlHandle {
9404 PeripheralControlHandle { inner: self.inner.clone() }
9405 }
9406
9407 fn into_inner(
9408 self,
9409 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9410 {
9411 (self.inner, self.is_terminated)
9412 }
9413
9414 fn from_inner(
9415 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9416 is_terminated: bool,
9417 ) -> Self {
9418 Self { inner, is_terminated }
9419 }
9420}
9421
9422impl futures::Stream for PeripheralRequestStream {
9423 type Item = Result<PeripheralRequest, fidl::Error>;
9424
9425 fn poll_next(
9426 mut self: std::pin::Pin<&mut Self>,
9427 cx: &mut std::task::Context<'_>,
9428 ) -> std::task::Poll<Option<Self::Item>> {
9429 let this = &mut *self;
9430 if this.inner.check_shutdown(cx) {
9431 this.is_terminated = true;
9432 return std::task::Poll::Ready(None);
9433 }
9434 if this.is_terminated {
9435 panic!("polled PeripheralRequestStream after completion");
9436 }
9437 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9438 |bytes, handles| {
9439 match this.inner.channel().read_etc(cx, bytes, handles) {
9440 std::task::Poll::Ready(Ok(())) => {}
9441 std::task::Poll::Pending => return std::task::Poll::Pending,
9442 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9443 this.is_terminated = true;
9444 return std::task::Poll::Ready(None);
9445 }
9446 std::task::Poll::Ready(Err(e)) => {
9447 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9448 e.into(),
9449 ))));
9450 }
9451 }
9452
9453 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9455
9456 std::task::Poll::Ready(Some(match header.ordinal {
9457 0x39c6e9001d102338 => {
9458 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9459 let mut req = fidl::new_empty!(
9460 ChannelListenerRegistryListenL2capRequest,
9461 fidl::encoding::DefaultFuchsiaResourceDialect
9462 );
9463 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
9464 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9465 Ok(PeripheralRequest::ListenL2cap {
9466 payload: req,
9467 responder: PeripheralListenL2capResponder {
9468 control_handle: std::mem::ManuallyDrop::new(control_handle),
9469 tx_id: header.tx_id,
9470 },
9471 })
9472 }
9473 0x2d9ec9260c32c17f => {
9474 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9475 let mut req = fidl::new_empty!(
9476 PeripheralAdvertiseRequest,
9477 fidl::encoding::DefaultFuchsiaResourceDialect
9478 );
9479 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
9480 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9481 Ok(PeripheralRequest::Advertise {
9482 parameters: req.parameters,
9483 advertised_peripheral: req.advertised_peripheral,
9484
9485 responder: PeripheralAdvertiseResponder {
9486 control_handle: std::mem::ManuallyDrop::new(control_handle),
9487 tx_id: header.tx_id,
9488 },
9489 })
9490 }
9491 0x5875c1c575f00f7d => {
9492 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9493 let mut req = fidl::new_empty!(
9494 PeripheralStartAdvertisingRequest,
9495 fidl::encoding::DefaultFuchsiaResourceDialect
9496 );
9497 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
9498 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
9499 Ok(PeripheralRequest::StartAdvertising {
9500 parameters: req.parameters,
9501 handle: req.handle,
9502
9503 responder: PeripheralStartAdvertisingResponder {
9504 control_handle: std::mem::ManuallyDrop::new(control_handle),
9505 tx_id: header.tx_id,
9506 },
9507 })
9508 }
9509 _ => Err(fidl::Error::UnknownOrdinal {
9510 ordinal: header.ordinal,
9511 protocol_name:
9512 <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9513 }),
9514 }))
9515 },
9516 )
9517 }
9518}
9519
9520#[derive(Debug)]
9521pub enum PeripheralRequest {
9522 ListenL2cap {
9532 payload: ChannelListenerRegistryListenL2capRequest,
9533 responder: PeripheralListenL2capResponder,
9534 },
9535 Advertise {
9563 parameters: AdvertisingParameters,
9564 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9565 responder: PeripheralAdvertiseResponder,
9566 },
9567 StartAdvertising {
9588 parameters: AdvertisingParameters,
9589 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9590 responder: PeripheralStartAdvertisingResponder,
9591 },
9592}
9593
9594impl PeripheralRequest {
9595 #[allow(irrefutable_let_patterns)]
9596 pub fn into_listen_l2cap(
9597 self,
9598 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PeripheralListenL2capResponder)> {
9599 if let PeripheralRequest::ListenL2cap { payload, responder } = self {
9600 Some((payload, responder))
9601 } else {
9602 None
9603 }
9604 }
9605
9606 #[allow(irrefutable_let_patterns)]
9607 pub fn into_advertise(
9608 self,
9609 ) -> Option<(
9610 AdvertisingParameters,
9611 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9612 PeripheralAdvertiseResponder,
9613 )> {
9614 if let PeripheralRequest::Advertise { parameters, advertised_peripheral, responder } = self
9615 {
9616 Some((parameters, advertised_peripheral, responder))
9617 } else {
9618 None
9619 }
9620 }
9621
9622 #[allow(irrefutable_let_patterns)]
9623 pub fn into_start_advertising(
9624 self,
9625 ) -> Option<(
9626 AdvertisingParameters,
9627 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9628 PeripheralStartAdvertisingResponder,
9629 )> {
9630 if let PeripheralRequest::StartAdvertising { parameters, handle, responder } = self {
9631 Some((parameters, handle, responder))
9632 } else {
9633 None
9634 }
9635 }
9636
9637 pub fn method_name(&self) -> &'static str {
9639 match *self {
9640 PeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
9641 PeripheralRequest::Advertise { .. } => "advertise",
9642 PeripheralRequest::StartAdvertising { .. } => "start_advertising",
9643 }
9644 }
9645}
9646
9647#[derive(Debug, Clone)]
9648pub struct PeripheralControlHandle {
9649 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9650}
9651
9652impl fidl::endpoints::ControlHandle for PeripheralControlHandle {
9653 fn shutdown(&self) {
9654 self.inner.shutdown()
9655 }
9656
9657 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9658 self.inner.shutdown_with_epitaph(status)
9659 }
9660
9661 fn is_closed(&self) -> bool {
9662 self.inner.channel().is_closed()
9663 }
9664 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9665 self.inner.channel().on_closed()
9666 }
9667
9668 #[cfg(target_os = "fuchsia")]
9669 fn signal_peer(
9670 &self,
9671 clear_mask: zx::Signals,
9672 set_mask: zx::Signals,
9673 ) -> Result<(), zx_status::Status> {
9674 use fidl::Peered;
9675 self.inner.channel().signal_peer(clear_mask, set_mask)
9676 }
9677}
9678
9679impl PeripheralControlHandle {
9680 pub fn send_on_peer_connected(
9681 &self,
9682 mut peer: &Peer,
9683 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
9684 ) -> Result<(), fidl::Error> {
9685 self.inner.send::<PeripheralOnPeerConnectedRequest>(
9686 (peer, connection),
9687 0,
9688 0x16135d464299e356,
9689 fidl::encoding::DynamicFlags::empty(),
9690 )
9691 }
9692}
9693
9694#[must_use = "FIDL methods require a response to be sent"]
9695#[derive(Debug)]
9696pub struct PeripheralListenL2capResponder {
9697 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9698 tx_id: u32,
9699}
9700
9701impl std::ops::Drop for PeripheralListenL2capResponder {
9705 fn drop(&mut self) {
9706 self.control_handle.shutdown();
9707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9709 }
9710}
9711
9712impl fidl::endpoints::Responder for PeripheralListenL2capResponder {
9713 type ControlHandle = PeripheralControlHandle;
9714
9715 fn control_handle(&self) -> &PeripheralControlHandle {
9716 &self.control_handle
9717 }
9718
9719 fn drop_without_shutdown(mut self) {
9720 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9722 std::mem::forget(self);
9724 }
9725}
9726
9727impl PeripheralListenL2capResponder {
9728 pub fn send(
9732 self,
9733 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9734 ) -> Result<(), fidl::Error> {
9735 let _result = self.send_raw(result);
9736 if _result.is_err() {
9737 self.control_handle.shutdown();
9738 }
9739 self.drop_without_shutdown();
9740 _result
9741 }
9742
9743 pub fn send_no_shutdown_on_err(
9745 self,
9746 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9747 ) -> Result<(), fidl::Error> {
9748 let _result = self.send_raw(result);
9749 self.drop_without_shutdown();
9750 _result
9751 }
9752
9753 fn send_raw(
9754 &self,
9755 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9756 ) -> Result<(), fidl::Error> {
9757 self.control_handle.inner.send::<fidl::encoding::ResultType<
9758 ChannelListenerRegistryListenL2capResponse,
9759 i32,
9760 >>(
9761 result,
9762 self.tx_id,
9763 0x39c6e9001d102338,
9764 fidl::encoding::DynamicFlags::empty(),
9765 )
9766 }
9767}
9768
9769#[must_use = "FIDL methods require a response to be sent"]
9770#[derive(Debug)]
9771pub struct PeripheralAdvertiseResponder {
9772 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9773 tx_id: u32,
9774}
9775
9776impl std::ops::Drop for PeripheralAdvertiseResponder {
9780 fn drop(&mut self) {
9781 self.control_handle.shutdown();
9782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9784 }
9785}
9786
9787impl fidl::endpoints::Responder for PeripheralAdvertiseResponder {
9788 type ControlHandle = PeripheralControlHandle;
9789
9790 fn control_handle(&self) -> &PeripheralControlHandle {
9791 &self.control_handle
9792 }
9793
9794 fn drop_without_shutdown(mut self) {
9795 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9797 std::mem::forget(self);
9799 }
9800}
9801
9802impl PeripheralAdvertiseResponder {
9803 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9807 let _result = self.send_raw(result);
9808 if _result.is_err() {
9809 self.control_handle.shutdown();
9810 }
9811 self.drop_without_shutdown();
9812 _result
9813 }
9814
9815 pub fn send_no_shutdown_on_err(
9817 self,
9818 mut result: Result<(), PeripheralError>,
9819 ) -> Result<(), fidl::Error> {
9820 let _result = self.send_raw(result);
9821 self.drop_without_shutdown();
9822 _result
9823 }
9824
9825 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9826 self.control_handle.inner.send::<fidl::encoding::ResultType<
9827 fidl::encoding::EmptyStruct,
9828 PeripheralError,
9829 >>(
9830 result,
9831 self.tx_id,
9832 0x2d9ec9260c32c17f,
9833 fidl::encoding::DynamicFlags::empty(),
9834 )
9835 }
9836}
9837
9838#[must_use = "FIDL methods require a response to be sent"]
9839#[derive(Debug)]
9840pub struct PeripheralStartAdvertisingResponder {
9841 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9842 tx_id: u32,
9843}
9844
9845impl std::ops::Drop for PeripheralStartAdvertisingResponder {
9849 fn drop(&mut self) {
9850 self.control_handle.shutdown();
9851 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9853 }
9854}
9855
9856impl fidl::endpoints::Responder for PeripheralStartAdvertisingResponder {
9857 type ControlHandle = PeripheralControlHandle;
9858
9859 fn control_handle(&self) -> &PeripheralControlHandle {
9860 &self.control_handle
9861 }
9862
9863 fn drop_without_shutdown(mut self) {
9864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9866 std::mem::forget(self);
9868 }
9869}
9870
9871impl PeripheralStartAdvertisingResponder {
9872 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9876 let _result = self.send_raw(result);
9877 if _result.is_err() {
9878 self.control_handle.shutdown();
9879 }
9880 self.drop_without_shutdown();
9881 _result
9882 }
9883
9884 pub fn send_no_shutdown_on_err(
9886 self,
9887 mut result: Result<(), PeripheralError>,
9888 ) -> Result<(), fidl::Error> {
9889 let _result = self.send_raw(result);
9890 self.drop_without_shutdown();
9891 _result
9892 }
9893
9894 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9895 self.control_handle.inner.send::<fidl::encoding::ResultType<
9896 fidl::encoding::EmptyStruct,
9897 PeripheralError,
9898 >>(
9899 result,
9900 self.tx_id,
9901 0x5875c1c575f00f7d,
9902 fidl::encoding::DynamicFlags::empty(),
9903 )
9904 }
9905}
9906
9907#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9908pub struct PrivilegedCentralMarker;
9909
9910impl fidl::endpoints::ProtocolMarker for PrivilegedCentralMarker {
9911 type Proxy = PrivilegedCentralProxy;
9912 type RequestStream = PrivilegedCentralRequestStream;
9913 #[cfg(target_os = "fuchsia")]
9914 type SynchronousProxy = PrivilegedCentralSynchronousProxy;
9915
9916 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedCentral";
9917}
9918impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedCentralMarker {}
9919
9920pub trait PrivilegedCentralProxyInterface: Send + Sync {
9921 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
9922 + Send;
9923 fn r#listen_l2cap(
9924 &self,
9925 payload: ChannelListenerRegistryListenL2capRequest,
9926 ) -> Self::ListenL2capResponseFut;
9927 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
9928 fn r#scan(
9929 &self,
9930 options: &ScanOptions,
9931 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
9932 ) -> Self::ScanResponseFut;
9933 fn r#connect(
9934 &self,
9935 id: &fidl_fuchsia_bluetooth::PeerId,
9936 options: &ConnectionOptions,
9937 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
9938 ) -> Result<(), fidl::Error>;
9939 fn r#sync_to_periodic_advertising(
9940 &self,
9941 payload: CentralSyncToPeriodicAdvertisingRequest,
9942 ) -> Result<(), fidl::Error>;
9943 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
9944 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
9945 > + Send;
9946 fn r#create_connected_isochronous_group(
9947 &self,
9948 payload: CentralCreateConnectedIsochronousGroupRequest,
9949 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
9950 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
9951 + Send;
9952 fn r#get_peripherals(
9953 &self,
9954 service_uuids: Option<&[String]>,
9955 ) -> Self::GetPeripheralsResponseFut;
9956 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
9957 + Send;
9958 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
9959 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9960 + Send;
9961 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
9962 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
9963 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9964 + Send;
9965 fn r#connect_peripheral(
9966 &self,
9967 identifier: &str,
9968 options: &ConnectionOptions,
9969 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9970 ) -> Self::ConnectPeripheralResponseFut;
9971 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
9972 + Send;
9973 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
9974}
9975#[derive(Debug)]
9976#[cfg(target_os = "fuchsia")]
9977pub struct PrivilegedCentralSynchronousProxy {
9978 client: fidl::client::sync::Client,
9979}
9980
9981#[cfg(target_os = "fuchsia")]
9982impl fidl::endpoints::SynchronousProxy for PrivilegedCentralSynchronousProxy {
9983 type Proxy = PrivilegedCentralProxy;
9984 type Protocol = PrivilegedCentralMarker;
9985
9986 fn from_channel(inner: fidl::Channel) -> Self {
9987 Self::new(inner)
9988 }
9989
9990 fn into_channel(self) -> fidl::Channel {
9991 self.client.into_channel()
9992 }
9993
9994 fn as_channel(&self) -> &fidl::Channel {
9995 self.client.as_channel()
9996 }
9997}
9998
9999#[cfg(target_os = "fuchsia")]
10000impl PrivilegedCentralSynchronousProxy {
10001 pub fn new(channel: fidl::Channel) -> Self {
10002 let protocol_name =
10003 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10004 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10005 }
10006
10007 pub fn into_channel(self) -> fidl::Channel {
10008 self.client.into_channel()
10009 }
10010
10011 pub fn wait_for_event(
10014 &self,
10015 deadline: zx::MonotonicInstant,
10016 ) -> Result<PrivilegedCentralEvent, fidl::Error> {
10017 PrivilegedCentralEvent::decode(self.client.wait_for_event(deadline)?)
10018 }
10019
10020 pub fn r#listen_l2cap(
10030 &self,
10031 mut payload: ChannelListenerRegistryListenL2capRequest,
10032 ___deadline: zx::MonotonicInstant,
10033 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
10034 let _response = self.client.send_query::<
10035 ChannelListenerRegistryListenL2capRequest,
10036 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
10037 >(
10038 &mut payload,
10039 0x39c6e9001d102338,
10040 fidl::encoding::DynamicFlags::empty(),
10041 ___deadline,
10042 )?;
10043 Ok(_response.map(|x| x))
10044 }
10045
10046 pub fn r#scan(
10073 &self,
10074 mut options: &ScanOptions,
10075 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10076 ___deadline: zx::MonotonicInstant,
10077 ) -> Result<(), fidl::Error> {
10078 let _response =
10079 self.client.send_query::<CentralScanRequest, fidl::encoding::EmptyPayload>(
10080 (options, result_watcher),
10081 0x41f7121798dfe15f,
10082 fidl::encoding::DynamicFlags::empty(),
10083 ___deadline,
10084 )?;
10085 Ok(_response)
10086 }
10087
10088 pub fn r#connect(
10110 &self,
10111 mut id: &fidl_fuchsia_bluetooth::PeerId,
10112 mut options: &ConnectionOptions,
10113 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10114 ) -> Result<(), fidl::Error> {
10115 self.client.send::<CentralConnectRequest>(
10116 (id, options, handle),
10117 0x31a3065f2a6913c4,
10118 fidl::encoding::DynamicFlags::empty(),
10119 )
10120 }
10121
10122 pub fn r#sync_to_periodic_advertising(
10125 &self,
10126 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10127 ) -> Result<(), fidl::Error> {
10128 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
10129 &mut payload,
10130 0x1db6df126a00c5b9,
10131 fidl::encoding::DynamicFlags::empty(),
10132 )
10133 }
10134
10135 pub fn r#create_connected_isochronous_group(
10144 &self,
10145 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10146 ___deadline: zx::MonotonicInstant,
10147 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
10148 let _response = self
10149 .client
10150 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
10151 CentralCreateConnectedIsochronousGroupResponse,
10152 CreateCigError,
10153 >>(
10154 &mut payload,
10155 0x60323e70ae22e13,
10156 fidl::encoding::DynamicFlags::empty(),
10157 ___deadline,
10158 )?;
10159 Ok(_response.map(|x| x))
10160 }
10161
10162 pub fn r#get_peripherals(
10168 &self,
10169 mut service_uuids: Option<&[String]>,
10170 ___deadline: zx::MonotonicInstant,
10171 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
10172 let _response =
10173 self.client.send_query::<CentralGetPeripheralsRequest, CentralGetPeripheralsResponse>(
10174 (service_uuids,),
10175 0x37ba777499c683a8,
10176 fidl::encoding::DynamicFlags::empty(),
10177 ___deadline,
10178 )?;
10179 Ok(_response.peripherals)
10180 }
10181
10182 pub fn r#get_peripheral(
10188 &self,
10189 mut identifier: &str,
10190 ___deadline: zx::MonotonicInstant,
10191 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
10192 let _response =
10193 self.client.send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse>(
10194 (identifier,),
10195 0x97f5a2f2d9c13da,
10196 fidl::encoding::DynamicFlags::empty(),
10197 ___deadline,
10198 )?;
10199 Ok(_response.peripheral)
10200 }
10201
10202 pub fn r#start_scan(
10211 &self,
10212 mut filter: Option<&ScanFilter>,
10213 ___deadline: zx::MonotonicInstant,
10214 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10215 let _response =
10216 self.client.send_query::<CentralStartScanRequest, CentralStartScanResponse>(
10217 (filter,),
10218 0xeb4cf0cd0e1132b,
10219 fidl::encoding::DynamicFlags::empty(),
10220 ___deadline,
10221 )?;
10222 Ok(_response.status)
10223 }
10224
10225 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10227 self.client.send::<fidl::encoding::EmptyPayload>(
10228 (),
10229 0x5f79ee6a0bb037a0,
10230 fidl::encoding::DynamicFlags::empty(),
10231 )
10232 }
10233
10234 pub fn r#connect_peripheral(
10241 &self,
10242 mut identifier: &str,
10243 mut options: &ConnectionOptions,
10244 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10245 ___deadline: zx::MonotonicInstant,
10246 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10247 let _response = self
10248 .client
10249 .send_query::<CentralConnectPeripheralRequest, CentralConnectPeripheralResponse>(
10250 (identifier, options, gatt_client),
10251 0x714d6c32d066d75a,
10252 fidl::encoding::DynamicFlags::empty(),
10253 ___deadline,
10254 )?;
10255 Ok(_response.status)
10256 }
10257
10258 pub fn r#disconnect_peripheral(
10260 &self,
10261 mut identifier: &str,
10262 ___deadline: zx::MonotonicInstant,
10263 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10264 let _response = self
10265 .client
10266 .send_query::<CentralDisconnectPeripheralRequest, CentralDisconnectPeripheralResponse>(
10267 (identifier,),
10268 0xa9430da197362fd,
10269 fidl::encoding::DynamicFlags::empty(),
10270 ___deadline,
10271 )?;
10272 Ok(_response.status)
10273 }
10274}
10275
10276#[cfg(target_os = "fuchsia")]
10277impl From<PrivilegedCentralSynchronousProxy> for zx::NullableHandle {
10278 fn from(value: PrivilegedCentralSynchronousProxy) -> Self {
10279 value.into_channel().into()
10280 }
10281}
10282
10283#[cfg(target_os = "fuchsia")]
10284impl From<fidl::Channel> for PrivilegedCentralSynchronousProxy {
10285 fn from(value: fidl::Channel) -> Self {
10286 Self::new(value)
10287 }
10288}
10289
10290#[cfg(target_os = "fuchsia")]
10291impl fidl::endpoints::FromClient for PrivilegedCentralSynchronousProxy {
10292 type Protocol = PrivilegedCentralMarker;
10293
10294 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedCentralMarker>) -> Self {
10295 Self::new(value.into_channel())
10296 }
10297}
10298
10299#[derive(Debug, Clone)]
10300pub struct PrivilegedCentralProxy {
10301 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10302}
10303
10304impl fidl::endpoints::Proxy for PrivilegedCentralProxy {
10305 type Protocol = PrivilegedCentralMarker;
10306
10307 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10308 Self::new(inner)
10309 }
10310
10311 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10312 self.client.into_channel().map_err(|client| Self { client })
10313 }
10314
10315 fn as_channel(&self) -> &::fidl::AsyncChannel {
10316 self.client.as_channel()
10317 }
10318}
10319
10320impl PrivilegedCentralProxy {
10321 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10323 let protocol_name =
10324 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10325 Self { client: fidl::client::Client::new(channel, protocol_name) }
10326 }
10327
10328 pub fn take_event_stream(&self) -> PrivilegedCentralEventStream {
10334 PrivilegedCentralEventStream { event_receiver: self.client.take_event_receiver() }
10335 }
10336
10337 pub fn r#listen_l2cap(
10347 &self,
10348 mut payload: ChannelListenerRegistryListenL2capRequest,
10349 ) -> fidl::client::QueryResponseFut<
10350 ChannelListenerRegistryListenL2capResult,
10351 fidl::encoding::DefaultFuchsiaResourceDialect,
10352 > {
10353 PrivilegedCentralProxyInterface::r#listen_l2cap(self, payload)
10354 }
10355
10356 pub fn r#scan(
10383 &self,
10384 mut options: &ScanOptions,
10385 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10386 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
10387 PrivilegedCentralProxyInterface::r#scan(self, options, result_watcher)
10388 }
10389
10390 pub fn r#connect(
10412 &self,
10413 mut id: &fidl_fuchsia_bluetooth::PeerId,
10414 mut options: &ConnectionOptions,
10415 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10416 ) -> Result<(), fidl::Error> {
10417 PrivilegedCentralProxyInterface::r#connect(self, id, options, handle)
10418 }
10419
10420 pub fn r#sync_to_periodic_advertising(
10423 &self,
10424 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10425 ) -> Result<(), fidl::Error> {
10426 PrivilegedCentralProxyInterface::r#sync_to_periodic_advertising(self, payload)
10427 }
10428
10429 pub fn r#create_connected_isochronous_group(
10438 &self,
10439 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10440 ) -> fidl::client::QueryResponseFut<
10441 CentralCreateConnectedIsochronousGroupResult,
10442 fidl::encoding::DefaultFuchsiaResourceDialect,
10443 > {
10444 PrivilegedCentralProxyInterface::r#create_connected_isochronous_group(self, payload)
10445 }
10446
10447 pub fn r#get_peripherals(
10453 &self,
10454 mut service_uuids: Option<&[String]>,
10455 ) -> fidl::client::QueryResponseFut<
10456 Vec<RemoteDevice>,
10457 fidl::encoding::DefaultFuchsiaResourceDialect,
10458 > {
10459 PrivilegedCentralProxyInterface::r#get_peripherals(self, service_uuids)
10460 }
10461
10462 pub fn r#get_peripheral(
10468 &self,
10469 mut identifier: &str,
10470 ) -> fidl::client::QueryResponseFut<
10471 Option<Box<RemoteDevice>>,
10472 fidl::encoding::DefaultFuchsiaResourceDialect,
10473 > {
10474 PrivilegedCentralProxyInterface::r#get_peripheral(self, identifier)
10475 }
10476
10477 pub fn r#start_scan(
10486 &self,
10487 mut filter: Option<&ScanFilter>,
10488 ) -> fidl::client::QueryResponseFut<
10489 fidl_fuchsia_bluetooth::Status,
10490 fidl::encoding::DefaultFuchsiaResourceDialect,
10491 > {
10492 PrivilegedCentralProxyInterface::r#start_scan(self, filter)
10493 }
10494
10495 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10497 PrivilegedCentralProxyInterface::r#stop_scan(self)
10498 }
10499
10500 pub fn r#connect_peripheral(
10507 &self,
10508 mut identifier: &str,
10509 mut options: &ConnectionOptions,
10510 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10511 ) -> fidl::client::QueryResponseFut<
10512 fidl_fuchsia_bluetooth::Status,
10513 fidl::encoding::DefaultFuchsiaResourceDialect,
10514 > {
10515 PrivilegedCentralProxyInterface::r#connect_peripheral(
10516 self,
10517 identifier,
10518 options,
10519 gatt_client,
10520 )
10521 }
10522
10523 pub fn r#disconnect_peripheral(
10525 &self,
10526 mut identifier: &str,
10527 ) -> fidl::client::QueryResponseFut<
10528 fidl_fuchsia_bluetooth::Status,
10529 fidl::encoding::DefaultFuchsiaResourceDialect,
10530 > {
10531 PrivilegedCentralProxyInterface::r#disconnect_peripheral(self, identifier)
10532 }
10533}
10534
10535impl PrivilegedCentralProxyInterface for PrivilegedCentralProxy {
10536 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
10537 ChannelListenerRegistryListenL2capResult,
10538 fidl::encoding::DefaultFuchsiaResourceDialect,
10539 >;
10540 fn r#listen_l2cap(
10541 &self,
10542 mut payload: ChannelListenerRegistryListenL2capRequest,
10543 ) -> Self::ListenL2capResponseFut {
10544 fn _decode(
10545 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10546 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
10547 let _response = fidl::client::decode_transaction_body::<
10548 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
10549 fidl::encoding::DefaultFuchsiaResourceDialect,
10550 0x39c6e9001d102338,
10551 >(_buf?)?;
10552 Ok(_response.map(|x| x))
10553 }
10554 self.client.send_query_and_decode::<
10555 ChannelListenerRegistryListenL2capRequest,
10556 ChannelListenerRegistryListenL2capResult,
10557 >(
10558 &mut payload,
10559 0x39c6e9001d102338,
10560 fidl::encoding::DynamicFlags::empty(),
10561 _decode,
10562 )
10563 }
10564
10565 type ScanResponseFut =
10566 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
10567 fn r#scan(
10568 &self,
10569 mut options: &ScanOptions,
10570 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
10571 ) -> Self::ScanResponseFut {
10572 fn _decode(
10573 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10574 ) -> Result<(), fidl::Error> {
10575 let _response = fidl::client::decode_transaction_body::<
10576 fidl::encoding::EmptyPayload,
10577 fidl::encoding::DefaultFuchsiaResourceDialect,
10578 0x41f7121798dfe15f,
10579 >(_buf?)?;
10580 Ok(_response)
10581 }
10582 self.client.send_query_and_decode::<CentralScanRequest, ()>(
10583 (options, result_watcher),
10584 0x41f7121798dfe15f,
10585 fidl::encoding::DynamicFlags::empty(),
10586 _decode,
10587 )
10588 }
10589
10590 fn r#connect(
10591 &self,
10592 mut id: &fidl_fuchsia_bluetooth::PeerId,
10593 mut options: &ConnectionOptions,
10594 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
10595 ) -> Result<(), fidl::Error> {
10596 self.client.send::<CentralConnectRequest>(
10597 (id, options, handle),
10598 0x31a3065f2a6913c4,
10599 fidl::encoding::DynamicFlags::empty(),
10600 )
10601 }
10602
10603 fn r#sync_to_periodic_advertising(
10604 &self,
10605 mut payload: CentralSyncToPeriodicAdvertisingRequest,
10606 ) -> Result<(), fidl::Error> {
10607 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
10608 &mut payload,
10609 0x1db6df126a00c5b9,
10610 fidl::encoding::DynamicFlags::empty(),
10611 )
10612 }
10613
10614 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
10615 CentralCreateConnectedIsochronousGroupResult,
10616 fidl::encoding::DefaultFuchsiaResourceDialect,
10617 >;
10618 fn r#create_connected_isochronous_group(
10619 &self,
10620 mut payload: CentralCreateConnectedIsochronousGroupRequest,
10621 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
10622 fn _decode(
10623 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10624 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
10625 let _response = fidl::client::decode_transaction_body::<
10626 fidl::encoding::ResultType<
10627 CentralCreateConnectedIsochronousGroupResponse,
10628 CreateCigError,
10629 >,
10630 fidl::encoding::DefaultFuchsiaResourceDialect,
10631 0x60323e70ae22e13,
10632 >(_buf?)?;
10633 Ok(_response.map(|x| x))
10634 }
10635 self.client.send_query_and_decode::<
10636 CentralCreateConnectedIsochronousGroupRequest,
10637 CentralCreateConnectedIsochronousGroupResult,
10638 >(
10639 &mut payload,
10640 0x60323e70ae22e13,
10641 fidl::encoding::DynamicFlags::empty(),
10642 _decode,
10643 )
10644 }
10645
10646 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
10647 Vec<RemoteDevice>,
10648 fidl::encoding::DefaultFuchsiaResourceDialect,
10649 >;
10650 fn r#get_peripherals(
10651 &self,
10652 mut service_uuids: Option<&[String]>,
10653 ) -> Self::GetPeripheralsResponseFut {
10654 fn _decode(
10655 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10656 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
10657 let _response = fidl::client::decode_transaction_body::<
10658 CentralGetPeripheralsResponse,
10659 fidl::encoding::DefaultFuchsiaResourceDialect,
10660 0x37ba777499c683a8,
10661 >(_buf?)?;
10662 Ok(_response.peripherals)
10663 }
10664 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
10665 (service_uuids,),
10666 0x37ba777499c683a8,
10667 fidl::encoding::DynamicFlags::empty(),
10668 _decode,
10669 )
10670 }
10671
10672 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
10673 Option<Box<RemoteDevice>>,
10674 fidl::encoding::DefaultFuchsiaResourceDialect,
10675 >;
10676 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
10677 fn _decode(
10678 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10679 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
10680 let _response = fidl::client::decode_transaction_body::<
10681 CentralGetPeripheralResponse,
10682 fidl::encoding::DefaultFuchsiaResourceDialect,
10683 0x97f5a2f2d9c13da,
10684 >(_buf?)?;
10685 Ok(_response.peripheral)
10686 }
10687 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
10688 (identifier,),
10689 0x97f5a2f2d9c13da,
10690 fidl::encoding::DynamicFlags::empty(),
10691 _decode,
10692 )
10693 }
10694
10695 type StartScanResponseFut = fidl::client::QueryResponseFut<
10696 fidl_fuchsia_bluetooth::Status,
10697 fidl::encoding::DefaultFuchsiaResourceDialect,
10698 >;
10699 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
10700 fn _decode(
10701 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10702 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10703 let _response = fidl::client::decode_transaction_body::<
10704 CentralStartScanResponse,
10705 fidl::encoding::DefaultFuchsiaResourceDialect,
10706 0xeb4cf0cd0e1132b,
10707 >(_buf?)?;
10708 Ok(_response.status)
10709 }
10710 self.client
10711 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
10712 (filter,),
10713 0xeb4cf0cd0e1132b,
10714 fidl::encoding::DynamicFlags::empty(),
10715 _decode,
10716 )
10717 }
10718
10719 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
10720 self.client.send::<fidl::encoding::EmptyPayload>(
10721 (),
10722 0x5f79ee6a0bb037a0,
10723 fidl::encoding::DynamicFlags::empty(),
10724 )
10725 }
10726
10727 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
10728 fidl_fuchsia_bluetooth::Status,
10729 fidl::encoding::DefaultFuchsiaResourceDialect,
10730 >;
10731 fn r#connect_peripheral(
10732 &self,
10733 mut identifier: &str,
10734 mut options: &ConnectionOptions,
10735 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10736 ) -> Self::ConnectPeripheralResponseFut {
10737 fn _decode(
10738 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10739 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10740 let _response = fidl::client::decode_transaction_body::<
10741 CentralConnectPeripheralResponse,
10742 fidl::encoding::DefaultFuchsiaResourceDialect,
10743 0x714d6c32d066d75a,
10744 >(_buf?)?;
10745 Ok(_response.status)
10746 }
10747 self.client.send_query_and_decode::<
10748 CentralConnectPeripheralRequest,
10749 fidl_fuchsia_bluetooth::Status,
10750 >(
10751 (identifier, options, gatt_client,),
10752 0x714d6c32d066d75a,
10753 fidl::encoding::DynamicFlags::empty(),
10754 _decode,
10755 )
10756 }
10757
10758 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
10759 fidl_fuchsia_bluetooth::Status,
10760 fidl::encoding::DefaultFuchsiaResourceDialect,
10761 >;
10762 fn r#disconnect_peripheral(
10763 &self,
10764 mut identifier: &str,
10765 ) -> Self::DisconnectPeripheralResponseFut {
10766 fn _decode(
10767 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10768 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
10769 let _response = fidl::client::decode_transaction_body::<
10770 CentralDisconnectPeripheralResponse,
10771 fidl::encoding::DefaultFuchsiaResourceDialect,
10772 0xa9430da197362fd,
10773 >(_buf?)?;
10774 Ok(_response.status)
10775 }
10776 self.client.send_query_and_decode::<
10777 CentralDisconnectPeripheralRequest,
10778 fidl_fuchsia_bluetooth::Status,
10779 >(
10780 (identifier,),
10781 0xa9430da197362fd,
10782 fidl::encoding::DynamicFlags::empty(),
10783 _decode,
10784 )
10785 }
10786}
10787
10788pub struct PrivilegedCentralEventStream {
10789 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10790}
10791
10792impl std::marker::Unpin for PrivilegedCentralEventStream {}
10793
10794impl futures::stream::FusedStream for PrivilegedCentralEventStream {
10795 fn is_terminated(&self) -> bool {
10796 self.event_receiver.is_terminated()
10797 }
10798}
10799
10800impl futures::Stream for PrivilegedCentralEventStream {
10801 type Item = Result<PrivilegedCentralEvent, fidl::Error>;
10802
10803 fn poll_next(
10804 mut self: std::pin::Pin<&mut Self>,
10805 cx: &mut std::task::Context<'_>,
10806 ) -> std::task::Poll<Option<Self::Item>> {
10807 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10808 &mut self.event_receiver,
10809 cx
10810 )?) {
10811 Some(buf) => std::task::Poll::Ready(Some(PrivilegedCentralEvent::decode(buf))),
10812 None => std::task::Poll::Ready(None),
10813 }
10814 }
10815}
10816
10817#[derive(Debug)]
10818pub enum PrivilegedCentralEvent {
10819 OnScanStateChanged { scanning: bool },
10820 OnDeviceDiscovered { device: RemoteDevice },
10821 OnPeripheralDisconnected { identifier: String },
10822}
10823
10824impl PrivilegedCentralEvent {
10825 #[allow(irrefutable_let_patterns)]
10826 pub fn into_on_scan_state_changed(self) -> Option<bool> {
10827 if let PrivilegedCentralEvent::OnScanStateChanged { scanning } = self {
10828 Some((scanning))
10829 } else {
10830 None
10831 }
10832 }
10833 #[allow(irrefutable_let_patterns)]
10834 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
10835 if let PrivilegedCentralEvent::OnDeviceDiscovered { device } = self {
10836 Some((device))
10837 } else {
10838 None
10839 }
10840 }
10841 #[allow(irrefutable_let_patterns)]
10842 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
10843 if let PrivilegedCentralEvent::OnPeripheralDisconnected { identifier } = self {
10844 Some((identifier))
10845 } else {
10846 None
10847 }
10848 }
10849
10850 fn decode(
10852 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10853 ) -> Result<PrivilegedCentralEvent, fidl::Error> {
10854 let (bytes, _handles) = buf.split_mut();
10855 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10856 debug_assert_eq!(tx_header.tx_id, 0);
10857 match tx_header.ordinal {
10858 0x5f8edc23cad04d3f => {
10859 let mut out = fidl::new_empty!(
10860 CentralOnScanStateChangedRequest,
10861 fidl::encoding::DefaultFuchsiaResourceDialect
10862 );
10863 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10864 Ok((PrivilegedCentralEvent::OnScanStateChanged { scanning: out.scanning }))
10865 }
10866 0x708dadf20d66db6 => {
10867 let mut out = fidl::new_empty!(
10868 CentralOnDeviceDiscoveredRequest,
10869 fidl::encoding::DefaultFuchsiaResourceDialect
10870 );
10871 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10872 Ok((PrivilegedCentralEvent::OnDeviceDiscovered { device: out.device }))
10873 }
10874 0x4e4c6b979b2126df => {
10875 let mut out = fidl::new_empty!(
10876 CentralOnPeripheralDisconnectedRequest,
10877 fidl::encoding::DefaultFuchsiaResourceDialect
10878 );
10879 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
10880 Ok((PrivilegedCentralEvent::OnPeripheralDisconnected {
10881 identifier: out.identifier,
10882 }))
10883 }
10884 _ => Err(fidl::Error::UnknownOrdinal {
10885 ordinal: tx_header.ordinal,
10886 protocol_name:
10887 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10888 }),
10889 }
10890 }
10891}
10892
10893pub struct PrivilegedCentralRequestStream {
10895 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10896 is_terminated: bool,
10897}
10898
10899impl std::marker::Unpin for PrivilegedCentralRequestStream {}
10900
10901impl futures::stream::FusedStream for PrivilegedCentralRequestStream {
10902 fn is_terminated(&self) -> bool {
10903 self.is_terminated
10904 }
10905}
10906
10907impl fidl::endpoints::RequestStream for PrivilegedCentralRequestStream {
10908 type Protocol = PrivilegedCentralMarker;
10909 type ControlHandle = PrivilegedCentralControlHandle;
10910
10911 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10912 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10913 }
10914
10915 fn control_handle(&self) -> Self::ControlHandle {
10916 PrivilegedCentralControlHandle { inner: self.inner.clone() }
10917 }
10918
10919 fn into_inner(
10920 self,
10921 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10922 {
10923 (self.inner, self.is_terminated)
10924 }
10925
10926 fn from_inner(
10927 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10928 is_terminated: bool,
10929 ) -> Self {
10930 Self { inner, is_terminated }
10931 }
10932}
10933
10934impl futures::Stream for PrivilegedCentralRequestStream {
10935 type Item = Result<PrivilegedCentralRequest, fidl::Error>;
10936
10937 fn poll_next(
10938 mut self: std::pin::Pin<&mut Self>,
10939 cx: &mut std::task::Context<'_>,
10940 ) -> std::task::Poll<Option<Self::Item>> {
10941 let this = &mut *self;
10942 if this.inner.check_shutdown(cx) {
10943 this.is_terminated = true;
10944 return std::task::Poll::Ready(None);
10945 }
10946 if this.is_terminated {
10947 panic!("polled PrivilegedCentralRequestStream after completion");
10948 }
10949 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10950 |bytes, handles| {
10951 match this.inner.channel().read_etc(cx, bytes, handles) {
10952 std::task::Poll::Ready(Ok(())) => {}
10953 std::task::Poll::Pending => return std::task::Poll::Pending,
10954 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10955 this.is_terminated = true;
10956 return std::task::Poll::Ready(None);
10957 }
10958 std::task::Poll::Ready(Err(e)) => {
10959 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10960 e.into(),
10961 ))));
10962 }
10963 }
10964
10965 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10967
10968 std::task::Poll::Ready(Some(match header.ordinal {
10969 0x39c6e9001d102338 => {
10970 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10971 let mut req = fidl::new_empty!(
10972 ChannelListenerRegistryListenL2capRequest,
10973 fidl::encoding::DefaultFuchsiaResourceDialect
10974 );
10975 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
10976 let control_handle =
10977 PrivilegedCentralControlHandle { inner: this.inner.clone() };
10978 Ok(PrivilegedCentralRequest::ListenL2cap {
10979 payload: req,
10980 responder: PrivilegedCentralListenL2capResponder {
10981 control_handle: std::mem::ManuallyDrop::new(control_handle),
10982 tx_id: header.tx_id,
10983 },
10984 })
10985 }
10986 0x41f7121798dfe15f => {
10987 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10988 let mut req = fidl::new_empty!(
10989 CentralScanRequest,
10990 fidl::encoding::DefaultFuchsiaResourceDialect
10991 );
10992 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
10993 let control_handle =
10994 PrivilegedCentralControlHandle { inner: this.inner.clone() };
10995 Ok(PrivilegedCentralRequest::Scan {
10996 options: req.options,
10997 result_watcher: req.result_watcher,
10998
10999 responder: PrivilegedCentralScanResponder {
11000 control_handle: std::mem::ManuallyDrop::new(control_handle),
11001 tx_id: header.tx_id,
11002 },
11003 })
11004 }
11005 0x31a3065f2a6913c4 => {
11006 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11007 let mut req = fidl::new_empty!(
11008 CentralConnectRequest,
11009 fidl::encoding::DefaultFuchsiaResourceDialect
11010 );
11011 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
11012 let control_handle =
11013 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11014 Ok(PrivilegedCentralRequest::Connect {
11015 id: req.id,
11016 options: req.options,
11017 handle: req.handle,
11018
11019 control_handle,
11020 })
11021 }
11022 0x1db6df126a00c5b9 => {
11023 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11024 let mut req = fidl::new_empty!(
11025 CentralSyncToPeriodicAdvertisingRequest,
11026 fidl::encoding::DefaultFuchsiaResourceDialect
11027 );
11028 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralSyncToPeriodicAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
11029 let control_handle =
11030 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11031 Ok(PrivilegedCentralRequest::SyncToPeriodicAdvertising {
11032 payload: req,
11033 control_handle,
11034 })
11035 }
11036 0x60323e70ae22e13 => {
11037 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11038 let mut req = fidl::new_empty!(
11039 CentralCreateConnectedIsochronousGroupRequest,
11040 fidl::encoding::DefaultFuchsiaResourceDialect
11041 );
11042 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
11043 let control_handle =
11044 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11045 Ok(PrivilegedCentralRequest::CreateConnectedIsochronousGroup {
11046 payload: req,
11047 responder: PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11048 control_handle: std::mem::ManuallyDrop::new(control_handle),
11049 tx_id: header.tx_id,
11050 },
11051 })
11052 }
11053 0x37ba777499c683a8 => {
11054 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11055 let mut req = fidl::new_empty!(
11056 CentralGetPeripheralsRequest,
11057 fidl::encoding::DefaultFuchsiaResourceDialect
11058 );
11059 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
11060 let control_handle =
11061 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11062 Ok(PrivilegedCentralRequest::GetPeripherals {
11063 service_uuids: req.service_uuids,
11064
11065 responder: PrivilegedCentralGetPeripheralsResponder {
11066 control_handle: std::mem::ManuallyDrop::new(control_handle),
11067 tx_id: header.tx_id,
11068 },
11069 })
11070 }
11071 0x97f5a2f2d9c13da => {
11072 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11073 let mut req = fidl::new_empty!(
11074 CentralGetPeripheralRequest,
11075 fidl::encoding::DefaultFuchsiaResourceDialect
11076 );
11077 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11078 let control_handle =
11079 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11080 Ok(PrivilegedCentralRequest::GetPeripheral {
11081 identifier: req.identifier,
11082
11083 responder: PrivilegedCentralGetPeripheralResponder {
11084 control_handle: std::mem::ManuallyDrop::new(control_handle),
11085 tx_id: header.tx_id,
11086 },
11087 })
11088 }
11089 0xeb4cf0cd0e1132b => {
11090 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11091 let mut req = fidl::new_empty!(
11092 CentralStartScanRequest,
11093 fidl::encoding::DefaultFuchsiaResourceDialect
11094 );
11095 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
11096 let control_handle =
11097 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11098 Ok(PrivilegedCentralRequest::StartScan {
11099 filter: req.filter,
11100
11101 responder: PrivilegedCentralStartScanResponder {
11102 control_handle: std::mem::ManuallyDrop::new(control_handle),
11103 tx_id: header.tx_id,
11104 },
11105 })
11106 }
11107 0x5f79ee6a0bb037a0 => {
11108 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
11109 let mut req = fidl::new_empty!(
11110 fidl::encoding::EmptyPayload,
11111 fidl::encoding::DefaultFuchsiaResourceDialect
11112 );
11113 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11114 let control_handle =
11115 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11116 Ok(PrivilegedCentralRequest::StopScan { control_handle })
11117 }
11118 0x714d6c32d066d75a => {
11119 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11120 let mut req = fidl::new_empty!(
11121 CentralConnectPeripheralRequest,
11122 fidl::encoding::DefaultFuchsiaResourceDialect
11123 );
11124 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11125 let control_handle =
11126 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11127 Ok(PrivilegedCentralRequest::ConnectPeripheral {
11128 identifier: req.identifier,
11129 options: req.options,
11130 gatt_client: req.gatt_client,
11131
11132 responder: PrivilegedCentralConnectPeripheralResponder {
11133 control_handle: std::mem::ManuallyDrop::new(control_handle),
11134 tx_id: header.tx_id,
11135 },
11136 })
11137 }
11138 0xa9430da197362fd => {
11139 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11140 let mut req = fidl::new_empty!(
11141 CentralDisconnectPeripheralRequest,
11142 fidl::encoding::DefaultFuchsiaResourceDialect
11143 );
11144 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
11145 let control_handle =
11146 PrivilegedCentralControlHandle { inner: this.inner.clone() };
11147 Ok(PrivilegedCentralRequest::DisconnectPeripheral {
11148 identifier: req.identifier,
11149
11150 responder: PrivilegedCentralDisconnectPeripheralResponder {
11151 control_handle: std::mem::ManuallyDrop::new(control_handle),
11152 tx_id: header.tx_id,
11153 },
11154 })
11155 }
11156 _ => Err(fidl::Error::UnknownOrdinal {
11157 ordinal: header.ordinal,
11158 protocol_name:
11159 <PrivilegedCentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11160 }),
11161 }))
11162 },
11163 )
11164 }
11165}
11166
11167#[derive(Debug)]
11171pub enum PrivilegedCentralRequest {
11172 ListenL2cap {
11182 payload: ChannelListenerRegistryListenL2capRequest,
11183 responder: PrivilegedCentralListenL2capResponder,
11184 },
11185 Scan {
11212 options: ScanOptions,
11213 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
11214 responder: PrivilegedCentralScanResponder,
11215 },
11216 Connect {
11238 id: fidl_fuchsia_bluetooth::PeerId,
11239 options: ConnectionOptions,
11240 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
11241 control_handle: PrivilegedCentralControlHandle,
11242 },
11243 SyncToPeriodicAdvertising {
11246 payload: CentralSyncToPeriodicAdvertisingRequest,
11247 control_handle: PrivilegedCentralControlHandle,
11248 },
11249 CreateConnectedIsochronousGroup {
11258 payload: CentralCreateConnectedIsochronousGroupRequest,
11259 responder: PrivilegedCentralCreateConnectedIsochronousGroupResponder,
11260 },
11261 GetPeripherals {
11267 service_uuids: Option<Vec<String>>,
11268 responder: PrivilegedCentralGetPeripheralsResponder,
11269 },
11270 GetPeripheral { identifier: String, responder: PrivilegedCentralGetPeripheralResponder },
11276 StartScan { filter: Option<Box<ScanFilter>>, responder: PrivilegedCentralStartScanResponder },
11285 StopScan { control_handle: PrivilegedCentralControlHandle },
11287 ConnectPeripheral {
11294 identifier: String,
11295 options: ConnectionOptions,
11296 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
11297 responder: PrivilegedCentralConnectPeripheralResponder,
11298 },
11299 DisconnectPeripheral {
11301 identifier: String,
11302 responder: PrivilegedCentralDisconnectPeripheralResponder,
11303 },
11304}
11305
11306impl PrivilegedCentralRequest {
11307 #[allow(irrefutable_let_patterns)]
11308 pub fn into_listen_l2cap(
11309 self,
11310 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedCentralListenL2capResponder)>
11311 {
11312 if let PrivilegedCentralRequest::ListenL2cap { payload, responder } = self {
11313 Some((payload, responder))
11314 } else {
11315 None
11316 }
11317 }
11318
11319 #[allow(irrefutable_let_patterns)]
11320 pub fn into_scan(
11321 self,
11322 ) -> Option<(
11323 ScanOptions,
11324 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
11325 PrivilegedCentralScanResponder,
11326 )> {
11327 if let PrivilegedCentralRequest::Scan { options, result_watcher, responder } = self {
11328 Some((options, result_watcher, responder))
11329 } else {
11330 None
11331 }
11332 }
11333
11334 #[allow(irrefutable_let_patterns)]
11335 pub fn into_connect(
11336 self,
11337 ) -> Option<(
11338 fidl_fuchsia_bluetooth::PeerId,
11339 ConnectionOptions,
11340 fidl::endpoints::ServerEnd<ConnectionMarker>,
11341 PrivilegedCentralControlHandle,
11342 )> {
11343 if let PrivilegedCentralRequest::Connect { id, options, handle, control_handle } = self {
11344 Some((id, options, handle, control_handle))
11345 } else {
11346 None
11347 }
11348 }
11349
11350 #[allow(irrefutable_let_patterns)]
11351 pub fn into_sync_to_periodic_advertising(
11352 self,
11353 ) -> Option<(CentralSyncToPeriodicAdvertisingRequest, PrivilegedCentralControlHandle)> {
11354 if let PrivilegedCentralRequest::SyncToPeriodicAdvertising { payload, control_handle } =
11355 self
11356 {
11357 Some((payload, control_handle))
11358 } else {
11359 None
11360 }
11361 }
11362
11363 #[allow(irrefutable_let_patterns)]
11364 pub fn into_create_connected_isochronous_group(
11365 self,
11366 ) -> Option<(
11367 CentralCreateConnectedIsochronousGroupRequest,
11368 PrivilegedCentralCreateConnectedIsochronousGroupResponder,
11369 )> {
11370 if let PrivilegedCentralRequest::CreateConnectedIsochronousGroup { payload, responder } =
11371 self
11372 {
11373 Some((payload, responder))
11374 } else {
11375 None
11376 }
11377 }
11378
11379 #[allow(irrefutable_let_patterns)]
11380 pub fn into_get_peripherals(
11381 self,
11382 ) -> Option<(Option<Vec<String>>, PrivilegedCentralGetPeripheralsResponder)> {
11383 if let PrivilegedCentralRequest::GetPeripherals { service_uuids, responder } = self {
11384 Some((service_uuids, responder))
11385 } else {
11386 None
11387 }
11388 }
11389
11390 #[allow(irrefutable_let_patterns)]
11391 pub fn into_get_peripheral(self) -> Option<(String, PrivilegedCentralGetPeripheralResponder)> {
11392 if let PrivilegedCentralRequest::GetPeripheral { identifier, responder } = self {
11393 Some((identifier, responder))
11394 } else {
11395 None
11396 }
11397 }
11398
11399 #[allow(irrefutable_let_patterns)]
11400 pub fn into_start_scan(
11401 self,
11402 ) -> Option<(Option<Box<ScanFilter>>, PrivilegedCentralStartScanResponder)> {
11403 if let PrivilegedCentralRequest::StartScan { filter, responder } = self {
11404 Some((filter, responder))
11405 } else {
11406 None
11407 }
11408 }
11409
11410 #[allow(irrefutable_let_patterns)]
11411 pub fn into_stop_scan(self) -> Option<(PrivilegedCentralControlHandle)> {
11412 if let PrivilegedCentralRequest::StopScan { control_handle } = self {
11413 Some((control_handle))
11414 } else {
11415 None
11416 }
11417 }
11418
11419 #[allow(irrefutable_let_patterns)]
11420 pub fn into_connect_peripheral(
11421 self,
11422 ) -> Option<(
11423 String,
11424 ConnectionOptions,
11425 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
11426 PrivilegedCentralConnectPeripheralResponder,
11427 )> {
11428 if let PrivilegedCentralRequest::ConnectPeripheral {
11429 identifier,
11430 options,
11431 gatt_client,
11432 responder,
11433 } = self
11434 {
11435 Some((identifier, options, gatt_client, responder))
11436 } else {
11437 None
11438 }
11439 }
11440
11441 #[allow(irrefutable_let_patterns)]
11442 pub fn into_disconnect_peripheral(
11443 self,
11444 ) -> Option<(String, PrivilegedCentralDisconnectPeripheralResponder)> {
11445 if let PrivilegedCentralRequest::DisconnectPeripheral { identifier, responder } = self {
11446 Some((identifier, responder))
11447 } else {
11448 None
11449 }
11450 }
11451
11452 pub fn method_name(&self) -> &'static str {
11454 match *self {
11455 PrivilegedCentralRequest::ListenL2cap { .. } => "listen_l2cap",
11456 PrivilegedCentralRequest::Scan { .. } => "scan",
11457 PrivilegedCentralRequest::Connect { .. } => "connect",
11458 PrivilegedCentralRequest::SyncToPeriodicAdvertising { .. } => {
11459 "sync_to_periodic_advertising"
11460 }
11461 PrivilegedCentralRequest::CreateConnectedIsochronousGroup { .. } => {
11462 "create_connected_isochronous_group"
11463 }
11464 PrivilegedCentralRequest::GetPeripherals { .. } => "get_peripherals",
11465 PrivilegedCentralRequest::GetPeripheral { .. } => "get_peripheral",
11466 PrivilegedCentralRequest::StartScan { .. } => "start_scan",
11467 PrivilegedCentralRequest::StopScan { .. } => "stop_scan",
11468 PrivilegedCentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
11469 PrivilegedCentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
11470 }
11471 }
11472}
11473
11474#[derive(Debug, Clone)]
11475pub struct PrivilegedCentralControlHandle {
11476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11477}
11478
11479impl fidl::endpoints::ControlHandle for PrivilegedCentralControlHandle {
11480 fn shutdown(&self) {
11481 self.inner.shutdown()
11482 }
11483
11484 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11485 self.inner.shutdown_with_epitaph(status)
11486 }
11487
11488 fn is_closed(&self) -> bool {
11489 self.inner.channel().is_closed()
11490 }
11491 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11492 self.inner.channel().on_closed()
11493 }
11494
11495 #[cfg(target_os = "fuchsia")]
11496 fn signal_peer(
11497 &self,
11498 clear_mask: zx::Signals,
11499 set_mask: zx::Signals,
11500 ) -> Result<(), zx_status::Status> {
11501 use fidl::Peered;
11502 self.inner.channel().signal_peer(clear_mask, set_mask)
11503 }
11504}
11505
11506impl PrivilegedCentralControlHandle {
11507 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
11508 self.inner.send::<CentralOnScanStateChangedRequest>(
11509 (scanning,),
11510 0,
11511 0x5f8edc23cad04d3f,
11512 fidl::encoding::DynamicFlags::empty(),
11513 )
11514 }
11515
11516 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
11517 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
11518 (device,),
11519 0,
11520 0x708dadf20d66db6,
11521 fidl::encoding::DynamicFlags::empty(),
11522 )
11523 }
11524
11525 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
11526 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
11527 (identifier,),
11528 0,
11529 0x4e4c6b979b2126df,
11530 fidl::encoding::DynamicFlags::empty(),
11531 )
11532 }
11533}
11534
11535#[must_use = "FIDL methods require a response to be sent"]
11536#[derive(Debug)]
11537pub struct PrivilegedCentralListenL2capResponder {
11538 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11539 tx_id: u32,
11540}
11541
11542impl std::ops::Drop for PrivilegedCentralListenL2capResponder {
11546 fn drop(&mut self) {
11547 self.control_handle.shutdown();
11548 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11550 }
11551}
11552
11553impl fidl::endpoints::Responder for PrivilegedCentralListenL2capResponder {
11554 type ControlHandle = PrivilegedCentralControlHandle;
11555
11556 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11557 &self.control_handle
11558 }
11559
11560 fn drop_without_shutdown(mut self) {
11561 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11563 std::mem::forget(self);
11565 }
11566}
11567
11568impl PrivilegedCentralListenL2capResponder {
11569 pub fn send(
11573 self,
11574 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11575 ) -> Result<(), fidl::Error> {
11576 let _result = self.send_raw(result);
11577 if _result.is_err() {
11578 self.control_handle.shutdown();
11579 }
11580 self.drop_without_shutdown();
11581 _result
11582 }
11583
11584 pub fn send_no_shutdown_on_err(
11586 self,
11587 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11588 ) -> Result<(), fidl::Error> {
11589 let _result = self.send_raw(result);
11590 self.drop_without_shutdown();
11591 _result
11592 }
11593
11594 fn send_raw(
11595 &self,
11596 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
11597 ) -> Result<(), fidl::Error> {
11598 self.control_handle.inner.send::<fidl::encoding::ResultType<
11599 ChannelListenerRegistryListenL2capResponse,
11600 i32,
11601 >>(
11602 result,
11603 self.tx_id,
11604 0x39c6e9001d102338,
11605 fidl::encoding::DynamicFlags::empty(),
11606 )
11607 }
11608}
11609
11610#[must_use = "FIDL methods require a response to be sent"]
11611#[derive(Debug)]
11612pub struct PrivilegedCentralScanResponder {
11613 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11614 tx_id: u32,
11615}
11616
11617impl std::ops::Drop for PrivilegedCentralScanResponder {
11621 fn drop(&mut self) {
11622 self.control_handle.shutdown();
11623 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11625 }
11626}
11627
11628impl fidl::endpoints::Responder for PrivilegedCentralScanResponder {
11629 type ControlHandle = PrivilegedCentralControlHandle;
11630
11631 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11632 &self.control_handle
11633 }
11634
11635 fn drop_without_shutdown(mut self) {
11636 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11638 std::mem::forget(self);
11640 }
11641}
11642
11643impl PrivilegedCentralScanResponder {
11644 pub fn send(self) -> Result<(), fidl::Error> {
11648 let _result = self.send_raw();
11649 if _result.is_err() {
11650 self.control_handle.shutdown();
11651 }
11652 self.drop_without_shutdown();
11653 _result
11654 }
11655
11656 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
11658 let _result = self.send_raw();
11659 self.drop_without_shutdown();
11660 _result
11661 }
11662
11663 fn send_raw(&self) -> Result<(), fidl::Error> {
11664 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
11665 (),
11666 self.tx_id,
11667 0x41f7121798dfe15f,
11668 fidl::encoding::DynamicFlags::empty(),
11669 )
11670 }
11671}
11672
11673#[must_use = "FIDL methods require a response to be sent"]
11674#[derive(Debug)]
11675pub struct PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11676 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11677 tx_id: u32,
11678}
11679
11680impl std::ops::Drop for PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11684 fn drop(&mut self) {
11685 self.control_handle.shutdown();
11686 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11688 }
11689}
11690
11691impl fidl::endpoints::Responder for PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11692 type ControlHandle = PrivilegedCentralControlHandle;
11693
11694 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11695 &self.control_handle
11696 }
11697
11698 fn drop_without_shutdown(mut self) {
11699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11701 std::mem::forget(self);
11703 }
11704}
11705
11706impl PrivilegedCentralCreateConnectedIsochronousGroupResponder {
11707 pub fn send(
11711 self,
11712 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11713 ) -> Result<(), fidl::Error> {
11714 let _result = self.send_raw(result);
11715 if _result.is_err() {
11716 self.control_handle.shutdown();
11717 }
11718 self.drop_without_shutdown();
11719 _result
11720 }
11721
11722 pub fn send_no_shutdown_on_err(
11724 self,
11725 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11726 ) -> Result<(), fidl::Error> {
11727 let _result = self.send_raw(result);
11728 self.drop_without_shutdown();
11729 _result
11730 }
11731
11732 fn send_raw(
11733 &self,
11734 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
11735 ) -> Result<(), fidl::Error> {
11736 self.control_handle.inner.send::<fidl::encoding::ResultType<
11737 CentralCreateConnectedIsochronousGroupResponse,
11738 CreateCigError,
11739 >>(
11740 result,
11741 self.tx_id,
11742 0x60323e70ae22e13,
11743 fidl::encoding::DynamicFlags::empty(),
11744 )
11745 }
11746}
11747
11748#[must_use = "FIDL methods require a response to be sent"]
11749#[derive(Debug)]
11750pub struct PrivilegedCentralGetPeripheralsResponder {
11751 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11752 tx_id: u32,
11753}
11754
11755impl std::ops::Drop for PrivilegedCentralGetPeripheralsResponder {
11759 fn drop(&mut self) {
11760 self.control_handle.shutdown();
11761 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11763 }
11764}
11765
11766impl fidl::endpoints::Responder for PrivilegedCentralGetPeripheralsResponder {
11767 type ControlHandle = PrivilegedCentralControlHandle;
11768
11769 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11770 &self.control_handle
11771 }
11772
11773 fn drop_without_shutdown(mut self) {
11774 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11776 std::mem::forget(self);
11778 }
11779}
11780
11781impl PrivilegedCentralGetPeripheralsResponder {
11782 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
11786 let _result = self.send_raw(peripherals);
11787 if _result.is_err() {
11788 self.control_handle.shutdown();
11789 }
11790 self.drop_without_shutdown();
11791 _result
11792 }
11793
11794 pub fn send_no_shutdown_on_err(
11796 self,
11797 mut peripherals: &[RemoteDevice],
11798 ) -> Result<(), fidl::Error> {
11799 let _result = self.send_raw(peripherals);
11800 self.drop_without_shutdown();
11801 _result
11802 }
11803
11804 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
11805 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
11806 (peripherals,),
11807 self.tx_id,
11808 0x37ba777499c683a8,
11809 fidl::encoding::DynamicFlags::empty(),
11810 )
11811 }
11812}
11813
11814#[must_use = "FIDL methods require a response to be sent"]
11815#[derive(Debug)]
11816pub struct PrivilegedCentralGetPeripheralResponder {
11817 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11818 tx_id: u32,
11819}
11820
11821impl std::ops::Drop for PrivilegedCentralGetPeripheralResponder {
11825 fn drop(&mut self) {
11826 self.control_handle.shutdown();
11827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11829 }
11830}
11831
11832impl fidl::endpoints::Responder for PrivilegedCentralGetPeripheralResponder {
11833 type ControlHandle = PrivilegedCentralControlHandle;
11834
11835 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11836 &self.control_handle
11837 }
11838
11839 fn drop_without_shutdown(mut self) {
11840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11842 std::mem::forget(self);
11844 }
11845}
11846
11847impl PrivilegedCentralGetPeripheralResponder {
11848 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
11852 let _result = self.send_raw(peripheral);
11853 if _result.is_err() {
11854 self.control_handle.shutdown();
11855 }
11856 self.drop_without_shutdown();
11857 _result
11858 }
11859
11860 pub fn send_no_shutdown_on_err(
11862 self,
11863 mut peripheral: Option<&RemoteDevice>,
11864 ) -> Result<(), fidl::Error> {
11865 let _result = self.send_raw(peripheral);
11866 self.drop_without_shutdown();
11867 _result
11868 }
11869
11870 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
11871 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
11872 (peripheral,),
11873 self.tx_id,
11874 0x97f5a2f2d9c13da,
11875 fidl::encoding::DynamicFlags::empty(),
11876 )
11877 }
11878}
11879
11880#[must_use = "FIDL methods require a response to be sent"]
11881#[derive(Debug)]
11882pub struct PrivilegedCentralStartScanResponder {
11883 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11884 tx_id: u32,
11885}
11886
11887impl std::ops::Drop for PrivilegedCentralStartScanResponder {
11891 fn drop(&mut self) {
11892 self.control_handle.shutdown();
11893 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11895 }
11896}
11897
11898impl fidl::endpoints::Responder for PrivilegedCentralStartScanResponder {
11899 type ControlHandle = PrivilegedCentralControlHandle;
11900
11901 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11902 &self.control_handle
11903 }
11904
11905 fn drop_without_shutdown(mut self) {
11906 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11908 std::mem::forget(self);
11910 }
11911}
11912
11913impl PrivilegedCentralStartScanResponder {
11914 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
11918 let _result = self.send_raw(status);
11919 if _result.is_err() {
11920 self.control_handle.shutdown();
11921 }
11922 self.drop_without_shutdown();
11923 _result
11924 }
11925
11926 pub fn send_no_shutdown_on_err(
11928 self,
11929 mut status: &fidl_fuchsia_bluetooth::Status,
11930 ) -> Result<(), fidl::Error> {
11931 let _result = self.send_raw(status);
11932 self.drop_without_shutdown();
11933 _result
11934 }
11935
11936 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
11937 self.control_handle.inner.send::<CentralStartScanResponse>(
11938 (status,),
11939 self.tx_id,
11940 0xeb4cf0cd0e1132b,
11941 fidl::encoding::DynamicFlags::empty(),
11942 )
11943 }
11944}
11945
11946#[must_use = "FIDL methods require a response to be sent"]
11947#[derive(Debug)]
11948pub struct PrivilegedCentralConnectPeripheralResponder {
11949 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
11950 tx_id: u32,
11951}
11952
11953impl std::ops::Drop for PrivilegedCentralConnectPeripheralResponder {
11957 fn drop(&mut self) {
11958 self.control_handle.shutdown();
11959 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11961 }
11962}
11963
11964impl fidl::endpoints::Responder for PrivilegedCentralConnectPeripheralResponder {
11965 type ControlHandle = PrivilegedCentralControlHandle;
11966
11967 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
11968 &self.control_handle
11969 }
11970
11971 fn drop_without_shutdown(mut self) {
11972 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11974 std::mem::forget(self);
11976 }
11977}
11978
11979impl PrivilegedCentralConnectPeripheralResponder {
11980 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
11984 let _result = self.send_raw(status);
11985 if _result.is_err() {
11986 self.control_handle.shutdown();
11987 }
11988 self.drop_without_shutdown();
11989 _result
11990 }
11991
11992 pub fn send_no_shutdown_on_err(
11994 self,
11995 mut status: &fidl_fuchsia_bluetooth::Status,
11996 ) -> Result<(), fidl::Error> {
11997 let _result = self.send_raw(status);
11998 self.drop_without_shutdown();
11999 _result
12000 }
12001
12002 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12003 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
12004 (status,),
12005 self.tx_id,
12006 0x714d6c32d066d75a,
12007 fidl::encoding::DynamicFlags::empty(),
12008 )
12009 }
12010}
12011
12012#[must_use = "FIDL methods require a response to be sent"]
12013#[derive(Debug)]
12014pub struct PrivilegedCentralDisconnectPeripheralResponder {
12015 control_handle: std::mem::ManuallyDrop<PrivilegedCentralControlHandle>,
12016 tx_id: u32,
12017}
12018
12019impl std::ops::Drop for PrivilegedCentralDisconnectPeripheralResponder {
12023 fn drop(&mut self) {
12024 self.control_handle.shutdown();
12025 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12027 }
12028}
12029
12030impl fidl::endpoints::Responder for PrivilegedCentralDisconnectPeripheralResponder {
12031 type ControlHandle = PrivilegedCentralControlHandle;
12032
12033 fn control_handle(&self) -> &PrivilegedCentralControlHandle {
12034 &self.control_handle
12035 }
12036
12037 fn drop_without_shutdown(mut self) {
12038 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12040 std::mem::forget(self);
12042 }
12043}
12044
12045impl PrivilegedCentralDisconnectPeripheralResponder {
12046 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12050 let _result = self.send_raw(status);
12051 if _result.is_err() {
12052 self.control_handle.shutdown();
12053 }
12054 self.drop_without_shutdown();
12055 _result
12056 }
12057
12058 pub fn send_no_shutdown_on_err(
12060 self,
12061 mut status: &fidl_fuchsia_bluetooth::Status,
12062 ) -> Result<(), fidl::Error> {
12063 let _result = self.send_raw(status);
12064 self.drop_without_shutdown();
12065 _result
12066 }
12067
12068 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
12069 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
12070 (status,),
12071 self.tx_id,
12072 0xa9430da197362fd,
12073 fidl::encoding::DynamicFlags::empty(),
12074 )
12075 }
12076}
12077
12078#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
12079pub struct PrivilegedPeripheralMarker;
12080
12081impl fidl::endpoints::ProtocolMarker for PrivilegedPeripheralMarker {
12082 type Proxy = PrivilegedPeripheralProxy;
12083 type RequestStream = PrivilegedPeripheralRequestStream;
12084 #[cfg(target_os = "fuchsia")]
12085 type SynchronousProxy = PrivilegedPeripheralSynchronousProxy;
12086
12087 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedPeripheral";
12088}
12089impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedPeripheralMarker {}
12090
12091pub trait PrivilegedPeripheralProxyInterface: Send + Sync {
12092 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
12093 + Send;
12094 fn r#listen_l2cap(
12095 &self,
12096 payload: ChannelListenerRegistryListenL2capRequest,
12097 ) -> Self::ListenL2capResponseFut;
12098 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
12099 + Send;
12100 fn r#advertise(
12101 &self,
12102 parameters: &AdvertisingParameters,
12103 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12104 ) -> Self::AdvertiseResponseFut;
12105 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
12106 + Send;
12107 fn r#start_advertising(
12108 &self,
12109 parameters: &AdvertisingParameters,
12110 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12111 ) -> Self::StartAdvertisingResponseFut;
12112}
12113#[derive(Debug)]
12114#[cfg(target_os = "fuchsia")]
12115pub struct PrivilegedPeripheralSynchronousProxy {
12116 client: fidl::client::sync::Client,
12117}
12118
12119#[cfg(target_os = "fuchsia")]
12120impl fidl::endpoints::SynchronousProxy for PrivilegedPeripheralSynchronousProxy {
12121 type Proxy = PrivilegedPeripheralProxy;
12122 type Protocol = PrivilegedPeripheralMarker;
12123
12124 fn from_channel(inner: fidl::Channel) -> Self {
12125 Self::new(inner)
12126 }
12127
12128 fn into_channel(self) -> fidl::Channel {
12129 self.client.into_channel()
12130 }
12131
12132 fn as_channel(&self) -> &fidl::Channel {
12133 self.client.as_channel()
12134 }
12135}
12136
12137#[cfg(target_os = "fuchsia")]
12138impl PrivilegedPeripheralSynchronousProxy {
12139 pub fn new(channel: fidl::Channel) -> Self {
12140 let protocol_name =
12141 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12142 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
12143 }
12144
12145 pub fn into_channel(self) -> fidl::Channel {
12146 self.client.into_channel()
12147 }
12148
12149 pub fn wait_for_event(
12152 &self,
12153 deadline: zx::MonotonicInstant,
12154 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
12155 PrivilegedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
12156 }
12157
12158 pub fn r#listen_l2cap(
12168 &self,
12169 mut payload: ChannelListenerRegistryListenL2capRequest,
12170 ___deadline: zx::MonotonicInstant,
12171 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
12172 let _response = self.client.send_query::<
12173 ChannelListenerRegistryListenL2capRequest,
12174 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
12175 >(
12176 &mut payload,
12177 0x39c6e9001d102338,
12178 fidl::encoding::DynamicFlags::empty(),
12179 ___deadline,
12180 )?;
12181 Ok(_response.map(|x| x))
12182 }
12183
12184 pub fn r#advertise(
12212 &self,
12213 mut parameters: &AdvertisingParameters,
12214 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12215 ___deadline: zx::MonotonicInstant,
12216 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
12217 let _response = self.client.send_query::<
12218 PeripheralAdvertiseRequest,
12219 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12220 >(
12221 (parameters, advertised_peripheral,),
12222 0x2d9ec9260c32c17f,
12223 fidl::encoding::DynamicFlags::empty(),
12224 ___deadline,
12225 )?;
12226 Ok(_response.map(|x| x))
12227 }
12228
12229 pub fn r#start_advertising(
12250 &self,
12251 mut parameters: &AdvertisingParameters,
12252 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12253 ___deadline: zx::MonotonicInstant,
12254 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
12255 let _response = self.client.send_query::<
12256 PeripheralStartAdvertisingRequest,
12257 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12258 >(
12259 (parameters, handle,),
12260 0x5875c1c575f00f7d,
12261 fidl::encoding::DynamicFlags::empty(),
12262 ___deadline,
12263 )?;
12264 Ok(_response.map(|x| x))
12265 }
12266}
12267
12268#[cfg(target_os = "fuchsia")]
12269impl From<PrivilegedPeripheralSynchronousProxy> for zx::NullableHandle {
12270 fn from(value: PrivilegedPeripheralSynchronousProxy) -> Self {
12271 value.into_channel().into()
12272 }
12273}
12274
12275#[cfg(target_os = "fuchsia")]
12276impl From<fidl::Channel> for PrivilegedPeripheralSynchronousProxy {
12277 fn from(value: fidl::Channel) -> Self {
12278 Self::new(value)
12279 }
12280}
12281
12282#[cfg(target_os = "fuchsia")]
12283impl fidl::endpoints::FromClient for PrivilegedPeripheralSynchronousProxy {
12284 type Protocol = PrivilegedPeripheralMarker;
12285
12286 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedPeripheralMarker>) -> Self {
12287 Self::new(value.into_channel())
12288 }
12289}
12290
12291#[derive(Debug, Clone)]
12292pub struct PrivilegedPeripheralProxy {
12293 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
12294}
12295
12296impl fidl::endpoints::Proxy for PrivilegedPeripheralProxy {
12297 type Protocol = PrivilegedPeripheralMarker;
12298
12299 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
12300 Self::new(inner)
12301 }
12302
12303 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
12304 self.client.into_channel().map_err(|client| Self { client })
12305 }
12306
12307 fn as_channel(&self) -> &::fidl::AsyncChannel {
12308 self.client.as_channel()
12309 }
12310}
12311
12312impl PrivilegedPeripheralProxy {
12313 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
12315 let protocol_name =
12316 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
12317 Self { client: fidl::client::Client::new(channel, protocol_name) }
12318 }
12319
12320 pub fn take_event_stream(&self) -> PrivilegedPeripheralEventStream {
12326 PrivilegedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
12327 }
12328
12329 pub fn r#listen_l2cap(
12339 &self,
12340 mut payload: ChannelListenerRegistryListenL2capRequest,
12341 ) -> fidl::client::QueryResponseFut<
12342 ChannelListenerRegistryListenL2capResult,
12343 fidl::encoding::DefaultFuchsiaResourceDialect,
12344 > {
12345 PrivilegedPeripheralProxyInterface::r#listen_l2cap(self, payload)
12346 }
12347
12348 pub fn r#advertise(
12376 &self,
12377 mut parameters: &AdvertisingParameters,
12378 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12379 ) -> fidl::client::QueryResponseFut<
12380 PeripheralAdvertiseResult,
12381 fidl::encoding::DefaultFuchsiaResourceDialect,
12382 > {
12383 PrivilegedPeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
12384 }
12385
12386 pub fn r#start_advertising(
12407 &self,
12408 mut parameters: &AdvertisingParameters,
12409 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12410 ) -> fidl::client::QueryResponseFut<
12411 PeripheralStartAdvertisingResult,
12412 fidl::encoding::DefaultFuchsiaResourceDialect,
12413 > {
12414 PrivilegedPeripheralProxyInterface::r#start_advertising(self, parameters, handle)
12415 }
12416}
12417
12418impl PrivilegedPeripheralProxyInterface for PrivilegedPeripheralProxy {
12419 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
12420 ChannelListenerRegistryListenL2capResult,
12421 fidl::encoding::DefaultFuchsiaResourceDialect,
12422 >;
12423 fn r#listen_l2cap(
12424 &self,
12425 mut payload: ChannelListenerRegistryListenL2capRequest,
12426 ) -> Self::ListenL2capResponseFut {
12427 fn _decode(
12428 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12429 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
12430 let _response = fidl::client::decode_transaction_body::<
12431 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
12432 fidl::encoding::DefaultFuchsiaResourceDialect,
12433 0x39c6e9001d102338,
12434 >(_buf?)?;
12435 Ok(_response.map(|x| x))
12436 }
12437 self.client.send_query_and_decode::<
12438 ChannelListenerRegistryListenL2capRequest,
12439 ChannelListenerRegistryListenL2capResult,
12440 >(
12441 &mut payload,
12442 0x39c6e9001d102338,
12443 fidl::encoding::DynamicFlags::empty(),
12444 _decode,
12445 )
12446 }
12447
12448 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
12449 PeripheralAdvertiseResult,
12450 fidl::encoding::DefaultFuchsiaResourceDialect,
12451 >;
12452 fn r#advertise(
12453 &self,
12454 mut parameters: &AdvertisingParameters,
12455 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12456 ) -> Self::AdvertiseResponseFut {
12457 fn _decode(
12458 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12459 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
12460 let _response = fidl::client::decode_transaction_body::<
12461 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12462 fidl::encoding::DefaultFuchsiaResourceDialect,
12463 0x2d9ec9260c32c17f,
12464 >(_buf?)?;
12465 Ok(_response.map(|x| x))
12466 }
12467 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
12468 (parameters, advertised_peripheral),
12469 0x2d9ec9260c32c17f,
12470 fidl::encoding::DynamicFlags::empty(),
12471 _decode,
12472 )
12473 }
12474
12475 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
12476 PeripheralStartAdvertisingResult,
12477 fidl::encoding::DefaultFuchsiaResourceDialect,
12478 >;
12479 fn r#start_advertising(
12480 &self,
12481 mut parameters: &AdvertisingParameters,
12482 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12483 ) -> Self::StartAdvertisingResponseFut {
12484 fn _decode(
12485 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
12486 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
12487 let _response = fidl::client::decode_transaction_body::<
12488 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
12489 fidl::encoding::DefaultFuchsiaResourceDialect,
12490 0x5875c1c575f00f7d,
12491 >(_buf?)?;
12492 Ok(_response.map(|x| x))
12493 }
12494 self.client.send_query_and_decode::<
12495 PeripheralStartAdvertisingRequest,
12496 PeripheralStartAdvertisingResult,
12497 >(
12498 (parameters, handle,),
12499 0x5875c1c575f00f7d,
12500 fidl::encoding::DynamicFlags::empty(),
12501 _decode,
12502 )
12503 }
12504}
12505
12506pub struct PrivilegedPeripheralEventStream {
12507 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
12508}
12509
12510impl std::marker::Unpin for PrivilegedPeripheralEventStream {}
12511
12512impl futures::stream::FusedStream for PrivilegedPeripheralEventStream {
12513 fn is_terminated(&self) -> bool {
12514 self.event_receiver.is_terminated()
12515 }
12516}
12517
12518impl futures::Stream for PrivilegedPeripheralEventStream {
12519 type Item = Result<PrivilegedPeripheralEvent, fidl::Error>;
12520
12521 fn poll_next(
12522 mut self: std::pin::Pin<&mut Self>,
12523 cx: &mut std::task::Context<'_>,
12524 ) -> std::task::Poll<Option<Self::Item>> {
12525 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
12526 &mut self.event_receiver,
12527 cx
12528 )?) {
12529 Some(buf) => std::task::Poll::Ready(Some(PrivilegedPeripheralEvent::decode(buf))),
12530 None => std::task::Poll::Ready(None),
12531 }
12532 }
12533}
12534
12535#[derive(Debug)]
12536pub enum PrivilegedPeripheralEvent {
12537 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
12538}
12539
12540impl PrivilegedPeripheralEvent {
12541 #[allow(irrefutable_let_patterns)]
12542 pub fn into_on_peer_connected(
12543 self,
12544 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
12545 if let PrivilegedPeripheralEvent::OnPeerConnected { peer, connection } = self {
12546 Some((peer, connection))
12547 } else {
12548 None
12549 }
12550 }
12551
12552 fn decode(
12554 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
12555 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
12556 let (bytes, _handles) = buf.split_mut();
12557 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12558 debug_assert_eq!(tx_header.tx_id, 0);
12559 match tx_header.ordinal {
12560 0x16135d464299e356 => {
12561 let mut out = fidl::new_empty!(
12562 PeripheralOnPeerConnectedRequest,
12563 fidl::encoding::DefaultFuchsiaResourceDialect
12564 );
12565 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
12566 Ok((PrivilegedPeripheralEvent::OnPeerConnected {
12567 peer: out.peer,
12568 connection: out.connection,
12569 }))
12570 }
12571 _ => Err(fidl::Error::UnknownOrdinal {
12572 ordinal: tx_header.ordinal,
12573 protocol_name:
12574 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12575 }),
12576 }
12577 }
12578}
12579
12580pub struct PrivilegedPeripheralRequestStream {
12582 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12583 is_terminated: bool,
12584}
12585
12586impl std::marker::Unpin for PrivilegedPeripheralRequestStream {}
12587
12588impl futures::stream::FusedStream for PrivilegedPeripheralRequestStream {
12589 fn is_terminated(&self) -> bool {
12590 self.is_terminated
12591 }
12592}
12593
12594impl fidl::endpoints::RequestStream for PrivilegedPeripheralRequestStream {
12595 type Protocol = PrivilegedPeripheralMarker;
12596 type ControlHandle = PrivilegedPeripheralControlHandle;
12597
12598 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
12599 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
12600 }
12601
12602 fn control_handle(&self) -> Self::ControlHandle {
12603 PrivilegedPeripheralControlHandle { inner: self.inner.clone() }
12604 }
12605
12606 fn into_inner(
12607 self,
12608 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
12609 {
12610 (self.inner, self.is_terminated)
12611 }
12612
12613 fn from_inner(
12614 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12615 is_terminated: bool,
12616 ) -> Self {
12617 Self { inner, is_terminated }
12618 }
12619}
12620
12621impl futures::Stream for PrivilegedPeripheralRequestStream {
12622 type Item = Result<PrivilegedPeripheralRequest, fidl::Error>;
12623
12624 fn poll_next(
12625 mut self: std::pin::Pin<&mut Self>,
12626 cx: &mut std::task::Context<'_>,
12627 ) -> std::task::Poll<Option<Self::Item>> {
12628 let this = &mut *self;
12629 if this.inner.check_shutdown(cx) {
12630 this.is_terminated = true;
12631 return std::task::Poll::Ready(None);
12632 }
12633 if this.is_terminated {
12634 panic!("polled PrivilegedPeripheralRequestStream after completion");
12635 }
12636 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
12637 |bytes, handles| {
12638 match this.inner.channel().read_etc(cx, bytes, handles) {
12639 std::task::Poll::Ready(Ok(())) => {}
12640 std::task::Poll::Pending => return std::task::Poll::Pending,
12641 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
12642 this.is_terminated = true;
12643 return std::task::Poll::Ready(None);
12644 }
12645 std::task::Poll::Ready(Err(e)) => {
12646 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
12647 e.into(),
12648 ))));
12649 }
12650 }
12651
12652 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
12654
12655 std::task::Poll::Ready(Some(match header.ordinal {
12656 0x39c6e9001d102338 => {
12657 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12658 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12659 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
12660 let control_handle = PrivilegedPeripheralControlHandle {
12661 inner: this.inner.clone(),
12662 };
12663 Ok(PrivilegedPeripheralRequest::ListenL2cap {payload: req,
12664 responder: PrivilegedPeripheralListenL2capResponder {
12665 control_handle: std::mem::ManuallyDrop::new(control_handle),
12666 tx_id: header.tx_id,
12667 },
12668 })
12669 }
12670 0x2d9ec9260c32c17f => {
12671 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12672 let mut req = fidl::new_empty!(PeripheralAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
12674 let control_handle = PrivilegedPeripheralControlHandle {
12675 inner: this.inner.clone(),
12676 };
12677 Ok(PrivilegedPeripheralRequest::Advertise {parameters: req.parameters,
12678advertised_peripheral: req.advertised_peripheral,
12679
12680 responder: PrivilegedPeripheralAdvertiseResponder {
12681 control_handle: std::mem::ManuallyDrop::new(control_handle),
12682 tx_id: header.tx_id,
12683 },
12684 })
12685 }
12686 0x5875c1c575f00f7d => {
12687 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
12688 let mut req = fidl::new_empty!(PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
12689 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
12690 let control_handle = PrivilegedPeripheralControlHandle {
12691 inner: this.inner.clone(),
12692 };
12693 Ok(PrivilegedPeripheralRequest::StartAdvertising {parameters: req.parameters,
12694handle: req.handle,
12695
12696 responder: PrivilegedPeripheralStartAdvertisingResponder {
12697 control_handle: std::mem::ManuallyDrop::new(control_handle),
12698 tx_id: header.tx_id,
12699 },
12700 })
12701 }
12702 _ => Err(fidl::Error::UnknownOrdinal {
12703 ordinal: header.ordinal,
12704 protocol_name: <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
12705 }),
12706 }))
12707 },
12708 )
12709 }
12710}
12711
12712#[derive(Debug)]
12720pub enum PrivilegedPeripheralRequest {
12721 ListenL2cap {
12731 payload: ChannelListenerRegistryListenL2capRequest,
12732 responder: PrivilegedPeripheralListenL2capResponder,
12733 },
12734 Advertise {
12762 parameters: AdvertisingParameters,
12763 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12764 responder: PrivilegedPeripheralAdvertiseResponder,
12765 },
12766 StartAdvertising {
12787 parameters: AdvertisingParameters,
12788 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12789 responder: PrivilegedPeripheralStartAdvertisingResponder,
12790 },
12791}
12792
12793impl PrivilegedPeripheralRequest {
12794 #[allow(irrefutable_let_patterns)]
12795 pub fn into_listen_l2cap(
12796 self,
12797 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedPeripheralListenL2capResponder)>
12798 {
12799 if let PrivilegedPeripheralRequest::ListenL2cap { payload, responder } = self {
12800 Some((payload, responder))
12801 } else {
12802 None
12803 }
12804 }
12805
12806 #[allow(irrefutable_let_patterns)]
12807 pub fn into_advertise(
12808 self,
12809 ) -> Option<(
12810 AdvertisingParameters,
12811 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
12812 PrivilegedPeripheralAdvertiseResponder,
12813 )> {
12814 if let PrivilegedPeripheralRequest::Advertise {
12815 parameters,
12816 advertised_peripheral,
12817 responder,
12818 } = self
12819 {
12820 Some((parameters, advertised_peripheral, responder))
12821 } else {
12822 None
12823 }
12824 }
12825
12826 #[allow(irrefutable_let_patterns)]
12827 pub fn into_start_advertising(
12828 self,
12829 ) -> Option<(
12830 AdvertisingParameters,
12831 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
12832 PrivilegedPeripheralStartAdvertisingResponder,
12833 )> {
12834 if let PrivilegedPeripheralRequest::StartAdvertising { parameters, handle, responder } =
12835 self
12836 {
12837 Some((parameters, handle, responder))
12838 } else {
12839 None
12840 }
12841 }
12842
12843 pub fn method_name(&self) -> &'static str {
12845 match *self {
12846 PrivilegedPeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
12847 PrivilegedPeripheralRequest::Advertise { .. } => "advertise",
12848 PrivilegedPeripheralRequest::StartAdvertising { .. } => "start_advertising",
12849 }
12850 }
12851}
12852
12853#[derive(Debug, Clone)]
12854pub struct PrivilegedPeripheralControlHandle {
12855 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
12856}
12857
12858impl fidl::endpoints::ControlHandle for PrivilegedPeripheralControlHandle {
12859 fn shutdown(&self) {
12860 self.inner.shutdown()
12861 }
12862
12863 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
12864 self.inner.shutdown_with_epitaph(status)
12865 }
12866
12867 fn is_closed(&self) -> bool {
12868 self.inner.channel().is_closed()
12869 }
12870 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
12871 self.inner.channel().on_closed()
12872 }
12873
12874 #[cfg(target_os = "fuchsia")]
12875 fn signal_peer(
12876 &self,
12877 clear_mask: zx::Signals,
12878 set_mask: zx::Signals,
12879 ) -> Result<(), zx_status::Status> {
12880 use fidl::Peered;
12881 self.inner.channel().signal_peer(clear_mask, set_mask)
12882 }
12883}
12884
12885impl PrivilegedPeripheralControlHandle {
12886 pub fn send_on_peer_connected(
12887 &self,
12888 mut peer: &Peer,
12889 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
12890 ) -> Result<(), fidl::Error> {
12891 self.inner.send::<PeripheralOnPeerConnectedRequest>(
12892 (peer, connection),
12893 0,
12894 0x16135d464299e356,
12895 fidl::encoding::DynamicFlags::empty(),
12896 )
12897 }
12898}
12899
12900#[must_use = "FIDL methods require a response to be sent"]
12901#[derive(Debug)]
12902pub struct PrivilegedPeripheralListenL2capResponder {
12903 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
12904 tx_id: u32,
12905}
12906
12907impl std::ops::Drop for PrivilegedPeripheralListenL2capResponder {
12911 fn drop(&mut self) {
12912 self.control_handle.shutdown();
12913 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12915 }
12916}
12917
12918impl fidl::endpoints::Responder for PrivilegedPeripheralListenL2capResponder {
12919 type ControlHandle = PrivilegedPeripheralControlHandle;
12920
12921 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
12922 &self.control_handle
12923 }
12924
12925 fn drop_without_shutdown(mut self) {
12926 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12928 std::mem::forget(self);
12930 }
12931}
12932
12933impl PrivilegedPeripheralListenL2capResponder {
12934 pub fn send(
12938 self,
12939 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
12940 ) -> Result<(), fidl::Error> {
12941 let _result = self.send_raw(result);
12942 if _result.is_err() {
12943 self.control_handle.shutdown();
12944 }
12945 self.drop_without_shutdown();
12946 _result
12947 }
12948
12949 pub fn send_no_shutdown_on_err(
12951 self,
12952 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
12953 ) -> Result<(), fidl::Error> {
12954 let _result = self.send_raw(result);
12955 self.drop_without_shutdown();
12956 _result
12957 }
12958
12959 fn send_raw(
12960 &self,
12961 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
12962 ) -> Result<(), fidl::Error> {
12963 self.control_handle.inner.send::<fidl::encoding::ResultType<
12964 ChannelListenerRegistryListenL2capResponse,
12965 i32,
12966 >>(
12967 result,
12968 self.tx_id,
12969 0x39c6e9001d102338,
12970 fidl::encoding::DynamicFlags::empty(),
12971 )
12972 }
12973}
12974
12975#[must_use = "FIDL methods require a response to be sent"]
12976#[derive(Debug)]
12977pub struct PrivilegedPeripheralAdvertiseResponder {
12978 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
12979 tx_id: u32,
12980}
12981
12982impl std::ops::Drop for PrivilegedPeripheralAdvertiseResponder {
12986 fn drop(&mut self) {
12987 self.control_handle.shutdown();
12988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
12990 }
12991}
12992
12993impl fidl::endpoints::Responder for PrivilegedPeripheralAdvertiseResponder {
12994 type ControlHandle = PrivilegedPeripheralControlHandle;
12995
12996 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
12997 &self.control_handle
12998 }
12999
13000 fn drop_without_shutdown(mut self) {
13001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13003 std::mem::forget(self);
13005 }
13006}
13007
13008impl PrivilegedPeripheralAdvertiseResponder {
13009 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13013 let _result = self.send_raw(result);
13014 if _result.is_err() {
13015 self.control_handle.shutdown();
13016 }
13017 self.drop_without_shutdown();
13018 _result
13019 }
13020
13021 pub fn send_no_shutdown_on_err(
13023 self,
13024 mut result: Result<(), PeripheralError>,
13025 ) -> Result<(), fidl::Error> {
13026 let _result = self.send_raw(result);
13027 self.drop_without_shutdown();
13028 _result
13029 }
13030
13031 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13032 self.control_handle.inner.send::<fidl::encoding::ResultType<
13033 fidl::encoding::EmptyStruct,
13034 PeripheralError,
13035 >>(
13036 result,
13037 self.tx_id,
13038 0x2d9ec9260c32c17f,
13039 fidl::encoding::DynamicFlags::empty(),
13040 )
13041 }
13042}
13043
13044#[must_use = "FIDL methods require a response to be sent"]
13045#[derive(Debug)]
13046pub struct PrivilegedPeripheralStartAdvertisingResponder {
13047 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
13048 tx_id: u32,
13049}
13050
13051impl std::ops::Drop for PrivilegedPeripheralStartAdvertisingResponder {
13055 fn drop(&mut self) {
13056 self.control_handle.shutdown();
13057 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13059 }
13060}
13061
13062impl fidl::endpoints::Responder for PrivilegedPeripheralStartAdvertisingResponder {
13063 type ControlHandle = PrivilegedPeripheralControlHandle;
13064
13065 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
13066 &self.control_handle
13067 }
13068
13069 fn drop_without_shutdown(mut self) {
13070 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13072 std::mem::forget(self);
13074 }
13075}
13076
13077impl PrivilegedPeripheralStartAdvertisingResponder {
13078 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13082 let _result = self.send_raw(result);
13083 if _result.is_err() {
13084 self.control_handle.shutdown();
13085 }
13086 self.drop_without_shutdown();
13087 _result
13088 }
13089
13090 pub fn send_no_shutdown_on_err(
13092 self,
13093 mut result: Result<(), PeripheralError>,
13094 ) -> Result<(), fidl::Error> {
13095 let _result = self.send_raw(result);
13096 self.drop_without_shutdown();
13097 _result
13098 }
13099
13100 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
13101 self.control_handle.inner.send::<fidl::encoding::ResultType<
13102 fidl::encoding::EmptyStruct,
13103 PeripheralError,
13104 >>(
13105 result,
13106 self.tx_id,
13107 0x5875c1c575f00f7d,
13108 fidl::encoding::DynamicFlags::empty(),
13109 )
13110 }
13111}
13112
13113#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
13114pub struct ScanResultWatcherMarker;
13115
13116impl fidl::endpoints::ProtocolMarker for ScanResultWatcherMarker {
13117 type Proxy = ScanResultWatcherProxy;
13118 type RequestStream = ScanResultWatcherRequestStream;
13119 #[cfg(target_os = "fuchsia")]
13120 type SynchronousProxy = ScanResultWatcherSynchronousProxy;
13121
13122 const DEBUG_NAME: &'static str = "(anonymous) ScanResultWatcher";
13123}
13124
13125pub trait ScanResultWatcherProxyInterface: Send + Sync {
13126 type WatchResponseFut: std::future::Future<Output = Result<Vec<Peer>, fidl::Error>> + Send;
13127 fn r#watch(&self) -> Self::WatchResponseFut;
13128}
13129#[derive(Debug)]
13130#[cfg(target_os = "fuchsia")]
13131pub struct ScanResultWatcherSynchronousProxy {
13132 client: fidl::client::sync::Client,
13133}
13134
13135#[cfg(target_os = "fuchsia")]
13136impl fidl::endpoints::SynchronousProxy for ScanResultWatcherSynchronousProxy {
13137 type Proxy = ScanResultWatcherProxy;
13138 type Protocol = ScanResultWatcherMarker;
13139
13140 fn from_channel(inner: fidl::Channel) -> Self {
13141 Self::new(inner)
13142 }
13143
13144 fn into_channel(self) -> fidl::Channel {
13145 self.client.into_channel()
13146 }
13147
13148 fn as_channel(&self) -> &fidl::Channel {
13149 self.client.as_channel()
13150 }
13151}
13152
13153#[cfg(target_os = "fuchsia")]
13154impl ScanResultWatcherSynchronousProxy {
13155 pub fn new(channel: fidl::Channel) -> Self {
13156 let protocol_name =
13157 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13158 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
13159 }
13160
13161 pub fn into_channel(self) -> fidl::Channel {
13162 self.client.into_channel()
13163 }
13164
13165 pub fn wait_for_event(
13168 &self,
13169 deadline: zx::MonotonicInstant,
13170 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
13171 ScanResultWatcherEvent::decode(self.client.wait_for_event(deadline)?)
13172 }
13173
13174 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Peer>, fidl::Error> {
13184 let _response = self
13185 .client
13186 .send_query::<fidl::encoding::EmptyPayload, ScanResultWatcherWatchResponse>(
13187 (),
13188 0x713a122e949f301a,
13189 fidl::encoding::DynamicFlags::empty(),
13190 ___deadline,
13191 )?;
13192 Ok(_response.updated)
13193 }
13194}
13195
13196#[cfg(target_os = "fuchsia")]
13197impl From<ScanResultWatcherSynchronousProxy> for zx::NullableHandle {
13198 fn from(value: ScanResultWatcherSynchronousProxy) -> Self {
13199 value.into_channel().into()
13200 }
13201}
13202
13203#[cfg(target_os = "fuchsia")]
13204impl From<fidl::Channel> for ScanResultWatcherSynchronousProxy {
13205 fn from(value: fidl::Channel) -> Self {
13206 Self::new(value)
13207 }
13208}
13209
13210#[cfg(target_os = "fuchsia")]
13211impl fidl::endpoints::FromClient for ScanResultWatcherSynchronousProxy {
13212 type Protocol = ScanResultWatcherMarker;
13213
13214 fn from_client(value: fidl::endpoints::ClientEnd<ScanResultWatcherMarker>) -> Self {
13215 Self::new(value.into_channel())
13216 }
13217}
13218
13219#[derive(Debug, Clone)]
13220pub struct ScanResultWatcherProxy {
13221 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
13222}
13223
13224impl fidl::endpoints::Proxy for ScanResultWatcherProxy {
13225 type Protocol = ScanResultWatcherMarker;
13226
13227 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
13228 Self::new(inner)
13229 }
13230
13231 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
13232 self.client.into_channel().map_err(|client| Self { client })
13233 }
13234
13235 fn as_channel(&self) -> &::fidl::AsyncChannel {
13236 self.client.as_channel()
13237 }
13238}
13239
13240impl ScanResultWatcherProxy {
13241 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
13243 let protocol_name =
13244 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
13245 Self { client: fidl::client::Client::new(channel, protocol_name) }
13246 }
13247
13248 pub fn take_event_stream(&self) -> ScanResultWatcherEventStream {
13254 ScanResultWatcherEventStream { event_receiver: self.client.take_event_receiver() }
13255 }
13256
13257 pub fn r#watch(
13267 &self,
13268 ) -> fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>
13269 {
13270 ScanResultWatcherProxyInterface::r#watch(self)
13271 }
13272}
13273
13274impl ScanResultWatcherProxyInterface for ScanResultWatcherProxy {
13275 type WatchResponseFut =
13276 fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>;
13277 fn r#watch(&self) -> Self::WatchResponseFut {
13278 fn _decode(
13279 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
13280 ) -> Result<Vec<Peer>, fidl::Error> {
13281 let _response = fidl::client::decode_transaction_body::<
13282 ScanResultWatcherWatchResponse,
13283 fidl::encoding::DefaultFuchsiaResourceDialect,
13284 0x713a122e949f301a,
13285 >(_buf?)?;
13286 Ok(_response.updated)
13287 }
13288 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Peer>>(
13289 (),
13290 0x713a122e949f301a,
13291 fidl::encoding::DynamicFlags::empty(),
13292 _decode,
13293 )
13294 }
13295}
13296
13297pub struct ScanResultWatcherEventStream {
13298 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
13299}
13300
13301impl std::marker::Unpin for ScanResultWatcherEventStream {}
13302
13303impl futures::stream::FusedStream for ScanResultWatcherEventStream {
13304 fn is_terminated(&self) -> bool {
13305 self.event_receiver.is_terminated()
13306 }
13307}
13308
13309impl futures::Stream for ScanResultWatcherEventStream {
13310 type Item = Result<ScanResultWatcherEvent, fidl::Error>;
13311
13312 fn poll_next(
13313 mut self: std::pin::Pin<&mut Self>,
13314 cx: &mut std::task::Context<'_>,
13315 ) -> std::task::Poll<Option<Self::Item>> {
13316 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
13317 &mut self.event_receiver,
13318 cx
13319 )?) {
13320 Some(buf) => std::task::Poll::Ready(Some(ScanResultWatcherEvent::decode(buf))),
13321 None => std::task::Poll::Ready(None),
13322 }
13323 }
13324}
13325
13326#[derive(Debug)]
13327pub enum ScanResultWatcherEvent {}
13328
13329impl ScanResultWatcherEvent {
13330 fn decode(
13332 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
13333 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
13334 let (bytes, _handles) = buf.split_mut();
13335 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13336 debug_assert_eq!(tx_header.tx_id, 0);
13337 match tx_header.ordinal {
13338 _ => Err(fidl::Error::UnknownOrdinal {
13339 ordinal: tx_header.ordinal,
13340 protocol_name:
13341 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13342 }),
13343 }
13344 }
13345}
13346
13347pub struct ScanResultWatcherRequestStream {
13349 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13350 is_terminated: bool,
13351}
13352
13353impl std::marker::Unpin for ScanResultWatcherRequestStream {}
13354
13355impl futures::stream::FusedStream for ScanResultWatcherRequestStream {
13356 fn is_terminated(&self) -> bool {
13357 self.is_terminated
13358 }
13359}
13360
13361impl fidl::endpoints::RequestStream for ScanResultWatcherRequestStream {
13362 type Protocol = ScanResultWatcherMarker;
13363 type ControlHandle = ScanResultWatcherControlHandle;
13364
13365 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
13366 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
13367 }
13368
13369 fn control_handle(&self) -> Self::ControlHandle {
13370 ScanResultWatcherControlHandle { inner: self.inner.clone() }
13371 }
13372
13373 fn into_inner(
13374 self,
13375 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
13376 {
13377 (self.inner, self.is_terminated)
13378 }
13379
13380 fn from_inner(
13381 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13382 is_terminated: bool,
13383 ) -> Self {
13384 Self { inner, is_terminated }
13385 }
13386}
13387
13388impl futures::Stream for ScanResultWatcherRequestStream {
13389 type Item = Result<ScanResultWatcherRequest, fidl::Error>;
13390
13391 fn poll_next(
13392 mut self: std::pin::Pin<&mut Self>,
13393 cx: &mut std::task::Context<'_>,
13394 ) -> std::task::Poll<Option<Self::Item>> {
13395 let this = &mut *self;
13396 if this.inner.check_shutdown(cx) {
13397 this.is_terminated = true;
13398 return std::task::Poll::Ready(None);
13399 }
13400 if this.is_terminated {
13401 panic!("polled ScanResultWatcherRequestStream after completion");
13402 }
13403 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
13404 |bytes, handles| {
13405 match this.inner.channel().read_etc(cx, bytes, handles) {
13406 std::task::Poll::Ready(Ok(())) => {}
13407 std::task::Poll::Pending => return std::task::Poll::Pending,
13408 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
13409 this.is_terminated = true;
13410 return std::task::Poll::Ready(None);
13411 }
13412 std::task::Poll::Ready(Err(e)) => {
13413 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
13414 e.into(),
13415 ))));
13416 }
13417 }
13418
13419 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
13421
13422 std::task::Poll::Ready(Some(match header.ordinal {
13423 0x713a122e949f301a => {
13424 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
13425 let mut req = fidl::new_empty!(
13426 fidl::encoding::EmptyPayload,
13427 fidl::encoding::DefaultFuchsiaResourceDialect
13428 );
13429 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
13430 let control_handle =
13431 ScanResultWatcherControlHandle { inner: this.inner.clone() };
13432 Ok(ScanResultWatcherRequest::Watch {
13433 responder: ScanResultWatcherWatchResponder {
13434 control_handle: std::mem::ManuallyDrop::new(control_handle),
13435 tx_id: header.tx_id,
13436 },
13437 })
13438 }
13439 _ => Err(fidl::Error::UnknownOrdinal {
13440 ordinal: header.ordinal,
13441 protocol_name:
13442 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
13443 }),
13444 }))
13445 },
13446 )
13447 }
13448}
13449
13450#[derive(Debug)]
13456pub enum ScanResultWatcherRequest {
13457 Watch { responder: ScanResultWatcherWatchResponder },
13467}
13468
13469impl ScanResultWatcherRequest {
13470 #[allow(irrefutable_let_patterns)]
13471 pub fn into_watch(self) -> Option<(ScanResultWatcherWatchResponder)> {
13472 if let ScanResultWatcherRequest::Watch { responder } = self {
13473 Some((responder))
13474 } else {
13475 None
13476 }
13477 }
13478
13479 pub fn method_name(&self) -> &'static str {
13481 match *self {
13482 ScanResultWatcherRequest::Watch { .. } => "watch",
13483 }
13484 }
13485}
13486
13487#[derive(Debug, Clone)]
13488pub struct ScanResultWatcherControlHandle {
13489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
13490}
13491
13492impl fidl::endpoints::ControlHandle for ScanResultWatcherControlHandle {
13493 fn shutdown(&self) {
13494 self.inner.shutdown()
13495 }
13496
13497 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
13498 self.inner.shutdown_with_epitaph(status)
13499 }
13500
13501 fn is_closed(&self) -> bool {
13502 self.inner.channel().is_closed()
13503 }
13504 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
13505 self.inner.channel().on_closed()
13506 }
13507
13508 #[cfg(target_os = "fuchsia")]
13509 fn signal_peer(
13510 &self,
13511 clear_mask: zx::Signals,
13512 set_mask: zx::Signals,
13513 ) -> Result<(), zx_status::Status> {
13514 use fidl::Peered;
13515 self.inner.channel().signal_peer(clear_mask, set_mask)
13516 }
13517}
13518
13519impl ScanResultWatcherControlHandle {}
13520
13521#[must_use = "FIDL methods require a response to be sent"]
13522#[derive(Debug)]
13523pub struct ScanResultWatcherWatchResponder {
13524 control_handle: std::mem::ManuallyDrop<ScanResultWatcherControlHandle>,
13525 tx_id: u32,
13526}
13527
13528impl std::ops::Drop for ScanResultWatcherWatchResponder {
13532 fn drop(&mut self) {
13533 self.control_handle.shutdown();
13534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13536 }
13537}
13538
13539impl fidl::endpoints::Responder for ScanResultWatcherWatchResponder {
13540 type ControlHandle = ScanResultWatcherControlHandle;
13541
13542 fn control_handle(&self) -> &ScanResultWatcherControlHandle {
13543 &self.control_handle
13544 }
13545
13546 fn drop_without_shutdown(mut self) {
13547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
13549 std::mem::forget(self);
13551 }
13552}
13553
13554impl ScanResultWatcherWatchResponder {
13555 pub fn send(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13559 let _result = self.send_raw(updated);
13560 if _result.is_err() {
13561 self.control_handle.shutdown();
13562 }
13563 self.drop_without_shutdown();
13564 _result
13565 }
13566
13567 pub fn send_no_shutdown_on_err(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13569 let _result = self.send_raw(updated);
13570 self.drop_without_shutdown();
13571 _result
13572 }
13573
13574 fn send_raw(&self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
13575 self.control_handle.inner.send::<ScanResultWatcherWatchResponse>(
13576 (updated,),
13577 self.tx_id,
13578 0x713a122e949f301a,
13579 fidl::encoding::DynamicFlags::empty(),
13580 )
13581 }
13582}
13583
13584mod internal {
13585 use super::*;
13586
13587 impl fidl::encoding::ResourceTypeMarker for AdvertisedPeripheralOnConnectedRequest {
13588 type Borrowed<'a> = &'a mut Self;
13589 fn take_or_borrow<'a>(
13590 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13591 ) -> Self::Borrowed<'a> {
13592 value
13593 }
13594 }
13595
13596 unsafe impl fidl::encoding::TypeMarker for AdvertisedPeripheralOnConnectedRequest {
13597 type Owned = Self;
13598
13599 #[inline(always)]
13600 fn inline_align(_context: fidl::encoding::Context) -> usize {
13601 8
13602 }
13603
13604 #[inline(always)]
13605 fn inline_size(_context: fidl::encoding::Context) -> usize {
13606 24
13607 }
13608 }
13609
13610 unsafe impl
13611 fidl::encoding::Encode<
13612 AdvertisedPeripheralOnConnectedRequest,
13613 fidl::encoding::DefaultFuchsiaResourceDialect,
13614 > for &mut AdvertisedPeripheralOnConnectedRequest
13615 {
13616 #[inline]
13617 unsafe fn encode(
13618 self,
13619 encoder: &mut fidl::encoding::Encoder<
13620 '_,
13621 fidl::encoding::DefaultFuchsiaResourceDialect,
13622 >,
13623 offset: usize,
13624 _depth: fidl::encoding::Depth,
13625 ) -> fidl::Result<()> {
13626 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
13627 fidl::encoding::Encode::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13629 (
13630 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
13631 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
13632 ),
13633 encoder, offset, _depth
13634 )
13635 }
13636 }
13637 unsafe impl<
13638 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
13639 T1: fidl::encoding::Encode<
13640 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13641 fidl::encoding::DefaultFuchsiaResourceDialect,
13642 >,
13643 >
13644 fidl::encoding::Encode<
13645 AdvertisedPeripheralOnConnectedRequest,
13646 fidl::encoding::DefaultFuchsiaResourceDialect,
13647 > for (T0, T1)
13648 {
13649 #[inline]
13650 unsafe fn encode(
13651 self,
13652 encoder: &mut fidl::encoding::Encoder<
13653 '_,
13654 fidl::encoding::DefaultFuchsiaResourceDialect,
13655 >,
13656 offset: usize,
13657 depth: fidl::encoding::Depth,
13658 ) -> fidl::Result<()> {
13659 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
13660 unsafe {
13663 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13664 (ptr as *mut u64).write_unaligned(0);
13665 }
13666 self.0.encode(encoder, offset + 0, depth)?;
13668 self.1.encode(encoder, offset + 16, depth)?;
13669 Ok(())
13670 }
13671 }
13672
13673 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13674 for AdvertisedPeripheralOnConnectedRequest
13675 {
13676 #[inline(always)]
13677 fn new_empty() -> Self {
13678 Self {
13679 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
13680 connection: fidl::new_empty!(
13681 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13682 fidl::encoding::DefaultFuchsiaResourceDialect
13683 ),
13684 }
13685 }
13686
13687 #[inline]
13688 unsafe fn decode(
13689 &mut self,
13690 decoder: &mut fidl::encoding::Decoder<
13691 '_,
13692 fidl::encoding::DefaultFuchsiaResourceDialect,
13693 >,
13694 offset: usize,
13695 _depth: fidl::encoding::Depth,
13696 ) -> fidl::Result<()> {
13697 decoder.debug_check_bounds::<Self>(offset);
13698 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13700 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13701 let mask = 0xffffffff00000000u64;
13702 let maskedval = padval & mask;
13703 if maskedval != 0 {
13704 return Err(fidl::Error::NonZeroPadding {
13705 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13706 });
13707 }
13708 fidl::decode!(
13709 Peer,
13710 fidl::encoding::DefaultFuchsiaResourceDialect,
13711 &mut self.peer,
13712 decoder,
13713 offset + 0,
13714 _depth
13715 )?;
13716 fidl::decode!(
13717 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
13718 fidl::encoding::DefaultFuchsiaResourceDialect,
13719 &mut self.connection,
13720 decoder,
13721 offset + 16,
13722 _depth
13723 )?;
13724 Ok(())
13725 }
13726 }
13727
13728 impl fidl::encoding::ResourceTypeMarker for CentralConnectPeripheralRequest {
13729 type Borrowed<'a> = &'a mut Self;
13730 fn take_or_borrow<'a>(
13731 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13732 ) -> Self::Borrowed<'a> {
13733 value
13734 }
13735 }
13736
13737 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralRequest {
13738 type Owned = Self;
13739
13740 #[inline(always)]
13741 fn inline_align(_context: fidl::encoding::Context) -> usize {
13742 8
13743 }
13744
13745 #[inline(always)]
13746 fn inline_size(_context: fidl::encoding::Context) -> usize {
13747 40
13748 }
13749 }
13750
13751 unsafe impl
13752 fidl::encoding::Encode<
13753 CentralConnectPeripheralRequest,
13754 fidl::encoding::DefaultFuchsiaResourceDialect,
13755 > for &mut CentralConnectPeripheralRequest
13756 {
13757 #[inline]
13758 unsafe fn encode(
13759 self,
13760 encoder: &mut fidl::encoding::Encoder<
13761 '_,
13762 fidl::encoding::DefaultFuchsiaResourceDialect,
13763 >,
13764 offset: usize,
13765 _depth: fidl::encoding::Depth,
13766 ) -> fidl::Result<()> {
13767 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
13768 fidl::encoding::Encode::<
13770 CentralConnectPeripheralRequest,
13771 fidl::encoding::DefaultFuchsiaResourceDialect,
13772 >::encode(
13773 (
13774 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
13775 &self.identifier,
13776 ),
13777 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
13778 <fidl::encoding::Endpoint<
13779 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13780 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13781 &mut self.gatt_client
13782 ),
13783 ),
13784 encoder,
13785 offset,
13786 _depth,
13787 )
13788 }
13789 }
13790 unsafe impl<
13791 T0: fidl::encoding::Encode<
13792 fidl::encoding::BoundedString<16>,
13793 fidl::encoding::DefaultFuchsiaResourceDialect,
13794 >,
13795 T1: fidl::encoding::Encode<ConnectionOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
13796 T2: fidl::encoding::Encode<
13797 fidl::encoding::Endpoint<
13798 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13799 >,
13800 fidl::encoding::DefaultFuchsiaResourceDialect,
13801 >,
13802 >
13803 fidl::encoding::Encode<
13804 CentralConnectPeripheralRequest,
13805 fidl::encoding::DefaultFuchsiaResourceDialect,
13806 > for (T0, T1, T2)
13807 {
13808 #[inline]
13809 unsafe fn encode(
13810 self,
13811 encoder: &mut fidl::encoding::Encoder<
13812 '_,
13813 fidl::encoding::DefaultFuchsiaResourceDialect,
13814 >,
13815 offset: usize,
13816 depth: fidl::encoding::Depth,
13817 ) -> fidl::Result<()> {
13818 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
13819 unsafe {
13822 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
13823 (ptr as *mut u64).write_unaligned(0);
13824 }
13825 self.0.encode(encoder, offset + 0, depth)?;
13827 self.1.encode(encoder, offset + 16, depth)?;
13828 self.2.encode(encoder, offset + 32, depth)?;
13829 Ok(())
13830 }
13831 }
13832
13833 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13834 for CentralConnectPeripheralRequest
13835 {
13836 #[inline(always)]
13837 fn new_empty() -> Self {
13838 Self {
13839 identifier: fidl::new_empty!(
13840 fidl::encoding::BoundedString<16>,
13841 fidl::encoding::DefaultFuchsiaResourceDialect
13842 ),
13843 options: fidl::new_empty!(
13844 ConnectionOptions,
13845 fidl::encoding::DefaultFuchsiaResourceDialect
13846 ),
13847 gatt_client: fidl::new_empty!(
13848 fidl::encoding::Endpoint<
13849 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13850 >,
13851 fidl::encoding::DefaultFuchsiaResourceDialect
13852 ),
13853 }
13854 }
13855
13856 #[inline]
13857 unsafe fn decode(
13858 &mut self,
13859 decoder: &mut fidl::encoding::Decoder<
13860 '_,
13861 fidl::encoding::DefaultFuchsiaResourceDialect,
13862 >,
13863 offset: usize,
13864 _depth: fidl::encoding::Depth,
13865 ) -> fidl::Result<()> {
13866 decoder.debug_check_bounds::<Self>(offset);
13867 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
13869 let padval = unsafe { (ptr as *const u64).read_unaligned() };
13870 let mask = 0xffffffff00000000u64;
13871 let maskedval = padval & mask;
13872 if maskedval != 0 {
13873 return Err(fidl::Error::NonZeroPadding {
13874 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
13875 });
13876 }
13877 fidl::decode!(
13878 fidl::encoding::BoundedString<16>,
13879 fidl::encoding::DefaultFuchsiaResourceDialect,
13880 &mut self.identifier,
13881 decoder,
13882 offset + 0,
13883 _depth
13884 )?;
13885 fidl::decode!(
13886 ConnectionOptions,
13887 fidl::encoding::DefaultFuchsiaResourceDialect,
13888 &mut self.options,
13889 decoder,
13890 offset + 16,
13891 _depth
13892 )?;
13893 fidl::decode!(
13894 fidl::encoding::Endpoint<
13895 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
13896 >,
13897 fidl::encoding::DefaultFuchsiaResourceDialect,
13898 &mut self.gatt_client,
13899 decoder,
13900 offset + 32,
13901 _depth
13902 )?;
13903 Ok(())
13904 }
13905 }
13906
13907 impl fidl::encoding::ResourceTypeMarker for CentralConnectRequest {
13908 type Borrowed<'a> = &'a mut Self;
13909 fn take_or_borrow<'a>(
13910 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13911 ) -> Self::Borrowed<'a> {
13912 value
13913 }
13914 }
13915
13916 unsafe impl fidl::encoding::TypeMarker for CentralConnectRequest {
13917 type Owned = Self;
13918
13919 #[inline(always)]
13920 fn inline_align(_context: fidl::encoding::Context) -> usize {
13921 8
13922 }
13923
13924 #[inline(always)]
13925 fn inline_size(_context: fidl::encoding::Context) -> usize {
13926 32
13927 }
13928 }
13929
13930 unsafe impl
13931 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13932 for &mut CentralConnectRequest
13933 {
13934 #[inline]
13935 unsafe fn encode(
13936 self,
13937 encoder: &mut fidl::encoding::Encoder<
13938 '_,
13939 fidl::encoding::DefaultFuchsiaResourceDialect,
13940 >,
13941 offset: usize,
13942 _depth: fidl::encoding::Depth,
13943 ) -> fidl::Result<()> {
13944 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
13945 fidl::encoding::Encode::<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13947 (
13948 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
13949 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
13950 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
13951 ),
13952 encoder, offset, _depth
13953 )
13954 }
13955 }
13956 unsafe impl<
13957 T0: fidl::encoding::Encode<
13958 fidl_fuchsia_bluetooth::PeerId,
13959 fidl::encoding::DefaultFuchsiaResourceDialect,
13960 >,
13961 T1: fidl::encoding::Encode<ConnectionOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
13962 T2: fidl::encoding::Encode<
13963 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
13964 fidl::encoding::DefaultFuchsiaResourceDialect,
13965 >,
13966 >
13967 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13968 for (T0, T1, T2)
13969 {
13970 #[inline]
13971 unsafe fn encode(
13972 self,
13973 encoder: &mut fidl::encoding::Encoder<
13974 '_,
13975 fidl::encoding::DefaultFuchsiaResourceDialect,
13976 >,
13977 offset: usize,
13978 depth: fidl::encoding::Depth,
13979 ) -> fidl::Result<()> {
13980 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
13981 unsafe {
13984 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
13985 (ptr as *mut u64).write_unaligned(0);
13986 }
13987 self.0.encode(encoder, offset + 0, depth)?;
13989 self.1.encode(encoder, offset + 8, depth)?;
13990 self.2.encode(encoder, offset + 24, depth)?;
13991 Ok(())
13992 }
13993 }
13994
13995 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13996 for CentralConnectRequest
13997 {
13998 #[inline(always)]
13999 fn new_empty() -> Self {
14000 Self {
14001 id: fidl::new_empty!(
14002 fidl_fuchsia_bluetooth::PeerId,
14003 fidl::encoding::DefaultFuchsiaResourceDialect
14004 ),
14005 options: fidl::new_empty!(
14006 ConnectionOptions,
14007 fidl::encoding::DefaultFuchsiaResourceDialect
14008 ),
14009 handle: fidl::new_empty!(
14010 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
14011 fidl::encoding::DefaultFuchsiaResourceDialect
14012 ),
14013 }
14014 }
14015
14016 #[inline]
14017 unsafe fn decode(
14018 &mut self,
14019 decoder: &mut fidl::encoding::Decoder<
14020 '_,
14021 fidl::encoding::DefaultFuchsiaResourceDialect,
14022 >,
14023 offset: usize,
14024 _depth: fidl::encoding::Depth,
14025 ) -> fidl::Result<()> {
14026 decoder.debug_check_bounds::<Self>(offset);
14027 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
14029 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14030 let mask = 0xffffffff00000000u64;
14031 let maskedval = padval & mask;
14032 if maskedval != 0 {
14033 return Err(fidl::Error::NonZeroPadding {
14034 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
14035 });
14036 }
14037 fidl::decode!(
14038 fidl_fuchsia_bluetooth::PeerId,
14039 fidl::encoding::DefaultFuchsiaResourceDialect,
14040 &mut self.id,
14041 decoder,
14042 offset + 0,
14043 _depth
14044 )?;
14045 fidl::decode!(
14046 ConnectionOptions,
14047 fidl::encoding::DefaultFuchsiaResourceDialect,
14048 &mut self.options,
14049 decoder,
14050 offset + 8,
14051 _depth
14052 )?;
14053 fidl::decode!(
14054 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
14055 fidl::encoding::DefaultFuchsiaResourceDialect,
14056 &mut self.handle,
14057 decoder,
14058 offset + 24,
14059 _depth
14060 )?;
14061 Ok(())
14062 }
14063 }
14064
14065 impl fidl::encoding::ResourceTypeMarker for CentralScanRequest {
14066 type Borrowed<'a> = &'a mut Self;
14067 fn take_or_borrow<'a>(
14068 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14069 ) -> Self::Borrowed<'a> {
14070 value
14071 }
14072 }
14073
14074 unsafe impl fidl::encoding::TypeMarker for CentralScanRequest {
14075 type Owned = Self;
14076
14077 #[inline(always)]
14078 fn inline_align(_context: fidl::encoding::Context) -> usize {
14079 8
14080 }
14081
14082 #[inline(always)]
14083 fn inline_size(_context: fidl::encoding::Context) -> usize {
14084 24
14085 }
14086 }
14087
14088 unsafe impl
14089 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
14090 for &mut CentralScanRequest
14091 {
14092 #[inline]
14093 unsafe fn encode(
14094 self,
14095 encoder: &mut fidl::encoding::Encoder<
14096 '_,
14097 fidl::encoding::DefaultFuchsiaResourceDialect,
14098 >,
14099 offset: usize,
14100 _depth: fidl::encoding::Depth,
14101 ) -> fidl::Result<()> {
14102 encoder.debug_check_bounds::<CentralScanRequest>(offset);
14103 fidl::encoding::Encode::<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14105 (
14106 <ScanOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
14107 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_watcher),
14108 ),
14109 encoder, offset, _depth
14110 )
14111 }
14112 }
14113 unsafe impl<
14114 T0: fidl::encoding::Encode<ScanOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
14115 T1: fidl::encoding::Encode<
14116 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14117 fidl::encoding::DefaultFuchsiaResourceDialect,
14118 >,
14119 > fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
14120 for (T0, T1)
14121 {
14122 #[inline]
14123 unsafe fn encode(
14124 self,
14125 encoder: &mut fidl::encoding::Encoder<
14126 '_,
14127 fidl::encoding::DefaultFuchsiaResourceDialect,
14128 >,
14129 offset: usize,
14130 depth: fidl::encoding::Depth,
14131 ) -> fidl::Result<()> {
14132 encoder.debug_check_bounds::<CentralScanRequest>(offset);
14133 unsafe {
14136 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14137 (ptr as *mut u64).write_unaligned(0);
14138 }
14139 self.0.encode(encoder, offset + 0, depth)?;
14141 self.1.encode(encoder, offset + 16, depth)?;
14142 Ok(())
14143 }
14144 }
14145
14146 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14147 for CentralScanRequest
14148 {
14149 #[inline(always)]
14150 fn new_empty() -> Self {
14151 Self {
14152 options: fidl::new_empty!(
14153 ScanOptions,
14154 fidl::encoding::DefaultFuchsiaResourceDialect
14155 ),
14156 result_watcher: fidl::new_empty!(
14157 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14158 fidl::encoding::DefaultFuchsiaResourceDialect
14159 ),
14160 }
14161 }
14162
14163 #[inline]
14164 unsafe fn decode(
14165 &mut self,
14166 decoder: &mut fidl::encoding::Decoder<
14167 '_,
14168 fidl::encoding::DefaultFuchsiaResourceDialect,
14169 >,
14170 offset: usize,
14171 _depth: fidl::encoding::Depth,
14172 ) -> fidl::Result<()> {
14173 decoder.debug_check_bounds::<Self>(offset);
14174 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14176 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14177 let mask = 0xffffffff00000000u64;
14178 let maskedval = padval & mask;
14179 if maskedval != 0 {
14180 return Err(fidl::Error::NonZeroPadding {
14181 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14182 });
14183 }
14184 fidl::decode!(
14185 ScanOptions,
14186 fidl::encoding::DefaultFuchsiaResourceDialect,
14187 &mut self.options,
14188 decoder,
14189 offset + 0,
14190 _depth
14191 )?;
14192 fidl::decode!(
14193 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
14194 fidl::encoding::DefaultFuchsiaResourceDialect,
14195 &mut self.result_watcher,
14196 decoder,
14197 offset + 16,
14198 _depth
14199 )?;
14200 Ok(())
14201 }
14202 }
14203
14204 impl fidl::encoding::ResourceTypeMarker for ChannelListenerAcceptRequest {
14205 type Borrowed<'a> = &'a mut Self;
14206 fn take_or_borrow<'a>(
14207 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14208 ) -> Self::Borrowed<'a> {
14209 value
14210 }
14211 }
14212
14213 unsafe impl fidl::encoding::TypeMarker for ChannelListenerAcceptRequest {
14214 type Owned = Self;
14215
14216 #[inline(always)]
14217 fn inline_align(_context: fidl::encoding::Context) -> usize {
14218 4
14219 }
14220
14221 #[inline(always)]
14222 fn inline_size(_context: fidl::encoding::Context) -> usize {
14223 4
14224 }
14225 }
14226
14227 unsafe impl
14228 fidl::encoding::Encode<
14229 ChannelListenerAcceptRequest,
14230 fidl::encoding::DefaultFuchsiaResourceDialect,
14231 > for &mut ChannelListenerAcceptRequest
14232 {
14233 #[inline]
14234 unsafe fn encode(
14235 self,
14236 encoder: &mut fidl::encoding::Encoder<
14237 '_,
14238 fidl::encoding::DefaultFuchsiaResourceDialect,
14239 >,
14240 offset: usize,
14241 _depth: fidl::encoding::Depth,
14242 ) -> fidl::Result<()> {
14243 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
14244 fidl::encoding::Encode::<
14246 ChannelListenerAcceptRequest,
14247 fidl::encoding::DefaultFuchsiaResourceDialect,
14248 >::encode(
14249 (<fidl::encoding::Endpoint<
14250 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14251 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14252 &mut self.channel
14253 ),),
14254 encoder,
14255 offset,
14256 _depth,
14257 )
14258 }
14259 }
14260 unsafe impl<
14261 T0: fidl::encoding::Encode<
14262 fidl::encoding::Endpoint<
14263 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14264 >,
14265 fidl::encoding::DefaultFuchsiaResourceDialect,
14266 >,
14267 >
14268 fidl::encoding::Encode<
14269 ChannelListenerAcceptRequest,
14270 fidl::encoding::DefaultFuchsiaResourceDialect,
14271 > for (T0,)
14272 {
14273 #[inline]
14274 unsafe fn encode(
14275 self,
14276 encoder: &mut fidl::encoding::Encoder<
14277 '_,
14278 fidl::encoding::DefaultFuchsiaResourceDialect,
14279 >,
14280 offset: usize,
14281 depth: fidl::encoding::Depth,
14282 ) -> fidl::Result<()> {
14283 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
14284 self.0.encode(encoder, offset + 0, depth)?;
14288 Ok(())
14289 }
14290 }
14291
14292 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14293 for ChannelListenerAcceptRequest
14294 {
14295 #[inline(always)]
14296 fn new_empty() -> Self {
14297 Self {
14298 channel: fidl::new_empty!(
14299 fidl::encoding::Endpoint<
14300 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14301 >,
14302 fidl::encoding::DefaultFuchsiaResourceDialect
14303 ),
14304 }
14305 }
14306
14307 #[inline]
14308 unsafe fn decode(
14309 &mut self,
14310 decoder: &mut fidl::encoding::Decoder<
14311 '_,
14312 fidl::encoding::DefaultFuchsiaResourceDialect,
14313 >,
14314 offset: usize,
14315 _depth: fidl::encoding::Depth,
14316 ) -> fidl::Result<()> {
14317 decoder.debug_check_bounds::<Self>(offset);
14318 fidl::decode!(
14320 fidl::encoding::Endpoint<
14321 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14322 >,
14323 fidl::encoding::DefaultFuchsiaResourceDialect,
14324 &mut self.channel,
14325 decoder,
14326 offset + 0,
14327 _depth
14328 )?;
14329 Ok(())
14330 }
14331 }
14332
14333 impl fidl::encoding::ResourceTypeMarker for ConnectionRequestGattClientRequest {
14334 type Borrowed<'a> = &'a mut Self;
14335 fn take_or_borrow<'a>(
14336 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14337 ) -> Self::Borrowed<'a> {
14338 value
14339 }
14340 }
14341
14342 unsafe impl fidl::encoding::TypeMarker for ConnectionRequestGattClientRequest {
14343 type Owned = Self;
14344
14345 #[inline(always)]
14346 fn inline_align(_context: fidl::encoding::Context) -> usize {
14347 4
14348 }
14349
14350 #[inline(always)]
14351 fn inline_size(_context: fidl::encoding::Context) -> usize {
14352 4
14353 }
14354 }
14355
14356 unsafe impl
14357 fidl::encoding::Encode<
14358 ConnectionRequestGattClientRequest,
14359 fidl::encoding::DefaultFuchsiaResourceDialect,
14360 > for &mut ConnectionRequestGattClientRequest
14361 {
14362 #[inline]
14363 unsafe fn encode(
14364 self,
14365 encoder: &mut fidl::encoding::Encoder<
14366 '_,
14367 fidl::encoding::DefaultFuchsiaResourceDialect,
14368 >,
14369 offset: usize,
14370 _depth: fidl::encoding::Depth,
14371 ) -> fidl::Result<()> {
14372 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
14373 fidl::encoding::Encode::<
14375 ConnectionRequestGattClientRequest,
14376 fidl::encoding::DefaultFuchsiaResourceDialect,
14377 >::encode(
14378 (<fidl::encoding::Endpoint<
14379 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14380 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14381 &mut self.client
14382 ),),
14383 encoder,
14384 offset,
14385 _depth,
14386 )
14387 }
14388 }
14389 unsafe impl<
14390 T0: fidl::encoding::Encode<
14391 fidl::encoding::Endpoint<
14392 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14393 >,
14394 fidl::encoding::DefaultFuchsiaResourceDialect,
14395 >,
14396 >
14397 fidl::encoding::Encode<
14398 ConnectionRequestGattClientRequest,
14399 fidl::encoding::DefaultFuchsiaResourceDialect,
14400 > for (T0,)
14401 {
14402 #[inline]
14403 unsafe fn encode(
14404 self,
14405 encoder: &mut fidl::encoding::Encoder<
14406 '_,
14407 fidl::encoding::DefaultFuchsiaResourceDialect,
14408 >,
14409 offset: usize,
14410 depth: fidl::encoding::Depth,
14411 ) -> fidl::Result<()> {
14412 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
14413 self.0.encode(encoder, offset + 0, depth)?;
14417 Ok(())
14418 }
14419 }
14420
14421 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14422 for ConnectionRequestGattClientRequest
14423 {
14424 #[inline(always)]
14425 fn new_empty() -> Self {
14426 Self {
14427 client: fidl::new_empty!(
14428 fidl::encoding::Endpoint<
14429 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14430 >,
14431 fidl::encoding::DefaultFuchsiaResourceDialect
14432 ),
14433 }
14434 }
14435
14436 #[inline]
14437 unsafe fn decode(
14438 &mut self,
14439 decoder: &mut fidl::encoding::Decoder<
14440 '_,
14441 fidl::encoding::DefaultFuchsiaResourceDialect,
14442 >,
14443 offset: usize,
14444 _depth: fidl::encoding::Depth,
14445 ) -> fidl::Result<()> {
14446 decoder.debug_check_bounds::<Self>(offset);
14447 fidl::decode!(
14449 fidl::encoding::Endpoint<
14450 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
14451 >,
14452 fidl::encoding::DefaultFuchsiaResourceDialect,
14453 &mut self.client,
14454 decoder,
14455 offset + 0,
14456 _depth
14457 )?;
14458 Ok(())
14459 }
14460 }
14461
14462 impl fidl::encoding::ResourceTypeMarker for PeripheralAdvertiseRequest {
14463 type Borrowed<'a> = &'a mut Self;
14464 fn take_or_borrow<'a>(
14465 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14466 ) -> Self::Borrowed<'a> {
14467 value
14468 }
14469 }
14470
14471 unsafe impl fidl::encoding::TypeMarker for PeripheralAdvertiseRequest {
14472 type Owned = Self;
14473
14474 #[inline(always)]
14475 fn inline_align(_context: fidl::encoding::Context) -> usize {
14476 8
14477 }
14478
14479 #[inline(always)]
14480 fn inline_size(_context: fidl::encoding::Context) -> usize {
14481 24
14482 }
14483 }
14484
14485 unsafe impl
14486 fidl::encoding::Encode<
14487 PeripheralAdvertiseRequest,
14488 fidl::encoding::DefaultFuchsiaResourceDialect,
14489 > for &mut PeripheralAdvertiseRequest
14490 {
14491 #[inline]
14492 unsafe fn encode(
14493 self,
14494 encoder: &mut fidl::encoding::Encoder<
14495 '_,
14496 fidl::encoding::DefaultFuchsiaResourceDialect,
14497 >,
14498 offset: usize,
14499 _depth: fidl::encoding::Depth,
14500 ) -> fidl::Result<()> {
14501 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
14502 fidl::encoding::Encode::<
14504 PeripheralAdvertiseRequest,
14505 fidl::encoding::DefaultFuchsiaResourceDialect,
14506 >::encode(
14507 (
14508 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(
14509 &self.parameters,
14510 ),
14511 <fidl::encoding::Endpoint<
14512 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
14513 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14514 &mut self.advertised_peripheral,
14515 ),
14516 ),
14517 encoder,
14518 offset,
14519 _depth,
14520 )
14521 }
14522 }
14523 unsafe impl<
14524 T0: fidl::encoding::Encode<
14525 AdvertisingParameters,
14526 fidl::encoding::DefaultFuchsiaResourceDialect,
14527 >,
14528 T1: fidl::encoding::Encode<
14529 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
14530 fidl::encoding::DefaultFuchsiaResourceDialect,
14531 >,
14532 >
14533 fidl::encoding::Encode<
14534 PeripheralAdvertiseRequest,
14535 fidl::encoding::DefaultFuchsiaResourceDialect,
14536 > for (T0, T1)
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 unsafe {
14552 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14553 (ptr as *mut u64).write_unaligned(0);
14554 }
14555 self.0.encode(encoder, offset + 0, depth)?;
14557 self.1.encode(encoder, offset + 16, depth)?;
14558 Ok(())
14559 }
14560 }
14561
14562 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14563 for PeripheralAdvertiseRequest
14564 {
14565 #[inline(always)]
14566 fn new_empty() -> Self {
14567 Self {
14568 parameters: fidl::new_empty!(
14569 AdvertisingParameters,
14570 fidl::encoding::DefaultFuchsiaResourceDialect
14571 ),
14572 advertised_peripheral: fidl::new_empty!(
14573 fidl::encoding::Endpoint<
14574 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
14575 >,
14576 fidl::encoding::DefaultFuchsiaResourceDialect
14577 ),
14578 }
14579 }
14580
14581 #[inline]
14582 unsafe fn decode(
14583 &mut self,
14584 decoder: &mut fidl::encoding::Decoder<
14585 '_,
14586 fidl::encoding::DefaultFuchsiaResourceDialect,
14587 >,
14588 offset: usize,
14589 _depth: fidl::encoding::Depth,
14590 ) -> fidl::Result<()> {
14591 decoder.debug_check_bounds::<Self>(offset);
14592 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14594 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14595 let mask = 0xffffffff00000000u64;
14596 let maskedval = padval & mask;
14597 if maskedval != 0 {
14598 return Err(fidl::Error::NonZeroPadding {
14599 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14600 });
14601 }
14602 fidl::decode!(
14603 AdvertisingParameters,
14604 fidl::encoding::DefaultFuchsiaResourceDialect,
14605 &mut self.parameters,
14606 decoder,
14607 offset + 0,
14608 _depth
14609 )?;
14610 fidl::decode!(
14611 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
14612 fidl::encoding::DefaultFuchsiaResourceDialect,
14613 &mut self.advertised_peripheral,
14614 decoder,
14615 offset + 16,
14616 _depth
14617 )?;
14618 Ok(())
14619 }
14620 }
14621
14622 impl fidl::encoding::ResourceTypeMarker for PeripheralOnPeerConnectedRequest {
14623 type Borrowed<'a> = &'a mut Self;
14624 fn take_or_borrow<'a>(
14625 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14626 ) -> Self::Borrowed<'a> {
14627 value
14628 }
14629 }
14630
14631 unsafe impl fidl::encoding::TypeMarker for PeripheralOnPeerConnectedRequest {
14632 type Owned = Self;
14633
14634 #[inline(always)]
14635 fn inline_align(_context: fidl::encoding::Context) -> usize {
14636 8
14637 }
14638
14639 #[inline(always)]
14640 fn inline_size(_context: fidl::encoding::Context) -> usize {
14641 24
14642 }
14643 }
14644
14645 unsafe impl
14646 fidl::encoding::Encode<
14647 PeripheralOnPeerConnectedRequest,
14648 fidl::encoding::DefaultFuchsiaResourceDialect,
14649 > for &mut PeripheralOnPeerConnectedRequest
14650 {
14651 #[inline]
14652 unsafe fn encode(
14653 self,
14654 encoder: &mut fidl::encoding::Encoder<
14655 '_,
14656 fidl::encoding::DefaultFuchsiaResourceDialect,
14657 >,
14658 offset: usize,
14659 _depth: fidl::encoding::Depth,
14660 ) -> fidl::Result<()> {
14661 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
14662 fidl::encoding::Encode::<PeripheralOnPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14664 (
14665 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
14666 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
14667 ),
14668 encoder, offset, _depth
14669 )
14670 }
14671 }
14672 unsafe impl<
14673 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
14674 T1: fidl::encoding::Encode<
14675 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14676 fidl::encoding::DefaultFuchsiaResourceDialect,
14677 >,
14678 >
14679 fidl::encoding::Encode<
14680 PeripheralOnPeerConnectedRequest,
14681 fidl::encoding::DefaultFuchsiaResourceDialect,
14682 > for (T0, T1)
14683 {
14684 #[inline]
14685 unsafe fn encode(
14686 self,
14687 encoder: &mut fidl::encoding::Encoder<
14688 '_,
14689 fidl::encoding::DefaultFuchsiaResourceDialect,
14690 >,
14691 offset: usize,
14692 depth: fidl::encoding::Depth,
14693 ) -> fidl::Result<()> {
14694 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
14695 unsafe {
14698 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14699 (ptr as *mut u64).write_unaligned(0);
14700 }
14701 self.0.encode(encoder, offset + 0, depth)?;
14703 self.1.encode(encoder, offset + 16, depth)?;
14704 Ok(())
14705 }
14706 }
14707
14708 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14709 for PeripheralOnPeerConnectedRequest
14710 {
14711 #[inline(always)]
14712 fn new_empty() -> Self {
14713 Self {
14714 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
14715 connection: fidl::new_empty!(
14716 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14717 fidl::encoding::DefaultFuchsiaResourceDialect
14718 ),
14719 }
14720 }
14721
14722 #[inline]
14723 unsafe fn decode(
14724 &mut self,
14725 decoder: &mut fidl::encoding::Decoder<
14726 '_,
14727 fidl::encoding::DefaultFuchsiaResourceDialect,
14728 >,
14729 offset: usize,
14730 _depth: fidl::encoding::Depth,
14731 ) -> fidl::Result<()> {
14732 decoder.debug_check_bounds::<Self>(offset);
14733 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14735 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14736 let mask = 0xffffffff00000000u64;
14737 let maskedval = padval & mask;
14738 if maskedval != 0 {
14739 return Err(fidl::Error::NonZeroPadding {
14740 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14741 });
14742 }
14743 fidl::decode!(
14744 Peer,
14745 fidl::encoding::DefaultFuchsiaResourceDialect,
14746 &mut self.peer,
14747 decoder,
14748 offset + 0,
14749 _depth
14750 )?;
14751 fidl::decode!(
14752 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
14753 fidl::encoding::DefaultFuchsiaResourceDialect,
14754 &mut self.connection,
14755 decoder,
14756 offset + 16,
14757 _depth
14758 )?;
14759 Ok(())
14760 }
14761 }
14762
14763 impl fidl::encoding::ResourceTypeMarker for PeripheralStartAdvertisingRequest {
14764 type Borrowed<'a> = &'a mut Self;
14765 fn take_or_borrow<'a>(
14766 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14767 ) -> Self::Borrowed<'a> {
14768 value
14769 }
14770 }
14771
14772 unsafe impl fidl::encoding::TypeMarker for PeripheralStartAdvertisingRequest {
14773 type Owned = Self;
14774
14775 #[inline(always)]
14776 fn inline_align(_context: fidl::encoding::Context) -> usize {
14777 8
14778 }
14779
14780 #[inline(always)]
14781 fn inline_size(_context: fidl::encoding::Context) -> usize {
14782 24
14783 }
14784 }
14785
14786 unsafe impl
14787 fidl::encoding::Encode<
14788 PeripheralStartAdvertisingRequest,
14789 fidl::encoding::DefaultFuchsiaResourceDialect,
14790 > for &mut PeripheralStartAdvertisingRequest
14791 {
14792 #[inline]
14793 unsafe fn encode(
14794 self,
14795 encoder: &mut fidl::encoding::Encoder<
14796 '_,
14797 fidl::encoding::DefaultFuchsiaResourceDialect,
14798 >,
14799 offset: usize,
14800 _depth: fidl::encoding::Depth,
14801 ) -> fidl::Result<()> {
14802 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
14803 fidl::encoding::Encode::<PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14805 (
14806 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
14807 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
14808 ),
14809 encoder, offset, _depth
14810 )
14811 }
14812 }
14813 unsafe impl<
14814 T0: fidl::encoding::Encode<
14815 AdvertisingParameters,
14816 fidl::encoding::DefaultFuchsiaResourceDialect,
14817 >,
14818 T1: fidl::encoding::Encode<
14819 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14820 fidl::encoding::DefaultFuchsiaResourceDialect,
14821 >,
14822 >
14823 fidl::encoding::Encode<
14824 PeripheralStartAdvertisingRequest,
14825 fidl::encoding::DefaultFuchsiaResourceDialect,
14826 > for (T0, T1)
14827 {
14828 #[inline]
14829 unsafe fn encode(
14830 self,
14831 encoder: &mut fidl::encoding::Encoder<
14832 '_,
14833 fidl::encoding::DefaultFuchsiaResourceDialect,
14834 >,
14835 offset: usize,
14836 depth: fidl::encoding::Depth,
14837 ) -> fidl::Result<()> {
14838 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
14839 unsafe {
14842 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
14843 (ptr as *mut u64).write_unaligned(0);
14844 }
14845 self.0.encode(encoder, offset + 0, depth)?;
14847 self.1.encode(encoder, offset + 16, depth)?;
14848 Ok(())
14849 }
14850 }
14851
14852 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14853 for PeripheralStartAdvertisingRequest
14854 {
14855 #[inline(always)]
14856 fn new_empty() -> Self {
14857 Self {
14858 parameters: fidl::new_empty!(
14859 AdvertisingParameters,
14860 fidl::encoding::DefaultFuchsiaResourceDialect
14861 ),
14862 handle: fidl::new_empty!(
14863 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14864 fidl::encoding::DefaultFuchsiaResourceDialect
14865 ),
14866 }
14867 }
14868
14869 #[inline]
14870 unsafe fn decode(
14871 &mut self,
14872 decoder: &mut fidl::encoding::Decoder<
14873 '_,
14874 fidl::encoding::DefaultFuchsiaResourceDialect,
14875 >,
14876 offset: usize,
14877 _depth: fidl::encoding::Depth,
14878 ) -> fidl::Result<()> {
14879 decoder.debug_check_bounds::<Self>(offset);
14880 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
14882 let padval = unsafe { (ptr as *const u64).read_unaligned() };
14883 let mask = 0xffffffff00000000u64;
14884 let maskedval = padval & mask;
14885 if maskedval != 0 {
14886 return Err(fidl::Error::NonZeroPadding {
14887 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
14888 });
14889 }
14890 fidl::decode!(
14891 AdvertisingParameters,
14892 fidl::encoding::DefaultFuchsiaResourceDialect,
14893 &mut self.parameters,
14894 decoder,
14895 offset + 0,
14896 _depth
14897 )?;
14898 fidl::decode!(
14899 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
14900 fidl::encoding::DefaultFuchsiaResourceDialect,
14901 &mut self.handle,
14902 decoder,
14903 offset + 16,
14904 _depth
14905 )?;
14906 Ok(())
14907 }
14908 }
14909
14910 impl CentralCreateConnectedIsochronousGroupRequest {
14911 #[inline(always)]
14912 fn max_ordinal_present(&self) -> u64 {
14913 if let Some(_) = self.cig {
14914 return 3;
14915 }
14916 if let Some(_) = self.cis_requested_parameters {
14917 return 2;
14918 }
14919 if let Some(_) = self.cig_parameters {
14920 return 1;
14921 }
14922 0
14923 }
14924 }
14925
14926 impl fidl::encoding::ResourceTypeMarker for CentralCreateConnectedIsochronousGroupRequest {
14927 type Borrowed<'a> = &'a mut Self;
14928 fn take_or_borrow<'a>(
14929 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14930 ) -> Self::Borrowed<'a> {
14931 value
14932 }
14933 }
14934
14935 unsafe impl fidl::encoding::TypeMarker for CentralCreateConnectedIsochronousGroupRequest {
14936 type Owned = Self;
14937
14938 #[inline(always)]
14939 fn inline_align(_context: fidl::encoding::Context) -> usize {
14940 8
14941 }
14942
14943 #[inline(always)]
14944 fn inline_size(_context: fidl::encoding::Context) -> usize {
14945 16
14946 }
14947 }
14948
14949 unsafe impl
14950 fidl::encoding::Encode<
14951 CentralCreateConnectedIsochronousGroupRequest,
14952 fidl::encoding::DefaultFuchsiaResourceDialect,
14953 > for &mut CentralCreateConnectedIsochronousGroupRequest
14954 {
14955 unsafe fn encode(
14956 self,
14957 encoder: &mut fidl::encoding::Encoder<
14958 '_,
14959 fidl::encoding::DefaultFuchsiaResourceDialect,
14960 >,
14961 offset: usize,
14962 mut depth: fidl::encoding::Depth,
14963 ) -> fidl::Result<()> {
14964 encoder.debug_check_bounds::<CentralCreateConnectedIsochronousGroupRequest>(offset);
14965 let max_ordinal: u64 = self.max_ordinal_present();
14967 encoder.write_num(max_ordinal, offset);
14968 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14969 if max_ordinal == 0 {
14971 return Ok(());
14972 }
14973 depth.increment()?;
14974 let envelope_size = 8;
14975 let bytes_len = max_ordinal as usize * envelope_size;
14976 #[allow(unused_variables)]
14977 let offset = encoder.out_of_line_offset(bytes_len);
14978 let mut _prev_end_offset: usize = 0;
14979 if 1 > max_ordinal {
14980 return Ok(());
14981 }
14982
14983 let cur_offset: usize = (1 - 1) * envelope_size;
14986
14987 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14989
14990 fidl::encoding::encode_in_envelope_optional::<
14995 CigParameters,
14996 fidl::encoding::DefaultFuchsiaResourceDialect,
14997 >(
14998 self.cig_parameters
14999 .as_ref()
15000 .map(<CigParameters as fidl::encoding::ValueTypeMarker>::borrow),
15001 encoder,
15002 offset + cur_offset,
15003 depth,
15004 )?;
15005
15006 _prev_end_offset = cur_offset + envelope_size;
15007 if 2 > max_ordinal {
15008 return Ok(());
15009 }
15010
15011 let cur_offset: usize = (2 - 1) * envelope_size;
15014
15015 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15017
15018 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15023 self.cis_requested_parameters.as_mut().map(<fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15024 encoder, offset + cur_offset, depth
15025 )?;
15026
15027 _prev_end_offset = cur_offset + envelope_size;
15028 if 3 > max_ordinal {
15029 return Ok(());
15030 }
15031
15032 let cur_offset: usize = (3 - 1) * envelope_size;
15035
15036 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15038
15039 fidl::encoding::encode_in_envelope_optional::<
15044 fidl::encoding::Endpoint<
15045 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15046 >,
15047 fidl::encoding::DefaultFuchsiaResourceDialect,
15048 >(
15049 self.cig.as_mut().map(
15050 <fidl::encoding::Endpoint<
15051 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15052 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15053 ),
15054 encoder,
15055 offset + cur_offset,
15056 depth,
15057 )?;
15058
15059 _prev_end_offset = cur_offset + envelope_size;
15060
15061 Ok(())
15062 }
15063 }
15064
15065 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15066 for CentralCreateConnectedIsochronousGroupRequest
15067 {
15068 #[inline(always)]
15069 fn new_empty() -> Self {
15070 Self::default()
15071 }
15072
15073 unsafe fn decode(
15074 &mut self,
15075 decoder: &mut fidl::encoding::Decoder<
15076 '_,
15077 fidl::encoding::DefaultFuchsiaResourceDialect,
15078 >,
15079 offset: usize,
15080 mut depth: fidl::encoding::Depth,
15081 ) -> fidl::Result<()> {
15082 decoder.debug_check_bounds::<Self>(offset);
15083 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15084 None => return Err(fidl::Error::NotNullable),
15085 Some(len) => len,
15086 };
15087 if len == 0 {
15089 return Ok(());
15090 };
15091 depth.increment()?;
15092 let envelope_size = 8;
15093 let bytes_len = len * envelope_size;
15094 let offset = decoder.out_of_line_offset(bytes_len)?;
15095 let mut _next_ordinal_to_read = 0;
15097 let mut next_offset = offset;
15098 let end_offset = offset + bytes_len;
15099 _next_ordinal_to_read += 1;
15100 if next_offset >= end_offset {
15101 return Ok(());
15102 }
15103
15104 while _next_ordinal_to_read < 1 {
15106 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15107 _next_ordinal_to_read += 1;
15108 next_offset += envelope_size;
15109 }
15110
15111 let next_out_of_line = decoder.next_out_of_line();
15112 let handles_before = decoder.remaining_handles();
15113 if let Some((inlined, num_bytes, num_handles)) =
15114 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15115 {
15116 let member_inline_size =
15117 <CigParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15118 if inlined != (member_inline_size <= 4) {
15119 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15120 }
15121 let inner_offset;
15122 let mut inner_depth = depth.clone();
15123 if inlined {
15124 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15125 inner_offset = next_offset;
15126 } else {
15127 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15128 inner_depth.increment()?;
15129 }
15130 let val_ref = self.cig_parameters.get_or_insert_with(|| {
15131 fidl::new_empty!(CigParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
15132 });
15133 fidl::decode!(
15134 CigParameters,
15135 fidl::encoding::DefaultFuchsiaResourceDialect,
15136 val_ref,
15137 decoder,
15138 inner_offset,
15139 inner_depth
15140 )?;
15141 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15142 {
15143 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15144 }
15145 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15146 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15147 }
15148 }
15149
15150 next_offset += envelope_size;
15151 _next_ordinal_to_read += 1;
15152 if next_offset >= end_offset {
15153 return Ok(());
15154 }
15155
15156 while _next_ordinal_to_read < 2 {
15158 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15159 _next_ordinal_to_read += 1;
15160 next_offset += envelope_size;
15161 }
15162
15163 let next_out_of_line = decoder.next_out_of_line();
15164 let handles_before = decoder.remaining_handles();
15165 if let Some((inlined, num_bytes, num_handles)) =
15166 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15167 {
15168 let member_inline_size = <fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15169 if inlined != (member_inline_size <= 4) {
15170 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15171 }
15172 let inner_offset;
15173 let mut inner_depth = depth.clone();
15174 if inlined {
15175 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15176 inner_offset = next_offset;
15177 } else {
15178 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15179 inner_depth.increment()?;
15180 }
15181 let val_ref =
15182 self.cis_requested_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect));
15183 fidl::decode!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15185 {
15186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15187 }
15188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15190 }
15191 }
15192
15193 next_offset += envelope_size;
15194 _next_ordinal_to_read += 1;
15195 if next_offset >= end_offset {
15196 return Ok(());
15197 }
15198
15199 while _next_ordinal_to_read < 3 {
15201 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15202 _next_ordinal_to_read += 1;
15203 next_offset += envelope_size;
15204 }
15205
15206 let next_out_of_line = decoder.next_out_of_line();
15207 let handles_before = decoder.remaining_handles();
15208 if let Some((inlined, num_bytes, num_handles)) =
15209 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15210 {
15211 let member_inline_size = <fidl::encoding::Endpoint<
15212 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15213 > as fidl::encoding::TypeMarker>::inline_size(
15214 decoder.context
15215 );
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 = self.cig.get_or_insert_with(|| {
15229 fidl::new_empty!(
15230 fidl::encoding::Endpoint<
15231 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15232 >,
15233 fidl::encoding::DefaultFuchsiaResourceDialect
15234 )
15235 });
15236 fidl::decode!(
15237 fidl::encoding::Endpoint<
15238 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
15239 >,
15240 fidl::encoding::DefaultFuchsiaResourceDialect,
15241 val_ref,
15242 decoder,
15243 inner_offset,
15244 inner_depth
15245 )?;
15246 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15247 {
15248 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15249 }
15250 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15251 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15252 }
15253 }
15254
15255 next_offset += envelope_size;
15256
15257 while next_offset < end_offset {
15259 _next_ordinal_to_read += 1;
15260 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15261 next_offset += envelope_size;
15262 }
15263
15264 Ok(())
15265 }
15266 }
15267
15268 impl CentralSyncToPeriodicAdvertisingRequest {
15269 #[inline(always)]
15270 fn max_ordinal_present(&self) -> u64 {
15271 if let Some(_) = self.config {
15272 return 4;
15273 }
15274 if let Some(_) = self.sync {
15275 return 3;
15276 }
15277 if let Some(_) = self.advertising_sid {
15278 return 2;
15279 }
15280 if let Some(_) = self.peer_id {
15281 return 1;
15282 }
15283 0
15284 }
15285 }
15286
15287 impl fidl::encoding::ResourceTypeMarker for CentralSyncToPeriodicAdvertisingRequest {
15288 type Borrowed<'a> = &'a mut Self;
15289 fn take_or_borrow<'a>(
15290 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15291 ) -> Self::Borrowed<'a> {
15292 value
15293 }
15294 }
15295
15296 unsafe impl fidl::encoding::TypeMarker for CentralSyncToPeriodicAdvertisingRequest {
15297 type Owned = Self;
15298
15299 #[inline(always)]
15300 fn inline_align(_context: fidl::encoding::Context) -> usize {
15301 8
15302 }
15303
15304 #[inline(always)]
15305 fn inline_size(_context: fidl::encoding::Context) -> usize {
15306 16
15307 }
15308 }
15309
15310 unsafe impl
15311 fidl::encoding::Encode<
15312 CentralSyncToPeriodicAdvertisingRequest,
15313 fidl::encoding::DefaultFuchsiaResourceDialect,
15314 > for &mut CentralSyncToPeriodicAdvertisingRequest
15315 {
15316 unsafe fn encode(
15317 self,
15318 encoder: &mut fidl::encoding::Encoder<
15319 '_,
15320 fidl::encoding::DefaultFuchsiaResourceDialect,
15321 >,
15322 offset: usize,
15323 mut depth: fidl::encoding::Depth,
15324 ) -> fidl::Result<()> {
15325 encoder.debug_check_bounds::<CentralSyncToPeriodicAdvertisingRequest>(offset);
15326 let max_ordinal: u64 = self.max_ordinal_present();
15328 encoder.write_num(max_ordinal, offset);
15329 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15330 if max_ordinal == 0 {
15332 return Ok(());
15333 }
15334 depth.increment()?;
15335 let envelope_size = 8;
15336 let bytes_len = max_ordinal as usize * envelope_size;
15337 #[allow(unused_variables)]
15338 let offset = encoder.out_of_line_offset(bytes_len);
15339 let mut _prev_end_offset: usize = 0;
15340 if 1 > max_ordinal {
15341 return Ok(());
15342 }
15343
15344 let cur_offset: usize = (1 - 1) * envelope_size;
15347
15348 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15350
15351 fidl::encoding::encode_in_envelope_optional::<
15356 fidl_fuchsia_bluetooth::PeerId,
15357 fidl::encoding::DefaultFuchsiaResourceDialect,
15358 >(
15359 self.peer_id.as_ref().map(
15360 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
15361 ),
15362 encoder,
15363 offset + cur_offset,
15364 depth,
15365 )?;
15366
15367 _prev_end_offset = cur_offset + envelope_size;
15368 if 2 > max_ordinal {
15369 return Ok(());
15370 }
15371
15372 let cur_offset: usize = (2 - 1) * envelope_size;
15375
15376 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15378
15379 fidl::encoding::encode_in_envelope_optional::<
15384 u8,
15385 fidl::encoding::DefaultFuchsiaResourceDialect,
15386 >(
15387 self.advertising_sid.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
15388 encoder,
15389 offset + cur_offset,
15390 depth,
15391 )?;
15392
15393 _prev_end_offset = cur_offset + envelope_size;
15394 if 3 > max_ordinal {
15395 return Ok(());
15396 }
15397
15398 let cur_offset: usize = (3 - 1) * envelope_size;
15401
15402 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15404
15405 fidl::encoding::encode_in_envelope_optional::<
15410 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
15411 fidl::encoding::DefaultFuchsiaResourceDialect,
15412 >(
15413 self.sync.as_mut().map(
15414 <fidl::encoding::Endpoint<
15415 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15416 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15417 ),
15418 encoder,
15419 offset + cur_offset,
15420 depth,
15421 )?;
15422
15423 _prev_end_offset = cur_offset + envelope_size;
15424 if 4 > max_ordinal {
15425 return Ok(());
15426 }
15427
15428 let cur_offset: usize = (4 - 1) * envelope_size;
15431
15432 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15434
15435 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
15440 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
15441 encoder, offset + cur_offset, depth
15442 )?;
15443
15444 _prev_end_offset = cur_offset + envelope_size;
15445
15446 Ok(())
15447 }
15448 }
15449
15450 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15451 for CentralSyncToPeriodicAdvertisingRequest
15452 {
15453 #[inline(always)]
15454 fn new_empty() -> Self {
15455 Self::default()
15456 }
15457
15458 unsafe fn decode(
15459 &mut self,
15460 decoder: &mut fidl::encoding::Decoder<
15461 '_,
15462 fidl::encoding::DefaultFuchsiaResourceDialect,
15463 >,
15464 offset: usize,
15465 mut depth: fidl::encoding::Depth,
15466 ) -> fidl::Result<()> {
15467 decoder.debug_check_bounds::<Self>(offset);
15468 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15469 None => return Err(fidl::Error::NotNullable),
15470 Some(len) => len,
15471 };
15472 if len == 0 {
15474 return Ok(());
15475 };
15476 depth.increment()?;
15477 let envelope_size = 8;
15478 let bytes_len = len * envelope_size;
15479 let offset = decoder.out_of_line_offset(bytes_len)?;
15480 let mut _next_ordinal_to_read = 0;
15482 let mut next_offset = offset;
15483 let end_offset = offset + bytes_len;
15484 _next_ordinal_to_read += 1;
15485 if next_offset >= end_offset {
15486 return Ok(());
15487 }
15488
15489 while _next_ordinal_to_read < 1 {
15491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15492 _next_ordinal_to_read += 1;
15493 next_offset += envelope_size;
15494 }
15495
15496 let next_out_of_line = decoder.next_out_of_line();
15497 let handles_before = decoder.remaining_handles();
15498 if let Some((inlined, num_bytes, num_handles)) =
15499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15500 {
15501 let member_inline_size =
15502 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
15503 decoder.context,
15504 );
15505 if inlined != (member_inline_size <= 4) {
15506 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15507 }
15508 let inner_offset;
15509 let mut inner_depth = depth.clone();
15510 if inlined {
15511 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15512 inner_offset = next_offset;
15513 } else {
15514 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15515 inner_depth.increment()?;
15516 }
15517 let val_ref = self.peer_id.get_or_insert_with(|| {
15518 fidl::new_empty!(
15519 fidl_fuchsia_bluetooth::PeerId,
15520 fidl::encoding::DefaultFuchsiaResourceDialect
15521 )
15522 });
15523 fidl::decode!(
15524 fidl_fuchsia_bluetooth::PeerId,
15525 fidl::encoding::DefaultFuchsiaResourceDialect,
15526 val_ref,
15527 decoder,
15528 inner_offset,
15529 inner_depth
15530 )?;
15531 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15532 {
15533 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15534 }
15535 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15536 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15537 }
15538 }
15539
15540 next_offset += envelope_size;
15541 _next_ordinal_to_read += 1;
15542 if next_offset >= end_offset {
15543 return Ok(());
15544 }
15545
15546 while _next_ordinal_to_read < 2 {
15548 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15549 _next_ordinal_to_read += 1;
15550 next_offset += envelope_size;
15551 }
15552
15553 let next_out_of_line = decoder.next_out_of_line();
15554 let handles_before = decoder.remaining_handles();
15555 if let Some((inlined, num_bytes, num_handles)) =
15556 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15557 {
15558 let member_inline_size =
15559 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15560 if inlined != (member_inline_size <= 4) {
15561 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15562 }
15563 let inner_offset;
15564 let mut inner_depth = depth.clone();
15565 if inlined {
15566 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15567 inner_offset = next_offset;
15568 } else {
15569 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15570 inner_depth.increment()?;
15571 }
15572 let val_ref = self.advertising_sid.get_or_insert_with(|| {
15573 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
15574 });
15575 fidl::decode!(
15576 u8,
15577 fidl::encoding::DefaultFuchsiaResourceDialect,
15578 val_ref,
15579 decoder,
15580 inner_offset,
15581 inner_depth
15582 )?;
15583 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15584 {
15585 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15586 }
15587 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15588 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15589 }
15590 }
15591
15592 next_offset += envelope_size;
15593 _next_ordinal_to_read += 1;
15594 if next_offset >= end_offset {
15595 return Ok(());
15596 }
15597
15598 while _next_ordinal_to_read < 3 {
15600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15601 _next_ordinal_to_read += 1;
15602 next_offset += envelope_size;
15603 }
15604
15605 let next_out_of_line = decoder.next_out_of_line();
15606 let handles_before = decoder.remaining_handles();
15607 if let Some((inlined, num_bytes, num_handles)) =
15608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15609 {
15610 let member_inline_size = <fidl::encoding::Endpoint<
15611 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15612 > as fidl::encoding::TypeMarker>::inline_size(
15613 decoder.context
15614 );
15615 if inlined != (member_inline_size <= 4) {
15616 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15617 }
15618 let inner_offset;
15619 let mut inner_depth = depth.clone();
15620 if inlined {
15621 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15622 inner_offset = next_offset;
15623 } else {
15624 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15625 inner_depth.increment()?;
15626 }
15627 let val_ref = self.sync.get_or_insert_with(|| {
15628 fidl::new_empty!(
15629 fidl::encoding::Endpoint<
15630 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15631 >,
15632 fidl::encoding::DefaultFuchsiaResourceDialect
15633 )
15634 });
15635 fidl::decode!(
15636 fidl::encoding::Endpoint<
15637 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
15638 >,
15639 fidl::encoding::DefaultFuchsiaResourceDialect,
15640 val_ref,
15641 decoder,
15642 inner_offset,
15643 inner_depth
15644 )?;
15645 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15646 {
15647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15648 }
15649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15651 }
15652 }
15653
15654 next_offset += envelope_size;
15655 _next_ordinal_to_read += 1;
15656 if next_offset >= end_offset {
15657 return Ok(());
15658 }
15659
15660 while _next_ordinal_to_read < 4 {
15662 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15663 _next_ordinal_to_read += 1;
15664 next_offset += envelope_size;
15665 }
15666
15667 let next_out_of_line = decoder.next_out_of_line();
15668 let handles_before = decoder.remaining_handles();
15669 if let Some((inlined, num_bytes, num_handles)) =
15670 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15671 {
15672 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15673 if inlined != (member_inline_size <= 4) {
15674 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15675 }
15676 let inner_offset;
15677 let mut inner_depth = depth.clone();
15678 if inlined {
15679 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15680 inner_offset = next_offset;
15681 } else {
15682 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15683 inner_depth.increment()?;
15684 }
15685 let val_ref = self.config.get_or_insert_with(|| {
15686 fidl::new_empty!(
15687 PeriodicAdvertisingSyncConfiguration,
15688 fidl::encoding::DefaultFuchsiaResourceDialect
15689 )
15690 });
15691 fidl::decode!(
15692 PeriodicAdvertisingSyncConfiguration,
15693 fidl::encoding::DefaultFuchsiaResourceDialect,
15694 val_ref,
15695 decoder,
15696 inner_offset,
15697 inner_depth
15698 )?;
15699 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15700 {
15701 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15702 }
15703 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15704 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15705 }
15706 }
15707
15708 next_offset += envelope_size;
15709
15710 while next_offset < end_offset {
15712 _next_ordinal_to_read += 1;
15713 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15714 next_offset += envelope_size;
15715 }
15716
15717 Ok(())
15718 }
15719 }
15720
15721 impl ChannelListenerConnectedRequest {
15722 #[inline(always)]
15723 fn max_ordinal_present(&self) -> u64 {
15724 if let Some(_) = self.ext_offload {
15725 return 2;
15726 }
15727 if let Some(_) = self.channel {
15728 return 1;
15729 }
15730 0
15731 }
15732 }
15733
15734 impl fidl::encoding::ResourceTypeMarker for ChannelListenerConnectedRequest {
15735 type Borrowed<'a> = &'a mut Self;
15736 fn take_or_borrow<'a>(
15737 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15738 ) -> Self::Borrowed<'a> {
15739 value
15740 }
15741 }
15742
15743 unsafe impl fidl::encoding::TypeMarker for ChannelListenerConnectedRequest {
15744 type Owned = Self;
15745
15746 #[inline(always)]
15747 fn inline_align(_context: fidl::encoding::Context) -> usize {
15748 8
15749 }
15750
15751 #[inline(always)]
15752 fn inline_size(_context: fidl::encoding::Context) -> usize {
15753 16
15754 }
15755 }
15756
15757 unsafe impl
15758 fidl::encoding::Encode<
15759 ChannelListenerConnectedRequest,
15760 fidl::encoding::DefaultFuchsiaResourceDialect,
15761 > for &mut ChannelListenerConnectedRequest
15762 {
15763 unsafe fn encode(
15764 self,
15765 encoder: &mut fidl::encoding::Encoder<
15766 '_,
15767 fidl::encoding::DefaultFuchsiaResourceDialect,
15768 >,
15769 offset: usize,
15770 mut depth: fidl::encoding::Depth,
15771 ) -> fidl::Result<()> {
15772 encoder.debug_check_bounds::<ChannelListenerConnectedRequest>(offset);
15773 let max_ordinal: u64 = self.max_ordinal_present();
15775 encoder.write_num(max_ordinal, offset);
15776 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15777 if max_ordinal == 0 {
15779 return Ok(());
15780 }
15781 depth.increment()?;
15782 let envelope_size = 8;
15783 let bytes_len = max_ordinal as usize * envelope_size;
15784 #[allow(unused_variables)]
15785 let offset = encoder.out_of_line_offset(bytes_len);
15786 let mut _prev_end_offset: usize = 0;
15787 if 1 > max_ordinal {
15788 return Ok(());
15789 }
15790
15791 let cur_offset: usize = (1 - 1) * envelope_size;
15794
15795 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15797
15798 fidl::encoding::encode_in_envelope_optional::<
15803 fidl::encoding::Endpoint<
15804 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15805 >,
15806 fidl::encoding::DefaultFuchsiaResourceDialect,
15807 >(
15808 self.channel.as_mut().map(
15809 <fidl::encoding::Endpoint<
15810 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15811 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15812 ),
15813 encoder,
15814 offset + cur_offset,
15815 depth,
15816 )?;
15817
15818 _prev_end_offset = cur_offset + envelope_size;
15819 if 2 > max_ordinal {
15820 return Ok(());
15821 }
15822
15823 let cur_offset: usize = (2 - 1) * envelope_size;
15826
15827 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15829
15830 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15835 self.ext_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15836 encoder, offset + cur_offset, depth
15837 )?;
15838
15839 _prev_end_offset = cur_offset + envelope_size;
15840
15841 Ok(())
15842 }
15843 }
15844
15845 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15846 for ChannelListenerConnectedRequest
15847 {
15848 #[inline(always)]
15849 fn new_empty() -> Self {
15850 Self::default()
15851 }
15852
15853 unsafe fn decode(
15854 &mut self,
15855 decoder: &mut fidl::encoding::Decoder<
15856 '_,
15857 fidl::encoding::DefaultFuchsiaResourceDialect,
15858 >,
15859 offset: usize,
15860 mut depth: fidl::encoding::Depth,
15861 ) -> fidl::Result<()> {
15862 decoder.debug_check_bounds::<Self>(offset);
15863 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15864 None => return Err(fidl::Error::NotNullable),
15865 Some(len) => len,
15866 };
15867 if len == 0 {
15869 return Ok(());
15870 };
15871 depth.increment()?;
15872 let envelope_size = 8;
15873 let bytes_len = len * envelope_size;
15874 let offset = decoder.out_of_line_offset(bytes_len)?;
15875 let mut _next_ordinal_to_read = 0;
15877 let mut next_offset = offset;
15878 let end_offset = offset + bytes_len;
15879 _next_ordinal_to_read += 1;
15880 if next_offset >= end_offset {
15881 return Ok(());
15882 }
15883
15884 while _next_ordinal_to_read < 1 {
15886 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15887 _next_ordinal_to_read += 1;
15888 next_offset += envelope_size;
15889 }
15890
15891 let next_out_of_line = decoder.next_out_of_line();
15892 let handles_before = decoder.remaining_handles();
15893 if let Some((inlined, num_bytes, num_handles)) =
15894 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15895 {
15896 let member_inline_size = <fidl::encoding::Endpoint<
15897 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15898 > as fidl::encoding::TypeMarker>::inline_size(
15899 decoder.context
15900 );
15901 if inlined != (member_inline_size <= 4) {
15902 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15903 }
15904 let inner_offset;
15905 let mut inner_depth = depth.clone();
15906 if inlined {
15907 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15908 inner_offset = next_offset;
15909 } else {
15910 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15911 inner_depth.increment()?;
15912 }
15913 let val_ref = self.channel.get_or_insert_with(|| {
15914 fidl::new_empty!(
15915 fidl::encoding::Endpoint<
15916 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15917 >,
15918 fidl::encoding::DefaultFuchsiaResourceDialect
15919 )
15920 });
15921 fidl::decode!(
15922 fidl::encoding::Endpoint<
15923 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
15924 >,
15925 fidl::encoding::DefaultFuchsiaResourceDialect,
15926 val_ref,
15927 decoder,
15928 inner_offset,
15929 inner_depth
15930 )?;
15931 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15932 {
15933 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15934 }
15935 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15936 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15937 }
15938 }
15939
15940 next_offset += envelope_size;
15941 _next_ordinal_to_read += 1;
15942 if next_offset >= end_offset {
15943 return Ok(());
15944 }
15945
15946 while _next_ordinal_to_read < 2 {
15948 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15949 _next_ordinal_to_read += 1;
15950 next_offset += envelope_size;
15951 }
15952
15953 let next_out_of_line = decoder.next_out_of_line();
15954 let handles_before = decoder.remaining_handles();
15955 if let Some((inlined, num_bytes, num_handles)) =
15956 fidl::encoding::decode_envelope_header(decoder, next_offset)?
15957 {
15958 let member_inline_size = <fidl::encoding::Endpoint<
15959 fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>,
15960 > as fidl::encoding::TypeMarker>::inline_size(
15961 decoder.context
15962 );
15963 if inlined != (member_inline_size <= 4) {
15964 return Err(fidl::Error::InvalidInlineBitInEnvelope);
15965 }
15966 let inner_offset;
15967 let mut inner_depth = depth.clone();
15968 if inlined {
15969 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15970 inner_offset = next_offset;
15971 } else {
15972 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15973 inner_depth.increment()?;
15974 }
15975 let val_ref = self.ext_offload.get_or_insert_with(|| {
15976 fidl::new_empty!(
15977 fidl::encoding::Endpoint<
15978 fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>,
15979 >,
15980 fidl::encoding::DefaultFuchsiaResourceDialect
15981 )
15982 });
15983 fidl::decode!(
15984 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelOffloadExtMarker>>,
15985 fidl::encoding::DefaultFuchsiaResourceDialect,
15986 val_ref,
15987 decoder,
15988 inner_offset,
15989 inner_depth
15990 )?;
15991 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15992 {
15993 return Err(fidl::Error::InvalidNumBytesInEnvelope);
15994 }
15995 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15996 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15997 }
15998 }
15999
16000 next_offset += envelope_size;
16001
16002 while next_offset < end_offset {
16004 _next_ordinal_to_read += 1;
16005 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16006 next_offset += envelope_size;
16007 }
16008
16009 Ok(())
16010 }
16011 }
16012
16013 impl ChannelListenerRegistryListenL2capRequest {
16014 #[inline(always)]
16015 fn max_ordinal_present(&self) -> u64 {
16016 if let Some(_) = self.listener {
16017 return 2;
16018 }
16019 if let Some(_) = self.parameters {
16020 return 1;
16021 }
16022 0
16023 }
16024 }
16025
16026 impl fidl::encoding::ResourceTypeMarker for ChannelListenerRegistryListenL2capRequest {
16027 type Borrowed<'a> = &'a mut Self;
16028 fn take_or_borrow<'a>(
16029 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16030 ) -> Self::Borrowed<'a> {
16031 value
16032 }
16033 }
16034
16035 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capRequest {
16036 type Owned = Self;
16037
16038 #[inline(always)]
16039 fn inline_align(_context: fidl::encoding::Context) -> usize {
16040 8
16041 }
16042
16043 #[inline(always)]
16044 fn inline_size(_context: fidl::encoding::Context) -> usize {
16045 16
16046 }
16047 }
16048
16049 unsafe impl
16050 fidl::encoding::Encode<
16051 ChannelListenerRegistryListenL2capRequest,
16052 fidl::encoding::DefaultFuchsiaResourceDialect,
16053 > for &mut ChannelListenerRegistryListenL2capRequest
16054 {
16055 unsafe fn encode(
16056 self,
16057 encoder: &mut fidl::encoding::Encoder<
16058 '_,
16059 fidl::encoding::DefaultFuchsiaResourceDialect,
16060 >,
16061 offset: usize,
16062 mut depth: fidl::encoding::Depth,
16063 ) -> fidl::Result<()> {
16064 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capRequest>(offset);
16065 let max_ordinal: u64 = self.max_ordinal_present();
16067 encoder.write_num(max_ordinal, offset);
16068 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16069 if max_ordinal == 0 {
16071 return Ok(());
16072 }
16073 depth.increment()?;
16074 let envelope_size = 8;
16075 let bytes_len = max_ordinal as usize * envelope_size;
16076 #[allow(unused_variables)]
16077 let offset = encoder.out_of_line_offset(bytes_len);
16078 let mut _prev_end_offset: usize = 0;
16079 if 1 > max_ordinal {
16080 return Ok(());
16081 }
16082
16083 let cur_offset: usize = (1 - 1) * envelope_size;
16086
16087 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16089
16090 fidl::encoding::encode_in_envelope_optional::<
16095 AcceptedChannelParameters,
16096 fidl::encoding::DefaultFuchsiaResourceDialect,
16097 >(
16098 self.parameters
16099 .as_ref()
16100 .map(<AcceptedChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
16101 encoder,
16102 offset + cur_offset,
16103 depth,
16104 )?;
16105
16106 _prev_end_offset = cur_offset + envelope_size;
16107 if 2 > max_ordinal {
16108 return Ok(());
16109 }
16110
16111 let cur_offset: usize = (2 - 1) * envelope_size;
16114
16115 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16117
16118 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16123 self.listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16124 encoder, offset + cur_offset, depth
16125 )?;
16126
16127 _prev_end_offset = cur_offset + envelope_size;
16128
16129 Ok(())
16130 }
16131 }
16132
16133 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16134 for ChannelListenerRegistryListenL2capRequest
16135 {
16136 #[inline(always)]
16137 fn new_empty() -> Self {
16138 Self::default()
16139 }
16140
16141 unsafe fn decode(
16142 &mut self,
16143 decoder: &mut fidl::encoding::Decoder<
16144 '_,
16145 fidl::encoding::DefaultFuchsiaResourceDialect,
16146 >,
16147 offset: usize,
16148 mut depth: fidl::encoding::Depth,
16149 ) -> fidl::Result<()> {
16150 decoder.debug_check_bounds::<Self>(offset);
16151 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16152 None => return Err(fidl::Error::NotNullable),
16153 Some(len) => len,
16154 };
16155 if len == 0 {
16157 return Ok(());
16158 };
16159 depth.increment()?;
16160 let envelope_size = 8;
16161 let bytes_len = len * envelope_size;
16162 let offset = decoder.out_of_line_offset(bytes_len)?;
16163 let mut _next_ordinal_to_read = 0;
16165 let mut next_offset = offset;
16166 let end_offset = offset + bytes_len;
16167 _next_ordinal_to_read += 1;
16168 if next_offset >= end_offset {
16169 return Ok(());
16170 }
16171
16172 while _next_ordinal_to_read < 1 {
16174 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16175 _next_ordinal_to_read += 1;
16176 next_offset += envelope_size;
16177 }
16178
16179 let next_out_of_line = decoder.next_out_of_line();
16180 let handles_before = decoder.remaining_handles();
16181 if let Some((inlined, num_bytes, num_handles)) =
16182 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16183 {
16184 let member_inline_size =
16185 <AcceptedChannelParameters as fidl::encoding::TypeMarker>::inline_size(
16186 decoder.context,
16187 );
16188 if inlined != (member_inline_size <= 4) {
16189 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16190 }
16191 let inner_offset;
16192 let mut inner_depth = depth.clone();
16193 if inlined {
16194 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16195 inner_offset = next_offset;
16196 } else {
16197 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16198 inner_depth.increment()?;
16199 }
16200 let val_ref = self.parameters.get_or_insert_with(|| {
16201 fidl::new_empty!(
16202 AcceptedChannelParameters,
16203 fidl::encoding::DefaultFuchsiaResourceDialect
16204 )
16205 });
16206 fidl::decode!(
16207 AcceptedChannelParameters,
16208 fidl::encoding::DefaultFuchsiaResourceDialect,
16209 val_ref,
16210 decoder,
16211 inner_offset,
16212 inner_depth
16213 )?;
16214 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16215 {
16216 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16217 }
16218 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16219 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16220 }
16221 }
16222
16223 next_offset += envelope_size;
16224 _next_ordinal_to_read += 1;
16225 if next_offset >= end_offset {
16226 return Ok(());
16227 }
16228
16229 while _next_ordinal_to_read < 2 {
16231 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16232 _next_ordinal_to_read += 1;
16233 next_offset += envelope_size;
16234 }
16235
16236 let next_out_of_line = decoder.next_out_of_line();
16237 let handles_before = decoder.remaining_handles();
16238 if let Some((inlined, num_bytes, num_handles)) =
16239 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16240 {
16241 let member_inline_size = <fidl::encoding::Endpoint<
16242 fidl::endpoints::ClientEnd<ChannelListenerMarker>,
16243 > as fidl::encoding::TypeMarker>::inline_size(
16244 decoder.context
16245 );
16246 if inlined != (member_inline_size <= 4) {
16247 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16248 }
16249 let inner_offset;
16250 let mut inner_depth = depth.clone();
16251 if inlined {
16252 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16253 inner_offset = next_offset;
16254 } else {
16255 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16256 inner_depth.increment()?;
16257 }
16258 let val_ref = self.listener.get_or_insert_with(|| {
16259 fidl::new_empty!(
16260 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
16261 fidl::encoding::DefaultFuchsiaResourceDialect
16262 )
16263 });
16264 fidl::decode!(
16265 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
16266 fidl::encoding::DefaultFuchsiaResourceDialect,
16267 val_ref,
16268 decoder,
16269 inner_offset,
16270 inner_depth
16271 )?;
16272 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16273 {
16274 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16275 }
16276 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16277 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16278 }
16279 }
16280
16281 next_offset += envelope_size;
16282
16283 while next_offset < end_offset {
16285 _next_ordinal_to_read += 1;
16286 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16287 next_offset += envelope_size;
16288 }
16289
16290 Ok(())
16291 }
16292 }
16293
16294 impl CisRequestedParameters {
16295 #[inline(always)]
16296 fn max_ordinal_present(&self) -> u64 {
16297 if let Some(_) = self.max_sdu_size_incoming {
16298 return 4;
16299 }
16300 if let Some(_) = self.max_sdu_size_outgoing {
16301 return 3;
16302 }
16303 if let Some(_) = self.connection_stream {
16304 return 2;
16305 }
16306 if let Some(_) = self.cis_id {
16307 return 1;
16308 }
16309 0
16310 }
16311 }
16312
16313 impl fidl::encoding::ResourceTypeMarker for CisRequestedParameters {
16314 type Borrowed<'a> = &'a mut Self;
16315 fn take_or_borrow<'a>(
16316 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16317 ) -> Self::Borrowed<'a> {
16318 value
16319 }
16320 }
16321
16322 unsafe impl fidl::encoding::TypeMarker for CisRequestedParameters {
16323 type Owned = Self;
16324
16325 #[inline(always)]
16326 fn inline_align(_context: fidl::encoding::Context) -> usize {
16327 8
16328 }
16329
16330 #[inline(always)]
16331 fn inline_size(_context: fidl::encoding::Context) -> usize {
16332 16
16333 }
16334 }
16335
16336 unsafe impl
16337 fidl::encoding::Encode<
16338 CisRequestedParameters,
16339 fidl::encoding::DefaultFuchsiaResourceDialect,
16340 > for &mut CisRequestedParameters
16341 {
16342 unsafe fn encode(
16343 self,
16344 encoder: &mut fidl::encoding::Encoder<
16345 '_,
16346 fidl::encoding::DefaultFuchsiaResourceDialect,
16347 >,
16348 offset: usize,
16349 mut depth: fidl::encoding::Depth,
16350 ) -> fidl::Result<()> {
16351 encoder.debug_check_bounds::<CisRequestedParameters>(offset);
16352 let max_ordinal: u64 = self.max_ordinal_present();
16354 encoder.write_num(max_ordinal, offset);
16355 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16356 if max_ordinal == 0 {
16358 return Ok(());
16359 }
16360 depth.increment()?;
16361 let envelope_size = 8;
16362 let bytes_len = max_ordinal as usize * envelope_size;
16363 #[allow(unused_variables)]
16364 let offset = encoder.out_of_line_offset(bytes_len);
16365 let mut _prev_end_offset: usize = 0;
16366 if 1 > max_ordinal {
16367 return Ok(());
16368 }
16369
16370 let cur_offset: usize = (1 - 1) * envelope_size;
16373
16374 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16376
16377 fidl::encoding::encode_in_envelope_optional::<
16382 u8,
16383 fidl::encoding::DefaultFuchsiaResourceDialect,
16384 >(
16385 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16386 encoder,
16387 offset + cur_offset,
16388 depth,
16389 )?;
16390
16391 _prev_end_offset = cur_offset + envelope_size;
16392 if 2 > max_ordinal {
16393 return Ok(());
16394 }
16395
16396 let cur_offset: usize = (2 - 1) * envelope_size;
16399
16400 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16402
16403 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16408 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16409 encoder, offset + cur_offset, depth
16410 )?;
16411
16412 _prev_end_offset = cur_offset + envelope_size;
16413 if 3 > max_ordinal {
16414 return Ok(());
16415 }
16416
16417 let cur_offset: usize = (3 - 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 u16,
16430 fidl::encoding::DefaultFuchsiaResourceDialect,
16431 >(
16432 self.max_sdu_size_outgoing
16433 .as_ref()
16434 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
16435 encoder,
16436 offset + cur_offset,
16437 depth,
16438 )?;
16439
16440 _prev_end_offset = cur_offset + envelope_size;
16441 if 4 > max_ordinal {
16442 return Ok(());
16443 }
16444
16445 let cur_offset: usize = (4 - 1) * envelope_size;
16448
16449 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16451
16452 fidl::encoding::encode_in_envelope_optional::<
16457 u16,
16458 fidl::encoding::DefaultFuchsiaResourceDialect,
16459 >(
16460 self.max_sdu_size_incoming
16461 .as_ref()
16462 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
16463 encoder,
16464 offset + cur_offset,
16465 depth,
16466 )?;
16467
16468 _prev_end_offset = cur_offset + envelope_size;
16469
16470 Ok(())
16471 }
16472 }
16473
16474 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16475 for CisRequestedParameters
16476 {
16477 #[inline(always)]
16478 fn new_empty() -> Self {
16479 Self::default()
16480 }
16481
16482 unsafe fn decode(
16483 &mut self,
16484 decoder: &mut fidl::encoding::Decoder<
16485 '_,
16486 fidl::encoding::DefaultFuchsiaResourceDialect,
16487 >,
16488 offset: usize,
16489 mut depth: fidl::encoding::Depth,
16490 ) -> fidl::Result<()> {
16491 decoder.debug_check_bounds::<Self>(offset);
16492 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16493 None => return Err(fidl::Error::NotNullable),
16494 Some(len) => len,
16495 };
16496 if len == 0 {
16498 return Ok(());
16499 };
16500 depth.increment()?;
16501 let envelope_size = 8;
16502 let bytes_len = len * envelope_size;
16503 let offset = decoder.out_of_line_offset(bytes_len)?;
16504 let mut _next_ordinal_to_read = 0;
16506 let mut next_offset = offset;
16507 let end_offset = offset + bytes_len;
16508 _next_ordinal_to_read += 1;
16509 if next_offset >= end_offset {
16510 return Ok(());
16511 }
16512
16513 while _next_ordinal_to_read < 1 {
16515 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16516 _next_ordinal_to_read += 1;
16517 next_offset += envelope_size;
16518 }
16519
16520 let next_out_of_line = decoder.next_out_of_line();
16521 let handles_before = decoder.remaining_handles();
16522 if let Some((inlined, num_bytes, num_handles)) =
16523 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16524 {
16525 let member_inline_size =
16526 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16527 if inlined != (member_inline_size <= 4) {
16528 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16529 }
16530 let inner_offset;
16531 let mut inner_depth = depth.clone();
16532 if inlined {
16533 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16534 inner_offset = next_offset;
16535 } else {
16536 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16537 inner_depth.increment()?;
16538 }
16539 let val_ref = self.cis_id.get_or_insert_with(|| {
16540 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
16541 });
16542 fidl::decode!(
16543 u8,
16544 fidl::encoding::DefaultFuchsiaResourceDialect,
16545 val_ref,
16546 decoder,
16547 inner_offset,
16548 inner_depth
16549 )?;
16550 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16551 {
16552 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16553 }
16554 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16555 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16556 }
16557 }
16558
16559 next_offset += envelope_size;
16560 _next_ordinal_to_read += 1;
16561 if next_offset >= end_offset {
16562 return Ok(());
16563 }
16564
16565 while _next_ordinal_to_read < 2 {
16567 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16568 _next_ordinal_to_read += 1;
16569 next_offset += envelope_size;
16570 }
16571
16572 let next_out_of_line = decoder.next_out_of_line();
16573 let handles_before = decoder.remaining_handles();
16574 if let Some((inlined, num_bytes, num_handles)) =
16575 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16576 {
16577 let member_inline_size = <fidl::encoding::Endpoint<
16578 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
16579 > as fidl::encoding::TypeMarker>::inline_size(
16580 decoder.context
16581 );
16582 if inlined != (member_inline_size <= 4) {
16583 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16584 }
16585 let inner_offset;
16586 let mut inner_depth = depth.clone();
16587 if inlined {
16588 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16589 inner_offset = next_offset;
16590 } else {
16591 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16592 inner_depth.increment()?;
16593 }
16594 let val_ref = self.connection_stream.get_or_insert_with(|| {
16595 fidl::new_empty!(
16596 fidl::encoding::Endpoint<
16597 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
16598 >,
16599 fidl::encoding::DefaultFuchsiaResourceDialect
16600 )
16601 });
16602 fidl::decode!(
16603 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
16604 fidl::encoding::DefaultFuchsiaResourceDialect,
16605 val_ref,
16606 decoder,
16607 inner_offset,
16608 inner_depth
16609 )?;
16610 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16611 {
16612 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16613 }
16614 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16615 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16616 }
16617 }
16618
16619 next_offset += envelope_size;
16620 _next_ordinal_to_read += 1;
16621 if next_offset >= end_offset {
16622 return Ok(());
16623 }
16624
16625 while _next_ordinal_to_read < 3 {
16627 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16628 _next_ordinal_to_read += 1;
16629 next_offset += envelope_size;
16630 }
16631
16632 let next_out_of_line = decoder.next_out_of_line();
16633 let handles_before = decoder.remaining_handles();
16634 if let Some((inlined, num_bytes, num_handles)) =
16635 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16636 {
16637 let member_inline_size =
16638 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16639 if inlined != (member_inline_size <= 4) {
16640 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16641 }
16642 let inner_offset;
16643 let mut inner_depth = depth.clone();
16644 if inlined {
16645 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16646 inner_offset = next_offset;
16647 } else {
16648 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16649 inner_depth.increment()?;
16650 }
16651 let val_ref = self.max_sdu_size_outgoing.get_or_insert_with(|| {
16652 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
16653 });
16654 fidl::decode!(
16655 u16,
16656 fidl::encoding::DefaultFuchsiaResourceDialect,
16657 val_ref,
16658 decoder,
16659 inner_offset,
16660 inner_depth
16661 )?;
16662 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16663 {
16664 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16665 }
16666 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16667 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16668 }
16669 }
16670
16671 next_offset += envelope_size;
16672 _next_ordinal_to_read += 1;
16673 if next_offset >= end_offset {
16674 return Ok(());
16675 }
16676
16677 while _next_ordinal_to_read < 4 {
16679 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16680 _next_ordinal_to_read += 1;
16681 next_offset += envelope_size;
16682 }
16683
16684 let next_out_of_line = decoder.next_out_of_line();
16685 let handles_before = decoder.remaining_handles();
16686 if let Some((inlined, num_bytes, num_handles)) =
16687 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16688 {
16689 let member_inline_size =
16690 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16691 if inlined != (member_inline_size <= 4) {
16692 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16693 }
16694 let inner_offset;
16695 let mut inner_depth = depth.clone();
16696 if inlined {
16697 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16698 inner_offset = next_offset;
16699 } else {
16700 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16701 inner_depth.increment()?;
16702 }
16703 let val_ref = self.max_sdu_size_incoming.get_or_insert_with(|| {
16704 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
16705 });
16706 fidl::decode!(
16707 u16,
16708 fidl::encoding::DefaultFuchsiaResourceDialect,
16709 val_ref,
16710 decoder,
16711 inner_offset,
16712 inner_depth
16713 )?;
16714 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16715 {
16716 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16717 }
16718 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16719 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16720 }
16721 }
16722
16723 next_offset += envelope_size;
16724
16725 while next_offset < end_offset {
16727 _next_ordinal_to_read += 1;
16728 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16729 next_offset += envelope_size;
16730 }
16731
16732 Ok(())
16733 }
16734 }
16735
16736 impl ConnectionAcceptCisRequest {
16737 #[inline(always)]
16738 fn max_ordinal_present(&self) -> u64 {
16739 if let Some(_) = self.connection_stream {
16740 return 3;
16741 }
16742 if let Some(_) = self.cis_id {
16743 return 2;
16744 }
16745 if let Some(_) = self.cig_id {
16746 return 1;
16747 }
16748 0
16749 }
16750 }
16751
16752 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptCisRequest {
16753 type Borrowed<'a> = &'a mut Self;
16754 fn take_or_borrow<'a>(
16755 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16756 ) -> Self::Borrowed<'a> {
16757 value
16758 }
16759 }
16760
16761 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptCisRequest {
16762 type Owned = Self;
16763
16764 #[inline(always)]
16765 fn inline_align(_context: fidl::encoding::Context) -> usize {
16766 8
16767 }
16768
16769 #[inline(always)]
16770 fn inline_size(_context: fidl::encoding::Context) -> usize {
16771 16
16772 }
16773 }
16774
16775 unsafe impl
16776 fidl::encoding::Encode<
16777 ConnectionAcceptCisRequest,
16778 fidl::encoding::DefaultFuchsiaResourceDialect,
16779 > for &mut ConnectionAcceptCisRequest
16780 {
16781 unsafe fn encode(
16782 self,
16783 encoder: &mut fidl::encoding::Encoder<
16784 '_,
16785 fidl::encoding::DefaultFuchsiaResourceDialect,
16786 >,
16787 offset: usize,
16788 mut depth: fidl::encoding::Depth,
16789 ) -> fidl::Result<()> {
16790 encoder.debug_check_bounds::<ConnectionAcceptCisRequest>(offset);
16791 let max_ordinal: u64 = self.max_ordinal_present();
16793 encoder.write_num(max_ordinal, offset);
16794 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16795 if max_ordinal == 0 {
16797 return Ok(());
16798 }
16799 depth.increment()?;
16800 let envelope_size = 8;
16801 let bytes_len = max_ordinal as usize * envelope_size;
16802 #[allow(unused_variables)]
16803 let offset = encoder.out_of_line_offset(bytes_len);
16804 let mut _prev_end_offset: usize = 0;
16805 if 1 > max_ordinal {
16806 return Ok(());
16807 }
16808
16809 let cur_offset: usize = (1 - 1) * envelope_size;
16812
16813 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16815
16816 fidl::encoding::encode_in_envelope_optional::<
16821 u8,
16822 fidl::encoding::DefaultFuchsiaResourceDialect,
16823 >(
16824 self.cig_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16825 encoder,
16826 offset + cur_offset,
16827 depth,
16828 )?;
16829
16830 _prev_end_offset = cur_offset + envelope_size;
16831 if 2 > max_ordinal {
16832 return Ok(());
16833 }
16834
16835 let cur_offset: usize = (2 - 1) * envelope_size;
16838
16839 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16841
16842 fidl::encoding::encode_in_envelope_optional::<
16847 u8,
16848 fidl::encoding::DefaultFuchsiaResourceDialect,
16849 >(
16850 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
16851 encoder,
16852 offset + cur_offset,
16853 depth,
16854 )?;
16855
16856 _prev_end_offset = cur_offset + envelope_size;
16857 if 3 > max_ordinal {
16858 return Ok(());
16859 }
16860
16861 let cur_offset: usize = (3 - 1) * envelope_size;
16864
16865 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16867
16868 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
16873 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16874 encoder, offset + cur_offset, depth
16875 )?;
16876
16877 _prev_end_offset = cur_offset + envelope_size;
16878
16879 Ok(())
16880 }
16881 }
16882
16883 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16884 for ConnectionAcceptCisRequest
16885 {
16886 #[inline(always)]
16887 fn new_empty() -> Self {
16888 Self::default()
16889 }
16890
16891 unsafe fn decode(
16892 &mut self,
16893 decoder: &mut fidl::encoding::Decoder<
16894 '_,
16895 fidl::encoding::DefaultFuchsiaResourceDialect,
16896 >,
16897 offset: usize,
16898 mut depth: fidl::encoding::Depth,
16899 ) -> fidl::Result<()> {
16900 decoder.debug_check_bounds::<Self>(offset);
16901 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16902 None => return Err(fidl::Error::NotNullable),
16903 Some(len) => len,
16904 };
16905 if len == 0 {
16907 return Ok(());
16908 };
16909 depth.increment()?;
16910 let envelope_size = 8;
16911 let bytes_len = len * envelope_size;
16912 let offset = decoder.out_of_line_offset(bytes_len)?;
16913 let mut _next_ordinal_to_read = 0;
16915 let mut next_offset = offset;
16916 let end_offset = offset + bytes_len;
16917 _next_ordinal_to_read += 1;
16918 if next_offset >= end_offset {
16919 return Ok(());
16920 }
16921
16922 while _next_ordinal_to_read < 1 {
16924 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16925 _next_ordinal_to_read += 1;
16926 next_offset += envelope_size;
16927 }
16928
16929 let next_out_of_line = decoder.next_out_of_line();
16930 let handles_before = decoder.remaining_handles();
16931 if let Some((inlined, num_bytes, num_handles)) =
16932 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16933 {
16934 let member_inline_size =
16935 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16936 if inlined != (member_inline_size <= 4) {
16937 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16938 }
16939 let inner_offset;
16940 let mut inner_depth = depth.clone();
16941 if inlined {
16942 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16943 inner_offset = next_offset;
16944 } else {
16945 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16946 inner_depth.increment()?;
16947 }
16948 let val_ref = self.cig_id.get_or_insert_with(|| {
16949 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
16950 });
16951 fidl::decode!(
16952 u8,
16953 fidl::encoding::DefaultFuchsiaResourceDialect,
16954 val_ref,
16955 decoder,
16956 inner_offset,
16957 inner_depth
16958 )?;
16959 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16960 {
16961 return Err(fidl::Error::InvalidNumBytesInEnvelope);
16962 }
16963 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16964 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16965 }
16966 }
16967
16968 next_offset += envelope_size;
16969 _next_ordinal_to_read += 1;
16970 if next_offset >= end_offset {
16971 return Ok(());
16972 }
16973
16974 while _next_ordinal_to_read < 2 {
16976 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16977 _next_ordinal_to_read += 1;
16978 next_offset += envelope_size;
16979 }
16980
16981 let next_out_of_line = decoder.next_out_of_line();
16982 let handles_before = decoder.remaining_handles();
16983 if let Some((inlined, num_bytes, num_handles)) =
16984 fidl::encoding::decode_envelope_header(decoder, next_offset)?
16985 {
16986 let member_inline_size =
16987 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16988 if inlined != (member_inline_size <= 4) {
16989 return Err(fidl::Error::InvalidInlineBitInEnvelope);
16990 }
16991 let inner_offset;
16992 let mut inner_depth = depth.clone();
16993 if inlined {
16994 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16995 inner_offset = next_offset;
16996 } else {
16997 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16998 inner_depth.increment()?;
16999 }
17000 let val_ref = self.cis_id.get_or_insert_with(|| {
17001 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
17002 });
17003 fidl::decode!(
17004 u8,
17005 fidl::encoding::DefaultFuchsiaResourceDialect,
17006 val_ref,
17007 decoder,
17008 inner_offset,
17009 inner_depth
17010 )?;
17011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17012 {
17013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17014 }
17015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17017 }
17018 }
17019
17020 next_offset += envelope_size;
17021 _next_ordinal_to_read += 1;
17022 if next_offset >= end_offset {
17023 return Ok(());
17024 }
17025
17026 while _next_ordinal_to_read < 3 {
17028 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17029 _next_ordinal_to_read += 1;
17030 next_offset += envelope_size;
17031 }
17032
17033 let next_out_of_line = decoder.next_out_of_line();
17034 let handles_before = decoder.remaining_handles();
17035 if let Some((inlined, num_bytes, num_handles)) =
17036 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17037 {
17038 let member_inline_size = <fidl::encoding::Endpoint<
17039 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
17040 > as fidl::encoding::TypeMarker>::inline_size(
17041 decoder.context
17042 );
17043 if inlined != (member_inline_size <= 4) {
17044 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17045 }
17046 let inner_offset;
17047 let mut inner_depth = depth.clone();
17048 if inlined {
17049 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17050 inner_offset = next_offset;
17051 } else {
17052 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17053 inner_depth.increment()?;
17054 }
17055 let val_ref = self.connection_stream.get_or_insert_with(|| {
17056 fidl::new_empty!(
17057 fidl::encoding::Endpoint<
17058 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
17059 >,
17060 fidl::encoding::DefaultFuchsiaResourceDialect
17061 )
17062 });
17063 fidl::decode!(
17064 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
17065 fidl::encoding::DefaultFuchsiaResourceDialect,
17066 val_ref,
17067 decoder,
17068 inner_offset,
17069 inner_depth
17070 )?;
17071 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17072 {
17073 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17074 }
17075 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17076 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17077 }
17078 }
17079
17080 next_offset += envelope_size;
17081
17082 while next_offset < end_offset {
17084 _next_ordinal_to_read += 1;
17085 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17086 next_offset += envelope_size;
17087 }
17088
17089 Ok(())
17090 }
17091 }
17092
17093 impl ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17094 #[inline(always)]
17095 fn max_ordinal_present(&self) -> u64 {
17096 if let Some(_) = self.config {
17097 return 2;
17098 }
17099 if let Some(_) = self.sync {
17100 return 1;
17101 }
17102 0
17103 }
17104 }
17105
17106 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17107 type Borrowed<'a> = &'a mut Self;
17108 fn take_or_borrow<'a>(
17109 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17110 ) -> Self::Borrowed<'a> {
17111 value
17112 }
17113 }
17114
17115 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
17116 type Owned = Self;
17117
17118 #[inline(always)]
17119 fn inline_align(_context: fidl::encoding::Context) -> usize {
17120 8
17121 }
17122
17123 #[inline(always)]
17124 fn inline_size(_context: fidl::encoding::Context) -> usize {
17125 16
17126 }
17127 }
17128
17129 unsafe impl
17130 fidl::encoding::Encode<
17131 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
17132 fidl::encoding::DefaultFuchsiaResourceDialect,
17133 > for &mut ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
17134 {
17135 unsafe fn encode(
17136 self,
17137 encoder: &mut fidl::encoding::Encoder<
17138 '_,
17139 fidl::encoding::DefaultFuchsiaResourceDialect,
17140 >,
17141 offset: usize,
17142 mut depth: fidl::encoding::Depth,
17143 ) -> fidl::Result<()> {
17144 encoder.debug_check_bounds::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(
17145 offset,
17146 );
17147 let max_ordinal: u64 = self.max_ordinal_present();
17149 encoder.write_num(max_ordinal, offset);
17150 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17151 if max_ordinal == 0 {
17153 return Ok(());
17154 }
17155 depth.increment()?;
17156 let envelope_size = 8;
17157 let bytes_len = max_ordinal as usize * envelope_size;
17158 #[allow(unused_variables)]
17159 let offset = encoder.out_of_line_offset(bytes_len);
17160 let mut _prev_end_offset: usize = 0;
17161 if 1 > max_ordinal {
17162 return Ok(());
17163 }
17164
17165 let cur_offset: usize = (1 - 1) * envelope_size;
17168
17169 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17171
17172 fidl::encoding::encode_in_envelope_optional::<
17177 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
17178 fidl::encoding::DefaultFuchsiaResourceDialect,
17179 >(
17180 self.sync.as_mut().map(
17181 <fidl::encoding::Endpoint<
17182 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17183 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17184 ),
17185 encoder,
17186 offset + cur_offset,
17187 depth,
17188 )?;
17189
17190 _prev_end_offset = cur_offset + envelope_size;
17191 if 2 > max_ordinal {
17192 return Ok(());
17193 }
17194
17195 let cur_offset: usize = (2 - 1) * envelope_size;
17198
17199 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17201
17202 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
17207 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
17208 encoder, offset + cur_offset, depth
17209 )?;
17210
17211 _prev_end_offset = cur_offset + envelope_size;
17212
17213 Ok(())
17214 }
17215 }
17216
17217 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17218 for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
17219 {
17220 #[inline(always)]
17221 fn new_empty() -> Self {
17222 Self::default()
17223 }
17224
17225 unsafe fn decode(
17226 &mut self,
17227 decoder: &mut fidl::encoding::Decoder<
17228 '_,
17229 fidl::encoding::DefaultFuchsiaResourceDialect,
17230 >,
17231 offset: usize,
17232 mut depth: fidl::encoding::Depth,
17233 ) -> fidl::Result<()> {
17234 decoder.debug_check_bounds::<Self>(offset);
17235 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17236 None => return Err(fidl::Error::NotNullable),
17237 Some(len) => len,
17238 };
17239 if len == 0 {
17241 return Ok(());
17242 };
17243 depth.increment()?;
17244 let envelope_size = 8;
17245 let bytes_len = len * envelope_size;
17246 let offset = decoder.out_of_line_offset(bytes_len)?;
17247 let mut _next_ordinal_to_read = 0;
17249 let mut next_offset = offset;
17250 let end_offset = offset + bytes_len;
17251 _next_ordinal_to_read += 1;
17252 if next_offset >= end_offset {
17253 return Ok(());
17254 }
17255
17256 while _next_ordinal_to_read < 1 {
17258 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17259 _next_ordinal_to_read += 1;
17260 next_offset += envelope_size;
17261 }
17262
17263 let next_out_of_line = decoder.next_out_of_line();
17264 let handles_before = decoder.remaining_handles();
17265 if let Some((inlined, num_bytes, num_handles)) =
17266 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17267 {
17268 let member_inline_size = <fidl::encoding::Endpoint<
17269 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17270 > as fidl::encoding::TypeMarker>::inline_size(
17271 decoder.context
17272 );
17273 if inlined != (member_inline_size <= 4) {
17274 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17275 }
17276 let inner_offset;
17277 let mut inner_depth = depth.clone();
17278 if inlined {
17279 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17280 inner_offset = next_offset;
17281 } else {
17282 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17283 inner_depth.increment()?;
17284 }
17285 let val_ref = self.sync.get_or_insert_with(|| {
17286 fidl::new_empty!(
17287 fidl::encoding::Endpoint<
17288 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17289 >,
17290 fidl::encoding::DefaultFuchsiaResourceDialect
17291 )
17292 });
17293 fidl::decode!(
17294 fidl::encoding::Endpoint<
17295 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
17296 >,
17297 fidl::encoding::DefaultFuchsiaResourceDialect,
17298 val_ref,
17299 decoder,
17300 inner_offset,
17301 inner_depth
17302 )?;
17303 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17304 {
17305 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17306 }
17307 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17308 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17309 }
17310 }
17311
17312 next_offset += envelope_size;
17313 _next_ordinal_to_read += 1;
17314 if next_offset >= end_offset {
17315 return Ok(());
17316 }
17317
17318 while _next_ordinal_to_read < 2 {
17320 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17321 _next_ordinal_to_read += 1;
17322 next_offset += envelope_size;
17323 }
17324
17325 let next_out_of_line = decoder.next_out_of_line();
17326 let handles_before = decoder.remaining_handles();
17327 if let Some((inlined, num_bytes, num_handles)) =
17328 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17329 {
17330 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17331 if inlined != (member_inline_size <= 4) {
17332 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17333 }
17334 let inner_offset;
17335 let mut inner_depth = depth.clone();
17336 if inlined {
17337 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17338 inner_offset = next_offset;
17339 } else {
17340 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17341 inner_depth.increment()?;
17342 }
17343 let val_ref = self.config.get_or_insert_with(|| {
17344 fidl::new_empty!(
17345 PeriodicAdvertisingSyncConfiguration,
17346 fidl::encoding::DefaultFuchsiaResourceDialect
17347 )
17348 });
17349 fidl::decode!(
17350 PeriodicAdvertisingSyncConfiguration,
17351 fidl::encoding::DefaultFuchsiaResourceDialect,
17352 val_ref,
17353 decoder,
17354 inner_offset,
17355 inner_depth
17356 )?;
17357 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17358 {
17359 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17360 }
17361 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17362 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17363 }
17364 }
17365
17366 next_offset += envelope_size;
17367
17368 while next_offset < end_offset {
17370 _next_ordinal_to_read += 1;
17371 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17372 next_offset += envelope_size;
17373 }
17374
17375 Ok(())
17376 }
17377 }
17378
17379 impl ConnectionConnectL2capRequest {
17380 #[inline(always)]
17381 fn max_ordinal_present(&self) -> u64 {
17382 if let Some(_) = self.ext_offload {
17383 return 4;
17384 }
17385 if let Some(_) = self.psm {
17386 return 3;
17387 }
17388 if let Some(_) = self.channel {
17389 return 2;
17390 }
17391 if let Some(_) = self.parameters {
17392 return 1;
17393 }
17394 0
17395 }
17396 }
17397
17398 impl fidl::encoding::ResourceTypeMarker for ConnectionConnectL2capRequest {
17399 type Borrowed<'a> = &'a mut Self;
17400 fn take_or_borrow<'a>(
17401 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17402 ) -> Self::Borrowed<'a> {
17403 value
17404 }
17405 }
17406
17407 unsafe impl fidl::encoding::TypeMarker for ConnectionConnectL2capRequest {
17408 type Owned = Self;
17409
17410 #[inline(always)]
17411 fn inline_align(_context: fidl::encoding::Context) -> usize {
17412 8
17413 }
17414
17415 #[inline(always)]
17416 fn inline_size(_context: fidl::encoding::Context) -> usize {
17417 16
17418 }
17419 }
17420
17421 unsafe impl
17422 fidl::encoding::Encode<
17423 ConnectionConnectL2capRequest,
17424 fidl::encoding::DefaultFuchsiaResourceDialect,
17425 > for &mut ConnectionConnectL2capRequest
17426 {
17427 unsafe fn encode(
17428 self,
17429 encoder: &mut fidl::encoding::Encoder<
17430 '_,
17431 fidl::encoding::DefaultFuchsiaResourceDialect,
17432 >,
17433 offset: usize,
17434 mut depth: fidl::encoding::Depth,
17435 ) -> fidl::Result<()> {
17436 encoder.debug_check_bounds::<ConnectionConnectL2capRequest>(offset);
17437 let max_ordinal: u64 = self.max_ordinal_present();
17439 encoder.write_num(max_ordinal, offset);
17440 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17441 if max_ordinal == 0 {
17443 return Ok(());
17444 }
17445 depth.increment()?;
17446 let envelope_size = 8;
17447 let bytes_len = max_ordinal as usize * envelope_size;
17448 #[allow(unused_variables)]
17449 let offset = encoder.out_of_line_offset(bytes_len);
17450 let mut _prev_end_offset: usize = 0;
17451 if 1 > max_ordinal {
17452 return Ok(());
17453 }
17454
17455 let cur_offset: usize = (1 - 1) * envelope_size;
17458
17459 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17461
17462 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
17467 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
17468 encoder, offset + cur_offset, depth
17469 )?;
17470
17471 _prev_end_offset = cur_offset + envelope_size;
17472 if 2 > max_ordinal {
17473 return Ok(());
17474 }
17475
17476 let cur_offset: usize = (2 - 1) * envelope_size;
17479
17480 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17482
17483 fidl::encoding::encode_in_envelope_optional::<
17488 fidl::encoding::Endpoint<
17489 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17490 >,
17491 fidl::encoding::DefaultFuchsiaResourceDialect,
17492 >(
17493 self.channel.as_mut().map(
17494 <fidl::encoding::Endpoint<
17495 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17496 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
17497 ),
17498 encoder,
17499 offset + cur_offset,
17500 depth,
17501 )?;
17502
17503 _prev_end_offset = cur_offset + envelope_size;
17504 if 3 > max_ordinal {
17505 return Ok(());
17506 }
17507
17508 let cur_offset: usize = (3 - 1) * envelope_size;
17511
17512 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17514
17515 fidl::encoding::encode_in_envelope_optional::<
17520 u16,
17521 fidl::encoding::DefaultFuchsiaResourceDialect,
17522 >(
17523 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
17524 encoder,
17525 offset + cur_offset,
17526 depth,
17527 )?;
17528
17529 _prev_end_offset = cur_offset + envelope_size;
17530 if 4 > max_ordinal {
17531 return Ok(());
17532 }
17533
17534 let cur_offset: usize = (4 - 1) * envelope_size;
17537
17538 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17540
17541 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17546 self.ext_offload.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17547 encoder, offset + cur_offset, depth
17548 )?;
17549
17550 _prev_end_offset = cur_offset + envelope_size;
17551
17552 Ok(())
17553 }
17554 }
17555
17556 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17557 for ConnectionConnectL2capRequest
17558 {
17559 #[inline(always)]
17560 fn new_empty() -> Self {
17561 Self::default()
17562 }
17563
17564 unsafe fn decode(
17565 &mut self,
17566 decoder: &mut fidl::encoding::Decoder<
17567 '_,
17568 fidl::encoding::DefaultFuchsiaResourceDialect,
17569 >,
17570 offset: usize,
17571 mut depth: fidl::encoding::Depth,
17572 ) -> fidl::Result<()> {
17573 decoder.debug_check_bounds::<Self>(offset);
17574 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17575 None => return Err(fidl::Error::NotNullable),
17576 Some(len) => len,
17577 };
17578 if len == 0 {
17580 return Ok(());
17581 };
17582 depth.increment()?;
17583 let envelope_size = 8;
17584 let bytes_len = len * envelope_size;
17585 let offset = decoder.out_of_line_offset(bytes_len)?;
17586 let mut _next_ordinal_to_read = 0;
17588 let mut next_offset = offset;
17589 let end_offset = offset + bytes_len;
17590 _next_ordinal_to_read += 1;
17591 if next_offset >= end_offset {
17592 return Ok(());
17593 }
17594
17595 while _next_ordinal_to_read < 1 {
17597 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17598 _next_ordinal_to_read += 1;
17599 next_offset += envelope_size;
17600 }
17601
17602 let next_out_of_line = decoder.next_out_of_line();
17603 let handles_before = decoder.remaining_handles();
17604 if let Some((inlined, num_bytes, num_handles)) =
17605 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17606 {
17607 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17608 if inlined != (member_inline_size <= 4) {
17609 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17610 }
17611 let inner_offset;
17612 let mut inner_depth = depth.clone();
17613 if inlined {
17614 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17615 inner_offset = next_offset;
17616 } else {
17617 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17618 inner_depth.increment()?;
17619 }
17620 let val_ref = self.parameters.get_or_insert_with(|| {
17621 fidl::new_empty!(
17622 fidl_fuchsia_bluetooth::ChannelParameters,
17623 fidl::encoding::DefaultFuchsiaResourceDialect
17624 )
17625 });
17626 fidl::decode!(
17627 fidl_fuchsia_bluetooth::ChannelParameters,
17628 fidl::encoding::DefaultFuchsiaResourceDialect,
17629 val_ref,
17630 decoder,
17631 inner_offset,
17632 inner_depth
17633 )?;
17634 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17635 {
17636 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17637 }
17638 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17639 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17640 }
17641 }
17642
17643 next_offset += envelope_size;
17644 _next_ordinal_to_read += 1;
17645 if next_offset >= end_offset {
17646 return Ok(());
17647 }
17648
17649 while _next_ordinal_to_read < 2 {
17651 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17652 _next_ordinal_to_read += 1;
17653 next_offset += envelope_size;
17654 }
17655
17656 let next_out_of_line = decoder.next_out_of_line();
17657 let handles_before = decoder.remaining_handles();
17658 if let Some((inlined, num_bytes, num_handles)) =
17659 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17660 {
17661 let member_inline_size = <fidl::encoding::Endpoint<
17662 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17663 > as fidl::encoding::TypeMarker>::inline_size(
17664 decoder.context
17665 );
17666 if inlined != (member_inline_size <= 4) {
17667 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17668 }
17669 let inner_offset;
17670 let mut inner_depth = depth.clone();
17671 if inlined {
17672 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17673 inner_offset = next_offset;
17674 } else {
17675 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17676 inner_depth.increment()?;
17677 }
17678 let val_ref = self.channel.get_or_insert_with(|| {
17679 fidl::new_empty!(
17680 fidl::encoding::Endpoint<
17681 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17682 >,
17683 fidl::encoding::DefaultFuchsiaResourceDialect
17684 )
17685 });
17686 fidl::decode!(
17687 fidl::encoding::Endpoint<
17688 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
17689 >,
17690 fidl::encoding::DefaultFuchsiaResourceDialect,
17691 val_ref,
17692 decoder,
17693 inner_offset,
17694 inner_depth
17695 )?;
17696 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17697 {
17698 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17699 }
17700 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17701 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17702 }
17703 }
17704
17705 next_offset += envelope_size;
17706 _next_ordinal_to_read += 1;
17707 if next_offset >= end_offset {
17708 return Ok(());
17709 }
17710
17711 while _next_ordinal_to_read < 3 {
17713 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17714 _next_ordinal_to_read += 1;
17715 next_offset += envelope_size;
17716 }
17717
17718 let next_out_of_line = decoder.next_out_of_line();
17719 let handles_before = decoder.remaining_handles();
17720 if let Some((inlined, num_bytes, num_handles)) =
17721 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17722 {
17723 let member_inline_size =
17724 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17725 if inlined != (member_inline_size <= 4) {
17726 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17727 }
17728 let inner_offset;
17729 let mut inner_depth = depth.clone();
17730 if inlined {
17731 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17732 inner_offset = next_offset;
17733 } else {
17734 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17735 inner_depth.increment()?;
17736 }
17737 let val_ref = self.psm.get_or_insert_with(|| {
17738 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
17739 });
17740 fidl::decode!(
17741 u16,
17742 fidl::encoding::DefaultFuchsiaResourceDialect,
17743 val_ref,
17744 decoder,
17745 inner_offset,
17746 inner_depth
17747 )?;
17748 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17749 {
17750 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17751 }
17752 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17753 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17754 }
17755 }
17756
17757 next_offset += envelope_size;
17758 _next_ordinal_to_read += 1;
17759 if next_offset >= end_offset {
17760 return Ok(());
17761 }
17762
17763 while _next_ordinal_to_read < 4 {
17765 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17766 _next_ordinal_to_read += 1;
17767 next_offset += envelope_size;
17768 }
17769
17770 let next_out_of_line = decoder.next_out_of_line();
17771 let handles_before = decoder.remaining_handles();
17772 if let Some((inlined, num_bytes, num_handles)) =
17773 fidl::encoding::decode_envelope_header(decoder, next_offset)?
17774 {
17775 let member_inline_size = <fidl::encoding::Endpoint<
17776 fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>,
17777 > as fidl::encoding::TypeMarker>::inline_size(
17778 decoder.context
17779 );
17780 if inlined != (member_inline_size <= 4) {
17781 return Err(fidl::Error::InvalidInlineBitInEnvelope);
17782 }
17783 let inner_offset;
17784 let mut inner_depth = depth.clone();
17785 if inlined {
17786 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17787 inner_offset = next_offset;
17788 } else {
17789 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17790 inner_depth.increment()?;
17791 }
17792 let val_ref = self.ext_offload.get_or_insert_with(|| {
17793 fidl::new_empty!(
17794 fidl::encoding::Endpoint<
17795 fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>,
17796 >,
17797 fidl::encoding::DefaultFuchsiaResourceDialect
17798 )
17799 });
17800 fidl::decode!(
17801 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ChannelOffloadExtMarker>>,
17802 fidl::encoding::DefaultFuchsiaResourceDialect,
17803 val_ref,
17804 decoder,
17805 inner_offset,
17806 inner_depth
17807 )?;
17808 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17809 {
17810 return Err(fidl::Error::InvalidNumBytesInEnvelope);
17811 }
17812 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17813 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17814 }
17815 }
17816
17817 next_offset += envelope_size;
17818
17819 while next_offset < end_offset {
17821 _next_ordinal_to_read += 1;
17822 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17823 next_offset += envelope_size;
17824 }
17825
17826 Ok(())
17827 }
17828 }
17829}