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