1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_bluetooth_le__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AdvertisedPeripheralOnConnectedRequest {
16 pub peer: Peer,
17 pub connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for AdvertisedPeripheralOnConnectedRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct CentralConnectPeripheralRequest {
27 pub identifier: String,
28 pub options: ConnectionOptions,
29 pub gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
30}
31
32impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
33 for CentralConnectPeripheralRequest
34{
35}
36
37#[derive(Debug, PartialEq)]
38pub struct CentralConnectRequest {
39 pub id: fidl_fuchsia_bluetooth::PeerId,
40 pub options: ConnectionOptions,
41 pub handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CentralConnectRequest {}
45
46#[derive(Debug, PartialEq)]
47pub struct CentralScanRequest {
48 pub options: ScanOptions,
49 pub result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
50}
51
52impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CentralScanRequest {}
53
54#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
55pub struct ChannelListenerAcceptRequest {
56 pub channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60 for ChannelListenerAcceptRequest
61{
62}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct ConnectionRequestGattClientRequest {
66 pub client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70 for ConnectionRequestGattClientRequest
71{
72}
73
74#[derive(Debug, PartialEq)]
75pub struct PeripheralAdvertiseRequest {
76 pub parameters: AdvertisingParameters,
77 pub advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
81 for PeripheralAdvertiseRequest
82{
83}
84
85#[derive(Debug, PartialEq)]
86pub struct PeripheralOnPeerConnectedRequest {
87 pub peer: Peer,
88 pub connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92 for PeripheralOnPeerConnectedRequest
93{
94}
95
96#[derive(Debug, PartialEq)]
97pub struct PeripheralStartAdvertisingRequest {
98 pub parameters: AdvertisingParameters,
99 pub handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103 for PeripheralStartAdvertisingRequest
104{
105}
106
107#[derive(Debug, Default, PartialEq)]
108pub struct CentralCreateConnectedIsochronousGroupRequest {
109 pub cig_parameters: Option<CigParameters>,
111 pub cis_requested_parameters: Option<Vec<CisRequestedParameters>>,
113 pub cig: Option<fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>>,
115 #[doc(hidden)]
116 pub __source_breaking: fidl::marker::SourceBreaking,
117}
118
119impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
120 for CentralCreateConnectedIsochronousGroupRequest
121{
122}
123
124#[derive(Debug, Default, PartialEq)]
125pub struct ChannelListenerRegistryListenL2capRequest {
126 pub parameters: Option<AcceptedChannelParameters>,
128 pub listener: Option<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
130 #[doc(hidden)]
131 pub __source_breaking: fidl::marker::SourceBreaking,
132}
133
134impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
135 for ChannelListenerRegistryListenL2capRequest
136{
137}
138
139#[derive(Debug, Default, PartialEq)]
140pub struct CisRequestedParameters {
141 pub cis_id: Option<u8>,
145 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
148 pub max_sdu_size_outgoing: Option<u16>,
153 pub max_sdu_size_incoming: Option<u16>,
158 #[doc(hidden)]
159 pub __source_breaking: fidl::marker::SourceBreaking,
160}
161
162impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CisRequestedParameters {}
163
164#[derive(Debug, Default, PartialEq)]
165pub struct ConnectionAcceptCisRequest {
166 pub cig_id: Option<u8>,
168 pub cis_id: Option<u8>,
170 pub connection_stream: Option<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
177 #[doc(hidden)]
178 pub __source_breaking: fidl::marker::SourceBreaking,
179}
180
181impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
182 for ConnectionAcceptCisRequest
183{
184}
185
186#[derive(Debug, Default, PartialEq)]
187pub struct ConnectionConnectL2capRequest {
188 pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
190 pub channel: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
192 pub psm: Option<u16>,
194 #[doc(hidden)]
195 pub __source_breaking: fidl::marker::SourceBreaking,
196}
197
198impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
199 for ConnectionConnectL2capRequest
200{
201}
202
203#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
204pub struct AdvertisedPeripheralMarker;
205
206impl fidl::endpoints::ProtocolMarker for AdvertisedPeripheralMarker {
207 type Proxy = AdvertisedPeripheralProxy;
208 type RequestStream = AdvertisedPeripheralRequestStream;
209 #[cfg(target_os = "fuchsia")]
210 type SynchronousProxy = AdvertisedPeripheralSynchronousProxy;
211
212 const DEBUG_NAME: &'static str = "(anonymous) AdvertisedPeripheral";
213}
214
215pub trait AdvertisedPeripheralProxyInterface: Send + Sync {
216 type OnConnectedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
217 fn r#on_connected(
218 &self,
219 peer: &Peer,
220 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
221 ) -> Self::OnConnectedResponseFut;
222}
223#[derive(Debug)]
224#[cfg(target_os = "fuchsia")]
225pub struct AdvertisedPeripheralSynchronousProxy {
226 client: fidl::client::sync::Client,
227}
228
229#[cfg(target_os = "fuchsia")]
230impl fidl::endpoints::SynchronousProxy for AdvertisedPeripheralSynchronousProxy {
231 type Proxy = AdvertisedPeripheralProxy;
232 type Protocol = AdvertisedPeripheralMarker;
233
234 fn from_channel(inner: fidl::Channel) -> Self {
235 Self::new(inner)
236 }
237
238 fn into_channel(self) -> fidl::Channel {
239 self.client.into_channel()
240 }
241
242 fn as_channel(&self) -> &fidl::Channel {
243 self.client.as_channel()
244 }
245}
246
247#[cfg(target_os = "fuchsia")]
248impl AdvertisedPeripheralSynchronousProxy {
249 pub fn new(channel: fidl::Channel) -> Self {
250 let protocol_name =
251 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
252 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
253 }
254
255 pub fn into_channel(self) -> fidl::Channel {
256 self.client.into_channel()
257 }
258
259 pub fn wait_for_event(
262 &self,
263 deadline: zx::MonotonicInstant,
264 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
265 AdvertisedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
266 }
267
268 pub fn r#on_connected(
286 &self,
287 mut peer: &Peer,
288 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
289 ___deadline: zx::MonotonicInstant,
290 ) -> Result<(), fidl::Error> {
291 let _response = self
292 .client
293 .send_query::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::EmptyPayload>(
294 (peer, connection),
295 0x607b7716457eb178,
296 fidl::encoding::DynamicFlags::empty(),
297 ___deadline,
298 )?;
299 Ok(_response)
300 }
301}
302
303#[cfg(target_os = "fuchsia")]
304impl From<AdvertisedPeripheralSynchronousProxy> for zx::Handle {
305 fn from(value: AdvertisedPeripheralSynchronousProxy) -> Self {
306 value.into_channel().into()
307 }
308}
309
310#[cfg(target_os = "fuchsia")]
311impl From<fidl::Channel> for AdvertisedPeripheralSynchronousProxy {
312 fn from(value: fidl::Channel) -> Self {
313 Self::new(value)
314 }
315}
316
317#[derive(Debug, Clone)]
318pub struct AdvertisedPeripheralProxy {
319 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
320}
321
322impl fidl::endpoints::Proxy for AdvertisedPeripheralProxy {
323 type Protocol = AdvertisedPeripheralMarker;
324
325 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
326 Self::new(inner)
327 }
328
329 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
330 self.client.into_channel().map_err(|client| Self { client })
331 }
332
333 fn as_channel(&self) -> &::fidl::AsyncChannel {
334 self.client.as_channel()
335 }
336}
337
338impl AdvertisedPeripheralProxy {
339 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
341 let protocol_name =
342 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
343 Self { client: fidl::client::Client::new(channel, protocol_name) }
344 }
345
346 pub fn take_event_stream(&self) -> AdvertisedPeripheralEventStream {
352 AdvertisedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
353 }
354
355 pub fn r#on_connected(
373 &self,
374 mut peer: &Peer,
375 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
376 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
377 AdvertisedPeripheralProxyInterface::r#on_connected(self, peer, connection)
378 }
379}
380
381impl AdvertisedPeripheralProxyInterface for AdvertisedPeripheralProxy {
382 type OnConnectedResponseFut =
383 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
384 fn r#on_connected(
385 &self,
386 mut peer: &Peer,
387 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
388 ) -> Self::OnConnectedResponseFut {
389 fn _decode(
390 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
391 ) -> Result<(), fidl::Error> {
392 let _response = fidl::client::decode_transaction_body::<
393 fidl::encoding::EmptyPayload,
394 fidl::encoding::DefaultFuchsiaResourceDialect,
395 0x607b7716457eb178,
396 >(_buf?)?;
397 Ok(_response)
398 }
399 self.client.send_query_and_decode::<AdvertisedPeripheralOnConnectedRequest, ()>(
400 (peer, connection),
401 0x607b7716457eb178,
402 fidl::encoding::DynamicFlags::empty(),
403 _decode,
404 )
405 }
406}
407
408pub struct AdvertisedPeripheralEventStream {
409 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
410}
411
412impl std::marker::Unpin for AdvertisedPeripheralEventStream {}
413
414impl futures::stream::FusedStream for AdvertisedPeripheralEventStream {
415 fn is_terminated(&self) -> bool {
416 self.event_receiver.is_terminated()
417 }
418}
419
420impl futures::Stream for AdvertisedPeripheralEventStream {
421 type Item = Result<AdvertisedPeripheralEvent, fidl::Error>;
422
423 fn poll_next(
424 mut self: std::pin::Pin<&mut Self>,
425 cx: &mut std::task::Context<'_>,
426 ) -> std::task::Poll<Option<Self::Item>> {
427 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
428 &mut self.event_receiver,
429 cx
430 )?) {
431 Some(buf) => std::task::Poll::Ready(Some(AdvertisedPeripheralEvent::decode(buf))),
432 None => std::task::Poll::Ready(None),
433 }
434 }
435}
436
437#[derive(Debug)]
438pub enum AdvertisedPeripheralEvent {}
439
440impl AdvertisedPeripheralEvent {
441 fn decode(
443 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
444 ) -> Result<AdvertisedPeripheralEvent, fidl::Error> {
445 let (bytes, _handles) = buf.split_mut();
446 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
447 debug_assert_eq!(tx_header.tx_id, 0);
448 match tx_header.ordinal {
449 _ => Err(fidl::Error::UnknownOrdinal {
450 ordinal: tx_header.ordinal,
451 protocol_name:
452 <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
453 }),
454 }
455 }
456}
457
458pub struct AdvertisedPeripheralRequestStream {
460 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
461 is_terminated: bool,
462}
463
464impl std::marker::Unpin for AdvertisedPeripheralRequestStream {}
465
466impl futures::stream::FusedStream for AdvertisedPeripheralRequestStream {
467 fn is_terminated(&self) -> bool {
468 self.is_terminated
469 }
470}
471
472impl fidl::endpoints::RequestStream for AdvertisedPeripheralRequestStream {
473 type Protocol = AdvertisedPeripheralMarker;
474 type ControlHandle = AdvertisedPeripheralControlHandle;
475
476 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
477 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
478 }
479
480 fn control_handle(&self) -> Self::ControlHandle {
481 AdvertisedPeripheralControlHandle { inner: self.inner.clone() }
482 }
483
484 fn into_inner(
485 self,
486 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
487 {
488 (self.inner, self.is_terminated)
489 }
490
491 fn from_inner(
492 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
493 is_terminated: bool,
494 ) -> Self {
495 Self { inner, is_terminated }
496 }
497}
498
499impl futures::Stream for AdvertisedPeripheralRequestStream {
500 type Item = Result<AdvertisedPeripheralRequest, fidl::Error>;
501
502 fn poll_next(
503 mut self: std::pin::Pin<&mut Self>,
504 cx: &mut std::task::Context<'_>,
505 ) -> std::task::Poll<Option<Self::Item>> {
506 let this = &mut *self;
507 if this.inner.check_shutdown(cx) {
508 this.is_terminated = true;
509 return std::task::Poll::Ready(None);
510 }
511 if this.is_terminated {
512 panic!("polled AdvertisedPeripheralRequestStream after completion");
513 }
514 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
515 |bytes, handles| {
516 match this.inner.channel().read_etc(cx, bytes, handles) {
517 std::task::Poll::Ready(Ok(())) => {}
518 std::task::Poll::Pending => return std::task::Poll::Pending,
519 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
520 this.is_terminated = true;
521 return std::task::Poll::Ready(None);
522 }
523 std::task::Poll::Ready(Err(e)) => {
524 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
525 e.into(),
526 ))))
527 }
528 }
529
530 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
532
533 std::task::Poll::Ready(Some(match header.ordinal {
534 0x607b7716457eb178 => {
535 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
536 let mut req = fidl::new_empty!(AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
537 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AdvertisedPeripheralOnConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
538 let control_handle = AdvertisedPeripheralControlHandle {
539 inner: this.inner.clone(),
540 };
541 Ok(AdvertisedPeripheralRequest::OnConnected {peer: req.peer,
542connection: req.connection,
543
544 responder: AdvertisedPeripheralOnConnectedResponder {
545 control_handle: std::mem::ManuallyDrop::new(control_handle),
546 tx_id: header.tx_id,
547 },
548 })
549 }
550 _ => Err(fidl::Error::UnknownOrdinal {
551 ordinal: header.ordinal,
552 protocol_name: <AdvertisedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
553 }),
554 }))
555 },
556 )
557 }
558}
559
560#[derive(Debug)]
565pub enum AdvertisedPeripheralRequest {
566 OnConnected {
584 peer: Peer,
585 connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
586 responder: AdvertisedPeripheralOnConnectedResponder,
587 },
588}
589
590impl AdvertisedPeripheralRequest {
591 #[allow(irrefutable_let_patterns)]
592 pub fn into_on_connected(
593 self,
594 ) -> Option<(
595 Peer,
596 fidl::endpoints::ClientEnd<ConnectionMarker>,
597 AdvertisedPeripheralOnConnectedResponder,
598 )> {
599 if let AdvertisedPeripheralRequest::OnConnected { peer, connection, responder } = self {
600 Some((peer, connection, responder))
601 } else {
602 None
603 }
604 }
605
606 pub fn method_name(&self) -> &'static str {
608 match *self {
609 AdvertisedPeripheralRequest::OnConnected { .. } => "on_connected",
610 }
611 }
612}
613
614#[derive(Debug, Clone)]
615pub struct AdvertisedPeripheralControlHandle {
616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
617}
618
619impl fidl::endpoints::ControlHandle for AdvertisedPeripheralControlHandle {
620 fn shutdown(&self) {
621 self.inner.shutdown()
622 }
623 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
624 self.inner.shutdown_with_epitaph(status)
625 }
626
627 fn is_closed(&self) -> bool {
628 self.inner.channel().is_closed()
629 }
630 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
631 self.inner.channel().on_closed()
632 }
633
634 #[cfg(target_os = "fuchsia")]
635 fn signal_peer(
636 &self,
637 clear_mask: zx::Signals,
638 set_mask: zx::Signals,
639 ) -> Result<(), zx_status::Status> {
640 use fidl::Peered;
641 self.inner.channel().signal_peer(clear_mask, set_mask)
642 }
643}
644
645impl AdvertisedPeripheralControlHandle {}
646
647#[must_use = "FIDL methods require a response to be sent"]
648#[derive(Debug)]
649pub struct AdvertisedPeripheralOnConnectedResponder {
650 control_handle: std::mem::ManuallyDrop<AdvertisedPeripheralControlHandle>,
651 tx_id: u32,
652}
653
654impl std::ops::Drop for AdvertisedPeripheralOnConnectedResponder {
658 fn drop(&mut self) {
659 self.control_handle.shutdown();
660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
662 }
663}
664
665impl fidl::endpoints::Responder for AdvertisedPeripheralOnConnectedResponder {
666 type ControlHandle = AdvertisedPeripheralControlHandle;
667
668 fn control_handle(&self) -> &AdvertisedPeripheralControlHandle {
669 &self.control_handle
670 }
671
672 fn drop_without_shutdown(mut self) {
673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
675 std::mem::forget(self);
677 }
678}
679
680impl AdvertisedPeripheralOnConnectedResponder {
681 pub fn send(self) -> Result<(), fidl::Error> {
685 let _result = self.send_raw();
686 if _result.is_err() {
687 self.control_handle.shutdown();
688 }
689 self.drop_without_shutdown();
690 _result
691 }
692
693 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
695 let _result = self.send_raw();
696 self.drop_without_shutdown();
697 _result
698 }
699
700 fn send_raw(&self) -> Result<(), fidl::Error> {
701 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
702 (),
703 self.tx_id,
704 0x607b7716457eb178,
705 fidl::encoding::DynamicFlags::empty(),
706 )
707 }
708}
709
710#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
711pub struct AdvertisingHandleMarker;
712
713impl fidl::endpoints::ProtocolMarker for AdvertisingHandleMarker {
714 type Proxy = AdvertisingHandleProxy;
715 type RequestStream = AdvertisingHandleRequestStream;
716 #[cfg(target_os = "fuchsia")]
717 type SynchronousProxy = AdvertisingHandleSynchronousProxy;
718
719 const DEBUG_NAME: &'static str = "(anonymous) AdvertisingHandle";
720}
721
722pub trait AdvertisingHandleProxyInterface: Send + Sync {}
723#[derive(Debug)]
724#[cfg(target_os = "fuchsia")]
725pub struct AdvertisingHandleSynchronousProxy {
726 client: fidl::client::sync::Client,
727}
728
729#[cfg(target_os = "fuchsia")]
730impl fidl::endpoints::SynchronousProxy for AdvertisingHandleSynchronousProxy {
731 type Proxy = AdvertisingHandleProxy;
732 type Protocol = AdvertisingHandleMarker;
733
734 fn from_channel(inner: fidl::Channel) -> Self {
735 Self::new(inner)
736 }
737
738 fn into_channel(self) -> fidl::Channel {
739 self.client.into_channel()
740 }
741
742 fn as_channel(&self) -> &fidl::Channel {
743 self.client.as_channel()
744 }
745}
746
747#[cfg(target_os = "fuchsia")]
748impl AdvertisingHandleSynchronousProxy {
749 pub fn new(channel: fidl::Channel) -> Self {
750 let protocol_name =
751 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
752 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
753 }
754
755 pub fn into_channel(self) -> fidl::Channel {
756 self.client.into_channel()
757 }
758
759 pub fn wait_for_event(
762 &self,
763 deadline: zx::MonotonicInstant,
764 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
765 AdvertisingHandleEvent::decode(self.client.wait_for_event(deadline)?)
766 }
767}
768
769#[cfg(target_os = "fuchsia")]
770impl From<AdvertisingHandleSynchronousProxy> for zx::Handle {
771 fn from(value: AdvertisingHandleSynchronousProxy) -> Self {
772 value.into_channel().into()
773 }
774}
775
776#[cfg(target_os = "fuchsia")]
777impl From<fidl::Channel> for AdvertisingHandleSynchronousProxy {
778 fn from(value: fidl::Channel) -> Self {
779 Self::new(value)
780 }
781}
782
783#[derive(Debug, Clone)]
784pub struct AdvertisingHandleProxy {
785 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
786}
787
788impl fidl::endpoints::Proxy for AdvertisingHandleProxy {
789 type Protocol = AdvertisingHandleMarker;
790
791 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
792 Self::new(inner)
793 }
794
795 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
796 self.client.into_channel().map_err(|client| Self { client })
797 }
798
799 fn as_channel(&self) -> &::fidl::AsyncChannel {
800 self.client.as_channel()
801 }
802}
803
804impl AdvertisingHandleProxy {
805 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
807 let protocol_name =
808 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
809 Self { client: fidl::client::Client::new(channel, protocol_name) }
810 }
811
812 pub fn take_event_stream(&self) -> AdvertisingHandleEventStream {
818 AdvertisingHandleEventStream { event_receiver: self.client.take_event_receiver() }
819 }
820}
821
822impl AdvertisingHandleProxyInterface for AdvertisingHandleProxy {}
823
824pub struct AdvertisingHandleEventStream {
825 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
826}
827
828impl std::marker::Unpin for AdvertisingHandleEventStream {}
829
830impl futures::stream::FusedStream for AdvertisingHandleEventStream {
831 fn is_terminated(&self) -> bool {
832 self.event_receiver.is_terminated()
833 }
834}
835
836impl futures::Stream for AdvertisingHandleEventStream {
837 type Item = Result<AdvertisingHandleEvent, fidl::Error>;
838
839 fn poll_next(
840 mut self: std::pin::Pin<&mut Self>,
841 cx: &mut std::task::Context<'_>,
842 ) -> std::task::Poll<Option<Self::Item>> {
843 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
844 &mut self.event_receiver,
845 cx
846 )?) {
847 Some(buf) => std::task::Poll::Ready(Some(AdvertisingHandleEvent::decode(buf))),
848 None => std::task::Poll::Ready(None),
849 }
850 }
851}
852
853#[derive(Debug)]
854pub enum AdvertisingHandleEvent {}
855
856impl AdvertisingHandleEvent {
857 fn decode(
859 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
860 ) -> Result<AdvertisingHandleEvent, fidl::Error> {
861 let (bytes, _handles) = buf.split_mut();
862 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
863 debug_assert_eq!(tx_header.tx_id, 0);
864 match tx_header.ordinal {
865 _ => Err(fidl::Error::UnknownOrdinal {
866 ordinal: tx_header.ordinal,
867 protocol_name:
868 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
869 }),
870 }
871 }
872}
873
874pub struct AdvertisingHandleRequestStream {
876 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
877 is_terminated: bool,
878}
879
880impl std::marker::Unpin for AdvertisingHandleRequestStream {}
881
882impl futures::stream::FusedStream for AdvertisingHandleRequestStream {
883 fn is_terminated(&self) -> bool {
884 self.is_terminated
885 }
886}
887
888impl fidl::endpoints::RequestStream for AdvertisingHandleRequestStream {
889 type Protocol = AdvertisingHandleMarker;
890 type ControlHandle = AdvertisingHandleControlHandle;
891
892 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
893 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
894 }
895
896 fn control_handle(&self) -> Self::ControlHandle {
897 AdvertisingHandleControlHandle { inner: self.inner.clone() }
898 }
899
900 fn into_inner(
901 self,
902 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
903 {
904 (self.inner, self.is_terminated)
905 }
906
907 fn from_inner(
908 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
909 is_terminated: bool,
910 ) -> Self {
911 Self { inner, is_terminated }
912 }
913}
914
915impl futures::Stream for AdvertisingHandleRequestStream {
916 type Item = Result<AdvertisingHandleRequest, fidl::Error>;
917
918 fn poll_next(
919 mut self: std::pin::Pin<&mut Self>,
920 cx: &mut std::task::Context<'_>,
921 ) -> std::task::Poll<Option<Self::Item>> {
922 let this = &mut *self;
923 if this.inner.check_shutdown(cx) {
924 this.is_terminated = true;
925 return std::task::Poll::Ready(None);
926 }
927 if this.is_terminated {
928 panic!("polled AdvertisingHandleRequestStream after completion");
929 }
930 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
931 |bytes, handles| {
932 match this.inner.channel().read_etc(cx, bytes, handles) {
933 std::task::Poll::Ready(Ok(())) => {}
934 std::task::Poll::Pending => return std::task::Poll::Pending,
935 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
936 this.is_terminated = true;
937 return std::task::Poll::Ready(None);
938 }
939 std::task::Poll::Ready(Err(e)) => {
940 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
941 e.into(),
942 ))))
943 }
944 }
945
946 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
948
949 std::task::Poll::Ready(Some(match header.ordinal {
950 _ => Err(fidl::Error::UnknownOrdinal {
951 ordinal: header.ordinal,
952 protocol_name:
953 <AdvertisingHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
954 }),
955 }))
956 },
957 )
958 }
959}
960
961#[derive(Debug)]
965pub enum AdvertisingHandleRequest {}
966
967impl AdvertisingHandleRequest {
968 pub fn method_name(&self) -> &'static str {
970 match *self {}
971 }
972}
973
974#[derive(Debug, Clone)]
975pub struct AdvertisingHandleControlHandle {
976 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
977}
978
979impl fidl::endpoints::ControlHandle for AdvertisingHandleControlHandle {
980 fn shutdown(&self) {
981 self.inner.shutdown()
982 }
983 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
984 self.inner.shutdown_with_epitaph(status)
985 }
986
987 fn is_closed(&self) -> bool {
988 self.inner.channel().is_closed()
989 }
990 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
991 self.inner.channel().on_closed()
992 }
993
994 #[cfg(target_os = "fuchsia")]
995 fn signal_peer(
996 &self,
997 clear_mask: zx::Signals,
998 set_mask: zx::Signals,
999 ) -> Result<(), zx_status::Status> {
1000 use fidl::Peered;
1001 self.inner.channel().signal_peer(clear_mask, set_mask)
1002 }
1003}
1004
1005impl AdvertisingHandleControlHandle {}
1006
1007#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1008pub struct CentralMarker;
1009
1010impl fidl::endpoints::ProtocolMarker for CentralMarker {
1011 type Proxy = CentralProxy;
1012 type RequestStream = CentralRequestStream;
1013 #[cfg(target_os = "fuchsia")]
1014 type SynchronousProxy = CentralSynchronousProxy;
1015
1016 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Central";
1017}
1018impl fidl::endpoints::DiscoverableProtocolMarker for CentralMarker {}
1019pub type CentralCreateConnectedIsochronousGroupResult =
1020 Result<CentralCreateConnectedIsochronousGroupResponse, CreateCigError>;
1021
1022pub trait CentralProxyInterface: Send + Sync {
1023 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
1024 + Send;
1025 fn r#listen_l2cap(
1026 &self,
1027 payload: ChannelListenerRegistryListenL2capRequest,
1028 ) -> Self::ListenL2capResponseFut;
1029 type ScanResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1030 fn r#scan(
1031 &self,
1032 options: &ScanOptions,
1033 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1034 ) -> Self::ScanResponseFut;
1035 fn r#connect(
1036 &self,
1037 id: &fidl_fuchsia_bluetooth::PeerId,
1038 options: &ConnectionOptions,
1039 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1040 ) -> Result<(), fidl::Error>;
1041 type CreateConnectedIsochronousGroupResponseFut: std::future::Future<
1042 Output = Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error>,
1043 > + Send;
1044 fn r#create_connected_isochronous_group(
1045 &self,
1046 payload: CentralCreateConnectedIsochronousGroupRequest,
1047 ) -> Self::CreateConnectedIsochronousGroupResponseFut;
1048 type GetPeripheralsResponseFut: std::future::Future<Output = Result<Vec<RemoteDevice>, fidl::Error>>
1049 + Send;
1050 fn r#get_peripherals(
1051 &self,
1052 service_uuids: Option<&[String]>,
1053 ) -> Self::GetPeripheralsResponseFut;
1054 type GetPeripheralResponseFut: std::future::Future<Output = Result<Option<Box<RemoteDevice>>, fidl::Error>>
1055 + Send;
1056 fn r#get_peripheral(&self, identifier: &str) -> Self::GetPeripheralResponseFut;
1057 type StartScanResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1058 + Send;
1059 fn r#start_scan(&self, filter: Option<&ScanFilter>) -> Self::StartScanResponseFut;
1060 fn r#stop_scan(&self) -> Result<(), fidl::Error>;
1061 type ConnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1062 + Send;
1063 fn r#connect_peripheral(
1064 &self,
1065 identifier: &str,
1066 options: &ConnectionOptions,
1067 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1068 ) -> Self::ConnectPeripheralResponseFut;
1069 type DisconnectPeripheralResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::Status, fidl::Error>>
1070 + Send;
1071 fn r#disconnect_peripheral(&self, identifier: &str) -> Self::DisconnectPeripheralResponseFut;
1072}
1073#[derive(Debug)]
1074#[cfg(target_os = "fuchsia")]
1075pub struct CentralSynchronousProxy {
1076 client: fidl::client::sync::Client,
1077}
1078
1079#[cfg(target_os = "fuchsia")]
1080impl fidl::endpoints::SynchronousProxy for CentralSynchronousProxy {
1081 type Proxy = CentralProxy;
1082 type Protocol = CentralMarker;
1083
1084 fn from_channel(inner: fidl::Channel) -> Self {
1085 Self::new(inner)
1086 }
1087
1088 fn into_channel(self) -> fidl::Channel {
1089 self.client.into_channel()
1090 }
1091
1092 fn as_channel(&self) -> &fidl::Channel {
1093 self.client.as_channel()
1094 }
1095}
1096
1097#[cfg(target_os = "fuchsia")]
1098impl CentralSynchronousProxy {
1099 pub fn new(channel: fidl::Channel) -> Self {
1100 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1101 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1102 }
1103
1104 pub fn into_channel(self) -> fidl::Channel {
1105 self.client.into_channel()
1106 }
1107
1108 pub fn wait_for_event(
1111 &self,
1112 deadline: zx::MonotonicInstant,
1113 ) -> Result<CentralEvent, fidl::Error> {
1114 CentralEvent::decode(self.client.wait_for_event(deadline)?)
1115 }
1116
1117 pub fn r#listen_l2cap(
1127 &self,
1128 mut payload: ChannelListenerRegistryListenL2capRequest,
1129 ___deadline: zx::MonotonicInstant,
1130 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1131 let _response = self.client.send_query::<
1132 ChannelListenerRegistryListenL2capRequest,
1133 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1134 >(
1135 &mut payload,
1136 0x39c6e9001d102338,
1137 fidl::encoding::DynamicFlags::empty(),
1138 ___deadline,
1139 )?;
1140 Ok(_response.map(|x| x))
1141 }
1142
1143 pub fn r#scan(
1170 &self,
1171 mut options: &ScanOptions,
1172 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1173 ___deadline: zx::MonotonicInstant,
1174 ) -> Result<(), fidl::Error> {
1175 let _response =
1176 self.client.send_query::<CentralScanRequest, fidl::encoding::EmptyPayload>(
1177 (options, result_watcher),
1178 0x41f7121798dfe15f,
1179 fidl::encoding::DynamicFlags::empty(),
1180 ___deadline,
1181 )?;
1182 Ok(_response)
1183 }
1184
1185 pub fn r#connect(
1207 &self,
1208 mut id: &fidl_fuchsia_bluetooth::PeerId,
1209 mut options: &ConnectionOptions,
1210 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1211 ) -> Result<(), fidl::Error> {
1212 self.client.send::<CentralConnectRequest>(
1213 (id, options, handle),
1214 0x31a3065f2a6913c4,
1215 fidl::encoding::DynamicFlags::empty(),
1216 )
1217 }
1218
1219 pub fn r#create_connected_isochronous_group(
1228 &self,
1229 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1230 ___deadline: zx::MonotonicInstant,
1231 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1232 let _response = self
1233 .client
1234 .send_query::<CentralCreateConnectedIsochronousGroupRequest, fidl::encoding::ResultType<
1235 CentralCreateConnectedIsochronousGroupResponse,
1236 CreateCigError,
1237 >>(
1238 &mut payload,
1239 0x60323e70ae22e13,
1240 fidl::encoding::DynamicFlags::empty(),
1241 ___deadline,
1242 )?;
1243 Ok(_response.map(|x| x))
1244 }
1245
1246 pub fn r#get_peripherals(
1252 &self,
1253 mut service_uuids: Option<&[String]>,
1254 ___deadline: zx::MonotonicInstant,
1255 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1256 let _response =
1257 self.client.send_query::<CentralGetPeripheralsRequest, CentralGetPeripheralsResponse>(
1258 (service_uuids,),
1259 0x37ba777499c683a8,
1260 fidl::encoding::DynamicFlags::empty(),
1261 ___deadline,
1262 )?;
1263 Ok(_response.peripherals)
1264 }
1265
1266 pub fn r#get_peripheral(
1272 &self,
1273 mut identifier: &str,
1274 ___deadline: zx::MonotonicInstant,
1275 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1276 let _response =
1277 self.client.send_query::<CentralGetPeripheralRequest, CentralGetPeripheralResponse>(
1278 (identifier,),
1279 0x97f5a2f2d9c13da,
1280 fidl::encoding::DynamicFlags::empty(),
1281 ___deadline,
1282 )?;
1283 Ok(_response.peripheral)
1284 }
1285
1286 pub fn r#start_scan(
1295 &self,
1296 mut filter: Option<&ScanFilter>,
1297 ___deadline: zx::MonotonicInstant,
1298 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1299 let _response =
1300 self.client.send_query::<CentralStartScanRequest, CentralStartScanResponse>(
1301 (filter,),
1302 0xeb4cf0cd0e1132b,
1303 fidl::encoding::DynamicFlags::empty(),
1304 ___deadline,
1305 )?;
1306 Ok(_response.status)
1307 }
1308
1309 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1311 self.client.send::<fidl::encoding::EmptyPayload>(
1312 (),
1313 0x5f79ee6a0bb037a0,
1314 fidl::encoding::DynamicFlags::empty(),
1315 )
1316 }
1317
1318 pub fn r#connect_peripheral(
1325 &self,
1326 mut identifier: &str,
1327 mut options: &ConnectionOptions,
1328 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1329 ___deadline: zx::MonotonicInstant,
1330 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1331 let _response = self
1332 .client
1333 .send_query::<CentralConnectPeripheralRequest, CentralConnectPeripheralResponse>(
1334 (identifier, options, gatt_client),
1335 0x714d6c32d066d75a,
1336 fidl::encoding::DynamicFlags::empty(),
1337 ___deadline,
1338 )?;
1339 Ok(_response.status)
1340 }
1341
1342 pub fn r#disconnect_peripheral(
1344 &self,
1345 mut identifier: &str,
1346 ___deadline: zx::MonotonicInstant,
1347 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1348 let _response = self
1349 .client
1350 .send_query::<CentralDisconnectPeripheralRequest, CentralDisconnectPeripheralResponse>(
1351 (identifier,),
1352 0xa9430da197362fd,
1353 fidl::encoding::DynamicFlags::empty(),
1354 ___deadline,
1355 )?;
1356 Ok(_response.status)
1357 }
1358}
1359
1360#[cfg(target_os = "fuchsia")]
1361impl From<CentralSynchronousProxy> for zx::Handle {
1362 fn from(value: CentralSynchronousProxy) -> Self {
1363 value.into_channel().into()
1364 }
1365}
1366
1367#[cfg(target_os = "fuchsia")]
1368impl From<fidl::Channel> for CentralSynchronousProxy {
1369 fn from(value: fidl::Channel) -> Self {
1370 Self::new(value)
1371 }
1372}
1373
1374#[derive(Debug, Clone)]
1375pub struct CentralProxy {
1376 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1377}
1378
1379impl fidl::endpoints::Proxy for CentralProxy {
1380 type Protocol = CentralMarker;
1381
1382 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1383 Self::new(inner)
1384 }
1385
1386 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1387 self.client.into_channel().map_err(|client| Self { client })
1388 }
1389
1390 fn as_channel(&self) -> &::fidl::AsyncChannel {
1391 self.client.as_channel()
1392 }
1393}
1394
1395impl CentralProxy {
1396 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1398 let protocol_name = <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1399 Self { client: fidl::client::Client::new(channel, protocol_name) }
1400 }
1401
1402 pub fn take_event_stream(&self) -> CentralEventStream {
1408 CentralEventStream { event_receiver: self.client.take_event_receiver() }
1409 }
1410
1411 pub fn r#listen_l2cap(
1421 &self,
1422 mut payload: ChannelListenerRegistryListenL2capRequest,
1423 ) -> fidl::client::QueryResponseFut<
1424 ChannelListenerRegistryListenL2capResult,
1425 fidl::encoding::DefaultFuchsiaResourceDialect,
1426 > {
1427 CentralProxyInterface::r#listen_l2cap(self, payload)
1428 }
1429
1430 pub fn r#scan(
1457 &self,
1458 mut options: &ScanOptions,
1459 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1460 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1461 CentralProxyInterface::r#scan(self, options, result_watcher)
1462 }
1463
1464 pub fn r#connect(
1486 &self,
1487 mut id: &fidl_fuchsia_bluetooth::PeerId,
1488 mut options: &ConnectionOptions,
1489 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1490 ) -> Result<(), fidl::Error> {
1491 CentralProxyInterface::r#connect(self, id, options, handle)
1492 }
1493
1494 pub fn r#create_connected_isochronous_group(
1503 &self,
1504 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1505 ) -> fidl::client::QueryResponseFut<
1506 CentralCreateConnectedIsochronousGroupResult,
1507 fidl::encoding::DefaultFuchsiaResourceDialect,
1508 > {
1509 CentralProxyInterface::r#create_connected_isochronous_group(self, payload)
1510 }
1511
1512 pub fn r#get_peripherals(
1518 &self,
1519 mut service_uuids: Option<&[String]>,
1520 ) -> fidl::client::QueryResponseFut<
1521 Vec<RemoteDevice>,
1522 fidl::encoding::DefaultFuchsiaResourceDialect,
1523 > {
1524 CentralProxyInterface::r#get_peripherals(self, service_uuids)
1525 }
1526
1527 pub fn r#get_peripheral(
1533 &self,
1534 mut identifier: &str,
1535 ) -> fidl::client::QueryResponseFut<
1536 Option<Box<RemoteDevice>>,
1537 fidl::encoding::DefaultFuchsiaResourceDialect,
1538 > {
1539 CentralProxyInterface::r#get_peripheral(self, identifier)
1540 }
1541
1542 pub fn r#start_scan(
1551 &self,
1552 mut filter: Option<&ScanFilter>,
1553 ) -> fidl::client::QueryResponseFut<
1554 fidl_fuchsia_bluetooth::Status,
1555 fidl::encoding::DefaultFuchsiaResourceDialect,
1556 > {
1557 CentralProxyInterface::r#start_scan(self, filter)
1558 }
1559
1560 pub fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1562 CentralProxyInterface::r#stop_scan(self)
1563 }
1564
1565 pub fn r#connect_peripheral(
1572 &self,
1573 mut identifier: &str,
1574 mut options: &ConnectionOptions,
1575 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1576 ) -> fidl::client::QueryResponseFut<
1577 fidl_fuchsia_bluetooth::Status,
1578 fidl::encoding::DefaultFuchsiaResourceDialect,
1579 > {
1580 CentralProxyInterface::r#connect_peripheral(self, identifier, options, gatt_client)
1581 }
1582
1583 pub fn r#disconnect_peripheral(
1585 &self,
1586 mut identifier: &str,
1587 ) -> fidl::client::QueryResponseFut<
1588 fidl_fuchsia_bluetooth::Status,
1589 fidl::encoding::DefaultFuchsiaResourceDialect,
1590 > {
1591 CentralProxyInterface::r#disconnect_peripheral(self, identifier)
1592 }
1593}
1594
1595impl CentralProxyInterface for CentralProxy {
1596 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
1597 ChannelListenerRegistryListenL2capResult,
1598 fidl::encoding::DefaultFuchsiaResourceDialect,
1599 >;
1600 fn r#listen_l2cap(
1601 &self,
1602 mut payload: ChannelListenerRegistryListenL2capRequest,
1603 ) -> Self::ListenL2capResponseFut {
1604 fn _decode(
1605 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1606 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
1607 let _response = fidl::client::decode_transaction_body::<
1608 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
1609 fidl::encoding::DefaultFuchsiaResourceDialect,
1610 0x39c6e9001d102338,
1611 >(_buf?)?;
1612 Ok(_response.map(|x| x))
1613 }
1614 self.client.send_query_and_decode::<
1615 ChannelListenerRegistryListenL2capRequest,
1616 ChannelListenerRegistryListenL2capResult,
1617 >(
1618 &mut payload,
1619 0x39c6e9001d102338,
1620 fidl::encoding::DynamicFlags::empty(),
1621 _decode,
1622 )
1623 }
1624
1625 type ScanResponseFut =
1626 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1627 fn r#scan(
1628 &self,
1629 mut options: &ScanOptions,
1630 mut result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
1631 ) -> Self::ScanResponseFut {
1632 fn _decode(
1633 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1634 ) -> Result<(), fidl::Error> {
1635 let _response = fidl::client::decode_transaction_body::<
1636 fidl::encoding::EmptyPayload,
1637 fidl::encoding::DefaultFuchsiaResourceDialect,
1638 0x41f7121798dfe15f,
1639 >(_buf?)?;
1640 Ok(_response)
1641 }
1642 self.client.send_query_and_decode::<CentralScanRequest, ()>(
1643 (options, result_watcher),
1644 0x41f7121798dfe15f,
1645 fidl::encoding::DynamicFlags::empty(),
1646 _decode,
1647 )
1648 }
1649
1650 fn r#connect(
1651 &self,
1652 mut id: &fidl_fuchsia_bluetooth::PeerId,
1653 mut options: &ConnectionOptions,
1654 mut handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
1655 ) -> Result<(), fidl::Error> {
1656 self.client.send::<CentralConnectRequest>(
1657 (id, options, handle),
1658 0x31a3065f2a6913c4,
1659 fidl::encoding::DynamicFlags::empty(),
1660 )
1661 }
1662
1663 type CreateConnectedIsochronousGroupResponseFut = fidl::client::QueryResponseFut<
1664 CentralCreateConnectedIsochronousGroupResult,
1665 fidl::encoding::DefaultFuchsiaResourceDialect,
1666 >;
1667 fn r#create_connected_isochronous_group(
1668 &self,
1669 mut payload: CentralCreateConnectedIsochronousGroupRequest,
1670 ) -> Self::CreateConnectedIsochronousGroupResponseFut {
1671 fn _decode(
1672 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1673 ) -> Result<CentralCreateConnectedIsochronousGroupResult, fidl::Error> {
1674 let _response = fidl::client::decode_transaction_body::<
1675 fidl::encoding::ResultType<
1676 CentralCreateConnectedIsochronousGroupResponse,
1677 CreateCigError,
1678 >,
1679 fidl::encoding::DefaultFuchsiaResourceDialect,
1680 0x60323e70ae22e13,
1681 >(_buf?)?;
1682 Ok(_response.map(|x| x))
1683 }
1684 self.client.send_query_and_decode::<
1685 CentralCreateConnectedIsochronousGroupRequest,
1686 CentralCreateConnectedIsochronousGroupResult,
1687 >(
1688 &mut payload,
1689 0x60323e70ae22e13,
1690 fidl::encoding::DynamicFlags::empty(),
1691 _decode,
1692 )
1693 }
1694
1695 type GetPeripheralsResponseFut = fidl::client::QueryResponseFut<
1696 Vec<RemoteDevice>,
1697 fidl::encoding::DefaultFuchsiaResourceDialect,
1698 >;
1699 fn r#get_peripherals(
1700 &self,
1701 mut service_uuids: Option<&[String]>,
1702 ) -> Self::GetPeripheralsResponseFut {
1703 fn _decode(
1704 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1705 ) -> Result<Vec<RemoteDevice>, fidl::Error> {
1706 let _response = fidl::client::decode_transaction_body::<
1707 CentralGetPeripheralsResponse,
1708 fidl::encoding::DefaultFuchsiaResourceDialect,
1709 0x37ba777499c683a8,
1710 >(_buf?)?;
1711 Ok(_response.peripherals)
1712 }
1713 self.client.send_query_and_decode::<CentralGetPeripheralsRequest, Vec<RemoteDevice>>(
1714 (service_uuids,),
1715 0x37ba777499c683a8,
1716 fidl::encoding::DynamicFlags::empty(),
1717 _decode,
1718 )
1719 }
1720
1721 type GetPeripheralResponseFut = fidl::client::QueryResponseFut<
1722 Option<Box<RemoteDevice>>,
1723 fidl::encoding::DefaultFuchsiaResourceDialect,
1724 >;
1725 fn r#get_peripheral(&self, mut identifier: &str) -> Self::GetPeripheralResponseFut {
1726 fn _decode(
1727 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1728 ) -> Result<Option<Box<RemoteDevice>>, fidl::Error> {
1729 let _response = fidl::client::decode_transaction_body::<
1730 CentralGetPeripheralResponse,
1731 fidl::encoding::DefaultFuchsiaResourceDialect,
1732 0x97f5a2f2d9c13da,
1733 >(_buf?)?;
1734 Ok(_response.peripheral)
1735 }
1736 self.client.send_query_and_decode::<CentralGetPeripheralRequest, Option<Box<RemoteDevice>>>(
1737 (identifier,),
1738 0x97f5a2f2d9c13da,
1739 fidl::encoding::DynamicFlags::empty(),
1740 _decode,
1741 )
1742 }
1743
1744 type StartScanResponseFut = fidl::client::QueryResponseFut<
1745 fidl_fuchsia_bluetooth::Status,
1746 fidl::encoding::DefaultFuchsiaResourceDialect,
1747 >;
1748 fn r#start_scan(&self, mut filter: Option<&ScanFilter>) -> Self::StartScanResponseFut {
1749 fn _decode(
1750 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1751 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1752 let _response = fidl::client::decode_transaction_body::<
1753 CentralStartScanResponse,
1754 fidl::encoding::DefaultFuchsiaResourceDialect,
1755 0xeb4cf0cd0e1132b,
1756 >(_buf?)?;
1757 Ok(_response.status)
1758 }
1759 self.client
1760 .send_query_and_decode::<CentralStartScanRequest, fidl_fuchsia_bluetooth::Status>(
1761 (filter,),
1762 0xeb4cf0cd0e1132b,
1763 fidl::encoding::DynamicFlags::empty(),
1764 _decode,
1765 )
1766 }
1767
1768 fn r#stop_scan(&self) -> Result<(), fidl::Error> {
1769 self.client.send::<fidl::encoding::EmptyPayload>(
1770 (),
1771 0x5f79ee6a0bb037a0,
1772 fidl::encoding::DynamicFlags::empty(),
1773 )
1774 }
1775
1776 type ConnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1777 fidl_fuchsia_bluetooth::Status,
1778 fidl::encoding::DefaultFuchsiaResourceDialect,
1779 >;
1780 fn r#connect_peripheral(
1781 &self,
1782 mut identifier: &str,
1783 mut options: &ConnectionOptions,
1784 mut gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
1785 ) -> Self::ConnectPeripheralResponseFut {
1786 fn _decode(
1787 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1788 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1789 let _response = fidl::client::decode_transaction_body::<
1790 CentralConnectPeripheralResponse,
1791 fidl::encoding::DefaultFuchsiaResourceDialect,
1792 0x714d6c32d066d75a,
1793 >(_buf?)?;
1794 Ok(_response.status)
1795 }
1796 self.client.send_query_and_decode::<
1797 CentralConnectPeripheralRequest,
1798 fidl_fuchsia_bluetooth::Status,
1799 >(
1800 (identifier, options, gatt_client,),
1801 0x714d6c32d066d75a,
1802 fidl::encoding::DynamicFlags::empty(),
1803 _decode,
1804 )
1805 }
1806
1807 type DisconnectPeripheralResponseFut = fidl::client::QueryResponseFut<
1808 fidl_fuchsia_bluetooth::Status,
1809 fidl::encoding::DefaultFuchsiaResourceDialect,
1810 >;
1811 fn r#disconnect_peripheral(
1812 &self,
1813 mut identifier: &str,
1814 ) -> Self::DisconnectPeripheralResponseFut {
1815 fn _decode(
1816 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1817 ) -> Result<fidl_fuchsia_bluetooth::Status, fidl::Error> {
1818 let _response = fidl::client::decode_transaction_body::<
1819 CentralDisconnectPeripheralResponse,
1820 fidl::encoding::DefaultFuchsiaResourceDialect,
1821 0xa9430da197362fd,
1822 >(_buf?)?;
1823 Ok(_response.status)
1824 }
1825 self.client.send_query_and_decode::<
1826 CentralDisconnectPeripheralRequest,
1827 fidl_fuchsia_bluetooth::Status,
1828 >(
1829 (identifier,),
1830 0xa9430da197362fd,
1831 fidl::encoding::DynamicFlags::empty(),
1832 _decode,
1833 )
1834 }
1835}
1836
1837pub struct CentralEventStream {
1838 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1839}
1840
1841impl std::marker::Unpin for CentralEventStream {}
1842
1843impl futures::stream::FusedStream for CentralEventStream {
1844 fn is_terminated(&self) -> bool {
1845 self.event_receiver.is_terminated()
1846 }
1847}
1848
1849impl futures::Stream for CentralEventStream {
1850 type Item = Result<CentralEvent, fidl::Error>;
1851
1852 fn poll_next(
1853 mut self: std::pin::Pin<&mut Self>,
1854 cx: &mut std::task::Context<'_>,
1855 ) -> std::task::Poll<Option<Self::Item>> {
1856 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1857 &mut self.event_receiver,
1858 cx
1859 )?) {
1860 Some(buf) => std::task::Poll::Ready(Some(CentralEvent::decode(buf))),
1861 None => std::task::Poll::Ready(None),
1862 }
1863 }
1864}
1865
1866#[derive(Debug)]
1867pub enum CentralEvent {
1868 OnScanStateChanged { scanning: bool },
1869 OnDeviceDiscovered { device: RemoteDevice },
1870 OnPeripheralDisconnected { identifier: String },
1871}
1872
1873impl CentralEvent {
1874 #[allow(irrefutable_let_patterns)]
1875 pub fn into_on_scan_state_changed(self) -> Option<bool> {
1876 if let CentralEvent::OnScanStateChanged { scanning } = self {
1877 Some((scanning))
1878 } else {
1879 None
1880 }
1881 }
1882 #[allow(irrefutable_let_patterns)]
1883 pub fn into_on_device_discovered(self) -> Option<RemoteDevice> {
1884 if let CentralEvent::OnDeviceDiscovered { device } = self {
1885 Some((device))
1886 } else {
1887 None
1888 }
1889 }
1890 #[allow(irrefutable_let_patterns)]
1891 pub fn into_on_peripheral_disconnected(self) -> Option<String> {
1892 if let CentralEvent::OnPeripheralDisconnected { identifier } = self {
1893 Some((identifier))
1894 } else {
1895 None
1896 }
1897 }
1898
1899 fn decode(
1901 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1902 ) -> Result<CentralEvent, fidl::Error> {
1903 let (bytes, _handles) = buf.split_mut();
1904 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1905 debug_assert_eq!(tx_header.tx_id, 0);
1906 match tx_header.ordinal {
1907 0x5f8edc23cad04d3f => {
1908 let mut out = fidl::new_empty!(
1909 CentralOnScanStateChangedRequest,
1910 fidl::encoding::DefaultFuchsiaResourceDialect
1911 );
1912 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnScanStateChangedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1913 Ok((CentralEvent::OnScanStateChanged { scanning: out.scanning }))
1914 }
1915 0x708dadf20d66db6 => {
1916 let mut out = fidl::new_empty!(
1917 CentralOnDeviceDiscoveredRequest,
1918 fidl::encoding::DefaultFuchsiaResourceDialect
1919 );
1920 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnDeviceDiscoveredRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1921 Ok((CentralEvent::OnDeviceDiscovered { device: out.device }))
1922 }
1923 0x4e4c6b979b2126df => {
1924 let mut out = fidl::new_empty!(
1925 CentralOnPeripheralDisconnectedRequest,
1926 fidl::encoding::DefaultFuchsiaResourceDialect
1927 );
1928 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralOnPeripheralDisconnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1929 Ok((CentralEvent::OnPeripheralDisconnected { identifier: out.identifier }))
1930 }
1931 _ => Err(fidl::Error::UnknownOrdinal {
1932 ordinal: tx_header.ordinal,
1933 protocol_name: <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1934 }),
1935 }
1936 }
1937}
1938
1939pub struct CentralRequestStream {
1941 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1942 is_terminated: bool,
1943}
1944
1945impl std::marker::Unpin for CentralRequestStream {}
1946
1947impl futures::stream::FusedStream for CentralRequestStream {
1948 fn is_terminated(&self) -> bool {
1949 self.is_terminated
1950 }
1951}
1952
1953impl fidl::endpoints::RequestStream for CentralRequestStream {
1954 type Protocol = CentralMarker;
1955 type ControlHandle = CentralControlHandle;
1956
1957 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1958 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1959 }
1960
1961 fn control_handle(&self) -> Self::ControlHandle {
1962 CentralControlHandle { inner: self.inner.clone() }
1963 }
1964
1965 fn into_inner(
1966 self,
1967 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1968 {
1969 (self.inner, self.is_terminated)
1970 }
1971
1972 fn from_inner(
1973 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1974 is_terminated: bool,
1975 ) -> Self {
1976 Self { inner, is_terminated }
1977 }
1978}
1979
1980impl futures::Stream for CentralRequestStream {
1981 type Item = Result<CentralRequest, fidl::Error>;
1982
1983 fn poll_next(
1984 mut self: std::pin::Pin<&mut Self>,
1985 cx: &mut std::task::Context<'_>,
1986 ) -> std::task::Poll<Option<Self::Item>> {
1987 let this = &mut *self;
1988 if this.inner.check_shutdown(cx) {
1989 this.is_terminated = true;
1990 return std::task::Poll::Ready(None);
1991 }
1992 if this.is_terminated {
1993 panic!("polled CentralRequestStream after completion");
1994 }
1995 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1996 |bytes, handles| {
1997 match this.inner.channel().read_etc(cx, bytes, handles) {
1998 std::task::Poll::Ready(Ok(())) => {}
1999 std::task::Poll::Pending => return std::task::Poll::Pending,
2000 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2001 this.is_terminated = true;
2002 return std::task::Poll::Ready(None);
2003 }
2004 std::task::Poll::Ready(Err(e)) => {
2005 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2006 e.into(),
2007 ))))
2008 }
2009 }
2010
2011 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2013
2014 std::task::Poll::Ready(Some(match header.ordinal {
2015 0x39c6e9001d102338 => {
2016 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2017 let mut req = fidl::new_empty!(
2018 ChannelListenerRegistryListenL2capRequest,
2019 fidl::encoding::DefaultFuchsiaResourceDialect
2020 );
2021 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
2022 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2023 Ok(CentralRequest::ListenL2cap {
2024 payload: req,
2025 responder: CentralListenL2capResponder {
2026 control_handle: std::mem::ManuallyDrop::new(control_handle),
2027 tx_id: header.tx_id,
2028 },
2029 })
2030 }
2031 0x41f7121798dfe15f => {
2032 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2033 let mut req = fidl::new_empty!(
2034 CentralScanRequest,
2035 fidl::encoding::DefaultFuchsiaResourceDialect
2036 );
2037 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralScanRequest>(&header, _body_bytes, handles, &mut req)?;
2038 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2039 Ok(CentralRequest::Scan {
2040 options: req.options,
2041 result_watcher: req.result_watcher,
2042
2043 responder: CentralScanResponder {
2044 control_handle: std::mem::ManuallyDrop::new(control_handle),
2045 tx_id: header.tx_id,
2046 },
2047 })
2048 }
2049 0x31a3065f2a6913c4 => {
2050 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2051 let mut req = fidl::new_empty!(
2052 CentralConnectRequest,
2053 fidl::encoding::DefaultFuchsiaResourceDialect
2054 );
2055 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2056 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2057 Ok(CentralRequest::Connect {
2058 id: req.id,
2059 options: req.options,
2060 handle: req.handle,
2061
2062 control_handle,
2063 })
2064 }
2065 0x60323e70ae22e13 => {
2066 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2067 let mut req = fidl::new_empty!(
2068 CentralCreateConnectedIsochronousGroupRequest,
2069 fidl::encoding::DefaultFuchsiaResourceDialect
2070 );
2071 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralCreateConnectedIsochronousGroupRequest>(&header, _body_bytes, handles, &mut req)?;
2072 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2073 Ok(CentralRequest::CreateConnectedIsochronousGroup {
2074 payload: req,
2075 responder: CentralCreateConnectedIsochronousGroupResponder {
2076 control_handle: std::mem::ManuallyDrop::new(control_handle),
2077 tx_id: header.tx_id,
2078 },
2079 })
2080 }
2081 0x37ba777499c683a8 => {
2082 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2083 let mut req = fidl::new_empty!(
2084 CentralGetPeripheralsRequest,
2085 fidl::encoding::DefaultFuchsiaResourceDialect
2086 );
2087 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralsRequest>(&header, _body_bytes, handles, &mut req)?;
2088 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2089 Ok(CentralRequest::GetPeripherals {
2090 service_uuids: req.service_uuids,
2091
2092 responder: CentralGetPeripheralsResponder {
2093 control_handle: std::mem::ManuallyDrop::new(control_handle),
2094 tx_id: header.tx_id,
2095 },
2096 })
2097 }
2098 0x97f5a2f2d9c13da => {
2099 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2100 let mut req = fidl::new_empty!(
2101 CentralGetPeripheralRequest,
2102 fidl::encoding::DefaultFuchsiaResourceDialect
2103 );
2104 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralGetPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2105 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2106 Ok(CentralRequest::GetPeripheral {
2107 identifier: req.identifier,
2108
2109 responder: CentralGetPeripheralResponder {
2110 control_handle: std::mem::ManuallyDrop::new(control_handle),
2111 tx_id: header.tx_id,
2112 },
2113 })
2114 }
2115 0xeb4cf0cd0e1132b => {
2116 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2117 let mut req = fidl::new_empty!(
2118 CentralStartScanRequest,
2119 fidl::encoding::DefaultFuchsiaResourceDialect
2120 );
2121 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralStartScanRequest>(&header, _body_bytes, handles, &mut req)?;
2122 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2123 Ok(CentralRequest::StartScan {
2124 filter: req.filter,
2125
2126 responder: CentralStartScanResponder {
2127 control_handle: std::mem::ManuallyDrop::new(control_handle),
2128 tx_id: header.tx_id,
2129 },
2130 })
2131 }
2132 0x5f79ee6a0bb037a0 => {
2133 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2134 let mut req = fidl::new_empty!(
2135 fidl::encoding::EmptyPayload,
2136 fidl::encoding::DefaultFuchsiaResourceDialect
2137 );
2138 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2139 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2140 Ok(CentralRequest::StopScan { control_handle })
2141 }
2142 0x714d6c32d066d75a => {
2143 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2144 let mut req = fidl::new_empty!(
2145 CentralConnectPeripheralRequest,
2146 fidl::encoding::DefaultFuchsiaResourceDialect
2147 );
2148 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralConnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2149 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2150 Ok(CentralRequest::ConnectPeripheral {
2151 identifier: req.identifier,
2152 options: req.options,
2153 gatt_client: req.gatt_client,
2154
2155 responder: CentralConnectPeripheralResponder {
2156 control_handle: std::mem::ManuallyDrop::new(control_handle),
2157 tx_id: header.tx_id,
2158 },
2159 })
2160 }
2161 0xa9430da197362fd => {
2162 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2163 let mut req = fidl::new_empty!(
2164 CentralDisconnectPeripheralRequest,
2165 fidl::encoding::DefaultFuchsiaResourceDialect
2166 );
2167 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CentralDisconnectPeripheralRequest>(&header, _body_bytes, handles, &mut req)?;
2168 let control_handle = CentralControlHandle { inner: this.inner.clone() };
2169 Ok(CentralRequest::DisconnectPeripheral {
2170 identifier: req.identifier,
2171
2172 responder: CentralDisconnectPeripheralResponder {
2173 control_handle: std::mem::ManuallyDrop::new(control_handle),
2174 tx_id: header.tx_id,
2175 },
2176 })
2177 }
2178 _ => Err(fidl::Error::UnknownOrdinal {
2179 ordinal: header.ordinal,
2180 protocol_name:
2181 <CentralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2182 }),
2183 }))
2184 },
2185 )
2186 }
2187}
2188
2189#[derive(Debug)]
2190pub enum CentralRequest {
2191 ListenL2cap {
2201 payload: ChannelListenerRegistryListenL2capRequest,
2202 responder: CentralListenL2capResponder,
2203 },
2204 Scan {
2231 options: ScanOptions,
2232 result_watcher: fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2233 responder: CentralScanResponder,
2234 },
2235 Connect {
2257 id: fidl_fuchsia_bluetooth::PeerId,
2258 options: ConnectionOptions,
2259 handle: fidl::endpoints::ServerEnd<ConnectionMarker>,
2260 control_handle: CentralControlHandle,
2261 },
2262 CreateConnectedIsochronousGroup {
2271 payload: CentralCreateConnectedIsochronousGroupRequest,
2272 responder: CentralCreateConnectedIsochronousGroupResponder,
2273 },
2274 GetPeripherals { service_uuids: Option<Vec<String>>, responder: CentralGetPeripheralsResponder },
2280 GetPeripheral { identifier: String, responder: CentralGetPeripheralResponder },
2286 StartScan { filter: Option<Box<ScanFilter>>, responder: CentralStartScanResponder },
2295 StopScan { control_handle: CentralControlHandle },
2297 ConnectPeripheral {
2304 identifier: String,
2305 options: ConnectionOptions,
2306 gatt_client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2307 responder: CentralConnectPeripheralResponder,
2308 },
2309 DisconnectPeripheral { identifier: String, responder: CentralDisconnectPeripheralResponder },
2311}
2312
2313impl CentralRequest {
2314 #[allow(irrefutable_let_patterns)]
2315 pub fn into_listen_l2cap(
2316 self,
2317 ) -> Option<(ChannelListenerRegistryListenL2capRequest, CentralListenL2capResponder)> {
2318 if let CentralRequest::ListenL2cap { payload, responder } = self {
2319 Some((payload, responder))
2320 } else {
2321 None
2322 }
2323 }
2324
2325 #[allow(irrefutable_let_patterns)]
2326 pub fn into_scan(
2327 self,
2328 ) -> Option<(
2329 ScanOptions,
2330 fidl::endpoints::ServerEnd<ScanResultWatcherMarker>,
2331 CentralScanResponder,
2332 )> {
2333 if let CentralRequest::Scan { options, result_watcher, responder } = self {
2334 Some((options, result_watcher, responder))
2335 } else {
2336 None
2337 }
2338 }
2339
2340 #[allow(irrefutable_let_patterns)]
2341 pub fn into_connect(
2342 self,
2343 ) -> Option<(
2344 fidl_fuchsia_bluetooth::PeerId,
2345 ConnectionOptions,
2346 fidl::endpoints::ServerEnd<ConnectionMarker>,
2347 CentralControlHandle,
2348 )> {
2349 if let CentralRequest::Connect { id, options, handle, control_handle } = self {
2350 Some((id, options, handle, control_handle))
2351 } else {
2352 None
2353 }
2354 }
2355
2356 #[allow(irrefutable_let_patterns)]
2357 pub fn into_create_connected_isochronous_group(
2358 self,
2359 ) -> Option<(
2360 CentralCreateConnectedIsochronousGroupRequest,
2361 CentralCreateConnectedIsochronousGroupResponder,
2362 )> {
2363 if let CentralRequest::CreateConnectedIsochronousGroup { payload, responder } = self {
2364 Some((payload, responder))
2365 } else {
2366 None
2367 }
2368 }
2369
2370 #[allow(irrefutable_let_patterns)]
2371 pub fn into_get_peripherals(
2372 self,
2373 ) -> Option<(Option<Vec<String>>, CentralGetPeripheralsResponder)> {
2374 if let CentralRequest::GetPeripherals { service_uuids, responder } = self {
2375 Some((service_uuids, responder))
2376 } else {
2377 None
2378 }
2379 }
2380
2381 #[allow(irrefutable_let_patterns)]
2382 pub fn into_get_peripheral(self) -> Option<(String, CentralGetPeripheralResponder)> {
2383 if let CentralRequest::GetPeripheral { identifier, responder } = self {
2384 Some((identifier, responder))
2385 } else {
2386 None
2387 }
2388 }
2389
2390 #[allow(irrefutable_let_patterns)]
2391 pub fn into_start_scan(self) -> Option<(Option<Box<ScanFilter>>, CentralStartScanResponder)> {
2392 if let CentralRequest::StartScan { filter, responder } = self {
2393 Some((filter, responder))
2394 } else {
2395 None
2396 }
2397 }
2398
2399 #[allow(irrefutable_let_patterns)]
2400 pub fn into_stop_scan(self) -> Option<(CentralControlHandle)> {
2401 if let CentralRequest::StopScan { control_handle } = self {
2402 Some((control_handle))
2403 } else {
2404 None
2405 }
2406 }
2407
2408 #[allow(irrefutable_let_patterns)]
2409 pub fn into_connect_peripheral(
2410 self,
2411 ) -> Option<(
2412 String,
2413 ConnectionOptions,
2414 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
2415 CentralConnectPeripheralResponder,
2416 )> {
2417 if let CentralRequest::ConnectPeripheral { identifier, options, gatt_client, responder } =
2418 self
2419 {
2420 Some((identifier, options, gatt_client, responder))
2421 } else {
2422 None
2423 }
2424 }
2425
2426 #[allow(irrefutable_let_patterns)]
2427 pub fn into_disconnect_peripheral(
2428 self,
2429 ) -> Option<(String, CentralDisconnectPeripheralResponder)> {
2430 if let CentralRequest::DisconnectPeripheral { identifier, responder } = self {
2431 Some((identifier, responder))
2432 } else {
2433 None
2434 }
2435 }
2436
2437 pub fn method_name(&self) -> &'static str {
2439 match *self {
2440 CentralRequest::ListenL2cap { .. } => "listen_l2cap",
2441 CentralRequest::Scan { .. } => "scan",
2442 CentralRequest::Connect { .. } => "connect",
2443 CentralRequest::CreateConnectedIsochronousGroup { .. } => {
2444 "create_connected_isochronous_group"
2445 }
2446 CentralRequest::GetPeripherals { .. } => "get_peripherals",
2447 CentralRequest::GetPeripheral { .. } => "get_peripheral",
2448 CentralRequest::StartScan { .. } => "start_scan",
2449 CentralRequest::StopScan { .. } => "stop_scan",
2450 CentralRequest::ConnectPeripheral { .. } => "connect_peripheral",
2451 CentralRequest::DisconnectPeripheral { .. } => "disconnect_peripheral",
2452 }
2453 }
2454}
2455
2456#[derive(Debug, Clone)]
2457pub struct CentralControlHandle {
2458 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2459}
2460
2461impl fidl::endpoints::ControlHandle for CentralControlHandle {
2462 fn shutdown(&self) {
2463 self.inner.shutdown()
2464 }
2465 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2466 self.inner.shutdown_with_epitaph(status)
2467 }
2468
2469 fn is_closed(&self) -> bool {
2470 self.inner.channel().is_closed()
2471 }
2472 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2473 self.inner.channel().on_closed()
2474 }
2475
2476 #[cfg(target_os = "fuchsia")]
2477 fn signal_peer(
2478 &self,
2479 clear_mask: zx::Signals,
2480 set_mask: zx::Signals,
2481 ) -> Result<(), zx_status::Status> {
2482 use fidl::Peered;
2483 self.inner.channel().signal_peer(clear_mask, set_mask)
2484 }
2485}
2486
2487impl CentralControlHandle {
2488 pub fn send_on_scan_state_changed(&self, mut scanning: bool) -> Result<(), fidl::Error> {
2489 self.inner.send::<CentralOnScanStateChangedRequest>(
2490 (scanning,),
2491 0,
2492 0x5f8edc23cad04d3f,
2493 fidl::encoding::DynamicFlags::empty(),
2494 )
2495 }
2496
2497 pub fn send_on_device_discovered(&self, mut device: &RemoteDevice) -> Result<(), fidl::Error> {
2498 self.inner.send::<CentralOnDeviceDiscoveredRequest>(
2499 (device,),
2500 0,
2501 0x708dadf20d66db6,
2502 fidl::encoding::DynamicFlags::empty(),
2503 )
2504 }
2505
2506 pub fn send_on_peripheral_disconnected(&self, mut identifier: &str) -> Result<(), fidl::Error> {
2507 self.inner.send::<CentralOnPeripheralDisconnectedRequest>(
2508 (identifier,),
2509 0,
2510 0x4e4c6b979b2126df,
2511 fidl::encoding::DynamicFlags::empty(),
2512 )
2513 }
2514}
2515
2516#[must_use = "FIDL methods require a response to be sent"]
2517#[derive(Debug)]
2518pub struct CentralListenL2capResponder {
2519 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2520 tx_id: u32,
2521}
2522
2523impl std::ops::Drop for CentralListenL2capResponder {
2527 fn drop(&mut self) {
2528 self.control_handle.shutdown();
2529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2531 }
2532}
2533
2534impl fidl::endpoints::Responder for CentralListenL2capResponder {
2535 type ControlHandle = CentralControlHandle;
2536
2537 fn control_handle(&self) -> &CentralControlHandle {
2538 &self.control_handle
2539 }
2540
2541 fn drop_without_shutdown(mut self) {
2542 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2544 std::mem::forget(self);
2546 }
2547}
2548
2549impl CentralListenL2capResponder {
2550 pub fn send(
2554 self,
2555 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2556 ) -> Result<(), fidl::Error> {
2557 let _result = self.send_raw(result);
2558 if _result.is_err() {
2559 self.control_handle.shutdown();
2560 }
2561 self.drop_without_shutdown();
2562 _result
2563 }
2564
2565 pub fn send_no_shutdown_on_err(
2567 self,
2568 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2569 ) -> Result<(), fidl::Error> {
2570 let _result = self.send_raw(result);
2571 self.drop_without_shutdown();
2572 _result
2573 }
2574
2575 fn send_raw(
2576 &self,
2577 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
2578 ) -> Result<(), fidl::Error> {
2579 self.control_handle.inner.send::<fidl::encoding::ResultType<
2580 ChannelListenerRegistryListenL2capResponse,
2581 i32,
2582 >>(
2583 result,
2584 self.tx_id,
2585 0x39c6e9001d102338,
2586 fidl::encoding::DynamicFlags::empty(),
2587 )
2588 }
2589}
2590
2591#[must_use = "FIDL methods require a response to be sent"]
2592#[derive(Debug)]
2593pub struct CentralScanResponder {
2594 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2595 tx_id: u32,
2596}
2597
2598impl std::ops::Drop for CentralScanResponder {
2602 fn drop(&mut self) {
2603 self.control_handle.shutdown();
2604 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2606 }
2607}
2608
2609impl fidl::endpoints::Responder for CentralScanResponder {
2610 type ControlHandle = CentralControlHandle;
2611
2612 fn control_handle(&self) -> &CentralControlHandle {
2613 &self.control_handle
2614 }
2615
2616 fn drop_without_shutdown(mut self) {
2617 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2619 std::mem::forget(self);
2621 }
2622}
2623
2624impl CentralScanResponder {
2625 pub fn send(self) -> Result<(), fidl::Error> {
2629 let _result = self.send_raw();
2630 if _result.is_err() {
2631 self.control_handle.shutdown();
2632 }
2633 self.drop_without_shutdown();
2634 _result
2635 }
2636
2637 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2639 let _result = self.send_raw();
2640 self.drop_without_shutdown();
2641 _result
2642 }
2643
2644 fn send_raw(&self) -> Result<(), fidl::Error> {
2645 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2646 (),
2647 self.tx_id,
2648 0x41f7121798dfe15f,
2649 fidl::encoding::DynamicFlags::empty(),
2650 )
2651 }
2652}
2653
2654#[must_use = "FIDL methods require a response to be sent"]
2655#[derive(Debug)]
2656pub struct CentralCreateConnectedIsochronousGroupResponder {
2657 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2658 tx_id: u32,
2659}
2660
2661impl std::ops::Drop for CentralCreateConnectedIsochronousGroupResponder {
2665 fn drop(&mut self) {
2666 self.control_handle.shutdown();
2667 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2669 }
2670}
2671
2672impl fidl::endpoints::Responder for CentralCreateConnectedIsochronousGroupResponder {
2673 type ControlHandle = CentralControlHandle;
2674
2675 fn control_handle(&self) -> &CentralControlHandle {
2676 &self.control_handle
2677 }
2678
2679 fn drop_without_shutdown(mut self) {
2680 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2682 std::mem::forget(self);
2684 }
2685}
2686
2687impl CentralCreateConnectedIsochronousGroupResponder {
2688 pub fn send(
2692 self,
2693 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2694 ) -> Result<(), fidl::Error> {
2695 let _result = self.send_raw(result);
2696 if _result.is_err() {
2697 self.control_handle.shutdown();
2698 }
2699 self.drop_without_shutdown();
2700 _result
2701 }
2702
2703 pub fn send_no_shutdown_on_err(
2705 self,
2706 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2707 ) -> Result<(), fidl::Error> {
2708 let _result = self.send_raw(result);
2709 self.drop_without_shutdown();
2710 _result
2711 }
2712
2713 fn send_raw(
2714 &self,
2715 mut result: Result<&CentralCreateConnectedIsochronousGroupResponse, CreateCigError>,
2716 ) -> Result<(), fidl::Error> {
2717 self.control_handle.inner.send::<fidl::encoding::ResultType<
2718 CentralCreateConnectedIsochronousGroupResponse,
2719 CreateCigError,
2720 >>(
2721 result,
2722 self.tx_id,
2723 0x60323e70ae22e13,
2724 fidl::encoding::DynamicFlags::empty(),
2725 )
2726 }
2727}
2728
2729#[must_use = "FIDL methods require a response to be sent"]
2730#[derive(Debug)]
2731pub struct CentralGetPeripheralsResponder {
2732 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2733 tx_id: u32,
2734}
2735
2736impl std::ops::Drop for CentralGetPeripheralsResponder {
2740 fn drop(&mut self) {
2741 self.control_handle.shutdown();
2742 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2744 }
2745}
2746
2747impl fidl::endpoints::Responder for CentralGetPeripheralsResponder {
2748 type ControlHandle = CentralControlHandle;
2749
2750 fn control_handle(&self) -> &CentralControlHandle {
2751 &self.control_handle
2752 }
2753
2754 fn drop_without_shutdown(mut self) {
2755 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2757 std::mem::forget(self);
2759 }
2760}
2761
2762impl CentralGetPeripheralsResponder {
2763 pub fn send(self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2767 let _result = self.send_raw(peripherals);
2768 if _result.is_err() {
2769 self.control_handle.shutdown();
2770 }
2771 self.drop_without_shutdown();
2772 _result
2773 }
2774
2775 pub fn send_no_shutdown_on_err(
2777 self,
2778 mut peripherals: &[RemoteDevice],
2779 ) -> Result<(), fidl::Error> {
2780 let _result = self.send_raw(peripherals);
2781 self.drop_without_shutdown();
2782 _result
2783 }
2784
2785 fn send_raw(&self, mut peripherals: &[RemoteDevice]) -> Result<(), fidl::Error> {
2786 self.control_handle.inner.send::<CentralGetPeripheralsResponse>(
2787 (peripherals,),
2788 self.tx_id,
2789 0x37ba777499c683a8,
2790 fidl::encoding::DynamicFlags::empty(),
2791 )
2792 }
2793}
2794
2795#[must_use = "FIDL methods require a response to be sent"]
2796#[derive(Debug)]
2797pub struct CentralGetPeripheralResponder {
2798 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2799 tx_id: u32,
2800}
2801
2802impl std::ops::Drop for CentralGetPeripheralResponder {
2806 fn drop(&mut self) {
2807 self.control_handle.shutdown();
2808 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2810 }
2811}
2812
2813impl fidl::endpoints::Responder for CentralGetPeripheralResponder {
2814 type ControlHandle = CentralControlHandle;
2815
2816 fn control_handle(&self) -> &CentralControlHandle {
2817 &self.control_handle
2818 }
2819
2820 fn drop_without_shutdown(mut self) {
2821 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2823 std::mem::forget(self);
2825 }
2826}
2827
2828impl CentralGetPeripheralResponder {
2829 pub fn send(self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2833 let _result = self.send_raw(peripheral);
2834 if _result.is_err() {
2835 self.control_handle.shutdown();
2836 }
2837 self.drop_without_shutdown();
2838 _result
2839 }
2840
2841 pub fn send_no_shutdown_on_err(
2843 self,
2844 mut peripheral: Option<&RemoteDevice>,
2845 ) -> Result<(), fidl::Error> {
2846 let _result = self.send_raw(peripheral);
2847 self.drop_without_shutdown();
2848 _result
2849 }
2850
2851 fn send_raw(&self, mut peripheral: Option<&RemoteDevice>) -> Result<(), fidl::Error> {
2852 self.control_handle.inner.send::<CentralGetPeripheralResponse>(
2853 (peripheral,),
2854 self.tx_id,
2855 0x97f5a2f2d9c13da,
2856 fidl::encoding::DynamicFlags::empty(),
2857 )
2858 }
2859}
2860
2861#[must_use = "FIDL methods require a response to be sent"]
2862#[derive(Debug)]
2863pub struct CentralStartScanResponder {
2864 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2865 tx_id: u32,
2866}
2867
2868impl std::ops::Drop for CentralStartScanResponder {
2872 fn drop(&mut self) {
2873 self.control_handle.shutdown();
2874 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2876 }
2877}
2878
2879impl fidl::endpoints::Responder for CentralStartScanResponder {
2880 type ControlHandle = CentralControlHandle;
2881
2882 fn control_handle(&self) -> &CentralControlHandle {
2883 &self.control_handle
2884 }
2885
2886 fn drop_without_shutdown(mut self) {
2887 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2889 std::mem::forget(self);
2891 }
2892}
2893
2894impl CentralStartScanResponder {
2895 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2899 let _result = self.send_raw(status);
2900 if _result.is_err() {
2901 self.control_handle.shutdown();
2902 }
2903 self.drop_without_shutdown();
2904 _result
2905 }
2906
2907 pub fn send_no_shutdown_on_err(
2909 self,
2910 mut status: &fidl_fuchsia_bluetooth::Status,
2911 ) -> Result<(), fidl::Error> {
2912 let _result = self.send_raw(status);
2913 self.drop_without_shutdown();
2914 _result
2915 }
2916
2917 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2918 self.control_handle.inner.send::<CentralStartScanResponse>(
2919 (status,),
2920 self.tx_id,
2921 0xeb4cf0cd0e1132b,
2922 fidl::encoding::DynamicFlags::empty(),
2923 )
2924 }
2925}
2926
2927#[must_use = "FIDL methods require a response to be sent"]
2928#[derive(Debug)]
2929pub struct CentralConnectPeripheralResponder {
2930 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2931 tx_id: u32,
2932}
2933
2934impl std::ops::Drop for CentralConnectPeripheralResponder {
2938 fn drop(&mut self) {
2939 self.control_handle.shutdown();
2940 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2942 }
2943}
2944
2945impl fidl::endpoints::Responder for CentralConnectPeripheralResponder {
2946 type ControlHandle = CentralControlHandle;
2947
2948 fn control_handle(&self) -> &CentralControlHandle {
2949 &self.control_handle
2950 }
2951
2952 fn drop_without_shutdown(mut self) {
2953 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2955 std::mem::forget(self);
2957 }
2958}
2959
2960impl CentralConnectPeripheralResponder {
2961 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2965 let _result = self.send_raw(status);
2966 if _result.is_err() {
2967 self.control_handle.shutdown();
2968 }
2969 self.drop_without_shutdown();
2970 _result
2971 }
2972
2973 pub fn send_no_shutdown_on_err(
2975 self,
2976 mut status: &fidl_fuchsia_bluetooth::Status,
2977 ) -> Result<(), fidl::Error> {
2978 let _result = self.send_raw(status);
2979 self.drop_without_shutdown();
2980 _result
2981 }
2982
2983 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
2984 self.control_handle.inner.send::<CentralConnectPeripheralResponse>(
2985 (status,),
2986 self.tx_id,
2987 0x714d6c32d066d75a,
2988 fidl::encoding::DynamicFlags::empty(),
2989 )
2990 }
2991}
2992
2993#[must_use = "FIDL methods require a response to be sent"]
2994#[derive(Debug)]
2995pub struct CentralDisconnectPeripheralResponder {
2996 control_handle: std::mem::ManuallyDrop<CentralControlHandle>,
2997 tx_id: u32,
2998}
2999
3000impl std::ops::Drop for CentralDisconnectPeripheralResponder {
3004 fn drop(&mut self) {
3005 self.control_handle.shutdown();
3006 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3008 }
3009}
3010
3011impl fidl::endpoints::Responder for CentralDisconnectPeripheralResponder {
3012 type ControlHandle = CentralControlHandle;
3013
3014 fn control_handle(&self) -> &CentralControlHandle {
3015 &self.control_handle
3016 }
3017
3018 fn drop_without_shutdown(mut self) {
3019 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3021 std::mem::forget(self);
3023 }
3024}
3025
3026impl CentralDisconnectPeripheralResponder {
3027 pub fn send(self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3031 let _result = self.send_raw(status);
3032 if _result.is_err() {
3033 self.control_handle.shutdown();
3034 }
3035 self.drop_without_shutdown();
3036 _result
3037 }
3038
3039 pub fn send_no_shutdown_on_err(
3041 self,
3042 mut status: &fidl_fuchsia_bluetooth::Status,
3043 ) -> Result<(), fidl::Error> {
3044 let _result = self.send_raw(status);
3045 self.drop_without_shutdown();
3046 _result
3047 }
3048
3049 fn send_raw(&self, mut status: &fidl_fuchsia_bluetooth::Status) -> Result<(), fidl::Error> {
3050 self.control_handle.inner.send::<CentralDisconnectPeripheralResponse>(
3051 (status,),
3052 self.tx_id,
3053 0xa9430da197362fd,
3054 fidl::encoding::DynamicFlags::empty(),
3055 )
3056 }
3057}
3058
3059#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3060pub struct ChannelListenerMarker;
3061
3062impl fidl::endpoints::ProtocolMarker for ChannelListenerMarker {
3063 type Proxy = ChannelListenerProxy;
3064 type RequestStream = ChannelListenerRequestStream;
3065 #[cfg(target_os = "fuchsia")]
3066 type SynchronousProxy = ChannelListenerSynchronousProxy;
3067
3068 const DEBUG_NAME: &'static str = "(anonymous) ChannelListener";
3069}
3070
3071pub trait ChannelListenerProxyInterface: Send + Sync {
3072 type AcceptResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3073 fn r#accept(
3074 &self,
3075 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3076 ) -> Self::AcceptResponseFut;
3077}
3078#[derive(Debug)]
3079#[cfg(target_os = "fuchsia")]
3080pub struct ChannelListenerSynchronousProxy {
3081 client: fidl::client::sync::Client,
3082}
3083
3084#[cfg(target_os = "fuchsia")]
3085impl fidl::endpoints::SynchronousProxy for ChannelListenerSynchronousProxy {
3086 type Proxy = ChannelListenerProxy;
3087 type Protocol = ChannelListenerMarker;
3088
3089 fn from_channel(inner: fidl::Channel) -> Self {
3090 Self::new(inner)
3091 }
3092
3093 fn into_channel(self) -> fidl::Channel {
3094 self.client.into_channel()
3095 }
3096
3097 fn as_channel(&self) -> &fidl::Channel {
3098 self.client.as_channel()
3099 }
3100}
3101
3102#[cfg(target_os = "fuchsia")]
3103impl ChannelListenerSynchronousProxy {
3104 pub fn new(channel: fidl::Channel) -> Self {
3105 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3106 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3107 }
3108
3109 pub fn into_channel(self) -> fidl::Channel {
3110 self.client.into_channel()
3111 }
3112
3113 pub fn wait_for_event(
3116 &self,
3117 deadline: zx::MonotonicInstant,
3118 ) -> Result<ChannelListenerEvent, fidl::Error> {
3119 ChannelListenerEvent::decode(self.client.wait_for_event(deadline)?)
3120 }
3121
3122 pub fn r#accept(
3123 &self,
3124 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3125 ___deadline: zx::MonotonicInstant,
3126 ) -> Result<(), fidl::Error> {
3127 let _response = self.client.send_query::<
3128 ChannelListenerAcceptRequest,
3129 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3130 >(
3131 (channel,),
3132 0x6f535bd36b20fc7b,
3133 fidl::encoding::DynamicFlags::FLEXIBLE,
3134 ___deadline,
3135 )?
3136 .into_result::<ChannelListenerMarker>("accept")?;
3137 Ok(_response)
3138 }
3139}
3140
3141#[cfg(target_os = "fuchsia")]
3142impl From<ChannelListenerSynchronousProxy> for zx::Handle {
3143 fn from(value: ChannelListenerSynchronousProxy) -> Self {
3144 value.into_channel().into()
3145 }
3146}
3147
3148#[cfg(target_os = "fuchsia")]
3149impl From<fidl::Channel> for ChannelListenerSynchronousProxy {
3150 fn from(value: fidl::Channel) -> Self {
3151 Self::new(value)
3152 }
3153}
3154
3155#[derive(Debug, Clone)]
3156pub struct ChannelListenerProxy {
3157 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3158}
3159
3160impl fidl::endpoints::Proxy for ChannelListenerProxy {
3161 type Protocol = ChannelListenerMarker;
3162
3163 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3164 Self::new(inner)
3165 }
3166
3167 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3168 self.client.into_channel().map_err(|client| Self { client })
3169 }
3170
3171 fn as_channel(&self) -> &::fidl::AsyncChannel {
3172 self.client.as_channel()
3173 }
3174}
3175
3176impl ChannelListenerProxy {
3177 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3179 let protocol_name = <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3180 Self { client: fidl::client::Client::new(channel, protocol_name) }
3181 }
3182
3183 pub fn take_event_stream(&self) -> ChannelListenerEventStream {
3189 ChannelListenerEventStream { event_receiver: self.client.take_event_receiver() }
3190 }
3191
3192 pub fn r#accept(
3193 &self,
3194 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3195 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3196 ChannelListenerProxyInterface::r#accept(self, channel)
3197 }
3198}
3199
3200impl ChannelListenerProxyInterface for ChannelListenerProxy {
3201 type AcceptResponseFut =
3202 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3203 fn r#accept(
3204 &self,
3205 mut channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3206 ) -> Self::AcceptResponseFut {
3207 fn _decode(
3208 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3209 ) -> Result<(), fidl::Error> {
3210 let _response = fidl::client::decode_transaction_body::<
3211 fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
3212 fidl::encoding::DefaultFuchsiaResourceDialect,
3213 0x6f535bd36b20fc7b,
3214 >(_buf?)?
3215 .into_result::<ChannelListenerMarker>("accept")?;
3216 Ok(_response)
3217 }
3218 self.client.send_query_and_decode::<ChannelListenerAcceptRequest, ()>(
3219 (channel,),
3220 0x6f535bd36b20fc7b,
3221 fidl::encoding::DynamicFlags::FLEXIBLE,
3222 _decode,
3223 )
3224 }
3225}
3226
3227pub struct ChannelListenerEventStream {
3228 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3229}
3230
3231impl std::marker::Unpin for ChannelListenerEventStream {}
3232
3233impl futures::stream::FusedStream for ChannelListenerEventStream {
3234 fn is_terminated(&self) -> bool {
3235 self.event_receiver.is_terminated()
3236 }
3237}
3238
3239impl futures::Stream for ChannelListenerEventStream {
3240 type Item = Result<ChannelListenerEvent, fidl::Error>;
3241
3242 fn poll_next(
3243 mut self: std::pin::Pin<&mut Self>,
3244 cx: &mut std::task::Context<'_>,
3245 ) -> std::task::Poll<Option<Self::Item>> {
3246 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3247 &mut self.event_receiver,
3248 cx
3249 )?) {
3250 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerEvent::decode(buf))),
3251 None => std::task::Poll::Ready(None),
3252 }
3253 }
3254}
3255
3256#[derive(Debug)]
3257pub enum ChannelListenerEvent {
3258 #[non_exhaustive]
3259 _UnknownEvent {
3260 ordinal: u64,
3262 },
3263}
3264
3265impl ChannelListenerEvent {
3266 fn decode(
3268 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3269 ) -> Result<ChannelListenerEvent, fidl::Error> {
3270 let (bytes, _handles) = buf.split_mut();
3271 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3272 debug_assert_eq!(tx_header.tx_id, 0);
3273 match tx_header.ordinal {
3274 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3275 Ok(ChannelListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3276 }
3277 _ => Err(fidl::Error::UnknownOrdinal {
3278 ordinal: tx_header.ordinal,
3279 protocol_name:
3280 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3281 }),
3282 }
3283 }
3284}
3285
3286pub struct ChannelListenerRequestStream {
3288 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3289 is_terminated: bool,
3290}
3291
3292impl std::marker::Unpin for ChannelListenerRequestStream {}
3293
3294impl futures::stream::FusedStream for ChannelListenerRequestStream {
3295 fn is_terminated(&self) -> bool {
3296 self.is_terminated
3297 }
3298}
3299
3300impl fidl::endpoints::RequestStream for ChannelListenerRequestStream {
3301 type Protocol = ChannelListenerMarker;
3302 type ControlHandle = ChannelListenerControlHandle;
3303
3304 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3305 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3306 }
3307
3308 fn control_handle(&self) -> Self::ControlHandle {
3309 ChannelListenerControlHandle { inner: self.inner.clone() }
3310 }
3311
3312 fn into_inner(
3313 self,
3314 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3315 {
3316 (self.inner, self.is_terminated)
3317 }
3318
3319 fn from_inner(
3320 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3321 is_terminated: bool,
3322 ) -> Self {
3323 Self { inner, is_terminated }
3324 }
3325}
3326
3327impl futures::Stream for ChannelListenerRequestStream {
3328 type Item = Result<ChannelListenerRequest, fidl::Error>;
3329
3330 fn poll_next(
3331 mut self: std::pin::Pin<&mut Self>,
3332 cx: &mut std::task::Context<'_>,
3333 ) -> std::task::Poll<Option<Self::Item>> {
3334 let this = &mut *self;
3335 if this.inner.check_shutdown(cx) {
3336 this.is_terminated = true;
3337 return std::task::Poll::Ready(None);
3338 }
3339 if this.is_terminated {
3340 panic!("polled ChannelListenerRequestStream after completion");
3341 }
3342 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3343 |bytes, handles| {
3344 match this.inner.channel().read_etc(cx, bytes, handles) {
3345 std::task::Poll::Ready(Ok(())) => {}
3346 std::task::Poll::Pending => return std::task::Poll::Pending,
3347 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3348 this.is_terminated = true;
3349 return std::task::Poll::Ready(None);
3350 }
3351 std::task::Poll::Ready(Err(e)) => {
3352 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3353 e.into(),
3354 ))))
3355 }
3356 }
3357
3358 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3360
3361 std::task::Poll::Ready(Some(match header.ordinal {
3362 0x6f535bd36b20fc7b => {
3363 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3364 let mut req = fidl::new_empty!(
3365 ChannelListenerAcceptRequest,
3366 fidl::encoding::DefaultFuchsiaResourceDialect
3367 );
3368 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerAcceptRequest>(&header, _body_bytes, handles, &mut req)?;
3369 let control_handle =
3370 ChannelListenerControlHandle { inner: this.inner.clone() };
3371 Ok(ChannelListenerRequest::Accept {
3372 channel: req.channel,
3373
3374 responder: ChannelListenerAcceptResponder {
3375 control_handle: std::mem::ManuallyDrop::new(control_handle),
3376 tx_id: header.tx_id,
3377 },
3378 })
3379 }
3380 _ if header.tx_id == 0
3381 && header
3382 .dynamic_flags()
3383 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3384 {
3385 Ok(ChannelListenerRequest::_UnknownMethod {
3386 ordinal: header.ordinal,
3387 control_handle: ChannelListenerControlHandle {
3388 inner: this.inner.clone(),
3389 },
3390 method_type: fidl::MethodType::OneWay,
3391 })
3392 }
3393 _ if header
3394 .dynamic_flags()
3395 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
3396 {
3397 this.inner.send_framework_err(
3398 fidl::encoding::FrameworkErr::UnknownMethod,
3399 header.tx_id,
3400 header.ordinal,
3401 header.dynamic_flags(),
3402 (bytes, handles),
3403 )?;
3404 Ok(ChannelListenerRequest::_UnknownMethod {
3405 ordinal: header.ordinal,
3406 control_handle: ChannelListenerControlHandle {
3407 inner: this.inner.clone(),
3408 },
3409 method_type: fidl::MethodType::TwoWay,
3410 })
3411 }
3412 _ => Err(fidl::Error::UnknownOrdinal {
3413 ordinal: header.ordinal,
3414 protocol_name:
3415 <ChannelListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3416 }),
3417 }))
3418 },
3419 )
3420 }
3421}
3422
3423#[derive(Debug)]
3430pub enum ChannelListenerRequest {
3431 Accept {
3432 channel: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3433 responder: ChannelListenerAcceptResponder,
3434 },
3435 #[non_exhaustive]
3437 _UnknownMethod {
3438 ordinal: u64,
3440 control_handle: ChannelListenerControlHandle,
3441 method_type: fidl::MethodType,
3442 },
3443}
3444
3445impl ChannelListenerRequest {
3446 #[allow(irrefutable_let_patterns)]
3447 pub fn into_accept(
3448 self,
3449 ) -> Option<(
3450 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
3451 ChannelListenerAcceptResponder,
3452 )> {
3453 if let ChannelListenerRequest::Accept { channel, responder } = self {
3454 Some((channel, responder))
3455 } else {
3456 None
3457 }
3458 }
3459
3460 pub fn method_name(&self) -> &'static str {
3462 match *self {
3463 ChannelListenerRequest::Accept { .. } => "accept",
3464 ChannelListenerRequest::_UnknownMethod {
3465 method_type: fidl::MethodType::OneWay,
3466 ..
3467 } => "unknown one-way method",
3468 ChannelListenerRequest::_UnknownMethod {
3469 method_type: fidl::MethodType::TwoWay,
3470 ..
3471 } => "unknown two-way method",
3472 }
3473 }
3474}
3475
3476#[derive(Debug, Clone)]
3477pub struct ChannelListenerControlHandle {
3478 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3479}
3480
3481impl fidl::endpoints::ControlHandle for ChannelListenerControlHandle {
3482 fn shutdown(&self) {
3483 self.inner.shutdown()
3484 }
3485 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3486 self.inner.shutdown_with_epitaph(status)
3487 }
3488
3489 fn is_closed(&self) -> bool {
3490 self.inner.channel().is_closed()
3491 }
3492 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3493 self.inner.channel().on_closed()
3494 }
3495
3496 #[cfg(target_os = "fuchsia")]
3497 fn signal_peer(
3498 &self,
3499 clear_mask: zx::Signals,
3500 set_mask: zx::Signals,
3501 ) -> Result<(), zx_status::Status> {
3502 use fidl::Peered;
3503 self.inner.channel().signal_peer(clear_mask, set_mask)
3504 }
3505}
3506
3507impl ChannelListenerControlHandle {}
3508
3509#[must_use = "FIDL methods require a response to be sent"]
3510#[derive(Debug)]
3511pub struct ChannelListenerAcceptResponder {
3512 control_handle: std::mem::ManuallyDrop<ChannelListenerControlHandle>,
3513 tx_id: u32,
3514}
3515
3516impl std::ops::Drop for ChannelListenerAcceptResponder {
3520 fn drop(&mut self) {
3521 self.control_handle.shutdown();
3522 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3524 }
3525}
3526
3527impl fidl::endpoints::Responder for ChannelListenerAcceptResponder {
3528 type ControlHandle = ChannelListenerControlHandle;
3529
3530 fn control_handle(&self) -> &ChannelListenerControlHandle {
3531 &self.control_handle
3532 }
3533
3534 fn drop_without_shutdown(mut self) {
3535 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3537 std::mem::forget(self);
3539 }
3540}
3541
3542impl ChannelListenerAcceptResponder {
3543 pub fn send(self) -> Result<(), fidl::Error> {
3547 let _result = self.send_raw();
3548 if _result.is_err() {
3549 self.control_handle.shutdown();
3550 }
3551 self.drop_without_shutdown();
3552 _result
3553 }
3554
3555 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3557 let _result = self.send_raw();
3558 self.drop_without_shutdown();
3559 _result
3560 }
3561
3562 fn send_raw(&self) -> Result<(), fidl::Error> {
3563 self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3564 fidl::encoding::Flexible::new(()),
3565 self.tx_id,
3566 0x6f535bd36b20fc7b,
3567 fidl::encoding::DynamicFlags::FLEXIBLE,
3568 )
3569 }
3570}
3571
3572#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3573pub struct ChannelListenerRegistryMarker;
3574
3575impl fidl::endpoints::ProtocolMarker for ChannelListenerRegistryMarker {
3576 type Proxy = ChannelListenerRegistryProxy;
3577 type RequestStream = ChannelListenerRegistryRequestStream;
3578 #[cfg(target_os = "fuchsia")]
3579 type SynchronousProxy = ChannelListenerRegistrySynchronousProxy;
3580
3581 const DEBUG_NAME: &'static str = "(anonymous) ChannelListenerRegistry";
3582}
3583pub type ChannelListenerRegistryListenL2capResult =
3584 Result<ChannelListenerRegistryListenL2capResponse, i32>;
3585
3586pub trait ChannelListenerRegistryProxyInterface: Send + Sync {
3587 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
3588 + Send;
3589 fn r#listen_l2cap(
3590 &self,
3591 payload: ChannelListenerRegistryListenL2capRequest,
3592 ) -> Self::ListenL2capResponseFut;
3593}
3594#[derive(Debug)]
3595#[cfg(target_os = "fuchsia")]
3596pub struct ChannelListenerRegistrySynchronousProxy {
3597 client: fidl::client::sync::Client,
3598}
3599
3600#[cfg(target_os = "fuchsia")]
3601impl fidl::endpoints::SynchronousProxy for ChannelListenerRegistrySynchronousProxy {
3602 type Proxy = ChannelListenerRegistryProxy;
3603 type Protocol = ChannelListenerRegistryMarker;
3604
3605 fn from_channel(inner: fidl::Channel) -> Self {
3606 Self::new(inner)
3607 }
3608
3609 fn into_channel(self) -> fidl::Channel {
3610 self.client.into_channel()
3611 }
3612
3613 fn as_channel(&self) -> &fidl::Channel {
3614 self.client.as_channel()
3615 }
3616}
3617
3618#[cfg(target_os = "fuchsia")]
3619impl ChannelListenerRegistrySynchronousProxy {
3620 pub fn new(channel: fidl::Channel) -> Self {
3621 let protocol_name =
3622 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3623 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3624 }
3625
3626 pub fn into_channel(self) -> fidl::Channel {
3627 self.client.into_channel()
3628 }
3629
3630 pub fn wait_for_event(
3633 &self,
3634 deadline: zx::MonotonicInstant,
3635 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3636 ChannelListenerRegistryEvent::decode(self.client.wait_for_event(deadline)?)
3637 }
3638
3639 pub fn r#listen_l2cap(
3649 &self,
3650 mut payload: ChannelListenerRegistryListenL2capRequest,
3651 ___deadline: zx::MonotonicInstant,
3652 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3653 let _response = self.client.send_query::<
3654 ChannelListenerRegistryListenL2capRequest,
3655 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3656 >(
3657 &mut payload,
3658 0x39c6e9001d102338,
3659 fidl::encoding::DynamicFlags::empty(),
3660 ___deadline,
3661 )?;
3662 Ok(_response.map(|x| x))
3663 }
3664}
3665
3666#[cfg(target_os = "fuchsia")]
3667impl From<ChannelListenerRegistrySynchronousProxy> for zx::Handle {
3668 fn from(value: ChannelListenerRegistrySynchronousProxy) -> Self {
3669 value.into_channel().into()
3670 }
3671}
3672
3673#[cfg(target_os = "fuchsia")]
3674impl From<fidl::Channel> for ChannelListenerRegistrySynchronousProxy {
3675 fn from(value: fidl::Channel) -> Self {
3676 Self::new(value)
3677 }
3678}
3679
3680#[derive(Debug, Clone)]
3681pub struct ChannelListenerRegistryProxy {
3682 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3683}
3684
3685impl fidl::endpoints::Proxy for ChannelListenerRegistryProxy {
3686 type Protocol = ChannelListenerRegistryMarker;
3687
3688 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3689 Self::new(inner)
3690 }
3691
3692 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3693 self.client.into_channel().map_err(|client| Self { client })
3694 }
3695
3696 fn as_channel(&self) -> &::fidl::AsyncChannel {
3697 self.client.as_channel()
3698 }
3699}
3700
3701impl ChannelListenerRegistryProxy {
3702 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3704 let protocol_name =
3705 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3706 Self { client: fidl::client::Client::new(channel, protocol_name) }
3707 }
3708
3709 pub fn take_event_stream(&self) -> ChannelListenerRegistryEventStream {
3715 ChannelListenerRegistryEventStream { event_receiver: self.client.take_event_receiver() }
3716 }
3717
3718 pub fn r#listen_l2cap(
3728 &self,
3729 mut payload: ChannelListenerRegistryListenL2capRequest,
3730 ) -> fidl::client::QueryResponseFut<
3731 ChannelListenerRegistryListenL2capResult,
3732 fidl::encoding::DefaultFuchsiaResourceDialect,
3733 > {
3734 ChannelListenerRegistryProxyInterface::r#listen_l2cap(self, payload)
3735 }
3736}
3737
3738impl ChannelListenerRegistryProxyInterface for ChannelListenerRegistryProxy {
3739 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
3740 ChannelListenerRegistryListenL2capResult,
3741 fidl::encoding::DefaultFuchsiaResourceDialect,
3742 >;
3743 fn r#listen_l2cap(
3744 &self,
3745 mut payload: ChannelListenerRegistryListenL2capRequest,
3746 ) -> Self::ListenL2capResponseFut {
3747 fn _decode(
3748 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3749 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
3750 let _response = fidl::client::decode_transaction_body::<
3751 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
3752 fidl::encoding::DefaultFuchsiaResourceDialect,
3753 0x39c6e9001d102338,
3754 >(_buf?)?;
3755 Ok(_response.map(|x| x))
3756 }
3757 self.client.send_query_and_decode::<
3758 ChannelListenerRegistryListenL2capRequest,
3759 ChannelListenerRegistryListenL2capResult,
3760 >(
3761 &mut payload,
3762 0x39c6e9001d102338,
3763 fidl::encoding::DynamicFlags::empty(),
3764 _decode,
3765 )
3766 }
3767}
3768
3769pub struct ChannelListenerRegistryEventStream {
3770 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3771}
3772
3773impl std::marker::Unpin for ChannelListenerRegistryEventStream {}
3774
3775impl futures::stream::FusedStream for ChannelListenerRegistryEventStream {
3776 fn is_terminated(&self) -> bool {
3777 self.event_receiver.is_terminated()
3778 }
3779}
3780
3781impl futures::Stream for ChannelListenerRegistryEventStream {
3782 type Item = Result<ChannelListenerRegistryEvent, fidl::Error>;
3783
3784 fn poll_next(
3785 mut self: std::pin::Pin<&mut Self>,
3786 cx: &mut std::task::Context<'_>,
3787 ) -> std::task::Poll<Option<Self::Item>> {
3788 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3789 &mut self.event_receiver,
3790 cx
3791 )?) {
3792 Some(buf) => std::task::Poll::Ready(Some(ChannelListenerRegistryEvent::decode(buf))),
3793 None => std::task::Poll::Ready(None),
3794 }
3795 }
3796}
3797
3798#[derive(Debug)]
3799pub enum ChannelListenerRegistryEvent {}
3800
3801impl ChannelListenerRegistryEvent {
3802 fn decode(
3804 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3805 ) -> Result<ChannelListenerRegistryEvent, fidl::Error> {
3806 let (bytes, _handles) = buf.split_mut();
3807 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3808 debug_assert_eq!(tx_header.tx_id, 0);
3809 match tx_header.ordinal {
3810 _ => Err(fidl::Error::UnknownOrdinal {
3811 ordinal: tx_header.ordinal,
3812 protocol_name:
3813 <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3814 }),
3815 }
3816 }
3817}
3818
3819pub struct ChannelListenerRegistryRequestStream {
3821 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3822 is_terminated: bool,
3823}
3824
3825impl std::marker::Unpin for ChannelListenerRegistryRequestStream {}
3826
3827impl futures::stream::FusedStream for ChannelListenerRegistryRequestStream {
3828 fn is_terminated(&self) -> bool {
3829 self.is_terminated
3830 }
3831}
3832
3833impl fidl::endpoints::RequestStream for ChannelListenerRegistryRequestStream {
3834 type Protocol = ChannelListenerRegistryMarker;
3835 type ControlHandle = ChannelListenerRegistryControlHandle;
3836
3837 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3838 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3839 }
3840
3841 fn control_handle(&self) -> Self::ControlHandle {
3842 ChannelListenerRegistryControlHandle { inner: self.inner.clone() }
3843 }
3844
3845 fn into_inner(
3846 self,
3847 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3848 {
3849 (self.inner, self.is_terminated)
3850 }
3851
3852 fn from_inner(
3853 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3854 is_terminated: bool,
3855 ) -> Self {
3856 Self { inner, is_terminated }
3857 }
3858}
3859
3860impl futures::Stream for ChannelListenerRegistryRequestStream {
3861 type Item = Result<ChannelListenerRegistryRequest, fidl::Error>;
3862
3863 fn poll_next(
3864 mut self: std::pin::Pin<&mut Self>,
3865 cx: &mut std::task::Context<'_>,
3866 ) -> std::task::Poll<Option<Self::Item>> {
3867 let this = &mut *self;
3868 if this.inner.check_shutdown(cx) {
3869 this.is_terminated = true;
3870 return std::task::Poll::Ready(None);
3871 }
3872 if this.is_terminated {
3873 panic!("polled ChannelListenerRegistryRequestStream after completion");
3874 }
3875 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3876 |bytes, handles| {
3877 match this.inner.channel().read_etc(cx, bytes, handles) {
3878 std::task::Poll::Ready(Ok(())) => {}
3879 std::task::Poll::Pending => return std::task::Poll::Pending,
3880 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3881 this.is_terminated = true;
3882 return std::task::Poll::Ready(None);
3883 }
3884 std::task::Poll::Ready(Err(e)) => {
3885 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3886 e.into(),
3887 ))))
3888 }
3889 }
3890
3891 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3893
3894 std::task::Poll::Ready(Some(match header.ordinal {
3895 0x39c6e9001d102338 => {
3896 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3897 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3898 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
3899 let control_handle = ChannelListenerRegistryControlHandle {
3900 inner: this.inner.clone(),
3901 };
3902 Ok(ChannelListenerRegistryRequest::ListenL2cap {payload: req,
3903 responder: ChannelListenerRegistryListenL2capResponder {
3904 control_handle: std::mem::ManuallyDrop::new(control_handle),
3905 tx_id: header.tx_id,
3906 },
3907 })
3908 }
3909 _ => Err(fidl::Error::UnknownOrdinal {
3910 ordinal: header.ordinal,
3911 protocol_name: <ChannelListenerRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3912 }),
3913 }))
3914 },
3915 )
3916 }
3917}
3918
3919#[derive(Debug)]
3922pub enum ChannelListenerRegistryRequest {
3923 ListenL2cap {
3933 payload: ChannelListenerRegistryListenL2capRequest,
3934 responder: ChannelListenerRegistryListenL2capResponder,
3935 },
3936}
3937
3938impl ChannelListenerRegistryRequest {
3939 #[allow(irrefutable_let_patterns)]
3940 pub fn into_listen_l2cap(
3941 self,
3942 ) -> Option<(
3943 ChannelListenerRegistryListenL2capRequest,
3944 ChannelListenerRegistryListenL2capResponder,
3945 )> {
3946 if let ChannelListenerRegistryRequest::ListenL2cap { payload, responder } = self {
3947 Some((payload, responder))
3948 } else {
3949 None
3950 }
3951 }
3952
3953 pub fn method_name(&self) -> &'static str {
3955 match *self {
3956 ChannelListenerRegistryRequest::ListenL2cap { .. } => "listen_l2cap",
3957 }
3958 }
3959}
3960
3961#[derive(Debug, Clone)]
3962pub struct ChannelListenerRegistryControlHandle {
3963 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3964}
3965
3966impl fidl::endpoints::ControlHandle for ChannelListenerRegistryControlHandle {
3967 fn shutdown(&self) {
3968 self.inner.shutdown()
3969 }
3970 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3971 self.inner.shutdown_with_epitaph(status)
3972 }
3973
3974 fn is_closed(&self) -> bool {
3975 self.inner.channel().is_closed()
3976 }
3977 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3978 self.inner.channel().on_closed()
3979 }
3980
3981 #[cfg(target_os = "fuchsia")]
3982 fn signal_peer(
3983 &self,
3984 clear_mask: zx::Signals,
3985 set_mask: zx::Signals,
3986 ) -> Result<(), zx_status::Status> {
3987 use fidl::Peered;
3988 self.inner.channel().signal_peer(clear_mask, set_mask)
3989 }
3990}
3991
3992impl ChannelListenerRegistryControlHandle {}
3993
3994#[must_use = "FIDL methods require a response to be sent"]
3995#[derive(Debug)]
3996pub struct ChannelListenerRegistryListenL2capResponder {
3997 control_handle: std::mem::ManuallyDrop<ChannelListenerRegistryControlHandle>,
3998 tx_id: u32,
3999}
4000
4001impl std::ops::Drop for ChannelListenerRegistryListenL2capResponder {
4005 fn drop(&mut self) {
4006 self.control_handle.shutdown();
4007 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4009 }
4010}
4011
4012impl fidl::endpoints::Responder for ChannelListenerRegistryListenL2capResponder {
4013 type ControlHandle = ChannelListenerRegistryControlHandle;
4014
4015 fn control_handle(&self) -> &ChannelListenerRegistryControlHandle {
4016 &self.control_handle
4017 }
4018
4019 fn drop_without_shutdown(mut self) {
4020 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4022 std::mem::forget(self);
4024 }
4025}
4026
4027impl ChannelListenerRegistryListenL2capResponder {
4028 pub fn send(
4032 self,
4033 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4034 ) -> Result<(), fidl::Error> {
4035 let _result = self.send_raw(result);
4036 if _result.is_err() {
4037 self.control_handle.shutdown();
4038 }
4039 self.drop_without_shutdown();
4040 _result
4041 }
4042
4043 pub fn send_no_shutdown_on_err(
4045 self,
4046 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4047 ) -> Result<(), fidl::Error> {
4048 let _result = self.send_raw(result);
4049 self.drop_without_shutdown();
4050 _result
4051 }
4052
4053 fn send_raw(
4054 &self,
4055 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
4056 ) -> Result<(), fidl::Error> {
4057 self.control_handle.inner.send::<fidl::encoding::ResultType<
4058 ChannelListenerRegistryListenL2capResponse,
4059 i32,
4060 >>(
4061 result,
4062 self.tx_id,
4063 0x39c6e9001d102338,
4064 fidl::encoding::DynamicFlags::empty(),
4065 )
4066 }
4067}
4068
4069#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4070pub struct CodecDelayMarker;
4071
4072impl fidl::endpoints::ProtocolMarker for CodecDelayMarker {
4073 type Proxy = CodecDelayProxy;
4074 type RequestStream = CodecDelayRequestStream;
4075 #[cfg(target_os = "fuchsia")]
4076 type SynchronousProxy = CodecDelaySynchronousProxy;
4077
4078 const DEBUG_NAME: &'static str = "(anonymous) CodecDelay";
4079}
4080pub type CodecDelayGetCodecLocalDelayRangeResult =
4081 Result<CodecDelayGetCodecLocalDelayRangeResponse, i32>;
4082
4083pub trait CodecDelayProxyInterface: Send + Sync {
4084 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
4085 + Send;
4086 fn r#get_codec_local_delay_range(
4087 &self,
4088 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4089 ) -> Self::GetCodecLocalDelayRangeResponseFut;
4090}
4091#[derive(Debug)]
4092#[cfg(target_os = "fuchsia")]
4093pub struct CodecDelaySynchronousProxy {
4094 client: fidl::client::sync::Client,
4095}
4096
4097#[cfg(target_os = "fuchsia")]
4098impl fidl::endpoints::SynchronousProxy for CodecDelaySynchronousProxy {
4099 type Proxy = CodecDelayProxy;
4100 type Protocol = CodecDelayMarker;
4101
4102 fn from_channel(inner: fidl::Channel) -> Self {
4103 Self::new(inner)
4104 }
4105
4106 fn into_channel(self) -> fidl::Channel {
4107 self.client.into_channel()
4108 }
4109
4110 fn as_channel(&self) -> &fidl::Channel {
4111 self.client.as_channel()
4112 }
4113}
4114
4115#[cfg(target_os = "fuchsia")]
4116impl CodecDelaySynchronousProxy {
4117 pub fn new(channel: fidl::Channel) -> Self {
4118 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4119 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4120 }
4121
4122 pub fn into_channel(self) -> fidl::Channel {
4123 self.client.into_channel()
4124 }
4125
4126 pub fn wait_for_event(
4129 &self,
4130 deadline: zx::MonotonicInstant,
4131 ) -> Result<CodecDelayEvent, fidl::Error> {
4132 CodecDelayEvent::decode(self.client.wait_for_event(deadline)?)
4133 }
4134
4135 pub fn r#get_codec_local_delay_range(
4143 &self,
4144 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4145 ___deadline: zx::MonotonicInstant,
4146 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4147 let _response = self.client.send_query::<
4148 CodecDelayGetCodecLocalDelayRangeRequest,
4149 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4150 >(
4151 payload,
4152 0x1cf34fdeed80b4d,
4153 fidl::encoding::DynamicFlags::empty(),
4154 ___deadline,
4155 )?;
4156 Ok(_response.map(|x| x))
4157 }
4158}
4159
4160#[cfg(target_os = "fuchsia")]
4161impl From<CodecDelaySynchronousProxy> for zx::Handle {
4162 fn from(value: CodecDelaySynchronousProxy) -> Self {
4163 value.into_channel().into()
4164 }
4165}
4166
4167#[cfg(target_os = "fuchsia")]
4168impl From<fidl::Channel> for CodecDelaySynchronousProxy {
4169 fn from(value: fidl::Channel) -> Self {
4170 Self::new(value)
4171 }
4172}
4173
4174#[derive(Debug, Clone)]
4175pub struct CodecDelayProxy {
4176 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4177}
4178
4179impl fidl::endpoints::Proxy for CodecDelayProxy {
4180 type Protocol = CodecDelayMarker;
4181
4182 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4183 Self::new(inner)
4184 }
4185
4186 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4187 self.client.into_channel().map_err(|client| Self { client })
4188 }
4189
4190 fn as_channel(&self) -> &::fidl::AsyncChannel {
4191 self.client.as_channel()
4192 }
4193}
4194
4195impl CodecDelayProxy {
4196 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4198 let protocol_name = <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4199 Self { client: fidl::client::Client::new(channel, protocol_name) }
4200 }
4201
4202 pub fn take_event_stream(&self) -> CodecDelayEventStream {
4208 CodecDelayEventStream { event_receiver: self.client.take_event_receiver() }
4209 }
4210
4211 pub fn r#get_codec_local_delay_range(
4219 &self,
4220 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4221 ) -> fidl::client::QueryResponseFut<
4222 CodecDelayGetCodecLocalDelayRangeResult,
4223 fidl::encoding::DefaultFuchsiaResourceDialect,
4224 > {
4225 CodecDelayProxyInterface::r#get_codec_local_delay_range(self, payload)
4226 }
4227}
4228
4229impl CodecDelayProxyInterface for CodecDelayProxy {
4230 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
4231 CodecDelayGetCodecLocalDelayRangeResult,
4232 fidl::encoding::DefaultFuchsiaResourceDialect,
4233 >;
4234 fn r#get_codec_local_delay_range(
4235 &self,
4236 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
4237 ) -> Self::GetCodecLocalDelayRangeResponseFut {
4238 fn _decode(
4239 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4240 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
4241 let _response = fidl::client::decode_transaction_body::<
4242 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4243 fidl::encoding::DefaultFuchsiaResourceDialect,
4244 0x1cf34fdeed80b4d,
4245 >(_buf?)?;
4246 Ok(_response.map(|x| x))
4247 }
4248 self.client.send_query_and_decode::<
4249 CodecDelayGetCodecLocalDelayRangeRequest,
4250 CodecDelayGetCodecLocalDelayRangeResult,
4251 >(
4252 payload,
4253 0x1cf34fdeed80b4d,
4254 fidl::encoding::DynamicFlags::empty(),
4255 _decode,
4256 )
4257 }
4258}
4259
4260pub struct CodecDelayEventStream {
4261 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4262}
4263
4264impl std::marker::Unpin for CodecDelayEventStream {}
4265
4266impl futures::stream::FusedStream for CodecDelayEventStream {
4267 fn is_terminated(&self) -> bool {
4268 self.event_receiver.is_terminated()
4269 }
4270}
4271
4272impl futures::Stream for CodecDelayEventStream {
4273 type Item = Result<CodecDelayEvent, fidl::Error>;
4274
4275 fn poll_next(
4276 mut self: std::pin::Pin<&mut Self>,
4277 cx: &mut std::task::Context<'_>,
4278 ) -> std::task::Poll<Option<Self::Item>> {
4279 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4280 &mut self.event_receiver,
4281 cx
4282 )?) {
4283 Some(buf) => std::task::Poll::Ready(Some(CodecDelayEvent::decode(buf))),
4284 None => std::task::Poll::Ready(None),
4285 }
4286 }
4287}
4288
4289#[derive(Debug)]
4290pub enum CodecDelayEvent {}
4291
4292impl CodecDelayEvent {
4293 fn decode(
4295 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4296 ) -> Result<CodecDelayEvent, fidl::Error> {
4297 let (bytes, _handles) = buf.split_mut();
4298 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4299 debug_assert_eq!(tx_header.tx_id, 0);
4300 match tx_header.ordinal {
4301 _ => Err(fidl::Error::UnknownOrdinal {
4302 ordinal: tx_header.ordinal,
4303 protocol_name: <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4304 }),
4305 }
4306 }
4307}
4308
4309pub struct CodecDelayRequestStream {
4311 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4312 is_terminated: bool,
4313}
4314
4315impl std::marker::Unpin for CodecDelayRequestStream {}
4316
4317impl futures::stream::FusedStream for CodecDelayRequestStream {
4318 fn is_terminated(&self) -> bool {
4319 self.is_terminated
4320 }
4321}
4322
4323impl fidl::endpoints::RequestStream for CodecDelayRequestStream {
4324 type Protocol = CodecDelayMarker;
4325 type ControlHandle = CodecDelayControlHandle;
4326
4327 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4328 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4329 }
4330
4331 fn control_handle(&self) -> Self::ControlHandle {
4332 CodecDelayControlHandle { inner: self.inner.clone() }
4333 }
4334
4335 fn into_inner(
4336 self,
4337 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4338 {
4339 (self.inner, self.is_terminated)
4340 }
4341
4342 fn from_inner(
4343 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4344 is_terminated: bool,
4345 ) -> Self {
4346 Self { inner, is_terminated }
4347 }
4348}
4349
4350impl futures::Stream for CodecDelayRequestStream {
4351 type Item = Result<CodecDelayRequest, fidl::Error>;
4352
4353 fn poll_next(
4354 mut self: std::pin::Pin<&mut Self>,
4355 cx: &mut std::task::Context<'_>,
4356 ) -> std::task::Poll<Option<Self::Item>> {
4357 let this = &mut *self;
4358 if this.inner.check_shutdown(cx) {
4359 this.is_terminated = true;
4360 return std::task::Poll::Ready(None);
4361 }
4362 if this.is_terminated {
4363 panic!("polled CodecDelayRequestStream after completion");
4364 }
4365 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4366 |bytes, handles| {
4367 match this.inner.channel().read_etc(cx, bytes, handles) {
4368 std::task::Poll::Ready(Ok(())) => {}
4369 std::task::Poll::Pending => return std::task::Poll::Pending,
4370 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4371 this.is_terminated = true;
4372 return std::task::Poll::Ready(None);
4373 }
4374 std::task::Poll::Ready(Err(e)) => {
4375 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4376 e.into(),
4377 ))))
4378 }
4379 }
4380
4381 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4383
4384 std::task::Poll::Ready(Some(match header.ordinal {
4385 0x1cf34fdeed80b4d => {
4386 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4387 let mut req = fidl::new_empty!(
4388 CodecDelayGetCodecLocalDelayRangeRequest,
4389 fidl::encoding::DefaultFuchsiaResourceDialect
4390 );
4391 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
4392 let control_handle = CodecDelayControlHandle { inner: this.inner.clone() };
4393 Ok(CodecDelayRequest::GetCodecLocalDelayRange {
4394 payload: req,
4395 responder: CodecDelayGetCodecLocalDelayRangeResponder {
4396 control_handle: std::mem::ManuallyDrop::new(control_handle),
4397 tx_id: header.tx_id,
4398 },
4399 })
4400 }
4401 _ => Err(fidl::Error::UnknownOrdinal {
4402 ordinal: header.ordinal,
4403 protocol_name:
4404 <CodecDelayMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4405 }),
4406 }))
4407 },
4408 )
4409 }
4410}
4411
4412#[derive(Debug)]
4415pub enum CodecDelayRequest {
4416 GetCodecLocalDelayRange {
4424 payload: CodecDelayGetCodecLocalDelayRangeRequest,
4425 responder: CodecDelayGetCodecLocalDelayRangeResponder,
4426 },
4427}
4428
4429impl CodecDelayRequest {
4430 #[allow(irrefutable_let_patterns)]
4431 pub fn into_get_codec_local_delay_range(
4432 self,
4433 ) -> Option<(
4434 CodecDelayGetCodecLocalDelayRangeRequest,
4435 CodecDelayGetCodecLocalDelayRangeResponder,
4436 )> {
4437 if let CodecDelayRequest::GetCodecLocalDelayRange { payload, responder } = self {
4438 Some((payload, responder))
4439 } else {
4440 None
4441 }
4442 }
4443
4444 pub fn method_name(&self) -> &'static str {
4446 match *self {
4447 CodecDelayRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
4448 }
4449 }
4450}
4451
4452#[derive(Debug, Clone)]
4453pub struct CodecDelayControlHandle {
4454 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4455}
4456
4457impl fidl::endpoints::ControlHandle for CodecDelayControlHandle {
4458 fn shutdown(&self) {
4459 self.inner.shutdown()
4460 }
4461 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4462 self.inner.shutdown_with_epitaph(status)
4463 }
4464
4465 fn is_closed(&self) -> bool {
4466 self.inner.channel().is_closed()
4467 }
4468 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4469 self.inner.channel().on_closed()
4470 }
4471
4472 #[cfg(target_os = "fuchsia")]
4473 fn signal_peer(
4474 &self,
4475 clear_mask: zx::Signals,
4476 set_mask: zx::Signals,
4477 ) -> Result<(), zx_status::Status> {
4478 use fidl::Peered;
4479 self.inner.channel().signal_peer(clear_mask, set_mask)
4480 }
4481}
4482
4483impl CodecDelayControlHandle {}
4484
4485#[must_use = "FIDL methods require a response to be sent"]
4486#[derive(Debug)]
4487pub struct CodecDelayGetCodecLocalDelayRangeResponder {
4488 control_handle: std::mem::ManuallyDrop<CodecDelayControlHandle>,
4489 tx_id: u32,
4490}
4491
4492impl std::ops::Drop for CodecDelayGetCodecLocalDelayRangeResponder {
4496 fn drop(&mut self) {
4497 self.control_handle.shutdown();
4498 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4500 }
4501}
4502
4503impl fidl::endpoints::Responder for CodecDelayGetCodecLocalDelayRangeResponder {
4504 type ControlHandle = CodecDelayControlHandle;
4505
4506 fn control_handle(&self) -> &CodecDelayControlHandle {
4507 &self.control_handle
4508 }
4509
4510 fn drop_without_shutdown(mut self) {
4511 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4513 std::mem::forget(self);
4515 }
4516}
4517
4518impl CodecDelayGetCodecLocalDelayRangeResponder {
4519 pub fn send(
4523 self,
4524 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4525 ) -> Result<(), fidl::Error> {
4526 let _result = self.send_raw(result);
4527 if _result.is_err() {
4528 self.control_handle.shutdown();
4529 }
4530 self.drop_without_shutdown();
4531 _result
4532 }
4533
4534 pub fn send_no_shutdown_on_err(
4536 self,
4537 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4538 ) -> Result<(), fidl::Error> {
4539 let _result = self.send_raw(result);
4540 self.drop_without_shutdown();
4541 _result
4542 }
4543
4544 fn send_raw(
4545 &self,
4546 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
4547 ) -> Result<(), fidl::Error> {
4548 self.control_handle.inner.send::<fidl::encoding::ResultType<
4549 CodecDelayGetCodecLocalDelayRangeResponse,
4550 i32,
4551 >>(
4552 result,
4553 self.tx_id,
4554 0x1cf34fdeed80b4d,
4555 fidl::encoding::DynamicFlags::empty(),
4556 )
4557 }
4558}
4559
4560#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4561pub struct ConnectedIsochronousGroupMarker;
4562
4563impl fidl::endpoints::ProtocolMarker for ConnectedIsochronousGroupMarker {
4564 type Proxy = ConnectedIsochronousGroupProxy;
4565 type RequestStream = ConnectedIsochronousGroupRequestStream;
4566 #[cfg(target_os = "fuchsia")]
4567 type SynchronousProxy = ConnectedIsochronousGroupSynchronousProxy;
4568
4569 const DEBUG_NAME: &'static str = "(anonymous) ConnectedIsochronousGroup";
4570}
4571pub type ConnectedIsochronousGroupEstablishStreamsResult = Result<(), EstablishStreamsError>;
4572
4573pub trait ConnectedIsochronousGroupProxyInterface: Send + Sync {
4574 type EstablishStreamsResponseFut: std::future::Future<
4575 Output = Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error>,
4576 > + Send;
4577 fn r#establish_streams(
4578 &self,
4579 payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4580 ) -> Self::EstablishStreamsResponseFut;
4581 fn r#remove(&self) -> Result<(), fidl::Error>;
4582}
4583#[derive(Debug)]
4584#[cfg(target_os = "fuchsia")]
4585pub struct ConnectedIsochronousGroupSynchronousProxy {
4586 client: fidl::client::sync::Client,
4587}
4588
4589#[cfg(target_os = "fuchsia")]
4590impl fidl::endpoints::SynchronousProxy for ConnectedIsochronousGroupSynchronousProxy {
4591 type Proxy = ConnectedIsochronousGroupProxy;
4592 type Protocol = ConnectedIsochronousGroupMarker;
4593
4594 fn from_channel(inner: fidl::Channel) -> Self {
4595 Self::new(inner)
4596 }
4597
4598 fn into_channel(self) -> fidl::Channel {
4599 self.client.into_channel()
4600 }
4601
4602 fn as_channel(&self) -> &fidl::Channel {
4603 self.client.as_channel()
4604 }
4605}
4606
4607#[cfg(target_os = "fuchsia")]
4608impl ConnectedIsochronousGroupSynchronousProxy {
4609 pub fn new(channel: fidl::Channel) -> Self {
4610 let protocol_name =
4611 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4612 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4613 }
4614
4615 pub fn into_channel(self) -> fidl::Channel {
4616 self.client.into_channel()
4617 }
4618
4619 pub fn wait_for_event(
4622 &self,
4623 deadline: zx::MonotonicInstant,
4624 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4625 ConnectedIsochronousGroupEvent::decode(self.client.wait_for_event(deadline)?)
4626 }
4627
4628 pub fn r#establish_streams(
4637 &self,
4638 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4639 ___deadline: zx::MonotonicInstant,
4640 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4641 let _response = self.client.send_query::<
4642 ConnectedIsochronousGroupEstablishStreamsRequest,
4643 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EstablishStreamsError>,
4644 >(
4645 payload,
4646 0xc7296c5edb4dacc,
4647 fidl::encoding::DynamicFlags::FLEXIBLE,
4648 ___deadline,
4649 )?
4650 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4651 Ok(_response.map(|x| x))
4652 }
4653
4654 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4657 self.client.send::<fidl::encoding::EmptyPayload>(
4658 (),
4659 0xbed433babd20503,
4660 fidl::encoding::DynamicFlags::FLEXIBLE,
4661 )
4662 }
4663}
4664
4665#[cfg(target_os = "fuchsia")]
4666impl From<ConnectedIsochronousGroupSynchronousProxy> for zx::Handle {
4667 fn from(value: ConnectedIsochronousGroupSynchronousProxy) -> Self {
4668 value.into_channel().into()
4669 }
4670}
4671
4672#[cfg(target_os = "fuchsia")]
4673impl From<fidl::Channel> for ConnectedIsochronousGroupSynchronousProxy {
4674 fn from(value: fidl::Channel) -> Self {
4675 Self::new(value)
4676 }
4677}
4678
4679#[derive(Debug, Clone)]
4680pub struct ConnectedIsochronousGroupProxy {
4681 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4682}
4683
4684impl fidl::endpoints::Proxy for ConnectedIsochronousGroupProxy {
4685 type Protocol = ConnectedIsochronousGroupMarker;
4686
4687 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4688 Self::new(inner)
4689 }
4690
4691 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4692 self.client.into_channel().map_err(|client| Self { client })
4693 }
4694
4695 fn as_channel(&self) -> &::fidl::AsyncChannel {
4696 self.client.as_channel()
4697 }
4698}
4699
4700impl ConnectedIsochronousGroupProxy {
4701 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4703 let protocol_name =
4704 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4705 Self { client: fidl::client::Client::new(channel, protocol_name) }
4706 }
4707
4708 pub fn take_event_stream(&self) -> ConnectedIsochronousGroupEventStream {
4714 ConnectedIsochronousGroupEventStream { event_receiver: self.client.take_event_receiver() }
4715 }
4716
4717 pub fn r#establish_streams(
4726 &self,
4727 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4728 ) -> fidl::client::QueryResponseFut<
4729 ConnectedIsochronousGroupEstablishStreamsResult,
4730 fidl::encoding::DefaultFuchsiaResourceDialect,
4731 > {
4732 ConnectedIsochronousGroupProxyInterface::r#establish_streams(self, payload)
4733 }
4734
4735 pub fn r#remove(&self) -> Result<(), fidl::Error> {
4738 ConnectedIsochronousGroupProxyInterface::r#remove(self)
4739 }
4740}
4741
4742impl ConnectedIsochronousGroupProxyInterface for ConnectedIsochronousGroupProxy {
4743 type EstablishStreamsResponseFut = fidl::client::QueryResponseFut<
4744 ConnectedIsochronousGroupEstablishStreamsResult,
4745 fidl::encoding::DefaultFuchsiaResourceDialect,
4746 >;
4747 fn r#establish_streams(
4748 &self,
4749 mut payload: &ConnectedIsochronousGroupEstablishStreamsRequest,
4750 ) -> Self::EstablishStreamsResponseFut {
4751 fn _decode(
4752 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4753 ) -> Result<ConnectedIsochronousGroupEstablishStreamsResult, fidl::Error> {
4754 let _response = fidl::client::decode_transaction_body::<
4755 fidl::encoding::FlexibleResultType<
4756 fidl::encoding::EmptyStruct,
4757 EstablishStreamsError,
4758 >,
4759 fidl::encoding::DefaultFuchsiaResourceDialect,
4760 0xc7296c5edb4dacc,
4761 >(_buf?)?
4762 .into_result::<ConnectedIsochronousGroupMarker>("establish_streams")?;
4763 Ok(_response.map(|x| x))
4764 }
4765 self.client.send_query_and_decode::<
4766 ConnectedIsochronousGroupEstablishStreamsRequest,
4767 ConnectedIsochronousGroupEstablishStreamsResult,
4768 >(
4769 payload,
4770 0xc7296c5edb4dacc,
4771 fidl::encoding::DynamicFlags::FLEXIBLE,
4772 _decode,
4773 )
4774 }
4775
4776 fn r#remove(&self) -> Result<(), fidl::Error> {
4777 self.client.send::<fidl::encoding::EmptyPayload>(
4778 (),
4779 0xbed433babd20503,
4780 fidl::encoding::DynamicFlags::FLEXIBLE,
4781 )
4782 }
4783}
4784
4785pub struct ConnectedIsochronousGroupEventStream {
4786 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4787}
4788
4789impl std::marker::Unpin for ConnectedIsochronousGroupEventStream {}
4790
4791impl futures::stream::FusedStream for ConnectedIsochronousGroupEventStream {
4792 fn is_terminated(&self) -> bool {
4793 self.event_receiver.is_terminated()
4794 }
4795}
4796
4797impl futures::Stream for ConnectedIsochronousGroupEventStream {
4798 type Item = Result<ConnectedIsochronousGroupEvent, fidl::Error>;
4799
4800 fn poll_next(
4801 mut self: std::pin::Pin<&mut Self>,
4802 cx: &mut std::task::Context<'_>,
4803 ) -> std::task::Poll<Option<Self::Item>> {
4804 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4805 &mut self.event_receiver,
4806 cx
4807 )?) {
4808 Some(buf) => std::task::Poll::Ready(Some(ConnectedIsochronousGroupEvent::decode(buf))),
4809 None => std::task::Poll::Ready(None),
4810 }
4811 }
4812}
4813
4814#[derive(Debug)]
4815pub enum ConnectedIsochronousGroupEvent {
4816 #[non_exhaustive]
4817 _UnknownEvent {
4818 ordinal: u64,
4820 },
4821}
4822
4823impl ConnectedIsochronousGroupEvent {
4824 fn decode(
4826 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4827 ) -> Result<ConnectedIsochronousGroupEvent, fidl::Error> {
4828 let (bytes, _handles) = buf.split_mut();
4829 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4830 debug_assert_eq!(tx_header.tx_id, 0);
4831 match tx_header.ordinal {
4832 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4833 Ok(ConnectedIsochronousGroupEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4834 }
4835 _ => Err(fidl::Error::UnknownOrdinal {
4836 ordinal: tx_header.ordinal,
4837 protocol_name:
4838 <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4839 }),
4840 }
4841 }
4842}
4843
4844pub struct ConnectedIsochronousGroupRequestStream {
4846 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4847 is_terminated: bool,
4848}
4849
4850impl std::marker::Unpin for ConnectedIsochronousGroupRequestStream {}
4851
4852impl futures::stream::FusedStream for ConnectedIsochronousGroupRequestStream {
4853 fn is_terminated(&self) -> bool {
4854 self.is_terminated
4855 }
4856}
4857
4858impl fidl::endpoints::RequestStream for ConnectedIsochronousGroupRequestStream {
4859 type Protocol = ConnectedIsochronousGroupMarker;
4860 type ControlHandle = ConnectedIsochronousGroupControlHandle;
4861
4862 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4863 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4864 }
4865
4866 fn control_handle(&self) -> Self::ControlHandle {
4867 ConnectedIsochronousGroupControlHandle { inner: self.inner.clone() }
4868 }
4869
4870 fn into_inner(
4871 self,
4872 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4873 {
4874 (self.inner, self.is_terminated)
4875 }
4876
4877 fn from_inner(
4878 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4879 is_terminated: bool,
4880 ) -> Self {
4881 Self { inner, is_terminated }
4882 }
4883}
4884
4885impl futures::Stream for ConnectedIsochronousGroupRequestStream {
4886 type Item = Result<ConnectedIsochronousGroupRequest, fidl::Error>;
4887
4888 fn poll_next(
4889 mut self: std::pin::Pin<&mut Self>,
4890 cx: &mut std::task::Context<'_>,
4891 ) -> std::task::Poll<Option<Self::Item>> {
4892 let this = &mut *self;
4893 if this.inner.check_shutdown(cx) {
4894 this.is_terminated = true;
4895 return std::task::Poll::Ready(None);
4896 }
4897 if this.is_terminated {
4898 panic!("polled ConnectedIsochronousGroupRequestStream after completion");
4899 }
4900 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4901 |bytes, handles| {
4902 match this.inner.channel().read_etc(cx, bytes, handles) {
4903 std::task::Poll::Ready(Ok(())) => {}
4904 std::task::Poll::Pending => return std::task::Poll::Pending,
4905 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4906 this.is_terminated = true;
4907 return std::task::Poll::Ready(None);
4908 }
4909 std::task::Poll::Ready(Err(e)) => {
4910 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4911 e.into(),
4912 ))))
4913 }
4914 }
4915
4916 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4918
4919 std::task::Poll::Ready(Some(match header.ordinal {
4920 0xc7296c5edb4dacc => {
4921 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4922 let mut req = fidl::new_empty!(ConnectedIsochronousGroupEstablishStreamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4923 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectedIsochronousGroupEstablishStreamsRequest>(&header, _body_bytes, handles, &mut req)?;
4924 let control_handle = ConnectedIsochronousGroupControlHandle {
4925 inner: this.inner.clone(),
4926 };
4927 Ok(ConnectedIsochronousGroupRequest::EstablishStreams {payload: req,
4928 responder: ConnectedIsochronousGroupEstablishStreamsResponder {
4929 control_handle: std::mem::ManuallyDrop::new(control_handle),
4930 tx_id: header.tx_id,
4931 },
4932 })
4933 }
4934 0xbed433babd20503 => {
4935 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4936 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4937 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4938 let control_handle = ConnectedIsochronousGroupControlHandle {
4939 inner: this.inner.clone(),
4940 };
4941 Ok(ConnectedIsochronousGroupRequest::Remove {
4942 control_handle,
4943 })
4944 }
4945 _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4946 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
4947 ordinal: header.ordinal,
4948 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
4949 method_type: fidl::MethodType::OneWay,
4950 })
4951 }
4952 _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4953 this.inner.send_framework_err(
4954 fidl::encoding::FrameworkErr::UnknownMethod,
4955 header.tx_id,
4956 header.ordinal,
4957 header.dynamic_flags(),
4958 (bytes, handles),
4959 )?;
4960 Ok(ConnectedIsochronousGroupRequest::_UnknownMethod {
4961 ordinal: header.ordinal,
4962 control_handle: ConnectedIsochronousGroupControlHandle { inner: this.inner.clone() },
4963 method_type: fidl::MethodType::TwoWay,
4964 })
4965 }
4966 _ => Err(fidl::Error::UnknownOrdinal {
4967 ordinal: header.ordinal,
4968 protocol_name: <ConnectedIsochronousGroupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4969 }),
4970 }))
4971 },
4972 )
4973 }
4974}
4975
4976#[derive(Debug)]
4977pub enum ConnectedIsochronousGroupRequest {
4978 EstablishStreams {
4987 payload: ConnectedIsochronousGroupEstablishStreamsRequest,
4988 responder: ConnectedIsochronousGroupEstablishStreamsResponder,
4989 },
4990 Remove { control_handle: ConnectedIsochronousGroupControlHandle },
4993 #[non_exhaustive]
4995 _UnknownMethod {
4996 ordinal: u64,
4998 control_handle: ConnectedIsochronousGroupControlHandle,
4999 method_type: fidl::MethodType,
5000 },
5001}
5002
5003impl ConnectedIsochronousGroupRequest {
5004 #[allow(irrefutable_let_patterns)]
5005 pub fn into_establish_streams(
5006 self,
5007 ) -> Option<(
5008 ConnectedIsochronousGroupEstablishStreamsRequest,
5009 ConnectedIsochronousGroupEstablishStreamsResponder,
5010 )> {
5011 if let ConnectedIsochronousGroupRequest::EstablishStreams { payload, responder } = self {
5012 Some((payload, responder))
5013 } else {
5014 None
5015 }
5016 }
5017
5018 #[allow(irrefutable_let_patterns)]
5019 pub fn into_remove(self) -> Option<(ConnectedIsochronousGroupControlHandle)> {
5020 if let ConnectedIsochronousGroupRequest::Remove { control_handle } = self {
5021 Some((control_handle))
5022 } else {
5023 None
5024 }
5025 }
5026
5027 pub fn method_name(&self) -> &'static str {
5029 match *self {
5030 ConnectedIsochronousGroupRequest::EstablishStreams { .. } => "establish_streams",
5031 ConnectedIsochronousGroupRequest::Remove { .. } => "remove",
5032 ConnectedIsochronousGroupRequest::_UnknownMethod {
5033 method_type: fidl::MethodType::OneWay,
5034 ..
5035 } => "unknown one-way method",
5036 ConnectedIsochronousGroupRequest::_UnknownMethod {
5037 method_type: fidl::MethodType::TwoWay,
5038 ..
5039 } => "unknown two-way method",
5040 }
5041 }
5042}
5043
5044#[derive(Debug, Clone)]
5045pub struct ConnectedIsochronousGroupControlHandle {
5046 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5047}
5048
5049impl fidl::endpoints::ControlHandle for ConnectedIsochronousGroupControlHandle {
5050 fn shutdown(&self) {
5051 self.inner.shutdown()
5052 }
5053 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5054 self.inner.shutdown_with_epitaph(status)
5055 }
5056
5057 fn is_closed(&self) -> bool {
5058 self.inner.channel().is_closed()
5059 }
5060 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5061 self.inner.channel().on_closed()
5062 }
5063
5064 #[cfg(target_os = "fuchsia")]
5065 fn signal_peer(
5066 &self,
5067 clear_mask: zx::Signals,
5068 set_mask: zx::Signals,
5069 ) -> Result<(), zx_status::Status> {
5070 use fidl::Peered;
5071 self.inner.channel().signal_peer(clear_mask, set_mask)
5072 }
5073}
5074
5075impl ConnectedIsochronousGroupControlHandle {}
5076
5077#[must_use = "FIDL methods require a response to be sent"]
5078#[derive(Debug)]
5079pub struct ConnectedIsochronousGroupEstablishStreamsResponder {
5080 control_handle: std::mem::ManuallyDrop<ConnectedIsochronousGroupControlHandle>,
5081 tx_id: u32,
5082}
5083
5084impl std::ops::Drop for ConnectedIsochronousGroupEstablishStreamsResponder {
5088 fn drop(&mut self) {
5089 self.control_handle.shutdown();
5090 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5092 }
5093}
5094
5095impl fidl::endpoints::Responder for ConnectedIsochronousGroupEstablishStreamsResponder {
5096 type ControlHandle = ConnectedIsochronousGroupControlHandle;
5097
5098 fn control_handle(&self) -> &ConnectedIsochronousGroupControlHandle {
5099 &self.control_handle
5100 }
5101
5102 fn drop_without_shutdown(mut self) {
5103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5105 std::mem::forget(self);
5107 }
5108}
5109
5110impl ConnectedIsochronousGroupEstablishStreamsResponder {
5111 pub fn send(self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5115 let _result = self.send_raw(result);
5116 if _result.is_err() {
5117 self.control_handle.shutdown();
5118 }
5119 self.drop_without_shutdown();
5120 _result
5121 }
5122
5123 pub fn send_no_shutdown_on_err(
5125 self,
5126 mut result: Result<(), EstablishStreamsError>,
5127 ) -> Result<(), fidl::Error> {
5128 let _result = self.send_raw(result);
5129 self.drop_without_shutdown();
5130 _result
5131 }
5132
5133 fn send_raw(&self, mut result: Result<(), EstablishStreamsError>) -> Result<(), fidl::Error> {
5134 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5135 fidl::encoding::EmptyStruct,
5136 EstablishStreamsError,
5137 >>(
5138 fidl::encoding::FlexibleResult::new(result),
5139 self.tx_id,
5140 0xc7296c5edb4dacc,
5141 fidl::encoding::DynamicFlags::FLEXIBLE,
5142 )
5143 }
5144}
5145
5146#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5147pub struct ConnectionMarker;
5148
5149impl fidl::endpoints::ProtocolMarker for ConnectionMarker {
5150 type Proxy = ConnectionProxy;
5151 type RequestStream = ConnectionRequestStream;
5152 #[cfg(target_os = "fuchsia")]
5153 type SynchronousProxy = ConnectionSynchronousProxy;
5154
5155 const DEBUG_NAME: &'static str = "(anonymous) Connection";
5156}
5157
5158pub trait ConnectionProxyInterface: Send + Sync {
5159 type GetCodecLocalDelayRangeResponseFut: std::future::Future<Output = Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error>>
5160 + Send;
5161 fn r#get_codec_local_delay_range(
5162 &self,
5163 payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5164 ) -> Self::GetCodecLocalDelayRangeResponseFut;
5165 fn r#request_gatt_client(
5166 &self,
5167 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5168 ) -> Result<(), fidl::Error>;
5169 fn r#accept_cis(&self, payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error>;
5170 fn r#connect_l2cap(&self, payload: ConnectionConnectL2capRequest) -> Result<(), fidl::Error>;
5171}
5172#[derive(Debug)]
5173#[cfg(target_os = "fuchsia")]
5174pub struct ConnectionSynchronousProxy {
5175 client: fidl::client::sync::Client,
5176}
5177
5178#[cfg(target_os = "fuchsia")]
5179impl fidl::endpoints::SynchronousProxy for ConnectionSynchronousProxy {
5180 type Proxy = ConnectionProxy;
5181 type Protocol = ConnectionMarker;
5182
5183 fn from_channel(inner: fidl::Channel) -> Self {
5184 Self::new(inner)
5185 }
5186
5187 fn into_channel(self) -> fidl::Channel {
5188 self.client.into_channel()
5189 }
5190
5191 fn as_channel(&self) -> &fidl::Channel {
5192 self.client.as_channel()
5193 }
5194}
5195
5196#[cfg(target_os = "fuchsia")]
5197impl ConnectionSynchronousProxy {
5198 pub fn new(channel: fidl::Channel) -> Self {
5199 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5200 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5201 }
5202
5203 pub fn into_channel(self) -> fidl::Channel {
5204 self.client.into_channel()
5205 }
5206
5207 pub fn wait_for_event(
5210 &self,
5211 deadline: zx::MonotonicInstant,
5212 ) -> Result<ConnectionEvent, fidl::Error> {
5213 ConnectionEvent::decode(self.client.wait_for_event(deadline)?)
5214 }
5215
5216 pub fn r#get_codec_local_delay_range(
5224 &self,
5225 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5226 ___deadline: zx::MonotonicInstant,
5227 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5228 let _response = self.client.send_query::<
5229 CodecDelayGetCodecLocalDelayRangeRequest,
5230 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5231 >(
5232 payload,
5233 0x1cf34fdeed80b4d,
5234 fidl::encoding::DynamicFlags::empty(),
5235 ___deadline,
5236 )?;
5237 Ok(_response.map(|x| x))
5238 }
5239
5240 pub fn r#request_gatt_client(
5244 &self,
5245 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5246 ) -> Result<(), fidl::Error> {
5247 self.client.send::<ConnectionRequestGattClientRequest>(
5248 (client,),
5249 0x2a670e0fec6ccc6b,
5250 fidl::encoding::DynamicFlags::empty(),
5251 )
5252 }
5253
5254 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5269 self.client.send::<ConnectionAcceptCisRequest>(
5270 &mut payload,
5271 0x7e6338c237088144,
5272 fidl::encoding::DynamicFlags::empty(),
5273 )
5274 }
5275
5276 pub fn r#connect_l2cap(
5278 &self,
5279 mut payload: ConnectionConnectL2capRequest,
5280 ) -> Result<(), fidl::Error> {
5281 self.client.send::<ConnectionConnectL2capRequest>(
5282 &mut payload,
5283 0x12351316feaebce9,
5284 fidl::encoding::DynamicFlags::empty(),
5285 )
5286 }
5287}
5288
5289#[cfg(target_os = "fuchsia")]
5290impl From<ConnectionSynchronousProxy> for zx::Handle {
5291 fn from(value: ConnectionSynchronousProxy) -> Self {
5292 value.into_channel().into()
5293 }
5294}
5295
5296#[cfg(target_os = "fuchsia")]
5297impl From<fidl::Channel> for ConnectionSynchronousProxy {
5298 fn from(value: fidl::Channel) -> Self {
5299 Self::new(value)
5300 }
5301}
5302
5303#[derive(Debug, Clone)]
5304pub struct ConnectionProxy {
5305 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5306}
5307
5308impl fidl::endpoints::Proxy for ConnectionProxy {
5309 type Protocol = ConnectionMarker;
5310
5311 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5312 Self::new(inner)
5313 }
5314
5315 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5316 self.client.into_channel().map_err(|client| Self { client })
5317 }
5318
5319 fn as_channel(&self) -> &::fidl::AsyncChannel {
5320 self.client.as_channel()
5321 }
5322}
5323
5324impl ConnectionProxy {
5325 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5327 let protocol_name = <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5328 Self { client: fidl::client::Client::new(channel, protocol_name) }
5329 }
5330
5331 pub fn take_event_stream(&self) -> ConnectionEventStream {
5337 ConnectionEventStream { event_receiver: self.client.take_event_receiver() }
5338 }
5339
5340 pub fn r#get_codec_local_delay_range(
5348 &self,
5349 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5350 ) -> fidl::client::QueryResponseFut<
5351 CodecDelayGetCodecLocalDelayRangeResult,
5352 fidl::encoding::DefaultFuchsiaResourceDialect,
5353 > {
5354 ConnectionProxyInterface::r#get_codec_local_delay_range(self, payload)
5355 }
5356
5357 pub fn r#request_gatt_client(
5361 &self,
5362 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5363 ) -> Result<(), fidl::Error> {
5364 ConnectionProxyInterface::r#request_gatt_client(self, client)
5365 }
5366
5367 pub fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5382 ConnectionProxyInterface::r#accept_cis(self, payload)
5383 }
5384
5385 pub fn r#connect_l2cap(
5387 &self,
5388 mut payload: ConnectionConnectL2capRequest,
5389 ) -> Result<(), fidl::Error> {
5390 ConnectionProxyInterface::r#connect_l2cap(self, payload)
5391 }
5392}
5393
5394impl ConnectionProxyInterface for ConnectionProxy {
5395 type GetCodecLocalDelayRangeResponseFut = fidl::client::QueryResponseFut<
5396 CodecDelayGetCodecLocalDelayRangeResult,
5397 fidl::encoding::DefaultFuchsiaResourceDialect,
5398 >;
5399 fn r#get_codec_local_delay_range(
5400 &self,
5401 mut payload: &CodecDelayGetCodecLocalDelayRangeRequest,
5402 ) -> Self::GetCodecLocalDelayRangeResponseFut {
5403 fn _decode(
5404 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5405 ) -> Result<CodecDelayGetCodecLocalDelayRangeResult, fidl::Error> {
5406 let _response = fidl::client::decode_transaction_body::<
5407 fidl::encoding::ResultType<CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5408 fidl::encoding::DefaultFuchsiaResourceDialect,
5409 0x1cf34fdeed80b4d,
5410 >(_buf?)?;
5411 Ok(_response.map(|x| x))
5412 }
5413 self.client.send_query_and_decode::<
5414 CodecDelayGetCodecLocalDelayRangeRequest,
5415 CodecDelayGetCodecLocalDelayRangeResult,
5416 >(
5417 payload,
5418 0x1cf34fdeed80b4d,
5419 fidl::encoding::DynamicFlags::empty(),
5420 _decode,
5421 )
5422 }
5423
5424 fn r#request_gatt_client(
5425 &self,
5426 mut client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5427 ) -> Result<(), fidl::Error> {
5428 self.client.send::<ConnectionRequestGattClientRequest>(
5429 (client,),
5430 0x2a670e0fec6ccc6b,
5431 fidl::encoding::DynamicFlags::empty(),
5432 )
5433 }
5434
5435 fn r#accept_cis(&self, mut payload: ConnectionAcceptCisRequest) -> Result<(), fidl::Error> {
5436 self.client.send::<ConnectionAcceptCisRequest>(
5437 &mut payload,
5438 0x7e6338c237088144,
5439 fidl::encoding::DynamicFlags::empty(),
5440 )
5441 }
5442
5443 fn r#connect_l2cap(
5444 &self,
5445 mut payload: ConnectionConnectL2capRequest,
5446 ) -> Result<(), fidl::Error> {
5447 self.client.send::<ConnectionConnectL2capRequest>(
5448 &mut payload,
5449 0x12351316feaebce9,
5450 fidl::encoding::DynamicFlags::empty(),
5451 )
5452 }
5453}
5454
5455pub struct ConnectionEventStream {
5456 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5457}
5458
5459impl std::marker::Unpin for ConnectionEventStream {}
5460
5461impl futures::stream::FusedStream for ConnectionEventStream {
5462 fn is_terminated(&self) -> bool {
5463 self.event_receiver.is_terminated()
5464 }
5465}
5466
5467impl futures::Stream for ConnectionEventStream {
5468 type Item = Result<ConnectionEvent, fidl::Error>;
5469
5470 fn poll_next(
5471 mut self: std::pin::Pin<&mut Self>,
5472 cx: &mut std::task::Context<'_>,
5473 ) -> std::task::Poll<Option<Self::Item>> {
5474 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5475 &mut self.event_receiver,
5476 cx
5477 )?) {
5478 Some(buf) => std::task::Poll::Ready(Some(ConnectionEvent::decode(buf))),
5479 None => std::task::Poll::Ready(None),
5480 }
5481 }
5482}
5483
5484#[derive(Debug)]
5485pub enum ConnectionEvent {}
5486
5487impl ConnectionEvent {
5488 fn decode(
5490 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5491 ) -> Result<ConnectionEvent, fidl::Error> {
5492 let (bytes, _handles) = buf.split_mut();
5493 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5494 debug_assert_eq!(tx_header.tx_id, 0);
5495 match tx_header.ordinal {
5496 _ => Err(fidl::Error::UnknownOrdinal {
5497 ordinal: tx_header.ordinal,
5498 protocol_name: <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5499 }),
5500 }
5501 }
5502}
5503
5504pub struct ConnectionRequestStream {
5506 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5507 is_terminated: bool,
5508}
5509
5510impl std::marker::Unpin for ConnectionRequestStream {}
5511
5512impl futures::stream::FusedStream for ConnectionRequestStream {
5513 fn is_terminated(&self) -> bool {
5514 self.is_terminated
5515 }
5516}
5517
5518impl fidl::endpoints::RequestStream for ConnectionRequestStream {
5519 type Protocol = ConnectionMarker;
5520 type ControlHandle = ConnectionControlHandle;
5521
5522 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5523 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5524 }
5525
5526 fn control_handle(&self) -> Self::ControlHandle {
5527 ConnectionControlHandle { inner: self.inner.clone() }
5528 }
5529
5530 fn into_inner(
5531 self,
5532 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5533 {
5534 (self.inner, self.is_terminated)
5535 }
5536
5537 fn from_inner(
5538 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5539 is_terminated: bool,
5540 ) -> Self {
5541 Self { inner, is_terminated }
5542 }
5543}
5544
5545impl futures::Stream for ConnectionRequestStream {
5546 type Item = Result<ConnectionRequest, fidl::Error>;
5547
5548 fn poll_next(
5549 mut self: std::pin::Pin<&mut Self>,
5550 cx: &mut std::task::Context<'_>,
5551 ) -> std::task::Poll<Option<Self::Item>> {
5552 let this = &mut *self;
5553 if this.inner.check_shutdown(cx) {
5554 this.is_terminated = true;
5555 return std::task::Poll::Ready(None);
5556 }
5557 if this.is_terminated {
5558 panic!("polled ConnectionRequestStream after completion");
5559 }
5560 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5561 |bytes, handles| {
5562 match this.inner.channel().read_etc(cx, bytes, handles) {
5563 std::task::Poll::Ready(Ok(())) => {}
5564 std::task::Poll::Pending => return std::task::Poll::Pending,
5565 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5566 this.is_terminated = true;
5567 return std::task::Poll::Ready(None);
5568 }
5569 std::task::Poll::Ready(Err(e)) => {
5570 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5571 e.into(),
5572 ))))
5573 }
5574 }
5575
5576 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5578
5579 std::task::Poll::Ready(Some(match header.ordinal {
5580 0x1cf34fdeed80b4d => {
5581 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5582 let mut req = fidl::new_empty!(
5583 CodecDelayGetCodecLocalDelayRangeRequest,
5584 fidl::encoding::DefaultFuchsiaResourceDialect
5585 );
5586 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecDelayGetCodecLocalDelayRangeRequest>(&header, _body_bytes, handles, &mut req)?;
5587 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5588 Ok(ConnectionRequest::GetCodecLocalDelayRange {
5589 payload: req,
5590 responder: ConnectionGetCodecLocalDelayRangeResponder {
5591 control_handle: std::mem::ManuallyDrop::new(control_handle),
5592 tx_id: header.tx_id,
5593 },
5594 })
5595 }
5596 0x2a670e0fec6ccc6b => {
5597 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5598 let mut req = fidl::new_empty!(
5599 ConnectionRequestGattClientRequest,
5600 fidl::encoding::DefaultFuchsiaResourceDialect
5601 );
5602 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionRequestGattClientRequest>(&header, _body_bytes, handles, &mut req)?;
5603 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5604 Ok(ConnectionRequest::RequestGattClient {
5605 client: req.client,
5606
5607 control_handle,
5608 })
5609 }
5610 0x7e6338c237088144 => {
5611 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5612 let mut req = fidl::new_empty!(
5613 ConnectionAcceptCisRequest,
5614 fidl::encoding::DefaultFuchsiaResourceDialect
5615 );
5616 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionAcceptCisRequest>(&header, _body_bytes, handles, &mut req)?;
5617 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5618 Ok(ConnectionRequest::AcceptCis { payload: req, control_handle })
5619 }
5620 0x12351316feaebce9 => {
5621 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5622 let mut req = fidl::new_empty!(
5623 ConnectionConnectL2capRequest,
5624 fidl::encoding::DefaultFuchsiaResourceDialect
5625 );
5626 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionConnectL2capRequest>(&header, _body_bytes, handles, &mut req)?;
5627 let control_handle = ConnectionControlHandle { inner: this.inner.clone() };
5628 Ok(ConnectionRequest::ConnectL2cap { payload: req, control_handle })
5629 }
5630 _ => Err(fidl::Error::UnknownOrdinal {
5631 ordinal: header.ordinal,
5632 protocol_name:
5633 <ConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5634 }),
5635 }))
5636 },
5637 )
5638 }
5639}
5640
5641#[derive(Debug)]
5647pub enum ConnectionRequest {
5648 GetCodecLocalDelayRange {
5656 payload: CodecDelayGetCodecLocalDelayRangeRequest,
5657 responder: ConnectionGetCodecLocalDelayRangeResponder,
5658 },
5659 RequestGattClient {
5663 client: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5664 control_handle: ConnectionControlHandle,
5665 },
5666 AcceptCis { payload: ConnectionAcceptCisRequest, control_handle: ConnectionControlHandle },
5681 ConnectL2cap { payload: ConnectionConnectL2capRequest, control_handle: ConnectionControlHandle },
5683}
5684
5685impl ConnectionRequest {
5686 #[allow(irrefutable_let_patterns)]
5687 pub fn into_get_codec_local_delay_range(
5688 self,
5689 ) -> Option<(
5690 CodecDelayGetCodecLocalDelayRangeRequest,
5691 ConnectionGetCodecLocalDelayRangeResponder,
5692 )> {
5693 if let ConnectionRequest::GetCodecLocalDelayRange { payload, responder } = self {
5694 Some((payload, responder))
5695 } else {
5696 None
5697 }
5698 }
5699
5700 #[allow(irrefutable_let_patterns)]
5701 pub fn into_request_gatt_client(
5702 self,
5703 ) -> Option<(
5704 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
5705 ConnectionControlHandle,
5706 )> {
5707 if let ConnectionRequest::RequestGattClient { client, control_handle } = self {
5708 Some((client, control_handle))
5709 } else {
5710 None
5711 }
5712 }
5713
5714 #[allow(irrefutable_let_patterns)]
5715 pub fn into_accept_cis(self) -> Option<(ConnectionAcceptCisRequest, ConnectionControlHandle)> {
5716 if let ConnectionRequest::AcceptCis { payload, control_handle } = self {
5717 Some((payload, control_handle))
5718 } else {
5719 None
5720 }
5721 }
5722
5723 #[allow(irrefutable_let_patterns)]
5724 pub fn into_connect_l2cap(
5725 self,
5726 ) -> Option<(ConnectionConnectL2capRequest, ConnectionControlHandle)> {
5727 if let ConnectionRequest::ConnectL2cap { payload, control_handle } = self {
5728 Some((payload, control_handle))
5729 } else {
5730 None
5731 }
5732 }
5733
5734 pub fn method_name(&self) -> &'static str {
5736 match *self {
5737 ConnectionRequest::GetCodecLocalDelayRange { .. } => "get_codec_local_delay_range",
5738 ConnectionRequest::RequestGattClient { .. } => "request_gatt_client",
5739 ConnectionRequest::AcceptCis { .. } => "accept_cis",
5740 ConnectionRequest::ConnectL2cap { .. } => "connect_l2cap",
5741 }
5742 }
5743}
5744
5745#[derive(Debug, Clone)]
5746pub struct ConnectionControlHandle {
5747 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5748}
5749
5750impl fidl::endpoints::ControlHandle for ConnectionControlHandle {
5751 fn shutdown(&self) {
5752 self.inner.shutdown()
5753 }
5754 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5755 self.inner.shutdown_with_epitaph(status)
5756 }
5757
5758 fn is_closed(&self) -> bool {
5759 self.inner.channel().is_closed()
5760 }
5761 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5762 self.inner.channel().on_closed()
5763 }
5764
5765 #[cfg(target_os = "fuchsia")]
5766 fn signal_peer(
5767 &self,
5768 clear_mask: zx::Signals,
5769 set_mask: zx::Signals,
5770 ) -> Result<(), zx_status::Status> {
5771 use fidl::Peered;
5772 self.inner.channel().signal_peer(clear_mask, set_mask)
5773 }
5774}
5775
5776impl ConnectionControlHandle {}
5777
5778#[must_use = "FIDL methods require a response to be sent"]
5779#[derive(Debug)]
5780pub struct ConnectionGetCodecLocalDelayRangeResponder {
5781 control_handle: std::mem::ManuallyDrop<ConnectionControlHandle>,
5782 tx_id: u32,
5783}
5784
5785impl std::ops::Drop for ConnectionGetCodecLocalDelayRangeResponder {
5789 fn drop(&mut self) {
5790 self.control_handle.shutdown();
5791 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5793 }
5794}
5795
5796impl fidl::endpoints::Responder for ConnectionGetCodecLocalDelayRangeResponder {
5797 type ControlHandle = ConnectionControlHandle;
5798
5799 fn control_handle(&self) -> &ConnectionControlHandle {
5800 &self.control_handle
5801 }
5802
5803 fn drop_without_shutdown(mut self) {
5804 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5806 std::mem::forget(self);
5808 }
5809}
5810
5811impl ConnectionGetCodecLocalDelayRangeResponder {
5812 pub fn send(
5816 self,
5817 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5818 ) -> Result<(), fidl::Error> {
5819 let _result = self.send_raw(result);
5820 if _result.is_err() {
5821 self.control_handle.shutdown();
5822 }
5823 self.drop_without_shutdown();
5824 _result
5825 }
5826
5827 pub fn send_no_shutdown_on_err(
5829 self,
5830 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5831 ) -> Result<(), fidl::Error> {
5832 let _result = self.send_raw(result);
5833 self.drop_without_shutdown();
5834 _result
5835 }
5836
5837 fn send_raw(
5838 &self,
5839 mut result: Result<&CodecDelayGetCodecLocalDelayRangeResponse, i32>,
5840 ) -> Result<(), fidl::Error> {
5841 self.control_handle.inner.send::<fidl::encoding::ResultType<
5842 CodecDelayGetCodecLocalDelayRangeResponse,
5843 i32,
5844 >>(
5845 result,
5846 self.tx_id,
5847 0x1cf34fdeed80b4d,
5848 fidl::encoding::DynamicFlags::empty(),
5849 )
5850 }
5851}
5852
5853#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5854pub struct IsochronousStreamMarker;
5855
5856impl fidl::endpoints::ProtocolMarker for IsochronousStreamMarker {
5857 type Proxy = IsochronousStreamProxy;
5858 type RequestStream = IsochronousStreamRequestStream;
5859 #[cfg(target_os = "fuchsia")]
5860 type SynchronousProxy = IsochronousStreamSynchronousProxy;
5861
5862 const DEBUG_NAME: &'static str = "(anonymous) IsochronousStream";
5863}
5864pub type IsochronousStreamSetupDataPathResult = Result<(), i32>;
5865pub type IsochronousStreamWriteResult = Result<(), i32>;
5866
5867pub trait IsochronousStreamProxyInterface: Send + Sync {
5868 type SetupDataPathResponseFut: std::future::Future<Output = Result<IsochronousStreamSetupDataPathResult, fidl::Error>>
5869 + Send;
5870 fn r#setup_data_path(
5871 &self,
5872 payload: &IsochronousStreamSetupDataPathRequest,
5873 ) -> Self::SetupDataPathResponseFut;
5874 type ReadResponseFut: std::future::Future<Output = Result<IsochronousStreamReadResponse, fidl::Error>>
5875 + Send;
5876 fn r#read(&self) -> Self::ReadResponseFut;
5877 type WriteResponseFut: std::future::Future<Output = Result<IsochronousStreamWriteResult, fidl::Error>>
5878 + Send;
5879 fn r#write(&self, payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut;
5880}
5881#[derive(Debug)]
5882#[cfg(target_os = "fuchsia")]
5883pub struct IsochronousStreamSynchronousProxy {
5884 client: fidl::client::sync::Client,
5885}
5886
5887#[cfg(target_os = "fuchsia")]
5888impl fidl::endpoints::SynchronousProxy for IsochronousStreamSynchronousProxy {
5889 type Proxy = IsochronousStreamProxy;
5890 type Protocol = IsochronousStreamMarker;
5891
5892 fn from_channel(inner: fidl::Channel) -> Self {
5893 Self::new(inner)
5894 }
5895
5896 fn into_channel(self) -> fidl::Channel {
5897 self.client.into_channel()
5898 }
5899
5900 fn as_channel(&self) -> &fidl::Channel {
5901 self.client.as_channel()
5902 }
5903}
5904
5905#[cfg(target_os = "fuchsia")]
5906impl IsochronousStreamSynchronousProxy {
5907 pub fn new(channel: fidl::Channel) -> Self {
5908 let protocol_name =
5909 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5910 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5911 }
5912
5913 pub fn into_channel(self) -> fidl::Channel {
5914 self.client.into_channel()
5915 }
5916
5917 pub fn wait_for_event(
5920 &self,
5921 deadline: zx::MonotonicInstant,
5922 ) -> Result<IsochronousStreamEvent, fidl::Error> {
5923 IsochronousStreamEvent::decode(self.client.wait_for_event(deadline)?)
5924 }
5925
5926 pub fn r#setup_data_path(
5938 &self,
5939 mut payload: &IsochronousStreamSetupDataPathRequest,
5940 ___deadline: zx::MonotonicInstant,
5941 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
5942 let _response = self.client.send_query::<
5943 IsochronousStreamSetupDataPathRequest,
5944 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5945 >(
5946 payload,
5947 0x7ec1e2b9cc6d2fbe,
5948 fidl::encoding::DynamicFlags::FLEXIBLE,
5949 ___deadline,
5950 )?
5951 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
5952 Ok(_response.map(|x| x))
5953 }
5954
5955 pub fn r#read(
5961 &self,
5962 ___deadline: zx::MonotonicInstant,
5963 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
5964 let _response = self.client.send_query::<
5965 fidl::encoding::EmptyPayload,
5966 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
5967 >(
5968 (),
5969 0x6d7d8b4950ed3a32,
5970 fidl::encoding::DynamicFlags::FLEXIBLE,
5971 ___deadline,
5972 )?
5973 .into_result::<IsochronousStreamMarker>("read")?;
5974 Ok(_response)
5975 }
5976
5977 pub fn r#write(
5981 &self,
5982 mut payload: &IsochronousStreamWriteRequest,
5983 ___deadline: zx::MonotonicInstant,
5984 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
5985 let _response = self.client.send_query::<
5986 IsochronousStreamWriteRequest,
5987 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5988 >(
5989 payload,
5990 0x5282e90b667d0d43,
5991 fidl::encoding::DynamicFlags::FLEXIBLE,
5992 ___deadline,
5993 )?
5994 .into_result::<IsochronousStreamMarker>("write")?;
5995 Ok(_response.map(|x| x))
5996 }
5997}
5998
5999#[cfg(target_os = "fuchsia")]
6000impl From<IsochronousStreamSynchronousProxy> for zx::Handle {
6001 fn from(value: IsochronousStreamSynchronousProxy) -> Self {
6002 value.into_channel().into()
6003 }
6004}
6005
6006#[cfg(target_os = "fuchsia")]
6007impl From<fidl::Channel> for IsochronousStreamSynchronousProxy {
6008 fn from(value: fidl::Channel) -> Self {
6009 Self::new(value)
6010 }
6011}
6012
6013#[derive(Debug, Clone)]
6014pub struct IsochronousStreamProxy {
6015 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6016}
6017
6018impl fidl::endpoints::Proxy for IsochronousStreamProxy {
6019 type Protocol = IsochronousStreamMarker;
6020
6021 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6022 Self::new(inner)
6023 }
6024
6025 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6026 self.client.into_channel().map_err(|client| Self { client })
6027 }
6028
6029 fn as_channel(&self) -> &::fidl::AsyncChannel {
6030 self.client.as_channel()
6031 }
6032}
6033
6034impl IsochronousStreamProxy {
6035 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6037 let protocol_name =
6038 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6039 Self { client: fidl::client::Client::new(channel, protocol_name) }
6040 }
6041
6042 pub fn take_event_stream(&self) -> IsochronousStreamEventStream {
6048 IsochronousStreamEventStream { event_receiver: self.client.take_event_receiver() }
6049 }
6050
6051 pub fn r#setup_data_path(
6063 &self,
6064 mut payload: &IsochronousStreamSetupDataPathRequest,
6065 ) -> fidl::client::QueryResponseFut<
6066 IsochronousStreamSetupDataPathResult,
6067 fidl::encoding::DefaultFuchsiaResourceDialect,
6068 > {
6069 IsochronousStreamProxyInterface::r#setup_data_path(self, payload)
6070 }
6071
6072 pub fn r#read(
6078 &self,
6079 ) -> fidl::client::QueryResponseFut<
6080 IsochronousStreamReadResponse,
6081 fidl::encoding::DefaultFuchsiaResourceDialect,
6082 > {
6083 IsochronousStreamProxyInterface::r#read(self)
6084 }
6085
6086 pub fn r#write(
6090 &self,
6091 mut payload: &IsochronousStreamWriteRequest,
6092 ) -> fidl::client::QueryResponseFut<
6093 IsochronousStreamWriteResult,
6094 fidl::encoding::DefaultFuchsiaResourceDialect,
6095 > {
6096 IsochronousStreamProxyInterface::r#write(self, payload)
6097 }
6098}
6099
6100impl IsochronousStreamProxyInterface for IsochronousStreamProxy {
6101 type SetupDataPathResponseFut = fidl::client::QueryResponseFut<
6102 IsochronousStreamSetupDataPathResult,
6103 fidl::encoding::DefaultFuchsiaResourceDialect,
6104 >;
6105 fn r#setup_data_path(
6106 &self,
6107 mut payload: &IsochronousStreamSetupDataPathRequest,
6108 ) -> Self::SetupDataPathResponseFut {
6109 fn _decode(
6110 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6111 ) -> Result<IsochronousStreamSetupDataPathResult, fidl::Error> {
6112 let _response = fidl::client::decode_transaction_body::<
6113 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6114 fidl::encoding::DefaultFuchsiaResourceDialect,
6115 0x7ec1e2b9cc6d2fbe,
6116 >(_buf?)?
6117 .into_result::<IsochronousStreamMarker>("setup_data_path")?;
6118 Ok(_response.map(|x| x))
6119 }
6120 self.client.send_query_and_decode::<
6121 IsochronousStreamSetupDataPathRequest,
6122 IsochronousStreamSetupDataPathResult,
6123 >(
6124 payload,
6125 0x7ec1e2b9cc6d2fbe,
6126 fidl::encoding::DynamicFlags::FLEXIBLE,
6127 _decode,
6128 )
6129 }
6130
6131 type ReadResponseFut = fidl::client::QueryResponseFut<
6132 IsochronousStreamReadResponse,
6133 fidl::encoding::DefaultFuchsiaResourceDialect,
6134 >;
6135 fn r#read(&self) -> Self::ReadResponseFut {
6136 fn _decode(
6137 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6138 ) -> Result<IsochronousStreamReadResponse, fidl::Error> {
6139 let _response = fidl::client::decode_transaction_body::<
6140 fidl::encoding::FlexibleType<IsochronousStreamReadResponse>,
6141 fidl::encoding::DefaultFuchsiaResourceDialect,
6142 0x6d7d8b4950ed3a32,
6143 >(_buf?)?
6144 .into_result::<IsochronousStreamMarker>("read")?;
6145 Ok(_response)
6146 }
6147 self.client
6148 .send_query_and_decode::<fidl::encoding::EmptyPayload, IsochronousStreamReadResponse>(
6149 (),
6150 0x6d7d8b4950ed3a32,
6151 fidl::encoding::DynamicFlags::FLEXIBLE,
6152 _decode,
6153 )
6154 }
6155
6156 type WriteResponseFut = fidl::client::QueryResponseFut<
6157 IsochronousStreamWriteResult,
6158 fidl::encoding::DefaultFuchsiaResourceDialect,
6159 >;
6160 fn r#write(&self, mut payload: &IsochronousStreamWriteRequest) -> Self::WriteResponseFut {
6161 fn _decode(
6162 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6163 ) -> Result<IsochronousStreamWriteResult, fidl::Error> {
6164 let _response = fidl::client::decode_transaction_body::<
6165 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6166 fidl::encoding::DefaultFuchsiaResourceDialect,
6167 0x5282e90b667d0d43,
6168 >(_buf?)?
6169 .into_result::<IsochronousStreamMarker>("write")?;
6170 Ok(_response.map(|x| x))
6171 }
6172 self.client
6173 .send_query_and_decode::<IsochronousStreamWriteRequest, IsochronousStreamWriteResult>(
6174 payload,
6175 0x5282e90b667d0d43,
6176 fidl::encoding::DynamicFlags::FLEXIBLE,
6177 _decode,
6178 )
6179 }
6180}
6181
6182pub struct IsochronousStreamEventStream {
6183 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6184}
6185
6186impl std::marker::Unpin for IsochronousStreamEventStream {}
6187
6188impl futures::stream::FusedStream for IsochronousStreamEventStream {
6189 fn is_terminated(&self) -> bool {
6190 self.event_receiver.is_terminated()
6191 }
6192}
6193
6194impl futures::Stream for IsochronousStreamEventStream {
6195 type Item = Result<IsochronousStreamEvent, fidl::Error>;
6196
6197 fn poll_next(
6198 mut self: std::pin::Pin<&mut Self>,
6199 cx: &mut std::task::Context<'_>,
6200 ) -> std::task::Poll<Option<Self::Item>> {
6201 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6202 &mut self.event_receiver,
6203 cx
6204 )?) {
6205 Some(buf) => std::task::Poll::Ready(Some(IsochronousStreamEvent::decode(buf))),
6206 None => std::task::Poll::Ready(None),
6207 }
6208 }
6209}
6210
6211#[derive(Debug)]
6212pub enum IsochronousStreamEvent {
6213 OnEstablished {
6214 payload: IsochronousStreamOnEstablishedRequest,
6215 },
6216 #[non_exhaustive]
6217 _UnknownEvent {
6218 ordinal: u64,
6220 },
6221}
6222
6223impl IsochronousStreamEvent {
6224 #[allow(irrefutable_let_patterns)]
6225 pub fn into_on_established(self) -> Option<IsochronousStreamOnEstablishedRequest> {
6226 if let IsochronousStreamEvent::OnEstablished { payload } = self {
6227 Some((payload))
6228 } else {
6229 None
6230 }
6231 }
6232
6233 fn decode(
6235 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6236 ) -> Result<IsochronousStreamEvent, fidl::Error> {
6237 let (bytes, _handles) = buf.split_mut();
6238 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6239 debug_assert_eq!(tx_header.tx_id, 0);
6240 match tx_header.ordinal {
6241 0x341c50e9d10f3421 => {
6242 let mut out = fidl::new_empty!(
6243 IsochronousStreamOnEstablishedRequest,
6244 fidl::encoding::DefaultFuchsiaResourceDialect
6245 );
6246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamOnEstablishedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6247 Ok((IsochronousStreamEvent::OnEstablished { payload: out }))
6248 }
6249 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6250 Ok(IsochronousStreamEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6251 }
6252 _ => Err(fidl::Error::UnknownOrdinal {
6253 ordinal: tx_header.ordinal,
6254 protocol_name:
6255 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6256 }),
6257 }
6258 }
6259}
6260
6261pub struct IsochronousStreamRequestStream {
6263 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6264 is_terminated: bool,
6265}
6266
6267impl std::marker::Unpin for IsochronousStreamRequestStream {}
6268
6269impl futures::stream::FusedStream for IsochronousStreamRequestStream {
6270 fn is_terminated(&self) -> bool {
6271 self.is_terminated
6272 }
6273}
6274
6275impl fidl::endpoints::RequestStream for IsochronousStreamRequestStream {
6276 type Protocol = IsochronousStreamMarker;
6277 type ControlHandle = IsochronousStreamControlHandle;
6278
6279 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6280 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6281 }
6282
6283 fn control_handle(&self) -> Self::ControlHandle {
6284 IsochronousStreamControlHandle { inner: self.inner.clone() }
6285 }
6286
6287 fn into_inner(
6288 self,
6289 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6290 {
6291 (self.inner, self.is_terminated)
6292 }
6293
6294 fn from_inner(
6295 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6296 is_terminated: bool,
6297 ) -> Self {
6298 Self { inner, is_terminated }
6299 }
6300}
6301
6302impl futures::Stream for IsochronousStreamRequestStream {
6303 type Item = Result<IsochronousStreamRequest, fidl::Error>;
6304
6305 fn poll_next(
6306 mut self: std::pin::Pin<&mut Self>,
6307 cx: &mut std::task::Context<'_>,
6308 ) -> std::task::Poll<Option<Self::Item>> {
6309 let this = &mut *self;
6310 if this.inner.check_shutdown(cx) {
6311 this.is_terminated = true;
6312 return std::task::Poll::Ready(None);
6313 }
6314 if this.is_terminated {
6315 panic!("polled IsochronousStreamRequestStream after completion");
6316 }
6317 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6318 |bytes, handles| {
6319 match this.inner.channel().read_etc(cx, bytes, handles) {
6320 std::task::Poll::Ready(Ok(())) => {}
6321 std::task::Poll::Pending => return std::task::Poll::Pending,
6322 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6323 this.is_terminated = true;
6324 return std::task::Poll::Ready(None);
6325 }
6326 std::task::Poll::Ready(Err(e)) => {
6327 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6328 e.into(),
6329 ))))
6330 }
6331 }
6332
6333 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6335
6336 std::task::Poll::Ready(Some(match header.ordinal {
6337 0x7ec1e2b9cc6d2fbe => {
6338 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6339 let mut req = fidl::new_empty!(
6340 IsochronousStreamSetupDataPathRequest,
6341 fidl::encoding::DefaultFuchsiaResourceDialect
6342 );
6343 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamSetupDataPathRequest>(&header, _body_bytes, handles, &mut req)?;
6344 let control_handle =
6345 IsochronousStreamControlHandle { inner: this.inner.clone() };
6346 Ok(IsochronousStreamRequest::SetupDataPath {
6347 payload: req,
6348 responder: IsochronousStreamSetupDataPathResponder {
6349 control_handle: std::mem::ManuallyDrop::new(control_handle),
6350 tx_id: header.tx_id,
6351 },
6352 })
6353 }
6354 0x6d7d8b4950ed3a32 => {
6355 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6356 let mut req = fidl::new_empty!(
6357 fidl::encoding::EmptyPayload,
6358 fidl::encoding::DefaultFuchsiaResourceDialect
6359 );
6360 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6361 let control_handle =
6362 IsochronousStreamControlHandle { inner: this.inner.clone() };
6363 Ok(IsochronousStreamRequest::Read {
6364 responder: IsochronousStreamReadResponder {
6365 control_handle: std::mem::ManuallyDrop::new(control_handle),
6366 tx_id: header.tx_id,
6367 },
6368 })
6369 }
6370 0x5282e90b667d0d43 => {
6371 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6372 let mut req = fidl::new_empty!(
6373 IsochronousStreamWriteRequest,
6374 fidl::encoding::DefaultFuchsiaResourceDialect
6375 );
6376 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IsochronousStreamWriteRequest>(&header, _body_bytes, handles, &mut req)?;
6377 let control_handle =
6378 IsochronousStreamControlHandle { inner: this.inner.clone() };
6379 Ok(IsochronousStreamRequest::Write {
6380 payload: req,
6381 responder: IsochronousStreamWriteResponder {
6382 control_handle: std::mem::ManuallyDrop::new(control_handle),
6383 tx_id: header.tx_id,
6384 },
6385 })
6386 }
6387 _ if header.tx_id == 0
6388 && header
6389 .dynamic_flags()
6390 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6391 {
6392 Ok(IsochronousStreamRequest::_UnknownMethod {
6393 ordinal: header.ordinal,
6394 control_handle: IsochronousStreamControlHandle {
6395 inner: this.inner.clone(),
6396 },
6397 method_type: fidl::MethodType::OneWay,
6398 })
6399 }
6400 _ if header
6401 .dynamic_flags()
6402 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6403 {
6404 this.inner.send_framework_err(
6405 fidl::encoding::FrameworkErr::UnknownMethod,
6406 header.tx_id,
6407 header.ordinal,
6408 header.dynamic_flags(),
6409 (bytes, handles),
6410 )?;
6411 Ok(IsochronousStreamRequest::_UnknownMethod {
6412 ordinal: header.ordinal,
6413 control_handle: IsochronousStreamControlHandle {
6414 inner: this.inner.clone(),
6415 },
6416 method_type: fidl::MethodType::TwoWay,
6417 })
6418 }
6419 _ => Err(fidl::Error::UnknownOrdinal {
6420 ordinal: header.ordinal,
6421 protocol_name:
6422 <IsochronousStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6423 }),
6424 }))
6425 },
6426 )
6427 }
6428}
6429
6430#[derive(Debug)]
6431pub enum IsochronousStreamRequest {
6432 SetupDataPath {
6444 payload: IsochronousStreamSetupDataPathRequest,
6445 responder: IsochronousStreamSetupDataPathResponder,
6446 },
6447 Read { responder: IsochronousStreamReadResponder },
6453 Write { payload: IsochronousStreamWriteRequest, responder: IsochronousStreamWriteResponder },
6457 #[non_exhaustive]
6459 _UnknownMethod {
6460 ordinal: u64,
6462 control_handle: IsochronousStreamControlHandle,
6463 method_type: fidl::MethodType,
6464 },
6465}
6466
6467impl IsochronousStreamRequest {
6468 #[allow(irrefutable_let_patterns)]
6469 pub fn into_setup_data_path(
6470 self,
6471 ) -> Option<(IsochronousStreamSetupDataPathRequest, IsochronousStreamSetupDataPathResponder)>
6472 {
6473 if let IsochronousStreamRequest::SetupDataPath { payload, responder } = self {
6474 Some((payload, responder))
6475 } else {
6476 None
6477 }
6478 }
6479
6480 #[allow(irrefutable_let_patterns)]
6481 pub fn into_read(self) -> Option<(IsochronousStreamReadResponder)> {
6482 if let IsochronousStreamRequest::Read { responder } = self {
6483 Some((responder))
6484 } else {
6485 None
6486 }
6487 }
6488
6489 #[allow(irrefutable_let_patterns)]
6490 pub fn into_write(
6491 self,
6492 ) -> Option<(IsochronousStreamWriteRequest, IsochronousStreamWriteResponder)> {
6493 if let IsochronousStreamRequest::Write { payload, responder } = self {
6494 Some((payload, responder))
6495 } else {
6496 None
6497 }
6498 }
6499
6500 pub fn method_name(&self) -> &'static str {
6502 match *self {
6503 IsochronousStreamRequest::SetupDataPath { .. } => "setup_data_path",
6504 IsochronousStreamRequest::Read { .. } => "read",
6505 IsochronousStreamRequest::Write { .. } => "write",
6506 IsochronousStreamRequest::_UnknownMethod {
6507 method_type: fidl::MethodType::OneWay,
6508 ..
6509 } => "unknown one-way method",
6510 IsochronousStreamRequest::_UnknownMethod {
6511 method_type: fidl::MethodType::TwoWay,
6512 ..
6513 } => "unknown two-way method",
6514 }
6515 }
6516}
6517
6518#[derive(Debug, Clone)]
6519pub struct IsochronousStreamControlHandle {
6520 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6521}
6522
6523impl fidl::endpoints::ControlHandle for IsochronousStreamControlHandle {
6524 fn shutdown(&self) {
6525 self.inner.shutdown()
6526 }
6527 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6528 self.inner.shutdown_with_epitaph(status)
6529 }
6530
6531 fn is_closed(&self) -> bool {
6532 self.inner.channel().is_closed()
6533 }
6534 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6535 self.inner.channel().on_closed()
6536 }
6537
6538 #[cfg(target_os = "fuchsia")]
6539 fn signal_peer(
6540 &self,
6541 clear_mask: zx::Signals,
6542 set_mask: zx::Signals,
6543 ) -> Result<(), zx_status::Status> {
6544 use fidl::Peered;
6545 self.inner.channel().signal_peer(clear_mask, set_mask)
6546 }
6547}
6548
6549impl IsochronousStreamControlHandle {
6550 pub fn send_on_established(
6551 &self,
6552 mut payload: &IsochronousStreamOnEstablishedRequest,
6553 ) -> Result<(), fidl::Error> {
6554 self.inner.send::<IsochronousStreamOnEstablishedRequest>(
6555 payload,
6556 0,
6557 0x341c50e9d10f3421,
6558 fidl::encoding::DynamicFlags::FLEXIBLE,
6559 )
6560 }
6561}
6562
6563#[must_use = "FIDL methods require a response to be sent"]
6564#[derive(Debug)]
6565pub struct IsochronousStreamSetupDataPathResponder {
6566 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6567 tx_id: u32,
6568}
6569
6570impl std::ops::Drop for IsochronousStreamSetupDataPathResponder {
6574 fn drop(&mut self) {
6575 self.control_handle.shutdown();
6576 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6578 }
6579}
6580
6581impl fidl::endpoints::Responder for IsochronousStreamSetupDataPathResponder {
6582 type ControlHandle = IsochronousStreamControlHandle;
6583
6584 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6585 &self.control_handle
6586 }
6587
6588 fn drop_without_shutdown(mut self) {
6589 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6591 std::mem::forget(self);
6593 }
6594}
6595
6596impl IsochronousStreamSetupDataPathResponder {
6597 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6601 let _result = self.send_raw(result);
6602 if _result.is_err() {
6603 self.control_handle.shutdown();
6604 }
6605 self.drop_without_shutdown();
6606 _result
6607 }
6608
6609 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6611 let _result = self.send_raw(result);
6612 self.drop_without_shutdown();
6613 _result
6614 }
6615
6616 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6617 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6618 fidl::encoding::EmptyStruct,
6619 i32,
6620 >>(
6621 fidl::encoding::FlexibleResult::new(result),
6622 self.tx_id,
6623 0x7ec1e2b9cc6d2fbe,
6624 fidl::encoding::DynamicFlags::FLEXIBLE,
6625 )
6626 }
6627}
6628
6629#[must_use = "FIDL methods require a response to be sent"]
6630#[derive(Debug)]
6631pub struct IsochronousStreamReadResponder {
6632 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6633 tx_id: u32,
6634}
6635
6636impl std::ops::Drop for IsochronousStreamReadResponder {
6640 fn drop(&mut self) {
6641 self.control_handle.shutdown();
6642 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6644 }
6645}
6646
6647impl fidl::endpoints::Responder for IsochronousStreamReadResponder {
6648 type ControlHandle = IsochronousStreamControlHandle;
6649
6650 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6651 &self.control_handle
6652 }
6653
6654 fn drop_without_shutdown(mut self) {
6655 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6657 std::mem::forget(self);
6659 }
6660}
6661
6662impl IsochronousStreamReadResponder {
6663 pub fn send(self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
6667 let _result = self.send_raw(payload);
6668 if _result.is_err() {
6669 self.control_handle.shutdown();
6670 }
6671 self.drop_without_shutdown();
6672 _result
6673 }
6674
6675 pub fn send_no_shutdown_on_err(
6677 self,
6678 mut payload: &IsochronousStreamReadResponse,
6679 ) -> Result<(), fidl::Error> {
6680 let _result = self.send_raw(payload);
6681 self.drop_without_shutdown();
6682 _result
6683 }
6684
6685 fn send_raw(&self, mut payload: &IsochronousStreamReadResponse) -> Result<(), fidl::Error> {
6686 self.control_handle
6687 .inner
6688 .send::<fidl::encoding::FlexibleType<IsochronousStreamReadResponse>>(
6689 fidl::encoding::Flexible::new(payload),
6690 self.tx_id,
6691 0x6d7d8b4950ed3a32,
6692 fidl::encoding::DynamicFlags::FLEXIBLE,
6693 )
6694 }
6695}
6696
6697#[must_use = "FIDL methods require a response to be sent"]
6698#[derive(Debug)]
6699pub struct IsochronousStreamWriteResponder {
6700 control_handle: std::mem::ManuallyDrop<IsochronousStreamControlHandle>,
6701 tx_id: u32,
6702}
6703
6704impl std::ops::Drop for IsochronousStreamWriteResponder {
6708 fn drop(&mut self) {
6709 self.control_handle.shutdown();
6710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6712 }
6713}
6714
6715impl fidl::endpoints::Responder for IsochronousStreamWriteResponder {
6716 type ControlHandle = IsochronousStreamControlHandle;
6717
6718 fn control_handle(&self) -> &IsochronousStreamControlHandle {
6719 &self.control_handle
6720 }
6721
6722 fn drop_without_shutdown(mut self) {
6723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6725 std::mem::forget(self);
6727 }
6728}
6729
6730impl IsochronousStreamWriteResponder {
6731 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6735 let _result = self.send_raw(result);
6736 if _result.is_err() {
6737 self.control_handle.shutdown();
6738 }
6739 self.drop_without_shutdown();
6740 _result
6741 }
6742
6743 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6745 let _result = self.send_raw(result);
6746 self.drop_without_shutdown();
6747 _result
6748 }
6749
6750 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6751 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6752 fidl::encoding::EmptyStruct,
6753 i32,
6754 >>(
6755 fidl::encoding::FlexibleResult::new(result),
6756 self.tx_id,
6757 0x5282e90b667d0d43,
6758 fidl::encoding::DynamicFlags::FLEXIBLE,
6759 )
6760 }
6761}
6762
6763#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6764pub struct PeripheralMarker;
6765
6766impl fidl::endpoints::ProtocolMarker for PeripheralMarker {
6767 type Proxy = PeripheralProxy;
6768 type RequestStream = PeripheralRequestStream;
6769 #[cfg(target_os = "fuchsia")]
6770 type SynchronousProxy = PeripheralSynchronousProxy;
6771
6772 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.Peripheral";
6773}
6774impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralMarker {}
6775pub type PeripheralAdvertiseResult = Result<(), PeripheralError>;
6776pub type PeripheralStartAdvertisingResult = Result<(), PeripheralError>;
6777
6778pub trait PeripheralProxyInterface: Send + Sync {
6779 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
6780 + Send;
6781 fn r#listen_l2cap(
6782 &self,
6783 payload: ChannelListenerRegistryListenL2capRequest,
6784 ) -> Self::ListenL2capResponseFut;
6785 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
6786 + Send;
6787 fn r#advertise(
6788 &self,
6789 parameters: &AdvertisingParameters,
6790 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
6791 ) -> Self::AdvertiseResponseFut;
6792 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
6793 + Send;
6794 fn r#start_advertising(
6795 &self,
6796 parameters: &AdvertisingParameters,
6797 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
6798 ) -> Self::StartAdvertisingResponseFut;
6799}
6800#[derive(Debug)]
6801#[cfg(target_os = "fuchsia")]
6802pub struct PeripheralSynchronousProxy {
6803 client: fidl::client::sync::Client,
6804}
6805
6806#[cfg(target_os = "fuchsia")]
6807impl fidl::endpoints::SynchronousProxy for PeripheralSynchronousProxy {
6808 type Proxy = PeripheralProxy;
6809 type Protocol = PeripheralMarker;
6810
6811 fn from_channel(inner: fidl::Channel) -> Self {
6812 Self::new(inner)
6813 }
6814
6815 fn into_channel(self) -> fidl::Channel {
6816 self.client.into_channel()
6817 }
6818
6819 fn as_channel(&self) -> &fidl::Channel {
6820 self.client.as_channel()
6821 }
6822}
6823
6824#[cfg(target_os = "fuchsia")]
6825impl PeripheralSynchronousProxy {
6826 pub fn new(channel: fidl::Channel) -> Self {
6827 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6828 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6829 }
6830
6831 pub fn into_channel(self) -> fidl::Channel {
6832 self.client.into_channel()
6833 }
6834
6835 pub fn wait_for_event(
6838 &self,
6839 deadline: zx::MonotonicInstant,
6840 ) -> Result<PeripheralEvent, fidl::Error> {
6841 PeripheralEvent::decode(self.client.wait_for_event(deadline)?)
6842 }
6843
6844 pub fn r#listen_l2cap(
6854 &self,
6855 mut payload: ChannelListenerRegistryListenL2capRequest,
6856 ___deadline: zx::MonotonicInstant,
6857 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
6858 let _response = self.client.send_query::<
6859 ChannelListenerRegistryListenL2capRequest,
6860 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
6861 >(
6862 &mut payload,
6863 0x39c6e9001d102338,
6864 fidl::encoding::DynamicFlags::empty(),
6865 ___deadline,
6866 )?;
6867 Ok(_response.map(|x| x))
6868 }
6869
6870 pub fn r#advertise(
6898 &self,
6899 mut parameters: &AdvertisingParameters,
6900 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
6901 ___deadline: zx::MonotonicInstant,
6902 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
6903 let _response = self.client.send_query::<
6904 PeripheralAdvertiseRequest,
6905 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
6906 >(
6907 (parameters, advertised_peripheral,),
6908 0x2d9ec9260c32c17f,
6909 fidl::encoding::DynamicFlags::empty(),
6910 ___deadline,
6911 )?;
6912 Ok(_response.map(|x| x))
6913 }
6914
6915 pub fn r#start_advertising(
6936 &self,
6937 mut parameters: &AdvertisingParameters,
6938 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
6939 ___deadline: zx::MonotonicInstant,
6940 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
6941 let _response = self.client.send_query::<
6942 PeripheralStartAdvertisingRequest,
6943 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
6944 >(
6945 (parameters, handle,),
6946 0x5875c1c575f00f7d,
6947 fidl::encoding::DynamicFlags::empty(),
6948 ___deadline,
6949 )?;
6950 Ok(_response.map(|x| x))
6951 }
6952}
6953
6954#[cfg(target_os = "fuchsia")]
6955impl From<PeripheralSynchronousProxy> for zx::Handle {
6956 fn from(value: PeripheralSynchronousProxy) -> Self {
6957 value.into_channel().into()
6958 }
6959}
6960
6961#[cfg(target_os = "fuchsia")]
6962impl From<fidl::Channel> for PeripheralSynchronousProxy {
6963 fn from(value: fidl::Channel) -> Self {
6964 Self::new(value)
6965 }
6966}
6967
6968#[derive(Debug, Clone)]
6969pub struct PeripheralProxy {
6970 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6971}
6972
6973impl fidl::endpoints::Proxy for PeripheralProxy {
6974 type Protocol = PeripheralMarker;
6975
6976 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6977 Self::new(inner)
6978 }
6979
6980 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6981 self.client.into_channel().map_err(|client| Self { client })
6982 }
6983
6984 fn as_channel(&self) -> &::fidl::AsyncChannel {
6985 self.client.as_channel()
6986 }
6987}
6988
6989impl PeripheralProxy {
6990 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6992 let protocol_name = <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6993 Self { client: fidl::client::Client::new(channel, protocol_name) }
6994 }
6995
6996 pub fn take_event_stream(&self) -> PeripheralEventStream {
7002 PeripheralEventStream { event_receiver: self.client.take_event_receiver() }
7003 }
7004
7005 pub fn r#listen_l2cap(
7015 &self,
7016 mut payload: ChannelListenerRegistryListenL2capRequest,
7017 ) -> fidl::client::QueryResponseFut<
7018 ChannelListenerRegistryListenL2capResult,
7019 fidl::encoding::DefaultFuchsiaResourceDialect,
7020 > {
7021 PeripheralProxyInterface::r#listen_l2cap(self, payload)
7022 }
7023
7024 pub fn r#advertise(
7052 &self,
7053 mut parameters: &AdvertisingParameters,
7054 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7055 ) -> fidl::client::QueryResponseFut<
7056 PeripheralAdvertiseResult,
7057 fidl::encoding::DefaultFuchsiaResourceDialect,
7058 > {
7059 PeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
7060 }
7061
7062 pub fn r#start_advertising(
7083 &self,
7084 mut parameters: &AdvertisingParameters,
7085 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7086 ) -> fidl::client::QueryResponseFut<
7087 PeripheralStartAdvertisingResult,
7088 fidl::encoding::DefaultFuchsiaResourceDialect,
7089 > {
7090 PeripheralProxyInterface::r#start_advertising(self, parameters, handle)
7091 }
7092}
7093
7094impl PeripheralProxyInterface for PeripheralProxy {
7095 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
7096 ChannelListenerRegistryListenL2capResult,
7097 fidl::encoding::DefaultFuchsiaResourceDialect,
7098 >;
7099 fn r#listen_l2cap(
7100 &self,
7101 mut payload: ChannelListenerRegistryListenL2capRequest,
7102 ) -> Self::ListenL2capResponseFut {
7103 fn _decode(
7104 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7105 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
7106 let _response = fidl::client::decode_transaction_body::<
7107 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
7108 fidl::encoding::DefaultFuchsiaResourceDialect,
7109 0x39c6e9001d102338,
7110 >(_buf?)?;
7111 Ok(_response.map(|x| x))
7112 }
7113 self.client.send_query_and_decode::<
7114 ChannelListenerRegistryListenL2capRequest,
7115 ChannelListenerRegistryListenL2capResult,
7116 >(
7117 &mut payload,
7118 0x39c6e9001d102338,
7119 fidl::encoding::DynamicFlags::empty(),
7120 _decode,
7121 )
7122 }
7123
7124 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
7125 PeripheralAdvertiseResult,
7126 fidl::encoding::DefaultFuchsiaResourceDialect,
7127 >;
7128 fn r#advertise(
7129 &self,
7130 mut parameters: &AdvertisingParameters,
7131 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7132 ) -> Self::AdvertiseResponseFut {
7133 fn _decode(
7134 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7135 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
7136 let _response = fidl::client::decode_transaction_body::<
7137 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7138 fidl::encoding::DefaultFuchsiaResourceDialect,
7139 0x2d9ec9260c32c17f,
7140 >(_buf?)?;
7141 Ok(_response.map(|x| x))
7142 }
7143 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
7144 (parameters, advertised_peripheral),
7145 0x2d9ec9260c32c17f,
7146 fidl::encoding::DynamicFlags::empty(),
7147 _decode,
7148 )
7149 }
7150
7151 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
7152 PeripheralStartAdvertisingResult,
7153 fidl::encoding::DefaultFuchsiaResourceDialect,
7154 >;
7155 fn r#start_advertising(
7156 &self,
7157 mut parameters: &AdvertisingParameters,
7158 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7159 ) -> Self::StartAdvertisingResponseFut {
7160 fn _decode(
7161 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7162 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
7163 let _response = fidl::client::decode_transaction_body::<
7164 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7165 fidl::encoding::DefaultFuchsiaResourceDialect,
7166 0x5875c1c575f00f7d,
7167 >(_buf?)?;
7168 Ok(_response.map(|x| x))
7169 }
7170 self.client.send_query_and_decode::<
7171 PeripheralStartAdvertisingRequest,
7172 PeripheralStartAdvertisingResult,
7173 >(
7174 (parameters, handle,),
7175 0x5875c1c575f00f7d,
7176 fidl::encoding::DynamicFlags::empty(),
7177 _decode,
7178 )
7179 }
7180}
7181
7182pub struct PeripheralEventStream {
7183 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7184}
7185
7186impl std::marker::Unpin for PeripheralEventStream {}
7187
7188impl futures::stream::FusedStream for PeripheralEventStream {
7189 fn is_terminated(&self) -> bool {
7190 self.event_receiver.is_terminated()
7191 }
7192}
7193
7194impl futures::Stream for PeripheralEventStream {
7195 type Item = Result<PeripheralEvent, fidl::Error>;
7196
7197 fn poll_next(
7198 mut self: std::pin::Pin<&mut Self>,
7199 cx: &mut std::task::Context<'_>,
7200 ) -> std::task::Poll<Option<Self::Item>> {
7201 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7202 &mut self.event_receiver,
7203 cx
7204 )?) {
7205 Some(buf) => std::task::Poll::Ready(Some(PeripheralEvent::decode(buf))),
7206 None => std::task::Poll::Ready(None),
7207 }
7208 }
7209}
7210
7211#[derive(Debug)]
7212pub enum PeripheralEvent {
7213 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
7214}
7215
7216impl PeripheralEvent {
7217 #[allow(irrefutable_let_patterns)]
7218 pub fn into_on_peer_connected(
7219 self,
7220 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
7221 if let PeripheralEvent::OnPeerConnected { peer, connection } = self {
7222 Some((peer, connection))
7223 } else {
7224 None
7225 }
7226 }
7227
7228 fn decode(
7230 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7231 ) -> Result<PeripheralEvent, fidl::Error> {
7232 let (bytes, _handles) = buf.split_mut();
7233 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7234 debug_assert_eq!(tx_header.tx_id, 0);
7235 match tx_header.ordinal {
7236 0x16135d464299e356 => {
7237 let mut out = fidl::new_empty!(
7238 PeripheralOnPeerConnectedRequest,
7239 fidl::encoding::DefaultFuchsiaResourceDialect
7240 );
7241 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
7242 Ok((PeripheralEvent::OnPeerConnected {
7243 peer: out.peer,
7244 connection: out.connection,
7245 }))
7246 }
7247 _ => Err(fidl::Error::UnknownOrdinal {
7248 ordinal: tx_header.ordinal,
7249 protocol_name: <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7250 }),
7251 }
7252 }
7253}
7254
7255pub struct PeripheralRequestStream {
7257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7258 is_terminated: bool,
7259}
7260
7261impl std::marker::Unpin for PeripheralRequestStream {}
7262
7263impl futures::stream::FusedStream for PeripheralRequestStream {
7264 fn is_terminated(&self) -> bool {
7265 self.is_terminated
7266 }
7267}
7268
7269impl fidl::endpoints::RequestStream for PeripheralRequestStream {
7270 type Protocol = PeripheralMarker;
7271 type ControlHandle = PeripheralControlHandle;
7272
7273 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7274 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7275 }
7276
7277 fn control_handle(&self) -> Self::ControlHandle {
7278 PeripheralControlHandle { inner: self.inner.clone() }
7279 }
7280
7281 fn into_inner(
7282 self,
7283 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7284 {
7285 (self.inner, self.is_terminated)
7286 }
7287
7288 fn from_inner(
7289 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7290 is_terminated: bool,
7291 ) -> Self {
7292 Self { inner, is_terminated }
7293 }
7294}
7295
7296impl futures::Stream for PeripheralRequestStream {
7297 type Item = Result<PeripheralRequest, fidl::Error>;
7298
7299 fn poll_next(
7300 mut self: std::pin::Pin<&mut Self>,
7301 cx: &mut std::task::Context<'_>,
7302 ) -> std::task::Poll<Option<Self::Item>> {
7303 let this = &mut *self;
7304 if this.inner.check_shutdown(cx) {
7305 this.is_terminated = true;
7306 return std::task::Poll::Ready(None);
7307 }
7308 if this.is_terminated {
7309 panic!("polled PeripheralRequestStream after completion");
7310 }
7311 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7312 |bytes, handles| {
7313 match this.inner.channel().read_etc(cx, bytes, handles) {
7314 std::task::Poll::Ready(Ok(())) => {}
7315 std::task::Poll::Pending => return std::task::Poll::Pending,
7316 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7317 this.is_terminated = true;
7318 return std::task::Poll::Ready(None);
7319 }
7320 std::task::Poll::Ready(Err(e)) => {
7321 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7322 e.into(),
7323 ))))
7324 }
7325 }
7326
7327 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7329
7330 std::task::Poll::Ready(Some(match header.ordinal {
7331 0x39c6e9001d102338 => {
7332 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7333 let mut req = fidl::new_empty!(
7334 ChannelListenerRegistryListenL2capRequest,
7335 fidl::encoding::DefaultFuchsiaResourceDialect
7336 );
7337 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
7338 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7339 Ok(PeripheralRequest::ListenL2cap {
7340 payload: req,
7341 responder: PeripheralListenL2capResponder {
7342 control_handle: std::mem::ManuallyDrop::new(control_handle),
7343 tx_id: header.tx_id,
7344 },
7345 })
7346 }
7347 0x2d9ec9260c32c17f => {
7348 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7349 let mut req = fidl::new_empty!(
7350 PeripheralAdvertiseRequest,
7351 fidl::encoding::DefaultFuchsiaResourceDialect
7352 );
7353 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
7354 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7355 Ok(PeripheralRequest::Advertise {
7356 parameters: req.parameters,
7357 advertised_peripheral: req.advertised_peripheral,
7358
7359 responder: PeripheralAdvertiseResponder {
7360 control_handle: std::mem::ManuallyDrop::new(control_handle),
7361 tx_id: header.tx_id,
7362 },
7363 })
7364 }
7365 0x5875c1c575f00f7d => {
7366 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7367 let mut req = fidl::new_empty!(
7368 PeripheralStartAdvertisingRequest,
7369 fidl::encoding::DefaultFuchsiaResourceDialect
7370 );
7371 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
7372 let control_handle = PeripheralControlHandle { inner: this.inner.clone() };
7373 Ok(PeripheralRequest::StartAdvertising {
7374 parameters: req.parameters,
7375 handle: req.handle,
7376
7377 responder: PeripheralStartAdvertisingResponder {
7378 control_handle: std::mem::ManuallyDrop::new(control_handle),
7379 tx_id: header.tx_id,
7380 },
7381 })
7382 }
7383 _ => Err(fidl::Error::UnknownOrdinal {
7384 ordinal: header.ordinal,
7385 protocol_name:
7386 <PeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7387 }),
7388 }))
7389 },
7390 )
7391 }
7392}
7393
7394#[derive(Debug)]
7395pub enum PeripheralRequest {
7396 ListenL2cap {
7406 payload: ChannelListenerRegistryListenL2capRequest,
7407 responder: PeripheralListenL2capResponder,
7408 },
7409 Advertise {
7437 parameters: AdvertisingParameters,
7438 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7439 responder: PeripheralAdvertiseResponder,
7440 },
7441 StartAdvertising {
7462 parameters: AdvertisingParameters,
7463 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7464 responder: PeripheralStartAdvertisingResponder,
7465 },
7466}
7467
7468impl PeripheralRequest {
7469 #[allow(irrefutable_let_patterns)]
7470 pub fn into_listen_l2cap(
7471 self,
7472 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PeripheralListenL2capResponder)> {
7473 if let PeripheralRequest::ListenL2cap { payload, responder } = self {
7474 Some((payload, responder))
7475 } else {
7476 None
7477 }
7478 }
7479
7480 #[allow(irrefutable_let_patterns)]
7481 pub fn into_advertise(
7482 self,
7483 ) -> Option<(
7484 AdvertisingParameters,
7485 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7486 PeripheralAdvertiseResponder,
7487 )> {
7488 if let PeripheralRequest::Advertise { parameters, advertised_peripheral, responder } = self
7489 {
7490 Some((parameters, advertised_peripheral, responder))
7491 } else {
7492 None
7493 }
7494 }
7495
7496 #[allow(irrefutable_let_patterns)]
7497 pub fn into_start_advertising(
7498 self,
7499 ) -> Option<(
7500 AdvertisingParameters,
7501 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7502 PeripheralStartAdvertisingResponder,
7503 )> {
7504 if let PeripheralRequest::StartAdvertising { parameters, handle, responder } = self {
7505 Some((parameters, handle, responder))
7506 } else {
7507 None
7508 }
7509 }
7510
7511 pub fn method_name(&self) -> &'static str {
7513 match *self {
7514 PeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
7515 PeripheralRequest::Advertise { .. } => "advertise",
7516 PeripheralRequest::StartAdvertising { .. } => "start_advertising",
7517 }
7518 }
7519}
7520
7521#[derive(Debug, Clone)]
7522pub struct PeripheralControlHandle {
7523 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7524}
7525
7526impl fidl::endpoints::ControlHandle for PeripheralControlHandle {
7527 fn shutdown(&self) {
7528 self.inner.shutdown()
7529 }
7530 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7531 self.inner.shutdown_with_epitaph(status)
7532 }
7533
7534 fn is_closed(&self) -> bool {
7535 self.inner.channel().is_closed()
7536 }
7537 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7538 self.inner.channel().on_closed()
7539 }
7540
7541 #[cfg(target_os = "fuchsia")]
7542 fn signal_peer(
7543 &self,
7544 clear_mask: zx::Signals,
7545 set_mask: zx::Signals,
7546 ) -> Result<(), zx_status::Status> {
7547 use fidl::Peered;
7548 self.inner.channel().signal_peer(clear_mask, set_mask)
7549 }
7550}
7551
7552impl PeripheralControlHandle {
7553 pub fn send_on_peer_connected(
7554 &self,
7555 mut peer: &Peer,
7556 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
7557 ) -> Result<(), fidl::Error> {
7558 self.inner.send::<PeripheralOnPeerConnectedRequest>(
7559 (peer, connection),
7560 0,
7561 0x16135d464299e356,
7562 fidl::encoding::DynamicFlags::empty(),
7563 )
7564 }
7565}
7566
7567#[must_use = "FIDL methods require a response to be sent"]
7568#[derive(Debug)]
7569pub struct PeripheralListenL2capResponder {
7570 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7571 tx_id: u32,
7572}
7573
7574impl std::ops::Drop for PeripheralListenL2capResponder {
7578 fn drop(&mut self) {
7579 self.control_handle.shutdown();
7580 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7582 }
7583}
7584
7585impl fidl::endpoints::Responder for PeripheralListenL2capResponder {
7586 type ControlHandle = PeripheralControlHandle;
7587
7588 fn control_handle(&self) -> &PeripheralControlHandle {
7589 &self.control_handle
7590 }
7591
7592 fn drop_without_shutdown(mut self) {
7593 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7595 std::mem::forget(self);
7597 }
7598}
7599
7600impl PeripheralListenL2capResponder {
7601 pub fn send(
7605 self,
7606 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7607 ) -> Result<(), fidl::Error> {
7608 let _result = self.send_raw(result);
7609 if _result.is_err() {
7610 self.control_handle.shutdown();
7611 }
7612 self.drop_without_shutdown();
7613 _result
7614 }
7615
7616 pub fn send_no_shutdown_on_err(
7618 self,
7619 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7620 ) -> Result<(), fidl::Error> {
7621 let _result = self.send_raw(result);
7622 self.drop_without_shutdown();
7623 _result
7624 }
7625
7626 fn send_raw(
7627 &self,
7628 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
7629 ) -> Result<(), fidl::Error> {
7630 self.control_handle.inner.send::<fidl::encoding::ResultType<
7631 ChannelListenerRegistryListenL2capResponse,
7632 i32,
7633 >>(
7634 result,
7635 self.tx_id,
7636 0x39c6e9001d102338,
7637 fidl::encoding::DynamicFlags::empty(),
7638 )
7639 }
7640}
7641
7642#[must_use = "FIDL methods require a response to be sent"]
7643#[derive(Debug)]
7644pub struct PeripheralAdvertiseResponder {
7645 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7646 tx_id: u32,
7647}
7648
7649impl std::ops::Drop for PeripheralAdvertiseResponder {
7653 fn drop(&mut self) {
7654 self.control_handle.shutdown();
7655 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7657 }
7658}
7659
7660impl fidl::endpoints::Responder for PeripheralAdvertiseResponder {
7661 type ControlHandle = PeripheralControlHandle;
7662
7663 fn control_handle(&self) -> &PeripheralControlHandle {
7664 &self.control_handle
7665 }
7666
7667 fn drop_without_shutdown(mut self) {
7668 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7670 std::mem::forget(self);
7672 }
7673}
7674
7675impl PeripheralAdvertiseResponder {
7676 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7680 let _result = self.send_raw(result);
7681 if _result.is_err() {
7682 self.control_handle.shutdown();
7683 }
7684 self.drop_without_shutdown();
7685 _result
7686 }
7687
7688 pub fn send_no_shutdown_on_err(
7690 self,
7691 mut result: Result<(), PeripheralError>,
7692 ) -> Result<(), fidl::Error> {
7693 let _result = self.send_raw(result);
7694 self.drop_without_shutdown();
7695 _result
7696 }
7697
7698 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7699 self.control_handle.inner.send::<fidl::encoding::ResultType<
7700 fidl::encoding::EmptyStruct,
7701 PeripheralError,
7702 >>(
7703 result,
7704 self.tx_id,
7705 0x2d9ec9260c32c17f,
7706 fidl::encoding::DynamicFlags::empty(),
7707 )
7708 }
7709}
7710
7711#[must_use = "FIDL methods require a response to be sent"]
7712#[derive(Debug)]
7713pub struct PeripheralStartAdvertisingResponder {
7714 control_handle: std::mem::ManuallyDrop<PeripheralControlHandle>,
7715 tx_id: u32,
7716}
7717
7718impl std::ops::Drop for PeripheralStartAdvertisingResponder {
7722 fn drop(&mut self) {
7723 self.control_handle.shutdown();
7724 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7726 }
7727}
7728
7729impl fidl::endpoints::Responder for PeripheralStartAdvertisingResponder {
7730 type ControlHandle = PeripheralControlHandle;
7731
7732 fn control_handle(&self) -> &PeripheralControlHandle {
7733 &self.control_handle
7734 }
7735
7736 fn drop_without_shutdown(mut self) {
7737 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7739 std::mem::forget(self);
7741 }
7742}
7743
7744impl PeripheralStartAdvertisingResponder {
7745 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7749 let _result = self.send_raw(result);
7750 if _result.is_err() {
7751 self.control_handle.shutdown();
7752 }
7753 self.drop_without_shutdown();
7754 _result
7755 }
7756
7757 pub fn send_no_shutdown_on_err(
7759 self,
7760 mut result: Result<(), PeripheralError>,
7761 ) -> Result<(), fidl::Error> {
7762 let _result = self.send_raw(result);
7763 self.drop_without_shutdown();
7764 _result
7765 }
7766
7767 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
7768 self.control_handle.inner.send::<fidl::encoding::ResultType<
7769 fidl::encoding::EmptyStruct,
7770 PeripheralError,
7771 >>(
7772 result,
7773 self.tx_id,
7774 0x5875c1c575f00f7d,
7775 fidl::encoding::DynamicFlags::empty(),
7776 )
7777 }
7778}
7779
7780#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7781pub struct PrivilegedPeripheralMarker;
7782
7783impl fidl::endpoints::ProtocolMarker for PrivilegedPeripheralMarker {
7784 type Proxy = PrivilegedPeripheralProxy;
7785 type RequestStream = PrivilegedPeripheralRequestStream;
7786 #[cfg(target_os = "fuchsia")]
7787 type SynchronousProxy = PrivilegedPeripheralSynchronousProxy;
7788
7789 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.le.PrivilegedPeripheral";
7790}
7791impl fidl::endpoints::DiscoverableProtocolMarker for PrivilegedPeripheralMarker {}
7792
7793pub trait PrivilegedPeripheralProxyInterface: Send + Sync {
7794 type ListenL2capResponseFut: std::future::Future<Output = Result<ChannelListenerRegistryListenL2capResult, fidl::Error>>
7795 + Send;
7796 fn r#listen_l2cap(
7797 &self,
7798 payload: ChannelListenerRegistryListenL2capRequest,
7799 ) -> Self::ListenL2capResponseFut;
7800 type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralAdvertiseResult, fidl::Error>>
7801 + Send;
7802 fn r#advertise(
7803 &self,
7804 parameters: &AdvertisingParameters,
7805 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7806 ) -> Self::AdvertiseResponseFut;
7807 type StartAdvertisingResponseFut: std::future::Future<Output = Result<PeripheralStartAdvertisingResult, fidl::Error>>
7808 + Send;
7809 fn r#start_advertising(
7810 &self,
7811 parameters: &AdvertisingParameters,
7812 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7813 ) -> Self::StartAdvertisingResponseFut;
7814}
7815#[derive(Debug)]
7816#[cfg(target_os = "fuchsia")]
7817pub struct PrivilegedPeripheralSynchronousProxy {
7818 client: fidl::client::sync::Client,
7819}
7820
7821#[cfg(target_os = "fuchsia")]
7822impl fidl::endpoints::SynchronousProxy for PrivilegedPeripheralSynchronousProxy {
7823 type Proxy = PrivilegedPeripheralProxy;
7824 type Protocol = PrivilegedPeripheralMarker;
7825
7826 fn from_channel(inner: fidl::Channel) -> Self {
7827 Self::new(inner)
7828 }
7829
7830 fn into_channel(self) -> fidl::Channel {
7831 self.client.into_channel()
7832 }
7833
7834 fn as_channel(&self) -> &fidl::Channel {
7835 self.client.as_channel()
7836 }
7837}
7838
7839#[cfg(target_os = "fuchsia")]
7840impl PrivilegedPeripheralSynchronousProxy {
7841 pub fn new(channel: fidl::Channel) -> Self {
7842 let protocol_name =
7843 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7844 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7845 }
7846
7847 pub fn into_channel(self) -> fidl::Channel {
7848 self.client.into_channel()
7849 }
7850
7851 pub fn wait_for_event(
7854 &self,
7855 deadline: zx::MonotonicInstant,
7856 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
7857 PrivilegedPeripheralEvent::decode(self.client.wait_for_event(deadline)?)
7858 }
7859
7860 pub fn r#listen_l2cap(
7870 &self,
7871 mut payload: ChannelListenerRegistryListenL2capRequest,
7872 ___deadline: zx::MonotonicInstant,
7873 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
7874 let _response = self.client.send_query::<
7875 ChannelListenerRegistryListenL2capRequest,
7876 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
7877 >(
7878 &mut payload,
7879 0x39c6e9001d102338,
7880 fidl::encoding::DynamicFlags::empty(),
7881 ___deadline,
7882 )?;
7883 Ok(_response.map(|x| x))
7884 }
7885
7886 pub fn r#advertise(
7914 &self,
7915 mut parameters: &AdvertisingParameters,
7916 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
7917 ___deadline: zx::MonotonicInstant,
7918 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
7919 let _response = self.client.send_query::<
7920 PeripheralAdvertiseRequest,
7921 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7922 >(
7923 (parameters, advertised_peripheral,),
7924 0x2d9ec9260c32c17f,
7925 fidl::encoding::DynamicFlags::empty(),
7926 ___deadline,
7927 )?;
7928 Ok(_response.map(|x| x))
7929 }
7930
7931 pub fn r#start_advertising(
7952 &self,
7953 mut parameters: &AdvertisingParameters,
7954 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
7955 ___deadline: zx::MonotonicInstant,
7956 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
7957 let _response = self.client.send_query::<
7958 PeripheralStartAdvertisingRequest,
7959 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
7960 >(
7961 (parameters, handle,),
7962 0x5875c1c575f00f7d,
7963 fidl::encoding::DynamicFlags::empty(),
7964 ___deadline,
7965 )?;
7966 Ok(_response.map(|x| x))
7967 }
7968}
7969
7970#[cfg(target_os = "fuchsia")]
7971impl From<PrivilegedPeripheralSynchronousProxy> for zx::Handle {
7972 fn from(value: PrivilegedPeripheralSynchronousProxy) -> Self {
7973 value.into_channel().into()
7974 }
7975}
7976
7977#[cfg(target_os = "fuchsia")]
7978impl From<fidl::Channel> for PrivilegedPeripheralSynchronousProxy {
7979 fn from(value: fidl::Channel) -> Self {
7980 Self::new(value)
7981 }
7982}
7983
7984#[derive(Debug, Clone)]
7985pub struct PrivilegedPeripheralProxy {
7986 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7987}
7988
7989impl fidl::endpoints::Proxy for PrivilegedPeripheralProxy {
7990 type Protocol = PrivilegedPeripheralMarker;
7991
7992 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7993 Self::new(inner)
7994 }
7995
7996 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7997 self.client.into_channel().map_err(|client| Self { client })
7998 }
7999
8000 fn as_channel(&self) -> &::fidl::AsyncChannel {
8001 self.client.as_channel()
8002 }
8003}
8004
8005impl PrivilegedPeripheralProxy {
8006 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8008 let protocol_name =
8009 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8010 Self { client: fidl::client::Client::new(channel, protocol_name) }
8011 }
8012
8013 pub fn take_event_stream(&self) -> PrivilegedPeripheralEventStream {
8019 PrivilegedPeripheralEventStream { event_receiver: self.client.take_event_receiver() }
8020 }
8021
8022 pub fn r#listen_l2cap(
8032 &self,
8033 mut payload: ChannelListenerRegistryListenL2capRequest,
8034 ) -> fidl::client::QueryResponseFut<
8035 ChannelListenerRegistryListenL2capResult,
8036 fidl::encoding::DefaultFuchsiaResourceDialect,
8037 > {
8038 PrivilegedPeripheralProxyInterface::r#listen_l2cap(self, payload)
8039 }
8040
8041 pub fn r#advertise(
8069 &self,
8070 mut parameters: &AdvertisingParameters,
8071 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8072 ) -> fidl::client::QueryResponseFut<
8073 PeripheralAdvertiseResult,
8074 fidl::encoding::DefaultFuchsiaResourceDialect,
8075 > {
8076 PrivilegedPeripheralProxyInterface::r#advertise(self, parameters, advertised_peripheral)
8077 }
8078
8079 pub fn r#start_advertising(
8100 &self,
8101 mut parameters: &AdvertisingParameters,
8102 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8103 ) -> fidl::client::QueryResponseFut<
8104 PeripheralStartAdvertisingResult,
8105 fidl::encoding::DefaultFuchsiaResourceDialect,
8106 > {
8107 PrivilegedPeripheralProxyInterface::r#start_advertising(self, parameters, handle)
8108 }
8109}
8110
8111impl PrivilegedPeripheralProxyInterface for PrivilegedPeripheralProxy {
8112 type ListenL2capResponseFut = fidl::client::QueryResponseFut<
8113 ChannelListenerRegistryListenL2capResult,
8114 fidl::encoding::DefaultFuchsiaResourceDialect,
8115 >;
8116 fn r#listen_l2cap(
8117 &self,
8118 mut payload: ChannelListenerRegistryListenL2capRequest,
8119 ) -> Self::ListenL2capResponseFut {
8120 fn _decode(
8121 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8122 ) -> Result<ChannelListenerRegistryListenL2capResult, fidl::Error> {
8123 let _response = fidl::client::decode_transaction_body::<
8124 fidl::encoding::ResultType<ChannelListenerRegistryListenL2capResponse, i32>,
8125 fidl::encoding::DefaultFuchsiaResourceDialect,
8126 0x39c6e9001d102338,
8127 >(_buf?)?;
8128 Ok(_response.map(|x| x))
8129 }
8130 self.client.send_query_and_decode::<
8131 ChannelListenerRegistryListenL2capRequest,
8132 ChannelListenerRegistryListenL2capResult,
8133 >(
8134 &mut payload,
8135 0x39c6e9001d102338,
8136 fidl::encoding::DynamicFlags::empty(),
8137 _decode,
8138 )
8139 }
8140
8141 type AdvertiseResponseFut = fidl::client::QueryResponseFut<
8142 PeripheralAdvertiseResult,
8143 fidl::encoding::DefaultFuchsiaResourceDialect,
8144 >;
8145 fn r#advertise(
8146 &self,
8147 mut parameters: &AdvertisingParameters,
8148 mut advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8149 ) -> Self::AdvertiseResponseFut {
8150 fn _decode(
8151 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8152 ) -> Result<PeripheralAdvertiseResult, fidl::Error> {
8153 let _response = fidl::client::decode_transaction_body::<
8154 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8155 fidl::encoding::DefaultFuchsiaResourceDialect,
8156 0x2d9ec9260c32c17f,
8157 >(_buf?)?;
8158 Ok(_response.map(|x| x))
8159 }
8160 self.client.send_query_and_decode::<PeripheralAdvertiseRequest, PeripheralAdvertiseResult>(
8161 (parameters, advertised_peripheral),
8162 0x2d9ec9260c32c17f,
8163 fidl::encoding::DynamicFlags::empty(),
8164 _decode,
8165 )
8166 }
8167
8168 type StartAdvertisingResponseFut = fidl::client::QueryResponseFut<
8169 PeripheralStartAdvertisingResult,
8170 fidl::encoding::DefaultFuchsiaResourceDialect,
8171 >;
8172 fn r#start_advertising(
8173 &self,
8174 mut parameters: &AdvertisingParameters,
8175 mut handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8176 ) -> Self::StartAdvertisingResponseFut {
8177 fn _decode(
8178 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8179 ) -> Result<PeripheralStartAdvertisingResult, fidl::Error> {
8180 let _response = fidl::client::decode_transaction_body::<
8181 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeripheralError>,
8182 fidl::encoding::DefaultFuchsiaResourceDialect,
8183 0x5875c1c575f00f7d,
8184 >(_buf?)?;
8185 Ok(_response.map(|x| x))
8186 }
8187 self.client.send_query_and_decode::<
8188 PeripheralStartAdvertisingRequest,
8189 PeripheralStartAdvertisingResult,
8190 >(
8191 (parameters, handle,),
8192 0x5875c1c575f00f7d,
8193 fidl::encoding::DynamicFlags::empty(),
8194 _decode,
8195 )
8196 }
8197}
8198
8199pub struct PrivilegedPeripheralEventStream {
8200 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8201}
8202
8203impl std::marker::Unpin for PrivilegedPeripheralEventStream {}
8204
8205impl futures::stream::FusedStream for PrivilegedPeripheralEventStream {
8206 fn is_terminated(&self) -> bool {
8207 self.event_receiver.is_terminated()
8208 }
8209}
8210
8211impl futures::Stream for PrivilegedPeripheralEventStream {
8212 type Item = Result<PrivilegedPeripheralEvent, fidl::Error>;
8213
8214 fn poll_next(
8215 mut self: std::pin::Pin<&mut Self>,
8216 cx: &mut std::task::Context<'_>,
8217 ) -> std::task::Poll<Option<Self::Item>> {
8218 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8219 &mut self.event_receiver,
8220 cx
8221 )?) {
8222 Some(buf) => std::task::Poll::Ready(Some(PrivilegedPeripheralEvent::decode(buf))),
8223 None => std::task::Poll::Ready(None),
8224 }
8225 }
8226}
8227
8228#[derive(Debug)]
8229pub enum PrivilegedPeripheralEvent {
8230 OnPeerConnected { peer: Peer, connection: fidl::endpoints::ClientEnd<ConnectionMarker> },
8231}
8232
8233impl PrivilegedPeripheralEvent {
8234 #[allow(irrefutable_let_patterns)]
8235 pub fn into_on_peer_connected(
8236 self,
8237 ) -> Option<(Peer, fidl::endpoints::ClientEnd<ConnectionMarker>)> {
8238 if let PrivilegedPeripheralEvent::OnPeerConnected { peer, connection } = self {
8239 Some((peer, connection))
8240 } else {
8241 None
8242 }
8243 }
8244
8245 fn decode(
8247 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8248 ) -> Result<PrivilegedPeripheralEvent, fidl::Error> {
8249 let (bytes, _handles) = buf.split_mut();
8250 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8251 debug_assert_eq!(tx_header.tx_id, 0);
8252 match tx_header.ordinal {
8253 0x16135d464299e356 => {
8254 let mut out = fidl::new_empty!(
8255 PeripheralOnPeerConnectedRequest,
8256 fidl::encoding::DefaultFuchsiaResourceDialect
8257 );
8258 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
8259 Ok((PrivilegedPeripheralEvent::OnPeerConnected {
8260 peer: out.peer,
8261 connection: out.connection,
8262 }))
8263 }
8264 _ => Err(fidl::Error::UnknownOrdinal {
8265 ordinal: tx_header.ordinal,
8266 protocol_name:
8267 <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8268 }),
8269 }
8270 }
8271}
8272
8273pub struct PrivilegedPeripheralRequestStream {
8275 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8276 is_terminated: bool,
8277}
8278
8279impl std::marker::Unpin for PrivilegedPeripheralRequestStream {}
8280
8281impl futures::stream::FusedStream for PrivilegedPeripheralRequestStream {
8282 fn is_terminated(&self) -> bool {
8283 self.is_terminated
8284 }
8285}
8286
8287impl fidl::endpoints::RequestStream for PrivilegedPeripheralRequestStream {
8288 type Protocol = PrivilegedPeripheralMarker;
8289 type ControlHandle = PrivilegedPeripheralControlHandle;
8290
8291 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8292 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8293 }
8294
8295 fn control_handle(&self) -> Self::ControlHandle {
8296 PrivilegedPeripheralControlHandle { inner: self.inner.clone() }
8297 }
8298
8299 fn into_inner(
8300 self,
8301 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8302 {
8303 (self.inner, self.is_terminated)
8304 }
8305
8306 fn from_inner(
8307 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8308 is_terminated: bool,
8309 ) -> Self {
8310 Self { inner, is_terminated }
8311 }
8312}
8313
8314impl futures::Stream for PrivilegedPeripheralRequestStream {
8315 type Item = Result<PrivilegedPeripheralRequest, fidl::Error>;
8316
8317 fn poll_next(
8318 mut self: std::pin::Pin<&mut Self>,
8319 cx: &mut std::task::Context<'_>,
8320 ) -> std::task::Poll<Option<Self::Item>> {
8321 let this = &mut *self;
8322 if this.inner.check_shutdown(cx) {
8323 this.is_terminated = true;
8324 return std::task::Poll::Ready(None);
8325 }
8326 if this.is_terminated {
8327 panic!("polled PrivilegedPeripheralRequestStream after completion");
8328 }
8329 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8330 |bytes, handles| {
8331 match this.inner.channel().read_etc(cx, bytes, handles) {
8332 std::task::Poll::Ready(Ok(())) => {}
8333 std::task::Poll::Pending => return std::task::Poll::Pending,
8334 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8335 this.is_terminated = true;
8336 return std::task::Poll::Ready(None);
8337 }
8338 std::task::Poll::Ready(Err(e)) => {
8339 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8340 e.into(),
8341 ))))
8342 }
8343 }
8344
8345 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8347
8348 std::task::Poll::Ready(Some(match header.ordinal {
8349 0x39c6e9001d102338 => {
8350 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8351 let mut req = fidl::new_empty!(ChannelListenerRegistryListenL2capRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8352 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ChannelListenerRegistryListenL2capRequest>(&header, _body_bytes, handles, &mut req)?;
8353 let control_handle = PrivilegedPeripheralControlHandle {
8354 inner: this.inner.clone(),
8355 };
8356 Ok(PrivilegedPeripheralRequest::ListenL2cap {payload: req,
8357 responder: PrivilegedPeripheralListenL2capResponder {
8358 control_handle: std::mem::ManuallyDrop::new(control_handle),
8359 tx_id: header.tx_id,
8360 },
8361 })
8362 }
8363 0x2d9ec9260c32c17f => {
8364 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8365 let mut req = fidl::new_empty!(PeripheralAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8366 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
8367 let control_handle = PrivilegedPeripheralControlHandle {
8368 inner: this.inner.clone(),
8369 };
8370 Ok(PrivilegedPeripheralRequest::Advertise {parameters: req.parameters,
8371advertised_peripheral: req.advertised_peripheral,
8372
8373 responder: PrivilegedPeripheralAdvertiseResponder {
8374 control_handle: std::mem::ManuallyDrop::new(control_handle),
8375 tx_id: header.tx_id,
8376 },
8377 })
8378 }
8379 0x5875c1c575f00f7d => {
8380 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8381 let mut req = fidl::new_empty!(PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8382 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralStartAdvertisingRequest>(&header, _body_bytes, handles, &mut req)?;
8383 let control_handle = PrivilegedPeripheralControlHandle {
8384 inner: this.inner.clone(),
8385 };
8386 Ok(PrivilegedPeripheralRequest::StartAdvertising {parameters: req.parameters,
8387handle: req.handle,
8388
8389 responder: PrivilegedPeripheralStartAdvertisingResponder {
8390 control_handle: std::mem::ManuallyDrop::new(control_handle),
8391 tx_id: header.tx_id,
8392 },
8393 })
8394 }
8395 _ => Err(fidl::Error::UnknownOrdinal {
8396 ordinal: header.ordinal,
8397 protocol_name: <PrivilegedPeripheralMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8398 }),
8399 }))
8400 },
8401 )
8402 }
8403}
8404
8405#[derive(Debug)]
8413pub enum PrivilegedPeripheralRequest {
8414 ListenL2cap {
8424 payload: ChannelListenerRegistryListenL2capRequest,
8425 responder: PrivilegedPeripheralListenL2capResponder,
8426 },
8427 Advertise {
8455 parameters: AdvertisingParameters,
8456 advertised_peripheral: fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8457 responder: PrivilegedPeripheralAdvertiseResponder,
8458 },
8459 StartAdvertising {
8480 parameters: AdvertisingParameters,
8481 handle: fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8482 responder: PrivilegedPeripheralStartAdvertisingResponder,
8483 },
8484}
8485
8486impl PrivilegedPeripheralRequest {
8487 #[allow(irrefutable_let_patterns)]
8488 pub fn into_listen_l2cap(
8489 self,
8490 ) -> Option<(ChannelListenerRegistryListenL2capRequest, PrivilegedPeripheralListenL2capResponder)>
8491 {
8492 if let PrivilegedPeripheralRequest::ListenL2cap { payload, responder } = self {
8493 Some((payload, responder))
8494 } else {
8495 None
8496 }
8497 }
8498
8499 #[allow(irrefutable_let_patterns)]
8500 pub fn into_advertise(
8501 self,
8502 ) -> Option<(
8503 AdvertisingParameters,
8504 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
8505 PrivilegedPeripheralAdvertiseResponder,
8506 )> {
8507 if let PrivilegedPeripheralRequest::Advertise {
8508 parameters,
8509 advertised_peripheral,
8510 responder,
8511 } = self
8512 {
8513 Some((parameters, advertised_peripheral, responder))
8514 } else {
8515 None
8516 }
8517 }
8518
8519 #[allow(irrefutable_let_patterns)]
8520 pub fn into_start_advertising(
8521 self,
8522 ) -> Option<(
8523 AdvertisingParameters,
8524 fidl::endpoints::ServerEnd<AdvertisingHandleMarker>,
8525 PrivilegedPeripheralStartAdvertisingResponder,
8526 )> {
8527 if let PrivilegedPeripheralRequest::StartAdvertising { parameters, handle, responder } =
8528 self
8529 {
8530 Some((parameters, handle, responder))
8531 } else {
8532 None
8533 }
8534 }
8535
8536 pub fn method_name(&self) -> &'static str {
8538 match *self {
8539 PrivilegedPeripheralRequest::ListenL2cap { .. } => "listen_l2cap",
8540 PrivilegedPeripheralRequest::Advertise { .. } => "advertise",
8541 PrivilegedPeripheralRequest::StartAdvertising { .. } => "start_advertising",
8542 }
8543 }
8544}
8545
8546#[derive(Debug, Clone)]
8547pub struct PrivilegedPeripheralControlHandle {
8548 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8549}
8550
8551impl fidl::endpoints::ControlHandle for PrivilegedPeripheralControlHandle {
8552 fn shutdown(&self) {
8553 self.inner.shutdown()
8554 }
8555 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8556 self.inner.shutdown_with_epitaph(status)
8557 }
8558
8559 fn is_closed(&self) -> bool {
8560 self.inner.channel().is_closed()
8561 }
8562 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8563 self.inner.channel().on_closed()
8564 }
8565
8566 #[cfg(target_os = "fuchsia")]
8567 fn signal_peer(
8568 &self,
8569 clear_mask: zx::Signals,
8570 set_mask: zx::Signals,
8571 ) -> Result<(), zx_status::Status> {
8572 use fidl::Peered;
8573 self.inner.channel().signal_peer(clear_mask, set_mask)
8574 }
8575}
8576
8577impl PrivilegedPeripheralControlHandle {
8578 pub fn send_on_peer_connected(
8579 &self,
8580 mut peer: &Peer,
8581 mut connection: fidl::endpoints::ClientEnd<ConnectionMarker>,
8582 ) -> Result<(), fidl::Error> {
8583 self.inner.send::<PeripheralOnPeerConnectedRequest>(
8584 (peer, connection),
8585 0,
8586 0x16135d464299e356,
8587 fidl::encoding::DynamicFlags::empty(),
8588 )
8589 }
8590}
8591
8592#[must_use = "FIDL methods require a response to be sent"]
8593#[derive(Debug)]
8594pub struct PrivilegedPeripheralListenL2capResponder {
8595 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8596 tx_id: u32,
8597}
8598
8599impl std::ops::Drop for PrivilegedPeripheralListenL2capResponder {
8603 fn drop(&mut self) {
8604 self.control_handle.shutdown();
8605 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8607 }
8608}
8609
8610impl fidl::endpoints::Responder for PrivilegedPeripheralListenL2capResponder {
8611 type ControlHandle = PrivilegedPeripheralControlHandle;
8612
8613 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8614 &self.control_handle
8615 }
8616
8617 fn drop_without_shutdown(mut self) {
8618 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8620 std::mem::forget(self);
8622 }
8623}
8624
8625impl PrivilegedPeripheralListenL2capResponder {
8626 pub fn send(
8630 self,
8631 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8632 ) -> Result<(), fidl::Error> {
8633 let _result = self.send_raw(result);
8634 if _result.is_err() {
8635 self.control_handle.shutdown();
8636 }
8637 self.drop_without_shutdown();
8638 _result
8639 }
8640
8641 pub fn send_no_shutdown_on_err(
8643 self,
8644 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8645 ) -> Result<(), fidl::Error> {
8646 let _result = self.send_raw(result);
8647 self.drop_without_shutdown();
8648 _result
8649 }
8650
8651 fn send_raw(
8652 &self,
8653 mut result: Result<&ChannelListenerRegistryListenL2capResponse, i32>,
8654 ) -> Result<(), fidl::Error> {
8655 self.control_handle.inner.send::<fidl::encoding::ResultType<
8656 ChannelListenerRegistryListenL2capResponse,
8657 i32,
8658 >>(
8659 result,
8660 self.tx_id,
8661 0x39c6e9001d102338,
8662 fidl::encoding::DynamicFlags::empty(),
8663 )
8664 }
8665}
8666
8667#[must_use = "FIDL methods require a response to be sent"]
8668#[derive(Debug)]
8669pub struct PrivilegedPeripheralAdvertiseResponder {
8670 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8671 tx_id: u32,
8672}
8673
8674impl std::ops::Drop for PrivilegedPeripheralAdvertiseResponder {
8678 fn drop(&mut self) {
8679 self.control_handle.shutdown();
8680 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8682 }
8683}
8684
8685impl fidl::endpoints::Responder for PrivilegedPeripheralAdvertiseResponder {
8686 type ControlHandle = PrivilegedPeripheralControlHandle;
8687
8688 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8689 &self.control_handle
8690 }
8691
8692 fn drop_without_shutdown(mut self) {
8693 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8695 std::mem::forget(self);
8697 }
8698}
8699
8700impl PrivilegedPeripheralAdvertiseResponder {
8701 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8705 let _result = self.send_raw(result);
8706 if _result.is_err() {
8707 self.control_handle.shutdown();
8708 }
8709 self.drop_without_shutdown();
8710 _result
8711 }
8712
8713 pub fn send_no_shutdown_on_err(
8715 self,
8716 mut result: Result<(), PeripheralError>,
8717 ) -> Result<(), fidl::Error> {
8718 let _result = self.send_raw(result);
8719 self.drop_without_shutdown();
8720 _result
8721 }
8722
8723 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8724 self.control_handle.inner.send::<fidl::encoding::ResultType<
8725 fidl::encoding::EmptyStruct,
8726 PeripheralError,
8727 >>(
8728 result,
8729 self.tx_id,
8730 0x2d9ec9260c32c17f,
8731 fidl::encoding::DynamicFlags::empty(),
8732 )
8733 }
8734}
8735
8736#[must_use = "FIDL methods require a response to be sent"]
8737#[derive(Debug)]
8738pub struct PrivilegedPeripheralStartAdvertisingResponder {
8739 control_handle: std::mem::ManuallyDrop<PrivilegedPeripheralControlHandle>,
8740 tx_id: u32,
8741}
8742
8743impl std::ops::Drop for PrivilegedPeripheralStartAdvertisingResponder {
8747 fn drop(&mut self) {
8748 self.control_handle.shutdown();
8749 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8751 }
8752}
8753
8754impl fidl::endpoints::Responder for PrivilegedPeripheralStartAdvertisingResponder {
8755 type ControlHandle = PrivilegedPeripheralControlHandle;
8756
8757 fn control_handle(&self) -> &PrivilegedPeripheralControlHandle {
8758 &self.control_handle
8759 }
8760
8761 fn drop_without_shutdown(mut self) {
8762 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8764 std::mem::forget(self);
8766 }
8767}
8768
8769impl PrivilegedPeripheralStartAdvertisingResponder {
8770 pub fn send(self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8774 let _result = self.send_raw(result);
8775 if _result.is_err() {
8776 self.control_handle.shutdown();
8777 }
8778 self.drop_without_shutdown();
8779 _result
8780 }
8781
8782 pub fn send_no_shutdown_on_err(
8784 self,
8785 mut result: Result<(), PeripheralError>,
8786 ) -> Result<(), fidl::Error> {
8787 let _result = self.send_raw(result);
8788 self.drop_without_shutdown();
8789 _result
8790 }
8791
8792 fn send_raw(&self, mut result: Result<(), PeripheralError>) -> Result<(), fidl::Error> {
8793 self.control_handle.inner.send::<fidl::encoding::ResultType<
8794 fidl::encoding::EmptyStruct,
8795 PeripheralError,
8796 >>(
8797 result,
8798 self.tx_id,
8799 0x5875c1c575f00f7d,
8800 fidl::encoding::DynamicFlags::empty(),
8801 )
8802 }
8803}
8804
8805#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8806pub struct ScanResultWatcherMarker;
8807
8808impl fidl::endpoints::ProtocolMarker for ScanResultWatcherMarker {
8809 type Proxy = ScanResultWatcherProxy;
8810 type RequestStream = ScanResultWatcherRequestStream;
8811 #[cfg(target_os = "fuchsia")]
8812 type SynchronousProxy = ScanResultWatcherSynchronousProxy;
8813
8814 const DEBUG_NAME: &'static str = "(anonymous) ScanResultWatcher";
8815}
8816
8817pub trait ScanResultWatcherProxyInterface: Send + Sync {
8818 type WatchResponseFut: std::future::Future<Output = Result<Vec<Peer>, fidl::Error>> + Send;
8819 fn r#watch(&self) -> Self::WatchResponseFut;
8820}
8821#[derive(Debug)]
8822#[cfg(target_os = "fuchsia")]
8823pub struct ScanResultWatcherSynchronousProxy {
8824 client: fidl::client::sync::Client,
8825}
8826
8827#[cfg(target_os = "fuchsia")]
8828impl fidl::endpoints::SynchronousProxy for ScanResultWatcherSynchronousProxy {
8829 type Proxy = ScanResultWatcherProxy;
8830 type Protocol = ScanResultWatcherMarker;
8831
8832 fn from_channel(inner: fidl::Channel) -> Self {
8833 Self::new(inner)
8834 }
8835
8836 fn into_channel(self) -> fidl::Channel {
8837 self.client.into_channel()
8838 }
8839
8840 fn as_channel(&self) -> &fidl::Channel {
8841 self.client.as_channel()
8842 }
8843}
8844
8845#[cfg(target_os = "fuchsia")]
8846impl ScanResultWatcherSynchronousProxy {
8847 pub fn new(channel: fidl::Channel) -> Self {
8848 let protocol_name =
8849 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8850 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8851 }
8852
8853 pub fn into_channel(self) -> fidl::Channel {
8854 self.client.into_channel()
8855 }
8856
8857 pub fn wait_for_event(
8860 &self,
8861 deadline: zx::MonotonicInstant,
8862 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
8863 ScanResultWatcherEvent::decode(self.client.wait_for_event(deadline)?)
8864 }
8865
8866 pub fn r#watch(&self, ___deadline: zx::MonotonicInstant) -> Result<Vec<Peer>, fidl::Error> {
8876 let _response = self
8877 .client
8878 .send_query::<fidl::encoding::EmptyPayload, ScanResultWatcherWatchResponse>(
8879 (),
8880 0x713a122e949f301a,
8881 fidl::encoding::DynamicFlags::empty(),
8882 ___deadline,
8883 )?;
8884 Ok(_response.updated)
8885 }
8886}
8887
8888#[cfg(target_os = "fuchsia")]
8889impl From<ScanResultWatcherSynchronousProxy> for zx::Handle {
8890 fn from(value: ScanResultWatcherSynchronousProxy) -> Self {
8891 value.into_channel().into()
8892 }
8893}
8894
8895#[cfg(target_os = "fuchsia")]
8896impl From<fidl::Channel> for ScanResultWatcherSynchronousProxy {
8897 fn from(value: fidl::Channel) -> Self {
8898 Self::new(value)
8899 }
8900}
8901
8902#[derive(Debug, Clone)]
8903pub struct ScanResultWatcherProxy {
8904 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8905}
8906
8907impl fidl::endpoints::Proxy for ScanResultWatcherProxy {
8908 type Protocol = ScanResultWatcherMarker;
8909
8910 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8911 Self::new(inner)
8912 }
8913
8914 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8915 self.client.into_channel().map_err(|client| Self { client })
8916 }
8917
8918 fn as_channel(&self) -> &::fidl::AsyncChannel {
8919 self.client.as_channel()
8920 }
8921}
8922
8923impl ScanResultWatcherProxy {
8924 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8926 let protocol_name =
8927 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8928 Self { client: fidl::client::Client::new(channel, protocol_name) }
8929 }
8930
8931 pub fn take_event_stream(&self) -> ScanResultWatcherEventStream {
8937 ScanResultWatcherEventStream { event_receiver: self.client.take_event_receiver() }
8938 }
8939
8940 pub fn r#watch(
8950 &self,
8951 ) -> fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>
8952 {
8953 ScanResultWatcherProxyInterface::r#watch(self)
8954 }
8955}
8956
8957impl ScanResultWatcherProxyInterface for ScanResultWatcherProxy {
8958 type WatchResponseFut =
8959 fidl::client::QueryResponseFut<Vec<Peer>, fidl::encoding::DefaultFuchsiaResourceDialect>;
8960 fn r#watch(&self) -> Self::WatchResponseFut {
8961 fn _decode(
8962 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8963 ) -> Result<Vec<Peer>, fidl::Error> {
8964 let _response = fidl::client::decode_transaction_body::<
8965 ScanResultWatcherWatchResponse,
8966 fidl::encoding::DefaultFuchsiaResourceDialect,
8967 0x713a122e949f301a,
8968 >(_buf?)?;
8969 Ok(_response.updated)
8970 }
8971 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Peer>>(
8972 (),
8973 0x713a122e949f301a,
8974 fidl::encoding::DynamicFlags::empty(),
8975 _decode,
8976 )
8977 }
8978}
8979
8980pub struct ScanResultWatcherEventStream {
8981 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8982}
8983
8984impl std::marker::Unpin for ScanResultWatcherEventStream {}
8985
8986impl futures::stream::FusedStream for ScanResultWatcherEventStream {
8987 fn is_terminated(&self) -> bool {
8988 self.event_receiver.is_terminated()
8989 }
8990}
8991
8992impl futures::Stream for ScanResultWatcherEventStream {
8993 type Item = Result<ScanResultWatcherEvent, fidl::Error>;
8994
8995 fn poll_next(
8996 mut self: std::pin::Pin<&mut Self>,
8997 cx: &mut std::task::Context<'_>,
8998 ) -> std::task::Poll<Option<Self::Item>> {
8999 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9000 &mut self.event_receiver,
9001 cx
9002 )?) {
9003 Some(buf) => std::task::Poll::Ready(Some(ScanResultWatcherEvent::decode(buf))),
9004 None => std::task::Poll::Ready(None),
9005 }
9006 }
9007}
9008
9009#[derive(Debug)]
9010pub enum ScanResultWatcherEvent {}
9011
9012impl ScanResultWatcherEvent {
9013 fn decode(
9015 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9016 ) -> Result<ScanResultWatcherEvent, fidl::Error> {
9017 let (bytes, _handles) = buf.split_mut();
9018 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9019 debug_assert_eq!(tx_header.tx_id, 0);
9020 match tx_header.ordinal {
9021 _ => Err(fidl::Error::UnknownOrdinal {
9022 ordinal: tx_header.ordinal,
9023 protocol_name:
9024 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9025 }),
9026 }
9027 }
9028}
9029
9030pub struct ScanResultWatcherRequestStream {
9032 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9033 is_terminated: bool,
9034}
9035
9036impl std::marker::Unpin for ScanResultWatcherRequestStream {}
9037
9038impl futures::stream::FusedStream for ScanResultWatcherRequestStream {
9039 fn is_terminated(&self) -> bool {
9040 self.is_terminated
9041 }
9042}
9043
9044impl fidl::endpoints::RequestStream for ScanResultWatcherRequestStream {
9045 type Protocol = ScanResultWatcherMarker;
9046 type ControlHandle = ScanResultWatcherControlHandle;
9047
9048 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9049 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9050 }
9051
9052 fn control_handle(&self) -> Self::ControlHandle {
9053 ScanResultWatcherControlHandle { inner: self.inner.clone() }
9054 }
9055
9056 fn into_inner(
9057 self,
9058 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9059 {
9060 (self.inner, self.is_terminated)
9061 }
9062
9063 fn from_inner(
9064 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9065 is_terminated: bool,
9066 ) -> Self {
9067 Self { inner, is_terminated }
9068 }
9069}
9070
9071impl futures::Stream for ScanResultWatcherRequestStream {
9072 type Item = Result<ScanResultWatcherRequest, fidl::Error>;
9073
9074 fn poll_next(
9075 mut self: std::pin::Pin<&mut Self>,
9076 cx: &mut std::task::Context<'_>,
9077 ) -> std::task::Poll<Option<Self::Item>> {
9078 let this = &mut *self;
9079 if this.inner.check_shutdown(cx) {
9080 this.is_terminated = true;
9081 return std::task::Poll::Ready(None);
9082 }
9083 if this.is_terminated {
9084 panic!("polled ScanResultWatcherRequestStream after completion");
9085 }
9086 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9087 |bytes, handles| {
9088 match this.inner.channel().read_etc(cx, bytes, handles) {
9089 std::task::Poll::Ready(Ok(())) => {}
9090 std::task::Poll::Pending => return std::task::Poll::Pending,
9091 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9092 this.is_terminated = true;
9093 return std::task::Poll::Ready(None);
9094 }
9095 std::task::Poll::Ready(Err(e)) => {
9096 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9097 e.into(),
9098 ))))
9099 }
9100 }
9101
9102 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9104
9105 std::task::Poll::Ready(Some(match header.ordinal {
9106 0x713a122e949f301a => {
9107 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9108 let mut req = fidl::new_empty!(
9109 fidl::encoding::EmptyPayload,
9110 fidl::encoding::DefaultFuchsiaResourceDialect
9111 );
9112 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9113 let control_handle =
9114 ScanResultWatcherControlHandle { inner: this.inner.clone() };
9115 Ok(ScanResultWatcherRequest::Watch {
9116 responder: ScanResultWatcherWatchResponder {
9117 control_handle: std::mem::ManuallyDrop::new(control_handle),
9118 tx_id: header.tx_id,
9119 },
9120 })
9121 }
9122 _ => Err(fidl::Error::UnknownOrdinal {
9123 ordinal: header.ordinal,
9124 protocol_name:
9125 <ScanResultWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9126 }),
9127 }))
9128 },
9129 )
9130 }
9131}
9132
9133#[derive(Debug)]
9139pub enum ScanResultWatcherRequest {
9140 Watch { responder: ScanResultWatcherWatchResponder },
9150}
9151
9152impl ScanResultWatcherRequest {
9153 #[allow(irrefutable_let_patterns)]
9154 pub fn into_watch(self) -> Option<(ScanResultWatcherWatchResponder)> {
9155 if let ScanResultWatcherRequest::Watch { responder } = self {
9156 Some((responder))
9157 } else {
9158 None
9159 }
9160 }
9161
9162 pub fn method_name(&self) -> &'static str {
9164 match *self {
9165 ScanResultWatcherRequest::Watch { .. } => "watch",
9166 }
9167 }
9168}
9169
9170#[derive(Debug, Clone)]
9171pub struct ScanResultWatcherControlHandle {
9172 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9173}
9174
9175impl fidl::endpoints::ControlHandle for ScanResultWatcherControlHandle {
9176 fn shutdown(&self) {
9177 self.inner.shutdown()
9178 }
9179 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9180 self.inner.shutdown_with_epitaph(status)
9181 }
9182
9183 fn is_closed(&self) -> bool {
9184 self.inner.channel().is_closed()
9185 }
9186 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9187 self.inner.channel().on_closed()
9188 }
9189
9190 #[cfg(target_os = "fuchsia")]
9191 fn signal_peer(
9192 &self,
9193 clear_mask: zx::Signals,
9194 set_mask: zx::Signals,
9195 ) -> Result<(), zx_status::Status> {
9196 use fidl::Peered;
9197 self.inner.channel().signal_peer(clear_mask, set_mask)
9198 }
9199}
9200
9201impl ScanResultWatcherControlHandle {}
9202
9203#[must_use = "FIDL methods require a response to be sent"]
9204#[derive(Debug)]
9205pub struct ScanResultWatcherWatchResponder {
9206 control_handle: std::mem::ManuallyDrop<ScanResultWatcherControlHandle>,
9207 tx_id: u32,
9208}
9209
9210impl std::ops::Drop for ScanResultWatcherWatchResponder {
9214 fn drop(&mut self) {
9215 self.control_handle.shutdown();
9216 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9218 }
9219}
9220
9221impl fidl::endpoints::Responder for ScanResultWatcherWatchResponder {
9222 type ControlHandle = ScanResultWatcherControlHandle;
9223
9224 fn control_handle(&self) -> &ScanResultWatcherControlHandle {
9225 &self.control_handle
9226 }
9227
9228 fn drop_without_shutdown(mut self) {
9229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9231 std::mem::forget(self);
9233 }
9234}
9235
9236impl ScanResultWatcherWatchResponder {
9237 pub fn send(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9241 let _result = self.send_raw(updated);
9242 if _result.is_err() {
9243 self.control_handle.shutdown();
9244 }
9245 self.drop_without_shutdown();
9246 _result
9247 }
9248
9249 pub fn send_no_shutdown_on_err(self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9251 let _result = self.send_raw(updated);
9252 self.drop_without_shutdown();
9253 _result
9254 }
9255
9256 fn send_raw(&self, mut updated: &[Peer]) -> Result<(), fidl::Error> {
9257 self.control_handle.inner.send::<ScanResultWatcherWatchResponse>(
9258 (updated,),
9259 self.tx_id,
9260 0x713a122e949f301a,
9261 fidl::encoding::DynamicFlags::empty(),
9262 )
9263 }
9264}
9265
9266mod internal {
9267 use super::*;
9268
9269 impl fidl::encoding::ResourceTypeMarker for AdvertisedPeripheralOnConnectedRequest {
9270 type Borrowed<'a> = &'a mut Self;
9271 fn take_or_borrow<'a>(
9272 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9273 ) -> Self::Borrowed<'a> {
9274 value
9275 }
9276 }
9277
9278 unsafe impl fidl::encoding::TypeMarker for AdvertisedPeripheralOnConnectedRequest {
9279 type Owned = Self;
9280
9281 #[inline(always)]
9282 fn inline_align(_context: fidl::encoding::Context) -> usize {
9283 8
9284 }
9285
9286 #[inline(always)]
9287 fn inline_size(_context: fidl::encoding::Context) -> usize {
9288 24
9289 }
9290 }
9291
9292 unsafe impl
9293 fidl::encoding::Encode<
9294 AdvertisedPeripheralOnConnectedRequest,
9295 fidl::encoding::DefaultFuchsiaResourceDialect,
9296 > for &mut AdvertisedPeripheralOnConnectedRequest
9297 {
9298 #[inline]
9299 unsafe fn encode(
9300 self,
9301 encoder: &mut fidl::encoding::Encoder<
9302 '_,
9303 fidl::encoding::DefaultFuchsiaResourceDialect,
9304 >,
9305 offset: usize,
9306 _depth: fidl::encoding::Depth,
9307 ) -> fidl::Result<()> {
9308 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
9309 fidl::encoding::Encode::<AdvertisedPeripheralOnConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9311 (
9312 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
9313 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
9314 ),
9315 encoder, offset, _depth
9316 )
9317 }
9318 }
9319 unsafe impl<
9320 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
9321 T1: fidl::encoding::Encode<
9322 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9323 fidl::encoding::DefaultFuchsiaResourceDialect,
9324 >,
9325 >
9326 fidl::encoding::Encode<
9327 AdvertisedPeripheralOnConnectedRequest,
9328 fidl::encoding::DefaultFuchsiaResourceDialect,
9329 > for (T0, T1)
9330 {
9331 #[inline]
9332 unsafe fn encode(
9333 self,
9334 encoder: &mut fidl::encoding::Encoder<
9335 '_,
9336 fidl::encoding::DefaultFuchsiaResourceDialect,
9337 >,
9338 offset: usize,
9339 depth: fidl::encoding::Depth,
9340 ) -> fidl::Result<()> {
9341 encoder.debug_check_bounds::<AdvertisedPeripheralOnConnectedRequest>(offset);
9342 unsafe {
9345 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9346 (ptr as *mut u64).write_unaligned(0);
9347 }
9348 self.0.encode(encoder, offset + 0, depth)?;
9350 self.1.encode(encoder, offset + 16, depth)?;
9351 Ok(())
9352 }
9353 }
9354
9355 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9356 for AdvertisedPeripheralOnConnectedRequest
9357 {
9358 #[inline(always)]
9359 fn new_empty() -> Self {
9360 Self {
9361 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
9362 connection: fidl::new_empty!(
9363 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9364 fidl::encoding::DefaultFuchsiaResourceDialect
9365 ),
9366 }
9367 }
9368
9369 #[inline]
9370 unsafe fn decode(
9371 &mut self,
9372 decoder: &mut fidl::encoding::Decoder<
9373 '_,
9374 fidl::encoding::DefaultFuchsiaResourceDialect,
9375 >,
9376 offset: usize,
9377 _depth: fidl::encoding::Depth,
9378 ) -> fidl::Result<()> {
9379 decoder.debug_check_bounds::<Self>(offset);
9380 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9382 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9383 let mask = 0xffffffff00000000u64;
9384 let maskedval = padval & mask;
9385 if maskedval != 0 {
9386 return Err(fidl::Error::NonZeroPadding {
9387 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9388 });
9389 }
9390 fidl::decode!(
9391 Peer,
9392 fidl::encoding::DefaultFuchsiaResourceDialect,
9393 &mut self.peer,
9394 decoder,
9395 offset + 0,
9396 _depth
9397 )?;
9398 fidl::decode!(
9399 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
9400 fidl::encoding::DefaultFuchsiaResourceDialect,
9401 &mut self.connection,
9402 decoder,
9403 offset + 16,
9404 _depth
9405 )?;
9406 Ok(())
9407 }
9408 }
9409
9410 impl fidl::encoding::ResourceTypeMarker for CentralConnectPeripheralRequest {
9411 type Borrowed<'a> = &'a mut Self;
9412 fn take_or_borrow<'a>(
9413 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9414 ) -> Self::Borrowed<'a> {
9415 value
9416 }
9417 }
9418
9419 unsafe impl fidl::encoding::TypeMarker for CentralConnectPeripheralRequest {
9420 type Owned = Self;
9421
9422 #[inline(always)]
9423 fn inline_align(_context: fidl::encoding::Context) -> usize {
9424 8
9425 }
9426
9427 #[inline(always)]
9428 fn inline_size(_context: fidl::encoding::Context) -> usize {
9429 40
9430 }
9431 }
9432
9433 unsafe impl
9434 fidl::encoding::Encode<
9435 CentralConnectPeripheralRequest,
9436 fidl::encoding::DefaultFuchsiaResourceDialect,
9437 > for &mut CentralConnectPeripheralRequest
9438 {
9439 #[inline]
9440 unsafe fn encode(
9441 self,
9442 encoder: &mut fidl::encoding::Encoder<
9443 '_,
9444 fidl::encoding::DefaultFuchsiaResourceDialect,
9445 >,
9446 offset: usize,
9447 _depth: fidl::encoding::Depth,
9448 ) -> fidl::Result<()> {
9449 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
9450 fidl::encoding::Encode::<
9452 CentralConnectPeripheralRequest,
9453 fidl::encoding::DefaultFuchsiaResourceDialect,
9454 >::encode(
9455 (
9456 <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow(
9457 &self.identifier,
9458 ),
9459 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9460 <fidl::encoding::Endpoint<
9461 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9462 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9463 &mut self.gatt_client
9464 ),
9465 ),
9466 encoder,
9467 offset,
9468 _depth,
9469 )
9470 }
9471 }
9472 unsafe impl<
9473 T0: fidl::encoding::Encode<
9474 fidl::encoding::BoundedString<16>,
9475 fidl::encoding::DefaultFuchsiaResourceDialect,
9476 >,
9477 T1: fidl::encoding::Encode<
9478 ConnectionOptions,
9479 fidl::encoding::DefaultFuchsiaResourceDialect,
9480 >,
9481 T2: fidl::encoding::Encode<
9482 fidl::encoding::Endpoint<
9483 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9484 >,
9485 fidl::encoding::DefaultFuchsiaResourceDialect,
9486 >,
9487 >
9488 fidl::encoding::Encode<
9489 CentralConnectPeripheralRequest,
9490 fidl::encoding::DefaultFuchsiaResourceDialect,
9491 > for (T0, T1, T2)
9492 {
9493 #[inline]
9494 unsafe fn encode(
9495 self,
9496 encoder: &mut fidl::encoding::Encoder<
9497 '_,
9498 fidl::encoding::DefaultFuchsiaResourceDialect,
9499 >,
9500 offset: usize,
9501 depth: fidl::encoding::Depth,
9502 ) -> fidl::Result<()> {
9503 encoder.debug_check_bounds::<CentralConnectPeripheralRequest>(offset);
9504 unsafe {
9507 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9508 (ptr as *mut u64).write_unaligned(0);
9509 }
9510 self.0.encode(encoder, offset + 0, depth)?;
9512 self.1.encode(encoder, offset + 16, depth)?;
9513 self.2.encode(encoder, offset + 32, depth)?;
9514 Ok(())
9515 }
9516 }
9517
9518 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9519 for CentralConnectPeripheralRequest
9520 {
9521 #[inline(always)]
9522 fn new_empty() -> Self {
9523 Self {
9524 identifier: fidl::new_empty!(
9525 fidl::encoding::BoundedString<16>,
9526 fidl::encoding::DefaultFuchsiaResourceDialect
9527 ),
9528 options: fidl::new_empty!(
9529 ConnectionOptions,
9530 fidl::encoding::DefaultFuchsiaResourceDialect
9531 ),
9532 gatt_client: fidl::new_empty!(
9533 fidl::encoding::Endpoint<
9534 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9535 >,
9536 fidl::encoding::DefaultFuchsiaResourceDialect
9537 ),
9538 }
9539 }
9540
9541 #[inline]
9542 unsafe fn decode(
9543 &mut self,
9544 decoder: &mut fidl::encoding::Decoder<
9545 '_,
9546 fidl::encoding::DefaultFuchsiaResourceDialect,
9547 >,
9548 offset: usize,
9549 _depth: fidl::encoding::Depth,
9550 ) -> fidl::Result<()> {
9551 decoder.debug_check_bounds::<Self>(offset);
9552 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9554 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9555 let mask = 0xffffffff00000000u64;
9556 let maskedval = padval & mask;
9557 if maskedval != 0 {
9558 return Err(fidl::Error::NonZeroPadding {
9559 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9560 });
9561 }
9562 fidl::decode!(
9563 fidl::encoding::BoundedString<16>,
9564 fidl::encoding::DefaultFuchsiaResourceDialect,
9565 &mut self.identifier,
9566 decoder,
9567 offset + 0,
9568 _depth
9569 )?;
9570 fidl::decode!(
9571 ConnectionOptions,
9572 fidl::encoding::DefaultFuchsiaResourceDialect,
9573 &mut self.options,
9574 decoder,
9575 offset + 16,
9576 _depth
9577 )?;
9578 fidl::decode!(
9579 fidl::encoding::Endpoint<
9580 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::ClientMarker>,
9581 >,
9582 fidl::encoding::DefaultFuchsiaResourceDialect,
9583 &mut self.gatt_client,
9584 decoder,
9585 offset + 32,
9586 _depth
9587 )?;
9588 Ok(())
9589 }
9590 }
9591
9592 impl fidl::encoding::ResourceTypeMarker for CentralConnectRequest {
9593 type Borrowed<'a> = &'a mut Self;
9594 fn take_or_borrow<'a>(
9595 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9596 ) -> Self::Borrowed<'a> {
9597 value
9598 }
9599 }
9600
9601 unsafe impl fidl::encoding::TypeMarker for CentralConnectRequest {
9602 type Owned = Self;
9603
9604 #[inline(always)]
9605 fn inline_align(_context: fidl::encoding::Context) -> usize {
9606 8
9607 }
9608
9609 #[inline(always)]
9610 fn inline_size(_context: fidl::encoding::Context) -> usize {
9611 32
9612 }
9613 }
9614
9615 unsafe impl
9616 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9617 for &mut CentralConnectRequest
9618 {
9619 #[inline]
9620 unsafe fn encode(
9621 self,
9622 encoder: &mut fidl::encoding::Encoder<
9623 '_,
9624 fidl::encoding::DefaultFuchsiaResourceDialect,
9625 >,
9626 offset: usize,
9627 _depth: fidl::encoding::Depth,
9628 ) -> fidl::Result<()> {
9629 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
9630 fidl::encoding::Encode::<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9632 (
9633 <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
9634 <ConnectionOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9635 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
9636 ),
9637 encoder, offset, _depth
9638 )
9639 }
9640 }
9641 unsafe impl<
9642 T0: fidl::encoding::Encode<
9643 fidl_fuchsia_bluetooth::PeerId,
9644 fidl::encoding::DefaultFuchsiaResourceDialect,
9645 >,
9646 T1: fidl::encoding::Encode<
9647 ConnectionOptions,
9648 fidl::encoding::DefaultFuchsiaResourceDialect,
9649 >,
9650 T2: fidl::encoding::Encode<
9651 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9652 fidl::encoding::DefaultFuchsiaResourceDialect,
9653 >,
9654 >
9655 fidl::encoding::Encode<CentralConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9656 for (T0, T1, T2)
9657 {
9658 #[inline]
9659 unsafe fn encode(
9660 self,
9661 encoder: &mut fidl::encoding::Encoder<
9662 '_,
9663 fidl::encoding::DefaultFuchsiaResourceDialect,
9664 >,
9665 offset: usize,
9666 depth: fidl::encoding::Depth,
9667 ) -> fidl::Result<()> {
9668 encoder.debug_check_bounds::<CentralConnectRequest>(offset);
9669 unsafe {
9672 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
9673 (ptr as *mut u64).write_unaligned(0);
9674 }
9675 self.0.encode(encoder, offset + 0, depth)?;
9677 self.1.encode(encoder, offset + 8, depth)?;
9678 self.2.encode(encoder, offset + 24, depth)?;
9679 Ok(())
9680 }
9681 }
9682
9683 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9684 for CentralConnectRequest
9685 {
9686 #[inline(always)]
9687 fn new_empty() -> Self {
9688 Self {
9689 id: fidl::new_empty!(
9690 fidl_fuchsia_bluetooth::PeerId,
9691 fidl::encoding::DefaultFuchsiaResourceDialect
9692 ),
9693 options: fidl::new_empty!(
9694 ConnectionOptions,
9695 fidl::encoding::DefaultFuchsiaResourceDialect
9696 ),
9697 handle: fidl::new_empty!(
9698 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9699 fidl::encoding::DefaultFuchsiaResourceDialect
9700 ),
9701 }
9702 }
9703
9704 #[inline]
9705 unsafe fn decode(
9706 &mut self,
9707 decoder: &mut fidl::encoding::Decoder<
9708 '_,
9709 fidl::encoding::DefaultFuchsiaResourceDialect,
9710 >,
9711 offset: usize,
9712 _depth: fidl::encoding::Depth,
9713 ) -> fidl::Result<()> {
9714 decoder.debug_check_bounds::<Self>(offset);
9715 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
9717 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9718 let mask = 0xffffffff00000000u64;
9719 let maskedval = padval & mask;
9720 if maskedval != 0 {
9721 return Err(fidl::Error::NonZeroPadding {
9722 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
9723 });
9724 }
9725 fidl::decode!(
9726 fidl_fuchsia_bluetooth::PeerId,
9727 fidl::encoding::DefaultFuchsiaResourceDialect,
9728 &mut self.id,
9729 decoder,
9730 offset + 0,
9731 _depth
9732 )?;
9733 fidl::decode!(
9734 ConnectionOptions,
9735 fidl::encoding::DefaultFuchsiaResourceDialect,
9736 &mut self.options,
9737 decoder,
9738 offset + 8,
9739 _depth
9740 )?;
9741 fidl::decode!(
9742 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ConnectionMarker>>,
9743 fidl::encoding::DefaultFuchsiaResourceDialect,
9744 &mut self.handle,
9745 decoder,
9746 offset + 24,
9747 _depth
9748 )?;
9749 Ok(())
9750 }
9751 }
9752
9753 impl fidl::encoding::ResourceTypeMarker for CentralScanRequest {
9754 type Borrowed<'a> = &'a mut Self;
9755 fn take_or_borrow<'a>(
9756 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9757 ) -> Self::Borrowed<'a> {
9758 value
9759 }
9760 }
9761
9762 unsafe impl fidl::encoding::TypeMarker for CentralScanRequest {
9763 type Owned = Self;
9764
9765 #[inline(always)]
9766 fn inline_align(_context: fidl::encoding::Context) -> usize {
9767 8
9768 }
9769
9770 #[inline(always)]
9771 fn inline_size(_context: fidl::encoding::Context) -> usize {
9772 24
9773 }
9774 }
9775
9776 unsafe impl
9777 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9778 for &mut CentralScanRequest
9779 {
9780 #[inline]
9781 unsafe fn encode(
9782 self,
9783 encoder: &mut fidl::encoding::Encoder<
9784 '_,
9785 fidl::encoding::DefaultFuchsiaResourceDialect,
9786 >,
9787 offset: usize,
9788 _depth: fidl::encoding::Depth,
9789 ) -> fidl::Result<()> {
9790 encoder.debug_check_bounds::<CentralScanRequest>(offset);
9791 fidl::encoding::Encode::<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9793 (
9794 <ScanOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9795 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result_watcher),
9796 ),
9797 encoder, offset, _depth
9798 )
9799 }
9800 }
9801 unsafe impl<
9802 T0: fidl::encoding::Encode<ScanOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
9803 T1: fidl::encoding::Encode<
9804 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9805 fidl::encoding::DefaultFuchsiaResourceDialect,
9806 >,
9807 >
9808 fidl::encoding::Encode<CentralScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
9809 for (T0, T1)
9810 {
9811 #[inline]
9812 unsafe fn encode(
9813 self,
9814 encoder: &mut fidl::encoding::Encoder<
9815 '_,
9816 fidl::encoding::DefaultFuchsiaResourceDialect,
9817 >,
9818 offset: usize,
9819 depth: fidl::encoding::Depth,
9820 ) -> fidl::Result<()> {
9821 encoder.debug_check_bounds::<CentralScanRequest>(offset);
9822 unsafe {
9825 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9826 (ptr as *mut u64).write_unaligned(0);
9827 }
9828 self.0.encode(encoder, offset + 0, depth)?;
9830 self.1.encode(encoder, offset + 16, depth)?;
9831 Ok(())
9832 }
9833 }
9834
9835 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9836 for CentralScanRequest
9837 {
9838 #[inline(always)]
9839 fn new_empty() -> Self {
9840 Self {
9841 options: fidl::new_empty!(
9842 ScanOptions,
9843 fidl::encoding::DefaultFuchsiaResourceDialect
9844 ),
9845 result_watcher: fidl::new_empty!(
9846 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9847 fidl::encoding::DefaultFuchsiaResourceDialect
9848 ),
9849 }
9850 }
9851
9852 #[inline]
9853 unsafe fn decode(
9854 &mut self,
9855 decoder: &mut fidl::encoding::Decoder<
9856 '_,
9857 fidl::encoding::DefaultFuchsiaResourceDialect,
9858 >,
9859 offset: usize,
9860 _depth: fidl::encoding::Depth,
9861 ) -> fidl::Result<()> {
9862 decoder.debug_check_bounds::<Self>(offset);
9863 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9865 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9866 let mask = 0xffffffff00000000u64;
9867 let maskedval = padval & mask;
9868 if maskedval != 0 {
9869 return Err(fidl::Error::NonZeroPadding {
9870 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9871 });
9872 }
9873 fidl::decode!(
9874 ScanOptions,
9875 fidl::encoding::DefaultFuchsiaResourceDialect,
9876 &mut self.options,
9877 decoder,
9878 offset + 0,
9879 _depth
9880 )?;
9881 fidl::decode!(
9882 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultWatcherMarker>>,
9883 fidl::encoding::DefaultFuchsiaResourceDialect,
9884 &mut self.result_watcher,
9885 decoder,
9886 offset + 16,
9887 _depth
9888 )?;
9889 Ok(())
9890 }
9891 }
9892
9893 impl fidl::encoding::ResourceTypeMarker for ChannelListenerAcceptRequest {
9894 type Borrowed<'a> = &'a mut Self;
9895 fn take_or_borrow<'a>(
9896 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9897 ) -> Self::Borrowed<'a> {
9898 value
9899 }
9900 }
9901
9902 unsafe impl fidl::encoding::TypeMarker for ChannelListenerAcceptRequest {
9903 type Owned = Self;
9904
9905 #[inline(always)]
9906 fn inline_align(_context: fidl::encoding::Context) -> usize {
9907 4
9908 }
9909
9910 #[inline(always)]
9911 fn inline_size(_context: fidl::encoding::Context) -> usize {
9912 4
9913 }
9914 }
9915
9916 unsafe impl
9917 fidl::encoding::Encode<
9918 ChannelListenerAcceptRequest,
9919 fidl::encoding::DefaultFuchsiaResourceDialect,
9920 > for &mut ChannelListenerAcceptRequest
9921 {
9922 #[inline]
9923 unsafe fn encode(
9924 self,
9925 encoder: &mut fidl::encoding::Encoder<
9926 '_,
9927 fidl::encoding::DefaultFuchsiaResourceDialect,
9928 >,
9929 offset: usize,
9930 _depth: fidl::encoding::Depth,
9931 ) -> fidl::Result<()> {
9932 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
9933 fidl::encoding::Encode::<
9935 ChannelListenerAcceptRequest,
9936 fidl::encoding::DefaultFuchsiaResourceDialect,
9937 >::encode(
9938 (<fidl::encoding::Endpoint<
9939 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
9940 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9941 &mut self.channel
9942 ),),
9943 encoder,
9944 offset,
9945 _depth,
9946 )
9947 }
9948 }
9949 unsafe impl<
9950 T0: fidl::encoding::Encode<
9951 fidl::encoding::Endpoint<
9952 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
9953 >,
9954 fidl::encoding::DefaultFuchsiaResourceDialect,
9955 >,
9956 >
9957 fidl::encoding::Encode<
9958 ChannelListenerAcceptRequest,
9959 fidl::encoding::DefaultFuchsiaResourceDialect,
9960 > for (T0,)
9961 {
9962 #[inline]
9963 unsafe fn encode(
9964 self,
9965 encoder: &mut fidl::encoding::Encoder<
9966 '_,
9967 fidl::encoding::DefaultFuchsiaResourceDialect,
9968 >,
9969 offset: usize,
9970 depth: fidl::encoding::Depth,
9971 ) -> fidl::Result<()> {
9972 encoder.debug_check_bounds::<ChannelListenerAcceptRequest>(offset);
9973 self.0.encode(encoder, offset + 0, depth)?;
9977 Ok(())
9978 }
9979 }
9980
9981 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9982 for ChannelListenerAcceptRequest
9983 {
9984 #[inline(always)]
9985 fn new_empty() -> Self {
9986 Self {
9987 channel: fidl::new_empty!(
9988 fidl::encoding::Endpoint<
9989 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
9990 >,
9991 fidl::encoding::DefaultFuchsiaResourceDialect
9992 ),
9993 }
9994 }
9995
9996 #[inline]
9997 unsafe fn decode(
9998 &mut self,
9999 decoder: &mut fidl::encoding::Decoder<
10000 '_,
10001 fidl::encoding::DefaultFuchsiaResourceDialect,
10002 >,
10003 offset: usize,
10004 _depth: fidl::encoding::Depth,
10005 ) -> fidl::Result<()> {
10006 decoder.debug_check_bounds::<Self>(offset);
10007 fidl::decode!(
10009 fidl::encoding::Endpoint<
10010 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
10011 >,
10012 fidl::encoding::DefaultFuchsiaResourceDialect,
10013 &mut self.channel,
10014 decoder,
10015 offset + 0,
10016 _depth
10017 )?;
10018 Ok(())
10019 }
10020 }
10021
10022 impl fidl::encoding::ResourceTypeMarker for ConnectionRequestGattClientRequest {
10023 type Borrowed<'a> = &'a mut Self;
10024 fn take_or_borrow<'a>(
10025 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10026 ) -> Self::Borrowed<'a> {
10027 value
10028 }
10029 }
10030
10031 unsafe impl fidl::encoding::TypeMarker for ConnectionRequestGattClientRequest {
10032 type Owned = Self;
10033
10034 #[inline(always)]
10035 fn inline_align(_context: fidl::encoding::Context) -> usize {
10036 4
10037 }
10038
10039 #[inline(always)]
10040 fn inline_size(_context: fidl::encoding::Context) -> usize {
10041 4
10042 }
10043 }
10044
10045 unsafe impl
10046 fidl::encoding::Encode<
10047 ConnectionRequestGattClientRequest,
10048 fidl::encoding::DefaultFuchsiaResourceDialect,
10049 > for &mut ConnectionRequestGattClientRequest
10050 {
10051 #[inline]
10052 unsafe fn encode(
10053 self,
10054 encoder: &mut fidl::encoding::Encoder<
10055 '_,
10056 fidl::encoding::DefaultFuchsiaResourceDialect,
10057 >,
10058 offset: usize,
10059 _depth: fidl::encoding::Depth,
10060 ) -> fidl::Result<()> {
10061 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
10062 fidl::encoding::Encode::<
10064 ConnectionRequestGattClientRequest,
10065 fidl::encoding::DefaultFuchsiaResourceDialect,
10066 >::encode(
10067 (<fidl::encoding::Endpoint<
10068 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10069 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10070 &mut self.client
10071 ),),
10072 encoder,
10073 offset,
10074 _depth,
10075 )
10076 }
10077 }
10078 unsafe impl<
10079 T0: fidl::encoding::Encode<
10080 fidl::encoding::Endpoint<
10081 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10082 >,
10083 fidl::encoding::DefaultFuchsiaResourceDialect,
10084 >,
10085 >
10086 fidl::encoding::Encode<
10087 ConnectionRequestGattClientRequest,
10088 fidl::encoding::DefaultFuchsiaResourceDialect,
10089 > for (T0,)
10090 {
10091 #[inline]
10092 unsafe fn encode(
10093 self,
10094 encoder: &mut fidl::encoding::Encoder<
10095 '_,
10096 fidl::encoding::DefaultFuchsiaResourceDialect,
10097 >,
10098 offset: usize,
10099 depth: fidl::encoding::Depth,
10100 ) -> fidl::Result<()> {
10101 encoder.debug_check_bounds::<ConnectionRequestGattClientRequest>(offset);
10102 self.0.encode(encoder, offset + 0, depth)?;
10106 Ok(())
10107 }
10108 }
10109
10110 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10111 for ConnectionRequestGattClientRequest
10112 {
10113 #[inline(always)]
10114 fn new_empty() -> Self {
10115 Self {
10116 client: fidl::new_empty!(
10117 fidl::encoding::Endpoint<
10118 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10119 >,
10120 fidl::encoding::DefaultFuchsiaResourceDialect
10121 ),
10122 }
10123 }
10124
10125 #[inline]
10126 unsafe fn decode(
10127 &mut self,
10128 decoder: &mut fidl::encoding::Decoder<
10129 '_,
10130 fidl::encoding::DefaultFuchsiaResourceDialect,
10131 >,
10132 offset: usize,
10133 _depth: fidl::encoding::Depth,
10134 ) -> fidl::Result<()> {
10135 decoder.debug_check_bounds::<Self>(offset);
10136 fidl::decode!(
10138 fidl::encoding::Endpoint<
10139 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::ClientMarker>,
10140 >,
10141 fidl::encoding::DefaultFuchsiaResourceDialect,
10142 &mut self.client,
10143 decoder,
10144 offset + 0,
10145 _depth
10146 )?;
10147 Ok(())
10148 }
10149 }
10150
10151 impl fidl::encoding::ResourceTypeMarker for PeripheralAdvertiseRequest {
10152 type Borrowed<'a> = &'a mut Self;
10153 fn take_or_borrow<'a>(
10154 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10155 ) -> Self::Borrowed<'a> {
10156 value
10157 }
10158 }
10159
10160 unsafe impl fidl::encoding::TypeMarker for PeripheralAdvertiseRequest {
10161 type Owned = Self;
10162
10163 #[inline(always)]
10164 fn inline_align(_context: fidl::encoding::Context) -> usize {
10165 8
10166 }
10167
10168 #[inline(always)]
10169 fn inline_size(_context: fidl::encoding::Context) -> usize {
10170 24
10171 }
10172 }
10173
10174 unsafe impl
10175 fidl::encoding::Encode<
10176 PeripheralAdvertiseRequest,
10177 fidl::encoding::DefaultFuchsiaResourceDialect,
10178 > for &mut PeripheralAdvertiseRequest
10179 {
10180 #[inline]
10181 unsafe fn encode(
10182 self,
10183 encoder: &mut fidl::encoding::Encoder<
10184 '_,
10185 fidl::encoding::DefaultFuchsiaResourceDialect,
10186 >,
10187 offset: usize,
10188 _depth: fidl::encoding::Depth,
10189 ) -> fidl::Result<()> {
10190 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
10191 fidl::encoding::Encode::<
10193 PeripheralAdvertiseRequest,
10194 fidl::encoding::DefaultFuchsiaResourceDialect,
10195 >::encode(
10196 (
10197 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(
10198 &self.parameters,
10199 ),
10200 <fidl::encoding::Endpoint<
10201 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
10202 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10203 &mut self.advertised_peripheral,
10204 ),
10205 ),
10206 encoder,
10207 offset,
10208 _depth,
10209 )
10210 }
10211 }
10212 unsafe impl<
10213 T0: fidl::encoding::Encode<
10214 AdvertisingParameters,
10215 fidl::encoding::DefaultFuchsiaResourceDialect,
10216 >,
10217 T1: fidl::encoding::Encode<
10218 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
10219 fidl::encoding::DefaultFuchsiaResourceDialect,
10220 >,
10221 >
10222 fidl::encoding::Encode<
10223 PeripheralAdvertiseRequest,
10224 fidl::encoding::DefaultFuchsiaResourceDialect,
10225 > for (T0, T1)
10226 {
10227 #[inline]
10228 unsafe fn encode(
10229 self,
10230 encoder: &mut fidl::encoding::Encoder<
10231 '_,
10232 fidl::encoding::DefaultFuchsiaResourceDialect,
10233 >,
10234 offset: usize,
10235 depth: fidl::encoding::Depth,
10236 ) -> fidl::Result<()> {
10237 encoder.debug_check_bounds::<PeripheralAdvertiseRequest>(offset);
10238 unsafe {
10241 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10242 (ptr as *mut u64).write_unaligned(0);
10243 }
10244 self.0.encode(encoder, offset + 0, depth)?;
10246 self.1.encode(encoder, offset + 16, depth)?;
10247 Ok(())
10248 }
10249 }
10250
10251 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10252 for PeripheralAdvertiseRequest
10253 {
10254 #[inline(always)]
10255 fn new_empty() -> Self {
10256 Self {
10257 parameters: fidl::new_empty!(
10258 AdvertisingParameters,
10259 fidl::encoding::DefaultFuchsiaResourceDialect
10260 ),
10261 advertised_peripheral: fidl::new_empty!(
10262 fidl::encoding::Endpoint<
10263 fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>,
10264 >,
10265 fidl::encoding::DefaultFuchsiaResourceDialect
10266 ),
10267 }
10268 }
10269
10270 #[inline]
10271 unsafe fn decode(
10272 &mut self,
10273 decoder: &mut fidl::encoding::Decoder<
10274 '_,
10275 fidl::encoding::DefaultFuchsiaResourceDialect,
10276 >,
10277 offset: usize,
10278 _depth: fidl::encoding::Depth,
10279 ) -> fidl::Result<()> {
10280 decoder.debug_check_bounds::<Self>(offset);
10281 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10283 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10284 let mask = 0xffffffff00000000u64;
10285 let maskedval = padval & mask;
10286 if maskedval != 0 {
10287 return Err(fidl::Error::NonZeroPadding {
10288 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10289 });
10290 }
10291 fidl::decode!(
10292 AdvertisingParameters,
10293 fidl::encoding::DefaultFuchsiaResourceDialect,
10294 &mut self.parameters,
10295 decoder,
10296 offset + 0,
10297 _depth
10298 )?;
10299 fidl::decode!(
10300 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AdvertisedPeripheralMarker>>,
10301 fidl::encoding::DefaultFuchsiaResourceDialect,
10302 &mut self.advertised_peripheral,
10303 decoder,
10304 offset + 16,
10305 _depth
10306 )?;
10307 Ok(())
10308 }
10309 }
10310
10311 impl fidl::encoding::ResourceTypeMarker for PeripheralOnPeerConnectedRequest {
10312 type Borrowed<'a> = &'a mut Self;
10313 fn take_or_borrow<'a>(
10314 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10315 ) -> Self::Borrowed<'a> {
10316 value
10317 }
10318 }
10319
10320 unsafe impl fidl::encoding::TypeMarker for PeripheralOnPeerConnectedRequest {
10321 type Owned = Self;
10322
10323 #[inline(always)]
10324 fn inline_align(_context: fidl::encoding::Context) -> usize {
10325 8
10326 }
10327
10328 #[inline(always)]
10329 fn inline_size(_context: fidl::encoding::Context) -> usize {
10330 24
10331 }
10332 }
10333
10334 unsafe impl
10335 fidl::encoding::Encode<
10336 PeripheralOnPeerConnectedRequest,
10337 fidl::encoding::DefaultFuchsiaResourceDialect,
10338 > for &mut PeripheralOnPeerConnectedRequest
10339 {
10340 #[inline]
10341 unsafe fn encode(
10342 self,
10343 encoder: &mut fidl::encoding::Encoder<
10344 '_,
10345 fidl::encoding::DefaultFuchsiaResourceDialect,
10346 >,
10347 offset: usize,
10348 _depth: fidl::encoding::Depth,
10349 ) -> fidl::Result<()> {
10350 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
10351 fidl::encoding::Encode::<PeripheralOnPeerConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10353 (
10354 <Peer as fidl::encoding::ValueTypeMarker>::borrow(&self.peer),
10355 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.connection),
10356 ),
10357 encoder, offset, _depth
10358 )
10359 }
10360 }
10361 unsafe impl<
10362 T0: fidl::encoding::Encode<Peer, fidl::encoding::DefaultFuchsiaResourceDialect>,
10363 T1: fidl::encoding::Encode<
10364 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10365 fidl::encoding::DefaultFuchsiaResourceDialect,
10366 >,
10367 >
10368 fidl::encoding::Encode<
10369 PeripheralOnPeerConnectedRequest,
10370 fidl::encoding::DefaultFuchsiaResourceDialect,
10371 > for (T0, T1)
10372 {
10373 #[inline]
10374 unsafe fn encode(
10375 self,
10376 encoder: &mut fidl::encoding::Encoder<
10377 '_,
10378 fidl::encoding::DefaultFuchsiaResourceDialect,
10379 >,
10380 offset: usize,
10381 depth: fidl::encoding::Depth,
10382 ) -> fidl::Result<()> {
10383 encoder.debug_check_bounds::<PeripheralOnPeerConnectedRequest>(offset);
10384 unsafe {
10387 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10388 (ptr as *mut u64).write_unaligned(0);
10389 }
10390 self.0.encode(encoder, offset + 0, depth)?;
10392 self.1.encode(encoder, offset + 16, depth)?;
10393 Ok(())
10394 }
10395 }
10396
10397 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10398 for PeripheralOnPeerConnectedRequest
10399 {
10400 #[inline(always)]
10401 fn new_empty() -> Self {
10402 Self {
10403 peer: fidl::new_empty!(Peer, fidl::encoding::DefaultFuchsiaResourceDialect),
10404 connection: fidl::new_empty!(
10405 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10406 fidl::encoding::DefaultFuchsiaResourceDialect
10407 ),
10408 }
10409 }
10410
10411 #[inline]
10412 unsafe fn decode(
10413 &mut self,
10414 decoder: &mut fidl::encoding::Decoder<
10415 '_,
10416 fidl::encoding::DefaultFuchsiaResourceDialect,
10417 >,
10418 offset: usize,
10419 _depth: fidl::encoding::Depth,
10420 ) -> fidl::Result<()> {
10421 decoder.debug_check_bounds::<Self>(offset);
10422 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10424 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10425 let mask = 0xffffffff00000000u64;
10426 let maskedval = padval & mask;
10427 if maskedval != 0 {
10428 return Err(fidl::Error::NonZeroPadding {
10429 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10430 });
10431 }
10432 fidl::decode!(
10433 Peer,
10434 fidl::encoding::DefaultFuchsiaResourceDialect,
10435 &mut self.peer,
10436 decoder,
10437 offset + 0,
10438 _depth
10439 )?;
10440 fidl::decode!(
10441 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ConnectionMarker>>,
10442 fidl::encoding::DefaultFuchsiaResourceDialect,
10443 &mut self.connection,
10444 decoder,
10445 offset + 16,
10446 _depth
10447 )?;
10448 Ok(())
10449 }
10450 }
10451
10452 impl fidl::encoding::ResourceTypeMarker for PeripheralStartAdvertisingRequest {
10453 type Borrowed<'a> = &'a mut Self;
10454 fn take_or_borrow<'a>(
10455 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10456 ) -> Self::Borrowed<'a> {
10457 value
10458 }
10459 }
10460
10461 unsafe impl fidl::encoding::TypeMarker for PeripheralStartAdvertisingRequest {
10462 type Owned = Self;
10463
10464 #[inline(always)]
10465 fn inline_align(_context: fidl::encoding::Context) -> usize {
10466 8
10467 }
10468
10469 #[inline(always)]
10470 fn inline_size(_context: fidl::encoding::Context) -> usize {
10471 24
10472 }
10473 }
10474
10475 unsafe impl
10476 fidl::encoding::Encode<
10477 PeripheralStartAdvertisingRequest,
10478 fidl::encoding::DefaultFuchsiaResourceDialect,
10479 > for &mut PeripheralStartAdvertisingRequest
10480 {
10481 #[inline]
10482 unsafe fn encode(
10483 self,
10484 encoder: &mut fidl::encoding::Encoder<
10485 '_,
10486 fidl::encoding::DefaultFuchsiaResourceDialect,
10487 >,
10488 offset: usize,
10489 _depth: fidl::encoding::Depth,
10490 ) -> fidl::Result<()> {
10491 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
10492 fidl::encoding::Encode::<PeripheralStartAdvertisingRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10494 (
10495 <AdvertisingParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.parameters),
10496 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
10497 ),
10498 encoder, offset, _depth
10499 )
10500 }
10501 }
10502 unsafe impl<
10503 T0: fidl::encoding::Encode<
10504 AdvertisingParameters,
10505 fidl::encoding::DefaultFuchsiaResourceDialect,
10506 >,
10507 T1: fidl::encoding::Encode<
10508 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10509 fidl::encoding::DefaultFuchsiaResourceDialect,
10510 >,
10511 >
10512 fidl::encoding::Encode<
10513 PeripheralStartAdvertisingRequest,
10514 fidl::encoding::DefaultFuchsiaResourceDialect,
10515 > for (T0, T1)
10516 {
10517 #[inline]
10518 unsafe fn encode(
10519 self,
10520 encoder: &mut fidl::encoding::Encoder<
10521 '_,
10522 fidl::encoding::DefaultFuchsiaResourceDialect,
10523 >,
10524 offset: usize,
10525 depth: fidl::encoding::Depth,
10526 ) -> fidl::Result<()> {
10527 encoder.debug_check_bounds::<PeripheralStartAdvertisingRequest>(offset);
10528 unsafe {
10531 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10532 (ptr as *mut u64).write_unaligned(0);
10533 }
10534 self.0.encode(encoder, offset + 0, depth)?;
10536 self.1.encode(encoder, offset + 16, depth)?;
10537 Ok(())
10538 }
10539 }
10540
10541 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10542 for PeripheralStartAdvertisingRequest
10543 {
10544 #[inline(always)]
10545 fn new_empty() -> Self {
10546 Self {
10547 parameters: fidl::new_empty!(
10548 AdvertisingParameters,
10549 fidl::encoding::DefaultFuchsiaResourceDialect
10550 ),
10551 handle: fidl::new_empty!(
10552 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10553 fidl::encoding::DefaultFuchsiaResourceDialect
10554 ),
10555 }
10556 }
10557
10558 #[inline]
10559 unsafe fn decode(
10560 &mut self,
10561 decoder: &mut fidl::encoding::Decoder<
10562 '_,
10563 fidl::encoding::DefaultFuchsiaResourceDialect,
10564 >,
10565 offset: usize,
10566 _depth: fidl::encoding::Depth,
10567 ) -> fidl::Result<()> {
10568 decoder.debug_check_bounds::<Self>(offset);
10569 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10571 let padval = unsafe { (ptr as *const u64).read_unaligned() };
10572 let mask = 0xffffffff00000000u64;
10573 let maskedval = padval & mask;
10574 if maskedval != 0 {
10575 return Err(fidl::Error::NonZeroPadding {
10576 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10577 });
10578 }
10579 fidl::decode!(
10580 AdvertisingParameters,
10581 fidl::encoding::DefaultFuchsiaResourceDialect,
10582 &mut self.parameters,
10583 decoder,
10584 offset + 0,
10585 _depth
10586 )?;
10587 fidl::decode!(
10588 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AdvertisingHandleMarker>>,
10589 fidl::encoding::DefaultFuchsiaResourceDialect,
10590 &mut self.handle,
10591 decoder,
10592 offset + 16,
10593 _depth
10594 )?;
10595 Ok(())
10596 }
10597 }
10598
10599 impl CentralCreateConnectedIsochronousGroupRequest {
10600 #[inline(always)]
10601 fn max_ordinal_present(&self) -> u64 {
10602 if let Some(_) = self.cig {
10603 return 3;
10604 }
10605 if let Some(_) = self.cis_requested_parameters {
10606 return 2;
10607 }
10608 if let Some(_) = self.cig_parameters {
10609 return 1;
10610 }
10611 0
10612 }
10613 }
10614
10615 impl fidl::encoding::ResourceTypeMarker for CentralCreateConnectedIsochronousGroupRequest {
10616 type Borrowed<'a> = &'a mut Self;
10617 fn take_or_borrow<'a>(
10618 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10619 ) -> Self::Borrowed<'a> {
10620 value
10621 }
10622 }
10623
10624 unsafe impl fidl::encoding::TypeMarker for CentralCreateConnectedIsochronousGroupRequest {
10625 type Owned = Self;
10626
10627 #[inline(always)]
10628 fn inline_align(_context: fidl::encoding::Context) -> usize {
10629 8
10630 }
10631
10632 #[inline(always)]
10633 fn inline_size(_context: fidl::encoding::Context) -> usize {
10634 16
10635 }
10636 }
10637
10638 unsafe impl
10639 fidl::encoding::Encode<
10640 CentralCreateConnectedIsochronousGroupRequest,
10641 fidl::encoding::DefaultFuchsiaResourceDialect,
10642 > for &mut CentralCreateConnectedIsochronousGroupRequest
10643 {
10644 unsafe fn encode(
10645 self,
10646 encoder: &mut fidl::encoding::Encoder<
10647 '_,
10648 fidl::encoding::DefaultFuchsiaResourceDialect,
10649 >,
10650 offset: usize,
10651 mut depth: fidl::encoding::Depth,
10652 ) -> fidl::Result<()> {
10653 encoder.debug_check_bounds::<CentralCreateConnectedIsochronousGroupRequest>(offset);
10654 let max_ordinal: u64 = self.max_ordinal_present();
10656 encoder.write_num(max_ordinal, offset);
10657 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10658 if max_ordinal == 0 {
10660 return Ok(());
10661 }
10662 depth.increment()?;
10663 let envelope_size = 8;
10664 let bytes_len = max_ordinal as usize * envelope_size;
10665 #[allow(unused_variables)]
10666 let offset = encoder.out_of_line_offset(bytes_len);
10667 let mut _prev_end_offset: usize = 0;
10668 if 1 > max_ordinal {
10669 return Ok(());
10670 }
10671
10672 let cur_offset: usize = (1 - 1) * envelope_size;
10675
10676 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10678
10679 fidl::encoding::encode_in_envelope_optional::<
10684 CigParameters,
10685 fidl::encoding::DefaultFuchsiaResourceDialect,
10686 >(
10687 self.cig_parameters
10688 .as_ref()
10689 .map(<CigParameters as fidl::encoding::ValueTypeMarker>::borrow),
10690 encoder,
10691 offset + cur_offset,
10692 depth,
10693 )?;
10694
10695 _prev_end_offset = cur_offset + envelope_size;
10696 if 2 > max_ordinal {
10697 return Ok(());
10698 }
10699
10700 let cur_offset: usize = (2 - 1) * envelope_size;
10703
10704 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10706
10707 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10712 self.cis_requested_parameters.as_mut().map(<fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10713 encoder, offset + cur_offset, depth
10714 )?;
10715
10716 _prev_end_offset = cur_offset + envelope_size;
10717 if 3 > max_ordinal {
10718 return Ok(());
10719 }
10720
10721 let cur_offset: usize = (3 - 1) * envelope_size;
10724
10725 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10727
10728 fidl::encoding::encode_in_envelope_optional::<
10733 fidl::encoding::Endpoint<
10734 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10735 >,
10736 fidl::encoding::DefaultFuchsiaResourceDialect,
10737 >(
10738 self.cig.as_mut().map(
10739 <fidl::encoding::Endpoint<
10740 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10741 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10742 ),
10743 encoder,
10744 offset + cur_offset,
10745 depth,
10746 )?;
10747
10748 _prev_end_offset = cur_offset + envelope_size;
10749
10750 Ok(())
10751 }
10752 }
10753
10754 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10755 for CentralCreateConnectedIsochronousGroupRequest
10756 {
10757 #[inline(always)]
10758 fn new_empty() -> Self {
10759 Self::default()
10760 }
10761
10762 unsafe fn decode(
10763 &mut self,
10764 decoder: &mut fidl::encoding::Decoder<
10765 '_,
10766 fidl::encoding::DefaultFuchsiaResourceDialect,
10767 >,
10768 offset: usize,
10769 mut depth: fidl::encoding::Depth,
10770 ) -> fidl::Result<()> {
10771 decoder.debug_check_bounds::<Self>(offset);
10772 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10773 None => return Err(fidl::Error::NotNullable),
10774 Some(len) => len,
10775 };
10776 if len == 0 {
10778 return Ok(());
10779 };
10780 depth.increment()?;
10781 let envelope_size = 8;
10782 let bytes_len = len * envelope_size;
10783 let offset = decoder.out_of_line_offset(bytes_len)?;
10784 let mut _next_ordinal_to_read = 0;
10786 let mut next_offset = offset;
10787 let end_offset = offset + bytes_len;
10788 _next_ordinal_to_read += 1;
10789 if next_offset >= end_offset {
10790 return Ok(());
10791 }
10792
10793 while _next_ordinal_to_read < 1 {
10795 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10796 _next_ordinal_to_read += 1;
10797 next_offset += envelope_size;
10798 }
10799
10800 let next_out_of_line = decoder.next_out_of_line();
10801 let handles_before = decoder.remaining_handles();
10802 if let Some((inlined, num_bytes, num_handles)) =
10803 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10804 {
10805 let member_inline_size =
10806 <CigParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10807 if inlined != (member_inline_size <= 4) {
10808 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10809 }
10810 let inner_offset;
10811 let mut inner_depth = depth.clone();
10812 if inlined {
10813 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10814 inner_offset = next_offset;
10815 } else {
10816 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10817 inner_depth.increment()?;
10818 }
10819 let val_ref = self.cig_parameters.get_or_insert_with(|| {
10820 fidl::new_empty!(CigParameters, fidl::encoding::DefaultFuchsiaResourceDialect)
10821 });
10822 fidl::decode!(
10823 CigParameters,
10824 fidl::encoding::DefaultFuchsiaResourceDialect,
10825 val_ref,
10826 decoder,
10827 inner_offset,
10828 inner_depth
10829 )?;
10830 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10831 {
10832 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10833 }
10834 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10835 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10836 }
10837 }
10838
10839 next_offset += envelope_size;
10840 _next_ordinal_to_read += 1;
10841 if next_offset >= end_offset {
10842 return Ok(());
10843 }
10844
10845 while _next_ordinal_to_read < 2 {
10847 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10848 _next_ordinal_to_read += 1;
10849 next_offset += envelope_size;
10850 }
10851
10852 let next_out_of_line = decoder.next_out_of_line();
10853 let handles_before = decoder.remaining_handles();
10854 if let Some((inlined, num_bytes, num_handles)) =
10855 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10856 {
10857 let member_inline_size = <fidl::encoding::Vector<CisRequestedParameters, 31> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10858 if inlined != (member_inline_size <= 4) {
10859 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10860 }
10861 let inner_offset;
10862 let mut inner_depth = depth.clone();
10863 if inlined {
10864 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10865 inner_offset = next_offset;
10866 } else {
10867 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10868 inner_depth.increment()?;
10869 }
10870 let val_ref =
10871 self.cis_requested_parameters.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect));
10872 fidl::decode!(fidl::encoding::Vector<CisRequestedParameters, 31>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10873 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10874 {
10875 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10876 }
10877 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10878 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10879 }
10880 }
10881
10882 next_offset += envelope_size;
10883 _next_ordinal_to_read += 1;
10884 if next_offset >= end_offset {
10885 return Ok(());
10886 }
10887
10888 while _next_ordinal_to_read < 3 {
10890 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10891 _next_ordinal_to_read += 1;
10892 next_offset += envelope_size;
10893 }
10894
10895 let next_out_of_line = decoder.next_out_of_line();
10896 let handles_before = decoder.remaining_handles();
10897 if let Some((inlined, num_bytes, num_handles)) =
10898 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10899 {
10900 let member_inline_size = <fidl::encoding::Endpoint<
10901 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10902 > as fidl::encoding::TypeMarker>::inline_size(
10903 decoder.context
10904 );
10905 if inlined != (member_inline_size <= 4) {
10906 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10907 }
10908 let inner_offset;
10909 let mut inner_depth = depth.clone();
10910 if inlined {
10911 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10912 inner_offset = next_offset;
10913 } else {
10914 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10915 inner_depth.increment()?;
10916 }
10917 let val_ref = self.cig.get_or_insert_with(|| {
10918 fidl::new_empty!(
10919 fidl::encoding::Endpoint<
10920 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10921 >,
10922 fidl::encoding::DefaultFuchsiaResourceDialect
10923 )
10924 });
10925 fidl::decode!(
10926 fidl::encoding::Endpoint<
10927 fidl::endpoints::ServerEnd<ConnectedIsochronousGroupMarker>,
10928 >,
10929 fidl::encoding::DefaultFuchsiaResourceDialect,
10930 val_ref,
10931 decoder,
10932 inner_offset,
10933 inner_depth
10934 )?;
10935 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10936 {
10937 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10938 }
10939 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10940 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10941 }
10942 }
10943
10944 next_offset += envelope_size;
10945
10946 while next_offset < end_offset {
10948 _next_ordinal_to_read += 1;
10949 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10950 next_offset += envelope_size;
10951 }
10952
10953 Ok(())
10954 }
10955 }
10956
10957 impl ChannelListenerRegistryListenL2capRequest {
10958 #[inline(always)]
10959 fn max_ordinal_present(&self) -> u64 {
10960 if let Some(_) = self.listener {
10961 return 2;
10962 }
10963 if let Some(_) = self.parameters {
10964 return 1;
10965 }
10966 0
10967 }
10968 }
10969
10970 impl fidl::encoding::ResourceTypeMarker for ChannelListenerRegistryListenL2capRequest {
10971 type Borrowed<'a> = &'a mut Self;
10972 fn take_or_borrow<'a>(
10973 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10974 ) -> Self::Borrowed<'a> {
10975 value
10976 }
10977 }
10978
10979 unsafe impl fidl::encoding::TypeMarker for ChannelListenerRegistryListenL2capRequest {
10980 type Owned = Self;
10981
10982 #[inline(always)]
10983 fn inline_align(_context: fidl::encoding::Context) -> usize {
10984 8
10985 }
10986
10987 #[inline(always)]
10988 fn inline_size(_context: fidl::encoding::Context) -> usize {
10989 16
10990 }
10991 }
10992
10993 unsafe impl
10994 fidl::encoding::Encode<
10995 ChannelListenerRegistryListenL2capRequest,
10996 fidl::encoding::DefaultFuchsiaResourceDialect,
10997 > for &mut ChannelListenerRegistryListenL2capRequest
10998 {
10999 unsafe fn encode(
11000 self,
11001 encoder: &mut fidl::encoding::Encoder<
11002 '_,
11003 fidl::encoding::DefaultFuchsiaResourceDialect,
11004 >,
11005 offset: usize,
11006 mut depth: fidl::encoding::Depth,
11007 ) -> fidl::Result<()> {
11008 encoder.debug_check_bounds::<ChannelListenerRegistryListenL2capRequest>(offset);
11009 let max_ordinal: u64 = self.max_ordinal_present();
11011 encoder.write_num(max_ordinal, offset);
11012 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11013 if max_ordinal == 0 {
11015 return Ok(());
11016 }
11017 depth.increment()?;
11018 let envelope_size = 8;
11019 let bytes_len = max_ordinal as usize * envelope_size;
11020 #[allow(unused_variables)]
11021 let offset = encoder.out_of_line_offset(bytes_len);
11022 let mut _prev_end_offset: usize = 0;
11023 if 1 > max_ordinal {
11024 return Ok(());
11025 }
11026
11027 let cur_offset: usize = (1 - 1) * envelope_size;
11030
11031 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11033
11034 fidl::encoding::encode_in_envelope_optional::<
11039 AcceptedChannelParameters,
11040 fidl::encoding::DefaultFuchsiaResourceDialect,
11041 >(
11042 self.parameters
11043 .as_ref()
11044 .map(<AcceptedChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
11045 encoder,
11046 offset + cur_offset,
11047 depth,
11048 )?;
11049
11050 _prev_end_offset = cur_offset + envelope_size;
11051 if 2 > max_ordinal {
11052 return Ok(());
11053 }
11054
11055 let cur_offset: usize = (2 - 1) * envelope_size;
11058
11059 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11061
11062 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11067 self.listener.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11068 encoder, offset + cur_offset, depth
11069 )?;
11070
11071 _prev_end_offset = cur_offset + envelope_size;
11072
11073 Ok(())
11074 }
11075 }
11076
11077 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11078 for ChannelListenerRegistryListenL2capRequest
11079 {
11080 #[inline(always)]
11081 fn new_empty() -> Self {
11082 Self::default()
11083 }
11084
11085 unsafe fn decode(
11086 &mut self,
11087 decoder: &mut fidl::encoding::Decoder<
11088 '_,
11089 fidl::encoding::DefaultFuchsiaResourceDialect,
11090 >,
11091 offset: usize,
11092 mut depth: fidl::encoding::Depth,
11093 ) -> fidl::Result<()> {
11094 decoder.debug_check_bounds::<Self>(offset);
11095 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11096 None => return Err(fidl::Error::NotNullable),
11097 Some(len) => len,
11098 };
11099 if len == 0 {
11101 return Ok(());
11102 };
11103 depth.increment()?;
11104 let envelope_size = 8;
11105 let bytes_len = len * envelope_size;
11106 let offset = decoder.out_of_line_offset(bytes_len)?;
11107 let mut _next_ordinal_to_read = 0;
11109 let mut next_offset = offset;
11110 let end_offset = offset + bytes_len;
11111 _next_ordinal_to_read += 1;
11112 if next_offset >= end_offset {
11113 return Ok(());
11114 }
11115
11116 while _next_ordinal_to_read < 1 {
11118 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11119 _next_ordinal_to_read += 1;
11120 next_offset += envelope_size;
11121 }
11122
11123 let next_out_of_line = decoder.next_out_of_line();
11124 let handles_before = decoder.remaining_handles();
11125 if let Some((inlined, num_bytes, num_handles)) =
11126 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11127 {
11128 let member_inline_size =
11129 <AcceptedChannelParameters as fidl::encoding::TypeMarker>::inline_size(
11130 decoder.context,
11131 );
11132 if inlined != (member_inline_size <= 4) {
11133 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11134 }
11135 let inner_offset;
11136 let mut inner_depth = depth.clone();
11137 if inlined {
11138 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11139 inner_offset = next_offset;
11140 } else {
11141 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11142 inner_depth.increment()?;
11143 }
11144 let val_ref = self.parameters.get_or_insert_with(|| {
11145 fidl::new_empty!(
11146 AcceptedChannelParameters,
11147 fidl::encoding::DefaultFuchsiaResourceDialect
11148 )
11149 });
11150 fidl::decode!(
11151 AcceptedChannelParameters,
11152 fidl::encoding::DefaultFuchsiaResourceDialect,
11153 val_ref,
11154 decoder,
11155 inner_offset,
11156 inner_depth
11157 )?;
11158 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11159 {
11160 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11161 }
11162 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11163 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11164 }
11165 }
11166
11167 next_offset += envelope_size;
11168 _next_ordinal_to_read += 1;
11169 if next_offset >= end_offset {
11170 return Ok(());
11171 }
11172
11173 while _next_ordinal_to_read < 2 {
11175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11176 _next_ordinal_to_read += 1;
11177 next_offset += envelope_size;
11178 }
11179
11180 let next_out_of_line = decoder.next_out_of_line();
11181 let handles_before = decoder.remaining_handles();
11182 if let Some((inlined, num_bytes, num_handles)) =
11183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11184 {
11185 let member_inline_size = <fidl::encoding::Endpoint<
11186 fidl::endpoints::ClientEnd<ChannelListenerMarker>,
11187 > as fidl::encoding::TypeMarker>::inline_size(
11188 decoder.context
11189 );
11190 if inlined != (member_inline_size <= 4) {
11191 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11192 }
11193 let inner_offset;
11194 let mut inner_depth = depth.clone();
11195 if inlined {
11196 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11197 inner_offset = next_offset;
11198 } else {
11199 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11200 inner_depth.increment()?;
11201 }
11202 let val_ref = self.listener.get_or_insert_with(|| {
11203 fidl::new_empty!(
11204 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
11205 fidl::encoding::DefaultFuchsiaResourceDialect
11206 )
11207 });
11208 fidl::decode!(
11209 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ChannelListenerMarker>>,
11210 fidl::encoding::DefaultFuchsiaResourceDialect,
11211 val_ref,
11212 decoder,
11213 inner_offset,
11214 inner_depth
11215 )?;
11216 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11217 {
11218 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11219 }
11220 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11221 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11222 }
11223 }
11224
11225 next_offset += envelope_size;
11226
11227 while next_offset < end_offset {
11229 _next_ordinal_to_read += 1;
11230 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11231 next_offset += envelope_size;
11232 }
11233
11234 Ok(())
11235 }
11236 }
11237
11238 impl CisRequestedParameters {
11239 #[inline(always)]
11240 fn max_ordinal_present(&self) -> u64 {
11241 if let Some(_) = self.max_sdu_size_incoming {
11242 return 4;
11243 }
11244 if let Some(_) = self.max_sdu_size_outgoing {
11245 return 3;
11246 }
11247 if let Some(_) = self.connection_stream {
11248 return 2;
11249 }
11250 if let Some(_) = self.cis_id {
11251 return 1;
11252 }
11253 0
11254 }
11255 }
11256
11257 impl fidl::encoding::ResourceTypeMarker for CisRequestedParameters {
11258 type Borrowed<'a> = &'a mut Self;
11259 fn take_or_borrow<'a>(
11260 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11261 ) -> Self::Borrowed<'a> {
11262 value
11263 }
11264 }
11265
11266 unsafe impl fidl::encoding::TypeMarker for CisRequestedParameters {
11267 type Owned = Self;
11268
11269 #[inline(always)]
11270 fn inline_align(_context: fidl::encoding::Context) -> usize {
11271 8
11272 }
11273
11274 #[inline(always)]
11275 fn inline_size(_context: fidl::encoding::Context) -> usize {
11276 16
11277 }
11278 }
11279
11280 unsafe impl
11281 fidl::encoding::Encode<
11282 CisRequestedParameters,
11283 fidl::encoding::DefaultFuchsiaResourceDialect,
11284 > for &mut CisRequestedParameters
11285 {
11286 unsafe fn encode(
11287 self,
11288 encoder: &mut fidl::encoding::Encoder<
11289 '_,
11290 fidl::encoding::DefaultFuchsiaResourceDialect,
11291 >,
11292 offset: usize,
11293 mut depth: fidl::encoding::Depth,
11294 ) -> fidl::Result<()> {
11295 encoder.debug_check_bounds::<CisRequestedParameters>(offset);
11296 let max_ordinal: u64 = self.max_ordinal_present();
11298 encoder.write_num(max_ordinal, offset);
11299 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11300 if max_ordinal == 0 {
11302 return Ok(());
11303 }
11304 depth.increment()?;
11305 let envelope_size = 8;
11306 let bytes_len = max_ordinal as usize * envelope_size;
11307 #[allow(unused_variables)]
11308 let offset = encoder.out_of_line_offset(bytes_len);
11309 let mut _prev_end_offset: usize = 0;
11310 if 1 > max_ordinal {
11311 return Ok(());
11312 }
11313
11314 let cur_offset: usize = (1 - 1) * envelope_size;
11317
11318 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11320
11321 fidl::encoding::encode_in_envelope_optional::<
11326 u8,
11327 fidl::encoding::DefaultFuchsiaResourceDialect,
11328 >(
11329 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11330 encoder,
11331 offset + cur_offset,
11332 depth,
11333 )?;
11334
11335 _prev_end_offset = cur_offset + envelope_size;
11336 if 2 > max_ordinal {
11337 return Ok(());
11338 }
11339
11340 let cur_offset: usize = (2 - 1) * envelope_size;
11343
11344 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11346
11347 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11352 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11353 encoder, offset + cur_offset, depth
11354 )?;
11355
11356 _prev_end_offset = cur_offset + envelope_size;
11357 if 3 > max_ordinal {
11358 return Ok(());
11359 }
11360
11361 let cur_offset: usize = (3 - 1) * envelope_size;
11364
11365 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11367
11368 fidl::encoding::encode_in_envelope_optional::<
11373 u16,
11374 fidl::encoding::DefaultFuchsiaResourceDialect,
11375 >(
11376 self.max_sdu_size_outgoing
11377 .as_ref()
11378 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
11379 encoder,
11380 offset + cur_offset,
11381 depth,
11382 )?;
11383
11384 _prev_end_offset = cur_offset + envelope_size;
11385 if 4 > max_ordinal {
11386 return Ok(());
11387 }
11388
11389 let cur_offset: usize = (4 - 1) * envelope_size;
11392
11393 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11395
11396 fidl::encoding::encode_in_envelope_optional::<
11401 u16,
11402 fidl::encoding::DefaultFuchsiaResourceDialect,
11403 >(
11404 self.max_sdu_size_incoming
11405 .as_ref()
11406 .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
11407 encoder,
11408 offset + cur_offset,
11409 depth,
11410 )?;
11411
11412 _prev_end_offset = cur_offset + envelope_size;
11413
11414 Ok(())
11415 }
11416 }
11417
11418 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11419 for CisRequestedParameters
11420 {
11421 #[inline(always)]
11422 fn new_empty() -> Self {
11423 Self::default()
11424 }
11425
11426 unsafe fn decode(
11427 &mut self,
11428 decoder: &mut fidl::encoding::Decoder<
11429 '_,
11430 fidl::encoding::DefaultFuchsiaResourceDialect,
11431 >,
11432 offset: usize,
11433 mut depth: fidl::encoding::Depth,
11434 ) -> fidl::Result<()> {
11435 decoder.debug_check_bounds::<Self>(offset);
11436 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11437 None => return Err(fidl::Error::NotNullable),
11438 Some(len) => len,
11439 };
11440 if len == 0 {
11442 return Ok(());
11443 };
11444 depth.increment()?;
11445 let envelope_size = 8;
11446 let bytes_len = len * envelope_size;
11447 let offset = decoder.out_of_line_offset(bytes_len)?;
11448 let mut _next_ordinal_to_read = 0;
11450 let mut next_offset = offset;
11451 let end_offset = offset + bytes_len;
11452 _next_ordinal_to_read += 1;
11453 if next_offset >= end_offset {
11454 return Ok(());
11455 }
11456
11457 while _next_ordinal_to_read < 1 {
11459 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11460 _next_ordinal_to_read += 1;
11461 next_offset += envelope_size;
11462 }
11463
11464 let next_out_of_line = decoder.next_out_of_line();
11465 let handles_before = decoder.remaining_handles();
11466 if let Some((inlined, num_bytes, num_handles)) =
11467 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11468 {
11469 let member_inline_size =
11470 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11471 if inlined != (member_inline_size <= 4) {
11472 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11473 }
11474 let inner_offset;
11475 let mut inner_depth = depth.clone();
11476 if inlined {
11477 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11478 inner_offset = next_offset;
11479 } else {
11480 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11481 inner_depth.increment()?;
11482 }
11483 let val_ref = self.cis_id.get_or_insert_with(|| {
11484 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
11485 });
11486 fidl::decode!(
11487 u8,
11488 fidl::encoding::DefaultFuchsiaResourceDialect,
11489 val_ref,
11490 decoder,
11491 inner_offset,
11492 inner_depth
11493 )?;
11494 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11495 {
11496 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11497 }
11498 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11499 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11500 }
11501 }
11502
11503 next_offset += envelope_size;
11504 _next_ordinal_to_read += 1;
11505 if next_offset >= end_offset {
11506 return Ok(());
11507 }
11508
11509 while _next_ordinal_to_read < 2 {
11511 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11512 _next_ordinal_to_read += 1;
11513 next_offset += envelope_size;
11514 }
11515
11516 let next_out_of_line = decoder.next_out_of_line();
11517 let handles_before = decoder.remaining_handles();
11518 if let Some((inlined, num_bytes, num_handles)) =
11519 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11520 {
11521 let member_inline_size = <fidl::encoding::Endpoint<
11522 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
11523 > as fidl::encoding::TypeMarker>::inline_size(
11524 decoder.context
11525 );
11526 if inlined != (member_inline_size <= 4) {
11527 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11528 }
11529 let inner_offset;
11530 let mut inner_depth = depth.clone();
11531 if inlined {
11532 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11533 inner_offset = next_offset;
11534 } else {
11535 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11536 inner_depth.increment()?;
11537 }
11538 let val_ref = self.connection_stream.get_or_insert_with(|| {
11539 fidl::new_empty!(
11540 fidl::encoding::Endpoint<
11541 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
11542 >,
11543 fidl::encoding::DefaultFuchsiaResourceDialect
11544 )
11545 });
11546 fidl::decode!(
11547 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
11548 fidl::encoding::DefaultFuchsiaResourceDialect,
11549 val_ref,
11550 decoder,
11551 inner_offset,
11552 inner_depth
11553 )?;
11554 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11555 {
11556 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11557 }
11558 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11559 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11560 }
11561 }
11562
11563 next_offset += envelope_size;
11564 _next_ordinal_to_read += 1;
11565 if next_offset >= end_offset {
11566 return Ok(());
11567 }
11568
11569 while _next_ordinal_to_read < 3 {
11571 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11572 _next_ordinal_to_read += 1;
11573 next_offset += envelope_size;
11574 }
11575
11576 let next_out_of_line = decoder.next_out_of_line();
11577 let handles_before = decoder.remaining_handles();
11578 if let Some((inlined, num_bytes, num_handles)) =
11579 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11580 {
11581 let member_inline_size =
11582 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11583 if inlined != (member_inline_size <= 4) {
11584 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11585 }
11586 let inner_offset;
11587 let mut inner_depth = depth.clone();
11588 if inlined {
11589 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11590 inner_offset = next_offset;
11591 } else {
11592 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11593 inner_depth.increment()?;
11594 }
11595 let val_ref = self.max_sdu_size_outgoing.get_or_insert_with(|| {
11596 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
11597 });
11598 fidl::decode!(
11599 u16,
11600 fidl::encoding::DefaultFuchsiaResourceDialect,
11601 val_ref,
11602 decoder,
11603 inner_offset,
11604 inner_depth
11605 )?;
11606 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11607 {
11608 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11609 }
11610 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11611 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11612 }
11613 }
11614
11615 next_offset += envelope_size;
11616 _next_ordinal_to_read += 1;
11617 if next_offset >= end_offset {
11618 return Ok(());
11619 }
11620
11621 while _next_ordinal_to_read < 4 {
11623 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11624 _next_ordinal_to_read += 1;
11625 next_offset += envelope_size;
11626 }
11627
11628 let next_out_of_line = decoder.next_out_of_line();
11629 let handles_before = decoder.remaining_handles();
11630 if let Some((inlined, num_bytes, num_handles)) =
11631 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11632 {
11633 let member_inline_size =
11634 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11635 if inlined != (member_inline_size <= 4) {
11636 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11637 }
11638 let inner_offset;
11639 let mut inner_depth = depth.clone();
11640 if inlined {
11641 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11642 inner_offset = next_offset;
11643 } else {
11644 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11645 inner_depth.increment()?;
11646 }
11647 let val_ref = self.max_sdu_size_incoming.get_or_insert_with(|| {
11648 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
11649 });
11650 fidl::decode!(
11651 u16,
11652 fidl::encoding::DefaultFuchsiaResourceDialect,
11653 val_ref,
11654 decoder,
11655 inner_offset,
11656 inner_depth
11657 )?;
11658 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11659 {
11660 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11661 }
11662 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11663 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11664 }
11665 }
11666
11667 next_offset += envelope_size;
11668
11669 while next_offset < end_offset {
11671 _next_ordinal_to_read += 1;
11672 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11673 next_offset += envelope_size;
11674 }
11675
11676 Ok(())
11677 }
11678 }
11679
11680 impl ConnectionAcceptCisRequest {
11681 #[inline(always)]
11682 fn max_ordinal_present(&self) -> u64 {
11683 if let Some(_) = self.connection_stream {
11684 return 3;
11685 }
11686 if let Some(_) = self.cis_id {
11687 return 2;
11688 }
11689 if let Some(_) = self.cig_id {
11690 return 1;
11691 }
11692 0
11693 }
11694 }
11695
11696 impl fidl::encoding::ResourceTypeMarker for ConnectionAcceptCisRequest {
11697 type Borrowed<'a> = &'a mut Self;
11698 fn take_or_borrow<'a>(
11699 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11700 ) -> Self::Borrowed<'a> {
11701 value
11702 }
11703 }
11704
11705 unsafe impl fidl::encoding::TypeMarker for ConnectionAcceptCisRequest {
11706 type Owned = Self;
11707
11708 #[inline(always)]
11709 fn inline_align(_context: fidl::encoding::Context) -> usize {
11710 8
11711 }
11712
11713 #[inline(always)]
11714 fn inline_size(_context: fidl::encoding::Context) -> usize {
11715 16
11716 }
11717 }
11718
11719 unsafe impl
11720 fidl::encoding::Encode<
11721 ConnectionAcceptCisRequest,
11722 fidl::encoding::DefaultFuchsiaResourceDialect,
11723 > for &mut ConnectionAcceptCisRequest
11724 {
11725 unsafe fn encode(
11726 self,
11727 encoder: &mut fidl::encoding::Encoder<
11728 '_,
11729 fidl::encoding::DefaultFuchsiaResourceDialect,
11730 >,
11731 offset: usize,
11732 mut depth: fidl::encoding::Depth,
11733 ) -> fidl::Result<()> {
11734 encoder.debug_check_bounds::<ConnectionAcceptCisRequest>(offset);
11735 let max_ordinal: u64 = self.max_ordinal_present();
11737 encoder.write_num(max_ordinal, offset);
11738 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11739 if max_ordinal == 0 {
11741 return Ok(());
11742 }
11743 depth.increment()?;
11744 let envelope_size = 8;
11745 let bytes_len = max_ordinal as usize * envelope_size;
11746 #[allow(unused_variables)]
11747 let offset = encoder.out_of_line_offset(bytes_len);
11748 let mut _prev_end_offset: usize = 0;
11749 if 1 > max_ordinal {
11750 return Ok(());
11751 }
11752
11753 let cur_offset: usize = (1 - 1) * envelope_size;
11756
11757 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11759
11760 fidl::encoding::encode_in_envelope_optional::<
11765 u8,
11766 fidl::encoding::DefaultFuchsiaResourceDialect,
11767 >(
11768 self.cig_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11769 encoder,
11770 offset + cur_offset,
11771 depth,
11772 )?;
11773
11774 _prev_end_offset = cur_offset + envelope_size;
11775 if 2 > max_ordinal {
11776 return Ok(());
11777 }
11778
11779 let cur_offset: usize = (2 - 1) * envelope_size;
11782
11783 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11785
11786 fidl::encoding::encode_in_envelope_optional::<
11791 u8,
11792 fidl::encoding::DefaultFuchsiaResourceDialect,
11793 >(
11794 self.cis_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11795 encoder,
11796 offset + cur_offset,
11797 depth,
11798 )?;
11799
11800 _prev_end_offset = cur_offset + envelope_size;
11801 if 3 > max_ordinal {
11802 return Ok(());
11803 }
11804
11805 let cur_offset: usize = (3 - 1) * envelope_size;
11808
11809 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11811
11812 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11817 self.connection_stream.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11818 encoder, offset + cur_offset, depth
11819 )?;
11820
11821 _prev_end_offset = cur_offset + envelope_size;
11822
11823 Ok(())
11824 }
11825 }
11826
11827 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11828 for ConnectionAcceptCisRequest
11829 {
11830 #[inline(always)]
11831 fn new_empty() -> Self {
11832 Self::default()
11833 }
11834
11835 unsafe fn decode(
11836 &mut self,
11837 decoder: &mut fidl::encoding::Decoder<
11838 '_,
11839 fidl::encoding::DefaultFuchsiaResourceDialect,
11840 >,
11841 offset: usize,
11842 mut depth: fidl::encoding::Depth,
11843 ) -> fidl::Result<()> {
11844 decoder.debug_check_bounds::<Self>(offset);
11845 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11846 None => return Err(fidl::Error::NotNullable),
11847 Some(len) => len,
11848 };
11849 if len == 0 {
11851 return Ok(());
11852 };
11853 depth.increment()?;
11854 let envelope_size = 8;
11855 let bytes_len = len * envelope_size;
11856 let offset = decoder.out_of_line_offset(bytes_len)?;
11857 let mut _next_ordinal_to_read = 0;
11859 let mut next_offset = offset;
11860 let end_offset = offset + bytes_len;
11861 _next_ordinal_to_read += 1;
11862 if next_offset >= end_offset {
11863 return Ok(());
11864 }
11865
11866 while _next_ordinal_to_read < 1 {
11868 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11869 _next_ordinal_to_read += 1;
11870 next_offset += envelope_size;
11871 }
11872
11873 let next_out_of_line = decoder.next_out_of_line();
11874 let handles_before = decoder.remaining_handles();
11875 if let Some((inlined, num_bytes, num_handles)) =
11876 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11877 {
11878 let member_inline_size =
11879 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11880 if inlined != (member_inline_size <= 4) {
11881 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11882 }
11883 let inner_offset;
11884 let mut inner_depth = depth.clone();
11885 if inlined {
11886 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11887 inner_offset = next_offset;
11888 } else {
11889 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11890 inner_depth.increment()?;
11891 }
11892 let val_ref = self.cig_id.get_or_insert_with(|| {
11893 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
11894 });
11895 fidl::decode!(
11896 u8,
11897 fidl::encoding::DefaultFuchsiaResourceDialect,
11898 val_ref,
11899 decoder,
11900 inner_offset,
11901 inner_depth
11902 )?;
11903 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11904 {
11905 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11906 }
11907 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11908 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11909 }
11910 }
11911
11912 next_offset += envelope_size;
11913 _next_ordinal_to_read += 1;
11914 if next_offset >= end_offset {
11915 return Ok(());
11916 }
11917
11918 while _next_ordinal_to_read < 2 {
11920 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11921 _next_ordinal_to_read += 1;
11922 next_offset += envelope_size;
11923 }
11924
11925 let next_out_of_line = decoder.next_out_of_line();
11926 let handles_before = decoder.remaining_handles();
11927 if let Some((inlined, num_bytes, num_handles)) =
11928 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11929 {
11930 let member_inline_size =
11931 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11932 if inlined != (member_inline_size <= 4) {
11933 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11934 }
11935 let inner_offset;
11936 let mut inner_depth = depth.clone();
11937 if inlined {
11938 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11939 inner_offset = next_offset;
11940 } else {
11941 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11942 inner_depth.increment()?;
11943 }
11944 let val_ref = self.cis_id.get_or_insert_with(|| {
11945 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
11946 });
11947 fidl::decode!(
11948 u8,
11949 fidl::encoding::DefaultFuchsiaResourceDialect,
11950 val_ref,
11951 decoder,
11952 inner_offset,
11953 inner_depth
11954 )?;
11955 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11956 {
11957 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11958 }
11959 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11960 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11961 }
11962 }
11963
11964 next_offset += envelope_size;
11965 _next_ordinal_to_read += 1;
11966 if next_offset >= end_offset {
11967 return Ok(());
11968 }
11969
11970 while _next_ordinal_to_read < 3 {
11972 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11973 _next_ordinal_to_read += 1;
11974 next_offset += envelope_size;
11975 }
11976
11977 let next_out_of_line = decoder.next_out_of_line();
11978 let handles_before = decoder.remaining_handles();
11979 if let Some((inlined, num_bytes, num_handles)) =
11980 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11981 {
11982 let member_inline_size = <fidl::encoding::Endpoint<
11983 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
11984 > as fidl::encoding::TypeMarker>::inline_size(
11985 decoder.context
11986 );
11987 if inlined != (member_inline_size <= 4) {
11988 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11989 }
11990 let inner_offset;
11991 let mut inner_depth = depth.clone();
11992 if inlined {
11993 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11994 inner_offset = next_offset;
11995 } else {
11996 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11997 inner_depth.increment()?;
11998 }
11999 let val_ref = self.connection_stream.get_or_insert_with(|| {
12000 fidl::new_empty!(
12001 fidl::encoding::Endpoint<
12002 fidl::endpoints::ServerEnd<IsochronousStreamMarker>,
12003 >,
12004 fidl::encoding::DefaultFuchsiaResourceDialect
12005 )
12006 });
12007 fidl::decode!(
12008 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IsochronousStreamMarker>>,
12009 fidl::encoding::DefaultFuchsiaResourceDialect,
12010 val_ref,
12011 decoder,
12012 inner_offset,
12013 inner_depth
12014 )?;
12015 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12016 {
12017 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12018 }
12019 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12020 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12021 }
12022 }
12023
12024 next_offset += envelope_size;
12025
12026 while next_offset < end_offset {
12028 _next_ordinal_to_read += 1;
12029 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12030 next_offset += envelope_size;
12031 }
12032
12033 Ok(())
12034 }
12035 }
12036
12037 impl ConnectionConnectL2capRequest {
12038 #[inline(always)]
12039 fn max_ordinal_present(&self) -> u64 {
12040 if let Some(_) = self.psm {
12041 return 3;
12042 }
12043 if let Some(_) = self.channel {
12044 return 2;
12045 }
12046 if let Some(_) = self.parameters {
12047 return 1;
12048 }
12049 0
12050 }
12051 }
12052
12053 impl fidl::encoding::ResourceTypeMarker for ConnectionConnectL2capRequest {
12054 type Borrowed<'a> = &'a mut Self;
12055 fn take_or_borrow<'a>(
12056 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12057 ) -> Self::Borrowed<'a> {
12058 value
12059 }
12060 }
12061
12062 unsafe impl fidl::encoding::TypeMarker for ConnectionConnectL2capRequest {
12063 type Owned = Self;
12064
12065 #[inline(always)]
12066 fn inline_align(_context: fidl::encoding::Context) -> usize {
12067 8
12068 }
12069
12070 #[inline(always)]
12071 fn inline_size(_context: fidl::encoding::Context) -> usize {
12072 16
12073 }
12074 }
12075
12076 unsafe impl
12077 fidl::encoding::Encode<
12078 ConnectionConnectL2capRequest,
12079 fidl::encoding::DefaultFuchsiaResourceDialect,
12080 > for &mut ConnectionConnectL2capRequest
12081 {
12082 unsafe fn encode(
12083 self,
12084 encoder: &mut fidl::encoding::Encoder<
12085 '_,
12086 fidl::encoding::DefaultFuchsiaResourceDialect,
12087 >,
12088 offset: usize,
12089 mut depth: fidl::encoding::Depth,
12090 ) -> fidl::Result<()> {
12091 encoder.debug_check_bounds::<ConnectionConnectL2capRequest>(offset);
12092 let max_ordinal: u64 = self.max_ordinal_present();
12094 encoder.write_num(max_ordinal, offset);
12095 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12096 if max_ordinal == 0 {
12098 return Ok(());
12099 }
12100 depth.increment()?;
12101 let envelope_size = 8;
12102 let bytes_len = max_ordinal as usize * envelope_size;
12103 #[allow(unused_variables)]
12104 let offset = encoder.out_of_line_offset(bytes_len);
12105 let mut _prev_end_offset: usize = 0;
12106 if 1 > max_ordinal {
12107 return Ok(());
12108 }
12109
12110 let cur_offset: usize = (1 - 1) * envelope_size;
12113
12114 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12116
12117 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::ChannelParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
12122 self.parameters.as_ref().map(<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow),
12123 encoder, offset + cur_offset, depth
12124 )?;
12125
12126 _prev_end_offset = cur_offset + envelope_size;
12127 if 2 > max_ordinal {
12128 return Ok(());
12129 }
12130
12131 let cur_offset: usize = (2 - 1) * envelope_size;
12134
12135 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12137
12138 fidl::encoding::encode_in_envelope_optional::<
12143 fidl::encoding::Endpoint<
12144 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12145 >,
12146 fidl::encoding::DefaultFuchsiaResourceDialect,
12147 >(
12148 self.channel.as_mut().map(
12149 <fidl::encoding::Endpoint<
12150 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12151 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12152 ),
12153 encoder,
12154 offset + cur_offset,
12155 depth,
12156 )?;
12157
12158 _prev_end_offset = cur_offset + envelope_size;
12159 if 3 > max_ordinal {
12160 return Ok(());
12161 }
12162
12163 let cur_offset: usize = (3 - 1) * envelope_size;
12166
12167 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12169
12170 fidl::encoding::encode_in_envelope_optional::<
12175 u16,
12176 fidl::encoding::DefaultFuchsiaResourceDialect,
12177 >(
12178 self.psm.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
12179 encoder,
12180 offset + cur_offset,
12181 depth,
12182 )?;
12183
12184 _prev_end_offset = cur_offset + envelope_size;
12185
12186 Ok(())
12187 }
12188 }
12189
12190 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12191 for ConnectionConnectL2capRequest
12192 {
12193 #[inline(always)]
12194 fn new_empty() -> Self {
12195 Self::default()
12196 }
12197
12198 unsafe fn decode(
12199 &mut self,
12200 decoder: &mut fidl::encoding::Decoder<
12201 '_,
12202 fidl::encoding::DefaultFuchsiaResourceDialect,
12203 >,
12204 offset: usize,
12205 mut depth: fidl::encoding::Depth,
12206 ) -> fidl::Result<()> {
12207 decoder.debug_check_bounds::<Self>(offset);
12208 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12209 None => return Err(fidl::Error::NotNullable),
12210 Some(len) => len,
12211 };
12212 if len == 0 {
12214 return Ok(());
12215 };
12216 depth.increment()?;
12217 let envelope_size = 8;
12218 let bytes_len = len * envelope_size;
12219 let offset = decoder.out_of_line_offset(bytes_len)?;
12220 let mut _next_ordinal_to_read = 0;
12222 let mut next_offset = offset;
12223 let end_offset = offset + bytes_len;
12224 _next_ordinal_to_read += 1;
12225 if next_offset >= end_offset {
12226 return Ok(());
12227 }
12228
12229 while _next_ordinal_to_read < 1 {
12231 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12232 _next_ordinal_to_read += 1;
12233 next_offset += envelope_size;
12234 }
12235
12236 let next_out_of_line = decoder.next_out_of_line();
12237 let handles_before = decoder.remaining_handles();
12238 if let Some((inlined, num_bytes, num_handles)) =
12239 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12240 {
12241 let member_inline_size = <fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12242 if inlined != (member_inline_size <= 4) {
12243 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12244 }
12245 let inner_offset;
12246 let mut inner_depth = depth.clone();
12247 if inlined {
12248 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12249 inner_offset = next_offset;
12250 } else {
12251 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12252 inner_depth.increment()?;
12253 }
12254 let val_ref = self.parameters.get_or_insert_with(|| {
12255 fidl::new_empty!(
12256 fidl_fuchsia_bluetooth::ChannelParameters,
12257 fidl::encoding::DefaultFuchsiaResourceDialect
12258 )
12259 });
12260 fidl::decode!(
12261 fidl_fuchsia_bluetooth::ChannelParameters,
12262 fidl::encoding::DefaultFuchsiaResourceDialect,
12263 val_ref,
12264 decoder,
12265 inner_offset,
12266 inner_depth
12267 )?;
12268 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12269 {
12270 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12271 }
12272 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12273 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12274 }
12275 }
12276
12277 next_offset += envelope_size;
12278 _next_ordinal_to_read += 1;
12279 if next_offset >= end_offset {
12280 return Ok(());
12281 }
12282
12283 while _next_ordinal_to_read < 2 {
12285 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12286 _next_ordinal_to_read += 1;
12287 next_offset += envelope_size;
12288 }
12289
12290 let next_out_of_line = decoder.next_out_of_line();
12291 let handles_before = decoder.remaining_handles();
12292 if let Some((inlined, num_bytes, num_handles)) =
12293 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12294 {
12295 let member_inline_size = <fidl::encoding::Endpoint<
12296 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12297 > as fidl::encoding::TypeMarker>::inline_size(
12298 decoder.context
12299 );
12300 if inlined != (member_inline_size <= 4) {
12301 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12302 }
12303 let inner_offset;
12304 let mut inner_depth = depth.clone();
12305 if inlined {
12306 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12307 inner_offset = next_offset;
12308 } else {
12309 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12310 inner_depth.increment()?;
12311 }
12312 let val_ref = self.channel.get_or_insert_with(|| {
12313 fidl::new_empty!(
12314 fidl::encoding::Endpoint<
12315 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12316 >,
12317 fidl::encoding::DefaultFuchsiaResourceDialect
12318 )
12319 });
12320 fidl::decode!(
12321 fidl::encoding::Endpoint<
12322 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth::ChannelMarker>,
12323 >,
12324 fidl::encoding::DefaultFuchsiaResourceDialect,
12325 val_ref,
12326 decoder,
12327 inner_offset,
12328 inner_depth
12329 )?;
12330 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12331 {
12332 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12333 }
12334 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12335 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12336 }
12337 }
12338
12339 next_offset += envelope_size;
12340 _next_ordinal_to_read += 1;
12341 if next_offset >= end_offset {
12342 return Ok(());
12343 }
12344
12345 while _next_ordinal_to_read < 3 {
12347 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12348 _next_ordinal_to_read += 1;
12349 next_offset += envelope_size;
12350 }
12351
12352 let next_out_of_line = decoder.next_out_of_line();
12353 let handles_before = decoder.remaining_handles();
12354 if let Some((inlined, num_bytes, num_handles)) =
12355 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12356 {
12357 let member_inline_size =
12358 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12359 if inlined != (member_inline_size <= 4) {
12360 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12361 }
12362 let inner_offset;
12363 let mut inner_depth = depth.clone();
12364 if inlined {
12365 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12366 inner_offset = next_offset;
12367 } else {
12368 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12369 inner_depth.increment()?;
12370 }
12371 let val_ref = self.psm.get_or_insert_with(|| {
12372 fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
12373 });
12374 fidl::decode!(
12375 u16,
12376 fidl::encoding::DefaultFuchsiaResourceDialect,
12377 val_ref,
12378 decoder,
12379 inner_offset,
12380 inner_depth
12381 )?;
12382 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12383 {
12384 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12385 }
12386 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12387 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12388 }
12389 }
12390
12391 next_offset += envelope_size;
12392
12393 while next_offset < end_offset {
12395 _next_ordinal_to_read += 1;
12396 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12397 next_offset += envelope_size;
12398 }
12399
12400 Ok(())
12401 }
12402 }
12403}