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