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 ChannelListenerRegistryListenL2capRequest {
150 pub parameters: Option<AcceptedChannelParameters>,
152 pub listener: Option<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
154 #[doc(hidden)]
155 pub __source_breaking: fidl::marker::SourceBreaking,
156}
157
158impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
159 for ChannelListenerRegistryListenL2capRequest
160{
161}
162
163#[derive(Debug, Default, PartialEq)]
164pub struct CisRequestedParameters {
165 pub cis_id: Option<u8>,
169 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
172 pub max_sdu_size_outgoing: Option<u16>,
177 pub max_sdu_size_incoming: Option<u16>,
182 #[doc(hidden)]
183 pub __source_breaking: fidl::marker::SourceBreaking,
184}
185
186impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CisRequestedParameters {}
187
188#[derive(Debug, Default, PartialEq)]
189pub struct ConnectionAcceptCisRequest {
190 pub cig_id: Option<u8>,
192 pub cis_id: Option<u8>,
194 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
201 #[doc(hidden)]
202 pub __source_breaking: fidl::marker::SourceBreaking,
203}
204
205impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
206 for ConnectionAcceptCisRequest
207{
208}
209
210#[derive(Debug, Default, PartialEq)]
211pub struct ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
212 pub sync: Option<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
216 pub config: Option<PeriodicAdvertisingSyncConfiguration>,
217 #[doc(hidden)]
218 pub __source_breaking: fidl::marker::SourceBreaking,
219}
220
221impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
222 for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
223{
224}
225
226#[derive(Debug, Default, PartialEq)]
227pub struct ConnectionConnectL2capRequest {
228 pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
230 pub channel: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
232 pub psm: Option<u16>,
234 #[doc(hidden)]
235 pub __source_breaking: fidl::marker::SourceBreaking,
236}
237
238impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
239 for ConnectionConnectL2capRequest
240{
241}
242
243#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
244pub struct AdvertisedPeripheralMarker;
245
246impl fidl::endpoints::ProtocolMarker for AdvertisedPeripheralMarker {
247 type Proxy = AdvertisedPeripheralProxy;
248 type RequestStream = AdvertisedPeripheralRequestStream;
249 #[cfg(target_os = "fuchsia")]
250 type SynchronousProxy = AdvertisedPeripheralSynchronousProxy;
251
252 const DEBUG_NAME: &'static str = "(anonymous) AdvertisedPeripheral";
253}
254
255pub trait AdvertisedPeripheralProxyInterface: Send + Sync {
256 type OnConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
257 fn r#on_connected(
258 &self,
259 peer: &Peer,
260 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
261 ) -> Self::OnConnectedResponseFut;
262}
263#[derive(Debug)]
264#[cfg(target_os = "fuchsia")]
265pub struct AdvertisedPeripheralSynchronousProxy {
266 client: fidl::client::sync::Client,
267}
268
269#[cfg(target_os = "fuchsia")]
270impl fidl::endpoints::SynchronousProxy for AdvertisedPeripheralSynchronousProxy {
271 type Proxy = AdvertisedPeripheralProxy;
272 type Protocol = AdvertisedPeripheralMarker;
273
274 fn from_channel(inner: fidl::Channel) -> Self {
275 Self::new(inner)
276 }
277
278 fn into_channel(self) -> fidl::Channel {
279 self.client.into_channel()
280 }
281
282 fn as_channel(&self) -> &fidl::Channel {
283 self.client.as_channel()
284 }
285}
286
287#[cfg(target_os = "fuchsia")]
288impl AdvertisedPeripheralSynchronousProxy {
289 pub fn new(channel: fidl::Channel) -> Self {
290 let protocol_name =
291 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
292 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
293 }
294
295 pub fn into_channel(self) -> fidl::Channel {
296 self.client.into_channel()
297 }
298
299 pub fn wait_for_event(
302 &self,
303 deadline: zx::MonotonicInstant,
304 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
305 AdvertisedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
306 }
307
308 pub fn r#on_connected(
326 &self,
327 mut peer: &Peer,
328 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
329 ___deadline: zx::MonotonicInstant,
330 ) -> Result<(), fidl::Error> {
331 let _response = self
332 .client
333 .send_query::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::EmptyPayload>(
334 (peer, connection),
335 0x607b7716457eb178,
336 fidl::encoding::DynamicFlags::empty(),
337 ___deadline,
338 )?;
339 Ok(_response)
340 }
341}
342
343#[cfg(target_os = "fuchsia")]
344impl From<AdvertisedPeripheralSynchronousProxy> for zx::Handle {
345 fn from(value: AdvertisedPeripheralSynchronousProxy) -> Self {
346 value.into_channel().into()
347 }
348}
349
350#[cfg(target_os = "fuchsia")]
351impl From<fidl::Channel> for AdvertisedPeripheralSynchronousProxy {
352 fn from(value: fidl::Channel) -> Self {
353 Self::new(value)
354 }
355}
356
357#[cfg(target_os = "fuchsia")]
358impl fidl::endpoints::FromClient for AdvertisedPeripheralSynchronousProxy {
359 type Protocol = AdvertisedPeripheralMarker;
360
361 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>) -> Self {
362 Self::new(value.into_channel())
363 }
364}
365
366#[derive(Debug, Clone)]
367pub struct AdvertisedPeripheralProxy {
368 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
369}
370
371impl fidl::endpoints::Proxy for AdvertisedPeripheralProxy {
372 type Protocol = AdvertisedPeripheralMarker;
373
374 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
375 Self::new(inner)
376 }
377
378 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
379 self.client.into_channel().map_err(|client| Self { client })
380 }
381
382 fn as_channel(&self) -> &::fidl::AsyncChannel {
383 self.client.as_channel()
384 }
385}
386
387impl AdvertisedPeripheralProxy {
388 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
390 let protocol_name =
391 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
392 Self { client: fidl::client::Client::new(channel, protocol_name) }
393 }
394
395 pub fn take_event_stream(&self) -> AdvertisedPeripheralEventStream {
401 AdvertisedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
402 }
403
404 pub fn r#on_connected(
422 &self,
423 mut peer: &Peer,
424 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
425 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
426 AdvertisedPeripheralProxyInterface::r#on_connected(self, peer, connection)
427 }
428}
429
430impl AdvertisedPeripheralProxyInterface for AdvertisedPeripheralProxy {
431 type OnConnectedResponseFut =
432 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
433 fn r#on_connected(
434 &self,
435 mut peer: &Peer,
436 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
437 ) -> Self::OnConnectedResponseFut {
438 fn _decode(
439 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440 ) -> Result<(), fidl::Error> {
441 let _response = fidl::client::decode_transaction_body::<
442 fidl::encoding::EmptyPayload,
443 fidl::encoding::DefaultFuchsiaResourceDialect,
444 0x607b7716457eb178,
445 >(_buf?)?;
446 Ok(_response)
447 }
448 self.client.send_query_and_decode::<AdvertisedPeripheralOnConnectedRequest, ()>(
449 (peer, connection),
450 0x607b7716457eb178,
451 fidl::encoding::DynamicFlags::empty(),
452 _decode,
453 )
454 }
455}
456
457pub struct AdvertisedPeripheralEventStream {
458 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
459}
460
461impl std::marker::Unpin for AdvertisedPeripheralEventStream {}
462
463impl futures::stream::FusedStream for AdvertisedPeripheralEventStream {
464 fn is_terminated(&self) -> bool {
465 self.event_receiver.is_terminated()
466 }
467}
468
469impl futures::Stream for AdvertisedPeripheralEventStream {
470 type Item = Result<AdvertisedPeripheralEvent, fidl::Error>;
471
472 fn poll_next(
473 mut self: std::pin::Pin<&mut Self>,
474 cx: &mut std::task::Context<'_>,
475 ) -> std::task::Poll<Option<Self::Item>> {
476 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
477 &mut self.event_receiver,
478 cx
479 )?) {
480 Some(buf) => std::task::Poll::Ready(Some(AdvertisedPeripheralEvent::decode(buf))),
481 None => std::task::Poll::Ready(None),
482 }
483 }
484}
485
486#[derive(Debug)]
487pub enum AdvertisedPeripheralEvent {}
488
489impl AdvertisedPeripheralEvent {
490 fn decode(
492 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
493 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
494 let (bytes, _handles) = buf.split_mut();
495 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
496 debug_assert_eq!(tx_header.tx_id, 0);
497 match tx_header.ordinal {
498 _ => Err(fidl::Error::UnknownOrdinal {
499 ordinal: tx_header.ordinal,
500 protocol_name:
501 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
502 }),
503 }
504 }
505}
506
507pub struct AdvertisedPeripheralRequestStream {
509 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
510 is_terminated: bool,
511}
512
513impl std::marker::Unpin for AdvertisedPeripheralRequestStream {}
514
515impl futures::stream::FusedStream for AdvertisedPeripheralRequestStream {
516 fn is_terminated(&self) -> bool {
517 self.is_terminated
518 }
519}
520
521impl fidl::endpoints::RequestStream for AdvertisedPeripheralRequestStream {
522 type Protocol = AdvertisedPeripheralMarker;
523 type ControlHandle = AdvertisedPeripheralControlHandle;
524
525 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
526 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
527 }
528
529 fn control_handle(&self) -> Self::ControlHandle {
530 AdvertisedPeripheralControlHandle { inner: self.inner.clone() }
531 }
532
533 fn into_inner(
534 self,
535 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
536 {
537 (self.inner, self.is_terminated)
538 }
539
540 fn from_inner(
541 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
542 is_terminated: bool,
543 ) -> Self {
544 Self { inner, is_terminated }
545 }
546}
547
548impl futures::Stream for AdvertisedPeripheralRequestStream {
549 type Item = Result<AdvertisedPeripheralRequest, fidl::Error>;
550
551 fn poll_next(
552 mut self: std::pin::Pin<&mut Self>,
553 cx: &mut std::task::Context<'_>,
554 ) -> std::task::Poll<Option<Self::Item>> {
555 let this = &mut *self;
556 if this.inner.check_shutdown(cx) {
557 this.is_terminated = true;
558 return std::task::Poll::Ready(None);
559 }
560 if this.is_terminated {
561 panic!("polled AdvertisedPeripheralRequestStream after completion");
562 }
563 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
564 |bytes, handles| {
565 match this.inner.channel().read_etc(cx, bytes, handles) {
566 std::task::Poll::Ready(Ok(())) => {}
567 std::task::Poll::Pending => return std::task::Poll::Pending,
568 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
569 this.is_terminated = true;
570 return std::task::Poll::Ready(None);
571 }
572 std::task::Poll::Ready(Err(e)) => {
573 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
574 e.into(),
575 ))))
576 }
577 }
578
579 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
581
582 std::task::Poll::Ready(Some(match header.ordinal {
583 0x607b7716457eb178 => {
584 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
585 let mut req = fidl::new_empty!(AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
586 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdvertisedPeripheralOnConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
587 let control_handle = AdvertisedPeripheralControlHandle {
588 inner: this.inner.clone(),
589 };
590 Ok(AdvertisedPeripheralRequest::OnConnected {peer: req.peer,
591connection: req.connection,
592
593 responder: AdvertisedPeripheralOnConnectedResponder {
594 control_handle: std::mem::ManuallyDrop::new(control_handle),
595 tx_id: header.tx_id,
596 },
597 })
598 }
599 _ => Err(fidl::Error::UnknownOrdinal {
600 ordinal: header.ordinal,
601 protocol_name: <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
602 }),
603 }))
604 },
605 )
606 }
607}
608
609#[derive(Debug)]
614pub enum AdvertisedPeripheralRequest {
615 OnConnected {
633 peer: Peer,
634 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
635 responder: AdvertisedPeripheralOnConnectedResponder,
636 },
637}
638
639impl AdvertisedPeripheralRequest {
640 #[allow(irrefutable_let_patterns)]
641 pub fn into_on_connected(
642 self,
643 ) -> Option<(
644 Peer,
645 fidl::endpoints::ClientEnd<ConnectionMarker>,
646 AdvertisedPeripheralOnConnectedResponder,
647 )> {
648 if let AdvertisedPeripheralRequest::OnConnected { peer, connection, responder } = self {
649 Some((peer, connection, responder))
650 } else {
651 None
652 }
653 }
654
655 pub fn method_name(&self) -> &'static str {
657 match *self {
658 AdvertisedPeripheralRequest::OnConnected { .. } => "on_connected",
659 }
660 }
661}
662
663#[derive(Debug, Clone)]
664pub struct AdvertisedPeripheralControlHandle {
665 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
666}
667
668impl fidl::endpoints::ControlHandle for AdvertisedPeripheralControlHandle {
669 fn shutdown(&self) {
670 self.inner.shutdown()
671 }
672 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
673 self.inner.shutdown_with_epitaph(status)
674 }
675
676 fn is_closed(&self) -> bool {
677 self.inner.channel().is_closed()
678 }
679 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
680 self.inner.channel().on_closed()
681 }
682
683 #[cfg(target_os = "fuchsia")]
684 fn signal_peer(
685 &self,
686 clear_mask: zx::Signals,
687 set_mask: zx::Signals,
688 ) -> Result<(), zx_status::Status> {
689 use fidl::Peered;
690 self.inner.channel().signal_peer(clear_mask, set_mask)
691 }
692}
693
694impl AdvertisedPeripheralControlHandle {}
695
696#[must_use = "FIDL methods require a response to be sent"]
697#[derive(Debug)]
698pub struct AdvertisedPeripheralOnConnectedResponder {
699 control_handle: std::mem::ManuallyDrop<AdvertisedPeripheralControlHandle>,
700 tx_id: u32,
701}
702
703impl std::ops::Drop for AdvertisedPeripheralOnConnectedResponder {
707 fn drop(&mut self) {
708 self.control_handle.shutdown();
709 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
711 }
712}
713
714impl fidl::endpoints::Responder for AdvertisedPeripheralOnConnectedResponder {
715 type ControlHandle = AdvertisedPeripheralControlHandle;
716
717 fn control_handle(&self) -> &AdvertisedPeripheralControlHandle {
718 &self.control_handle
719 }
720
721 fn drop_without_shutdown(mut self) {
722 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
724 std::mem::forget(self);
726 }
727}
728
729impl AdvertisedPeripheralOnConnectedResponder {
730 pub fn send(self) -> Result<(), fidl::Error> {
734 let _result = self.send_raw();
735 if _result.is_err() {
736 self.control_handle.shutdown();
737 }
738 self.drop_without_shutdown();
739 _result
740 }
741
742 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
744 let _result = self.send_raw();
745 self.drop_without_shutdown();
746 _result
747 }
748
749 fn send_raw(&self) -> Result<(), fidl::Error> {
750 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
751 (),
752 self.tx_id,
753 0x607b7716457eb178,
754 fidl::encoding::DynamicFlags::empty(),
755 )
756 }
757}
758
759#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
760pub struct AdvertisingHandleMarker;
761
762impl fidl::endpoints::ProtocolMarker for AdvertisingHandleMarker {
763 type Proxy = AdvertisingHandleProxy;
764 type RequestStream = AdvertisingHandleRequestStream;
765 #[cfg(target_os = "fuchsia")]
766 type SynchronousProxy = AdvertisingHandleSynchronousProxy;
767
768 const DEBUG_NAME: &'static str = "(anonymous) AdvertisingHandle";
769}
770
771pub trait AdvertisingHandleProxyInterface: Send + Sync {}
772#[derive(Debug)]
773#[cfg(target_os = "fuchsia")]
774pub struct AdvertisingHandleSynchronousProxy {
775 client: fidl::client::sync::Client,
776}
777
778#[cfg(target_os = "fuchsia")]
779impl fidl::endpoints::SynchronousProxy for AdvertisingHandleSynchronousProxy {
780 type Proxy = AdvertisingHandleProxy;
781 type Protocol = AdvertisingHandleMarker;
782
783 fn from_channel(inner: fidl::Channel) -> Self {
784 Self::new(inner)
785 }
786
787 fn into_channel(self) -> fidl::Channel {
788 self.client.into_channel()
789 }
790
791 fn as_channel(&self) -> &fidl::Channel {
792 self.client.as_channel()
793 }
794}
795
796#[cfg(target_os = "fuchsia")]
797impl AdvertisingHandleSynchronousProxy {
798 pub fn new(channel: fidl::Channel) -> Self {
799 let protocol_name =
800 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
801 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
802 }
803
804 pub fn into_channel(self) -> fidl::Channel {
805 self.client.into_channel()
806 }
807
808 pub fn wait_for_event(
811 &self,
812 deadline: zx::MonotonicInstant,
813 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
814 AdvertisingHandleEvent::decode(self.client.wait_for_event(deadline)?)
815 }
816}
817
818#[cfg(target_os = "fuchsia")]
819impl From<AdvertisingHandleSynchronousProxy> for zx::Handle {
820 fn from(value: AdvertisingHandleSynchronousProxy) -> Self {
821 value.into_channel().into()
822 }
823}
824
825#[cfg(target_os = "fuchsia")]
826impl From<fidl::Channel> for AdvertisingHandleSynchronousProxy {
827 fn from(value: fidl::Channel) -> Self {
828 Self::new(value)
829 }
830}
831
832#[cfg(target_os = "fuchsia")]
833impl fidl::endpoints::FromClient for AdvertisingHandleSynchronousProxy {
834 type Protocol = AdvertisingHandleMarker;
835
836 fn from_client(value: fidl::endpoints::ClientEnd<AdvertisingHandleMarker>) -> Self {
837 Self::new(value.into_channel())
838 }
839}
840
841#[derive(Debug, Clone)]
842pub struct AdvertisingHandleProxy {
843 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
844}
845
846impl fidl::endpoints::Proxy for AdvertisingHandleProxy {
847 type Protocol = AdvertisingHandleMarker;
848
849 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
850 Self::new(inner)
851 }
852
853 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
854 self.client.into_channel().map_err(|client| Self { client })
855 }
856
857 fn as_channel(&self) -> &::fidl::AsyncChannel {
858 self.client.as_channel()
859 }
860}
861
862impl AdvertisingHandleProxy {
863 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
865 let protocol_name =
866 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
867 Self { client: fidl::client::Client::new(channel, protocol_name) }
868 }
869
870 pub fn take_event_stream(&self) -> AdvertisingHandleEventStream {
876 AdvertisingHandleEventStream { event_receiver: self.client.take_event_receiver() }
877 }
878}
879
880impl AdvertisingHandleProxyInterface for AdvertisingHandleProxy {}
881
882pub struct AdvertisingHandleEventStream {
883 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
884}
885
886impl std::marker::Unpin for AdvertisingHandleEventStream {}
887
888impl futures::stream::FusedStream for AdvertisingHandleEventStream {
889 fn is_terminated(&self) -> bool {
890 self.event_receiver.is_terminated()
891 }
892}
893
894impl futures::Stream for AdvertisingHandleEventStream {
895 type Item = Result<AdvertisingHandleEvent, fidl::Error>;
896
897 fn poll_next(
898 mut self: std::pin::Pin<&mut Self>,
899 cx: &mut std::task::Context<'_>,
900 ) -> std::task::Poll<Option<Self::Item>> {
901 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
902 &mut self.event_receiver,
903 cx
904 )?) {
905 Some(buf) => std::task::Poll::Ready(Some(AdvertisingHandleEvent::decode(buf))),
906 None => std::task::Poll::Ready(None),
907 }
908 }
909}
910
911#[derive(Debug)]
912pub enum AdvertisingHandleEvent {}
913
914impl AdvertisingHandleEvent {
915 fn decode(
917 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
918 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
919 let (bytes, _handles) = buf.split_mut();
920 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
921 debug_assert_eq!(tx_header.tx_id, 0);
922 match tx_header.ordinal {
923 _ => Err(fidl::Error::UnknownOrdinal {
924 ordinal: tx_header.ordinal,
925 protocol_name:
926 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
927 }),
928 }
929 }
930}
931
932pub struct AdvertisingHandleRequestStream {
934 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
935 is_terminated: bool,
936}
937
938impl std::marker::Unpin for AdvertisingHandleRequestStream {}
939
940impl futures::stream::FusedStream for AdvertisingHandleRequestStream {
941 fn is_terminated(&self) -> bool {
942 self.is_terminated
943 }
944}
945
946impl fidl::endpoints::RequestStream for AdvertisingHandleRequestStream {
947 type Protocol = AdvertisingHandleMarker;
948 type ControlHandle = AdvertisingHandleControlHandle;
949
950 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
951 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
952 }
953
954 fn control_handle(&self) -> Self::ControlHandle {
955 AdvertisingHandleControlHandle { inner: self.inner.clone() }
956 }
957
958 fn into_inner(
959 self,
960 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
961 {
962 (self.inner, self.is_terminated)
963 }
964
965 fn from_inner(
966 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
967 is_terminated: bool,
968 ) -> Self {
969 Self { inner, is_terminated }
970 }
971}
972
973impl futures::Stream for AdvertisingHandleRequestStream {
974 type Item = Result<AdvertisingHandleRequest, fidl::Error>;
975
976 fn poll_next(
977 mut self: std::pin::Pin<&mut Self>,
978 cx: &mut std::task::Context<'_>,
979 ) -> std::task::Poll<Option<Self::Item>> {
980 let this = &mut *self;
981 if this.inner.check_shutdown(cx) {
982 this.is_terminated = true;
983 return std::task::Poll::Ready(None);
984 }
985 if this.is_terminated {
986 panic!("polled AdvertisingHandleRequestStream after completion");
987 }
988 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
989 |bytes, handles| {
990 match this.inner.channel().read_etc(cx, bytes, handles) {
991 std::task::Poll::Ready(Ok(())) => {}
992 std::task::Poll::Pending => return std::task::Poll::Pending,
993 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
994 this.is_terminated = true;
995 return std::task::Poll::Ready(None);
996 }
997 std::task::Poll::Ready(Err(e)) => {
998 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
999 e.into(),
1000 ))))
1001 }
1002 }
1003
1004 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1006
1007 std::task::Poll::Ready(Some(match header.ordinal {
1008 _ => Err(fidl::Error::UnknownOrdinal {
1009 ordinal: header.ordinal,
1010 protocol_name:
1011 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1012 }),
1013 }))
1014 },
1015 )
1016 }
1017}
1018
1019#[derive(Debug)]
1023pub enum AdvertisingHandleRequest {}
1024
1025impl AdvertisingHandleRequest {
1026 pub fn method_name(&self) -> &'static str {
1028 match *self {}
1029 }
1030}
1031
1032#[derive(Debug, Clone)]
1033pub struct AdvertisingHandleControlHandle {
1034 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1035}
1036
1037impl fidl::endpoints::ControlHandle for AdvertisingHandleControlHandle {
1038 fn shutdown(&self) {
1039 self.inner.shutdown()
1040 }
1041 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1042 self.inner.shutdown_with_epitaph(status)
1043 }
1044
1045 fn is_closed(&self) -> bool {
1046 self.inner.channel().is_closed()
1047 }
1048 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1049 self.inner.channel().on_closed()
1050 }
1051
1052 #[cfg(target_os = "fuchsia")]
1053 fn signal_peer(
1054 &self,
1055 clear_mask: zx::Signals,
1056 set_mask: zx::Signals,
1057 ) -> Result<(), zx_status::Status> {
1058 use fidl::Peered;
1059 self.inner.channel().signal_peer(clear_mask, set_mask)
1060 }
1061}
1062
1063impl AdvertisingHandleControlHandle {}
1064
1065#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1066pub struct CentralMarker;
1067
1068impl fidl::endpoints::ProtocolMarker for CentralMarker {
1069 type Proxy = CentralProxy;
1070 type RequestStream = CentralRequestStream;
1071 #[cfg(target_os = "fuchsia")]
1072 type SynchronousProxy = CentralSynchronousProxy;
1073
1074 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Central";
1075}
1076impl fidl::endpoints::DiscoverableProtocolMarker for CentralMarker {}
1077pub type CentralCreateConnectedIsochronousGroupResult =
1078 Result<CentralCreateConnectedIsochronousGroupResponse, CreateCigError>;
1079
1080pub trait CentralProxyInterface: Send + Sync {
1081 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
1082 + Send;
1083 fn r#listen_l2cap(
1084 &self,
1085 payload: ChannelListenerRegistryListenL2capRequest,
1086 ) -> Self::ListenL2capResponseFut;
1087 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1088 fn r#scan(
1089 &self,
1090 options: &ScanOptions,
1091 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1092 ) -> Self::ScanResponseFut;
1093 fn r#connect(
1094 &self,
1095 id: &fidl_fuchsia_bluetooth::PeerId,
1096 options: &ConnectionOptions,
1097 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1098 ) -> Result<(), fidl::Error>;
1099 fn r#sync_to_periodic_advertising(
1100 &self,
1101 payload: CentralSyncToPeriodicAdvertisingRequest,
1102 ) -> Result<(), fidl::Error>;
1103 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
1104 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
1105 > + Send;
1106 fn r#create_connected_isochronous_group(
1107 &self,
1108 payload: CentralCreateConnectedIsochronousGroupRequest,
1109 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
1110 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
1111 + Send;
1112 fn r#get_peripherals(
1113 &self,
1114 service_uuids: Option<&[String]>,
1115 ) -> Self::GetPeripheralsResponseFut;
1116 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
1117 + Send;
1118 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
1119 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1120 + Send;
1121 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
1122 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
1123 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1124 + Send;
1125 fn r#connect_peripheral(
1126 &self,
1127 identifier: &str,
1128 options: &ConnectionOptions,
1129 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1130 ) -> Self::ConnectPeripheralResponseFut;
1131 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1132 + Send;
1133 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
1134}
1135#[derive(Debug)]
1136#[cfg(target_os = "fuchsia")]
1137pub struct CentralSynchronousProxy {
1138 client: fidl::client::sync::Client,
1139}
1140
1141#[cfg(target_os = "fuchsia")]
1142impl fidl::endpoints::SynchronousProxy for CentralSynchronousProxy {
1143 type Proxy = CentralProxy;
1144 type Protocol = CentralMarker;
1145
1146 fn from_channel(inner: fidl::Channel) -> Self {
1147 Self::new(inner)
1148 }
1149
1150 fn into_channel(self) -> fidl::Channel {
1151 self.client.into_channel()
1152 }
1153
1154 fn as_channel(&self) -> &fidl::Channel {
1155 self.client.as_channel()
1156 }
1157}
1158
1159#[cfg(target_os = "fuchsia")]
1160impl CentralSynchronousProxy {
1161 pub fn new(channel: fidl::Channel) -> Self {
1162 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1163 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1164 }
1165
1166 pub fn into_channel(self) -> fidl::Channel {
1167 self.client.into_channel()
1168 }
1169
1170 pub fn wait_for_event(
1173 &self,
1174 deadline: zx::MonotonicInstant,
1175 ) -> Result<CentralEvent, fidl::Error> {
1176 CentralEvent::decode(self.client.wait_for_event(deadline)?)
1177 }
1178
1179 pub fn r#listen_l2cap(
1189 &self,
1190 mut payload: ChannelListenerRegistryListenL2capRequest,
1191 ___deadline: zx::MonotonicInstant,
1192 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1193 let _response = self.client.send_query::<
1194 ChannelListenerRegistryListenL2capRequest,
1195 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1196 >(
1197 &mut payload,
1198 0x39c6e9001d102338,
1199 fidl::encoding::DynamicFlags::empty(),
1200 ___deadline,
1201 )?;
1202 Ok(_response.map(|x| x))
1203 }
1204
1205 pub fn r#scan(
1232 &self,
1233 mut options: &ScanOptions,
1234 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1235 ___deadline: zx::MonotonicInstant,
1236 ) -> Result<(), fidl::Error> {
1237 let _response =
1238 self.client.send_query::<CentralScanRequest, fidl::encoding::EmptyPayload>(
1239 (options, result_watcher),
1240 0x41f7121798dfe15f,
1241 fidl::encoding::DynamicFlags::empty(),
1242 ___deadline,
1243 )?;
1244 Ok(_response)
1245 }
1246
1247 pub fn r#connect(
1269 &self,
1270 mut id: &fidl_fuchsia_bluetooth::PeerId,
1271 mut options: &ConnectionOptions,
1272 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1273 ) -> Result<(), fidl::Error> {
1274 self.client.send::<CentralConnectRequest>(
1275 (id, options, handle),
1276 0x31a3065f2a6913c4,
1277 fidl::encoding::DynamicFlags::empty(),
1278 )
1279 }
1280
1281 pub fn r#sync_to_periodic_advertising(
1284 &self,
1285 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1286 ) -> Result<(), fidl::Error> {
1287 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1288 &mut payload,
1289 0x1db6df126a00c5b9,
1290 fidl::encoding::DynamicFlags::empty(),
1291 )
1292 }
1293
1294 pub fn r#create_connected_isochronous_group(
1303 &self,
1304 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1305 ___deadline: zx::MonotonicInstant,
1306 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1307 let _response = self
1308 .client
1309 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
1310 CentralCreateConnectedIsochronousGroupResponse,
1311 CreateCigError,
1312 >>(
1313 &mut payload,
1314 0x60323e70ae22e13,
1315 fidl::encoding::DynamicFlags::empty(),
1316 ___deadline,
1317 )?;
1318 Ok(_response.map(|x| x))
1319 }
1320
1321 pub fn r#get_peripherals(
1327 &self,
1328 mut service_uuids: Option<&[String]>,
1329 ___deadline: zx::MonotonicInstant,
1330 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1331 let _response =
1332 self.client.send_query::<CentralGetPeripheralsRequest, CentralGetPeripheralsResponse>(
1333 (service_uuids,),
1334 0x37ba777499c683a8,
1335 fidl::encoding::DynamicFlags::empty(),
1336 ___deadline,
1337 )?;
1338 Ok(_response.peripherals)
1339 }
1340
1341 pub fn r#get_peripheral(
1347 &self,
1348 mut identifier: &str,
1349 ___deadline: zx::MonotonicInstant,
1350 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1351 let _response =
1352 self.client.send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse>(
1353 (identifier,),
1354 0x97f5a2f2d9c13da,
1355 fidl::encoding::DynamicFlags::empty(),
1356 ___deadline,
1357 )?;
1358 Ok(_response.peripheral)
1359 }
1360
1361 pub fn r#start_scan(
1370 &self,
1371 mut filter: Option<&ScanFilter>,
1372 ___deadline: zx::MonotonicInstant,
1373 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1374 let _response =
1375 self.client.send_query::<CentralStartScanRequest, CentralStartScanResponse>(
1376 (filter,),
1377 0xeb4cf0cd0e1132b,
1378 fidl::encoding::DynamicFlags::empty(),
1379 ___deadline,
1380 )?;
1381 Ok(_response.status)
1382 }
1383
1384 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1386 self.client.send::<fidl::encoding::EmptyPayload>(
1387 (),
1388 0x5f79ee6a0bb037a0,
1389 fidl::encoding::DynamicFlags::empty(),
1390 )
1391 }
1392
1393 pub fn r#connect_peripheral(
1400 &self,
1401 mut identifier: &str,
1402 mut options: &ConnectionOptions,
1403 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1404 ___deadline: zx::MonotonicInstant,
1405 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1406 let _response = self
1407 .client
1408 .send_query::<CentralConnectPeripheralRequest, CentralConnectPeripheralResponse>(
1409 (identifier, options, gatt_client),
1410 0x714d6c32d066d75a,
1411 fidl::encoding::DynamicFlags::empty(),
1412 ___deadline,
1413 )?;
1414 Ok(_response.status)
1415 }
1416
1417 pub fn r#disconnect_peripheral(
1419 &self,
1420 mut identifier: &str,
1421 ___deadline: zx::MonotonicInstant,
1422 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1423 let _response = self
1424 .client
1425 .send_query::<CentralDisconnectPeripheralRequest, CentralDisconnectPeripheralResponse>(
1426 (identifier,),
1427 0xa9430da197362fd,
1428 fidl::encoding::DynamicFlags::empty(),
1429 ___deadline,
1430 )?;
1431 Ok(_response.status)
1432 }
1433}
1434
1435#[cfg(target_os = "fuchsia")]
1436impl From<CentralSynchronousProxy> for zx::Handle {
1437 fn from(value: CentralSynchronousProxy) -> Self {
1438 value.into_channel().into()
1439 }
1440}
1441
1442#[cfg(target_os = "fuchsia")]
1443impl From<fidl::Channel> for CentralSynchronousProxy {
1444 fn from(value: fidl::Channel) -> Self {
1445 Self::new(value)
1446 }
1447}
1448
1449#[cfg(target_os = "fuchsia")]
1450impl fidl::endpoints::FromClient for CentralSynchronousProxy {
1451 type Protocol = CentralMarker;
1452
1453 fn from_client(value: fidl::endpoints::ClientEnd<CentralMarker>) -> Self {
1454 Self::new(value.into_channel())
1455 }
1456}
1457
1458#[derive(Debug, Clone)]
1459pub struct CentralProxy {
1460 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1461}
1462
1463impl fidl::endpoints::Proxy for CentralProxy {
1464 type Protocol = CentralMarker;
1465
1466 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1467 Self::new(inner)
1468 }
1469
1470 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1471 self.client.into_channel().map_err(|client| Self { client })
1472 }
1473
1474 fn as_channel(&self) -> &::fidl::AsyncChannel {
1475 self.client.as_channel()
1476 }
1477}
1478
1479impl CentralProxy {
1480 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1482 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1483 Self { client: fidl::client::Client::new(channel, protocol_name) }
1484 }
1485
1486 pub fn take_event_stream(&self) -> CentralEventStream {
1492 CentralEventStream { event_receiver: self.client.take_event_receiver() }
1493 }
1494
1495 pub fn r#listen_l2cap(
1505 &self,
1506 mut payload: ChannelListenerRegistryListenL2capRequest,
1507 ) -> fidl::client::QueryResponseFut<
1508 ChannelListenerRegistryListenL2capResult,
1509 fidl::encoding::DefaultFuchsiaResourceDialect,
1510 > {
1511 CentralProxyInterface::r#listen_l2cap(self, payload)
1512 }
1513
1514 pub fn r#scan(
1541 &self,
1542 mut options: &ScanOptions,
1543 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1544 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1545 CentralProxyInterface::r#scan(self, options, result_watcher)
1546 }
1547
1548 pub fn r#connect(
1570 &self,
1571 mut id: &fidl_fuchsia_bluetooth::PeerId,
1572 mut options: &ConnectionOptions,
1573 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1574 ) -> Result<(), fidl::Error> {
1575 CentralProxyInterface::r#connect(self, id, options, handle)
1576 }
1577
1578 pub fn r#sync_to_periodic_advertising(
1581 &self,
1582 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1583 ) -> Result<(), fidl::Error> {
1584 CentralProxyInterface::r#sync_to_periodic_advertising(self, payload)
1585 }
1586
1587 pub fn r#create_connected_isochronous_group(
1596 &self,
1597 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1598 ) -> fidl::client::QueryResponseFut<
1599 CentralCreateConnectedIsochronousGroupResult,
1600 fidl::encoding::DefaultFuchsiaResourceDialect,
1601 > {
1602 CentralProxyInterface::r#create_connected_isochronous_group(self, payload)
1603 }
1604
1605 pub fn r#get_peripherals(
1611 &self,
1612 mut service_uuids: Option<&[String]>,
1613 ) -> fidl::client::QueryResponseFut<
1614 Vec<RemoteDevice>,
1615 fidl::encoding::DefaultFuchsiaResourceDialect,
1616 > {
1617 CentralProxyInterface::r#get_peripherals(self, service_uuids)
1618 }
1619
1620 pub fn r#get_peripheral(
1626 &self,
1627 mut identifier: &str,
1628 ) -> fidl::client::QueryResponseFut<
1629 Option<Box<RemoteDevice>>,
1630 fidl::encoding::DefaultFuchsiaResourceDialect,
1631 > {
1632 CentralProxyInterface::r#get_peripheral(self, identifier)
1633 }
1634
1635 pub fn r#start_scan(
1644 &self,
1645 mut filter: Option<&ScanFilter>,
1646 ) -> fidl::client::QueryResponseFut<
1647 fidl_fuchsia_bluetooth::Status,
1648 fidl::encoding::DefaultFuchsiaResourceDialect,
1649 > {
1650 CentralProxyInterface::r#start_scan(self, filter)
1651 }
1652
1653 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1655 CentralProxyInterface::r#stop_scan(self)
1656 }
1657
1658 pub fn r#connect_peripheral(
1665 &self,
1666 mut identifier: &str,
1667 mut options: &ConnectionOptions,
1668 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1669 ) -> fidl::client::QueryResponseFut<
1670 fidl_fuchsia_bluetooth::Status,
1671 fidl::encoding::DefaultFuchsiaResourceDialect,
1672 > {
1673 CentralProxyInterface::r#connect_peripheral(self, identifier, options, gatt_client)
1674 }
1675
1676 pub fn r#disconnect_peripheral(
1678 &self,
1679 mut identifier: &str,
1680 ) -> fidl::client::QueryResponseFut<
1681 fidl_fuchsia_bluetooth::Status,
1682 fidl::encoding::DefaultFuchsiaResourceDialect,
1683 > {
1684 CentralProxyInterface::r#disconnect_peripheral(self, identifier)
1685 }
1686}
1687
1688impl CentralProxyInterface for CentralProxy {
1689 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
1690 ChannelListenerRegistryListenL2capResult,
1691 fidl::encoding::DefaultFuchsiaResourceDialect,
1692 >;
1693 fn r#listen_l2cap(
1694 &self,
1695 mut payload: ChannelListenerRegistryListenL2capRequest,
1696 ) -> Self::ListenL2capResponseFut {
1697 fn _decode(
1698 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1699 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1700 let _response = fidl::client::decode_transaction_body::<
1701 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1702 fidl::encoding::DefaultFuchsiaResourceDialect,
1703 0x39c6e9001d102338,
1704 >(_buf?)?;
1705 Ok(_response.map(|x| x))
1706 }
1707 self.client.send_query_and_decode::<
1708 ChannelListenerRegistryListenL2capRequest,
1709 ChannelListenerRegistryListenL2capResult,
1710 >(
1711 &mut payload,
1712 0x39c6e9001d102338,
1713 fidl::encoding::DynamicFlags::empty(),
1714 _decode,
1715 )
1716 }
1717
1718 type ScanResponseFut =
1719 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1720 fn r#scan(
1721 &self,
1722 mut options: &ScanOptions,
1723 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1724 ) -> Self::ScanResponseFut {
1725 fn _decode(
1726 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1727 ) -> Result<(), fidl::Error> {
1728 let _response = fidl::client::decode_transaction_body::<
1729 fidl::encoding::EmptyPayload,
1730 fidl::encoding::DefaultFuchsiaResourceDialect,
1731 0x41f7121798dfe15f,
1732 >(_buf?)?;
1733 Ok(_response)
1734 }
1735 self.client.send_query_and_decode::<CentralScanRequest, ()>(
1736 (options, result_watcher),
1737 0x41f7121798dfe15f,
1738 fidl::encoding::DynamicFlags::empty(),
1739 _decode,
1740 )
1741 }
1742
1743 fn r#connect(
1744 &self,
1745 mut id: &fidl_fuchsia_bluetooth::PeerId,
1746 mut options: &ConnectionOptions,
1747 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1748 ) -> Result<(), fidl::Error> {
1749 self.client.send::<CentralConnectRequest>(
1750 (id, options, handle),
1751 0x31a3065f2a6913c4,
1752 fidl::encoding::DynamicFlags::empty(),
1753 )
1754 }
1755
1756 fn r#sync_to_periodic_advertising(
1757 &self,
1758 mut payload: CentralSyncToPeriodicAdvertisingRequest,
1759 ) -> Result<(), fidl::Error> {
1760 self.client.send::<CentralSyncToPeriodicAdvertisingRequest>(
1761 &mut payload,
1762 0x1db6df126a00c5b9,
1763 fidl::encoding::DynamicFlags::empty(),
1764 )
1765 }
1766
1767 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
1768 CentralCreateConnectedIsochronousGroupResult,
1769 fidl::encoding::DefaultFuchsiaResourceDialect,
1770 >;
1771 fn r#create_connected_isochronous_group(
1772 &self,
1773 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1774 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
1775 fn _decode(
1776 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1777 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1778 let _response = fidl::client::decode_transaction_body::<
1779 fidl::encoding::ResultType<
1780 CentralCreateConnectedIsochronousGroupResponse,
1781 CreateCigError,
1782 >,
1783 fidl::encoding::DefaultFuchsiaResourceDialect,
1784 0x60323e70ae22e13,
1785 >(_buf?)?;
1786 Ok(_response.map(|x| x))
1787 }
1788 self.client.send_query_and_decode::<
1789 CentralCreateConnectedIsochronousGroupRequest,
1790 CentralCreateConnectedIsochronousGroupResult,
1791 >(
1792 &mut payload,
1793 0x60323e70ae22e13,
1794 fidl::encoding::DynamicFlags::empty(),
1795 _decode,
1796 )
1797 }
1798
1799 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
1800 Vec<RemoteDevice>,
1801 fidl::encoding::DefaultFuchsiaResourceDialect,
1802 >;
1803 fn r#get_peripherals(
1804 &self,
1805 mut service_uuids: Option<&[String]>,
1806 ) -> Self::GetPeripheralsResponseFut {
1807 fn _decode(
1808 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1809 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1810 let _response = fidl::client::decode_transaction_body::<
1811 CentralGetPeripheralsResponse,
1812 fidl::encoding::DefaultFuchsiaResourceDialect,
1813 0x37ba777499c683a8,
1814 >(_buf?)?;
1815 Ok(_response.peripherals)
1816 }
1817 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
1818 (service_uuids,),
1819 0x37ba777499c683a8,
1820 fidl::encoding::DynamicFlags::empty(),
1821 _decode,
1822 )
1823 }
1824
1825 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
1826 Option<Box<RemoteDevice>>,
1827 fidl::encoding::DefaultFuchsiaResourceDialect,
1828 >;
1829 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
1830 fn _decode(
1831 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1832 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1833 let _response = fidl::client::decode_transaction_body::<
1834 CentralGetPeripheralResponse,
1835 fidl::encoding::DefaultFuchsiaResourceDialect,
1836 0x97f5a2f2d9c13da,
1837 >(_buf?)?;
1838 Ok(_response.peripheral)
1839 }
1840 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
1841 (identifier,),
1842 0x97f5a2f2d9c13da,
1843 fidl::encoding::DynamicFlags::empty(),
1844 _decode,
1845 )
1846 }
1847
1848 type StartScanResponseFut = fidl::client::QueryResponseFut<
1849 fidl_fuchsia_bluetooth::Status,
1850 fidl::encoding::DefaultFuchsiaResourceDialect,
1851 >;
1852 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
1853 fn _decode(
1854 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1855 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1856 let _response = fidl::client::decode_transaction_body::<
1857 CentralStartScanResponse,
1858 fidl::encoding::DefaultFuchsiaResourceDialect,
1859 0xeb4cf0cd0e1132b,
1860 >(_buf?)?;
1861 Ok(_response.status)
1862 }
1863 self.client
1864 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
1865 (filter,),
1866 0xeb4cf0cd0e1132b,
1867 fidl::encoding::DynamicFlags::empty(),
1868 _decode,
1869 )
1870 }
1871
1872 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1873 self.client.send::<fidl::encoding::EmptyPayload>(
1874 (),
1875 0x5f79ee6a0bb037a0,
1876 fidl::encoding::DynamicFlags::empty(),
1877 )
1878 }
1879
1880 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1881 fidl_fuchsia_bluetooth::Status,
1882 fidl::encoding::DefaultFuchsiaResourceDialect,
1883 >;
1884 fn r#connect_peripheral(
1885 &self,
1886 mut identifier: &str,
1887 mut options: &ConnectionOptions,
1888 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1889 ) -> Self::ConnectPeripheralResponseFut {
1890 fn _decode(
1891 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1892 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1893 let _response = fidl::client::decode_transaction_body::<
1894 CentralConnectPeripheralResponse,
1895 fidl::encoding::DefaultFuchsiaResourceDialect,
1896 0x714d6c32d066d75a,
1897 >(_buf?)?;
1898 Ok(_response.status)
1899 }
1900 self.client.send_query_and_decode::<
1901 CentralConnectPeripheralRequest,
1902 fidl_fuchsia_bluetooth::Status,
1903 >(
1904 (identifier, options, gatt_client,),
1905 0x714d6c32d066d75a,
1906 fidl::encoding::DynamicFlags::empty(),
1907 _decode,
1908 )
1909 }
1910
1911 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1912 fidl_fuchsia_bluetooth::Status,
1913 fidl::encoding::DefaultFuchsiaResourceDialect,
1914 >;
1915 fn r#disconnect_peripheral(
1916 &self,
1917 mut identifier: &str,
1918 ) -> Self::DisconnectPeripheralResponseFut {
1919 fn _decode(
1920 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1921 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1922 let _response = fidl::client::decode_transaction_body::<
1923 CentralDisconnectPeripheralResponse,
1924 fidl::encoding::DefaultFuchsiaResourceDialect,
1925 0xa9430da197362fd,
1926 >(_buf?)?;
1927 Ok(_response.status)
1928 }
1929 self.client.send_query_and_decode::<
1930 CentralDisconnectPeripheralRequest,
1931 fidl_fuchsia_bluetooth::Status,
1932 >(
1933 (identifier,),
1934 0xa9430da197362fd,
1935 fidl::encoding::DynamicFlags::empty(),
1936 _decode,
1937 )
1938 }
1939}
1940
1941pub struct CentralEventStream {
1942 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1943}
1944
1945impl std::marker::Unpin for CentralEventStream {}
1946
1947impl futures::stream::FusedStream for CentralEventStream {
1948 fn is_terminated(&self) -> bool {
1949 self.event_receiver.is_terminated()
1950 }
1951}
1952
1953impl futures::Stream for CentralEventStream {
1954 type Item = Result<CentralEvent, fidl::Error>;
1955
1956 fn poll_next(
1957 mut self: std::pin::Pin<&mut Self>,
1958 cx: &mut std::task::Context<'_>,
1959 ) -> std::task::Poll<Option<Self::Item>> {
1960 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1961 &mut self.event_receiver,
1962 cx
1963 )?) {
1964 Some(buf) => std::task::Poll::Ready(Some(CentralEvent::decode(buf))),
1965 None => std::task::Poll::Ready(None),
1966 }
1967 }
1968}
1969
1970#[derive(Debug)]
1971pub enum CentralEvent {
1972 OnScanStateChanged { scanning: bool },
1973 OnDeviceDiscovered { device: RemoteDevice },
1974 OnPeripheralDisconnected { identifier: String },
1975}
1976
1977impl CentralEvent {
1978 #[allow(irrefutable_let_patterns)]
1979 pub fn into_on_scan_state_changed(self) -> Option<bool> {
1980 if let CentralEvent::OnScanStateChanged { scanning } = self {
1981 Some((scanning))
1982 } else {
1983 None
1984 }
1985 }
1986 #[allow(irrefutable_let_patterns)]
1987 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
1988 if let CentralEvent::OnDeviceDiscovered { device } = self {
1989 Some((device))
1990 } else {
1991 None
1992 }
1993 }
1994 #[allow(irrefutable_let_patterns)]
1995 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
1996 if let CentralEvent::OnPeripheralDisconnected { identifier } = self {
1997 Some((identifier))
1998 } else {
1999 None
2000 }
2001 }
2002
2003 fn decode(
2005 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2006 ) -> Result<CentralEvent, fidl::Error> {
2007 let (bytes, _handles) = buf.split_mut();
2008 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2009 debug_assert_eq!(tx_header.tx_id, 0);
2010 match tx_header.ordinal {
2011 0x5f8edc23cad04d3f => {
2012 let mut out = fidl::new_empty!(
2013 CentralOnScanStateChangedRequest,
2014 fidl::encoding::DefaultFuchsiaResourceDialect
2015 );
2016 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2017 Ok((CentralEvent::OnScanStateChanged { scanning: out.scanning }))
2018 }
2019 0x708dadf20d66db6 => {
2020 let mut out = fidl::new_empty!(
2021 CentralOnDeviceDiscoveredRequest,
2022 fidl::encoding::DefaultFuchsiaResourceDialect
2023 );
2024 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2025 Ok((CentralEvent::OnDeviceDiscovered { device: out.device }))
2026 }
2027 0x4e4c6b979b2126df => {
2028 let mut out = fidl::new_empty!(
2029 CentralOnPeripheralDisconnectedRequest,
2030 fidl::encoding::DefaultFuchsiaResourceDialect
2031 );
2032 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2033 Ok((CentralEvent::OnPeripheralDisconnected { identifier: out.identifier }))
2034 }
2035 _ => Err(fidl::Error::UnknownOrdinal {
2036 ordinal: tx_header.ordinal,
2037 protocol_name: <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2038 }),
2039 }
2040 }
2041}
2042
2043pub struct CentralRequestStream {
2045 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2046 is_terminated: bool,
2047}
2048
2049impl std::marker::Unpin for CentralRequestStream {}
2050
2051impl futures::stream::FusedStream for CentralRequestStream {
2052 fn is_terminated(&self) -> bool {
2053 self.is_terminated
2054 }
2055}
2056
2057impl fidl::endpoints::RequestStream for CentralRequestStream {
2058 type Protocol = CentralMarker;
2059 type ControlHandle = CentralControlHandle;
2060
2061 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2062 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2063 }
2064
2065 fn control_handle(&self) -> Self::ControlHandle {
2066 CentralControlHandle { inner: self.inner.clone() }
2067 }
2068
2069 fn into_inner(
2070 self,
2071 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2072 {
2073 (self.inner, self.is_terminated)
2074 }
2075
2076 fn from_inner(
2077 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2078 is_terminated: bool,
2079 ) -> Self {
2080 Self { inner, is_terminated }
2081 }
2082}
2083
2084impl futures::Stream for CentralRequestStream {
2085 type Item = Result<CentralRequest, fidl::Error>;
2086
2087 fn poll_next(
2088 mut self: std::pin::Pin<&mut Self>,
2089 cx: &mut std::task::Context<'_>,
2090 ) -> std::task::Poll<Option<Self::Item>> {
2091 let this = &mut *self;
2092 if this.inner.check_shutdown(cx) {
2093 this.is_terminated = true;
2094 return std::task::Poll::Ready(None);
2095 }
2096 if this.is_terminated {
2097 panic!("polled CentralRequestStream after completion");
2098 }
2099 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2100 |bytes, handles| {
2101 match this.inner.channel().read_etc(cx, bytes, handles) {
2102 std::task::Poll::Ready(Ok(())) => {}
2103 std::task::Poll::Pending => return std::task::Poll::Pending,
2104 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2105 this.is_terminated = true;
2106 return std::task::Poll::Ready(None);
2107 }
2108 std::task::Poll::Ready(Err(e)) => {
2109 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2110 e.into(),
2111 ))))
2112 }
2113 }
2114
2115 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2117
2118 std::task::Poll::Ready(Some(match header.ordinal {
2119 0x39c6e9001d102338 => {
2120 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2121 let mut req = fidl::new_empty!(
2122 ChannelListenerRegistryListenL2capRequest,
2123 fidl::encoding::DefaultFuchsiaResourceDialect
2124 );
2125 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
2126 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2127 Ok(CentralRequest::ListenL2cap {
2128 payload: req,
2129 responder: CentralListenL2capResponder {
2130 control_handle: std::mem::ManuallyDrop::new(control_handle),
2131 tx_id: header.tx_id,
2132 },
2133 })
2134 }
2135 0x41f7121798dfe15f => {
2136 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2137 let mut req = fidl::new_empty!(
2138 CentralScanRequest,
2139 fidl::encoding::DefaultFuchsiaResourceDialect
2140 );
2141 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
2142 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2143 Ok(CentralRequest::Scan {
2144 options: req.options,
2145 result_watcher: req.result_watcher,
2146
2147 responder: CentralScanResponder {
2148 control_handle: std::mem::ManuallyDrop::new(control_handle),
2149 tx_id: header.tx_id,
2150 },
2151 })
2152 }
2153 0x31a3065f2a6913c4 => {
2154 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2155 let mut req = fidl::new_empty!(
2156 CentralConnectRequest,
2157 fidl::encoding::DefaultFuchsiaResourceDialect
2158 );
2159 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2160 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2161 Ok(CentralRequest::Connect {
2162 id: req.id,
2163 options: req.options,
2164 handle: req.handle,
2165
2166 control_handle,
2167 })
2168 }
2169 0x1db6df126a00c5b9 => {
2170 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2171 let mut req = fidl::new_empty!(
2172 CentralSyncToPeriodicAdvertisingRequest,
2173 fidl::encoding::DefaultFuchsiaResourceDialect
2174 );
2175 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralSyncToPeriodicAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
2176 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2177 Ok(CentralRequest::SyncToPeriodicAdvertising {
2178 payload: req,
2179 control_handle,
2180 })
2181 }
2182 0x60323e70ae22e13 => {
2183 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2184 let mut req = fidl::new_empty!(
2185 CentralCreateConnectedIsochronousGroupRequest,
2186 fidl::encoding::DefaultFuchsiaResourceDialect
2187 );
2188 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
2189 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2190 Ok(CentralRequest::CreateConnectedIsochronousGroup {
2191 payload: req,
2192 responder: CentralCreateConnectedIsochronousGroupResponder {
2193 control_handle: std::mem::ManuallyDrop::new(control_handle),
2194 tx_id: header.tx_id,
2195 },
2196 })
2197 }
2198 0x37ba777499c683a8 => {
2199 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2200 let mut req = fidl::new_empty!(
2201 CentralGetPeripheralsRequest,
2202 fidl::encoding::DefaultFuchsiaResourceDialect
2203 );
2204 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
2205 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2206 Ok(CentralRequest::GetPeripherals {
2207 service_uuids: req.service_uuids,
2208
2209 responder: CentralGetPeripheralsResponder {
2210 control_handle: std::mem::ManuallyDrop::new(control_handle),
2211 tx_id: header.tx_id,
2212 },
2213 })
2214 }
2215 0x97f5a2f2d9c13da => {
2216 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2217 let mut req = fidl::new_empty!(
2218 CentralGetPeripheralRequest,
2219 fidl::encoding::DefaultFuchsiaResourceDialect
2220 );
2221 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2222 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2223 Ok(CentralRequest::GetPeripheral {
2224 identifier: req.identifier,
2225
2226 responder: CentralGetPeripheralResponder {
2227 control_handle: std::mem::ManuallyDrop::new(control_handle),
2228 tx_id: header.tx_id,
2229 },
2230 })
2231 }
2232 0xeb4cf0cd0e1132b => {
2233 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2234 let mut req = fidl::new_empty!(
2235 CentralStartScanRequest,
2236 fidl::encoding::DefaultFuchsiaResourceDialect
2237 );
2238 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
2239 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2240 Ok(CentralRequest::StartScan {
2241 filter: req.filter,
2242
2243 responder: CentralStartScanResponder {
2244 control_handle: std::mem::ManuallyDrop::new(control_handle),
2245 tx_id: header.tx_id,
2246 },
2247 })
2248 }
2249 0x5f79ee6a0bb037a0 => {
2250 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2251 let mut req = fidl::new_empty!(
2252 fidl::encoding::EmptyPayload,
2253 fidl::encoding::DefaultFuchsiaResourceDialect
2254 );
2255 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2256 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2257 Ok(CentralRequest::StopScan { control_handle })
2258 }
2259 0x714d6c32d066d75a => {
2260 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2261 let mut req = fidl::new_empty!(
2262 CentralConnectPeripheralRequest,
2263 fidl::encoding::DefaultFuchsiaResourceDialect
2264 );
2265 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2266 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2267 Ok(CentralRequest::ConnectPeripheral {
2268 identifier: req.identifier,
2269 options: req.options,
2270 gatt_client: req.gatt_client,
2271
2272 responder: CentralConnectPeripheralResponder {
2273 control_handle: std::mem::ManuallyDrop::new(control_handle),
2274 tx_id: header.tx_id,
2275 },
2276 })
2277 }
2278 0xa9430da197362fd => {
2279 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2280 let mut req = fidl::new_empty!(
2281 CentralDisconnectPeripheralRequest,
2282 fidl::encoding::DefaultFuchsiaResourceDialect
2283 );
2284 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2285 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2286 Ok(CentralRequest::DisconnectPeripheral {
2287 identifier: req.identifier,
2288
2289 responder: CentralDisconnectPeripheralResponder {
2290 control_handle: std::mem::ManuallyDrop::new(control_handle),
2291 tx_id: header.tx_id,
2292 },
2293 })
2294 }
2295 _ => Err(fidl::Error::UnknownOrdinal {
2296 ordinal: header.ordinal,
2297 protocol_name:
2298 <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2299 }),
2300 }))
2301 },
2302 )
2303 }
2304}
2305
2306#[derive(Debug)]
2307pub enum CentralRequest {
2308 ListenL2cap {
2318 payload: ChannelListenerRegistryListenL2capRequest,
2319 responder: CentralListenL2capResponder,
2320 },
2321 Scan {
2348 options: ScanOptions,
2349 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2350 responder: CentralScanResponder,
2351 },
2352 Connect {
2374 id: fidl_fuchsia_bluetooth::PeerId,
2375 options: ConnectionOptions,
2376 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
2377 control_handle: CentralControlHandle,
2378 },
2379 SyncToPeriodicAdvertising {
2382 payload: CentralSyncToPeriodicAdvertisingRequest,
2383 control_handle: CentralControlHandle,
2384 },
2385 CreateConnectedIsochronousGroup {
2394 payload: CentralCreateConnectedIsochronousGroupRequest,
2395 responder: CentralCreateConnectedIsochronousGroupResponder,
2396 },
2397 GetPeripherals { service_uuids: Option<Vec<String>>, responder: CentralGetPeripheralsResponder },
2403 GetPeripheral { identifier: String, responder: CentralGetPeripheralResponder },
2409 StartScan { filter: Option<Box<ScanFilter>>, responder: CentralStartScanResponder },
2418 StopScan { control_handle: CentralControlHandle },
2420 ConnectPeripheral {
2427 identifier: String,
2428 options: ConnectionOptions,
2429 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2430 responder: CentralConnectPeripheralResponder,
2431 },
2432 DisconnectPeripheral { identifier: String, responder: CentralDisconnectPeripheralResponder },
2434}
2435
2436impl CentralRequest {
2437 #[allow(irrefutable_let_patterns)]
2438 pub fn into_listen_l2cap(
2439 self,
2440 ) -> Option<(ChannelListenerRegistryListenL2capRequest, CentralListenL2capResponder)> {
2441 if let CentralRequest::ListenL2cap { payload, responder } = self {
2442 Some((payload, responder))
2443 } else {
2444 None
2445 }
2446 }
2447
2448 #[allow(irrefutable_let_patterns)]
2449 pub fn into_scan(
2450 self,
2451 ) -> Option<(
2452 ScanOptions,
2453 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2454 CentralScanResponder,
2455 )> {
2456 if let CentralRequest::Scan { options, result_watcher, responder } = self {
2457 Some((options, result_watcher, responder))
2458 } else {
2459 None
2460 }
2461 }
2462
2463 #[allow(irrefutable_let_patterns)]
2464 pub fn into_connect(
2465 self,
2466 ) -> Option<(
2467 fidl_fuchsia_bluetooth::PeerId,
2468 ConnectionOptions,
2469 fidl::endpoints::ServerEnd<ConnectionMarker>,
2470 CentralControlHandle,
2471 )> {
2472 if let CentralRequest::Connect { id, options, handle, control_handle } = self {
2473 Some((id, options, handle, control_handle))
2474 } else {
2475 None
2476 }
2477 }
2478
2479 #[allow(irrefutable_let_patterns)]
2480 pub fn into_sync_to_periodic_advertising(
2481 self,
2482 ) -> Option<(CentralSyncToPeriodicAdvertisingRequest, CentralControlHandle)> {
2483 if let CentralRequest::SyncToPeriodicAdvertising { payload, control_handle } = self {
2484 Some((payload, control_handle))
2485 } else {
2486 None
2487 }
2488 }
2489
2490 #[allow(irrefutable_let_patterns)]
2491 pub fn into_create_connected_isochronous_group(
2492 self,
2493 ) -> Option<(
2494 CentralCreateConnectedIsochronousGroupRequest,
2495 CentralCreateConnectedIsochronousGroupResponder,
2496 )> {
2497 if let CentralRequest::CreateConnectedIsochronousGroup { payload, responder } = self {
2498 Some((payload, responder))
2499 } else {
2500 None
2501 }
2502 }
2503
2504 #[allow(irrefutable_let_patterns)]
2505 pub fn into_get_peripherals(
2506 self,
2507 ) -> Option<(Option<Vec<String>>, CentralGetPeripheralsResponder)> {
2508 if let CentralRequest::GetPeripherals { service_uuids, responder } = self {
2509 Some((service_uuids, responder))
2510 } else {
2511 None
2512 }
2513 }
2514
2515 #[allow(irrefutable_let_patterns)]
2516 pub fn into_get_peripheral(self) -> Option<(String, CentralGetPeripheralResponder)> {
2517 if let CentralRequest::GetPeripheral { identifier, responder } = self {
2518 Some((identifier, responder))
2519 } else {
2520 None
2521 }
2522 }
2523
2524 #[allow(irrefutable_let_patterns)]
2525 pub fn into_start_scan(self) -> Option<(Option<Box<ScanFilter>>, CentralStartScanResponder)> {
2526 if let CentralRequest::StartScan { filter, responder } = self {
2527 Some((filter, responder))
2528 } else {
2529 None
2530 }
2531 }
2532
2533 #[allow(irrefutable_let_patterns)]
2534 pub fn into_stop_scan(self) -> Option<(CentralControlHandle)> {
2535 if let CentralRequest::StopScan { control_handle } = self {
2536 Some((control_handle))
2537 } else {
2538 None
2539 }
2540 }
2541
2542 #[allow(irrefutable_let_patterns)]
2543 pub fn into_connect_peripheral(
2544 self,
2545 ) -> Option<(
2546 String,
2547 ConnectionOptions,
2548 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2549 CentralConnectPeripheralResponder,
2550 )> {
2551 if let CentralRequest::ConnectPeripheral { identifier, options, gatt_client, responder } =
2552 self
2553 {
2554 Some((identifier, options, gatt_client, responder))
2555 } else {
2556 None
2557 }
2558 }
2559
2560 #[allow(irrefutable_let_patterns)]
2561 pub fn into_disconnect_peripheral(
2562 self,
2563 ) -> Option<(String, CentralDisconnectPeripheralResponder)> {
2564 if let CentralRequest::DisconnectPeripheral { identifier, responder } = self {
2565 Some((identifier, responder))
2566 } else {
2567 None
2568 }
2569 }
2570
2571 pub fn method_name(&self) -> &'static str {
2573 match *self {
2574 CentralRequest::ListenL2cap { .. } => "listen_l2cap",
2575 CentralRequest::Scan { .. } => "scan",
2576 CentralRequest::Connect { .. } => "connect",
2577 CentralRequest::SyncToPeriodicAdvertising { .. } => "sync_to_periodic_advertising",
2578 CentralRequest::CreateConnectedIsochronousGroup { .. } => {
2579 "create_connected_isochronous_group"
2580 }
2581 CentralRequest::GetPeripherals { .. } => "get_peripherals",
2582 CentralRequest::GetPeripheral { .. } => "get_peripheral",
2583 CentralRequest::StartScan { .. } => "start_scan",
2584 CentralRequest::StopScan { .. } => "stop_scan",
2585 CentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
2586 CentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
2587 }
2588 }
2589}
2590
2591#[derive(Debug, Clone)]
2592pub struct CentralControlHandle {
2593 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2594}
2595
2596impl fidl::endpoints::ControlHandle for CentralControlHandle {
2597 fn shutdown(&self) {
2598 self.inner.shutdown()
2599 }
2600 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2601 self.inner.shutdown_with_epitaph(status)
2602 }
2603
2604 fn is_closed(&self) -> bool {
2605 self.inner.channel().is_closed()
2606 }
2607 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2608 self.inner.channel().on_closed()
2609 }
2610
2611 #[cfg(target_os = "fuchsia")]
2612 fn signal_peer(
2613 &self,
2614 clear_mask: zx::Signals,
2615 set_mask: zx::Signals,
2616 ) -> Result<(), zx_status::Status> {
2617 use fidl::Peered;
2618 self.inner.channel().signal_peer(clear_mask, set_mask)
2619 }
2620}
2621
2622impl CentralControlHandle {
2623 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
2624 self.inner.send::<CentralOnScanStateChangedRequest>(
2625 (scanning,),
2626 0,
2627 0x5f8edc23cad04d3f,
2628 fidl::encoding::DynamicFlags::empty(),
2629 )
2630 }
2631
2632 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
2633 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
2634 (device,),
2635 0,
2636 0x708dadf20d66db6,
2637 fidl::encoding::DynamicFlags::empty(),
2638 )
2639 }
2640
2641 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
2642 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
2643 (identifier,),
2644 0,
2645 0x4e4c6b979b2126df,
2646 fidl::encoding::DynamicFlags::empty(),
2647 )
2648 }
2649}
2650
2651#[must_use = "FIDL methods require a response to be sent"]
2652#[derive(Debug)]
2653pub struct CentralListenL2capResponder {
2654 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2655 tx_id: u32,
2656}
2657
2658impl std::ops::Drop for CentralListenL2capResponder {
2662 fn drop(&mut self) {
2663 self.control_handle.shutdown();
2664 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2666 }
2667}
2668
2669impl fidl::endpoints::Responder for CentralListenL2capResponder {
2670 type ControlHandle = CentralControlHandle;
2671
2672 fn control_handle(&self) -> &CentralControlHandle {
2673 &self.control_handle
2674 }
2675
2676 fn drop_without_shutdown(mut self) {
2677 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2679 std::mem::forget(self);
2681 }
2682}
2683
2684impl CentralListenL2capResponder {
2685 pub fn send(
2689 self,
2690 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2691 ) -> Result<(), fidl::Error> {
2692 let _result = self.send_raw(result);
2693 if _result.is_err() {
2694 self.control_handle.shutdown();
2695 }
2696 self.drop_without_shutdown();
2697 _result
2698 }
2699
2700 pub fn send_no_shutdown_on_err(
2702 self,
2703 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2704 ) -> Result<(), fidl::Error> {
2705 let _result = self.send_raw(result);
2706 self.drop_without_shutdown();
2707 _result
2708 }
2709
2710 fn send_raw(
2711 &self,
2712 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2713 ) -> Result<(), fidl::Error> {
2714 self.control_handle.inner.send::<fidl::encoding::ResultType<
2715 ChannelListenerRegistryListenL2capResponse,
2716 i32,
2717 >>(
2718 result,
2719 self.tx_id,
2720 0x39c6e9001d102338,
2721 fidl::encoding::DynamicFlags::empty(),
2722 )
2723 }
2724}
2725
2726#[must_use = "FIDL methods require a response to be sent"]
2727#[derive(Debug)]
2728pub struct CentralScanResponder {
2729 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2730 tx_id: u32,
2731}
2732
2733impl std::ops::Drop for CentralScanResponder {
2737 fn drop(&mut self) {
2738 self.control_handle.shutdown();
2739 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2741 }
2742}
2743
2744impl fidl::endpoints::Responder for CentralScanResponder {
2745 type ControlHandle = CentralControlHandle;
2746
2747 fn control_handle(&self) -> &CentralControlHandle {
2748 &self.control_handle
2749 }
2750
2751 fn drop_without_shutdown(mut self) {
2752 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2754 std::mem::forget(self);
2756 }
2757}
2758
2759impl CentralScanResponder {
2760 pub fn send(self) -> Result<(), fidl::Error> {
2764 let _result = self.send_raw();
2765 if _result.is_err() {
2766 self.control_handle.shutdown();
2767 }
2768 self.drop_without_shutdown();
2769 _result
2770 }
2771
2772 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2774 let _result = self.send_raw();
2775 self.drop_without_shutdown();
2776 _result
2777 }
2778
2779 fn send_raw(&self) -> Result<(), fidl::Error> {
2780 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2781 (),
2782 self.tx_id,
2783 0x41f7121798dfe15f,
2784 fidl::encoding::DynamicFlags::empty(),
2785 )
2786 }
2787}
2788
2789#[must_use = "FIDL methods require a response to be sent"]
2790#[derive(Debug)]
2791pub struct CentralCreateConnectedIsochronousGroupResponder {
2792 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2793 tx_id: u32,
2794}
2795
2796impl std::ops::Drop for CentralCreateConnectedIsochronousGroupResponder {
2800 fn drop(&mut self) {
2801 self.control_handle.shutdown();
2802 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2804 }
2805}
2806
2807impl fidl::endpoints::Responder for CentralCreateConnectedIsochronousGroupResponder {
2808 type ControlHandle = CentralControlHandle;
2809
2810 fn control_handle(&self) -> &CentralControlHandle {
2811 &self.control_handle
2812 }
2813
2814 fn drop_without_shutdown(mut self) {
2815 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2817 std::mem::forget(self);
2819 }
2820}
2821
2822impl CentralCreateConnectedIsochronousGroupResponder {
2823 pub fn send(
2827 self,
2828 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2829 ) -> Result<(), fidl::Error> {
2830 let _result = self.send_raw(result);
2831 if _result.is_err() {
2832 self.control_handle.shutdown();
2833 }
2834 self.drop_without_shutdown();
2835 _result
2836 }
2837
2838 pub fn send_no_shutdown_on_err(
2840 self,
2841 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2842 ) -> Result<(), fidl::Error> {
2843 let _result = self.send_raw(result);
2844 self.drop_without_shutdown();
2845 _result
2846 }
2847
2848 fn send_raw(
2849 &self,
2850 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2851 ) -> Result<(), fidl::Error> {
2852 self.control_handle.inner.send::<fidl::encoding::ResultType<
2853 CentralCreateConnectedIsochronousGroupResponse,
2854 CreateCigError,
2855 >>(
2856 result,
2857 self.tx_id,
2858 0x60323e70ae22e13,
2859 fidl::encoding::DynamicFlags::empty(),
2860 )
2861 }
2862}
2863
2864#[must_use = "FIDL methods require a response to be sent"]
2865#[derive(Debug)]
2866pub struct CentralGetPeripheralsResponder {
2867 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2868 tx_id: u32,
2869}
2870
2871impl std::ops::Drop for CentralGetPeripheralsResponder {
2875 fn drop(&mut self) {
2876 self.control_handle.shutdown();
2877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2879 }
2880}
2881
2882impl fidl::endpoints::Responder for CentralGetPeripheralsResponder {
2883 type ControlHandle = CentralControlHandle;
2884
2885 fn control_handle(&self) -> &CentralControlHandle {
2886 &self.control_handle
2887 }
2888
2889 fn drop_without_shutdown(mut self) {
2890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2892 std::mem::forget(self);
2894 }
2895}
2896
2897impl CentralGetPeripheralsResponder {
2898 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2902 let _result = self.send_raw(peripherals);
2903 if _result.is_err() {
2904 self.control_handle.shutdown();
2905 }
2906 self.drop_without_shutdown();
2907 _result
2908 }
2909
2910 pub fn send_no_shutdown_on_err(
2912 self,
2913 mut peripherals: &[RemoteDevice],
2914 ) -> Result<(), fidl::Error> {
2915 let _result = self.send_raw(peripherals);
2916 self.drop_without_shutdown();
2917 _result
2918 }
2919
2920 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2921 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
2922 (peripherals,),
2923 self.tx_id,
2924 0x37ba777499c683a8,
2925 fidl::encoding::DynamicFlags::empty(),
2926 )
2927 }
2928}
2929
2930#[must_use = "FIDL methods require a response to be sent"]
2931#[derive(Debug)]
2932pub struct CentralGetPeripheralResponder {
2933 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2934 tx_id: u32,
2935}
2936
2937impl std::ops::Drop for CentralGetPeripheralResponder {
2941 fn drop(&mut self) {
2942 self.control_handle.shutdown();
2943 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2945 }
2946}
2947
2948impl fidl::endpoints::Responder for CentralGetPeripheralResponder {
2949 type ControlHandle = CentralControlHandle;
2950
2951 fn control_handle(&self) -> &CentralControlHandle {
2952 &self.control_handle
2953 }
2954
2955 fn drop_without_shutdown(mut self) {
2956 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2958 std::mem::forget(self);
2960 }
2961}
2962
2963impl CentralGetPeripheralResponder {
2964 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2968 let _result = self.send_raw(peripheral);
2969 if _result.is_err() {
2970 self.control_handle.shutdown();
2971 }
2972 self.drop_without_shutdown();
2973 _result
2974 }
2975
2976 pub fn send_no_shutdown_on_err(
2978 self,
2979 mut peripheral: Option<&RemoteDevice>,
2980 ) -> Result<(), fidl::Error> {
2981 let _result = self.send_raw(peripheral);
2982 self.drop_without_shutdown();
2983 _result
2984 }
2985
2986 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2987 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
2988 (peripheral,),
2989 self.tx_id,
2990 0x97f5a2f2d9c13da,
2991 fidl::encoding::DynamicFlags::empty(),
2992 )
2993 }
2994}
2995
2996#[must_use = "FIDL methods require a response to be sent"]
2997#[derive(Debug)]
2998pub struct CentralStartScanResponder {
2999 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3000 tx_id: u32,
3001}
3002
3003impl std::ops::Drop for CentralStartScanResponder {
3007 fn drop(&mut self) {
3008 self.control_handle.shutdown();
3009 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3011 }
3012}
3013
3014impl fidl::endpoints::Responder for CentralStartScanResponder {
3015 type ControlHandle = CentralControlHandle;
3016
3017 fn control_handle(&self) -> &CentralControlHandle {
3018 &self.control_handle
3019 }
3020
3021 fn drop_without_shutdown(mut self) {
3022 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3024 std::mem::forget(self);
3026 }
3027}
3028
3029impl CentralStartScanResponder {
3030 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3034 let _result = self.send_raw(status);
3035 if _result.is_err() {
3036 self.control_handle.shutdown();
3037 }
3038 self.drop_without_shutdown();
3039 _result
3040 }
3041
3042 pub fn send_no_shutdown_on_err(
3044 self,
3045 mut status: &fidl_fuchsia_bluetooth::Status,
3046 ) -> Result<(), fidl::Error> {
3047 let _result = self.send_raw(status);
3048 self.drop_without_shutdown();
3049 _result
3050 }
3051
3052 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3053 self.control_handle.inner.send::<CentralStartScanResponse>(
3054 (status,),
3055 self.tx_id,
3056 0xeb4cf0cd0e1132b,
3057 fidl::encoding::DynamicFlags::empty(),
3058 )
3059 }
3060}
3061
3062#[must_use = "FIDL methods require a response to be sent"]
3063#[derive(Debug)]
3064pub struct CentralConnectPeripheralResponder {
3065 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3066 tx_id: u32,
3067}
3068
3069impl std::ops::Drop for CentralConnectPeripheralResponder {
3073 fn drop(&mut self) {
3074 self.control_handle.shutdown();
3075 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3077 }
3078}
3079
3080impl fidl::endpoints::Responder for CentralConnectPeripheralResponder {
3081 type ControlHandle = CentralControlHandle;
3082
3083 fn control_handle(&self) -> &CentralControlHandle {
3084 &self.control_handle
3085 }
3086
3087 fn drop_without_shutdown(mut self) {
3088 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3090 std::mem::forget(self);
3092 }
3093}
3094
3095impl CentralConnectPeripheralResponder {
3096 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3100 let _result = self.send_raw(status);
3101 if _result.is_err() {
3102 self.control_handle.shutdown();
3103 }
3104 self.drop_without_shutdown();
3105 _result
3106 }
3107
3108 pub fn send_no_shutdown_on_err(
3110 self,
3111 mut status: &fidl_fuchsia_bluetooth::Status,
3112 ) -> Result<(), fidl::Error> {
3113 let _result = self.send_raw(status);
3114 self.drop_without_shutdown();
3115 _result
3116 }
3117
3118 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3119 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
3120 (status,),
3121 self.tx_id,
3122 0x714d6c32d066d75a,
3123 fidl::encoding::DynamicFlags::empty(),
3124 )
3125 }
3126}
3127
3128#[must_use = "FIDL methods require a response to be sent"]
3129#[derive(Debug)]
3130pub struct CentralDisconnectPeripheralResponder {
3131 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
3132 tx_id: u32,
3133}
3134
3135impl std::ops::Drop for CentralDisconnectPeripheralResponder {
3139 fn drop(&mut self) {
3140 self.control_handle.shutdown();
3141 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3143 }
3144}
3145
3146impl fidl::endpoints::Responder for CentralDisconnectPeripheralResponder {
3147 type ControlHandle = CentralControlHandle;
3148
3149 fn control_handle(&self) -> &CentralControlHandle {
3150 &self.control_handle
3151 }
3152
3153 fn drop_without_shutdown(mut self) {
3154 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3156 std::mem::forget(self);
3158 }
3159}
3160
3161impl CentralDisconnectPeripheralResponder {
3162 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3166 let _result = self.send_raw(status);
3167 if _result.is_err() {
3168 self.control_handle.shutdown();
3169 }
3170 self.drop_without_shutdown();
3171 _result
3172 }
3173
3174 pub fn send_no_shutdown_on_err(
3176 self,
3177 mut status: &fidl_fuchsia_bluetooth::Status,
3178 ) -> Result<(), fidl::Error> {
3179 let _result = self.send_raw(status);
3180 self.drop_without_shutdown();
3181 _result
3182 }
3183
3184 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3185 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
3186 (status,),
3187 self.tx_id,
3188 0xa9430da197362fd,
3189 fidl::encoding::DynamicFlags::empty(),
3190 )
3191 }
3192}
3193
3194#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3195pub struct ChannelListenerMarker;
3196
3197impl fidl::endpoints::ProtocolMarker for ChannelListenerMarker {
3198 type Proxy = ChannelListenerProxy;
3199 type RequestStream = ChannelListenerRequestStream;
3200 #[cfg(target_os = "fuchsia")]
3201 type SynchronousProxy = ChannelListenerSynchronousProxy;
3202
3203 const DEBUG_NAME: &'static str = "(anonymous) ChannelListener";
3204}
3205
3206pub trait ChannelListenerProxyInterface: Send + Sync {
3207 type AcceptResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3208 fn r#accept(
3209 &self,
3210 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3211 ) -> Self::AcceptResponseFut;
3212}
3213#[derive(Debug)]
3214#[cfg(target_os = "fuchsia")]
3215pub struct ChannelListenerSynchronousProxy {
3216 client: fidl::client::sync::Client,
3217}
3218
3219#[cfg(target_os = "fuchsia")]
3220impl fidl::endpoints::SynchronousProxy for ChannelListenerSynchronousProxy {
3221 type Proxy = ChannelListenerProxy;
3222 type Protocol = ChannelListenerMarker;
3223
3224 fn from_channel(inner: fidl::Channel) -> Self {
3225 Self::new(inner)
3226 }
3227
3228 fn into_channel(self) -> fidl::Channel {
3229 self.client.into_channel()
3230 }
3231
3232 fn as_channel(&self) -> &fidl::Channel {
3233 self.client.as_channel()
3234 }
3235}
3236
3237#[cfg(target_os = "fuchsia")]
3238impl ChannelListenerSynchronousProxy {
3239 pub fn new(channel: fidl::Channel) -> Self {
3240 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3241 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3242 }
3243
3244 pub fn into_channel(self) -> fidl::Channel {
3245 self.client.into_channel()
3246 }
3247
3248 pub fn wait_for_event(
3251 &self,
3252 deadline: zx::MonotonicInstant,
3253 ) -> Result<ChannelListenerEvent, fidl::Error> {
3254 ChannelListenerEvent::decode(self.client.wait_for_event(deadline)?)
3255 }
3256
3257 pub fn r#accept(
3258 &self,
3259 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3260 ___deadline: zx::MonotonicInstant,
3261 ) -> Result<(), fidl::Error> {
3262 let _response = self.client.send_query::<
3263 ChannelListenerAcceptRequest,
3264 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3265 >(
3266 (channel,),
3267 0x6f535bd36b20fc7b,
3268 fidl::encoding::DynamicFlags::FLEXIBLE,
3269 ___deadline,
3270 )?
3271 .into_result::<ChannelListenerMarker>("accept")?;
3272 Ok(_response)
3273 }
3274}
3275
3276#[cfg(target_os = "fuchsia")]
3277impl From<ChannelListenerSynchronousProxy> for zx::Handle {
3278 fn from(value: ChannelListenerSynchronousProxy) -> Self {
3279 value.into_channel().into()
3280 }
3281}
3282
3283#[cfg(target_os = "fuchsia")]
3284impl From<fidl::Channel> for ChannelListenerSynchronousProxy {
3285 fn from(value: fidl::Channel) -> Self {
3286 Self::new(value)
3287 }
3288}
3289
3290#[cfg(target_os = "fuchsia")]
3291impl fidl::endpoints::FromClient for ChannelListenerSynchronousProxy {
3292 type Protocol = ChannelListenerMarker;
3293
3294 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerMarker>) -> Self {
3295 Self::new(value.into_channel())
3296 }
3297}
3298
3299#[derive(Debug, Clone)]
3300pub struct ChannelListenerProxy {
3301 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3302}
3303
3304impl fidl::endpoints::Proxy for ChannelListenerProxy {
3305 type Protocol = ChannelListenerMarker;
3306
3307 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3308 Self::new(inner)
3309 }
3310
3311 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3312 self.client.into_channel().map_err(|client| Self { client })
3313 }
3314
3315 fn as_channel(&self) -> &::fidl::AsyncChannel {
3316 self.client.as_channel()
3317 }
3318}
3319
3320impl ChannelListenerProxy {
3321 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3323 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3324 Self { client: fidl::client::Client::new(channel, protocol_name) }
3325 }
3326
3327 pub fn take_event_stream(&self) -> ChannelListenerEventStream {
3333 ChannelListenerEventStream { event_receiver: self.client.take_event_receiver() }
3334 }
3335
3336 pub fn r#accept(
3337 &self,
3338 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3339 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3340 ChannelListenerProxyInterface::r#accept(self, channel)
3341 }
3342}
3343
3344impl ChannelListenerProxyInterface for ChannelListenerProxy {
3345 type AcceptResponseFut =
3346 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3347 fn r#accept(
3348 &self,
3349 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3350 ) -> Self::AcceptResponseFut {
3351 fn _decode(
3352 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3353 ) -> Result<(), fidl::Error> {
3354 let _response = fidl::client::decode_transaction_body::<
3355 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3356 fidl::encoding::DefaultFuchsiaResourceDialect,
3357 0x6f535bd36b20fc7b,
3358 >(_buf?)?
3359 .into_result::<ChannelListenerMarker>("accept")?;
3360 Ok(_response)
3361 }
3362 self.client.send_query_and_decode::<ChannelListenerAcceptRequest, ()>(
3363 (channel,),
3364 0x6f535bd36b20fc7b,
3365 fidl::encoding::DynamicFlags::FLEXIBLE,
3366 _decode,
3367 )
3368 }
3369}
3370
3371pub struct ChannelListenerEventStream {
3372 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3373}
3374
3375impl std::marker::Unpin for ChannelListenerEventStream {}
3376
3377impl futures::stream::FusedStream for ChannelListenerEventStream {
3378 fn is_terminated(&self) -> bool {
3379 self.event_receiver.is_terminated()
3380 }
3381}
3382
3383impl futures::Stream for ChannelListenerEventStream {
3384 type Item = Result<ChannelListenerEvent, fidl::Error>;
3385
3386 fn poll_next(
3387 mut self: std::pin::Pin<&mut Self>,
3388 cx: &mut std::task::Context<'_>,
3389 ) -> std::task::Poll<Option<Self::Item>> {
3390 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3391 &mut self.event_receiver,
3392 cx
3393 )?) {
3394 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerEvent::decode(buf))),
3395 None => std::task::Poll::Ready(None),
3396 }
3397 }
3398}
3399
3400#[derive(Debug)]
3401pub enum ChannelListenerEvent {
3402 #[non_exhaustive]
3403 _UnknownEvent {
3404 ordinal: u64,
3406 },
3407}
3408
3409impl ChannelListenerEvent {
3410 fn decode(
3412 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3413 ) -> Result<ChannelListenerEvent, fidl::Error> {
3414 let (bytes, _handles) = buf.split_mut();
3415 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3416 debug_assert_eq!(tx_header.tx_id, 0);
3417 match tx_header.ordinal {
3418 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3419 Ok(ChannelListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3420 }
3421 _ => Err(fidl::Error::UnknownOrdinal {
3422 ordinal: tx_header.ordinal,
3423 protocol_name:
3424 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3425 }),
3426 }
3427 }
3428}
3429
3430pub struct ChannelListenerRequestStream {
3432 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3433 is_terminated: bool,
3434}
3435
3436impl std::marker::Unpin for ChannelListenerRequestStream {}
3437
3438impl futures::stream::FusedStream for ChannelListenerRequestStream {
3439 fn is_terminated(&self) -> bool {
3440 self.is_terminated
3441 }
3442}
3443
3444impl fidl::endpoints::RequestStream for ChannelListenerRequestStream {
3445 type Protocol = ChannelListenerMarker;
3446 type ControlHandle = ChannelListenerControlHandle;
3447
3448 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3449 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3450 }
3451
3452 fn control_handle(&self) -> Self::ControlHandle {
3453 ChannelListenerControlHandle { inner: self.inner.clone() }
3454 }
3455
3456 fn into_inner(
3457 self,
3458 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3459 {
3460 (self.inner, self.is_terminated)
3461 }
3462
3463 fn from_inner(
3464 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3465 is_terminated: bool,
3466 ) -> Self {
3467 Self { inner, is_terminated }
3468 }
3469}
3470
3471impl futures::Stream for ChannelListenerRequestStream {
3472 type Item = Result<ChannelListenerRequest, fidl::Error>;
3473
3474 fn poll_next(
3475 mut self: std::pin::Pin<&mut Self>,
3476 cx: &mut std::task::Context<'_>,
3477 ) -> std::task::Poll<Option<Self::Item>> {
3478 let this = &mut *self;
3479 if this.inner.check_shutdown(cx) {
3480 this.is_terminated = true;
3481 return std::task::Poll::Ready(None);
3482 }
3483 if this.is_terminated {
3484 panic!("polled ChannelListenerRequestStream after completion");
3485 }
3486 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3487 |bytes, handles| {
3488 match this.inner.channel().read_etc(cx, bytes, handles) {
3489 std::task::Poll::Ready(Ok(())) => {}
3490 std::task::Poll::Pending => return std::task::Poll::Pending,
3491 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3492 this.is_terminated = true;
3493 return std::task::Poll::Ready(None);
3494 }
3495 std::task::Poll::Ready(Err(e)) => {
3496 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3497 e.into(),
3498 ))))
3499 }
3500 }
3501
3502 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3504
3505 std::task::Poll::Ready(Some(match header.ordinal {
3506 0x6f535bd36b20fc7b => {
3507 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3508 let mut req = fidl::new_empty!(
3509 ChannelListenerAcceptRequest,
3510 fidl::encoding::DefaultFuchsiaResourceDialect
3511 );
3512 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
3513 let control_handle =
3514 ChannelListenerControlHandle { inner: this.inner.clone() };
3515 Ok(ChannelListenerRequest::Accept {
3516 channel: req.channel,
3517
3518 responder: ChannelListenerAcceptResponder {
3519 control_handle: std::mem::ManuallyDrop::new(control_handle),
3520 tx_id: header.tx_id,
3521 },
3522 })
3523 }
3524 _ if header.tx_id == 0
3525 && header
3526 .dynamic_flags()
3527 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3528 {
3529 Ok(ChannelListenerRequest::_UnknownMethod {
3530 ordinal: header.ordinal,
3531 control_handle: ChannelListenerControlHandle {
3532 inner: this.inner.clone(),
3533 },
3534 method_type: fidl::MethodType::OneWay,
3535 })
3536 }
3537 _ if header
3538 .dynamic_flags()
3539 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3540 {
3541 this.inner.send_framework_err(
3542 fidl::encoding::FrameworkErr::UnknownMethod,
3543 header.tx_id,
3544 header.ordinal,
3545 header.dynamic_flags(),
3546 (bytes, handles),
3547 )?;
3548 Ok(ChannelListenerRequest::_UnknownMethod {
3549 ordinal: header.ordinal,
3550 control_handle: ChannelListenerControlHandle {
3551 inner: this.inner.clone(),
3552 },
3553 method_type: fidl::MethodType::TwoWay,
3554 })
3555 }
3556 _ => Err(fidl::Error::UnknownOrdinal {
3557 ordinal: header.ordinal,
3558 protocol_name:
3559 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3560 }),
3561 }))
3562 },
3563 )
3564 }
3565}
3566
3567#[derive(Debug)]
3574pub enum ChannelListenerRequest {
3575 Accept {
3576 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3577 responder: ChannelListenerAcceptResponder,
3578 },
3579 #[non_exhaustive]
3581 _UnknownMethod {
3582 ordinal: u64,
3584 control_handle: ChannelListenerControlHandle,
3585 method_type: fidl::MethodType,
3586 },
3587}
3588
3589impl ChannelListenerRequest {
3590 #[allow(irrefutable_let_patterns)]
3591 pub fn into_accept(
3592 self,
3593 ) -> Option<(
3594 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3595 ChannelListenerAcceptResponder,
3596 )> {
3597 if let ChannelListenerRequest::Accept { channel, responder } = self {
3598 Some((channel, responder))
3599 } else {
3600 None
3601 }
3602 }
3603
3604 pub fn method_name(&self) -> &'static str {
3606 match *self {
3607 ChannelListenerRequest::Accept { .. } => "accept",
3608 ChannelListenerRequest::_UnknownMethod {
3609 method_type: fidl::MethodType::OneWay,
3610 ..
3611 } => "unknown one-way method",
3612 ChannelListenerRequest::_UnknownMethod {
3613 method_type: fidl::MethodType::TwoWay,
3614 ..
3615 } => "unknown two-way method",
3616 }
3617 }
3618}
3619
3620#[derive(Debug, Clone)]
3621pub struct ChannelListenerControlHandle {
3622 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3623}
3624
3625impl fidl::endpoints::ControlHandle for ChannelListenerControlHandle {
3626 fn shutdown(&self) {
3627 self.inner.shutdown()
3628 }
3629 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3630 self.inner.shutdown_with_epitaph(status)
3631 }
3632
3633 fn is_closed(&self) -> bool {
3634 self.inner.channel().is_closed()
3635 }
3636 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3637 self.inner.channel().on_closed()
3638 }
3639
3640 #[cfg(target_os = "fuchsia")]
3641 fn signal_peer(
3642 &self,
3643 clear_mask: zx::Signals,
3644 set_mask: zx::Signals,
3645 ) -> Result<(), zx_status::Status> {
3646 use fidl::Peered;
3647 self.inner.channel().signal_peer(clear_mask, set_mask)
3648 }
3649}
3650
3651impl ChannelListenerControlHandle {}
3652
3653#[must_use = "FIDL methods require a response to be sent"]
3654#[derive(Debug)]
3655pub struct ChannelListenerAcceptResponder {
3656 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3657 tx_id: u32,
3658}
3659
3660impl std::ops::Drop for ChannelListenerAcceptResponder {
3664 fn drop(&mut self) {
3665 self.control_handle.shutdown();
3666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3668 }
3669}
3670
3671impl fidl::endpoints::Responder for ChannelListenerAcceptResponder {
3672 type ControlHandle = ChannelListenerControlHandle;
3673
3674 fn control_handle(&self) -> &ChannelListenerControlHandle {
3675 &self.control_handle
3676 }
3677
3678 fn drop_without_shutdown(mut self) {
3679 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3681 std::mem::forget(self);
3683 }
3684}
3685
3686impl ChannelListenerAcceptResponder {
3687 pub fn send(self) -> Result<(), fidl::Error> {
3691 let _result = self.send_raw();
3692 if _result.is_err() {
3693 self.control_handle.shutdown();
3694 }
3695 self.drop_without_shutdown();
3696 _result
3697 }
3698
3699 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3701 let _result = self.send_raw();
3702 self.drop_without_shutdown();
3703 _result
3704 }
3705
3706 fn send_raw(&self) -> Result<(), fidl::Error> {
3707 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3708 fidl::encoding::Flexible::new(()),
3709 self.tx_id,
3710 0x6f535bd36b20fc7b,
3711 fidl::encoding::DynamicFlags::FLEXIBLE,
3712 )
3713 }
3714}
3715
3716#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3717pub struct ChannelListenerRegistryMarker;
3718
3719impl fidl::endpoints::ProtocolMarker for ChannelListenerRegistryMarker {
3720 type Proxy = ChannelListenerRegistryProxy;
3721 type RequestStream = ChannelListenerRegistryRequestStream;
3722 #[cfg(target_os = "fuchsia")]
3723 type SynchronousProxy = ChannelListenerRegistrySynchronousProxy;
3724
3725 const DEBUG_NAME: &'static str = "(anonymous) ChannelListenerRegistry";
3726}
3727pub type ChannelListenerRegistryListenL2capResult =
3728 Result<ChannelListenerRegistryListenL2capResponse, i32>;
3729
3730pub trait ChannelListenerRegistryProxyInterface: Send + Sync {
3731 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
3732 + Send;
3733 fn r#listen_l2cap(
3734 &self,
3735 payload: ChannelListenerRegistryListenL2capRequest,
3736 ) -> Self::ListenL2capResponseFut;
3737}
3738#[derive(Debug)]
3739#[cfg(target_os = "fuchsia")]
3740pub struct ChannelListenerRegistrySynchronousProxy {
3741 client: fidl::client::sync::Client,
3742}
3743
3744#[cfg(target_os = "fuchsia")]
3745impl fidl::endpoints::SynchronousProxy for ChannelListenerRegistrySynchronousProxy {
3746 type Proxy = ChannelListenerRegistryProxy;
3747 type Protocol = ChannelListenerRegistryMarker;
3748
3749 fn from_channel(inner: fidl::Channel) -> Self {
3750 Self::new(inner)
3751 }
3752
3753 fn into_channel(self) -> fidl::Channel {
3754 self.client.into_channel()
3755 }
3756
3757 fn as_channel(&self) -> &fidl::Channel {
3758 self.client.as_channel()
3759 }
3760}
3761
3762#[cfg(target_os = "fuchsia")]
3763impl ChannelListenerRegistrySynchronousProxy {
3764 pub fn new(channel: fidl::Channel) -> Self {
3765 let protocol_name =
3766 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3767 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3768 }
3769
3770 pub fn into_channel(self) -> fidl::Channel {
3771 self.client.into_channel()
3772 }
3773
3774 pub fn wait_for_event(
3777 &self,
3778 deadline: zx::MonotonicInstant,
3779 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3780 ChannelListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
3781 }
3782
3783 pub fn r#listen_l2cap(
3793 &self,
3794 mut payload: ChannelListenerRegistryListenL2capRequest,
3795 ___deadline: zx::MonotonicInstant,
3796 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3797 let _response = self.client.send_query::<
3798 ChannelListenerRegistryListenL2capRequest,
3799 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3800 >(
3801 &mut payload,
3802 0x39c6e9001d102338,
3803 fidl::encoding::DynamicFlags::empty(),
3804 ___deadline,
3805 )?;
3806 Ok(_response.map(|x| x))
3807 }
3808}
3809
3810#[cfg(target_os = "fuchsia")]
3811impl From<ChannelListenerRegistrySynchronousProxy> for zx::Handle {
3812 fn from(value: ChannelListenerRegistrySynchronousProxy) -> Self {
3813 value.into_channel().into()
3814 }
3815}
3816
3817#[cfg(target_os = "fuchsia")]
3818impl From<fidl::Channel> for ChannelListenerRegistrySynchronousProxy {
3819 fn from(value: fidl::Channel) -> Self {
3820 Self::new(value)
3821 }
3822}
3823
3824#[cfg(target_os = "fuchsia")]
3825impl fidl::endpoints::FromClient for ChannelListenerRegistrySynchronousProxy {
3826 type Protocol = ChannelListenerRegistryMarker;
3827
3828 fn from_client(value: fidl::endpoints::ClientEnd<ChannelListenerRegistryMarker>) -> Self {
3829 Self::new(value.into_channel())
3830 }
3831}
3832
3833#[derive(Debug, Clone)]
3834pub struct ChannelListenerRegistryProxy {
3835 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3836}
3837
3838impl fidl::endpoints::Proxy for ChannelListenerRegistryProxy {
3839 type Protocol = ChannelListenerRegistryMarker;
3840
3841 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3842 Self::new(inner)
3843 }
3844
3845 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3846 self.client.into_channel().map_err(|client| Self { client })
3847 }
3848
3849 fn as_channel(&self) -> &::fidl::AsyncChannel {
3850 self.client.as_channel()
3851 }
3852}
3853
3854impl ChannelListenerRegistryProxy {
3855 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3857 let protocol_name =
3858 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3859 Self { client: fidl::client::Client::new(channel, protocol_name) }
3860 }
3861
3862 pub fn take_event_stream(&self) -> ChannelListenerRegistryEventStream {
3868 ChannelListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
3869 }
3870
3871 pub fn r#listen_l2cap(
3881 &self,
3882 mut payload: ChannelListenerRegistryListenL2capRequest,
3883 ) -> fidl::client::QueryResponseFut<
3884 ChannelListenerRegistryListenL2capResult,
3885 fidl::encoding::DefaultFuchsiaResourceDialect,
3886 > {
3887 ChannelListenerRegistryProxyInterface::r#listen_l2cap(self, payload)
3888 }
3889}
3890
3891impl ChannelListenerRegistryProxyInterface for ChannelListenerRegistryProxy {
3892 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
3893 ChannelListenerRegistryListenL2capResult,
3894 fidl::encoding::DefaultFuchsiaResourceDialect,
3895 >;
3896 fn r#listen_l2cap(
3897 &self,
3898 mut payload: ChannelListenerRegistryListenL2capRequest,
3899 ) -> Self::ListenL2capResponseFut {
3900 fn _decode(
3901 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3902 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3903 let _response = fidl::client::decode_transaction_body::<
3904 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3905 fidl::encoding::DefaultFuchsiaResourceDialect,
3906 0x39c6e9001d102338,
3907 >(_buf?)?;
3908 Ok(_response.map(|x| x))
3909 }
3910 self.client.send_query_and_decode::<
3911 ChannelListenerRegistryListenL2capRequest,
3912 ChannelListenerRegistryListenL2capResult,
3913 >(
3914 &mut payload,
3915 0x39c6e9001d102338,
3916 fidl::encoding::DynamicFlags::empty(),
3917 _decode,
3918 )
3919 }
3920}
3921
3922pub struct ChannelListenerRegistryEventStream {
3923 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3924}
3925
3926impl std::marker::Unpin for ChannelListenerRegistryEventStream {}
3927
3928impl futures::stream::FusedStream for ChannelListenerRegistryEventStream {
3929 fn is_terminated(&self) -> bool {
3930 self.event_receiver.is_terminated()
3931 }
3932}
3933
3934impl futures::Stream for ChannelListenerRegistryEventStream {
3935 type Item = Result<ChannelListenerRegistryEvent, fidl::Error>;
3936
3937 fn poll_next(
3938 mut self: std::pin::Pin<&mut Self>,
3939 cx: &mut std::task::Context<'_>,
3940 ) -> std::task::Poll<Option<Self::Item>> {
3941 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3942 &mut self.event_receiver,
3943 cx
3944 )?) {
3945 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerRegistryEvent::decode(buf))),
3946 None => std::task::Poll::Ready(None),
3947 }
3948 }
3949}
3950
3951#[derive(Debug)]
3952pub enum ChannelListenerRegistryEvent {}
3953
3954impl ChannelListenerRegistryEvent {
3955 fn decode(
3957 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3958 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3959 let (bytes, _handles) = buf.split_mut();
3960 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3961 debug_assert_eq!(tx_header.tx_id, 0);
3962 match tx_header.ordinal {
3963 _ => Err(fidl::Error::UnknownOrdinal {
3964 ordinal: tx_header.ordinal,
3965 protocol_name:
3966 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3967 }),
3968 }
3969 }
3970}
3971
3972pub struct ChannelListenerRegistryRequestStream {
3974 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3975 is_terminated: bool,
3976}
3977
3978impl std::marker::Unpin for ChannelListenerRegistryRequestStream {}
3979
3980impl futures::stream::FusedStream for ChannelListenerRegistryRequestStream {
3981 fn is_terminated(&self) -> bool {
3982 self.is_terminated
3983 }
3984}
3985
3986impl fidl::endpoints::RequestStream for ChannelListenerRegistryRequestStream {
3987 type Protocol = ChannelListenerRegistryMarker;
3988 type ControlHandle = ChannelListenerRegistryControlHandle;
3989
3990 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3991 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3992 }
3993
3994 fn control_handle(&self) -> Self::ControlHandle {
3995 ChannelListenerRegistryControlHandle { inner: self.inner.clone() }
3996 }
3997
3998 fn into_inner(
3999 self,
4000 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4001 {
4002 (self.inner, self.is_terminated)
4003 }
4004
4005 fn from_inner(
4006 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4007 is_terminated: bool,
4008 ) -> Self {
4009 Self { inner, is_terminated }
4010 }
4011}
4012
4013impl futures::Stream for ChannelListenerRegistryRequestStream {
4014 type Item = Result<ChannelListenerRegistryRequest, fidl::Error>;
4015
4016 fn poll_next(
4017 mut self: std::pin::Pin<&mut Self>,
4018 cx: &mut std::task::Context<'_>,
4019 ) -> std::task::Poll<Option<Self::Item>> {
4020 let this = &mut *self;
4021 if this.inner.check_shutdown(cx) {
4022 this.is_terminated = true;
4023 return std::task::Poll::Ready(None);
4024 }
4025 if this.is_terminated {
4026 panic!("polled ChannelListenerRegistryRequestStream after completion");
4027 }
4028 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4029 |bytes, handles| {
4030 match this.inner.channel().read_etc(cx, bytes, handles) {
4031 std::task::Poll::Ready(Ok(())) => {}
4032 std::task::Poll::Pending => return std::task::Poll::Pending,
4033 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4034 this.is_terminated = true;
4035 return std::task::Poll::Ready(None);
4036 }
4037 std::task::Poll::Ready(Err(e)) => {
4038 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4039 e.into(),
4040 ))))
4041 }
4042 }
4043
4044 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4046
4047 std::task::Poll::Ready(Some(match header.ordinal {
4048 0x39c6e9001d102338 => {
4049 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4050 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4051 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
4052 let control_handle = ChannelListenerRegistryControlHandle {
4053 inner: this.inner.clone(),
4054 };
4055 Ok(ChannelListenerRegistryRequest::ListenL2cap {payload: req,
4056 responder: ChannelListenerRegistryListenL2capResponder {
4057 control_handle: std::mem::ManuallyDrop::new(control_handle),
4058 tx_id: header.tx_id,
4059 },
4060 })
4061 }
4062 _ => Err(fidl::Error::UnknownOrdinal {
4063 ordinal: header.ordinal,
4064 protocol_name: <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4065 }),
4066 }))
4067 },
4068 )
4069 }
4070}
4071
4072#[derive(Debug)]
4075pub enum ChannelListenerRegistryRequest {
4076 ListenL2cap {
4086 payload: ChannelListenerRegistryListenL2capRequest,
4087 responder: ChannelListenerRegistryListenL2capResponder,
4088 },
4089}
4090
4091impl ChannelListenerRegistryRequest {
4092 #[allow(irrefutable_let_patterns)]
4093 pub fn into_listen_l2cap(
4094 self,
4095 ) -> Option<(
4096 ChannelListenerRegistryListenL2capRequest,
4097 ChannelListenerRegistryListenL2capResponder,
4098 )> {
4099 if let ChannelListenerRegistryRequest::ListenL2cap { payload, responder } = self {
4100 Some((payload, responder))
4101 } else {
4102 None
4103 }
4104 }
4105
4106 pub fn method_name(&self) -> &'static str {
4108 match *self {
4109 ChannelListenerRegistryRequest::ListenL2cap { .. } => "listen_l2cap",
4110 }
4111 }
4112}
4113
4114#[derive(Debug, Clone)]
4115pub struct ChannelListenerRegistryControlHandle {
4116 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4117}
4118
4119impl fidl::endpoints::ControlHandle for ChannelListenerRegistryControlHandle {
4120 fn shutdown(&self) {
4121 self.inner.shutdown()
4122 }
4123 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4124 self.inner.shutdown_with_epitaph(status)
4125 }
4126
4127 fn is_closed(&self) -> bool {
4128 self.inner.channel().is_closed()
4129 }
4130 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4131 self.inner.channel().on_closed()
4132 }
4133
4134 #[cfg(target_os = "fuchsia")]
4135 fn signal_peer(
4136 &self,
4137 clear_mask: zx::Signals,
4138 set_mask: zx::Signals,
4139 ) -> Result<(), zx_status::Status> {
4140 use fidl::Peered;
4141 self.inner.channel().signal_peer(clear_mask, set_mask)
4142 }
4143}
4144
4145impl ChannelListenerRegistryControlHandle {}
4146
4147#[must_use = "FIDL methods require a response to be sent"]
4148#[derive(Debug)]
4149pub struct ChannelListenerRegistryListenL2capResponder {
4150 control_handle: std::mem::ManuallyDrop<ChannelListenerRegistryControlHandle>,
4151 tx_id: u32,
4152}
4153
4154impl std::ops::Drop for ChannelListenerRegistryListenL2capResponder {
4158 fn drop(&mut self) {
4159 self.control_handle.shutdown();
4160 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4162 }
4163}
4164
4165impl fidl::endpoints::Responder for ChannelListenerRegistryListenL2capResponder {
4166 type ControlHandle = ChannelListenerRegistryControlHandle;
4167
4168 fn control_handle(&self) -> &ChannelListenerRegistryControlHandle {
4169 &self.control_handle
4170 }
4171
4172 fn drop_without_shutdown(mut self) {
4173 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4175 std::mem::forget(self);
4177 }
4178}
4179
4180impl ChannelListenerRegistryListenL2capResponder {
4181 pub fn send(
4185 self,
4186 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4187 ) -> Result<(), fidl::Error> {
4188 let _result = self.send_raw(result);
4189 if _result.is_err() {
4190 self.control_handle.shutdown();
4191 }
4192 self.drop_without_shutdown();
4193 _result
4194 }
4195
4196 pub fn send_no_shutdown_on_err(
4198 self,
4199 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4200 ) -> Result<(), fidl::Error> {
4201 let _result = self.send_raw(result);
4202 self.drop_without_shutdown();
4203 _result
4204 }
4205
4206 fn send_raw(
4207 &self,
4208 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4209 ) -> Result<(), fidl::Error> {
4210 self.control_handle.inner.send::<fidl::encoding::ResultType<
4211 ChannelListenerRegistryListenL2capResponse,
4212 i32,
4213 >>(
4214 result,
4215 self.tx_id,
4216 0x39c6e9001d102338,
4217 fidl::encoding::DynamicFlags::empty(),
4218 )
4219 }
4220}
4221
4222#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4223pub struct CodecDelayMarker;
4224
4225impl fidl::endpoints::ProtocolMarker for CodecDelayMarker {
4226 type Proxy = CodecDelayProxy;
4227 type RequestStream = CodecDelayRequestStream;
4228 #[cfg(target_os = "fuchsia")]
4229 type SynchronousProxy = CodecDelaySynchronousProxy;
4230
4231 const DEBUG_NAME: &'static str = "(anonymous) CodecDelay";
4232}
4233pub type CodecDelayGetCodecLocalDelayRangeResult =
4234 Result<CodecDelayGetCodecLocalDelayRangeResponse, i32>;
4235
4236pub trait CodecDelayProxyInterface: Send + Sync {
4237 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
4238 + Send;
4239 fn r#get_codec_local_delay_range(
4240 &self,
4241 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4242 ) -> Self::GetCodecLocalDelayRangeResponseFut;
4243}
4244#[derive(Debug)]
4245#[cfg(target_os = "fuchsia")]
4246pub struct CodecDelaySynchronousProxy {
4247 client: fidl::client::sync::Client,
4248}
4249
4250#[cfg(target_os = "fuchsia")]
4251impl fidl::endpoints::SynchronousProxy for CodecDelaySynchronousProxy {
4252 type Proxy = CodecDelayProxy;
4253 type Protocol = CodecDelayMarker;
4254
4255 fn from_channel(inner: fidl::Channel) -> Self {
4256 Self::new(inner)
4257 }
4258
4259 fn into_channel(self) -> fidl::Channel {
4260 self.client.into_channel()
4261 }
4262
4263 fn as_channel(&self) -> &fidl::Channel {
4264 self.client.as_channel()
4265 }
4266}
4267
4268#[cfg(target_os = "fuchsia")]
4269impl CodecDelaySynchronousProxy {
4270 pub fn new(channel: fidl::Channel) -> Self {
4271 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4272 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4273 }
4274
4275 pub fn into_channel(self) -> fidl::Channel {
4276 self.client.into_channel()
4277 }
4278
4279 pub fn wait_for_event(
4282 &self,
4283 deadline: zx::MonotonicInstant,
4284 ) -> Result<CodecDelayEvent, fidl::Error> {
4285 CodecDelayEvent::decode(self.client.wait_for_event(deadline)?)
4286 }
4287
4288 pub fn r#get_codec_local_delay_range(
4296 &self,
4297 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4298 ___deadline: zx::MonotonicInstant,
4299 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4300 let _response = self.client.send_query::<
4301 CodecDelayGetCodecLocalDelayRangeRequest,
4302 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4303 >(
4304 payload,
4305 0x1cf34fdeed80b4d,
4306 fidl::encoding::DynamicFlags::empty(),
4307 ___deadline,
4308 )?;
4309 Ok(_response.map(|x| x))
4310 }
4311}
4312
4313#[cfg(target_os = "fuchsia")]
4314impl From<CodecDelaySynchronousProxy> for zx::Handle {
4315 fn from(value: CodecDelaySynchronousProxy) -> Self {
4316 value.into_channel().into()
4317 }
4318}
4319
4320#[cfg(target_os = "fuchsia")]
4321impl From<fidl::Channel> for CodecDelaySynchronousProxy {
4322 fn from(value: fidl::Channel) -> Self {
4323 Self::new(value)
4324 }
4325}
4326
4327#[cfg(target_os = "fuchsia")]
4328impl fidl::endpoints::FromClient for CodecDelaySynchronousProxy {
4329 type Protocol = CodecDelayMarker;
4330
4331 fn from_client(value: fidl::endpoints::ClientEnd<CodecDelayMarker>) -> Self {
4332 Self::new(value.into_channel())
4333 }
4334}
4335
4336#[derive(Debug, Clone)]
4337pub struct CodecDelayProxy {
4338 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4339}
4340
4341impl fidl::endpoints::Proxy for CodecDelayProxy {
4342 type Protocol = CodecDelayMarker;
4343
4344 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4345 Self::new(inner)
4346 }
4347
4348 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4349 self.client.into_channel().map_err(|client| Self { client })
4350 }
4351
4352 fn as_channel(&self) -> &::fidl::AsyncChannel {
4353 self.client.as_channel()
4354 }
4355}
4356
4357impl CodecDelayProxy {
4358 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4360 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4361 Self { client: fidl::client::Client::new(channel, protocol_name) }
4362 }
4363
4364 pub fn take_event_stream(&self) -> CodecDelayEventStream {
4370 CodecDelayEventStream { event_receiver: self.client.take_event_receiver() }
4371 }
4372
4373 pub fn r#get_codec_local_delay_range(
4381 &self,
4382 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4383 ) -> fidl::client::QueryResponseFut<
4384 CodecDelayGetCodecLocalDelayRangeResult,
4385 fidl::encoding::DefaultFuchsiaResourceDialect,
4386 > {
4387 CodecDelayProxyInterface::r#get_codec_local_delay_range(self, payload)
4388 }
4389}
4390
4391impl CodecDelayProxyInterface for CodecDelayProxy {
4392 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
4393 CodecDelayGetCodecLocalDelayRangeResult,
4394 fidl::encoding::DefaultFuchsiaResourceDialect,
4395 >;
4396 fn r#get_codec_local_delay_range(
4397 &self,
4398 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4399 ) -> Self::GetCodecLocalDelayRangeResponseFut {
4400 fn _decode(
4401 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4402 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4403 let _response = fidl::client::decode_transaction_body::<
4404 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4405 fidl::encoding::DefaultFuchsiaResourceDialect,
4406 0x1cf34fdeed80b4d,
4407 >(_buf?)?;
4408 Ok(_response.map(|x| x))
4409 }
4410 self.client.send_query_and_decode::<
4411 CodecDelayGetCodecLocalDelayRangeRequest,
4412 CodecDelayGetCodecLocalDelayRangeResult,
4413 >(
4414 payload,
4415 0x1cf34fdeed80b4d,
4416 fidl::encoding::DynamicFlags::empty(),
4417 _decode,
4418 )
4419 }
4420}
4421
4422pub struct CodecDelayEventStream {
4423 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4424}
4425
4426impl std::marker::Unpin for CodecDelayEventStream {}
4427
4428impl futures::stream::FusedStream for CodecDelayEventStream {
4429 fn is_terminated(&self) -> bool {
4430 self.event_receiver.is_terminated()
4431 }
4432}
4433
4434impl futures::Stream for CodecDelayEventStream {
4435 type Item = Result<CodecDelayEvent, fidl::Error>;
4436
4437 fn poll_next(
4438 mut self: std::pin::Pin<&mut Self>,
4439 cx: &mut std::task::Context<'_>,
4440 ) -> std::task::Poll<Option<Self::Item>> {
4441 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4442 &mut self.event_receiver,
4443 cx
4444 )?) {
4445 Some(buf) => std::task::Poll::Ready(Some(CodecDelayEvent::decode(buf))),
4446 None => std::task::Poll::Ready(None),
4447 }
4448 }
4449}
4450
4451#[derive(Debug)]
4452pub enum CodecDelayEvent {}
4453
4454impl CodecDelayEvent {
4455 fn decode(
4457 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4458 ) -> Result<CodecDelayEvent, fidl::Error> {
4459 let (bytes, _handles) = buf.split_mut();
4460 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4461 debug_assert_eq!(tx_header.tx_id, 0);
4462 match tx_header.ordinal {
4463 _ => Err(fidl::Error::UnknownOrdinal {
4464 ordinal: tx_header.ordinal,
4465 protocol_name: <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4466 }),
4467 }
4468 }
4469}
4470
4471pub struct CodecDelayRequestStream {
4473 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4474 is_terminated: bool,
4475}
4476
4477impl std::marker::Unpin for CodecDelayRequestStream {}
4478
4479impl futures::stream::FusedStream for CodecDelayRequestStream {
4480 fn is_terminated(&self) -> bool {
4481 self.is_terminated
4482 }
4483}
4484
4485impl fidl::endpoints::RequestStream for CodecDelayRequestStream {
4486 type Protocol = CodecDelayMarker;
4487 type ControlHandle = CodecDelayControlHandle;
4488
4489 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4490 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4491 }
4492
4493 fn control_handle(&self) -> Self::ControlHandle {
4494 CodecDelayControlHandle { inner: self.inner.clone() }
4495 }
4496
4497 fn into_inner(
4498 self,
4499 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4500 {
4501 (self.inner, self.is_terminated)
4502 }
4503
4504 fn from_inner(
4505 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4506 is_terminated: bool,
4507 ) -> Self {
4508 Self { inner, is_terminated }
4509 }
4510}
4511
4512impl futures::Stream for CodecDelayRequestStream {
4513 type Item = Result<CodecDelayRequest, fidl::Error>;
4514
4515 fn poll_next(
4516 mut self: std::pin::Pin<&mut Self>,
4517 cx: &mut std::task::Context<'_>,
4518 ) -> std::task::Poll<Option<Self::Item>> {
4519 let this = &mut *self;
4520 if this.inner.check_shutdown(cx) {
4521 this.is_terminated = true;
4522 return std::task::Poll::Ready(None);
4523 }
4524 if this.is_terminated {
4525 panic!("polled CodecDelayRequestStream after completion");
4526 }
4527 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4528 |bytes, handles| {
4529 match this.inner.channel().read_etc(cx, bytes, handles) {
4530 std::task::Poll::Ready(Ok(())) => {}
4531 std::task::Poll::Pending => return std::task::Poll::Pending,
4532 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4533 this.is_terminated = true;
4534 return std::task::Poll::Ready(None);
4535 }
4536 std::task::Poll::Ready(Err(e)) => {
4537 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4538 e.into(),
4539 ))))
4540 }
4541 }
4542
4543 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4545
4546 std::task::Poll::Ready(Some(match header.ordinal {
4547 0x1cf34fdeed80b4d => {
4548 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4549 let mut req = fidl::new_empty!(
4550 CodecDelayGetCodecLocalDelayRangeRequest,
4551 fidl::encoding::DefaultFuchsiaResourceDialect
4552 );
4553 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
4554 let control_handle = CodecDelayControlHandle { inner: this.inner.clone() };
4555 Ok(CodecDelayRequest::GetCodecLocalDelayRange {
4556 payload: req,
4557 responder: CodecDelayGetCodecLocalDelayRangeResponder {
4558 control_handle: std::mem::ManuallyDrop::new(control_handle),
4559 tx_id: header.tx_id,
4560 },
4561 })
4562 }
4563 _ => Err(fidl::Error::UnknownOrdinal {
4564 ordinal: header.ordinal,
4565 protocol_name:
4566 <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4567 }),
4568 }))
4569 },
4570 )
4571 }
4572}
4573
4574#[derive(Debug)]
4577pub enum CodecDelayRequest {
4578 GetCodecLocalDelayRange {
4586 payload: CodecDelayGetCodecLocalDelayRangeRequest,
4587 responder: CodecDelayGetCodecLocalDelayRangeResponder,
4588 },
4589}
4590
4591impl CodecDelayRequest {
4592 #[allow(irrefutable_let_patterns)]
4593 pub fn into_get_codec_local_delay_range(
4594 self,
4595 ) -> Option<(
4596 CodecDelayGetCodecLocalDelayRangeRequest,
4597 CodecDelayGetCodecLocalDelayRangeResponder,
4598 )> {
4599 if let CodecDelayRequest::GetCodecLocalDelayRange { payload, responder } = self {
4600 Some((payload, responder))
4601 } else {
4602 None
4603 }
4604 }
4605
4606 pub fn method_name(&self) -> &'static str {
4608 match *self {
4609 CodecDelayRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
4610 }
4611 }
4612}
4613
4614#[derive(Debug, Clone)]
4615pub struct CodecDelayControlHandle {
4616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4617}
4618
4619impl fidl::endpoints::ControlHandle for CodecDelayControlHandle {
4620 fn shutdown(&self) {
4621 self.inner.shutdown()
4622 }
4623 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4624 self.inner.shutdown_with_epitaph(status)
4625 }
4626
4627 fn is_closed(&self) -> bool {
4628 self.inner.channel().is_closed()
4629 }
4630 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4631 self.inner.channel().on_closed()
4632 }
4633
4634 #[cfg(target_os = "fuchsia")]
4635 fn signal_peer(
4636 &self,
4637 clear_mask: zx::Signals,
4638 set_mask: zx::Signals,
4639 ) -> Result<(), zx_status::Status> {
4640 use fidl::Peered;
4641 self.inner.channel().signal_peer(clear_mask, set_mask)
4642 }
4643}
4644
4645impl CodecDelayControlHandle {}
4646
4647#[must_use = "FIDL methods require a response to be sent"]
4648#[derive(Debug)]
4649pub struct CodecDelayGetCodecLocalDelayRangeResponder {
4650 control_handle: std::mem::ManuallyDrop<CodecDelayControlHandle>,
4651 tx_id: u32,
4652}
4653
4654impl std::ops::Drop for CodecDelayGetCodecLocalDelayRangeResponder {
4658 fn drop(&mut self) {
4659 self.control_handle.shutdown();
4660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4662 }
4663}
4664
4665impl fidl::endpoints::Responder for CodecDelayGetCodecLocalDelayRangeResponder {
4666 type ControlHandle = CodecDelayControlHandle;
4667
4668 fn control_handle(&self) -> &CodecDelayControlHandle {
4669 &self.control_handle
4670 }
4671
4672 fn drop_without_shutdown(mut self) {
4673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4675 std::mem::forget(self);
4677 }
4678}
4679
4680impl CodecDelayGetCodecLocalDelayRangeResponder {
4681 pub fn send(
4685 self,
4686 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4687 ) -> Result<(), fidl::Error> {
4688 let _result = self.send_raw(result);
4689 if _result.is_err() {
4690 self.control_handle.shutdown();
4691 }
4692 self.drop_without_shutdown();
4693 _result
4694 }
4695
4696 pub fn send_no_shutdown_on_err(
4698 self,
4699 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4700 ) -> Result<(), fidl::Error> {
4701 let _result = self.send_raw(result);
4702 self.drop_without_shutdown();
4703 _result
4704 }
4705
4706 fn send_raw(
4707 &self,
4708 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4709 ) -> Result<(), fidl::Error> {
4710 self.control_handle.inner.send::<fidl::encoding::ResultType<
4711 CodecDelayGetCodecLocalDelayRangeResponse,
4712 i32,
4713 >>(
4714 result,
4715 self.tx_id,
4716 0x1cf34fdeed80b4d,
4717 fidl::encoding::DynamicFlags::empty(),
4718 )
4719 }
4720}
4721
4722#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4723pub struct ConnectedIsochronousGroupMarker;
4724
4725impl fidl::endpoints::ProtocolMarker for ConnectedIsochronousGroupMarker {
4726 type Proxy = ConnectedIsochronousGroupProxy;
4727 type RequestStream = ConnectedIsochronousGroupRequestStream;
4728 #[cfg(target_os = "fuchsia")]
4729 type SynchronousProxy = ConnectedIsochronousGroupSynchronousProxy;
4730
4731 const DEBUG_NAME: &'static str = "(anonymous) ConnectedIsochronousGroup";
4732}
4733pub type ConnectedIsochronousGroupEstablishStreamsResult = Result<(), EstablishStreamsError>;
4734
4735pub trait ConnectedIsochronousGroupProxyInterface: Send + Sync {
4736 type EstablishStreamsResponseFut: std::future::Future<
4737 Output = Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error>,
4738 > + Send;
4739 fn r#establish_streams(
4740 &self,
4741 payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4742 ) -> Self::EstablishStreamsResponseFut;
4743 fn r#remove(&self) -> Result<(), fidl::Error>;
4744}
4745#[derive(Debug)]
4746#[cfg(target_os = "fuchsia")]
4747pub struct ConnectedIsochronousGroupSynchronousProxy {
4748 client: fidl::client::sync::Client,
4749}
4750
4751#[cfg(target_os = "fuchsia")]
4752impl fidl::endpoints::SynchronousProxy for ConnectedIsochronousGroupSynchronousProxy {
4753 type Proxy = ConnectedIsochronousGroupProxy;
4754 type Protocol = ConnectedIsochronousGroupMarker;
4755
4756 fn from_channel(inner: fidl::Channel) -> Self {
4757 Self::new(inner)
4758 }
4759
4760 fn into_channel(self) -> fidl::Channel {
4761 self.client.into_channel()
4762 }
4763
4764 fn as_channel(&self) -> &fidl::Channel {
4765 self.client.as_channel()
4766 }
4767}
4768
4769#[cfg(target_os = "fuchsia")]
4770impl ConnectedIsochronousGroupSynchronousProxy {
4771 pub fn new(channel: fidl::Channel) -> Self {
4772 let protocol_name =
4773 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4774 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4775 }
4776
4777 pub fn into_channel(self) -> fidl::Channel {
4778 self.client.into_channel()
4779 }
4780
4781 pub fn wait_for_event(
4784 &self,
4785 deadline: zx::MonotonicInstant,
4786 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4787 ConnectedIsochronousGroupEvent::decode(self.client.wait_for_event(deadline)?)
4788 }
4789
4790 pub fn r#establish_streams(
4799 &self,
4800 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4801 ___deadline: zx::MonotonicInstant,
4802 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4803 let _response = self.client.send_query::<
4804 ConnectedIsochronousGroupEstablishStreamsRequest,
4805 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EstablishStreamsError>,
4806 >(
4807 payload,
4808 0xc7296c5edb4dacc,
4809 fidl::encoding::DynamicFlags::FLEXIBLE,
4810 ___deadline,
4811 )?
4812 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4813 Ok(_response.map(|x| x))
4814 }
4815
4816 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4819 self.client.send::<fidl::encoding::EmptyPayload>(
4820 (),
4821 0xbed433babd20503,
4822 fidl::encoding::DynamicFlags::FLEXIBLE,
4823 )
4824 }
4825}
4826
4827#[cfg(target_os = "fuchsia")]
4828impl From<ConnectedIsochronousGroupSynchronousProxy> for zx::Handle {
4829 fn from(value: ConnectedIsochronousGroupSynchronousProxy) -> Self {
4830 value.into_channel().into()
4831 }
4832}
4833
4834#[cfg(target_os = "fuchsia")]
4835impl From<fidl::Channel> for ConnectedIsochronousGroupSynchronousProxy {
4836 fn from(value: fidl::Channel) -> Self {
4837 Self::new(value)
4838 }
4839}
4840
4841#[cfg(target_os = "fuchsia")]
4842impl fidl::endpoints::FromClient for ConnectedIsochronousGroupSynchronousProxy {
4843 type Protocol = ConnectedIsochronousGroupMarker;
4844
4845 fn from_client(value: fidl::endpoints::ClientEnd<ConnectedIsochronousGroupMarker>) -> Self {
4846 Self::new(value.into_channel())
4847 }
4848}
4849
4850#[derive(Debug, Clone)]
4851pub struct ConnectedIsochronousGroupProxy {
4852 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4853}
4854
4855impl fidl::endpoints::Proxy for ConnectedIsochronousGroupProxy {
4856 type Protocol = ConnectedIsochronousGroupMarker;
4857
4858 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4859 Self::new(inner)
4860 }
4861
4862 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4863 self.client.into_channel().map_err(|client| Self { client })
4864 }
4865
4866 fn as_channel(&self) -> &::fidl::AsyncChannel {
4867 self.client.as_channel()
4868 }
4869}
4870
4871impl ConnectedIsochronousGroupProxy {
4872 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4874 let protocol_name =
4875 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4876 Self { client: fidl::client::Client::new(channel, protocol_name) }
4877 }
4878
4879 pub fn take_event_stream(&self) -> ConnectedIsochronousGroupEventStream {
4885 ConnectedIsochronousGroupEventStream { event_receiver: self.client.take_event_receiver() }
4886 }
4887
4888 pub fn r#establish_streams(
4897 &self,
4898 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4899 ) -> fidl::client::QueryResponseFut<
4900 ConnectedIsochronousGroupEstablishStreamsResult,
4901 fidl::encoding::DefaultFuchsiaResourceDialect,
4902 > {
4903 ConnectedIsochronousGroupProxyInterface::r#establish_streams(self, payload)
4904 }
4905
4906 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4909 ConnectedIsochronousGroupProxyInterface::r#remove(self)
4910 }
4911}
4912
4913impl ConnectedIsochronousGroupProxyInterface for ConnectedIsochronousGroupProxy {
4914 type EstablishStreamsResponseFut = fidl::client::QueryResponseFut<
4915 ConnectedIsochronousGroupEstablishStreamsResult,
4916 fidl::encoding::DefaultFuchsiaResourceDialect,
4917 >;
4918 fn r#establish_streams(
4919 &self,
4920 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4921 ) -> Self::EstablishStreamsResponseFut {
4922 fn _decode(
4923 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4924 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4925 let _response = fidl::client::decode_transaction_body::<
4926 fidl::encoding::FlexibleResultType<
4927 fidl::encoding::EmptyStruct,
4928 EstablishStreamsError,
4929 >,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 0xc7296c5edb4dacc,
4932 >(_buf?)?
4933 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4934 Ok(_response.map(|x| x))
4935 }
4936 self.client.send_query_and_decode::<
4937 ConnectedIsochronousGroupEstablishStreamsRequest,
4938 ConnectedIsochronousGroupEstablishStreamsResult,
4939 >(
4940 payload,
4941 0xc7296c5edb4dacc,
4942 fidl::encoding::DynamicFlags::FLEXIBLE,
4943 _decode,
4944 )
4945 }
4946
4947 fn r#remove(&self) -> Result<(), fidl::Error> {
4948 self.client.send::<fidl::encoding::EmptyPayload>(
4949 (),
4950 0xbed433babd20503,
4951 fidl::encoding::DynamicFlags::FLEXIBLE,
4952 )
4953 }
4954}
4955
4956pub struct ConnectedIsochronousGroupEventStream {
4957 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4958}
4959
4960impl std::marker::Unpin for ConnectedIsochronousGroupEventStream {}
4961
4962impl futures::stream::FusedStream for ConnectedIsochronousGroupEventStream {
4963 fn is_terminated(&self) -> bool {
4964 self.event_receiver.is_terminated()
4965 }
4966}
4967
4968impl futures::Stream for ConnectedIsochronousGroupEventStream {
4969 type Item = Result<ConnectedIsochronousGroupEvent, fidl::Error>;
4970
4971 fn poll_next(
4972 mut self: std::pin::Pin<&mut Self>,
4973 cx: &mut std::task::Context<'_>,
4974 ) -> std::task::Poll<Option<Self::Item>> {
4975 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4976 &mut self.event_receiver,
4977 cx
4978 )?) {
4979 Some(buf) => std::task::Poll::Ready(Some(ConnectedIsochronousGroupEvent::decode(buf))),
4980 None => std::task::Poll::Ready(None),
4981 }
4982 }
4983}
4984
4985#[derive(Debug)]
4986pub enum ConnectedIsochronousGroupEvent {
4987 #[non_exhaustive]
4988 _UnknownEvent {
4989 ordinal: u64,
4991 },
4992}
4993
4994impl ConnectedIsochronousGroupEvent {
4995 fn decode(
4997 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4998 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4999 let (bytes, _handles) = buf.split_mut();
5000 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5001 debug_assert_eq!(tx_header.tx_id, 0);
5002 match tx_header.ordinal {
5003 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5004 Ok(ConnectedIsochronousGroupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5005 }
5006 _ => Err(fidl::Error::UnknownOrdinal {
5007 ordinal: tx_header.ordinal,
5008 protocol_name:
5009 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5010 }),
5011 }
5012 }
5013}
5014
5015pub struct ConnectedIsochronousGroupRequestStream {
5017 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5018 is_terminated: bool,
5019}
5020
5021impl std::marker::Unpin for ConnectedIsochronousGroupRequestStream {}
5022
5023impl futures::stream::FusedStream for ConnectedIsochronousGroupRequestStream {
5024 fn is_terminated(&self) -> bool {
5025 self.is_terminated
5026 }
5027}
5028
5029impl fidl::endpoints::RequestStream for ConnectedIsochronousGroupRequestStream {
5030 type Protocol = ConnectedIsochronousGroupMarker;
5031 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5032
5033 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5034 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5035 }
5036
5037 fn control_handle(&self) -> Self::ControlHandle {
5038 ConnectedIsochronousGroupControlHandle { inner: self.inner.clone() }
5039 }
5040
5041 fn into_inner(
5042 self,
5043 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5044 {
5045 (self.inner, self.is_terminated)
5046 }
5047
5048 fn from_inner(
5049 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5050 is_terminated: bool,
5051 ) -> Self {
5052 Self { inner, is_terminated }
5053 }
5054}
5055
5056impl futures::Stream for ConnectedIsochronousGroupRequestStream {
5057 type Item = Result<ConnectedIsochronousGroupRequest, fidl::Error>;
5058
5059 fn poll_next(
5060 mut self: std::pin::Pin<&mut Self>,
5061 cx: &mut std::task::Context<'_>,
5062 ) -> std::task::Poll<Option<Self::Item>> {
5063 let this = &mut *self;
5064 if this.inner.check_shutdown(cx) {
5065 this.is_terminated = true;
5066 return std::task::Poll::Ready(None);
5067 }
5068 if this.is_terminated {
5069 panic!("polled ConnectedIsochronousGroupRequestStream after completion");
5070 }
5071 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5072 |bytes, handles| {
5073 match this.inner.channel().read_etc(cx, bytes, handles) {
5074 std::task::Poll::Ready(Ok(())) => {}
5075 std::task::Poll::Pending => return std::task::Poll::Pending,
5076 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5077 this.is_terminated = true;
5078 return std::task::Poll::Ready(None);
5079 }
5080 std::task::Poll::Ready(Err(e)) => {
5081 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5082 e.into(),
5083 ))))
5084 }
5085 }
5086
5087 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5089
5090 std::task::Poll::Ready(Some(match header.ordinal {
5091 0xc7296c5edb4dacc => {
5092 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5093 let mut req = fidl::new_empty!(ConnectedIsochronousGroupEstablishStreamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5094 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectedIsochronousGroupEstablishStreamsRequest>(&header, _body_bytes, handles, &mut req)?;
5095 let control_handle = ConnectedIsochronousGroupControlHandle {
5096 inner: this.inner.clone(),
5097 };
5098 Ok(ConnectedIsochronousGroupRequest::EstablishStreams {payload: req,
5099 responder: ConnectedIsochronousGroupEstablishStreamsResponder {
5100 control_handle: std::mem::ManuallyDrop::new(control_handle),
5101 tx_id: header.tx_id,
5102 },
5103 })
5104 }
5105 0xbed433babd20503 => {
5106 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5107 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5108 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5109 let control_handle = ConnectedIsochronousGroupControlHandle {
5110 inner: this.inner.clone(),
5111 };
5112 Ok(ConnectedIsochronousGroupRequest::Remove {
5113 control_handle,
5114 })
5115 }
5116 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5117 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5118 ordinal: header.ordinal,
5119 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5120 method_type: fidl::MethodType::OneWay,
5121 })
5122 }
5123 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5124 this.inner.send_framework_err(
5125 fidl::encoding::FrameworkErr::UnknownMethod,
5126 header.tx_id,
5127 header.ordinal,
5128 header.dynamic_flags(),
5129 (bytes, handles),
5130 )?;
5131 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
5132 ordinal: header.ordinal,
5133 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
5134 method_type: fidl::MethodType::TwoWay,
5135 })
5136 }
5137 _ => Err(fidl::Error::UnknownOrdinal {
5138 ordinal: header.ordinal,
5139 protocol_name: <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5140 }),
5141 }))
5142 },
5143 )
5144 }
5145}
5146
5147#[derive(Debug)]
5148pub enum ConnectedIsochronousGroupRequest {
5149 EstablishStreams {
5158 payload: ConnectedIsochronousGroupEstablishStreamsRequest,
5159 responder: ConnectedIsochronousGroupEstablishStreamsResponder,
5160 },
5161 Remove { control_handle: ConnectedIsochronousGroupControlHandle },
5164 #[non_exhaustive]
5166 _UnknownMethod {
5167 ordinal: u64,
5169 control_handle: ConnectedIsochronousGroupControlHandle,
5170 method_type: fidl::MethodType,
5171 },
5172}
5173
5174impl ConnectedIsochronousGroupRequest {
5175 #[allow(irrefutable_let_patterns)]
5176 pub fn into_establish_streams(
5177 self,
5178 ) -> Option<(
5179 ConnectedIsochronousGroupEstablishStreamsRequest,
5180 ConnectedIsochronousGroupEstablishStreamsResponder,
5181 )> {
5182 if let ConnectedIsochronousGroupRequest::EstablishStreams { payload, responder } = self {
5183 Some((payload, responder))
5184 } else {
5185 None
5186 }
5187 }
5188
5189 #[allow(irrefutable_let_patterns)]
5190 pub fn into_remove(self) -> Option<(ConnectedIsochronousGroupControlHandle)> {
5191 if let ConnectedIsochronousGroupRequest::Remove { control_handle } = self {
5192 Some((control_handle))
5193 } else {
5194 None
5195 }
5196 }
5197
5198 pub fn method_name(&self) -> &'static str {
5200 match *self {
5201 ConnectedIsochronousGroupRequest::EstablishStreams { .. } => "establish_streams",
5202 ConnectedIsochronousGroupRequest::Remove { .. } => "remove",
5203 ConnectedIsochronousGroupRequest::_UnknownMethod {
5204 method_type: fidl::MethodType::OneWay,
5205 ..
5206 } => "unknown one-way method",
5207 ConnectedIsochronousGroupRequest::_UnknownMethod {
5208 method_type: fidl::MethodType::TwoWay,
5209 ..
5210 } => "unknown two-way method",
5211 }
5212 }
5213}
5214
5215#[derive(Debug, Clone)]
5216pub struct ConnectedIsochronousGroupControlHandle {
5217 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5218}
5219
5220impl fidl::endpoints::ControlHandle for ConnectedIsochronousGroupControlHandle {
5221 fn shutdown(&self) {
5222 self.inner.shutdown()
5223 }
5224 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5225 self.inner.shutdown_with_epitaph(status)
5226 }
5227
5228 fn is_closed(&self) -> bool {
5229 self.inner.channel().is_closed()
5230 }
5231 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5232 self.inner.channel().on_closed()
5233 }
5234
5235 #[cfg(target_os = "fuchsia")]
5236 fn signal_peer(
5237 &self,
5238 clear_mask: zx::Signals,
5239 set_mask: zx::Signals,
5240 ) -> Result<(), zx_status::Status> {
5241 use fidl::Peered;
5242 self.inner.channel().signal_peer(clear_mask, set_mask)
5243 }
5244}
5245
5246impl ConnectedIsochronousGroupControlHandle {}
5247
5248#[must_use = "FIDL methods require a response to be sent"]
5249#[derive(Debug)]
5250pub struct ConnectedIsochronousGroupEstablishStreamsResponder {
5251 control_handle: std::mem::ManuallyDrop<ConnectedIsochronousGroupControlHandle>,
5252 tx_id: u32,
5253}
5254
5255impl std::ops::Drop for ConnectedIsochronousGroupEstablishStreamsResponder {
5259 fn drop(&mut self) {
5260 self.control_handle.shutdown();
5261 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5263 }
5264}
5265
5266impl fidl::endpoints::Responder for ConnectedIsochronousGroupEstablishStreamsResponder {
5267 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5268
5269 fn control_handle(&self) -> &ConnectedIsochronousGroupControlHandle {
5270 &self.control_handle
5271 }
5272
5273 fn drop_without_shutdown(mut self) {
5274 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5276 std::mem::forget(self);
5278 }
5279}
5280
5281impl ConnectedIsochronousGroupEstablishStreamsResponder {
5282 pub fn send(self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5286 let _result = self.send_raw(result);
5287 if _result.is_err() {
5288 self.control_handle.shutdown();
5289 }
5290 self.drop_without_shutdown();
5291 _result
5292 }
5293
5294 pub fn send_no_shutdown_on_err(
5296 self,
5297 mut result: Result<(), EstablishStreamsError>,
5298 ) -> Result<(), fidl::Error> {
5299 let _result = self.send_raw(result);
5300 self.drop_without_shutdown();
5301 _result
5302 }
5303
5304 fn send_raw(&self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5305 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5306 fidl::encoding::EmptyStruct,
5307 EstablishStreamsError,
5308 >>(
5309 fidl::encoding::FlexibleResult::new(result),
5310 self.tx_id,
5311 0xc7296c5edb4dacc,
5312 fidl::encoding::DynamicFlags::FLEXIBLE,
5313 )
5314 }
5315}
5316
5317#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5318pub struct ConnectionMarker;
5319
5320impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
5321 type Proxy = ConnectionProxy;
5322 type RequestStream = ConnectionRequestStream;
5323 #[cfg(target_os = "fuchsia")]
5324 type SynchronousProxy = ConnectionSynchronousProxy;
5325
5326 const DEBUG_NAME: &'static str = "(anonymous) Connection";
5327}
5328pub type ConnectionTransferPeriodicAdvertisingSyncResult =
5329 Result<(), PeriodicAdvertisingSyncTransferError>;
5330pub type ConnectionAcceptPeriodicAdvertisingSyncTransferResult =
5331 Result<(), PeriodicAdvertisingSyncTransferError>;
5332
5333pub trait ConnectionProxyInterface: Send + Sync {
5334 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
5335 + Send;
5336 fn r#get_codec_local_delay_range(
5337 &self,
5338 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5339 ) -> Self::GetCodecLocalDelayRangeResponseFut;
5340 fn r#request_gatt_client(
5341 &self,
5342 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5343 ) -> Result<(), fidl::Error>;
5344 fn r#accept_cis(&self, payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error>;
5345 fn r#connect_l2cap(&self, payload: ConnectionConnectL2capRequest) -> Result<(), fidl::Error>;
5346 type TransferPeriodicAdvertisingSyncResponseFut: std::future::Future<
5347 Output = Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error>,
5348 > + Send;
5349 fn r#transfer_periodic_advertising_sync(
5350 &self,
5351 payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
5352 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut;
5353 type AcceptPeriodicAdvertisingSyncTransferResponseFut: std::future::Future<
5354 Output = Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error>,
5355 > + Send;
5356 fn r#accept_periodic_advertising_sync_transfer(
5357 &self,
5358 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5359 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut;
5360}
5361#[derive(Debug)]
5362#[cfg(target_os = "fuchsia")]
5363pub struct ConnectionSynchronousProxy {
5364 client: fidl::client::sync::Client,
5365}
5366
5367#[cfg(target_os = "fuchsia")]
5368impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
5369 type Proxy = ConnectionProxy;
5370 type Protocol = ConnectionMarker;
5371
5372 fn from_channel(inner: fidl::Channel) -> Self {
5373 Self::new(inner)
5374 }
5375
5376 fn into_channel(self) -> fidl::Channel {
5377 self.client.into_channel()
5378 }
5379
5380 fn as_channel(&self) -> &fidl::Channel {
5381 self.client.as_channel()
5382 }
5383}
5384
5385#[cfg(target_os = "fuchsia")]
5386impl ConnectionSynchronousProxy {
5387 pub fn new(channel: fidl::Channel) -> Self {
5388 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5389 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5390 }
5391
5392 pub fn into_channel(self) -> fidl::Channel {
5393 self.client.into_channel()
5394 }
5395
5396 pub fn wait_for_event(
5399 &self,
5400 deadline: zx::MonotonicInstant,
5401 ) -> Result<ConnectionEvent, fidl::Error> {
5402 ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
5403 }
5404
5405 pub fn r#get_codec_local_delay_range(
5413 &self,
5414 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5415 ___deadline: zx::MonotonicInstant,
5416 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5417 let _response = self.client.send_query::<
5418 CodecDelayGetCodecLocalDelayRangeRequest,
5419 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5420 >(
5421 payload,
5422 0x1cf34fdeed80b4d,
5423 fidl::encoding::DynamicFlags::empty(),
5424 ___deadline,
5425 )?;
5426 Ok(_response.map(|x| x))
5427 }
5428
5429 pub fn r#request_gatt_client(
5433 &self,
5434 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5435 ) -> Result<(), fidl::Error> {
5436 self.client.send::<ConnectionRequestGattClientRequest>(
5437 (client,),
5438 0x2a670e0fec6ccc6b,
5439 fidl::encoding::DynamicFlags::empty(),
5440 )
5441 }
5442
5443 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5458 self.client.send::<ConnectionAcceptCisRequest>(
5459 &mut payload,
5460 0x7e6338c237088144,
5461 fidl::encoding::DynamicFlags::empty(),
5462 )
5463 }
5464
5465 pub fn r#connect_l2cap(
5467 &self,
5468 mut payload: ConnectionConnectL2capRequest,
5469 ) -> Result<(), fidl::Error> {
5470 self.client.send::<ConnectionConnectL2capRequest>(
5471 &mut payload,
5472 0x12351316feaebce9,
5473 fidl::encoding::DynamicFlags::empty(),
5474 )
5475 }
5476
5477 pub fn r#transfer_periodic_advertising_sync(
5480 &self,
5481 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
5482 ___deadline: zx::MonotonicInstant,
5483 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
5484 let _response = self.client.send_query::<
5485 ConnectionTransferPeriodicAdvertisingSyncRequest,
5486 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
5487 >(
5488 payload,
5489 0x1117a10b5ba1e219,
5490 fidl::encoding::DynamicFlags::empty(),
5491 ___deadline,
5492 )?;
5493 Ok(_response.map(|x| x))
5494 }
5495
5496 pub fn r#accept_periodic_advertising_sync_transfer(
5499 &self,
5500 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5501 ___deadline: zx::MonotonicInstant,
5502 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
5503 let _response = self.client.send_query::<
5504 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5505 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeriodicAdvertisingSyncTransferError>,
5506 >(
5507 &mut payload,
5508 0x441a31a7effa7e2b,
5509 fidl::encoding::DynamicFlags::empty(),
5510 ___deadline,
5511 )?;
5512 Ok(_response.map(|x| x))
5513 }
5514}
5515
5516#[cfg(target_os = "fuchsia")]
5517impl From<ConnectionSynchronousProxy> for zx::Handle {
5518 fn from(value: ConnectionSynchronousProxy) -> Self {
5519 value.into_channel().into()
5520 }
5521}
5522
5523#[cfg(target_os = "fuchsia")]
5524impl From<fidl::Channel> for ConnectionSynchronousProxy {
5525 fn from(value: fidl::Channel) -> Self {
5526 Self::new(value)
5527 }
5528}
5529
5530#[cfg(target_os = "fuchsia")]
5531impl fidl::endpoints::FromClient for ConnectionSynchronousProxy {
5532 type Protocol = ConnectionMarker;
5533
5534 fn from_client(value: fidl::endpoints::ClientEnd<ConnectionMarker>) -> Self {
5535 Self::new(value.into_channel())
5536 }
5537}
5538
5539#[derive(Debug, Clone)]
5540pub struct ConnectionProxy {
5541 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5542}
5543
5544impl fidl::endpoints::Proxy for ConnectionProxy {
5545 type Protocol = ConnectionMarker;
5546
5547 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5548 Self::new(inner)
5549 }
5550
5551 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5552 self.client.into_channel().map_err(|client| Self { client })
5553 }
5554
5555 fn as_channel(&self) -> &::fidl::AsyncChannel {
5556 self.client.as_channel()
5557 }
5558}
5559
5560impl ConnectionProxy {
5561 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5563 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5564 Self { client: fidl::client::Client::new(channel, protocol_name) }
5565 }
5566
5567 pub fn take_event_stream(&self) -> ConnectionEventStream {
5573 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
5574 }
5575
5576 pub fn r#get_codec_local_delay_range(
5584 &self,
5585 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5586 ) -> fidl::client::QueryResponseFut<
5587 CodecDelayGetCodecLocalDelayRangeResult,
5588 fidl::encoding::DefaultFuchsiaResourceDialect,
5589 > {
5590 ConnectionProxyInterface::r#get_codec_local_delay_range(self, payload)
5591 }
5592
5593 pub fn r#request_gatt_client(
5597 &self,
5598 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5599 ) -> Result<(), fidl::Error> {
5600 ConnectionProxyInterface::r#request_gatt_client(self, client)
5601 }
5602
5603 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5618 ConnectionProxyInterface::r#accept_cis(self, payload)
5619 }
5620
5621 pub fn r#connect_l2cap(
5623 &self,
5624 mut payload: ConnectionConnectL2capRequest,
5625 ) -> Result<(), fidl::Error> {
5626 ConnectionProxyInterface::r#connect_l2cap(self, payload)
5627 }
5628
5629 pub fn r#transfer_periodic_advertising_sync(
5632 &self,
5633 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
5634 ) -> fidl::client::QueryResponseFut<
5635 ConnectionTransferPeriodicAdvertisingSyncResult,
5636 fidl::encoding::DefaultFuchsiaResourceDialect,
5637 > {
5638 ConnectionProxyInterface::r#transfer_periodic_advertising_sync(self, payload)
5639 }
5640
5641 pub fn r#accept_periodic_advertising_sync_transfer(
5644 &self,
5645 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5646 ) -> fidl::client::QueryResponseFut<
5647 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
5648 fidl::encoding::DefaultFuchsiaResourceDialect,
5649 > {
5650 ConnectionProxyInterface::r#accept_periodic_advertising_sync_transfer(self, payload)
5651 }
5652}
5653
5654impl ConnectionProxyInterface for ConnectionProxy {
5655 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
5656 CodecDelayGetCodecLocalDelayRangeResult,
5657 fidl::encoding::DefaultFuchsiaResourceDialect,
5658 >;
5659 fn r#get_codec_local_delay_range(
5660 &self,
5661 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5662 ) -> Self::GetCodecLocalDelayRangeResponseFut {
5663 fn _decode(
5664 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5665 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5666 let _response = fidl::client::decode_transaction_body::<
5667 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5668 fidl::encoding::DefaultFuchsiaResourceDialect,
5669 0x1cf34fdeed80b4d,
5670 >(_buf?)?;
5671 Ok(_response.map(|x| x))
5672 }
5673 self.client.send_query_and_decode::<
5674 CodecDelayGetCodecLocalDelayRangeRequest,
5675 CodecDelayGetCodecLocalDelayRangeResult,
5676 >(
5677 payload,
5678 0x1cf34fdeed80b4d,
5679 fidl::encoding::DynamicFlags::empty(),
5680 _decode,
5681 )
5682 }
5683
5684 fn r#request_gatt_client(
5685 &self,
5686 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5687 ) -> Result<(), fidl::Error> {
5688 self.client.send::<ConnectionRequestGattClientRequest>(
5689 (client,),
5690 0x2a670e0fec6ccc6b,
5691 fidl::encoding::DynamicFlags::empty(),
5692 )
5693 }
5694
5695 fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5696 self.client.send::<ConnectionAcceptCisRequest>(
5697 &mut payload,
5698 0x7e6338c237088144,
5699 fidl::encoding::DynamicFlags::empty(),
5700 )
5701 }
5702
5703 fn r#connect_l2cap(
5704 &self,
5705 mut payload: ConnectionConnectL2capRequest,
5706 ) -> Result<(), fidl::Error> {
5707 self.client.send::<ConnectionConnectL2capRequest>(
5708 &mut payload,
5709 0x12351316feaebce9,
5710 fidl::encoding::DynamicFlags::empty(),
5711 )
5712 }
5713
5714 type TransferPeriodicAdvertisingSyncResponseFut = fidl::client::QueryResponseFut<
5715 ConnectionTransferPeriodicAdvertisingSyncResult,
5716 fidl::encoding::DefaultFuchsiaResourceDialect,
5717 >;
5718 fn r#transfer_periodic_advertising_sync(
5719 &self,
5720 mut payload: &ConnectionTransferPeriodicAdvertisingSyncRequest,
5721 ) -> Self::TransferPeriodicAdvertisingSyncResponseFut {
5722 fn _decode(
5723 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5724 ) -> Result<ConnectionTransferPeriodicAdvertisingSyncResult, fidl::Error> {
5725 let _response = fidl::client::decode_transaction_body::<
5726 fidl::encoding::ResultType<
5727 fidl::encoding::EmptyStruct,
5728 PeriodicAdvertisingSyncTransferError,
5729 >,
5730 fidl::encoding::DefaultFuchsiaResourceDialect,
5731 0x1117a10b5ba1e219,
5732 >(_buf?)?;
5733 Ok(_response.map(|x| x))
5734 }
5735 self.client.send_query_and_decode::<
5736 ConnectionTransferPeriodicAdvertisingSyncRequest,
5737 ConnectionTransferPeriodicAdvertisingSyncResult,
5738 >(
5739 payload,
5740 0x1117a10b5ba1e219,
5741 fidl::encoding::DynamicFlags::empty(),
5742 _decode,
5743 )
5744 }
5745
5746 type AcceptPeriodicAdvertisingSyncTransferResponseFut = fidl::client::QueryResponseFut<
5747 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
5748 fidl::encoding::DefaultFuchsiaResourceDialect,
5749 >;
5750 fn r#accept_periodic_advertising_sync_transfer(
5751 &self,
5752 mut payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5753 ) -> Self::AcceptPeriodicAdvertisingSyncTransferResponseFut {
5754 fn _decode(
5755 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5756 ) -> Result<ConnectionAcceptPeriodicAdvertisingSyncTransferResult, fidl::Error> {
5757 let _response = fidl::client::decode_transaction_body::<
5758 fidl::encoding::ResultType<
5759 fidl::encoding::EmptyStruct,
5760 PeriodicAdvertisingSyncTransferError,
5761 >,
5762 fidl::encoding::DefaultFuchsiaResourceDialect,
5763 0x441a31a7effa7e2b,
5764 >(_buf?)?;
5765 Ok(_response.map(|x| x))
5766 }
5767 self.client.send_query_and_decode::<
5768 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5769 ConnectionAcceptPeriodicAdvertisingSyncTransferResult,
5770 >(
5771 &mut payload,
5772 0x441a31a7effa7e2b,
5773 fidl::encoding::DynamicFlags::empty(),
5774 _decode,
5775 )
5776 }
5777}
5778
5779pub struct ConnectionEventStream {
5780 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5781}
5782
5783impl std::marker::Unpin for ConnectionEventStream {}
5784
5785impl futures::stream::FusedStream for ConnectionEventStream {
5786 fn is_terminated(&self) -> bool {
5787 self.event_receiver.is_terminated()
5788 }
5789}
5790
5791impl futures::Stream for ConnectionEventStream {
5792 type Item = Result<ConnectionEvent, fidl::Error>;
5793
5794 fn poll_next(
5795 mut self: std::pin::Pin<&mut Self>,
5796 cx: &mut std::task::Context<'_>,
5797 ) -> std::task::Poll<Option<Self::Item>> {
5798 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5799 &mut self.event_receiver,
5800 cx
5801 )?) {
5802 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
5803 None => std::task::Poll::Ready(None),
5804 }
5805 }
5806}
5807
5808#[derive(Debug)]
5809pub enum ConnectionEvent {}
5810
5811impl ConnectionEvent {
5812 fn decode(
5814 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5815 ) -> Result<ConnectionEvent, fidl::Error> {
5816 let (bytes, _handles) = buf.split_mut();
5817 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5818 debug_assert_eq!(tx_header.tx_id, 0);
5819 match tx_header.ordinal {
5820 _ => Err(fidl::Error::UnknownOrdinal {
5821 ordinal: tx_header.ordinal,
5822 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5823 }),
5824 }
5825 }
5826}
5827
5828pub struct ConnectionRequestStream {
5830 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5831 is_terminated: bool,
5832}
5833
5834impl std::marker::Unpin for ConnectionRequestStream {}
5835
5836impl futures::stream::FusedStream for ConnectionRequestStream {
5837 fn is_terminated(&self) -> bool {
5838 self.is_terminated
5839 }
5840}
5841
5842impl fidl::endpoints::RequestStream for ConnectionRequestStream {
5843 type Protocol = ConnectionMarker;
5844 type ControlHandle = ConnectionControlHandle;
5845
5846 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5847 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5848 }
5849
5850 fn control_handle(&self) -> Self::ControlHandle {
5851 ConnectionControlHandle { inner: self.inner.clone() }
5852 }
5853
5854 fn into_inner(
5855 self,
5856 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5857 {
5858 (self.inner, self.is_terminated)
5859 }
5860
5861 fn from_inner(
5862 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5863 is_terminated: bool,
5864 ) -> Self {
5865 Self { inner, is_terminated }
5866 }
5867}
5868
5869impl futures::Stream for ConnectionRequestStream {
5870 type Item = Result<ConnectionRequest, fidl::Error>;
5871
5872 fn poll_next(
5873 mut self: std::pin::Pin<&mut Self>,
5874 cx: &mut std::task::Context<'_>,
5875 ) -> std::task::Poll<Option<Self::Item>> {
5876 let this = &mut *self;
5877 if this.inner.check_shutdown(cx) {
5878 this.is_terminated = true;
5879 return std::task::Poll::Ready(None);
5880 }
5881 if this.is_terminated {
5882 panic!("polled ConnectionRequestStream after completion");
5883 }
5884 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5885 |bytes, handles| {
5886 match this.inner.channel().read_etc(cx, bytes, handles) {
5887 std::task::Poll::Ready(Ok(())) => {}
5888 std::task::Poll::Pending => return std::task::Poll::Pending,
5889 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5890 this.is_terminated = true;
5891 return std::task::Poll::Ready(None);
5892 }
5893 std::task::Poll::Ready(Err(e)) => {
5894 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5895 e.into(),
5896 ))))
5897 }
5898 }
5899
5900 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5902
5903 std::task::Poll::Ready(Some(match header.ordinal {
5904 0x1cf34fdeed80b4d => {
5905 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5906 let mut req = fidl::new_empty!(
5907 CodecDelayGetCodecLocalDelayRangeRequest,
5908 fidl::encoding::DefaultFuchsiaResourceDialect
5909 );
5910 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
5911 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5912 Ok(ConnectionRequest::GetCodecLocalDelayRange {
5913 payload: req,
5914 responder: ConnectionGetCodecLocalDelayRangeResponder {
5915 control_handle: std::mem::ManuallyDrop::new(control_handle),
5916 tx_id: header.tx_id,
5917 },
5918 })
5919 }
5920 0x2a670e0fec6ccc6b => {
5921 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5922 let mut req = fidl::new_empty!(
5923 ConnectionRequestGattClientRequest,
5924 fidl::encoding::DefaultFuchsiaResourceDialect
5925 );
5926 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionRequestGattClientRequest>(&header, _body_bytes, handles, &mut req)?;
5927 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5928 Ok(ConnectionRequest::RequestGattClient {
5929 client: req.client,
5930
5931 control_handle,
5932 })
5933 }
5934 0x7e6338c237088144 => {
5935 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5936 let mut req = fidl::new_empty!(
5937 ConnectionAcceptCisRequest,
5938 fidl::encoding::DefaultFuchsiaResourceDialect
5939 );
5940 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptCisRequest>(&header, _body_bytes, handles, &mut req)?;
5941 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5942 Ok(ConnectionRequest::AcceptCis { payload: req, control_handle })
5943 }
5944 0x12351316feaebce9 => {
5945 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5946 let mut req = fidl::new_empty!(
5947 ConnectionConnectL2capRequest,
5948 fidl::encoding::DefaultFuchsiaResourceDialect
5949 );
5950 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionConnectL2capRequest>(&header, _body_bytes, handles, &mut req)?;
5951 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5952 Ok(ConnectionRequest::ConnectL2cap { payload: req, control_handle })
5953 }
5954 0x1117a10b5ba1e219 => {
5955 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5956 let mut req = fidl::new_empty!(
5957 ConnectionTransferPeriodicAdvertisingSyncRequest,
5958 fidl::encoding::DefaultFuchsiaResourceDialect
5959 );
5960 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionTransferPeriodicAdvertisingSyncRequest>(&header, _body_bytes, handles, &mut req)?;
5961 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5962 Ok(ConnectionRequest::TransferPeriodicAdvertisingSync {
5963 payload: req,
5964 responder: ConnectionTransferPeriodicAdvertisingSyncResponder {
5965 control_handle: std::mem::ManuallyDrop::new(control_handle),
5966 tx_id: header.tx_id,
5967 },
5968 })
5969 }
5970 0x441a31a7effa7e2b => {
5971 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5972 let mut req = fidl::new_empty!(
5973 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
5974 fidl::encoding::DefaultFuchsiaResourceDialect
5975 );
5976 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(&header, _body_bytes, handles, &mut req)?;
5977 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5978 Ok(ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer {
5979 payload: req,
5980 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
5981 control_handle: std::mem::ManuallyDrop::new(control_handle),
5982 tx_id: header.tx_id,
5983 },
5984 })
5985 }
5986 _ => Err(fidl::Error::UnknownOrdinal {
5987 ordinal: header.ordinal,
5988 protocol_name:
5989 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5990 }),
5991 }))
5992 },
5993 )
5994 }
5995}
5996
5997#[derive(Debug)]
6003pub enum ConnectionRequest {
6004 GetCodecLocalDelayRange {
6012 payload: CodecDelayGetCodecLocalDelayRangeRequest,
6013 responder: ConnectionGetCodecLocalDelayRangeResponder,
6014 },
6015 RequestGattClient {
6019 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6020 control_handle: ConnectionControlHandle,
6021 },
6022 AcceptCis { payload: ConnectionAcceptCisRequest, control_handle: ConnectionControlHandle },
6037 ConnectL2cap { payload: ConnectionConnectL2capRequest, control_handle: ConnectionControlHandle },
6039 TransferPeriodicAdvertisingSync {
6042 payload: ConnectionTransferPeriodicAdvertisingSyncRequest,
6043 responder: ConnectionTransferPeriodicAdvertisingSyncResponder,
6044 },
6045 AcceptPeriodicAdvertisingSyncTransfer {
6048 payload: ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6049 responder: ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6050 },
6051}
6052
6053impl ConnectionRequest {
6054 #[allow(irrefutable_let_patterns)]
6055 pub fn into_get_codec_local_delay_range(
6056 self,
6057 ) -> Option<(
6058 CodecDelayGetCodecLocalDelayRangeRequest,
6059 ConnectionGetCodecLocalDelayRangeResponder,
6060 )> {
6061 if let ConnectionRequest::GetCodecLocalDelayRange { payload, responder } = self {
6062 Some((payload, responder))
6063 } else {
6064 None
6065 }
6066 }
6067
6068 #[allow(irrefutable_let_patterns)]
6069 pub fn into_request_gatt_client(
6070 self,
6071 ) -> Option<(
6072 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
6073 ConnectionControlHandle,
6074 )> {
6075 if let ConnectionRequest::RequestGattClient { client, control_handle } = self {
6076 Some((client, control_handle))
6077 } else {
6078 None
6079 }
6080 }
6081
6082 #[allow(irrefutable_let_patterns)]
6083 pub fn into_accept_cis(self) -> Option<(ConnectionAcceptCisRequest, ConnectionControlHandle)> {
6084 if let ConnectionRequest::AcceptCis { payload, control_handle } = self {
6085 Some((payload, control_handle))
6086 } else {
6087 None
6088 }
6089 }
6090
6091 #[allow(irrefutable_let_patterns)]
6092 pub fn into_connect_l2cap(
6093 self,
6094 ) -> Option<(ConnectionConnectL2capRequest, ConnectionControlHandle)> {
6095 if let ConnectionRequest::ConnectL2cap { payload, control_handle } = self {
6096 Some((payload, control_handle))
6097 } else {
6098 None
6099 }
6100 }
6101
6102 #[allow(irrefutable_let_patterns)]
6103 pub fn into_transfer_periodic_advertising_sync(
6104 self,
6105 ) -> Option<(
6106 ConnectionTransferPeriodicAdvertisingSyncRequest,
6107 ConnectionTransferPeriodicAdvertisingSyncResponder,
6108 )> {
6109 if let ConnectionRequest::TransferPeriodicAdvertisingSync { payload, responder } = self {
6110 Some((payload, responder))
6111 } else {
6112 None
6113 }
6114 }
6115
6116 #[allow(irrefutable_let_patterns)]
6117 pub fn into_accept_periodic_advertising_sync_transfer(
6118 self,
6119 ) -> Option<(
6120 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
6121 ConnectionAcceptPeriodicAdvertisingSyncTransferResponder,
6122 )> {
6123 if let ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { payload, responder } =
6124 self
6125 {
6126 Some((payload, responder))
6127 } else {
6128 None
6129 }
6130 }
6131
6132 pub fn method_name(&self) -> &'static str {
6134 match *self {
6135 ConnectionRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
6136 ConnectionRequest::RequestGattClient { .. } => "request_gatt_client",
6137 ConnectionRequest::AcceptCis { .. } => "accept_cis",
6138 ConnectionRequest::ConnectL2cap { .. } => "connect_l2cap",
6139 ConnectionRequest::TransferPeriodicAdvertisingSync { .. } => {
6140 "transfer_periodic_advertising_sync"
6141 }
6142 ConnectionRequest::AcceptPeriodicAdvertisingSyncTransfer { .. } => {
6143 "accept_periodic_advertising_sync_transfer"
6144 }
6145 }
6146 }
6147}
6148
6149#[derive(Debug, Clone)]
6150pub struct ConnectionControlHandle {
6151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6152}
6153
6154impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
6155 fn shutdown(&self) {
6156 self.inner.shutdown()
6157 }
6158 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6159 self.inner.shutdown_with_epitaph(status)
6160 }
6161
6162 fn is_closed(&self) -> bool {
6163 self.inner.channel().is_closed()
6164 }
6165 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6166 self.inner.channel().on_closed()
6167 }
6168
6169 #[cfg(target_os = "fuchsia")]
6170 fn signal_peer(
6171 &self,
6172 clear_mask: zx::Signals,
6173 set_mask: zx::Signals,
6174 ) -> Result<(), zx_status::Status> {
6175 use fidl::Peered;
6176 self.inner.channel().signal_peer(clear_mask, set_mask)
6177 }
6178}
6179
6180impl ConnectionControlHandle {}
6181
6182#[must_use = "FIDL methods require a response to be sent"]
6183#[derive(Debug)]
6184pub struct ConnectionGetCodecLocalDelayRangeResponder {
6185 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
6186 tx_id: u32,
6187}
6188
6189impl std::ops::Drop for ConnectionGetCodecLocalDelayRangeResponder {
6193 fn drop(&mut self) {
6194 self.control_handle.shutdown();
6195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6197 }
6198}
6199
6200impl fidl::endpoints::Responder for ConnectionGetCodecLocalDelayRangeResponder {
6201 type ControlHandle = ConnectionControlHandle;
6202
6203 fn control_handle(&self) -> &ConnectionControlHandle {
6204 &self.control_handle
6205 }
6206
6207 fn drop_without_shutdown(mut self) {
6208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6210 std::mem::forget(self);
6212 }
6213}
6214
6215impl ConnectionGetCodecLocalDelayRangeResponder {
6216 pub fn send(
6220 self,
6221 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6222 ) -> Result<(), fidl::Error> {
6223 let _result = self.send_raw(result);
6224 if _result.is_err() {
6225 self.control_handle.shutdown();
6226 }
6227 self.drop_without_shutdown();
6228 _result
6229 }
6230
6231 pub fn send_no_shutdown_on_err(
6233 self,
6234 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6235 ) -> Result<(), fidl::Error> {
6236 let _result = self.send_raw(result);
6237 self.drop_without_shutdown();
6238 _result
6239 }
6240
6241 fn send_raw(
6242 &self,
6243 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
6244 ) -> Result<(), fidl::Error> {
6245 self.control_handle.inner.send::<fidl::encoding::ResultType<
6246 CodecDelayGetCodecLocalDelayRangeResponse,
6247 i32,
6248 >>(
6249 result,
6250 self.tx_id,
6251 0x1cf34fdeed80b4d,
6252 fidl::encoding::DynamicFlags::empty(),
6253 )
6254 }
6255}
6256
6257#[must_use = "FIDL methods require a response to be sent"]
6258#[derive(Debug)]
6259pub struct ConnectionTransferPeriodicAdvertisingSyncResponder {
6260 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
6261 tx_id: u32,
6262}
6263
6264impl std::ops::Drop for ConnectionTransferPeriodicAdvertisingSyncResponder {
6268 fn drop(&mut self) {
6269 self.control_handle.shutdown();
6270 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6272 }
6273}
6274
6275impl fidl::endpoints::Responder for ConnectionTransferPeriodicAdvertisingSyncResponder {
6276 type ControlHandle = ConnectionControlHandle;
6277
6278 fn control_handle(&self) -> &ConnectionControlHandle {
6279 &self.control_handle
6280 }
6281
6282 fn drop_without_shutdown(mut self) {
6283 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6285 std::mem::forget(self);
6287 }
6288}
6289
6290impl ConnectionTransferPeriodicAdvertisingSyncResponder {
6291 pub fn send(
6295 self,
6296 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6297 ) -> Result<(), fidl::Error> {
6298 let _result = self.send_raw(result);
6299 if _result.is_err() {
6300 self.control_handle.shutdown();
6301 }
6302 self.drop_without_shutdown();
6303 _result
6304 }
6305
6306 pub fn send_no_shutdown_on_err(
6308 self,
6309 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6310 ) -> Result<(), fidl::Error> {
6311 let _result = self.send_raw(result);
6312 self.drop_without_shutdown();
6313 _result
6314 }
6315
6316 fn send_raw(
6317 &self,
6318 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6319 ) -> Result<(), fidl::Error> {
6320 self.control_handle.inner.send::<fidl::encoding::ResultType<
6321 fidl::encoding::EmptyStruct,
6322 PeriodicAdvertisingSyncTransferError,
6323 >>(
6324 result,
6325 self.tx_id,
6326 0x1117a10b5ba1e219,
6327 fidl::encoding::DynamicFlags::empty(),
6328 )
6329 }
6330}
6331
6332#[must_use = "FIDL methods require a response to be sent"]
6333#[derive(Debug)]
6334pub struct ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6335 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
6336 tx_id: u32,
6337}
6338
6339impl std::ops::Drop for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6343 fn drop(&mut self) {
6344 self.control_handle.shutdown();
6345 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6347 }
6348}
6349
6350impl fidl::endpoints::Responder for ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6351 type ControlHandle = ConnectionControlHandle;
6352
6353 fn control_handle(&self) -> &ConnectionControlHandle {
6354 &self.control_handle
6355 }
6356
6357 fn drop_without_shutdown(mut self) {
6358 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6360 std::mem::forget(self);
6362 }
6363}
6364
6365impl ConnectionAcceptPeriodicAdvertisingSyncTransferResponder {
6366 pub fn send(
6370 self,
6371 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6372 ) -> Result<(), fidl::Error> {
6373 let _result = self.send_raw(result);
6374 if _result.is_err() {
6375 self.control_handle.shutdown();
6376 }
6377 self.drop_without_shutdown();
6378 _result
6379 }
6380
6381 pub fn send_no_shutdown_on_err(
6383 self,
6384 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6385 ) -> Result<(), fidl::Error> {
6386 let _result = self.send_raw(result);
6387 self.drop_without_shutdown();
6388 _result
6389 }
6390
6391 fn send_raw(
6392 &self,
6393 mut result: Result<(), PeriodicAdvertisingSyncTransferError>,
6394 ) -> Result<(), fidl::Error> {
6395 self.control_handle.inner.send::<fidl::encoding::ResultType<
6396 fidl::encoding::EmptyStruct,
6397 PeriodicAdvertisingSyncTransferError,
6398 >>(
6399 result,
6400 self.tx_id,
6401 0x441a31a7effa7e2b,
6402 fidl::encoding::DynamicFlags::empty(),
6403 )
6404 }
6405}
6406
6407#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6408pub struct IsochronousStreamMarker;
6409
6410impl fidl::endpoints::ProtocolMarker for IsochronousStreamMarker {
6411 type Proxy = IsochronousStreamProxy;
6412 type RequestStream = IsochronousStreamRequestStream;
6413 #[cfg(target_os = "fuchsia")]
6414 type SynchronousProxy = IsochronousStreamSynchronousProxy;
6415
6416 const DEBUG_NAME: &'static str = "(anonymous) IsochronousStream";
6417}
6418pub type IsochronousStreamSetupDataPathResult = Result<(), i32>;
6419pub type IsochronousStreamWriteResult = Result<(), i32>;
6420
6421pub trait IsochronousStreamProxyInterface: Send + Sync {
6422 type SetupDataPathResponseFut: std::future::Future<Output = Result<IsochronousStreamSetupDataPathResult, fidl::Error>>
6423 + Send;
6424 fn r#setup_data_path(
6425 &self,
6426 payload: &IsochronousStreamSetupDataPathRequest,
6427 ) -> Self::SetupDataPathResponseFut;
6428 type ReadResponseFut: std::future::Future<Output = Result<IsochronousStreamReadResponse, fidl::Error>>
6429 + Send;
6430 fn r#read(&self) -> Self::ReadResponseFut;
6431 type WriteResponseFut: std::future::Future<Output = Result<IsochronousStreamWriteResult, fidl::Error>>
6432 + Send;
6433 fn r#write(&self, payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut;
6434}
6435#[derive(Debug)]
6436#[cfg(target_os = "fuchsia")]
6437pub struct IsochronousStreamSynchronousProxy {
6438 client: fidl::client::sync::Client,
6439}
6440
6441#[cfg(target_os = "fuchsia")]
6442impl fidl::endpoints::SynchronousProxy for IsochronousStreamSynchronousProxy {
6443 type Proxy = IsochronousStreamProxy;
6444 type Protocol = IsochronousStreamMarker;
6445
6446 fn from_channel(inner: fidl::Channel) -> Self {
6447 Self::new(inner)
6448 }
6449
6450 fn into_channel(self) -> fidl::Channel {
6451 self.client.into_channel()
6452 }
6453
6454 fn as_channel(&self) -> &fidl::Channel {
6455 self.client.as_channel()
6456 }
6457}
6458
6459#[cfg(target_os = "fuchsia")]
6460impl IsochronousStreamSynchronousProxy {
6461 pub fn new(channel: fidl::Channel) -> Self {
6462 let protocol_name =
6463 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6464 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6465 }
6466
6467 pub fn into_channel(self) -> fidl::Channel {
6468 self.client.into_channel()
6469 }
6470
6471 pub fn wait_for_event(
6474 &self,
6475 deadline: zx::MonotonicInstant,
6476 ) -> Result<IsochronousStreamEvent, fidl::Error> {
6477 IsochronousStreamEvent::decode(self.client.wait_for_event(deadline)?)
6478 }
6479
6480 pub fn r#setup_data_path(
6492 &self,
6493 mut payload: &IsochronousStreamSetupDataPathRequest,
6494 ___deadline: zx::MonotonicInstant,
6495 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
6496 let _response = self.client.send_query::<
6497 IsochronousStreamSetupDataPathRequest,
6498 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6499 >(
6500 payload,
6501 0x7ec1e2b9cc6d2fbe,
6502 fidl::encoding::DynamicFlags::FLEXIBLE,
6503 ___deadline,
6504 )?
6505 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
6506 Ok(_response.map(|x| x))
6507 }
6508
6509 pub fn r#read(
6515 &self,
6516 ___deadline: zx::MonotonicInstant,
6517 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
6518 let _response = self.client.send_query::<
6519 fidl::encoding::EmptyPayload,
6520 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
6521 >(
6522 (),
6523 0x6d7d8b4950ed3a32,
6524 fidl::encoding::DynamicFlags::FLEXIBLE,
6525 ___deadline,
6526 )?
6527 .into_result::<IsochronousStreamMarker>("read")?;
6528 Ok(_response)
6529 }
6530
6531 pub fn r#write(
6535 &self,
6536 mut payload: &IsochronousStreamWriteRequest,
6537 ___deadline: zx::MonotonicInstant,
6538 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
6539 let _response = self.client.send_query::<
6540 IsochronousStreamWriteRequest,
6541 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6542 >(
6543 payload,
6544 0x5282e90b667d0d43,
6545 fidl::encoding::DynamicFlags::FLEXIBLE,
6546 ___deadline,
6547 )?
6548 .into_result::<IsochronousStreamMarker>("write")?;
6549 Ok(_response.map(|x| x))
6550 }
6551}
6552
6553#[cfg(target_os = "fuchsia")]
6554impl From<IsochronousStreamSynchronousProxy> for zx::Handle {
6555 fn from(value: IsochronousStreamSynchronousProxy) -> Self {
6556 value.into_channel().into()
6557 }
6558}
6559
6560#[cfg(target_os = "fuchsia")]
6561impl From<fidl::Channel> for IsochronousStreamSynchronousProxy {
6562 fn from(value: fidl::Channel) -> Self {
6563 Self::new(value)
6564 }
6565}
6566
6567#[cfg(target_os = "fuchsia")]
6568impl fidl::endpoints::FromClient for IsochronousStreamSynchronousProxy {
6569 type Protocol = IsochronousStreamMarker;
6570
6571 fn from_client(value: fidl::endpoints::ClientEnd<IsochronousStreamMarker>) -> Self {
6572 Self::new(value.into_channel())
6573 }
6574}
6575
6576#[derive(Debug, Clone)]
6577pub struct IsochronousStreamProxy {
6578 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6579}
6580
6581impl fidl::endpoints::Proxy for IsochronousStreamProxy {
6582 type Protocol = IsochronousStreamMarker;
6583
6584 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6585 Self::new(inner)
6586 }
6587
6588 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6589 self.client.into_channel().map_err(|client| Self { client })
6590 }
6591
6592 fn as_channel(&self) -> &::fidl::AsyncChannel {
6593 self.client.as_channel()
6594 }
6595}
6596
6597impl IsochronousStreamProxy {
6598 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6600 let protocol_name =
6601 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6602 Self { client: fidl::client::Client::new(channel, protocol_name) }
6603 }
6604
6605 pub fn take_event_stream(&self) -> IsochronousStreamEventStream {
6611 IsochronousStreamEventStream { event_receiver: self.client.take_event_receiver() }
6612 }
6613
6614 pub fn r#setup_data_path(
6626 &self,
6627 mut payload: &IsochronousStreamSetupDataPathRequest,
6628 ) -> fidl::client::QueryResponseFut<
6629 IsochronousStreamSetupDataPathResult,
6630 fidl::encoding::DefaultFuchsiaResourceDialect,
6631 > {
6632 IsochronousStreamProxyInterface::r#setup_data_path(self, payload)
6633 }
6634
6635 pub fn r#read(
6641 &self,
6642 ) -> fidl::client::QueryResponseFut<
6643 IsochronousStreamReadResponse,
6644 fidl::encoding::DefaultFuchsiaResourceDialect,
6645 > {
6646 IsochronousStreamProxyInterface::r#read(self)
6647 }
6648
6649 pub fn r#write(
6653 &self,
6654 mut payload: &IsochronousStreamWriteRequest,
6655 ) -> fidl::client::QueryResponseFut<
6656 IsochronousStreamWriteResult,
6657 fidl::encoding::DefaultFuchsiaResourceDialect,
6658 > {
6659 IsochronousStreamProxyInterface::r#write(self, payload)
6660 }
6661}
6662
6663impl IsochronousStreamProxyInterface for IsochronousStreamProxy {
6664 type SetupDataPathResponseFut = fidl::client::QueryResponseFut<
6665 IsochronousStreamSetupDataPathResult,
6666 fidl::encoding::DefaultFuchsiaResourceDialect,
6667 >;
6668 fn r#setup_data_path(
6669 &self,
6670 mut payload: &IsochronousStreamSetupDataPathRequest,
6671 ) -> Self::SetupDataPathResponseFut {
6672 fn _decode(
6673 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6674 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
6675 let _response = fidl::client::decode_transaction_body::<
6676 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6677 fidl::encoding::DefaultFuchsiaResourceDialect,
6678 0x7ec1e2b9cc6d2fbe,
6679 >(_buf?)?
6680 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
6681 Ok(_response.map(|x| x))
6682 }
6683 self.client.send_query_and_decode::<
6684 IsochronousStreamSetupDataPathRequest,
6685 IsochronousStreamSetupDataPathResult,
6686 >(
6687 payload,
6688 0x7ec1e2b9cc6d2fbe,
6689 fidl::encoding::DynamicFlags::FLEXIBLE,
6690 _decode,
6691 )
6692 }
6693
6694 type ReadResponseFut = fidl::client::QueryResponseFut<
6695 IsochronousStreamReadResponse,
6696 fidl::encoding::DefaultFuchsiaResourceDialect,
6697 >;
6698 fn r#read(&self) -> Self::ReadResponseFut {
6699 fn _decode(
6700 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6701 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
6702 let _response = fidl::client::decode_transaction_body::<
6703 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
6704 fidl::encoding::DefaultFuchsiaResourceDialect,
6705 0x6d7d8b4950ed3a32,
6706 >(_buf?)?
6707 .into_result::<IsochronousStreamMarker>("read")?;
6708 Ok(_response)
6709 }
6710 self.client
6711 .send_query_and_decode::<fidl::encoding::EmptyPayload, IsochronousStreamReadResponse>(
6712 (),
6713 0x6d7d8b4950ed3a32,
6714 fidl::encoding::DynamicFlags::FLEXIBLE,
6715 _decode,
6716 )
6717 }
6718
6719 type WriteResponseFut = fidl::client::QueryResponseFut<
6720 IsochronousStreamWriteResult,
6721 fidl::encoding::DefaultFuchsiaResourceDialect,
6722 >;
6723 fn r#write(&self, mut payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut {
6724 fn _decode(
6725 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6726 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
6727 let _response = fidl::client::decode_transaction_body::<
6728 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6729 fidl::encoding::DefaultFuchsiaResourceDialect,
6730 0x5282e90b667d0d43,
6731 >(_buf?)?
6732 .into_result::<IsochronousStreamMarker>("write")?;
6733 Ok(_response.map(|x| x))
6734 }
6735 self.client
6736 .send_query_and_decode::<IsochronousStreamWriteRequest, IsochronousStreamWriteResult>(
6737 payload,
6738 0x5282e90b667d0d43,
6739 fidl::encoding::DynamicFlags::FLEXIBLE,
6740 _decode,
6741 )
6742 }
6743}
6744
6745pub struct IsochronousStreamEventStream {
6746 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6747}
6748
6749impl std::marker::Unpin for IsochronousStreamEventStream {}
6750
6751impl futures::stream::FusedStream for IsochronousStreamEventStream {
6752 fn is_terminated(&self) -> bool {
6753 self.event_receiver.is_terminated()
6754 }
6755}
6756
6757impl futures::Stream for IsochronousStreamEventStream {
6758 type Item = Result<IsochronousStreamEvent, fidl::Error>;
6759
6760 fn poll_next(
6761 mut self: std::pin::Pin<&mut Self>,
6762 cx: &mut std::task::Context<'_>,
6763 ) -> std::task::Poll<Option<Self::Item>> {
6764 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6765 &mut self.event_receiver,
6766 cx
6767 )?) {
6768 Some(buf) => std::task::Poll::Ready(Some(IsochronousStreamEvent::decode(buf))),
6769 None => std::task::Poll::Ready(None),
6770 }
6771 }
6772}
6773
6774#[derive(Debug)]
6775pub enum IsochronousStreamEvent {
6776 OnEstablished {
6777 payload: IsochronousStreamOnEstablishedRequest,
6778 },
6779 #[non_exhaustive]
6780 _UnknownEvent {
6781 ordinal: u64,
6783 },
6784}
6785
6786impl IsochronousStreamEvent {
6787 #[allow(irrefutable_let_patterns)]
6788 pub fn into_on_established(self) -> Option<IsochronousStreamOnEstablishedRequest> {
6789 if let IsochronousStreamEvent::OnEstablished { payload } = self {
6790 Some((payload))
6791 } else {
6792 None
6793 }
6794 }
6795
6796 fn decode(
6798 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6799 ) -> Result<IsochronousStreamEvent, fidl::Error> {
6800 let (bytes, _handles) = buf.split_mut();
6801 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6802 debug_assert_eq!(tx_header.tx_id, 0);
6803 match tx_header.ordinal {
6804 0x341c50e9d10f3421 => {
6805 let mut out = fidl::new_empty!(
6806 IsochronousStreamOnEstablishedRequest,
6807 fidl::encoding::DefaultFuchsiaResourceDialect
6808 );
6809 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6810 Ok((IsochronousStreamEvent::OnEstablished { payload: out }))
6811 }
6812 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6813 Ok(IsochronousStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6814 }
6815 _ => Err(fidl::Error::UnknownOrdinal {
6816 ordinal: tx_header.ordinal,
6817 protocol_name:
6818 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6819 }),
6820 }
6821 }
6822}
6823
6824pub struct IsochronousStreamRequestStream {
6826 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6827 is_terminated: bool,
6828}
6829
6830impl std::marker::Unpin for IsochronousStreamRequestStream {}
6831
6832impl futures::stream::FusedStream for IsochronousStreamRequestStream {
6833 fn is_terminated(&self) -> bool {
6834 self.is_terminated
6835 }
6836}
6837
6838impl fidl::endpoints::RequestStream for IsochronousStreamRequestStream {
6839 type Protocol = IsochronousStreamMarker;
6840 type ControlHandle = IsochronousStreamControlHandle;
6841
6842 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6843 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6844 }
6845
6846 fn control_handle(&self) -> Self::ControlHandle {
6847 IsochronousStreamControlHandle { inner: self.inner.clone() }
6848 }
6849
6850 fn into_inner(
6851 self,
6852 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6853 {
6854 (self.inner, self.is_terminated)
6855 }
6856
6857 fn from_inner(
6858 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6859 is_terminated: bool,
6860 ) -> Self {
6861 Self { inner, is_terminated }
6862 }
6863}
6864
6865impl futures::Stream for IsochronousStreamRequestStream {
6866 type Item = Result<IsochronousStreamRequest, fidl::Error>;
6867
6868 fn poll_next(
6869 mut self: std::pin::Pin<&mut Self>,
6870 cx: &mut std::task::Context<'_>,
6871 ) -> std::task::Poll<Option<Self::Item>> {
6872 let this = &mut *self;
6873 if this.inner.check_shutdown(cx) {
6874 this.is_terminated = true;
6875 return std::task::Poll::Ready(None);
6876 }
6877 if this.is_terminated {
6878 panic!("polled IsochronousStreamRequestStream after completion");
6879 }
6880 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6881 |bytes, handles| {
6882 match this.inner.channel().read_etc(cx, bytes, handles) {
6883 std::task::Poll::Ready(Ok(())) => {}
6884 std::task::Poll::Pending => return std::task::Poll::Pending,
6885 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6886 this.is_terminated = true;
6887 return std::task::Poll::Ready(None);
6888 }
6889 std::task::Poll::Ready(Err(e)) => {
6890 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6891 e.into(),
6892 ))))
6893 }
6894 }
6895
6896 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6898
6899 std::task::Poll::Ready(Some(match header.ordinal {
6900 0x7ec1e2b9cc6d2fbe => {
6901 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6902 let mut req = fidl::new_empty!(
6903 IsochronousStreamSetupDataPathRequest,
6904 fidl::encoding::DefaultFuchsiaResourceDialect
6905 );
6906 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamSetupDataPathRequest>(&header, _body_bytes, handles, &mut req)?;
6907 let control_handle =
6908 IsochronousStreamControlHandle { inner: this.inner.clone() };
6909 Ok(IsochronousStreamRequest::SetupDataPath {
6910 payload: req,
6911 responder: IsochronousStreamSetupDataPathResponder {
6912 control_handle: std::mem::ManuallyDrop::new(control_handle),
6913 tx_id: header.tx_id,
6914 },
6915 })
6916 }
6917 0x6d7d8b4950ed3a32 => {
6918 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6919 let mut req = fidl::new_empty!(
6920 fidl::encoding::EmptyPayload,
6921 fidl::encoding::DefaultFuchsiaResourceDialect
6922 );
6923 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6924 let control_handle =
6925 IsochronousStreamControlHandle { inner: this.inner.clone() };
6926 Ok(IsochronousStreamRequest::Read {
6927 responder: IsochronousStreamReadResponder {
6928 control_handle: std::mem::ManuallyDrop::new(control_handle),
6929 tx_id: header.tx_id,
6930 },
6931 })
6932 }
6933 0x5282e90b667d0d43 => {
6934 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6935 let mut req = fidl::new_empty!(
6936 IsochronousStreamWriteRequest,
6937 fidl::encoding::DefaultFuchsiaResourceDialect
6938 );
6939 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamWriteRequest>(&header, _body_bytes, handles, &mut req)?;
6940 let control_handle =
6941 IsochronousStreamControlHandle { inner: this.inner.clone() };
6942 Ok(IsochronousStreamRequest::Write {
6943 payload: req,
6944 responder: IsochronousStreamWriteResponder {
6945 control_handle: std::mem::ManuallyDrop::new(control_handle),
6946 tx_id: header.tx_id,
6947 },
6948 })
6949 }
6950 _ if header.tx_id == 0
6951 && header
6952 .dynamic_flags()
6953 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6954 {
6955 Ok(IsochronousStreamRequest::_UnknownMethod {
6956 ordinal: header.ordinal,
6957 control_handle: IsochronousStreamControlHandle {
6958 inner: this.inner.clone(),
6959 },
6960 method_type: fidl::MethodType::OneWay,
6961 })
6962 }
6963 _ if header
6964 .dynamic_flags()
6965 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6966 {
6967 this.inner.send_framework_err(
6968 fidl::encoding::FrameworkErr::UnknownMethod,
6969 header.tx_id,
6970 header.ordinal,
6971 header.dynamic_flags(),
6972 (bytes, handles),
6973 )?;
6974 Ok(IsochronousStreamRequest::_UnknownMethod {
6975 ordinal: header.ordinal,
6976 control_handle: IsochronousStreamControlHandle {
6977 inner: this.inner.clone(),
6978 },
6979 method_type: fidl::MethodType::TwoWay,
6980 })
6981 }
6982 _ => Err(fidl::Error::UnknownOrdinal {
6983 ordinal: header.ordinal,
6984 protocol_name:
6985 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6986 }),
6987 }))
6988 },
6989 )
6990 }
6991}
6992
6993#[derive(Debug)]
6994pub enum IsochronousStreamRequest {
6995 SetupDataPath {
7007 payload: IsochronousStreamSetupDataPathRequest,
7008 responder: IsochronousStreamSetupDataPathResponder,
7009 },
7010 Read { responder: IsochronousStreamReadResponder },
7016 Write { payload: IsochronousStreamWriteRequest, responder: IsochronousStreamWriteResponder },
7020 #[non_exhaustive]
7022 _UnknownMethod {
7023 ordinal: u64,
7025 control_handle: IsochronousStreamControlHandle,
7026 method_type: fidl::MethodType,
7027 },
7028}
7029
7030impl IsochronousStreamRequest {
7031 #[allow(irrefutable_let_patterns)]
7032 pub fn into_setup_data_path(
7033 self,
7034 ) -> Option<(IsochronousStreamSetupDataPathRequest, IsochronousStreamSetupDataPathResponder)>
7035 {
7036 if let IsochronousStreamRequest::SetupDataPath { payload, responder } = self {
7037 Some((payload, responder))
7038 } else {
7039 None
7040 }
7041 }
7042
7043 #[allow(irrefutable_let_patterns)]
7044 pub fn into_read(self) -> Option<(IsochronousStreamReadResponder)> {
7045 if let IsochronousStreamRequest::Read { responder } = self {
7046 Some((responder))
7047 } else {
7048 None
7049 }
7050 }
7051
7052 #[allow(irrefutable_let_patterns)]
7053 pub fn into_write(
7054 self,
7055 ) -> Option<(IsochronousStreamWriteRequest, IsochronousStreamWriteResponder)> {
7056 if let IsochronousStreamRequest::Write { payload, responder } = self {
7057 Some((payload, responder))
7058 } else {
7059 None
7060 }
7061 }
7062
7063 pub fn method_name(&self) -> &'static str {
7065 match *self {
7066 IsochronousStreamRequest::SetupDataPath { .. } => "setup_data_path",
7067 IsochronousStreamRequest::Read { .. } => "read",
7068 IsochronousStreamRequest::Write { .. } => "write",
7069 IsochronousStreamRequest::_UnknownMethod {
7070 method_type: fidl::MethodType::OneWay,
7071 ..
7072 } => "unknown one-way method",
7073 IsochronousStreamRequest::_UnknownMethod {
7074 method_type: fidl::MethodType::TwoWay,
7075 ..
7076 } => "unknown two-way method",
7077 }
7078 }
7079}
7080
7081#[derive(Debug, Clone)]
7082pub struct IsochronousStreamControlHandle {
7083 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7084}
7085
7086impl fidl::endpoints::ControlHandle for IsochronousStreamControlHandle {
7087 fn shutdown(&self) {
7088 self.inner.shutdown()
7089 }
7090 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7091 self.inner.shutdown_with_epitaph(status)
7092 }
7093
7094 fn is_closed(&self) -> bool {
7095 self.inner.channel().is_closed()
7096 }
7097 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7098 self.inner.channel().on_closed()
7099 }
7100
7101 #[cfg(target_os = "fuchsia")]
7102 fn signal_peer(
7103 &self,
7104 clear_mask: zx::Signals,
7105 set_mask: zx::Signals,
7106 ) -> Result<(), zx_status::Status> {
7107 use fidl::Peered;
7108 self.inner.channel().signal_peer(clear_mask, set_mask)
7109 }
7110}
7111
7112impl IsochronousStreamControlHandle {
7113 pub fn send_on_established(
7114 &self,
7115 mut payload: &IsochronousStreamOnEstablishedRequest,
7116 ) -> Result<(), fidl::Error> {
7117 self.inner.send::<IsochronousStreamOnEstablishedRequest>(
7118 payload,
7119 0,
7120 0x341c50e9d10f3421,
7121 fidl::encoding::DynamicFlags::FLEXIBLE,
7122 )
7123 }
7124}
7125
7126#[must_use = "FIDL methods require a response to be sent"]
7127#[derive(Debug)]
7128pub struct IsochronousStreamSetupDataPathResponder {
7129 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7130 tx_id: u32,
7131}
7132
7133impl std::ops::Drop for IsochronousStreamSetupDataPathResponder {
7137 fn drop(&mut self) {
7138 self.control_handle.shutdown();
7139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7141 }
7142}
7143
7144impl fidl::endpoints::Responder for IsochronousStreamSetupDataPathResponder {
7145 type ControlHandle = IsochronousStreamControlHandle;
7146
7147 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7148 &self.control_handle
7149 }
7150
7151 fn drop_without_shutdown(mut self) {
7152 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7154 std::mem::forget(self);
7156 }
7157}
7158
7159impl IsochronousStreamSetupDataPathResponder {
7160 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7164 let _result = self.send_raw(result);
7165 if _result.is_err() {
7166 self.control_handle.shutdown();
7167 }
7168 self.drop_without_shutdown();
7169 _result
7170 }
7171
7172 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7174 let _result = self.send_raw(result);
7175 self.drop_without_shutdown();
7176 _result
7177 }
7178
7179 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7180 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7181 fidl::encoding::EmptyStruct,
7182 i32,
7183 >>(
7184 fidl::encoding::FlexibleResult::new(result),
7185 self.tx_id,
7186 0x7ec1e2b9cc6d2fbe,
7187 fidl::encoding::DynamicFlags::FLEXIBLE,
7188 )
7189 }
7190}
7191
7192#[must_use = "FIDL methods require a response to be sent"]
7193#[derive(Debug)]
7194pub struct IsochronousStreamReadResponder {
7195 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7196 tx_id: u32,
7197}
7198
7199impl std::ops::Drop for IsochronousStreamReadResponder {
7203 fn drop(&mut self) {
7204 self.control_handle.shutdown();
7205 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7207 }
7208}
7209
7210impl fidl::endpoints::Responder for IsochronousStreamReadResponder {
7211 type ControlHandle = IsochronousStreamControlHandle;
7212
7213 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7214 &self.control_handle
7215 }
7216
7217 fn drop_without_shutdown(mut self) {
7218 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7220 std::mem::forget(self);
7222 }
7223}
7224
7225impl IsochronousStreamReadResponder {
7226 pub fn send(self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
7230 let _result = self.send_raw(payload);
7231 if _result.is_err() {
7232 self.control_handle.shutdown();
7233 }
7234 self.drop_without_shutdown();
7235 _result
7236 }
7237
7238 pub fn send_no_shutdown_on_err(
7240 self,
7241 mut payload: &IsochronousStreamReadResponse,
7242 ) -> Result<(), fidl::Error> {
7243 let _result = self.send_raw(payload);
7244 self.drop_without_shutdown();
7245 _result
7246 }
7247
7248 fn send_raw(&self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
7249 self.control_handle
7250 .inner
7251 .send::<fidl::encoding::FlexibleType<IsochronousStreamReadResponse>>(
7252 fidl::encoding::Flexible::new(payload),
7253 self.tx_id,
7254 0x6d7d8b4950ed3a32,
7255 fidl::encoding::DynamicFlags::FLEXIBLE,
7256 )
7257 }
7258}
7259
7260#[must_use = "FIDL methods require a response to be sent"]
7261#[derive(Debug)]
7262pub struct IsochronousStreamWriteResponder {
7263 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
7264 tx_id: u32,
7265}
7266
7267impl std::ops::Drop for IsochronousStreamWriteResponder {
7271 fn drop(&mut self) {
7272 self.control_handle.shutdown();
7273 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7275 }
7276}
7277
7278impl fidl::endpoints::Responder for IsochronousStreamWriteResponder {
7279 type ControlHandle = IsochronousStreamControlHandle;
7280
7281 fn control_handle(&self) -> &IsochronousStreamControlHandle {
7282 &self.control_handle
7283 }
7284
7285 fn drop_without_shutdown(mut self) {
7286 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7288 std::mem::forget(self);
7290 }
7291}
7292
7293impl IsochronousStreamWriteResponder {
7294 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7298 let _result = self.send_raw(result);
7299 if _result.is_err() {
7300 self.control_handle.shutdown();
7301 }
7302 self.drop_without_shutdown();
7303 _result
7304 }
7305
7306 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7308 let _result = self.send_raw(result);
7309 self.drop_without_shutdown();
7310 _result
7311 }
7312
7313 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7314 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7315 fidl::encoding::EmptyStruct,
7316 i32,
7317 >>(
7318 fidl::encoding::FlexibleResult::new(result),
7319 self.tx_id,
7320 0x5282e90b667d0d43,
7321 fidl::encoding::DynamicFlags::FLEXIBLE,
7322 )
7323 }
7324}
7325
7326#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7327pub struct PeriodicAdvertisingSyncMarker;
7328
7329impl fidl::endpoints::ProtocolMarker for PeriodicAdvertisingSyncMarker {
7330 type Proxy = PeriodicAdvertisingSyncProxy;
7331 type RequestStream = PeriodicAdvertisingSyncRequestStream;
7332 #[cfg(target_os = "fuchsia")]
7333 type SynchronousProxy = PeriodicAdvertisingSyncSynchronousProxy;
7334
7335 const DEBUG_NAME: &'static str = "(anonymous) PeriodicAdvertisingSync";
7336}
7337pub type PeriodicAdvertisingSyncSyncToSubeventsResult = Result<(), i32>;
7338
7339pub trait PeriodicAdvertisingSyncProxyInterface: Send + Sync {
7340 type WatchAdvertisingReportResponseFut: std::future::Future<
7341 Output = Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error>,
7342 > + Send;
7343 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut;
7344 type SyncToSubeventsResponseFut: std::future::Future<
7345 Output = Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error>,
7346 > + Send;
7347 fn r#sync_to_subevents(
7348 &self,
7349 payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
7350 ) -> Self::SyncToSubeventsResponseFut;
7351 fn r#cancel(&self) -> Result<(), fidl::Error>;
7352}
7353#[derive(Debug)]
7354#[cfg(target_os = "fuchsia")]
7355pub struct PeriodicAdvertisingSyncSynchronousProxy {
7356 client: fidl::client::sync::Client,
7357}
7358
7359#[cfg(target_os = "fuchsia")]
7360impl fidl::endpoints::SynchronousProxy for PeriodicAdvertisingSyncSynchronousProxy {
7361 type Proxy = PeriodicAdvertisingSyncProxy;
7362 type Protocol = PeriodicAdvertisingSyncMarker;
7363
7364 fn from_channel(inner: fidl::Channel) -> Self {
7365 Self::new(inner)
7366 }
7367
7368 fn into_channel(self) -> fidl::Channel {
7369 self.client.into_channel()
7370 }
7371
7372 fn as_channel(&self) -> &fidl::Channel {
7373 self.client.as_channel()
7374 }
7375}
7376
7377#[cfg(target_os = "fuchsia")]
7378impl PeriodicAdvertisingSyncSynchronousProxy {
7379 pub fn new(channel: fidl::Channel) -> Self {
7380 let protocol_name =
7381 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7382 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7383 }
7384
7385 pub fn into_channel(self) -> fidl::Channel {
7386 self.client.into_channel()
7387 }
7388
7389 pub fn wait_for_event(
7392 &self,
7393 deadline: zx::MonotonicInstant,
7394 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
7395 PeriodicAdvertisingSyncEvent::decode(self.client.wait_for_event(deadline)?)
7396 }
7397
7398 pub fn r#watch_advertising_report(
7401 &self,
7402 ___deadline: zx::MonotonicInstant,
7403 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
7404 let _response = self.client.send_query::<
7405 fidl::encoding::EmptyPayload,
7406 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
7407 >(
7408 (),
7409 0x2ea610fea0e7d337,
7410 fidl::encoding::DynamicFlags::FLEXIBLE,
7411 ___deadline,
7412 )?
7413 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
7414 Ok(_response)
7415 }
7416
7417 pub fn r#sync_to_subevents(
7420 &self,
7421 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
7422 ___deadline: zx::MonotonicInstant,
7423 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
7424 let _response = self.client.send_query::<
7425 PeriodicAdvertisingSyncSyncToSubeventsRequest,
7426 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7427 >(
7428 payload,
7429 0x653c5dab1f1d80ed,
7430 fidl::encoding::DynamicFlags::FLEXIBLE,
7431 ___deadline,
7432 )?
7433 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
7434 Ok(_response.map(|x| x))
7435 }
7436
7437 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
7442 self.client.send::<fidl::encoding::EmptyPayload>(
7443 (),
7444 0xd617c037eaf5d92,
7445 fidl::encoding::DynamicFlags::FLEXIBLE,
7446 )
7447 }
7448}
7449
7450#[cfg(target_os = "fuchsia")]
7451impl From<PeriodicAdvertisingSyncSynchronousProxy> for zx::Handle {
7452 fn from(value: PeriodicAdvertisingSyncSynchronousProxy) -> Self {
7453 value.into_channel().into()
7454 }
7455}
7456
7457#[cfg(target_os = "fuchsia")]
7458impl From<fidl::Channel> for PeriodicAdvertisingSyncSynchronousProxy {
7459 fn from(value: fidl::Channel) -> Self {
7460 Self::new(value)
7461 }
7462}
7463
7464#[cfg(target_os = "fuchsia")]
7465impl fidl::endpoints::FromClient for PeriodicAdvertisingSyncSynchronousProxy {
7466 type Protocol = PeriodicAdvertisingSyncMarker;
7467
7468 fn from_client(value: fidl::endpoints::ClientEnd<PeriodicAdvertisingSyncMarker>) -> Self {
7469 Self::new(value.into_channel())
7470 }
7471}
7472
7473#[derive(Debug, Clone)]
7474pub struct PeriodicAdvertisingSyncProxy {
7475 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7476}
7477
7478impl fidl::endpoints::Proxy for PeriodicAdvertisingSyncProxy {
7479 type Protocol = PeriodicAdvertisingSyncMarker;
7480
7481 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7482 Self::new(inner)
7483 }
7484
7485 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7486 self.client.into_channel().map_err(|client| Self { client })
7487 }
7488
7489 fn as_channel(&self) -> &::fidl::AsyncChannel {
7490 self.client.as_channel()
7491 }
7492}
7493
7494impl PeriodicAdvertisingSyncProxy {
7495 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7497 let protocol_name =
7498 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7499 Self { client: fidl::client::Client::new(channel, protocol_name) }
7500 }
7501
7502 pub fn take_event_stream(&self) -> PeriodicAdvertisingSyncEventStream {
7508 PeriodicAdvertisingSyncEventStream { event_receiver: self.client.take_event_receiver() }
7509 }
7510
7511 pub fn r#watch_advertising_report(
7514 &self,
7515 ) -> fidl::client::QueryResponseFut<
7516 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
7517 fidl::encoding::DefaultFuchsiaResourceDialect,
7518 > {
7519 PeriodicAdvertisingSyncProxyInterface::r#watch_advertising_report(self)
7520 }
7521
7522 pub fn r#sync_to_subevents(
7525 &self,
7526 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
7527 ) -> fidl::client::QueryResponseFut<
7528 PeriodicAdvertisingSyncSyncToSubeventsResult,
7529 fidl::encoding::DefaultFuchsiaResourceDialect,
7530 > {
7531 PeriodicAdvertisingSyncProxyInterface::r#sync_to_subevents(self, payload)
7532 }
7533
7534 pub fn r#cancel(&self) -> Result<(), fidl::Error> {
7539 PeriodicAdvertisingSyncProxyInterface::r#cancel(self)
7540 }
7541}
7542
7543impl PeriodicAdvertisingSyncProxyInterface for PeriodicAdvertisingSyncProxy {
7544 type WatchAdvertisingReportResponseFut = fidl::client::QueryResponseFut<
7545 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
7546 fidl::encoding::DefaultFuchsiaResourceDialect,
7547 >;
7548 fn r#watch_advertising_report(&self) -> Self::WatchAdvertisingReportResponseFut {
7549 fn _decode(
7550 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7551 ) -> Result<PeriodicAdvertisingSyncWatchAdvertisingReportResponse, fidl::Error> {
7552 let _response = fidl::client::decode_transaction_body::<
7553 fidl::encoding::FlexibleType<PeriodicAdvertisingSyncWatchAdvertisingReportResponse>,
7554 fidl::encoding::DefaultFuchsiaResourceDialect,
7555 0x2ea610fea0e7d337,
7556 >(_buf?)?
7557 .into_result::<PeriodicAdvertisingSyncMarker>("watch_advertising_report")?;
7558 Ok(_response)
7559 }
7560 self.client.send_query_and_decode::<
7561 fidl::encoding::EmptyPayload,
7562 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
7563 >(
7564 (),
7565 0x2ea610fea0e7d337,
7566 fidl::encoding::DynamicFlags::FLEXIBLE,
7567 _decode,
7568 )
7569 }
7570
7571 type SyncToSubeventsResponseFut = fidl::client::QueryResponseFut<
7572 PeriodicAdvertisingSyncSyncToSubeventsResult,
7573 fidl::encoding::DefaultFuchsiaResourceDialect,
7574 >;
7575 fn r#sync_to_subevents(
7576 &self,
7577 mut payload: &PeriodicAdvertisingSyncSyncToSubeventsRequest,
7578 ) -> Self::SyncToSubeventsResponseFut {
7579 fn _decode(
7580 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7581 ) -> Result<PeriodicAdvertisingSyncSyncToSubeventsResult, fidl::Error> {
7582 let _response = fidl::client::decode_transaction_body::<
7583 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
7584 fidl::encoding::DefaultFuchsiaResourceDialect,
7585 0x653c5dab1f1d80ed,
7586 >(_buf?)?
7587 .into_result::<PeriodicAdvertisingSyncMarker>("sync_to_subevents")?;
7588 Ok(_response.map(|x| x))
7589 }
7590 self.client.send_query_and_decode::<
7591 PeriodicAdvertisingSyncSyncToSubeventsRequest,
7592 PeriodicAdvertisingSyncSyncToSubeventsResult,
7593 >(
7594 payload,
7595 0x653c5dab1f1d80ed,
7596 fidl::encoding::DynamicFlags::FLEXIBLE,
7597 _decode,
7598 )
7599 }
7600
7601 fn r#cancel(&self) -> Result<(), fidl::Error> {
7602 self.client.send::<fidl::encoding::EmptyPayload>(
7603 (),
7604 0xd617c037eaf5d92,
7605 fidl::encoding::DynamicFlags::FLEXIBLE,
7606 )
7607 }
7608}
7609
7610pub struct PeriodicAdvertisingSyncEventStream {
7611 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7612}
7613
7614impl std::marker::Unpin for PeriodicAdvertisingSyncEventStream {}
7615
7616impl futures::stream::FusedStream for PeriodicAdvertisingSyncEventStream {
7617 fn is_terminated(&self) -> bool {
7618 self.event_receiver.is_terminated()
7619 }
7620}
7621
7622impl futures::Stream for PeriodicAdvertisingSyncEventStream {
7623 type Item = Result<PeriodicAdvertisingSyncEvent, fidl::Error>;
7624
7625 fn poll_next(
7626 mut self: std::pin::Pin<&mut Self>,
7627 cx: &mut std::task::Context<'_>,
7628 ) -> std::task::Poll<Option<Self::Item>> {
7629 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7630 &mut self.event_receiver,
7631 cx
7632 )?) {
7633 Some(buf) => std::task::Poll::Ready(Some(PeriodicAdvertisingSyncEvent::decode(buf))),
7634 None => std::task::Poll::Ready(None),
7635 }
7636 }
7637}
7638
7639#[derive(Debug)]
7640pub enum PeriodicAdvertisingSyncEvent {
7641 OnEstablished {
7642 payload: PeriodicAdvertisingSyncOnEstablishedRequest,
7643 },
7644 OnError {
7645 error: PeriodicAdvertisingSyncError,
7646 },
7647 #[non_exhaustive]
7648 _UnknownEvent {
7649 ordinal: u64,
7651 },
7652}
7653
7654impl PeriodicAdvertisingSyncEvent {
7655 #[allow(irrefutable_let_patterns)]
7656 pub fn into_on_established(self) -> Option<PeriodicAdvertisingSyncOnEstablishedRequest> {
7657 if let PeriodicAdvertisingSyncEvent::OnEstablished { payload } = self {
7658 Some((payload))
7659 } else {
7660 None
7661 }
7662 }
7663 #[allow(irrefutable_let_patterns)]
7664 pub fn into_on_error(self) -> Option<PeriodicAdvertisingSyncError> {
7665 if let PeriodicAdvertisingSyncEvent::OnError { error } = self {
7666 Some((error))
7667 } else {
7668 None
7669 }
7670 }
7671
7672 fn decode(
7674 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7675 ) -> Result<PeriodicAdvertisingSyncEvent, fidl::Error> {
7676 let (bytes, _handles) = buf.split_mut();
7677 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7678 debug_assert_eq!(tx_header.tx_id, 0);
7679 match tx_header.ordinal {
7680 0x4a5c307761c40fdc => {
7681 let mut out = fidl::new_empty!(
7682 PeriodicAdvertisingSyncOnEstablishedRequest,
7683 fidl::encoding::DefaultFuchsiaResourceDialect
7684 );
7685 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7686 Ok((PeriodicAdvertisingSyncEvent::OnEstablished { payload: out }))
7687 }
7688 0x1c051673126ce4a => {
7689 let mut out = fidl::new_empty!(
7690 PeriodicAdvertisingSyncOnErrorRequest,
7691 fidl::encoding::DefaultFuchsiaResourceDialect
7692 );
7693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncOnErrorRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7694 Ok((PeriodicAdvertisingSyncEvent::OnError { error: out.error }))
7695 }
7696 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7697 Ok(PeriodicAdvertisingSyncEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7698 }
7699 _ => Err(fidl::Error::UnknownOrdinal {
7700 ordinal: tx_header.ordinal,
7701 protocol_name:
7702 <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7703 }),
7704 }
7705 }
7706}
7707
7708pub struct PeriodicAdvertisingSyncRequestStream {
7710 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7711 is_terminated: bool,
7712}
7713
7714impl std::marker::Unpin for PeriodicAdvertisingSyncRequestStream {}
7715
7716impl futures::stream::FusedStream for PeriodicAdvertisingSyncRequestStream {
7717 fn is_terminated(&self) -> bool {
7718 self.is_terminated
7719 }
7720}
7721
7722impl fidl::endpoints::RequestStream for PeriodicAdvertisingSyncRequestStream {
7723 type Protocol = PeriodicAdvertisingSyncMarker;
7724 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
7725
7726 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7727 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7728 }
7729
7730 fn control_handle(&self) -> Self::ControlHandle {
7731 PeriodicAdvertisingSyncControlHandle { inner: self.inner.clone() }
7732 }
7733
7734 fn into_inner(
7735 self,
7736 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7737 {
7738 (self.inner, self.is_terminated)
7739 }
7740
7741 fn from_inner(
7742 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7743 is_terminated: bool,
7744 ) -> Self {
7745 Self { inner, is_terminated }
7746 }
7747}
7748
7749impl futures::Stream for PeriodicAdvertisingSyncRequestStream {
7750 type Item = Result<PeriodicAdvertisingSyncRequest, fidl::Error>;
7751
7752 fn poll_next(
7753 mut self: std::pin::Pin<&mut Self>,
7754 cx: &mut std::task::Context<'_>,
7755 ) -> std::task::Poll<Option<Self::Item>> {
7756 let this = &mut *self;
7757 if this.inner.check_shutdown(cx) {
7758 this.is_terminated = true;
7759 return std::task::Poll::Ready(None);
7760 }
7761 if this.is_terminated {
7762 panic!("polled PeriodicAdvertisingSyncRequestStream after completion");
7763 }
7764 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7765 |bytes, handles| {
7766 match this.inner.channel().read_etc(cx, bytes, handles) {
7767 std::task::Poll::Ready(Ok(())) => {}
7768 std::task::Poll::Pending => return std::task::Poll::Pending,
7769 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7770 this.is_terminated = true;
7771 return std::task::Poll::Ready(None);
7772 }
7773 std::task::Poll::Ready(Err(e)) => {
7774 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7775 e.into(),
7776 ))))
7777 }
7778 }
7779
7780 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7782
7783 std::task::Poll::Ready(Some(match header.ordinal {
7784 0x2ea610fea0e7d337 => {
7785 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7786 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7787 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7788 let control_handle = PeriodicAdvertisingSyncControlHandle {
7789 inner: this.inner.clone(),
7790 };
7791 Ok(PeriodicAdvertisingSyncRequest::WatchAdvertisingReport {
7792 responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
7793 control_handle: std::mem::ManuallyDrop::new(control_handle),
7794 tx_id: header.tx_id,
7795 },
7796 })
7797 }
7798 0x653c5dab1f1d80ed => {
7799 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7800 let mut req = fidl::new_empty!(PeriodicAdvertisingSyncSyncToSubeventsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7801 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeriodicAdvertisingSyncSyncToSubeventsRequest>(&header, _body_bytes, handles, &mut req)?;
7802 let control_handle = PeriodicAdvertisingSyncControlHandle {
7803 inner: this.inner.clone(),
7804 };
7805 Ok(PeriodicAdvertisingSyncRequest::SyncToSubevents {payload: req,
7806 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder {
7807 control_handle: std::mem::ManuallyDrop::new(control_handle),
7808 tx_id: header.tx_id,
7809 },
7810 })
7811 }
7812 0xd617c037eaf5d92 => {
7813 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7814 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
7815 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7816 let control_handle = PeriodicAdvertisingSyncControlHandle {
7817 inner: this.inner.clone(),
7818 };
7819 Ok(PeriodicAdvertisingSyncRequest::Cancel {
7820 control_handle,
7821 })
7822 }
7823 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7824 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
7825 ordinal: header.ordinal,
7826 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
7827 method_type: fidl::MethodType::OneWay,
7828 })
7829 }
7830 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7831 this.inner.send_framework_err(
7832 fidl::encoding::FrameworkErr::UnknownMethod,
7833 header.tx_id,
7834 header.ordinal,
7835 header.dynamic_flags(),
7836 (bytes, handles),
7837 )?;
7838 Ok(PeriodicAdvertisingSyncRequest::_UnknownMethod {
7839 ordinal: header.ordinal,
7840 control_handle: PeriodicAdvertisingSyncControlHandle { inner: this.inner.clone() },
7841 method_type: fidl::MethodType::TwoWay,
7842 })
7843 }
7844 _ => Err(fidl::Error::UnknownOrdinal {
7845 ordinal: header.ordinal,
7846 protocol_name: <PeriodicAdvertisingSyncMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7847 }),
7848 }))
7849 },
7850 )
7851 }
7852}
7853
7854#[derive(Debug)]
7856pub enum PeriodicAdvertisingSyncRequest {
7857 WatchAdvertisingReport { responder: PeriodicAdvertisingSyncWatchAdvertisingReportResponder },
7860 SyncToSubevents {
7863 payload: PeriodicAdvertisingSyncSyncToSubeventsRequest,
7864 responder: PeriodicAdvertisingSyncSyncToSubeventsResponder,
7865 },
7866 Cancel { control_handle: PeriodicAdvertisingSyncControlHandle },
7871 #[non_exhaustive]
7873 _UnknownMethod {
7874 ordinal: u64,
7876 control_handle: PeriodicAdvertisingSyncControlHandle,
7877 method_type: fidl::MethodType,
7878 },
7879}
7880
7881impl PeriodicAdvertisingSyncRequest {
7882 #[allow(irrefutable_let_patterns)]
7883 pub fn into_watch_advertising_report(
7884 self,
7885 ) -> Option<(PeriodicAdvertisingSyncWatchAdvertisingReportResponder)> {
7886 if let PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { responder } = self {
7887 Some((responder))
7888 } else {
7889 None
7890 }
7891 }
7892
7893 #[allow(irrefutable_let_patterns)]
7894 pub fn into_sync_to_subevents(
7895 self,
7896 ) -> Option<(
7897 PeriodicAdvertisingSyncSyncToSubeventsRequest,
7898 PeriodicAdvertisingSyncSyncToSubeventsResponder,
7899 )> {
7900 if let PeriodicAdvertisingSyncRequest::SyncToSubevents { payload, responder } = self {
7901 Some((payload, responder))
7902 } else {
7903 None
7904 }
7905 }
7906
7907 #[allow(irrefutable_let_patterns)]
7908 pub fn into_cancel(self) -> Option<(PeriodicAdvertisingSyncControlHandle)> {
7909 if let PeriodicAdvertisingSyncRequest::Cancel { control_handle } = self {
7910 Some((control_handle))
7911 } else {
7912 None
7913 }
7914 }
7915
7916 pub fn method_name(&self) -> &'static str {
7918 match *self {
7919 PeriodicAdvertisingSyncRequest::WatchAdvertisingReport { .. } => {
7920 "watch_advertising_report"
7921 }
7922 PeriodicAdvertisingSyncRequest::SyncToSubevents { .. } => "sync_to_subevents",
7923 PeriodicAdvertisingSyncRequest::Cancel { .. } => "cancel",
7924 PeriodicAdvertisingSyncRequest::_UnknownMethod {
7925 method_type: fidl::MethodType::OneWay,
7926 ..
7927 } => "unknown one-way method",
7928 PeriodicAdvertisingSyncRequest::_UnknownMethod {
7929 method_type: fidl::MethodType::TwoWay,
7930 ..
7931 } => "unknown two-way method",
7932 }
7933 }
7934}
7935
7936#[derive(Debug, Clone)]
7937pub struct PeriodicAdvertisingSyncControlHandle {
7938 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7939}
7940
7941impl fidl::endpoints::ControlHandle for PeriodicAdvertisingSyncControlHandle {
7942 fn shutdown(&self) {
7943 self.inner.shutdown()
7944 }
7945 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7946 self.inner.shutdown_with_epitaph(status)
7947 }
7948
7949 fn is_closed(&self) -> bool {
7950 self.inner.channel().is_closed()
7951 }
7952 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7953 self.inner.channel().on_closed()
7954 }
7955
7956 #[cfg(target_os = "fuchsia")]
7957 fn signal_peer(
7958 &self,
7959 clear_mask: zx::Signals,
7960 set_mask: zx::Signals,
7961 ) -> Result<(), zx_status::Status> {
7962 use fidl::Peered;
7963 self.inner.channel().signal_peer(clear_mask, set_mask)
7964 }
7965}
7966
7967impl PeriodicAdvertisingSyncControlHandle {
7968 pub fn send_on_established(
7969 &self,
7970 mut payload: &PeriodicAdvertisingSyncOnEstablishedRequest,
7971 ) -> Result<(), fidl::Error> {
7972 self.inner.send::<PeriodicAdvertisingSyncOnEstablishedRequest>(
7973 payload,
7974 0,
7975 0x4a5c307761c40fdc,
7976 fidl::encoding::DynamicFlags::FLEXIBLE,
7977 )
7978 }
7979
7980 pub fn send_on_error(
7981 &self,
7982 mut error: PeriodicAdvertisingSyncError,
7983 ) -> Result<(), fidl::Error> {
7984 self.inner.send::<PeriodicAdvertisingSyncOnErrorRequest>(
7985 (error,),
7986 0,
7987 0x1c051673126ce4a,
7988 fidl::encoding::DynamicFlags::FLEXIBLE,
7989 )
7990 }
7991}
7992
7993#[must_use = "FIDL methods require a response to be sent"]
7994#[derive(Debug)]
7995pub struct PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
7996 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
7997 tx_id: u32,
7998}
7999
8000impl std::ops::Drop for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8004 fn drop(&mut self) {
8005 self.control_handle.shutdown();
8006 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8008 }
8009}
8010
8011impl fidl::endpoints::Responder for PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8012 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8013
8014 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8015 &self.control_handle
8016 }
8017
8018 fn drop_without_shutdown(mut self) {
8019 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8021 std::mem::forget(self);
8023 }
8024}
8025
8026impl PeriodicAdvertisingSyncWatchAdvertisingReportResponder {
8027 pub fn send(
8031 self,
8032 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8033 ) -> Result<(), fidl::Error> {
8034 let _result = self.send_raw(payload);
8035 if _result.is_err() {
8036 self.control_handle.shutdown();
8037 }
8038 self.drop_without_shutdown();
8039 _result
8040 }
8041
8042 pub fn send_no_shutdown_on_err(
8044 self,
8045 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8046 ) -> Result<(), fidl::Error> {
8047 let _result = self.send_raw(payload);
8048 self.drop_without_shutdown();
8049 _result
8050 }
8051
8052 fn send_raw(
8053 &self,
8054 mut payload: &PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8055 ) -> Result<(), fidl::Error> {
8056 self.control_handle.inner.send::<fidl::encoding::FlexibleType<
8057 PeriodicAdvertisingSyncWatchAdvertisingReportResponse,
8058 >>(
8059 fidl::encoding::Flexible::new(payload),
8060 self.tx_id,
8061 0x2ea610fea0e7d337,
8062 fidl::encoding::DynamicFlags::FLEXIBLE,
8063 )
8064 }
8065}
8066
8067#[must_use = "FIDL methods require a response to be sent"]
8068#[derive(Debug)]
8069pub struct PeriodicAdvertisingSyncSyncToSubeventsResponder {
8070 control_handle: std::mem::ManuallyDrop<PeriodicAdvertisingSyncControlHandle>,
8071 tx_id: u32,
8072}
8073
8074impl std::ops::Drop for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8078 fn drop(&mut self) {
8079 self.control_handle.shutdown();
8080 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8082 }
8083}
8084
8085impl fidl::endpoints::Responder for PeriodicAdvertisingSyncSyncToSubeventsResponder {
8086 type ControlHandle = PeriodicAdvertisingSyncControlHandle;
8087
8088 fn control_handle(&self) -> &PeriodicAdvertisingSyncControlHandle {
8089 &self.control_handle
8090 }
8091
8092 fn drop_without_shutdown(mut self) {
8093 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8095 std::mem::forget(self);
8097 }
8098}
8099
8100impl PeriodicAdvertisingSyncSyncToSubeventsResponder {
8101 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8105 let _result = self.send_raw(result);
8106 if _result.is_err() {
8107 self.control_handle.shutdown();
8108 }
8109 self.drop_without_shutdown();
8110 _result
8111 }
8112
8113 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8115 let _result = self.send_raw(result);
8116 self.drop_without_shutdown();
8117 _result
8118 }
8119
8120 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
8121 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
8122 fidl::encoding::EmptyStruct,
8123 i32,
8124 >>(
8125 fidl::encoding::FlexibleResult::new(result),
8126 self.tx_id,
8127 0x653c5dab1f1d80ed,
8128 fidl::encoding::DynamicFlags::FLEXIBLE,
8129 )
8130 }
8131}
8132
8133#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8134pub struct PeripheralMarker;
8135
8136impl fidl::endpoints::ProtocolMarker for PeripheralMarker {
8137 type Proxy = PeripheralProxy;
8138 type RequestStream = PeripheralRequestStream;
8139 #[cfg(target_os = "fuchsia")]
8140 type SynchronousProxy = PeripheralSynchronousProxy;
8141
8142 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Peripheral";
8143}
8144impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralMarker {}
8145pub type PeripheralAdvertiseResult = Result<(), PeripheralError>;
8146pub type PeripheralStartAdvertisingResult = Result<(), PeripheralError>;
8147
8148pub trait PeripheralProxyInterface: Send + Sync {
8149 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
8150 + Send;
8151 fn r#listen_l2cap(
8152 &self,
8153 payload: ChannelListenerRegistryListenL2capRequest,
8154 ) -> Self::ListenL2capResponseFut;
8155 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
8156 + Send;
8157 fn r#advertise(
8158 &self,
8159 parameters: &AdvertisingParameters,
8160 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8161 ) -> Self::AdvertiseResponseFut;
8162 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
8163 + Send;
8164 fn r#start_advertising(
8165 &self,
8166 parameters: &AdvertisingParameters,
8167 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8168 ) -> Self::StartAdvertisingResponseFut;
8169}
8170#[derive(Debug)]
8171#[cfg(target_os = "fuchsia")]
8172pub struct PeripheralSynchronousProxy {
8173 client: fidl::client::sync::Client,
8174}
8175
8176#[cfg(target_os = "fuchsia")]
8177impl fidl::endpoints::SynchronousProxy for PeripheralSynchronousProxy {
8178 type Proxy = PeripheralProxy;
8179 type Protocol = PeripheralMarker;
8180
8181 fn from_channel(inner: fidl::Channel) -> Self {
8182 Self::new(inner)
8183 }
8184
8185 fn into_channel(self) -> fidl::Channel {
8186 self.client.into_channel()
8187 }
8188
8189 fn as_channel(&self) -> &fidl::Channel {
8190 self.client.as_channel()
8191 }
8192}
8193
8194#[cfg(target_os = "fuchsia")]
8195impl PeripheralSynchronousProxy {
8196 pub fn new(channel: fidl::Channel) -> Self {
8197 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8198 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8199 }
8200
8201 pub fn into_channel(self) -> fidl::Channel {
8202 self.client.into_channel()
8203 }
8204
8205 pub fn wait_for_event(
8208 &self,
8209 deadline: zx::MonotonicInstant,
8210 ) -> Result<PeripheralEvent, fidl::Error> {
8211 PeripheralEvent::decode(self.client.wait_for_event(deadline)?)
8212 }
8213
8214 pub fn r#listen_l2cap(
8224 &self,
8225 mut payload: ChannelListenerRegistryListenL2capRequest,
8226 ___deadline: zx::MonotonicInstant,
8227 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8228 let _response = self.client.send_query::<
8229 ChannelListenerRegistryListenL2capRequest,
8230 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
8231 >(
8232 &mut payload,
8233 0x39c6e9001d102338,
8234 fidl::encoding::DynamicFlags::empty(),
8235 ___deadline,
8236 )?;
8237 Ok(_response.map(|x| x))
8238 }
8239
8240 pub fn r#advertise(
8268 &self,
8269 mut parameters: &AdvertisingParameters,
8270 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8271 ___deadline: zx::MonotonicInstant,
8272 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
8273 let _response = self.client.send_query::<
8274 PeripheralAdvertiseRequest,
8275 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8276 >(
8277 (parameters, advertised_peripheral,),
8278 0x2d9ec9260c32c17f,
8279 fidl::encoding::DynamicFlags::empty(),
8280 ___deadline,
8281 )?;
8282 Ok(_response.map(|x| x))
8283 }
8284
8285 pub fn r#start_advertising(
8306 &self,
8307 mut parameters: &AdvertisingParameters,
8308 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8309 ___deadline: zx::MonotonicInstant,
8310 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
8311 let _response = self.client.send_query::<
8312 PeripheralStartAdvertisingRequest,
8313 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8314 >(
8315 (parameters, handle,),
8316 0x5875c1c575f00f7d,
8317 fidl::encoding::DynamicFlags::empty(),
8318 ___deadline,
8319 )?;
8320 Ok(_response.map(|x| x))
8321 }
8322}
8323
8324#[cfg(target_os = "fuchsia")]
8325impl From<PeripheralSynchronousProxy> for zx::Handle {
8326 fn from(value: PeripheralSynchronousProxy) -> Self {
8327 value.into_channel().into()
8328 }
8329}
8330
8331#[cfg(target_os = "fuchsia")]
8332impl From<fidl::Channel> for PeripheralSynchronousProxy {
8333 fn from(value: fidl::Channel) -> Self {
8334 Self::new(value)
8335 }
8336}
8337
8338#[cfg(target_os = "fuchsia")]
8339impl fidl::endpoints::FromClient for PeripheralSynchronousProxy {
8340 type Protocol = PeripheralMarker;
8341
8342 fn from_client(value: fidl::endpoints::ClientEnd<PeripheralMarker>) -> Self {
8343 Self::new(value.into_channel())
8344 }
8345}
8346
8347#[derive(Debug, Clone)]
8348pub struct PeripheralProxy {
8349 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8350}
8351
8352impl fidl::endpoints::Proxy for PeripheralProxy {
8353 type Protocol = PeripheralMarker;
8354
8355 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8356 Self::new(inner)
8357 }
8358
8359 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8360 self.client.into_channel().map_err(|client| Self { client })
8361 }
8362
8363 fn as_channel(&self) -> &::fidl::AsyncChannel {
8364 self.client.as_channel()
8365 }
8366}
8367
8368impl PeripheralProxy {
8369 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8371 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8372 Self { client: fidl::client::Client::new(channel, protocol_name) }
8373 }
8374
8375 pub fn take_event_stream(&self) -> PeripheralEventStream {
8381 PeripheralEventStream { event_receiver: self.client.take_event_receiver() }
8382 }
8383
8384 pub fn r#listen_l2cap(
8394 &self,
8395 mut payload: ChannelListenerRegistryListenL2capRequest,
8396 ) -> fidl::client::QueryResponseFut<
8397 ChannelListenerRegistryListenL2capResult,
8398 fidl::encoding::DefaultFuchsiaResourceDialect,
8399 > {
8400 PeripheralProxyInterface::r#listen_l2cap(self, payload)
8401 }
8402
8403 pub fn r#advertise(
8431 &self,
8432 mut parameters: &AdvertisingParameters,
8433 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8434 ) -> fidl::client::QueryResponseFut<
8435 PeripheralAdvertiseResult,
8436 fidl::encoding::DefaultFuchsiaResourceDialect,
8437 > {
8438 PeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
8439 }
8440
8441 pub fn r#start_advertising(
8462 &self,
8463 mut parameters: &AdvertisingParameters,
8464 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8465 ) -> fidl::client::QueryResponseFut<
8466 PeripheralStartAdvertisingResult,
8467 fidl::encoding::DefaultFuchsiaResourceDialect,
8468 > {
8469 PeripheralProxyInterface::r#start_advertising(self, parameters, handle)
8470 }
8471}
8472
8473impl PeripheralProxyInterface for PeripheralProxy {
8474 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
8475 ChannelListenerRegistryListenL2capResult,
8476 fidl::encoding::DefaultFuchsiaResourceDialect,
8477 >;
8478 fn r#listen_l2cap(
8479 &self,
8480 mut payload: ChannelListenerRegistryListenL2capRequest,
8481 ) -> Self::ListenL2capResponseFut {
8482 fn _decode(
8483 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8484 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8485 let _response = fidl::client::decode_transaction_body::<
8486 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
8487 fidl::encoding::DefaultFuchsiaResourceDialect,
8488 0x39c6e9001d102338,
8489 >(_buf?)?;
8490 Ok(_response.map(|x| x))
8491 }
8492 self.client.send_query_and_decode::<
8493 ChannelListenerRegistryListenL2capRequest,
8494 ChannelListenerRegistryListenL2capResult,
8495 >(
8496 &mut payload,
8497 0x39c6e9001d102338,
8498 fidl::encoding::DynamicFlags::empty(),
8499 _decode,
8500 )
8501 }
8502
8503 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
8504 PeripheralAdvertiseResult,
8505 fidl::encoding::DefaultFuchsiaResourceDialect,
8506 >;
8507 fn r#advertise(
8508 &self,
8509 mut parameters: &AdvertisingParameters,
8510 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8511 ) -> Self::AdvertiseResponseFut {
8512 fn _decode(
8513 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8514 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
8515 let _response = fidl::client::decode_transaction_body::<
8516 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8517 fidl::encoding::DefaultFuchsiaResourceDialect,
8518 0x2d9ec9260c32c17f,
8519 >(_buf?)?;
8520 Ok(_response.map(|x| x))
8521 }
8522 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
8523 (parameters, advertised_peripheral),
8524 0x2d9ec9260c32c17f,
8525 fidl::encoding::DynamicFlags::empty(),
8526 _decode,
8527 )
8528 }
8529
8530 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
8531 PeripheralStartAdvertisingResult,
8532 fidl::encoding::DefaultFuchsiaResourceDialect,
8533 >;
8534 fn r#start_advertising(
8535 &self,
8536 mut parameters: &AdvertisingParameters,
8537 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8538 ) -> Self::StartAdvertisingResponseFut {
8539 fn _decode(
8540 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8541 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
8542 let _response = fidl::client::decode_transaction_body::<
8543 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8544 fidl::encoding::DefaultFuchsiaResourceDialect,
8545 0x5875c1c575f00f7d,
8546 >(_buf?)?;
8547 Ok(_response.map(|x| x))
8548 }
8549 self.client.send_query_and_decode::<
8550 PeripheralStartAdvertisingRequest,
8551 PeripheralStartAdvertisingResult,
8552 >(
8553 (parameters, handle,),
8554 0x5875c1c575f00f7d,
8555 fidl::encoding::DynamicFlags::empty(),
8556 _decode,
8557 )
8558 }
8559}
8560
8561pub struct PeripheralEventStream {
8562 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8563}
8564
8565impl std::marker::Unpin for PeripheralEventStream {}
8566
8567impl futures::stream::FusedStream for PeripheralEventStream {
8568 fn is_terminated(&self) -> bool {
8569 self.event_receiver.is_terminated()
8570 }
8571}
8572
8573impl futures::Stream for PeripheralEventStream {
8574 type Item = Result<PeripheralEvent, fidl::Error>;
8575
8576 fn poll_next(
8577 mut self: std::pin::Pin<&mut Self>,
8578 cx: &mut std::task::Context<'_>,
8579 ) -> std::task::Poll<Option<Self::Item>> {
8580 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8581 &mut self.event_receiver,
8582 cx
8583 )?) {
8584 Some(buf) => std::task::Poll::Ready(Some(PeripheralEvent::decode(buf))),
8585 None => std::task::Poll::Ready(None),
8586 }
8587 }
8588}
8589
8590#[derive(Debug)]
8591pub enum PeripheralEvent {
8592 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
8593}
8594
8595impl PeripheralEvent {
8596 #[allow(irrefutable_let_patterns)]
8597 pub fn into_on_peer_connected(
8598 self,
8599 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
8600 if let PeripheralEvent::OnPeerConnected { peer, connection } = self {
8601 Some((peer, connection))
8602 } else {
8603 None
8604 }
8605 }
8606
8607 fn decode(
8609 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8610 ) -> Result<PeripheralEvent, fidl::Error> {
8611 let (bytes, _handles) = buf.split_mut();
8612 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8613 debug_assert_eq!(tx_header.tx_id, 0);
8614 match tx_header.ordinal {
8615 0x16135d464299e356 => {
8616 let mut out = fidl::new_empty!(
8617 PeripheralOnPeerConnectedRequest,
8618 fidl::encoding::DefaultFuchsiaResourceDialect
8619 );
8620 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8621 Ok((PeripheralEvent::OnPeerConnected {
8622 peer: out.peer,
8623 connection: out.connection,
8624 }))
8625 }
8626 _ => Err(fidl::Error::UnknownOrdinal {
8627 ordinal: tx_header.ordinal,
8628 protocol_name: <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8629 }),
8630 }
8631 }
8632}
8633
8634pub struct PeripheralRequestStream {
8636 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8637 is_terminated: bool,
8638}
8639
8640impl std::marker::Unpin for PeripheralRequestStream {}
8641
8642impl futures::stream::FusedStream for PeripheralRequestStream {
8643 fn is_terminated(&self) -> bool {
8644 self.is_terminated
8645 }
8646}
8647
8648impl fidl::endpoints::RequestStream for PeripheralRequestStream {
8649 type Protocol = PeripheralMarker;
8650 type ControlHandle = PeripheralControlHandle;
8651
8652 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8653 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8654 }
8655
8656 fn control_handle(&self) -> Self::ControlHandle {
8657 PeripheralControlHandle { inner: self.inner.clone() }
8658 }
8659
8660 fn into_inner(
8661 self,
8662 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8663 {
8664 (self.inner, self.is_terminated)
8665 }
8666
8667 fn from_inner(
8668 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8669 is_terminated: bool,
8670 ) -> Self {
8671 Self { inner, is_terminated }
8672 }
8673}
8674
8675impl futures::Stream for PeripheralRequestStream {
8676 type Item = Result<PeripheralRequest, fidl::Error>;
8677
8678 fn poll_next(
8679 mut self: std::pin::Pin<&mut Self>,
8680 cx: &mut std::task::Context<'_>,
8681 ) -> std::task::Poll<Option<Self::Item>> {
8682 let this = &mut *self;
8683 if this.inner.check_shutdown(cx) {
8684 this.is_terminated = true;
8685 return std::task::Poll::Ready(None);
8686 }
8687 if this.is_terminated {
8688 panic!("polled PeripheralRequestStream after completion");
8689 }
8690 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8691 |bytes, handles| {
8692 match this.inner.channel().read_etc(cx, bytes, handles) {
8693 std::task::Poll::Ready(Ok(())) => {}
8694 std::task::Poll::Pending => return std::task::Poll::Pending,
8695 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8696 this.is_terminated = true;
8697 return std::task::Poll::Ready(None);
8698 }
8699 std::task::Poll::Ready(Err(e)) => {
8700 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8701 e.into(),
8702 ))))
8703 }
8704 }
8705
8706 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8708
8709 std::task::Poll::Ready(Some(match header.ordinal {
8710 0x39c6e9001d102338 => {
8711 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8712 let mut req = fidl::new_empty!(
8713 ChannelListenerRegistryListenL2capRequest,
8714 fidl::encoding::DefaultFuchsiaResourceDialect
8715 );
8716 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
8717 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
8718 Ok(PeripheralRequest::ListenL2cap {
8719 payload: req,
8720 responder: PeripheralListenL2capResponder {
8721 control_handle: std::mem::ManuallyDrop::new(control_handle),
8722 tx_id: header.tx_id,
8723 },
8724 })
8725 }
8726 0x2d9ec9260c32c17f => {
8727 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8728 let mut req = fidl::new_empty!(
8729 PeripheralAdvertiseRequest,
8730 fidl::encoding::DefaultFuchsiaResourceDialect
8731 );
8732 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
8733 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
8734 Ok(PeripheralRequest::Advertise {
8735 parameters: req.parameters,
8736 advertised_peripheral: req.advertised_peripheral,
8737
8738 responder: PeripheralAdvertiseResponder {
8739 control_handle: std::mem::ManuallyDrop::new(control_handle),
8740 tx_id: header.tx_id,
8741 },
8742 })
8743 }
8744 0x5875c1c575f00f7d => {
8745 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8746 let mut req = fidl::new_empty!(
8747 PeripheralStartAdvertisingRequest,
8748 fidl::encoding::DefaultFuchsiaResourceDialect
8749 );
8750 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
8751 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
8752 Ok(PeripheralRequest::StartAdvertising {
8753 parameters: req.parameters,
8754 handle: req.handle,
8755
8756 responder: PeripheralStartAdvertisingResponder {
8757 control_handle: std::mem::ManuallyDrop::new(control_handle),
8758 tx_id: header.tx_id,
8759 },
8760 })
8761 }
8762 _ => Err(fidl::Error::UnknownOrdinal {
8763 ordinal: header.ordinal,
8764 protocol_name:
8765 <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8766 }),
8767 }))
8768 },
8769 )
8770 }
8771}
8772
8773#[derive(Debug)]
8774pub enum PeripheralRequest {
8775 ListenL2cap {
8785 payload: ChannelListenerRegistryListenL2capRequest,
8786 responder: PeripheralListenL2capResponder,
8787 },
8788 Advertise {
8816 parameters: AdvertisingParameters,
8817 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8818 responder: PeripheralAdvertiseResponder,
8819 },
8820 StartAdvertising {
8841 parameters: AdvertisingParameters,
8842 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8843 responder: PeripheralStartAdvertisingResponder,
8844 },
8845}
8846
8847impl PeripheralRequest {
8848 #[allow(irrefutable_let_patterns)]
8849 pub fn into_listen_l2cap(
8850 self,
8851 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PeripheralListenL2capResponder)> {
8852 if let PeripheralRequest::ListenL2cap { payload, responder } = self {
8853 Some((payload, responder))
8854 } else {
8855 None
8856 }
8857 }
8858
8859 #[allow(irrefutable_let_patterns)]
8860 pub fn into_advertise(
8861 self,
8862 ) -> Option<(
8863 AdvertisingParameters,
8864 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8865 PeripheralAdvertiseResponder,
8866 )> {
8867 if let PeripheralRequest::Advertise { parameters, advertised_peripheral, responder } = self
8868 {
8869 Some((parameters, advertised_peripheral, responder))
8870 } else {
8871 None
8872 }
8873 }
8874
8875 #[allow(irrefutable_let_patterns)]
8876 pub fn into_start_advertising(
8877 self,
8878 ) -> Option<(
8879 AdvertisingParameters,
8880 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8881 PeripheralStartAdvertisingResponder,
8882 )> {
8883 if let PeripheralRequest::StartAdvertising { parameters, handle, responder } = self {
8884 Some((parameters, handle, responder))
8885 } else {
8886 None
8887 }
8888 }
8889
8890 pub fn method_name(&self) -> &'static str {
8892 match *self {
8893 PeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
8894 PeripheralRequest::Advertise { .. } => "advertise",
8895 PeripheralRequest::StartAdvertising { .. } => "start_advertising",
8896 }
8897 }
8898}
8899
8900#[derive(Debug, Clone)]
8901pub struct PeripheralControlHandle {
8902 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8903}
8904
8905impl fidl::endpoints::ControlHandle for PeripheralControlHandle {
8906 fn shutdown(&self) {
8907 self.inner.shutdown()
8908 }
8909 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8910 self.inner.shutdown_with_epitaph(status)
8911 }
8912
8913 fn is_closed(&self) -> bool {
8914 self.inner.channel().is_closed()
8915 }
8916 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8917 self.inner.channel().on_closed()
8918 }
8919
8920 #[cfg(target_os = "fuchsia")]
8921 fn signal_peer(
8922 &self,
8923 clear_mask: zx::Signals,
8924 set_mask: zx::Signals,
8925 ) -> Result<(), zx_status::Status> {
8926 use fidl::Peered;
8927 self.inner.channel().signal_peer(clear_mask, set_mask)
8928 }
8929}
8930
8931impl PeripheralControlHandle {
8932 pub fn send_on_peer_connected(
8933 &self,
8934 mut peer: &Peer,
8935 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
8936 ) -> Result<(), fidl::Error> {
8937 self.inner.send::<PeripheralOnPeerConnectedRequest>(
8938 (peer, connection),
8939 0,
8940 0x16135d464299e356,
8941 fidl::encoding::DynamicFlags::empty(),
8942 )
8943 }
8944}
8945
8946#[must_use = "FIDL methods require a response to be sent"]
8947#[derive(Debug)]
8948pub struct PeripheralListenL2capResponder {
8949 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
8950 tx_id: u32,
8951}
8952
8953impl std::ops::Drop for PeripheralListenL2capResponder {
8957 fn drop(&mut self) {
8958 self.control_handle.shutdown();
8959 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8961 }
8962}
8963
8964impl fidl::endpoints::Responder for PeripheralListenL2capResponder {
8965 type ControlHandle = PeripheralControlHandle;
8966
8967 fn control_handle(&self) -> &PeripheralControlHandle {
8968 &self.control_handle
8969 }
8970
8971 fn drop_without_shutdown(mut self) {
8972 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8974 std::mem::forget(self);
8976 }
8977}
8978
8979impl PeripheralListenL2capResponder {
8980 pub fn send(
8984 self,
8985 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8986 ) -> Result<(), fidl::Error> {
8987 let _result = self.send_raw(result);
8988 if _result.is_err() {
8989 self.control_handle.shutdown();
8990 }
8991 self.drop_without_shutdown();
8992 _result
8993 }
8994
8995 pub fn send_no_shutdown_on_err(
8997 self,
8998 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8999 ) -> Result<(), fidl::Error> {
9000 let _result = self.send_raw(result);
9001 self.drop_without_shutdown();
9002 _result
9003 }
9004
9005 fn send_raw(
9006 &self,
9007 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
9008 ) -> Result<(), fidl::Error> {
9009 self.control_handle.inner.send::<fidl::encoding::ResultType<
9010 ChannelListenerRegistryListenL2capResponse,
9011 i32,
9012 >>(
9013 result,
9014 self.tx_id,
9015 0x39c6e9001d102338,
9016 fidl::encoding::DynamicFlags::empty(),
9017 )
9018 }
9019}
9020
9021#[must_use = "FIDL methods require a response to be sent"]
9022#[derive(Debug)]
9023pub struct PeripheralAdvertiseResponder {
9024 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9025 tx_id: u32,
9026}
9027
9028impl std::ops::Drop for PeripheralAdvertiseResponder {
9032 fn drop(&mut self) {
9033 self.control_handle.shutdown();
9034 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9036 }
9037}
9038
9039impl fidl::endpoints::Responder for PeripheralAdvertiseResponder {
9040 type ControlHandle = PeripheralControlHandle;
9041
9042 fn control_handle(&self) -> &PeripheralControlHandle {
9043 &self.control_handle
9044 }
9045
9046 fn drop_without_shutdown(mut self) {
9047 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9049 std::mem::forget(self);
9051 }
9052}
9053
9054impl PeripheralAdvertiseResponder {
9055 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9059 let _result = self.send_raw(result);
9060 if _result.is_err() {
9061 self.control_handle.shutdown();
9062 }
9063 self.drop_without_shutdown();
9064 _result
9065 }
9066
9067 pub fn send_no_shutdown_on_err(
9069 self,
9070 mut result: Result<(), PeripheralError>,
9071 ) -> Result<(), fidl::Error> {
9072 let _result = self.send_raw(result);
9073 self.drop_without_shutdown();
9074 _result
9075 }
9076
9077 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9078 self.control_handle.inner.send::<fidl::encoding::ResultType<
9079 fidl::encoding::EmptyStruct,
9080 PeripheralError,
9081 >>(
9082 result,
9083 self.tx_id,
9084 0x2d9ec9260c32c17f,
9085 fidl::encoding::DynamicFlags::empty(),
9086 )
9087 }
9088}
9089
9090#[must_use = "FIDL methods require a response to be sent"]
9091#[derive(Debug)]
9092pub struct PeripheralStartAdvertisingResponder {
9093 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
9094 tx_id: u32,
9095}
9096
9097impl std::ops::Drop for PeripheralStartAdvertisingResponder {
9101 fn drop(&mut self) {
9102 self.control_handle.shutdown();
9103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9105 }
9106}
9107
9108impl fidl::endpoints::Responder for PeripheralStartAdvertisingResponder {
9109 type ControlHandle = PeripheralControlHandle;
9110
9111 fn control_handle(&self) -> &PeripheralControlHandle {
9112 &self.control_handle
9113 }
9114
9115 fn drop_without_shutdown(mut self) {
9116 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9118 std::mem::forget(self);
9120 }
9121}
9122
9123impl PeripheralStartAdvertisingResponder {
9124 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9128 let _result = self.send_raw(result);
9129 if _result.is_err() {
9130 self.control_handle.shutdown();
9131 }
9132 self.drop_without_shutdown();
9133 _result
9134 }
9135
9136 pub fn send_no_shutdown_on_err(
9138 self,
9139 mut result: Result<(), PeripheralError>,
9140 ) -> Result<(), fidl::Error> {
9141 let _result = self.send_raw(result);
9142 self.drop_without_shutdown();
9143 _result
9144 }
9145
9146 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
9147 self.control_handle.inner.send::<fidl::encoding::ResultType<
9148 fidl::encoding::EmptyStruct,
9149 PeripheralError,
9150 >>(
9151 result,
9152 self.tx_id,
9153 0x5875c1c575f00f7d,
9154 fidl::encoding::DynamicFlags::empty(),
9155 )
9156 }
9157}
9158
9159#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9160pub struct PrivilegedPeripheralMarker;
9161
9162impl fidl::endpoints::ProtocolMarker for PrivilegedPeripheralMarker {
9163 type Proxy = PrivilegedPeripheralProxy;
9164 type RequestStream = PrivilegedPeripheralRequestStream;
9165 #[cfg(target_os = "fuchsia")]
9166 type SynchronousProxy = PrivilegedPeripheralSynchronousProxy;
9167
9168 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedPeripheral";
9169}
9170impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedPeripheralMarker {}
9171
9172pub trait PrivilegedPeripheralProxyInterface: Send + Sync {
9173 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
9174 + Send;
9175 fn r#listen_l2cap(
9176 &self,
9177 payload: ChannelListenerRegistryListenL2capRequest,
9178 ) -> Self::ListenL2capResponseFut;
9179 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
9180 + Send;
9181 fn r#advertise(
9182 &self,
9183 parameters: &AdvertisingParameters,
9184 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9185 ) -> Self::AdvertiseResponseFut;
9186 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
9187 + Send;
9188 fn r#start_advertising(
9189 &self,
9190 parameters: &AdvertisingParameters,
9191 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9192 ) -> Self::StartAdvertisingResponseFut;
9193}
9194#[derive(Debug)]
9195#[cfg(target_os = "fuchsia")]
9196pub struct PrivilegedPeripheralSynchronousProxy {
9197 client: fidl::client::sync::Client,
9198}
9199
9200#[cfg(target_os = "fuchsia")]
9201impl fidl::endpoints::SynchronousProxy for PrivilegedPeripheralSynchronousProxy {
9202 type Proxy = PrivilegedPeripheralProxy;
9203 type Protocol = PrivilegedPeripheralMarker;
9204
9205 fn from_channel(inner: fidl::Channel) -> Self {
9206 Self::new(inner)
9207 }
9208
9209 fn into_channel(self) -> fidl::Channel {
9210 self.client.into_channel()
9211 }
9212
9213 fn as_channel(&self) -> &fidl::Channel {
9214 self.client.as_channel()
9215 }
9216}
9217
9218#[cfg(target_os = "fuchsia")]
9219impl PrivilegedPeripheralSynchronousProxy {
9220 pub fn new(channel: fidl::Channel) -> Self {
9221 let protocol_name =
9222 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9223 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9224 }
9225
9226 pub fn into_channel(self) -> fidl::Channel {
9227 self.client.into_channel()
9228 }
9229
9230 pub fn wait_for_event(
9233 &self,
9234 deadline: zx::MonotonicInstant,
9235 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
9236 PrivilegedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
9237 }
9238
9239 pub fn r#listen_l2cap(
9249 &self,
9250 mut payload: ChannelListenerRegistryListenL2capRequest,
9251 ___deadline: zx::MonotonicInstant,
9252 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
9253 let _response = self.client.send_query::<
9254 ChannelListenerRegistryListenL2capRequest,
9255 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
9256 >(
9257 &mut payload,
9258 0x39c6e9001d102338,
9259 fidl::encoding::DynamicFlags::empty(),
9260 ___deadline,
9261 )?;
9262 Ok(_response.map(|x| x))
9263 }
9264
9265 pub fn r#advertise(
9293 &self,
9294 mut parameters: &AdvertisingParameters,
9295 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9296 ___deadline: zx::MonotonicInstant,
9297 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9298 let _response = self.client.send_query::<
9299 PeripheralAdvertiseRequest,
9300 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9301 >(
9302 (parameters, advertised_peripheral,),
9303 0x2d9ec9260c32c17f,
9304 fidl::encoding::DynamicFlags::empty(),
9305 ___deadline,
9306 )?;
9307 Ok(_response.map(|x| x))
9308 }
9309
9310 pub fn r#start_advertising(
9331 &self,
9332 mut parameters: &AdvertisingParameters,
9333 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9334 ___deadline: zx::MonotonicInstant,
9335 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9336 let _response = self.client.send_query::<
9337 PeripheralStartAdvertisingRequest,
9338 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9339 >(
9340 (parameters, handle,),
9341 0x5875c1c575f00f7d,
9342 fidl::encoding::DynamicFlags::empty(),
9343 ___deadline,
9344 )?;
9345 Ok(_response.map(|x| x))
9346 }
9347}
9348
9349#[cfg(target_os = "fuchsia")]
9350impl From<PrivilegedPeripheralSynchronousProxy> for zx::Handle {
9351 fn from(value: PrivilegedPeripheralSynchronousProxy) -> Self {
9352 value.into_channel().into()
9353 }
9354}
9355
9356#[cfg(target_os = "fuchsia")]
9357impl From<fidl::Channel> for PrivilegedPeripheralSynchronousProxy {
9358 fn from(value: fidl::Channel) -> Self {
9359 Self::new(value)
9360 }
9361}
9362
9363#[cfg(target_os = "fuchsia")]
9364impl fidl::endpoints::FromClient for PrivilegedPeripheralSynchronousProxy {
9365 type Protocol = PrivilegedPeripheralMarker;
9366
9367 fn from_client(value: fidl::endpoints::ClientEnd<PrivilegedPeripheralMarker>) -> Self {
9368 Self::new(value.into_channel())
9369 }
9370}
9371
9372#[derive(Debug, Clone)]
9373pub struct PrivilegedPeripheralProxy {
9374 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9375}
9376
9377impl fidl::endpoints::Proxy for PrivilegedPeripheralProxy {
9378 type Protocol = PrivilegedPeripheralMarker;
9379
9380 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9381 Self::new(inner)
9382 }
9383
9384 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9385 self.client.into_channel().map_err(|client| Self { client })
9386 }
9387
9388 fn as_channel(&self) -> &::fidl::AsyncChannel {
9389 self.client.as_channel()
9390 }
9391}
9392
9393impl PrivilegedPeripheralProxy {
9394 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9396 let protocol_name =
9397 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9398 Self { client: fidl::client::Client::new(channel, protocol_name) }
9399 }
9400
9401 pub fn take_event_stream(&self) -> PrivilegedPeripheralEventStream {
9407 PrivilegedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
9408 }
9409
9410 pub fn r#listen_l2cap(
9420 &self,
9421 mut payload: ChannelListenerRegistryListenL2capRequest,
9422 ) -> fidl::client::QueryResponseFut<
9423 ChannelListenerRegistryListenL2capResult,
9424 fidl::encoding::DefaultFuchsiaResourceDialect,
9425 > {
9426 PrivilegedPeripheralProxyInterface::r#listen_l2cap(self, payload)
9427 }
9428
9429 pub fn r#advertise(
9457 &self,
9458 mut parameters: &AdvertisingParameters,
9459 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9460 ) -> fidl::client::QueryResponseFut<
9461 PeripheralAdvertiseResult,
9462 fidl::encoding::DefaultFuchsiaResourceDialect,
9463 > {
9464 PrivilegedPeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
9465 }
9466
9467 pub fn r#start_advertising(
9488 &self,
9489 mut parameters: &AdvertisingParameters,
9490 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9491 ) -> fidl::client::QueryResponseFut<
9492 PeripheralStartAdvertisingResult,
9493 fidl::encoding::DefaultFuchsiaResourceDialect,
9494 > {
9495 PrivilegedPeripheralProxyInterface::r#start_advertising(self, parameters, handle)
9496 }
9497}
9498
9499impl PrivilegedPeripheralProxyInterface for PrivilegedPeripheralProxy {
9500 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
9501 ChannelListenerRegistryListenL2capResult,
9502 fidl::encoding::DefaultFuchsiaResourceDialect,
9503 >;
9504 fn r#listen_l2cap(
9505 &self,
9506 mut payload: ChannelListenerRegistryListenL2capRequest,
9507 ) -> Self::ListenL2capResponseFut {
9508 fn _decode(
9509 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9510 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
9511 let _response = fidl::client::decode_transaction_body::<
9512 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
9513 fidl::encoding::DefaultFuchsiaResourceDialect,
9514 0x39c6e9001d102338,
9515 >(_buf?)?;
9516 Ok(_response.map(|x| x))
9517 }
9518 self.client.send_query_and_decode::<
9519 ChannelListenerRegistryListenL2capRequest,
9520 ChannelListenerRegistryListenL2capResult,
9521 >(
9522 &mut payload,
9523 0x39c6e9001d102338,
9524 fidl::encoding::DynamicFlags::empty(),
9525 _decode,
9526 )
9527 }
9528
9529 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
9530 PeripheralAdvertiseResult,
9531 fidl::encoding::DefaultFuchsiaResourceDialect,
9532 >;
9533 fn r#advertise(
9534 &self,
9535 mut parameters: &AdvertisingParameters,
9536 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9537 ) -> Self::AdvertiseResponseFut {
9538 fn _decode(
9539 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9540 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
9541 let _response = fidl::client::decode_transaction_body::<
9542 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9543 fidl::encoding::DefaultFuchsiaResourceDialect,
9544 0x2d9ec9260c32c17f,
9545 >(_buf?)?;
9546 Ok(_response.map(|x| x))
9547 }
9548 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
9549 (parameters, advertised_peripheral),
9550 0x2d9ec9260c32c17f,
9551 fidl::encoding::DynamicFlags::empty(),
9552 _decode,
9553 )
9554 }
9555
9556 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
9557 PeripheralStartAdvertisingResult,
9558 fidl::encoding::DefaultFuchsiaResourceDialect,
9559 >;
9560 fn r#start_advertising(
9561 &self,
9562 mut parameters: &AdvertisingParameters,
9563 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9564 ) -> Self::StartAdvertisingResponseFut {
9565 fn _decode(
9566 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9567 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
9568 let _response = fidl::client::decode_transaction_body::<
9569 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
9570 fidl::encoding::DefaultFuchsiaResourceDialect,
9571 0x5875c1c575f00f7d,
9572 >(_buf?)?;
9573 Ok(_response.map(|x| x))
9574 }
9575 self.client.send_query_and_decode::<
9576 PeripheralStartAdvertisingRequest,
9577 PeripheralStartAdvertisingResult,
9578 >(
9579 (parameters, handle,),
9580 0x5875c1c575f00f7d,
9581 fidl::encoding::DynamicFlags::empty(),
9582 _decode,
9583 )
9584 }
9585}
9586
9587pub struct PrivilegedPeripheralEventStream {
9588 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9589}
9590
9591impl std::marker::Unpin for PrivilegedPeripheralEventStream {}
9592
9593impl futures::stream::FusedStream for PrivilegedPeripheralEventStream {
9594 fn is_terminated(&self) -> bool {
9595 self.event_receiver.is_terminated()
9596 }
9597}
9598
9599impl futures::Stream for PrivilegedPeripheralEventStream {
9600 type Item = Result<PrivilegedPeripheralEvent, fidl::Error>;
9601
9602 fn poll_next(
9603 mut self: std::pin::Pin<&mut Self>,
9604 cx: &mut std::task::Context<'_>,
9605 ) -> std::task::Poll<Option<Self::Item>> {
9606 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9607 &mut self.event_receiver,
9608 cx
9609 )?) {
9610 Some(buf) => std::task::Poll::Ready(Some(PrivilegedPeripheralEvent::decode(buf))),
9611 None => std::task::Poll::Ready(None),
9612 }
9613 }
9614}
9615
9616#[derive(Debug)]
9617pub enum PrivilegedPeripheralEvent {
9618 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
9619}
9620
9621impl PrivilegedPeripheralEvent {
9622 #[allow(irrefutable_let_patterns)]
9623 pub fn into_on_peer_connected(
9624 self,
9625 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
9626 if let PrivilegedPeripheralEvent::OnPeerConnected { peer, connection } = self {
9627 Some((peer, connection))
9628 } else {
9629 None
9630 }
9631 }
9632
9633 fn decode(
9635 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9636 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
9637 let (bytes, _handles) = buf.split_mut();
9638 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9639 debug_assert_eq!(tx_header.tx_id, 0);
9640 match tx_header.ordinal {
9641 0x16135d464299e356 => {
9642 let mut out = fidl::new_empty!(
9643 PeripheralOnPeerConnectedRequest,
9644 fidl::encoding::DefaultFuchsiaResourceDialect
9645 );
9646 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
9647 Ok((PrivilegedPeripheralEvent::OnPeerConnected {
9648 peer: out.peer,
9649 connection: out.connection,
9650 }))
9651 }
9652 _ => Err(fidl::Error::UnknownOrdinal {
9653 ordinal: tx_header.ordinal,
9654 protocol_name:
9655 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9656 }),
9657 }
9658 }
9659}
9660
9661pub struct PrivilegedPeripheralRequestStream {
9663 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9664 is_terminated: bool,
9665}
9666
9667impl std::marker::Unpin for PrivilegedPeripheralRequestStream {}
9668
9669impl futures::stream::FusedStream for PrivilegedPeripheralRequestStream {
9670 fn is_terminated(&self) -> bool {
9671 self.is_terminated
9672 }
9673}
9674
9675impl fidl::endpoints::RequestStream for PrivilegedPeripheralRequestStream {
9676 type Protocol = PrivilegedPeripheralMarker;
9677 type ControlHandle = PrivilegedPeripheralControlHandle;
9678
9679 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9680 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9681 }
9682
9683 fn control_handle(&self) -> Self::ControlHandle {
9684 PrivilegedPeripheralControlHandle { inner: self.inner.clone() }
9685 }
9686
9687 fn into_inner(
9688 self,
9689 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9690 {
9691 (self.inner, self.is_terminated)
9692 }
9693
9694 fn from_inner(
9695 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9696 is_terminated: bool,
9697 ) -> Self {
9698 Self { inner, is_terminated }
9699 }
9700}
9701
9702impl futures::Stream for PrivilegedPeripheralRequestStream {
9703 type Item = Result<PrivilegedPeripheralRequest, fidl::Error>;
9704
9705 fn poll_next(
9706 mut self: std::pin::Pin<&mut Self>,
9707 cx: &mut std::task::Context<'_>,
9708 ) -> std::task::Poll<Option<Self::Item>> {
9709 let this = &mut *self;
9710 if this.inner.check_shutdown(cx) {
9711 this.is_terminated = true;
9712 return std::task::Poll::Ready(None);
9713 }
9714 if this.is_terminated {
9715 panic!("polled PrivilegedPeripheralRequestStream after completion");
9716 }
9717 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9718 |bytes, handles| {
9719 match this.inner.channel().read_etc(cx, bytes, handles) {
9720 std::task::Poll::Ready(Ok(())) => {}
9721 std::task::Poll::Pending => return std::task::Poll::Pending,
9722 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9723 this.is_terminated = true;
9724 return std::task::Poll::Ready(None);
9725 }
9726 std::task::Poll::Ready(Err(e)) => {
9727 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9728 e.into(),
9729 ))))
9730 }
9731 }
9732
9733 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9735
9736 std::task::Poll::Ready(Some(match header.ordinal {
9737 0x39c6e9001d102338 => {
9738 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9739 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9740 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
9741 let control_handle = PrivilegedPeripheralControlHandle {
9742 inner: this.inner.clone(),
9743 };
9744 Ok(PrivilegedPeripheralRequest::ListenL2cap {payload: req,
9745 responder: PrivilegedPeripheralListenL2capResponder {
9746 control_handle: std::mem::ManuallyDrop::new(control_handle),
9747 tx_id: header.tx_id,
9748 },
9749 })
9750 }
9751 0x2d9ec9260c32c17f => {
9752 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9753 let mut req = fidl::new_empty!(PeripheralAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9754 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
9755 let control_handle = PrivilegedPeripheralControlHandle {
9756 inner: this.inner.clone(),
9757 };
9758 Ok(PrivilegedPeripheralRequest::Advertise {parameters: req.parameters,
9759advertised_peripheral: req.advertised_peripheral,
9760
9761 responder: PrivilegedPeripheralAdvertiseResponder {
9762 control_handle: std::mem::ManuallyDrop::new(control_handle),
9763 tx_id: header.tx_id,
9764 },
9765 })
9766 }
9767 0x5875c1c575f00f7d => {
9768 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9769 let mut req = fidl::new_empty!(PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9770 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
9771 let control_handle = PrivilegedPeripheralControlHandle {
9772 inner: this.inner.clone(),
9773 };
9774 Ok(PrivilegedPeripheralRequest::StartAdvertising {parameters: req.parameters,
9775handle: req.handle,
9776
9777 responder: PrivilegedPeripheralStartAdvertisingResponder {
9778 control_handle: std::mem::ManuallyDrop::new(control_handle),
9779 tx_id: header.tx_id,
9780 },
9781 })
9782 }
9783 _ => Err(fidl::Error::UnknownOrdinal {
9784 ordinal: header.ordinal,
9785 protocol_name: <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9786 }),
9787 }))
9788 },
9789 )
9790 }
9791}
9792
9793#[derive(Debug)]
9801pub enum PrivilegedPeripheralRequest {
9802 ListenL2cap {
9812 payload: ChannelListenerRegistryListenL2capRequest,
9813 responder: PrivilegedPeripheralListenL2capResponder,
9814 },
9815 Advertise {
9843 parameters: AdvertisingParameters,
9844 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9845 responder: PrivilegedPeripheralAdvertiseResponder,
9846 },
9847 StartAdvertising {
9868 parameters: AdvertisingParameters,
9869 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9870 responder: PrivilegedPeripheralStartAdvertisingResponder,
9871 },
9872}
9873
9874impl PrivilegedPeripheralRequest {
9875 #[allow(irrefutable_let_patterns)]
9876 pub fn into_listen_l2cap(
9877 self,
9878 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedPeripheralListenL2capResponder)>
9879 {
9880 if let PrivilegedPeripheralRequest::ListenL2cap { payload, responder } = self {
9881 Some((payload, responder))
9882 } else {
9883 None
9884 }
9885 }
9886
9887 #[allow(irrefutable_let_patterns)]
9888 pub fn into_advertise(
9889 self,
9890 ) -> Option<(
9891 AdvertisingParameters,
9892 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
9893 PrivilegedPeripheralAdvertiseResponder,
9894 )> {
9895 if let PrivilegedPeripheralRequest::Advertise {
9896 parameters,
9897 advertised_peripheral,
9898 responder,
9899 } = self
9900 {
9901 Some((parameters, advertised_peripheral, responder))
9902 } else {
9903 None
9904 }
9905 }
9906
9907 #[allow(irrefutable_let_patterns)]
9908 pub fn into_start_advertising(
9909 self,
9910 ) -> Option<(
9911 AdvertisingParameters,
9912 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
9913 PrivilegedPeripheralStartAdvertisingResponder,
9914 )> {
9915 if let PrivilegedPeripheralRequest::StartAdvertising { parameters, handle, responder } =
9916 self
9917 {
9918 Some((parameters, handle, responder))
9919 } else {
9920 None
9921 }
9922 }
9923
9924 pub fn method_name(&self) -> &'static str {
9926 match *self {
9927 PrivilegedPeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
9928 PrivilegedPeripheralRequest::Advertise { .. } => "advertise",
9929 PrivilegedPeripheralRequest::StartAdvertising { .. } => "start_advertising",
9930 }
9931 }
9932}
9933
9934#[derive(Debug, Clone)]
9935pub struct PrivilegedPeripheralControlHandle {
9936 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9937}
9938
9939impl fidl::endpoints::ControlHandle for PrivilegedPeripheralControlHandle {
9940 fn shutdown(&self) {
9941 self.inner.shutdown()
9942 }
9943 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9944 self.inner.shutdown_with_epitaph(status)
9945 }
9946
9947 fn is_closed(&self) -> bool {
9948 self.inner.channel().is_closed()
9949 }
9950 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9951 self.inner.channel().on_closed()
9952 }
9953
9954 #[cfg(target_os = "fuchsia")]
9955 fn signal_peer(
9956 &self,
9957 clear_mask: zx::Signals,
9958 set_mask: zx::Signals,
9959 ) -> Result<(), zx_status::Status> {
9960 use fidl::Peered;
9961 self.inner.channel().signal_peer(clear_mask, set_mask)
9962 }
9963}
9964
9965impl PrivilegedPeripheralControlHandle {
9966 pub fn send_on_peer_connected(
9967 &self,
9968 mut peer: &Peer,
9969 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
9970 ) -> Result<(), fidl::Error> {
9971 self.inner.send::<PeripheralOnPeerConnectedRequest>(
9972 (peer, connection),
9973 0,
9974 0x16135d464299e356,
9975 fidl::encoding::DynamicFlags::empty(),
9976 )
9977 }
9978}
9979
9980#[must_use = "FIDL methods require a response to be sent"]
9981#[derive(Debug)]
9982pub struct PrivilegedPeripheralListenL2capResponder {
9983 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
9984 tx_id: u32,
9985}
9986
9987impl std::ops::Drop for PrivilegedPeripheralListenL2capResponder {
9991 fn drop(&mut self) {
9992 self.control_handle.shutdown();
9993 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9995 }
9996}
9997
9998impl fidl::endpoints::Responder for PrivilegedPeripheralListenL2capResponder {
9999 type ControlHandle = PrivilegedPeripheralControlHandle;
10000
10001 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
10002 &self.control_handle
10003 }
10004
10005 fn drop_without_shutdown(mut self) {
10006 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10008 std::mem::forget(self);
10010 }
10011}
10012
10013impl PrivilegedPeripheralListenL2capResponder {
10014 pub fn send(
10018 self,
10019 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
10020 ) -> Result<(), fidl::Error> {
10021 let _result = self.send_raw(result);
10022 if _result.is_err() {
10023 self.control_handle.shutdown();
10024 }
10025 self.drop_without_shutdown();
10026 _result
10027 }
10028
10029 pub fn send_no_shutdown_on_err(
10031 self,
10032 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
10033 ) -> Result<(), fidl::Error> {
10034 let _result = self.send_raw(result);
10035 self.drop_without_shutdown();
10036 _result
10037 }
10038
10039 fn send_raw(
10040 &self,
10041 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
10042 ) -> Result<(), fidl::Error> {
10043 self.control_handle.inner.send::<fidl::encoding::ResultType<
10044 ChannelListenerRegistryListenL2capResponse,
10045 i32,
10046 >>(
10047 result,
10048 self.tx_id,
10049 0x39c6e9001d102338,
10050 fidl::encoding::DynamicFlags::empty(),
10051 )
10052 }
10053}
10054
10055#[must_use = "FIDL methods require a response to be sent"]
10056#[derive(Debug)]
10057pub struct PrivilegedPeripheralAdvertiseResponder {
10058 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
10059 tx_id: u32,
10060}
10061
10062impl std::ops::Drop for PrivilegedPeripheralAdvertiseResponder {
10066 fn drop(&mut self) {
10067 self.control_handle.shutdown();
10068 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10070 }
10071}
10072
10073impl fidl::endpoints::Responder for PrivilegedPeripheralAdvertiseResponder {
10074 type ControlHandle = PrivilegedPeripheralControlHandle;
10075
10076 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
10077 &self.control_handle
10078 }
10079
10080 fn drop_without_shutdown(mut self) {
10081 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10083 std::mem::forget(self);
10085 }
10086}
10087
10088impl PrivilegedPeripheralAdvertiseResponder {
10089 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
10093 let _result = self.send_raw(result);
10094 if _result.is_err() {
10095 self.control_handle.shutdown();
10096 }
10097 self.drop_without_shutdown();
10098 _result
10099 }
10100
10101 pub fn send_no_shutdown_on_err(
10103 self,
10104 mut result: Result<(), PeripheralError>,
10105 ) -> Result<(), fidl::Error> {
10106 let _result = self.send_raw(result);
10107 self.drop_without_shutdown();
10108 _result
10109 }
10110
10111 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
10112 self.control_handle.inner.send::<fidl::encoding::ResultType<
10113 fidl::encoding::EmptyStruct,
10114 PeripheralError,
10115 >>(
10116 result,
10117 self.tx_id,
10118 0x2d9ec9260c32c17f,
10119 fidl::encoding::DynamicFlags::empty(),
10120 )
10121 }
10122}
10123
10124#[must_use = "FIDL methods require a response to be sent"]
10125#[derive(Debug)]
10126pub struct PrivilegedPeripheralStartAdvertisingResponder {
10127 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
10128 tx_id: u32,
10129}
10130
10131impl std::ops::Drop for PrivilegedPeripheralStartAdvertisingResponder {
10135 fn drop(&mut self) {
10136 self.control_handle.shutdown();
10137 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10139 }
10140}
10141
10142impl fidl::endpoints::Responder for PrivilegedPeripheralStartAdvertisingResponder {
10143 type ControlHandle = PrivilegedPeripheralControlHandle;
10144
10145 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
10146 &self.control_handle
10147 }
10148
10149 fn drop_without_shutdown(mut self) {
10150 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10152 std::mem::forget(self);
10154 }
10155}
10156
10157impl PrivilegedPeripheralStartAdvertisingResponder {
10158 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
10162 let _result = self.send_raw(result);
10163 if _result.is_err() {
10164 self.control_handle.shutdown();
10165 }
10166 self.drop_without_shutdown();
10167 _result
10168 }
10169
10170 pub fn send_no_shutdown_on_err(
10172 self,
10173 mut result: Result<(), PeripheralError>,
10174 ) -> Result<(), fidl::Error> {
10175 let _result = self.send_raw(result);
10176 self.drop_without_shutdown();
10177 _result
10178 }
10179
10180 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
10181 self.control_handle.inner.send::<fidl::encoding::ResultType<
10182 fidl::encoding::EmptyStruct,
10183 PeripheralError,
10184 >>(
10185 result,
10186 self.tx_id,
10187 0x5875c1c575f00f7d,
10188 fidl::encoding::DynamicFlags::empty(),
10189 )
10190 }
10191}
10192
10193#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10194pub struct ScanResultWatcherMarker;
10195
10196impl fidl::endpoints::ProtocolMarker for ScanResultWatcherMarker {
10197 type Proxy = ScanResultWatcherProxy;
10198 type RequestStream = ScanResultWatcherRequestStream;
10199 #[cfg(target_os = "fuchsia")]
10200 type SynchronousProxy = ScanResultWatcherSynchronousProxy;
10201
10202 const DEBUG_NAME: &'static str = "(anonymous) ScanResultWatcher";
10203}
10204
10205pub trait ScanResultWatcherProxyInterface: Send + Sync {
10206 type WatchResponseFut: std::future::Future<Output = Result<Vec<Peer>, fidl::Error>> + Send;
10207 fn r#watch(&self) -> Self::WatchResponseFut;
10208}
10209#[derive(Debug)]
10210#[cfg(target_os = "fuchsia")]
10211pub struct ScanResultWatcherSynchronousProxy {
10212 client: fidl::client::sync::Client,
10213}
10214
10215#[cfg(target_os = "fuchsia")]
10216impl fidl::endpoints::SynchronousProxy for ScanResultWatcherSynchronousProxy {
10217 type Proxy = ScanResultWatcherProxy;
10218 type Protocol = ScanResultWatcherMarker;
10219
10220 fn from_channel(inner: fidl::Channel) -> Self {
10221 Self::new(inner)
10222 }
10223
10224 fn into_channel(self) -> fidl::Channel {
10225 self.client.into_channel()
10226 }
10227
10228 fn as_channel(&self) -> &fidl::Channel {
10229 self.client.as_channel()
10230 }
10231}
10232
10233#[cfg(target_os = "fuchsia")]
10234impl ScanResultWatcherSynchronousProxy {
10235 pub fn new(channel: fidl::Channel) -> Self {
10236 let protocol_name =
10237 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10238 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10239 }
10240
10241 pub fn into_channel(self) -> fidl::Channel {
10242 self.client.into_channel()
10243 }
10244
10245 pub fn wait_for_event(
10248 &self,
10249 deadline: zx::MonotonicInstant,
10250 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
10251 ScanResultWatcherEvent::decode(self.client.wait_for_event(deadline)?)
10252 }
10253
10254 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Peer>, fidl::Error> {
10264 let _response = self
10265 .client
10266 .send_query::<fidl::encoding::EmptyPayload, ScanResultWatcherWatchResponse>(
10267 (),
10268 0x713a122e949f301a,
10269 fidl::encoding::DynamicFlags::empty(),
10270 ___deadline,
10271 )?;
10272 Ok(_response.updated)
10273 }
10274}
10275
10276#[cfg(target_os = "fuchsia")]
10277impl From<ScanResultWatcherSynchronousProxy> for zx::Handle {
10278 fn from(value: ScanResultWatcherSynchronousProxy) -> Self {
10279 value.into_channel().into()
10280 }
10281}
10282
10283#[cfg(target_os = "fuchsia")]
10284impl From<fidl::Channel> for ScanResultWatcherSynchronousProxy {
10285 fn from(value: fidl::Channel) -> Self {
10286 Self::new(value)
10287 }
10288}
10289
10290#[cfg(target_os = "fuchsia")]
10291impl fidl::endpoints::FromClient for ScanResultWatcherSynchronousProxy {
10292 type Protocol = ScanResultWatcherMarker;
10293
10294 fn from_client(value: fidl::endpoints::ClientEnd<ScanResultWatcherMarker>) -> Self {
10295 Self::new(value.into_channel())
10296 }
10297}
10298
10299#[derive(Debug, Clone)]
10300pub struct ScanResultWatcherProxy {
10301 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10302}
10303
10304impl fidl::endpoints::Proxy for ScanResultWatcherProxy {
10305 type Protocol = ScanResultWatcherMarker;
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 ScanResultWatcherProxy {
10321 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10323 let protocol_name =
10324 <ScanResultWatcherMarker 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) -> ScanResultWatcherEventStream {
10334 ScanResultWatcherEventStream { event_receiver: self.client.take_event_receiver() }
10335 }
10336
10337 pub fn r#watch(
10347 &self,
10348 ) -> fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>
10349 {
10350 ScanResultWatcherProxyInterface::r#watch(self)
10351 }
10352}
10353
10354impl ScanResultWatcherProxyInterface for ScanResultWatcherProxy {
10355 type WatchResponseFut =
10356 fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>;
10357 fn r#watch(&self) -> Self::WatchResponseFut {
10358 fn _decode(
10359 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10360 ) -> Result<Vec<Peer>, fidl::Error> {
10361 let _response = fidl::client::decode_transaction_body::<
10362 ScanResultWatcherWatchResponse,
10363 fidl::encoding::DefaultFuchsiaResourceDialect,
10364 0x713a122e949f301a,
10365 >(_buf?)?;
10366 Ok(_response.updated)
10367 }
10368 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Peer>>(
10369 (),
10370 0x713a122e949f301a,
10371 fidl::encoding::DynamicFlags::empty(),
10372 _decode,
10373 )
10374 }
10375}
10376
10377pub struct ScanResultWatcherEventStream {
10378 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10379}
10380
10381impl std::marker::Unpin for ScanResultWatcherEventStream {}
10382
10383impl futures::stream::FusedStream for ScanResultWatcherEventStream {
10384 fn is_terminated(&self) -> bool {
10385 self.event_receiver.is_terminated()
10386 }
10387}
10388
10389impl futures::Stream for ScanResultWatcherEventStream {
10390 type Item = Result<ScanResultWatcherEvent, fidl::Error>;
10391
10392 fn poll_next(
10393 mut self: std::pin::Pin<&mut Self>,
10394 cx: &mut std::task::Context<'_>,
10395 ) -> std::task::Poll<Option<Self::Item>> {
10396 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10397 &mut self.event_receiver,
10398 cx
10399 )?) {
10400 Some(buf) => std::task::Poll::Ready(Some(ScanResultWatcherEvent::decode(buf))),
10401 None => std::task::Poll::Ready(None),
10402 }
10403 }
10404}
10405
10406#[derive(Debug)]
10407pub enum ScanResultWatcherEvent {}
10408
10409impl ScanResultWatcherEvent {
10410 fn decode(
10412 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10413 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
10414 let (bytes, _handles) = buf.split_mut();
10415 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10416 debug_assert_eq!(tx_header.tx_id, 0);
10417 match tx_header.ordinal {
10418 _ => Err(fidl::Error::UnknownOrdinal {
10419 ordinal: tx_header.ordinal,
10420 protocol_name:
10421 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10422 }),
10423 }
10424 }
10425}
10426
10427pub struct ScanResultWatcherRequestStream {
10429 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10430 is_terminated: bool,
10431}
10432
10433impl std::marker::Unpin for ScanResultWatcherRequestStream {}
10434
10435impl futures::stream::FusedStream for ScanResultWatcherRequestStream {
10436 fn is_terminated(&self) -> bool {
10437 self.is_terminated
10438 }
10439}
10440
10441impl fidl::endpoints::RequestStream for ScanResultWatcherRequestStream {
10442 type Protocol = ScanResultWatcherMarker;
10443 type ControlHandle = ScanResultWatcherControlHandle;
10444
10445 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10446 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10447 }
10448
10449 fn control_handle(&self) -> Self::ControlHandle {
10450 ScanResultWatcherControlHandle { inner: self.inner.clone() }
10451 }
10452
10453 fn into_inner(
10454 self,
10455 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10456 {
10457 (self.inner, self.is_terminated)
10458 }
10459
10460 fn from_inner(
10461 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10462 is_terminated: bool,
10463 ) -> Self {
10464 Self { inner, is_terminated }
10465 }
10466}
10467
10468impl futures::Stream for ScanResultWatcherRequestStream {
10469 type Item = Result<ScanResultWatcherRequest, fidl::Error>;
10470
10471 fn poll_next(
10472 mut self: std::pin::Pin<&mut Self>,
10473 cx: &mut std::task::Context<'_>,
10474 ) -> std::task::Poll<Option<Self::Item>> {
10475 let this = &mut *self;
10476 if this.inner.check_shutdown(cx) {
10477 this.is_terminated = true;
10478 return std::task::Poll::Ready(None);
10479 }
10480 if this.is_terminated {
10481 panic!("polled ScanResultWatcherRequestStream after completion");
10482 }
10483 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10484 |bytes, handles| {
10485 match this.inner.channel().read_etc(cx, bytes, handles) {
10486 std::task::Poll::Ready(Ok(())) => {}
10487 std::task::Poll::Pending => return std::task::Poll::Pending,
10488 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10489 this.is_terminated = true;
10490 return std::task::Poll::Ready(None);
10491 }
10492 std::task::Poll::Ready(Err(e)) => {
10493 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10494 e.into(),
10495 ))))
10496 }
10497 }
10498
10499 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10501
10502 std::task::Poll::Ready(Some(match header.ordinal {
10503 0x713a122e949f301a => {
10504 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10505 let mut req = fidl::new_empty!(
10506 fidl::encoding::EmptyPayload,
10507 fidl::encoding::DefaultFuchsiaResourceDialect
10508 );
10509 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10510 let control_handle =
10511 ScanResultWatcherControlHandle { inner: this.inner.clone() };
10512 Ok(ScanResultWatcherRequest::Watch {
10513 responder: ScanResultWatcherWatchResponder {
10514 control_handle: std::mem::ManuallyDrop::new(control_handle),
10515 tx_id: header.tx_id,
10516 },
10517 })
10518 }
10519 _ => Err(fidl::Error::UnknownOrdinal {
10520 ordinal: header.ordinal,
10521 protocol_name:
10522 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10523 }),
10524 }))
10525 },
10526 )
10527 }
10528}
10529
10530#[derive(Debug)]
10536pub enum ScanResultWatcherRequest {
10537 Watch { responder: ScanResultWatcherWatchResponder },
10547}
10548
10549impl ScanResultWatcherRequest {
10550 #[allow(irrefutable_let_patterns)]
10551 pub fn into_watch(self) -> Option<(ScanResultWatcherWatchResponder)> {
10552 if let ScanResultWatcherRequest::Watch { responder } = self {
10553 Some((responder))
10554 } else {
10555 None
10556 }
10557 }
10558
10559 pub fn method_name(&self) -> &'static str {
10561 match *self {
10562 ScanResultWatcherRequest::Watch { .. } => "watch",
10563 }
10564 }
10565}
10566
10567#[derive(Debug, Clone)]
10568pub struct ScanResultWatcherControlHandle {
10569 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10570}
10571
10572impl fidl::endpoints::ControlHandle for ScanResultWatcherControlHandle {
10573 fn shutdown(&self) {
10574 self.inner.shutdown()
10575 }
10576 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10577 self.inner.shutdown_with_epitaph(status)
10578 }
10579
10580 fn is_closed(&self) -> bool {
10581 self.inner.channel().is_closed()
10582 }
10583 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10584 self.inner.channel().on_closed()
10585 }
10586
10587 #[cfg(target_os = "fuchsia")]
10588 fn signal_peer(
10589 &self,
10590 clear_mask: zx::Signals,
10591 set_mask: zx::Signals,
10592 ) -> Result<(), zx_status::Status> {
10593 use fidl::Peered;
10594 self.inner.channel().signal_peer(clear_mask, set_mask)
10595 }
10596}
10597
10598impl ScanResultWatcherControlHandle {}
10599
10600#[must_use = "FIDL methods require a response to be sent"]
10601#[derive(Debug)]
10602pub struct ScanResultWatcherWatchResponder {
10603 control_handle: std::mem::ManuallyDrop<ScanResultWatcherControlHandle>,
10604 tx_id: u32,
10605}
10606
10607impl std::ops::Drop for ScanResultWatcherWatchResponder {
10611 fn drop(&mut self) {
10612 self.control_handle.shutdown();
10613 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10615 }
10616}
10617
10618impl fidl::endpoints::Responder for ScanResultWatcherWatchResponder {
10619 type ControlHandle = ScanResultWatcherControlHandle;
10620
10621 fn control_handle(&self) -> &ScanResultWatcherControlHandle {
10622 &self.control_handle
10623 }
10624
10625 fn drop_without_shutdown(mut self) {
10626 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10628 std::mem::forget(self);
10630 }
10631}
10632
10633impl ScanResultWatcherWatchResponder {
10634 pub fn send(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
10638 let _result = self.send_raw(updated);
10639 if _result.is_err() {
10640 self.control_handle.shutdown();
10641 }
10642 self.drop_without_shutdown();
10643 _result
10644 }
10645
10646 pub fn send_no_shutdown_on_err(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
10648 let _result = self.send_raw(updated);
10649 self.drop_without_shutdown();
10650 _result
10651 }
10652
10653 fn send_raw(&self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
10654 self.control_handle.inner.send::<ScanResultWatcherWatchResponse>(
10655 (updated,),
10656 self.tx_id,
10657 0x713a122e949f301a,
10658 fidl::encoding::DynamicFlags::empty(),
10659 )
10660 }
10661}
10662
10663mod internal {
10664 use super::*;
10665
10666 impl fidl::encoding::ResourceTypeMarker for AdvertisedPeripheralOnConnectedRequest {
10667 type Borrowed<'a> = &'a mut Self;
10668 fn take_or_borrow<'a>(
10669 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10670 ) -> Self::Borrowed<'a> {
10671 value
10672 }
10673 }
10674
10675 unsafe impl fidl::encoding::TypeMarker for AdvertisedPeripheralOnConnectedRequest {
10676 type Owned = Self;
10677
10678 #[inline(always)]
10679 fn inline_align(_context: fidl::encoding::Context) -> usize {
10680 8
10681 }
10682
10683 #[inline(always)]
10684 fn inline_size(_context: fidl::encoding::Context) -> usize {
10685 24
10686 }
10687 }
10688
10689 unsafe impl
10690 fidl::encoding::Encode<
10691 AdvertisedPeripheralOnConnectedRequest,
10692 fidl::encoding::DefaultFuchsiaResourceDialect,
10693 > for &mut AdvertisedPeripheralOnConnectedRequest
10694 {
10695 #[inline]
10696 unsafe fn encode(
10697 self,
10698 encoder: &mut fidl::encoding::Encoder<
10699 '_,
10700 fidl::encoding::DefaultFuchsiaResourceDialect,
10701 >,
10702 offset: usize,
10703 _depth: fidl::encoding::Depth,
10704 ) -> fidl::Result<()> {
10705 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
10706 fidl::encoding::Encode::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10708 (
10709 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
10710 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
10711 ),
10712 encoder, offset, _depth
10713 )
10714 }
10715 }
10716 unsafe impl<
10717 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
10718 T1: fidl::encoding::Encode<
10719 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10720 fidl::encoding::DefaultFuchsiaResourceDialect,
10721 >,
10722 >
10723 fidl::encoding::Encode<
10724 AdvertisedPeripheralOnConnectedRequest,
10725 fidl::encoding::DefaultFuchsiaResourceDialect,
10726 > for (T0, T1)
10727 {
10728 #[inline]
10729 unsafe fn encode(
10730 self,
10731 encoder: &mut fidl::encoding::Encoder<
10732 '_,
10733 fidl::encoding::DefaultFuchsiaResourceDialect,
10734 >,
10735 offset: usize,
10736 depth: fidl::encoding::Depth,
10737 ) -> fidl::Result<()> {
10738 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
10739 unsafe {
10742 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10743 (ptr as *mut u64).write_unaligned(0);
10744 }
10745 self.0.encode(encoder, offset + 0, depth)?;
10747 self.1.encode(encoder, offset + 16, depth)?;
10748 Ok(())
10749 }
10750 }
10751
10752 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10753 for AdvertisedPeripheralOnConnectedRequest
10754 {
10755 #[inline(always)]
10756 fn new_empty() -> Self {
10757 Self {
10758 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
10759 connection: fidl::new_empty!(
10760 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10761 fidl::encoding::DefaultFuchsiaResourceDialect
10762 ),
10763 }
10764 }
10765
10766 #[inline]
10767 unsafe fn decode(
10768 &mut self,
10769 decoder: &mut fidl::encoding::Decoder<
10770 '_,
10771 fidl::encoding::DefaultFuchsiaResourceDialect,
10772 >,
10773 offset: usize,
10774 _depth: fidl::encoding::Depth,
10775 ) -> fidl::Result<()> {
10776 decoder.debug_check_bounds::<Self>(offset);
10777 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10779 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10780 let mask = 0xffffffff00000000u64;
10781 let maskedval = padval & mask;
10782 if maskedval != 0 {
10783 return Err(fidl::Error::NonZeroPadding {
10784 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10785 });
10786 }
10787 fidl::decode!(
10788 Peer,
10789 fidl::encoding::DefaultFuchsiaResourceDialect,
10790 &mut self.peer,
10791 decoder,
10792 offset + 0,
10793 _depth
10794 )?;
10795 fidl::decode!(
10796 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10797 fidl::encoding::DefaultFuchsiaResourceDialect,
10798 &mut self.connection,
10799 decoder,
10800 offset + 16,
10801 _depth
10802 )?;
10803 Ok(())
10804 }
10805 }
10806
10807 impl fidl::encoding::ResourceTypeMarker for CentralConnectPeripheralRequest {
10808 type Borrowed<'a> = &'a mut Self;
10809 fn take_or_borrow<'a>(
10810 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10811 ) -> Self::Borrowed<'a> {
10812 value
10813 }
10814 }
10815
10816 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralRequest {
10817 type Owned = Self;
10818
10819 #[inline(always)]
10820 fn inline_align(_context: fidl::encoding::Context) -> usize {
10821 8
10822 }
10823
10824 #[inline(always)]
10825 fn inline_size(_context: fidl::encoding::Context) -> usize {
10826 40
10827 }
10828 }
10829
10830 unsafe impl
10831 fidl::encoding::Encode<
10832 CentralConnectPeripheralRequest,
10833 fidl::encoding::DefaultFuchsiaResourceDialect,
10834 > for &mut CentralConnectPeripheralRequest
10835 {
10836 #[inline]
10837 unsafe fn encode(
10838 self,
10839 encoder: &mut fidl::encoding::Encoder<
10840 '_,
10841 fidl::encoding::DefaultFuchsiaResourceDialect,
10842 >,
10843 offset: usize,
10844 _depth: fidl::encoding::Depth,
10845 ) -> fidl::Result<()> {
10846 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
10847 fidl::encoding::Encode::<
10849 CentralConnectPeripheralRequest,
10850 fidl::encoding::DefaultFuchsiaResourceDialect,
10851 >::encode(
10852 (
10853 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
10854 &self.identifier,
10855 ),
10856 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10857 <fidl::encoding::Endpoint<
10858 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10859 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10860 &mut self.gatt_client
10861 ),
10862 ),
10863 encoder,
10864 offset,
10865 _depth,
10866 )
10867 }
10868 }
10869 unsafe impl<
10870 T0: fidl::encoding::Encode<
10871 fidl::encoding::BoundedString<16>,
10872 fidl::encoding::DefaultFuchsiaResourceDialect,
10873 >,
10874 T1: fidl::encoding::Encode<
10875 ConnectionOptions,
10876 fidl::encoding::DefaultFuchsiaResourceDialect,
10877 >,
10878 T2: fidl::encoding::Encode<
10879 fidl::encoding::Endpoint<
10880 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10881 >,
10882 fidl::encoding::DefaultFuchsiaResourceDialect,
10883 >,
10884 >
10885 fidl::encoding::Encode<
10886 CentralConnectPeripheralRequest,
10887 fidl::encoding::DefaultFuchsiaResourceDialect,
10888 > for (T0, T1, T2)
10889 {
10890 #[inline]
10891 unsafe fn encode(
10892 self,
10893 encoder: &mut fidl::encoding::Encoder<
10894 '_,
10895 fidl::encoding::DefaultFuchsiaResourceDialect,
10896 >,
10897 offset: usize,
10898 depth: fidl::encoding::Depth,
10899 ) -> fidl::Result<()> {
10900 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
10901 unsafe {
10904 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10905 (ptr as *mut u64).write_unaligned(0);
10906 }
10907 self.0.encode(encoder, offset + 0, depth)?;
10909 self.1.encode(encoder, offset + 16, depth)?;
10910 self.2.encode(encoder, offset + 32, depth)?;
10911 Ok(())
10912 }
10913 }
10914
10915 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10916 for CentralConnectPeripheralRequest
10917 {
10918 #[inline(always)]
10919 fn new_empty() -> Self {
10920 Self {
10921 identifier: fidl::new_empty!(
10922 fidl::encoding::BoundedString<16>,
10923 fidl::encoding::DefaultFuchsiaResourceDialect
10924 ),
10925 options: fidl::new_empty!(
10926 ConnectionOptions,
10927 fidl::encoding::DefaultFuchsiaResourceDialect
10928 ),
10929 gatt_client: fidl::new_empty!(
10930 fidl::encoding::Endpoint<
10931 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10932 >,
10933 fidl::encoding::DefaultFuchsiaResourceDialect
10934 ),
10935 }
10936 }
10937
10938 #[inline]
10939 unsafe fn decode(
10940 &mut self,
10941 decoder: &mut fidl::encoding::Decoder<
10942 '_,
10943 fidl::encoding::DefaultFuchsiaResourceDialect,
10944 >,
10945 offset: usize,
10946 _depth: fidl::encoding::Depth,
10947 ) -> fidl::Result<()> {
10948 decoder.debug_check_bounds::<Self>(offset);
10949 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10951 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10952 let mask = 0xffffffff00000000u64;
10953 let maskedval = padval & mask;
10954 if maskedval != 0 {
10955 return Err(fidl::Error::NonZeroPadding {
10956 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10957 });
10958 }
10959 fidl::decode!(
10960 fidl::encoding::BoundedString<16>,
10961 fidl::encoding::DefaultFuchsiaResourceDialect,
10962 &mut self.identifier,
10963 decoder,
10964 offset + 0,
10965 _depth
10966 )?;
10967 fidl::decode!(
10968 ConnectionOptions,
10969 fidl::encoding::DefaultFuchsiaResourceDialect,
10970 &mut self.options,
10971 decoder,
10972 offset + 16,
10973 _depth
10974 )?;
10975 fidl::decode!(
10976 fidl::encoding::Endpoint<
10977 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
10978 >,
10979 fidl::encoding::DefaultFuchsiaResourceDialect,
10980 &mut self.gatt_client,
10981 decoder,
10982 offset + 32,
10983 _depth
10984 )?;
10985 Ok(())
10986 }
10987 }
10988
10989 impl fidl::encoding::ResourceTypeMarker for CentralConnectRequest {
10990 type Borrowed<'a> = &'a mut Self;
10991 fn take_or_borrow<'a>(
10992 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10993 ) -> Self::Borrowed<'a> {
10994 value
10995 }
10996 }
10997
10998 unsafe impl fidl::encoding::TypeMarker for CentralConnectRequest {
10999 type Owned = Self;
11000
11001 #[inline(always)]
11002 fn inline_align(_context: fidl::encoding::Context) -> usize {
11003 8
11004 }
11005
11006 #[inline(always)]
11007 fn inline_size(_context: fidl::encoding::Context) -> usize {
11008 32
11009 }
11010 }
11011
11012 unsafe impl
11013 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11014 for &mut CentralConnectRequest
11015 {
11016 #[inline]
11017 unsafe fn encode(
11018 self,
11019 encoder: &mut fidl::encoding::Encoder<
11020 '_,
11021 fidl::encoding::DefaultFuchsiaResourceDialect,
11022 >,
11023 offset: usize,
11024 _depth: fidl::encoding::Depth,
11025 ) -> fidl::Result<()> {
11026 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
11027 fidl::encoding::Encode::<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11029 (
11030 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11031 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
11032 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
11033 ),
11034 encoder, offset, _depth
11035 )
11036 }
11037 }
11038 unsafe impl<
11039 T0: fidl::encoding::Encode<
11040 fidl_fuchsia_bluetooth::PeerId,
11041 fidl::encoding::DefaultFuchsiaResourceDialect,
11042 >,
11043 T1: fidl::encoding::Encode<
11044 ConnectionOptions,
11045 fidl::encoding::DefaultFuchsiaResourceDialect,
11046 >,
11047 T2: fidl::encoding::Encode<
11048 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
11049 fidl::encoding::DefaultFuchsiaResourceDialect,
11050 >,
11051 >
11052 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11053 for (T0, T1, T2)
11054 {
11055 #[inline]
11056 unsafe fn encode(
11057 self,
11058 encoder: &mut fidl::encoding::Encoder<
11059 '_,
11060 fidl::encoding::DefaultFuchsiaResourceDialect,
11061 >,
11062 offset: usize,
11063 depth: fidl::encoding::Depth,
11064 ) -> fidl::Result<()> {
11065 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
11066 unsafe {
11069 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
11070 (ptr as *mut u64).write_unaligned(0);
11071 }
11072 self.0.encode(encoder, offset + 0, depth)?;
11074 self.1.encode(encoder, offset + 8, depth)?;
11075 self.2.encode(encoder, offset + 24, depth)?;
11076 Ok(())
11077 }
11078 }
11079
11080 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11081 for CentralConnectRequest
11082 {
11083 #[inline(always)]
11084 fn new_empty() -> Self {
11085 Self {
11086 id: fidl::new_empty!(
11087 fidl_fuchsia_bluetooth::PeerId,
11088 fidl::encoding::DefaultFuchsiaResourceDialect
11089 ),
11090 options: fidl::new_empty!(
11091 ConnectionOptions,
11092 fidl::encoding::DefaultFuchsiaResourceDialect
11093 ),
11094 handle: fidl::new_empty!(
11095 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
11096 fidl::encoding::DefaultFuchsiaResourceDialect
11097 ),
11098 }
11099 }
11100
11101 #[inline]
11102 unsafe fn decode(
11103 &mut self,
11104 decoder: &mut fidl::encoding::Decoder<
11105 '_,
11106 fidl::encoding::DefaultFuchsiaResourceDialect,
11107 >,
11108 offset: usize,
11109 _depth: fidl::encoding::Depth,
11110 ) -> fidl::Result<()> {
11111 decoder.debug_check_bounds::<Self>(offset);
11112 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11114 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11115 let mask = 0xffffffff00000000u64;
11116 let maskedval = padval & mask;
11117 if maskedval != 0 {
11118 return Err(fidl::Error::NonZeroPadding {
11119 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11120 });
11121 }
11122 fidl::decode!(
11123 fidl_fuchsia_bluetooth::PeerId,
11124 fidl::encoding::DefaultFuchsiaResourceDialect,
11125 &mut self.id,
11126 decoder,
11127 offset + 0,
11128 _depth
11129 )?;
11130 fidl::decode!(
11131 ConnectionOptions,
11132 fidl::encoding::DefaultFuchsiaResourceDialect,
11133 &mut self.options,
11134 decoder,
11135 offset + 8,
11136 _depth
11137 )?;
11138 fidl::decode!(
11139 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
11140 fidl::encoding::DefaultFuchsiaResourceDialect,
11141 &mut self.handle,
11142 decoder,
11143 offset + 24,
11144 _depth
11145 )?;
11146 Ok(())
11147 }
11148 }
11149
11150 impl fidl::encoding::ResourceTypeMarker for CentralScanRequest {
11151 type Borrowed<'a> = &'a mut Self;
11152 fn take_or_borrow<'a>(
11153 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11154 ) -> Self::Borrowed<'a> {
11155 value
11156 }
11157 }
11158
11159 unsafe impl fidl::encoding::TypeMarker for CentralScanRequest {
11160 type Owned = Self;
11161
11162 #[inline(always)]
11163 fn inline_align(_context: fidl::encoding::Context) -> usize {
11164 8
11165 }
11166
11167 #[inline(always)]
11168 fn inline_size(_context: fidl::encoding::Context) -> usize {
11169 24
11170 }
11171 }
11172
11173 unsafe impl
11174 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11175 for &mut CentralScanRequest
11176 {
11177 #[inline]
11178 unsafe fn encode(
11179 self,
11180 encoder: &mut fidl::encoding::Encoder<
11181 '_,
11182 fidl::encoding::DefaultFuchsiaResourceDialect,
11183 >,
11184 offset: usize,
11185 _depth: fidl::encoding::Depth,
11186 ) -> fidl::Result<()> {
11187 encoder.debug_check_bounds::<CentralScanRequest>(offset);
11188 fidl::encoding::Encode::<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11190 (
11191 <ScanOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
11192 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_watcher),
11193 ),
11194 encoder, offset, _depth
11195 )
11196 }
11197 }
11198 unsafe impl<
11199 T0: fidl::encoding::Encode<ScanOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
11200 T1: fidl::encoding::Encode<
11201 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
11202 fidl::encoding::DefaultFuchsiaResourceDialect,
11203 >,
11204 >
11205 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11206 for (T0, T1)
11207 {
11208 #[inline]
11209 unsafe fn encode(
11210 self,
11211 encoder: &mut fidl::encoding::Encoder<
11212 '_,
11213 fidl::encoding::DefaultFuchsiaResourceDialect,
11214 >,
11215 offset: usize,
11216 depth: fidl::encoding::Depth,
11217 ) -> fidl::Result<()> {
11218 encoder.debug_check_bounds::<CentralScanRequest>(offset);
11219 unsafe {
11222 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11223 (ptr as *mut u64).write_unaligned(0);
11224 }
11225 self.0.encode(encoder, offset + 0, depth)?;
11227 self.1.encode(encoder, offset + 16, depth)?;
11228 Ok(())
11229 }
11230 }
11231
11232 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11233 for CentralScanRequest
11234 {
11235 #[inline(always)]
11236 fn new_empty() -> Self {
11237 Self {
11238 options: fidl::new_empty!(
11239 ScanOptions,
11240 fidl::encoding::DefaultFuchsiaResourceDialect
11241 ),
11242 result_watcher: fidl::new_empty!(
11243 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
11244 fidl::encoding::DefaultFuchsiaResourceDialect
11245 ),
11246 }
11247 }
11248
11249 #[inline]
11250 unsafe fn decode(
11251 &mut self,
11252 decoder: &mut fidl::encoding::Decoder<
11253 '_,
11254 fidl::encoding::DefaultFuchsiaResourceDialect,
11255 >,
11256 offset: usize,
11257 _depth: fidl::encoding::Depth,
11258 ) -> fidl::Result<()> {
11259 decoder.debug_check_bounds::<Self>(offset);
11260 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11262 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11263 let mask = 0xffffffff00000000u64;
11264 let maskedval = padval & mask;
11265 if maskedval != 0 {
11266 return Err(fidl::Error::NonZeroPadding {
11267 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11268 });
11269 }
11270 fidl::decode!(
11271 ScanOptions,
11272 fidl::encoding::DefaultFuchsiaResourceDialect,
11273 &mut self.options,
11274 decoder,
11275 offset + 0,
11276 _depth
11277 )?;
11278 fidl::decode!(
11279 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
11280 fidl::encoding::DefaultFuchsiaResourceDialect,
11281 &mut self.result_watcher,
11282 decoder,
11283 offset + 16,
11284 _depth
11285 )?;
11286 Ok(())
11287 }
11288 }
11289
11290 impl fidl::encoding::ResourceTypeMarker for ChannelListenerAcceptRequest {
11291 type Borrowed<'a> = &'a mut Self;
11292 fn take_or_borrow<'a>(
11293 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11294 ) -> Self::Borrowed<'a> {
11295 value
11296 }
11297 }
11298
11299 unsafe impl fidl::encoding::TypeMarker for ChannelListenerAcceptRequest {
11300 type Owned = Self;
11301
11302 #[inline(always)]
11303 fn inline_align(_context: fidl::encoding::Context) -> usize {
11304 4
11305 }
11306
11307 #[inline(always)]
11308 fn inline_size(_context: fidl::encoding::Context) -> usize {
11309 4
11310 }
11311 }
11312
11313 unsafe impl
11314 fidl::encoding::Encode<
11315 ChannelListenerAcceptRequest,
11316 fidl::encoding::DefaultFuchsiaResourceDialect,
11317 > for &mut ChannelListenerAcceptRequest
11318 {
11319 #[inline]
11320 unsafe fn encode(
11321 self,
11322 encoder: &mut fidl::encoding::Encoder<
11323 '_,
11324 fidl::encoding::DefaultFuchsiaResourceDialect,
11325 >,
11326 offset: usize,
11327 _depth: fidl::encoding::Depth,
11328 ) -> fidl::Result<()> {
11329 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
11330 fidl::encoding::Encode::<
11332 ChannelListenerAcceptRequest,
11333 fidl::encoding::DefaultFuchsiaResourceDialect,
11334 >::encode(
11335 (<fidl::encoding::Endpoint<
11336 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
11337 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11338 &mut self.channel
11339 ),),
11340 encoder,
11341 offset,
11342 _depth,
11343 )
11344 }
11345 }
11346 unsafe impl<
11347 T0: fidl::encoding::Encode<
11348 fidl::encoding::Endpoint<
11349 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
11350 >,
11351 fidl::encoding::DefaultFuchsiaResourceDialect,
11352 >,
11353 >
11354 fidl::encoding::Encode<
11355 ChannelListenerAcceptRequest,
11356 fidl::encoding::DefaultFuchsiaResourceDialect,
11357 > for (T0,)
11358 {
11359 #[inline]
11360 unsafe fn encode(
11361 self,
11362 encoder: &mut fidl::encoding::Encoder<
11363 '_,
11364 fidl::encoding::DefaultFuchsiaResourceDialect,
11365 >,
11366 offset: usize,
11367 depth: fidl::encoding::Depth,
11368 ) -> fidl::Result<()> {
11369 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
11370 self.0.encode(encoder, offset + 0, depth)?;
11374 Ok(())
11375 }
11376 }
11377
11378 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11379 for ChannelListenerAcceptRequest
11380 {
11381 #[inline(always)]
11382 fn new_empty() -> Self {
11383 Self {
11384 channel: fidl::new_empty!(
11385 fidl::encoding::Endpoint<
11386 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
11387 >,
11388 fidl::encoding::DefaultFuchsiaResourceDialect
11389 ),
11390 }
11391 }
11392
11393 #[inline]
11394 unsafe fn decode(
11395 &mut self,
11396 decoder: &mut fidl::encoding::Decoder<
11397 '_,
11398 fidl::encoding::DefaultFuchsiaResourceDialect,
11399 >,
11400 offset: usize,
11401 _depth: fidl::encoding::Depth,
11402 ) -> fidl::Result<()> {
11403 decoder.debug_check_bounds::<Self>(offset);
11404 fidl::decode!(
11406 fidl::encoding::Endpoint<
11407 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
11408 >,
11409 fidl::encoding::DefaultFuchsiaResourceDialect,
11410 &mut self.channel,
11411 decoder,
11412 offset + 0,
11413 _depth
11414 )?;
11415 Ok(())
11416 }
11417 }
11418
11419 impl fidl::encoding::ResourceTypeMarker for ConnectionRequestGattClientRequest {
11420 type Borrowed<'a> = &'a mut Self;
11421 fn take_or_borrow<'a>(
11422 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11423 ) -> Self::Borrowed<'a> {
11424 value
11425 }
11426 }
11427
11428 unsafe impl fidl::encoding::TypeMarker for ConnectionRequestGattClientRequest {
11429 type Owned = Self;
11430
11431 #[inline(always)]
11432 fn inline_align(_context: fidl::encoding::Context) -> usize {
11433 4
11434 }
11435
11436 #[inline(always)]
11437 fn inline_size(_context: fidl::encoding::Context) -> usize {
11438 4
11439 }
11440 }
11441
11442 unsafe impl
11443 fidl::encoding::Encode<
11444 ConnectionRequestGattClientRequest,
11445 fidl::encoding::DefaultFuchsiaResourceDialect,
11446 > for &mut ConnectionRequestGattClientRequest
11447 {
11448 #[inline]
11449 unsafe fn encode(
11450 self,
11451 encoder: &mut fidl::encoding::Encoder<
11452 '_,
11453 fidl::encoding::DefaultFuchsiaResourceDialect,
11454 >,
11455 offset: usize,
11456 _depth: fidl::encoding::Depth,
11457 ) -> fidl::Result<()> {
11458 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
11459 fidl::encoding::Encode::<
11461 ConnectionRequestGattClientRequest,
11462 fidl::encoding::DefaultFuchsiaResourceDialect,
11463 >::encode(
11464 (<fidl::encoding::Endpoint<
11465 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
11466 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11467 &mut self.client
11468 ),),
11469 encoder,
11470 offset,
11471 _depth,
11472 )
11473 }
11474 }
11475 unsafe impl<
11476 T0: fidl::encoding::Encode<
11477 fidl::encoding::Endpoint<
11478 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
11479 >,
11480 fidl::encoding::DefaultFuchsiaResourceDialect,
11481 >,
11482 >
11483 fidl::encoding::Encode<
11484 ConnectionRequestGattClientRequest,
11485 fidl::encoding::DefaultFuchsiaResourceDialect,
11486 > for (T0,)
11487 {
11488 #[inline]
11489 unsafe fn encode(
11490 self,
11491 encoder: &mut fidl::encoding::Encoder<
11492 '_,
11493 fidl::encoding::DefaultFuchsiaResourceDialect,
11494 >,
11495 offset: usize,
11496 depth: fidl::encoding::Depth,
11497 ) -> fidl::Result<()> {
11498 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
11499 self.0.encode(encoder, offset + 0, depth)?;
11503 Ok(())
11504 }
11505 }
11506
11507 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11508 for ConnectionRequestGattClientRequest
11509 {
11510 #[inline(always)]
11511 fn new_empty() -> Self {
11512 Self {
11513 client: fidl::new_empty!(
11514 fidl::encoding::Endpoint<
11515 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
11516 >,
11517 fidl::encoding::DefaultFuchsiaResourceDialect
11518 ),
11519 }
11520 }
11521
11522 #[inline]
11523 unsafe fn decode(
11524 &mut self,
11525 decoder: &mut fidl::encoding::Decoder<
11526 '_,
11527 fidl::encoding::DefaultFuchsiaResourceDialect,
11528 >,
11529 offset: usize,
11530 _depth: fidl::encoding::Depth,
11531 ) -> fidl::Result<()> {
11532 decoder.debug_check_bounds::<Self>(offset);
11533 fidl::decode!(
11535 fidl::encoding::Endpoint<
11536 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
11537 >,
11538 fidl::encoding::DefaultFuchsiaResourceDialect,
11539 &mut self.client,
11540 decoder,
11541 offset + 0,
11542 _depth
11543 )?;
11544 Ok(())
11545 }
11546 }
11547
11548 impl fidl::encoding::ResourceTypeMarker for PeripheralAdvertiseRequest {
11549 type Borrowed<'a> = &'a mut Self;
11550 fn take_or_borrow<'a>(
11551 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11552 ) -> Self::Borrowed<'a> {
11553 value
11554 }
11555 }
11556
11557 unsafe impl fidl::encoding::TypeMarker for PeripheralAdvertiseRequest {
11558 type Owned = Self;
11559
11560 #[inline(always)]
11561 fn inline_align(_context: fidl::encoding::Context) -> usize {
11562 8
11563 }
11564
11565 #[inline(always)]
11566 fn inline_size(_context: fidl::encoding::Context) -> usize {
11567 24
11568 }
11569 }
11570
11571 unsafe impl
11572 fidl::encoding::Encode<
11573 PeripheralAdvertiseRequest,
11574 fidl::encoding::DefaultFuchsiaResourceDialect,
11575 > for &mut PeripheralAdvertiseRequest
11576 {
11577 #[inline]
11578 unsafe fn encode(
11579 self,
11580 encoder: &mut fidl::encoding::Encoder<
11581 '_,
11582 fidl::encoding::DefaultFuchsiaResourceDialect,
11583 >,
11584 offset: usize,
11585 _depth: fidl::encoding::Depth,
11586 ) -> fidl::Result<()> {
11587 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
11588 fidl::encoding::Encode::<
11590 PeripheralAdvertiseRequest,
11591 fidl::encoding::DefaultFuchsiaResourceDialect,
11592 >::encode(
11593 (
11594 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(
11595 &self.parameters,
11596 ),
11597 <fidl::encoding::Endpoint<
11598 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
11599 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11600 &mut self.advertised_peripheral,
11601 ),
11602 ),
11603 encoder,
11604 offset,
11605 _depth,
11606 )
11607 }
11608 }
11609 unsafe impl<
11610 T0: fidl::encoding::Encode<
11611 AdvertisingParameters,
11612 fidl::encoding::DefaultFuchsiaResourceDialect,
11613 >,
11614 T1: fidl::encoding::Encode<
11615 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
11616 fidl::encoding::DefaultFuchsiaResourceDialect,
11617 >,
11618 >
11619 fidl::encoding::Encode<
11620 PeripheralAdvertiseRequest,
11621 fidl::encoding::DefaultFuchsiaResourceDialect,
11622 > for (T0, T1)
11623 {
11624 #[inline]
11625 unsafe fn encode(
11626 self,
11627 encoder: &mut fidl::encoding::Encoder<
11628 '_,
11629 fidl::encoding::DefaultFuchsiaResourceDialect,
11630 >,
11631 offset: usize,
11632 depth: fidl::encoding::Depth,
11633 ) -> fidl::Result<()> {
11634 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
11635 unsafe {
11638 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11639 (ptr as *mut u64).write_unaligned(0);
11640 }
11641 self.0.encode(encoder, offset + 0, depth)?;
11643 self.1.encode(encoder, offset + 16, depth)?;
11644 Ok(())
11645 }
11646 }
11647
11648 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11649 for PeripheralAdvertiseRequest
11650 {
11651 #[inline(always)]
11652 fn new_empty() -> Self {
11653 Self {
11654 parameters: fidl::new_empty!(
11655 AdvertisingParameters,
11656 fidl::encoding::DefaultFuchsiaResourceDialect
11657 ),
11658 advertised_peripheral: fidl::new_empty!(
11659 fidl::encoding::Endpoint<
11660 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
11661 >,
11662 fidl::encoding::DefaultFuchsiaResourceDialect
11663 ),
11664 }
11665 }
11666
11667 #[inline]
11668 unsafe fn decode(
11669 &mut self,
11670 decoder: &mut fidl::encoding::Decoder<
11671 '_,
11672 fidl::encoding::DefaultFuchsiaResourceDialect,
11673 >,
11674 offset: usize,
11675 _depth: fidl::encoding::Depth,
11676 ) -> fidl::Result<()> {
11677 decoder.debug_check_bounds::<Self>(offset);
11678 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11680 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11681 let mask = 0xffffffff00000000u64;
11682 let maskedval = padval & mask;
11683 if maskedval != 0 {
11684 return Err(fidl::Error::NonZeroPadding {
11685 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11686 });
11687 }
11688 fidl::decode!(
11689 AdvertisingParameters,
11690 fidl::encoding::DefaultFuchsiaResourceDialect,
11691 &mut self.parameters,
11692 decoder,
11693 offset + 0,
11694 _depth
11695 )?;
11696 fidl::decode!(
11697 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
11698 fidl::encoding::DefaultFuchsiaResourceDialect,
11699 &mut self.advertised_peripheral,
11700 decoder,
11701 offset + 16,
11702 _depth
11703 )?;
11704 Ok(())
11705 }
11706 }
11707
11708 impl fidl::encoding::ResourceTypeMarker for PeripheralOnPeerConnectedRequest {
11709 type Borrowed<'a> = &'a mut Self;
11710 fn take_or_borrow<'a>(
11711 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11712 ) -> Self::Borrowed<'a> {
11713 value
11714 }
11715 }
11716
11717 unsafe impl fidl::encoding::TypeMarker for PeripheralOnPeerConnectedRequest {
11718 type Owned = Self;
11719
11720 #[inline(always)]
11721 fn inline_align(_context: fidl::encoding::Context) -> usize {
11722 8
11723 }
11724
11725 #[inline(always)]
11726 fn inline_size(_context: fidl::encoding::Context) -> usize {
11727 24
11728 }
11729 }
11730
11731 unsafe impl
11732 fidl::encoding::Encode<
11733 PeripheralOnPeerConnectedRequest,
11734 fidl::encoding::DefaultFuchsiaResourceDialect,
11735 > for &mut PeripheralOnPeerConnectedRequest
11736 {
11737 #[inline]
11738 unsafe fn encode(
11739 self,
11740 encoder: &mut fidl::encoding::Encoder<
11741 '_,
11742 fidl::encoding::DefaultFuchsiaResourceDialect,
11743 >,
11744 offset: usize,
11745 _depth: fidl::encoding::Depth,
11746 ) -> fidl::Result<()> {
11747 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
11748 fidl::encoding::Encode::<PeripheralOnPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11750 (
11751 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
11752 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
11753 ),
11754 encoder, offset, _depth
11755 )
11756 }
11757 }
11758 unsafe impl<
11759 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
11760 T1: fidl::encoding::Encode<
11761 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
11762 fidl::encoding::DefaultFuchsiaResourceDialect,
11763 >,
11764 >
11765 fidl::encoding::Encode<
11766 PeripheralOnPeerConnectedRequest,
11767 fidl::encoding::DefaultFuchsiaResourceDialect,
11768 > for (T0, T1)
11769 {
11770 #[inline]
11771 unsafe fn encode(
11772 self,
11773 encoder: &mut fidl::encoding::Encoder<
11774 '_,
11775 fidl::encoding::DefaultFuchsiaResourceDialect,
11776 >,
11777 offset: usize,
11778 depth: fidl::encoding::Depth,
11779 ) -> fidl::Result<()> {
11780 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
11781 unsafe {
11784 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11785 (ptr as *mut u64).write_unaligned(0);
11786 }
11787 self.0.encode(encoder, offset + 0, depth)?;
11789 self.1.encode(encoder, offset + 16, depth)?;
11790 Ok(())
11791 }
11792 }
11793
11794 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11795 for PeripheralOnPeerConnectedRequest
11796 {
11797 #[inline(always)]
11798 fn new_empty() -> Self {
11799 Self {
11800 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
11801 connection: fidl::new_empty!(
11802 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
11803 fidl::encoding::DefaultFuchsiaResourceDialect
11804 ),
11805 }
11806 }
11807
11808 #[inline]
11809 unsafe fn decode(
11810 &mut self,
11811 decoder: &mut fidl::encoding::Decoder<
11812 '_,
11813 fidl::encoding::DefaultFuchsiaResourceDialect,
11814 >,
11815 offset: usize,
11816 _depth: fidl::encoding::Depth,
11817 ) -> fidl::Result<()> {
11818 decoder.debug_check_bounds::<Self>(offset);
11819 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11821 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11822 let mask = 0xffffffff00000000u64;
11823 let maskedval = padval & mask;
11824 if maskedval != 0 {
11825 return Err(fidl::Error::NonZeroPadding {
11826 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11827 });
11828 }
11829 fidl::decode!(
11830 Peer,
11831 fidl::encoding::DefaultFuchsiaResourceDialect,
11832 &mut self.peer,
11833 decoder,
11834 offset + 0,
11835 _depth
11836 )?;
11837 fidl::decode!(
11838 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
11839 fidl::encoding::DefaultFuchsiaResourceDialect,
11840 &mut self.connection,
11841 decoder,
11842 offset + 16,
11843 _depth
11844 )?;
11845 Ok(())
11846 }
11847 }
11848
11849 impl fidl::encoding::ResourceTypeMarker for PeripheralStartAdvertisingRequest {
11850 type Borrowed<'a> = &'a mut Self;
11851 fn take_or_borrow<'a>(
11852 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11853 ) -> Self::Borrowed<'a> {
11854 value
11855 }
11856 }
11857
11858 unsafe impl fidl::encoding::TypeMarker for PeripheralStartAdvertisingRequest {
11859 type Owned = Self;
11860
11861 #[inline(always)]
11862 fn inline_align(_context: fidl::encoding::Context) -> usize {
11863 8
11864 }
11865
11866 #[inline(always)]
11867 fn inline_size(_context: fidl::encoding::Context) -> usize {
11868 24
11869 }
11870 }
11871
11872 unsafe impl
11873 fidl::encoding::Encode<
11874 PeripheralStartAdvertisingRequest,
11875 fidl::encoding::DefaultFuchsiaResourceDialect,
11876 > for &mut PeripheralStartAdvertisingRequest
11877 {
11878 #[inline]
11879 unsafe fn encode(
11880 self,
11881 encoder: &mut fidl::encoding::Encoder<
11882 '_,
11883 fidl::encoding::DefaultFuchsiaResourceDialect,
11884 >,
11885 offset: usize,
11886 _depth: fidl::encoding::Depth,
11887 ) -> fidl::Result<()> {
11888 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
11889 fidl::encoding::Encode::<PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11891 (
11892 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
11893 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
11894 ),
11895 encoder, offset, _depth
11896 )
11897 }
11898 }
11899 unsafe impl<
11900 T0: fidl::encoding::Encode<
11901 AdvertisingParameters,
11902 fidl::encoding::DefaultFuchsiaResourceDialect,
11903 >,
11904 T1: fidl::encoding::Encode<
11905 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
11906 fidl::encoding::DefaultFuchsiaResourceDialect,
11907 >,
11908 >
11909 fidl::encoding::Encode<
11910 PeripheralStartAdvertisingRequest,
11911 fidl::encoding::DefaultFuchsiaResourceDialect,
11912 > for (T0, T1)
11913 {
11914 #[inline]
11915 unsafe fn encode(
11916 self,
11917 encoder: &mut fidl::encoding::Encoder<
11918 '_,
11919 fidl::encoding::DefaultFuchsiaResourceDialect,
11920 >,
11921 offset: usize,
11922 depth: fidl::encoding::Depth,
11923 ) -> fidl::Result<()> {
11924 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
11925 unsafe {
11928 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11929 (ptr as *mut u64).write_unaligned(0);
11930 }
11931 self.0.encode(encoder, offset + 0, depth)?;
11933 self.1.encode(encoder, offset + 16, depth)?;
11934 Ok(())
11935 }
11936 }
11937
11938 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11939 for PeripheralStartAdvertisingRequest
11940 {
11941 #[inline(always)]
11942 fn new_empty() -> Self {
11943 Self {
11944 parameters: fidl::new_empty!(
11945 AdvertisingParameters,
11946 fidl::encoding::DefaultFuchsiaResourceDialect
11947 ),
11948 handle: fidl::new_empty!(
11949 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
11950 fidl::encoding::DefaultFuchsiaResourceDialect
11951 ),
11952 }
11953 }
11954
11955 #[inline]
11956 unsafe fn decode(
11957 &mut self,
11958 decoder: &mut fidl::encoding::Decoder<
11959 '_,
11960 fidl::encoding::DefaultFuchsiaResourceDialect,
11961 >,
11962 offset: usize,
11963 _depth: fidl::encoding::Depth,
11964 ) -> fidl::Result<()> {
11965 decoder.debug_check_bounds::<Self>(offset);
11966 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11968 let padval = unsafe { (ptr as *const u64).read_unaligned() };
11969 let mask = 0xffffffff00000000u64;
11970 let maskedval = padval & mask;
11971 if maskedval != 0 {
11972 return Err(fidl::Error::NonZeroPadding {
11973 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11974 });
11975 }
11976 fidl::decode!(
11977 AdvertisingParameters,
11978 fidl::encoding::DefaultFuchsiaResourceDialect,
11979 &mut self.parameters,
11980 decoder,
11981 offset + 0,
11982 _depth
11983 )?;
11984 fidl::decode!(
11985 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
11986 fidl::encoding::DefaultFuchsiaResourceDialect,
11987 &mut self.handle,
11988 decoder,
11989 offset + 16,
11990 _depth
11991 )?;
11992 Ok(())
11993 }
11994 }
11995
11996 impl CentralCreateConnectedIsochronousGroupRequest {
11997 #[inline(always)]
11998 fn max_ordinal_present(&self) -> u64 {
11999 if let Some(_) = self.cig {
12000 return 3;
12001 }
12002 if let Some(_) = self.cis_requested_parameters {
12003 return 2;
12004 }
12005 if let Some(_) = self.cig_parameters {
12006 return 1;
12007 }
12008 0
12009 }
12010 }
12011
12012 impl fidl::encoding::ResourceTypeMarker for CentralCreateConnectedIsochronousGroupRequest {
12013 type Borrowed<'a> = &'a mut Self;
12014 fn take_or_borrow<'a>(
12015 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12016 ) -> Self::Borrowed<'a> {
12017 value
12018 }
12019 }
12020
12021 unsafe impl fidl::encoding::TypeMarker for CentralCreateConnectedIsochronousGroupRequest {
12022 type Owned = Self;
12023
12024 #[inline(always)]
12025 fn inline_align(_context: fidl::encoding::Context) -> usize {
12026 8
12027 }
12028
12029 #[inline(always)]
12030 fn inline_size(_context: fidl::encoding::Context) -> usize {
12031 16
12032 }
12033 }
12034
12035 unsafe impl
12036 fidl::encoding::Encode<
12037 CentralCreateConnectedIsochronousGroupRequest,
12038 fidl::encoding::DefaultFuchsiaResourceDialect,
12039 > for &mut CentralCreateConnectedIsochronousGroupRequest
12040 {
12041 unsafe fn encode(
12042 self,
12043 encoder: &mut fidl::encoding::Encoder<
12044 '_,
12045 fidl::encoding::DefaultFuchsiaResourceDialect,
12046 >,
12047 offset: usize,
12048 mut depth: fidl::encoding::Depth,
12049 ) -> fidl::Result<()> {
12050 encoder.debug_check_bounds::<CentralCreateConnectedIsochronousGroupRequest>(offset);
12051 let max_ordinal: u64 = self.max_ordinal_present();
12053 encoder.write_num(max_ordinal, offset);
12054 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12055 if max_ordinal == 0 {
12057 return Ok(());
12058 }
12059 depth.increment()?;
12060 let envelope_size = 8;
12061 let bytes_len = max_ordinal as usize * envelope_size;
12062 #[allow(unused_variables)]
12063 let offset = encoder.out_of_line_offset(bytes_len);
12064 let mut _prev_end_offset: usize = 0;
12065 if 1 > max_ordinal {
12066 return Ok(());
12067 }
12068
12069 let cur_offset: usize = (1 - 1) * envelope_size;
12072
12073 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12075
12076 fidl::encoding::encode_in_envelope_optional::<
12081 CigParameters,
12082 fidl::encoding::DefaultFuchsiaResourceDialect,
12083 >(
12084 self.cig_parameters
12085 .as_ref()
12086 .map(<CigParameters as fidl::encoding::ValueTypeMarker>::borrow),
12087 encoder,
12088 offset + cur_offset,
12089 depth,
12090 )?;
12091
12092 _prev_end_offset = cur_offset + envelope_size;
12093 if 2 > max_ordinal {
12094 return Ok(());
12095 }
12096
12097 let cur_offset: usize = (2 - 1) * envelope_size;
12100
12101 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12103
12104 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12109 self.cis_requested_parameters.as_mut().map(<fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12110 encoder, offset + cur_offset, depth
12111 )?;
12112
12113 _prev_end_offset = cur_offset + envelope_size;
12114 if 3 > max_ordinal {
12115 return Ok(());
12116 }
12117
12118 let cur_offset: usize = (3 - 1) * envelope_size;
12121
12122 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12124
12125 fidl::encoding::encode_in_envelope_optional::<
12130 fidl::encoding::Endpoint<
12131 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
12132 >,
12133 fidl::encoding::DefaultFuchsiaResourceDialect,
12134 >(
12135 self.cig.as_mut().map(
12136 <fidl::encoding::Endpoint<
12137 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
12138 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12139 ),
12140 encoder,
12141 offset + cur_offset,
12142 depth,
12143 )?;
12144
12145 _prev_end_offset = cur_offset + envelope_size;
12146
12147 Ok(())
12148 }
12149 }
12150
12151 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12152 for CentralCreateConnectedIsochronousGroupRequest
12153 {
12154 #[inline(always)]
12155 fn new_empty() -> Self {
12156 Self::default()
12157 }
12158
12159 unsafe fn decode(
12160 &mut self,
12161 decoder: &mut fidl::encoding::Decoder<
12162 '_,
12163 fidl::encoding::DefaultFuchsiaResourceDialect,
12164 >,
12165 offset: usize,
12166 mut depth: fidl::encoding::Depth,
12167 ) -> fidl::Result<()> {
12168 decoder.debug_check_bounds::<Self>(offset);
12169 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12170 None => return Err(fidl::Error::NotNullable),
12171 Some(len) => len,
12172 };
12173 if len == 0 {
12175 return Ok(());
12176 };
12177 depth.increment()?;
12178 let envelope_size = 8;
12179 let bytes_len = len * envelope_size;
12180 let offset = decoder.out_of_line_offset(bytes_len)?;
12181 let mut _next_ordinal_to_read = 0;
12183 let mut next_offset = offset;
12184 let end_offset = offset + bytes_len;
12185 _next_ordinal_to_read += 1;
12186 if next_offset >= end_offset {
12187 return Ok(());
12188 }
12189
12190 while _next_ordinal_to_read < 1 {
12192 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12193 _next_ordinal_to_read += 1;
12194 next_offset += envelope_size;
12195 }
12196
12197 let next_out_of_line = decoder.next_out_of_line();
12198 let handles_before = decoder.remaining_handles();
12199 if let Some((inlined, num_bytes, num_handles)) =
12200 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12201 {
12202 let member_inline_size =
12203 <CigParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12204 if inlined != (member_inline_size <= 4) {
12205 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12206 }
12207 let inner_offset;
12208 let mut inner_depth = depth.clone();
12209 if inlined {
12210 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12211 inner_offset = next_offset;
12212 } else {
12213 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12214 inner_depth.increment()?;
12215 }
12216 let val_ref = self.cig_parameters.get_or_insert_with(|| {
12217 fidl::new_empty!(CigParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
12218 });
12219 fidl::decode!(
12220 CigParameters,
12221 fidl::encoding::DefaultFuchsiaResourceDialect,
12222 val_ref,
12223 decoder,
12224 inner_offset,
12225 inner_depth
12226 )?;
12227 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12228 {
12229 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12230 }
12231 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12232 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12233 }
12234 }
12235
12236 next_offset += envelope_size;
12237 _next_ordinal_to_read += 1;
12238 if next_offset >= end_offset {
12239 return Ok(());
12240 }
12241
12242 while _next_ordinal_to_read < 2 {
12244 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12245 _next_ordinal_to_read += 1;
12246 next_offset += envelope_size;
12247 }
12248
12249 let next_out_of_line = decoder.next_out_of_line();
12250 let handles_before = decoder.remaining_handles();
12251 if let Some((inlined, num_bytes, num_handles)) =
12252 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12253 {
12254 let member_inline_size = <fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12255 if inlined != (member_inline_size <= 4) {
12256 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12257 }
12258 let inner_offset;
12259 let mut inner_depth = depth.clone();
12260 if inlined {
12261 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12262 inner_offset = next_offset;
12263 } else {
12264 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12265 inner_depth.increment()?;
12266 }
12267 let val_ref =
12268 self.cis_requested_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect));
12269 fidl::decode!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12270 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12271 {
12272 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12273 }
12274 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12275 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12276 }
12277 }
12278
12279 next_offset += envelope_size;
12280 _next_ordinal_to_read += 1;
12281 if next_offset >= end_offset {
12282 return Ok(());
12283 }
12284
12285 while _next_ordinal_to_read < 3 {
12287 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12288 _next_ordinal_to_read += 1;
12289 next_offset += envelope_size;
12290 }
12291
12292 let next_out_of_line = decoder.next_out_of_line();
12293 let handles_before = decoder.remaining_handles();
12294 if let Some((inlined, num_bytes, num_handles)) =
12295 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12296 {
12297 let member_inline_size = <fidl::encoding::Endpoint<
12298 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
12299 > as fidl::encoding::TypeMarker>::inline_size(
12300 decoder.context
12301 );
12302 if inlined != (member_inline_size <= 4) {
12303 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12304 }
12305 let inner_offset;
12306 let mut inner_depth = depth.clone();
12307 if inlined {
12308 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12309 inner_offset = next_offset;
12310 } else {
12311 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12312 inner_depth.increment()?;
12313 }
12314 let val_ref = self.cig.get_or_insert_with(|| {
12315 fidl::new_empty!(
12316 fidl::encoding::Endpoint<
12317 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
12318 >,
12319 fidl::encoding::DefaultFuchsiaResourceDialect
12320 )
12321 });
12322 fidl::decode!(
12323 fidl::encoding::Endpoint<
12324 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
12325 >,
12326 fidl::encoding::DefaultFuchsiaResourceDialect,
12327 val_ref,
12328 decoder,
12329 inner_offset,
12330 inner_depth
12331 )?;
12332 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12333 {
12334 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12335 }
12336 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12337 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12338 }
12339 }
12340
12341 next_offset += envelope_size;
12342
12343 while next_offset < end_offset {
12345 _next_ordinal_to_read += 1;
12346 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12347 next_offset += envelope_size;
12348 }
12349
12350 Ok(())
12351 }
12352 }
12353
12354 impl CentralSyncToPeriodicAdvertisingRequest {
12355 #[inline(always)]
12356 fn max_ordinal_present(&self) -> u64 {
12357 if let Some(_) = self.config {
12358 return 4;
12359 }
12360 if let Some(_) = self.sync {
12361 return 3;
12362 }
12363 if let Some(_) = self.advertising_sid {
12364 return 2;
12365 }
12366 if let Some(_) = self.peer_id {
12367 return 1;
12368 }
12369 0
12370 }
12371 }
12372
12373 impl fidl::encoding::ResourceTypeMarker for CentralSyncToPeriodicAdvertisingRequest {
12374 type Borrowed<'a> = &'a mut Self;
12375 fn take_or_borrow<'a>(
12376 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12377 ) -> Self::Borrowed<'a> {
12378 value
12379 }
12380 }
12381
12382 unsafe impl fidl::encoding::TypeMarker for CentralSyncToPeriodicAdvertisingRequest {
12383 type Owned = Self;
12384
12385 #[inline(always)]
12386 fn inline_align(_context: fidl::encoding::Context) -> usize {
12387 8
12388 }
12389
12390 #[inline(always)]
12391 fn inline_size(_context: fidl::encoding::Context) -> usize {
12392 16
12393 }
12394 }
12395
12396 unsafe impl
12397 fidl::encoding::Encode<
12398 CentralSyncToPeriodicAdvertisingRequest,
12399 fidl::encoding::DefaultFuchsiaResourceDialect,
12400 > for &mut CentralSyncToPeriodicAdvertisingRequest
12401 {
12402 unsafe fn encode(
12403 self,
12404 encoder: &mut fidl::encoding::Encoder<
12405 '_,
12406 fidl::encoding::DefaultFuchsiaResourceDialect,
12407 >,
12408 offset: usize,
12409 mut depth: fidl::encoding::Depth,
12410 ) -> fidl::Result<()> {
12411 encoder.debug_check_bounds::<CentralSyncToPeriodicAdvertisingRequest>(offset);
12412 let max_ordinal: u64 = self.max_ordinal_present();
12414 encoder.write_num(max_ordinal, offset);
12415 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12416 if max_ordinal == 0 {
12418 return Ok(());
12419 }
12420 depth.increment()?;
12421 let envelope_size = 8;
12422 let bytes_len = max_ordinal as usize * envelope_size;
12423 #[allow(unused_variables)]
12424 let offset = encoder.out_of_line_offset(bytes_len);
12425 let mut _prev_end_offset: usize = 0;
12426 if 1 > max_ordinal {
12427 return Ok(());
12428 }
12429
12430 let cur_offset: usize = (1 - 1) * envelope_size;
12433
12434 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12436
12437 fidl::encoding::encode_in_envelope_optional::<
12442 fidl_fuchsia_bluetooth::PeerId,
12443 fidl::encoding::DefaultFuchsiaResourceDialect,
12444 >(
12445 self.peer_id.as_ref().map(
12446 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow,
12447 ),
12448 encoder,
12449 offset + cur_offset,
12450 depth,
12451 )?;
12452
12453 _prev_end_offset = cur_offset + envelope_size;
12454 if 2 > max_ordinal {
12455 return Ok(());
12456 }
12457
12458 let cur_offset: usize = (2 - 1) * envelope_size;
12461
12462 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12464
12465 fidl::encoding::encode_in_envelope_optional::<
12470 u8,
12471 fidl::encoding::DefaultFuchsiaResourceDialect,
12472 >(
12473 self.advertising_sid.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
12474 encoder,
12475 offset + cur_offset,
12476 depth,
12477 )?;
12478
12479 _prev_end_offset = cur_offset + envelope_size;
12480 if 3 > max_ordinal {
12481 return Ok(());
12482 }
12483
12484 let cur_offset: usize = (3 - 1) * envelope_size;
12487
12488 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12490
12491 fidl::encoding::encode_in_envelope_optional::<
12496 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
12497 fidl::encoding::DefaultFuchsiaResourceDialect,
12498 >(
12499 self.sync.as_mut().map(
12500 <fidl::encoding::Endpoint<
12501 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
12502 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12503 ),
12504 encoder,
12505 offset + cur_offset,
12506 depth,
12507 )?;
12508
12509 _prev_end_offset = cur_offset + envelope_size;
12510 if 4 > max_ordinal {
12511 return Ok(());
12512 }
12513
12514 let cur_offset: usize = (4 - 1) * envelope_size;
12517
12518 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12520
12521 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
12526 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
12527 encoder, offset + cur_offset, depth
12528 )?;
12529
12530 _prev_end_offset = cur_offset + envelope_size;
12531
12532 Ok(())
12533 }
12534 }
12535
12536 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12537 for CentralSyncToPeriodicAdvertisingRequest
12538 {
12539 #[inline(always)]
12540 fn new_empty() -> Self {
12541 Self::default()
12542 }
12543
12544 unsafe fn decode(
12545 &mut self,
12546 decoder: &mut fidl::encoding::Decoder<
12547 '_,
12548 fidl::encoding::DefaultFuchsiaResourceDialect,
12549 >,
12550 offset: usize,
12551 mut depth: fidl::encoding::Depth,
12552 ) -> fidl::Result<()> {
12553 decoder.debug_check_bounds::<Self>(offset);
12554 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12555 None => return Err(fidl::Error::NotNullable),
12556 Some(len) => len,
12557 };
12558 if len == 0 {
12560 return Ok(());
12561 };
12562 depth.increment()?;
12563 let envelope_size = 8;
12564 let bytes_len = len * envelope_size;
12565 let offset = decoder.out_of_line_offset(bytes_len)?;
12566 let mut _next_ordinal_to_read = 0;
12568 let mut next_offset = offset;
12569 let end_offset = offset + bytes_len;
12570 _next_ordinal_to_read += 1;
12571 if next_offset >= end_offset {
12572 return Ok(());
12573 }
12574
12575 while _next_ordinal_to_read < 1 {
12577 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12578 _next_ordinal_to_read += 1;
12579 next_offset += envelope_size;
12580 }
12581
12582 let next_out_of_line = decoder.next_out_of_line();
12583 let handles_before = decoder.remaining_handles();
12584 if let Some((inlined, num_bytes, num_handles)) =
12585 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12586 {
12587 let member_inline_size =
12588 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::TypeMarker>::inline_size(
12589 decoder.context,
12590 );
12591 if inlined != (member_inline_size <= 4) {
12592 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12593 }
12594 let inner_offset;
12595 let mut inner_depth = depth.clone();
12596 if inlined {
12597 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12598 inner_offset = next_offset;
12599 } else {
12600 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12601 inner_depth.increment()?;
12602 }
12603 let val_ref = self.peer_id.get_or_insert_with(|| {
12604 fidl::new_empty!(
12605 fidl_fuchsia_bluetooth::PeerId,
12606 fidl::encoding::DefaultFuchsiaResourceDialect
12607 )
12608 });
12609 fidl::decode!(
12610 fidl_fuchsia_bluetooth::PeerId,
12611 fidl::encoding::DefaultFuchsiaResourceDialect,
12612 val_ref,
12613 decoder,
12614 inner_offset,
12615 inner_depth
12616 )?;
12617 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12618 {
12619 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12620 }
12621 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12622 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12623 }
12624 }
12625
12626 next_offset += envelope_size;
12627 _next_ordinal_to_read += 1;
12628 if next_offset >= end_offset {
12629 return Ok(());
12630 }
12631
12632 while _next_ordinal_to_read < 2 {
12634 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12635 _next_ordinal_to_read += 1;
12636 next_offset += envelope_size;
12637 }
12638
12639 let next_out_of_line = decoder.next_out_of_line();
12640 let handles_before = decoder.remaining_handles();
12641 if let Some((inlined, num_bytes, num_handles)) =
12642 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12643 {
12644 let member_inline_size =
12645 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12646 if inlined != (member_inline_size <= 4) {
12647 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12648 }
12649 let inner_offset;
12650 let mut inner_depth = depth.clone();
12651 if inlined {
12652 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12653 inner_offset = next_offset;
12654 } else {
12655 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12656 inner_depth.increment()?;
12657 }
12658 let val_ref = self.advertising_sid.get_or_insert_with(|| {
12659 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
12660 });
12661 fidl::decode!(
12662 u8,
12663 fidl::encoding::DefaultFuchsiaResourceDialect,
12664 val_ref,
12665 decoder,
12666 inner_offset,
12667 inner_depth
12668 )?;
12669 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12670 {
12671 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12672 }
12673 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12674 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12675 }
12676 }
12677
12678 next_offset += envelope_size;
12679 _next_ordinal_to_read += 1;
12680 if next_offset >= end_offset {
12681 return Ok(());
12682 }
12683
12684 while _next_ordinal_to_read < 3 {
12686 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12687 _next_ordinal_to_read += 1;
12688 next_offset += envelope_size;
12689 }
12690
12691 let next_out_of_line = decoder.next_out_of_line();
12692 let handles_before = decoder.remaining_handles();
12693 if let Some((inlined, num_bytes, num_handles)) =
12694 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12695 {
12696 let member_inline_size = <fidl::encoding::Endpoint<
12697 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
12698 > as fidl::encoding::TypeMarker>::inline_size(
12699 decoder.context
12700 );
12701 if inlined != (member_inline_size <= 4) {
12702 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12703 }
12704 let inner_offset;
12705 let mut inner_depth = depth.clone();
12706 if inlined {
12707 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12708 inner_offset = next_offset;
12709 } else {
12710 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12711 inner_depth.increment()?;
12712 }
12713 let val_ref = self.sync.get_or_insert_with(|| {
12714 fidl::new_empty!(
12715 fidl::encoding::Endpoint<
12716 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
12717 >,
12718 fidl::encoding::DefaultFuchsiaResourceDialect
12719 )
12720 });
12721 fidl::decode!(
12722 fidl::encoding::Endpoint<
12723 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
12724 >,
12725 fidl::encoding::DefaultFuchsiaResourceDialect,
12726 val_ref,
12727 decoder,
12728 inner_offset,
12729 inner_depth
12730 )?;
12731 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12732 {
12733 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12734 }
12735 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12736 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12737 }
12738 }
12739
12740 next_offset += envelope_size;
12741 _next_ordinal_to_read += 1;
12742 if next_offset >= end_offset {
12743 return Ok(());
12744 }
12745
12746 while _next_ordinal_to_read < 4 {
12748 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12749 _next_ordinal_to_read += 1;
12750 next_offset += envelope_size;
12751 }
12752
12753 let next_out_of_line = decoder.next_out_of_line();
12754 let handles_before = decoder.remaining_handles();
12755 if let Some((inlined, num_bytes, num_handles)) =
12756 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12757 {
12758 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12759 if inlined != (member_inline_size <= 4) {
12760 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12761 }
12762 let inner_offset;
12763 let mut inner_depth = depth.clone();
12764 if inlined {
12765 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12766 inner_offset = next_offset;
12767 } else {
12768 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12769 inner_depth.increment()?;
12770 }
12771 let val_ref = self.config.get_or_insert_with(|| {
12772 fidl::new_empty!(
12773 PeriodicAdvertisingSyncConfiguration,
12774 fidl::encoding::DefaultFuchsiaResourceDialect
12775 )
12776 });
12777 fidl::decode!(
12778 PeriodicAdvertisingSyncConfiguration,
12779 fidl::encoding::DefaultFuchsiaResourceDialect,
12780 val_ref,
12781 decoder,
12782 inner_offset,
12783 inner_depth
12784 )?;
12785 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12786 {
12787 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12788 }
12789 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12790 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12791 }
12792 }
12793
12794 next_offset += envelope_size;
12795
12796 while next_offset < end_offset {
12798 _next_ordinal_to_read += 1;
12799 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12800 next_offset += envelope_size;
12801 }
12802
12803 Ok(())
12804 }
12805 }
12806
12807 impl ChannelListenerRegistryListenL2capRequest {
12808 #[inline(always)]
12809 fn max_ordinal_present(&self) -> u64 {
12810 if let Some(_) = self.listener {
12811 return 2;
12812 }
12813 if let Some(_) = self.parameters {
12814 return 1;
12815 }
12816 0
12817 }
12818 }
12819
12820 impl fidl::encoding::ResourceTypeMarker for ChannelListenerRegistryListenL2capRequest {
12821 type Borrowed<'a> = &'a mut Self;
12822 fn take_or_borrow<'a>(
12823 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12824 ) -> Self::Borrowed<'a> {
12825 value
12826 }
12827 }
12828
12829 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capRequest {
12830 type Owned = Self;
12831
12832 #[inline(always)]
12833 fn inline_align(_context: fidl::encoding::Context) -> usize {
12834 8
12835 }
12836
12837 #[inline(always)]
12838 fn inline_size(_context: fidl::encoding::Context) -> usize {
12839 16
12840 }
12841 }
12842
12843 unsafe impl
12844 fidl::encoding::Encode<
12845 ChannelListenerRegistryListenL2capRequest,
12846 fidl::encoding::DefaultFuchsiaResourceDialect,
12847 > for &mut ChannelListenerRegistryListenL2capRequest
12848 {
12849 unsafe fn encode(
12850 self,
12851 encoder: &mut fidl::encoding::Encoder<
12852 '_,
12853 fidl::encoding::DefaultFuchsiaResourceDialect,
12854 >,
12855 offset: usize,
12856 mut depth: fidl::encoding::Depth,
12857 ) -> fidl::Result<()> {
12858 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capRequest>(offset);
12859 let max_ordinal: u64 = self.max_ordinal_present();
12861 encoder.write_num(max_ordinal, offset);
12862 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12863 if max_ordinal == 0 {
12865 return Ok(());
12866 }
12867 depth.increment()?;
12868 let envelope_size = 8;
12869 let bytes_len = max_ordinal as usize * envelope_size;
12870 #[allow(unused_variables)]
12871 let offset = encoder.out_of_line_offset(bytes_len);
12872 let mut _prev_end_offset: usize = 0;
12873 if 1 > max_ordinal {
12874 return Ok(());
12875 }
12876
12877 let cur_offset: usize = (1 - 1) * envelope_size;
12880
12881 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12883
12884 fidl::encoding::encode_in_envelope_optional::<
12889 AcceptedChannelParameters,
12890 fidl::encoding::DefaultFuchsiaResourceDialect,
12891 >(
12892 self.parameters
12893 .as_ref()
12894 .map(<AcceptedChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
12895 encoder,
12896 offset + cur_offset,
12897 depth,
12898 )?;
12899
12900 _prev_end_offset = cur_offset + envelope_size;
12901 if 2 > max_ordinal {
12902 return Ok(());
12903 }
12904
12905 let cur_offset: usize = (2 - 1) * envelope_size;
12908
12909 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12911
12912 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12917 self.listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12918 encoder, offset + cur_offset, depth
12919 )?;
12920
12921 _prev_end_offset = cur_offset + envelope_size;
12922
12923 Ok(())
12924 }
12925 }
12926
12927 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12928 for ChannelListenerRegistryListenL2capRequest
12929 {
12930 #[inline(always)]
12931 fn new_empty() -> Self {
12932 Self::default()
12933 }
12934
12935 unsafe fn decode(
12936 &mut self,
12937 decoder: &mut fidl::encoding::Decoder<
12938 '_,
12939 fidl::encoding::DefaultFuchsiaResourceDialect,
12940 >,
12941 offset: usize,
12942 mut depth: fidl::encoding::Depth,
12943 ) -> fidl::Result<()> {
12944 decoder.debug_check_bounds::<Self>(offset);
12945 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12946 None => return Err(fidl::Error::NotNullable),
12947 Some(len) => len,
12948 };
12949 if len == 0 {
12951 return Ok(());
12952 };
12953 depth.increment()?;
12954 let envelope_size = 8;
12955 let bytes_len = len * envelope_size;
12956 let offset = decoder.out_of_line_offset(bytes_len)?;
12957 let mut _next_ordinal_to_read = 0;
12959 let mut next_offset = offset;
12960 let end_offset = offset + bytes_len;
12961 _next_ordinal_to_read += 1;
12962 if next_offset >= end_offset {
12963 return Ok(());
12964 }
12965
12966 while _next_ordinal_to_read < 1 {
12968 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12969 _next_ordinal_to_read += 1;
12970 next_offset += envelope_size;
12971 }
12972
12973 let next_out_of_line = decoder.next_out_of_line();
12974 let handles_before = decoder.remaining_handles();
12975 if let Some((inlined, num_bytes, num_handles)) =
12976 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12977 {
12978 let member_inline_size =
12979 <AcceptedChannelParameters as fidl::encoding::TypeMarker>::inline_size(
12980 decoder.context,
12981 );
12982 if inlined != (member_inline_size <= 4) {
12983 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12984 }
12985 let inner_offset;
12986 let mut inner_depth = depth.clone();
12987 if inlined {
12988 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12989 inner_offset = next_offset;
12990 } else {
12991 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12992 inner_depth.increment()?;
12993 }
12994 let val_ref = self.parameters.get_or_insert_with(|| {
12995 fidl::new_empty!(
12996 AcceptedChannelParameters,
12997 fidl::encoding::DefaultFuchsiaResourceDialect
12998 )
12999 });
13000 fidl::decode!(
13001 AcceptedChannelParameters,
13002 fidl::encoding::DefaultFuchsiaResourceDialect,
13003 val_ref,
13004 decoder,
13005 inner_offset,
13006 inner_depth
13007 )?;
13008 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13009 {
13010 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13011 }
13012 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13013 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13014 }
13015 }
13016
13017 next_offset += envelope_size;
13018 _next_ordinal_to_read += 1;
13019 if next_offset >= end_offset {
13020 return Ok(());
13021 }
13022
13023 while _next_ordinal_to_read < 2 {
13025 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13026 _next_ordinal_to_read += 1;
13027 next_offset += envelope_size;
13028 }
13029
13030 let next_out_of_line = decoder.next_out_of_line();
13031 let handles_before = decoder.remaining_handles();
13032 if let Some((inlined, num_bytes, num_handles)) =
13033 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13034 {
13035 let member_inline_size = <fidl::encoding::Endpoint<
13036 fidl::endpoints::ClientEnd<ChannelListenerMarker>,
13037 > as fidl::encoding::TypeMarker>::inline_size(
13038 decoder.context
13039 );
13040 if inlined != (member_inline_size <= 4) {
13041 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13042 }
13043 let inner_offset;
13044 let mut inner_depth = depth.clone();
13045 if inlined {
13046 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13047 inner_offset = next_offset;
13048 } else {
13049 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13050 inner_depth.increment()?;
13051 }
13052 let val_ref = self.listener.get_or_insert_with(|| {
13053 fidl::new_empty!(
13054 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
13055 fidl::encoding::DefaultFuchsiaResourceDialect
13056 )
13057 });
13058 fidl::decode!(
13059 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
13060 fidl::encoding::DefaultFuchsiaResourceDialect,
13061 val_ref,
13062 decoder,
13063 inner_offset,
13064 inner_depth
13065 )?;
13066 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13067 {
13068 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13069 }
13070 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13071 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13072 }
13073 }
13074
13075 next_offset += envelope_size;
13076
13077 while next_offset < end_offset {
13079 _next_ordinal_to_read += 1;
13080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13081 next_offset += envelope_size;
13082 }
13083
13084 Ok(())
13085 }
13086 }
13087
13088 impl CisRequestedParameters {
13089 #[inline(always)]
13090 fn max_ordinal_present(&self) -> u64 {
13091 if let Some(_) = self.max_sdu_size_incoming {
13092 return 4;
13093 }
13094 if let Some(_) = self.max_sdu_size_outgoing {
13095 return 3;
13096 }
13097 if let Some(_) = self.connection_stream {
13098 return 2;
13099 }
13100 if let Some(_) = self.cis_id {
13101 return 1;
13102 }
13103 0
13104 }
13105 }
13106
13107 impl fidl::encoding::ResourceTypeMarker for CisRequestedParameters {
13108 type Borrowed<'a> = &'a mut Self;
13109 fn take_or_borrow<'a>(
13110 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13111 ) -> Self::Borrowed<'a> {
13112 value
13113 }
13114 }
13115
13116 unsafe impl fidl::encoding::TypeMarker for CisRequestedParameters {
13117 type Owned = Self;
13118
13119 #[inline(always)]
13120 fn inline_align(_context: fidl::encoding::Context) -> usize {
13121 8
13122 }
13123
13124 #[inline(always)]
13125 fn inline_size(_context: fidl::encoding::Context) -> usize {
13126 16
13127 }
13128 }
13129
13130 unsafe impl
13131 fidl::encoding::Encode<
13132 CisRequestedParameters,
13133 fidl::encoding::DefaultFuchsiaResourceDialect,
13134 > for &mut CisRequestedParameters
13135 {
13136 unsafe fn encode(
13137 self,
13138 encoder: &mut fidl::encoding::Encoder<
13139 '_,
13140 fidl::encoding::DefaultFuchsiaResourceDialect,
13141 >,
13142 offset: usize,
13143 mut depth: fidl::encoding::Depth,
13144 ) -> fidl::Result<()> {
13145 encoder.debug_check_bounds::<CisRequestedParameters>(offset);
13146 let max_ordinal: u64 = self.max_ordinal_present();
13148 encoder.write_num(max_ordinal, offset);
13149 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13150 if max_ordinal == 0 {
13152 return Ok(());
13153 }
13154 depth.increment()?;
13155 let envelope_size = 8;
13156 let bytes_len = max_ordinal as usize * envelope_size;
13157 #[allow(unused_variables)]
13158 let offset = encoder.out_of_line_offset(bytes_len);
13159 let mut _prev_end_offset: usize = 0;
13160 if 1 > max_ordinal {
13161 return Ok(());
13162 }
13163
13164 let cur_offset: usize = (1 - 1) * envelope_size;
13167
13168 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13170
13171 fidl::encoding::encode_in_envelope_optional::<
13176 u8,
13177 fidl::encoding::DefaultFuchsiaResourceDialect,
13178 >(
13179 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13180 encoder,
13181 offset + cur_offset,
13182 depth,
13183 )?;
13184
13185 _prev_end_offset = cur_offset + envelope_size;
13186 if 2 > max_ordinal {
13187 return Ok(());
13188 }
13189
13190 let cur_offset: usize = (2 - 1) * envelope_size;
13193
13194 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13196
13197 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13202 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13203 encoder, offset + cur_offset, depth
13204 )?;
13205
13206 _prev_end_offset = cur_offset + envelope_size;
13207 if 3 > max_ordinal {
13208 return Ok(());
13209 }
13210
13211 let cur_offset: usize = (3 - 1) * envelope_size;
13214
13215 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13217
13218 fidl::encoding::encode_in_envelope_optional::<
13223 u16,
13224 fidl::encoding::DefaultFuchsiaResourceDialect,
13225 >(
13226 self.max_sdu_size_outgoing
13227 .as_ref()
13228 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
13229 encoder,
13230 offset + cur_offset,
13231 depth,
13232 )?;
13233
13234 _prev_end_offset = cur_offset + envelope_size;
13235 if 4 > max_ordinal {
13236 return Ok(());
13237 }
13238
13239 let cur_offset: usize = (4 - 1) * envelope_size;
13242
13243 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13245
13246 fidl::encoding::encode_in_envelope_optional::<
13251 u16,
13252 fidl::encoding::DefaultFuchsiaResourceDialect,
13253 >(
13254 self.max_sdu_size_incoming
13255 .as_ref()
13256 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
13257 encoder,
13258 offset + cur_offset,
13259 depth,
13260 )?;
13261
13262 _prev_end_offset = cur_offset + envelope_size;
13263
13264 Ok(())
13265 }
13266 }
13267
13268 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13269 for CisRequestedParameters
13270 {
13271 #[inline(always)]
13272 fn new_empty() -> Self {
13273 Self::default()
13274 }
13275
13276 unsafe fn decode(
13277 &mut self,
13278 decoder: &mut fidl::encoding::Decoder<
13279 '_,
13280 fidl::encoding::DefaultFuchsiaResourceDialect,
13281 >,
13282 offset: usize,
13283 mut depth: fidl::encoding::Depth,
13284 ) -> fidl::Result<()> {
13285 decoder.debug_check_bounds::<Self>(offset);
13286 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13287 None => return Err(fidl::Error::NotNullable),
13288 Some(len) => len,
13289 };
13290 if len == 0 {
13292 return Ok(());
13293 };
13294 depth.increment()?;
13295 let envelope_size = 8;
13296 let bytes_len = len * envelope_size;
13297 let offset = decoder.out_of_line_offset(bytes_len)?;
13298 let mut _next_ordinal_to_read = 0;
13300 let mut next_offset = offset;
13301 let end_offset = offset + bytes_len;
13302 _next_ordinal_to_read += 1;
13303 if next_offset >= end_offset {
13304 return Ok(());
13305 }
13306
13307 while _next_ordinal_to_read < 1 {
13309 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13310 _next_ordinal_to_read += 1;
13311 next_offset += envelope_size;
13312 }
13313
13314 let next_out_of_line = decoder.next_out_of_line();
13315 let handles_before = decoder.remaining_handles();
13316 if let Some((inlined, num_bytes, num_handles)) =
13317 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13318 {
13319 let member_inline_size =
13320 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13321 if inlined != (member_inline_size <= 4) {
13322 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13323 }
13324 let inner_offset;
13325 let mut inner_depth = depth.clone();
13326 if inlined {
13327 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13328 inner_offset = next_offset;
13329 } else {
13330 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13331 inner_depth.increment()?;
13332 }
13333 let val_ref = self.cis_id.get_or_insert_with(|| {
13334 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
13335 });
13336 fidl::decode!(
13337 u8,
13338 fidl::encoding::DefaultFuchsiaResourceDialect,
13339 val_ref,
13340 decoder,
13341 inner_offset,
13342 inner_depth
13343 )?;
13344 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13345 {
13346 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13347 }
13348 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13349 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13350 }
13351 }
13352
13353 next_offset += envelope_size;
13354 _next_ordinal_to_read += 1;
13355 if next_offset >= end_offset {
13356 return Ok(());
13357 }
13358
13359 while _next_ordinal_to_read < 2 {
13361 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13362 _next_ordinal_to_read += 1;
13363 next_offset += envelope_size;
13364 }
13365
13366 let next_out_of_line = decoder.next_out_of_line();
13367 let handles_before = decoder.remaining_handles();
13368 if let Some((inlined, num_bytes, num_handles)) =
13369 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13370 {
13371 let member_inline_size = <fidl::encoding::Endpoint<
13372 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
13373 > as fidl::encoding::TypeMarker>::inline_size(
13374 decoder.context
13375 );
13376 if inlined != (member_inline_size <= 4) {
13377 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13378 }
13379 let inner_offset;
13380 let mut inner_depth = depth.clone();
13381 if inlined {
13382 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13383 inner_offset = next_offset;
13384 } else {
13385 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13386 inner_depth.increment()?;
13387 }
13388 let val_ref = self.connection_stream.get_or_insert_with(|| {
13389 fidl::new_empty!(
13390 fidl::encoding::Endpoint<
13391 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
13392 >,
13393 fidl::encoding::DefaultFuchsiaResourceDialect
13394 )
13395 });
13396 fidl::decode!(
13397 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
13398 fidl::encoding::DefaultFuchsiaResourceDialect,
13399 val_ref,
13400 decoder,
13401 inner_offset,
13402 inner_depth
13403 )?;
13404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13405 {
13406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13407 }
13408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13410 }
13411 }
13412
13413 next_offset += envelope_size;
13414 _next_ordinal_to_read += 1;
13415 if next_offset >= end_offset {
13416 return Ok(());
13417 }
13418
13419 while _next_ordinal_to_read < 3 {
13421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13422 _next_ordinal_to_read += 1;
13423 next_offset += envelope_size;
13424 }
13425
13426 let next_out_of_line = decoder.next_out_of_line();
13427 let handles_before = decoder.remaining_handles();
13428 if let Some((inlined, num_bytes, num_handles)) =
13429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13430 {
13431 let member_inline_size =
13432 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13433 if inlined != (member_inline_size <= 4) {
13434 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13435 }
13436 let inner_offset;
13437 let mut inner_depth = depth.clone();
13438 if inlined {
13439 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13440 inner_offset = next_offset;
13441 } else {
13442 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13443 inner_depth.increment()?;
13444 }
13445 let val_ref = self.max_sdu_size_outgoing.get_or_insert_with(|| {
13446 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
13447 });
13448 fidl::decode!(
13449 u16,
13450 fidl::encoding::DefaultFuchsiaResourceDialect,
13451 val_ref,
13452 decoder,
13453 inner_offset,
13454 inner_depth
13455 )?;
13456 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13457 {
13458 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13459 }
13460 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13461 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13462 }
13463 }
13464
13465 next_offset += envelope_size;
13466 _next_ordinal_to_read += 1;
13467 if next_offset >= end_offset {
13468 return Ok(());
13469 }
13470
13471 while _next_ordinal_to_read < 4 {
13473 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13474 _next_ordinal_to_read += 1;
13475 next_offset += envelope_size;
13476 }
13477
13478 let next_out_of_line = decoder.next_out_of_line();
13479 let handles_before = decoder.remaining_handles();
13480 if let Some((inlined, num_bytes, num_handles)) =
13481 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13482 {
13483 let member_inline_size =
13484 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13485 if inlined != (member_inline_size <= 4) {
13486 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13487 }
13488 let inner_offset;
13489 let mut inner_depth = depth.clone();
13490 if inlined {
13491 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13492 inner_offset = next_offset;
13493 } else {
13494 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13495 inner_depth.increment()?;
13496 }
13497 let val_ref = self.max_sdu_size_incoming.get_or_insert_with(|| {
13498 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
13499 });
13500 fidl::decode!(
13501 u16,
13502 fidl::encoding::DefaultFuchsiaResourceDialect,
13503 val_ref,
13504 decoder,
13505 inner_offset,
13506 inner_depth
13507 )?;
13508 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13509 {
13510 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13511 }
13512 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13513 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13514 }
13515 }
13516
13517 next_offset += envelope_size;
13518
13519 while next_offset < end_offset {
13521 _next_ordinal_to_read += 1;
13522 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13523 next_offset += envelope_size;
13524 }
13525
13526 Ok(())
13527 }
13528 }
13529
13530 impl ConnectionAcceptCisRequest {
13531 #[inline(always)]
13532 fn max_ordinal_present(&self) -> u64 {
13533 if let Some(_) = self.connection_stream {
13534 return 3;
13535 }
13536 if let Some(_) = self.cis_id {
13537 return 2;
13538 }
13539 if let Some(_) = self.cig_id {
13540 return 1;
13541 }
13542 0
13543 }
13544 }
13545
13546 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptCisRequest {
13547 type Borrowed<'a> = &'a mut Self;
13548 fn take_or_borrow<'a>(
13549 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13550 ) -> Self::Borrowed<'a> {
13551 value
13552 }
13553 }
13554
13555 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptCisRequest {
13556 type Owned = Self;
13557
13558 #[inline(always)]
13559 fn inline_align(_context: fidl::encoding::Context) -> usize {
13560 8
13561 }
13562
13563 #[inline(always)]
13564 fn inline_size(_context: fidl::encoding::Context) -> usize {
13565 16
13566 }
13567 }
13568
13569 unsafe impl
13570 fidl::encoding::Encode<
13571 ConnectionAcceptCisRequest,
13572 fidl::encoding::DefaultFuchsiaResourceDialect,
13573 > for &mut ConnectionAcceptCisRequest
13574 {
13575 unsafe fn encode(
13576 self,
13577 encoder: &mut fidl::encoding::Encoder<
13578 '_,
13579 fidl::encoding::DefaultFuchsiaResourceDialect,
13580 >,
13581 offset: usize,
13582 mut depth: fidl::encoding::Depth,
13583 ) -> fidl::Result<()> {
13584 encoder.debug_check_bounds::<ConnectionAcceptCisRequest>(offset);
13585 let max_ordinal: u64 = self.max_ordinal_present();
13587 encoder.write_num(max_ordinal, offset);
13588 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13589 if max_ordinal == 0 {
13591 return Ok(());
13592 }
13593 depth.increment()?;
13594 let envelope_size = 8;
13595 let bytes_len = max_ordinal as usize * envelope_size;
13596 #[allow(unused_variables)]
13597 let offset = encoder.out_of_line_offset(bytes_len);
13598 let mut _prev_end_offset: usize = 0;
13599 if 1 > max_ordinal {
13600 return Ok(());
13601 }
13602
13603 let cur_offset: usize = (1 - 1) * envelope_size;
13606
13607 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13609
13610 fidl::encoding::encode_in_envelope_optional::<
13615 u8,
13616 fidl::encoding::DefaultFuchsiaResourceDialect,
13617 >(
13618 self.cig_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13619 encoder,
13620 offset + cur_offset,
13621 depth,
13622 )?;
13623
13624 _prev_end_offset = cur_offset + envelope_size;
13625 if 2 > max_ordinal {
13626 return Ok(());
13627 }
13628
13629 let cur_offset: usize = (2 - 1) * envelope_size;
13632
13633 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13635
13636 fidl::encoding::encode_in_envelope_optional::<
13641 u8,
13642 fidl::encoding::DefaultFuchsiaResourceDialect,
13643 >(
13644 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
13645 encoder,
13646 offset + cur_offset,
13647 depth,
13648 )?;
13649
13650 _prev_end_offset = cur_offset + envelope_size;
13651 if 3 > max_ordinal {
13652 return Ok(());
13653 }
13654
13655 let cur_offset: usize = (3 - 1) * envelope_size;
13658
13659 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13661
13662 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13667 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13668 encoder, offset + cur_offset, depth
13669 )?;
13670
13671 _prev_end_offset = cur_offset + envelope_size;
13672
13673 Ok(())
13674 }
13675 }
13676
13677 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13678 for ConnectionAcceptCisRequest
13679 {
13680 #[inline(always)]
13681 fn new_empty() -> Self {
13682 Self::default()
13683 }
13684
13685 unsafe fn decode(
13686 &mut self,
13687 decoder: &mut fidl::encoding::Decoder<
13688 '_,
13689 fidl::encoding::DefaultFuchsiaResourceDialect,
13690 >,
13691 offset: usize,
13692 mut depth: fidl::encoding::Depth,
13693 ) -> fidl::Result<()> {
13694 decoder.debug_check_bounds::<Self>(offset);
13695 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13696 None => return Err(fidl::Error::NotNullable),
13697 Some(len) => len,
13698 };
13699 if len == 0 {
13701 return Ok(());
13702 };
13703 depth.increment()?;
13704 let envelope_size = 8;
13705 let bytes_len = len * envelope_size;
13706 let offset = decoder.out_of_line_offset(bytes_len)?;
13707 let mut _next_ordinal_to_read = 0;
13709 let mut next_offset = offset;
13710 let end_offset = offset + bytes_len;
13711 _next_ordinal_to_read += 1;
13712 if next_offset >= end_offset {
13713 return Ok(());
13714 }
13715
13716 while _next_ordinal_to_read < 1 {
13718 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13719 _next_ordinal_to_read += 1;
13720 next_offset += envelope_size;
13721 }
13722
13723 let next_out_of_line = decoder.next_out_of_line();
13724 let handles_before = decoder.remaining_handles();
13725 if let Some((inlined, num_bytes, num_handles)) =
13726 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13727 {
13728 let member_inline_size =
13729 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13730 if inlined != (member_inline_size <= 4) {
13731 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13732 }
13733 let inner_offset;
13734 let mut inner_depth = depth.clone();
13735 if inlined {
13736 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13737 inner_offset = next_offset;
13738 } else {
13739 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13740 inner_depth.increment()?;
13741 }
13742 let val_ref = self.cig_id.get_or_insert_with(|| {
13743 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
13744 });
13745 fidl::decode!(
13746 u8,
13747 fidl::encoding::DefaultFuchsiaResourceDialect,
13748 val_ref,
13749 decoder,
13750 inner_offset,
13751 inner_depth
13752 )?;
13753 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13754 {
13755 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13756 }
13757 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13758 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13759 }
13760 }
13761
13762 next_offset += envelope_size;
13763 _next_ordinal_to_read += 1;
13764 if next_offset >= end_offset {
13765 return Ok(());
13766 }
13767
13768 while _next_ordinal_to_read < 2 {
13770 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13771 _next_ordinal_to_read += 1;
13772 next_offset += envelope_size;
13773 }
13774
13775 let next_out_of_line = decoder.next_out_of_line();
13776 let handles_before = decoder.remaining_handles();
13777 if let Some((inlined, num_bytes, num_handles)) =
13778 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13779 {
13780 let member_inline_size =
13781 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
13782 if inlined != (member_inline_size <= 4) {
13783 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13784 }
13785 let inner_offset;
13786 let mut inner_depth = depth.clone();
13787 if inlined {
13788 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13789 inner_offset = next_offset;
13790 } else {
13791 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13792 inner_depth.increment()?;
13793 }
13794 let val_ref = self.cis_id.get_or_insert_with(|| {
13795 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
13796 });
13797 fidl::decode!(
13798 u8,
13799 fidl::encoding::DefaultFuchsiaResourceDialect,
13800 val_ref,
13801 decoder,
13802 inner_offset,
13803 inner_depth
13804 )?;
13805 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13806 {
13807 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13808 }
13809 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13810 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13811 }
13812 }
13813
13814 next_offset += envelope_size;
13815 _next_ordinal_to_read += 1;
13816 if next_offset >= end_offset {
13817 return Ok(());
13818 }
13819
13820 while _next_ordinal_to_read < 3 {
13822 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13823 _next_ordinal_to_read += 1;
13824 next_offset += envelope_size;
13825 }
13826
13827 let next_out_of_line = decoder.next_out_of_line();
13828 let handles_before = decoder.remaining_handles();
13829 if let Some((inlined, num_bytes, num_handles)) =
13830 fidl::encoding::decode_envelope_header(decoder, next_offset)?
13831 {
13832 let member_inline_size = <fidl::encoding::Endpoint<
13833 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
13834 > as fidl::encoding::TypeMarker>::inline_size(
13835 decoder.context
13836 );
13837 if inlined != (member_inline_size <= 4) {
13838 return Err(fidl::Error::InvalidInlineBitInEnvelope);
13839 }
13840 let inner_offset;
13841 let mut inner_depth = depth.clone();
13842 if inlined {
13843 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13844 inner_offset = next_offset;
13845 } else {
13846 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13847 inner_depth.increment()?;
13848 }
13849 let val_ref = self.connection_stream.get_or_insert_with(|| {
13850 fidl::new_empty!(
13851 fidl::encoding::Endpoint<
13852 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
13853 >,
13854 fidl::encoding::DefaultFuchsiaResourceDialect
13855 )
13856 });
13857 fidl::decode!(
13858 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
13859 fidl::encoding::DefaultFuchsiaResourceDialect,
13860 val_ref,
13861 decoder,
13862 inner_offset,
13863 inner_depth
13864 )?;
13865 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13866 {
13867 return Err(fidl::Error::InvalidNumBytesInEnvelope);
13868 }
13869 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13870 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13871 }
13872 }
13873
13874 next_offset += envelope_size;
13875
13876 while next_offset < end_offset {
13878 _next_ordinal_to_read += 1;
13879 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13880 next_offset += envelope_size;
13881 }
13882
13883 Ok(())
13884 }
13885 }
13886
13887 impl ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
13888 #[inline(always)]
13889 fn max_ordinal_present(&self) -> u64 {
13890 if let Some(_) = self.config {
13891 return 2;
13892 }
13893 if let Some(_) = self.sync {
13894 return 1;
13895 }
13896 0
13897 }
13898 }
13899
13900 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
13901 type Borrowed<'a> = &'a mut Self;
13902 fn take_or_borrow<'a>(
13903 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13904 ) -> Self::Borrowed<'a> {
13905 value
13906 }
13907 }
13908
13909 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest {
13910 type Owned = Self;
13911
13912 #[inline(always)]
13913 fn inline_align(_context: fidl::encoding::Context) -> usize {
13914 8
13915 }
13916
13917 #[inline(always)]
13918 fn inline_size(_context: fidl::encoding::Context) -> usize {
13919 16
13920 }
13921 }
13922
13923 unsafe impl
13924 fidl::encoding::Encode<
13925 ConnectionAcceptPeriodicAdvertisingSyncTransferRequest,
13926 fidl::encoding::DefaultFuchsiaResourceDialect,
13927 > for &mut ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
13928 {
13929 unsafe fn encode(
13930 self,
13931 encoder: &mut fidl::encoding::Encoder<
13932 '_,
13933 fidl::encoding::DefaultFuchsiaResourceDialect,
13934 >,
13935 offset: usize,
13936 mut depth: fidl::encoding::Depth,
13937 ) -> fidl::Result<()> {
13938 encoder.debug_check_bounds::<ConnectionAcceptPeriodicAdvertisingSyncTransferRequest>(
13939 offset,
13940 );
13941 let max_ordinal: u64 = self.max_ordinal_present();
13943 encoder.write_num(max_ordinal, offset);
13944 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13945 if max_ordinal == 0 {
13947 return Ok(());
13948 }
13949 depth.increment()?;
13950 let envelope_size = 8;
13951 let bytes_len = max_ordinal as usize * envelope_size;
13952 #[allow(unused_variables)]
13953 let offset = encoder.out_of_line_offset(bytes_len);
13954 let mut _prev_end_offset: usize = 0;
13955 if 1 > max_ordinal {
13956 return Ok(());
13957 }
13958
13959 let cur_offset: usize = (1 - 1) * envelope_size;
13962
13963 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13965
13966 fidl::encoding::encode_in_envelope_optional::<
13971 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>>,
13972 fidl::encoding::DefaultFuchsiaResourceDialect,
13973 >(
13974 self.sync.as_mut().map(
13975 <fidl::encoding::Endpoint<
13976 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
13977 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
13978 ),
13979 encoder,
13980 offset + cur_offset,
13981 depth,
13982 )?;
13983
13984 _prev_end_offset = cur_offset + envelope_size;
13985 if 2 > max_ordinal {
13986 return Ok(());
13987 }
13988
13989 let cur_offset: usize = (2 - 1) * envelope_size;
13992
13993 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13995
13996 fidl::encoding::encode_in_envelope_optional::<PeriodicAdvertisingSyncConfiguration, fidl::encoding::DefaultFuchsiaResourceDialect>(
14001 self.config.as_ref().map(<PeriodicAdvertisingSyncConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
14002 encoder, offset + cur_offset, depth
14003 )?;
14004
14005 _prev_end_offset = cur_offset + envelope_size;
14006
14007 Ok(())
14008 }
14009 }
14010
14011 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14012 for ConnectionAcceptPeriodicAdvertisingSyncTransferRequest
14013 {
14014 #[inline(always)]
14015 fn new_empty() -> Self {
14016 Self::default()
14017 }
14018
14019 unsafe fn decode(
14020 &mut self,
14021 decoder: &mut fidl::encoding::Decoder<
14022 '_,
14023 fidl::encoding::DefaultFuchsiaResourceDialect,
14024 >,
14025 offset: usize,
14026 mut depth: fidl::encoding::Depth,
14027 ) -> fidl::Result<()> {
14028 decoder.debug_check_bounds::<Self>(offset);
14029 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14030 None => return Err(fidl::Error::NotNullable),
14031 Some(len) => len,
14032 };
14033 if len == 0 {
14035 return Ok(());
14036 };
14037 depth.increment()?;
14038 let envelope_size = 8;
14039 let bytes_len = len * envelope_size;
14040 let offset = decoder.out_of_line_offset(bytes_len)?;
14041 let mut _next_ordinal_to_read = 0;
14043 let mut next_offset = offset;
14044 let end_offset = offset + bytes_len;
14045 _next_ordinal_to_read += 1;
14046 if next_offset >= end_offset {
14047 return Ok(());
14048 }
14049
14050 while _next_ordinal_to_read < 1 {
14052 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14053 _next_ordinal_to_read += 1;
14054 next_offset += envelope_size;
14055 }
14056
14057 let next_out_of_line = decoder.next_out_of_line();
14058 let handles_before = decoder.remaining_handles();
14059 if let Some((inlined, num_bytes, num_handles)) =
14060 fidl::encoding::decode_envelope_header(decoder, next_offset)?
14061 {
14062 let member_inline_size = <fidl::encoding::Endpoint<
14063 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
14064 > as fidl::encoding::TypeMarker>::inline_size(
14065 decoder.context
14066 );
14067 if inlined != (member_inline_size <= 4) {
14068 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14069 }
14070 let inner_offset;
14071 let mut inner_depth = depth.clone();
14072 if inlined {
14073 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14074 inner_offset = next_offset;
14075 } else {
14076 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14077 inner_depth.increment()?;
14078 }
14079 let val_ref = self.sync.get_or_insert_with(|| {
14080 fidl::new_empty!(
14081 fidl::encoding::Endpoint<
14082 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
14083 >,
14084 fidl::encoding::DefaultFuchsiaResourceDialect
14085 )
14086 });
14087 fidl::decode!(
14088 fidl::encoding::Endpoint<
14089 fidl::endpoints::ServerEnd<PeriodicAdvertisingSyncMarker>,
14090 >,
14091 fidl::encoding::DefaultFuchsiaResourceDialect,
14092 val_ref,
14093 decoder,
14094 inner_offset,
14095 inner_depth
14096 )?;
14097 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14098 {
14099 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14100 }
14101 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14102 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14103 }
14104 }
14105
14106 next_offset += envelope_size;
14107 _next_ordinal_to_read += 1;
14108 if next_offset >= end_offset {
14109 return Ok(());
14110 }
14111
14112 while _next_ordinal_to_read < 2 {
14114 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14115 _next_ordinal_to_read += 1;
14116 next_offset += envelope_size;
14117 }
14118
14119 let next_out_of_line = decoder.next_out_of_line();
14120 let handles_before = decoder.remaining_handles();
14121 if let Some((inlined, num_bytes, num_handles)) =
14122 fidl::encoding::decode_envelope_header(decoder, next_offset)?
14123 {
14124 let member_inline_size = <PeriodicAdvertisingSyncConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14125 if inlined != (member_inline_size <= 4) {
14126 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14127 }
14128 let inner_offset;
14129 let mut inner_depth = depth.clone();
14130 if inlined {
14131 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14132 inner_offset = next_offset;
14133 } else {
14134 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14135 inner_depth.increment()?;
14136 }
14137 let val_ref = self.config.get_or_insert_with(|| {
14138 fidl::new_empty!(
14139 PeriodicAdvertisingSyncConfiguration,
14140 fidl::encoding::DefaultFuchsiaResourceDialect
14141 )
14142 });
14143 fidl::decode!(
14144 PeriodicAdvertisingSyncConfiguration,
14145 fidl::encoding::DefaultFuchsiaResourceDialect,
14146 val_ref,
14147 decoder,
14148 inner_offset,
14149 inner_depth
14150 )?;
14151 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14152 {
14153 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14154 }
14155 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14156 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14157 }
14158 }
14159
14160 next_offset += envelope_size;
14161
14162 while next_offset < end_offset {
14164 _next_ordinal_to_read += 1;
14165 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14166 next_offset += envelope_size;
14167 }
14168
14169 Ok(())
14170 }
14171 }
14172
14173 impl ConnectionConnectL2capRequest {
14174 #[inline(always)]
14175 fn max_ordinal_present(&self) -> u64 {
14176 if let Some(_) = self.psm {
14177 return 3;
14178 }
14179 if let Some(_) = self.channel {
14180 return 2;
14181 }
14182 if let Some(_) = self.parameters {
14183 return 1;
14184 }
14185 0
14186 }
14187 }
14188
14189 impl fidl::encoding::ResourceTypeMarker for ConnectionConnectL2capRequest {
14190 type Borrowed<'a> = &'a mut Self;
14191 fn take_or_borrow<'a>(
14192 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14193 ) -> Self::Borrowed<'a> {
14194 value
14195 }
14196 }
14197
14198 unsafe impl fidl::encoding::TypeMarker for ConnectionConnectL2capRequest {
14199 type Owned = Self;
14200
14201 #[inline(always)]
14202 fn inline_align(_context: fidl::encoding::Context) -> usize {
14203 8
14204 }
14205
14206 #[inline(always)]
14207 fn inline_size(_context: fidl::encoding::Context) -> usize {
14208 16
14209 }
14210 }
14211
14212 unsafe impl
14213 fidl::encoding::Encode<
14214 ConnectionConnectL2capRequest,
14215 fidl::encoding::DefaultFuchsiaResourceDialect,
14216 > for &mut ConnectionConnectL2capRequest
14217 {
14218 unsafe fn encode(
14219 self,
14220 encoder: &mut fidl::encoding::Encoder<
14221 '_,
14222 fidl::encoding::DefaultFuchsiaResourceDialect,
14223 >,
14224 offset: usize,
14225 mut depth: fidl::encoding::Depth,
14226 ) -> fidl::Result<()> {
14227 encoder.debug_check_bounds::<ConnectionConnectL2capRequest>(offset);
14228 let max_ordinal: u64 = self.max_ordinal_present();
14230 encoder.write_num(max_ordinal, offset);
14231 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14232 if max_ordinal == 0 {
14234 return Ok(());
14235 }
14236 depth.increment()?;
14237 let envelope_size = 8;
14238 let bytes_len = max_ordinal as usize * envelope_size;
14239 #[allow(unused_variables)]
14240 let offset = encoder.out_of_line_offset(bytes_len);
14241 let mut _prev_end_offset: usize = 0;
14242 if 1 > max_ordinal {
14243 return Ok(());
14244 }
14245
14246 let cur_offset: usize = (1 - 1) * envelope_size;
14249
14250 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14252
14253 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
14258 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
14259 encoder, offset + cur_offset, depth
14260 )?;
14261
14262 _prev_end_offset = cur_offset + envelope_size;
14263 if 2 > max_ordinal {
14264 return Ok(());
14265 }
14266
14267 let cur_offset: usize = (2 - 1) * envelope_size;
14270
14271 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14273
14274 fidl::encoding::encode_in_envelope_optional::<
14279 fidl::encoding::Endpoint<
14280 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14281 >,
14282 fidl::encoding::DefaultFuchsiaResourceDialect,
14283 >(
14284 self.channel.as_mut().map(
14285 <fidl::encoding::Endpoint<
14286 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14287 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14288 ),
14289 encoder,
14290 offset + cur_offset,
14291 depth,
14292 )?;
14293
14294 _prev_end_offset = cur_offset + envelope_size;
14295 if 3 > max_ordinal {
14296 return Ok(());
14297 }
14298
14299 let cur_offset: usize = (3 - 1) * envelope_size;
14302
14303 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14305
14306 fidl::encoding::encode_in_envelope_optional::<
14311 u16,
14312 fidl::encoding::DefaultFuchsiaResourceDialect,
14313 >(
14314 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
14315 encoder,
14316 offset + cur_offset,
14317 depth,
14318 )?;
14319
14320 _prev_end_offset = cur_offset + envelope_size;
14321
14322 Ok(())
14323 }
14324 }
14325
14326 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14327 for ConnectionConnectL2capRequest
14328 {
14329 #[inline(always)]
14330 fn new_empty() -> Self {
14331 Self::default()
14332 }
14333
14334 unsafe fn decode(
14335 &mut self,
14336 decoder: &mut fidl::encoding::Decoder<
14337 '_,
14338 fidl::encoding::DefaultFuchsiaResourceDialect,
14339 >,
14340 offset: usize,
14341 mut depth: fidl::encoding::Depth,
14342 ) -> fidl::Result<()> {
14343 decoder.debug_check_bounds::<Self>(offset);
14344 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14345 None => return Err(fidl::Error::NotNullable),
14346 Some(len) => len,
14347 };
14348 if len == 0 {
14350 return Ok(());
14351 };
14352 depth.increment()?;
14353 let envelope_size = 8;
14354 let bytes_len = len * envelope_size;
14355 let offset = decoder.out_of_line_offset(bytes_len)?;
14356 let mut _next_ordinal_to_read = 0;
14358 let mut next_offset = offset;
14359 let end_offset = offset + bytes_len;
14360 _next_ordinal_to_read += 1;
14361 if next_offset >= end_offset {
14362 return Ok(());
14363 }
14364
14365 while _next_ordinal_to_read < 1 {
14367 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14368 _next_ordinal_to_read += 1;
14369 next_offset += envelope_size;
14370 }
14371
14372 let next_out_of_line = decoder.next_out_of_line();
14373 let handles_before = decoder.remaining_handles();
14374 if let Some((inlined, num_bytes, num_handles)) =
14375 fidl::encoding::decode_envelope_header(decoder, next_offset)?
14376 {
14377 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14378 if inlined != (member_inline_size <= 4) {
14379 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14380 }
14381 let inner_offset;
14382 let mut inner_depth = depth.clone();
14383 if inlined {
14384 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14385 inner_offset = next_offset;
14386 } else {
14387 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14388 inner_depth.increment()?;
14389 }
14390 let val_ref = self.parameters.get_or_insert_with(|| {
14391 fidl::new_empty!(
14392 fidl_fuchsia_bluetooth::ChannelParameters,
14393 fidl::encoding::DefaultFuchsiaResourceDialect
14394 )
14395 });
14396 fidl::decode!(
14397 fidl_fuchsia_bluetooth::ChannelParameters,
14398 fidl::encoding::DefaultFuchsiaResourceDialect,
14399 val_ref,
14400 decoder,
14401 inner_offset,
14402 inner_depth
14403 )?;
14404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14405 {
14406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14407 }
14408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14410 }
14411 }
14412
14413 next_offset += envelope_size;
14414 _next_ordinal_to_read += 1;
14415 if next_offset >= end_offset {
14416 return Ok(());
14417 }
14418
14419 while _next_ordinal_to_read < 2 {
14421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14422 _next_ordinal_to_read += 1;
14423 next_offset += envelope_size;
14424 }
14425
14426 let next_out_of_line = decoder.next_out_of_line();
14427 let handles_before = decoder.remaining_handles();
14428 if let Some((inlined, num_bytes, num_handles)) =
14429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
14430 {
14431 let member_inline_size = <fidl::encoding::Endpoint<
14432 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14433 > as fidl::encoding::TypeMarker>::inline_size(
14434 decoder.context
14435 );
14436 if inlined != (member_inline_size <= 4) {
14437 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14438 }
14439 let inner_offset;
14440 let mut inner_depth = depth.clone();
14441 if inlined {
14442 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14443 inner_offset = next_offset;
14444 } else {
14445 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14446 inner_depth.increment()?;
14447 }
14448 let val_ref = self.channel.get_or_insert_with(|| {
14449 fidl::new_empty!(
14450 fidl::encoding::Endpoint<
14451 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14452 >,
14453 fidl::encoding::DefaultFuchsiaResourceDialect
14454 )
14455 });
14456 fidl::decode!(
14457 fidl::encoding::Endpoint<
14458 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
14459 >,
14460 fidl::encoding::DefaultFuchsiaResourceDialect,
14461 val_ref,
14462 decoder,
14463 inner_offset,
14464 inner_depth
14465 )?;
14466 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14467 {
14468 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14469 }
14470 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14471 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14472 }
14473 }
14474
14475 next_offset += envelope_size;
14476 _next_ordinal_to_read += 1;
14477 if next_offset >= end_offset {
14478 return Ok(());
14479 }
14480
14481 while _next_ordinal_to_read < 3 {
14483 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14484 _next_ordinal_to_read += 1;
14485 next_offset += envelope_size;
14486 }
14487
14488 let next_out_of_line = decoder.next_out_of_line();
14489 let handles_before = decoder.remaining_handles();
14490 if let Some((inlined, num_bytes, num_handles)) =
14491 fidl::encoding::decode_envelope_header(decoder, next_offset)?
14492 {
14493 let member_inline_size =
14494 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14495 if inlined != (member_inline_size <= 4) {
14496 return Err(fidl::Error::InvalidInlineBitInEnvelope);
14497 }
14498 let inner_offset;
14499 let mut inner_depth = depth.clone();
14500 if inlined {
14501 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14502 inner_offset = next_offset;
14503 } else {
14504 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14505 inner_depth.increment()?;
14506 }
14507 let val_ref = self.psm.get_or_insert_with(|| {
14508 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
14509 });
14510 fidl::decode!(
14511 u16,
14512 fidl::encoding::DefaultFuchsiaResourceDialect,
14513 val_ref,
14514 decoder,
14515 inner_offset,
14516 inner_depth
14517 )?;
14518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14519 {
14520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
14521 }
14522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14524 }
14525 }
14526
14527 next_offset += envelope_size;
14528
14529 while next_offset < end_offset {
14531 _next_ordinal_to_read += 1;
14532 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14533 next_offset += envelope_size;
14534 }
14535
14536 Ok(())
14537 }
14538 }
14539}