fidl_fuchsia_bluetooth_host/
fidl_fuchsia_bluetooth_host.rs

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