Skip to main content

fidl_fuchsia_bluetooth_affordances/
fidl_fuchsia_bluetooth_affordances.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_affordances_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct HostControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for HostControllerMarker {
18    type Proxy = HostControllerProxy;
19    type RequestStream = HostControllerRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = HostControllerSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.affordances.HostController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for HostControllerMarker {}
26pub type HostControllerGetHostsResult = Result<HostControllerGetHostsResponse, Error>;
27pub type HostControllerSetDiscoverabilityResult = Result<(), Error>;
28pub type HostControllerSetActiveHostResult = Result<(), Error>;
29pub type HostControllerSetLocalNameResult = Result<(), Error>;
30pub type HostControllerStartPairingDelegateResult = Result<(), Error>;
31pub type HostControllerSetDeviceClassResult = Result<(), Error>;
32
33pub trait HostControllerProxyInterface: Send + Sync {
34    type GetHostsResponseFut: std::future::Future<Output = Result<HostControllerGetHostsResult, fidl::Error>>
35        + Send;
36    fn r#get_hosts(&self) -> Self::GetHostsResponseFut;
37    type SetDiscoverabilityResponseFut: std::future::Future<Output = Result<HostControllerSetDiscoverabilityResult, fidl::Error>>
38        + Send;
39    fn r#set_discoverability(
40        &self,
41        payload: &HostControllerSetDiscoverabilityRequest,
42    ) -> Self::SetDiscoverabilityResponseFut;
43    type SetActiveHostResponseFut: std::future::Future<Output = Result<HostControllerSetActiveHostResult, fidl::Error>>
44        + Send;
45    fn r#set_active_host(&self, payload: &HostSelector) -> Self::SetActiveHostResponseFut;
46    type SetLocalNameResponseFut: std::future::Future<Output = Result<HostControllerSetLocalNameResult, fidl::Error>>
47        + Send;
48    fn r#set_local_name(
49        &self,
50        payload: &HostControllerSetLocalNameRequest,
51    ) -> Self::SetLocalNameResponseFut;
52    type StartPairingDelegateResponseFut: std::future::Future<Output = Result<HostControllerStartPairingDelegateResult, fidl::Error>>
53        + Send;
54    fn r#start_pairing_delegate(
55        &self,
56        payload: &HostControllerStartPairingDelegateRequest,
57    ) -> Self::StartPairingDelegateResponseFut;
58    type StopPairingDelegateResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
59        + Send;
60    fn r#stop_pairing_delegate(&self) -> Self::StopPairingDelegateResponseFut;
61    type SetDeviceClassResponseFut: std::future::Future<Output = Result<HostControllerSetDeviceClassResult, fidl::Error>>
62        + Send;
63    fn r#set_device_class(
64        &self,
65        payload: &HostControllerSetDeviceClassRequest,
66    ) -> Self::SetDeviceClassResponseFut;
67}
68#[derive(Debug)]
69#[cfg(target_os = "fuchsia")]
70pub struct HostControllerSynchronousProxy {
71    client: fidl::client::sync::Client,
72}
73
74#[cfg(target_os = "fuchsia")]
75impl fidl::endpoints::SynchronousProxy for HostControllerSynchronousProxy {
76    type Proxy = HostControllerProxy;
77    type Protocol = HostControllerMarker;
78
79    fn from_channel(inner: fidl::Channel) -> Self {
80        Self::new(inner)
81    }
82
83    fn into_channel(self) -> fidl::Channel {
84        self.client.into_channel()
85    }
86
87    fn as_channel(&self) -> &fidl::Channel {
88        self.client.as_channel()
89    }
90}
91
92#[cfg(target_os = "fuchsia")]
93impl HostControllerSynchronousProxy {
94    pub fn new(channel: fidl::Channel) -> Self {
95        Self { client: fidl::client::sync::Client::new(channel) }
96    }
97
98    pub fn into_channel(self) -> fidl::Channel {
99        self.client.into_channel()
100    }
101
102    /// Waits until an event arrives and returns it. It is safe for other
103    /// threads to make concurrent requests while waiting for an event.
104    pub fn wait_for_event(
105        &self,
106        deadline: zx::MonotonicInstant,
107    ) -> Result<HostControllerEvent, fidl::Error> {
108        HostControllerEvent::decode(self.client.wait_for_event::<HostControllerMarker>(deadline)?)
109    }
110
111    /// Get all known hosts.
112    ///
113    /// * error Returns `INTERNAL` if the operation failed (check logs).
114    pub fn r#get_hosts(
115        &self,
116        ___deadline: zx::MonotonicInstant,
117    ) -> Result<HostControllerGetHostsResult, fidl::Error> {
118        let _response = self.client.send_query::<
119            fidl::encoding::EmptyPayload,
120            fidl::encoding::FlexibleResultType<HostControllerGetHostsResponse, Error>,
121            HostControllerMarker,
122        >(
123            (),
124            0x167d2522684d453d,
125            fidl::encoding::DynamicFlags::FLEXIBLE,
126            ___deadline,
127        )?
128        .into_result::<HostControllerMarker>("get_hosts")?;
129        Ok(_response.map(|x| x))
130    }
131
132    /// Set discoverability state.
133    ///
134    /// * error Returns `INTERNAL` if the operation failed (check logs).
135    /// * error Returns `MISSING_PARAMETERS` if `discoverable` is missing.
136    pub fn r#set_discoverability(
137        &self,
138        mut payload: &HostControllerSetDiscoverabilityRequest,
139        ___deadline: zx::MonotonicInstant,
140    ) -> Result<HostControllerSetDiscoverabilityResult, fidl::Error> {
141        let _response = self.client.send_query::<
142            HostControllerSetDiscoverabilityRequest,
143            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
144            HostControllerMarker,
145        >(
146            payload,
147            0x1e977b538b94b08b,
148            fidl::encoding::DynamicFlags::FLEXIBLE,
149            ___deadline,
150        )?
151        .into_result::<HostControllerMarker>("set_discoverability")?;
152        Ok(_response.map(|x| x))
153    }
154
155    /// Set the active host.
156    ///
157    /// * error Returns `INTERNAL` if the operation failed (check logs).
158    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a host ID.
159    pub fn r#set_active_host(
160        &self,
161        mut payload: &HostSelector,
162        ___deadline: zx::MonotonicInstant,
163    ) -> Result<HostControllerSetActiveHostResult, fidl::Error> {
164        let _response = self.client.send_query::<
165            HostSelector,
166            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
167            HostControllerMarker,
168        >(
169            payload,
170            0x1d3f8ba8b30347de,
171            fidl::encoding::DynamicFlags::FLEXIBLE,
172            ___deadline,
173        )?
174        .into_result::<HostControllerMarker>("set_active_host")?;
175        Ok(_response.map(|x| x))
176    }
177
178    /// Set the active host's local name.
179    ///
180    /// * error Returns `INTERNAL` if the operation failed (check logs).
181    /// * error Returns `MISSING_PARAMETERS` if `name` is missing.
182    pub fn r#set_local_name(
183        &self,
184        mut payload: &HostControllerSetLocalNameRequest,
185        ___deadline: zx::MonotonicInstant,
186    ) -> Result<HostControllerSetLocalNameResult, fidl::Error> {
187        let _response = self.client.send_query::<
188            HostControllerSetLocalNameRequest,
189            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
190            HostControllerMarker,
191        >(
192            payload,
193            0x357714c7aa252336,
194            fidl::encoding::DynamicFlags::FLEXIBLE,
195            ___deadline,
196        )?
197        .into_result::<HostControllerMarker>("set_local_name")?;
198        Ok(_response.map(|x| x))
199    }
200
201    /// Start a pairing delegate to respond to pairing procedures. Only one pairing delegate can be
202    /// set at a time host-wide. Calling this while a delegate started by this method is already
203    /// active will drop and overwrite the existing delegate. If this is called while a delegate
204    /// started through other means is active, the new delegate will be closed immediately. Closing
205    /// a pairing delegate after it is set aborts all ongoing pairing procedures without accepting
206    /// and unsets the delegate.
207    ///
208    /// If no pairing delegate is set, all pairings will be rejected even if the peer connection was
209    /// initiated by the host.
210    ///
211    /// * error Returns `INTERNAL` if the operation failed (check logs).
212    /// * error Returns `MISSING_PARAMETERS` if `input_capability` or `output_capability` is
213    ///   missing.
214    pub fn r#start_pairing_delegate(
215        &self,
216        mut payload: &HostControllerStartPairingDelegateRequest,
217        ___deadline: zx::MonotonicInstant,
218    ) -> Result<HostControllerStartPairingDelegateResult, fidl::Error> {
219        let _response = self.client.send_query::<
220            HostControllerStartPairingDelegateRequest,
221            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
222            HostControllerMarker,
223        >(
224            payload,
225            0x155c20cb1b9c1ed2,
226            fidl::encoding::DynamicFlags::FLEXIBLE,
227            ___deadline,
228        )?
229        .into_result::<HostControllerMarker>("start_pairing_delegate")?;
230        Ok(_response.map(|x| x))
231    }
232
233    /// Stop a pairing delegate previously started by [`StartPairingDelegate`]. This will abort all
234    /// ongoing pairing procedures without accepting and unsets the delegate.
235    ///
236    /// This method can only stop a delegate started by [`StartPairingDelegate`], and will not stop
237    /// a delegate started through other means.
238    pub fn r#stop_pairing_delegate(
239        &self,
240        ___deadline: zx::MonotonicInstant,
241    ) -> Result<(), fidl::Error> {
242        let _response = self.client.send_query::<
243            fidl::encoding::EmptyPayload,
244            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
245            HostControllerMarker,
246        >(
247            (),
248            0x5caaee1192a8172c,
249            fidl::encoding::DynamicFlags::FLEXIBLE,
250            ___deadline,
251        )?
252        .into_result::<HostControllerMarker>("stop_pairing_delegate")?;
253        Ok(_response)
254    }
255
256    /// Set the active host's device class.
257    ///
258    /// * error Returns `INTERNAL` if the operation failed (check logs).
259    /// * error Returns `MISSING_PARAMETERS` if `device_class` is missing.
260    pub fn r#set_device_class(
261        &self,
262        mut payload: &HostControllerSetDeviceClassRequest,
263        ___deadline: zx::MonotonicInstant,
264    ) -> Result<HostControllerSetDeviceClassResult, fidl::Error> {
265        let _response = self.client.send_query::<
266            HostControllerSetDeviceClassRequest,
267            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
268            HostControllerMarker,
269        >(
270            payload,
271            0x34dcc9ed479692dc,
272            fidl::encoding::DynamicFlags::FLEXIBLE,
273            ___deadline,
274        )?
275        .into_result::<HostControllerMarker>("set_device_class")?;
276        Ok(_response.map(|x| x))
277    }
278}
279
280#[cfg(target_os = "fuchsia")]
281impl From<HostControllerSynchronousProxy> for zx::NullableHandle {
282    fn from(value: HostControllerSynchronousProxy) -> Self {
283        value.into_channel().into()
284    }
285}
286
287#[cfg(target_os = "fuchsia")]
288impl From<fidl::Channel> for HostControllerSynchronousProxy {
289    fn from(value: fidl::Channel) -> Self {
290        Self::new(value)
291    }
292}
293
294#[cfg(target_os = "fuchsia")]
295impl fidl::endpoints::FromClient for HostControllerSynchronousProxy {
296    type Protocol = HostControllerMarker;
297
298    fn from_client(value: fidl::endpoints::ClientEnd<HostControllerMarker>) -> Self {
299        Self::new(value.into_channel())
300    }
301}
302
303#[derive(Debug, Clone)]
304pub struct HostControllerProxy {
305    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
306}
307
308impl fidl::endpoints::Proxy for HostControllerProxy {
309    type Protocol = HostControllerMarker;
310
311    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
312        Self::new(inner)
313    }
314
315    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
316        self.client.into_channel().map_err(|client| Self { client })
317    }
318
319    fn as_channel(&self) -> &::fidl::AsyncChannel {
320        self.client.as_channel()
321    }
322}
323
324impl HostControllerProxy {
325    /// Create a new Proxy for fuchsia.bluetooth.affordances/HostController.
326    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
327        let protocol_name = <HostControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
328        Self { client: fidl::client::Client::new(channel, protocol_name) }
329    }
330
331    /// Get a Stream of events from the remote end of the protocol.
332    ///
333    /// # Panics
334    ///
335    /// Panics if the event stream was already taken.
336    pub fn take_event_stream(&self) -> HostControllerEventStream {
337        HostControllerEventStream { event_receiver: self.client.take_event_receiver() }
338    }
339
340    /// Get all known hosts.
341    ///
342    /// * error Returns `INTERNAL` if the operation failed (check logs).
343    pub fn r#get_hosts(
344        &self,
345    ) -> fidl::client::QueryResponseFut<
346        HostControllerGetHostsResult,
347        fidl::encoding::DefaultFuchsiaResourceDialect,
348    > {
349        HostControllerProxyInterface::r#get_hosts(self)
350    }
351
352    /// Set discoverability state.
353    ///
354    /// * error Returns `INTERNAL` if the operation failed (check logs).
355    /// * error Returns `MISSING_PARAMETERS` if `discoverable` is missing.
356    pub fn r#set_discoverability(
357        &self,
358        mut payload: &HostControllerSetDiscoverabilityRequest,
359    ) -> fidl::client::QueryResponseFut<
360        HostControllerSetDiscoverabilityResult,
361        fidl::encoding::DefaultFuchsiaResourceDialect,
362    > {
363        HostControllerProxyInterface::r#set_discoverability(self, payload)
364    }
365
366    /// Set the active host.
367    ///
368    /// * error Returns `INTERNAL` if the operation failed (check logs).
369    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a host ID.
370    pub fn r#set_active_host(
371        &self,
372        mut payload: &HostSelector,
373    ) -> fidl::client::QueryResponseFut<
374        HostControllerSetActiveHostResult,
375        fidl::encoding::DefaultFuchsiaResourceDialect,
376    > {
377        HostControllerProxyInterface::r#set_active_host(self, payload)
378    }
379
380    /// Set the active host's local name.
381    ///
382    /// * error Returns `INTERNAL` if the operation failed (check logs).
383    /// * error Returns `MISSING_PARAMETERS` if `name` is missing.
384    pub fn r#set_local_name(
385        &self,
386        mut payload: &HostControllerSetLocalNameRequest,
387    ) -> fidl::client::QueryResponseFut<
388        HostControllerSetLocalNameResult,
389        fidl::encoding::DefaultFuchsiaResourceDialect,
390    > {
391        HostControllerProxyInterface::r#set_local_name(self, payload)
392    }
393
394    /// Start a pairing delegate to respond to pairing procedures. Only one pairing delegate can be
395    /// set at a time host-wide. Calling this while a delegate started by this method is already
396    /// active will drop and overwrite the existing delegate. If this is called while a delegate
397    /// started through other means is active, the new delegate will be closed immediately. Closing
398    /// a pairing delegate after it is set aborts all ongoing pairing procedures without accepting
399    /// and unsets the delegate.
400    ///
401    /// If no pairing delegate is set, all pairings will be rejected even if the peer connection was
402    /// initiated by the host.
403    ///
404    /// * error Returns `INTERNAL` if the operation failed (check logs).
405    /// * error Returns `MISSING_PARAMETERS` if `input_capability` or `output_capability` is
406    ///   missing.
407    pub fn r#start_pairing_delegate(
408        &self,
409        mut payload: &HostControllerStartPairingDelegateRequest,
410    ) -> fidl::client::QueryResponseFut<
411        HostControllerStartPairingDelegateResult,
412        fidl::encoding::DefaultFuchsiaResourceDialect,
413    > {
414        HostControllerProxyInterface::r#start_pairing_delegate(self, payload)
415    }
416
417    /// Stop a pairing delegate previously started by [`StartPairingDelegate`]. This will abort all
418    /// ongoing pairing procedures without accepting and unsets the delegate.
419    ///
420    /// This method can only stop a delegate started by [`StartPairingDelegate`], and will not stop
421    /// a delegate started through other means.
422    pub fn r#stop_pairing_delegate(
423        &self,
424    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
425        HostControllerProxyInterface::r#stop_pairing_delegate(self)
426    }
427
428    /// Set the active host's device class.
429    ///
430    /// * error Returns `INTERNAL` if the operation failed (check logs).
431    /// * error Returns `MISSING_PARAMETERS` if `device_class` is missing.
432    pub fn r#set_device_class(
433        &self,
434        mut payload: &HostControllerSetDeviceClassRequest,
435    ) -> fidl::client::QueryResponseFut<
436        HostControllerSetDeviceClassResult,
437        fidl::encoding::DefaultFuchsiaResourceDialect,
438    > {
439        HostControllerProxyInterface::r#set_device_class(self, payload)
440    }
441}
442
443impl HostControllerProxyInterface for HostControllerProxy {
444    type GetHostsResponseFut = fidl::client::QueryResponseFut<
445        HostControllerGetHostsResult,
446        fidl::encoding::DefaultFuchsiaResourceDialect,
447    >;
448    fn r#get_hosts(&self) -> Self::GetHostsResponseFut {
449        fn _decode(
450            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
451        ) -> Result<HostControllerGetHostsResult, fidl::Error> {
452            let _response = fidl::client::decode_transaction_body::<
453                fidl::encoding::FlexibleResultType<HostControllerGetHostsResponse, Error>,
454                fidl::encoding::DefaultFuchsiaResourceDialect,
455                0x167d2522684d453d,
456            >(_buf?)?
457            .into_result::<HostControllerMarker>("get_hosts")?;
458            Ok(_response.map(|x| x))
459        }
460        self.client
461            .send_query_and_decode::<fidl::encoding::EmptyPayload, HostControllerGetHostsResult>(
462                (),
463                0x167d2522684d453d,
464                fidl::encoding::DynamicFlags::FLEXIBLE,
465                _decode,
466            )
467    }
468
469    type SetDiscoverabilityResponseFut = fidl::client::QueryResponseFut<
470        HostControllerSetDiscoverabilityResult,
471        fidl::encoding::DefaultFuchsiaResourceDialect,
472    >;
473    fn r#set_discoverability(
474        &self,
475        mut payload: &HostControllerSetDiscoverabilityRequest,
476    ) -> Self::SetDiscoverabilityResponseFut {
477        fn _decode(
478            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
479        ) -> Result<HostControllerSetDiscoverabilityResult, fidl::Error> {
480            let _response = fidl::client::decode_transaction_body::<
481                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
482                fidl::encoding::DefaultFuchsiaResourceDialect,
483                0x1e977b538b94b08b,
484            >(_buf?)?
485            .into_result::<HostControllerMarker>("set_discoverability")?;
486            Ok(_response.map(|x| x))
487        }
488        self.client.send_query_and_decode::<
489            HostControllerSetDiscoverabilityRequest,
490            HostControllerSetDiscoverabilityResult,
491        >(
492            payload,
493            0x1e977b538b94b08b,
494            fidl::encoding::DynamicFlags::FLEXIBLE,
495            _decode,
496        )
497    }
498
499    type SetActiveHostResponseFut = fidl::client::QueryResponseFut<
500        HostControllerSetActiveHostResult,
501        fidl::encoding::DefaultFuchsiaResourceDialect,
502    >;
503    fn r#set_active_host(&self, mut payload: &HostSelector) -> Self::SetActiveHostResponseFut {
504        fn _decode(
505            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
506        ) -> Result<HostControllerSetActiveHostResult, fidl::Error> {
507            let _response = fidl::client::decode_transaction_body::<
508                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
509                fidl::encoding::DefaultFuchsiaResourceDialect,
510                0x1d3f8ba8b30347de,
511            >(_buf?)?
512            .into_result::<HostControllerMarker>("set_active_host")?;
513            Ok(_response.map(|x| x))
514        }
515        self.client.send_query_and_decode::<HostSelector, HostControllerSetActiveHostResult>(
516            payload,
517            0x1d3f8ba8b30347de,
518            fidl::encoding::DynamicFlags::FLEXIBLE,
519            _decode,
520        )
521    }
522
523    type SetLocalNameResponseFut = fidl::client::QueryResponseFut<
524        HostControllerSetLocalNameResult,
525        fidl::encoding::DefaultFuchsiaResourceDialect,
526    >;
527    fn r#set_local_name(
528        &self,
529        mut payload: &HostControllerSetLocalNameRequest,
530    ) -> Self::SetLocalNameResponseFut {
531        fn _decode(
532            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
533        ) -> Result<HostControllerSetLocalNameResult, fidl::Error> {
534            let _response = fidl::client::decode_transaction_body::<
535                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
536                fidl::encoding::DefaultFuchsiaResourceDialect,
537                0x357714c7aa252336,
538            >(_buf?)?
539            .into_result::<HostControllerMarker>("set_local_name")?;
540            Ok(_response.map(|x| x))
541        }
542        self.client.send_query_and_decode::<
543            HostControllerSetLocalNameRequest,
544            HostControllerSetLocalNameResult,
545        >(
546            payload,
547            0x357714c7aa252336,
548            fidl::encoding::DynamicFlags::FLEXIBLE,
549            _decode,
550        )
551    }
552
553    type StartPairingDelegateResponseFut = fidl::client::QueryResponseFut<
554        HostControllerStartPairingDelegateResult,
555        fidl::encoding::DefaultFuchsiaResourceDialect,
556    >;
557    fn r#start_pairing_delegate(
558        &self,
559        mut payload: &HostControllerStartPairingDelegateRequest,
560    ) -> Self::StartPairingDelegateResponseFut {
561        fn _decode(
562            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
563        ) -> Result<HostControllerStartPairingDelegateResult, fidl::Error> {
564            let _response = fidl::client::decode_transaction_body::<
565                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
566                fidl::encoding::DefaultFuchsiaResourceDialect,
567                0x155c20cb1b9c1ed2,
568            >(_buf?)?
569            .into_result::<HostControllerMarker>("start_pairing_delegate")?;
570            Ok(_response.map(|x| x))
571        }
572        self.client.send_query_and_decode::<
573            HostControllerStartPairingDelegateRequest,
574            HostControllerStartPairingDelegateResult,
575        >(
576            payload,
577            0x155c20cb1b9c1ed2,
578            fidl::encoding::DynamicFlags::FLEXIBLE,
579            _decode,
580        )
581    }
582
583    type StopPairingDelegateResponseFut =
584        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
585    fn r#stop_pairing_delegate(&self) -> Self::StopPairingDelegateResponseFut {
586        fn _decode(
587            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
588        ) -> Result<(), fidl::Error> {
589            let _response = fidl::client::decode_transaction_body::<
590                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
591                fidl::encoding::DefaultFuchsiaResourceDialect,
592                0x5caaee1192a8172c,
593            >(_buf?)?
594            .into_result::<HostControllerMarker>("stop_pairing_delegate")?;
595            Ok(_response)
596        }
597        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
598            (),
599            0x5caaee1192a8172c,
600            fidl::encoding::DynamicFlags::FLEXIBLE,
601            _decode,
602        )
603    }
604
605    type SetDeviceClassResponseFut = fidl::client::QueryResponseFut<
606        HostControllerSetDeviceClassResult,
607        fidl::encoding::DefaultFuchsiaResourceDialect,
608    >;
609    fn r#set_device_class(
610        &self,
611        mut payload: &HostControllerSetDeviceClassRequest,
612    ) -> Self::SetDeviceClassResponseFut {
613        fn _decode(
614            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
615        ) -> Result<HostControllerSetDeviceClassResult, fidl::Error> {
616            let _response = fidl::client::decode_transaction_body::<
617                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
618                fidl::encoding::DefaultFuchsiaResourceDialect,
619                0x34dcc9ed479692dc,
620            >(_buf?)?
621            .into_result::<HostControllerMarker>("set_device_class")?;
622            Ok(_response.map(|x| x))
623        }
624        self.client.send_query_and_decode::<
625            HostControllerSetDeviceClassRequest,
626            HostControllerSetDeviceClassResult,
627        >(
628            payload,
629            0x34dcc9ed479692dc,
630            fidl::encoding::DynamicFlags::FLEXIBLE,
631            _decode,
632        )
633    }
634}
635
636pub struct HostControllerEventStream {
637    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
638}
639
640impl std::marker::Unpin for HostControllerEventStream {}
641
642impl futures::stream::FusedStream for HostControllerEventStream {
643    fn is_terminated(&self) -> bool {
644        self.event_receiver.is_terminated()
645    }
646}
647
648impl futures::Stream for HostControllerEventStream {
649    type Item = Result<HostControllerEvent, fidl::Error>;
650
651    fn poll_next(
652        mut self: std::pin::Pin<&mut Self>,
653        cx: &mut std::task::Context<'_>,
654    ) -> std::task::Poll<Option<Self::Item>> {
655        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
656            &mut self.event_receiver,
657            cx
658        )?) {
659            Some(buf) => std::task::Poll::Ready(Some(HostControllerEvent::decode(buf))),
660            None => std::task::Poll::Ready(None),
661        }
662    }
663}
664
665#[derive(Debug)]
666pub enum HostControllerEvent {
667    #[non_exhaustive]
668    _UnknownEvent {
669        /// Ordinal of the event that was sent.
670        ordinal: u64,
671    },
672}
673
674impl HostControllerEvent {
675    /// Decodes a message buffer as a [`HostControllerEvent`].
676    fn decode(
677        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
678    ) -> Result<HostControllerEvent, fidl::Error> {
679        let (bytes, _handles) = buf.split_mut();
680        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
681        debug_assert_eq!(tx_header.tx_id, 0);
682        match tx_header.ordinal {
683            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
684                Ok(HostControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
685            }
686            _ => Err(fidl::Error::UnknownOrdinal {
687                ordinal: tx_header.ordinal,
688                protocol_name:
689                    <HostControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
690            }),
691        }
692    }
693}
694
695/// A Stream of incoming requests for fuchsia.bluetooth.affordances/HostController.
696pub struct HostControllerRequestStream {
697    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
698    is_terminated: bool,
699}
700
701impl std::marker::Unpin for HostControllerRequestStream {}
702
703impl futures::stream::FusedStream for HostControllerRequestStream {
704    fn is_terminated(&self) -> bool {
705        self.is_terminated
706    }
707}
708
709impl fidl::endpoints::RequestStream for HostControllerRequestStream {
710    type Protocol = HostControllerMarker;
711    type ControlHandle = HostControllerControlHandle;
712
713    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
714        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
715    }
716
717    fn control_handle(&self) -> Self::ControlHandle {
718        HostControllerControlHandle { inner: self.inner.clone() }
719    }
720
721    fn into_inner(
722        self,
723    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
724    {
725        (self.inner, self.is_terminated)
726    }
727
728    fn from_inner(
729        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
730        is_terminated: bool,
731    ) -> Self {
732        Self { inner, is_terminated }
733    }
734}
735
736impl futures::Stream for HostControllerRequestStream {
737    type Item = Result<HostControllerRequest, fidl::Error>;
738
739    fn poll_next(
740        mut self: std::pin::Pin<&mut Self>,
741        cx: &mut std::task::Context<'_>,
742    ) -> std::task::Poll<Option<Self::Item>> {
743        let this = &mut *self;
744        if this.inner.check_shutdown(cx) {
745            this.is_terminated = true;
746            return std::task::Poll::Ready(None);
747        }
748        if this.is_terminated {
749            panic!("polled HostControllerRequestStream after completion");
750        }
751        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
752            |bytes, handles| {
753                match this.inner.channel().read_etc(cx, bytes, handles) {
754                    std::task::Poll::Ready(Ok(())) => {}
755                    std::task::Poll::Pending => return std::task::Poll::Pending,
756                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
757                        this.is_terminated = true;
758                        return std::task::Poll::Ready(None);
759                    }
760                    std::task::Poll::Ready(Err(e)) => {
761                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
762                            e.into(),
763                        ))));
764                    }
765                }
766
767                // A message has been received from the channel
768                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
769
770                std::task::Poll::Ready(Some(match header.ordinal {
771                    0x167d2522684d453d => {
772                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
773                        let mut req = fidl::new_empty!(
774                            fidl::encoding::EmptyPayload,
775                            fidl::encoding::DefaultFuchsiaResourceDialect
776                        );
777                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
778                        let control_handle =
779                            HostControllerControlHandle { inner: this.inner.clone() };
780                        Ok(HostControllerRequest::GetHosts {
781                            responder: HostControllerGetHostsResponder {
782                                control_handle: std::mem::ManuallyDrop::new(control_handle),
783                                tx_id: header.tx_id,
784                            },
785                        })
786                    }
787                    0x1e977b538b94b08b => {
788                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
789                        let mut req = fidl::new_empty!(
790                            HostControllerSetDiscoverabilityRequest,
791                            fidl::encoding::DefaultFuchsiaResourceDialect
792                        );
793                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostControllerSetDiscoverabilityRequest>(&header, _body_bytes, handles, &mut req)?;
794                        let control_handle =
795                            HostControllerControlHandle { inner: this.inner.clone() };
796                        Ok(HostControllerRequest::SetDiscoverability {
797                            payload: req,
798                            responder: HostControllerSetDiscoverabilityResponder {
799                                control_handle: std::mem::ManuallyDrop::new(control_handle),
800                                tx_id: header.tx_id,
801                            },
802                        })
803                    }
804                    0x1d3f8ba8b30347de => {
805                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
806                        let mut req = fidl::new_empty!(
807                            HostSelector,
808                            fidl::encoding::DefaultFuchsiaResourceDialect
809                        );
810                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSelector>(&header, _body_bytes, handles, &mut req)?;
811                        let control_handle =
812                            HostControllerControlHandle { inner: this.inner.clone() };
813                        Ok(HostControllerRequest::SetActiveHost {
814                            payload: req,
815                            responder: HostControllerSetActiveHostResponder {
816                                control_handle: std::mem::ManuallyDrop::new(control_handle),
817                                tx_id: header.tx_id,
818                            },
819                        })
820                    }
821                    0x357714c7aa252336 => {
822                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
823                        let mut req = fidl::new_empty!(
824                            HostControllerSetLocalNameRequest,
825                            fidl::encoding::DefaultFuchsiaResourceDialect
826                        );
827                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostControllerSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
828                        let control_handle =
829                            HostControllerControlHandle { inner: this.inner.clone() };
830                        Ok(HostControllerRequest::SetLocalName {
831                            payload: req,
832                            responder: HostControllerSetLocalNameResponder {
833                                control_handle: std::mem::ManuallyDrop::new(control_handle),
834                                tx_id: header.tx_id,
835                            },
836                        })
837                    }
838                    0x155c20cb1b9c1ed2 => {
839                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
840                        let mut req = fidl::new_empty!(
841                            HostControllerStartPairingDelegateRequest,
842                            fidl::encoding::DefaultFuchsiaResourceDialect
843                        );
844                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostControllerStartPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
845                        let control_handle =
846                            HostControllerControlHandle { inner: this.inner.clone() };
847                        Ok(HostControllerRequest::StartPairingDelegate {
848                            payload: req,
849                            responder: HostControllerStartPairingDelegateResponder {
850                                control_handle: std::mem::ManuallyDrop::new(control_handle),
851                                tx_id: header.tx_id,
852                            },
853                        })
854                    }
855                    0x5caaee1192a8172c => {
856                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
857                        let mut req = fidl::new_empty!(
858                            fidl::encoding::EmptyPayload,
859                            fidl::encoding::DefaultFuchsiaResourceDialect
860                        );
861                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
862                        let control_handle =
863                            HostControllerControlHandle { inner: this.inner.clone() };
864                        Ok(HostControllerRequest::StopPairingDelegate {
865                            responder: HostControllerStopPairingDelegateResponder {
866                                control_handle: std::mem::ManuallyDrop::new(control_handle),
867                                tx_id: header.tx_id,
868                            },
869                        })
870                    }
871                    0x34dcc9ed479692dc => {
872                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
873                        let mut req = fidl::new_empty!(
874                            HostControllerSetDeviceClassRequest,
875                            fidl::encoding::DefaultFuchsiaResourceDialect
876                        );
877                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostControllerSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
878                        let control_handle =
879                            HostControllerControlHandle { inner: this.inner.clone() };
880                        Ok(HostControllerRequest::SetDeviceClass {
881                            payload: req,
882                            responder: HostControllerSetDeviceClassResponder {
883                                control_handle: std::mem::ManuallyDrop::new(control_handle),
884                                tx_id: header.tx_id,
885                            },
886                        })
887                    }
888                    _ if header.tx_id == 0
889                        && header
890                            .dynamic_flags()
891                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
892                    {
893                        Ok(HostControllerRequest::_UnknownMethod {
894                            ordinal: header.ordinal,
895                            control_handle: HostControllerControlHandle {
896                                inner: this.inner.clone(),
897                            },
898                            method_type: fidl::MethodType::OneWay,
899                        })
900                    }
901                    _ if header
902                        .dynamic_flags()
903                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
904                    {
905                        this.inner.send_framework_err(
906                            fidl::encoding::FrameworkErr::UnknownMethod,
907                            header.tx_id,
908                            header.ordinal,
909                            header.dynamic_flags(),
910                            (bytes, handles),
911                        )?;
912                        Ok(HostControllerRequest::_UnknownMethod {
913                            ordinal: header.ordinal,
914                            control_handle: HostControllerControlHandle {
915                                inner: this.inner.clone(),
916                            },
917                            method_type: fidl::MethodType::TwoWay,
918                        })
919                    }
920                    _ => Err(fidl::Error::UnknownOrdinal {
921                        ordinal: header.ordinal,
922                        protocol_name:
923                            <HostControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
924                    }),
925                }))
926            },
927        )
928    }
929}
930
931#[derive(Debug)]
932pub enum HostControllerRequest {
933    /// Get all known hosts.
934    ///
935    /// * error Returns `INTERNAL` if the operation failed (check logs).
936    GetHosts { responder: HostControllerGetHostsResponder },
937    /// Set discoverability state.
938    ///
939    /// * error Returns `INTERNAL` if the operation failed (check logs).
940    /// * error Returns `MISSING_PARAMETERS` if `discoverable` is missing.
941    SetDiscoverability {
942        payload: HostControllerSetDiscoverabilityRequest,
943        responder: HostControllerSetDiscoverabilityResponder,
944    },
945    /// Set the active host.
946    ///
947    /// * error Returns `INTERNAL` if the operation failed (check logs).
948    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a host ID.
949    SetActiveHost { payload: HostSelector, responder: HostControllerSetActiveHostResponder },
950    /// Set the active host's local name.
951    ///
952    /// * error Returns `INTERNAL` if the operation failed (check logs).
953    /// * error Returns `MISSING_PARAMETERS` if `name` is missing.
954    SetLocalName {
955        payload: HostControllerSetLocalNameRequest,
956        responder: HostControllerSetLocalNameResponder,
957    },
958    /// Start a pairing delegate to respond to pairing procedures. Only one pairing delegate can be
959    /// set at a time host-wide. Calling this while a delegate started by this method is already
960    /// active will drop and overwrite the existing delegate. If this is called while a delegate
961    /// started through other means is active, the new delegate will be closed immediately. Closing
962    /// a pairing delegate after it is set aborts all ongoing pairing procedures without accepting
963    /// and unsets the delegate.
964    ///
965    /// If no pairing delegate is set, all pairings will be rejected even if the peer connection was
966    /// initiated by the host.
967    ///
968    /// * error Returns `INTERNAL` if the operation failed (check logs).
969    /// * error Returns `MISSING_PARAMETERS` if `input_capability` or `output_capability` is
970    ///   missing.
971    StartPairingDelegate {
972        payload: HostControllerStartPairingDelegateRequest,
973        responder: HostControllerStartPairingDelegateResponder,
974    },
975    /// Stop a pairing delegate previously started by [`StartPairingDelegate`]. This will abort all
976    /// ongoing pairing procedures without accepting and unsets the delegate.
977    ///
978    /// This method can only stop a delegate started by [`StartPairingDelegate`], and will not stop
979    /// a delegate started through other means.
980    StopPairingDelegate { responder: HostControllerStopPairingDelegateResponder },
981    /// Set the active host's device class.
982    ///
983    /// * error Returns `INTERNAL` if the operation failed (check logs).
984    /// * error Returns `MISSING_PARAMETERS` if `device_class` is missing.
985    SetDeviceClass {
986        payload: HostControllerSetDeviceClassRequest,
987        responder: HostControllerSetDeviceClassResponder,
988    },
989    /// An interaction was received which does not match any known method.
990    #[non_exhaustive]
991    _UnknownMethod {
992        /// Ordinal of the method that was called.
993        ordinal: u64,
994        control_handle: HostControllerControlHandle,
995        method_type: fidl::MethodType,
996    },
997}
998
999impl HostControllerRequest {
1000    #[allow(irrefutable_let_patterns)]
1001    pub fn into_get_hosts(self) -> Option<(HostControllerGetHostsResponder)> {
1002        if let HostControllerRequest::GetHosts { responder } = self {
1003            Some((responder))
1004        } else {
1005            None
1006        }
1007    }
1008
1009    #[allow(irrefutable_let_patterns)]
1010    pub fn into_set_discoverability(
1011        self,
1012    ) -> Option<(HostControllerSetDiscoverabilityRequest, HostControllerSetDiscoverabilityResponder)>
1013    {
1014        if let HostControllerRequest::SetDiscoverability { payload, responder } = self {
1015            Some((payload, responder))
1016        } else {
1017            None
1018        }
1019    }
1020
1021    #[allow(irrefutable_let_patterns)]
1022    pub fn into_set_active_host(
1023        self,
1024    ) -> Option<(HostSelector, HostControllerSetActiveHostResponder)> {
1025        if let HostControllerRequest::SetActiveHost { payload, responder } = self {
1026            Some((payload, responder))
1027        } else {
1028            None
1029        }
1030    }
1031
1032    #[allow(irrefutable_let_patterns)]
1033    pub fn into_set_local_name(
1034        self,
1035    ) -> Option<(HostControllerSetLocalNameRequest, HostControllerSetLocalNameResponder)> {
1036        if let HostControllerRequest::SetLocalName { payload, responder } = self {
1037            Some((payload, responder))
1038        } else {
1039            None
1040        }
1041    }
1042
1043    #[allow(irrefutable_let_patterns)]
1044    pub fn into_start_pairing_delegate(
1045        self,
1046    ) -> Option<(
1047        HostControllerStartPairingDelegateRequest,
1048        HostControllerStartPairingDelegateResponder,
1049    )> {
1050        if let HostControllerRequest::StartPairingDelegate { payload, responder } = self {
1051            Some((payload, responder))
1052        } else {
1053            None
1054        }
1055    }
1056
1057    #[allow(irrefutable_let_patterns)]
1058    pub fn into_stop_pairing_delegate(
1059        self,
1060    ) -> Option<(HostControllerStopPairingDelegateResponder)> {
1061        if let HostControllerRequest::StopPairingDelegate { responder } = self {
1062            Some((responder))
1063        } else {
1064            None
1065        }
1066    }
1067
1068    #[allow(irrefutable_let_patterns)]
1069    pub fn into_set_device_class(
1070        self,
1071    ) -> Option<(HostControllerSetDeviceClassRequest, HostControllerSetDeviceClassResponder)> {
1072        if let HostControllerRequest::SetDeviceClass { payload, responder } = self {
1073            Some((payload, responder))
1074        } else {
1075            None
1076        }
1077    }
1078
1079    /// Name of the method defined in FIDL
1080    pub fn method_name(&self) -> &'static str {
1081        match *self {
1082            HostControllerRequest::GetHosts { .. } => "get_hosts",
1083            HostControllerRequest::SetDiscoverability { .. } => "set_discoverability",
1084            HostControllerRequest::SetActiveHost { .. } => "set_active_host",
1085            HostControllerRequest::SetLocalName { .. } => "set_local_name",
1086            HostControllerRequest::StartPairingDelegate { .. } => "start_pairing_delegate",
1087            HostControllerRequest::StopPairingDelegate { .. } => "stop_pairing_delegate",
1088            HostControllerRequest::SetDeviceClass { .. } => "set_device_class",
1089            HostControllerRequest::_UnknownMethod {
1090                method_type: fidl::MethodType::OneWay, ..
1091            } => "unknown one-way method",
1092            HostControllerRequest::_UnknownMethod {
1093                method_type: fidl::MethodType::TwoWay, ..
1094            } => "unknown two-way method",
1095        }
1096    }
1097}
1098
1099#[derive(Debug, Clone)]
1100pub struct HostControllerControlHandle {
1101    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1102}
1103
1104impl fidl::endpoints::ControlHandle for HostControllerControlHandle {
1105    fn shutdown(&self) {
1106        self.inner.shutdown()
1107    }
1108
1109    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1110        self.inner.shutdown_with_epitaph(status)
1111    }
1112
1113    fn is_closed(&self) -> bool {
1114        self.inner.channel().is_closed()
1115    }
1116    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1117        self.inner.channel().on_closed()
1118    }
1119
1120    #[cfg(target_os = "fuchsia")]
1121    fn signal_peer(
1122        &self,
1123        clear_mask: zx::Signals,
1124        set_mask: zx::Signals,
1125    ) -> Result<(), zx_status::Status> {
1126        use fidl::Peered;
1127        self.inner.channel().signal_peer(clear_mask, set_mask)
1128    }
1129}
1130
1131impl HostControllerControlHandle {}
1132
1133#[must_use = "FIDL methods require a response to be sent"]
1134#[derive(Debug)]
1135pub struct HostControllerGetHostsResponder {
1136    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1137    tx_id: u32,
1138}
1139
1140/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1141/// if the responder is dropped without sending a response, so that the client
1142/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1143impl std::ops::Drop for HostControllerGetHostsResponder {
1144    fn drop(&mut self) {
1145        self.control_handle.shutdown();
1146        // Safety: drops once, never accessed again
1147        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1148    }
1149}
1150
1151impl fidl::endpoints::Responder for HostControllerGetHostsResponder {
1152    type ControlHandle = HostControllerControlHandle;
1153
1154    fn control_handle(&self) -> &HostControllerControlHandle {
1155        &self.control_handle
1156    }
1157
1158    fn drop_without_shutdown(mut self) {
1159        // Safety: drops once, never accessed again due to mem::forget
1160        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1161        // Prevent Drop from running (which would shut down the channel)
1162        std::mem::forget(self);
1163    }
1164}
1165
1166impl HostControllerGetHostsResponder {
1167    /// Sends a response to the FIDL transaction.
1168    ///
1169    /// Sets the channel to shutdown if an error occurs.
1170    pub fn send(
1171        self,
1172        mut result: Result<&HostControllerGetHostsResponse, Error>,
1173    ) -> Result<(), fidl::Error> {
1174        let _result = self.send_raw(result);
1175        if _result.is_err() {
1176            self.control_handle.shutdown();
1177        }
1178        self.drop_without_shutdown();
1179        _result
1180    }
1181
1182    /// Similar to "send" but does not shutdown the channel if an error occurs.
1183    pub fn send_no_shutdown_on_err(
1184        self,
1185        mut result: Result<&HostControllerGetHostsResponse, Error>,
1186    ) -> Result<(), fidl::Error> {
1187        let _result = self.send_raw(result);
1188        self.drop_without_shutdown();
1189        _result
1190    }
1191
1192    fn send_raw(
1193        &self,
1194        mut result: Result<&HostControllerGetHostsResponse, Error>,
1195    ) -> Result<(), fidl::Error> {
1196        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1197            HostControllerGetHostsResponse,
1198            Error,
1199        >>(
1200            fidl::encoding::FlexibleResult::new(result),
1201            self.tx_id,
1202            0x167d2522684d453d,
1203            fidl::encoding::DynamicFlags::FLEXIBLE,
1204        )
1205    }
1206}
1207
1208#[must_use = "FIDL methods require a response to be sent"]
1209#[derive(Debug)]
1210pub struct HostControllerSetDiscoverabilityResponder {
1211    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1212    tx_id: u32,
1213}
1214
1215/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1216/// if the responder is dropped without sending a response, so that the client
1217/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1218impl std::ops::Drop for HostControllerSetDiscoverabilityResponder {
1219    fn drop(&mut self) {
1220        self.control_handle.shutdown();
1221        // Safety: drops once, never accessed again
1222        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1223    }
1224}
1225
1226impl fidl::endpoints::Responder for HostControllerSetDiscoverabilityResponder {
1227    type ControlHandle = HostControllerControlHandle;
1228
1229    fn control_handle(&self) -> &HostControllerControlHandle {
1230        &self.control_handle
1231    }
1232
1233    fn drop_without_shutdown(mut self) {
1234        // Safety: drops once, never accessed again due to mem::forget
1235        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1236        // Prevent Drop from running (which would shut down the channel)
1237        std::mem::forget(self);
1238    }
1239}
1240
1241impl HostControllerSetDiscoverabilityResponder {
1242    /// Sends a response to the FIDL transaction.
1243    ///
1244    /// Sets the channel to shutdown if an error occurs.
1245    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1246        let _result = self.send_raw(result);
1247        if _result.is_err() {
1248            self.control_handle.shutdown();
1249        }
1250        self.drop_without_shutdown();
1251        _result
1252    }
1253
1254    /// Similar to "send" but does not shutdown the channel if an error occurs.
1255    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1256        let _result = self.send_raw(result);
1257        self.drop_without_shutdown();
1258        _result
1259    }
1260
1261    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1262        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1263            fidl::encoding::EmptyStruct,
1264            Error,
1265        >>(
1266            fidl::encoding::FlexibleResult::new(result),
1267            self.tx_id,
1268            0x1e977b538b94b08b,
1269            fidl::encoding::DynamicFlags::FLEXIBLE,
1270        )
1271    }
1272}
1273
1274#[must_use = "FIDL methods require a response to be sent"]
1275#[derive(Debug)]
1276pub struct HostControllerSetActiveHostResponder {
1277    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1278    tx_id: u32,
1279}
1280
1281/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1282/// if the responder is dropped without sending a response, so that the client
1283/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1284impl std::ops::Drop for HostControllerSetActiveHostResponder {
1285    fn drop(&mut self) {
1286        self.control_handle.shutdown();
1287        // Safety: drops once, never accessed again
1288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1289    }
1290}
1291
1292impl fidl::endpoints::Responder for HostControllerSetActiveHostResponder {
1293    type ControlHandle = HostControllerControlHandle;
1294
1295    fn control_handle(&self) -> &HostControllerControlHandle {
1296        &self.control_handle
1297    }
1298
1299    fn drop_without_shutdown(mut self) {
1300        // Safety: drops once, never accessed again due to mem::forget
1301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1302        // Prevent Drop from running (which would shut down the channel)
1303        std::mem::forget(self);
1304    }
1305}
1306
1307impl HostControllerSetActiveHostResponder {
1308    /// Sends a response to the FIDL transaction.
1309    ///
1310    /// Sets the channel to shutdown if an error occurs.
1311    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1312        let _result = self.send_raw(result);
1313        if _result.is_err() {
1314            self.control_handle.shutdown();
1315        }
1316        self.drop_without_shutdown();
1317        _result
1318    }
1319
1320    /// Similar to "send" but does not shutdown the channel if an error occurs.
1321    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1322        let _result = self.send_raw(result);
1323        self.drop_without_shutdown();
1324        _result
1325    }
1326
1327    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1328        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1329            fidl::encoding::EmptyStruct,
1330            Error,
1331        >>(
1332            fidl::encoding::FlexibleResult::new(result),
1333            self.tx_id,
1334            0x1d3f8ba8b30347de,
1335            fidl::encoding::DynamicFlags::FLEXIBLE,
1336        )
1337    }
1338}
1339
1340#[must_use = "FIDL methods require a response to be sent"]
1341#[derive(Debug)]
1342pub struct HostControllerSetLocalNameResponder {
1343    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1344    tx_id: u32,
1345}
1346
1347/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1348/// if the responder is dropped without sending a response, so that the client
1349/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1350impl std::ops::Drop for HostControllerSetLocalNameResponder {
1351    fn drop(&mut self) {
1352        self.control_handle.shutdown();
1353        // Safety: drops once, never accessed again
1354        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1355    }
1356}
1357
1358impl fidl::endpoints::Responder for HostControllerSetLocalNameResponder {
1359    type ControlHandle = HostControllerControlHandle;
1360
1361    fn control_handle(&self) -> &HostControllerControlHandle {
1362        &self.control_handle
1363    }
1364
1365    fn drop_without_shutdown(mut self) {
1366        // Safety: drops once, never accessed again due to mem::forget
1367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368        // Prevent Drop from running (which would shut down the channel)
1369        std::mem::forget(self);
1370    }
1371}
1372
1373impl HostControllerSetLocalNameResponder {
1374    /// Sends a response to the FIDL transaction.
1375    ///
1376    /// Sets the channel to shutdown if an error occurs.
1377    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1378        let _result = self.send_raw(result);
1379        if _result.is_err() {
1380            self.control_handle.shutdown();
1381        }
1382        self.drop_without_shutdown();
1383        _result
1384    }
1385
1386    /// Similar to "send" but does not shutdown the channel if an error occurs.
1387    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1388        let _result = self.send_raw(result);
1389        self.drop_without_shutdown();
1390        _result
1391    }
1392
1393    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1394        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1395            fidl::encoding::EmptyStruct,
1396            Error,
1397        >>(
1398            fidl::encoding::FlexibleResult::new(result),
1399            self.tx_id,
1400            0x357714c7aa252336,
1401            fidl::encoding::DynamicFlags::FLEXIBLE,
1402        )
1403    }
1404}
1405
1406#[must_use = "FIDL methods require a response to be sent"]
1407#[derive(Debug)]
1408pub struct HostControllerStartPairingDelegateResponder {
1409    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1410    tx_id: u32,
1411}
1412
1413/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1414/// if the responder is dropped without sending a response, so that the client
1415/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1416impl std::ops::Drop for HostControllerStartPairingDelegateResponder {
1417    fn drop(&mut self) {
1418        self.control_handle.shutdown();
1419        // Safety: drops once, never accessed again
1420        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1421    }
1422}
1423
1424impl fidl::endpoints::Responder for HostControllerStartPairingDelegateResponder {
1425    type ControlHandle = HostControllerControlHandle;
1426
1427    fn control_handle(&self) -> &HostControllerControlHandle {
1428        &self.control_handle
1429    }
1430
1431    fn drop_without_shutdown(mut self) {
1432        // Safety: drops once, never accessed again due to mem::forget
1433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1434        // Prevent Drop from running (which would shut down the channel)
1435        std::mem::forget(self);
1436    }
1437}
1438
1439impl HostControllerStartPairingDelegateResponder {
1440    /// Sends a response to the FIDL transaction.
1441    ///
1442    /// Sets the channel to shutdown if an error occurs.
1443    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1444        let _result = self.send_raw(result);
1445        if _result.is_err() {
1446            self.control_handle.shutdown();
1447        }
1448        self.drop_without_shutdown();
1449        _result
1450    }
1451
1452    /// Similar to "send" but does not shutdown the channel if an error occurs.
1453    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1454        let _result = self.send_raw(result);
1455        self.drop_without_shutdown();
1456        _result
1457    }
1458
1459    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1460        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1461            fidl::encoding::EmptyStruct,
1462            Error,
1463        >>(
1464            fidl::encoding::FlexibleResult::new(result),
1465            self.tx_id,
1466            0x155c20cb1b9c1ed2,
1467            fidl::encoding::DynamicFlags::FLEXIBLE,
1468        )
1469    }
1470}
1471
1472#[must_use = "FIDL methods require a response to be sent"]
1473#[derive(Debug)]
1474pub struct HostControllerStopPairingDelegateResponder {
1475    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1476    tx_id: u32,
1477}
1478
1479/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1480/// if the responder is dropped without sending a response, so that the client
1481/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1482impl std::ops::Drop for HostControllerStopPairingDelegateResponder {
1483    fn drop(&mut self) {
1484        self.control_handle.shutdown();
1485        // Safety: drops once, never accessed again
1486        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1487    }
1488}
1489
1490impl fidl::endpoints::Responder for HostControllerStopPairingDelegateResponder {
1491    type ControlHandle = HostControllerControlHandle;
1492
1493    fn control_handle(&self) -> &HostControllerControlHandle {
1494        &self.control_handle
1495    }
1496
1497    fn drop_without_shutdown(mut self) {
1498        // Safety: drops once, never accessed again due to mem::forget
1499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1500        // Prevent Drop from running (which would shut down the channel)
1501        std::mem::forget(self);
1502    }
1503}
1504
1505impl HostControllerStopPairingDelegateResponder {
1506    /// Sends a response to the FIDL transaction.
1507    ///
1508    /// Sets the channel to shutdown if an error occurs.
1509    pub fn send(self) -> Result<(), fidl::Error> {
1510        let _result = self.send_raw();
1511        if _result.is_err() {
1512            self.control_handle.shutdown();
1513        }
1514        self.drop_without_shutdown();
1515        _result
1516    }
1517
1518    /// Similar to "send" but does not shutdown the channel if an error occurs.
1519    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1520        let _result = self.send_raw();
1521        self.drop_without_shutdown();
1522        _result
1523    }
1524
1525    fn send_raw(&self) -> Result<(), fidl::Error> {
1526        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
1527            fidl::encoding::Flexible::new(()),
1528            self.tx_id,
1529            0x5caaee1192a8172c,
1530            fidl::encoding::DynamicFlags::FLEXIBLE,
1531        )
1532    }
1533}
1534
1535#[must_use = "FIDL methods require a response to be sent"]
1536#[derive(Debug)]
1537pub struct HostControllerSetDeviceClassResponder {
1538    control_handle: std::mem::ManuallyDrop<HostControllerControlHandle>,
1539    tx_id: u32,
1540}
1541
1542/// Set the the channel to be shutdown (see [`HostControllerControlHandle::shutdown`])
1543/// if the responder is dropped without sending a response, so that the client
1544/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1545impl std::ops::Drop for HostControllerSetDeviceClassResponder {
1546    fn drop(&mut self) {
1547        self.control_handle.shutdown();
1548        // Safety: drops once, never accessed again
1549        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1550    }
1551}
1552
1553impl fidl::endpoints::Responder for HostControllerSetDeviceClassResponder {
1554    type ControlHandle = HostControllerControlHandle;
1555
1556    fn control_handle(&self) -> &HostControllerControlHandle {
1557        &self.control_handle
1558    }
1559
1560    fn drop_without_shutdown(mut self) {
1561        // Safety: drops once, never accessed again due to mem::forget
1562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1563        // Prevent Drop from running (which would shut down the channel)
1564        std::mem::forget(self);
1565    }
1566}
1567
1568impl HostControllerSetDeviceClassResponder {
1569    /// Sends a response to the FIDL transaction.
1570    ///
1571    /// Sets the channel to shutdown if an error occurs.
1572    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1573        let _result = self.send_raw(result);
1574        if _result.is_err() {
1575            self.control_handle.shutdown();
1576        }
1577        self.drop_without_shutdown();
1578        _result
1579    }
1580
1581    /// Similar to "send" but does not shutdown the channel if an error occurs.
1582    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1583        let _result = self.send_raw(result);
1584        self.drop_without_shutdown();
1585        _result
1586    }
1587
1588    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1589        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1590            fidl::encoding::EmptyStruct,
1591            Error,
1592        >>(
1593            fidl::encoding::FlexibleResult::new(result),
1594            self.tx_id,
1595            0x34dcc9ed479692dc,
1596            fidl::encoding::DynamicFlags::FLEXIBLE,
1597        )
1598    }
1599}
1600
1601#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1602pub struct PeerControllerMarker;
1603
1604impl fidl::endpoints::ProtocolMarker for PeerControllerMarker {
1605    type Proxy = PeerControllerProxy;
1606    type RequestStream = PeerControllerRequestStream;
1607    #[cfg(target_os = "fuchsia")]
1608    type SynchronousProxy = PeerControllerSynchronousProxy;
1609
1610    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.affordances.PeerController";
1611}
1612impl fidl::endpoints::DiscoverableProtocolMarker for PeerControllerMarker {}
1613pub type PeerControllerGetKnownPeersResult = Result<PeerControllerGetKnownPeersResponse, Error>;
1614pub type PeerControllerConnectPeerResult = Result<(), Error>;
1615pub type PeerControllerDisconnectPeerResult = Result<(), Error>;
1616pub type PeerControllerPairResult = Result<(), Error>;
1617pub type PeerControllerForgetPeerResult = Result<(), Error>;
1618pub type PeerControllerSetDiscoveryResult = Result<(), Error>;
1619
1620pub trait PeerControllerProxyInterface: Send + Sync {
1621    type GetKnownPeersResponseFut: std::future::Future<Output = Result<PeerControllerGetKnownPeersResult, fidl::Error>>
1622        + Send;
1623    fn r#get_known_peers(&self) -> Self::GetKnownPeersResponseFut;
1624    type ConnectPeerResponseFut: std::future::Future<Output = Result<PeerControllerConnectPeerResult, fidl::Error>>
1625        + Send;
1626    fn r#connect_peer(&self, payload: &PeerSelector) -> Self::ConnectPeerResponseFut;
1627    type DisconnectPeerResponseFut: std::future::Future<Output = Result<PeerControllerDisconnectPeerResult, fidl::Error>>
1628        + Send;
1629    fn r#disconnect_peer(&self, payload: &PeerSelector) -> Self::DisconnectPeerResponseFut;
1630    type PairResponseFut: std::future::Future<Output = Result<PeerControllerPairResult, fidl::Error>>
1631        + Send;
1632    fn r#pair(&self, payload: &PeerControllerPairRequest) -> Self::PairResponseFut;
1633    type ForgetPeerResponseFut: std::future::Future<Output = Result<PeerControllerForgetPeerResult, fidl::Error>>
1634        + Send;
1635    fn r#forget_peer(&self, payload: &PeerSelector) -> Self::ForgetPeerResponseFut;
1636    type SetDiscoveryResponseFut: std::future::Future<Output = Result<PeerControllerSetDiscoveryResult, fidl::Error>>
1637        + Send;
1638    fn r#set_discovery(
1639        &self,
1640        payload: &PeerControllerSetDiscoveryRequest,
1641    ) -> Self::SetDiscoveryResponseFut;
1642}
1643#[derive(Debug)]
1644#[cfg(target_os = "fuchsia")]
1645pub struct PeerControllerSynchronousProxy {
1646    client: fidl::client::sync::Client,
1647}
1648
1649#[cfg(target_os = "fuchsia")]
1650impl fidl::endpoints::SynchronousProxy for PeerControllerSynchronousProxy {
1651    type Proxy = PeerControllerProxy;
1652    type Protocol = PeerControllerMarker;
1653
1654    fn from_channel(inner: fidl::Channel) -> Self {
1655        Self::new(inner)
1656    }
1657
1658    fn into_channel(self) -> fidl::Channel {
1659        self.client.into_channel()
1660    }
1661
1662    fn as_channel(&self) -> &fidl::Channel {
1663        self.client.as_channel()
1664    }
1665}
1666
1667#[cfg(target_os = "fuchsia")]
1668impl PeerControllerSynchronousProxy {
1669    pub fn new(channel: fidl::Channel) -> Self {
1670        Self { client: fidl::client::sync::Client::new(channel) }
1671    }
1672
1673    pub fn into_channel(self) -> fidl::Channel {
1674        self.client.into_channel()
1675    }
1676
1677    /// Waits until an event arrives and returns it. It is safe for other
1678    /// threads to make concurrent requests while waiting for an event.
1679    pub fn wait_for_event(
1680        &self,
1681        deadline: zx::MonotonicInstant,
1682    ) -> Result<PeerControllerEvent, fidl::Error> {
1683        PeerControllerEvent::decode(self.client.wait_for_event::<PeerControllerMarker>(deadline)?)
1684    }
1685
1686    /// Get a list of discovered peers.
1687    ///
1688    /// * error Returns `INTERNAL` if the operation failed (check logs).
1689    pub fn r#get_known_peers(
1690        &self,
1691        ___deadline: zx::MonotonicInstant,
1692    ) -> Result<PeerControllerGetKnownPeersResult, fidl::Error> {
1693        let _response = self.client.send_query::<
1694            fidl::encoding::EmptyPayload,
1695            fidl::encoding::FlexibleResultType<PeerControllerGetKnownPeersResponse, Error>,
1696            PeerControllerMarker,
1697        >(
1698            (),
1699            0x482cf3745bab65f6,
1700            fidl::encoding::DynamicFlags::FLEXIBLE,
1701            ___deadline,
1702        )?
1703        .into_result::<PeerControllerMarker>("get_known_peers")?;
1704        Ok(_response.map(|x| x))
1705    }
1706
1707    /// Connect to a peer.
1708    ///
1709    /// * error Returns `INTERNAL` if the operation failed (check logs).
1710    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1711    pub fn r#connect_peer(
1712        &self,
1713        mut payload: &PeerSelector,
1714        ___deadline: zx::MonotonicInstant,
1715    ) -> Result<PeerControllerConnectPeerResult, fidl::Error> {
1716        let _response = self.client.send_query::<
1717            PeerSelector,
1718            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1719            PeerControllerMarker,
1720        >(
1721            payload,
1722            0x13fbb990835acf66,
1723            fidl::encoding::DynamicFlags::FLEXIBLE,
1724            ___deadline,
1725        )?
1726        .into_result::<PeerControllerMarker>("connect_peer")?;
1727        Ok(_response.map(|x| x))
1728    }
1729
1730    /// Disconnect all logical links (BR/EDR & LE) to a peer.
1731    ///
1732    /// * error Returns `INTERNAL` if the operation failed (check logs).
1733    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1734    pub fn r#disconnect_peer(
1735        &self,
1736        mut payload: &PeerSelector,
1737        ___deadline: zx::MonotonicInstant,
1738    ) -> Result<PeerControllerDisconnectPeerResult, fidl::Error> {
1739        let _response = self.client.send_query::<
1740            PeerSelector,
1741            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1742            PeerControllerMarker,
1743        >(
1744            payload,
1745            0x5f9992f066c664ad,
1746            fidl::encoding::DynamicFlags::FLEXIBLE,
1747            ___deadline,
1748        )?
1749        .into_result::<PeerControllerMarker>("disconnect_peer")?;
1750        Ok(_response.map(|x| x))
1751    }
1752
1753    /// Initiate pairing with a peer.
1754    ///
1755    /// * error Returns `INTERNAL` if the operation failed (check logs).
1756    /// * error Returns `MISSING_PARAMETERS` if `selector` or `options` is missing, or if `selector`
1757    ///   does not contain a peer ID.
1758    pub fn r#pair(
1759        &self,
1760        mut payload: &PeerControllerPairRequest,
1761        ___deadline: zx::MonotonicInstant,
1762    ) -> Result<PeerControllerPairResult, fidl::Error> {
1763        let _response = self.client.send_query::<
1764            PeerControllerPairRequest,
1765            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1766            PeerControllerMarker,
1767        >(
1768            payload,
1769            0x1991671d4d7eff26,
1770            fidl::encoding::DynamicFlags::FLEXIBLE,
1771            ___deadline,
1772        )?
1773        .into_result::<PeerControllerMarker>("pair")?;
1774        Ok(_response.map(|x| x))
1775    }
1776
1777    /// Forget a peer and all its bonding information.
1778    ///
1779    /// * error Returns `INTERNAL` if the operation failed (check logs).
1780    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1781    pub fn r#forget_peer(
1782        &self,
1783        mut payload: &PeerSelector,
1784        ___deadline: zx::MonotonicInstant,
1785    ) -> Result<PeerControllerForgetPeerResult, fidl::Error> {
1786        let _response = self.client.send_query::<
1787            PeerSelector,
1788            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1789            PeerControllerMarker,
1790        >(
1791            payload,
1792            0x26011dbbd834f8c6,
1793            fidl::encoding::DynamicFlags::FLEXIBLE,
1794            ___deadline,
1795        )?
1796        .into_result::<PeerControllerMarker>("forget_peer")?;
1797        Ok(_response.map(|x| x))
1798    }
1799
1800    /// Set discovery state.
1801    ///
1802    /// * error Returns `INTERNAL` if the operation failed (check logs).
1803    /// * error Returns `MISSING_PARAMETERS` if `discovery` is missing.
1804    pub fn r#set_discovery(
1805        &self,
1806        mut payload: &PeerControllerSetDiscoveryRequest,
1807        ___deadline: zx::MonotonicInstant,
1808    ) -> Result<PeerControllerSetDiscoveryResult, fidl::Error> {
1809        let _response = self.client.send_query::<
1810            PeerControllerSetDiscoveryRequest,
1811            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
1812            PeerControllerMarker,
1813        >(
1814            payload,
1815            0x3269624c9e1d6ab3,
1816            fidl::encoding::DynamicFlags::FLEXIBLE,
1817            ___deadline,
1818        )?
1819        .into_result::<PeerControllerMarker>("set_discovery")?;
1820        Ok(_response.map(|x| x))
1821    }
1822}
1823
1824#[cfg(target_os = "fuchsia")]
1825impl From<PeerControllerSynchronousProxy> for zx::NullableHandle {
1826    fn from(value: PeerControllerSynchronousProxy) -> Self {
1827        value.into_channel().into()
1828    }
1829}
1830
1831#[cfg(target_os = "fuchsia")]
1832impl From<fidl::Channel> for PeerControllerSynchronousProxy {
1833    fn from(value: fidl::Channel) -> Self {
1834        Self::new(value)
1835    }
1836}
1837
1838#[cfg(target_os = "fuchsia")]
1839impl fidl::endpoints::FromClient for PeerControllerSynchronousProxy {
1840    type Protocol = PeerControllerMarker;
1841
1842    fn from_client(value: fidl::endpoints::ClientEnd<PeerControllerMarker>) -> Self {
1843        Self::new(value.into_channel())
1844    }
1845}
1846
1847#[derive(Debug, Clone)]
1848pub struct PeerControllerProxy {
1849    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1850}
1851
1852impl fidl::endpoints::Proxy for PeerControllerProxy {
1853    type Protocol = PeerControllerMarker;
1854
1855    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1856        Self::new(inner)
1857    }
1858
1859    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1860        self.client.into_channel().map_err(|client| Self { client })
1861    }
1862
1863    fn as_channel(&self) -> &::fidl::AsyncChannel {
1864        self.client.as_channel()
1865    }
1866}
1867
1868impl PeerControllerProxy {
1869    /// Create a new Proxy for fuchsia.bluetooth.affordances/PeerController.
1870    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1871        let protocol_name = <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1872        Self { client: fidl::client::Client::new(channel, protocol_name) }
1873    }
1874
1875    /// Get a Stream of events from the remote end of the protocol.
1876    ///
1877    /// # Panics
1878    ///
1879    /// Panics if the event stream was already taken.
1880    pub fn take_event_stream(&self) -> PeerControllerEventStream {
1881        PeerControllerEventStream { event_receiver: self.client.take_event_receiver() }
1882    }
1883
1884    /// Get a list of discovered peers.
1885    ///
1886    /// * error Returns `INTERNAL` if the operation failed (check logs).
1887    pub fn r#get_known_peers(
1888        &self,
1889    ) -> fidl::client::QueryResponseFut<
1890        PeerControllerGetKnownPeersResult,
1891        fidl::encoding::DefaultFuchsiaResourceDialect,
1892    > {
1893        PeerControllerProxyInterface::r#get_known_peers(self)
1894    }
1895
1896    /// Connect to a peer.
1897    ///
1898    /// * error Returns `INTERNAL` if the operation failed (check logs).
1899    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1900    pub fn r#connect_peer(
1901        &self,
1902        mut payload: &PeerSelector,
1903    ) -> fidl::client::QueryResponseFut<
1904        PeerControllerConnectPeerResult,
1905        fidl::encoding::DefaultFuchsiaResourceDialect,
1906    > {
1907        PeerControllerProxyInterface::r#connect_peer(self, payload)
1908    }
1909
1910    /// Disconnect all logical links (BR/EDR & LE) to a peer.
1911    ///
1912    /// * error Returns `INTERNAL` if the operation failed (check logs).
1913    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1914    pub fn r#disconnect_peer(
1915        &self,
1916        mut payload: &PeerSelector,
1917    ) -> fidl::client::QueryResponseFut<
1918        PeerControllerDisconnectPeerResult,
1919        fidl::encoding::DefaultFuchsiaResourceDialect,
1920    > {
1921        PeerControllerProxyInterface::r#disconnect_peer(self, payload)
1922    }
1923
1924    /// Initiate pairing with a peer.
1925    ///
1926    /// * error Returns `INTERNAL` if the operation failed (check logs).
1927    /// * error Returns `MISSING_PARAMETERS` if `selector` or `options` is missing, or if `selector`
1928    ///   does not contain a peer ID.
1929    pub fn r#pair(
1930        &self,
1931        mut payload: &PeerControllerPairRequest,
1932    ) -> fidl::client::QueryResponseFut<
1933        PeerControllerPairResult,
1934        fidl::encoding::DefaultFuchsiaResourceDialect,
1935    > {
1936        PeerControllerProxyInterface::r#pair(self, payload)
1937    }
1938
1939    /// Forget a peer and all its bonding information.
1940    ///
1941    /// * error Returns `INTERNAL` if the operation failed (check logs).
1942    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
1943    pub fn r#forget_peer(
1944        &self,
1945        mut payload: &PeerSelector,
1946    ) -> fidl::client::QueryResponseFut<
1947        PeerControllerForgetPeerResult,
1948        fidl::encoding::DefaultFuchsiaResourceDialect,
1949    > {
1950        PeerControllerProxyInterface::r#forget_peer(self, payload)
1951    }
1952
1953    /// Set discovery state.
1954    ///
1955    /// * error Returns `INTERNAL` if the operation failed (check logs).
1956    /// * error Returns `MISSING_PARAMETERS` if `discovery` is missing.
1957    pub fn r#set_discovery(
1958        &self,
1959        mut payload: &PeerControllerSetDiscoveryRequest,
1960    ) -> fidl::client::QueryResponseFut<
1961        PeerControllerSetDiscoveryResult,
1962        fidl::encoding::DefaultFuchsiaResourceDialect,
1963    > {
1964        PeerControllerProxyInterface::r#set_discovery(self, payload)
1965    }
1966}
1967
1968impl PeerControllerProxyInterface for PeerControllerProxy {
1969    type GetKnownPeersResponseFut = fidl::client::QueryResponseFut<
1970        PeerControllerGetKnownPeersResult,
1971        fidl::encoding::DefaultFuchsiaResourceDialect,
1972    >;
1973    fn r#get_known_peers(&self) -> Self::GetKnownPeersResponseFut {
1974        fn _decode(
1975            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1976        ) -> Result<PeerControllerGetKnownPeersResult, fidl::Error> {
1977            let _response = fidl::client::decode_transaction_body::<
1978                fidl::encoding::FlexibleResultType<PeerControllerGetKnownPeersResponse, Error>,
1979                fidl::encoding::DefaultFuchsiaResourceDialect,
1980                0x482cf3745bab65f6,
1981            >(_buf?)?
1982            .into_result::<PeerControllerMarker>("get_known_peers")?;
1983            Ok(_response.map(|x| x))
1984        }
1985        self.client.send_query_and_decode::<
1986            fidl::encoding::EmptyPayload,
1987            PeerControllerGetKnownPeersResult,
1988        >(
1989            (),
1990            0x482cf3745bab65f6,
1991            fidl::encoding::DynamicFlags::FLEXIBLE,
1992            _decode,
1993        )
1994    }
1995
1996    type ConnectPeerResponseFut = fidl::client::QueryResponseFut<
1997        PeerControllerConnectPeerResult,
1998        fidl::encoding::DefaultFuchsiaResourceDialect,
1999    >;
2000    fn r#connect_peer(&self, mut payload: &PeerSelector) -> Self::ConnectPeerResponseFut {
2001        fn _decode(
2002            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2003        ) -> Result<PeerControllerConnectPeerResult, fidl::Error> {
2004            let _response = fidl::client::decode_transaction_body::<
2005                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2006                fidl::encoding::DefaultFuchsiaResourceDialect,
2007                0x13fbb990835acf66,
2008            >(_buf?)?
2009            .into_result::<PeerControllerMarker>("connect_peer")?;
2010            Ok(_response.map(|x| x))
2011        }
2012        self.client.send_query_and_decode::<PeerSelector, PeerControllerConnectPeerResult>(
2013            payload,
2014            0x13fbb990835acf66,
2015            fidl::encoding::DynamicFlags::FLEXIBLE,
2016            _decode,
2017        )
2018    }
2019
2020    type DisconnectPeerResponseFut = fidl::client::QueryResponseFut<
2021        PeerControllerDisconnectPeerResult,
2022        fidl::encoding::DefaultFuchsiaResourceDialect,
2023    >;
2024    fn r#disconnect_peer(&self, mut payload: &PeerSelector) -> Self::DisconnectPeerResponseFut {
2025        fn _decode(
2026            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2027        ) -> Result<PeerControllerDisconnectPeerResult, fidl::Error> {
2028            let _response = fidl::client::decode_transaction_body::<
2029                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2030                fidl::encoding::DefaultFuchsiaResourceDialect,
2031                0x5f9992f066c664ad,
2032            >(_buf?)?
2033            .into_result::<PeerControllerMarker>("disconnect_peer")?;
2034            Ok(_response.map(|x| x))
2035        }
2036        self.client.send_query_and_decode::<PeerSelector, PeerControllerDisconnectPeerResult>(
2037            payload,
2038            0x5f9992f066c664ad,
2039            fidl::encoding::DynamicFlags::FLEXIBLE,
2040            _decode,
2041        )
2042    }
2043
2044    type PairResponseFut = fidl::client::QueryResponseFut<
2045        PeerControllerPairResult,
2046        fidl::encoding::DefaultFuchsiaResourceDialect,
2047    >;
2048    fn r#pair(&self, mut payload: &PeerControllerPairRequest) -> Self::PairResponseFut {
2049        fn _decode(
2050            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2051        ) -> Result<PeerControllerPairResult, fidl::Error> {
2052            let _response = fidl::client::decode_transaction_body::<
2053                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2054                fidl::encoding::DefaultFuchsiaResourceDialect,
2055                0x1991671d4d7eff26,
2056            >(_buf?)?
2057            .into_result::<PeerControllerMarker>("pair")?;
2058            Ok(_response.map(|x| x))
2059        }
2060        self.client.send_query_and_decode::<PeerControllerPairRequest, PeerControllerPairResult>(
2061            payload,
2062            0x1991671d4d7eff26,
2063            fidl::encoding::DynamicFlags::FLEXIBLE,
2064            _decode,
2065        )
2066    }
2067
2068    type ForgetPeerResponseFut = fidl::client::QueryResponseFut<
2069        PeerControllerForgetPeerResult,
2070        fidl::encoding::DefaultFuchsiaResourceDialect,
2071    >;
2072    fn r#forget_peer(&self, mut payload: &PeerSelector) -> Self::ForgetPeerResponseFut {
2073        fn _decode(
2074            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2075        ) -> Result<PeerControllerForgetPeerResult, fidl::Error> {
2076            let _response = fidl::client::decode_transaction_body::<
2077                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2078                fidl::encoding::DefaultFuchsiaResourceDialect,
2079                0x26011dbbd834f8c6,
2080            >(_buf?)?
2081            .into_result::<PeerControllerMarker>("forget_peer")?;
2082            Ok(_response.map(|x| x))
2083        }
2084        self.client.send_query_and_decode::<PeerSelector, PeerControllerForgetPeerResult>(
2085            payload,
2086            0x26011dbbd834f8c6,
2087            fidl::encoding::DynamicFlags::FLEXIBLE,
2088            _decode,
2089        )
2090    }
2091
2092    type SetDiscoveryResponseFut = fidl::client::QueryResponseFut<
2093        PeerControllerSetDiscoveryResult,
2094        fidl::encoding::DefaultFuchsiaResourceDialect,
2095    >;
2096    fn r#set_discovery(
2097        &self,
2098        mut payload: &PeerControllerSetDiscoveryRequest,
2099    ) -> Self::SetDiscoveryResponseFut {
2100        fn _decode(
2101            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2102        ) -> Result<PeerControllerSetDiscoveryResult, fidl::Error> {
2103            let _response = fidl::client::decode_transaction_body::<
2104                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, Error>,
2105                fidl::encoding::DefaultFuchsiaResourceDialect,
2106                0x3269624c9e1d6ab3,
2107            >(_buf?)?
2108            .into_result::<PeerControllerMarker>("set_discovery")?;
2109            Ok(_response.map(|x| x))
2110        }
2111        self.client.send_query_and_decode::<
2112            PeerControllerSetDiscoveryRequest,
2113            PeerControllerSetDiscoveryResult,
2114        >(
2115            payload,
2116            0x3269624c9e1d6ab3,
2117            fidl::encoding::DynamicFlags::FLEXIBLE,
2118            _decode,
2119        )
2120    }
2121}
2122
2123pub struct PeerControllerEventStream {
2124    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2125}
2126
2127impl std::marker::Unpin for PeerControllerEventStream {}
2128
2129impl futures::stream::FusedStream for PeerControllerEventStream {
2130    fn is_terminated(&self) -> bool {
2131        self.event_receiver.is_terminated()
2132    }
2133}
2134
2135impl futures::Stream for PeerControllerEventStream {
2136    type Item = Result<PeerControllerEvent, fidl::Error>;
2137
2138    fn poll_next(
2139        mut self: std::pin::Pin<&mut Self>,
2140        cx: &mut std::task::Context<'_>,
2141    ) -> std::task::Poll<Option<Self::Item>> {
2142        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2143            &mut self.event_receiver,
2144            cx
2145        )?) {
2146            Some(buf) => std::task::Poll::Ready(Some(PeerControllerEvent::decode(buf))),
2147            None => std::task::Poll::Ready(None),
2148        }
2149    }
2150}
2151
2152#[derive(Debug)]
2153pub enum PeerControllerEvent {
2154    #[non_exhaustive]
2155    _UnknownEvent {
2156        /// Ordinal of the event that was sent.
2157        ordinal: u64,
2158    },
2159}
2160
2161impl PeerControllerEvent {
2162    /// Decodes a message buffer as a [`PeerControllerEvent`].
2163    fn decode(
2164        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2165    ) -> Result<PeerControllerEvent, fidl::Error> {
2166        let (bytes, _handles) = buf.split_mut();
2167        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2168        debug_assert_eq!(tx_header.tx_id, 0);
2169        match tx_header.ordinal {
2170            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2171                Ok(PeerControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2172            }
2173            _ => Err(fidl::Error::UnknownOrdinal {
2174                ordinal: tx_header.ordinal,
2175                protocol_name:
2176                    <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2177            }),
2178        }
2179    }
2180}
2181
2182/// A Stream of incoming requests for fuchsia.bluetooth.affordances/PeerController.
2183pub struct PeerControllerRequestStream {
2184    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2185    is_terminated: bool,
2186}
2187
2188impl std::marker::Unpin for PeerControllerRequestStream {}
2189
2190impl futures::stream::FusedStream for PeerControllerRequestStream {
2191    fn is_terminated(&self) -> bool {
2192        self.is_terminated
2193    }
2194}
2195
2196impl fidl::endpoints::RequestStream for PeerControllerRequestStream {
2197    type Protocol = PeerControllerMarker;
2198    type ControlHandle = PeerControllerControlHandle;
2199
2200    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2201        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2202    }
2203
2204    fn control_handle(&self) -> Self::ControlHandle {
2205        PeerControllerControlHandle { inner: self.inner.clone() }
2206    }
2207
2208    fn into_inner(
2209        self,
2210    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2211    {
2212        (self.inner, self.is_terminated)
2213    }
2214
2215    fn from_inner(
2216        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2217        is_terminated: bool,
2218    ) -> Self {
2219        Self { inner, is_terminated }
2220    }
2221}
2222
2223impl futures::Stream for PeerControllerRequestStream {
2224    type Item = Result<PeerControllerRequest, fidl::Error>;
2225
2226    fn poll_next(
2227        mut self: std::pin::Pin<&mut Self>,
2228        cx: &mut std::task::Context<'_>,
2229    ) -> std::task::Poll<Option<Self::Item>> {
2230        let this = &mut *self;
2231        if this.inner.check_shutdown(cx) {
2232            this.is_terminated = true;
2233            return std::task::Poll::Ready(None);
2234        }
2235        if this.is_terminated {
2236            panic!("polled PeerControllerRequestStream after completion");
2237        }
2238        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2239            |bytes, handles| {
2240                match this.inner.channel().read_etc(cx, bytes, handles) {
2241                    std::task::Poll::Ready(Ok(())) => {}
2242                    std::task::Poll::Pending => return std::task::Poll::Pending,
2243                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2244                        this.is_terminated = true;
2245                        return std::task::Poll::Ready(None);
2246                    }
2247                    std::task::Poll::Ready(Err(e)) => {
2248                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2249                            e.into(),
2250                        ))));
2251                    }
2252                }
2253
2254                // A message has been received from the channel
2255                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2256
2257                std::task::Poll::Ready(Some(match header.ordinal {
2258                    0x482cf3745bab65f6 => {
2259                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2260                        let mut req = fidl::new_empty!(
2261                            fidl::encoding::EmptyPayload,
2262                            fidl::encoding::DefaultFuchsiaResourceDialect
2263                        );
2264                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2265                        let control_handle =
2266                            PeerControllerControlHandle { inner: this.inner.clone() };
2267                        Ok(PeerControllerRequest::GetKnownPeers {
2268                            responder: PeerControllerGetKnownPeersResponder {
2269                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2270                                tx_id: header.tx_id,
2271                            },
2272                        })
2273                    }
2274                    0x13fbb990835acf66 => {
2275                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2276                        let mut req = fidl::new_empty!(
2277                            PeerSelector,
2278                            fidl::encoding::DefaultFuchsiaResourceDialect
2279                        );
2280                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSelector>(&header, _body_bytes, handles, &mut req)?;
2281                        let control_handle =
2282                            PeerControllerControlHandle { inner: this.inner.clone() };
2283                        Ok(PeerControllerRequest::ConnectPeer {
2284                            payload: req,
2285                            responder: PeerControllerConnectPeerResponder {
2286                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2287                                tx_id: header.tx_id,
2288                            },
2289                        })
2290                    }
2291                    0x5f9992f066c664ad => {
2292                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2293                        let mut req = fidl::new_empty!(
2294                            PeerSelector,
2295                            fidl::encoding::DefaultFuchsiaResourceDialect
2296                        );
2297                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSelector>(&header, _body_bytes, handles, &mut req)?;
2298                        let control_handle =
2299                            PeerControllerControlHandle { inner: this.inner.clone() };
2300                        Ok(PeerControllerRequest::DisconnectPeer {
2301                            payload: req,
2302                            responder: PeerControllerDisconnectPeerResponder {
2303                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2304                                tx_id: header.tx_id,
2305                            },
2306                        })
2307                    }
2308                    0x1991671d4d7eff26 => {
2309                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2310                        let mut req = fidl::new_empty!(
2311                            PeerControllerPairRequest,
2312                            fidl::encoding::DefaultFuchsiaResourceDialect
2313                        );
2314                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerControllerPairRequest>(&header, _body_bytes, handles, &mut req)?;
2315                        let control_handle =
2316                            PeerControllerControlHandle { inner: this.inner.clone() };
2317                        Ok(PeerControllerRequest::Pair {
2318                            payload: req,
2319                            responder: PeerControllerPairResponder {
2320                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2321                                tx_id: header.tx_id,
2322                            },
2323                        })
2324                    }
2325                    0x26011dbbd834f8c6 => {
2326                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2327                        let mut req = fidl::new_empty!(
2328                            PeerSelector,
2329                            fidl::encoding::DefaultFuchsiaResourceDialect
2330                        );
2331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSelector>(&header, _body_bytes, handles, &mut req)?;
2332                        let control_handle =
2333                            PeerControllerControlHandle { inner: this.inner.clone() };
2334                        Ok(PeerControllerRequest::ForgetPeer {
2335                            payload: req,
2336                            responder: PeerControllerForgetPeerResponder {
2337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2338                                tx_id: header.tx_id,
2339                            },
2340                        })
2341                    }
2342                    0x3269624c9e1d6ab3 => {
2343                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2344                        let mut req = fidl::new_empty!(
2345                            PeerControllerSetDiscoveryRequest,
2346                            fidl::encoding::DefaultFuchsiaResourceDialect
2347                        );
2348                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerControllerSetDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
2349                        let control_handle =
2350                            PeerControllerControlHandle { inner: this.inner.clone() };
2351                        Ok(PeerControllerRequest::SetDiscovery {
2352                            payload: req,
2353                            responder: PeerControllerSetDiscoveryResponder {
2354                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2355                                tx_id: header.tx_id,
2356                            },
2357                        })
2358                    }
2359                    _ if header.tx_id == 0
2360                        && header
2361                            .dynamic_flags()
2362                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2363                    {
2364                        Ok(PeerControllerRequest::_UnknownMethod {
2365                            ordinal: header.ordinal,
2366                            control_handle: PeerControllerControlHandle {
2367                                inner: this.inner.clone(),
2368                            },
2369                            method_type: fidl::MethodType::OneWay,
2370                        })
2371                    }
2372                    _ if header
2373                        .dynamic_flags()
2374                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2375                    {
2376                        this.inner.send_framework_err(
2377                            fidl::encoding::FrameworkErr::UnknownMethod,
2378                            header.tx_id,
2379                            header.ordinal,
2380                            header.dynamic_flags(),
2381                            (bytes, handles),
2382                        )?;
2383                        Ok(PeerControllerRequest::_UnknownMethod {
2384                            ordinal: header.ordinal,
2385                            control_handle: PeerControllerControlHandle {
2386                                inner: this.inner.clone(),
2387                            },
2388                            method_type: fidl::MethodType::TwoWay,
2389                        })
2390                    }
2391                    _ => Err(fidl::Error::UnknownOrdinal {
2392                        ordinal: header.ordinal,
2393                        protocol_name:
2394                            <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2395                    }),
2396                }))
2397            },
2398        )
2399    }
2400}
2401
2402#[derive(Debug)]
2403pub enum PeerControllerRequest {
2404    /// Get a list of discovered peers.
2405    ///
2406    /// * error Returns `INTERNAL` if the operation failed (check logs).
2407    GetKnownPeers { responder: PeerControllerGetKnownPeersResponder },
2408    /// Connect to a peer.
2409    ///
2410    /// * error Returns `INTERNAL` if the operation failed (check logs).
2411    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
2412    ConnectPeer { payload: PeerSelector, responder: PeerControllerConnectPeerResponder },
2413    /// Disconnect all logical links (BR/EDR & LE) to a peer.
2414    ///
2415    /// * error Returns `INTERNAL` if the operation failed (check logs).
2416    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
2417    DisconnectPeer { payload: PeerSelector, responder: PeerControllerDisconnectPeerResponder },
2418    /// Initiate pairing with a peer.
2419    ///
2420    /// * error Returns `INTERNAL` if the operation failed (check logs).
2421    /// * error Returns `MISSING_PARAMETERS` if `selector` or `options` is missing, or if `selector`
2422    ///   does not contain a peer ID.
2423    Pair { payload: PeerControllerPairRequest, responder: PeerControllerPairResponder },
2424    /// Forget a peer and all its bonding information.
2425    ///
2426    /// * error Returns `INTERNAL` if the operation failed (check logs).
2427    /// * error Returns `MISSING_PARAMETERS` if the selector does not contain a peer ID.
2428    ForgetPeer { payload: PeerSelector, responder: PeerControllerForgetPeerResponder },
2429    /// Set discovery state.
2430    ///
2431    /// * error Returns `INTERNAL` if the operation failed (check logs).
2432    /// * error Returns `MISSING_PARAMETERS` if `discovery` is missing.
2433    SetDiscovery {
2434        payload: PeerControllerSetDiscoveryRequest,
2435        responder: PeerControllerSetDiscoveryResponder,
2436    },
2437    /// An interaction was received which does not match any known method.
2438    #[non_exhaustive]
2439    _UnknownMethod {
2440        /// Ordinal of the method that was called.
2441        ordinal: u64,
2442        control_handle: PeerControllerControlHandle,
2443        method_type: fidl::MethodType,
2444    },
2445}
2446
2447impl PeerControllerRequest {
2448    #[allow(irrefutable_let_patterns)]
2449    pub fn into_get_known_peers(self) -> Option<(PeerControllerGetKnownPeersResponder)> {
2450        if let PeerControllerRequest::GetKnownPeers { responder } = self {
2451            Some((responder))
2452        } else {
2453            None
2454        }
2455    }
2456
2457    #[allow(irrefutable_let_patterns)]
2458    pub fn into_connect_peer(self) -> Option<(PeerSelector, PeerControllerConnectPeerResponder)> {
2459        if let PeerControllerRequest::ConnectPeer { payload, responder } = self {
2460            Some((payload, responder))
2461        } else {
2462            None
2463        }
2464    }
2465
2466    #[allow(irrefutable_let_patterns)]
2467    pub fn into_disconnect_peer(
2468        self,
2469    ) -> Option<(PeerSelector, PeerControllerDisconnectPeerResponder)> {
2470        if let PeerControllerRequest::DisconnectPeer { payload, responder } = self {
2471            Some((payload, responder))
2472        } else {
2473            None
2474        }
2475    }
2476
2477    #[allow(irrefutable_let_patterns)]
2478    pub fn into_pair(self) -> Option<(PeerControllerPairRequest, PeerControllerPairResponder)> {
2479        if let PeerControllerRequest::Pair { payload, responder } = self {
2480            Some((payload, responder))
2481        } else {
2482            None
2483        }
2484    }
2485
2486    #[allow(irrefutable_let_patterns)]
2487    pub fn into_forget_peer(self) -> Option<(PeerSelector, PeerControllerForgetPeerResponder)> {
2488        if let PeerControllerRequest::ForgetPeer { payload, responder } = self {
2489            Some((payload, responder))
2490        } else {
2491            None
2492        }
2493    }
2494
2495    #[allow(irrefutable_let_patterns)]
2496    pub fn into_set_discovery(
2497        self,
2498    ) -> Option<(PeerControllerSetDiscoveryRequest, PeerControllerSetDiscoveryResponder)> {
2499        if let PeerControllerRequest::SetDiscovery { payload, responder } = self {
2500            Some((payload, responder))
2501        } else {
2502            None
2503        }
2504    }
2505
2506    /// Name of the method defined in FIDL
2507    pub fn method_name(&self) -> &'static str {
2508        match *self {
2509            PeerControllerRequest::GetKnownPeers { .. } => "get_known_peers",
2510            PeerControllerRequest::ConnectPeer { .. } => "connect_peer",
2511            PeerControllerRequest::DisconnectPeer { .. } => "disconnect_peer",
2512            PeerControllerRequest::Pair { .. } => "pair",
2513            PeerControllerRequest::ForgetPeer { .. } => "forget_peer",
2514            PeerControllerRequest::SetDiscovery { .. } => "set_discovery",
2515            PeerControllerRequest::_UnknownMethod {
2516                method_type: fidl::MethodType::OneWay, ..
2517            } => "unknown one-way method",
2518            PeerControllerRequest::_UnknownMethod {
2519                method_type: fidl::MethodType::TwoWay, ..
2520            } => "unknown two-way method",
2521        }
2522    }
2523}
2524
2525#[derive(Debug, Clone)]
2526pub struct PeerControllerControlHandle {
2527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2528}
2529
2530impl fidl::endpoints::ControlHandle for PeerControllerControlHandle {
2531    fn shutdown(&self) {
2532        self.inner.shutdown()
2533    }
2534
2535    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2536        self.inner.shutdown_with_epitaph(status)
2537    }
2538
2539    fn is_closed(&self) -> bool {
2540        self.inner.channel().is_closed()
2541    }
2542    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2543        self.inner.channel().on_closed()
2544    }
2545
2546    #[cfg(target_os = "fuchsia")]
2547    fn signal_peer(
2548        &self,
2549        clear_mask: zx::Signals,
2550        set_mask: zx::Signals,
2551    ) -> Result<(), zx_status::Status> {
2552        use fidl::Peered;
2553        self.inner.channel().signal_peer(clear_mask, set_mask)
2554    }
2555}
2556
2557impl PeerControllerControlHandle {}
2558
2559#[must_use = "FIDL methods require a response to be sent"]
2560#[derive(Debug)]
2561pub struct PeerControllerGetKnownPeersResponder {
2562    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2563    tx_id: u32,
2564}
2565
2566/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2567/// if the responder is dropped without sending a response, so that the client
2568/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2569impl std::ops::Drop for PeerControllerGetKnownPeersResponder {
2570    fn drop(&mut self) {
2571        self.control_handle.shutdown();
2572        // Safety: drops once, never accessed again
2573        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2574    }
2575}
2576
2577impl fidl::endpoints::Responder for PeerControllerGetKnownPeersResponder {
2578    type ControlHandle = PeerControllerControlHandle;
2579
2580    fn control_handle(&self) -> &PeerControllerControlHandle {
2581        &self.control_handle
2582    }
2583
2584    fn drop_without_shutdown(mut self) {
2585        // Safety: drops once, never accessed again due to mem::forget
2586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2587        // Prevent Drop from running (which would shut down the channel)
2588        std::mem::forget(self);
2589    }
2590}
2591
2592impl PeerControllerGetKnownPeersResponder {
2593    /// Sends a response to the FIDL transaction.
2594    ///
2595    /// Sets the channel to shutdown if an error occurs.
2596    pub fn send(
2597        self,
2598        mut result: Result<&PeerControllerGetKnownPeersResponse, Error>,
2599    ) -> Result<(), fidl::Error> {
2600        let _result = self.send_raw(result);
2601        if _result.is_err() {
2602            self.control_handle.shutdown();
2603        }
2604        self.drop_without_shutdown();
2605        _result
2606    }
2607
2608    /// Similar to "send" but does not shutdown the channel if an error occurs.
2609    pub fn send_no_shutdown_on_err(
2610        self,
2611        mut result: Result<&PeerControllerGetKnownPeersResponse, Error>,
2612    ) -> Result<(), fidl::Error> {
2613        let _result = self.send_raw(result);
2614        self.drop_without_shutdown();
2615        _result
2616    }
2617
2618    fn send_raw(
2619        &self,
2620        mut result: Result<&PeerControllerGetKnownPeersResponse, Error>,
2621    ) -> Result<(), fidl::Error> {
2622        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2623            PeerControllerGetKnownPeersResponse,
2624            Error,
2625        >>(
2626            fidl::encoding::FlexibleResult::new(result),
2627            self.tx_id,
2628            0x482cf3745bab65f6,
2629            fidl::encoding::DynamicFlags::FLEXIBLE,
2630        )
2631    }
2632}
2633
2634#[must_use = "FIDL methods require a response to be sent"]
2635#[derive(Debug)]
2636pub struct PeerControllerConnectPeerResponder {
2637    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2638    tx_id: u32,
2639}
2640
2641/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2642/// if the responder is dropped without sending a response, so that the client
2643/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2644impl std::ops::Drop for PeerControllerConnectPeerResponder {
2645    fn drop(&mut self) {
2646        self.control_handle.shutdown();
2647        // Safety: drops once, never accessed again
2648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2649    }
2650}
2651
2652impl fidl::endpoints::Responder for PeerControllerConnectPeerResponder {
2653    type ControlHandle = PeerControllerControlHandle;
2654
2655    fn control_handle(&self) -> &PeerControllerControlHandle {
2656        &self.control_handle
2657    }
2658
2659    fn drop_without_shutdown(mut self) {
2660        // Safety: drops once, never accessed again due to mem::forget
2661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2662        // Prevent Drop from running (which would shut down the channel)
2663        std::mem::forget(self);
2664    }
2665}
2666
2667impl PeerControllerConnectPeerResponder {
2668    /// Sends a response to the FIDL transaction.
2669    ///
2670    /// Sets the channel to shutdown if an error occurs.
2671    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2672        let _result = self.send_raw(result);
2673        if _result.is_err() {
2674            self.control_handle.shutdown();
2675        }
2676        self.drop_without_shutdown();
2677        _result
2678    }
2679
2680    /// Similar to "send" but does not shutdown the channel if an error occurs.
2681    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2682        let _result = self.send_raw(result);
2683        self.drop_without_shutdown();
2684        _result
2685    }
2686
2687    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2688        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2689            fidl::encoding::EmptyStruct,
2690            Error,
2691        >>(
2692            fidl::encoding::FlexibleResult::new(result),
2693            self.tx_id,
2694            0x13fbb990835acf66,
2695            fidl::encoding::DynamicFlags::FLEXIBLE,
2696        )
2697    }
2698}
2699
2700#[must_use = "FIDL methods require a response to be sent"]
2701#[derive(Debug)]
2702pub struct PeerControllerDisconnectPeerResponder {
2703    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2704    tx_id: u32,
2705}
2706
2707/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2708/// if the responder is dropped without sending a response, so that the client
2709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2710impl std::ops::Drop for PeerControllerDisconnectPeerResponder {
2711    fn drop(&mut self) {
2712        self.control_handle.shutdown();
2713        // Safety: drops once, never accessed again
2714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2715    }
2716}
2717
2718impl fidl::endpoints::Responder for PeerControllerDisconnectPeerResponder {
2719    type ControlHandle = PeerControllerControlHandle;
2720
2721    fn control_handle(&self) -> &PeerControllerControlHandle {
2722        &self.control_handle
2723    }
2724
2725    fn drop_without_shutdown(mut self) {
2726        // Safety: drops once, never accessed again due to mem::forget
2727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2728        // Prevent Drop from running (which would shut down the channel)
2729        std::mem::forget(self);
2730    }
2731}
2732
2733impl PeerControllerDisconnectPeerResponder {
2734    /// Sends a response to the FIDL transaction.
2735    ///
2736    /// Sets the channel to shutdown if an error occurs.
2737    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2738        let _result = self.send_raw(result);
2739        if _result.is_err() {
2740            self.control_handle.shutdown();
2741        }
2742        self.drop_without_shutdown();
2743        _result
2744    }
2745
2746    /// Similar to "send" but does not shutdown the channel if an error occurs.
2747    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2748        let _result = self.send_raw(result);
2749        self.drop_without_shutdown();
2750        _result
2751    }
2752
2753    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2754        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2755            fidl::encoding::EmptyStruct,
2756            Error,
2757        >>(
2758            fidl::encoding::FlexibleResult::new(result),
2759            self.tx_id,
2760            0x5f9992f066c664ad,
2761            fidl::encoding::DynamicFlags::FLEXIBLE,
2762        )
2763    }
2764}
2765
2766#[must_use = "FIDL methods require a response to be sent"]
2767#[derive(Debug)]
2768pub struct PeerControllerPairResponder {
2769    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2770    tx_id: u32,
2771}
2772
2773/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2774/// if the responder is dropped without sending a response, so that the client
2775/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2776impl std::ops::Drop for PeerControllerPairResponder {
2777    fn drop(&mut self) {
2778        self.control_handle.shutdown();
2779        // Safety: drops once, never accessed again
2780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2781    }
2782}
2783
2784impl fidl::endpoints::Responder for PeerControllerPairResponder {
2785    type ControlHandle = PeerControllerControlHandle;
2786
2787    fn control_handle(&self) -> &PeerControllerControlHandle {
2788        &self.control_handle
2789    }
2790
2791    fn drop_without_shutdown(mut self) {
2792        // Safety: drops once, never accessed again due to mem::forget
2793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2794        // Prevent Drop from running (which would shut down the channel)
2795        std::mem::forget(self);
2796    }
2797}
2798
2799impl PeerControllerPairResponder {
2800    /// Sends a response to the FIDL transaction.
2801    ///
2802    /// Sets the channel to shutdown if an error occurs.
2803    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2804        let _result = self.send_raw(result);
2805        if _result.is_err() {
2806            self.control_handle.shutdown();
2807        }
2808        self.drop_without_shutdown();
2809        _result
2810    }
2811
2812    /// Similar to "send" but does not shutdown the channel if an error occurs.
2813    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2814        let _result = self.send_raw(result);
2815        self.drop_without_shutdown();
2816        _result
2817    }
2818
2819    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2820        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2821            fidl::encoding::EmptyStruct,
2822            Error,
2823        >>(
2824            fidl::encoding::FlexibleResult::new(result),
2825            self.tx_id,
2826            0x1991671d4d7eff26,
2827            fidl::encoding::DynamicFlags::FLEXIBLE,
2828        )
2829    }
2830}
2831
2832#[must_use = "FIDL methods require a response to be sent"]
2833#[derive(Debug)]
2834pub struct PeerControllerForgetPeerResponder {
2835    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2836    tx_id: u32,
2837}
2838
2839/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2840/// if the responder is dropped without sending a response, so that the client
2841/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2842impl std::ops::Drop for PeerControllerForgetPeerResponder {
2843    fn drop(&mut self) {
2844        self.control_handle.shutdown();
2845        // Safety: drops once, never accessed again
2846        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2847    }
2848}
2849
2850impl fidl::endpoints::Responder for PeerControllerForgetPeerResponder {
2851    type ControlHandle = PeerControllerControlHandle;
2852
2853    fn control_handle(&self) -> &PeerControllerControlHandle {
2854        &self.control_handle
2855    }
2856
2857    fn drop_without_shutdown(mut self) {
2858        // Safety: drops once, never accessed again due to mem::forget
2859        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2860        // Prevent Drop from running (which would shut down the channel)
2861        std::mem::forget(self);
2862    }
2863}
2864
2865impl PeerControllerForgetPeerResponder {
2866    /// Sends a response to the FIDL transaction.
2867    ///
2868    /// Sets the channel to shutdown if an error occurs.
2869    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2870        let _result = self.send_raw(result);
2871        if _result.is_err() {
2872            self.control_handle.shutdown();
2873        }
2874        self.drop_without_shutdown();
2875        _result
2876    }
2877
2878    /// Similar to "send" but does not shutdown the channel if an error occurs.
2879    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2880        let _result = self.send_raw(result);
2881        self.drop_without_shutdown();
2882        _result
2883    }
2884
2885    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2886        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2887            fidl::encoding::EmptyStruct,
2888            Error,
2889        >>(
2890            fidl::encoding::FlexibleResult::new(result),
2891            self.tx_id,
2892            0x26011dbbd834f8c6,
2893            fidl::encoding::DynamicFlags::FLEXIBLE,
2894        )
2895    }
2896}
2897
2898#[must_use = "FIDL methods require a response to be sent"]
2899#[derive(Debug)]
2900pub struct PeerControllerSetDiscoveryResponder {
2901    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2902    tx_id: u32,
2903}
2904
2905/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2906/// if the responder is dropped without sending a response, so that the client
2907/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2908impl std::ops::Drop for PeerControllerSetDiscoveryResponder {
2909    fn drop(&mut self) {
2910        self.control_handle.shutdown();
2911        // Safety: drops once, never accessed again
2912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2913    }
2914}
2915
2916impl fidl::endpoints::Responder for PeerControllerSetDiscoveryResponder {
2917    type ControlHandle = PeerControllerControlHandle;
2918
2919    fn control_handle(&self) -> &PeerControllerControlHandle {
2920        &self.control_handle
2921    }
2922
2923    fn drop_without_shutdown(mut self) {
2924        // Safety: drops once, never accessed again due to mem::forget
2925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2926        // Prevent Drop from running (which would shut down the channel)
2927        std::mem::forget(self);
2928    }
2929}
2930
2931impl PeerControllerSetDiscoveryResponder {
2932    /// Sends a response to the FIDL transaction.
2933    ///
2934    /// Sets the channel to shutdown if an error occurs.
2935    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2936        let _result = self.send_raw(result);
2937        if _result.is_err() {
2938            self.control_handle.shutdown();
2939        }
2940        self.drop_without_shutdown();
2941        _result
2942    }
2943
2944    /// Similar to "send" but does not shutdown the channel if an error occurs.
2945    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2946        let _result = self.send_raw(result);
2947        self.drop_without_shutdown();
2948        _result
2949    }
2950
2951    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2952        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2953            fidl::encoding::EmptyStruct,
2954            Error,
2955        >>(
2956            fidl::encoding::FlexibleResult::new(result),
2957            self.tx_id,
2958            0x3269624c9e1d6ab3,
2959            fidl::encoding::DynamicFlags::FLEXIBLE,
2960        )
2961    }
2962}
2963
2964#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2965pub struct PeripheralControllerMarker;
2966
2967impl fidl::endpoints::ProtocolMarker for PeripheralControllerMarker {
2968    type Proxy = PeripheralControllerProxy;
2969    type RequestStream = PeripheralControllerRequestStream;
2970    #[cfg(target_os = "fuchsia")]
2971    type SynchronousProxy = PeripheralControllerSynchronousProxy;
2972
2973    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.affordances.PeripheralController";
2974}
2975impl fidl::endpoints::DiscoverableProtocolMarker for PeripheralControllerMarker {}
2976pub type PeripheralControllerAdvertiseResult = Result<PeripheralControllerAdvertiseResponse, Error>;
2977
2978pub trait PeripheralControllerProxyInterface: Send + Sync {
2979    type AdvertiseResponseFut: std::future::Future<Output = Result<PeripheralControllerAdvertiseResult, fidl::Error>>
2980        + Send;
2981    fn r#advertise(
2982        &self,
2983        payload: &PeripheralControllerAdvertiseRequest,
2984    ) -> Self::AdvertiseResponseFut;
2985}
2986#[derive(Debug)]
2987#[cfg(target_os = "fuchsia")]
2988pub struct PeripheralControllerSynchronousProxy {
2989    client: fidl::client::sync::Client,
2990}
2991
2992#[cfg(target_os = "fuchsia")]
2993impl fidl::endpoints::SynchronousProxy for PeripheralControllerSynchronousProxy {
2994    type Proxy = PeripheralControllerProxy;
2995    type Protocol = PeripheralControllerMarker;
2996
2997    fn from_channel(inner: fidl::Channel) -> Self {
2998        Self::new(inner)
2999    }
3000
3001    fn into_channel(self) -> fidl::Channel {
3002        self.client.into_channel()
3003    }
3004
3005    fn as_channel(&self) -> &fidl::Channel {
3006        self.client.as_channel()
3007    }
3008}
3009
3010#[cfg(target_os = "fuchsia")]
3011impl PeripheralControllerSynchronousProxy {
3012    pub fn new(channel: fidl::Channel) -> Self {
3013        Self { client: fidl::client::sync::Client::new(channel) }
3014    }
3015
3016    pub fn into_channel(self) -> fidl::Channel {
3017        self.client.into_channel()
3018    }
3019
3020    /// Waits until an event arrives and returns it. It is safe for other
3021    /// threads to make concurrent requests while waiting for an event.
3022    pub fn wait_for_event(
3023        &self,
3024        deadline: zx::MonotonicInstant,
3025    ) -> Result<PeripheralControllerEvent, fidl::Error> {
3026        PeripheralControllerEvent::decode(
3027            self.client.wait_for_event::<PeripheralControllerMarker>(deadline)?,
3028        )
3029    }
3030
3031    /// Start advertising.
3032    ///
3033    /// * error Returns `INTERNAL` if the operation failed (check logs).
3034    /// * error Returns `TIMEOUT` if the advertisement timed out without a connection.
3035    /// * error Returns `MISSING_PARAMETERS` if `parameters` or `timeout` is missing.
3036    pub fn r#advertise(
3037        &self,
3038        mut payload: &PeripheralControllerAdvertiseRequest,
3039        ___deadline: zx::MonotonicInstant,
3040    ) -> Result<PeripheralControllerAdvertiseResult, fidl::Error> {
3041        let _response = self.client.send_query::<
3042            PeripheralControllerAdvertiseRequest,
3043            fidl::encoding::FlexibleResultType<PeripheralControllerAdvertiseResponse, Error>,
3044            PeripheralControllerMarker,
3045        >(
3046            payload,
3047            0x59079a81362a66f3,
3048            fidl::encoding::DynamicFlags::FLEXIBLE,
3049            ___deadline,
3050        )?
3051        .into_result::<PeripheralControllerMarker>("advertise")?;
3052        Ok(_response.map(|x| x))
3053    }
3054}
3055
3056#[cfg(target_os = "fuchsia")]
3057impl From<PeripheralControllerSynchronousProxy> for zx::NullableHandle {
3058    fn from(value: PeripheralControllerSynchronousProxy) -> Self {
3059        value.into_channel().into()
3060    }
3061}
3062
3063#[cfg(target_os = "fuchsia")]
3064impl From<fidl::Channel> for PeripheralControllerSynchronousProxy {
3065    fn from(value: fidl::Channel) -> Self {
3066        Self::new(value)
3067    }
3068}
3069
3070#[cfg(target_os = "fuchsia")]
3071impl fidl::endpoints::FromClient for PeripheralControllerSynchronousProxy {
3072    type Protocol = PeripheralControllerMarker;
3073
3074    fn from_client(value: fidl::endpoints::ClientEnd<PeripheralControllerMarker>) -> Self {
3075        Self::new(value.into_channel())
3076    }
3077}
3078
3079#[derive(Debug, Clone)]
3080pub struct PeripheralControllerProxy {
3081    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3082}
3083
3084impl fidl::endpoints::Proxy for PeripheralControllerProxy {
3085    type Protocol = PeripheralControllerMarker;
3086
3087    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3088        Self::new(inner)
3089    }
3090
3091    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3092        self.client.into_channel().map_err(|client| Self { client })
3093    }
3094
3095    fn as_channel(&self) -> &::fidl::AsyncChannel {
3096        self.client.as_channel()
3097    }
3098}
3099
3100impl PeripheralControllerProxy {
3101    /// Create a new Proxy for fuchsia.bluetooth.affordances/PeripheralController.
3102    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3103        let protocol_name =
3104            <PeripheralControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3105        Self { client: fidl::client::Client::new(channel, protocol_name) }
3106    }
3107
3108    /// Get a Stream of events from the remote end of the protocol.
3109    ///
3110    /// # Panics
3111    ///
3112    /// Panics if the event stream was already taken.
3113    pub fn take_event_stream(&self) -> PeripheralControllerEventStream {
3114        PeripheralControllerEventStream { event_receiver: self.client.take_event_receiver() }
3115    }
3116
3117    /// Start advertising.
3118    ///
3119    /// * error Returns `INTERNAL` if the operation failed (check logs).
3120    /// * error Returns `TIMEOUT` if the advertisement timed out without a connection.
3121    /// * error Returns `MISSING_PARAMETERS` if `parameters` or `timeout` is missing.
3122    pub fn r#advertise(
3123        &self,
3124        mut payload: &PeripheralControllerAdvertiseRequest,
3125    ) -> fidl::client::QueryResponseFut<
3126        PeripheralControllerAdvertiseResult,
3127        fidl::encoding::DefaultFuchsiaResourceDialect,
3128    > {
3129        PeripheralControllerProxyInterface::r#advertise(self, payload)
3130    }
3131}
3132
3133impl PeripheralControllerProxyInterface for PeripheralControllerProxy {
3134    type AdvertiseResponseFut = fidl::client::QueryResponseFut<
3135        PeripheralControllerAdvertiseResult,
3136        fidl::encoding::DefaultFuchsiaResourceDialect,
3137    >;
3138    fn r#advertise(
3139        &self,
3140        mut payload: &PeripheralControllerAdvertiseRequest,
3141    ) -> Self::AdvertiseResponseFut {
3142        fn _decode(
3143            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3144        ) -> Result<PeripheralControllerAdvertiseResult, fidl::Error> {
3145            let _response = fidl::client::decode_transaction_body::<
3146                fidl::encoding::FlexibleResultType<PeripheralControllerAdvertiseResponse, Error>,
3147                fidl::encoding::DefaultFuchsiaResourceDialect,
3148                0x59079a81362a66f3,
3149            >(_buf?)?
3150            .into_result::<PeripheralControllerMarker>("advertise")?;
3151            Ok(_response.map(|x| x))
3152        }
3153        self.client.send_query_and_decode::<
3154            PeripheralControllerAdvertiseRequest,
3155            PeripheralControllerAdvertiseResult,
3156        >(
3157            payload,
3158            0x59079a81362a66f3,
3159            fidl::encoding::DynamicFlags::FLEXIBLE,
3160            _decode,
3161        )
3162    }
3163}
3164
3165pub struct PeripheralControllerEventStream {
3166    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3167}
3168
3169impl std::marker::Unpin for PeripheralControllerEventStream {}
3170
3171impl futures::stream::FusedStream for PeripheralControllerEventStream {
3172    fn is_terminated(&self) -> bool {
3173        self.event_receiver.is_terminated()
3174    }
3175}
3176
3177impl futures::Stream for PeripheralControllerEventStream {
3178    type Item = Result<PeripheralControllerEvent, fidl::Error>;
3179
3180    fn poll_next(
3181        mut self: std::pin::Pin<&mut Self>,
3182        cx: &mut std::task::Context<'_>,
3183    ) -> std::task::Poll<Option<Self::Item>> {
3184        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3185            &mut self.event_receiver,
3186            cx
3187        )?) {
3188            Some(buf) => std::task::Poll::Ready(Some(PeripheralControllerEvent::decode(buf))),
3189            None => std::task::Poll::Ready(None),
3190        }
3191    }
3192}
3193
3194#[derive(Debug)]
3195pub enum PeripheralControllerEvent {
3196    #[non_exhaustive]
3197    _UnknownEvent {
3198        /// Ordinal of the event that was sent.
3199        ordinal: u64,
3200    },
3201}
3202
3203impl PeripheralControllerEvent {
3204    /// Decodes a message buffer as a [`PeripheralControllerEvent`].
3205    fn decode(
3206        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3207    ) -> Result<PeripheralControllerEvent, fidl::Error> {
3208        let (bytes, _handles) = buf.split_mut();
3209        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3210        debug_assert_eq!(tx_header.tx_id, 0);
3211        match tx_header.ordinal {
3212            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3213                Ok(PeripheralControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3214            }
3215            _ => Err(fidl::Error::UnknownOrdinal {
3216                ordinal: tx_header.ordinal,
3217                protocol_name:
3218                    <PeripheralControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3219            }),
3220        }
3221    }
3222}
3223
3224/// A Stream of incoming requests for fuchsia.bluetooth.affordances/PeripheralController.
3225pub struct PeripheralControllerRequestStream {
3226    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3227    is_terminated: bool,
3228}
3229
3230impl std::marker::Unpin for PeripheralControllerRequestStream {}
3231
3232impl futures::stream::FusedStream for PeripheralControllerRequestStream {
3233    fn is_terminated(&self) -> bool {
3234        self.is_terminated
3235    }
3236}
3237
3238impl fidl::endpoints::RequestStream for PeripheralControllerRequestStream {
3239    type Protocol = PeripheralControllerMarker;
3240    type ControlHandle = PeripheralControllerControlHandle;
3241
3242    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3243        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3244    }
3245
3246    fn control_handle(&self) -> Self::ControlHandle {
3247        PeripheralControllerControlHandle { inner: self.inner.clone() }
3248    }
3249
3250    fn into_inner(
3251        self,
3252    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3253    {
3254        (self.inner, self.is_terminated)
3255    }
3256
3257    fn from_inner(
3258        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3259        is_terminated: bool,
3260    ) -> Self {
3261        Self { inner, is_terminated }
3262    }
3263}
3264
3265impl futures::Stream for PeripheralControllerRequestStream {
3266    type Item = Result<PeripheralControllerRequest, fidl::Error>;
3267
3268    fn poll_next(
3269        mut self: std::pin::Pin<&mut Self>,
3270        cx: &mut std::task::Context<'_>,
3271    ) -> std::task::Poll<Option<Self::Item>> {
3272        let this = &mut *self;
3273        if this.inner.check_shutdown(cx) {
3274            this.is_terminated = true;
3275            return std::task::Poll::Ready(None);
3276        }
3277        if this.is_terminated {
3278            panic!("polled PeripheralControllerRequestStream after completion");
3279        }
3280        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3281            |bytes, handles| {
3282                match this.inner.channel().read_etc(cx, bytes, handles) {
3283                    std::task::Poll::Ready(Ok(())) => {}
3284                    std::task::Poll::Pending => return std::task::Poll::Pending,
3285                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3286                        this.is_terminated = true;
3287                        return std::task::Poll::Ready(None);
3288                    }
3289                    std::task::Poll::Ready(Err(e)) => {
3290                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3291                            e.into(),
3292                        ))));
3293                    }
3294                }
3295
3296                // A message has been received from the channel
3297                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3298
3299                std::task::Poll::Ready(Some(match header.ordinal {
3300                0x59079a81362a66f3 => {
3301                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3302                    let mut req = fidl::new_empty!(PeripheralControllerAdvertiseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3303                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeripheralControllerAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
3304                    let control_handle = PeripheralControllerControlHandle {
3305                        inner: this.inner.clone(),
3306                    };
3307                    Ok(PeripheralControllerRequest::Advertise {payload: req,
3308                        responder: PeripheralControllerAdvertiseResponder {
3309                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3310                            tx_id: header.tx_id,
3311                        },
3312                    })
3313                }
3314                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3315                    Ok(PeripheralControllerRequest::_UnknownMethod {
3316                        ordinal: header.ordinal,
3317                        control_handle: PeripheralControllerControlHandle { inner: this.inner.clone() },
3318                        method_type: fidl::MethodType::OneWay,
3319                    })
3320                }
3321                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3322                    this.inner.send_framework_err(
3323                        fidl::encoding::FrameworkErr::UnknownMethod,
3324                        header.tx_id,
3325                        header.ordinal,
3326                        header.dynamic_flags(),
3327                        (bytes, handles),
3328                    )?;
3329                    Ok(PeripheralControllerRequest::_UnknownMethod {
3330                        ordinal: header.ordinal,
3331                        control_handle: PeripheralControllerControlHandle { inner: this.inner.clone() },
3332                        method_type: fidl::MethodType::TwoWay,
3333                    })
3334                }
3335                _ => Err(fidl::Error::UnknownOrdinal {
3336                    ordinal: header.ordinal,
3337                    protocol_name: <PeripheralControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3338                }),
3339            }))
3340            },
3341        )
3342    }
3343}
3344
3345#[derive(Debug)]
3346pub enum PeripheralControllerRequest {
3347    /// Start advertising.
3348    ///
3349    /// * error Returns `INTERNAL` if the operation failed (check logs).
3350    /// * error Returns `TIMEOUT` if the advertisement timed out without a connection.
3351    /// * error Returns `MISSING_PARAMETERS` if `parameters` or `timeout` is missing.
3352    Advertise {
3353        payload: PeripheralControllerAdvertiseRequest,
3354        responder: PeripheralControllerAdvertiseResponder,
3355    },
3356    /// An interaction was received which does not match any known method.
3357    #[non_exhaustive]
3358    _UnknownMethod {
3359        /// Ordinal of the method that was called.
3360        ordinal: u64,
3361        control_handle: PeripheralControllerControlHandle,
3362        method_type: fidl::MethodType,
3363    },
3364}
3365
3366impl PeripheralControllerRequest {
3367    #[allow(irrefutable_let_patterns)]
3368    pub fn into_advertise(
3369        self,
3370    ) -> Option<(PeripheralControllerAdvertiseRequest, PeripheralControllerAdvertiseResponder)>
3371    {
3372        if let PeripheralControllerRequest::Advertise { payload, responder } = self {
3373            Some((payload, responder))
3374        } else {
3375            None
3376        }
3377    }
3378
3379    /// Name of the method defined in FIDL
3380    pub fn method_name(&self) -> &'static str {
3381        match *self {
3382            PeripheralControllerRequest::Advertise { .. } => "advertise",
3383            PeripheralControllerRequest::_UnknownMethod {
3384                method_type: fidl::MethodType::OneWay,
3385                ..
3386            } => "unknown one-way method",
3387            PeripheralControllerRequest::_UnknownMethod {
3388                method_type: fidl::MethodType::TwoWay,
3389                ..
3390            } => "unknown two-way method",
3391        }
3392    }
3393}
3394
3395#[derive(Debug, Clone)]
3396pub struct PeripheralControllerControlHandle {
3397    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3398}
3399
3400impl fidl::endpoints::ControlHandle for PeripheralControllerControlHandle {
3401    fn shutdown(&self) {
3402        self.inner.shutdown()
3403    }
3404
3405    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3406        self.inner.shutdown_with_epitaph(status)
3407    }
3408
3409    fn is_closed(&self) -> bool {
3410        self.inner.channel().is_closed()
3411    }
3412    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3413        self.inner.channel().on_closed()
3414    }
3415
3416    #[cfg(target_os = "fuchsia")]
3417    fn signal_peer(
3418        &self,
3419        clear_mask: zx::Signals,
3420        set_mask: zx::Signals,
3421    ) -> Result<(), zx_status::Status> {
3422        use fidl::Peered;
3423        self.inner.channel().signal_peer(clear_mask, set_mask)
3424    }
3425}
3426
3427impl PeripheralControllerControlHandle {}
3428
3429#[must_use = "FIDL methods require a response to be sent"]
3430#[derive(Debug)]
3431pub struct PeripheralControllerAdvertiseResponder {
3432    control_handle: std::mem::ManuallyDrop<PeripheralControllerControlHandle>,
3433    tx_id: u32,
3434}
3435
3436/// Set the the channel to be shutdown (see [`PeripheralControllerControlHandle::shutdown`])
3437/// if the responder is dropped without sending a response, so that the client
3438/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3439impl std::ops::Drop for PeripheralControllerAdvertiseResponder {
3440    fn drop(&mut self) {
3441        self.control_handle.shutdown();
3442        // Safety: drops once, never accessed again
3443        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3444    }
3445}
3446
3447impl fidl::endpoints::Responder for PeripheralControllerAdvertiseResponder {
3448    type ControlHandle = PeripheralControllerControlHandle;
3449
3450    fn control_handle(&self) -> &PeripheralControllerControlHandle {
3451        &self.control_handle
3452    }
3453
3454    fn drop_without_shutdown(mut self) {
3455        // Safety: drops once, never accessed again due to mem::forget
3456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3457        // Prevent Drop from running (which would shut down the channel)
3458        std::mem::forget(self);
3459    }
3460}
3461
3462impl PeripheralControllerAdvertiseResponder {
3463    /// Sends a response to the FIDL transaction.
3464    ///
3465    /// Sets the channel to shutdown if an error occurs.
3466    pub fn send(
3467        self,
3468        mut result: Result<&PeripheralControllerAdvertiseResponse, Error>,
3469    ) -> Result<(), fidl::Error> {
3470        let _result = self.send_raw(result);
3471        if _result.is_err() {
3472            self.control_handle.shutdown();
3473        }
3474        self.drop_without_shutdown();
3475        _result
3476    }
3477
3478    /// Similar to "send" but does not shutdown the channel if an error occurs.
3479    pub fn send_no_shutdown_on_err(
3480        self,
3481        mut result: Result<&PeripheralControllerAdvertiseResponse, Error>,
3482    ) -> Result<(), fidl::Error> {
3483        let _result = self.send_raw(result);
3484        self.drop_without_shutdown();
3485        _result
3486    }
3487
3488    fn send_raw(
3489        &self,
3490        mut result: Result<&PeripheralControllerAdvertiseResponse, Error>,
3491    ) -> Result<(), fidl::Error> {
3492        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3493            PeripheralControllerAdvertiseResponse,
3494            Error,
3495        >>(
3496            fidl::encoding::FlexibleResult::new(result),
3497            self.tx_id,
3498            0x59079a81362a66f3,
3499            fidl::encoding::DynamicFlags::FLEXIBLE,
3500        )
3501    }
3502}
3503
3504mod internal {
3505    use super::*;
3506}