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_host_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct HostSetBondingDelegateRequest {
16 pub delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for HostSetBondingDelegateRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct HostSetPairingDelegateRequest {
26 pub input: fidl_fuchsia_bluetooth_sys::InputCapability,
27 pub output: fidl_fuchsia_bluetooth_sys::OutputCapability,
28 pub delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for HostSetPairingDelegateRequest
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct HostSetPeerWatcherRequest {
38 pub peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HostSetPeerWatcherRequest {}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct ReceiverAddHostRequest {
45 pub request: fidl::endpoints::ClientEnd<HostMarker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ReceiverAddHostRequest {}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct HostStartDiscoveryRequest {
52 pub token: Option<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>,
54 #[doc(hidden)]
55 pub __source_breaking: fidl::marker::SourceBreaking,
56}
57
58impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HostStartDiscoveryRequest {}
59
60#[derive(Debug)]
61pub enum ProtocolRequest {
62 Central(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>),
63 Peripheral(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>),
64 GattServer(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>),
65 Gatt2Server(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>),
66 Profile(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>),
67 PrivilegedPeripheral(
68 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker>,
69 ),
70 #[doc(hidden)]
71 __SourceBreaking {
72 unknown_ordinal: u64,
73 },
74}
75
76#[macro_export]
78macro_rules! ProtocolRequestUnknown {
79 () => {
80 _
81 };
82}
83
84impl PartialEq for ProtocolRequest {
86 fn eq(&self, other: &Self) -> bool {
87 match (self, other) {
88 (Self::Central(x), Self::Central(y)) => *x == *y,
89 (Self::Peripheral(x), Self::Peripheral(y)) => *x == *y,
90 (Self::GattServer(x), Self::GattServer(y)) => *x == *y,
91 (Self::Gatt2Server(x), Self::Gatt2Server(y)) => *x == *y,
92 (Self::Profile(x), Self::Profile(y)) => *x == *y,
93 (Self::PrivilegedPeripheral(x), Self::PrivilegedPeripheral(y)) => *x == *y,
94 _ => false,
95 }
96 }
97}
98
99impl ProtocolRequest {
100 #[inline]
101 pub fn ordinal(&self) -> u64 {
102 match *self {
103 Self::Central(_) => 1,
104 Self::Peripheral(_) => 2,
105 Self::GattServer(_) => 3,
106 Self::Gatt2Server(_) => 4,
107 Self::Profile(_) => 5,
108 Self::PrivilegedPeripheral(_) => 6,
109 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
110 }
111 }
112
113 #[inline]
114 pub fn unknown_variant_for_testing() -> Self {
115 Self::__SourceBreaking { unknown_ordinal: 0 }
116 }
117
118 #[inline]
119 pub fn is_unknown(&self) -> bool {
120 match self {
121 Self::__SourceBreaking { .. } => true,
122 _ => false,
123 }
124 }
125}
126
127impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProtocolRequest {}
128
129#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
130pub struct BondingDelegateMarker;
131
132impl fidl::endpoints::ProtocolMarker for BondingDelegateMarker {
133 type Proxy = BondingDelegateProxy;
134 type RequestStream = BondingDelegateRequestStream;
135 #[cfg(target_os = "fuchsia")]
136 type SynchronousProxy = BondingDelegateSynchronousProxy;
137
138 const DEBUG_NAME: &'static str = "(anonymous) BondingDelegate";
139}
140
141pub trait BondingDelegateProxyInterface: Send + Sync {
142 type RestoreBondsResponseFut: std::future::Future<
143 Output = Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error>,
144 > + Send;
145 fn r#restore_bonds(
146 &self,
147 bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
148 ) -> Self::RestoreBondsResponseFut;
149 type WatchBondsResponseFut: std::future::Future<Output = Result<BondingDelegateWatchBondsResponse, fidl::Error>>
150 + Send;
151 fn r#watch_bonds(&self) -> Self::WatchBondsResponseFut;
152}
153#[derive(Debug)]
154#[cfg(target_os = "fuchsia")]
155pub struct BondingDelegateSynchronousProxy {
156 client: fidl::client::sync::Client,
157}
158
159#[cfg(target_os = "fuchsia")]
160impl fidl::endpoints::SynchronousProxy for BondingDelegateSynchronousProxy {
161 type Proxy = BondingDelegateProxy;
162 type Protocol = BondingDelegateMarker;
163
164 fn from_channel(inner: fidl::Channel) -> Self {
165 Self::new(inner)
166 }
167
168 fn into_channel(self) -> fidl::Channel {
169 self.client.into_channel()
170 }
171
172 fn as_channel(&self) -> &fidl::Channel {
173 self.client.as_channel()
174 }
175}
176
177#[cfg(target_os = "fuchsia")]
178impl BondingDelegateSynchronousProxy {
179 pub fn new(channel: fidl::Channel) -> Self {
180 let protocol_name = <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
181 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
182 }
183
184 pub fn into_channel(self) -> fidl::Channel {
185 self.client.into_channel()
186 }
187
188 pub fn wait_for_event(
191 &self,
192 deadline: zx::MonotonicInstant,
193 ) -> Result<BondingDelegateEvent, fidl::Error> {
194 BondingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
195 }
196
197 pub fn r#restore_bonds(
208 &self,
209 mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
210 ___deadline: zx::MonotonicInstant,
211 ) -> Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error> {
212 let _response = self.client.send_query::<
213 BondingDelegateRestoreBondsRequest,
214 fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>,
215 >(
216 (bonds,),
217 0x2f17e533f2475e96,
218 fidl::encoding::DynamicFlags::FLEXIBLE,
219 ___deadline,
220 )?
221 .into_result::<BondingDelegateMarker>("restore_bonds")?;
222 Ok(_response.errors)
223 }
224
225 pub fn r#watch_bonds(
227 &self,
228 ___deadline: zx::MonotonicInstant,
229 ) -> Result<BondingDelegateWatchBondsResponse, fidl::Error> {
230 let _response = self.client.send_query::<
231 fidl::encoding::EmptyPayload,
232 fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>,
233 >(
234 (),
235 0x48313cadc60cd07a,
236 fidl::encoding::DynamicFlags::FLEXIBLE,
237 ___deadline,
238 )?
239 .into_result::<BondingDelegateMarker>("watch_bonds")?;
240 Ok(_response)
241 }
242}
243
244#[cfg(target_os = "fuchsia")]
245impl From<BondingDelegateSynchronousProxy> for zx::Handle {
246 fn from(value: BondingDelegateSynchronousProxy) -> Self {
247 value.into_channel().into()
248 }
249}
250
251#[cfg(target_os = "fuchsia")]
252impl From<fidl::Channel> for BondingDelegateSynchronousProxy {
253 fn from(value: fidl::Channel) -> Self {
254 Self::new(value)
255 }
256}
257
258#[derive(Debug, Clone)]
259pub struct BondingDelegateProxy {
260 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
261}
262
263impl fidl::endpoints::Proxy for BondingDelegateProxy {
264 type Protocol = BondingDelegateMarker;
265
266 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
267 Self::new(inner)
268 }
269
270 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
271 self.client.into_channel().map_err(|client| Self { client })
272 }
273
274 fn as_channel(&self) -> &::fidl::AsyncChannel {
275 self.client.as_channel()
276 }
277}
278
279impl BondingDelegateProxy {
280 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
282 let protocol_name = <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
283 Self { client: fidl::client::Client::new(channel, protocol_name) }
284 }
285
286 pub fn take_event_stream(&self) -> BondingDelegateEventStream {
292 BondingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
293 }
294
295 pub fn r#restore_bonds(
306 &self,
307 mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
308 ) -> fidl::client::QueryResponseFut<
309 Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
310 fidl::encoding::DefaultFuchsiaResourceDialect,
311 > {
312 BondingDelegateProxyInterface::r#restore_bonds(self, bonds)
313 }
314
315 pub fn r#watch_bonds(
317 &self,
318 ) -> fidl::client::QueryResponseFut<
319 BondingDelegateWatchBondsResponse,
320 fidl::encoding::DefaultFuchsiaResourceDialect,
321 > {
322 BondingDelegateProxyInterface::r#watch_bonds(self)
323 }
324}
325
326impl BondingDelegateProxyInterface for BondingDelegateProxy {
327 type RestoreBondsResponseFut = fidl::client::QueryResponseFut<
328 Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
329 fidl::encoding::DefaultFuchsiaResourceDialect,
330 >;
331 fn r#restore_bonds(
332 &self,
333 mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
334 ) -> Self::RestoreBondsResponseFut {
335 fn _decode(
336 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
337 ) -> Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error> {
338 let _response = fidl::client::decode_transaction_body::<
339 fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>,
340 fidl::encoding::DefaultFuchsiaResourceDialect,
341 0x2f17e533f2475e96,
342 >(_buf?)?
343 .into_result::<BondingDelegateMarker>("restore_bonds")?;
344 Ok(_response.errors)
345 }
346 self.client.send_query_and_decode::<
347 BondingDelegateRestoreBondsRequest,
348 Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
349 >(
350 (bonds,),
351 0x2f17e533f2475e96,
352 fidl::encoding::DynamicFlags::FLEXIBLE,
353 _decode,
354 )
355 }
356
357 type WatchBondsResponseFut = fidl::client::QueryResponseFut<
358 BondingDelegateWatchBondsResponse,
359 fidl::encoding::DefaultFuchsiaResourceDialect,
360 >;
361 fn r#watch_bonds(&self) -> Self::WatchBondsResponseFut {
362 fn _decode(
363 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
364 ) -> Result<BondingDelegateWatchBondsResponse, fidl::Error> {
365 let _response = fidl::client::decode_transaction_body::<
366 fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>,
367 fidl::encoding::DefaultFuchsiaResourceDialect,
368 0x48313cadc60cd07a,
369 >(_buf?)?
370 .into_result::<BondingDelegateMarker>("watch_bonds")?;
371 Ok(_response)
372 }
373 self.client.send_query_and_decode::<
374 fidl::encoding::EmptyPayload,
375 BondingDelegateWatchBondsResponse,
376 >(
377 (),
378 0x48313cadc60cd07a,
379 fidl::encoding::DynamicFlags::FLEXIBLE,
380 _decode,
381 )
382 }
383}
384
385pub struct BondingDelegateEventStream {
386 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
387}
388
389impl std::marker::Unpin for BondingDelegateEventStream {}
390
391impl futures::stream::FusedStream for BondingDelegateEventStream {
392 fn is_terminated(&self) -> bool {
393 self.event_receiver.is_terminated()
394 }
395}
396
397impl futures::Stream for BondingDelegateEventStream {
398 type Item = Result<BondingDelegateEvent, fidl::Error>;
399
400 fn poll_next(
401 mut self: std::pin::Pin<&mut Self>,
402 cx: &mut std::task::Context<'_>,
403 ) -> std::task::Poll<Option<Self::Item>> {
404 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
405 &mut self.event_receiver,
406 cx
407 )?) {
408 Some(buf) => std::task::Poll::Ready(Some(BondingDelegateEvent::decode(buf))),
409 None => std::task::Poll::Ready(None),
410 }
411 }
412}
413
414#[derive(Debug)]
415pub enum BondingDelegateEvent {
416 #[non_exhaustive]
417 _UnknownEvent {
418 ordinal: u64,
420 },
421}
422
423impl BondingDelegateEvent {
424 fn decode(
426 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
427 ) -> Result<BondingDelegateEvent, fidl::Error> {
428 let (bytes, _handles) = buf.split_mut();
429 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
430 debug_assert_eq!(tx_header.tx_id, 0);
431 match tx_header.ordinal {
432 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
433 Ok(BondingDelegateEvent::_UnknownEvent { ordinal: tx_header.ordinal })
434 }
435 _ => Err(fidl::Error::UnknownOrdinal {
436 ordinal: tx_header.ordinal,
437 protocol_name:
438 <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
439 }),
440 }
441 }
442}
443
444pub struct BondingDelegateRequestStream {
446 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
447 is_terminated: bool,
448}
449
450impl std::marker::Unpin for BondingDelegateRequestStream {}
451
452impl futures::stream::FusedStream for BondingDelegateRequestStream {
453 fn is_terminated(&self) -> bool {
454 self.is_terminated
455 }
456}
457
458impl fidl::endpoints::RequestStream for BondingDelegateRequestStream {
459 type Protocol = BondingDelegateMarker;
460 type ControlHandle = BondingDelegateControlHandle;
461
462 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
463 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
464 }
465
466 fn control_handle(&self) -> Self::ControlHandle {
467 BondingDelegateControlHandle { inner: self.inner.clone() }
468 }
469
470 fn into_inner(
471 self,
472 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
473 {
474 (self.inner, self.is_terminated)
475 }
476
477 fn from_inner(
478 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
479 is_terminated: bool,
480 ) -> Self {
481 Self { inner, is_terminated }
482 }
483}
484
485impl futures::Stream for BondingDelegateRequestStream {
486 type Item = Result<BondingDelegateRequest, fidl::Error>;
487
488 fn poll_next(
489 mut self: std::pin::Pin<&mut Self>,
490 cx: &mut std::task::Context<'_>,
491 ) -> std::task::Poll<Option<Self::Item>> {
492 let this = &mut *self;
493 if this.inner.check_shutdown(cx) {
494 this.is_terminated = true;
495 return std::task::Poll::Ready(None);
496 }
497 if this.is_terminated {
498 panic!("polled BondingDelegateRequestStream after completion");
499 }
500 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
501 |bytes, handles| {
502 match this.inner.channel().read_etc(cx, bytes, handles) {
503 std::task::Poll::Ready(Ok(())) => {}
504 std::task::Poll::Pending => return std::task::Poll::Pending,
505 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
506 this.is_terminated = true;
507 return std::task::Poll::Ready(None);
508 }
509 std::task::Poll::Ready(Err(e)) => {
510 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
511 e.into(),
512 ))))
513 }
514 }
515
516 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
518
519 std::task::Poll::Ready(Some(match header.ordinal {
520 0x2f17e533f2475e96 => {
521 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
522 let mut req = fidl::new_empty!(
523 BondingDelegateRestoreBondsRequest,
524 fidl::encoding::DefaultFuchsiaResourceDialect
525 );
526 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BondingDelegateRestoreBondsRequest>(&header, _body_bytes, handles, &mut req)?;
527 let control_handle =
528 BondingDelegateControlHandle { inner: this.inner.clone() };
529 Ok(BondingDelegateRequest::RestoreBonds {
530 bonds: req.bonds,
531
532 responder: BondingDelegateRestoreBondsResponder {
533 control_handle: std::mem::ManuallyDrop::new(control_handle),
534 tx_id: header.tx_id,
535 },
536 })
537 }
538 0x48313cadc60cd07a => {
539 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
540 let mut req = fidl::new_empty!(
541 fidl::encoding::EmptyPayload,
542 fidl::encoding::DefaultFuchsiaResourceDialect
543 );
544 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
545 let control_handle =
546 BondingDelegateControlHandle { inner: this.inner.clone() };
547 Ok(BondingDelegateRequest::WatchBonds {
548 responder: BondingDelegateWatchBondsResponder {
549 control_handle: std::mem::ManuallyDrop::new(control_handle),
550 tx_id: header.tx_id,
551 },
552 })
553 }
554 _ if header.tx_id == 0
555 && header
556 .dynamic_flags()
557 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
558 {
559 Ok(BondingDelegateRequest::_UnknownMethod {
560 ordinal: header.ordinal,
561 control_handle: BondingDelegateControlHandle {
562 inner: this.inner.clone(),
563 },
564 method_type: fidl::MethodType::OneWay,
565 })
566 }
567 _ if header
568 .dynamic_flags()
569 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
570 {
571 this.inner.send_framework_err(
572 fidl::encoding::FrameworkErr::UnknownMethod,
573 header.tx_id,
574 header.ordinal,
575 header.dynamic_flags(),
576 (bytes, handles),
577 )?;
578 Ok(BondingDelegateRequest::_UnknownMethod {
579 ordinal: header.ordinal,
580 control_handle: BondingDelegateControlHandle {
581 inner: this.inner.clone(),
582 },
583 method_type: fidl::MethodType::TwoWay,
584 })
585 }
586 _ => Err(fidl::Error::UnknownOrdinal {
587 ordinal: header.ordinal,
588 protocol_name:
589 <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
590 }),
591 }))
592 },
593 )
594 }
595}
596
597#[derive(Debug)]
598pub enum BondingDelegateRequest {
599 RestoreBonds {
610 bonds: Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
611 responder: BondingDelegateRestoreBondsResponder,
612 },
613 WatchBonds { responder: BondingDelegateWatchBondsResponder },
615 #[non_exhaustive]
617 _UnknownMethod {
618 ordinal: u64,
620 control_handle: BondingDelegateControlHandle,
621 method_type: fidl::MethodType,
622 },
623}
624
625impl BondingDelegateRequest {
626 #[allow(irrefutable_let_patterns)]
627 pub fn into_restore_bonds(
628 self,
629 ) -> Option<(Vec<fidl_fuchsia_bluetooth_sys::BondingData>, BondingDelegateRestoreBondsResponder)>
630 {
631 if let BondingDelegateRequest::RestoreBonds { bonds, responder } = self {
632 Some((bonds, responder))
633 } else {
634 None
635 }
636 }
637
638 #[allow(irrefutable_let_patterns)]
639 pub fn into_watch_bonds(self) -> Option<(BondingDelegateWatchBondsResponder)> {
640 if let BondingDelegateRequest::WatchBonds { responder } = self {
641 Some((responder))
642 } else {
643 None
644 }
645 }
646
647 pub fn method_name(&self) -> &'static str {
649 match *self {
650 BondingDelegateRequest::RestoreBonds { .. } => "restore_bonds",
651 BondingDelegateRequest::WatchBonds { .. } => "watch_bonds",
652 BondingDelegateRequest::_UnknownMethod {
653 method_type: fidl::MethodType::OneWay,
654 ..
655 } => "unknown one-way method",
656 BondingDelegateRequest::_UnknownMethod {
657 method_type: fidl::MethodType::TwoWay,
658 ..
659 } => "unknown two-way method",
660 }
661 }
662}
663
664#[derive(Debug, Clone)]
665pub struct BondingDelegateControlHandle {
666 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
667}
668
669impl fidl::endpoints::ControlHandle for BondingDelegateControlHandle {
670 fn shutdown(&self) {
671 self.inner.shutdown()
672 }
673 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
674 self.inner.shutdown_with_epitaph(status)
675 }
676
677 fn is_closed(&self) -> bool {
678 self.inner.channel().is_closed()
679 }
680 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
681 self.inner.channel().on_closed()
682 }
683
684 #[cfg(target_os = "fuchsia")]
685 fn signal_peer(
686 &self,
687 clear_mask: zx::Signals,
688 set_mask: zx::Signals,
689 ) -> Result<(), zx_status::Status> {
690 use fidl::Peered;
691 self.inner.channel().signal_peer(clear_mask, set_mask)
692 }
693}
694
695impl BondingDelegateControlHandle {}
696
697#[must_use = "FIDL methods require a response to be sent"]
698#[derive(Debug)]
699pub struct BondingDelegateRestoreBondsResponder {
700 control_handle: std::mem::ManuallyDrop<BondingDelegateControlHandle>,
701 tx_id: u32,
702}
703
704impl std::ops::Drop for BondingDelegateRestoreBondsResponder {
708 fn drop(&mut self) {
709 self.control_handle.shutdown();
710 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
712 }
713}
714
715impl fidl::endpoints::Responder for BondingDelegateRestoreBondsResponder {
716 type ControlHandle = BondingDelegateControlHandle;
717
718 fn control_handle(&self) -> &BondingDelegateControlHandle {
719 &self.control_handle
720 }
721
722 fn drop_without_shutdown(mut self) {
723 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
725 std::mem::forget(self);
727 }
728}
729
730impl BondingDelegateRestoreBondsResponder {
731 pub fn send(
735 self,
736 mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
737 ) -> Result<(), fidl::Error> {
738 let _result = self.send_raw(errors);
739 if _result.is_err() {
740 self.control_handle.shutdown();
741 }
742 self.drop_without_shutdown();
743 _result
744 }
745
746 pub fn send_no_shutdown_on_err(
748 self,
749 mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
750 ) -> Result<(), fidl::Error> {
751 let _result = self.send_raw(errors);
752 self.drop_without_shutdown();
753 _result
754 }
755
756 fn send_raw(
757 &self,
758 mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
759 ) -> Result<(), fidl::Error> {
760 self.control_handle
761 .inner
762 .send::<fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>>(
763 fidl::encoding::Flexible::new((errors,)),
764 self.tx_id,
765 0x2f17e533f2475e96,
766 fidl::encoding::DynamicFlags::FLEXIBLE,
767 )
768 }
769}
770
771#[must_use = "FIDL methods require a response to be sent"]
772#[derive(Debug)]
773pub struct BondingDelegateWatchBondsResponder {
774 control_handle: std::mem::ManuallyDrop<BondingDelegateControlHandle>,
775 tx_id: u32,
776}
777
778impl std::ops::Drop for BondingDelegateWatchBondsResponder {
782 fn drop(&mut self) {
783 self.control_handle.shutdown();
784 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
786 }
787}
788
789impl fidl::endpoints::Responder for BondingDelegateWatchBondsResponder {
790 type ControlHandle = BondingDelegateControlHandle;
791
792 fn control_handle(&self) -> &BondingDelegateControlHandle {
793 &self.control_handle
794 }
795
796 fn drop_without_shutdown(mut self) {
797 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
799 std::mem::forget(self);
801 }
802}
803
804impl BondingDelegateWatchBondsResponder {
805 pub fn send(self, mut payload: &BondingDelegateWatchBondsResponse) -> Result<(), fidl::Error> {
809 let _result = self.send_raw(payload);
810 if _result.is_err() {
811 self.control_handle.shutdown();
812 }
813 self.drop_without_shutdown();
814 _result
815 }
816
817 pub fn send_no_shutdown_on_err(
819 self,
820 mut payload: &BondingDelegateWatchBondsResponse,
821 ) -> Result<(), fidl::Error> {
822 let _result = self.send_raw(payload);
823 self.drop_without_shutdown();
824 _result
825 }
826
827 fn send_raw(&self, mut payload: &BondingDelegateWatchBondsResponse) -> Result<(), fidl::Error> {
828 self.control_handle
829 .inner
830 .send::<fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>>(
831 fidl::encoding::Flexible::new(payload),
832 self.tx_id,
833 0x48313cadc60cd07a,
834 fidl::encoding::DynamicFlags::FLEXIBLE,
835 )
836 }
837}
838
839#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
840pub struct DiscoverySessionMarker;
841
842impl fidl::endpoints::ProtocolMarker for DiscoverySessionMarker {
843 type Proxy = DiscoverySessionProxy;
844 type RequestStream = DiscoverySessionRequestStream;
845 #[cfg(target_os = "fuchsia")]
846 type SynchronousProxy = DiscoverySessionSynchronousProxy;
847
848 const DEBUG_NAME: &'static str = "(anonymous) DiscoverySession";
849}
850
851pub trait DiscoverySessionProxyInterface: Send + Sync {
852 fn r#stop(&self) -> Result<(), fidl::Error>;
853}
854#[derive(Debug)]
855#[cfg(target_os = "fuchsia")]
856pub struct DiscoverySessionSynchronousProxy {
857 client: fidl::client::sync::Client,
858}
859
860#[cfg(target_os = "fuchsia")]
861impl fidl::endpoints::SynchronousProxy for DiscoverySessionSynchronousProxy {
862 type Proxy = DiscoverySessionProxy;
863 type Protocol = DiscoverySessionMarker;
864
865 fn from_channel(inner: fidl::Channel) -> Self {
866 Self::new(inner)
867 }
868
869 fn into_channel(self) -> fidl::Channel {
870 self.client.into_channel()
871 }
872
873 fn as_channel(&self) -> &fidl::Channel {
874 self.client.as_channel()
875 }
876}
877
878#[cfg(target_os = "fuchsia")]
879impl DiscoverySessionSynchronousProxy {
880 pub fn new(channel: fidl::Channel) -> Self {
881 let protocol_name = <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
882 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
883 }
884
885 pub fn into_channel(self) -> fidl::Channel {
886 self.client.into_channel()
887 }
888
889 pub fn wait_for_event(
892 &self,
893 deadline: zx::MonotonicInstant,
894 ) -> Result<DiscoverySessionEvent, fidl::Error> {
895 DiscoverySessionEvent::decode(self.client.wait_for_event(deadline)?)
896 }
897
898 pub fn r#stop(&self) -> Result<(), fidl::Error> {
903 self.client.send::<fidl::encoding::EmptyPayload>(
904 (),
905 0x3cbbd11b42632198,
906 fidl::encoding::DynamicFlags::FLEXIBLE,
907 )
908 }
909}
910
911#[cfg(target_os = "fuchsia")]
912impl From<DiscoverySessionSynchronousProxy> for zx::Handle {
913 fn from(value: DiscoverySessionSynchronousProxy) -> Self {
914 value.into_channel().into()
915 }
916}
917
918#[cfg(target_os = "fuchsia")]
919impl From<fidl::Channel> for DiscoverySessionSynchronousProxy {
920 fn from(value: fidl::Channel) -> Self {
921 Self::new(value)
922 }
923}
924
925#[derive(Debug, Clone)]
926pub struct DiscoverySessionProxy {
927 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
928}
929
930impl fidl::endpoints::Proxy for DiscoverySessionProxy {
931 type Protocol = DiscoverySessionMarker;
932
933 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
934 Self::new(inner)
935 }
936
937 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
938 self.client.into_channel().map_err(|client| Self { client })
939 }
940
941 fn as_channel(&self) -> &::fidl::AsyncChannel {
942 self.client.as_channel()
943 }
944}
945
946impl DiscoverySessionProxy {
947 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
949 let protocol_name = <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
950 Self { client: fidl::client::Client::new(channel, protocol_name) }
951 }
952
953 pub fn take_event_stream(&self) -> DiscoverySessionEventStream {
959 DiscoverySessionEventStream { event_receiver: self.client.take_event_receiver() }
960 }
961
962 pub fn r#stop(&self) -> Result<(), fidl::Error> {
967 DiscoverySessionProxyInterface::r#stop(self)
968 }
969}
970
971impl DiscoverySessionProxyInterface for DiscoverySessionProxy {
972 fn r#stop(&self) -> Result<(), fidl::Error> {
973 self.client.send::<fidl::encoding::EmptyPayload>(
974 (),
975 0x3cbbd11b42632198,
976 fidl::encoding::DynamicFlags::FLEXIBLE,
977 )
978 }
979}
980
981pub struct DiscoverySessionEventStream {
982 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
983}
984
985impl std::marker::Unpin for DiscoverySessionEventStream {}
986
987impl futures::stream::FusedStream for DiscoverySessionEventStream {
988 fn is_terminated(&self) -> bool {
989 self.event_receiver.is_terminated()
990 }
991}
992
993impl futures::Stream for DiscoverySessionEventStream {
994 type Item = Result<DiscoverySessionEvent, fidl::Error>;
995
996 fn poll_next(
997 mut self: std::pin::Pin<&mut Self>,
998 cx: &mut std::task::Context<'_>,
999 ) -> std::task::Poll<Option<Self::Item>> {
1000 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1001 &mut self.event_receiver,
1002 cx
1003 )?) {
1004 Some(buf) => std::task::Poll::Ready(Some(DiscoverySessionEvent::decode(buf))),
1005 None => std::task::Poll::Ready(None),
1006 }
1007 }
1008}
1009
1010#[derive(Debug)]
1011pub enum DiscoverySessionEvent {
1012 #[non_exhaustive]
1013 _UnknownEvent {
1014 ordinal: u64,
1016 },
1017}
1018
1019impl DiscoverySessionEvent {
1020 fn decode(
1022 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1023 ) -> Result<DiscoverySessionEvent, fidl::Error> {
1024 let (bytes, _handles) = buf.split_mut();
1025 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1026 debug_assert_eq!(tx_header.tx_id, 0);
1027 match tx_header.ordinal {
1028 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1029 Ok(DiscoverySessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1030 }
1031 _ => Err(fidl::Error::UnknownOrdinal {
1032 ordinal: tx_header.ordinal,
1033 protocol_name:
1034 <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1035 }),
1036 }
1037 }
1038}
1039
1040pub struct DiscoverySessionRequestStream {
1042 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1043 is_terminated: bool,
1044}
1045
1046impl std::marker::Unpin for DiscoverySessionRequestStream {}
1047
1048impl futures::stream::FusedStream for DiscoverySessionRequestStream {
1049 fn is_terminated(&self) -> bool {
1050 self.is_terminated
1051 }
1052}
1053
1054impl fidl::endpoints::RequestStream for DiscoverySessionRequestStream {
1055 type Protocol = DiscoverySessionMarker;
1056 type ControlHandle = DiscoverySessionControlHandle;
1057
1058 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1059 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1060 }
1061
1062 fn control_handle(&self) -> Self::ControlHandle {
1063 DiscoverySessionControlHandle { inner: self.inner.clone() }
1064 }
1065
1066 fn into_inner(
1067 self,
1068 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1069 {
1070 (self.inner, self.is_terminated)
1071 }
1072
1073 fn from_inner(
1074 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1075 is_terminated: bool,
1076 ) -> Self {
1077 Self { inner, is_terminated }
1078 }
1079}
1080
1081impl futures::Stream for DiscoverySessionRequestStream {
1082 type Item = Result<DiscoverySessionRequest, fidl::Error>;
1083
1084 fn poll_next(
1085 mut self: std::pin::Pin<&mut Self>,
1086 cx: &mut std::task::Context<'_>,
1087 ) -> std::task::Poll<Option<Self::Item>> {
1088 let this = &mut *self;
1089 if this.inner.check_shutdown(cx) {
1090 this.is_terminated = true;
1091 return std::task::Poll::Ready(None);
1092 }
1093 if this.is_terminated {
1094 panic!("polled DiscoverySessionRequestStream after completion");
1095 }
1096 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1097 |bytes, handles| {
1098 match this.inner.channel().read_etc(cx, bytes, handles) {
1099 std::task::Poll::Ready(Ok(())) => {}
1100 std::task::Poll::Pending => return std::task::Poll::Pending,
1101 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1102 this.is_terminated = true;
1103 return std::task::Poll::Ready(None);
1104 }
1105 std::task::Poll::Ready(Err(e)) => {
1106 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1107 e.into(),
1108 ))))
1109 }
1110 }
1111
1112 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1114
1115 std::task::Poll::Ready(Some(match header.ordinal {
1116 0x3cbbd11b42632198 => {
1117 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1118 let mut req = fidl::new_empty!(
1119 fidl::encoding::EmptyPayload,
1120 fidl::encoding::DefaultFuchsiaResourceDialect
1121 );
1122 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1123 let control_handle =
1124 DiscoverySessionControlHandle { inner: this.inner.clone() };
1125 Ok(DiscoverySessionRequest::Stop { control_handle })
1126 }
1127 _ if header.tx_id == 0
1128 && header
1129 .dynamic_flags()
1130 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1131 {
1132 Ok(DiscoverySessionRequest::_UnknownMethod {
1133 ordinal: header.ordinal,
1134 control_handle: DiscoverySessionControlHandle {
1135 inner: this.inner.clone(),
1136 },
1137 method_type: fidl::MethodType::OneWay,
1138 })
1139 }
1140 _ if header
1141 .dynamic_flags()
1142 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1143 {
1144 this.inner.send_framework_err(
1145 fidl::encoding::FrameworkErr::UnknownMethod,
1146 header.tx_id,
1147 header.ordinal,
1148 header.dynamic_flags(),
1149 (bytes, handles),
1150 )?;
1151 Ok(DiscoverySessionRequest::_UnknownMethod {
1152 ordinal: header.ordinal,
1153 control_handle: DiscoverySessionControlHandle {
1154 inner: this.inner.clone(),
1155 },
1156 method_type: fidl::MethodType::TwoWay,
1157 })
1158 }
1159 _ => Err(fidl::Error::UnknownOrdinal {
1160 ordinal: header.ordinal,
1161 protocol_name:
1162 <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1163 }),
1164 }))
1165 },
1166 )
1167 }
1168}
1169
1170#[derive(Debug)]
1172pub enum DiscoverySessionRequest {
1173 Stop { control_handle: DiscoverySessionControlHandle },
1178 #[non_exhaustive]
1180 _UnknownMethod {
1181 ordinal: u64,
1183 control_handle: DiscoverySessionControlHandle,
1184 method_type: fidl::MethodType,
1185 },
1186}
1187
1188impl DiscoverySessionRequest {
1189 #[allow(irrefutable_let_patterns)]
1190 pub fn into_stop(self) -> Option<(DiscoverySessionControlHandle)> {
1191 if let DiscoverySessionRequest::Stop { control_handle } = self {
1192 Some((control_handle))
1193 } else {
1194 None
1195 }
1196 }
1197
1198 pub fn method_name(&self) -> &'static str {
1200 match *self {
1201 DiscoverySessionRequest::Stop { .. } => "stop",
1202 DiscoverySessionRequest::_UnknownMethod {
1203 method_type: fidl::MethodType::OneWay,
1204 ..
1205 } => "unknown one-way method",
1206 DiscoverySessionRequest::_UnknownMethod {
1207 method_type: fidl::MethodType::TwoWay,
1208 ..
1209 } => "unknown two-way method",
1210 }
1211 }
1212}
1213
1214#[derive(Debug, Clone)]
1215pub struct DiscoverySessionControlHandle {
1216 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1217}
1218
1219impl fidl::endpoints::ControlHandle for DiscoverySessionControlHandle {
1220 fn shutdown(&self) {
1221 self.inner.shutdown()
1222 }
1223 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1224 self.inner.shutdown_with_epitaph(status)
1225 }
1226
1227 fn is_closed(&self) -> bool {
1228 self.inner.channel().is_closed()
1229 }
1230 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1231 self.inner.channel().on_closed()
1232 }
1233
1234 #[cfg(target_os = "fuchsia")]
1235 fn signal_peer(
1236 &self,
1237 clear_mask: zx::Signals,
1238 set_mask: zx::Signals,
1239 ) -> Result<(), zx_status::Status> {
1240 use fidl::Peered;
1241 self.inner.channel().signal_peer(clear_mask, set_mask)
1242 }
1243}
1244
1245impl DiscoverySessionControlHandle {}
1246
1247#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1248pub struct HostMarker;
1249
1250impl fidl::endpoints::ProtocolMarker for HostMarker {
1251 type Proxy = HostProxy;
1252 type RequestStream = HostRequestStream;
1253 #[cfg(target_os = "fuchsia")]
1254 type SynchronousProxy = HostSynchronousProxy;
1255
1256 const DEBUG_NAME: &'static str = "(anonymous) Host";
1257}
1258pub type HostSetLocalNameResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1259pub type HostSetDeviceClassResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1260pub type HostSetConnectableResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1261pub type HostSetDiscoverableResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1262pub type HostConnectResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1263pub type HostDisconnectResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1264pub type HostPairResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1265pub type HostForgetResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
1266
1267pub trait HostProxyInterface: Send + Sync {
1268 fn r#request_protocol(&self, payload: ProtocolRequest) -> Result<(), fidl::Error>;
1269 fn r#shutdown(&self) -> Result<(), fidl::Error>;
1270 type WatchStateResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error>>
1271 + Send;
1272 fn r#watch_state(&self) -> Self::WatchStateResponseFut;
1273 fn r#set_local_data(
1274 &self,
1275 payload: &fidl_fuchsia_bluetooth_sys::HostData,
1276 ) -> Result<(), fidl::Error>;
1277 fn r#set_peer_watcher(
1278 &self,
1279 peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
1280 ) -> Result<(), fidl::Error>;
1281 type SetLocalNameResponseFut: std::future::Future<Output = Result<HostSetLocalNameResult, fidl::Error>>
1282 + Send;
1283 fn r#set_local_name(&self, local_name: &str) -> Self::SetLocalNameResponseFut;
1284 type SetDeviceClassResponseFut: std::future::Future<Output = Result<HostSetDeviceClassResult, fidl::Error>>
1285 + Send;
1286 fn r#set_device_class(
1287 &self,
1288 device_class: &fidl_fuchsia_bluetooth::DeviceClass,
1289 ) -> Self::SetDeviceClassResponseFut;
1290 fn r#start_discovery(&self, payload: HostStartDiscoveryRequest) -> Result<(), fidl::Error>;
1291 type SetConnectableResponseFut: std::future::Future<Output = Result<HostSetConnectableResult, fidl::Error>>
1292 + Send;
1293 fn r#set_connectable(&self, enabled: bool) -> Self::SetConnectableResponseFut;
1294 type SetDiscoverableResponseFut: std::future::Future<Output = Result<HostSetDiscoverableResult, fidl::Error>>
1295 + Send;
1296 fn r#set_discoverable(&self, enabled: bool) -> Self::SetDiscoverableResponseFut;
1297 type ConnectResponseFut: std::future::Future<Output = Result<HostConnectResult, fidl::Error>>
1298 + Send;
1299 fn r#connect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut;
1300 type DisconnectResponseFut: std::future::Future<Output = Result<HostDisconnectResult, fidl::Error>>
1301 + Send;
1302 fn r#disconnect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut;
1303 type PairResponseFut: std::future::Future<Output = Result<HostPairResult, fidl::Error>> + Send;
1304 fn r#pair(
1305 &self,
1306 id: &fidl_fuchsia_bluetooth::PeerId,
1307 options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
1308 ) -> Self::PairResponseFut;
1309 type ForgetResponseFut: std::future::Future<Output = Result<HostForgetResult, fidl::Error>>
1310 + Send;
1311 fn r#forget(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut;
1312 fn r#enable_background_scan(&self, enabled: bool) -> Result<(), fidl::Error>;
1313 fn r#enable_privacy(&self, enabled: bool) -> Result<(), fidl::Error>;
1314 fn r#set_br_edr_security_mode(
1315 &self,
1316 bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
1317 ) -> Result<(), fidl::Error>;
1318 fn r#set_le_security_mode(
1319 &self,
1320 le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
1321 ) -> Result<(), fidl::Error>;
1322 fn r#set_pairing_delegate(
1323 &self,
1324 input: fidl_fuchsia_bluetooth_sys::InputCapability,
1325 output: fidl_fuchsia_bluetooth_sys::OutputCapability,
1326 delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
1327 ) -> Result<(), fidl::Error>;
1328 fn r#set_bonding_delegate(
1329 &self,
1330 delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
1331 ) -> Result<(), fidl::Error>;
1332}
1333#[derive(Debug)]
1334#[cfg(target_os = "fuchsia")]
1335pub struct HostSynchronousProxy {
1336 client: fidl::client::sync::Client,
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1340impl fidl::endpoints::SynchronousProxy for HostSynchronousProxy {
1341 type Proxy = HostProxy;
1342 type Protocol = HostMarker;
1343
1344 fn from_channel(inner: fidl::Channel) -> Self {
1345 Self::new(inner)
1346 }
1347
1348 fn into_channel(self) -> fidl::Channel {
1349 self.client.into_channel()
1350 }
1351
1352 fn as_channel(&self) -> &fidl::Channel {
1353 self.client.as_channel()
1354 }
1355}
1356
1357#[cfg(target_os = "fuchsia")]
1358impl HostSynchronousProxy {
1359 pub fn new(channel: fidl::Channel) -> Self {
1360 let protocol_name = <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1361 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1362 }
1363
1364 pub fn into_channel(self) -> fidl::Channel {
1365 self.client.into_channel()
1366 }
1367
1368 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<HostEvent, fidl::Error> {
1371 HostEvent::decode(self.client.wait_for_event(deadline)?)
1372 }
1373
1374 pub fn r#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
1377 self.client.send::<ProtocolRequest>(
1378 &mut payload,
1379 0x45cb5bf9834016b4,
1380 fidl::encoding::DynamicFlags::FLEXIBLE,
1381 )
1382 }
1383
1384 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
1400 self.client.send::<fidl::encoding::EmptyPayload>(
1401 (),
1402 0x18747459244591c9,
1403 fidl::encoding::DynamicFlags::empty(),
1404 )
1405 }
1406
1407 pub fn r#watch_state(
1415 &self,
1416 ___deadline: zx::MonotonicInstant,
1417 ) -> Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error> {
1418 let _response = self.client.send_query::<
1419 fidl::encoding::EmptyPayload,
1420 fidl::encoding::FlexibleType<HostWatchStateResponse>,
1421 >(
1422 (),
1423 0x19157554e2a3db52,
1424 fidl::encoding::DynamicFlags::FLEXIBLE,
1425 ___deadline,
1426 )?
1427 .into_result::<HostMarker>("watch_state")?;
1428 Ok(_response.info)
1429 }
1430
1431 pub fn r#set_local_data(
1433 &self,
1434 mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
1435 ) -> Result<(), fidl::Error> {
1436 self.client.send::<fidl_fuchsia_bluetooth_sys::HostData>(
1437 payload,
1438 0x57b70f72bb0a9187,
1439 fidl::encoding::DynamicFlags::empty(),
1440 )
1441 }
1442
1443 pub fn r#set_peer_watcher(
1446 &self,
1447 mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
1448 ) -> Result<(), fidl::Error> {
1449 self.client.send::<HostSetPeerWatcherRequest>(
1450 (peer_watcher,),
1451 0x3dec6b3c99c0a437,
1452 fidl::encoding::DynamicFlags::FLEXIBLE,
1453 )
1454 }
1455
1456 pub fn r#set_local_name(
1458 &self,
1459 mut local_name: &str,
1460 ___deadline: zx::MonotonicInstant,
1461 ) -> Result<HostSetLocalNameResult, fidl::Error> {
1462 let _response = self
1463 .client
1464 .send_query::<HostSetLocalNameRequest, fidl::encoding::FlexibleResultType<
1465 fidl::encoding::EmptyStruct,
1466 fidl_fuchsia_bluetooth_sys::Error,
1467 >>(
1468 (local_name,),
1469 0x85e98b56b98f123,
1470 fidl::encoding::DynamicFlags::FLEXIBLE,
1471 ___deadline,
1472 )?
1473 .into_result::<HostMarker>("set_local_name")?;
1474 Ok(_response.map(|x| x))
1475 }
1476
1477 pub fn r#set_device_class(
1479 &self,
1480 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
1481 ___deadline: zx::MonotonicInstant,
1482 ) -> Result<HostSetDeviceClassResult, fidl::Error> {
1483 let _response = self
1484 .client
1485 .send_query::<HostSetDeviceClassRequest, fidl::encoding::FlexibleResultType<
1486 fidl::encoding::EmptyStruct,
1487 fidl_fuchsia_bluetooth_sys::Error,
1488 >>(
1489 (device_class,),
1490 0x4caef8f835950de2,
1491 fidl::encoding::DynamicFlags::FLEXIBLE,
1492 ___deadline,
1493 )?
1494 .into_result::<HostMarker>("set_device_class")?;
1495 Ok(_response.map(|x| x))
1496 }
1497
1498 pub fn r#start_discovery(
1511 &self,
1512 mut payload: HostStartDiscoveryRequest,
1513 ) -> Result<(), fidl::Error> {
1514 self.client.send::<HostStartDiscoveryRequest>(
1515 &mut payload,
1516 0x3f40a85341413e4,
1517 fidl::encoding::DynamicFlags::FLEXIBLE,
1518 )
1519 }
1520
1521 pub fn r#set_connectable(
1523 &self,
1524 mut enabled: bool,
1525 ___deadline: zx::MonotonicInstant,
1526 ) -> Result<HostSetConnectableResult, fidl::Error> {
1527 let _response = self
1528 .client
1529 .send_query::<HostSetConnectableRequest, fidl::encoding::FlexibleResultType<
1530 fidl::encoding::EmptyStruct,
1531 fidl_fuchsia_bluetooth_sys::Error,
1532 >>(
1533 (enabled,), 0x187a6a82e811fa92, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1534 )?
1535 .into_result::<HostMarker>("set_connectable")?;
1536 Ok(_response.map(|x| x))
1537 }
1538
1539 pub fn r#set_discoverable(
1541 &self,
1542 mut enabled: bool,
1543 ___deadline: zx::MonotonicInstant,
1544 ) -> Result<HostSetDiscoverableResult, fidl::Error> {
1545 let _response = self
1546 .client
1547 .send_query::<HostSetDiscoverableRequest, fidl::encoding::FlexibleResultType<
1548 fidl::encoding::EmptyStruct,
1549 fidl_fuchsia_bluetooth_sys::Error,
1550 >>(
1551 (enabled,), 0x89f8c7da63e36de, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1552 )?
1553 .into_result::<HostMarker>("set_discoverable")?;
1554 Ok(_response.map(|x| x))
1555 }
1556
1557 pub fn r#connect(
1576 &self,
1577 mut id: &fidl_fuchsia_bluetooth::PeerId,
1578 ___deadline: zx::MonotonicInstant,
1579 ) -> Result<HostConnectResult, fidl::Error> {
1580 let _response = self
1581 .client
1582 .send_query::<HostConnectRequest, fidl::encoding::FlexibleResultType<
1583 fidl::encoding::EmptyStruct,
1584 fidl_fuchsia_bluetooth_sys::Error,
1585 >>(
1586 (id,), 0x5a56139c993e7240, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1587 )?
1588 .into_result::<HostMarker>("connect")?;
1589 Ok(_response.map(|x| x))
1590 }
1591
1592 pub fn r#disconnect(
1599 &self,
1600 mut id: &fidl_fuchsia_bluetooth::PeerId,
1601 ___deadline: zx::MonotonicInstant,
1602 ) -> Result<HostDisconnectResult, fidl::Error> {
1603 let _response = self
1604 .client
1605 .send_query::<HostDisconnectRequest, fidl::encoding::FlexibleResultType<
1606 fidl::encoding::EmptyStruct,
1607 fidl_fuchsia_bluetooth_sys::Error,
1608 >>(
1609 (id,), 0x33211717491121b1, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1610 )?
1611 .into_result::<HostMarker>("disconnect")?;
1612 Ok(_response.map(|x| x))
1613 }
1614
1615 pub fn r#pair(
1626 &self,
1627 mut id: &fidl_fuchsia_bluetooth::PeerId,
1628 mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
1629 ___deadline: zx::MonotonicInstant,
1630 ) -> Result<HostPairResult, fidl::Error> {
1631 let _response = self
1632 .client
1633 .send_query::<HostPairRequest, fidl::encoding::FlexibleResultType<
1634 fidl::encoding::EmptyStruct,
1635 fidl_fuchsia_bluetooth_sys::Error,
1636 >>(
1637 (id, options),
1638 0x2efaec6dc5d62ca2,
1639 fidl::encoding::DynamicFlags::FLEXIBLE,
1640 ___deadline,
1641 )?
1642 .into_result::<HostMarker>("pair")?;
1643 Ok(_response.map(|x| x))
1644 }
1645
1646 pub fn r#forget(
1654 &self,
1655 mut id: &fidl_fuchsia_bluetooth::PeerId,
1656 ___deadline: zx::MonotonicInstant,
1657 ) -> Result<HostForgetResult, fidl::Error> {
1658 let _response = self
1659 .client
1660 .send_query::<HostForgetRequest, fidl::encoding::FlexibleResultType<
1661 fidl::encoding::EmptyStruct,
1662 fidl_fuchsia_bluetooth_sys::Error,
1663 >>(
1664 (id,), 0x904f58dbdd4490a, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
1665 )?
1666 .into_result::<HostMarker>("forget")?;
1667 Ok(_response.map(|x| x))
1668 }
1669
1670 pub fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1675 self.client.send::<HostEnableBackgroundScanRequest>(
1676 (enabled,),
1677 0x51f038a8cf498946,
1678 fidl::encoding::DynamicFlags::FLEXIBLE,
1679 )
1680 }
1681
1682 pub fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
1686 self.client.send::<HostEnablePrivacyRequest>(
1687 (enabled,),
1688 0x370a76e1d2b5034b,
1689 fidl::encoding::DynamicFlags::empty(),
1690 )
1691 }
1692
1693 pub fn r#set_br_edr_security_mode(
1698 &self,
1699 mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
1700 ) -> Result<(), fidl::Error> {
1701 self.client.send::<HostSetBrEdrSecurityModeRequest>(
1702 (bredr_security_mode,),
1703 0x1d94d20717459281,
1704 fidl::encoding::DynamicFlags::empty(),
1705 )
1706 }
1707
1708 pub fn r#set_le_security_mode(
1713 &self,
1714 mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
1715 ) -> Result<(), fidl::Error> {
1716 self.client.send::<HostSetLeSecurityModeRequest>(
1717 (le_security_mode,),
1718 0x6ef0a424a336a81,
1719 fidl::encoding::DynamicFlags::empty(),
1720 )
1721 }
1722
1723 pub fn r#set_pairing_delegate(
1728 &self,
1729 mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
1730 mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
1731 mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
1732 ) -> Result<(), fidl::Error> {
1733 self.client.send::<HostSetPairingDelegateRequest>(
1734 (input, output, delegate),
1735 0x21a5bba5ffc9773e,
1736 fidl::encoding::DynamicFlags::FLEXIBLE,
1737 )
1738 }
1739
1740 pub fn r#set_bonding_delegate(
1744 &self,
1745 mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
1746 ) -> Result<(), fidl::Error> {
1747 self.client.send::<HostSetBondingDelegateRequest>(
1748 (delegate,),
1749 0x651d446a05b664d4,
1750 fidl::encoding::DynamicFlags::FLEXIBLE,
1751 )
1752 }
1753}
1754
1755#[cfg(target_os = "fuchsia")]
1756impl From<HostSynchronousProxy> for zx::Handle {
1757 fn from(value: HostSynchronousProxy) -> Self {
1758 value.into_channel().into()
1759 }
1760}
1761
1762#[cfg(target_os = "fuchsia")]
1763impl From<fidl::Channel> for HostSynchronousProxy {
1764 fn from(value: fidl::Channel) -> Self {
1765 Self::new(value)
1766 }
1767}
1768
1769#[derive(Debug, Clone)]
1770pub struct HostProxy {
1771 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1772}
1773
1774impl fidl::endpoints::Proxy for HostProxy {
1775 type Protocol = HostMarker;
1776
1777 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1778 Self::new(inner)
1779 }
1780
1781 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1782 self.client.into_channel().map_err(|client| Self { client })
1783 }
1784
1785 fn as_channel(&self) -> &::fidl::AsyncChannel {
1786 self.client.as_channel()
1787 }
1788}
1789
1790impl HostProxy {
1791 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1793 let protocol_name = <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1794 Self { client: fidl::client::Client::new(channel, protocol_name) }
1795 }
1796
1797 pub fn take_event_stream(&self) -> HostEventStream {
1803 HostEventStream { event_receiver: self.client.take_event_receiver() }
1804 }
1805
1806 pub fn r#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
1809 HostProxyInterface::r#request_protocol(self, payload)
1810 }
1811
1812 pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
1828 HostProxyInterface::r#shutdown(self)
1829 }
1830
1831 pub fn r#watch_state(
1839 &self,
1840 ) -> fidl::client::QueryResponseFut<
1841 fidl_fuchsia_bluetooth_sys::HostInfo,
1842 fidl::encoding::DefaultFuchsiaResourceDialect,
1843 > {
1844 HostProxyInterface::r#watch_state(self)
1845 }
1846
1847 pub fn r#set_local_data(
1849 &self,
1850 mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
1851 ) -> Result<(), fidl::Error> {
1852 HostProxyInterface::r#set_local_data(self, payload)
1853 }
1854
1855 pub fn r#set_peer_watcher(
1858 &self,
1859 mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
1860 ) -> Result<(), fidl::Error> {
1861 HostProxyInterface::r#set_peer_watcher(self, peer_watcher)
1862 }
1863
1864 pub fn r#set_local_name(
1866 &self,
1867 mut local_name: &str,
1868 ) -> fidl::client::QueryResponseFut<
1869 HostSetLocalNameResult,
1870 fidl::encoding::DefaultFuchsiaResourceDialect,
1871 > {
1872 HostProxyInterface::r#set_local_name(self, local_name)
1873 }
1874
1875 pub fn r#set_device_class(
1877 &self,
1878 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
1879 ) -> fidl::client::QueryResponseFut<
1880 HostSetDeviceClassResult,
1881 fidl::encoding::DefaultFuchsiaResourceDialect,
1882 > {
1883 HostProxyInterface::r#set_device_class(self, device_class)
1884 }
1885
1886 pub fn r#start_discovery(
1899 &self,
1900 mut payload: HostStartDiscoveryRequest,
1901 ) -> Result<(), fidl::Error> {
1902 HostProxyInterface::r#start_discovery(self, payload)
1903 }
1904
1905 pub fn r#set_connectable(
1907 &self,
1908 mut enabled: bool,
1909 ) -> fidl::client::QueryResponseFut<
1910 HostSetConnectableResult,
1911 fidl::encoding::DefaultFuchsiaResourceDialect,
1912 > {
1913 HostProxyInterface::r#set_connectable(self, enabled)
1914 }
1915
1916 pub fn r#set_discoverable(
1918 &self,
1919 mut enabled: bool,
1920 ) -> fidl::client::QueryResponseFut<
1921 HostSetDiscoverableResult,
1922 fidl::encoding::DefaultFuchsiaResourceDialect,
1923 > {
1924 HostProxyInterface::r#set_discoverable(self, enabled)
1925 }
1926
1927 pub fn r#connect(
1946 &self,
1947 mut id: &fidl_fuchsia_bluetooth::PeerId,
1948 ) -> fidl::client::QueryResponseFut<
1949 HostConnectResult,
1950 fidl::encoding::DefaultFuchsiaResourceDialect,
1951 > {
1952 HostProxyInterface::r#connect(self, id)
1953 }
1954
1955 pub fn r#disconnect(
1962 &self,
1963 mut id: &fidl_fuchsia_bluetooth::PeerId,
1964 ) -> fidl::client::QueryResponseFut<
1965 HostDisconnectResult,
1966 fidl::encoding::DefaultFuchsiaResourceDialect,
1967 > {
1968 HostProxyInterface::r#disconnect(self, id)
1969 }
1970
1971 pub fn r#pair(
1982 &self,
1983 mut id: &fidl_fuchsia_bluetooth::PeerId,
1984 mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
1985 ) -> fidl::client::QueryResponseFut<HostPairResult, fidl::encoding::DefaultFuchsiaResourceDialect>
1986 {
1987 HostProxyInterface::r#pair(self, id, options)
1988 }
1989
1990 pub fn r#forget(
1998 &self,
1999 mut id: &fidl_fuchsia_bluetooth::PeerId,
2000 ) -> fidl::client::QueryResponseFut<
2001 HostForgetResult,
2002 fidl::encoding::DefaultFuchsiaResourceDialect,
2003 > {
2004 HostProxyInterface::r#forget(self, id)
2005 }
2006
2007 pub fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2012 HostProxyInterface::r#enable_background_scan(self, enabled)
2013 }
2014
2015 pub fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2019 HostProxyInterface::r#enable_privacy(self, enabled)
2020 }
2021
2022 pub fn r#set_br_edr_security_mode(
2027 &self,
2028 mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
2029 ) -> Result<(), fidl::Error> {
2030 HostProxyInterface::r#set_br_edr_security_mode(self, bredr_security_mode)
2031 }
2032
2033 pub fn r#set_le_security_mode(
2038 &self,
2039 mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
2040 ) -> Result<(), fidl::Error> {
2041 HostProxyInterface::r#set_le_security_mode(self, le_security_mode)
2042 }
2043
2044 pub fn r#set_pairing_delegate(
2049 &self,
2050 mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
2051 mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
2052 mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
2053 ) -> Result<(), fidl::Error> {
2054 HostProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
2055 }
2056
2057 pub fn r#set_bonding_delegate(
2061 &self,
2062 mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
2063 ) -> Result<(), fidl::Error> {
2064 HostProxyInterface::r#set_bonding_delegate(self, delegate)
2065 }
2066}
2067
2068impl HostProxyInterface for HostProxy {
2069 fn r#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
2070 self.client.send::<ProtocolRequest>(
2071 &mut payload,
2072 0x45cb5bf9834016b4,
2073 fidl::encoding::DynamicFlags::FLEXIBLE,
2074 )
2075 }
2076
2077 fn r#shutdown(&self) -> Result<(), fidl::Error> {
2078 self.client.send::<fidl::encoding::EmptyPayload>(
2079 (),
2080 0x18747459244591c9,
2081 fidl::encoding::DynamicFlags::empty(),
2082 )
2083 }
2084
2085 type WatchStateResponseFut = fidl::client::QueryResponseFut<
2086 fidl_fuchsia_bluetooth_sys::HostInfo,
2087 fidl::encoding::DefaultFuchsiaResourceDialect,
2088 >;
2089 fn r#watch_state(&self) -> Self::WatchStateResponseFut {
2090 fn _decode(
2091 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2092 ) -> Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error> {
2093 let _response = fidl::client::decode_transaction_body::<
2094 fidl::encoding::FlexibleType<HostWatchStateResponse>,
2095 fidl::encoding::DefaultFuchsiaResourceDialect,
2096 0x19157554e2a3db52,
2097 >(_buf?)?
2098 .into_result::<HostMarker>("watch_state")?;
2099 Ok(_response.info)
2100 }
2101 self.client.send_query_and_decode::<
2102 fidl::encoding::EmptyPayload,
2103 fidl_fuchsia_bluetooth_sys::HostInfo,
2104 >(
2105 (),
2106 0x19157554e2a3db52,
2107 fidl::encoding::DynamicFlags::FLEXIBLE,
2108 _decode,
2109 )
2110 }
2111
2112 fn r#set_local_data(
2113 &self,
2114 mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
2115 ) -> Result<(), fidl::Error> {
2116 self.client.send::<fidl_fuchsia_bluetooth_sys::HostData>(
2117 payload,
2118 0x57b70f72bb0a9187,
2119 fidl::encoding::DynamicFlags::empty(),
2120 )
2121 }
2122
2123 fn r#set_peer_watcher(
2124 &self,
2125 mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
2126 ) -> Result<(), fidl::Error> {
2127 self.client.send::<HostSetPeerWatcherRequest>(
2128 (peer_watcher,),
2129 0x3dec6b3c99c0a437,
2130 fidl::encoding::DynamicFlags::FLEXIBLE,
2131 )
2132 }
2133
2134 type SetLocalNameResponseFut = fidl::client::QueryResponseFut<
2135 HostSetLocalNameResult,
2136 fidl::encoding::DefaultFuchsiaResourceDialect,
2137 >;
2138 fn r#set_local_name(&self, mut local_name: &str) -> Self::SetLocalNameResponseFut {
2139 fn _decode(
2140 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2141 ) -> Result<HostSetLocalNameResult, fidl::Error> {
2142 let _response = fidl::client::decode_transaction_body::<
2143 fidl::encoding::FlexibleResultType<
2144 fidl::encoding::EmptyStruct,
2145 fidl_fuchsia_bluetooth_sys::Error,
2146 >,
2147 fidl::encoding::DefaultFuchsiaResourceDialect,
2148 0x85e98b56b98f123,
2149 >(_buf?)?
2150 .into_result::<HostMarker>("set_local_name")?;
2151 Ok(_response.map(|x| x))
2152 }
2153 self.client.send_query_and_decode::<HostSetLocalNameRequest, HostSetLocalNameResult>(
2154 (local_name,),
2155 0x85e98b56b98f123,
2156 fidl::encoding::DynamicFlags::FLEXIBLE,
2157 _decode,
2158 )
2159 }
2160
2161 type SetDeviceClassResponseFut = fidl::client::QueryResponseFut<
2162 HostSetDeviceClassResult,
2163 fidl::encoding::DefaultFuchsiaResourceDialect,
2164 >;
2165 fn r#set_device_class(
2166 &self,
2167 mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
2168 ) -> Self::SetDeviceClassResponseFut {
2169 fn _decode(
2170 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2171 ) -> Result<HostSetDeviceClassResult, fidl::Error> {
2172 let _response = fidl::client::decode_transaction_body::<
2173 fidl::encoding::FlexibleResultType<
2174 fidl::encoding::EmptyStruct,
2175 fidl_fuchsia_bluetooth_sys::Error,
2176 >,
2177 fidl::encoding::DefaultFuchsiaResourceDialect,
2178 0x4caef8f835950de2,
2179 >(_buf?)?
2180 .into_result::<HostMarker>("set_device_class")?;
2181 Ok(_response.map(|x| x))
2182 }
2183 self.client.send_query_and_decode::<HostSetDeviceClassRequest, HostSetDeviceClassResult>(
2184 (device_class,),
2185 0x4caef8f835950de2,
2186 fidl::encoding::DynamicFlags::FLEXIBLE,
2187 _decode,
2188 )
2189 }
2190
2191 fn r#start_discovery(&self, mut payload: HostStartDiscoveryRequest) -> Result<(), fidl::Error> {
2192 self.client.send::<HostStartDiscoveryRequest>(
2193 &mut payload,
2194 0x3f40a85341413e4,
2195 fidl::encoding::DynamicFlags::FLEXIBLE,
2196 )
2197 }
2198
2199 type SetConnectableResponseFut = fidl::client::QueryResponseFut<
2200 HostSetConnectableResult,
2201 fidl::encoding::DefaultFuchsiaResourceDialect,
2202 >;
2203 fn r#set_connectable(&self, mut enabled: bool) -> Self::SetConnectableResponseFut {
2204 fn _decode(
2205 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2206 ) -> Result<HostSetConnectableResult, fidl::Error> {
2207 let _response = fidl::client::decode_transaction_body::<
2208 fidl::encoding::FlexibleResultType<
2209 fidl::encoding::EmptyStruct,
2210 fidl_fuchsia_bluetooth_sys::Error,
2211 >,
2212 fidl::encoding::DefaultFuchsiaResourceDialect,
2213 0x187a6a82e811fa92,
2214 >(_buf?)?
2215 .into_result::<HostMarker>("set_connectable")?;
2216 Ok(_response.map(|x| x))
2217 }
2218 self.client.send_query_and_decode::<HostSetConnectableRequest, HostSetConnectableResult>(
2219 (enabled,),
2220 0x187a6a82e811fa92,
2221 fidl::encoding::DynamicFlags::FLEXIBLE,
2222 _decode,
2223 )
2224 }
2225
2226 type SetDiscoverableResponseFut = fidl::client::QueryResponseFut<
2227 HostSetDiscoverableResult,
2228 fidl::encoding::DefaultFuchsiaResourceDialect,
2229 >;
2230 fn r#set_discoverable(&self, mut enabled: bool) -> Self::SetDiscoverableResponseFut {
2231 fn _decode(
2232 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2233 ) -> Result<HostSetDiscoverableResult, fidl::Error> {
2234 let _response = fidl::client::decode_transaction_body::<
2235 fidl::encoding::FlexibleResultType<
2236 fidl::encoding::EmptyStruct,
2237 fidl_fuchsia_bluetooth_sys::Error,
2238 >,
2239 fidl::encoding::DefaultFuchsiaResourceDialect,
2240 0x89f8c7da63e36de,
2241 >(_buf?)?
2242 .into_result::<HostMarker>("set_discoverable")?;
2243 Ok(_response.map(|x| x))
2244 }
2245 self.client.send_query_and_decode::<HostSetDiscoverableRequest, HostSetDiscoverableResult>(
2246 (enabled,),
2247 0x89f8c7da63e36de,
2248 fidl::encoding::DynamicFlags::FLEXIBLE,
2249 _decode,
2250 )
2251 }
2252
2253 type ConnectResponseFut = fidl::client::QueryResponseFut<
2254 HostConnectResult,
2255 fidl::encoding::DefaultFuchsiaResourceDialect,
2256 >;
2257 fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
2258 fn _decode(
2259 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2260 ) -> Result<HostConnectResult, fidl::Error> {
2261 let _response = fidl::client::decode_transaction_body::<
2262 fidl::encoding::FlexibleResultType<
2263 fidl::encoding::EmptyStruct,
2264 fidl_fuchsia_bluetooth_sys::Error,
2265 >,
2266 fidl::encoding::DefaultFuchsiaResourceDialect,
2267 0x5a56139c993e7240,
2268 >(_buf?)?
2269 .into_result::<HostMarker>("connect")?;
2270 Ok(_response.map(|x| x))
2271 }
2272 self.client.send_query_and_decode::<HostConnectRequest, HostConnectResult>(
2273 (id,),
2274 0x5a56139c993e7240,
2275 fidl::encoding::DynamicFlags::FLEXIBLE,
2276 _decode,
2277 )
2278 }
2279
2280 type DisconnectResponseFut = fidl::client::QueryResponseFut<
2281 HostDisconnectResult,
2282 fidl::encoding::DefaultFuchsiaResourceDialect,
2283 >;
2284 fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
2285 fn _decode(
2286 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2287 ) -> Result<HostDisconnectResult, fidl::Error> {
2288 let _response = fidl::client::decode_transaction_body::<
2289 fidl::encoding::FlexibleResultType<
2290 fidl::encoding::EmptyStruct,
2291 fidl_fuchsia_bluetooth_sys::Error,
2292 >,
2293 fidl::encoding::DefaultFuchsiaResourceDialect,
2294 0x33211717491121b1,
2295 >(_buf?)?
2296 .into_result::<HostMarker>("disconnect")?;
2297 Ok(_response.map(|x| x))
2298 }
2299 self.client.send_query_and_decode::<HostDisconnectRequest, HostDisconnectResult>(
2300 (id,),
2301 0x33211717491121b1,
2302 fidl::encoding::DynamicFlags::FLEXIBLE,
2303 _decode,
2304 )
2305 }
2306
2307 type PairResponseFut = fidl::client::QueryResponseFut<
2308 HostPairResult,
2309 fidl::encoding::DefaultFuchsiaResourceDialect,
2310 >;
2311 fn r#pair(
2312 &self,
2313 mut id: &fidl_fuchsia_bluetooth::PeerId,
2314 mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
2315 ) -> Self::PairResponseFut {
2316 fn _decode(
2317 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2318 ) -> Result<HostPairResult, fidl::Error> {
2319 let _response = fidl::client::decode_transaction_body::<
2320 fidl::encoding::FlexibleResultType<
2321 fidl::encoding::EmptyStruct,
2322 fidl_fuchsia_bluetooth_sys::Error,
2323 >,
2324 fidl::encoding::DefaultFuchsiaResourceDialect,
2325 0x2efaec6dc5d62ca2,
2326 >(_buf?)?
2327 .into_result::<HostMarker>("pair")?;
2328 Ok(_response.map(|x| x))
2329 }
2330 self.client.send_query_and_decode::<HostPairRequest, HostPairResult>(
2331 (id, options),
2332 0x2efaec6dc5d62ca2,
2333 fidl::encoding::DynamicFlags::FLEXIBLE,
2334 _decode,
2335 )
2336 }
2337
2338 type ForgetResponseFut = fidl::client::QueryResponseFut<
2339 HostForgetResult,
2340 fidl::encoding::DefaultFuchsiaResourceDialect,
2341 >;
2342 fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
2343 fn _decode(
2344 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2345 ) -> Result<HostForgetResult, fidl::Error> {
2346 let _response = fidl::client::decode_transaction_body::<
2347 fidl::encoding::FlexibleResultType<
2348 fidl::encoding::EmptyStruct,
2349 fidl_fuchsia_bluetooth_sys::Error,
2350 >,
2351 fidl::encoding::DefaultFuchsiaResourceDialect,
2352 0x904f58dbdd4490a,
2353 >(_buf?)?
2354 .into_result::<HostMarker>("forget")?;
2355 Ok(_response.map(|x| x))
2356 }
2357 self.client.send_query_and_decode::<HostForgetRequest, HostForgetResult>(
2358 (id,),
2359 0x904f58dbdd4490a,
2360 fidl::encoding::DynamicFlags::FLEXIBLE,
2361 _decode,
2362 )
2363 }
2364
2365 fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2366 self.client.send::<HostEnableBackgroundScanRequest>(
2367 (enabled,),
2368 0x51f038a8cf498946,
2369 fidl::encoding::DynamicFlags::FLEXIBLE,
2370 )
2371 }
2372
2373 fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2374 self.client.send::<HostEnablePrivacyRequest>(
2375 (enabled,),
2376 0x370a76e1d2b5034b,
2377 fidl::encoding::DynamicFlags::empty(),
2378 )
2379 }
2380
2381 fn r#set_br_edr_security_mode(
2382 &self,
2383 mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
2384 ) -> Result<(), fidl::Error> {
2385 self.client.send::<HostSetBrEdrSecurityModeRequest>(
2386 (bredr_security_mode,),
2387 0x1d94d20717459281,
2388 fidl::encoding::DynamicFlags::empty(),
2389 )
2390 }
2391
2392 fn r#set_le_security_mode(
2393 &self,
2394 mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
2395 ) -> Result<(), fidl::Error> {
2396 self.client.send::<HostSetLeSecurityModeRequest>(
2397 (le_security_mode,),
2398 0x6ef0a424a336a81,
2399 fidl::encoding::DynamicFlags::empty(),
2400 )
2401 }
2402
2403 fn r#set_pairing_delegate(
2404 &self,
2405 mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
2406 mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
2407 mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
2408 ) -> Result<(), fidl::Error> {
2409 self.client.send::<HostSetPairingDelegateRequest>(
2410 (input, output, delegate),
2411 0x21a5bba5ffc9773e,
2412 fidl::encoding::DynamicFlags::FLEXIBLE,
2413 )
2414 }
2415
2416 fn r#set_bonding_delegate(
2417 &self,
2418 mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
2419 ) -> Result<(), fidl::Error> {
2420 self.client.send::<HostSetBondingDelegateRequest>(
2421 (delegate,),
2422 0x651d446a05b664d4,
2423 fidl::encoding::DynamicFlags::FLEXIBLE,
2424 )
2425 }
2426}
2427
2428pub struct HostEventStream {
2429 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2430}
2431
2432impl std::marker::Unpin for HostEventStream {}
2433
2434impl futures::stream::FusedStream for HostEventStream {
2435 fn is_terminated(&self) -> bool {
2436 self.event_receiver.is_terminated()
2437 }
2438}
2439
2440impl futures::Stream for HostEventStream {
2441 type Item = Result<HostEvent, fidl::Error>;
2442
2443 fn poll_next(
2444 mut self: std::pin::Pin<&mut Self>,
2445 cx: &mut std::task::Context<'_>,
2446 ) -> std::task::Poll<Option<Self::Item>> {
2447 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2448 &mut self.event_receiver,
2449 cx
2450 )?) {
2451 Some(buf) => std::task::Poll::Ready(Some(HostEvent::decode(buf))),
2452 None => std::task::Poll::Ready(None),
2453 }
2454 }
2455}
2456
2457#[derive(Debug)]
2458pub enum HostEvent {
2459 #[non_exhaustive]
2460 _UnknownEvent {
2461 ordinal: u64,
2463 },
2464}
2465
2466impl HostEvent {
2467 fn decode(
2469 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2470 ) -> Result<HostEvent, fidl::Error> {
2471 let (bytes, _handles) = buf.split_mut();
2472 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2473 debug_assert_eq!(tx_header.tx_id, 0);
2474 match tx_header.ordinal {
2475 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2476 Ok(HostEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2477 }
2478 _ => Err(fidl::Error::UnknownOrdinal {
2479 ordinal: tx_header.ordinal,
2480 protocol_name: <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2481 }),
2482 }
2483 }
2484}
2485
2486pub struct HostRequestStream {
2488 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2489 is_terminated: bool,
2490}
2491
2492impl std::marker::Unpin for HostRequestStream {}
2493
2494impl futures::stream::FusedStream for HostRequestStream {
2495 fn is_terminated(&self) -> bool {
2496 self.is_terminated
2497 }
2498}
2499
2500impl fidl::endpoints::RequestStream for HostRequestStream {
2501 type Protocol = HostMarker;
2502 type ControlHandle = HostControlHandle;
2503
2504 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2505 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2506 }
2507
2508 fn control_handle(&self) -> Self::ControlHandle {
2509 HostControlHandle { inner: self.inner.clone() }
2510 }
2511
2512 fn into_inner(
2513 self,
2514 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2515 {
2516 (self.inner, self.is_terminated)
2517 }
2518
2519 fn from_inner(
2520 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2521 is_terminated: bool,
2522 ) -> Self {
2523 Self { inner, is_terminated }
2524 }
2525}
2526
2527impl futures::Stream for HostRequestStream {
2528 type Item = Result<HostRequest, fidl::Error>;
2529
2530 fn poll_next(
2531 mut self: std::pin::Pin<&mut Self>,
2532 cx: &mut std::task::Context<'_>,
2533 ) -> std::task::Poll<Option<Self::Item>> {
2534 let this = &mut *self;
2535 if this.inner.check_shutdown(cx) {
2536 this.is_terminated = true;
2537 return std::task::Poll::Ready(None);
2538 }
2539 if this.is_terminated {
2540 panic!("polled HostRequestStream after completion");
2541 }
2542 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2543 |bytes, handles| {
2544 match this.inner.channel().read_etc(cx, bytes, handles) {
2545 std::task::Poll::Ready(Ok(())) => {}
2546 std::task::Poll::Pending => return std::task::Poll::Pending,
2547 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2548 this.is_terminated = true;
2549 return std::task::Poll::Ready(None);
2550 }
2551 std::task::Poll::Ready(Err(e)) => {
2552 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2553 e.into(),
2554 ))))
2555 }
2556 }
2557
2558 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2560
2561 std::task::Poll::Ready(Some(match header.ordinal {
2562 0x45cb5bf9834016b4 => {
2563 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2564 let mut req = fidl::new_empty!(
2565 ProtocolRequest,
2566 fidl::encoding::DefaultFuchsiaResourceDialect
2567 );
2568 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
2569 let control_handle = HostControlHandle { inner: this.inner.clone() };
2570 Ok(HostRequest::RequestProtocol { payload: req, control_handle })
2571 }
2572 0x18747459244591c9 => {
2573 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2574 let mut req = fidl::new_empty!(
2575 fidl::encoding::EmptyPayload,
2576 fidl::encoding::DefaultFuchsiaResourceDialect
2577 );
2578 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2579 let control_handle = HostControlHandle { inner: this.inner.clone() };
2580 Ok(HostRequest::Shutdown { control_handle })
2581 }
2582 0x19157554e2a3db52 => {
2583 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2584 let mut req = fidl::new_empty!(
2585 fidl::encoding::EmptyPayload,
2586 fidl::encoding::DefaultFuchsiaResourceDialect
2587 );
2588 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2589 let control_handle = HostControlHandle { inner: this.inner.clone() };
2590 Ok(HostRequest::WatchState {
2591 responder: HostWatchStateResponder {
2592 control_handle: std::mem::ManuallyDrop::new(control_handle),
2593 tx_id: header.tx_id,
2594 },
2595 })
2596 }
2597 0x57b70f72bb0a9187 => {
2598 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2599 let mut req = fidl::new_empty!(
2600 fidl_fuchsia_bluetooth_sys::HostData,
2601 fidl::encoding::DefaultFuchsiaResourceDialect
2602 );
2603 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_bluetooth_sys::HostData>(&header, _body_bytes, handles, &mut req)?;
2604 let control_handle = HostControlHandle { inner: this.inner.clone() };
2605 Ok(HostRequest::SetLocalData { payload: req, control_handle })
2606 }
2607 0x3dec6b3c99c0a437 => {
2608 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2609 let mut req = fidl::new_empty!(
2610 HostSetPeerWatcherRequest,
2611 fidl::encoding::DefaultFuchsiaResourceDialect
2612 );
2613 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetPeerWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
2614 let control_handle = HostControlHandle { inner: this.inner.clone() };
2615 Ok(HostRequest::SetPeerWatcher {
2616 peer_watcher: req.peer_watcher,
2617
2618 control_handle,
2619 })
2620 }
2621 0x85e98b56b98f123 => {
2622 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2623 let mut req = fidl::new_empty!(
2624 HostSetLocalNameRequest,
2625 fidl::encoding::DefaultFuchsiaResourceDialect
2626 );
2627 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
2628 let control_handle = HostControlHandle { inner: this.inner.clone() };
2629 Ok(HostRequest::SetLocalName {
2630 local_name: req.local_name,
2631
2632 responder: HostSetLocalNameResponder {
2633 control_handle: std::mem::ManuallyDrop::new(control_handle),
2634 tx_id: header.tx_id,
2635 },
2636 })
2637 }
2638 0x4caef8f835950de2 => {
2639 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2640 let mut req = fidl::new_empty!(
2641 HostSetDeviceClassRequest,
2642 fidl::encoding::DefaultFuchsiaResourceDialect
2643 );
2644 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
2645 let control_handle = HostControlHandle { inner: this.inner.clone() };
2646 Ok(HostRequest::SetDeviceClass {
2647 device_class: req.device_class,
2648
2649 responder: HostSetDeviceClassResponder {
2650 control_handle: std::mem::ManuallyDrop::new(control_handle),
2651 tx_id: header.tx_id,
2652 },
2653 })
2654 }
2655 0x3f40a85341413e4 => {
2656 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2657 let mut req = fidl::new_empty!(
2658 HostStartDiscoveryRequest,
2659 fidl::encoding::DefaultFuchsiaResourceDialect
2660 );
2661 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
2662 let control_handle = HostControlHandle { inner: this.inner.clone() };
2663 Ok(HostRequest::StartDiscovery { payload: req, control_handle })
2664 }
2665 0x187a6a82e811fa92 => {
2666 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2667 let mut req = fidl::new_empty!(
2668 HostSetConnectableRequest,
2669 fidl::encoding::DefaultFuchsiaResourceDialect
2670 );
2671 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetConnectableRequest>(&header, _body_bytes, handles, &mut req)?;
2672 let control_handle = HostControlHandle { inner: this.inner.clone() };
2673 Ok(HostRequest::SetConnectable {
2674 enabled: req.enabled,
2675
2676 responder: HostSetConnectableResponder {
2677 control_handle: std::mem::ManuallyDrop::new(control_handle),
2678 tx_id: header.tx_id,
2679 },
2680 })
2681 }
2682 0x89f8c7da63e36de => {
2683 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2684 let mut req = fidl::new_empty!(
2685 HostSetDiscoverableRequest,
2686 fidl::encoding::DefaultFuchsiaResourceDialect
2687 );
2688 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
2689 let control_handle = HostControlHandle { inner: this.inner.clone() };
2690 Ok(HostRequest::SetDiscoverable {
2691 enabled: req.enabled,
2692
2693 responder: HostSetDiscoverableResponder {
2694 control_handle: std::mem::ManuallyDrop::new(control_handle),
2695 tx_id: header.tx_id,
2696 },
2697 })
2698 }
2699 0x5a56139c993e7240 => {
2700 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2701 let mut req = fidl::new_empty!(
2702 HostConnectRequest,
2703 fidl::encoding::DefaultFuchsiaResourceDialect
2704 );
2705 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2706 let control_handle = HostControlHandle { inner: this.inner.clone() };
2707 Ok(HostRequest::Connect {
2708 id: req.id,
2709
2710 responder: HostConnectResponder {
2711 control_handle: std::mem::ManuallyDrop::new(control_handle),
2712 tx_id: header.tx_id,
2713 },
2714 })
2715 }
2716 0x33211717491121b1 => {
2717 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2718 let mut req = fidl::new_empty!(
2719 HostDisconnectRequest,
2720 fidl::encoding::DefaultFuchsiaResourceDialect
2721 );
2722 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
2723 let control_handle = HostControlHandle { inner: this.inner.clone() };
2724 Ok(HostRequest::Disconnect {
2725 id: req.id,
2726
2727 responder: HostDisconnectResponder {
2728 control_handle: std::mem::ManuallyDrop::new(control_handle),
2729 tx_id: header.tx_id,
2730 },
2731 })
2732 }
2733 0x2efaec6dc5d62ca2 => {
2734 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2735 let mut req = fidl::new_empty!(
2736 HostPairRequest,
2737 fidl::encoding::DefaultFuchsiaResourceDialect
2738 );
2739 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostPairRequest>(&header, _body_bytes, handles, &mut req)?;
2740 let control_handle = HostControlHandle { inner: this.inner.clone() };
2741 Ok(HostRequest::Pair {
2742 id: req.id,
2743 options: req.options,
2744
2745 responder: HostPairResponder {
2746 control_handle: std::mem::ManuallyDrop::new(control_handle),
2747 tx_id: header.tx_id,
2748 },
2749 })
2750 }
2751 0x904f58dbdd4490a => {
2752 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2753 let mut req = fidl::new_empty!(
2754 HostForgetRequest,
2755 fidl::encoding::DefaultFuchsiaResourceDialect
2756 );
2757 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostForgetRequest>(&header, _body_bytes, handles, &mut req)?;
2758 let control_handle = HostControlHandle { inner: this.inner.clone() };
2759 Ok(HostRequest::Forget {
2760 id: req.id,
2761
2762 responder: HostForgetResponder {
2763 control_handle: std::mem::ManuallyDrop::new(control_handle),
2764 tx_id: header.tx_id,
2765 },
2766 })
2767 }
2768 0x51f038a8cf498946 => {
2769 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2770 let mut req = fidl::new_empty!(
2771 HostEnableBackgroundScanRequest,
2772 fidl::encoding::DefaultFuchsiaResourceDialect
2773 );
2774 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostEnableBackgroundScanRequest>(&header, _body_bytes, handles, &mut req)?;
2775 let control_handle = HostControlHandle { inner: this.inner.clone() };
2776 Ok(HostRequest::EnableBackgroundScan {
2777 enabled: req.enabled,
2778
2779 control_handle,
2780 })
2781 }
2782 0x370a76e1d2b5034b => {
2783 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2784 let mut req = fidl::new_empty!(
2785 HostEnablePrivacyRequest,
2786 fidl::encoding::DefaultFuchsiaResourceDialect
2787 );
2788 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostEnablePrivacyRequest>(&header, _body_bytes, handles, &mut req)?;
2789 let control_handle = HostControlHandle { inner: this.inner.clone() };
2790 Ok(HostRequest::EnablePrivacy { enabled: req.enabled, control_handle })
2791 }
2792 0x1d94d20717459281 => {
2793 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2794 let mut req = fidl::new_empty!(
2795 HostSetBrEdrSecurityModeRequest,
2796 fidl::encoding::DefaultFuchsiaResourceDialect
2797 );
2798 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetBrEdrSecurityModeRequest>(&header, _body_bytes, handles, &mut req)?;
2799 let control_handle = HostControlHandle { inner: this.inner.clone() };
2800 Ok(HostRequest::SetBrEdrSecurityMode {
2801 bredr_security_mode: req.bredr_security_mode,
2802
2803 control_handle,
2804 })
2805 }
2806 0x6ef0a424a336a81 => {
2807 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2808 let mut req = fidl::new_empty!(
2809 HostSetLeSecurityModeRequest,
2810 fidl::encoding::DefaultFuchsiaResourceDialect
2811 );
2812 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetLeSecurityModeRequest>(&header, _body_bytes, handles, &mut req)?;
2813 let control_handle = HostControlHandle { inner: this.inner.clone() };
2814 Ok(HostRequest::SetLeSecurityMode {
2815 le_security_mode: req.le_security_mode,
2816
2817 control_handle,
2818 })
2819 }
2820 0x21a5bba5ffc9773e => {
2821 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2822 let mut req = fidl::new_empty!(
2823 HostSetPairingDelegateRequest,
2824 fidl::encoding::DefaultFuchsiaResourceDialect
2825 );
2826 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
2827 let control_handle = HostControlHandle { inner: this.inner.clone() };
2828 Ok(HostRequest::SetPairingDelegate {
2829 input: req.input,
2830 output: req.output,
2831 delegate: req.delegate,
2832
2833 control_handle,
2834 })
2835 }
2836 0x651d446a05b664d4 => {
2837 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2838 let mut req = fidl::new_empty!(
2839 HostSetBondingDelegateRequest,
2840 fidl::encoding::DefaultFuchsiaResourceDialect
2841 );
2842 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetBondingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
2843 let control_handle = HostControlHandle { inner: this.inner.clone() };
2844 Ok(HostRequest::SetBondingDelegate {
2845 delegate: req.delegate,
2846
2847 control_handle,
2848 })
2849 }
2850 _ if header.tx_id == 0
2851 && header
2852 .dynamic_flags()
2853 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2854 {
2855 Ok(HostRequest::_UnknownMethod {
2856 ordinal: header.ordinal,
2857 control_handle: HostControlHandle { inner: this.inner.clone() },
2858 method_type: fidl::MethodType::OneWay,
2859 })
2860 }
2861 _ if header
2862 .dynamic_flags()
2863 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2864 {
2865 this.inner.send_framework_err(
2866 fidl::encoding::FrameworkErr::UnknownMethod,
2867 header.tx_id,
2868 header.ordinal,
2869 header.dynamic_flags(),
2870 (bytes, handles),
2871 )?;
2872 Ok(HostRequest::_UnknownMethod {
2873 ordinal: header.ordinal,
2874 control_handle: HostControlHandle { inner: this.inner.clone() },
2875 method_type: fidl::MethodType::TwoWay,
2876 })
2877 }
2878 _ => Err(fidl::Error::UnknownOrdinal {
2879 ordinal: header.ordinal,
2880 protocol_name: <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2881 }),
2882 }))
2883 },
2884 )
2885 }
2886}
2887
2888#[derive(Debug)]
2890pub enum HostRequest {
2891 RequestProtocol { payload: ProtocolRequest, control_handle: HostControlHandle },
2894 Shutdown { control_handle: HostControlHandle },
2910 WatchState { responder: HostWatchStateResponder },
2918 SetLocalData {
2920 payload: fidl_fuchsia_bluetooth_sys::HostData,
2921 control_handle: HostControlHandle,
2922 },
2923 SetPeerWatcher {
2926 peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
2927 control_handle: HostControlHandle,
2928 },
2929 SetLocalName { local_name: String, responder: HostSetLocalNameResponder },
2931 SetDeviceClass {
2933 device_class: fidl_fuchsia_bluetooth::DeviceClass,
2934 responder: HostSetDeviceClassResponder,
2935 },
2936 StartDiscovery { payload: HostStartDiscoveryRequest, control_handle: HostControlHandle },
2949 SetConnectable { enabled: bool, responder: HostSetConnectableResponder },
2951 SetDiscoverable { enabled: bool, responder: HostSetDiscoverableResponder },
2953 Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: HostConnectResponder },
2972 Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: HostDisconnectResponder },
2979 Pair {
2990 id: fidl_fuchsia_bluetooth::PeerId,
2991 options: fidl_fuchsia_bluetooth_sys::PairingOptions,
2992 responder: HostPairResponder,
2993 },
2994 Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: HostForgetResponder },
3002 EnableBackgroundScan { enabled: bool, control_handle: HostControlHandle },
3007 EnablePrivacy { enabled: bool, control_handle: HostControlHandle },
3011 SetBrEdrSecurityMode {
3016 bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
3017 control_handle: HostControlHandle,
3018 },
3019 SetLeSecurityMode {
3024 le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
3025 control_handle: HostControlHandle,
3026 },
3027 SetPairingDelegate {
3032 input: fidl_fuchsia_bluetooth_sys::InputCapability,
3033 output: fidl_fuchsia_bluetooth_sys::OutputCapability,
3034 delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
3035 control_handle: HostControlHandle,
3036 },
3037 SetBondingDelegate {
3041 delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
3042 control_handle: HostControlHandle,
3043 },
3044 #[non_exhaustive]
3046 _UnknownMethod {
3047 ordinal: u64,
3049 control_handle: HostControlHandle,
3050 method_type: fidl::MethodType,
3051 },
3052}
3053
3054impl HostRequest {
3055 #[allow(irrefutable_let_patterns)]
3056 pub fn into_request_protocol(self) -> Option<(ProtocolRequest, HostControlHandle)> {
3057 if let HostRequest::RequestProtocol { payload, control_handle } = self {
3058 Some((payload, control_handle))
3059 } else {
3060 None
3061 }
3062 }
3063
3064 #[allow(irrefutable_let_patterns)]
3065 pub fn into_shutdown(self) -> Option<(HostControlHandle)> {
3066 if let HostRequest::Shutdown { control_handle } = self {
3067 Some((control_handle))
3068 } else {
3069 None
3070 }
3071 }
3072
3073 #[allow(irrefutable_let_patterns)]
3074 pub fn into_watch_state(self) -> Option<(HostWatchStateResponder)> {
3075 if let HostRequest::WatchState { responder } = self {
3076 Some((responder))
3077 } else {
3078 None
3079 }
3080 }
3081
3082 #[allow(irrefutable_let_patterns)]
3083 pub fn into_set_local_data(
3084 self,
3085 ) -> Option<(fidl_fuchsia_bluetooth_sys::HostData, HostControlHandle)> {
3086 if let HostRequest::SetLocalData { payload, control_handle } = self {
3087 Some((payload, control_handle))
3088 } else {
3089 None
3090 }
3091 }
3092
3093 #[allow(irrefutable_let_patterns)]
3094 pub fn into_set_peer_watcher(
3095 self,
3096 ) -> Option<(fidl::endpoints::ServerEnd<PeerWatcherMarker>, HostControlHandle)> {
3097 if let HostRequest::SetPeerWatcher { peer_watcher, control_handle } = self {
3098 Some((peer_watcher, control_handle))
3099 } else {
3100 None
3101 }
3102 }
3103
3104 #[allow(irrefutable_let_patterns)]
3105 pub fn into_set_local_name(self) -> Option<(String, HostSetLocalNameResponder)> {
3106 if let HostRequest::SetLocalName { local_name, responder } = self {
3107 Some((local_name, responder))
3108 } else {
3109 None
3110 }
3111 }
3112
3113 #[allow(irrefutable_let_patterns)]
3114 pub fn into_set_device_class(
3115 self,
3116 ) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, HostSetDeviceClassResponder)> {
3117 if let HostRequest::SetDeviceClass { device_class, responder } = self {
3118 Some((device_class, responder))
3119 } else {
3120 None
3121 }
3122 }
3123
3124 #[allow(irrefutable_let_patterns)]
3125 pub fn into_start_discovery(self) -> Option<(HostStartDiscoveryRequest, HostControlHandle)> {
3126 if let HostRequest::StartDiscovery { payload, control_handle } = self {
3127 Some((payload, control_handle))
3128 } else {
3129 None
3130 }
3131 }
3132
3133 #[allow(irrefutable_let_patterns)]
3134 pub fn into_set_connectable(self) -> Option<(bool, HostSetConnectableResponder)> {
3135 if let HostRequest::SetConnectable { enabled, responder } = self {
3136 Some((enabled, responder))
3137 } else {
3138 None
3139 }
3140 }
3141
3142 #[allow(irrefutable_let_patterns)]
3143 pub fn into_set_discoverable(self) -> Option<(bool, HostSetDiscoverableResponder)> {
3144 if let HostRequest::SetDiscoverable { enabled, responder } = self {
3145 Some((enabled, responder))
3146 } else {
3147 None
3148 }
3149 }
3150
3151 #[allow(irrefutable_let_patterns)]
3152 pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostConnectResponder)> {
3153 if let HostRequest::Connect { id, responder } = self {
3154 Some((id, responder))
3155 } else {
3156 None
3157 }
3158 }
3159
3160 #[allow(irrefutable_let_patterns)]
3161 pub fn into_disconnect(
3162 self,
3163 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostDisconnectResponder)> {
3164 if let HostRequest::Disconnect { id, responder } = self {
3165 Some((id, responder))
3166 } else {
3167 None
3168 }
3169 }
3170
3171 #[allow(irrefutable_let_patterns)]
3172 pub fn into_pair(
3173 self,
3174 ) -> Option<(
3175 fidl_fuchsia_bluetooth::PeerId,
3176 fidl_fuchsia_bluetooth_sys::PairingOptions,
3177 HostPairResponder,
3178 )> {
3179 if let HostRequest::Pair { id, options, responder } = self {
3180 Some((id, options, responder))
3181 } else {
3182 None
3183 }
3184 }
3185
3186 #[allow(irrefutable_let_patterns)]
3187 pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostForgetResponder)> {
3188 if let HostRequest::Forget { id, responder } = self {
3189 Some((id, responder))
3190 } else {
3191 None
3192 }
3193 }
3194
3195 #[allow(irrefutable_let_patterns)]
3196 pub fn into_enable_background_scan(self) -> Option<(bool, HostControlHandle)> {
3197 if let HostRequest::EnableBackgroundScan { enabled, control_handle } = self {
3198 Some((enabled, control_handle))
3199 } else {
3200 None
3201 }
3202 }
3203
3204 #[allow(irrefutable_let_patterns)]
3205 pub fn into_enable_privacy(self) -> Option<(bool, HostControlHandle)> {
3206 if let HostRequest::EnablePrivacy { enabled, control_handle } = self {
3207 Some((enabled, control_handle))
3208 } else {
3209 None
3210 }
3211 }
3212
3213 #[allow(irrefutable_let_patterns)]
3214 pub fn into_set_br_edr_security_mode(
3215 self,
3216 ) -> Option<(fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode, HostControlHandle)> {
3217 if let HostRequest::SetBrEdrSecurityMode { bredr_security_mode, control_handle } = self {
3218 Some((bredr_security_mode, control_handle))
3219 } else {
3220 None
3221 }
3222 }
3223
3224 #[allow(irrefutable_let_patterns)]
3225 pub fn into_set_le_security_mode(
3226 self,
3227 ) -> Option<(fidl_fuchsia_bluetooth_sys::LeSecurityMode, HostControlHandle)> {
3228 if let HostRequest::SetLeSecurityMode { le_security_mode, control_handle } = self {
3229 Some((le_security_mode, control_handle))
3230 } else {
3231 None
3232 }
3233 }
3234
3235 #[allow(irrefutable_let_patterns)]
3236 pub fn into_set_pairing_delegate(
3237 self,
3238 ) -> Option<(
3239 fidl_fuchsia_bluetooth_sys::InputCapability,
3240 fidl_fuchsia_bluetooth_sys::OutputCapability,
3241 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
3242 HostControlHandle,
3243 )> {
3244 if let HostRequest::SetPairingDelegate { input, output, delegate, control_handle } = self {
3245 Some((input, output, delegate, control_handle))
3246 } else {
3247 None
3248 }
3249 }
3250
3251 #[allow(irrefutable_let_patterns)]
3252 pub fn into_set_bonding_delegate(
3253 self,
3254 ) -> Option<(fidl::endpoints::ServerEnd<BondingDelegateMarker>, HostControlHandle)> {
3255 if let HostRequest::SetBondingDelegate { delegate, control_handle } = self {
3256 Some((delegate, control_handle))
3257 } else {
3258 None
3259 }
3260 }
3261
3262 pub fn method_name(&self) -> &'static str {
3264 match *self {
3265 HostRequest::RequestProtocol { .. } => "request_protocol",
3266 HostRequest::Shutdown { .. } => "shutdown",
3267 HostRequest::WatchState { .. } => "watch_state",
3268 HostRequest::SetLocalData { .. } => "set_local_data",
3269 HostRequest::SetPeerWatcher { .. } => "set_peer_watcher",
3270 HostRequest::SetLocalName { .. } => "set_local_name",
3271 HostRequest::SetDeviceClass { .. } => "set_device_class",
3272 HostRequest::StartDiscovery { .. } => "start_discovery",
3273 HostRequest::SetConnectable { .. } => "set_connectable",
3274 HostRequest::SetDiscoverable { .. } => "set_discoverable",
3275 HostRequest::Connect { .. } => "connect",
3276 HostRequest::Disconnect { .. } => "disconnect",
3277 HostRequest::Pair { .. } => "pair",
3278 HostRequest::Forget { .. } => "forget",
3279 HostRequest::EnableBackgroundScan { .. } => "enable_background_scan",
3280 HostRequest::EnablePrivacy { .. } => "enable_privacy",
3281 HostRequest::SetBrEdrSecurityMode { .. } => "set_br_edr_security_mode",
3282 HostRequest::SetLeSecurityMode { .. } => "set_le_security_mode",
3283 HostRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
3284 HostRequest::SetBondingDelegate { .. } => "set_bonding_delegate",
3285 HostRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
3286 "unknown one-way method"
3287 }
3288 HostRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
3289 "unknown two-way method"
3290 }
3291 }
3292 }
3293}
3294
3295#[derive(Debug, Clone)]
3296pub struct HostControlHandle {
3297 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3298}
3299
3300impl fidl::endpoints::ControlHandle for HostControlHandle {
3301 fn shutdown(&self) {
3302 self.inner.shutdown()
3303 }
3304 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3305 self.inner.shutdown_with_epitaph(status)
3306 }
3307
3308 fn is_closed(&self) -> bool {
3309 self.inner.channel().is_closed()
3310 }
3311 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3312 self.inner.channel().on_closed()
3313 }
3314
3315 #[cfg(target_os = "fuchsia")]
3316 fn signal_peer(
3317 &self,
3318 clear_mask: zx::Signals,
3319 set_mask: zx::Signals,
3320 ) -> Result<(), zx_status::Status> {
3321 use fidl::Peered;
3322 self.inner.channel().signal_peer(clear_mask, set_mask)
3323 }
3324}
3325
3326impl HostControlHandle {}
3327
3328#[must_use = "FIDL methods require a response to be sent"]
3329#[derive(Debug)]
3330pub struct HostWatchStateResponder {
3331 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3332 tx_id: u32,
3333}
3334
3335impl std::ops::Drop for HostWatchStateResponder {
3339 fn drop(&mut self) {
3340 self.control_handle.shutdown();
3341 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3343 }
3344}
3345
3346impl fidl::endpoints::Responder for HostWatchStateResponder {
3347 type ControlHandle = HostControlHandle;
3348
3349 fn control_handle(&self) -> &HostControlHandle {
3350 &self.control_handle
3351 }
3352
3353 fn drop_without_shutdown(mut self) {
3354 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3356 std::mem::forget(self);
3358 }
3359}
3360
3361impl HostWatchStateResponder {
3362 pub fn send(self, mut info: &fidl_fuchsia_bluetooth_sys::HostInfo) -> Result<(), fidl::Error> {
3366 let _result = self.send_raw(info);
3367 if _result.is_err() {
3368 self.control_handle.shutdown();
3369 }
3370 self.drop_without_shutdown();
3371 _result
3372 }
3373
3374 pub fn send_no_shutdown_on_err(
3376 self,
3377 mut info: &fidl_fuchsia_bluetooth_sys::HostInfo,
3378 ) -> Result<(), fidl::Error> {
3379 let _result = self.send_raw(info);
3380 self.drop_without_shutdown();
3381 _result
3382 }
3383
3384 fn send_raw(&self, mut info: &fidl_fuchsia_bluetooth_sys::HostInfo) -> Result<(), fidl::Error> {
3385 self.control_handle.inner.send::<fidl::encoding::FlexibleType<HostWatchStateResponse>>(
3386 fidl::encoding::Flexible::new((info,)),
3387 self.tx_id,
3388 0x19157554e2a3db52,
3389 fidl::encoding::DynamicFlags::FLEXIBLE,
3390 )
3391 }
3392}
3393
3394#[must_use = "FIDL methods require a response to be sent"]
3395#[derive(Debug)]
3396pub struct HostSetLocalNameResponder {
3397 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3398 tx_id: u32,
3399}
3400
3401impl std::ops::Drop for HostSetLocalNameResponder {
3405 fn drop(&mut self) {
3406 self.control_handle.shutdown();
3407 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3409 }
3410}
3411
3412impl fidl::endpoints::Responder for HostSetLocalNameResponder {
3413 type ControlHandle = HostControlHandle;
3414
3415 fn control_handle(&self) -> &HostControlHandle {
3416 &self.control_handle
3417 }
3418
3419 fn drop_without_shutdown(mut self) {
3420 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3422 std::mem::forget(self);
3424 }
3425}
3426
3427impl HostSetLocalNameResponder {
3428 pub fn send(
3432 self,
3433 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3434 ) -> Result<(), fidl::Error> {
3435 let _result = self.send_raw(result);
3436 if _result.is_err() {
3437 self.control_handle.shutdown();
3438 }
3439 self.drop_without_shutdown();
3440 _result
3441 }
3442
3443 pub fn send_no_shutdown_on_err(
3445 self,
3446 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3447 ) -> Result<(), fidl::Error> {
3448 let _result = self.send_raw(result);
3449 self.drop_without_shutdown();
3450 _result
3451 }
3452
3453 fn send_raw(
3454 &self,
3455 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3456 ) -> Result<(), fidl::Error> {
3457 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3458 fidl::encoding::EmptyStruct,
3459 fidl_fuchsia_bluetooth_sys::Error,
3460 >>(
3461 fidl::encoding::FlexibleResult::new(result),
3462 self.tx_id,
3463 0x85e98b56b98f123,
3464 fidl::encoding::DynamicFlags::FLEXIBLE,
3465 )
3466 }
3467}
3468
3469#[must_use = "FIDL methods require a response to be sent"]
3470#[derive(Debug)]
3471pub struct HostSetDeviceClassResponder {
3472 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3473 tx_id: u32,
3474}
3475
3476impl std::ops::Drop for HostSetDeviceClassResponder {
3480 fn drop(&mut self) {
3481 self.control_handle.shutdown();
3482 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3484 }
3485}
3486
3487impl fidl::endpoints::Responder for HostSetDeviceClassResponder {
3488 type ControlHandle = HostControlHandle;
3489
3490 fn control_handle(&self) -> &HostControlHandle {
3491 &self.control_handle
3492 }
3493
3494 fn drop_without_shutdown(mut self) {
3495 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3497 std::mem::forget(self);
3499 }
3500}
3501
3502impl HostSetDeviceClassResponder {
3503 pub fn send(
3507 self,
3508 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3509 ) -> Result<(), fidl::Error> {
3510 let _result = self.send_raw(result);
3511 if _result.is_err() {
3512 self.control_handle.shutdown();
3513 }
3514 self.drop_without_shutdown();
3515 _result
3516 }
3517
3518 pub fn send_no_shutdown_on_err(
3520 self,
3521 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3522 ) -> Result<(), fidl::Error> {
3523 let _result = self.send_raw(result);
3524 self.drop_without_shutdown();
3525 _result
3526 }
3527
3528 fn send_raw(
3529 &self,
3530 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3531 ) -> Result<(), fidl::Error> {
3532 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3533 fidl::encoding::EmptyStruct,
3534 fidl_fuchsia_bluetooth_sys::Error,
3535 >>(
3536 fidl::encoding::FlexibleResult::new(result),
3537 self.tx_id,
3538 0x4caef8f835950de2,
3539 fidl::encoding::DynamicFlags::FLEXIBLE,
3540 )
3541 }
3542}
3543
3544#[must_use = "FIDL methods require a response to be sent"]
3545#[derive(Debug)]
3546pub struct HostSetConnectableResponder {
3547 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3548 tx_id: u32,
3549}
3550
3551impl std::ops::Drop for HostSetConnectableResponder {
3555 fn drop(&mut self) {
3556 self.control_handle.shutdown();
3557 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3559 }
3560}
3561
3562impl fidl::endpoints::Responder for HostSetConnectableResponder {
3563 type ControlHandle = HostControlHandle;
3564
3565 fn control_handle(&self) -> &HostControlHandle {
3566 &self.control_handle
3567 }
3568
3569 fn drop_without_shutdown(mut self) {
3570 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3572 std::mem::forget(self);
3574 }
3575}
3576
3577impl HostSetConnectableResponder {
3578 pub fn send(
3582 self,
3583 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3584 ) -> Result<(), fidl::Error> {
3585 let _result = self.send_raw(result);
3586 if _result.is_err() {
3587 self.control_handle.shutdown();
3588 }
3589 self.drop_without_shutdown();
3590 _result
3591 }
3592
3593 pub fn send_no_shutdown_on_err(
3595 self,
3596 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3597 ) -> Result<(), fidl::Error> {
3598 let _result = self.send_raw(result);
3599 self.drop_without_shutdown();
3600 _result
3601 }
3602
3603 fn send_raw(
3604 &self,
3605 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3606 ) -> Result<(), fidl::Error> {
3607 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3608 fidl::encoding::EmptyStruct,
3609 fidl_fuchsia_bluetooth_sys::Error,
3610 >>(
3611 fidl::encoding::FlexibleResult::new(result),
3612 self.tx_id,
3613 0x187a6a82e811fa92,
3614 fidl::encoding::DynamicFlags::FLEXIBLE,
3615 )
3616 }
3617}
3618
3619#[must_use = "FIDL methods require a response to be sent"]
3620#[derive(Debug)]
3621pub struct HostSetDiscoverableResponder {
3622 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3623 tx_id: u32,
3624}
3625
3626impl std::ops::Drop for HostSetDiscoverableResponder {
3630 fn drop(&mut self) {
3631 self.control_handle.shutdown();
3632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3634 }
3635}
3636
3637impl fidl::endpoints::Responder for HostSetDiscoverableResponder {
3638 type ControlHandle = HostControlHandle;
3639
3640 fn control_handle(&self) -> &HostControlHandle {
3641 &self.control_handle
3642 }
3643
3644 fn drop_without_shutdown(mut self) {
3645 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3647 std::mem::forget(self);
3649 }
3650}
3651
3652impl HostSetDiscoverableResponder {
3653 pub fn send(
3657 self,
3658 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3659 ) -> Result<(), fidl::Error> {
3660 let _result = self.send_raw(result);
3661 if _result.is_err() {
3662 self.control_handle.shutdown();
3663 }
3664 self.drop_without_shutdown();
3665 _result
3666 }
3667
3668 pub fn send_no_shutdown_on_err(
3670 self,
3671 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3672 ) -> Result<(), fidl::Error> {
3673 let _result = self.send_raw(result);
3674 self.drop_without_shutdown();
3675 _result
3676 }
3677
3678 fn send_raw(
3679 &self,
3680 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3681 ) -> Result<(), fidl::Error> {
3682 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3683 fidl::encoding::EmptyStruct,
3684 fidl_fuchsia_bluetooth_sys::Error,
3685 >>(
3686 fidl::encoding::FlexibleResult::new(result),
3687 self.tx_id,
3688 0x89f8c7da63e36de,
3689 fidl::encoding::DynamicFlags::FLEXIBLE,
3690 )
3691 }
3692}
3693
3694#[must_use = "FIDL methods require a response to be sent"]
3695#[derive(Debug)]
3696pub struct HostConnectResponder {
3697 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3698 tx_id: u32,
3699}
3700
3701impl std::ops::Drop for HostConnectResponder {
3705 fn drop(&mut self) {
3706 self.control_handle.shutdown();
3707 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3709 }
3710}
3711
3712impl fidl::endpoints::Responder for HostConnectResponder {
3713 type ControlHandle = HostControlHandle;
3714
3715 fn control_handle(&self) -> &HostControlHandle {
3716 &self.control_handle
3717 }
3718
3719 fn drop_without_shutdown(mut self) {
3720 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3722 std::mem::forget(self);
3724 }
3725}
3726
3727impl HostConnectResponder {
3728 pub fn send(
3732 self,
3733 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3734 ) -> Result<(), fidl::Error> {
3735 let _result = self.send_raw(result);
3736 if _result.is_err() {
3737 self.control_handle.shutdown();
3738 }
3739 self.drop_without_shutdown();
3740 _result
3741 }
3742
3743 pub fn send_no_shutdown_on_err(
3745 self,
3746 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3747 ) -> Result<(), fidl::Error> {
3748 let _result = self.send_raw(result);
3749 self.drop_without_shutdown();
3750 _result
3751 }
3752
3753 fn send_raw(
3754 &self,
3755 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3756 ) -> Result<(), fidl::Error> {
3757 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3758 fidl::encoding::EmptyStruct,
3759 fidl_fuchsia_bluetooth_sys::Error,
3760 >>(
3761 fidl::encoding::FlexibleResult::new(result),
3762 self.tx_id,
3763 0x5a56139c993e7240,
3764 fidl::encoding::DynamicFlags::FLEXIBLE,
3765 )
3766 }
3767}
3768
3769#[must_use = "FIDL methods require a response to be sent"]
3770#[derive(Debug)]
3771pub struct HostDisconnectResponder {
3772 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3773 tx_id: u32,
3774}
3775
3776impl std::ops::Drop for HostDisconnectResponder {
3780 fn drop(&mut self) {
3781 self.control_handle.shutdown();
3782 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3784 }
3785}
3786
3787impl fidl::endpoints::Responder for HostDisconnectResponder {
3788 type ControlHandle = HostControlHandle;
3789
3790 fn control_handle(&self) -> &HostControlHandle {
3791 &self.control_handle
3792 }
3793
3794 fn drop_without_shutdown(mut self) {
3795 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3797 std::mem::forget(self);
3799 }
3800}
3801
3802impl HostDisconnectResponder {
3803 pub fn send(
3807 self,
3808 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3809 ) -> Result<(), fidl::Error> {
3810 let _result = self.send_raw(result);
3811 if _result.is_err() {
3812 self.control_handle.shutdown();
3813 }
3814 self.drop_without_shutdown();
3815 _result
3816 }
3817
3818 pub fn send_no_shutdown_on_err(
3820 self,
3821 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3822 ) -> Result<(), fidl::Error> {
3823 let _result = self.send_raw(result);
3824 self.drop_without_shutdown();
3825 _result
3826 }
3827
3828 fn send_raw(
3829 &self,
3830 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3831 ) -> Result<(), fidl::Error> {
3832 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3833 fidl::encoding::EmptyStruct,
3834 fidl_fuchsia_bluetooth_sys::Error,
3835 >>(
3836 fidl::encoding::FlexibleResult::new(result),
3837 self.tx_id,
3838 0x33211717491121b1,
3839 fidl::encoding::DynamicFlags::FLEXIBLE,
3840 )
3841 }
3842}
3843
3844#[must_use = "FIDL methods require a response to be sent"]
3845#[derive(Debug)]
3846pub struct HostPairResponder {
3847 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3848 tx_id: u32,
3849}
3850
3851impl std::ops::Drop for HostPairResponder {
3855 fn drop(&mut self) {
3856 self.control_handle.shutdown();
3857 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3859 }
3860}
3861
3862impl fidl::endpoints::Responder for HostPairResponder {
3863 type ControlHandle = HostControlHandle;
3864
3865 fn control_handle(&self) -> &HostControlHandle {
3866 &self.control_handle
3867 }
3868
3869 fn drop_without_shutdown(mut self) {
3870 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3872 std::mem::forget(self);
3874 }
3875}
3876
3877impl HostPairResponder {
3878 pub fn send(
3882 self,
3883 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3884 ) -> Result<(), fidl::Error> {
3885 let _result = self.send_raw(result);
3886 if _result.is_err() {
3887 self.control_handle.shutdown();
3888 }
3889 self.drop_without_shutdown();
3890 _result
3891 }
3892
3893 pub fn send_no_shutdown_on_err(
3895 self,
3896 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3897 ) -> Result<(), fidl::Error> {
3898 let _result = self.send_raw(result);
3899 self.drop_without_shutdown();
3900 _result
3901 }
3902
3903 fn send_raw(
3904 &self,
3905 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3906 ) -> Result<(), fidl::Error> {
3907 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3908 fidl::encoding::EmptyStruct,
3909 fidl_fuchsia_bluetooth_sys::Error,
3910 >>(
3911 fidl::encoding::FlexibleResult::new(result),
3912 self.tx_id,
3913 0x2efaec6dc5d62ca2,
3914 fidl::encoding::DynamicFlags::FLEXIBLE,
3915 )
3916 }
3917}
3918
3919#[must_use = "FIDL methods require a response to be sent"]
3920#[derive(Debug)]
3921pub struct HostForgetResponder {
3922 control_handle: std::mem::ManuallyDrop<HostControlHandle>,
3923 tx_id: u32,
3924}
3925
3926impl std::ops::Drop for HostForgetResponder {
3930 fn drop(&mut self) {
3931 self.control_handle.shutdown();
3932 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3934 }
3935}
3936
3937impl fidl::endpoints::Responder for HostForgetResponder {
3938 type ControlHandle = HostControlHandle;
3939
3940 fn control_handle(&self) -> &HostControlHandle {
3941 &self.control_handle
3942 }
3943
3944 fn drop_without_shutdown(mut self) {
3945 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3947 std::mem::forget(self);
3949 }
3950}
3951
3952impl HostForgetResponder {
3953 pub fn send(
3957 self,
3958 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3959 ) -> Result<(), fidl::Error> {
3960 let _result = self.send_raw(result);
3961 if _result.is_err() {
3962 self.control_handle.shutdown();
3963 }
3964 self.drop_without_shutdown();
3965 _result
3966 }
3967
3968 pub fn send_no_shutdown_on_err(
3970 self,
3971 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3972 ) -> Result<(), fidl::Error> {
3973 let _result = self.send_raw(result);
3974 self.drop_without_shutdown();
3975 _result
3976 }
3977
3978 fn send_raw(
3979 &self,
3980 mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
3981 ) -> Result<(), fidl::Error> {
3982 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3983 fidl::encoding::EmptyStruct,
3984 fidl_fuchsia_bluetooth_sys::Error,
3985 >>(
3986 fidl::encoding::FlexibleResult::new(result),
3987 self.tx_id,
3988 0x904f58dbdd4490a,
3989 fidl::encoding::DynamicFlags::FLEXIBLE,
3990 )
3991 }
3992}
3993
3994#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3995pub struct PeerWatcherMarker;
3996
3997impl fidl::endpoints::ProtocolMarker for PeerWatcherMarker {
3998 type Proxy = PeerWatcherProxy;
3999 type RequestStream = PeerWatcherRequestStream;
4000 #[cfg(target_os = "fuchsia")]
4001 type SynchronousProxy = PeerWatcherSynchronousProxy;
4002
4003 const DEBUG_NAME: &'static str = "(anonymous) PeerWatcher";
4004}
4005
4006pub trait PeerWatcherProxyInterface: Send + Sync {
4007 type GetNextResponseFut: std::future::Future<Output = Result<PeerWatcherGetNextResponse, fidl::Error>>
4008 + Send;
4009 fn r#get_next(&self) -> Self::GetNextResponseFut;
4010}
4011#[derive(Debug)]
4012#[cfg(target_os = "fuchsia")]
4013pub struct PeerWatcherSynchronousProxy {
4014 client: fidl::client::sync::Client,
4015}
4016
4017#[cfg(target_os = "fuchsia")]
4018impl fidl::endpoints::SynchronousProxy for PeerWatcherSynchronousProxy {
4019 type Proxy = PeerWatcherProxy;
4020 type Protocol = PeerWatcherMarker;
4021
4022 fn from_channel(inner: fidl::Channel) -> Self {
4023 Self::new(inner)
4024 }
4025
4026 fn into_channel(self) -> fidl::Channel {
4027 self.client.into_channel()
4028 }
4029
4030 fn as_channel(&self) -> &fidl::Channel {
4031 self.client.as_channel()
4032 }
4033}
4034
4035#[cfg(target_os = "fuchsia")]
4036impl PeerWatcherSynchronousProxy {
4037 pub fn new(channel: fidl::Channel) -> Self {
4038 let protocol_name = <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4039 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4040 }
4041
4042 pub fn into_channel(self) -> fidl::Channel {
4043 self.client.into_channel()
4044 }
4045
4046 pub fn wait_for_event(
4049 &self,
4050 deadline: zx::MonotonicInstant,
4051 ) -> Result<PeerWatcherEvent, fidl::Error> {
4052 PeerWatcherEvent::decode(self.client.wait_for_event(deadline)?)
4053 }
4054
4055 pub fn r#get_next(
4057 &self,
4058 ___deadline: zx::MonotonicInstant,
4059 ) -> Result<PeerWatcherGetNextResponse, fidl::Error> {
4060 let _response = self.client.send_query::<
4061 fidl::encoding::EmptyPayload,
4062 fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>,
4063 >(
4064 (),
4065 0x31b4855de7565b77,
4066 fidl::encoding::DynamicFlags::FLEXIBLE,
4067 ___deadline,
4068 )?
4069 .into_result::<PeerWatcherMarker>("get_next")?;
4070 Ok(_response)
4071 }
4072}
4073
4074#[cfg(target_os = "fuchsia")]
4075impl From<PeerWatcherSynchronousProxy> for zx::Handle {
4076 fn from(value: PeerWatcherSynchronousProxy) -> Self {
4077 value.into_channel().into()
4078 }
4079}
4080
4081#[cfg(target_os = "fuchsia")]
4082impl From<fidl::Channel> for PeerWatcherSynchronousProxy {
4083 fn from(value: fidl::Channel) -> Self {
4084 Self::new(value)
4085 }
4086}
4087
4088#[derive(Debug, Clone)]
4089pub struct PeerWatcherProxy {
4090 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4091}
4092
4093impl fidl::endpoints::Proxy for PeerWatcherProxy {
4094 type Protocol = PeerWatcherMarker;
4095
4096 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4097 Self::new(inner)
4098 }
4099
4100 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4101 self.client.into_channel().map_err(|client| Self { client })
4102 }
4103
4104 fn as_channel(&self) -> &::fidl::AsyncChannel {
4105 self.client.as_channel()
4106 }
4107}
4108
4109impl PeerWatcherProxy {
4110 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4112 let protocol_name = <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4113 Self { client: fidl::client::Client::new(channel, protocol_name) }
4114 }
4115
4116 pub fn take_event_stream(&self) -> PeerWatcherEventStream {
4122 PeerWatcherEventStream { event_receiver: self.client.take_event_receiver() }
4123 }
4124
4125 pub fn r#get_next(
4127 &self,
4128 ) -> fidl::client::QueryResponseFut<
4129 PeerWatcherGetNextResponse,
4130 fidl::encoding::DefaultFuchsiaResourceDialect,
4131 > {
4132 PeerWatcherProxyInterface::r#get_next(self)
4133 }
4134}
4135
4136impl PeerWatcherProxyInterface for PeerWatcherProxy {
4137 type GetNextResponseFut = fidl::client::QueryResponseFut<
4138 PeerWatcherGetNextResponse,
4139 fidl::encoding::DefaultFuchsiaResourceDialect,
4140 >;
4141 fn r#get_next(&self) -> Self::GetNextResponseFut {
4142 fn _decode(
4143 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4144 ) -> Result<PeerWatcherGetNextResponse, fidl::Error> {
4145 let _response = fidl::client::decode_transaction_body::<
4146 fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>,
4147 fidl::encoding::DefaultFuchsiaResourceDialect,
4148 0x31b4855de7565b77,
4149 >(_buf?)?
4150 .into_result::<PeerWatcherMarker>("get_next")?;
4151 Ok(_response)
4152 }
4153 self.client
4154 .send_query_and_decode::<fidl::encoding::EmptyPayload, PeerWatcherGetNextResponse>(
4155 (),
4156 0x31b4855de7565b77,
4157 fidl::encoding::DynamicFlags::FLEXIBLE,
4158 _decode,
4159 )
4160 }
4161}
4162
4163pub struct PeerWatcherEventStream {
4164 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4165}
4166
4167impl std::marker::Unpin for PeerWatcherEventStream {}
4168
4169impl futures::stream::FusedStream for PeerWatcherEventStream {
4170 fn is_terminated(&self) -> bool {
4171 self.event_receiver.is_terminated()
4172 }
4173}
4174
4175impl futures::Stream for PeerWatcherEventStream {
4176 type Item = Result<PeerWatcherEvent, fidl::Error>;
4177
4178 fn poll_next(
4179 mut self: std::pin::Pin<&mut Self>,
4180 cx: &mut std::task::Context<'_>,
4181 ) -> std::task::Poll<Option<Self::Item>> {
4182 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4183 &mut self.event_receiver,
4184 cx
4185 )?) {
4186 Some(buf) => std::task::Poll::Ready(Some(PeerWatcherEvent::decode(buf))),
4187 None => std::task::Poll::Ready(None),
4188 }
4189 }
4190}
4191
4192#[derive(Debug)]
4193pub enum PeerWatcherEvent {
4194 #[non_exhaustive]
4195 _UnknownEvent {
4196 ordinal: u64,
4198 },
4199}
4200
4201impl PeerWatcherEvent {
4202 fn decode(
4204 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4205 ) -> Result<PeerWatcherEvent, fidl::Error> {
4206 let (bytes, _handles) = buf.split_mut();
4207 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4208 debug_assert_eq!(tx_header.tx_id, 0);
4209 match tx_header.ordinal {
4210 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4211 Ok(PeerWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4212 }
4213 _ => Err(fidl::Error::UnknownOrdinal {
4214 ordinal: tx_header.ordinal,
4215 protocol_name: <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4216 }),
4217 }
4218 }
4219}
4220
4221pub struct PeerWatcherRequestStream {
4223 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4224 is_terminated: bool,
4225}
4226
4227impl std::marker::Unpin for PeerWatcherRequestStream {}
4228
4229impl futures::stream::FusedStream for PeerWatcherRequestStream {
4230 fn is_terminated(&self) -> bool {
4231 self.is_terminated
4232 }
4233}
4234
4235impl fidl::endpoints::RequestStream for PeerWatcherRequestStream {
4236 type Protocol = PeerWatcherMarker;
4237 type ControlHandle = PeerWatcherControlHandle;
4238
4239 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4240 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4241 }
4242
4243 fn control_handle(&self) -> Self::ControlHandle {
4244 PeerWatcherControlHandle { inner: self.inner.clone() }
4245 }
4246
4247 fn into_inner(
4248 self,
4249 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4250 {
4251 (self.inner, self.is_terminated)
4252 }
4253
4254 fn from_inner(
4255 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4256 is_terminated: bool,
4257 ) -> Self {
4258 Self { inner, is_terminated }
4259 }
4260}
4261
4262impl futures::Stream for PeerWatcherRequestStream {
4263 type Item = Result<PeerWatcherRequest, fidl::Error>;
4264
4265 fn poll_next(
4266 mut self: std::pin::Pin<&mut Self>,
4267 cx: &mut std::task::Context<'_>,
4268 ) -> std::task::Poll<Option<Self::Item>> {
4269 let this = &mut *self;
4270 if this.inner.check_shutdown(cx) {
4271 this.is_terminated = true;
4272 return std::task::Poll::Ready(None);
4273 }
4274 if this.is_terminated {
4275 panic!("polled PeerWatcherRequestStream after completion");
4276 }
4277 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4278 |bytes, handles| {
4279 match this.inner.channel().read_etc(cx, bytes, handles) {
4280 std::task::Poll::Ready(Ok(())) => {}
4281 std::task::Poll::Pending => return std::task::Poll::Pending,
4282 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4283 this.is_terminated = true;
4284 return std::task::Poll::Ready(None);
4285 }
4286 std::task::Poll::Ready(Err(e)) => {
4287 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4288 e.into(),
4289 ))))
4290 }
4291 }
4292
4293 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4295
4296 std::task::Poll::Ready(Some(match header.ordinal {
4297 0x31b4855de7565b77 => {
4298 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4299 let mut req = fidl::new_empty!(
4300 fidl::encoding::EmptyPayload,
4301 fidl::encoding::DefaultFuchsiaResourceDialect
4302 );
4303 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4304 let control_handle = PeerWatcherControlHandle { inner: this.inner.clone() };
4305 Ok(PeerWatcherRequest::GetNext {
4306 responder: PeerWatcherGetNextResponder {
4307 control_handle: std::mem::ManuallyDrop::new(control_handle),
4308 tx_id: header.tx_id,
4309 },
4310 })
4311 }
4312 _ if header.tx_id == 0
4313 && header
4314 .dynamic_flags()
4315 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4316 {
4317 Ok(PeerWatcherRequest::_UnknownMethod {
4318 ordinal: header.ordinal,
4319 control_handle: PeerWatcherControlHandle { inner: this.inner.clone() },
4320 method_type: fidl::MethodType::OneWay,
4321 })
4322 }
4323 _ if header
4324 .dynamic_flags()
4325 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4326 {
4327 this.inner.send_framework_err(
4328 fidl::encoding::FrameworkErr::UnknownMethod,
4329 header.tx_id,
4330 header.ordinal,
4331 header.dynamic_flags(),
4332 (bytes, handles),
4333 )?;
4334 Ok(PeerWatcherRequest::_UnknownMethod {
4335 ordinal: header.ordinal,
4336 control_handle: PeerWatcherControlHandle { inner: this.inner.clone() },
4337 method_type: fidl::MethodType::TwoWay,
4338 })
4339 }
4340 _ => Err(fidl::Error::UnknownOrdinal {
4341 ordinal: header.ordinal,
4342 protocol_name:
4343 <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4344 }),
4345 }))
4346 },
4347 )
4348 }
4349}
4350
4351#[derive(Debug)]
4352pub enum PeerWatcherRequest {
4353 GetNext { responder: PeerWatcherGetNextResponder },
4355 #[non_exhaustive]
4357 _UnknownMethod {
4358 ordinal: u64,
4360 control_handle: PeerWatcherControlHandle,
4361 method_type: fidl::MethodType,
4362 },
4363}
4364
4365impl PeerWatcherRequest {
4366 #[allow(irrefutable_let_patterns)]
4367 pub fn into_get_next(self) -> Option<(PeerWatcherGetNextResponder)> {
4368 if let PeerWatcherRequest::GetNext { responder } = self {
4369 Some((responder))
4370 } else {
4371 None
4372 }
4373 }
4374
4375 pub fn method_name(&self) -> &'static str {
4377 match *self {
4378 PeerWatcherRequest::GetNext { .. } => "get_next",
4379 PeerWatcherRequest::_UnknownMethod {
4380 method_type: fidl::MethodType::OneWay, ..
4381 } => "unknown one-way method",
4382 PeerWatcherRequest::_UnknownMethod {
4383 method_type: fidl::MethodType::TwoWay, ..
4384 } => "unknown two-way method",
4385 }
4386 }
4387}
4388
4389#[derive(Debug, Clone)]
4390pub struct PeerWatcherControlHandle {
4391 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4392}
4393
4394impl fidl::endpoints::ControlHandle for PeerWatcherControlHandle {
4395 fn shutdown(&self) {
4396 self.inner.shutdown()
4397 }
4398 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4399 self.inner.shutdown_with_epitaph(status)
4400 }
4401
4402 fn is_closed(&self) -> bool {
4403 self.inner.channel().is_closed()
4404 }
4405 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4406 self.inner.channel().on_closed()
4407 }
4408
4409 #[cfg(target_os = "fuchsia")]
4410 fn signal_peer(
4411 &self,
4412 clear_mask: zx::Signals,
4413 set_mask: zx::Signals,
4414 ) -> Result<(), zx_status::Status> {
4415 use fidl::Peered;
4416 self.inner.channel().signal_peer(clear_mask, set_mask)
4417 }
4418}
4419
4420impl PeerWatcherControlHandle {}
4421
4422#[must_use = "FIDL methods require a response to be sent"]
4423#[derive(Debug)]
4424pub struct PeerWatcherGetNextResponder {
4425 control_handle: std::mem::ManuallyDrop<PeerWatcherControlHandle>,
4426 tx_id: u32,
4427}
4428
4429impl std::ops::Drop for PeerWatcherGetNextResponder {
4433 fn drop(&mut self) {
4434 self.control_handle.shutdown();
4435 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4437 }
4438}
4439
4440impl fidl::endpoints::Responder for PeerWatcherGetNextResponder {
4441 type ControlHandle = PeerWatcherControlHandle;
4442
4443 fn control_handle(&self) -> &PeerWatcherControlHandle {
4444 &self.control_handle
4445 }
4446
4447 fn drop_without_shutdown(mut self) {
4448 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4450 std::mem::forget(self);
4452 }
4453}
4454
4455impl PeerWatcherGetNextResponder {
4456 pub fn send(self, mut payload: &PeerWatcherGetNextResponse) -> Result<(), fidl::Error> {
4460 let _result = self.send_raw(payload);
4461 if _result.is_err() {
4462 self.control_handle.shutdown();
4463 }
4464 self.drop_without_shutdown();
4465 _result
4466 }
4467
4468 pub fn send_no_shutdown_on_err(
4470 self,
4471 mut payload: &PeerWatcherGetNextResponse,
4472 ) -> Result<(), fidl::Error> {
4473 let _result = self.send_raw(payload);
4474 self.drop_without_shutdown();
4475 _result
4476 }
4477
4478 fn send_raw(&self, mut payload: &PeerWatcherGetNextResponse) -> Result<(), fidl::Error> {
4479 self.control_handle.inner.send::<fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>>(
4480 fidl::encoding::Flexible::new(payload),
4481 self.tx_id,
4482 0x31b4855de7565b77,
4483 fidl::encoding::DynamicFlags::FLEXIBLE,
4484 )
4485 }
4486}
4487
4488#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4489pub struct ReceiverMarker;
4490
4491impl fidl::endpoints::ProtocolMarker for ReceiverMarker {
4492 type Proxy = ReceiverProxy;
4493 type RequestStream = ReceiverRequestStream;
4494 #[cfg(target_os = "fuchsia")]
4495 type SynchronousProxy = ReceiverSynchronousProxy;
4496
4497 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.host.Receiver";
4498}
4499impl fidl::endpoints::DiscoverableProtocolMarker for ReceiverMarker {}
4500
4501pub trait ReceiverProxyInterface: Send + Sync {
4502 fn r#add_host(
4503 &self,
4504 request: fidl::endpoints::ClientEnd<HostMarker>,
4505 ) -> Result<(), fidl::Error>;
4506}
4507#[derive(Debug)]
4508#[cfg(target_os = "fuchsia")]
4509pub struct ReceiverSynchronousProxy {
4510 client: fidl::client::sync::Client,
4511}
4512
4513#[cfg(target_os = "fuchsia")]
4514impl fidl::endpoints::SynchronousProxy for ReceiverSynchronousProxy {
4515 type Proxy = ReceiverProxy;
4516 type Protocol = ReceiverMarker;
4517
4518 fn from_channel(inner: fidl::Channel) -> Self {
4519 Self::new(inner)
4520 }
4521
4522 fn into_channel(self) -> fidl::Channel {
4523 self.client.into_channel()
4524 }
4525
4526 fn as_channel(&self) -> &fidl::Channel {
4527 self.client.as_channel()
4528 }
4529}
4530
4531#[cfg(target_os = "fuchsia")]
4532impl ReceiverSynchronousProxy {
4533 pub fn new(channel: fidl::Channel) -> Self {
4534 let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4535 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4536 }
4537
4538 pub fn into_channel(self) -> fidl::Channel {
4539 self.client.into_channel()
4540 }
4541
4542 pub fn wait_for_event(
4545 &self,
4546 deadline: zx::MonotonicInstant,
4547 ) -> Result<ReceiverEvent, fidl::Error> {
4548 ReceiverEvent::decode(self.client.wait_for_event(deadline)?)
4549 }
4550
4551 pub fn r#add_host(
4553 &self,
4554 mut request: fidl::endpoints::ClientEnd<HostMarker>,
4555 ) -> Result<(), fidl::Error> {
4556 self.client.send::<ReceiverAddHostRequest>(
4557 (request,),
4558 0x2089233075765e8c,
4559 fidl::encoding::DynamicFlags::FLEXIBLE,
4560 )
4561 }
4562}
4563
4564#[cfg(target_os = "fuchsia")]
4565impl From<ReceiverSynchronousProxy> for zx::Handle {
4566 fn from(value: ReceiverSynchronousProxy) -> Self {
4567 value.into_channel().into()
4568 }
4569}
4570
4571#[cfg(target_os = "fuchsia")]
4572impl From<fidl::Channel> for ReceiverSynchronousProxy {
4573 fn from(value: fidl::Channel) -> Self {
4574 Self::new(value)
4575 }
4576}
4577
4578#[derive(Debug, Clone)]
4579pub struct ReceiverProxy {
4580 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4581}
4582
4583impl fidl::endpoints::Proxy for ReceiverProxy {
4584 type Protocol = ReceiverMarker;
4585
4586 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4587 Self::new(inner)
4588 }
4589
4590 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4591 self.client.into_channel().map_err(|client| Self { client })
4592 }
4593
4594 fn as_channel(&self) -> &::fidl::AsyncChannel {
4595 self.client.as_channel()
4596 }
4597}
4598
4599impl ReceiverProxy {
4600 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4602 let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4603 Self { client: fidl::client::Client::new(channel, protocol_name) }
4604 }
4605
4606 pub fn take_event_stream(&self) -> ReceiverEventStream {
4612 ReceiverEventStream { event_receiver: self.client.take_event_receiver() }
4613 }
4614
4615 pub fn r#add_host(
4617 &self,
4618 mut request: fidl::endpoints::ClientEnd<HostMarker>,
4619 ) -> Result<(), fidl::Error> {
4620 ReceiverProxyInterface::r#add_host(self, request)
4621 }
4622}
4623
4624impl ReceiverProxyInterface for ReceiverProxy {
4625 fn r#add_host(
4626 &self,
4627 mut request: fidl::endpoints::ClientEnd<HostMarker>,
4628 ) -> Result<(), fidl::Error> {
4629 self.client.send::<ReceiverAddHostRequest>(
4630 (request,),
4631 0x2089233075765e8c,
4632 fidl::encoding::DynamicFlags::FLEXIBLE,
4633 )
4634 }
4635}
4636
4637pub struct ReceiverEventStream {
4638 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4639}
4640
4641impl std::marker::Unpin for ReceiverEventStream {}
4642
4643impl futures::stream::FusedStream for ReceiverEventStream {
4644 fn is_terminated(&self) -> bool {
4645 self.event_receiver.is_terminated()
4646 }
4647}
4648
4649impl futures::Stream for ReceiverEventStream {
4650 type Item = Result<ReceiverEvent, fidl::Error>;
4651
4652 fn poll_next(
4653 mut self: std::pin::Pin<&mut Self>,
4654 cx: &mut std::task::Context<'_>,
4655 ) -> std::task::Poll<Option<Self::Item>> {
4656 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4657 &mut self.event_receiver,
4658 cx
4659 )?) {
4660 Some(buf) => std::task::Poll::Ready(Some(ReceiverEvent::decode(buf))),
4661 None => std::task::Poll::Ready(None),
4662 }
4663 }
4664}
4665
4666#[derive(Debug)]
4667pub enum ReceiverEvent {
4668 #[non_exhaustive]
4669 _UnknownEvent {
4670 ordinal: u64,
4672 },
4673}
4674
4675impl ReceiverEvent {
4676 fn decode(
4678 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4679 ) -> Result<ReceiverEvent, fidl::Error> {
4680 let (bytes, _handles) = buf.split_mut();
4681 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4682 debug_assert_eq!(tx_header.tx_id, 0);
4683 match tx_header.ordinal {
4684 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4685 Ok(ReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4686 }
4687 _ => Err(fidl::Error::UnknownOrdinal {
4688 ordinal: tx_header.ordinal,
4689 protocol_name: <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4690 }),
4691 }
4692 }
4693}
4694
4695pub struct ReceiverRequestStream {
4697 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4698 is_terminated: bool,
4699}
4700
4701impl std::marker::Unpin for ReceiverRequestStream {}
4702
4703impl futures::stream::FusedStream for ReceiverRequestStream {
4704 fn is_terminated(&self) -> bool {
4705 self.is_terminated
4706 }
4707}
4708
4709impl fidl::endpoints::RequestStream for ReceiverRequestStream {
4710 type Protocol = ReceiverMarker;
4711 type ControlHandle = ReceiverControlHandle;
4712
4713 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4714 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4715 }
4716
4717 fn control_handle(&self) -> Self::ControlHandle {
4718 ReceiverControlHandle { inner: self.inner.clone() }
4719 }
4720
4721 fn into_inner(
4722 self,
4723 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4724 {
4725 (self.inner, self.is_terminated)
4726 }
4727
4728 fn from_inner(
4729 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4730 is_terminated: bool,
4731 ) -> Self {
4732 Self { inner, is_terminated }
4733 }
4734}
4735
4736impl futures::Stream for ReceiverRequestStream {
4737 type Item = Result<ReceiverRequest, fidl::Error>;
4738
4739 fn poll_next(
4740 mut self: std::pin::Pin<&mut Self>,
4741 cx: &mut std::task::Context<'_>,
4742 ) -> std::task::Poll<Option<Self::Item>> {
4743 let this = &mut *self;
4744 if this.inner.check_shutdown(cx) {
4745 this.is_terminated = true;
4746 return std::task::Poll::Ready(None);
4747 }
4748 if this.is_terminated {
4749 panic!("polled ReceiverRequestStream after completion");
4750 }
4751 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4752 |bytes, handles| {
4753 match this.inner.channel().read_etc(cx, bytes, handles) {
4754 std::task::Poll::Ready(Ok(())) => {}
4755 std::task::Poll::Pending => return std::task::Poll::Pending,
4756 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4757 this.is_terminated = true;
4758 return std::task::Poll::Ready(None);
4759 }
4760 std::task::Poll::Ready(Err(e)) => {
4761 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4762 e.into(),
4763 ))))
4764 }
4765 }
4766
4767 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4769
4770 std::task::Poll::Ready(Some(match header.ordinal {
4771 0x2089233075765e8c => {
4772 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4773 let mut req = fidl::new_empty!(
4774 ReceiverAddHostRequest,
4775 fidl::encoding::DefaultFuchsiaResourceDialect
4776 );
4777 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReceiverAddHostRequest>(&header, _body_bytes, handles, &mut req)?;
4778 let control_handle = ReceiverControlHandle { inner: this.inner.clone() };
4779 Ok(ReceiverRequest::AddHost { request: req.request, control_handle })
4780 }
4781 _ if header.tx_id == 0
4782 && header
4783 .dynamic_flags()
4784 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4785 {
4786 Ok(ReceiverRequest::_UnknownMethod {
4787 ordinal: header.ordinal,
4788 control_handle: ReceiverControlHandle { inner: this.inner.clone() },
4789 method_type: fidl::MethodType::OneWay,
4790 })
4791 }
4792 _ if header
4793 .dynamic_flags()
4794 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4795 {
4796 this.inner.send_framework_err(
4797 fidl::encoding::FrameworkErr::UnknownMethod,
4798 header.tx_id,
4799 header.ordinal,
4800 header.dynamic_flags(),
4801 (bytes, handles),
4802 )?;
4803 Ok(ReceiverRequest::_UnknownMethod {
4804 ordinal: header.ordinal,
4805 control_handle: ReceiverControlHandle { inner: this.inner.clone() },
4806 method_type: fidl::MethodType::TwoWay,
4807 })
4808 }
4809 _ => Err(fidl::Error::UnknownOrdinal {
4810 ordinal: header.ordinal,
4811 protocol_name:
4812 <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4813 }),
4814 }))
4815 },
4816 )
4817 }
4818}
4819
4820#[derive(Debug)]
4822pub enum ReceiverRequest {
4823 AddHost {
4825 request: fidl::endpoints::ClientEnd<HostMarker>,
4826 control_handle: ReceiverControlHandle,
4827 },
4828 #[non_exhaustive]
4830 _UnknownMethod {
4831 ordinal: u64,
4833 control_handle: ReceiverControlHandle,
4834 method_type: fidl::MethodType,
4835 },
4836}
4837
4838impl ReceiverRequest {
4839 #[allow(irrefutable_let_patterns)]
4840 pub fn into_add_host(
4841 self,
4842 ) -> Option<(fidl::endpoints::ClientEnd<HostMarker>, ReceiverControlHandle)> {
4843 if let ReceiverRequest::AddHost { request, control_handle } = self {
4844 Some((request, control_handle))
4845 } else {
4846 None
4847 }
4848 }
4849
4850 pub fn method_name(&self) -> &'static str {
4852 match *self {
4853 ReceiverRequest::AddHost { .. } => "add_host",
4854 ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4855 "unknown one-way method"
4856 }
4857 ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4858 "unknown two-way method"
4859 }
4860 }
4861 }
4862}
4863
4864#[derive(Debug, Clone)]
4865pub struct ReceiverControlHandle {
4866 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4867}
4868
4869impl fidl::endpoints::ControlHandle for ReceiverControlHandle {
4870 fn shutdown(&self) {
4871 self.inner.shutdown()
4872 }
4873 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4874 self.inner.shutdown_with_epitaph(status)
4875 }
4876
4877 fn is_closed(&self) -> bool {
4878 self.inner.channel().is_closed()
4879 }
4880 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4881 self.inner.channel().on_closed()
4882 }
4883
4884 #[cfg(target_os = "fuchsia")]
4885 fn signal_peer(
4886 &self,
4887 clear_mask: zx::Signals,
4888 set_mask: zx::Signals,
4889 ) -> Result<(), zx_status::Status> {
4890 use fidl::Peered;
4891 self.inner.channel().signal_peer(clear_mask, set_mask)
4892 }
4893}
4894
4895impl ReceiverControlHandle {}
4896
4897mod internal {
4898 use super::*;
4899
4900 impl fidl::encoding::ResourceTypeMarker for HostSetBondingDelegateRequest {
4901 type Borrowed<'a> = &'a mut Self;
4902 fn take_or_borrow<'a>(
4903 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4904 ) -> Self::Borrowed<'a> {
4905 value
4906 }
4907 }
4908
4909 unsafe impl fidl::encoding::TypeMarker for HostSetBondingDelegateRequest {
4910 type Owned = Self;
4911
4912 #[inline(always)]
4913 fn inline_align(_context: fidl::encoding::Context) -> usize {
4914 4
4915 }
4916
4917 #[inline(always)]
4918 fn inline_size(_context: fidl::encoding::Context) -> usize {
4919 4
4920 }
4921 }
4922
4923 unsafe impl
4924 fidl::encoding::Encode<
4925 HostSetBondingDelegateRequest,
4926 fidl::encoding::DefaultFuchsiaResourceDialect,
4927 > for &mut HostSetBondingDelegateRequest
4928 {
4929 #[inline]
4930 unsafe fn encode(
4931 self,
4932 encoder: &mut fidl::encoding::Encoder<
4933 '_,
4934 fidl::encoding::DefaultFuchsiaResourceDialect,
4935 >,
4936 offset: usize,
4937 _depth: fidl::encoding::Depth,
4938 ) -> fidl::Result<()> {
4939 encoder.debug_check_bounds::<HostSetBondingDelegateRequest>(offset);
4940 fidl::encoding::Encode::<HostSetBondingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4942 (
4943 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
4944 ),
4945 encoder, offset, _depth
4946 )
4947 }
4948 }
4949 unsafe impl<
4950 T0: fidl::encoding::Encode<
4951 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
4952 fidl::encoding::DefaultFuchsiaResourceDialect,
4953 >,
4954 >
4955 fidl::encoding::Encode<
4956 HostSetBondingDelegateRequest,
4957 fidl::encoding::DefaultFuchsiaResourceDialect,
4958 > for (T0,)
4959 {
4960 #[inline]
4961 unsafe fn encode(
4962 self,
4963 encoder: &mut fidl::encoding::Encoder<
4964 '_,
4965 fidl::encoding::DefaultFuchsiaResourceDialect,
4966 >,
4967 offset: usize,
4968 depth: fidl::encoding::Depth,
4969 ) -> fidl::Result<()> {
4970 encoder.debug_check_bounds::<HostSetBondingDelegateRequest>(offset);
4971 self.0.encode(encoder, offset + 0, depth)?;
4975 Ok(())
4976 }
4977 }
4978
4979 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4980 for HostSetBondingDelegateRequest
4981 {
4982 #[inline(always)]
4983 fn new_empty() -> Self {
4984 Self {
4985 delegate: fidl::new_empty!(
4986 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
4987 fidl::encoding::DefaultFuchsiaResourceDialect
4988 ),
4989 }
4990 }
4991
4992 #[inline]
4993 unsafe fn decode(
4994 &mut self,
4995 decoder: &mut fidl::encoding::Decoder<
4996 '_,
4997 fidl::encoding::DefaultFuchsiaResourceDialect,
4998 >,
4999 offset: usize,
5000 _depth: fidl::encoding::Depth,
5001 ) -> fidl::Result<()> {
5002 decoder.debug_check_bounds::<Self>(offset);
5003 fidl::decode!(
5005 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
5006 fidl::encoding::DefaultFuchsiaResourceDialect,
5007 &mut self.delegate,
5008 decoder,
5009 offset + 0,
5010 _depth
5011 )?;
5012 Ok(())
5013 }
5014 }
5015
5016 impl fidl::encoding::ResourceTypeMarker for HostSetPairingDelegateRequest {
5017 type Borrowed<'a> = &'a mut Self;
5018 fn take_or_borrow<'a>(
5019 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5020 ) -> Self::Borrowed<'a> {
5021 value
5022 }
5023 }
5024
5025 unsafe impl fidl::encoding::TypeMarker for HostSetPairingDelegateRequest {
5026 type Owned = Self;
5027
5028 #[inline(always)]
5029 fn inline_align(_context: fidl::encoding::Context) -> usize {
5030 4
5031 }
5032
5033 #[inline(always)]
5034 fn inline_size(_context: fidl::encoding::Context) -> usize {
5035 12
5036 }
5037 }
5038
5039 unsafe impl
5040 fidl::encoding::Encode<
5041 HostSetPairingDelegateRequest,
5042 fidl::encoding::DefaultFuchsiaResourceDialect,
5043 > for &mut HostSetPairingDelegateRequest
5044 {
5045 #[inline]
5046 unsafe fn encode(
5047 self,
5048 encoder: &mut fidl::encoding::Encoder<
5049 '_,
5050 fidl::encoding::DefaultFuchsiaResourceDialect,
5051 >,
5052 offset: usize,
5053 _depth: fidl::encoding::Depth,
5054 ) -> fidl::Result<()> {
5055 encoder.debug_check_bounds::<HostSetPairingDelegateRequest>(offset);
5056 fidl::encoding::Encode::<HostSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5058 (
5059 <fidl_fuchsia_bluetooth_sys::InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
5060 <fidl_fuchsia_bluetooth_sys::OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
5061 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
5062 ),
5063 encoder, offset, _depth
5064 )
5065 }
5066 }
5067 unsafe impl<
5068 T0: fidl::encoding::Encode<
5069 fidl_fuchsia_bluetooth_sys::InputCapability,
5070 fidl::encoding::DefaultFuchsiaResourceDialect,
5071 >,
5072 T1: fidl::encoding::Encode<
5073 fidl_fuchsia_bluetooth_sys::OutputCapability,
5074 fidl::encoding::DefaultFuchsiaResourceDialect,
5075 >,
5076 T2: fidl::encoding::Encode<
5077 fidl::encoding::Endpoint<
5078 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
5079 >,
5080 fidl::encoding::DefaultFuchsiaResourceDialect,
5081 >,
5082 >
5083 fidl::encoding::Encode<
5084 HostSetPairingDelegateRequest,
5085 fidl::encoding::DefaultFuchsiaResourceDialect,
5086 > for (T0, T1, T2)
5087 {
5088 #[inline]
5089 unsafe fn encode(
5090 self,
5091 encoder: &mut fidl::encoding::Encoder<
5092 '_,
5093 fidl::encoding::DefaultFuchsiaResourceDialect,
5094 >,
5095 offset: usize,
5096 depth: fidl::encoding::Depth,
5097 ) -> fidl::Result<()> {
5098 encoder.debug_check_bounds::<HostSetPairingDelegateRequest>(offset);
5099 self.0.encode(encoder, offset + 0, depth)?;
5103 self.1.encode(encoder, offset + 4, depth)?;
5104 self.2.encode(encoder, offset + 8, depth)?;
5105 Ok(())
5106 }
5107 }
5108
5109 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5110 for HostSetPairingDelegateRequest
5111 {
5112 #[inline(always)]
5113 fn new_empty() -> Self {
5114 Self {
5115 input: fidl::new_empty!(
5116 fidl_fuchsia_bluetooth_sys::InputCapability,
5117 fidl::encoding::DefaultFuchsiaResourceDialect
5118 ),
5119 output: fidl::new_empty!(
5120 fidl_fuchsia_bluetooth_sys::OutputCapability,
5121 fidl::encoding::DefaultFuchsiaResourceDialect
5122 ),
5123 delegate: fidl::new_empty!(
5124 fidl::encoding::Endpoint<
5125 fidl::endpoints::ClientEnd<
5126 fidl_fuchsia_bluetooth_sys::PairingDelegateMarker,
5127 >,
5128 >,
5129 fidl::encoding::DefaultFuchsiaResourceDialect
5130 ),
5131 }
5132 }
5133
5134 #[inline]
5135 unsafe fn decode(
5136 &mut self,
5137 decoder: &mut fidl::encoding::Decoder<
5138 '_,
5139 fidl::encoding::DefaultFuchsiaResourceDialect,
5140 >,
5141 offset: usize,
5142 _depth: fidl::encoding::Depth,
5143 ) -> fidl::Result<()> {
5144 decoder.debug_check_bounds::<Self>(offset);
5145 fidl::decode!(
5147 fidl_fuchsia_bluetooth_sys::InputCapability,
5148 fidl::encoding::DefaultFuchsiaResourceDialect,
5149 &mut self.input,
5150 decoder,
5151 offset + 0,
5152 _depth
5153 )?;
5154 fidl::decode!(
5155 fidl_fuchsia_bluetooth_sys::OutputCapability,
5156 fidl::encoding::DefaultFuchsiaResourceDialect,
5157 &mut self.output,
5158 decoder,
5159 offset + 4,
5160 _depth
5161 )?;
5162 fidl::decode!(
5163 fidl::encoding::Endpoint<
5164 fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
5165 >,
5166 fidl::encoding::DefaultFuchsiaResourceDialect,
5167 &mut self.delegate,
5168 decoder,
5169 offset + 8,
5170 _depth
5171 )?;
5172 Ok(())
5173 }
5174 }
5175
5176 impl fidl::encoding::ResourceTypeMarker for HostSetPeerWatcherRequest {
5177 type Borrowed<'a> = &'a mut Self;
5178 fn take_or_borrow<'a>(
5179 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5180 ) -> Self::Borrowed<'a> {
5181 value
5182 }
5183 }
5184
5185 unsafe impl fidl::encoding::TypeMarker for HostSetPeerWatcherRequest {
5186 type Owned = Self;
5187
5188 #[inline(always)]
5189 fn inline_align(_context: fidl::encoding::Context) -> usize {
5190 4
5191 }
5192
5193 #[inline(always)]
5194 fn inline_size(_context: fidl::encoding::Context) -> usize {
5195 4
5196 }
5197 }
5198
5199 unsafe impl
5200 fidl::encoding::Encode<
5201 HostSetPeerWatcherRequest,
5202 fidl::encoding::DefaultFuchsiaResourceDialect,
5203 > for &mut HostSetPeerWatcherRequest
5204 {
5205 #[inline]
5206 unsafe fn encode(
5207 self,
5208 encoder: &mut fidl::encoding::Encoder<
5209 '_,
5210 fidl::encoding::DefaultFuchsiaResourceDialect,
5211 >,
5212 offset: usize,
5213 _depth: fidl::encoding::Depth,
5214 ) -> fidl::Result<()> {
5215 encoder.debug_check_bounds::<HostSetPeerWatcherRequest>(offset);
5216 fidl::encoding::Encode::<HostSetPeerWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5218 (
5219 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.peer_watcher),
5220 ),
5221 encoder, offset, _depth
5222 )
5223 }
5224 }
5225 unsafe impl<
5226 T0: fidl::encoding::Encode<
5227 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
5228 fidl::encoding::DefaultFuchsiaResourceDialect,
5229 >,
5230 >
5231 fidl::encoding::Encode<
5232 HostSetPeerWatcherRequest,
5233 fidl::encoding::DefaultFuchsiaResourceDialect,
5234 > for (T0,)
5235 {
5236 #[inline]
5237 unsafe fn encode(
5238 self,
5239 encoder: &mut fidl::encoding::Encoder<
5240 '_,
5241 fidl::encoding::DefaultFuchsiaResourceDialect,
5242 >,
5243 offset: usize,
5244 depth: fidl::encoding::Depth,
5245 ) -> fidl::Result<()> {
5246 encoder.debug_check_bounds::<HostSetPeerWatcherRequest>(offset);
5247 self.0.encode(encoder, offset + 0, depth)?;
5251 Ok(())
5252 }
5253 }
5254
5255 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5256 for HostSetPeerWatcherRequest
5257 {
5258 #[inline(always)]
5259 fn new_empty() -> Self {
5260 Self {
5261 peer_watcher: fidl::new_empty!(
5262 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
5263 fidl::encoding::DefaultFuchsiaResourceDialect
5264 ),
5265 }
5266 }
5267
5268 #[inline]
5269 unsafe fn decode(
5270 &mut self,
5271 decoder: &mut fidl::encoding::Decoder<
5272 '_,
5273 fidl::encoding::DefaultFuchsiaResourceDialect,
5274 >,
5275 offset: usize,
5276 _depth: fidl::encoding::Depth,
5277 ) -> fidl::Result<()> {
5278 decoder.debug_check_bounds::<Self>(offset);
5279 fidl::decode!(
5281 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
5282 fidl::encoding::DefaultFuchsiaResourceDialect,
5283 &mut self.peer_watcher,
5284 decoder,
5285 offset + 0,
5286 _depth
5287 )?;
5288 Ok(())
5289 }
5290 }
5291
5292 impl fidl::encoding::ResourceTypeMarker for ReceiverAddHostRequest {
5293 type Borrowed<'a> = &'a mut Self;
5294 fn take_or_borrow<'a>(
5295 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5296 ) -> Self::Borrowed<'a> {
5297 value
5298 }
5299 }
5300
5301 unsafe impl fidl::encoding::TypeMarker for ReceiverAddHostRequest {
5302 type Owned = Self;
5303
5304 #[inline(always)]
5305 fn inline_align(_context: fidl::encoding::Context) -> usize {
5306 4
5307 }
5308
5309 #[inline(always)]
5310 fn inline_size(_context: fidl::encoding::Context) -> usize {
5311 4
5312 }
5313 }
5314
5315 unsafe impl
5316 fidl::encoding::Encode<
5317 ReceiverAddHostRequest,
5318 fidl::encoding::DefaultFuchsiaResourceDialect,
5319 > for &mut ReceiverAddHostRequest
5320 {
5321 #[inline]
5322 unsafe fn encode(
5323 self,
5324 encoder: &mut fidl::encoding::Encoder<
5325 '_,
5326 fidl::encoding::DefaultFuchsiaResourceDialect,
5327 >,
5328 offset: usize,
5329 _depth: fidl::encoding::Depth,
5330 ) -> fidl::Result<()> {
5331 encoder.debug_check_bounds::<ReceiverAddHostRequest>(offset);
5332 fidl::encoding::Encode::<ReceiverAddHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5334 (
5335 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
5336 ),
5337 encoder, offset, _depth
5338 )
5339 }
5340 }
5341 unsafe impl<
5342 T0: fidl::encoding::Encode<
5343 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
5344 fidl::encoding::DefaultFuchsiaResourceDialect,
5345 >,
5346 >
5347 fidl::encoding::Encode<
5348 ReceiverAddHostRequest,
5349 fidl::encoding::DefaultFuchsiaResourceDialect,
5350 > for (T0,)
5351 {
5352 #[inline]
5353 unsafe fn encode(
5354 self,
5355 encoder: &mut fidl::encoding::Encoder<
5356 '_,
5357 fidl::encoding::DefaultFuchsiaResourceDialect,
5358 >,
5359 offset: usize,
5360 depth: fidl::encoding::Depth,
5361 ) -> fidl::Result<()> {
5362 encoder.debug_check_bounds::<ReceiverAddHostRequest>(offset);
5363 self.0.encode(encoder, offset + 0, depth)?;
5367 Ok(())
5368 }
5369 }
5370
5371 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5372 for ReceiverAddHostRequest
5373 {
5374 #[inline(always)]
5375 fn new_empty() -> Self {
5376 Self {
5377 request: fidl::new_empty!(
5378 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
5379 fidl::encoding::DefaultFuchsiaResourceDialect
5380 ),
5381 }
5382 }
5383
5384 #[inline]
5385 unsafe fn decode(
5386 &mut self,
5387 decoder: &mut fidl::encoding::Decoder<
5388 '_,
5389 fidl::encoding::DefaultFuchsiaResourceDialect,
5390 >,
5391 offset: usize,
5392 _depth: fidl::encoding::Depth,
5393 ) -> fidl::Result<()> {
5394 decoder.debug_check_bounds::<Self>(offset);
5395 fidl::decode!(
5397 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
5398 fidl::encoding::DefaultFuchsiaResourceDialect,
5399 &mut self.request,
5400 decoder,
5401 offset + 0,
5402 _depth
5403 )?;
5404 Ok(())
5405 }
5406 }
5407
5408 impl HostStartDiscoveryRequest {
5409 #[inline(always)]
5410 fn max_ordinal_present(&self) -> u64 {
5411 if let Some(_) = self.token {
5412 return 1;
5413 }
5414 0
5415 }
5416 }
5417
5418 impl fidl::encoding::ResourceTypeMarker for HostStartDiscoveryRequest {
5419 type Borrowed<'a> = &'a mut Self;
5420 fn take_or_borrow<'a>(
5421 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5422 ) -> Self::Borrowed<'a> {
5423 value
5424 }
5425 }
5426
5427 unsafe impl fidl::encoding::TypeMarker for HostStartDiscoveryRequest {
5428 type Owned = Self;
5429
5430 #[inline(always)]
5431 fn inline_align(_context: fidl::encoding::Context) -> usize {
5432 8
5433 }
5434
5435 #[inline(always)]
5436 fn inline_size(_context: fidl::encoding::Context) -> usize {
5437 16
5438 }
5439 }
5440
5441 unsafe impl
5442 fidl::encoding::Encode<
5443 HostStartDiscoveryRequest,
5444 fidl::encoding::DefaultFuchsiaResourceDialect,
5445 > for &mut HostStartDiscoveryRequest
5446 {
5447 unsafe fn encode(
5448 self,
5449 encoder: &mut fidl::encoding::Encoder<
5450 '_,
5451 fidl::encoding::DefaultFuchsiaResourceDialect,
5452 >,
5453 offset: usize,
5454 mut depth: fidl::encoding::Depth,
5455 ) -> fidl::Result<()> {
5456 encoder.debug_check_bounds::<HostStartDiscoveryRequest>(offset);
5457 let max_ordinal: u64 = self.max_ordinal_present();
5459 encoder.write_num(max_ordinal, offset);
5460 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5461 if max_ordinal == 0 {
5463 return Ok(());
5464 }
5465 depth.increment()?;
5466 let envelope_size = 8;
5467 let bytes_len = max_ordinal as usize * envelope_size;
5468 #[allow(unused_variables)]
5469 let offset = encoder.out_of_line_offset(bytes_len);
5470 let mut _prev_end_offset: usize = 0;
5471 if 1 > max_ordinal {
5472 return Ok(());
5473 }
5474
5475 let cur_offset: usize = (1 - 1) * envelope_size;
5478
5479 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5481
5482 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
5487 self.token.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5488 encoder, offset + cur_offset, depth
5489 )?;
5490
5491 _prev_end_offset = cur_offset + envelope_size;
5492
5493 Ok(())
5494 }
5495 }
5496
5497 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5498 for HostStartDiscoveryRequest
5499 {
5500 #[inline(always)]
5501 fn new_empty() -> Self {
5502 Self::default()
5503 }
5504
5505 unsafe fn decode(
5506 &mut self,
5507 decoder: &mut fidl::encoding::Decoder<
5508 '_,
5509 fidl::encoding::DefaultFuchsiaResourceDialect,
5510 >,
5511 offset: usize,
5512 mut depth: fidl::encoding::Depth,
5513 ) -> fidl::Result<()> {
5514 decoder.debug_check_bounds::<Self>(offset);
5515 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5516 None => return Err(fidl::Error::NotNullable),
5517 Some(len) => len,
5518 };
5519 if len == 0 {
5521 return Ok(());
5522 };
5523 depth.increment()?;
5524 let envelope_size = 8;
5525 let bytes_len = len * envelope_size;
5526 let offset = decoder.out_of_line_offset(bytes_len)?;
5527 let mut _next_ordinal_to_read = 0;
5529 let mut next_offset = offset;
5530 let end_offset = offset + bytes_len;
5531 _next_ordinal_to_read += 1;
5532 if next_offset >= end_offset {
5533 return Ok(());
5534 }
5535
5536 while _next_ordinal_to_read < 1 {
5538 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5539 _next_ordinal_to_read += 1;
5540 next_offset += envelope_size;
5541 }
5542
5543 let next_out_of_line = decoder.next_out_of_line();
5544 let handles_before = decoder.remaining_handles();
5545 if let Some((inlined, num_bytes, num_handles)) =
5546 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5547 {
5548 let member_inline_size = <fidl::encoding::Endpoint<
5549 fidl::endpoints::ServerEnd<DiscoverySessionMarker>,
5550 > as fidl::encoding::TypeMarker>::inline_size(
5551 decoder.context
5552 );
5553 if inlined != (member_inline_size <= 4) {
5554 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5555 }
5556 let inner_offset;
5557 let mut inner_depth = depth.clone();
5558 if inlined {
5559 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5560 inner_offset = next_offset;
5561 } else {
5562 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5563 inner_depth.increment()?;
5564 }
5565 let val_ref = self.token.get_or_insert_with(|| {
5566 fidl::new_empty!(
5567 fidl::encoding::Endpoint<
5568 fidl::endpoints::ServerEnd<DiscoverySessionMarker>,
5569 >,
5570 fidl::encoding::DefaultFuchsiaResourceDialect
5571 )
5572 });
5573 fidl::decode!(
5574 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>,
5575 fidl::encoding::DefaultFuchsiaResourceDialect,
5576 val_ref,
5577 decoder,
5578 inner_offset,
5579 inner_depth
5580 )?;
5581 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5582 {
5583 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5584 }
5585 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5586 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5587 }
5588 }
5589
5590 next_offset += envelope_size;
5591
5592 while next_offset < end_offset {
5594 _next_ordinal_to_read += 1;
5595 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5596 next_offset += envelope_size;
5597 }
5598
5599 Ok(())
5600 }
5601 }
5602
5603 impl fidl::encoding::ResourceTypeMarker for ProtocolRequest {
5604 type Borrowed<'a> = &'a mut Self;
5605 fn take_or_borrow<'a>(
5606 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5607 ) -> Self::Borrowed<'a> {
5608 value
5609 }
5610 }
5611
5612 unsafe impl fidl::encoding::TypeMarker for ProtocolRequest {
5613 type Owned = Self;
5614
5615 #[inline(always)]
5616 fn inline_align(_context: fidl::encoding::Context) -> usize {
5617 8
5618 }
5619
5620 #[inline(always)]
5621 fn inline_size(_context: fidl::encoding::Context) -> usize {
5622 16
5623 }
5624 }
5625
5626 unsafe impl
5627 fidl::encoding::Encode<ProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
5628 for &mut ProtocolRequest
5629 {
5630 #[inline]
5631 unsafe fn encode(
5632 self,
5633 encoder: &mut fidl::encoding::Encoder<
5634 '_,
5635 fidl::encoding::DefaultFuchsiaResourceDialect,
5636 >,
5637 offset: usize,
5638 _depth: fidl::encoding::Depth,
5639 ) -> fidl::Result<()> {
5640 encoder.debug_check_bounds::<ProtocolRequest>(offset);
5641 encoder.write_num::<u64>(self.ordinal(), offset);
5642 match self {
5643 ProtocolRequest::Central(ref mut val) => fidl::encoding::encode_in_envelope::<
5644 fidl::encoding::Endpoint<
5645 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
5646 >,
5647 fidl::encoding::DefaultFuchsiaResourceDialect,
5648 >(
5649 <fidl::encoding::Endpoint<
5650 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
5651 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5652 val
5653 ),
5654 encoder,
5655 offset + 8,
5656 _depth,
5657 ),
5658 ProtocolRequest::Peripheral(ref mut val) => fidl::encoding::encode_in_envelope::<
5659 fidl::encoding::Endpoint<
5660 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
5661 >,
5662 fidl::encoding::DefaultFuchsiaResourceDialect,
5663 >(
5664 <fidl::encoding::Endpoint<
5665 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
5666 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5667 val
5668 ),
5669 encoder,
5670 offset + 8,
5671 _depth,
5672 ),
5673 ProtocolRequest::GattServer(ref mut val) => fidl::encoding::encode_in_envelope::<
5674 fidl::encoding::Endpoint<
5675 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
5676 >,
5677 fidl::encoding::DefaultFuchsiaResourceDialect,
5678 >(
5679 <fidl::encoding::Endpoint<
5680 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
5681 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5682 val
5683 ),
5684 encoder,
5685 offset + 8,
5686 _depth,
5687 ),
5688 ProtocolRequest::Gatt2Server(ref mut val) => fidl::encoding::encode_in_envelope::<
5689 fidl::encoding::Endpoint<
5690 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
5691 >,
5692 fidl::encoding::DefaultFuchsiaResourceDialect,
5693 >(
5694 <fidl::encoding::Endpoint<
5695 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
5696 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5697 val
5698 ),
5699 encoder,
5700 offset + 8,
5701 _depth,
5702 ),
5703 ProtocolRequest::Profile(ref mut val) => fidl::encoding::encode_in_envelope::<
5704 fidl::encoding::Endpoint<
5705 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
5706 >,
5707 fidl::encoding::DefaultFuchsiaResourceDialect,
5708 >(
5709 <fidl::encoding::Endpoint<
5710 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
5711 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5712 val
5713 ),
5714 encoder,
5715 offset + 8,
5716 _depth,
5717 ),
5718 ProtocolRequest::PrivilegedPeripheral(ref mut val) => {
5719 fidl::encoding::encode_in_envelope::<
5720 fidl::encoding::Endpoint<
5721 fidl::endpoints::ServerEnd<
5722 fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
5723 >,
5724 >,
5725 fidl::encoding::DefaultFuchsiaResourceDialect,
5726 >(
5727 <fidl::encoding::Endpoint<
5728 fidl::endpoints::ServerEnd<
5729 fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
5730 >,
5731 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5732 val
5733 ),
5734 encoder,
5735 offset + 8,
5736 _depth,
5737 )
5738 }
5739 ProtocolRequest::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
5740 }
5741 }
5742 }
5743
5744 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5745 for ProtocolRequest
5746 {
5747 #[inline(always)]
5748 fn new_empty() -> Self {
5749 Self::__SourceBreaking { unknown_ordinal: 0 }
5750 }
5751
5752 #[inline]
5753 unsafe fn decode(
5754 &mut self,
5755 decoder: &mut fidl::encoding::Decoder<
5756 '_,
5757 fidl::encoding::DefaultFuchsiaResourceDialect,
5758 >,
5759 offset: usize,
5760 mut depth: fidl::encoding::Depth,
5761 ) -> fidl::Result<()> {
5762 decoder.debug_check_bounds::<Self>(offset);
5763 #[allow(unused_variables)]
5764 let next_out_of_line = decoder.next_out_of_line();
5765 let handles_before = decoder.remaining_handles();
5766 let (ordinal, inlined, num_bytes, num_handles) =
5767 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5768
5769 let member_inline_size = match ordinal {
5770 1 => <fidl::encoding::Endpoint<
5771 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
5772 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5773 2 => <fidl::encoding::Endpoint<
5774 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
5775 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5776 3 => <fidl::encoding::Endpoint<
5777 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
5778 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5779 4 => <fidl::encoding::Endpoint<
5780 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
5781 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5782 5 => <fidl::encoding::Endpoint<
5783 fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
5784 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5785 6 => <fidl::encoding::Endpoint<
5786 fidl::endpoints::ServerEnd<
5787 fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
5788 >,
5789 > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5790 0 => return Err(fidl::Error::UnknownUnionTag),
5791 _ => num_bytes as usize,
5792 };
5793
5794 if inlined != (member_inline_size <= 4) {
5795 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5796 }
5797 let _inner_offset;
5798 if inlined {
5799 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5800 _inner_offset = offset + 8;
5801 } else {
5802 depth.increment()?;
5803 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5804 }
5805 match ordinal {
5806 1 => {
5807 #[allow(irrefutable_let_patterns)]
5808 if let ProtocolRequest::Central(_) = self {
5809 } else {
5811 *self = ProtocolRequest::Central(fidl::new_empty!(
5813 fidl::encoding::Endpoint<
5814 fidl::endpoints::ServerEnd<
5815 fidl_fuchsia_bluetooth_le::CentralMarker,
5816 >,
5817 >,
5818 fidl::encoding::DefaultFuchsiaResourceDialect
5819 ));
5820 }
5821 #[allow(irrefutable_let_patterns)]
5822 if let ProtocolRequest::Central(ref mut val) = self {
5823 fidl::decode!(
5824 fidl::encoding::Endpoint<
5825 fidl::endpoints::ServerEnd<
5826 fidl_fuchsia_bluetooth_le::CentralMarker,
5827 >,
5828 >,
5829 fidl::encoding::DefaultFuchsiaResourceDialect,
5830 val,
5831 decoder,
5832 _inner_offset,
5833 depth
5834 )?;
5835 } else {
5836 unreachable!()
5837 }
5838 }
5839 2 => {
5840 #[allow(irrefutable_let_patterns)]
5841 if let ProtocolRequest::Peripheral(_) = self {
5842 } else {
5844 *self = ProtocolRequest::Peripheral(fidl::new_empty!(
5846 fidl::encoding::Endpoint<
5847 fidl::endpoints::ServerEnd<
5848 fidl_fuchsia_bluetooth_le::PeripheralMarker,
5849 >,
5850 >,
5851 fidl::encoding::DefaultFuchsiaResourceDialect
5852 ));
5853 }
5854 #[allow(irrefutable_let_patterns)]
5855 if let ProtocolRequest::Peripheral(ref mut val) = self {
5856 fidl::decode!(
5857 fidl::encoding::Endpoint<
5858 fidl::endpoints::ServerEnd<
5859 fidl_fuchsia_bluetooth_le::PeripheralMarker,
5860 >,
5861 >,
5862 fidl::encoding::DefaultFuchsiaResourceDialect,
5863 val,
5864 decoder,
5865 _inner_offset,
5866 depth
5867 )?;
5868 } else {
5869 unreachable!()
5870 }
5871 }
5872 3 => {
5873 #[allow(irrefutable_let_patterns)]
5874 if let ProtocolRequest::GattServer(_) = self {
5875 } else {
5877 *self = ProtocolRequest::GattServer(fidl::new_empty!(
5879 fidl::encoding::Endpoint<
5880 fidl::endpoints::ServerEnd<
5881 fidl_fuchsia_bluetooth_gatt::Server_Marker,
5882 >,
5883 >,
5884 fidl::encoding::DefaultFuchsiaResourceDialect
5885 ));
5886 }
5887 #[allow(irrefutable_let_patterns)]
5888 if let ProtocolRequest::GattServer(ref mut val) = self {
5889 fidl::decode!(
5890 fidl::encoding::Endpoint<
5891 fidl::endpoints::ServerEnd<
5892 fidl_fuchsia_bluetooth_gatt::Server_Marker,
5893 >,
5894 >,
5895 fidl::encoding::DefaultFuchsiaResourceDialect,
5896 val,
5897 decoder,
5898 _inner_offset,
5899 depth
5900 )?;
5901 } else {
5902 unreachable!()
5903 }
5904 }
5905 4 => {
5906 #[allow(irrefutable_let_patterns)]
5907 if let ProtocolRequest::Gatt2Server(_) = self {
5908 } else {
5910 *self = ProtocolRequest::Gatt2Server(fidl::new_empty!(
5912 fidl::encoding::Endpoint<
5913 fidl::endpoints::ServerEnd<
5914 fidl_fuchsia_bluetooth_gatt2::Server_Marker,
5915 >,
5916 >,
5917 fidl::encoding::DefaultFuchsiaResourceDialect
5918 ));
5919 }
5920 #[allow(irrefutable_let_patterns)]
5921 if let ProtocolRequest::Gatt2Server(ref mut val) = self {
5922 fidl::decode!(
5923 fidl::encoding::Endpoint<
5924 fidl::endpoints::ServerEnd<
5925 fidl_fuchsia_bluetooth_gatt2::Server_Marker,
5926 >,
5927 >,
5928 fidl::encoding::DefaultFuchsiaResourceDialect,
5929 val,
5930 decoder,
5931 _inner_offset,
5932 depth
5933 )?;
5934 } else {
5935 unreachable!()
5936 }
5937 }
5938 5 => {
5939 #[allow(irrefutable_let_patterns)]
5940 if let ProtocolRequest::Profile(_) = self {
5941 } else {
5943 *self = ProtocolRequest::Profile(fidl::new_empty!(
5945 fidl::encoding::Endpoint<
5946 fidl::endpoints::ServerEnd<
5947 fidl_fuchsia_bluetooth_bredr::ProfileMarker,
5948 >,
5949 >,
5950 fidl::encoding::DefaultFuchsiaResourceDialect
5951 ));
5952 }
5953 #[allow(irrefutable_let_patterns)]
5954 if let ProtocolRequest::Profile(ref mut val) = self {
5955 fidl::decode!(
5956 fidl::encoding::Endpoint<
5957 fidl::endpoints::ServerEnd<
5958 fidl_fuchsia_bluetooth_bredr::ProfileMarker,
5959 >,
5960 >,
5961 fidl::encoding::DefaultFuchsiaResourceDialect,
5962 val,
5963 decoder,
5964 _inner_offset,
5965 depth
5966 )?;
5967 } else {
5968 unreachable!()
5969 }
5970 }
5971 6 => {
5972 #[allow(irrefutable_let_patterns)]
5973 if let ProtocolRequest::PrivilegedPeripheral(_) = self {
5974 } else {
5976 *self = ProtocolRequest::PrivilegedPeripheral(fidl::new_empty!(
5978 fidl::encoding::Endpoint<
5979 fidl::endpoints::ServerEnd<
5980 fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
5981 >,
5982 >,
5983 fidl::encoding::DefaultFuchsiaResourceDialect
5984 ));
5985 }
5986 #[allow(irrefutable_let_patterns)]
5987 if let ProtocolRequest::PrivilegedPeripheral(ref mut val) = self {
5988 fidl::decode!(
5989 fidl::encoding::Endpoint<
5990 fidl::endpoints::ServerEnd<
5991 fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
5992 >,
5993 >,
5994 fidl::encoding::DefaultFuchsiaResourceDialect,
5995 val,
5996 decoder,
5997 _inner_offset,
5998 depth
5999 )?;
6000 } else {
6001 unreachable!()
6002 }
6003 }
6004 #[allow(deprecated)]
6005 ordinal => {
6006 for _ in 0..num_handles {
6007 decoder.drop_next_handle()?;
6008 }
6009 *self = ProtocolRequest::__SourceBreaking { unknown_ordinal: ordinal };
6010 }
6011 }
6012 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6014 }
6015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6017 }
6018 Ok(())
6019 }
6020 }
6021}