Skip to main content

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