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::NullableHandle {
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
1283    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1284        self.inner.shutdown_with_epitaph(status)
1285    }
1286
1287    fn is_closed(&self) -> bool {
1288        self.inner.channel().is_closed()
1289    }
1290    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1291        self.inner.channel().on_closed()
1292    }
1293
1294    #[cfg(target_os = "fuchsia")]
1295    fn signal_peer(
1296        &self,
1297        clear_mask: zx::Signals,
1298        set_mask: zx::Signals,
1299    ) -> Result<(), zx_status::Status> {
1300        use fidl::Peered;
1301        self.inner.channel().signal_peer(clear_mask, set_mask)
1302    }
1303}
1304
1305impl PeerControllerControlHandle {}
1306
1307#[must_use = "FIDL methods require a response to be sent"]
1308#[derive(Debug)]
1309pub struct PeerControllerSetConfigurationResponder {
1310    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1311    tx_id: u32,
1312}
1313
1314/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1315/// if the responder is dropped without sending a response, so that the client
1316/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1317impl std::ops::Drop for PeerControllerSetConfigurationResponder {
1318    fn drop(&mut self) {
1319        self.control_handle.shutdown();
1320        // Safety: drops once, never accessed again
1321        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1322    }
1323}
1324
1325impl fidl::endpoints::Responder for PeerControllerSetConfigurationResponder {
1326    type ControlHandle = PeerControllerControlHandle;
1327
1328    fn control_handle(&self) -> &PeerControllerControlHandle {
1329        &self.control_handle
1330    }
1331
1332    fn drop_without_shutdown(mut self) {
1333        // Safety: drops once, never accessed again due to mem::forget
1334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1335        // Prevent Drop from running (which would shut down the channel)
1336        std::mem::forget(self);
1337    }
1338}
1339
1340impl PeerControllerSetConfigurationResponder {
1341    /// Sends a response to the FIDL transaction.
1342    ///
1343    /// Sets the channel to shutdown if an error occurs.
1344    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1345        let _result = self.send_raw(result);
1346        if _result.is_err() {
1347            self.control_handle.shutdown();
1348        }
1349        self.drop_without_shutdown();
1350        _result
1351    }
1352
1353    /// Similar to "send" but does not shutdown the channel if an error occurs.
1354    pub fn send_no_shutdown_on_err(
1355        self,
1356        mut result: Result<(), PeerError>,
1357    ) -> Result<(), fidl::Error> {
1358        let _result = self.send_raw(result);
1359        self.drop_without_shutdown();
1360        _result
1361    }
1362
1363    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1364        self.control_handle
1365            .inner
1366            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1367                result,
1368                self.tx_id,
1369                0x35f45144acf701ae,
1370                fidl::encoding::DynamicFlags::empty(),
1371            )
1372    }
1373}
1374
1375#[must_use = "FIDL methods require a response to be sent"]
1376#[derive(Debug)]
1377pub struct PeerControllerGetConfigurationResponder {
1378    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1379    tx_id: u32,
1380}
1381
1382/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1383/// if the responder is dropped without sending a response, so that the client
1384/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1385impl std::ops::Drop for PeerControllerGetConfigurationResponder {
1386    fn drop(&mut self) {
1387        self.control_handle.shutdown();
1388        // Safety: drops once, never accessed again
1389        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1390    }
1391}
1392
1393impl fidl::endpoints::Responder for PeerControllerGetConfigurationResponder {
1394    type ControlHandle = PeerControllerControlHandle;
1395
1396    fn control_handle(&self) -> &PeerControllerControlHandle {
1397        &self.control_handle
1398    }
1399
1400    fn drop_without_shutdown(mut self) {
1401        // Safety: drops once, never accessed again due to mem::forget
1402        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1403        // Prevent Drop from running (which would shut down the channel)
1404        std::mem::forget(self);
1405    }
1406}
1407
1408impl PeerControllerGetConfigurationResponder {
1409    /// Sends a response to the FIDL transaction.
1410    ///
1411    /// Sets the channel to shutdown if an error occurs.
1412    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1413        let _result = self.send_raw(result);
1414        if _result.is_err() {
1415            self.control_handle.shutdown();
1416        }
1417        self.drop_without_shutdown();
1418        _result
1419    }
1420
1421    /// Similar to "send" but does not shutdown the channel if an error occurs.
1422    pub fn send_no_shutdown_on_err(
1423        self,
1424        mut result: Result<(), PeerError>,
1425    ) -> Result<(), fidl::Error> {
1426        let _result = self.send_raw(result);
1427        self.drop_without_shutdown();
1428        _result
1429    }
1430
1431    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1432        self.control_handle
1433            .inner
1434            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1435                result,
1436                self.tx_id,
1437                0x507eb0483e8d50d,
1438                fidl::encoding::DynamicFlags::empty(),
1439            )
1440    }
1441}
1442
1443#[must_use = "FIDL methods require a response to be sent"]
1444#[derive(Debug)]
1445pub struct PeerControllerSuspendStreamResponder {
1446    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1447    tx_id: u32,
1448}
1449
1450/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1451/// if the responder is dropped without sending a response, so that the client
1452/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1453impl std::ops::Drop for PeerControllerSuspendStreamResponder {
1454    fn drop(&mut self) {
1455        self.control_handle.shutdown();
1456        // Safety: drops once, never accessed again
1457        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1458    }
1459}
1460
1461impl fidl::endpoints::Responder for PeerControllerSuspendStreamResponder {
1462    type ControlHandle = PeerControllerControlHandle;
1463
1464    fn control_handle(&self) -> &PeerControllerControlHandle {
1465        &self.control_handle
1466    }
1467
1468    fn drop_without_shutdown(mut self) {
1469        // Safety: drops once, never accessed again due to mem::forget
1470        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1471        // Prevent Drop from running (which would shut down the channel)
1472        std::mem::forget(self);
1473    }
1474}
1475
1476impl PeerControllerSuspendStreamResponder {
1477    /// Sends a response to the FIDL transaction.
1478    ///
1479    /// Sets the channel to shutdown if an error occurs.
1480    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1481        let _result = self.send_raw(result);
1482        if _result.is_err() {
1483            self.control_handle.shutdown();
1484        }
1485        self.drop_without_shutdown();
1486        _result
1487    }
1488
1489    /// Similar to "send" but does not shutdown the channel if an error occurs.
1490    pub fn send_no_shutdown_on_err(
1491        self,
1492        mut result: Result<(), PeerError>,
1493    ) -> Result<(), fidl::Error> {
1494        let _result = self.send_raw(result);
1495        self.drop_without_shutdown();
1496        _result
1497    }
1498
1499    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1500        self.control_handle
1501            .inner
1502            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1503                result,
1504                self.tx_id,
1505                0x43465c9341d472eb,
1506                fidl::encoding::DynamicFlags::empty(),
1507            )
1508    }
1509}
1510
1511#[must_use = "FIDL methods require a response to be sent"]
1512#[derive(Debug)]
1513pub struct PeerControllerSuspendAndReconfigureResponder {
1514    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1515    tx_id: u32,
1516}
1517
1518/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1519/// if the responder is dropped without sending a response, so that the client
1520/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1521impl std::ops::Drop for PeerControllerSuspendAndReconfigureResponder {
1522    fn drop(&mut self) {
1523        self.control_handle.shutdown();
1524        // Safety: drops once, never accessed again
1525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1526    }
1527}
1528
1529impl fidl::endpoints::Responder for PeerControllerSuspendAndReconfigureResponder {
1530    type ControlHandle = PeerControllerControlHandle;
1531
1532    fn control_handle(&self) -> &PeerControllerControlHandle {
1533        &self.control_handle
1534    }
1535
1536    fn drop_without_shutdown(mut self) {
1537        // Safety: drops once, never accessed again due to mem::forget
1538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1539        // Prevent Drop from running (which would shut down the channel)
1540        std::mem::forget(self);
1541    }
1542}
1543
1544impl PeerControllerSuspendAndReconfigureResponder {
1545    /// Sends a response to the FIDL transaction.
1546    ///
1547    /// Sets the channel to shutdown if an error occurs.
1548    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1549        let _result = self.send_raw(result);
1550        if _result.is_err() {
1551            self.control_handle.shutdown();
1552        }
1553        self.drop_without_shutdown();
1554        _result
1555    }
1556
1557    /// Similar to "send" but does not shutdown the channel if an error occurs.
1558    pub fn send_no_shutdown_on_err(
1559        self,
1560        mut result: Result<(), PeerError>,
1561    ) -> Result<(), fidl::Error> {
1562        let _result = self.send_raw(result);
1563        self.drop_without_shutdown();
1564        _result
1565    }
1566
1567    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1568        self.control_handle
1569            .inner
1570            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1571                result,
1572                self.tx_id,
1573                0x7ce8e3b693e20fe3,
1574                fidl::encoding::DynamicFlags::empty(),
1575            )
1576    }
1577}
1578
1579#[must_use = "FIDL methods require a response to be sent"]
1580#[derive(Debug)]
1581pub struct PeerControllerEstablishStreamResponder {
1582    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1583    tx_id: u32,
1584}
1585
1586/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1587/// if the responder is dropped without sending a response, so that the client
1588/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1589impl std::ops::Drop for PeerControllerEstablishStreamResponder {
1590    fn drop(&mut self) {
1591        self.control_handle.shutdown();
1592        // Safety: drops once, never accessed again
1593        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1594    }
1595}
1596
1597impl fidl::endpoints::Responder for PeerControllerEstablishStreamResponder {
1598    type ControlHandle = PeerControllerControlHandle;
1599
1600    fn control_handle(&self) -> &PeerControllerControlHandle {
1601        &self.control_handle
1602    }
1603
1604    fn drop_without_shutdown(mut self) {
1605        // Safety: drops once, never accessed again due to mem::forget
1606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1607        // Prevent Drop from running (which would shut down the channel)
1608        std::mem::forget(self);
1609    }
1610}
1611
1612impl PeerControllerEstablishStreamResponder {
1613    /// Sends a response to the FIDL transaction.
1614    ///
1615    /// Sets the channel to shutdown if an error occurs.
1616    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1617        let _result = self.send_raw(result);
1618        if _result.is_err() {
1619            self.control_handle.shutdown();
1620        }
1621        self.drop_without_shutdown();
1622        _result
1623    }
1624
1625    /// Similar to "send" but does not shutdown the channel if an error occurs.
1626    pub fn send_no_shutdown_on_err(
1627        self,
1628        mut result: Result<(), PeerError>,
1629    ) -> Result<(), fidl::Error> {
1630        let _result = self.send_raw(result);
1631        self.drop_without_shutdown();
1632        _result
1633    }
1634
1635    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1636        self.control_handle
1637            .inner
1638            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1639                result,
1640                self.tx_id,
1641                0x438e16ccd91eb5e5,
1642                fidl::encoding::DynamicFlags::empty(),
1643            )
1644    }
1645}
1646
1647#[must_use = "FIDL methods require a response to be sent"]
1648#[derive(Debug)]
1649pub struct PeerControllerReleaseStreamResponder {
1650    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1651    tx_id: u32,
1652}
1653
1654/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1655/// if the responder is dropped without sending a response, so that the client
1656/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1657impl std::ops::Drop for PeerControllerReleaseStreamResponder {
1658    fn drop(&mut self) {
1659        self.control_handle.shutdown();
1660        // Safety: drops once, never accessed again
1661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1662    }
1663}
1664
1665impl fidl::endpoints::Responder for PeerControllerReleaseStreamResponder {
1666    type ControlHandle = PeerControllerControlHandle;
1667
1668    fn control_handle(&self) -> &PeerControllerControlHandle {
1669        &self.control_handle
1670    }
1671
1672    fn drop_without_shutdown(mut self) {
1673        // Safety: drops once, never accessed again due to mem::forget
1674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1675        // Prevent Drop from running (which would shut down the channel)
1676        std::mem::forget(self);
1677    }
1678}
1679
1680impl PeerControllerReleaseStreamResponder {
1681    /// Sends a response to the FIDL transaction.
1682    ///
1683    /// Sets the channel to shutdown if an error occurs.
1684    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1685        let _result = self.send_raw(result);
1686        if _result.is_err() {
1687            self.control_handle.shutdown();
1688        }
1689        self.drop_without_shutdown();
1690        _result
1691    }
1692
1693    /// Similar to "send" but does not shutdown the channel if an error occurs.
1694    pub fn send_no_shutdown_on_err(
1695        self,
1696        mut result: Result<(), PeerError>,
1697    ) -> Result<(), fidl::Error> {
1698        let _result = self.send_raw(result);
1699        self.drop_without_shutdown();
1700        _result
1701    }
1702
1703    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1704        self.control_handle
1705            .inner
1706            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1707                result,
1708                self.tx_id,
1709                0x4884104b373151c6,
1710                fidl::encoding::DynamicFlags::empty(),
1711            )
1712    }
1713}
1714
1715#[must_use = "FIDL methods require a response to be sent"]
1716#[derive(Debug)]
1717pub struct PeerControllerAbortStreamResponder {
1718    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1719    tx_id: u32,
1720}
1721
1722/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1723/// if the responder is dropped without sending a response, so that the client
1724/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1725impl std::ops::Drop for PeerControllerAbortStreamResponder {
1726    fn drop(&mut self) {
1727        self.control_handle.shutdown();
1728        // Safety: drops once, never accessed again
1729        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1730    }
1731}
1732
1733impl fidl::endpoints::Responder for PeerControllerAbortStreamResponder {
1734    type ControlHandle = PeerControllerControlHandle;
1735
1736    fn control_handle(&self) -> &PeerControllerControlHandle {
1737        &self.control_handle
1738    }
1739
1740    fn drop_without_shutdown(mut self) {
1741        // Safety: drops once, never accessed again due to mem::forget
1742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743        // Prevent Drop from running (which would shut down the channel)
1744        std::mem::forget(self);
1745    }
1746}
1747
1748impl PeerControllerAbortStreamResponder {
1749    /// Sends a response to the FIDL transaction.
1750    ///
1751    /// Sets the channel to shutdown if an error occurs.
1752    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1753        let _result = self.send_raw(result);
1754        if _result.is_err() {
1755            self.control_handle.shutdown();
1756        }
1757        self.drop_without_shutdown();
1758        _result
1759    }
1760
1761    /// Similar to "send" but does not shutdown the channel if an error occurs.
1762    pub fn send_no_shutdown_on_err(
1763        self,
1764        mut result: Result<(), PeerError>,
1765    ) -> Result<(), fidl::Error> {
1766        let _result = self.send_raw(result);
1767        self.drop_without_shutdown();
1768        _result
1769    }
1770
1771    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1772        self.control_handle
1773            .inner
1774            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1775                result,
1776                self.tx_id,
1777                0xf85b067ed144997,
1778                fidl::encoding::DynamicFlags::empty(),
1779            )
1780    }
1781}
1782
1783#[must_use = "FIDL methods require a response to be sent"]
1784#[derive(Debug)]
1785pub struct PeerControllerStartStreamResponder {
1786    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1787    tx_id: u32,
1788}
1789
1790/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1791/// if the responder is dropped without sending a response, so that the client
1792/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1793impl std::ops::Drop for PeerControllerStartStreamResponder {
1794    fn drop(&mut self) {
1795        self.control_handle.shutdown();
1796        // Safety: drops once, never accessed again
1797        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1798    }
1799}
1800
1801impl fidl::endpoints::Responder for PeerControllerStartStreamResponder {
1802    type ControlHandle = PeerControllerControlHandle;
1803
1804    fn control_handle(&self) -> &PeerControllerControlHandle {
1805        &self.control_handle
1806    }
1807
1808    fn drop_without_shutdown(mut self) {
1809        // Safety: drops once, never accessed again due to mem::forget
1810        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1811        // Prevent Drop from running (which would shut down the channel)
1812        std::mem::forget(self);
1813    }
1814}
1815
1816impl PeerControllerStartStreamResponder {
1817    /// Sends a response to the FIDL transaction.
1818    ///
1819    /// Sets the channel to shutdown if an error occurs.
1820    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1821        let _result = self.send_raw(result);
1822        if _result.is_err() {
1823            self.control_handle.shutdown();
1824        }
1825        self.drop_without_shutdown();
1826        _result
1827    }
1828
1829    /// Similar to "send" but does not shutdown the channel if an error occurs.
1830    pub fn send_no_shutdown_on_err(
1831        self,
1832        mut result: Result<(), PeerError>,
1833    ) -> Result<(), fidl::Error> {
1834        let _result = self.send_raw(result);
1835        self.drop_without_shutdown();
1836        _result
1837    }
1838
1839    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1840        self.control_handle
1841            .inner
1842            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1843                result,
1844                self.tx_id,
1845                0xd0ead9aec2ebf77,
1846                fidl::encoding::DynamicFlags::empty(),
1847            )
1848    }
1849}
1850
1851#[must_use = "FIDL methods require a response to be sent"]
1852#[derive(Debug)]
1853pub struct PeerControllerReconfigureStreamResponder {
1854    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1855    tx_id: u32,
1856}
1857
1858/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1859/// if the responder is dropped without sending a response, so that the client
1860/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1861impl std::ops::Drop for PeerControllerReconfigureStreamResponder {
1862    fn drop(&mut self) {
1863        self.control_handle.shutdown();
1864        // Safety: drops once, never accessed again
1865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866    }
1867}
1868
1869impl fidl::endpoints::Responder for PeerControllerReconfigureStreamResponder {
1870    type ControlHandle = PeerControllerControlHandle;
1871
1872    fn control_handle(&self) -> &PeerControllerControlHandle {
1873        &self.control_handle
1874    }
1875
1876    fn drop_without_shutdown(mut self) {
1877        // Safety: drops once, never accessed again due to mem::forget
1878        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1879        // Prevent Drop from running (which would shut down the channel)
1880        std::mem::forget(self);
1881    }
1882}
1883
1884impl PeerControllerReconfigureStreamResponder {
1885    /// Sends a response to the FIDL transaction.
1886    ///
1887    /// Sets the channel to shutdown if an error occurs.
1888    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1889        let _result = self.send_raw(result);
1890        if _result.is_err() {
1891            self.control_handle.shutdown();
1892        }
1893        self.drop_without_shutdown();
1894        _result
1895    }
1896
1897    /// Similar to "send" but does not shutdown the channel if an error occurs.
1898    pub fn send_no_shutdown_on_err(
1899        self,
1900        mut result: Result<(), PeerError>,
1901    ) -> Result<(), fidl::Error> {
1902        let _result = self.send_raw(result);
1903        self.drop_without_shutdown();
1904        _result
1905    }
1906
1907    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1908        self.control_handle
1909            .inner
1910            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1911                result,
1912                self.tx_id,
1913                0x559404d6a9629c60,
1914                fidl::encoding::DynamicFlags::empty(),
1915            )
1916    }
1917}
1918
1919#[must_use = "FIDL methods require a response to be sent"]
1920#[derive(Debug)]
1921pub struct PeerControllerGetCapabilitiesResponder {
1922    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1923    tx_id: u32,
1924}
1925
1926/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1927/// if the responder is dropped without sending a response, so that the client
1928/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1929impl std::ops::Drop for PeerControllerGetCapabilitiesResponder {
1930    fn drop(&mut self) {
1931        self.control_handle.shutdown();
1932        // Safety: drops once, never accessed again
1933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1934    }
1935}
1936
1937impl fidl::endpoints::Responder for PeerControllerGetCapabilitiesResponder {
1938    type ControlHandle = PeerControllerControlHandle;
1939
1940    fn control_handle(&self) -> &PeerControllerControlHandle {
1941        &self.control_handle
1942    }
1943
1944    fn drop_without_shutdown(mut self) {
1945        // Safety: drops once, never accessed again due to mem::forget
1946        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1947        // Prevent Drop from running (which would shut down the channel)
1948        std::mem::forget(self);
1949    }
1950}
1951
1952impl PeerControllerGetCapabilitiesResponder {
1953    /// Sends a response to the FIDL transaction.
1954    ///
1955    /// Sets the channel to shutdown if an error occurs.
1956    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1957        let _result = self.send_raw(result);
1958        if _result.is_err() {
1959            self.control_handle.shutdown();
1960        }
1961        self.drop_without_shutdown();
1962        _result
1963    }
1964
1965    /// Similar to "send" but does not shutdown the channel if an error occurs.
1966    pub fn send_no_shutdown_on_err(
1967        self,
1968        mut result: Result<(), PeerError>,
1969    ) -> Result<(), fidl::Error> {
1970        let _result = self.send_raw(result);
1971        self.drop_without_shutdown();
1972        _result
1973    }
1974
1975    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
1976        self.control_handle
1977            .inner
1978            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
1979                result,
1980                self.tx_id,
1981                0x16884c07e6d969a7,
1982                fidl::encoding::DynamicFlags::empty(),
1983            )
1984    }
1985}
1986
1987#[must_use = "FIDL methods require a response to be sent"]
1988#[derive(Debug)]
1989pub struct PeerControllerGetAllCapabilitiesResponder {
1990    control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
1991    tx_id: u32,
1992}
1993
1994/// Set the the channel to be shutdown (see [`PeerControllerControlHandle::shutdown`])
1995/// if the responder is dropped without sending a response, so that the client
1996/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1997impl std::ops::Drop for PeerControllerGetAllCapabilitiesResponder {
1998    fn drop(&mut self) {
1999        self.control_handle.shutdown();
2000        // Safety: drops once, never accessed again
2001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2002    }
2003}
2004
2005impl fidl::endpoints::Responder for PeerControllerGetAllCapabilitiesResponder {
2006    type ControlHandle = PeerControllerControlHandle;
2007
2008    fn control_handle(&self) -> &PeerControllerControlHandle {
2009        &self.control_handle
2010    }
2011
2012    fn drop_without_shutdown(mut self) {
2013        // Safety: drops once, never accessed again due to mem::forget
2014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2015        // Prevent Drop from running (which would shut down the channel)
2016        std::mem::forget(self);
2017    }
2018}
2019
2020impl PeerControllerGetAllCapabilitiesResponder {
2021    /// Sends a response to the FIDL transaction.
2022    ///
2023    /// Sets the channel to shutdown if an error occurs.
2024    pub fn send(self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
2025        let _result = self.send_raw(result);
2026        if _result.is_err() {
2027            self.control_handle.shutdown();
2028        }
2029        self.drop_without_shutdown();
2030        _result
2031    }
2032
2033    /// Similar to "send" but does not shutdown the channel if an error occurs.
2034    pub fn send_no_shutdown_on_err(
2035        self,
2036        mut result: Result<(), PeerError>,
2037    ) -> Result<(), fidl::Error> {
2038        let _result = self.send_raw(result);
2039        self.drop_without_shutdown();
2040        _result
2041    }
2042
2043    fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
2044        self.control_handle
2045            .inner
2046            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
2047                result,
2048                self.tx_id,
2049                0x1e2c5b438e288cea,
2050                fidl::encoding::DynamicFlags::empty(),
2051            )
2052    }
2053}
2054
2055#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2056pub struct PeerManagerMarker;
2057
2058impl fidl::endpoints::ProtocolMarker for PeerManagerMarker {
2059    type Proxy = PeerManagerProxy;
2060    type RequestStream = PeerManagerRequestStream;
2061    #[cfg(target_os = "fuchsia")]
2062    type SynchronousProxy = PeerManagerSynchronousProxy;
2063
2064    const DEBUG_NAME: &'static str = "fuchsia.bluetooth.avdtp.test.PeerManager";
2065}
2066impl fidl::endpoints::DiscoverableProtocolMarker for PeerManagerMarker {}
2067
2068pub trait PeerManagerProxyInterface: Send + Sync {
2069    fn r#get_peer(
2070        &self,
2071        peer_id: &fidl_fuchsia_bluetooth::PeerId,
2072        handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2073    ) -> Result<(), fidl::Error>;
2074    type ConnectedPeersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error>>
2075        + Send;
2076    fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut;
2077}
2078#[derive(Debug)]
2079#[cfg(target_os = "fuchsia")]
2080pub struct PeerManagerSynchronousProxy {
2081    client: fidl::client::sync::Client,
2082}
2083
2084#[cfg(target_os = "fuchsia")]
2085impl fidl::endpoints::SynchronousProxy for PeerManagerSynchronousProxy {
2086    type Proxy = PeerManagerProxy;
2087    type Protocol = PeerManagerMarker;
2088
2089    fn from_channel(inner: fidl::Channel) -> Self {
2090        Self::new(inner)
2091    }
2092
2093    fn into_channel(self) -> fidl::Channel {
2094        self.client.into_channel()
2095    }
2096
2097    fn as_channel(&self) -> &fidl::Channel {
2098        self.client.as_channel()
2099    }
2100}
2101
2102#[cfg(target_os = "fuchsia")]
2103impl PeerManagerSynchronousProxy {
2104    pub fn new(channel: fidl::Channel) -> Self {
2105        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2106        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2107    }
2108
2109    pub fn into_channel(self) -> fidl::Channel {
2110        self.client.into_channel()
2111    }
2112
2113    /// Waits until an event arrives and returns it. It is safe for other
2114    /// threads to make concurrent requests while waiting for an event.
2115    pub fn wait_for_event(
2116        &self,
2117        deadline: zx::MonotonicInstant,
2118    ) -> Result<PeerManagerEvent, fidl::Error> {
2119        PeerManagerEvent::decode(self.client.wait_for_event(deadline)?)
2120    }
2121
2122    /// Connects to the server specified by a `peer_id`.
2123    /// On success, `handle` will be used for initiating PeerController procedures.
2124    /// On peer disconnect, the handle will be dropped and closed on the server side.
2125    pub fn r#get_peer(
2126        &self,
2127        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2128        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2129    ) -> Result<(), fidl::Error> {
2130        self.client.send::<PeerManagerGetPeerRequest>(
2131            (peer_id, handle),
2132            0x2a506872f2b04086,
2133            fidl::encoding::DynamicFlags::empty(),
2134        )
2135    }
2136
2137    /// Returns the `bt.PeerId` of each currently connected peer.
2138    pub fn r#connected_peers(
2139        &self,
2140        ___deadline: zx::MonotonicInstant,
2141    ) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
2142        let _response = self
2143            .client
2144            .send_query::<fidl::encoding::EmptyPayload, PeerManagerConnectedPeersResponse>(
2145                (),
2146                0x1deaca0295d5f8d6,
2147                fidl::encoding::DynamicFlags::empty(),
2148                ___deadline,
2149            )?;
2150        Ok(_response.peer_ids)
2151    }
2152}
2153
2154#[cfg(target_os = "fuchsia")]
2155impl From<PeerManagerSynchronousProxy> for zx::NullableHandle {
2156    fn from(value: PeerManagerSynchronousProxy) -> Self {
2157        value.into_channel().into()
2158    }
2159}
2160
2161#[cfg(target_os = "fuchsia")]
2162impl From<fidl::Channel> for PeerManagerSynchronousProxy {
2163    fn from(value: fidl::Channel) -> Self {
2164        Self::new(value)
2165    }
2166}
2167
2168#[cfg(target_os = "fuchsia")]
2169impl fidl::endpoints::FromClient for PeerManagerSynchronousProxy {
2170    type Protocol = PeerManagerMarker;
2171
2172    fn from_client(value: fidl::endpoints::ClientEnd<PeerManagerMarker>) -> Self {
2173        Self::new(value.into_channel())
2174    }
2175}
2176
2177#[derive(Debug, Clone)]
2178pub struct PeerManagerProxy {
2179    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2180}
2181
2182impl fidl::endpoints::Proxy for PeerManagerProxy {
2183    type Protocol = PeerManagerMarker;
2184
2185    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2186        Self::new(inner)
2187    }
2188
2189    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2190        self.client.into_channel().map_err(|client| Self { client })
2191    }
2192
2193    fn as_channel(&self) -> &::fidl::AsyncChannel {
2194        self.client.as_channel()
2195    }
2196}
2197
2198impl PeerManagerProxy {
2199    /// Create a new Proxy for fuchsia.bluetooth.avdtp.test/PeerManager.
2200    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2201        let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2202        Self { client: fidl::client::Client::new(channel, protocol_name) }
2203    }
2204
2205    /// Get a Stream of events from the remote end of the protocol.
2206    ///
2207    /// # Panics
2208    ///
2209    /// Panics if the event stream was already taken.
2210    pub fn take_event_stream(&self) -> PeerManagerEventStream {
2211        PeerManagerEventStream { event_receiver: self.client.take_event_receiver() }
2212    }
2213
2214    /// Connects to the server specified by a `peer_id`.
2215    /// On success, `handle` will be used for initiating PeerController procedures.
2216    /// On peer disconnect, the handle will be dropped and closed on the server side.
2217    pub fn r#get_peer(
2218        &self,
2219        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2220        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2221    ) -> Result<(), fidl::Error> {
2222        PeerManagerProxyInterface::r#get_peer(self, peer_id, handle)
2223    }
2224
2225    /// Returns the `bt.PeerId` of each currently connected peer.
2226    pub fn r#connected_peers(
2227        &self,
2228    ) -> fidl::client::QueryResponseFut<
2229        Vec<fidl_fuchsia_bluetooth::PeerId>,
2230        fidl::encoding::DefaultFuchsiaResourceDialect,
2231    > {
2232        PeerManagerProxyInterface::r#connected_peers(self)
2233    }
2234}
2235
2236impl PeerManagerProxyInterface for PeerManagerProxy {
2237    fn r#get_peer(
2238        &self,
2239        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2240        mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2241    ) -> Result<(), fidl::Error> {
2242        self.client.send::<PeerManagerGetPeerRequest>(
2243            (peer_id, handle),
2244            0x2a506872f2b04086,
2245            fidl::encoding::DynamicFlags::empty(),
2246        )
2247    }
2248
2249    type ConnectedPeersResponseFut = fidl::client::QueryResponseFut<
2250        Vec<fidl_fuchsia_bluetooth::PeerId>,
2251        fidl::encoding::DefaultFuchsiaResourceDialect,
2252    >;
2253    fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut {
2254        fn _decode(
2255            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2256        ) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
2257            let _response = fidl::client::decode_transaction_body::<
2258                PeerManagerConnectedPeersResponse,
2259                fidl::encoding::DefaultFuchsiaResourceDialect,
2260                0x1deaca0295d5f8d6,
2261            >(_buf?)?;
2262            Ok(_response.peer_ids)
2263        }
2264        self.client.send_query_and_decode::<
2265            fidl::encoding::EmptyPayload,
2266            Vec<fidl_fuchsia_bluetooth::PeerId>,
2267        >(
2268            (),
2269            0x1deaca0295d5f8d6,
2270            fidl::encoding::DynamicFlags::empty(),
2271            _decode,
2272        )
2273    }
2274}
2275
2276pub struct PeerManagerEventStream {
2277    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2278}
2279
2280impl std::marker::Unpin for PeerManagerEventStream {}
2281
2282impl futures::stream::FusedStream for PeerManagerEventStream {
2283    fn is_terminated(&self) -> bool {
2284        self.event_receiver.is_terminated()
2285    }
2286}
2287
2288impl futures::Stream for PeerManagerEventStream {
2289    type Item = Result<PeerManagerEvent, fidl::Error>;
2290
2291    fn poll_next(
2292        mut self: std::pin::Pin<&mut Self>,
2293        cx: &mut std::task::Context<'_>,
2294    ) -> std::task::Poll<Option<Self::Item>> {
2295        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2296            &mut self.event_receiver,
2297            cx
2298        )?) {
2299            Some(buf) => std::task::Poll::Ready(Some(PeerManagerEvent::decode(buf))),
2300            None => std::task::Poll::Ready(None),
2301        }
2302    }
2303}
2304
2305#[derive(Debug)]
2306pub enum PeerManagerEvent {
2307    OnPeerConnected { peer_id: fidl_fuchsia_bluetooth::PeerId },
2308}
2309
2310impl PeerManagerEvent {
2311    #[allow(irrefutable_let_patterns)]
2312    pub fn into_on_peer_connected(self) -> Option<fidl_fuchsia_bluetooth::PeerId> {
2313        if let PeerManagerEvent::OnPeerConnected { peer_id } = self {
2314            Some((peer_id))
2315        } else {
2316            None
2317        }
2318    }
2319
2320    /// Decodes a message buffer as a [`PeerManagerEvent`].
2321    fn decode(
2322        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2323    ) -> Result<PeerManagerEvent, fidl::Error> {
2324        let (bytes, _handles) = buf.split_mut();
2325        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2326        debug_assert_eq!(tx_header.tx_id, 0);
2327        match tx_header.ordinal {
2328            0x154e6b9e519774d1 => {
2329                let mut out = fidl::new_empty!(
2330                    PeerManagerOnPeerConnectedRequest,
2331                    fidl::encoding::DefaultFuchsiaResourceDialect
2332                );
2333                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2334                Ok((PeerManagerEvent::OnPeerConnected { peer_id: out.peer_id }))
2335            }
2336            _ => Err(fidl::Error::UnknownOrdinal {
2337                ordinal: tx_header.ordinal,
2338                protocol_name: <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2339            }),
2340        }
2341    }
2342}
2343
2344/// A Stream of incoming requests for fuchsia.bluetooth.avdtp.test/PeerManager.
2345pub struct PeerManagerRequestStream {
2346    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2347    is_terminated: bool,
2348}
2349
2350impl std::marker::Unpin for PeerManagerRequestStream {}
2351
2352impl futures::stream::FusedStream for PeerManagerRequestStream {
2353    fn is_terminated(&self) -> bool {
2354        self.is_terminated
2355    }
2356}
2357
2358impl fidl::endpoints::RequestStream for PeerManagerRequestStream {
2359    type Protocol = PeerManagerMarker;
2360    type ControlHandle = PeerManagerControlHandle;
2361
2362    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2363        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2364    }
2365
2366    fn control_handle(&self) -> Self::ControlHandle {
2367        PeerManagerControlHandle { inner: self.inner.clone() }
2368    }
2369
2370    fn into_inner(
2371        self,
2372    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2373    {
2374        (self.inner, self.is_terminated)
2375    }
2376
2377    fn from_inner(
2378        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2379        is_terminated: bool,
2380    ) -> Self {
2381        Self { inner, is_terminated }
2382    }
2383}
2384
2385impl futures::Stream for PeerManagerRequestStream {
2386    type Item = Result<PeerManagerRequest, fidl::Error>;
2387
2388    fn poll_next(
2389        mut self: std::pin::Pin<&mut Self>,
2390        cx: &mut std::task::Context<'_>,
2391    ) -> std::task::Poll<Option<Self::Item>> {
2392        let this = &mut *self;
2393        if this.inner.check_shutdown(cx) {
2394            this.is_terminated = true;
2395            return std::task::Poll::Ready(None);
2396        }
2397        if this.is_terminated {
2398            panic!("polled PeerManagerRequestStream after completion");
2399        }
2400        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2401            |bytes, handles| {
2402                match this.inner.channel().read_etc(cx, bytes, handles) {
2403                    std::task::Poll::Ready(Ok(())) => {}
2404                    std::task::Poll::Pending => return std::task::Poll::Pending,
2405                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2406                        this.is_terminated = true;
2407                        return std::task::Poll::Ready(None);
2408                    }
2409                    std::task::Poll::Ready(Err(e)) => {
2410                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2411                            e.into(),
2412                        ))));
2413                    }
2414                }
2415
2416                // A message has been received from the channel
2417                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2418
2419                std::task::Poll::Ready(Some(match header.ordinal {
2420                    0x2a506872f2b04086 => {
2421                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2422                        let mut req = fidl::new_empty!(
2423                            PeerManagerGetPeerRequest,
2424                            fidl::encoding::DefaultFuchsiaResourceDialect
2425                        );
2426                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerGetPeerRequest>(&header, _body_bytes, handles, &mut req)?;
2427                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
2428                        Ok(PeerManagerRequest::GetPeer {
2429                            peer_id: req.peer_id,
2430                            handle: req.handle,
2431
2432                            control_handle,
2433                        })
2434                    }
2435                    0x1deaca0295d5f8d6 => {
2436                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2437                        let mut req = fidl::new_empty!(
2438                            fidl::encoding::EmptyPayload,
2439                            fidl::encoding::DefaultFuchsiaResourceDialect
2440                        );
2441                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2442                        let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
2443                        Ok(PeerManagerRequest::ConnectedPeers {
2444                            responder: PeerManagerConnectedPeersResponder {
2445                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2446                                tx_id: header.tx_id,
2447                            },
2448                        })
2449                    }
2450                    _ => Err(fidl::Error::UnknownOrdinal {
2451                        ordinal: header.ordinal,
2452                        protocol_name:
2453                            <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2454                    }),
2455                }))
2456            },
2457        )
2458    }
2459}
2460
2461/// Control service for an AVDTP Peer.
2462#[derive(Debug)]
2463pub enum PeerManagerRequest {
2464    /// Connects to the server specified by a `peer_id`.
2465    /// On success, `handle` will be used for initiating PeerController procedures.
2466    /// On peer disconnect, the handle will be dropped and closed on the server side.
2467    GetPeer {
2468        peer_id: fidl_fuchsia_bluetooth::PeerId,
2469        handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
2470        control_handle: PeerManagerControlHandle,
2471    },
2472    /// Returns the `bt.PeerId` of each currently connected peer.
2473    ConnectedPeers { responder: PeerManagerConnectedPeersResponder },
2474}
2475
2476impl PeerManagerRequest {
2477    #[allow(irrefutable_let_patterns)]
2478    pub fn into_get_peer(
2479        self,
2480    ) -> Option<(
2481        fidl_fuchsia_bluetooth::PeerId,
2482        fidl::endpoints::ServerEnd<PeerControllerMarker>,
2483        PeerManagerControlHandle,
2484    )> {
2485        if let PeerManagerRequest::GetPeer { peer_id, handle, control_handle } = self {
2486            Some((peer_id, handle, control_handle))
2487        } else {
2488            None
2489        }
2490    }
2491
2492    #[allow(irrefutable_let_patterns)]
2493    pub fn into_connected_peers(self) -> Option<(PeerManagerConnectedPeersResponder)> {
2494        if let PeerManagerRequest::ConnectedPeers { responder } = self {
2495            Some((responder))
2496        } else {
2497            None
2498        }
2499    }
2500
2501    /// Name of the method defined in FIDL
2502    pub fn method_name(&self) -> &'static str {
2503        match *self {
2504            PeerManagerRequest::GetPeer { .. } => "get_peer",
2505            PeerManagerRequest::ConnectedPeers { .. } => "connected_peers",
2506        }
2507    }
2508}
2509
2510#[derive(Debug, Clone)]
2511pub struct PeerManagerControlHandle {
2512    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2513}
2514
2515impl fidl::endpoints::ControlHandle for PeerManagerControlHandle {
2516    fn shutdown(&self) {
2517        self.inner.shutdown()
2518    }
2519
2520    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2521        self.inner.shutdown_with_epitaph(status)
2522    }
2523
2524    fn is_closed(&self) -> bool {
2525        self.inner.channel().is_closed()
2526    }
2527    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2528        self.inner.channel().on_closed()
2529    }
2530
2531    #[cfg(target_os = "fuchsia")]
2532    fn signal_peer(
2533        &self,
2534        clear_mask: zx::Signals,
2535        set_mask: zx::Signals,
2536    ) -> Result<(), zx_status::Status> {
2537        use fidl::Peered;
2538        self.inner.channel().signal_peer(clear_mask, set_mask)
2539    }
2540}
2541
2542impl PeerManagerControlHandle {
2543    pub fn send_on_peer_connected(
2544        &self,
2545        mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
2546    ) -> Result<(), fidl::Error> {
2547        self.inner.send::<PeerManagerOnPeerConnectedRequest>(
2548            (peer_id,),
2549            0,
2550            0x154e6b9e519774d1,
2551            fidl::encoding::DynamicFlags::empty(),
2552        )
2553    }
2554}
2555
2556#[must_use = "FIDL methods require a response to be sent"]
2557#[derive(Debug)]
2558pub struct PeerManagerConnectedPeersResponder {
2559    control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
2560    tx_id: u32,
2561}
2562
2563/// Set the the channel to be shutdown (see [`PeerManagerControlHandle::shutdown`])
2564/// if the responder is dropped without sending a response, so that the client
2565/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2566impl std::ops::Drop for PeerManagerConnectedPeersResponder {
2567    fn drop(&mut self) {
2568        self.control_handle.shutdown();
2569        // Safety: drops once, never accessed again
2570        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2571    }
2572}
2573
2574impl fidl::endpoints::Responder for PeerManagerConnectedPeersResponder {
2575    type ControlHandle = PeerManagerControlHandle;
2576
2577    fn control_handle(&self) -> &PeerManagerControlHandle {
2578        &self.control_handle
2579    }
2580
2581    fn drop_without_shutdown(mut self) {
2582        // Safety: drops once, never accessed again due to mem::forget
2583        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2584        // Prevent Drop from running (which would shut down the channel)
2585        std::mem::forget(self);
2586    }
2587}
2588
2589impl PeerManagerConnectedPeersResponder {
2590    /// Sends a response to the FIDL transaction.
2591    ///
2592    /// Sets the channel to shutdown if an error occurs.
2593    pub fn send(self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
2594        let _result = self.send_raw(peer_ids);
2595        if _result.is_err() {
2596            self.control_handle.shutdown();
2597        }
2598        self.drop_without_shutdown();
2599        _result
2600    }
2601
2602    /// Similar to "send" but does not shutdown the channel if an error occurs.
2603    pub fn send_no_shutdown_on_err(
2604        self,
2605        mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId],
2606    ) -> Result<(), fidl::Error> {
2607        let _result = self.send_raw(peer_ids);
2608        self.drop_without_shutdown();
2609        _result
2610    }
2611
2612    fn send_raw(&self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
2613        self.control_handle.inner.send::<PeerManagerConnectedPeersResponse>(
2614            (peer_ids,),
2615            self.tx_id,
2616            0x1deaca0295d5f8d6,
2617            fidl::encoding::DynamicFlags::empty(),
2618        )
2619    }
2620}
2621
2622mod internal {
2623    use super::*;
2624
2625    impl fidl::encoding::ResourceTypeMarker for PeerManagerGetPeerRequest {
2626        type Borrowed<'a> = &'a mut Self;
2627        fn take_or_borrow<'a>(
2628            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2629        ) -> Self::Borrowed<'a> {
2630            value
2631        }
2632    }
2633
2634    unsafe impl fidl::encoding::TypeMarker for PeerManagerGetPeerRequest {
2635        type Owned = Self;
2636
2637        #[inline(always)]
2638        fn inline_align(_context: fidl::encoding::Context) -> usize {
2639            8
2640        }
2641
2642        #[inline(always)]
2643        fn inline_size(_context: fidl::encoding::Context) -> usize {
2644            16
2645        }
2646    }
2647
2648    unsafe impl
2649        fidl::encoding::Encode<
2650            PeerManagerGetPeerRequest,
2651            fidl::encoding::DefaultFuchsiaResourceDialect,
2652        > for &mut PeerManagerGetPeerRequest
2653    {
2654        #[inline]
2655        unsafe fn encode(
2656            self,
2657            encoder: &mut fidl::encoding::Encoder<
2658                '_,
2659                fidl::encoding::DefaultFuchsiaResourceDialect,
2660            >,
2661            offset: usize,
2662            _depth: fidl::encoding::Depth,
2663        ) -> fidl::Result<()> {
2664            encoder.debug_check_bounds::<PeerManagerGetPeerRequest>(offset);
2665            // Delegate to tuple encoding.
2666            fidl::encoding::Encode::<PeerManagerGetPeerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2667                (
2668                    <fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
2669                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
2670                ),
2671                encoder, offset, _depth
2672            )
2673        }
2674    }
2675    unsafe impl<
2676        T0: fidl::encoding::Encode<
2677                fidl_fuchsia_bluetooth::PeerId,
2678                fidl::encoding::DefaultFuchsiaResourceDialect,
2679            >,
2680        T1: fidl::encoding::Encode<
2681                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2682                fidl::encoding::DefaultFuchsiaResourceDialect,
2683            >,
2684    >
2685        fidl::encoding::Encode<
2686            PeerManagerGetPeerRequest,
2687            fidl::encoding::DefaultFuchsiaResourceDialect,
2688        > for (T0, T1)
2689    {
2690        #[inline]
2691        unsafe fn encode(
2692            self,
2693            encoder: &mut fidl::encoding::Encoder<
2694                '_,
2695                fidl::encoding::DefaultFuchsiaResourceDialect,
2696            >,
2697            offset: usize,
2698            depth: fidl::encoding::Depth,
2699        ) -> fidl::Result<()> {
2700            encoder.debug_check_bounds::<PeerManagerGetPeerRequest>(offset);
2701            // Zero out padding regions. There's no need to apply masks
2702            // because the unmasked parts will be overwritten by fields.
2703            unsafe {
2704                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2705                (ptr as *mut u64).write_unaligned(0);
2706            }
2707            // Write the fields.
2708            self.0.encode(encoder, offset + 0, depth)?;
2709            self.1.encode(encoder, offset + 8, depth)?;
2710            Ok(())
2711        }
2712    }
2713
2714    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2715        for PeerManagerGetPeerRequest
2716    {
2717        #[inline(always)]
2718        fn new_empty() -> Self {
2719            Self {
2720                peer_id: fidl::new_empty!(
2721                    fidl_fuchsia_bluetooth::PeerId,
2722                    fidl::encoding::DefaultFuchsiaResourceDialect
2723                ),
2724                handle: fidl::new_empty!(
2725                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2726                    fidl::encoding::DefaultFuchsiaResourceDialect
2727                ),
2728            }
2729        }
2730
2731        #[inline]
2732        unsafe fn decode(
2733            &mut self,
2734            decoder: &mut fidl::encoding::Decoder<
2735                '_,
2736                fidl::encoding::DefaultFuchsiaResourceDialect,
2737            >,
2738            offset: usize,
2739            _depth: fidl::encoding::Depth,
2740        ) -> fidl::Result<()> {
2741            decoder.debug_check_bounds::<Self>(offset);
2742            // Verify that padding bytes are zero.
2743            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2744            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2745            let mask = 0xffffffff00000000u64;
2746            let maskedval = padval & mask;
2747            if maskedval != 0 {
2748                return Err(fidl::Error::NonZeroPadding {
2749                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2750                });
2751            }
2752            fidl::decode!(
2753                fidl_fuchsia_bluetooth::PeerId,
2754                fidl::encoding::DefaultFuchsiaResourceDialect,
2755                &mut self.peer_id,
2756                decoder,
2757                offset + 0,
2758                _depth
2759            )?;
2760            fidl::decode!(
2761                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
2762                fidl::encoding::DefaultFuchsiaResourceDialect,
2763                &mut self.handle,
2764                decoder,
2765                offset + 8,
2766                _depth
2767            )?;
2768            Ok(())
2769        }
2770    }
2771}