fidl_fuchsia_bluetooth_avdtp_test/
fidl_fuchsia_bluetooth_avdtp_test.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// Maximum number of peers that can be connected to a node.
14/// (Core Spec 5.0, Vol 2, Part B, Section 1)
15pub const MAX_PICONET_SIZE: u64 = 8;
16
17/// Represents the return status of a [`fuchsia.bluetooth.avdtp.Peer`] method
18#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
19#[repr(u32)]
20pub enum PeerError {
21    /// Failure reason is not known
22    UnknownFailure = 1,
23    /// The peer is unable to perform the request
24    ProtocolError = 2,
25}
26
27impl PeerError {
28    #[inline]
29    pub fn from_primitive(prim: u32) -> Option<Self> {
30        match prim {
31            1 => Some(Self::UnknownFailure),
32            2 => Some(Self::ProtocolError),
33            _ => None,
34        }
35    }
36
37    #[inline]
38    pub const fn into_primitive(self) -> u32 {
39        self as u32
40    }
41
42    #[deprecated = "Strict enums should not use `is_unknown`"]
43    #[inline]
44    pub fn is_unknown(&self) -> bool {
45        false
46    }
47}
48
49#[derive(Clone, Debug, PartialEq)]
50pub struct PeerManagerConnectedPeersResponse {
51    pub peer_ids: Vec<fidl_fuchsia_bluetooth::PeerId>,
52}
53
54impl fidl::Persistable for PeerManagerConnectedPeersResponse {}
55
56#[derive(Debug, PartialEq)]
57pub struct PeerManagerGetPeerRequest {
58    pub peer_id: fidl_fuchsia_bluetooth::PeerId,
59    pub handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PeerManagerGetPeerRequest {}
63
64#[derive(Clone, Debug, PartialEq)]
65pub struct PeerManagerOnPeerConnectedRequest {
66    pub peer_id: fidl_fuchsia_bluetooth::PeerId,
67}
68
69impl fidl::Persistable for PeerManagerOnPeerConnectedRequest {}
70
71#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
72pub struct PeerControllerMarker;
73
74impl fidl::endpoints::ProtocolMarker for PeerControllerMarker {
75    type Proxy = PeerControllerProxy;
76    type RequestStream = PeerControllerRequestStream;
77    #[cfg(target_os = "fuchsia")]
78    type SynchronousProxy = PeerControllerSynchronousProxy;
79
80    const DEBUG_NAME: &'static str = "(anonymous) PeerController";
81}
82pub type PeerControllerSetConfigurationResult = Result<(), PeerError>;
83pub type PeerControllerGetConfigurationResult = Result<(), PeerError>;
84pub type PeerControllerSuspendStreamResult = Result<(), PeerError>;
85pub type PeerControllerSuspendAndReconfigureResult = Result<(), PeerError>;
86pub type PeerControllerEstablishStreamResult = Result<(), PeerError>;
87pub type PeerControllerReleaseStreamResult = Result<(), PeerError>;
88pub type PeerControllerAbortStreamResult = Result<(), PeerError>;
89pub type PeerControllerStartStreamResult = Result<(), PeerError>;
90pub type PeerControllerReconfigureStreamResult = Result<(), PeerError>;
91pub type PeerControllerGetCapabilitiesResult = Result<(), PeerError>;
92pub type PeerControllerGetAllCapabilitiesResult = Result<(), PeerError>;
93
94pub trait PeerControllerProxyInterface: Send + Sync {
95    type SetConfigurationResponseFut: std::future::Future<Output = Result<PeerControllerSetConfigurationResult, fidl::Error>>
96        + Send;
97    fn r#set_configuration(&self) -> Self::SetConfigurationResponseFut;
98    type GetConfigurationResponseFut: std::future::Future<Output = Result<PeerControllerGetConfigurationResult, fidl::Error>>
99        + Send;
100    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
101    type SuspendStreamResponseFut: std::future::Future<Output = Result<PeerControllerSuspendStreamResult, fidl::Error>>
102        + Send;
103    fn r#suspend_stream(&self) -> Self::SuspendStreamResponseFut;
104    type SuspendAndReconfigureResponseFut: std::future::Future<Output = Result<PeerControllerSuspendAndReconfigureResult, fidl::Error>>
105        + Send;
106    fn r#suspend_and_reconfigure(&self) -> Self::SuspendAndReconfigureResponseFut;
107    type EstablishStreamResponseFut: std::future::Future<Output = Result<PeerControllerEstablishStreamResult, fidl::Error>>
108        + Send;
109    fn r#establish_stream(&self) -> Self::EstablishStreamResponseFut;
110    type ReleaseStreamResponseFut: std::future::Future<Output = Result<PeerControllerReleaseStreamResult, fidl::Error>>
111        + Send;
112    fn r#release_stream(&self) -> Self::ReleaseStreamResponseFut;
113    type AbortStreamResponseFut: std::future::Future<Output = Result<PeerControllerAbortStreamResult, fidl::Error>>
114        + Send;
115    fn r#abort_stream(&self) -> Self::AbortStreamResponseFut;
116    type StartStreamResponseFut: std::future::Future<Output = Result<PeerControllerStartStreamResult, fidl::Error>>
117        + Send;
118    fn r#start_stream(&self) -> Self::StartStreamResponseFut;
119    type ReconfigureStreamResponseFut: std::future::Future<Output = Result<PeerControllerReconfigureStreamResult, fidl::Error>>
120        + Send;
121    fn r#reconfigure_stream(&self) -> Self::ReconfigureStreamResponseFut;
122    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<PeerControllerGetCapabilitiesResult, fidl::Error>>
123        + Send;
124    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
125    type GetAllCapabilitiesResponseFut: std::future::Future<Output = Result<PeerControllerGetAllCapabilitiesResult, fidl::Error>>
126        + Send;
127    fn r#get_all_capabilities(&self) -> Self::GetAllCapabilitiesResponseFut;
128}
129#[derive(Debug)]
130#[cfg(target_os = "fuchsia")]
131pub struct PeerControllerSynchronousProxy {
132    client: fidl::client::sync::Client,
133}
134
135#[cfg(target_os = "fuchsia")]
136impl fidl::endpoints::SynchronousProxy for PeerControllerSynchronousProxy {
137    type Proxy = PeerControllerProxy;
138    type Protocol = PeerControllerMarker;
139
140    fn from_channel(inner: fidl::Channel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> fidl::Channel {
145        self.client.into_channel()
146    }
147
148    fn as_channel(&self) -> &fidl::Channel {
149        self.client.as_channel()
150    }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl PeerControllerSynchronousProxy {
155    pub fn new(channel: fidl::Channel) -> Self {
156        let protocol_name = <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
158    }
159
160    pub fn into_channel(self) -> fidl::Channel {
161        self.client.into_channel()
162    }
163
164    /// Waits until an event arrives and returns it. It is safe for other
165    /// threads to make concurrent requests while waiting for an event.
166    pub fn wait_for_event(
167        &self,
168        deadline: zx::MonotonicInstant,
169    ) -> Result<PeerControllerEvent, fidl::Error> {
170        PeerControllerEvent::decode(self.client.wait_for_event(deadline)?)
171    }
172
173    /// Initiate a stream configuration procedure.
174    /// No configuration information is specified because generic config information will
175    /// be used to initiate the procedure.
176    pub fn r#set_configuration(
177        &self,
178        ___deadline: zx::MonotonicInstant,
179    ) -> Result<PeerControllerSetConfigurationResult, fidl::Error> {
180        let _response = self.client.send_query::<
181            fidl::encoding::EmptyPayload,
182            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
183        >(
184            (),
185            0x35f45144acf701ae,
186            fidl::encoding::DynamicFlags::empty(),
187            ___deadline,
188        )?;
189        Ok(_response.map(|x| x))
190    }
191
192    /// Initiate a procedure to get the configuration information of the peer stream.
193    /// The result is discarded because PeerController only initiates the procedure.
194    pub fn r#get_configuration(
195        &self,
196        ___deadline: zx::MonotonicInstant,
197    ) -> Result<PeerControllerGetConfigurationResult, fidl::Error> {
198        let _response = self.client.send_query::<
199            fidl::encoding::EmptyPayload,
200            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
201        >(
202            (),
203            0x507eb0483e8d50d,
204            fidl::encoding::DynamicFlags::empty(),
205            ___deadline,
206        )?;
207        Ok(_response.map(|x| x))
208    }
209
210    /// Initiate a suspend request to the stream.
211    /// This command will not resume nor reconfigure the stream.
212    pub fn r#suspend_stream(
213        &self,
214        ___deadline: zx::MonotonicInstant,
215    ) -> Result<PeerControllerSuspendStreamResult, fidl::Error> {
216        let _response = self.client.send_query::<
217            fidl::encoding::EmptyPayload,
218            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
219        >(
220            (),
221            0x43465c9341d472eb,
222            fidl::encoding::DynamicFlags::empty(),
223            ___deadline,
224        )?;
225        Ok(_response.map(|x| x))
226    }
227
228    /// A "chained" set of procedures on the current stream.
229    /// SuspendStream() followed by ReconfigureStream().
230    /// Reconfigure() configures the stream that is currently open.
231    pub fn r#suspend_and_reconfigure(
232        &self,
233        ___deadline: zx::MonotonicInstant,
234    ) -> Result<PeerControllerSuspendAndReconfigureResult, fidl::Error> {
235        let _response = self.client.send_query::<
236            fidl::encoding::EmptyPayload,
237            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
238        >(
239            (),
240            0x7ce8e3b693e20fe3,
241            fidl::encoding::DynamicFlags::empty(),
242            ___deadline,
243        )?;
244        Ok(_response.map(|x| x))
245    }
246
247    /// Initiate stream establishment with the peer.
248    pub fn r#establish_stream(
249        &self,
250        ___deadline: zx::MonotonicInstant,
251    ) -> Result<PeerControllerEstablishStreamResult, fidl::Error> {
252        let _response = self.client.send_query::<
253            fidl::encoding::EmptyPayload,
254            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
255        >(
256            (),
257            0x438e16ccd91eb5e5,
258            fidl::encoding::DynamicFlags::empty(),
259            ___deadline,
260        )?;
261        Ok(_response.map(|x| x))
262    }
263
264    /// Release the current stream that is owned by the peer.
265    /// If the streaming channel doesn't exist, no action will be taken.
266    pub fn r#release_stream(
267        &self,
268        ___deadline: zx::MonotonicInstant,
269    ) -> Result<PeerControllerReleaseStreamResult, fidl::Error> {
270        let _response = self.client.send_query::<
271            fidl::encoding::EmptyPayload,
272            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
273        >(
274            (),
275            0x4884104b373151c6,
276            fidl::encoding::DynamicFlags::empty(),
277            ___deadline,
278        )?;
279        Ok(_response.map(|x| x))
280    }
281
282    /// Initiate an abort procedure on the current stream.
283    /// If the streaming channel doesn't exist, no action will be taken.
284    pub fn r#abort_stream(
285        &self,
286        ___deadline: zx::MonotonicInstant,
287    ) -> Result<PeerControllerAbortStreamResult, fidl::Error> {
288        let _response = self.client.send_query::<
289            fidl::encoding::EmptyPayload,
290            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
291        >(
292            (),
293            0xf85b067ed144997,
294            fidl::encoding::DynamicFlags::empty(),
295            ___deadline,
296        )?;
297        Ok(_response.map(|x| x))
298    }
299
300    /// Start streaming media on the current stream that is owned by the peer.
301    /// If the streaming channel doesn't exist, no action will be taken.
302    pub fn r#start_stream(
303        &self,
304        ___deadline: zx::MonotonicInstant,
305    ) -> Result<PeerControllerStartStreamResult, fidl::Error> {
306        let _response = self.client.send_query::<
307            fidl::encoding::EmptyPayload,
308            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
309        >(
310            (),
311            0xd0ead9aec2ebf77,
312            fidl::encoding::DynamicFlags::empty(),
313            ___deadline,
314        )?;
315        Ok(_response.map(|x| x))
316    }
317
318    /// Initiate a reconfiguration procedure for the current stream.
319    /// No configuration information is specified because a generic set of config
320    /// information will be used to initiate the procedure.
321    pub fn r#reconfigure_stream(
322        &self,
323        ___deadline: zx::MonotonicInstant,
324    ) -> Result<PeerControllerReconfigureStreamResult, fidl::Error> {
325        let _response = self.client.send_query::<
326            fidl::encoding::EmptyPayload,
327            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
328        >(
329            (),
330            0x559404d6a9629c60,
331            fidl::encoding::DynamicFlags::empty(),
332            ___deadline,
333        )?;
334        Ok(_response.map(|x| x))
335    }
336
337    /// Initiate a procedure to get the capabilities of the peer.
338    /// The result is discarded because PeerController only initiates the procedure.
339    pub fn r#get_capabilities(
340        &self,
341        ___deadline: zx::MonotonicInstant,
342    ) -> Result<PeerControllerGetCapabilitiesResult, fidl::Error> {
343        let _response = self.client.send_query::<
344            fidl::encoding::EmptyPayload,
345            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
346        >(
347            (),
348            0x16884c07e6d969a7,
349            fidl::encoding::DynamicFlags::empty(),
350            ___deadline,
351        )?;
352        Ok(_response.map(|x| x))
353    }
354
355    /// Initiate a procedure to get the capabilities of the peer.
356    /// The result is discarded because PeerController only initiates the procedure.
357    pub fn r#get_all_capabilities(
358        &self,
359        ___deadline: zx::MonotonicInstant,
360    ) -> Result<PeerControllerGetAllCapabilitiesResult, fidl::Error> {
361        let _response = self.client.send_query::<
362            fidl::encoding::EmptyPayload,
363            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
364        >(
365            (),
366            0x1e2c5b438e288cea,
367            fidl::encoding::DynamicFlags::empty(),
368            ___deadline,
369        )?;
370        Ok(_response.map(|x| x))
371    }
372}
373
374#[derive(Debug, Clone)]
375pub struct PeerControllerProxy {
376    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
377}
378
379impl fidl::endpoints::Proxy for PeerControllerProxy {
380    type Protocol = PeerControllerMarker;
381
382    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
383        Self::new(inner)
384    }
385
386    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
387        self.client.into_channel().map_err(|client| Self { client })
388    }
389
390    fn as_channel(&self) -> &::fidl::AsyncChannel {
391        self.client.as_channel()
392    }
393}
394
395impl PeerControllerProxy {
396    /// Create a new Proxy for fuchsia.bluetooth.avdtp.test/PeerController.
397    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
398        let protocol_name = <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
399        Self { client: fidl::client::Client::new(channel, protocol_name) }
400    }
401
402    /// Get a Stream of events from the remote end of the protocol.
403    ///
404    /// # Panics
405    ///
406    /// Panics if the event stream was already taken.
407    pub fn take_event_stream(&self) -> PeerControllerEventStream {
408        PeerControllerEventStream { event_receiver: self.client.take_event_receiver() }
409    }
410
411    /// Initiate a stream configuration procedure.
412    /// No configuration information is specified because generic config information will
413    /// be used to initiate the procedure.
414    pub fn r#set_configuration(
415        &self,
416    ) -> fidl::client::QueryResponseFut<
417        PeerControllerSetConfigurationResult,
418        fidl::encoding::DefaultFuchsiaResourceDialect,
419    > {
420        PeerControllerProxyInterface::r#set_configuration(self)
421    }
422
423    /// Initiate a procedure to get the configuration information of the peer stream.
424    /// The result is discarded because PeerController only initiates the procedure.
425    pub fn r#get_configuration(
426        &self,
427    ) -> fidl::client::QueryResponseFut<
428        PeerControllerGetConfigurationResult,
429        fidl::encoding::DefaultFuchsiaResourceDialect,
430    > {
431        PeerControllerProxyInterface::r#get_configuration(self)
432    }
433
434    /// Initiate a suspend request to the stream.
435    /// This command will not resume nor reconfigure the stream.
436    pub fn r#suspend_stream(
437        &self,
438    ) -> fidl::client::QueryResponseFut<
439        PeerControllerSuspendStreamResult,
440        fidl::encoding::DefaultFuchsiaResourceDialect,
441    > {
442        PeerControllerProxyInterface::r#suspend_stream(self)
443    }
444
445    /// A "chained" set of procedures on the current stream.
446    /// SuspendStream() followed by ReconfigureStream().
447    /// Reconfigure() configures the stream that is currently open.
448    pub fn r#suspend_and_reconfigure(
449        &self,
450    ) -> fidl::client::QueryResponseFut<
451        PeerControllerSuspendAndReconfigureResult,
452        fidl::encoding::DefaultFuchsiaResourceDialect,
453    > {
454        PeerControllerProxyInterface::r#suspend_and_reconfigure(self)
455    }
456
457    /// Initiate stream establishment with the peer.
458    pub fn r#establish_stream(
459        &self,
460    ) -> fidl::client::QueryResponseFut<
461        PeerControllerEstablishStreamResult,
462        fidl::encoding::DefaultFuchsiaResourceDialect,
463    > {
464        PeerControllerProxyInterface::r#establish_stream(self)
465    }
466
467    /// Release the current stream that is owned by the peer.
468    /// If the streaming channel doesn't exist, no action will be taken.
469    pub fn r#release_stream(
470        &self,
471    ) -> fidl::client::QueryResponseFut<
472        PeerControllerReleaseStreamResult,
473        fidl::encoding::DefaultFuchsiaResourceDialect,
474    > {
475        PeerControllerProxyInterface::r#release_stream(self)
476    }
477
478    /// Initiate an abort procedure on the current stream.
479    /// If the streaming channel doesn't exist, no action will be taken.
480    pub fn r#abort_stream(
481        &self,
482    ) -> fidl::client::QueryResponseFut<
483        PeerControllerAbortStreamResult,
484        fidl::encoding::DefaultFuchsiaResourceDialect,
485    > {
486        PeerControllerProxyInterface::r#abort_stream(self)
487    }
488
489    /// Start streaming media on the current stream that is owned by the peer.
490    /// If the streaming channel doesn't exist, no action will be taken.
491    pub fn r#start_stream(
492        &self,
493    ) -> fidl::client::QueryResponseFut<
494        PeerControllerStartStreamResult,
495        fidl::encoding::DefaultFuchsiaResourceDialect,
496    > {
497        PeerControllerProxyInterface::r#start_stream(self)
498    }
499
500    /// Initiate a reconfiguration procedure for the current stream.
501    /// No configuration information is specified because a generic set of config
502    /// information will be used to initiate the procedure.
503    pub fn r#reconfigure_stream(
504        &self,
505    ) -> fidl::client::QueryResponseFut<
506        PeerControllerReconfigureStreamResult,
507        fidl::encoding::DefaultFuchsiaResourceDialect,
508    > {
509        PeerControllerProxyInterface::r#reconfigure_stream(self)
510    }
511
512    /// Initiate a procedure to get the capabilities of the peer.
513    /// The result is discarded because PeerController only initiates the procedure.
514    pub fn r#get_capabilities(
515        &self,
516    ) -> fidl::client::QueryResponseFut<
517        PeerControllerGetCapabilitiesResult,
518        fidl::encoding::DefaultFuchsiaResourceDialect,
519    > {
520        PeerControllerProxyInterface::r#get_capabilities(self)
521    }
522
523    /// Initiate a procedure to get the capabilities of the peer.
524    /// The result is discarded because PeerController only initiates the procedure.
525    pub fn r#get_all_capabilities(
526        &self,
527    ) -> fidl::client::QueryResponseFut<
528        PeerControllerGetAllCapabilitiesResult,
529        fidl::encoding::DefaultFuchsiaResourceDialect,
530    > {
531        PeerControllerProxyInterface::r#get_all_capabilities(self)
532    }
533}
534
535impl PeerControllerProxyInterface for PeerControllerProxy {
536    type SetConfigurationResponseFut = fidl::client::QueryResponseFut<
537        PeerControllerSetConfigurationResult,
538        fidl::encoding::DefaultFuchsiaResourceDialect,
539    >;
540    fn r#set_configuration(&self) -> Self::SetConfigurationResponseFut {
541        fn _decode(
542            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
543        ) -> Result<PeerControllerSetConfigurationResult, fidl::Error> {
544            let _response = fidl::client::decode_transaction_body::<
545                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
546                fidl::encoding::DefaultFuchsiaResourceDialect,
547                0x35f45144acf701ae,
548            >(_buf?)?;
549            Ok(_response.map(|x| x))
550        }
551        self.client.send_query_and_decode::<
552            fidl::encoding::EmptyPayload,
553            PeerControllerSetConfigurationResult,
554        >(
555            (),
556            0x35f45144acf701ae,
557            fidl::encoding::DynamicFlags::empty(),
558            _decode,
559        )
560    }
561
562    type GetConfigurationResponseFut = fidl::client::QueryResponseFut<
563        PeerControllerGetConfigurationResult,
564        fidl::encoding::DefaultFuchsiaResourceDialect,
565    >;
566    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
567        fn _decode(
568            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
569        ) -> Result<PeerControllerGetConfigurationResult, fidl::Error> {
570            let _response = fidl::client::decode_transaction_body::<
571                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
572                fidl::encoding::DefaultFuchsiaResourceDialect,
573                0x507eb0483e8d50d,
574            >(_buf?)?;
575            Ok(_response.map(|x| x))
576        }
577        self.client.send_query_and_decode::<
578            fidl::encoding::EmptyPayload,
579            PeerControllerGetConfigurationResult,
580        >(
581            (),
582            0x507eb0483e8d50d,
583            fidl::encoding::DynamicFlags::empty(),
584            _decode,
585        )
586    }
587
588    type SuspendStreamResponseFut = fidl::client::QueryResponseFut<
589        PeerControllerSuspendStreamResult,
590        fidl::encoding::DefaultFuchsiaResourceDialect,
591    >;
592    fn r#suspend_stream(&self) -> Self::SuspendStreamResponseFut {
593        fn _decode(
594            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
595        ) -> Result<PeerControllerSuspendStreamResult, fidl::Error> {
596            let _response = fidl::client::decode_transaction_body::<
597                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
598                fidl::encoding::DefaultFuchsiaResourceDialect,
599                0x43465c9341d472eb,
600            >(_buf?)?;
601            Ok(_response.map(|x| x))
602        }
603        self.client.send_query_and_decode::<
604            fidl::encoding::EmptyPayload,
605            PeerControllerSuspendStreamResult,
606        >(
607            (),
608            0x43465c9341d472eb,
609            fidl::encoding::DynamicFlags::empty(),
610            _decode,
611        )
612    }
613
614    type SuspendAndReconfigureResponseFut = fidl::client::QueryResponseFut<
615        PeerControllerSuspendAndReconfigureResult,
616        fidl::encoding::DefaultFuchsiaResourceDialect,
617    >;
618    fn r#suspend_and_reconfigure(&self) -> Self::SuspendAndReconfigureResponseFut {
619        fn _decode(
620            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
621        ) -> Result<PeerControllerSuspendAndReconfigureResult, fidl::Error> {
622            let _response = fidl::client::decode_transaction_body::<
623                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
624                fidl::encoding::DefaultFuchsiaResourceDialect,
625                0x7ce8e3b693e20fe3,
626            >(_buf?)?;
627            Ok(_response.map(|x| x))
628        }
629        self.client.send_query_and_decode::<
630            fidl::encoding::EmptyPayload,
631            PeerControllerSuspendAndReconfigureResult,
632        >(
633            (),
634            0x7ce8e3b693e20fe3,
635            fidl::encoding::DynamicFlags::empty(),
636            _decode,
637        )
638    }
639
640    type EstablishStreamResponseFut = fidl::client::QueryResponseFut<
641        PeerControllerEstablishStreamResult,
642        fidl::encoding::DefaultFuchsiaResourceDialect,
643    >;
644    fn r#establish_stream(&self) -> Self::EstablishStreamResponseFut {
645        fn _decode(
646            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
647        ) -> Result<PeerControllerEstablishStreamResult, fidl::Error> {
648            let _response = fidl::client::decode_transaction_body::<
649                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
650                fidl::encoding::DefaultFuchsiaResourceDialect,
651                0x438e16ccd91eb5e5,
652            >(_buf?)?;
653            Ok(_response.map(|x| x))
654        }
655        self.client.send_query_and_decode::<
656            fidl::encoding::EmptyPayload,
657            PeerControllerEstablishStreamResult,
658        >(
659            (),
660            0x438e16ccd91eb5e5,
661            fidl::encoding::DynamicFlags::empty(),
662            _decode,
663        )
664    }
665
666    type ReleaseStreamResponseFut = fidl::client::QueryResponseFut<
667        PeerControllerReleaseStreamResult,
668        fidl::encoding::DefaultFuchsiaResourceDialect,
669    >;
670    fn r#release_stream(&self) -> Self::ReleaseStreamResponseFut {
671        fn _decode(
672            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
673        ) -> Result<PeerControllerReleaseStreamResult, fidl::Error> {
674            let _response = fidl::client::decode_transaction_body::<
675                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
676                fidl::encoding::DefaultFuchsiaResourceDialect,
677                0x4884104b373151c6,
678            >(_buf?)?;
679            Ok(_response.map(|x| x))
680        }
681        self.client.send_query_and_decode::<
682            fidl::encoding::EmptyPayload,
683            PeerControllerReleaseStreamResult,
684        >(
685            (),
686            0x4884104b373151c6,
687            fidl::encoding::DynamicFlags::empty(),
688            _decode,
689        )
690    }
691
692    type AbortStreamResponseFut = fidl::client::QueryResponseFut<
693        PeerControllerAbortStreamResult,
694        fidl::encoding::DefaultFuchsiaResourceDialect,
695    >;
696    fn r#abort_stream(&self) -> Self::AbortStreamResponseFut {
697        fn _decode(
698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
699        ) -> Result<PeerControllerAbortStreamResult, fidl::Error> {
700            let _response = fidl::client::decode_transaction_body::<
701                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
702                fidl::encoding::DefaultFuchsiaResourceDialect,
703                0xf85b067ed144997,
704            >(_buf?)?;
705            Ok(_response.map(|x| x))
706        }
707        self.client
708            .send_query_and_decode::<fidl::encoding::EmptyPayload, PeerControllerAbortStreamResult>(
709                (),
710                0xf85b067ed144997,
711                fidl::encoding::DynamicFlags::empty(),
712                _decode,
713            )
714    }
715
716    type StartStreamResponseFut = fidl::client::QueryResponseFut<
717        PeerControllerStartStreamResult,
718        fidl::encoding::DefaultFuchsiaResourceDialect,
719    >;
720    fn r#start_stream(&self) -> Self::StartStreamResponseFut {
721        fn _decode(
722            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
723        ) -> Result<PeerControllerStartStreamResult, fidl::Error> {
724            let _response = fidl::client::decode_transaction_body::<
725                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
726                fidl::encoding::DefaultFuchsiaResourceDialect,
727                0xd0ead9aec2ebf77,
728            >(_buf?)?;
729            Ok(_response.map(|x| x))
730        }
731        self.client
732            .send_query_and_decode::<fidl::encoding::EmptyPayload, PeerControllerStartStreamResult>(
733                (),
734                0xd0ead9aec2ebf77,
735                fidl::encoding::DynamicFlags::empty(),
736                _decode,
737            )
738    }
739
740    type ReconfigureStreamResponseFut = fidl::client::QueryResponseFut<
741        PeerControllerReconfigureStreamResult,
742        fidl::encoding::DefaultFuchsiaResourceDialect,
743    >;
744    fn r#reconfigure_stream(&self) -> Self::ReconfigureStreamResponseFut {
745        fn _decode(
746            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
747        ) -> Result<PeerControllerReconfigureStreamResult, fidl::Error> {
748            let _response = fidl::client::decode_transaction_body::<
749                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
750                fidl::encoding::DefaultFuchsiaResourceDialect,
751                0x559404d6a9629c60,
752            >(_buf?)?;
753            Ok(_response.map(|x| x))
754        }
755        self.client.send_query_and_decode::<
756            fidl::encoding::EmptyPayload,
757            PeerControllerReconfigureStreamResult,
758        >(
759            (),
760            0x559404d6a9629c60,
761            fidl::encoding::DynamicFlags::empty(),
762            _decode,
763        )
764    }
765
766    type GetCapabilitiesResponseFut = fidl::client::QueryResponseFut<
767        PeerControllerGetCapabilitiesResult,
768        fidl::encoding::DefaultFuchsiaResourceDialect,
769    >;
770    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
771        fn _decode(
772            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
773        ) -> Result<PeerControllerGetCapabilitiesResult, fidl::Error> {
774            let _response = fidl::client::decode_transaction_body::<
775                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
776                fidl::encoding::DefaultFuchsiaResourceDialect,
777                0x16884c07e6d969a7,
778            >(_buf?)?;
779            Ok(_response.map(|x| x))
780        }
781        self.client.send_query_and_decode::<
782            fidl::encoding::EmptyPayload,
783            PeerControllerGetCapabilitiesResult,
784        >(
785            (),
786            0x16884c07e6d969a7,
787            fidl::encoding::DynamicFlags::empty(),
788            _decode,
789        )
790    }
791
792    type GetAllCapabilitiesResponseFut = fidl::client::QueryResponseFut<
793        PeerControllerGetAllCapabilitiesResult,
794        fidl::encoding::DefaultFuchsiaResourceDialect,
795    >;
796    fn r#get_all_capabilities(&self) -> Self::GetAllCapabilitiesResponseFut {
797        fn _decode(
798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
799        ) -> Result<PeerControllerGetAllCapabilitiesResult, fidl::Error> {
800            let _response = fidl::client::decode_transaction_body::<
801                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
802                fidl::encoding::DefaultFuchsiaResourceDialect,
803                0x1e2c5b438e288cea,
804            >(_buf?)?;
805            Ok(_response.map(|x| x))
806        }
807        self.client.send_query_and_decode::<
808            fidl::encoding::EmptyPayload,
809            PeerControllerGetAllCapabilitiesResult,
810        >(
811            (),
812            0x1e2c5b438e288cea,
813            fidl::encoding::DynamicFlags::empty(),
814            _decode,
815        )
816    }
817}
818
819pub struct PeerControllerEventStream {
820    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
821}
822
823impl std::marker::Unpin for PeerControllerEventStream {}
824
825impl futures::stream::FusedStream for PeerControllerEventStream {
826    fn is_terminated(&self) -> bool {
827        self.event_receiver.is_terminated()
828    }
829}
830
831impl futures::Stream for PeerControllerEventStream {
832    type Item = Result<PeerControllerEvent, fidl::Error>;
833
834    fn poll_next(
835        mut self: std::pin::Pin<&mut Self>,
836        cx: &mut std::task::Context<'_>,
837    ) -> std::task::Poll<Option<Self::Item>> {
838        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
839            &mut self.event_receiver,
840            cx
841        )?) {
842            Some(buf) => std::task::Poll::Ready(Some(PeerControllerEvent::decode(buf))),
843            None => std::task::Poll::Ready(None),
844        }
845    }
846}
847
848#[derive(Debug)]
849pub enum PeerControllerEvent {}
850
851impl PeerControllerEvent {
852    /// Decodes a message buffer as a [`PeerControllerEvent`].
853    fn decode(
854        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
855    ) -> Result<PeerControllerEvent, fidl::Error> {
856        let (bytes, _handles) = buf.split_mut();
857        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
858        debug_assert_eq!(tx_header.tx_id, 0);
859        match tx_header.ordinal {
860            _ => Err(fidl::Error::UnknownOrdinal {
861                ordinal: tx_header.ordinal,
862                protocol_name:
863                    <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
864            }),
865        }
866    }
867}
868
869/// A Stream of incoming requests for fuchsia.bluetooth.avdtp.test/PeerController.
870pub struct PeerControllerRequestStream {
871    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
872    is_terminated: bool,
873}
874
875impl std::marker::Unpin for PeerControllerRequestStream {}
876
877impl futures::stream::FusedStream for PeerControllerRequestStream {
878    fn is_terminated(&self) -> bool {
879        self.is_terminated
880    }
881}
882
883impl fidl::endpoints::RequestStream for PeerControllerRequestStream {
884    type Protocol = PeerControllerMarker;
885    type ControlHandle = PeerControllerControlHandle;
886
887    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
888        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
889    }
890
891    fn control_handle(&self) -> Self::ControlHandle {
892        PeerControllerControlHandle { inner: self.inner.clone() }
893    }
894
895    fn into_inner(
896        self,
897    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
898    {
899        (self.inner, self.is_terminated)
900    }
901
902    fn from_inner(
903        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
904        is_terminated: bool,
905    ) -> Self {
906        Self { inner, is_terminated }
907    }
908}
909
910impl futures::Stream for PeerControllerRequestStream {
911    type Item = Result<PeerControllerRequest, fidl::Error>;
912
913    fn poll_next(
914        mut self: std::pin::Pin<&mut Self>,
915        cx: &mut std::task::Context<'_>,
916    ) -> std::task::Poll<Option<Self::Item>> {
917        let this = &mut *self;
918        if this.inner.check_shutdown(cx) {
919            this.is_terminated = true;
920            return std::task::Poll::Ready(None);
921        }
922        if this.is_terminated {
923            panic!("polled PeerControllerRequestStream after completion");
924        }
925        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
926            |bytes, handles| {
927                match this.inner.channel().read_etc(cx, bytes, handles) {
928                    std::task::Poll::Ready(Ok(())) => {}
929                    std::task::Poll::Pending => return std::task::Poll::Pending,
930                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
931                        this.is_terminated = true;
932                        return std::task::Poll::Ready(None);
933                    }
934                    std::task::Poll::Ready(Err(e)) => {
935                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
936                            e.into(),
937                        ))))
938                    }
939                }
940
941                // A message has been received from the channel
942                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
943
944                std::task::Poll::Ready(Some(match header.ordinal {
945                    0x35f45144acf701ae => {
946                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947                        let mut req = fidl::new_empty!(
948                            fidl::encoding::EmptyPayload,
949                            fidl::encoding::DefaultFuchsiaResourceDialect
950                        );
951                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
952                        let control_handle =
953                            PeerControllerControlHandle { inner: this.inner.clone() };
954                        Ok(PeerControllerRequest::SetConfiguration {
955                            responder: PeerControllerSetConfigurationResponder {
956                                control_handle: std::mem::ManuallyDrop::new(control_handle),
957                                tx_id: header.tx_id,
958                            },
959                        })
960                    }
961                    0x507eb0483e8d50d => {
962                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963                        let mut req = fidl::new_empty!(
964                            fidl::encoding::EmptyPayload,
965                            fidl::encoding::DefaultFuchsiaResourceDialect
966                        );
967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
968                        let control_handle =
969                            PeerControllerControlHandle { inner: this.inner.clone() };
970                        Ok(PeerControllerRequest::GetConfiguration {
971                            responder: PeerControllerGetConfigurationResponder {
972                                control_handle: std::mem::ManuallyDrop::new(control_handle),
973                                tx_id: header.tx_id,
974                            },
975                        })
976                    }
977                    0x43465c9341d472eb => {
978                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
979                        let mut req = fidl::new_empty!(
980                            fidl::encoding::EmptyPayload,
981                            fidl::encoding::DefaultFuchsiaResourceDialect
982                        );
983                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
984                        let control_handle =
985                            PeerControllerControlHandle { inner: this.inner.clone() };
986                        Ok(PeerControllerRequest::SuspendStream {
987                            responder: PeerControllerSuspendStreamResponder {
988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
989                                tx_id: header.tx_id,
990                            },
991                        })
992                    }
993                    0x7ce8e3b693e20fe3 => {
994                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
995                        let mut req = fidl::new_empty!(
996                            fidl::encoding::EmptyPayload,
997                            fidl::encoding::DefaultFuchsiaResourceDialect
998                        );
999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1000                        let control_handle =
1001                            PeerControllerControlHandle { inner: this.inner.clone() };
1002                        Ok(PeerControllerRequest::SuspendAndReconfigure {
1003                            responder: PeerControllerSuspendAndReconfigureResponder {
1004                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1005                                tx_id: header.tx_id,
1006                            },
1007                        })
1008                    }
1009                    0x438e16ccd91eb5e5 => {
1010                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1011                        let mut req = fidl::new_empty!(
1012                            fidl::encoding::EmptyPayload,
1013                            fidl::encoding::DefaultFuchsiaResourceDialect
1014                        );
1015                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1016                        let control_handle =
1017                            PeerControllerControlHandle { inner: this.inner.clone() };
1018                        Ok(PeerControllerRequest::EstablishStream {
1019                            responder: PeerControllerEstablishStreamResponder {
1020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1021                                tx_id: header.tx_id,
1022                            },
1023                        })
1024                    }
1025                    0x4884104b373151c6 => {
1026                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1027                        let mut req = fidl::new_empty!(
1028                            fidl::encoding::EmptyPayload,
1029                            fidl::encoding::DefaultFuchsiaResourceDialect
1030                        );
1031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1032                        let control_handle =
1033                            PeerControllerControlHandle { inner: this.inner.clone() };
1034                        Ok(PeerControllerRequest::ReleaseStream {
1035                            responder: PeerControllerReleaseStreamResponder {
1036                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1037                                tx_id: header.tx_id,
1038                            },
1039                        })
1040                    }
1041                    0xf85b067ed144997 => {
1042                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1043                        let mut req = fidl::new_empty!(
1044                            fidl::encoding::EmptyPayload,
1045                            fidl::encoding::DefaultFuchsiaResourceDialect
1046                        );
1047                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1048                        let control_handle =
1049                            PeerControllerControlHandle { inner: this.inner.clone() };
1050                        Ok(PeerControllerRequest::AbortStream {
1051                            responder: PeerControllerAbortStreamResponder {
1052                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1053                                tx_id: header.tx_id,
1054                            },
1055                        })
1056                    }
1057                    0xd0ead9aec2ebf77 => {
1058                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1059                        let mut req = fidl::new_empty!(
1060                            fidl::encoding::EmptyPayload,
1061                            fidl::encoding::DefaultFuchsiaResourceDialect
1062                        );
1063                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1064                        let control_handle =
1065                            PeerControllerControlHandle { inner: this.inner.clone() };
1066                        Ok(PeerControllerRequest::StartStream {
1067                            responder: PeerControllerStartStreamResponder {
1068                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1069                                tx_id: header.tx_id,
1070                            },
1071                        })
1072                    }
1073                    0x559404d6a9629c60 => {
1074                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1075                        let mut req = fidl::new_empty!(
1076                            fidl::encoding::EmptyPayload,
1077                            fidl::encoding::DefaultFuchsiaResourceDialect
1078                        );
1079                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1080                        let control_handle =
1081                            PeerControllerControlHandle { inner: this.inner.clone() };
1082                        Ok(PeerControllerRequest::ReconfigureStream {
1083                            responder: PeerControllerReconfigureStreamResponder {
1084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1085                                tx_id: header.tx_id,
1086                            },
1087                        })
1088                    }
1089                    0x16884c07e6d969a7 => {
1090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1091                        let mut req = fidl::new_empty!(
1092                            fidl::encoding::EmptyPayload,
1093                            fidl::encoding::DefaultFuchsiaResourceDialect
1094                        );
1095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1096                        let control_handle =
1097                            PeerControllerControlHandle { inner: this.inner.clone() };
1098                        Ok(PeerControllerRequest::GetCapabilities {
1099                            responder: PeerControllerGetCapabilitiesResponder {
1100                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1101                                tx_id: header.tx_id,
1102                            },
1103                        })
1104                    }
1105                    0x1e2c5b438e288cea => {
1106                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1107                        let mut req = fidl::new_empty!(
1108                            fidl::encoding::EmptyPayload,
1109                            fidl::encoding::DefaultFuchsiaResourceDialect
1110                        );
1111                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1112                        let control_handle =
1113                            PeerControllerControlHandle { inner: this.inner.clone() };
1114                        Ok(PeerControllerRequest::GetAllCapabilities {
1115                            responder: PeerControllerGetAllCapabilitiesResponder {
1116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1117                                tx_id: header.tx_id,
1118                            },
1119                        })
1120                    }
1121                    _ => Err(fidl::Error::UnknownOrdinal {
1122                        ordinal: header.ordinal,
1123                        protocol_name:
1124                            <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1125                    }),
1126                }))
1127            },
1128        )
1129    }
1130}
1131
1132/// PeerController is an indirect control protocol used for driving the AVDTP library.
1133/// This protocol provides the client with an interface for initiating AVDTP commands
1134/// out of band. To drive end-to-end functionality of AVDTP see
1135/// [bt-profiles](//src/connectivity/bluetooth/profiles).
1136/// * `error PeerError` indicates a procedure failure.
1137/// The current Get*() & SetConfiguration() methods can be interpreted as only initiating an AVDTP
1138/// procedure. The implementations of the Get*() and SetConfiguration() methods use generic
1139/// capabilities and stream information.
1140#[derive(Debug)]
1141pub enum PeerControllerRequest {
1142    /// Initiate a stream configuration procedure.
1143    /// No configuration information is specified because generic config information will
1144    /// be used to initiate the procedure.
1145    SetConfiguration { responder: PeerControllerSetConfigurationResponder },
1146    /// Initiate a procedure to get the configuration information of the peer stream.
1147    /// The result is discarded because PeerController only initiates the procedure.
1148    GetConfiguration { responder: PeerControllerGetConfigurationResponder },
1149    /// Initiate a suspend request to the stream.
1150    /// This command will not resume nor reconfigure the stream.
1151    SuspendStream { responder: PeerControllerSuspendStreamResponder },
1152    /// A "chained" set of procedures on the current stream.
1153    /// SuspendStream() followed by ReconfigureStream().
1154    /// Reconfigure() configures the stream that is currently open.
1155    SuspendAndReconfigure { responder: PeerControllerSuspendAndReconfigureResponder },
1156    /// Initiate stream establishment with the peer.
1157    EstablishStream { responder: PeerControllerEstablishStreamResponder },
1158    /// Release the current stream that is owned by the peer.
1159    /// If the streaming channel doesn't exist, no action will be taken.
1160    ReleaseStream { responder: PeerControllerReleaseStreamResponder },
1161    /// Initiate an abort procedure on the current stream.
1162    /// If the streaming channel doesn't exist, no action will be taken.
1163    AbortStream { responder: PeerControllerAbortStreamResponder },
1164    /// Start streaming media on the current stream that is owned by the peer.
1165    /// If the streaming channel doesn't exist, no action will be taken.
1166    StartStream { responder: PeerControllerStartStreamResponder },
1167    /// Initiate a reconfiguration procedure for the current stream.
1168    /// No configuration information is specified because a generic set of config
1169    /// information will be used to initiate the procedure.
1170    ReconfigureStream { responder: PeerControllerReconfigureStreamResponder },
1171    /// Initiate a procedure to get the capabilities of the peer.
1172    /// The result is discarded because PeerController only initiates the procedure.
1173    GetCapabilities { responder: PeerControllerGetCapabilitiesResponder },
1174    /// Initiate a procedure to get the capabilities of the peer.
1175    /// The result is discarded because PeerController only initiates the procedure.
1176    GetAllCapabilities { responder: PeerControllerGetAllCapabilitiesResponder },
1177}
1178
1179impl PeerControllerRequest {
1180    #[allow(irrefutable_let_patterns)]
1181    pub fn into_set_configuration(self) -> Option<(PeerControllerSetConfigurationResponder)> {
1182        if let PeerControllerRequest::SetConfiguration { responder } = self {
1183            Some((responder))
1184        } else {
1185            None
1186        }
1187    }
1188
1189    #[allow(irrefutable_let_patterns)]
1190    pub fn into_get_configuration(self) -> Option<(PeerControllerGetConfigurationResponder)> {
1191        if let PeerControllerRequest::GetConfiguration { responder } = self {
1192            Some((responder))
1193        } else {
1194            None
1195        }
1196    }
1197
1198    #[allow(irrefutable_let_patterns)]
1199    pub fn into_suspend_stream(self) -> Option<(PeerControllerSuspendStreamResponder)> {
1200        if let PeerControllerRequest::SuspendStream { responder } = self {
1201            Some((responder))
1202        } else {
1203            None
1204        }
1205    }
1206
1207    #[allow(irrefutable_let_patterns)]
1208    pub fn into_suspend_and_reconfigure(
1209        self,
1210    ) -> Option<(PeerControllerSuspendAndReconfigureResponder)> {
1211        if let PeerControllerRequest::SuspendAndReconfigure { responder } = self {
1212            Some((responder))
1213        } else {
1214            None
1215        }
1216    }
1217
1218    #[allow(irrefutable_let_patterns)]
1219    pub fn into_establish_stream(self) -> Option<(PeerControllerEstablishStreamResponder)> {
1220        if let PeerControllerRequest::EstablishStream { responder } = self {
1221            Some((responder))
1222        } else {
1223            None
1224        }
1225    }
1226
1227    #[allow(irrefutable_let_patterns)]
1228    pub fn into_release_stream(self) -> Option<(PeerControllerReleaseStreamResponder)> {
1229        if let PeerControllerRequest::ReleaseStream { responder } = self {
1230            Some((responder))
1231        } else {
1232            None
1233        }
1234    }
1235
1236    #[allow(irrefutable_let_patterns)]
1237    pub fn into_abort_stream(self) -> Option<(PeerControllerAbortStreamResponder)> {
1238        if let PeerControllerRequest::AbortStream { responder } = self {
1239            Some((responder))
1240        } else {
1241            None
1242        }
1243    }
1244
1245    #[allow(irrefutable_let_patterns)]
1246    pub fn into_start_stream(self) -> Option<(PeerControllerStartStreamResponder)> {
1247        if let PeerControllerRequest::StartStream { responder } = self {
1248            Some((responder))
1249        } else {
1250            None
1251        }
1252    }
1253
1254    #[allow(irrefutable_let_patterns)]
1255    pub fn into_reconfigure_stream(self) -> Option<(PeerControllerReconfigureStreamResponder)> {
1256        if let PeerControllerRequest::ReconfigureStream { responder } = self {
1257            Some((responder))
1258        } else {
1259            None
1260        }
1261    }
1262
1263    #[allow(irrefutable_let_patterns)]
1264    pub fn into_get_capabilities(self) -> Option<(PeerControllerGetCapabilitiesResponder)> {
1265        if let PeerControllerRequest::GetCapabilities { responder } = self {
1266            Some((responder))
1267        } else {
1268            None
1269        }
1270    }
1271
1272    #[allow(irrefutable_let_patterns)]
1273    pub fn into_get_all_capabilities(self) -> Option<(PeerControllerGetAllCapabilitiesResponder)> {
1274        if let PeerControllerRequest::GetAllCapabilities { responder } = self {
1275            Some((responder))
1276        } else {
1277            None
1278        }
1279    }
1280
1281    /// Name of the method defined in FIDL
1282    pub fn method_name(&self) -> &'static str {
1283        match *self {
1284            PeerControllerRequest::SetConfiguration { .. } => "set_configuration",
1285            PeerControllerRequest::GetConfiguration { .. } => "get_configuration",
1286            PeerControllerRequest::SuspendStream { .. } => "suspend_stream",
1287            PeerControllerRequest::SuspendAndReconfigure { .. } => "suspend_and_reconfigure",
1288            PeerControllerRequest::EstablishStream { .. } => "establish_stream",
1289            PeerControllerRequest::ReleaseStream { .. } => "release_stream",
1290            PeerControllerRequest::AbortStream { .. } => "abort_stream",
1291            PeerControllerRequest::StartStream { .. } => "start_stream",
1292            PeerControllerRequest::ReconfigureStream { .. } => "reconfigure_stream",
1293            PeerControllerRequest::GetCapabilities { .. } => "get_capabilities",
1294            PeerControllerRequest::GetAllCapabilities { .. } => "get_all_capabilities",
1295        }
1296    }
1297}
1298
1299#[derive(Debug, Clone)]
1300pub struct PeerControllerControlHandle {
1301    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1302}
1303
1304impl fidl::endpoints::ControlHandle for PeerControllerControlHandle {
1305    fn shutdown(&self) {
1306        self.inner.shutdown()
1307    }
1308    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1309        self.inner.shutdown_with_epitaph(status)
1310    }
1311
1312    fn is_closed(&self) -> bool {
1313        self.inner.channel().is_closed()
1314    }
1315    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1316        self.inner.channel().on_closed()
1317    }
1318
1319    #[cfg(target_os = "fuchsia")]
1320    fn signal_peer(
1321        &self,
1322        clear_mask: zx::Signals,
1323        set_mask: zx::Signals,
1324    ) -> Result<(), zx_status::Status> {
1325        use fidl::Peered;
1326        self.inner.channel().signal_peer(clear_mask, set_mask)
1327    }
1328}
1329
1330impl PeerControllerControlHandle {}
1331
1332#[must_use = "FIDL methods require a response to be sent"]
1333#[derive(Debug)]
1334pub struct PeerControllerSetConfigurationResponder {
1335    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1336    tx_id: u32,
1337}
1338
1339/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1340/// if the responder is dropped without sending a response, so that the client
1341/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1342impl std::ops::Drop for PeerControllerSetConfigurationResponder {
1343    fn drop(&mut self) {
1344        self.control_handle.shutdown();
1345        // Safety: drops once, never accessed again
1346        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1347    }
1348}
1349
1350impl fidl::endpoints::Responder for PeerControllerSetConfigurationResponder {
1351    type ControlHandle = PeerControllerControlHandle;
1352
1353    fn control_handle(&self) -> &PeerControllerControlHandle {
1354        &self.control_handle
1355    }
1356
1357    fn drop_without_shutdown(mut self) {
1358        // Safety: drops once, never accessed again due to mem::forget
1359        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1360        // Prevent Drop from running (which would shut down the channel)
1361        std::mem::forget(self);
1362    }
1363}
1364
1365impl PeerControllerSetConfigurationResponder {
1366    /// Sends a response to the FIDL transaction.
1367    ///
1368    /// Sets the channel to shutdown if an error occurs.
1369    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1370        let _result = self.send_raw(result);
1371        if _result.is_err() {
1372            self.control_handle.shutdown();
1373        }
1374        self.drop_without_shutdown();
1375        _result
1376    }
1377
1378    /// Similar to "send" but does not shutdown the channel if an error occurs.
1379    pub fn send_no_shutdown_on_err(
1380        self,
1381        mut result: Result<(), PeerError>,
1382    ) -> Result<(), fidl::Error> {
1383        let _result = self.send_raw(result);
1384        self.drop_without_shutdown();
1385        _result
1386    }
1387
1388    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1389        self.control_handle
1390            .inner
1391            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1392                result,
1393                self.tx_id,
1394                0x35f45144acf701ae,
1395                fidl::encoding::DynamicFlags::empty(),
1396            )
1397    }
1398}
1399
1400#[must_use = "FIDL methods require a response to be sent"]
1401#[derive(Debug)]
1402pub struct PeerControllerGetConfigurationResponder {
1403    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1404    tx_id: u32,
1405}
1406
1407/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1408/// if the responder is dropped without sending a response, so that the client
1409/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1410impl std::ops::Drop for PeerControllerGetConfigurationResponder {
1411    fn drop(&mut self) {
1412        self.control_handle.shutdown();
1413        // Safety: drops once, never accessed again
1414        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1415    }
1416}
1417
1418impl fidl::endpoints::Responder for PeerControllerGetConfigurationResponder {
1419    type ControlHandle = PeerControllerControlHandle;
1420
1421    fn control_handle(&self) -> &PeerControllerControlHandle {
1422        &self.control_handle
1423    }
1424
1425    fn drop_without_shutdown(mut self) {
1426        // Safety: drops once, never accessed again due to mem::forget
1427        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1428        // Prevent Drop from running (which would shut down the channel)
1429        std::mem::forget(self);
1430    }
1431}
1432
1433impl PeerControllerGetConfigurationResponder {
1434    /// Sends a response to the FIDL transaction.
1435    ///
1436    /// Sets the channel to shutdown if an error occurs.
1437    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1438        let _result = self.send_raw(result);
1439        if _result.is_err() {
1440            self.control_handle.shutdown();
1441        }
1442        self.drop_without_shutdown();
1443        _result
1444    }
1445
1446    /// Similar to "send" but does not shutdown the channel if an error occurs.
1447    pub fn send_no_shutdown_on_err(
1448        self,
1449        mut result: Result<(), PeerError>,
1450    ) -> Result<(), fidl::Error> {
1451        let _result = self.send_raw(result);
1452        self.drop_without_shutdown();
1453        _result
1454    }
1455
1456    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1457        self.control_handle
1458            .inner
1459            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1460                result,
1461                self.tx_id,
1462                0x507eb0483e8d50d,
1463                fidl::encoding::DynamicFlags::empty(),
1464            )
1465    }
1466}
1467
1468#[must_use = "FIDL methods require a response to be sent"]
1469#[derive(Debug)]
1470pub struct PeerControllerSuspendStreamResponder {
1471    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1472    tx_id: u32,
1473}
1474
1475/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1476/// if the responder is dropped without sending a response, so that the client
1477/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1478impl std::ops::Drop for PeerControllerSuspendStreamResponder {
1479    fn drop(&mut self) {
1480        self.control_handle.shutdown();
1481        // Safety: drops once, never accessed again
1482        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1483    }
1484}
1485
1486impl fidl::endpoints::Responder for PeerControllerSuspendStreamResponder {
1487    type ControlHandle = PeerControllerControlHandle;
1488
1489    fn control_handle(&self) -> &PeerControllerControlHandle {
1490        &self.control_handle
1491    }
1492
1493    fn drop_without_shutdown(mut self) {
1494        // Safety: drops once, never accessed again due to mem::forget
1495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1496        // Prevent Drop from running (which would shut down the channel)
1497        std::mem::forget(self);
1498    }
1499}
1500
1501impl PeerControllerSuspendStreamResponder {
1502    /// Sends a response to the FIDL transaction.
1503    ///
1504    /// Sets the channel to shutdown if an error occurs.
1505    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1506        let _result = self.send_raw(result);
1507        if _result.is_err() {
1508            self.control_handle.shutdown();
1509        }
1510        self.drop_without_shutdown();
1511        _result
1512    }
1513
1514    /// Similar to "send" but does not shutdown the channel if an error occurs.
1515    pub fn send_no_shutdown_on_err(
1516        self,
1517        mut result: Result<(), PeerError>,
1518    ) -> Result<(), fidl::Error> {
1519        let _result = self.send_raw(result);
1520        self.drop_without_shutdown();
1521        _result
1522    }
1523
1524    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1525        self.control_handle
1526            .inner
1527            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1528                result,
1529                self.tx_id,
1530                0x43465c9341d472eb,
1531                fidl::encoding::DynamicFlags::empty(),
1532            )
1533    }
1534}
1535
1536#[must_use = "FIDL methods require a response to be sent"]
1537#[derive(Debug)]
1538pub struct PeerControllerSuspendAndReconfigureResponder {
1539    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1540    tx_id: u32,
1541}
1542
1543/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1544/// if the responder is dropped without sending a response, so that the client
1545/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1546impl std::ops::Drop for PeerControllerSuspendAndReconfigureResponder {
1547    fn drop(&mut self) {
1548        self.control_handle.shutdown();
1549        // Safety: drops once, never accessed again
1550        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1551    }
1552}
1553
1554impl fidl::endpoints::Responder for PeerControllerSuspendAndReconfigureResponder {
1555    type ControlHandle = PeerControllerControlHandle;
1556
1557    fn control_handle(&self) -> &PeerControllerControlHandle {
1558        &self.control_handle
1559    }
1560
1561    fn drop_without_shutdown(mut self) {
1562        // Safety: drops once, never accessed again due to mem::forget
1563        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1564        // Prevent Drop from running (which would shut down the channel)
1565        std::mem::forget(self);
1566    }
1567}
1568
1569impl PeerControllerSuspendAndReconfigureResponder {
1570    /// Sends a response to the FIDL transaction.
1571    ///
1572    /// Sets the channel to shutdown if an error occurs.
1573    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1574        let _result = self.send_raw(result);
1575        if _result.is_err() {
1576            self.control_handle.shutdown();
1577        }
1578        self.drop_without_shutdown();
1579        _result
1580    }
1581
1582    /// Similar to "send" but does not shutdown the channel if an error occurs.
1583    pub fn send_no_shutdown_on_err(
1584        self,
1585        mut result: Result<(), PeerError>,
1586    ) -> Result<(), fidl::Error> {
1587        let _result = self.send_raw(result);
1588        self.drop_without_shutdown();
1589        _result
1590    }
1591
1592    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1593        self.control_handle
1594            .inner
1595            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1596                result,
1597                self.tx_id,
1598                0x7ce8e3b693e20fe3,
1599                fidl::encoding::DynamicFlags::empty(),
1600            )
1601    }
1602}
1603
1604#[must_use = "FIDL methods require a response to be sent"]
1605#[derive(Debug)]
1606pub struct PeerControllerEstablishStreamResponder {
1607    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1608    tx_id: u32,
1609}
1610
1611/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1612/// if the responder is dropped without sending a response, so that the client
1613/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1614impl std::ops::Drop for PeerControllerEstablishStreamResponder {
1615    fn drop(&mut self) {
1616        self.control_handle.shutdown();
1617        // Safety: drops once, never accessed again
1618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1619    }
1620}
1621
1622impl fidl::endpoints::Responder for PeerControllerEstablishStreamResponder {
1623    type ControlHandle = PeerControllerControlHandle;
1624
1625    fn control_handle(&self) -> &PeerControllerControlHandle {
1626        &self.control_handle
1627    }
1628
1629    fn drop_without_shutdown(mut self) {
1630        // Safety: drops once, never accessed again due to mem::forget
1631        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1632        // Prevent Drop from running (which would shut down the channel)
1633        std::mem::forget(self);
1634    }
1635}
1636
1637impl PeerControllerEstablishStreamResponder {
1638    /// Sends a response to the FIDL transaction.
1639    ///
1640    /// Sets the channel to shutdown if an error occurs.
1641    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1642        let _result = self.send_raw(result);
1643        if _result.is_err() {
1644            self.control_handle.shutdown();
1645        }
1646        self.drop_without_shutdown();
1647        _result
1648    }
1649
1650    /// Similar to "send" but does not shutdown the channel if an error occurs.
1651    pub fn send_no_shutdown_on_err(
1652        self,
1653        mut result: Result<(), PeerError>,
1654    ) -> Result<(), fidl::Error> {
1655        let _result = self.send_raw(result);
1656        self.drop_without_shutdown();
1657        _result
1658    }
1659
1660    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1661        self.control_handle
1662            .inner
1663            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1664                result,
1665                self.tx_id,
1666                0x438e16ccd91eb5e5,
1667                fidl::encoding::DynamicFlags::empty(),
1668            )
1669    }
1670}
1671
1672#[must_use = "FIDL methods require a response to be sent"]
1673#[derive(Debug)]
1674pub struct PeerControllerReleaseStreamResponder {
1675    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1676    tx_id: u32,
1677}
1678
1679/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1680/// if the responder is dropped without sending a response, so that the client
1681/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1682impl std::ops::Drop for PeerControllerReleaseStreamResponder {
1683    fn drop(&mut self) {
1684        self.control_handle.shutdown();
1685        // Safety: drops once, never accessed again
1686        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1687    }
1688}
1689
1690impl fidl::endpoints::Responder for PeerControllerReleaseStreamResponder {
1691    type ControlHandle = PeerControllerControlHandle;
1692
1693    fn control_handle(&self) -> &PeerControllerControlHandle {
1694        &self.control_handle
1695    }
1696
1697    fn drop_without_shutdown(mut self) {
1698        // Safety: drops once, never accessed again due to mem::forget
1699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1700        // Prevent Drop from running (which would shut down the channel)
1701        std::mem::forget(self);
1702    }
1703}
1704
1705impl PeerControllerReleaseStreamResponder {
1706    /// Sends a response to the FIDL transaction.
1707    ///
1708    /// Sets the channel to shutdown if an error occurs.
1709    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1710        let _result = self.send_raw(result);
1711        if _result.is_err() {
1712            self.control_handle.shutdown();
1713        }
1714        self.drop_without_shutdown();
1715        _result
1716    }
1717
1718    /// Similar to "send" but does not shutdown the channel if an error occurs.
1719    pub fn send_no_shutdown_on_err(
1720        self,
1721        mut result: Result<(), PeerError>,
1722    ) -> Result<(), fidl::Error> {
1723        let _result = self.send_raw(result);
1724        self.drop_without_shutdown();
1725        _result
1726    }
1727
1728    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1729        self.control_handle
1730            .inner
1731            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1732                result,
1733                self.tx_id,
1734                0x4884104b373151c6,
1735                fidl::encoding::DynamicFlags::empty(),
1736            )
1737    }
1738}
1739
1740#[must_use = "FIDL methods require a response to be sent"]
1741#[derive(Debug)]
1742pub struct PeerControllerAbortStreamResponder {
1743    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1744    tx_id: u32,
1745}
1746
1747/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1748/// if the responder is dropped without sending a response, so that the client
1749/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1750impl std::ops::Drop for PeerControllerAbortStreamResponder {
1751    fn drop(&mut self) {
1752        self.control_handle.shutdown();
1753        // Safety: drops once, never accessed again
1754        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1755    }
1756}
1757
1758impl fidl::endpoints::Responder for PeerControllerAbortStreamResponder {
1759    type ControlHandle = PeerControllerControlHandle;
1760
1761    fn control_handle(&self) -> &PeerControllerControlHandle {
1762        &self.control_handle
1763    }
1764
1765    fn drop_without_shutdown(mut self) {
1766        // Safety: drops once, never accessed again due to mem::forget
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768        // Prevent Drop from running (which would shut down the channel)
1769        std::mem::forget(self);
1770    }
1771}
1772
1773impl PeerControllerAbortStreamResponder {
1774    /// Sends a response to the FIDL transaction.
1775    ///
1776    /// Sets the channel to shutdown if an error occurs.
1777    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1778        let _result = self.send_raw(result);
1779        if _result.is_err() {
1780            self.control_handle.shutdown();
1781        }
1782        self.drop_without_shutdown();
1783        _result
1784    }
1785
1786    /// Similar to "send" but does not shutdown the channel if an error occurs.
1787    pub fn send_no_shutdown_on_err(
1788        self,
1789        mut result: Result<(), PeerError>,
1790    ) -> Result<(), fidl::Error> {
1791        let _result = self.send_raw(result);
1792        self.drop_without_shutdown();
1793        _result
1794    }
1795
1796    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1797        self.control_handle
1798            .inner
1799            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1800                result,
1801                self.tx_id,
1802                0xf85b067ed144997,
1803                fidl::encoding::DynamicFlags::empty(),
1804            )
1805    }
1806}
1807
1808#[must_use = "FIDL methods require a response to be sent"]
1809#[derive(Debug)]
1810pub struct PeerControllerStartStreamResponder {
1811    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1812    tx_id: u32,
1813}
1814
1815/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1816/// if the responder is dropped without sending a response, so that the client
1817/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1818impl std::ops::Drop for PeerControllerStartStreamResponder {
1819    fn drop(&mut self) {
1820        self.control_handle.shutdown();
1821        // Safety: drops once, never accessed again
1822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1823    }
1824}
1825
1826impl fidl::endpoints::Responder for PeerControllerStartStreamResponder {
1827    type ControlHandle = PeerControllerControlHandle;
1828
1829    fn control_handle(&self) -> &PeerControllerControlHandle {
1830        &self.control_handle
1831    }
1832
1833    fn drop_without_shutdown(mut self) {
1834        // Safety: drops once, never accessed again due to mem::forget
1835        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1836        // Prevent Drop from running (which would shut down the channel)
1837        std::mem::forget(self);
1838    }
1839}
1840
1841impl PeerControllerStartStreamResponder {
1842    /// Sends a response to the FIDL transaction.
1843    ///
1844    /// Sets the channel to shutdown if an error occurs.
1845    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1846        let _result = self.send_raw(result);
1847        if _result.is_err() {
1848            self.control_handle.shutdown();
1849        }
1850        self.drop_without_shutdown();
1851        _result
1852    }
1853
1854    /// Similar to "send" but does not shutdown the channel if an error occurs.
1855    pub fn send_no_shutdown_on_err(
1856        self,
1857        mut result: Result<(), PeerError>,
1858    ) -> Result<(), fidl::Error> {
1859        let _result = self.send_raw(result);
1860        self.drop_without_shutdown();
1861        _result
1862    }
1863
1864    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1865        self.control_handle
1866            .inner
1867            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1868                result,
1869                self.tx_id,
1870                0xd0ead9aec2ebf77,
1871                fidl::encoding::DynamicFlags::empty(),
1872            )
1873    }
1874}
1875
1876#[must_use = "FIDL methods require a response to be sent"]
1877#[derive(Debug)]
1878pub struct PeerControllerReconfigureStreamResponder {
1879    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1880    tx_id: u32,
1881}
1882
1883/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1884/// if the responder is dropped without sending a response, so that the client
1885/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1886impl std::ops::Drop for PeerControllerReconfigureStreamResponder {
1887    fn drop(&mut self) {
1888        self.control_handle.shutdown();
1889        // Safety: drops once, never accessed again
1890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1891    }
1892}
1893
1894impl fidl::endpoints::Responder for PeerControllerReconfigureStreamResponder {
1895    type ControlHandle = PeerControllerControlHandle;
1896
1897    fn control_handle(&self) -> &PeerControllerControlHandle {
1898        &self.control_handle
1899    }
1900
1901    fn drop_without_shutdown(mut self) {
1902        // Safety: drops once, never accessed again due to mem::forget
1903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1904        // Prevent Drop from running (which would shut down the channel)
1905        std::mem::forget(self);
1906    }
1907}
1908
1909impl PeerControllerReconfigureStreamResponder {
1910    /// Sends a response to the FIDL transaction.
1911    ///
1912    /// Sets the channel to shutdown if an error occurs.
1913    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1914        let _result = self.send_raw(result);
1915        if _result.is_err() {
1916            self.control_handle.shutdown();
1917        }
1918        self.drop_without_shutdown();
1919        _result
1920    }
1921
1922    /// Similar to "send" but does not shutdown the channel if an error occurs.
1923    pub fn send_no_shutdown_on_err(
1924        self,
1925        mut result: Result<(), PeerError>,
1926    ) -> Result<(), fidl::Error> {
1927        let _result = self.send_raw(result);
1928        self.drop_without_shutdown();
1929        _result
1930    }
1931
1932    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1933        self.control_handle
1934            .inner
1935            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1936                result,
1937                self.tx_id,
1938                0x559404d6a9629c60,
1939                fidl::encoding::DynamicFlags::empty(),
1940            )
1941    }
1942}
1943
1944#[must_use = "FIDL methods require a response to be sent"]
1945#[derive(Debug)]
1946pub struct PeerControllerGetCapabilitiesResponder {
1947    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1948    tx_id: u32,
1949}
1950
1951/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1952/// if the responder is dropped without sending a response, so that the client
1953/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1954impl std::ops::Drop for PeerControllerGetCapabilitiesResponder {
1955    fn drop(&mut self) {
1956        self.control_handle.shutdown();
1957        // Safety: drops once, never accessed again
1958        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1959    }
1960}
1961
1962impl fidl::endpoints::Responder for PeerControllerGetCapabilitiesResponder {
1963    type ControlHandle = PeerControllerControlHandle;
1964
1965    fn control_handle(&self) -> &PeerControllerControlHandle {
1966        &self.control_handle
1967    }
1968
1969    fn drop_without_shutdown(mut self) {
1970        // Safety: drops once, never accessed again due to mem::forget
1971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1972        // Prevent Drop from running (which would shut down the channel)
1973        std::mem::forget(self);
1974    }
1975}
1976
1977impl PeerControllerGetCapabilitiesResponder {
1978    /// Sends a response to the FIDL transaction.
1979    ///
1980    /// Sets the channel to shutdown if an error occurs.
1981    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1982        let _result = self.send_raw(result);
1983        if _result.is_err() {
1984            self.control_handle.shutdown();
1985        }
1986        self.drop_without_shutdown();
1987        _result
1988    }
1989
1990    /// Similar to "send" but does not shutdown the channel if an error occurs.
1991    pub fn send_no_shutdown_on_err(
1992        self,
1993        mut result: Result<(), PeerError>,
1994    ) -> Result<(), fidl::Error> {
1995        let _result = self.send_raw(result);
1996        self.drop_without_shutdown();
1997        _result
1998    }
1999
2000    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
2001        self.control_handle
2002            .inner
2003            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
2004                result,
2005                self.tx_id,
2006                0x16884c07e6d969a7,
2007                fidl::encoding::DynamicFlags::empty(),
2008            )
2009    }
2010}
2011
2012#[must_use = "FIDL methods require a response to be sent"]
2013#[derive(Debug)]
2014pub struct PeerControllerGetAllCapabilitiesResponder {
2015    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
2016    tx_id: u32,
2017}
2018
2019/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
2020/// if the responder is dropped without sending a response, so that the client
2021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2022impl std::ops::Drop for PeerControllerGetAllCapabilitiesResponder {
2023    fn drop(&mut self) {
2024        self.control_handle.shutdown();
2025        // Safety: drops once, never accessed again
2026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2027    }
2028}
2029
2030impl fidl::endpoints::Responder for PeerControllerGetAllCapabilitiesResponder {
2031    type ControlHandle = PeerControllerControlHandle;
2032
2033    fn control_handle(&self) -> &PeerControllerControlHandle {
2034        &self.control_handle
2035    }
2036
2037    fn drop_without_shutdown(mut self) {
2038        // Safety: drops once, never accessed again due to mem::forget
2039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2040        // Prevent Drop from running (which would shut down the channel)
2041        std::mem::forget(self);
2042    }
2043}
2044
2045impl PeerControllerGetAllCapabilitiesResponder {
2046    /// Sends a response to the FIDL transaction.
2047    ///
2048    /// Sets the channel to shutdown if an error occurs.
2049    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
2050        let _result = self.send_raw(result);
2051        if _result.is_err() {
2052            self.control_handle.shutdown();
2053        }
2054        self.drop_without_shutdown();
2055        _result
2056    }
2057
2058    /// Similar to "send" but does not shutdown the channel if an error occurs.
2059    pub fn send_no_shutdown_on_err(
2060        self,
2061        mut result: Result<(), PeerError>,
2062    ) -> Result<(), fidl::Error> {
2063        let _result = self.send_raw(result);
2064        self.drop_without_shutdown();
2065        _result
2066    }
2067
2068    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
2069        self.control_handle
2070            .inner
2071            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
2072                result,
2073                self.tx_id,
2074                0x1e2c5b438e288cea,
2075                fidl::encoding::DynamicFlags::empty(),
2076            )
2077    }
2078}
2079
2080#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2081pub struct PeerManagerMarker;
2082
2083impl fidl::endpoints::ProtocolMarker for PeerManagerMarker {
2084    type Proxy = PeerManagerProxy;
2085    type RequestStream = PeerManagerRequestStream;
2086    #[cfg(target_os = "fuchsia")]
2087    type SynchronousProxy = PeerManagerSynchronousProxy;
2088
2089    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.avdtp.test.PeerManager";
2090}
2091impl fidl::endpoints::DiscoverableProtocolMarker for PeerManagerMarker {}
2092
2093pub trait PeerManagerProxyInterface: Send + Sync {
2094    fn r#get_peer(
2095        &self,
2096        peer_id: &fidl_fuchsia_bluetooth::PeerId,
2097        handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2098    ) -> Result<(), fidl::Error>;
2099    type ConnectedPeersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error>>
2100        + Send;
2101    fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut;
2102}
2103#[derive(Debug)]
2104#[cfg(target_os = "fuchsia")]
2105pub struct PeerManagerSynchronousProxy {
2106    client: fidl::client::sync::Client,
2107}
2108
2109#[cfg(target_os = "fuchsia")]
2110impl fidl::endpoints::SynchronousProxy for PeerManagerSynchronousProxy {
2111    type Proxy = PeerManagerProxy;
2112    type Protocol = PeerManagerMarker;
2113
2114    fn from_channel(inner: fidl::Channel) -> Self {
2115        Self::new(inner)
2116    }
2117
2118    fn into_channel(self) -> fidl::Channel {
2119        self.client.into_channel()
2120    }
2121
2122    fn as_channel(&self) -> &fidl::Channel {
2123        self.client.as_channel()
2124    }
2125}
2126
2127#[cfg(target_os = "fuchsia")]
2128impl PeerManagerSynchronousProxy {
2129    pub fn new(channel: fidl::Channel) -> Self {
2130        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2131        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2132    }
2133
2134    pub fn into_channel(self) -> fidl::Channel {
2135        self.client.into_channel()
2136    }
2137
2138    /// Waits until an event arrives and returns it. It is safe for other
2139    /// threads to make concurrent requests while waiting for an event.
2140    pub fn wait_for_event(
2141        &self,
2142        deadline: zx::MonotonicInstant,
2143    ) -> Result<PeerManagerEvent, fidl::Error> {
2144        PeerManagerEvent::decode(self.client.wait_for_event(deadline)?)
2145    }
2146
2147    /// Connects to the server specified by a `peer_id`.
2148    /// On success, `handle` will be used for initiating PeerController procedures.
2149    /// On peer disconnect, the handle will be dropped and closed on the server side.
2150    pub fn r#get_peer(
2151        &self,
2152        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2153        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2154    ) -> Result<(), fidl::Error> {
2155        self.client.send::<PeerManagerGetPeerRequest>(
2156            (peer_id, handle),
2157            0x2a506872f2b04086,
2158            fidl::encoding::DynamicFlags::empty(),
2159        )
2160    }
2161
2162    /// Returns the `bt.PeerId` of each currently connected peer.
2163    pub fn r#connected_peers(
2164        &self,
2165        ___deadline: zx::MonotonicInstant,
2166    ) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
2167        let _response = self
2168            .client
2169            .send_query::<fidl::encoding::EmptyPayload, PeerManagerConnectedPeersResponse>(
2170                (),
2171                0x1deaca0295d5f8d6,
2172                fidl::encoding::DynamicFlags::empty(),
2173                ___deadline,
2174            )?;
2175        Ok(_response.peer_ids)
2176    }
2177}
2178
2179#[derive(Debug, Clone)]
2180pub struct PeerManagerProxy {
2181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2182}
2183
2184impl fidl::endpoints::Proxy for PeerManagerProxy {
2185    type Protocol = PeerManagerMarker;
2186
2187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2188        Self::new(inner)
2189    }
2190
2191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2192        self.client.into_channel().map_err(|client| Self { client })
2193    }
2194
2195    fn as_channel(&self) -> &::fidl::AsyncChannel {
2196        self.client.as_channel()
2197    }
2198}
2199
2200impl PeerManagerProxy {
2201    /// Create a new Proxy for fuchsia.bluetooth.avdtp.test/PeerManager.
2202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2203        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2204        Self { client: fidl::client::Client::new(channel, protocol_name) }
2205    }
2206
2207    /// Get a Stream of events from the remote end of the protocol.
2208    ///
2209    /// # Panics
2210    ///
2211    /// Panics if the event stream was already taken.
2212    pub fn take_event_stream(&self) -> PeerManagerEventStream {
2213        PeerManagerEventStream { event_receiver: self.client.take_event_receiver() }
2214    }
2215
2216    /// Connects to the server specified by a `peer_id`.
2217    /// On success, `handle` will be used for initiating PeerController procedures.
2218    /// On peer disconnect, the handle will be dropped and closed on the server side.
2219    pub fn r#get_peer(
2220        &self,
2221        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2222        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2223    ) -> Result<(), fidl::Error> {
2224        PeerManagerProxyInterface::r#get_peer(self, peer_id, handle)
2225    }
2226
2227    /// Returns the `bt.PeerId` of each currently connected peer.
2228    pub fn r#connected_peers(
2229        &self,
2230    ) -> fidl::client::QueryResponseFut<
2231        Vec<fidl_fuchsia_bluetooth::PeerId>,
2232        fidl::encoding::DefaultFuchsiaResourceDialect,
2233    > {
2234        PeerManagerProxyInterface::r#connected_peers(self)
2235    }
2236}
2237
2238impl PeerManagerProxyInterface for PeerManagerProxy {
2239    fn r#get_peer(
2240        &self,
2241        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2242        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2243    ) -> Result<(), fidl::Error> {
2244        self.client.send::<PeerManagerGetPeerRequest>(
2245            (peer_id, handle),
2246            0x2a506872f2b04086,
2247            fidl::encoding::DynamicFlags::empty(),
2248        )
2249    }
2250
2251    type ConnectedPeersResponseFut = fidl::client::QueryResponseFut<
2252        Vec<fidl_fuchsia_bluetooth::PeerId>,
2253        fidl::encoding::DefaultFuchsiaResourceDialect,
2254    >;
2255    fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut {
2256        fn _decode(
2257            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2258        ) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
2259            let _response = fidl::client::decode_transaction_body::<
2260                PeerManagerConnectedPeersResponse,
2261                fidl::encoding::DefaultFuchsiaResourceDialect,
2262                0x1deaca0295d5f8d6,
2263            >(_buf?)?;
2264            Ok(_response.peer_ids)
2265        }
2266        self.client.send_query_and_decode::<
2267            fidl::encoding::EmptyPayload,
2268            Vec<fidl_fuchsia_bluetooth::PeerId>,
2269        >(
2270            (),
2271            0x1deaca0295d5f8d6,
2272            fidl::encoding::DynamicFlags::empty(),
2273            _decode,
2274        )
2275    }
2276}
2277
2278pub struct PeerManagerEventStream {
2279    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2280}
2281
2282impl std::marker::Unpin for PeerManagerEventStream {}
2283
2284impl futures::stream::FusedStream for PeerManagerEventStream {
2285    fn is_terminated(&self) -> bool {
2286        self.event_receiver.is_terminated()
2287    }
2288}
2289
2290impl futures::Stream for PeerManagerEventStream {
2291    type Item = Result<PeerManagerEvent, fidl::Error>;
2292
2293    fn poll_next(
2294        mut self: std::pin::Pin<&mut Self>,
2295        cx: &mut std::task::Context<'_>,
2296    ) -> std::task::Poll<Option<Self::Item>> {
2297        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2298            &mut self.event_receiver,
2299            cx
2300        )?) {
2301            Some(buf) => std::task::Poll::Ready(Some(PeerManagerEvent::decode(buf))),
2302            None => std::task::Poll::Ready(None),
2303        }
2304    }
2305}
2306
2307#[derive(Debug)]
2308pub enum PeerManagerEvent {
2309    OnPeerConnected { peer_id: fidl_fuchsia_bluetooth::PeerId },
2310}
2311
2312impl PeerManagerEvent {
2313    #[allow(irrefutable_let_patterns)]
2314    pub fn into_on_peer_connected(self) -> Option<fidl_fuchsia_bluetooth::PeerId> {
2315        if let PeerManagerEvent::OnPeerConnected { peer_id } = self {
2316            Some((peer_id))
2317        } else {
2318            None
2319        }
2320    }
2321
2322    /// Decodes a message buffer as a [`PeerManagerEvent`].
2323    fn decode(
2324        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2325    ) -> Result<PeerManagerEvent, fidl::Error> {
2326        let (bytes, _handles) = buf.split_mut();
2327        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2328        debug_assert_eq!(tx_header.tx_id, 0);
2329        match tx_header.ordinal {
2330            0x154e6b9e519774d1 => {
2331                let mut out = fidl::new_empty!(
2332                    PeerManagerOnPeerConnectedRequest,
2333                    fidl::encoding::DefaultFuchsiaResourceDialect
2334                );
2335                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2336                Ok((PeerManagerEvent::OnPeerConnected { peer_id: out.peer_id }))
2337            }
2338            _ => Err(fidl::Error::UnknownOrdinal {
2339                ordinal: tx_header.ordinal,
2340                protocol_name: <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2341            }),
2342        }
2343    }
2344}
2345
2346/// A Stream of incoming requests for fuchsia.bluetooth.avdtp.test/PeerManager.
2347pub struct PeerManagerRequestStream {
2348    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2349    is_terminated: bool,
2350}
2351
2352impl std::marker::Unpin for PeerManagerRequestStream {}
2353
2354impl futures::stream::FusedStream for PeerManagerRequestStream {
2355    fn is_terminated(&self) -> bool {
2356        self.is_terminated
2357    }
2358}
2359
2360impl fidl::endpoints::RequestStream for PeerManagerRequestStream {
2361    type Protocol = PeerManagerMarker;
2362    type ControlHandle = PeerManagerControlHandle;
2363
2364    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2365        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2366    }
2367
2368    fn control_handle(&self) -> Self::ControlHandle {
2369        PeerManagerControlHandle { inner: self.inner.clone() }
2370    }
2371
2372    fn into_inner(
2373        self,
2374    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2375    {
2376        (self.inner, self.is_terminated)
2377    }
2378
2379    fn from_inner(
2380        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2381        is_terminated: bool,
2382    ) -> Self {
2383        Self { inner, is_terminated }
2384    }
2385}
2386
2387impl futures::Stream for PeerManagerRequestStream {
2388    type Item = Result<PeerManagerRequest, fidl::Error>;
2389
2390    fn poll_next(
2391        mut self: std::pin::Pin<&mut Self>,
2392        cx: &mut std::task::Context<'_>,
2393    ) -> std::task::Poll<Option<Self::Item>> {
2394        let this = &mut *self;
2395        if this.inner.check_shutdown(cx) {
2396            this.is_terminated = true;
2397            return std::task::Poll::Ready(None);
2398        }
2399        if this.is_terminated {
2400            panic!("polled PeerManagerRequestStream after completion");
2401        }
2402        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2403            |bytes, handles| {
2404                match this.inner.channel().read_etc(cx, bytes, handles) {
2405                    std::task::Poll::Ready(Ok(())) => {}
2406                    std::task::Poll::Pending => return std::task::Poll::Pending,
2407                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2408                        this.is_terminated = true;
2409                        return std::task::Poll::Ready(None);
2410                    }
2411                    std::task::Poll::Ready(Err(e)) => {
2412                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2413                            e.into(),
2414                        ))))
2415                    }
2416                }
2417
2418                // A message has been received from the channel
2419                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2420
2421                std::task::Poll::Ready(Some(match header.ordinal {
2422                    0x2a506872f2b04086 => {
2423                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2424                        let mut req = fidl::new_empty!(
2425                            PeerManagerGetPeerRequest,
2426                            fidl::encoding::DefaultFuchsiaResourceDialect
2427                        );
2428                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerGetPeerRequest>(&header, _body_bytes, handles, &mut req)?;
2429                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
2430                        Ok(PeerManagerRequest::GetPeer {
2431                            peer_id: req.peer_id,
2432                            handle: req.handle,
2433
2434                            control_handle,
2435                        })
2436                    }
2437                    0x1deaca0295d5f8d6 => {
2438                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2439                        let mut req = fidl::new_empty!(
2440                            fidl::encoding::EmptyPayload,
2441                            fidl::encoding::DefaultFuchsiaResourceDialect
2442                        );
2443                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2444                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
2445                        Ok(PeerManagerRequest::ConnectedPeers {
2446                            responder: PeerManagerConnectedPeersResponder {
2447                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2448                                tx_id: header.tx_id,
2449                            },
2450                        })
2451                    }
2452                    _ => Err(fidl::Error::UnknownOrdinal {
2453                        ordinal: header.ordinal,
2454                        protocol_name:
2455                            <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2456                    }),
2457                }))
2458            },
2459        )
2460    }
2461}
2462
2463/// Control service for an AVDTP Peer.
2464#[derive(Debug)]
2465pub enum PeerManagerRequest {
2466    /// Connects to the server specified by a `peer_id`.
2467    /// On success, `handle` will be used for initiating PeerController procedures.
2468    /// On peer disconnect, the handle will be dropped and closed on the server side.
2469    GetPeer {
2470        peer_id: fidl_fuchsia_bluetooth::PeerId,
2471        handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2472        control_handle: PeerManagerControlHandle,
2473    },
2474    /// Returns the `bt.PeerId` of each currently connected peer.
2475    ConnectedPeers { responder: PeerManagerConnectedPeersResponder },
2476}
2477
2478impl PeerManagerRequest {
2479    #[allow(irrefutable_let_patterns)]
2480    pub fn into_get_peer(
2481        self,
2482    ) -> Option<(
2483        fidl_fuchsia_bluetooth::PeerId,
2484        fidl::endpoints::ServerEnd<PeerControllerMarker>,
2485        PeerManagerControlHandle,
2486    )> {
2487        if let PeerManagerRequest::GetPeer { peer_id, handle, control_handle } = self {
2488            Some((peer_id, handle, control_handle))
2489        } else {
2490            None
2491        }
2492    }
2493
2494    #[allow(irrefutable_let_patterns)]
2495    pub fn into_connected_peers(self) -> Option<(PeerManagerConnectedPeersResponder)> {
2496        if let PeerManagerRequest::ConnectedPeers { responder } = self {
2497            Some((responder))
2498        } else {
2499            None
2500        }
2501    }
2502
2503    /// Name of the method defined in FIDL
2504    pub fn method_name(&self) -> &'static str {
2505        match *self {
2506            PeerManagerRequest::GetPeer { .. } => "get_peer",
2507            PeerManagerRequest::ConnectedPeers { .. } => "connected_peers",
2508        }
2509    }
2510}
2511
2512#[derive(Debug, Clone)]
2513pub struct PeerManagerControlHandle {
2514    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2515}
2516
2517impl fidl::endpoints::ControlHandle for PeerManagerControlHandle {
2518    fn shutdown(&self) {
2519        self.inner.shutdown()
2520    }
2521    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2522        self.inner.shutdown_with_epitaph(status)
2523    }
2524
2525    fn is_closed(&self) -> bool {
2526        self.inner.channel().is_closed()
2527    }
2528    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2529        self.inner.channel().on_closed()
2530    }
2531
2532    #[cfg(target_os = "fuchsia")]
2533    fn signal_peer(
2534        &self,
2535        clear_mask: zx::Signals,
2536        set_mask: zx::Signals,
2537    ) -> Result<(), zx_status::Status> {
2538        use fidl::Peered;
2539        self.inner.channel().signal_peer(clear_mask, set_mask)
2540    }
2541}
2542
2543impl PeerManagerControlHandle {
2544    pub fn send_on_peer_connected(
2545        &self,
2546        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2547    ) -> Result<(), fidl::Error> {
2548        self.inner.send::<PeerManagerOnPeerConnectedRequest>(
2549            (peer_id,),
2550            0,
2551            0x154e6b9e519774d1,
2552            fidl::encoding::DynamicFlags::empty(),
2553        )
2554    }
2555}
2556
2557#[must_use = "FIDL methods require a response to be sent"]
2558#[derive(Debug)]
2559pub struct PeerManagerConnectedPeersResponder {
2560    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
2561    tx_id: u32,
2562}
2563
2564/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
2565/// if the responder is dropped without sending a response, so that the client
2566/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2567impl std::ops::Drop for PeerManagerConnectedPeersResponder {
2568    fn drop(&mut self) {
2569        self.control_handle.shutdown();
2570        // Safety: drops once, never accessed again
2571        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2572    }
2573}
2574
2575impl fidl::endpoints::Responder for PeerManagerConnectedPeersResponder {
2576    type ControlHandle = PeerManagerControlHandle;
2577
2578    fn control_handle(&self) -> &PeerManagerControlHandle {
2579        &self.control_handle
2580    }
2581
2582    fn drop_without_shutdown(mut self) {
2583        // Safety: drops once, never accessed again due to mem::forget
2584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2585        // Prevent Drop from running (which would shut down the channel)
2586        std::mem::forget(self);
2587    }
2588}
2589
2590impl PeerManagerConnectedPeersResponder {
2591    /// Sends a response to the FIDL transaction.
2592    ///
2593    /// Sets the channel to shutdown if an error occurs.
2594    pub fn send(self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
2595        let _result = self.send_raw(peer_ids);
2596        if _result.is_err() {
2597            self.control_handle.shutdown();
2598        }
2599        self.drop_without_shutdown();
2600        _result
2601    }
2602
2603    /// Similar to "send" but does not shutdown the channel if an error occurs.
2604    pub fn send_no_shutdown_on_err(
2605        self,
2606        mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId],
2607    ) -> Result<(), fidl::Error> {
2608        let _result = self.send_raw(peer_ids);
2609        self.drop_without_shutdown();
2610        _result
2611    }
2612
2613    fn send_raw(&self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
2614        self.control_handle.inner.send::<PeerManagerConnectedPeersResponse>(
2615            (peer_ids,),
2616            self.tx_id,
2617            0x1deaca0295d5f8d6,
2618            fidl::encoding::DynamicFlags::empty(),
2619        )
2620    }
2621}
2622
2623mod internal {
2624    use super::*;
2625    unsafe impl fidl::encoding::TypeMarker for PeerError {
2626        type Owned = Self;
2627
2628        #[inline(always)]
2629        fn inline_align(_context: fidl::encoding::Context) -> usize {
2630            std::mem::align_of::<u32>()
2631        }
2632
2633        #[inline(always)]
2634        fn inline_size(_context: fidl::encoding::Context) -> usize {
2635            std::mem::size_of::<u32>()
2636        }
2637
2638        #[inline(always)]
2639        fn encode_is_copy() -> bool {
2640            true
2641        }
2642
2643        #[inline(always)]
2644        fn decode_is_copy() -> bool {
2645            false
2646        }
2647    }
2648
2649    impl fidl::encoding::ValueTypeMarker for PeerError {
2650        type Borrowed<'a> = Self;
2651        #[inline(always)]
2652        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2653            *value
2654        }
2655    }
2656
2657    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PeerError {
2658        #[inline]
2659        unsafe fn encode(
2660            self,
2661            encoder: &mut fidl::encoding::Encoder<'_, D>,
2662            offset: usize,
2663            _depth: fidl::encoding::Depth,
2664        ) -> fidl::Result<()> {
2665            encoder.debug_check_bounds::<Self>(offset);
2666            encoder.write_num(self.into_primitive(), offset);
2667            Ok(())
2668        }
2669    }
2670
2671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerError {
2672        #[inline(always)]
2673        fn new_empty() -> Self {
2674            Self::UnknownFailure
2675        }
2676
2677        #[inline]
2678        unsafe fn decode(
2679            &mut self,
2680            decoder: &mut fidl::encoding::Decoder<'_, D>,
2681            offset: usize,
2682            _depth: fidl::encoding::Depth,
2683        ) -> fidl::Result<()> {
2684            decoder.debug_check_bounds::<Self>(offset);
2685            let prim = decoder.read_num::<u32>(offset);
2686
2687            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2688            Ok(())
2689        }
2690    }
2691
2692    impl fidl::encoding::ValueTypeMarker for PeerManagerConnectedPeersResponse {
2693        type Borrowed<'a> = &'a Self;
2694        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2695            value
2696        }
2697    }
2698
2699    unsafe impl fidl::encoding::TypeMarker for PeerManagerConnectedPeersResponse {
2700        type Owned = Self;
2701
2702        #[inline(always)]
2703        fn inline_align(_context: fidl::encoding::Context) -> usize {
2704            8
2705        }
2706
2707        #[inline(always)]
2708        fn inline_size(_context: fidl::encoding::Context) -> usize {
2709            16
2710        }
2711    }
2712
2713    unsafe impl<D: fidl::encoding::ResourceDialect>
2714        fidl::encoding::Encode<PeerManagerConnectedPeersResponse, D>
2715        for &PeerManagerConnectedPeersResponse
2716    {
2717        #[inline]
2718        unsafe fn encode(
2719            self,
2720            encoder: &mut fidl::encoding::Encoder<'_, D>,
2721            offset: usize,
2722            _depth: fidl::encoding::Depth,
2723        ) -> fidl::Result<()> {
2724            encoder.debug_check_bounds::<PeerManagerConnectedPeersResponse>(offset);
2725            // Delegate to tuple encoding.
2726            fidl::encoding::Encode::<PeerManagerConnectedPeersResponse, D>::encode(
2727                (
2728                    <fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_ids),
2729                ),
2730                encoder, offset, _depth
2731            )
2732        }
2733    }
2734    unsafe impl<
2735            D: fidl::encoding::ResourceDialect,
2736            T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, D>,
2737        > fidl::encoding::Encode<PeerManagerConnectedPeersResponse, D> for (T0,)
2738    {
2739        #[inline]
2740        unsafe fn encode(
2741            self,
2742            encoder: &mut fidl::encoding::Encoder<'_, D>,
2743            offset: usize,
2744            depth: fidl::encoding::Depth,
2745        ) -> fidl::Result<()> {
2746            encoder.debug_check_bounds::<PeerManagerConnectedPeersResponse>(offset);
2747            // Zero out padding regions. There's no need to apply masks
2748            // because the unmasked parts will be overwritten by fields.
2749            // Write the fields.
2750            self.0.encode(encoder, offset + 0, depth)?;
2751            Ok(())
2752        }
2753    }
2754
2755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2756        for PeerManagerConnectedPeersResponse
2757    {
2758        #[inline(always)]
2759        fn new_empty() -> Self {
2760            Self {
2761                peer_ids: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, D),
2762            }
2763        }
2764
2765        #[inline]
2766        unsafe fn decode(
2767            &mut self,
2768            decoder: &mut fidl::encoding::Decoder<'_, D>,
2769            offset: usize,
2770            _depth: fidl::encoding::Depth,
2771        ) -> fidl::Result<()> {
2772            decoder.debug_check_bounds::<Self>(offset);
2773            // Verify that padding bytes are zero.
2774            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, D, &mut self.peer_ids, decoder, offset + 0, _depth)?;
2775            Ok(())
2776        }
2777    }
2778
2779    impl fidl::encoding::ResourceTypeMarker for PeerManagerGetPeerRequest {
2780        type Borrowed<'a> = &'a mut Self;
2781        fn take_or_borrow<'a>(
2782            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2783        ) -> Self::Borrowed<'a> {
2784            value
2785        }
2786    }
2787
2788    unsafe impl fidl::encoding::TypeMarker for PeerManagerGetPeerRequest {
2789        type Owned = Self;
2790
2791        #[inline(always)]
2792        fn inline_align(_context: fidl::encoding::Context) -> usize {
2793            8
2794        }
2795
2796        #[inline(always)]
2797        fn inline_size(_context: fidl::encoding::Context) -> usize {
2798            16
2799        }
2800    }
2801
2802    unsafe impl
2803        fidl::encoding::Encode<
2804            PeerManagerGetPeerRequest,
2805            fidl::encoding::DefaultFuchsiaResourceDialect,
2806        > for &mut PeerManagerGetPeerRequest
2807    {
2808        #[inline]
2809        unsafe fn encode(
2810            self,
2811            encoder: &mut fidl::encoding::Encoder<
2812                '_,
2813                fidl::encoding::DefaultFuchsiaResourceDialect,
2814            >,
2815            offset: usize,
2816            _depth: fidl::encoding::Depth,
2817        ) -> fidl::Result<()> {
2818            encoder.debug_check_bounds::<PeerManagerGetPeerRequest>(offset);
2819            // Delegate to tuple encoding.
2820            fidl::encoding::Encode::<PeerManagerGetPeerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2821                (
2822                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2823                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
2824                ),
2825                encoder, offset, _depth
2826            )
2827        }
2828    }
2829    unsafe impl<
2830            T0: fidl::encoding::Encode<
2831                fidl_fuchsia_bluetooth::PeerId,
2832                fidl::encoding::DefaultFuchsiaResourceDialect,
2833            >,
2834            T1: fidl::encoding::Encode<
2835                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2836                fidl::encoding::DefaultFuchsiaResourceDialect,
2837            >,
2838        >
2839        fidl::encoding::Encode<
2840            PeerManagerGetPeerRequest,
2841            fidl::encoding::DefaultFuchsiaResourceDialect,
2842        > for (T0, T1)
2843    {
2844        #[inline]
2845        unsafe fn encode(
2846            self,
2847            encoder: &mut fidl::encoding::Encoder<
2848                '_,
2849                fidl::encoding::DefaultFuchsiaResourceDialect,
2850            >,
2851            offset: usize,
2852            depth: fidl::encoding::Depth,
2853        ) -> fidl::Result<()> {
2854            encoder.debug_check_bounds::<PeerManagerGetPeerRequest>(offset);
2855            // Zero out padding regions. There's no need to apply masks
2856            // because the unmasked parts will be overwritten by fields.
2857            unsafe {
2858                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2859                (ptr as *mut u64).write_unaligned(0);
2860            }
2861            // Write the fields.
2862            self.0.encode(encoder, offset + 0, depth)?;
2863            self.1.encode(encoder, offset + 8, depth)?;
2864            Ok(())
2865        }
2866    }
2867
2868    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2869        for PeerManagerGetPeerRequest
2870    {
2871        #[inline(always)]
2872        fn new_empty() -> Self {
2873            Self {
2874                peer_id: fidl::new_empty!(
2875                    fidl_fuchsia_bluetooth::PeerId,
2876                    fidl::encoding::DefaultFuchsiaResourceDialect
2877                ),
2878                handle: fidl::new_empty!(
2879                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2880                    fidl::encoding::DefaultFuchsiaResourceDialect
2881                ),
2882            }
2883        }
2884
2885        #[inline]
2886        unsafe fn decode(
2887            &mut self,
2888            decoder: &mut fidl::encoding::Decoder<
2889                '_,
2890                fidl::encoding::DefaultFuchsiaResourceDialect,
2891            >,
2892            offset: usize,
2893            _depth: fidl::encoding::Depth,
2894        ) -> fidl::Result<()> {
2895            decoder.debug_check_bounds::<Self>(offset);
2896            // Verify that padding bytes are zero.
2897            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2898            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2899            let mask = 0xffffffff00000000u64;
2900            let maskedval = padval & mask;
2901            if maskedval != 0 {
2902                return Err(fidl::Error::NonZeroPadding {
2903                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2904                });
2905            }
2906            fidl::decode!(
2907                fidl_fuchsia_bluetooth::PeerId,
2908                fidl::encoding::DefaultFuchsiaResourceDialect,
2909                &mut self.peer_id,
2910                decoder,
2911                offset + 0,
2912                _depth
2913            )?;
2914            fidl::decode!(
2915                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2916                fidl::encoding::DefaultFuchsiaResourceDialect,
2917                &mut self.handle,
2918                decoder,
2919                offset + 8,
2920                _depth
2921            )?;
2922            Ok(())
2923        }
2924    }
2925
2926    impl fidl::encoding::ValueTypeMarker for PeerManagerOnPeerConnectedRequest {
2927        type Borrowed<'a> = &'a Self;
2928        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2929            value
2930        }
2931    }
2932
2933    unsafe impl fidl::encoding::TypeMarker for PeerManagerOnPeerConnectedRequest {
2934        type Owned = Self;
2935
2936        #[inline(always)]
2937        fn inline_align(_context: fidl::encoding::Context) -> usize {
2938            8
2939        }
2940
2941        #[inline(always)]
2942        fn inline_size(_context: fidl::encoding::Context) -> usize {
2943            8
2944        }
2945    }
2946
2947    unsafe impl<D: fidl::encoding::ResourceDialect>
2948        fidl::encoding::Encode<PeerManagerOnPeerConnectedRequest, D>
2949        for &PeerManagerOnPeerConnectedRequest
2950    {
2951        #[inline]
2952        unsafe fn encode(
2953            self,
2954            encoder: &mut fidl::encoding::Encoder<'_, D>,
2955            offset: usize,
2956            _depth: fidl::encoding::Depth,
2957        ) -> fidl::Result<()> {
2958            encoder.debug_check_bounds::<PeerManagerOnPeerConnectedRequest>(offset);
2959            // Delegate to tuple encoding.
2960            fidl::encoding::Encode::<PeerManagerOnPeerConnectedRequest, D>::encode(
2961                (<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
2962                    &self.peer_id,
2963                ),),
2964                encoder,
2965                offset,
2966                _depth,
2967            )
2968        }
2969    }
2970    unsafe impl<
2971            D: fidl::encoding::ResourceDialect,
2972            T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
2973        > fidl::encoding::Encode<PeerManagerOnPeerConnectedRequest, D> for (T0,)
2974    {
2975        #[inline]
2976        unsafe fn encode(
2977            self,
2978            encoder: &mut fidl::encoding::Encoder<'_, D>,
2979            offset: usize,
2980            depth: fidl::encoding::Depth,
2981        ) -> fidl::Result<()> {
2982            encoder.debug_check_bounds::<PeerManagerOnPeerConnectedRequest>(offset);
2983            // Zero out padding regions. There's no need to apply masks
2984            // because the unmasked parts will be overwritten by fields.
2985            // Write the fields.
2986            self.0.encode(encoder, offset + 0, depth)?;
2987            Ok(())
2988        }
2989    }
2990
2991    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2992        for PeerManagerOnPeerConnectedRequest
2993    {
2994        #[inline(always)]
2995        fn new_empty() -> Self {
2996            Self { peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
2997        }
2998
2999        #[inline]
3000        unsafe fn decode(
3001            &mut self,
3002            decoder: &mut fidl::encoding::Decoder<'_, D>,
3003            offset: usize,
3004            _depth: fidl::encoding::Depth,
3005        ) -> fidl::Result<()> {
3006            decoder.debug_check_bounds::<Self>(offset);
3007            // Verify that padding bytes are zero.
3008            fidl::decode!(
3009                fidl_fuchsia_bluetooth::PeerId,
3010                D,
3011                &mut self.peer_id,
3012                decoder,
3013                offset + 0,
3014                _depth
3015            )?;
3016            Ok(())
3017        }
3018    }
3019}