fidl_fuchsia_hardware_audio/
fidl_fuchsia_hardware_audio.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_hardware_audio_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct CodecConnectorConnectRequest {
16    pub codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for CodecConnectorConnectRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct CompositeConnectorConnectRequest {
26    pub composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for CompositeConnectorConnectRequest
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct CompositeCreateRingBufferRequest {
36    pub processing_element_id: u64,
37    pub format: Format,
38    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
39}
40
41impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
42    for CompositeCreateRingBufferRequest
43{
44}
45
46#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct DaiConnectorConnectRequest {
48    pub dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
49}
50
51impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
52    for DaiConnectorConnectRequest
53{
54}
55
56#[derive(Debug, PartialEq)]
57pub struct DaiCreateRingBufferRequest {
58    pub dai_format: DaiFormat,
59    pub ring_buffer_format: Format,
60    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
61}
62
63impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
64    for DaiCreateRingBufferRequest
65{
66}
67
68#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69pub struct RingBufferGetVmoResponse {
70    pub num_frames: u32,
71    pub ring_buffer: fidl::Vmo,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RingBufferGetVmoResponse {}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct StreamConfigConnectorConnectRequest {
78    pub protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
82    for StreamConfigConnectorConnectRequest
83{
84}
85
86#[derive(Debug, PartialEq)]
87pub struct StreamConfigCreateRingBufferRequest {
88    pub format: Format,
89    pub ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for StreamConfigCreateRingBufferRequest
94{
95}
96
97#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
98pub struct CodecMarker;
99
100impl fidl::endpoints::ProtocolMarker for CodecMarker {
101    type Proxy = CodecProxy;
102    type RequestStream = CodecRequestStream;
103    #[cfg(target_os = "fuchsia")]
104    type SynchronousProxy = CodecSynchronousProxy;
105
106    const DEBUG_NAME: &'static str = "(anonymous) Codec";
107}
108pub type CodecGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
109pub type CodecSetDaiFormatResult = Result<CodecFormatInfo, i32>;
110
111pub trait CodecProxyInterface: Send + Sync {
112    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
113        + Send;
114    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
115    fn r#signal_processing_connect(
116        &self,
117        protocol: fidl::endpoints::ServerEnd<
118            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
119        >,
120    ) -> Result<(), fidl::Error>;
121    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
122    fn r#reset(&self) -> Self::ResetResponseFut;
123    type GetPropertiesResponseFut: std::future::Future<Output = Result<CodecProperties, fidl::Error>>
124        + Send;
125    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
126    type StopResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
127    fn r#stop(&self) -> Self::StopResponseFut;
128    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
129    fn r#start(&self) -> Self::StartResponseFut;
130    type IsBridgeableResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
131    fn r#is_bridgeable(&self) -> Self::IsBridgeableResponseFut;
132    fn r#set_bridged_mode(&self, enable_bridged_mode: bool) -> Result<(), fidl::Error>;
133    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CodecGetDaiFormatsResult, fidl::Error>>
134        + Send;
135    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
136    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CodecSetDaiFormatResult, fidl::Error>>
137        + Send;
138    fn r#set_dai_format(&self, format: &DaiFormat) -> Self::SetDaiFormatResponseFut;
139    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
140        + Send;
141    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
142}
143#[derive(Debug)]
144#[cfg(target_os = "fuchsia")]
145pub struct CodecSynchronousProxy {
146    client: fidl::client::sync::Client,
147}
148
149#[cfg(target_os = "fuchsia")]
150impl fidl::endpoints::SynchronousProxy for CodecSynchronousProxy {
151    type Proxy = CodecProxy;
152    type Protocol = CodecMarker;
153
154    fn from_channel(inner: fidl::Channel) -> Self {
155        Self::new(inner)
156    }
157
158    fn into_channel(self) -> fidl::Channel {
159        self.client.into_channel()
160    }
161
162    fn as_channel(&self) -> &fidl::Channel {
163        self.client.as_channel()
164    }
165}
166
167#[cfg(target_os = "fuchsia")]
168impl CodecSynchronousProxy {
169    pub fn new(channel: fidl::Channel) -> Self {
170        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
171        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
172    }
173
174    pub fn into_channel(self) -> fidl::Channel {
175        self.client.into_channel()
176    }
177
178    /// Waits until an event arrives and returns it. It is safe for other
179    /// threads to make concurrent requests while waiting for an event.
180    pub fn wait_for_event(
181        &self,
182        deadline: zx::MonotonicInstant,
183    ) -> Result<CodecEvent, fidl::Error> {
184        CodecEvent::decode(self.client.wait_for_event(deadline)?)
185    }
186
187    /// Retrieves top level health state.
188    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
189    pub fn r#get_health_state(
190        &self,
191        ___deadline: zx::MonotonicInstant,
192    ) -> Result<HealthState, fidl::Error> {
193        let _response =
194            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
195                (),
196                0x4e146d6bca733a84,
197                fidl::encoding::DynamicFlags::empty(),
198                ___deadline,
199            )?;
200        Ok(_response.state)
201    }
202
203    /// Connect to a `SignalProcessing` protocol.
204    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
205    /// the maximum number of connections have already been created, for instance one, then the
206    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
207    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
208    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
209    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
210    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
211    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
212    /// is intended to be composed, and hence the more verbose name allows differentiation and
213    /// improved clarity.
214    pub fn r#signal_processing_connect(
215        &self,
216        mut protocol: fidl::endpoints::ServerEnd<
217            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
218        >,
219    ) -> Result<(), fidl::Error> {
220        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
221            (protocol,),
222            0xa81907ce6066295,
223            fidl::encoding::DynamicFlags::empty(),
224        )
225    }
226
227    /// Resets the codec.
228    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
229    /// codec it will close the codec protocol channel, in this case the client may obtain a new
230    /// codec protocol channel and retry.
231    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
232        let _response =
233            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
234                (),
235                0x50757ae579a7bd6b,
236                fidl::encoding::DynamicFlags::empty(),
237                ___deadline,
238            )?;
239        Ok(_response)
240    }
241
242    /// Retrieves top level static properties.
243    pub fn r#get_properties(
244        &self,
245        ___deadline: zx::MonotonicInstant,
246    ) -> Result<CodecProperties, fidl::Error> {
247        let _response =
248            self.client.send_query::<fidl::encoding::EmptyPayload, CodecGetPropertiesResponse>(
249                (),
250                0x7a0d138a6a1d9d90,
251                fidl::encoding::DynamicFlags::empty(),
252                ___deadline,
253            )?;
254        Ok(_response.properties)
255    }
256
257    /// Stops the codec operation.
258    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
259    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
260    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
261    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
262    /// in the CLOCK_MONOTONIC timeline.
263    /// If the driver cannot successfully configure the codec to stop, it will close the codec
264    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
265    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
266        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, CodecStopResponse>(
267            (),
268            0x5c2e380df1332dbd,
269            fidl::encoding::DynamicFlags::empty(),
270            ___deadline,
271        )?;
272        Ok(_response.stop_time)
273    }
274
275    /// Start/Re-start the codec operation.
276    /// `Start` returns when configuring the codec to start is completed. This method does not wait
277    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
278    /// into account), nor is any such delay reflected in the returned `start_time`.
279    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
280    /// in the CLOCK_MONOTONIC timeline.
281    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
282    /// in which case the client may obtain a new codec protocol channel and retry.
283    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
284        let _response =
285            self.client.send_query::<fidl::encoding::EmptyPayload, CodecStartResponse>(
286                (),
287                0x329cdacb286ab00,
288                fidl::encoding::DynamicFlags::empty(),
289                ___deadline,
290            )?;
291        Ok(_response.start_time)
292    }
293
294    /// Returns whether a codec is bridgeable.
295    ///
296    /// # Deprecation
297    ///
298    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
299    /// A driver can still be configured to operate in bridged mode or not at boot time.
300    pub fn r#is_bridgeable(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
301        let _response =
302            self.client.send_query::<fidl::encoding::EmptyPayload, CodecIsBridgeableResponse>(
303                (),
304                0x26b0684f603f88ec,
305                fidl::encoding::DynamicFlags::empty(),
306                ___deadline,
307            )?;
308        Ok(_response.supports_bridged_mode)
309    }
310
311    /// Sets a codec's bridged mode. This method is required, but it only needs to take action if
312    /// the codec supports bridged mode as specified by its reply to `IsBridgeable`.
313    ///
314    /// # Deprecation
315    ///
316    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
317    /// A driver can still be configured to operate in bridged mode or not at boot time.
318    pub fn r#set_bridged_mode(&self, mut enable_bridged_mode: bool) -> Result<(), fidl::Error> {
319        self.client.send::<CodecSetBridgedModeRequest>(
320            (enable_bridged_mode,),
321            0x2bd8f7bfd0b0aa36,
322            fidl::encoding::DynamicFlags::empty(),
323        )
324    }
325
326    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
327    /// may reply with an error status and the controller may retry at a later time.
328    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
329    /// combinations of the parameters in DaiSupportedFormats may be supported.
330    pub fn r#get_dai_formats(
331        &self,
332        ___deadline: zx::MonotonicInstant,
333    ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
334        let _response = self.client.send_query::<
335            fidl::encoding::EmptyPayload,
336            fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
337        >(
338            (),
339            0xf8bbc46b4ba6a52,
340            fidl::encoding::DynamicFlags::empty(),
341            ___deadline,
342        )?;
343        Ok(_response.map(|x| x.formats))
344    }
345
346    /// Sets the DAI format to be used in the interface between the controller and codec.
347    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
348    pub fn r#set_dai_format(
349        &self,
350        mut format: &DaiFormat,
351        ___deadline: zx::MonotonicInstant,
352    ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
353        let _response = self.client.send_query::<
354            CodecSetDaiFormatRequest,
355            fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
356        >(
357            (format,),
358            0x2f829df9e5a7a1ea,
359            fidl::encoding::DynamicFlags::empty(),
360            ___deadline,
361        )?;
362        Ok(_response.map(|x| x.state))
363    }
364
365    /// Get the plug detect state via a hanging get. The driver will reply to the first
366    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
367    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
368    pub fn r#watch_plug_state(
369        &self,
370        ___deadline: zx::MonotonicInstant,
371    ) -> Result<PlugState, fidl::Error> {
372        let _response =
373            self.client.send_query::<fidl::encoding::EmptyPayload, CodecWatchPlugStateResponse>(
374                (),
375                0x182b87f935ca7326,
376                fidl::encoding::DynamicFlags::empty(),
377                ___deadline,
378            )?;
379        Ok(_response.plug_state)
380    }
381}
382
383#[derive(Debug, Clone)]
384pub struct CodecProxy {
385    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
386}
387
388impl fidl::endpoints::Proxy for CodecProxy {
389    type Protocol = CodecMarker;
390
391    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
392        Self::new(inner)
393    }
394
395    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
396        self.client.into_channel().map_err(|client| Self { client })
397    }
398
399    fn as_channel(&self) -> &::fidl::AsyncChannel {
400        self.client.as_channel()
401    }
402}
403
404impl CodecProxy {
405    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
406    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
407        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
408        Self { client: fidl::client::Client::new(channel, protocol_name) }
409    }
410
411    /// Get a Stream of events from the remote end of the protocol.
412    ///
413    /// # Panics
414    ///
415    /// Panics if the event stream was already taken.
416    pub fn take_event_stream(&self) -> CodecEventStream {
417        CodecEventStream { event_receiver: self.client.take_event_receiver() }
418    }
419
420    /// Retrieves top level health state.
421    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
422    pub fn r#get_health_state(
423        &self,
424    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
425    {
426        CodecProxyInterface::r#get_health_state(self)
427    }
428
429    /// Connect to a `SignalProcessing` protocol.
430    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
431    /// the maximum number of connections have already been created, for instance one, then the
432    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
433    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
434    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
435    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
436    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
437    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
438    /// is intended to be composed, and hence the more verbose name allows differentiation and
439    /// improved clarity.
440    pub fn r#signal_processing_connect(
441        &self,
442        mut protocol: fidl::endpoints::ServerEnd<
443            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
444        >,
445    ) -> Result<(), fidl::Error> {
446        CodecProxyInterface::r#signal_processing_connect(self, protocol)
447    }
448
449    /// Resets the codec.
450    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
451    /// codec it will close the codec protocol channel, in this case the client may obtain a new
452    /// codec protocol channel and retry.
453    pub fn r#reset(
454        &self,
455    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
456        CodecProxyInterface::r#reset(self)
457    }
458
459    /// Retrieves top level static properties.
460    pub fn r#get_properties(
461        &self,
462    ) -> fidl::client::QueryResponseFut<
463        CodecProperties,
464        fidl::encoding::DefaultFuchsiaResourceDialect,
465    > {
466        CodecProxyInterface::r#get_properties(self)
467    }
468
469    /// Stops the codec operation.
470    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
471    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
472    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
473    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
474    /// in the CLOCK_MONOTONIC timeline.
475    /// If the driver cannot successfully configure the codec to stop, it will close the codec
476    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
477    pub fn r#stop(
478        &self,
479    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
480        CodecProxyInterface::r#stop(self)
481    }
482
483    /// Start/Re-start the codec operation.
484    /// `Start` returns when configuring the codec to start is completed. This method does not wait
485    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
486    /// into account), nor is any such delay reflected in the returned `start_time`.
487    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
488    /// in the CLOCK_MONOTONIC timeline.
489    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
490    /// in which case the client may obtain a new codec protocol channel and retry.
491    pub fn r#start(
492        &self,
493    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
494        CodecProxyInterface::r#start(self)
495    }
496
497    /// Returns whether a codec is bridgeable.
498    ///
499    /// # Deprecation
500    ///
501    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
502    /// A driver can still be configured to operate in bridged mode or not at boot time.
503    pub fn r#is_bridgeable(
504        &self,
505    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
506        CodecProxyInterface::r#is_bridgeable(self)
507    }
508
509    /// Sets a codec's bridged mode. This method is required, but it only needs to take action if
510    /// the codec supports bridged mode as specified by its reply to `IsBridgeable`.
511    ///
512    /// # Deprecation
513    ///
514    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
515    /// A driver can still be configured to operate in bridged mode or not at boot time.
516    pub fn r#set_bridged_mode(&self, mut enable_bridged_mode: bool) -> Result<(), fidl::Error> {
517        CodecProxyInterface::r#set_bridged_mode(self, enable_bridged_mode)
518    }
519
520    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
521    /// may reply with an error status and the controller may retry at a later time.
522    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
523    /// combinations of the parameters in DaiSupportedFormats may be supported.
524    pub fn r#get_dai_formats(
525        &self,
526    ) -> fidl::client::QueryResponseFut<
527        CodecGetDaiFormatsResult,
528        fidl::encoding::DefaultFuchsiaResourceDialect,
529    > {
530        CodecProxyInterface::r#get_dai_formats(self)
531    }
532
533    /// Sets the DAI format to be used in the interface between the controller and codec.
534    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
535    pub fn r#set_dai_format(
536        &self,
537        mut format: &DaiFormat,
538    ) -> fidl::client::QueryResponseFut<
539        CodecSetDaiFormatResult,
540        fidl::encoding::DefaultFuchsiaResourceDialect,
541    > {
542        CodecProxyInterface::r#set_dai_format(self, format)
543    }
544
545    /// Get the plug detect state via a hanging get. The driver will reply to the first
546    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
547    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
548    pub fn r#watch_plug_state(
549        &self,
550    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
551    {
552        CodecProxyInterface::r#watch_plug_state(self)
553    }
554}
555
556impl CodecProxyInterface for CodecProxy {
557    type GetHealthStateResponseFut =
558        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
559    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
560        fn _decode(
561            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
562        ) -> Result<HealthState, fidl::Error> {
563            let _response = fidl::client::decode_transaction_body::<
564                HealthGetHealthStateResponse,
565                fidl::encoding::DefaultFuchsiaResourceDialect,
566                0x4e146d6bca733a84,
567            >(_buf?)?;
568            Ok(_response.state)
569        }
570        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
571            (),
572            0x4e146d6bca733a84,
573            fidl::encoding::DynamicFlags::empty(),
574            _decode,
575        )
576    }
577
578    fn r#signal_processing_connect(
579        &self,
580        mut protocol: fidl::endpoints::ServerEnd<
581            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
582        >,
583    ) -> Result<(), fidl::Error> {
584        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
585            (protocol,),
586            0xa81907ce6066295,
587            fidl::encoding::DynamicFlags::empty(),
588        )
589    }
590
591    type ResetResponseFut =
592        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
593    fn r#reset(&self) -> Self::ResetResponseFut {
594        fn _decode(
595            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
596        ) -> Result<(), fidl::Error> {
597            let _response = fidl::client::decode_transaction_body::<
598                fidl::encoding::EmptyPayload,
599                fidl::encoding::DefaultFuchsiaResourceDialect,
600                0x50757ae579a7bd6b,
601            >(_buf?)?;
602            Ok(_response)
603        }
604        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
605            (),
606            0x50757ae579a7bd6b,
607            fidl::encoding::DynamicFlags::empty(),
608            _decode,
609        )
610    }
611
612    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
613        CodecProperties,
614        fidl::encoding::DefaultFuchsiaResourceDialect,
615    >;
616    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
617        fn _decode(
618            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
619        ) -> Result<CodecProperties, fidl::Error> {
620            let _response = fidl::client::decode_transaction_body::<
621                CodecGetPropertiesResponse,
622                fidl::encoding::DefaultFuchsiaResourceDialect,
623                0x7a0d138a6a1d9d90,
624            >(_buf?)?;
625            Ok(_response.properties)
626        }
627        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
628            (),
629            0x7a0d138a6a1d9d90,
630            fidl::encoding::DynamicFlags::empty(),
631            _decode,
632        )
633    }
634
635    type StopResponseFut =
636        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
637    fn r#stop(&self) -> Self::StopResponseFut {
638        fn _decode(
639            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
640        ) -> Result<i64, fidl::Error> {
641            let _response = fidl::client::decode_transaction_body::<
642                CodecStopResponse,
643                fidl::encoding::DefaultFuchsiaResourceDialect,
644                0x5c2e380df1332dbd,
645            >(_buf?)?;
646            Ok(_response.stop_time)
647        }
648        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
649            (),
650            0x5c2e380df1332dbd,
651            fidl::encoding::DynamicFlags::empty(),
652            _decode,
653        )
654    }
655
656    type StartResponseFut =
657        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
658    fn r#start(&self) -> Self::StartResponseFut {
659        fn _decode(
660            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
661        ) -> Result<i64, fidl::Error> {
662            let _response = fidl::client::decode_transaction_body::<
663                CodecStartResponse,
664                fidl::encoding::DefaultFuchsiaResourceDialect,
665                0x329cdacb286ab00,
666            >(_buf?)?;
667            Ok(_response.start_time)
668        }
669        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
670            (),
671            0x329cdacb286ab00,
672            fidl::encoding::DynamicFlags::empty(),
673            _decode,
674        )
675    }
676
677    type IsBridgeableResponseFut =
678        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
679    fn r#is_bridgeable(&self) -> Self::IsBridgeableResponseFut {
680        fn _decode(
681            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
682        ) -> Result<bool, fidl::Error> {
683            let _response = fidl::client::decode_transaction_body::<
684                CodecIsBridgeableResponse,
685                fidl::encoding::DefaultFuchsiaResourceDialect,
686                0x26b0684f603f88ec,
687            >(_buf?)?;
688            Ok(_response.supports_bridged_mode)
689        }
690        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
691            (),
692            0x26b0684f603f88ec,
693            fidl::encoding::DynamicFlags::empty(),
694            _decode,
695        )
696    }
697
698    fn r#set_bridged_mode(&self, mut enable_bridged_mode: bool) -> Result<(), fidl::Error> {
699        self.client.send::<CodecSetBridgedModeRequest>(
700            (enable_bridged_mode,),
701            0x2bd8f7bfd0b0aa36,
702            fidl::encoding::DynamicFlags::empty(),
703        )
704    }
705
706    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
707        CodecGetDaiFormatsResult,
708        fidl::encoding::DefaultFuchsiaResourceDialect,
709    >;
710    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
711        fn _decode(
712            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
713        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
714            let _response = fidl::client::decode_transaction_body::<
715                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
716                fidl::encoding::DefaultFuchsiaResourceDialect,
717                0xf8bbc46b4ba6a52,
718            >(_buf?)?;
719            Ok(_response.map(|x| x.formats))
720        }
721        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
722            (),
723            0xf8bbc46b4ba6a52,
724            fidl::encoding::DynamicFlags::empty(),
725            _decode,
726        )
727    }
728
729    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
730        CodecSetDaiFormatResult,
731        fidl::encoding::DefaultFuchsiaResourceDialect,
732    >;
733    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
734        fn _decode(
735            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
736        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
737            let _response = fidl::client::decode_transaction_body::<
738                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
739                fidl::encoding::DefaultFuchsiaResourceDialect,
740                0x2f829df9e5a7a1ea,
741            >(_buf?)?;
742            Ok(_response.map(|x| x.state))
743        }
744        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
745            (format,),
746            0x2f829df9e5a7a1ea,
747            fidl::encoding::DynamicFlags::empty(),
748            _decode,
749        )
750    }
751
752    type WatchPlugStateResponseFut =
753        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
754    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
755        fn _decode(
756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
757        ) -> Result<PlugState, fidl::Error> {
758            let _response = fidl::client::decode_transaction_body::<
759                CodecWatchPlugStateResponse,
760                fidl::encoding::DefaultFuchsiaResourceDialect,
761                0x182b87f935ca7326,
762            >(_buf?)?;
763            Ok(_response.plug_state)
764        }
765        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
766            (),
767            0x182b87f935ca7326,
768            fidl::encoding::DynamicFlags::empty(),
769            _decode,
770        )
771    }
772}
773
774pub struct CodecEventStream {
775    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
776}
777
778impl std::marker::Unpin for CodecEventStream {}
779
780impl futures::stream::FusedStream for CodecEventStream {
781    fn is_terminated(&self) -> bool {
782        self.event_receiver.is_terminated()
783    }
784}
785
786impl futures::Stream for CodecEventStream {
787    type Item = Result<CodecEvent, fidl::Error>;
788
789    fn poll_next(
790        mut self: std::pin::Pin<&mut Self>,
791        cx: &mut std::task::Context<'_>,
792    ) -> std::task::Poll<Option<Self::Item>> {
793        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
794            &mut self.event_receiver,
795            cx
796        )?) {
797            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
798            None => std::task::Poll::Ready(None),
799        }
800    }
801}
802
803#[derive(Debug)]
804pub enum CodecEvent {}
805
806impl CodecEvent {
807    /// Decodes a message buffer as a [`CodecEvent`].
808    fn decode(
809        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
810    ) -> Result<CodecEvent, fidl::Error> {
811        let (bytes, _handles) = buf.split_mut();
812        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
813        debug_assert_eq!(tx_header.tx_id, 0);
814        match tx_header.ordinal {
815            _ => Err(fidl::Error::UnknownOrdinal {
816                ordinal: tx_header.ordinal,
817                protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
818            }),
819        }
820    }
821}
822
823/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
824pub struct CodecRequestStream {
825    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
826    is_terminated: bool,
827}
828
829impl std::marker::Unpin for CodecRequestStream {}
830
831impl futures::stream::FusedStream for CodecRequestStream {
832    fn is_terminated(&self) -> bool {
833        self.is_terminated
834    }
835}
836
837impl fidl::endpoints::RequestStream for CodecRequestStream {
838    type Protocol = CodecMarker;
839    type ControlHandle = CodecControlHandle;
840
841    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
842        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
843    }
844
845    fn control_handle(&self) -> Self::ControlHandle {
846        CodecControlHandle { inner: self.inner.clone() }
847    }
848
849    fn into_inner(
850        self,
851    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
852    {
853        (self.inner, self.is_terminated)
854    }
855
856    fn from_inner(
857        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
858        is_terminated: bool,
859    ) -> Self {
860        Self { inner, is_terminated }
861    }
862}
863
864impl futures::Stream for CodecRequestStream {
865    type Item = Result<CodecRequest, fidl::Error>;
866
867    fn poll_next(
868        mut self: std::pin::Pin<&mut Self>,
869        cx: &mut std::task::Context<'_>,
870    ) -> std::task::Poll<Option<Self::Item>> {
871        let this = &mut *self;
872        if this.inner.check_shutdown(cx) {
873            this.is_terminated = true;
874            return std::task::Poll::Ready(None);
875        }
876        if this.is_terminated {
877            panic!("polled CodecRequestStream after completion");
878        }
879        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
880            |bytes, handles| {
881                match this.inner.channel().read_etc(cx, bytes, handles) {
882                    std::task::Poll::Ready(Ok(())) => {}
883                    std::task::Poll::Pending => return std::task::Poll::Pending,
884                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
885                        this.is_terminated = true;
886                        return std::task::Poll::Ready(None);
887                    }
888                    std::task::Poll::Ready(Err(e)) => {
889                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
890                            e.into(),
891                        ))))
892                    }
893                }
894
895                // A message has been received from the channel
896                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
897
898                std::task::Poll::Ready(Some(match header.ordinal {
899                    0x4e146d6bca733a84 => {
900                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
901                        let mut req = fidl::new_empty!(
902                            fidl::encoding::EmptyPayload,
903                            fidl::encoding::DefaultFuchsiaResourceDialect
904                        );
905                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
906                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
907                        Ok(CodecRequest::GetHealthState {
908                            responder: CodecGetHealthStateResponder {
909                                control_handle: std::mem::ManuallyDrop::new(control_handle),
910                                tx_id: header.tx_id,
911                            },
912                        })
913                    }
914                    0xa81907ce6066295 => {
915                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
916                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
917                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
918                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
919                        Ok(CodecRequest::SignalProcessingConnect {
920                            protocol: req.protocol,
921
922                            control_handle,
923                        })
924                    }
925                    0x50757ae579a7bd6b => {
926                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
927                        let mut req = fidl::new_empty!(
928                            fidl::encoding::EmptyPayload,
929                            fidl::encoding::DefaultFuchsiaResourceDialect
930                        );
931                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
932                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
933                        Ok(CodecRequest::Reset {
934                            responder: CodecResetResponder {
935                                control_handle: std::mem::ManuallyDrop::new(control_handle),
936                                tx_id: header.tx_id,
937                            },
938                        })
939                    }
940                    0x7a0d138a6a1d9d90 => {
941                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
942                        let mut req = fidl::new_empty!(
943                            fidl::encoding::EmptyPayload,
944                            fidl::encoding::DefaultFuchsiaResourceDialect
945                        );
946                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
947                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
948                        Ok(CodecRequest::GetProperties {
949                            responder: CodecGetPropertiesResponder {
950                                control_handle: std::mem::ManuallyDrop::new(control_handle),
951                                tx_id: header.tx_id,
952                            },
953                        })
954                    }
955                    0x5c2e380df1332dbd => {
956                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
957                        let mut req = fidl::new_empty!(
958                            fidl::encoding::EmptyPayload,
959                            fidl::encoding::DefaultFuchsiaResourceDialect
960                        );
961                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
962                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
963                        Ok(CodecRequest::Stop {
964                            responder: CodecStopResponder {
965                                control_handle: std::mem::ManuallyDrop::new(control_handle),
966                                tx_id: header.tx_id,
967                            },
968                        })
969                    }
970                    0x329cdacb286ab00 => {
971                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
972                        let mut req = fidl::new_empty!(
973                            fidl::encoding::EmptyPayload,
974                            fidl::encoding::DefaultFuchsiaResourceDialect
975                        );
976                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
977                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
978                        Ok(CodecRequest::Start {
979                            responder: CodecStartResponder {
980                                control_handle: std::mem::ManuallyDrop::new(control_handle),
981                                tx_id: header.tx_id,
982                            },
983                        })
984                    }
985                    0x26b0684f603f88ec => {
986                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
987                        let mut req = fidl::new_empty!(
988                            fidl::encoding::EmptyPayload,
989                            fidl::encoding::DefaultFuchsiaResourceDialect
990                        );
991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
992                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
993                        Ok(CodecRequest::IsBridgeable {
994                            responder: CodecIsBridgeableResponder {
995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
996                                tx_id: header.tx_id,
997                            },
998                        })
999                    }
1000                    0x2bd8f7bfd0b0aa36 => {
1001                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1002                        let mut req = fidl::new_empty!(
1003                            CodecSetBridgedModeRequest,
1004                            fidl::encoding::DefaultFuchsiaResourceDialect
1005                        );
1006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetBridgedModeRequest>(&header, _body_bytes, handles, &mut req)?;
1007                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1008                        Ok(CodecRequest::SetBridgedMode {
1009                            enable_bridged_mode: req.enable_bridged_mode,
1010
1011                            control_handle,
1012                        })
1013                    }
1014                    0xf8bbc46b4ba6a52 => {
1015                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1016                        let mut req = fidl::new_empty!(
1017                            fidl::encoding::EmptyPayload,
1018                            fidl::encoding::DefaultFuchsiaResourceDialect
1019                        );
1020                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1021                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1022                        Ok(CodecRequest::GetDaiFormats {
1023                            responder: CodecGetDaiFormatsResponder {
1024                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1025                                tx_id: header.tx_id,
1026                            },
1027                        })
1028                    }
1029                    0x2f829df9e5a7a1ea => {
1030                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1031                        let mut req = fidl::new_empty!(
1032                            CodecSetDaiFormatRequest,
1033                            fidl::encoding::DefaultFuchsiaResourceDialect
1034                        );
1035                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
1036                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1037                        Ok(CodecRequest::SetDaiFormat {
1038                            format: req.format,
1039
1040                            responder: CodecSetDaiFormatResponder {
1041                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1042                                tx_id: header.tx_id,
1043                            },
1044                        })
1045                    }
1046                    0x182b87f935ca7326 => {
1047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1048                        let mut req = fidl::new_empty!(
1049                            fidl::encoding::EmptyPayload,
1050                            fidl::encoding::DefaultFuchsiaResourceDialect
1051                        );
1052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1053                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1054                        Ok(CodecRequest::WatchPlugState {
1055                            responder: CodecWatchPlugStateResponder {
1056                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1057                                tx_id: header.tx_id,
1058                            },
1059                        })
1060                    }
1061                    _ => Err(fidl::Error::UnknownOrdinal {
1062                        ordinal: header.ordinal,
1063                        protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1064                    }),
1065                }))
1066            },
1067        )
1068    }
1069}
1070
1071/// For an overview see
1072/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
1073/// # Deprecation
1074///
1075/// Not supported anymore, instead use an
1076/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1077/// with one DAI and no Ring Buffer, see
1078/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1079#[derive(Debug)]
1080pub enum CodecRequest {
1081    /// Retrieves top level health state.
1082    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
1083    GetHealthState { responder: CodecGetHealthStateResponder },
1084    /// Connect to a `SignalProcessing` protocol.
1085    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
1086    /// the maximum number of connections have already been created, for instance one, then the
1087    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
1088    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
1089    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
1090    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
1091    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
1092    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
1093    /// is intended to be composed, and hence the more verbose name allows differentiation and
1094    /// improved clarity.
1095    SignalProcessingConnect {
1096        protocol: fidl::endpoints::ServerEnd<
1097            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1098        >,
1099        control_handle: CodecControlHandle,
1100    },
1101    /// Resets the codec.
1102    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
1103    /// codec it will close the codec protocol channel, in this case the client may obtain a new
1104    /// codec protocol channel and retry.
1105    Reset { responder: CodecResetResponder },
1106    /// Retrieves top level static properties.
1107    GetProperties { responder: CodecGetPropertiesResponder },
1108    /// Stops the codec operation.
1109    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
1110    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
1111    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
1112    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
1113    /// in the CLOCK_MONOTONIC timeline.
1114    /// If the driver cannot successfully configure the codec to stop, it will close the codec
1115    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
1116    Stop { responder: CodecStopResponder },
1117    /// Start/Re-start the codec operation.
1118    /// `Start` returns when configuring the codec to start is completed. This method does not wait
1119    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
1120    /// into account), nor is any such delay reflected in the returned `start_time`.
1121    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
1122    /// in the CLOCK_MONOTONIC timeline.
1123    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
1124    /// in which case the client may obtain a new codec protocol channel and retry.
1125    Start { responder: CodecStartResponder },
1126    /// Returns whether a codec is bridgeable.
1127    ///
1128    /// # Deprecation
1129    ///
1130    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
1131    /// A driver can still be configured to operate in bridged mode or not at boot time.
1132    IsBridgeable { responder: CodecIsBridgeableResponder },
1133    /// Sets a codec's bridged mode. This method is required, but it only needs to take action if
1134    /// the codec supports bridged mode as specified by its reply to `IsBridgeable`.
1135    ///
1136    /// # Deprecation
1137    ///
1138    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
1139    /// A driver can still be configured to operate in bridged mode or not at boot time.
1140    SetBridgedMode { enable_bridged_mode: bool, control_handle: CodecControlHandle },
1141    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
1142    /// may reply with an error status and the controller may retry at a later time.
1143    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
1144    /// combinations of the parameters in DaiSupportedFormats may be supported.
1145    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
1146    /// Sets the DAI format to be used in the interface between the controller and codec.
1147    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
1148    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
1149    /// Get the plug detect state via a hanging get. The driver will reply to the first
1150    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
1151    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
1152    WatchPlugState { responder: CodecWatchPlugStateResponder },
1153}
1154
1155impl CodecRequest {
1156    #[allow(irrefutable_let_patterns)]
1157    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
1158        if let CodecRequest::GetHealthState { responder } = self {
1159            Some((responder))
1160        } else {
1161            None
1162        }
1163    }
1164
1165    #[allow(irrefutable_let_patterns)]
1166    pub fn into_signal_processing_connect(
1167        self,
1168    ) -> Option<(
1169        fidl::endpoints::ServerEnd<
1170            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1171        >,
1172        CodecControlHandle,
1173    )> {
1174        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1175            Some((protocol, control_handle))
1176        } else {
1177            None
1178        }
1179    }
1180
1181    #[allow(irrefutable_let_patterns)]
1182    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1183        if let CodecRequest::Reset { responder } = self {
1184            Some((responder))
1185        } else {
1186            None
1187        }
1188    }
1189
1190    #[allow(irrefutable_let_patterns)]
1191    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1192        if let CodecRequest::GetProperties { responder } = self {
1193            Some((responder))
1194        } else {
1195            None
1196        }
1197    }
1198
1199    #[allow(irrefutable_let_patterns)]
1200    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1201        if let CodecRequest::Stop { responder } = self {
1202            Some((responder))
1203        } else {
1204            None
1205        }
1206    }
1207
1208    #[allow(irrefutable_let_patterns)]
1209    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1210        if let CodecRequest::Start { responder } = self {
1211            Some((responder))
1212        } else {
1213            None
1214        }
1215    }
1216
1217    #[allow(irrefutable_let_patterns)]
1218    pub fn into_is_bridgeable(self) -> Option<(CodecIsBridgeableResponder)> {
1219        if let CodecRequest::IsBridgeable { responder } = self {
1220            Some((responder))
1221        } else {
1222            None
1223        }
1224    }
1225
1226    #[allow(irrefutable_let_patterns)]
1227    pub fn into_set_bridged_mode(self) -> Option<(bool, CodecControlHandle)> {
1228        if let CodecRequest::SetBridgedMode { enable_bridged_mode, control_handle } = self {
1229            Some((enable_bridged_mode, control_handle))
1230        } else {
1231            None
1232        }
1233    }
1234
1235    #[allow(irrefutable_let_patterns)]
1236    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1237        if let CodecRequest::GetDaiFormats { responder } = self {
1238            Some((responder))
1239        } else {
1240            None
1241        }
1242    }
1243
1244    #[allow(irrefutable_let_patterns)]
1245    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1246        if let CodecRequest::SetDaiFormat { format, responder } = self {
1247            Some((format, responder))
1248        } else {
1249            None
1250        }
1251    }
1252
1253    #[allow(irrefutable_let_patterns)]
1254    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1255        if let CodecRequest::WatchPlugState { responder } = self {
1256            Some((responder))
1257        } else {
1258            None
1259        }
1260    }
1261
1262    /// Name of the method defined in FIDL
1263    pub fn method_name(&self) -> &'static str {
1264        match *self {
1265            CodecRequest::GetHealthState { .. } => "get_health_state",
1266            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1267            CodecRequest::Reset { .. } => "reset",
1268            CodecRequest::GetProperties { .. } => "get_properties",
1269            CodecRequest::Stop { .. } => "stop",
1270            CodecRequest::Start { .. } => "start",
1271            CodecRequest::IsBridgeable { .. } => "is_bridgeable",
1272            CodecRequest::SetBridgedMode { .. } => "set_bridged_mode",
1273            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1274            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1275            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1276        }
1277    }
1278}
1279
1280#[derive(Debug, Clone)]
1281pub struct CodecControlHandle {
1282    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1283}
1284
1285impl fidl::endpoints::ControlHandle for CodecControlHandle {
1286    fn shutdown(&self) {
1287        self.inner.shutdown()
1288    }
1289    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1290        self.inner.shutdown_with_epitaph(status)
1291    }
1292
1293    fn is_closed(&self) -> bool {
1294        self.inner.channel().is_closed()
1295    }
1296    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1297        self.inner.channel().on_closed()
1298    }
1299
1300    #[cfg(target_os = "fuchsia")]
1301    fn signal_peer(
1302        &self,
1303        clear_mask: zx::Signals,
1304        set_mask: zx::Signals,
1305    ) -> Result<(), zx_status::Status> {
1306        use fidl::Peered;
1307        self.inner.channel().signal_peer(clear_mask, set_mask)
1308    }
1309}
1310
1311impl CodecControlHandle {}
1312
1313#[must_use = "FIDL methods require a response to be sent"]
1314#[derive(Debug)]
1315pub struct CodecGetHealthStateResponder {
1316    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1317    tx_id: u32,
1318}
1319
1320/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1321/// if the responder is dropped without sending a response, so that the client
1322/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1323impl std::ops::Drop for CodecGetHealthStateResponder {
1324    fn drop(&mut self) {
1325        self.control_handle.shutdown();
1326        // Safety: drops once, never accessed again
1327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1328    }
1329}
1330
1331impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1332    type ControlHandle = CodecControlHandle;
1333
1334    fn control_handle(&self) -> &CodecControlHandle {
1335        &self.control_handle
1336    }
1337
1338    fn drop_without_shutdown(mut self) {
1339        // Safety: drops once, never accessed again due to mem::forget
1340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1341        // Prevent Drop from running (which would shut down the channel)
1342        std::mem::forget(self);
1343    }
1344}
1345
1346impl CodecGetHealthStateResponder {
1347    /// Sends a response to the FIDL transaction.
1348    ///
1349    /// Sets the channel to shutdown if an error occurs.
1350    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1351        let _result = self.send_raw(state);
1352        if _result.is_err() {
1353            self.control_handle.shutdown();
1354        }
1355        self.drop_without_shutdown();
1356        _result
1357    }
1358
1359    /// Similar to "send" but does not shutdown the channel if an error occurs.
1360    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1361        let _result = self.send_raw(state);
1362        self.drop_without_shutdown();
1363        _result
1364    }
1365
1366    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1367        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1368            (state,),
1369            self.tx_id,
1370            0x4e146d6bca733a84,
1371            fidl::encoding::DynamicFlags::empty(),
1372        )
1373    }
1374}
1375
1376#[must_use = "FIDL methods require a response to be sent"]
1377#[derive(Debug)]
1378pub struct CodecResetResponder {
1379    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1380    tx_id: u32,
1381}
1382
1383/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1384/// if the responder is dropped without sending a response, so that the client
1385/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1386impl std::ops::Drop for CodecResetResponder {
1387    fn drop(&mut self) {
1388        self.control_handle.shutdown();
1389        // Safety: drops once, never accessed again
1390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1391    }
1392}
1393
1394impl fidl::endpoints::Responder for CodecResetResponder {
1395    type ControlHandle = CodecControlHandle;
1396
1397    fn control_handle(&self) -> &CodecControlHandle {
1398        &self.control_handle
1399    }
1400
1401    fn drop_without_shutdown(mut self) {
1402        // Safety: drops once, never accessed again due to mem::forget
1403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1404        // Prevent Drop from running (which would shut down the channel)
1405        std::mem::forget(self);
1406    }
1407}
1408
1409impl CodecResetResponder {
1410    /// Sends a response to the FIDL transaction.
1411    ///
1412    /// Sets the channel to shutdown if an error occurs.
1413    pub fn send(self) -> Result<(), fidl::Error> {
1414        let _result = self.send_raw();
1415        if _result.is_err() {
1416            self.control_handle.shutdown();
1417        }
1418        self.drop_without_shutdown();
1419        _result
1420    }
1421
1422    /// Similar to "send" but does not shutdown the channel if an error occurs.
1423    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1424        let _result = self.send_raw();
1425        self.drop_without_shutdown();
1426        _result
1427    }
1428
1429    fn send_raw(&self) -> Result<(), fidl::Error> {
1430        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1431            (),
1432            self.tx_id,
1433            0x50757ae579a7bd6b,
1434            fidl::encoding::DynamicFlags::empty(),
1435        )
1436    }
1437}
1438
1439#[must_use = "FIDL methods require a response to be sent"]
1440#[derive(Debug)]
1441pub struct CodecGetPropertiesResponder {
1442    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1443    tx_id: u32,
1444}
1445
1446/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1447/// if the responder is dropped without sending a response, so that the client
1448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1449impl std::ops::Drop for CodecGetPropertiesResponder {
1450    fn drop(&mut self) {
1451        self.control_handle.shutdown();
1452        // Safety: drops once, never accessed again
1453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1454    }
1455}
1456
1457impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1458    type ControlHandle = CodecControlHandle;
1459
1460    fn control_handle(&self) -> &CodecControlHandle {
1461        &self.control_handle
1462    }
1463
1464    fn drop_without_shutdown(mut self) {
1465        // Safety: drops once, never accessed again due to mem::forget
1466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1467        // Prevent Drop from running (which would shut down the channel)
1468        std::mem::forget(self);
1469    }
1470}
1471
1472impl CodecGetPropertiesResponder {
1473    /// Sends a response to the FIDL transaction.
1474    ///
1475    /// Sets the channel to shutdown if an error occurs.
1476    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1477        let _result = self.send_raw(properties);
1478        if _result.is_err() {
1479            self.control_handle.shutdown();
1480        }
1481        self.drop_without_shutdown();
1482        _result
1483    }
1484
1485    /// Similar to "send" but does not shutdown the channel if an error occurs.
1486    pub fn send_no_shutdown_on_err(
1487        self,
1488        mut properties: &CodecProperties,
1489    ) -> Result<(), fidl::Error> {
1490        let _result = self.send_raw(properties);
1491        self.drop_without_shutdown();
1492        _result
1493    }
1494
1495    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1496        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1497            (properties,),
1498            self.tx_id,
1499            0x7a0d138a6a1d9d90,
1500            fidl::encoding::DynamicFlags::empty(),
1501        )
1502    }
1503}
1504
1505#[must_use = "FIDL methods require a response to be sent"]
1506#[derive(Debug)]
1507pub struct CodecStopResponder {
1508    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1509    tx_id: u32,
1510}
1511
1512/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1513/// if the responder is dropped without sending a response, so that the client
1514/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1515impl std::ops::Drop for CodecStopResponder {
1516    fn drop(&mut self) {
1517        self.control_handle.shutdown();
1518        // Safety: drops once, never accessed again
1519        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1520    }
1521}
1522
1523impl fidl::endpoints::Responder for CodecStopResponder {
1524    type ControlHandle = CodecControlHandle;
1525
1526    fn control_handle(&self) -> &CodecControlHandle {
1527        &self.control_handle
1528    }
1529
1530    fn drop_without_shutdown(mut self) {
1531        // Safety: drops once, never accessed again due to mem::forget
1532        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1533        // Prevent Drop from running (which would shut down the channel)
1534        std::mem::forget(self);
1535    }
1536}
1537
1538impl CodecStopResponder {
1539    /// Sends a response to the FIDL transaction.
1540    ///
1541    /// Sets the channel to shutdown if an error occurs.
1542    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1543        let _result = self.send_raw(stop_time);
1544        if _result.is_err() {
1545            self.control_handle.shutdown();
1546        }
1547        self.drop_without_shutdown();
1548        _result
1549    }
1550
1551    /// Similar to "send" but does not shutdown the channel if an error occurs.
1552    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1553        let _result = self.send_raw(stop_time);
1554        self.drop_without_shutdown();
1555        _result
1556    }
1557
1558    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1559        self.control_handle.inner.send::<CodecStopResponse>(
1560            (stop_time,),
1561            self.tx_id,
1562            0x5c2e380df1332dbd,
1563            fidl::encoding::DynamicFlags::empty(),
1564        )
1565    }
1566}
1567
1568#[must_use = "FIDL methods require a response to be sent"]
1569#[derive(Debug)]
1570pub struct CodecStartResponder {
1571    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1572    tx_id: u32,
1573}
1574
1575/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1576/// if the responder is dropped without sending a response, so that the client
1577/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1578impl std::ops::Drop for CodecStartResponder {
1579    fn drop(&mut self) {
1580        self.control_handle.shutdown();
1581        // Safety: drops once, never accessed again
1582        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1583    }
1584}
1585
1586impl fidl::endpoints::Responder for CodecStartResponder {
1587    type ControlHandle = CodecControlHandle;
1588
1589    fn control_handle(&self) -> &CodecControlHandle {
1590        &self.control_handle
1591    }
1592
1593    fn drop_without_shutdown(mut self) {
1594        // Safety: drops once, never accessed again due to mem::forget
1595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1596        // Prevent Drop from running (which would shut down the channel)
1597        std::mem::forget(self);
1598    }
1599}
1600
1601impl CodecStartResponder {
1602    /// Sends a response to the FIDL transaction.
1603    ///
1604    /// Sets the channel to shutdown if an error occurs.
1605    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1606        let _result = self.send_raw(start_time);
1607        if _result.is_err() {
1608            self.control_handle.shutdown();
1609        }
1610        self.drop_without_shutdown();
1611        _result
1612    }
1613
1614    /// Similar to "send" but does not shutdown the channel if an error occurs.
1615    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1616        let _result = self.send_raw(start_time);
1617        self.drop_without_shutdown();
1618        _result
1619    }
1620
1621    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1622        self.control_handle.inner.send::<CodecStartResponse>(
1623            (start_time,),
1624            self.tx_id,
1625            0x329cdacb286ab00,
1626            fidl::encoding::DynamicFlags::empty(),
1627        )
1628    }
1629}
1630
1631#[must_use = "FIDL methods require a response to be sent"]
1632#[derive(Debug)]
1633pub struct CodecIsBridgeableResponder {
1634    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1635    tx_id: u32,
1636}
1637
1638/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1639/// if the responder is dropped without sending a response, so that the client
1640/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1641impl std::ops::Drop for CodecIsBridgeableResponder {
1642    fn drop(&mut self) {
1643        self.control_handle.shutdown();
1644        // Safety: drops once, never accessed again
1645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1646    }
1647}
1648
1649impl fidl::endpoints::Responder for CodecIsBridgeableResponder {
1650    type ControlHandle = CodecControlHandle;
1651
1652    fn control_handle(&self) -> &CodecControlHandle {
1653        &self.control_handle
1654    }
1655
1656    fn drop_without_shutdown(mut self) {
1657        // Safety: drops once, never accessed again due to mem::forget
1658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1659        // Prevent Drop from running (which would shut down the channel)
1660        std::mem::forget(self);
1661    }
1662}
1663
1664impl CodecIsBridgeableResponder {
1665    /// Sends a response to the FIDL transaction.
1666    ///
1667    /// Sets the channel to shutdown if an error occurs.
1668    pub fn send(self, mut supports_bridged_mode: bool) -> Result<(), fidl::Error> {
1669        let _result = self.send_raw(supports_bridged_mode);
1670        if _result.is_err() {
1671            self.control_handle.shutdown();
1672        }
1673        self.drop_without_shutdown();
1674        _result
1675    }
1676
1677    /// Similar to "send" but does not shutdown the channel if an error occurs.
1678    pub fn send_no_shutdown_on_err(
1679        self,
1680        mut supports_bridged_mode: bool,
1681    ) -> Result<(), fidl::Error> {
1682        let _result = self.send_raw(supports_bridged_mode);
1683        self.drop_without_shutdown();
1684        _result
1685    }
1686
1687    fn send_raw(&self, mut supports_bridged_mode: bool) -> Result<(), fidl::Error> {
1688        self.control_handle.inner.send::<CodecIsBridgeableResponse>(
1689            (supports_bridged_mode,),
1690            self.tx_id,
1691            0x26b0684f603f88ec,
1692            fidl::encoding::DynamicFlags::empty(),
1693        )
1694    }
1695}
1696
1697#[must_use = "FIDL methods require a response to be sent"]
1698#[derive(Debug)]
1699pub struct CodecGetDaiFormatsResponder {
1700    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1701    tx_id: u32,
1702}
1703
1704/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1705/// if the responder is dropped without sending a response, so that the client
1706/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1707impl std::ops::Drop for CodecGetDaiFormatsResponder {
1708    fn drop(&mut self) {
1709        self.control_handle.shutdown();
1710        // Safety: drops once, never accessed again
1711        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1712    }
1713}
1714
1715impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1716    type ControlHandle = CodecControlHandle;
1717
1718    fn control_handle(&self) -> &CodecControlHandle {
1719        &self.control_handle
1720    }
1721
1722    fn drop_without_shutdown(mut self) {
1723        // Safety: drops once, never accessed again due to mem::forget
1724        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1725        // Prevent Drop from running (which would shut down the channel)
1726        std::mem::forget(self);
1727    }
1728}
1729
1730impl CodecGetDaiFormatsResponder {
1731    /// Sends a response to the FIDL transaction.
1732    ///
1733    /// Sets the channel to shutdown if an error occurs.
1734    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1735        let _result = self.send_raw(result);
1736        if _result.is_err() {
1737            self.control_handle.shutdown();
1738        }
1739        self.drop_without_shutdown();
1740        _result
1741    }
1742
1743    /// Similar to "send" but does not shutdown the channel if an error occurs.
1744    pub fn send_no_shutdown_on_err(
1745        self,
1746        mut result: Result<&[DaiSupportedFormats], i32>,
1747    ) -> Result<(), fidl::Error> {
1748        let _result = self.send_raw(result);
1749        self.drop_without_shutdown();
1750        _result
1751    }
1752
1753    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1754        self.control_handle
1755            .inner
1756            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1757                result.map(|formats| (formats,)),
1758                self.tx_id,
1759                0xf8bbc46b4ba6a52,
1760                fidl::encoding::DynamicFlags::empty(),
1761            )
1762    }
1763}
1764
1765#[must_use = "FIDL methods require a response to be sent"]
1766#[derive(Debug)]
1767pub struct CodecSetDaiFormatResponder {
1768    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1769    tx_id: u32,
1770}
1771
1772/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1773/// if the responder is dropped without sending a response, so that the client
1774/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1775impl std::ops::Drop for CodecSetDaiFormatResponder {
1776    fn drop(&mut self) {
1777        self.control_handle.shutdown();
1778        // Safety: drops once, never accessed again
1779        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1780    }
1781}
1782
1783impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1784    type ControlHandle = CodecControlHandle;
1785
1786    fn control_handle(&self) -> &CodecControlHandle {
1787        &self.control_handle
1788    }
1789
1790    fn drop_without_shutdown(mut self) {
1791        // Safety: drops once, never accessed again due to mem::forget
1792        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1793        // Prevent Drop from running (which would shut down the channel)
1794        std::mem::forget(self);
1795    }
1796}
1797
1798impl CodecSetDaiFormatResponder {
1799    /// Sends a response to the FIDL transaction.
1800    ///
1801    /// Sets the channel to shutdown if an error occurs.
1802    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1803        let _result = self.send_raw(result);
1804        if _result.is_err() {
1805            self.control_handle.shutdown();
1806        }
1807        self.drop_without_shutdown();
1808        _result
1809    }
1810
1811    /// Similar to "send" but does not shutdown the channel if an error occurs.
1812    pub fn send_no_shutdown_on_err(
1813        self,
1814        mut result: Result<&CodecFormatInfo, i32>,
1815    ) -> Result<(), fidl::Error> {
1816        let _result = self.send_raw(result);
1817        self.drop_without_shutdown();
1818        _result
1819    }
1820
1821    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1822        self.control_handle
1823            .inner
1824            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1825                result.map(|state| (state,)),
1826                self.tx_id,
1827                0x2f829df9e5a7a1ea,
1828                fidl::encoding::DynamicFlags::empty(),
1829            )
1830    }
1831}
1832
1833#[must_use = "FIDL methods require a response to be sent"]
1834#[derive(Debug)]
1835pub struct CodecWatchPlugStateResponder {
1836    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1837    tx_id: u32,
1838}
1839
1840/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1841/// if the responder is dropped without sending a response, so that the client
1842/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1843impl std::ops::Drop for CodecWatchPlugStateResponder {
1844    fn drop(&mut self) {
1845        self.control_handle.shutdown();
1846        // Safety: drops once, never accessed again
1847        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1848    }
1849}
1850
1851impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1852    type ControlHandle = CodecControlHandle;
1853
1854    fn control_handle(&self) -> &CodecControlHandle {
1855        &self.control_handle
1856    }
1857
1858    fn drop_without_shutdown(mut self) {
1859        // Safety: drops once, never accessed again due to mem::forget
1860        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1861        // Prevent Drop from running (which would shut down the channel)
1862        std::mem::forget(self);
1863    }
1864}
1865
1866impl CodecWatchPlugStateResponder {
1867    /// Sends a response to the FIDL transaction.
1868    ///
1869    /// Sets the channel to shutdown if an error occurs.
1870    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1871        let _result = self.send_raw(plug_state);
1872        if _result.is_err() {
1873            self.control_handle.shutdown();
1874        }
1875        self.drop_without_shutdown();
1876        _result
1877    }
1878
1879    /// Similar to "send" but does not shutdown the channel if an error occurs.
1880    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1881        let _result = self.send_raw(plug_state);
1882        self.drop_without_shutdown();
1883        _result
1884    }
1885
1886    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1887        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1888            (plug_state,),
1889            self.tx_id,
1890            0x182b87f935ca7326,
1891            fidl::encoding::DynamicFlags::empty(),
1892        )
1893    }
1894}
1895
1896#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1897pub struct CodecConnectorMarker;
1898
1899impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1900    type Proxy = CodecConnectorProxy;
1901    type RequestStream = CodecConnectorRequestStream;
1902    #[cfg(target_os = "fuchsia")]
1903    type SynchronousProxy = CodecConnectorSynchronousProxy;
1904
1905    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1906}
1907
1908pub trait CodecConnectorProxyInterface: Send + Sync {
1909    fn r#connect(
1910        &self,
1911        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1912    ) -> Result<(), fidl::Error>;
1913}
1914#[derive(Debug)]
1915#[cfg(target_os = "fuchsia")]
1916pub struct CodecConnectorSynchronousProxy {
1917    client: fidl::client::sync::Client,
1918}
1919
1920#[cfg(target_os = "fuchsia")]
1921impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1922    type Proxy = CodecConnectorProxy;
1923    type Protocol = CodecConnectorMarker;
1924
1925    fn from_channel(inner: fidl::Channel) -> Self {
1926        Self::new(inner)
1927    }
1928
1929    fn into_channel(self) -> fidl::Channel {
1930        self.client.into_channel()
1931    }
1932
1933    fn as_channel(&self) -> &fidl::Channel {
1934        self.client.as_channel()
1935    }
1936}
1937
1938#[cfg(target_os = "fuchsia")]
1939impl CodecConnectorSynchronousProxy {
1940    pub fn new(channel: fidl::Channel) -> Self {
1941        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1942        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1943    }
1944
1945    pub fn into_channel(self) -> fidl::Channel {
1946        self.client.into_channel()
1947    }
1948
1949    /// Waits until an event arrives and returns it. It is safe for other
1950    /// threads to make concurrent requests while waiting for an event.
1951    pub fn wait_for_event(
1952        &self,
1953        deadline: zx::MonotonicInstant,
1954    ) -> Result<CodecConnectorEvent, fidl::Error> {
1955        CodecConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1956    }
1957
1958    /// Connect to a Codec protocol server.
1959    /// This indirection into the Codec protocol allows us to support independent codec client
1960    /// connections.
1961    pub fn r#connect(
1962        &self,
1963        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1964    ) -> Result<(), fidl::Error> {
1965        self.client.send::<CodecConnectorConnectRequest>(
1966            (codec_protocol,),
1967            0x1413f551544026c9,
1968            fidl::encoding::DynamicFlags::empty(),
1969        )
1970    }
1971}
1972
1973#[derive(Debug, Clone)]
1974pub struct CodecConnectorProxy {
1975    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1976}
1977
1978impl fidl::endpoints::Proxy for CodecConnectorProxy {
1979    type Protocol = CodecConnectorMarker;
1980
1981    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1982        Self::new(inner)
1983    }
1984
1985    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1986        self.client.into_channel().map_err(|client| Self { client })
1987    }
1988
1989    fn as_channel(&self) -> &::fidl::AsyncChannel {
1990        self.client.as_channel()
1991    }
1992}
1993
1994impl CodecConnectorProxy {
1995    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
1996    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1997        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1998        Self { client: fidl::client::Client::new(channel, protocol_name) }
1999    }
2000
2001    /// Get a Stream of events from the remote end of the protocol.
2002    ///
2003    /// # Panics
2004    ///
2005    /// Panics if the event stream was already taken.
2006    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
2007        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2008    }
2009
2010    /// Connect to a Codec protocol server.
2011    /// This indirection into the Codec protocol allows us to support independent codec client
2012    /// connections.
2013    pub fn r#connect(
2014        &self,
2015        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2016    ) -> Result<(), fidl::Error> {
2017        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
2018    }
2019}
2020
2021impl CodecConnectorProxyInterface for CodecConnectorProxy {
2022    fn r#connect(
2023        &self,
2024        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2025    ) -> Result<(), fidl::Error> {
2026        self.client.send::<CodecConnectorConnectRequest>(
2027            (codec_protocol,),
2028            0x1413f551544026c9,
2029            fidl::encoding::DynamicFlags::empty(),
2030        )
2031    }
2032}
2033
2034pub struct CodecConnectorEventStream {
2035    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2036}
2037
2038impl std::marker::Unpin for CodecConnectorEventStream {}
2039
2040impl futures::stream::FusedStream for CodecConnectorEventStream {
2041    fn is_terminated(&self) -> bool {
2042        self.event_receiver.is_terminated()
2043    }
2044}
2045
2046impl futures::Stream for CodecConnectorEventStream {
2047    type Item = Result<CodecConnectorEvent, fidl::Error>;
2048
2049    fn poll_next(
2050        mut self: std::pin::Pin<&mut Self>,
2051        cx: &mut std::task::Context<'_>,
2052    ) -> std::task::Poll<Option<Self::Item>> {
2053        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2054            &mut self.event_receiver,
2055            cx
2056        )?) {
2057            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
2058            None => std::task::Poll::Ready(None),
2059        }
2060    }
2061}
2062
2063#[derive(Debug)]
2064pub enum CodecConnectorEvent {}
2065
2066impl CodecConnectorEvent {
2067    /// Decodes a message buffer as a [`CodecConnectorEvent`].
2068    fn decode(
2069        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2070    ) -> Result<CodecConnectorEvent, fidl::Error> {
2071        let (bytes, _handles) = buf.split_mut();
2072        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2073        debug_assert_eq!(tx_header.tx_id, 0);
2074        match tx_header.ordinal {
2075            _ => Err(fidl::Error::UnknownOrdinal {
2076                ordinal: tx_header.ordinal,
2077                protocol_name:
2078                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2079            }),
2080        }
2081    }
2082}
2083
2084/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
2085pub struct CodecConnectorRequestStream {
2086    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2087    is_terminated: bool,
2088}
2089
2090impl std::marker::Unpin for CodecConnectorRequestStream {}
2091
2092impl futures::stream::FusedStream for CodecConnectorRequestStream {
2093    fn is_terminated(&self) -> bool {
2094        self.is_terminated
2095    }
2096}
2097
2098impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
2099    type Protocol = CodecConnectorMarker;
2100    type ControlHandle = CodecConnectorControlHandle;
2101
2102    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2103        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2104    }
2105
2106    fn control_handle(&self) -> Self::ControlHandle {
2107        CodecConnectorControlHandle { inner: self.inner.clone() }
2108    }
2109
2110    fn into_inner(
2111        self,
2112    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2113    {
2114        (self.inner, self.is_terminated)
2115    }
2116
2117    fn from_inner(
2118        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2119        is_terminated: bool,
2120    ) -> Self {
2121        Self { inner, is_terminated }
2122    }
2123}
2124
2125impl futures::Stream for CodecConnectorRequestStream {
2126    type Item = Result<CodecConnectorRequest, fidl::Error>;
2127
2128    fn poll_next(
2129        mut self: std::pin::Pin<&mut Self>,
2130        cx: &mut std::task::Context<'_>,
2131    ) -> std::task::Poll<Option<Self::Item>> {
2132        let this = &mut *self;
2133        if this.inner.check_shutdown(cx) {
2134            this.is_terminated = true;
2135            return std::task::Poll::Ready(None);
2136        }
2137        if this.is_terminated {
2138            panic!("polled CodecConnectorRequestStream after completion");
2139        }
2140        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2141            |bytes, handles| {
2142                match this.inner.channel().read_etc(cx, bytes, handles) {
2143                    std::task::Poll::Ready(Ok(())) => {}
2144                    std::task::Poll::Pending => return std::task::Poll::Pending,
2145                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2146                        this.is_terminated = true;
2147                        return std::task::Poll::Ready(None);
2148                    }
2149                    std::task::Poll::Ready(Err(e)) => {
2150                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2151                            e.into(),
2152                        ))))
2153                    }
2154                }
2155
2156                // A message has been received from the channel
2157                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2158
2159                std::task::Poll::Ready(Some(match header.ordinal {
2160                    0x1413f551544026c9 => {
2161                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2162                        let mut req = fidl::new_empty!(
2163                            CodecConnectorConnectRequest,
2164                            fidl::encoding::DefaultFuchsiaResourceDialect
2165                        );
2166                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2167                        let control_handle =
2168                            CodecConnectorControlHandle { inner: this.inner.clone() };
2169                        Ok(CodecConnectorRequest::Connect {
2170                            codec_protocol: req.codec_protocol,
2171
2172                            control_handle,
2173                        })
2174                    }
2175                    _ => Err(fidl::Error::UnknownOrdinal {
2176                        ordinal: header.ordinal,
2177                        protocol_name:
2178                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2179                    }),
2180                }))
2181            },
2182        )
2183    }
2184}
2185
2186/// For an overview of the Codec protocols see
2187/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
2188/// # Deprecation
2189///
2190/// Not supported anymore, instead use an
2191/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2192/// with one DAI and no Ring Buffer, see
2193/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2194#[derive(Debug)]
2195pub enum CodecConnectorRequest {
2196    /// Connect to a Codec protocol server.
2197    /// This indirection into the Codec protocol allows us to support independent codec client
2198    /// connections.
2199    Connect {
2200        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2201        control_handle: CodecConnectorControlHandle,
2202    },
2203}
2204
2205impl CodecConnectorRequest {
2206    #[allow(irrefutable_let_patterns)]
2207    pub fn into_connect(
2208        self,
2209    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2210        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2211            Some((codec_protocol, control_handle))
2212        } else {
2213            None
2214        }
2215    }
2216
2217    /// Name of the method defined in FIDL
2218    pub fn method_name(&self) -> &'static str {
2219        match *self {
2220            CodecConnectorRequest::Connect { .. } => "connect",
2221        }
2222    }
2223}
2224
2225#[derive(Debug, Clone)]
2226pub struct CodecConnectorControlHandle {
2227    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2228}
2229
2230impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2231    fn shutdown(&self) {
2232        self.inner.shutdown()
2233    }
2234    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2235        self.inner.shutdown_with_epitaph(status)
2236    }
2237
2238    fn is_closed(&self) -> bool {
2239        self.inner.channel().is_closed()
2240    }
2241    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2242        self.inner.channel().on_closed()
2243    }
2244
2245    #[cfg(target_os = "fuchsia")]
2246    fn signal_peer(
2247        &self,
2248        clear_mask: zx::Signals,
2249        set_mask: zx::Signals,
2250    ) -> Result<(), zx_status::Status> {
2251        use fidl::Peered;
2252        self.inner.channel().signal_peer(clear_mask, set_mask)
2253    }
2254}
2255
2256impl CodecConnectorControlHandle {}
2257
2258#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2259pub struct CompositeMarker;
2260
2261impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2262    type Proxy = CompositeProxy;
2263    type RequestStream = CompositeRequestStream;
2264    #[cfg(target_os = "fuchsia")]
2265    type SynchronousProxy = CompositeSynchronousProxy;
2266
2267    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2268}
2269pub type CompositeResetResult = Result<(), DriverError>;
2270pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, DriverError>;
2271pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2272pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2273pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2274
2275pub trait CompositeProxyInterface: Send + Sync {
2276    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2277        + Send;
2278    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2279    fn r#signal_processing_connect(
2280        &self,
2281        protocol: fidl::endpoints::ServerEnd<
2282            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2283        >,
2284    ) -> Result<(), fidl::Error>;
2285    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2286        + Send;
2287    fn r#reset(&self) -> Self::ResetResponseFut;
2288    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2289        + Send;
2290    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2291    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2292        + Send;
2293    fn r#get_ring_buffer_formats(
2294        &self,
2295        processing_element_id: u64,
2296    ) -> Self::GetRingBufferFormatsResponseFut;
2297    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2298        + Send;
2299    fn r#create_ring_buffer(
2300        &self,
2301        processing_element_id: u64,
2302        format: &Format,
2303        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2304    ) -> Self::CreateRingBufferResponseFut;
2305    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2306        + Send;
2307    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2308    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2309        + Send;
2310    fn r#set_dai_format(
2311        &self,
2312        processing_element_id: u64,
2313        format: &DaiFormat,
2314    ) -> Self::SetDaiFormatResponseFut;
2315}
2316#[derive(Debug)]
2317#[cfg(target_os = "fuchsia")]
2318pub struct CompositeSynchronousProxy {
2319    client: fidl::client::sync::Client,
2320}
2321
2322#[cfg(target_os = "fuchsia")]
2323impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2324    type Proxy = CompositeProxy;
2325    type Protocol = CompositeMarker;
2326
2327    fn from_channel(inner: fidl::Channel) -> Self {
2328        Self::new(inner)
2329    }
2330
2331    fn into_channel(self) -> fidl::Channel {
2332        self.client.into_channel()
2333    }
2334
2335    fn as_channel(&self) -> &fidl::Channel {
2336        self.client.as_channel()
2337    }
2338}
2339
2340#[cfg(target_os = "fuchsia")]
2341impl CompositeSynchronousProxy {
2342    pub fn new(channel: fidl::Channel) -> Self {
2343        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2344        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2345    }
2346
2347    pub fn into_channel(self) -> fidl::Channel {
2348        self.client.into_channel()
2349    }
2350
2351    /// Waits until an event arrives and returns it. It is safe for other
2352    /// threads to make concurrent requests while waiting for an event.
2353    pub fn wait_for_event(
2354        &self,
2355        deadline: zx::MonotonicInstant,
2356    ) -> Result<CompositeEvent, fidl::Error> {
2357        CompositeEvent::decode(self.client.wait_for_event(deadline)?)
2358    }
2359
2360    /// Retrieves top level health state.
2361    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2362    pub fn r#get_health_state(
2363        &self,
2364        ___deadline: zx::MonotonicInstant,
2365    ) -> Result<HealthState, fidl::Error> {
2366        let _response =
2367            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
2368                (),
2369                0x4e146d6bca733a84,
2370                fidl::encoding::DynamicFlags::empty(),
2371                ___deadline,
2372            )?;
2373        Ok(_response.state)
2374    }
2375
2376    /// Connect to a `SignalProcessing` protocol.
2377    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2378    /// the maximum number of connections have already been created, for instance one, then the
2379    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2380    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2381    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2382    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2383    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2384    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2385    /// is intended to be composed, and hence the more verbose name allows differentiation and
2386    /// improved clarity.
2387    pub fn r#signal_processing_connect(
2388        &self,
2389        mut protocol: fidl::endpoints::ServerEnd<
2390            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2391        >,
2392    ) -> Result<(), fidl::Error> {
2393        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2394            (protocol,),
2395            0xa81907ce6066295,
2396            fidl::encoding::DynamicFlags::empty(),
2397        )
2398    }
2399
2400    /// Resets the hardware including all DAI interconnects and signal processing.
2401    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2402    ///
2403    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2404    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2405    /// any processing elements, and reconstruct any ring buffers.
2406    ///
2407    /// If the driver can't successfully reset the hardware, it will return an error and then close
2408    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2409    pub fn r#reset(
2410        &self,
2411        ___deadline: zx::MonotonicInstant,
2412    ) -> Result<CompositeResetResult, fidl::Error> {
2413        let _response = self.client.send_query::<
2414            fidl::encoding::EmptyPayload,
2415            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2416        >(
2417            (),
2418            0xac355fb98341996,
2419            fidl::encoding::DynamicFlags::empty(),
2420            ___deadline,
2421        )?;
2422        Ok(_response.map(|x| x))
2423    }
2424
2425    /// Retrieves top level static properties.
2426    pub fn r#get_properties(
2427        &self,
2428        ___deadline: zx::MonotonicInstant,
2429    ) -> Result<CompositeProperties, fidl::Error> {
2430        let _response = self
2431            .client
2432            .send_query::<fidl::encoding::EmptyPayload, CompositeGetPropertiesResponse>(
2433                (),
2434                0x31846fa0a459942b,
2435                fidl::encoding::DynamicFlags::empty(),
2436                ___deadline,
2437            )?;
2438        Ok(_response.properties)
2439    }
2440
2441    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2442    /// in the topology supported by this driver as returned by `GetElements` from
2443    /// fuchsia.hardware.audio.signalprocessing.
2444    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2445    /// client may retry at a later time.
2446    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2447    /// by `GetElements`.
2448    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2449    /// `RING_BUFFER`.
2450    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2451    /// the parameters in `SupportedFormats` may be supported.
2452    pub fn r#get_ring_buffer_formats(
2453        &self,
2454        mut processing_element_id: u64,
2455        ___deadline: zx::MonotonicInstant,
2456    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2457        let _response = self.client.send_query::<
2458            CompositeGetRingBufferFormatsRequest,
2459            fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2460        >(
2461            (processing_element_id,),
2462            0x1d89b701b6816ac4,
2463            fidl::encoding::DynamicFlags::empty(),
2464            ___deadline,
2465        )?;
2466        Ok(_response.map(|x| x.ring_buffer_formats))
2467    }
2468
2469    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2470    /// processing element specified by `processing_element_id`. The format is based on information
2471    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2472    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2473    /// audio buffer provided by the driver.
2474    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2475    /// by `GetElements`.
2476    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2477    /// `RING_BUFFER`.
2478    pub fn r#create_ring_buffer(
2479        &self,
2480        mut processing_element_id: u64,
2481        mut format: &Format,
2482        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2483        ___deadline: zx::MonotonicInstant,
2484    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2485        let _response = self.client.send_query::<
2486            CompositeCreateRingBufferRequest,
2487            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2488        >(
2489            (processing_element_id, format, ring_buffer,),
2490            0x28c5685f85262033,
2491            fidl::encoding::DynamicFlags::empty(),
2492            ___deadline,
2493        )?;
2494        Ok(_response.map(|x| x))
2495    }
2496
2497    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2498    /// in the topology supported by this driver as returned by `GetElements` from
2499    /// fuchsia.hardware.audio.signalprocessing.
2500    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2501    /// may retry at a later time.
2502    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2503    /// by `GetElements`.
2504    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2505    /// `DAI_INTERCONNECT`.
2506    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2507    /// the parameters in SupportedFormats may be supported.
2508    pub fn r#get_dai_formats(
2509        &self,
2510        mut processing_element_id: u64,
2511        ___deadline: zx::MonotonicInstant,
2512    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2513        let _response = self.client.send_query::<
2514            CompositeGetDaiFormatsRequest,
2515            fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2516        >(
2517            (processing_element_id,),
2518            0x3cbeaed59c8f69b,
2519            fidl::encoding::DynamicFlags::empty(),
2520            ___deadline,
2521        )?;
2522        Ok(_response.map(|x| x.dai_formats))
2523    }
2524
2525    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2526    /// processing element specified by `processing_element_id`. The format is based on information
2527    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2528    /// requirement.
2529    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2530    /// by `GetElements`.
2531    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2532    /// `DAI_INTERCONNECT`.
2533    pub fn r#set_dai_format(
2534        &self,
2535        mut processing_element_id: u64,
2536        mut format: &DaiFormat,
2537        ___deadline: zx::MonotonicInstant,
2538    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2539        let _response = self.client.send_query::<
2540            CompositeSetDaiFormatRequest,
2541            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2542        >(
2543            (processing_element_id, format,),
2544            0x155acf5cc0dc8a84,
2545            fidl::encoding::DynamicFlags::empty(),
2546            ___deadline,
2547        )?;
2548        Ok(_response.map(|x| x))
2549    }
2550}
2551
2552#[derive(Debug, Clone)]
2553pub struct CompositeProxy {
2554    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2555}
2556
2557impl fidl::endpoints::Proxy for CompositeProxy {
2558    type Protocol = CompositeMarker;
2559
2560    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2561        Self::new(inner)
2562    }
2563
2564    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2565        self.client.into_channel().map_err(|client| Self { client })
2566    }
2567
2568    fn as_channel(&self) -> &::fidl::AsyncChannel {
2569        self.client.as_channel()
2570    }
2571}
2572
2573impl CompositeProxy {
2574    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2575    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2576        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2577        Self { client: fidl::client::Client::new(channel, protocol_name) }
2578    }
2579
2580    /// Get a Stream of events from the remote end of the protocol.
2581    ///
2582    /// # Panics
2583    ///
2584    /// Panics if the event stream was already taken.
2585    pub fn take_event_stream(&self) -> CompositeEventStream {
2586        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2587    }
2588
2589    /// Retrieves top level health state.
2590    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2591    pub fn r#get_health_state(
2592        &self,
2593    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2594    {
2595        CompositeProxyInterface::r#get_health_state(self)
2596    }
2597
2598    /// Connect to a `SignalProcessing` protocol.
2599    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2600    /// the maximum number of connections have already been created, for instance one, then the
2601    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2602    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2603    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2604    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2605    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2606    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2607    /// is intended to be composed, and hence the more verbose name allows differentiation and
2608    /// improved clarity.
2609    pub fn r#signal_processing_connect(
2610        &self,
2611        mut protocol: fidl::endpoints::ServerEnd<
2612            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2613        >,
2614    ) -> Result<(), fidl::Error> {
2615        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2616    }
2617
2618    /// Resets the hardware including all DAI interconnects and signal processing.
2619    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2620    ///
2621    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2622    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2623    /// any processing elements, and reconstruct any ring buffers.
2624    ///
2625    /// If the driver can't successfully reset the hardware, it will return an error and then close
2626    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2627    pub fn r#reset(
2628        &self,
2629    ) -> fidl::client::QueryResponseFut<
2630        CompositeResetResult,
2631        fidl::encoding::DefaultFuchsiaResourceDialect,
2632    > {
2633        CompositeProxyInterface::r#reset(self)
2634    }
2635
2636    /// Retrieves top level static properties.
2637    pub fn r#get_properties(
2638        &self,
2639    ) -> fidl::client::QueryResponseFut<
2640        CompositeProperties,
2641        fidl::encoding::DefaultFuchsiaResourceDialect,
2642    > {
2643        CompositeProxyInterface::r#get_properties(self)
2644    }
2645
2646    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2647    /// in the topology supported by this driver as returned by `GetElements` from
2648    /// fuchsia.hardware.audio.signalprocessing.
2649    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2650    /// client may retry at a later time.
2651    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2652    /// by `GetElements`.
2653    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2654    /// `RING_BUFFER`.
2655    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2656    /// the parameters in `SupportedFormats` may be supported.
2657    pub fn r#get_ring_buffer_formats(
2658        &self,
2659        mut processing_element_id: u64,
2660    ) -> fidl::client::QueryResponseFut<
2661        CompositeGetRingBufferFormatsResult,
2662        fidl::encoding::DefaultFuchsiaResourceDialect,
2663    > {
2664        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2665    }
2666
2667    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2668    /// processing element specified by `processing_element_id`. The format is based on information
2669    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2670    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2671    /// audio buffer provided by the driver.
2672    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2673    /// by `GetElements`.
2674    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2675    /// `RING_BUFFER`.
2676    pub fn r#create_ring_buffer(
2677        &self,
2678        mut processing_element_id: u64,
2679        mut format: &Format,
2680        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2681    ) -> fidl::client::QueryResponseFut<
2682        CompositeCreateRingBufferResult,
2683        fidl::encoding::DefaultFuchsiaResourceDialect,
2684    > {
2685        CompositeProxyInterface::r#create_ring_buffer(
2686            self,
2687            processing_element_id,
2688            format,
2689            ring_buffer,
2690        )
2691    }
2692
2693    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2694    /// in the topology supported by this driver as returned by `GetElements` from
2695    /// fuchsia.hardware.audio.signalprocessing.
2696    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2697    /// may retry at a later time.
2698    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2699    /// by `GetElements`.
2700    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2701    /// `DAI_INTERCONNECT`.
2702    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2703    /// the parameters in SupportedFormats may be supported.
2704    pub fn r#get_dai_formats(
2705        &self,
2706        mut processing_element_id: u64,
2707    ) -> fidl::client::QueryResponseFut<
2708        CompositeGetDaiFormatsResult,
2709        fidl::encoding::DefaultFuchsiaResourceDialect,
2710    > {
2711        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2712    }
2713
2714    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2715    /// processing element specified by `processing_element_id`. The format is based on information
2716    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2717    /// requirement.
2718    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2719    /// by `GetElements`.
2720    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2721    /// `DAI_INTERCONNECT`.
2722    pub fn r#set_dai_format(
2723        &self,
2724        mut processing_element_id: u64,
2725        mut format: &DaiFormat,
2726    ) -> fidl::client::QueryResponseFut<
2727        CompositeSetDaiFormatResult,
2728        fidl::encoding::DefaultFuchsiaResourceDialect,
2729    > {
2730        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2731    }
2732}
2733
2734impl CompositeProxyInterface for CompositeProxy {
2735    type GetHealthStateResponseFut =
2736        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2737    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2738        fn _decode(
2739            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2740        ) -> Result<HealthState, fidl::Error> {
2741            let _response = fidl::client::decode_transaction_body::<
2742                HealthGetHealthStateResponse,
2743                fidl::encoding::DefaultFuchsiaResourceDialect,
2744                0x4e146d6bca733a84,
2745            >(_buf?)?;
2746            Ok(_response.state)
2747        }
2748        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2749            (),
2750            0x4e146d6bca733a84,
2751            fidl::encoding::DynamicFlags::empty(),
2752            _decode,
2753        )
2754    }
2755
2756    fn r#signal_processing_connect(
2757        &self,
2758        mut protocol: fidl::endpoints::ServerEnd<
2759            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2760        >,
2761    ) -> Result<(), fidl::Error> {
2762        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2763            (protocol,),
2764            0xa81907ce6066295,
2765            fidl::encoding::DynamicFlags::empty(),
2766        )
2767    }
2768
2769    type ResetResponseFut = fidl::client::QueryResponseFut<
2770        CompositeResetResult,
2771        fidl::encoding::DefaultFuchsiaResourceDialect,
2772    >;
2773    fn r#reset(&self) -> Self::ResetResponseFut {
2774        fn _decode(
2775            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2776        ) -> Result<CompositeResetResult, fidl::Error> {
2777            let _response = fidl::client::decode_transaction_body::<
2778                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2779                fidl::encoding::DefaultFuchsiaResourceDialect,
2780                0xac355fb98341996,
2781            >(_buf?)?;
2782            Ok(_response.map(|x| x))
2783        }
2784        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2785            (),
2786            0xac355fb98341996,
2787            fidl::encoding::DynamicFlags::empty(),
2788            _decode,
2789        )
2790    }
2791
2792    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2793        CompositeProperties,
2794        fidl::encoding::DefaultFuchsiaResourceDialect,
2795    >;
2796    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2797        fn _decode(
2798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2799        ) -> Result<CompositeProperties, fidl::Error> {
2800            let _response = fidl::client::decode_transaction_body::<
2801                CompositeGetPropertiesResponse,
2802                fidl::encoding::DefaultFuchsiaResourceDialect,
2803                0x31846fa0a459942b,
2804            >(_buf?)?;
2805            Ok(_response.properties)
2806        }
2807        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2808            (),
2809            0x31846fa0a459942b,
2810            fidl::encoding::DynamicFlags::empty(),
2811            _decode,
2812        )
2813    }
2814
2815    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2816        CompositeGetRingBufferFormatsResult,
2817        fidl::encoding::DefaultFuchsiaResourceDialect,
2818    >;
2819    fn r#get_ring_buffer_formats(
2820        &self,
2821        mut processing_element_id: u64,
2822    ) -> Self::GetRingBufferFormatsResponseFut {
2823        fn _decode(
2824            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2825        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2826            let _response = fidl::client::decode_transaction_body::<
2827                fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2828                fidl::encoding::DefaultFuchsiaResourceDialect,
2829                0x1d89b701b6816ac4,
2830            >(_buf?)?;
2831            Ok(_response.map(|x| x.ring_buffer_formats))
2832        }
2833        self.client.send_query_and_decode::<
2834            CompositeGetRingBufferFormatsRequest,
2835            CompositeGetRingBufferFormatsResult,
2836        >(
2837            (processing_element_id,),
2838            0x1d89b701b6816ac4,
2839            fidl::encoding::DynamicFlags::empty(),
2840            _decode,
2841        )
2842    }
2843
2844    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2845        CompositeCreateRingBufferResult,
2846        fidl::encoding::DefaultFuchsiaResourceDialect,
2847    >;
2848    fn r#create_ring_buffer(
2849        &self,
2850        mut processing_element_id: u64,
2851        mut format: &Format,
2852        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2853    ) -> Self::CreateRingBufferResponseFut {
2854        fn _decode(
2855            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2856        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2857            let _response = fidl::client::decode_transaction_body::<
2858                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2859                fidl::encoding::DefaultFuchsiaResourceDialect,
2860                0x28c5685f85262033,
2861            >(_buf?)?;
2862            Ok(_response.map(|x| x))
2863        }
2864        self.client.send_query_and_decode::<
2865            CompositeCreateRingBufferRequest,
2866            CompositeCreateRingBufferResult,
2867        >(
2868            (processing_element_id, format, ring_buffer,),
2869            0x28c5685f85262033,
2870            fidl::encoding::DynamicFlags::empty(),
2871            _decode,
2872        )
2873    }
2874
2875    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2876        CompositeGetDaiFormatsResult,
2877        fidl::encoding::DefaultFuchsiaResourceDialect,
2878    >;
2879    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2880        fn _decode(
2881            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2882        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2883            let _response = fidl::client::decode_transaction_body::<
2884                fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2885                fidl::encoding::DefaultFuchsiaResourceDialect,
2886                0x3cbeaed59c8f69b,
2887            >(_buf?)?;
2888            Ok(_response.map(|x| x.dai_formats))
2889        }
2890        self.client
2891            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2892                (processing_element_id,),
2893                0x3cbeaed59c8f69b,
2894                fidl::encoding::DynamicFlags::empty(),
2895                _decode,
2896            )
2897    }
2898
2899    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2900        CompositeSetDaiFormatResult,
2901        fidl::encoding::DefaultFuchsiaResourceDialect,
2902    >;
2903    fn r#set_dai_format(
2904        &self,
2905        mut processing_element_id: u64,
2906        mut format: &DaiFormat,
2907    ) -> Self::SetDaiFormatResponseFut {
2908        fn _decode(
2909            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2910        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2911            let _response = fidl::client::decode_transaction_body::<
2912                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2913                fidl::encoding::DefaultFuchsiaResourceDialect,
2914                0x155acf5cc0dc8a84,
2915            >(_buf?)?;
2916            Ok(_response.map(|x| x))
2917        }
2918        self.client
2919            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2920                (processing_element_id, format),
2921                0x155acf5cc0dc8a84,
2922                fidl::encoding::DynamicFlags::empty(),
2923                _decode,
2924            )
2925    }
2926}
2927
2928pub struct CompositeEventStream {
2929    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2930}
2931
2932impl std::marker::Unpin for CompositeEventStream {}
2933
2934impl futures::stream::FusedStream for CompositeEventStream {
2935    fn is_terminated(&self) -> bool {
2936        self.event_receiver.is_terminated()
2937    }
2938}
2939
2940impl futures::Stream for CompositeEventStream {
2941    type Item = Result<CompositeEvent, fidl::Error>;
2942
2943    fn poll_next(
2944        mut self: std::pin::Pin<&mut Self>,
2945        cx: &mut std::task::Context<'_>,
2946    ) -> std::task::Poll<Option<Self::Item>> {
2947        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2948            &mut self.event_receiver,
2949            cx
2950        )?) {
2951            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
2952            None => std::task::Poll::Ready(None),
2953        }
2954    }
2955}
2956
2957#[derive(Debug)]
2958pub enum CompositeEvent {}
2959
2960impl CompositeEvent {
2961    /// Decodes a message buffer as a [`CompositeEvent`].
2962    fn decode(
2963        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2964    ) -> Result<CompositeEvent, fidl::Error> {
2965        let (bytes, _handles) = buf.split_mut();
2966        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2967        debug_assert_eq!(tx_header.tx_id, 0);
2968        match tx_header.ordinal {
2969            _ => Err(fidl::Error::UnknownOrdinal {
2970                ordinal: tx_header.ordinal,
2971                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2972            }),
2973        }
2974    }
2975}
2976
2977/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
2978pub struct CompositeRequestStream {
2979    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2980    is_terminated: bool,
2981}
2982
2983impl std::marker::Unpin for CompositeRequestStream {}
2984
2985impl futures::stream::FusedStream for CompositeRequestStream {
2986    fn is_terminated(&self) -> bool {
2987        self.is_terminated
2988    }
2989}
2990
2991impl fidl::endpoints::RequestStream for CompositeRequestStream {
2992    type Protocol = CompositeMarker;
2993    type ControlHandle = CompositeControlHandle;
2994
2995    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2996        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2997    }
2998
2999    fn control_handle(&self) -> Self::ControlHandle {
3000        CompositeControlHandle { inner: self.inner.clone() }
3001    }
3002
3003    fn into_inner(
3004        self,
3005    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3006    {
3007        (self.inner, self.is_terminated)
3008    }
3009
3010    fn from_inner(
3011        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3012        is_terminated: bool,
3013    ) -> Self {
3014        Self { inner, is_terminated }
3015    }
3016}
3017
3018impl futures::Stream for CompositeRequestStream {
3019    type Item = Result<CompositeRequest, fidl::Error>;
3020
3021    fn poll_next(
3022        mut self: std::pin::Pin<&mut Self>,
3023        cx: &mut std::task::Context<'_>,
3024    ) -> std::task::Poll<Option<Self::Item>> {
3025        let this = &mut *self;
3026        if this.inner.check_shutdown(cx) {
3027            this.is_terminated = true;
3028            return std::task::Poll::Ready(None);
3029        }
3030        if this.is_terminated {
3031            panic!("polled CompositeRequestStream after completion");
3032        }
3033        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3034            |bytes, handles| {
3035                match this.inner.channel().read_etc(cx, bytes, handles) {
3036                    std::task::Poll::Ready(Ok(())) => {}
3037                    std::task::Poll::Pending => return std::task::Poll::Pending,
3038                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3039                        this.is_terminated = true;
3040                        return std::task::Poll::Ready(None);
3041                    }
3042                    std::task::Poll::Ready(Err(e)) => {
3043                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3044                            e.into(),
3045                        ))))
3046                    }
3047                }
3048
3049                // A message has been received from the channel
3050                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3051
3052                std::task::Poll::Ready(Some(match header.ordinal {
3053                    0x4e146d6bca733a84 => {
3054                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3055                        let mut req = fidl::new_empty!(
3056                            fidl::encoding::EmptyPayload,
3057                            fidl::encoding::DefaultFuchsiaResourceDialect
3058                        );
3059                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3060                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3061                        Ok(CompositeRequest::GetHealthState {
3062                            responder: CompositeGetHealthStateResponder {
3063                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3064                                tx_id: header.tx_id,
3065                            },
3066                        })
3067                    }
3068                    0xa81907ce6066295 => {
3069                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3070                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3071                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3072                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3073                        Ok(CompositeRequest::SignalProcessingConnect {
3074                            protocol: req.protocol,
3075
3076                            control_handle,
3077                        })
3078                    }
3079                    0xac355fb98341996 => {
3080                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3081                        let mut req = fidl::new_empty!(
3082                            fidl::encoding::EmptyPayload,
3083                            fidl::encoding::DefaultFuchsiaResourceDialect
3084                        );
3085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3086                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3087                        Ok(CompositeRequest::Reset {
3088                            responder: CompositeResetResponder {
3089                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3090                                tx_id: header.tx_id,
3091                            },
3092                        })
3093                    }
3094                    0x31846fa0a459942b => {
3095                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3096                        let mut req = fidl::new_empty!(
3097                            fidl::encoding::EmptyPayload,
3098                            fidl::encoding::DefaultFuchsiaResourceDialect
3099                        );
3100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3101                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3102                        Ok(CompositeRequest::GetProperties {
3103                            responder: CompositeGetPropertiesResponder {
3104                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3105                                tx_id: header.tx_id,
3106                            },
3107                        })
3108                    }
3109                    0x1d89b701b6816ac4 => {
3110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3111                        let mut req = fidl::new_empty!(
3112                            CompositeGetRingBufferFormatsRequest,
3113                            fidl::encoding::DefaultFuchsiaResourceDialect
3114                        );
3115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3116                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3117                        Ok(CompositeRequest::GetRingBufferFormats {
3118                            processing_element_id: req.processing_element_id,
3119
3120                            responder: CompositeGetRingBufferFormatsResponder {
3121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3122                                tx_id: header.tx_id,
3123                            },
3124                        })
3125                    }
3126                    0x28c5685f85262033 => {
3127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3128                        let mut req = fidl::new_empty!(
3129                            CompositeCreateRingBufferRequest,
3130                            fidl::encoding::DefaultFuchsiaResourceDialect
3131                        );
3132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3133                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3134                        Ok(CompositeRequest::CreateRingBuffer {
3135                            processing_element_id: req.processing_element_id,
3136                            format: req.format,
3137                            ring_buffer: req.ring_buffer,
3138
3139                            responder: CompositeCreateRingBufferResponder {
3140                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3141                                tx_id: header.tx_id,
3142                            },
3143                        })
3144                    }
3145                    0x3cbeaed59c8f69b => {
3146                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3147                        let mut req = fidl::new_empty!(
3148                            CompositeGetDaiFormatsRequest,
3149                            fidl::encoding::DefaultFuchsiaResourceDialect
3150                        );
3151                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3152                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3153                        Ok(CompositeRequest::GetDaiFormats {
3154                            processing_element_id: req.processing_element_id,
3155
3156                            responder: CompositeGetDaiFormatsResponder {
3157                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3158                                tx_id: header.tx_id,
3159                            },
3160                        })
3161                    }
3162                    0x155acf5cc0dc8a84 => {
3163                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3164                        let mut req = fidl::new_empty!(
3165                            CompositeSetDaiFormatRequest,
3166                            fidl::encoding::DefaultFuchsiaResourceDialect
3167                        );
3168                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3169                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3170                        Ok(CompositeRequest::SetDaiFormat {
3171                            processing_element_id: req.processing_element_id,
3172                            format: req.format,
3173
3174                            responder: CompositeSetDaiFormatResponder {
3175                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3176                                tx_id: header.tx_id,
3177                            },
3178                        })
3179                    }
3180                    _ => Err(fidl::Error::UnknownOrdinal {
3181                        ordinal: header.ordinal,
3182                        protocol_name:
3183                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3184                    }),
3185                }))
3186            },
3187        )
3188    }
3189}
3190
3191/// The `Composite` interface is a FIDL protocol exposed by audio drivers. The `Composite` interface
3192/// is generic and allows the configuration of various audio hardware types including those supported
3193/// by the `StreamConfig`, `Dai` and `Codec` FIDL interfaces. The `Composite` interface is more
3194/// generic and provides more flexible routing within audio subsystems. Also see
3195/// [Audio Driver Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md)
3196/// The hardware abstracted by the Composite protocol will be turned off (placed in its lowest
3197/// supported power state) until a call to any APIs that requires the hardware to be turned on
3198/// (placed in a higher power state).
3199#[derive(Debug)]
3200pub enum CompositeRequest {
3201    /// Retrieves top level health state.
3202    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3203    GetHealthState { responder: CompositeGetHealthStateResponder },
3204    /// Connect to a `SignalProcessing` protocol.
3205    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3206    /// the maximum number of connections have already been created, for instance one, then the
3207    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3208    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3209    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3210    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3211    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3212    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3213    /// is intended to be composed, and hence the more verbose name allows differentiation and
3214    /// improved clarity.
3215    SignalProcessingConnect {
3216        protocol: fidl::endpoints::ServerEnd<
3217            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3218        >,
3219        control_handle: CompositeControlHandle,
3220    },
3221    /// Resets the hardware including all DAI interconnects and signal processing.
3222    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3223    ///
3224    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3225    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3226    /// any processing elements, and reconstruct any ring buffers.
3227    ///
3228    /// If the driver can't successfully reset the hardware, it will return an error and then close
3229    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3230    Reset { responder: CompositeResetResponder },
3231    /// Retrieves top level static properties.
3232    GetProperties { responder: CompositeGetPropertiesResponder },
3233    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3234    /// in the topology supported by this driver as returned by `GetElements` from
3235    /// fuchsia.hardware.audio.signalprocessing.
3236    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3237    /// client may retry at a later time.
3238    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3239    /// by `GetElements`.
3240    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3241    /// `RING_BUFFER`.
3242    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
3243    /// the parameters in `SupportedFormats` may be supported.
3244    GetRingBufferFormats {
3245        processing_element_id: u64,
3246        responder: CompositeGetRingBufferFormatsResponder,
3247    },
3248    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3249    /// processing element specified by `processing_element_id`. The format is based on information
3250    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3251    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3252    /// audio buffer provided by the driver.
3253    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3254    /// by `GetElements`.
3255    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3256    /// `RING_BUFFER`.
3257    CreateRingBuffer {
3258        processing_element_id: u64,
3259        format: Format,
3260        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3261        responder: CompositeCreateRingBufferResponder,
3262    },
3263    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3264    /// in the topology supported by this driver as returned by `GetElements` from
3265    /// fuchsia.hardware.audio.signalprocessing.
3266    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3267    /// may retry at a later time.
3268    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3269    /// by `GetElements`.
3270    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3271    /// `DAI_INTERCONNECT`.
3272    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3273    /// the parameters in SupportedFormats may be supported.
3274    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3275    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3276    /// processing element specified by `processing_element_id`. The format is based on information
3277    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3278    /// requirement.
3279    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3280    /// by `GetElements`.
3281    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3282    /// `DAI_INTERCONNECT`.
3283    SetDaiFormat {
3284        processing_element_id: u64,
3285        format: DaiFormat,
3286        responder: CompositeSetDaiFormatResponder,
3287    },
3288}
3289
3290impl CompositeRequest {
3291    #[allow(irrefutable_let_patterns)]
3292    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3293        if let CompositeRequest::GetHealthState { responder } = self {
3294            Some((responder))
3295        } else {
3296            None
3297        }
3298    }
3299
3300    #[allow(irrefutable_let_patterns)]
3301    pub fn into_signal_processing_connect(
3302        self,
3303    ) -> Option<(
3304        fidl::endpoints::ServerEnd<
3305            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3306        >,
3307        CompositeControlHandle,
3308    )> {
3309        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3310            Some((protocol, control_handle))
3311        } else {
3312            None
3313        }
3314    }
3315
3316    #[allow(irrefutable_let_patterns)]
3317    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3318        if let CompositeRequest::Reset { responder } = self {
3319            Some((responder))
3320        } else {
3321            None
3322        }
3323    }
3324
3325    #[allow(irrefutable_let_patterns)]
3326    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3327        if let CompositeRequest::GetProperties { responder } = self {
3328            Some((responder))
3329        } else {
3330            None
3331        }
3332    }
3333
3334    #[allow(irrefutable_let_patterns)]
3335    pub fn into_get_ring_buffer_formats(
3336        self,
3337    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3338        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3339            Some((processing_element_id, responder))
3340        } else {
3341            None
3342        }
3343    }
3344
3345    #[allow(irrefutable_let_patterns)]
3346    pub fn into_create_ring_buffer(
3347        self,
3348    ) -> Option<(
3349        u64,
3350        Format,
3351        fidl::endpoints::ServerEnd<RingBufferMarker>,
3352        CompositeCreateRingBufferResponder,
3353    )> {
3354        if let CompositeRequest::CreateRingBuffer {
3355            processing_element_id,
3356            format,
3357            ring_buffer,
3358            responder,
3359        } = self
3360        {
3361            Some((processing_element_id, format, ring_buffer, responder))
3362        } else {
3363            None
3364        }
3365    }
3366
3367    #[allow(irrefutable_let_patterns)]
3368    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3369        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3370            Some((processing_element_id, responder))
3371        } else {
3372            None
3373        }
3374    }
3375
3376    #[allow(irrefutable_let_patterns)]
3377    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3378        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3379            Some((processing_element_id, format, responder))
3380        } else {
3381            None
3382        }
3383    }
3384
3385    /// Name of the method defined in FIDL
3386    pub fn method_name(&self) -> &'static str {
3387        match *self {
3388            CompositeRequest::GetHealthState { .. } => "get_health_state",
3389            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3390            CompositeRequest::Reset { .. } => "reset",
3391            CompositeRequest::GetProperties { .. } => "get_properties",
3392            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3393            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3394            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3395            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3396        }
3397    }
3398}
3399
3400#[derive(Debug, Clone)]
3401pub struct CompositeControlHandle {
3402    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3403}
3404
3405impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3406    fn shutdown(&self) {
3407        self.inner.shutdown()
3408    }
3409    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3410        self.inner.shutdown_with_epitaph(status)
3411    }
3412
3413    fn is_closed(&self) -> bool {
3414        self.inner.channel().is_closed()
3415    }
3416    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3417        self.inner.channel().on_closed()
3418    }
3419
3420    #[cfg(target_os = "fuchsia")]
3421    fn signal_peer(
3422        &self,
3423        clear_mask: zx::Signals,
3424        set_mask: zx::Signals,
3425    ) -> Result<(), zx_status::Status> {
3426        use fidl::Peered;
3427        self.inner.channel().signal_peer(clear_mask, set_mask)
3428    }
3429}
3430
3431impl CompositeControlHandle {}
3432
3433#[must_use = "FIDL methods require a response to be sent"]
3434#[derive(Debug)]
3435pub struct CompositeGetHealthStateResponder {
3436    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3437    tx_id: u32,
3438}
3439
3440/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3441/// if the responder is dropped without sending a response, so that the client
3442/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3443impl std::ops::Drop for CompositeGetHealthStateResponder {
3444    fn drop(&mut self) {
3445        self.control_handle.shutdown();
3446        // Safety: drops once, never accessed again
3447        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3448    }
3449}
3450
3451impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3452    type ControlHandle = CompositeControlHandle;
3453
3454    fn control_handle(&self) -> &CompositeControlHandle {
3455        &self.control_handle
3456    }
3457
3458    fn drop_without_shutdown(mut self) {
3459        // Safety: drops once, never accessed again due to mem::forget
3460        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3461        // Prevent Drop from running (which would shut down the channel)
3462        std::mem::forget(self);
3463    }
3464}
3465
3466impl CompositeGetHealthStateResponder {
3467    /// Sends a response to the FIDL transaction.
3468    ///
3469    /// Sets the channel to shutdown if an error occurs.
3470    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3471        let _result = self.send_raw(state);
3472        if _result.is_err() {
3473            self.control_handle.shutdown();
3474        }
3475        self.drop_without_shutdown();
3476        _result
3477    }
3478
3479    /// Similar to "send" but does not shutdown the channel if an error occurs.
3480    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3481        let _result = self.send_raw(state);
3482        self.drop_without_shutdown();
3483        _result
3484    }
3485
3486    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3487        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3488            (state,),
3489            self.tx_id,
3490            0x4e146d6bca733a84,
3491            fidl::encoding::DynamicFlags::empty(),
3492        )
3493    }
3494}
3495
3496#[must_use = "FIDL methods require a response to be sent"]
3497#[derive(Debug)]
3498pub struct CompositeResetResponder {
3499    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3500    tx_id: u32,
3501}
3502
3503/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3504/// if the responder is dropped without sending a response, so that the client
3505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3506impl std::ops::Drop for CompositeResetResponder {
3507    fn drop(&mut self) {
3508        self.control_handle.shutdown();
3509        // Safety: drops once, never accessed again
3510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3511    }
3512}
3513
3514impl fidl::endpoints::Responder for CompositeResetResponder {
3515    type ControlHandle = CompositeControlHandle;
3516
3517    fn control_handle(&self) -> &CompositeControlHandle {
3518        &self.control_handle
3519    }
3520
3521    fn drop_without_shutdown(mut self) {
3522        // Safety: drops once, never accessed again due to mem::forget
3523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3524        // Prevent Drop from running (which would shut down the channel)
3525        std::mem::forget(self);
3526    }
3527}
3528
3529impl CompositeResetResponder {
3530    /// Sends a response to the FIDL transaction.
3531    ///
3532    /// Sets the channel to shutdown if an error occurs.
3533    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3534        let _result = self.send_raw(result);
3535        if _result.is_err() {
3536            self.control_handle.shutdown();
3537        }
3538        self.drop_without_shutdown();
3539        _result
3540    }
3541
3542    /// Similar to "send" but does not shutdown the channel if an error occurs.
3543    pub fn send_no_shutdown_on_err(
3544        self,
3545        mut result: Result<(), DriverError>,
3546    ) -> Result<(), fidl::Error> {
3547        let _result = self.send_raw(result);
3548        self.drop_without_shutdown();
3549        _result
3550    }
3551
3552    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3553        self.control_handle.inner.send::<fidl::encoding::ResultType<
3554            fidl::encoding::EmptyStruct,
3555            DriverError,
3556        >>(
3557            result,
3558            self.tx_id,
3559            0xac355fb98341996,
3560            fidl::encoding::DynamicFlags::empty(),
3561        )
3562    }
3563}
3564
3565#[must_use = "FIDL methods require a response to be sent"]
3566#[derive(Debug)]
3567pub struct CompositeGetPropertiesResponder {
3568    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3569    tx_id: u32,
3570}
3571
3572/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3573/// if the responder is dropped without sending a response, so that the client
3574/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3575impl std::ops::Drop for CompositeGetPropertiesResponder {
3576    fn drop(&mut self) {
3577        self.control_handle.shutdown();
3578        // Safety: drops once, never accessed again
3579        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3580    }
3581}
3582
3583impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3584    type ControlHandle = CompositeControlHandle;
3585
3586    fn control_handle(&self) -> &CompositeControlHandle {
3587        &self.control_handle
3588    }
3589
3590    fn drop_without_shutdown(mut self) {
3591        // Safety: drops once, never accessed again due to mem::forget
3592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3593        // Prevent Drop from running (which would shut down the channel)
3594        std::mem::forget(self);
3595    }
3596}
3597
3598impl CompositeGetPropertiesResponder {
3599    /// Sends a response to the FIDL transaction.
3600    ///
3601    /// Sets the channel to shutdown if an error occurs.
3602    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3603        let _result = self.send_raw(properties);
3604        if _result.is_err() {
3605            self.control_handle.shutdown();
3606        }
3607        self.drop_without_shutdown();
3608        _result
3609    }
3610
3611    /// Similar to "send" but does not shutdown the channel if an error occurs.
3612    pub fn send_no_shutdown_on_err(
3613        self,
3614        mut properties: &CompositeProperties,
3615    ) -> Result<(), fidl::Error> {
3616        let _result = self.send_raw(properties);
3617        self.drop_without_shutdown();
3618        _result
3619    }
3620
3621    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3622        self.control_handle.inner.send::<CompositeGetPropertiesResponse>(
3623            (properties,),
3624            self.tx_id,
3625            0x31846fa0a459942b,
3626            fidl::encoding::DynamicFlags::empty(),
3627        )
3628    }
3629}
3630
3631#[must_use = "FIDL methods require a response to be sent"]
3632#[derive(Debug)]
3633pub struct CompositeGetRingBufferFormatsResponder {
3634    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3635    tx_id: u32,
3636}
3637
3638/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3639/// if the responder is dropped without sending a response, so that the client
3640/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3641impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3642    fn drop(&mut self) {
3643        self.control_handle.shutdown();
3644        // Safety: drops once, never accessed again
3645        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3646    }
3647}
3648
3649impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
3650    type ControlHandle = CompositeControlHandle;
3651
3652    fn control_handle(&self) -> &CompositeControlHandle {
3653        &self.control_handle
3654    }
3655
3656    fn drop_without_shutdown(mut self) {
3657        // Safety: drops once, never accessed again due to mem::forget
3658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3659        // Prevent Drop from running (which would shut down the channel)
3660        std::mem::forget(self);
3661    }
3662}
3663
3664impl CompositeGetRingBufferFormatsResponder {
3665    /// Sends a response to the FIDL transaction.
3666    ///
3667    /// Sets the channel to shutdown if an error occurs.
3668    pub fn send(
3669        self,
3670        mut result: Result<&[SupportedFormats], DriverError>,
3671    ) -> Result<(), fidl::Error> {
3672        let _result = self.send_raw(result);
3673        if _result.is_err() {
3674            self.control_handle.shutdown();
3675        }
3676        self.drop_without_shutdown();
3677        _result
3678    }
3679
3680    /// Similar to "send" but does not shutdown the channel if an error occurs.
3681    pub fn send_no_shutdown_on_err(
3682        self,
3683        mut result: Result<&[SupportedFormats], DriverError>,
3684    ) -> Result<(), fidl::Error> {
3685        let _result = self.send_raw(result);
3686        self.drop_without_shutdown();
3687        _result
3688    }
3689
3690    fn send_raw(
3691        &self,
3692        mut result: Result<&[SupportedFormats], DriverError>,
3693    ) -> Result<(), fidl::Error> {
3694        self.control_handle.inner.send::<fidl::encoding::ResultType<
3695            CompositeGetRingBufferFormatsResponse,
3696            DriverError,
3697        >>(
3698            result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3699            self.tx_id,
3700            0x1d89b701b6816ac4,
3701            fidl::encoding::DynamicFlags::empty(),
3702        )
3703    }
3704}
3705
3706#[must_use = "FIDL methods require a response to be sent"]
3707#[derive(Debug)]
3708pub struct CompositeCreateRingBufferResponder {
3709    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3710    tx_id: u32,
3711}
3712
3713/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3714/// if the responder is dropped without sending a response, so that the client
3715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3716impl std::ops::Drop for CompositeCreateRingBufferResponder {
3717    fn drop(&mut self) {
3718        self.control_handle.shutdown();
3719        // Safety: drops once, never accessed again
3720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3721    }
3722}
3723
3724impl fidl::endpoints::Responder for CompositeCreateRingBufferResponder {
3725    type ControlHandle = CompositeControlHandle;
3726
3727    fn control_handle(&self) -> &CompositeControlHandle {
3728        &self.control_handle
3729    }
3730
3731    fn drop_without_shutdown(mut self) {
3732        // Safety: drops once, never accessed again due to mem::forget
3733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3734        // Prevent Drop from running (which would shut down the channel)
3735        std::mem::forget(self);
3736    }
3737}
3738
3739impl CompositeCreateRingBufferResponder {
3740    /// Sends a response to the FIDL transaction.
3741    ///
3742    /// Sets the channel to shutdown if an error occurs.
3743    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3744        let _result = self.send_raw(result);
3745        if _result.is_err() {
3746            self.control_handle.shutdown();
3747        }
3748        self.drop_without_shutdown();
3749        _result
3750    }
3751
3752    /// Similar to "send" but does not shutdown the channel if an error occurs.
3753    pub fn send_no_shutdown_on_err(
3754        self,
3755        mut result: Result<(), DriverError>,
3756    ) -> Result<(), fidl::Error> {
3757        let _result = self.send_raw(result);
3758        self.drop_without_shutdown();
3759        _result
3760    }
3761
3762    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3763        self.control_handle.inner.send::<fidl::encoding::ResultType<
3764            fidl::encoding::EmptyStruct,
3765            DriverError,
3766        >>(
3767            result,
3768            self.tx_id,
3769            0x28c5685f85262033,
3770            fidl::encoding::DynamicFlags::empty(),
3771        )
3772    }
3773}
3774
3775#[must_use = "FIDL methods require a response to be sent"]
3776#[derive(Debug)]
3777pub struct CompositeGetDaiFormatsResponder {
3778    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3779    tx_id: u32,
3780}
3781
3782/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3783/// if the responder is dropped without sending a response, so that the client
3784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3785impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3786    fn drop(&mut self) {
3787        self.control_handle.shutdown();
3788        // Safety: drops once, never accessed again
3789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3790    }
3791}
3792
3793impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
3794    type ControlHandle = CompositeControlHandle;
3795
3796    fn control_handle(&self) -> &CompositeControlHandle {
3797        &self.control_handle
3798    }
3799
3800    fn drop_without_shutdown(mut self) {
3801        // Safety: drops once, never accessed again due to mem::forget
3802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3803        // Prevent Drop from running (which would shut down the channel)
3804        std::mem::forget(self);
3805    }
3806}
3807
3808impl CompositeGetDaiFormatsResponder {
3809    /// Sends a response to the FIDL transaction.
3810    ///
3811    /// Sets the channel to shutdown if an error occurs.
3812    pub fn send(
3813        self,
3814        mut result: Result<&[DaiSupportedFormats], DriverError>,
3815    ) -> Result<(), fidl::Error> {
3816        let _result = self.send_raw(result);
3817        if _result.is_err() {
3818            self.control_handle.shutdown();
3819        }
3820        self.drop_without_shutdown();
3821        _result
3822    }
3823
3824    /// Similar to "send" but does not shutdown the channel if an error occurs.
3825    pub fn send_no_shutdown_on_err(
3826        self,
3827        mut result: Result<&[DaiSupportedFormats], DriverError>,
3828    ) -> Result<(), fidl::Error> {
3829        let _result = self.send_raw(result);
3830        self.drop_without_shutdown();
3831        _result
3832    }
3833
3834    fn send_raw(
3835        &self,
3836        mut result: Result<&[DaiSupportedFormats], DriverError>,
3837    ) -> Result<(), fidl::Error> {
3838        self.control_handle.inner.send::<fidl::encoding::ResultType<
3839            CompositeGetDaiFormatsResponse,
3840            DriverError,
3841        >>(
3842            result.map(|dai_formats| (dai_formats,)),
3843            self.tx_id,
3844            0x3cbeaed59c8f69b,
3845            fidl::encoding::DynamicFlags::empty(),
3846        )
3847    }
3848}
3849
3850#[must_use = "FIDL methods require a response to be sent"]
3851#[derive(Debug)]
3852pub struct CompositeSetDaiFormatResponder {
3853    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3854    tx_id: u32,
3855}
3856
3857/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3858/// if the responder is dropped without sending a response, so that the client
3859/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3860impl std::ops::Drop for CompositeSetDaiFormatResponder {
3861    fn drop(&mut self) {
3862        self.control_handle.shutdown();
3863        // Safety: drops once, never accessed again
3864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3865    }
3866}
3867
3868impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
3869    type ControlHandle = CompositeControlHandle;
3870
3871    fn control_handle(&self) -> &CompositeControlHandle {
3872        &self.control_handle
3873    }
3874
3875    fn drop_without_shutdown(mut self) {
3876        // Safety: drops once, never accessed again due to mem::forget
3877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3878        // Prevent Drop from running (which would shut down the channel)
3879        std::mem::forget(self);
3880    }
3881}
3882
3883impl CompositeSetDaiFormatResponder {
3884    /// Sends a response to the FIDL transaction.
3885    ///
3886    /// Sets the channel to shutdown if an error occurs.
3887    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3888        let _result = self.send_raw(result);
3889        if _result.is_err() {
3890            self.control_handle.shutdown();
3891        }
3892        self.drop_without_shutdown();
3893        _result
3894    }
3895
3896    /// Similar to "send" but does not shutdown the channel if an error occurs.
3897    pub fn send_no_shutdown_on_err(
3898        self,
3899        mut result: Result<(), DriverError>,
3900    ) -> Result<(), fidl::Error> {
3901        let _result = self.send_raw(result);
3902        self.drop_without_shutdown();
3903        _result
3904    }
3905
3906    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3907        self.control_handle.inner.send::<fidl::encoding::ResultType<
3908            fidl::encoding::EmptyStruct,
3909            DriverError,
3910        >>(
3911            result,
3912            self.tx_id,
3913            0x155acf5cc0dc8a84,
3914            fidl::encoding::DynamicFlags::empty(),
3915        )
3916    }
3917}
3918
3919#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3920pub struct CompositeConnectorMarker;
3921
3922impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
3923    type Proxy = CompositeConnectorProxy;
3924    type RequestStream = CompositeConnectorRequestStream;
3925    #[cfg(target_os = "fuchsia")]
3926    type SynchronousProxy = CompositeConnectorSynchronousProxy;
3927
3928    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3929}
3930
3931pub trait CompositeConnectorProxyInterface: Send + Sync {
3932    fn r#connect(
3933        &self,
3934        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3935    ) -> Result<(), fidl::Error>;
3936}
3937#[derive(Debug)]
3938#[cfg(target_os = "fuchsia")]
3939pub struct CompositeConnectorSynchronousProxy {
3940    client: fidl::client::sync::Client,
3941}
3942
3943#[cfg(target_os = "fuchsia")]
3944impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
3945    type Proxy = CompositeConnectorProxy;
3946    type Protocol = CompositeConnectorMarker;
3947
3948    fn from_channel(inner: fidl::Channel) -> Self {
3949        Self::new(inner)
3950    }
3951
3952    fn into_channel(self) -> fidl::Channel {
3953        self.client.into_channel()
3954    }
3955
3956    fn as_channel(&self) -> &fidl::Channel {
3957        self.client.as_channel()
3958    }
3959}
3960
3961#[cfg(target_os = "fuchsia")]
3962impl CompositeConnectorSynchronousProxy {
3963    pub fn new(channel: fidl::Channel) -> Self {
3964        let protocol_name =
3965            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3966        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3967    }
3968
3969    pub fn into_channel(self) -> fidl::Channel {
3970        self.client.into_channel()
3971    }
3972
3973    /// Waits until an event arrives and returns it. It is safe for other
3974    /// threads to make concurrent requests while waiting for an event.
3975    pub fn wait_for_event(
3976        &self,
3977        deadline: zx::MonotonicInstant,
3978    ) -> Result<CompositeConnectorEvent, fidl::Error> {
3979        CompositeConnectorEvent::decode(self.client.wait_for_event(deadline)?)
3980    }
3981
3982    /// Connect to a `Device` protocol.
3983    /// This method allows a component to serve FIDL outside the devhost's control.
3984    pub fn r#connect(
3985        &self,
3986        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
3987    ) -> Result<(), fidl::Error> {
3988        self.client.send::<CompositeConnectorConnectRequest>(
3989            (composite_protocol,),
3990            0x7ee557529079e466,
3991            fidl::encoding::DynamicFlags::empty(),
3992        )
3993    }
3994}
3995
3996#[derive(Debug, Clone)]
3997pub struct CompositeConnectorProxy {
3998    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3999}
4000
4001impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4002    type Protocol = CompositeConnectorMarker;
4003
4004    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4005        Self::new(inner)
4006    }
4007
4008    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4009        self.client.into_channel().map_err(|client| Self { client })
4010    }
4011
4012    fn as_channel(&self) -> &::fidl::AsyncChannel {
4013        self.client.as_channel()
4014    }
4015}
4016
4017impl CompositeConnectorProxy {
4018    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4019    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4020        let protocol_name =
4021            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4022        Self { client: fidl::client::Client::new(channel, protocol_name) }
4023    }
4024
4025    /// Get a Stream of events from the remote end of the protocol.
4026    ///
4027    /// # Panics
4028    ///
4029    /// Panics if the event stream was already taken.
4030    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4031        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4032    }
4033
4034    /// Connect to a `Device` protocol.
4035    /// This method allows a component to serve FIDL outside the devhost's control.
4036    pub fn r#connect(
4037        &self,
4038        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4039    ) -> Result<(), fidl::Error> {
4040        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4041    }
4042}
4043
4044impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4045    fn r#connect(
4046        &self,
4047        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4048    ) -> Result<(), fidl::Error> {
4049        self.client.send::<CompositeConnectorConnectRequest>(
4050            (composite_protocol,),
4051            0x7ee557529079e466,
4052            fidl::encoding::DynamicFlags::empty(),
4053        )
4054    }
4055}
4056
4057pub struct CompositeConnectorEventStream {
4058    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4059}
4060
4061impl std::marker::Unpin for CompositeConnectorEventStream {}
4062
4063impl futures::stream::FusedStream for CompositeConnectorEventStream {
4064    fn is_terminated(&self) -> bool {
4065        self.event_receiver.is_terminated()
4066    }
4067}
4068
4069impl futures::Stream for CompositeConnectorEventStream {
4070    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4071
4072    fn poll_next(
4073        mut self: std::pin::Pin<&mut Self>,
4074        cx: &mut std::task::Context<'_>,
4075    ) -> std::task::Poll<Option<Self::Item>> {
4076        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4077            &mut self.event_receiver,
4078            cx
4079        )?) {
4080            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4081            None => std::task::Poll::Ready(None),
4082        }
4083    }
4084}
4085
4086#[derive(Debug)]
4087pub enum CompositeConnectorEvent {}
4088
4089impl CompositeConnectorEvent {
4090    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4091    fn decode(
4092        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4093    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4094        let (bytes, _handles) = buf.split_mut();
4095        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4096        debug_assert_eq!(tx_header.tx_id, 0);
4097        match tx_header.ordinal {
4098            _ => Err(fidl::Error::UnknownOrdinal {
4099                ordinal: tx_header.ordinal,
4100                protocol_name:
4101                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4102            }),
4103        }
4104    }
4105}
4106
4107/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4108pub struct CompositeConnectorRequestStream {
4109    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4110    is_terminated: bool,
4111}
4112
4113impl std::marker::Unpin for CompositeConnectorRequestStream {}
4114
4115impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4116    fn is_terminated(&self) -> bool {
4117        self.is_terminated
4118    }
4119}
4120
4121impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4122    type Protocol = CompositeConnectorMarker;
4123    type ControlHandle = CompositeConnectorControlHandle;
4124
4125    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4126        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4127    }
4128
4129    fn control_handle(&self) -> Self::ControlHandle {
4130        CompositeConnectorControlHandle { inner: self.inner.clone() }
4131    }
4132
4133    fn into_inner(
4134        self,
4135    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4136    {
4137        (self.inner, self.is_terminated)
4138    }
4139
4140    fn from_inner(
4141        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4142        is_terminated: bool,
4143    ) -> Self {
4144        Self { inner, is_terminated }
4145    }
4146}
4147
4148impl futures::Stream for CompositeConnectorRequestStream {
4149    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4150
4151    fn poll_next(
4152        mut self: std::pin::Pin<&mut Self>,
4153        cx: &mut std::task::Context<'_>,
4154    ) -> std::task::Poll<Option<Self::Item>> {
4155        let this = &mut *self;
4156        if this.inner.check_shutdown(cx) {
4157            this.is_terminated = true;
4158            return std::task::Poll::Ready(None);
4159        }
4160        if this.is_terminated {
4161            panic!("polled CompositeConnectorRequestStream after completion");
4162        }
4163        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4164            |bytes, handles| {
4165                match this.inner.channel().read_etc(cx, bytes, handles) {
4166                    std::task::Poll::Ready(Ok(())) => {}
4167                    std::task::Poll::Pending => return std::task::Poll::Pending,
4168                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4169                        this.is_terminated = true;
4170                        return std::task::Poll::Ready(None);
4171                    }
4172                    std::task::Poll::Ready(Err(e)) => {
4173                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4174                            e.into(),
4175                        ))))
4176                    }
4177                }
4178
4179                // A message has been received from the channel
4180                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4181
4182                std::task::Poll::Ready(Some(match header.ordinal {
4183                0x7ee557529079e466 => {
4184                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4185                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4186                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4187                    let control_handle = CompositeConnectorControlHandle {
4188                        inner: this.inner.clone(),
4189                    };
4190                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4191
4192                        control_handle,
4193                    })
4194                }
4195                _ => Err(fidl::Error::UnknownOrdinal {
4196                    ordinal: header.ordinal,
4197                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4198                }),
4199            }))
4200            },
4201        )
4202    }
4203}
4204
4205/// For an overview see
4206/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4207#[derive(Debug)]
4208pub enum CompositeConnectorRequest {
4209    /// Connect to a `Device` protocol.
4210    /// This method allows a component to serve FIDL outside the devhost's control.
4211    Connect {
4212        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4213        control_handle: CompositeConnectorControlHandle,
4214    },
4215}
4216
4217impl CompositeConnectorRequest {
4218    #[allow(irrefutable_let_patterns)]
4219    pub fn into_connect(
4220        self,
4221    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4222    {
4223        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4224            Some((composite_protocol, control_handle))
4225        } else {
4226            None
4227        }
4228    }
4229
4230    /// Name of the method defined in FIDL
4231    pub fn method_name(&self) -> &'static str {
4232        match *self {
4233            CompositeConnectorRequest::Connect { .. } => "connect",
4234        }
4235    }
4236}
4237
4238#[derive(Debug, Clone)]
4239pub struct CompositeConnectorControlHandle {
4240    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4241}
4242
4243impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4244    fn shutdown(&self) {
4245        self.inner.shutdown()
4246    }
4247    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4248        self.inner.shutdown_with_epitaph(status)
4249    }
4250
4251    fn is_closed(&self) -> bool {
4252        self.inner.channel().is_closed()
4253    }
4254    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4255        self.inner.channel().on_closed()
4256    }
4257
4258    #[cfg(target_os = "fuchsia")]
4259    fn signal_peer(
4260        &self,
4261        clear_mask: zx::Signals,
4262        set_mask: zx::Signals,
4263    ) -> Result<(), zx_status::Status> {
4264        use fidl::Peered;
4265        self.inner.channel().signal_peer(clear_mask, set_mask)
4266    }
4267}
4268
4269impl CompositeConnectorControlHandle {}
4270
4271#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4272pub struct DaiMarker;
4273
4274impl fidl::endpoints::ProtocolMarker for DaiMarker {
4275    type Proxy = DaiProxy;
4276    type RequestStream = DaiRequestStream;
4277    #[cfg(target_os = "fuchsia")]
4278    type SynchronousProxy = DaiSynchronousProxy;
4279
4280    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4281}
4282pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4283pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4284
4285pub trait DaiProxyInterface: Send + Sync {
4286    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4287        + Send;
4288    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4289    fn r#signal_processing_connect(
4290        &self,
4291        protocol: fidl::endpoints::ServerEnd<
4292            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4293        >,
4294    ) -> Result<(), fidl::Error>;
4295    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4296    fn r#reset(&self) -> Self::ResetResponseFut;
4297    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4298        + Send;
4299    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4300    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4301        + Send;
4302    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4303    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4304        + Send;
4305    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4306    fn r#create_ring_buffer(
4307        &self,
4308        dai_format: &DaiFormat,
4309        ring_buffer_format: &Format,
4310        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4311    ) -> Result<(), fidl::Error>;
4312}
4313#[derive(Debug)]
4314#[cfg(target_os = "fuchsia")]
4315pub struct DaiSynchronousProxy {
4316    client: fidl::client::sync::Client,
4317}
4318
4319#[cfg(target_os = "fuchsia")]
4320impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4321    type Proxy = DaiProxy;
4322    type Protocol = DaiMarker;
4323
4324    fn from_channel(inner: fidl::Channel) -> Self {
4325        Self::new(inner)
4326    }
4327
4328    fn into_channel(self) -> fidl::Channel {
4329        self.client.into_channel()
4330    }
4331
4332    fn as_channel(&self) -> &fidl::Channel {
4333        self.client.as_channel()
4334    }
4335}
4336
4337#[cfg(target_os = "fuchsia")]
4338impl DaiSynchronousProxy {
4339    pub fn new(channel: fidl::Channel) -> Self {
4340        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4341        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4342    }
4343
4344    pub fn into_channel(self) -> fidl::Channel {
4345        self.client.into_channel()
4346    }
4347
4348    /// Waits until an event arrives and returns it. It is safe for other
4349    /// threads to make concurrent requests while waiting for an event.
4350    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4351        DaiEvent::decode(self.client.wait_for_event(deadline)?)
4352    }
4353
4354    /// Retrieves top level health state.
4355    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4356    pub fn r#get_health_state(
4357        &self,
4358        ___deadline: zx::MonotonicInstant,
4359    ) -> Result<HealthState, fidl::Error> {
4360        let _response =
4361            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
4362                (),
4363                0x4e146d6bca733a84,
4364                fidl::encoding::DynamicFlags::empty(),
4365                ___deadline,
4366            )?;
4367        Ok(_response.state)
4368    }
4369
4370    /// Connect to a `SignalProcessing` protocol.
4371    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4372    /// the maximum number of connections have already been created, for instance one, then the
4373    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4374    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4375    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4376    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4377    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4378    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4379    /// is intended to be composed, and hence the more verbose name allows differentiation and
4380    /// improved clarity.
4381    pub fn r#signal_processing_connect(
4382        &self,
4383        mut protocol: fidl::endpoints::ServerEnd<
4384            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4385        >,
4386    ) -> Result<(), fidl::Error> {
4387        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4388            (protocol,),
4389            0xa81907ce6066295,
4390            fidl::encoding::DynamicFlags::empty(),
4391        )
4392    }
4393
4394    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4395    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4396    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4397    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4398    /// protocol channel and retry.
4399    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4400        let _response =
4401            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4402                (),
4403                0x69e5fa9fa2f78c14,
4404                fidl::encoding::DynamicFlags::empty(),
4405                ___deadline,
4406            )?;
4407        Ok(_response)
4408    }
4409
4410    /// Retrieves top level static properties.
4411    pub fn r#get_properties(
4412        &self,
4413        ___deadline: zx::MonotonicInstant,
4414    ) -> Result<DaiProperties, fidl::Error> {
4415        let _response =
4416            self.client.send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse>(
4417                (),
4418                0x2c25a1a66149510b,
4419                fidl::encoding::DynamicFlags::empty(),
4420                ___deadline,
4421            )?;
4422        Ok(_response.properties)
4423    }
4424
4425    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4426    /// may reply with an error status and the client may retry at a later time.
4427    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4428    /// the parameters in SupportedFormats may be supported.
4429    pub fn r#get_dai_formats(
4430        &self,
4431        ___deadline: zx::MonotonicInstant,
4432    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4433        let _response = self.client.send_query::<
4434            fidl::encoding::EmptyPayload,
4435            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4436        >(
4437            (),
4438            0x1eb37b0cddf79d69,
4439            fidl::encoding::DynamicFlags::empty(),
4440            ___deadline,
4441        )?;
4442        Ok(_response.map(|x| x.dai_formats))
4443    }
4444
4445    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4446    /// may reply with an error status and the client may retry at a later time.
4447    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4448    /// the parameters in `SupportedFormats` may be supported.
4449    pub fn r#get_ring_buffer_formats(
4450        &self,
4451        ___deadline: zx::MonotonicInstant,
4452    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4453        let _response = self.client.send_query::<
4454            fidl::encoding::EmptyPayload,
4455            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4456        >(
4457            (),
4458            0x760371081d8c92e4,
4459            fidl::encoding::DynamicFlags::empty(),
4460            ___deadline,
4461        )?;
4462        Ok(_response.map(|x| x.ring_buffer_formats))
4463    }
4464
4465    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4466    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4467    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4468    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4469    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4470    /// gracefully quiesce any on-going streaming operations in the process.
4471    pub fn r#create_ring_buffer(
4472        &self,
4473        mut dai_format: &DaiFormat,
4474        mut ring_buffer_format: &Format,
4475        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4476    ) -> Result<(), fidl::Error> {
4477        self.client.send::<DaiCreateRingBufferRequest>(
4478            (dai_format, ring_buffer_format, ring_buffer),
4479            0x5af9760589a75257,
4480            fidl::encoding::DynamicFlags::empty(),
4481        )
4482    }
4483}
4484
4485#[derive(Debug, Clone)]
4486pub struct DaiProxy {
4487    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4488}
4489
4490impl fidl::endpoints::Proxy for DaiProxy {
4491    type Protocol = DaiMarker;
4492
4493    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4494        Self::new(inner)
4495    }
4496
4497    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4498        self.client.into_channel().map_err(|client| Self { client })
4499    }
4500
4501    fn as_channel(&self) -> &::fidl::AsyncChannel {
4502        self.client.as_channel()
4503    }
4504}
4505
4506impl DaiProxy {
4507    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4508    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4509        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4510        Self { client: fidl::client::Client::new(channel, protocol_name) }
4511    }
4512
4513    /// Get a Stream of events from the remote end of the protocol.
4514    ///
4515    /// # Panics
4516    ///
4517    /// Panics if the event stream was already taken.
4518    pub fn take_event_stream(&self) -> DaiEventStream {
4519        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4520    }
4521
4522    /// Retrieves top level health state.
4523    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4524    pub fn r#get_health_state(
4525        &self,
4526    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
4527    {
4528        DaiProxyInterface::r#get_health_state(self)
4529    }
4530
4531    /// Connect to a `SignalProcessing` protocol.
4532    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4533    /// the maximum number of connections have already been created, for instance one, then the
4534    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4535    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4536    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4537    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4538    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4539    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4540    /// is intended to be composed, and hence the more verbose name allows differentiation and
4541    /// improved clarity.
4542    pub fn r#signal_processing_connect(
4543        &self,
4544        mut protocol: fidl::endpoints::ServerEnd<
4545            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4546        >,
4547    ) -> Result<(), fidl::Error> {
4548        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4549    }
4550
4551    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4552    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4553    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4554    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4555    /// protocol channel and retry.
4556    pub fn r#reset(
4557        &self,
4558    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4559        DaiProxyInterface::r#reset(self)
4560    }
4561
4562    /// Retrieves top level static properties.
4563    pub fn r#get_properties(
4564        &self,
4565    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
4566    {
4567        DaiProxyInterface::r#get_properties(self)
4568    }
4569
4570    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4571    /// may reply with an error status and the client may retry at a later time.
4572    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4573    /// the parameters in SupportedFormats may be supported.
4574    pub fn r#get_dai_formats(
4575        &self,
4576    ) -> fidl::client::QueryResponseFut<
4577        DaiGetDaiFormatsResult,
4578        fidl::encoding::DefaultFuchsiaResourceDialect,
4579    > {
4580        DaiProxyInterface::r#get_dai_formats(self)
4581    }
4582
4583    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4584    /// may reply with an error status and the client may retry at a later time.
4585    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4586    /// the parameters in `SupportedFormats` may be supported.
4587    pub fn r#get_ring_buffer_formats(
4588        &self,
4589    ) -> fidl::client::QueryResponseFut<
4590        DaiGetRingBufferFormatsResult,
4591        fidl::encoding::DefaultFuchsiaResourceDialect,
4592    > {
4593        DaiProxyInterface::r#get_ring_buffer_formats(self)
4594    }
4595
4596    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4597    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4598    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4599    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4600    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4601    /// gracefully quiesce any on-going streaming operations in the process.
4602    pub fn r#create_ring_buffer(
4603        &self,
4604        mut dai_format: &DaiFormat,
4605        mut ring_buffer_format: &Format,
4606        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4607    ) -> Result<(), fidl::Error> {
4608        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4609    }
4610}
4611
4612impl DaiProxyInterface for DaiProxy {
4613    type GetHealthStateResponseFut =
4614        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
4615    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4616        fn _decode(
4617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4618        ) -> Result<HealthState, fidl::Error> {
4619            let _response = fidl::client::decode_transaction_body::<
4620                HealthGetHealthStateResponse,
4621                fidl::encoding::DefaultFuchsiaResourceDialect,
4622                0x4e146d6bca733a84,
4623            >(_buf?)?;
4624            Ok(_response.state)
4625        }
4626        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4627            (),
4628            0x4e146d6bca733a84,
4629            fidl::encoding::DynamicFlags::empty(),
4630            _decode,
4631        )
4632    }
4633
4634    fn r#signal_processing_connect(
4635        &self,
4636        mut protocol: fidl::endpoints::ServerEnd<
4637            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4638        >,
4639    ) -> Result<(), fidl::Error> {
4640        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4641            (protocol,),
4642            0xa81907ce6066295,
4643            fidl::encoding::DynamicFlags::empty(),
4644        )
4645    }
4646
4647    type ResetResponseFut =
4648        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4649    fn r#reset(&self) -> Self::ResetResponseFut {
4650        fn _decode(
4651            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4652        ) -> Result<(), fidl::Error> {
4653            let _response = fidl::client::decode_transaction_body::<
4654                fidl::encoding::EmptyPayload,
4655                fidl::encoding::DefaultFuchsiaResourceDialect,
4656                0x69e5fa9fa2f78c14,
4657            >(_buf?)?;
4658            Ok(_response)
4659        }
4660        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4661            (),
4662            0x69e5fa9fa2f78c14,
4663            fidl::encoding::DynamicFlags::empty(),
4664            _decode,
4665        )
4666    }
4667
4668    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
4669        DaiProperties,
4670        fidl::encoding::DefaultFuchsiaResourceDialect,
4671    >;
4672    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4673        fn _decode(
4674            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4675        ) -> Result<DaiProperties, fidl::Error> {
4676            let _response = fidl::client::decode_transaction_body::<
4677                DaiGetPropertiesResponse,
4678                fidl::encoding::DefaultFuchsiaResourceDialect,
4679                0x2c25a1a66149510b,
4680            >(_buf?)?;
4681            Ok(_response.properties)
4682        }
4683        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4684            (),
4685            0x2c25a1a66149510b,
4686            fidl::encoding::DynamicFlags::empty(),
4687            _decode,
4688        )
4689    }
4690
4691    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4692        DaiGetDaiFormatsResult,
4693        fidl::encoding::DefaultFuchsiaResourceDialect,
4694    >;
4695    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4696        fn _decode(
4697            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4698        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4699            let _response = fidl::client::decode_transaction_body::<
4700                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4701                fidl::encoding::DefaultFuchsiaResourceDialect,
4702                0x1eb37b0cddf79d69,
4703            >(_buf?)?;
4704            Ok(_response.map(|x| x.dai_formats))
4705        }
4706        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4707            (),
4708            0x1eb37b0cddf79d69,
4709            fidl::encoding::DynamicFlags::empty(),
4710            _decode,
4711        )
4712    }
4713
4714    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4715        DaiGetRingBufferFormatsResult,
4716        fidl::encoding::DefaultFuchsiaResourceDialect,
4717    >;
4718    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4719        fn _decode(
4720            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4721        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4722            let _response = fidl::client::decode_transaction_body::<
4723                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4724                fidl::encoding::DefaultFuchsiaResourceDialect,
4725                0x760371081d8c92e4,
4726            >(_buf?)?;
4727            Ok(_response.map(|x| x.ring_buffer_formats))
4728        }
4729        self.client
4730            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4731                (),
4732                0x760371081d8c92e4,
4733                fidl::encoding::DynamicFlags::empty(),
4734                _decode,
4735            )
4736    }
4737
4738    fn r#create_ring_buffer(
4739        &self,
4740        mut dai_format: &DaiFormat,
4741        mut ring_buffer_format: &Format,
4742        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4743    ) -> Result<(), fidl::Error> {
4744        self.client.send::<DaiCreateRingBufferRequest>(
4745            (dai_format, ring_buffer_format, ring_buffer),
4746            0x5af9760589a75257,
4747            fidl::encoding::DynamicFlags::empty(),
4748        )
4749    }
4750}
4751
4752pub struct DaiEventStream {
4753    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4754}
4755
4756impl std::marker::Unpin for DaiEventStream {}
4757
4758impl futures::stream::FusedStream for DaiEventStream {
4759    fn is_terminated(&self) -> bool {
4760        self.event_receiver.is_terminated()
4761    }
4762}
4763
4764impl futures::Stream for DaiEventStream {
4765    type Item = Result<DaiEvent, fidl::Error>;
4766
4767    fn poll_next(
4768        mut self: std::pin::Pin<&mut Self>,
4769        cx: &mut std::task::Context<'_>,
4770    ) -> std::task::Poll<Option<Self::Item>> {
4771        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4772            &mut self.event_receiver,
4773            cx
4774        )?) {
4775            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4776            None => std::task::Poll::Ready(None),
4777        }
4778    }
4779}
4780
4781#[derive(Debug)]
4782pub enum DaiEvent {}
4783
4784impl DaiEvent {
4785    /// Decodes a message buffer as a [`DaiEvent`].
4786    fn decode(
4787        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4788    ) -> Result<DaiEvent, fidl::Error> {
4789        let (bytes, _handles) = buf.split_mut();
4790        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4791        debug_assert_eq!(tx_header.tx_id, 0);
4792        match tx_header.ordinal {
4793            _ => Err(fidl::Error::UnknownOrdinal {
4794                ordinal: tx_header.ordinal,
4795                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4796            }),
4797        }
4798    }
4799}
4800
4801/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4802pub struct DaiRequestStream {
4803    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4804    is_terminated: bool,
4805}
4806
4807impl std::marker::Unpin for DaiRequestStream {}
4808
4809impl futures::stream::FusedStream for DaiRequestStream {
4810    fn is_terminated(&self) -> bool {
4811        self.is_terminated
4812    }
4813}
4814
4815impl fidl::endpoints::RequestStream for DaiRequestStream {
4816    type Protocol = DaiMarker;
4817    type ControlHandle = DaiControlHandle;
4818
4819    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4820        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4821    }
4822
4823    fn control_handle(&self) -> Self::ControlHandle {
4824        DaiControlHandle { inner: self.inner.clone() }
4825    }
4826
4827    fn into_inner(
4828        self,
4829    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4830    {
4831        (self.inner, self.is_terminated)
4832    }
4833
4834    fn from_inner(
4835        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4836        is_terminated: bool,
4837    ) -> Self {
4838        Self { inner, is_terminated }
4839    }
4840}
4841
4842impl futures::Stream for DaiRequestStream {
4843    type Item = Result<DaiRequest, fidl::Error>;
4844
4845    fn poll_next(
4846        mut self: std::pin::Pin<&mut Self>,
4847        cx: &mut std::task::Context<'_>,
4848    ) -> std::task::Poll<Option<Self::Item>> {
4849        let this = &mut *self;
4850        if this.inner.check_shutdown(cx) {
4851            this.is_terminated = true;
4852            return std::task::Poll::Ready(None);
4853        }
4854        if this.is_terminated {
4855            panic!("polled DaiRequestStream after completion");
4856        }
4857        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4858            |bytes, handles| {
4859                match this.inner.channel().read_etc(cx, bytes, handles) {
4860                    std::task::Poll::Ready(Ok(())) => {}
4861                    std::task::Poll::Pending => return std::task::Poll::Pending,
4862                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4863                        this.is_terminated = true;
4864                        return std::task::Poll::Ready(None);
4865                    }
4866                    std::task::Poll::Ready(Err(e)) => {
4867                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4868                            e.into(),
4869                        ))))
4870                    }
4871                }
4872
4873                // A message has been received from the channel
4874                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4875
4876                std::task::Poll::Ready(Some(match header.ordinal {
4877                    0x4e146d6bca733a84 => {
4878                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4879                        let mut req = fidl::new_empty!(
4880                            fidl::encoding::EmptyPayload,
4881                            fidl::encoding::DefaultFuchsiaResourceDialect
4882                        );
4883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4884                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4885                        Ok(DaiRequest::GetHealthState {
4886                            responder: DaiGetHealthStateResponder {
4887                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4888                                tx_id: header.tx_id,
4889                            },
4890                        })
4891                    }
4892                    0xa81907ce6066295 => {
4893                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4894                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4896                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4897                        Ok(DaiRequest::SignalProcessingConnect {
4898                            protocol: req.protocol,
4899
4900                            control_handle,
4901                        })
4902                    }
4903                    0x69e5fa9fa2f78c14 => {
4904                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4905                        let mut req = fidl::new_empty!(
4906                            fidl::encoding::EmptyPayload,
4907                            fidl::encoding::DefaultFuchsiaResourceDialect
4908                        );
4909                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4910                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4911                        Ok(DaiRequest::Reset {
4912                            responder: DaiResetResponder {
4913                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4914                                tx_id: header.tx_id,
4915                            },
4916                        })
4917                    }
4918                    0x2c25a1a66149510b => {
4919                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4920                        let mut req = fidl::new_empty!(
4921                            fidl::encoding::EmptyPayload,
4922                            fidl::encoding::DefaultFuchsiaResourceDialect
4923                        );
4924                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4925                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4926                        Ok(DaiRequest::GetProperties {
4927                            responder: DaiGetPropertiesResponder {
4928                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4929                                tx_id: header.tx_id,
4930                            },
4931                        })
4932                    }
4933                    0x1eb37b0cddf79d69 => {
4934                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4935                        let mut req = fidl::new_empty!(
4936                            fidl::encoding::EmptyPayload,
4937                            fidl::encoding::DefaultFuchsiaResourceDialect
4938                        );
4939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4940                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4941                        Ok(DaiRequest::GetDaiFormats {
4942                            responder: DaiGetDaiFormatsResponder {
4943                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4944                                tx_id: header.tx_id,
4945                            },
4946                        })
4947                    }
4948                    0x760371081d8c92e4 => {
4949                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4950                        let mut req = fidl::new_empty!(
4951                            fidl::encoding::EmptyPayload,
4952                            fidl::encoding::DefaultFuchsiaResourceDialect
4953                        );
4954                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4955                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4956                        Ok(DaiRequest::GetRingBufferFormats {
4957                            responder: DaiGetRingBufferFormatsResponder {
4958                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4959                                tx_id: header.tx_id,
4960                            },
4961                        })
4962                    }
4963                    0x5af9760589a75257 => {
4964                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4965                        let mut req = fidl::new_empty!(
4966                            DaiCreateRingBufferRequest,
4967                            fidl::encoding::DefaultFuchsiaResourceDialect
4968                        );
4969                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
4970                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
4971                        Ok(DaiRequest::CreateRingBuffer {
4972                            dai_format: req.dai_format,
4973                            ring_buffer_format: req.ring_buffer_format,
4974                            ring_buffer: req.ring_buffer,
4975
4976                            control_handle,
4977                        })
4978                    }
4979                    _ => Err(fidl::Error::UnknownOrdinal {
4980                        ordinal: header.ordinal,
4981                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4982                    }),
4983                }))
4984            },
4985        )
4986    }
4987}
4988
4989/// For an overview see
4990/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
4991/// # Deprecation
4992///
4993/// Not supported anymore, instead use an
4994/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
4995/// with one DAI and one Ring Buffer, see
4996/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
4997#[derive(Debug)]
4998pub enum DaiRequest {
4999    /// Retrieves top level health state.
5000    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5001    GetHealthState { responder: DaiGetHealthStateResponder },
5002    /// Connect to a `SignalProcessing` protocol.
5003    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5004    /// the maximum number of connections have already been created, for instance one, then the
5005    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5006    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5007    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5008    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5009    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5010    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5011    /// is intended to be composed, and hence the more verbose name allows differentiation and
5012    /// improved clarity.
5013    SignalProcessingConnect {
5014        protocol: fidl::endpoints::ServerEnd<
5015            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5016        >,
5017        control_handle: DaiControlHandle,
5018    },
5019    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5020    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5021    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5022    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5023    /// protocol channel and retry.
5024    Reset { responder: DaiResetResponder },
5025    /// Retrieves top level static properties.
5026    GetProperties { responder: DaiGetPropertiesResponder },
5027    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5028    /// may reply with an error status and the client may retry at a later time.
5029    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5030    /// the parameters in SupportedFormats may be supported.
5031    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5032    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5033    /// may reply with an error status and the client may retry at a later time.
5034    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5035    /// the parameters in `SupportedFormats` may be supported.
5036    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5037    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5038    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5039    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5040    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5041    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5042    /// gracefully quiesce any on-going streaming operations in the process.
5043    CreateRingBuffer {
5044        dai_format: DaiFormat,
5045        ring_buffer_format: Format,
5046        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5047        control_handle: DaiControlHandle,
5048    },
5049}
5050
5051impl DaiRequest {
5052    #[allow(irrefutable_let_patterns)]
5053    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5054        if let DaiRequest::GetHealthState { responder } = self {
5055            Some((responder))
5056        } else {
5057            None
5058        }
5059    }
5060
5061    #[allow(irrefutable_let_patterns)]
5062    pub fn into_signal_processing_connect(
5063        self,
5064    ) -> Option<(
5065        fidl::endpoints::ServerEnd<
5066            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5067        >,
5068        DaiControlHandle,
5069    )> {
5070        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5071            Some((protocol, control_handle))
5072        } else {
5073            None
5074        }
5075    }
5076
5077    #[allow(irrefutable_let_patterns)]
5078    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5079        if let DaiRequest::Reset { responder } = self {
5080            Some((responder))
5081        } else {
5082            None
5083        }
5084    }
5085
5086    #[allow(irrefutable_let_patterns)]
5087    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5088        if let DaiRequest::GetProperties { responder } = self {
5089            Some((responder))
5090        } else {
5091            None
5092        }
5093    }
5094
5095    #[allow(irrefutable_let_patterns)]
5096    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5097        if let DaiRequest::GetDaiFormats { responder } = self {
5098            Some((responder))
5099        } else {
5100            None
5101        }
5102    }
5103
5104    #[allow(irrefutable_let_patterns)]
5105    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5106        if let DaiRequest::GetRingBufferFormats { responder } = self {
5107            Some((responder))
5108        } else {
5109            None
5110        }
5111    }
5112
5113    #[allow(irrefutable_let_patterns)]
5114    pub fn into_create_ring_buffer(
5115        self,
5116    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5117    {
5118        if let DaiRequest::CreateRingBuffer {
5119            dai_format,
5120            ring_buffer_format,
5121            ring_buffer,
5122            control_handle,
5123        } = self
5124        {
5125            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5126        } else {
5127            None
5128        }
5129    }
5130
5131    /// Name of the method defined in FIDL
5132    pub fn method_name(&self) -> &'static str {
5133        match *self {
5134            DaiRequest::GetHealthState { .. } => "get_health_state",
5135            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5136            DaiRequest::Reset { .. } => "reset",
5137            DaiRequest::GetProperties { .. } => "get_properties",
5138            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5139            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5140            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5141        }
5142    }
5143}
5144
5145#[derive(Debug, Clone)]
5146pub struct DaiControlHandle {
5147    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5148}
5149
5150impl fidl::endpoints::ControlHandle for DaiControlHandle {
5151    fn shutdown(&self) {
5152        self.inner.shutdown()
5153    }
5154    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5155        self.inner.shutdown_with_epitaph(status)
5156    }
5157
5158    fn is_closed(&self) -> bool {
5159        self.inner.channel().is_closed()
5160    }
5161    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5162        self.inner.channel().on_closed()
5163    }
5164
5165    #[cfg(target_os = "fuchsia")]
5166    fn signal_peer(
5167        &self,
5168        clear_mask: zx::Signals,
5169        set_mask: zx::Signals,
5170    ) -> Result<(), zx_status::Status> {
5171        use fidl::Peered;
5172        self.inner.channel().signal_peer(clear_mask, set_mask)
5173    }
5174}
5175
5176impl DaiControlHandle {}
5177
5178#[must_use = "FIDL methods require a response to be sent"]
5179#[derive(Debug)]
5180pub struct DaiGetHealthStateResponder {
5181    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5182    tx_id: u32,
5183}
5184
5185/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5186/// if the responder is dropped without sending a response, so that the client
5187/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5188impl std::ops::Drop for DaiGetHealthStateResponder {
5189    fn drop(&mut self) {
5190        self.control_handle.shutdown();
5191        // Safety: drops once, never accessed again
5192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5193    }
5194}
5195
5196impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5197    type ControlHandle = DaiControlHandle;
5198
5199    fn control_handle(&self) -> &DaiControlHandle {
5200        &self.control_handle
5201    }
5202
5203    fn drop_without_shutdown(mut self) {
5204        // Safety: drops once, never accessed again due to mem::forget
5205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5206        // Prevent Drop from running (which would shut down the channel)
5207        std::mem::forget(self);
5208    }
5209}
5210
5211impl DaiGetHealthStateResponder {
5212    /// Sends a response to the FIDL transaction.
5213    ///
5214    /// Sets the channel to shutdown if an error occurs.
5215    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5216        let _result = self.send_raw(state);
5217        if _result.is_err() {
5218            self.control_handle.shutdown();
5219        }
5220        self.drop_without_shutdown();
5221        _result
5222    }
5223
5224    /// Similar to "send" but does not shutdown the channel if an error occurs.
5225    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5226        let _result = self.send_raw(state);
5227        self.drop_without_shutdown();
5228        _result
5229    }
5230
5231    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5232        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5233            (state,),
5234            self.tx_id,
5235            0x4e146d6bca733a84,
5236            fidl::encoding::DynamicFlags::empty(),
5237        )
5238    }
5239}
5240
5241#[must_use = "FIDL methods require a response to be sent"]
5242#[derive(Debug)]
5243pub struct DaiResetResponder {
5244    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5245    tx_id: u32,
5246}
5247
5248/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5249/// if the responder is dropped without sending a response, so that the client
5250/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5251impl std::ops::Drop for DaiResetResponder {
5252    fn drop(&mut self) {
5253        self.control_handle.shutdown();
5254        // Safety: drops once, never accessed again
5255        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5256    }
5257}
5258
5259impl fidl::endpoints::Responder for DaiResetResponder {
5260    type ControlHandle = DaiControlHandle;
5261
5262    fn control_handle(&self) -> &DaiControlHandle {
5263        &self.control_handle
5264    }
5265
5266    fn drop_without_shutdown(mut self) {
5267        // Safety: drops once, never accessed again due to mem::forget
5268        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5269        // Prevent Drop from running (which would shut down the channel)
5270        std::mem::forget(self);
5271    }
5272}
5273
5274impl DaiResetResponder {
5275    /// Sends a response to the FIDL transaction.
5276    ///
5277    /// Sets the channel to shutdown if an error occurs.
5278    pub fn send(self) -> Result<(), fidl::Error> {
5279        let _result = self.send_raw();
5280        if _result.is_err() {
5281            self.control_handle.shutdown();
5282        }
5283        self.drop_without_shutdown();
5284        _result
5285    }
5286
5287    /// Similar to "send" but does not shutdown the channel if an error occurs.
5288    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5289        let _result = self.send_raw();
5290        self.drop_without_shutdown();
5291        _result
5292    }
5293
5294    fn send_raw(&self) -> Result<(), fidl::Error> {
5295        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5296            (),
5297            self.tx_id,
5298            0x69e5fa9fa2f78c14,
5299            fidl::encoding::DynamicFlags::empty(),
5300        )
5301    }
5302}
5303
5304#[must_use = "FIDL methods require a response to be sent"]
5305#[derive(Debug)]
5306pub struct DaiGetPropertiesResponder {
5307    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5308    tx_id: u32,
5309}
5310
5311/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5312/// if the responder is dropped without sending a response, so that the client
5313/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5314impl std::ops::Drop for DaiGetPropertiesResponder {
5315    fn drop(&mut self) {
5316        self.control_handle.shutdown();
5317        // Safety: drops once, never accessed again
5318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5319    }
5320}
5321
5322impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5323    type ControlHandle = DaiControlHandle;
5324
5325    fn control_handle(&self) -> &DaiControlHandle {
5326        &self.control_handle
5327    }
5328
5329    fn drop_without_shutdown(mut self) {
5330        // Safety: drops once, never accessed again due to mem::forget
5331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5332        // Prevent Drop from running (which would shut down the channel)
5333        std::mem::forget(self);
5334    }
5335}
5336
5337impl DaiGetPropertiesResponder {
5338    /// Sends a response to the FIDL transaction.
5339    ///
5340    /// Sets the channel to shutdown if an error occurs.
5341    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5342        let _result = self.send_raw(properties);
5343        if _result.is_err() {
5344            self.control_handle.shutdown();
5345        }
5346        self.drop_without_shutdown();
5347        _result
5348    }
5349
5350    /// Similar to "send" but does not shutdown the channel if an error occurs.
5351    pub fn send_no_shutdown_on_err(
5352        self,
5353        mut properties: &DaiProperties,
5354    ) -> Result<(), fidl::Error> {
5355        let _result = self.send_raw(properties);
5356        self.drop_without_shutdown();
5357        _result
5358    }
5359
5360    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5361        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5362            (properties,),
5363            self.tx_id,
5364            0x2c25a1a66149510b,
5365            fidl::encoding::DynamicFlags::empty(),
5366        )
5367    }
5368}
5369
5370#[must_use = "FIDL methods require a response to be sent"]
5371#[derive(Debug)]
5372pub struct DaiGetDaiFormatsResponder {
5373    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5374    tx_id: u32,
5375}
5376
5377/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5378/// if the responder is dropped without sending a response, so that the client
5379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5380impl std::ops::Drop for DaiGetDaiFormatsResponder {
5381    fn drop(&mut self) {
5382        self.control_handle.shutdown();
5383        // Safety: drops once, never accessed again
5384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5385    }
5386}
5387
5388impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5389    type ControlHandle = DaiControlHandle;
5390
5391    fn control_handle(&self) -> &DaiControlHandle {
5392        &self.control_handle
5393    }
5394
5395    fn drop_without_shutdown(mut self) {
5396        // Safety: drops once, never accessed again due to mem::forget
5397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5398        // Prevent Drop from running (which would shut down the channel)
5399        std::mem::forget(self);
5400    }
5401}
5402
5403impl DaiGetDaiFormatsResponder {
5404    /// Sends a response to the FIDL transaction.
5405    ///
5406    /// Sets the channel to shutdown if an error occurs.
5407    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5408        let _result = self.send_raw(result);
5409        if _result.is_err() {
5410            self.control_handle.shutdown();
5411        }
5412        self.drop_without_shutdown();
5413        _result
5414    }
5415
5416    /// Similar to "send" but does not shutdown the channel if an error occurs.
5417    pub fn send_no_shutdown_on_err(
5418        self,
5419        mut result: Result<&[DaiSupportedFormats], i32>,
5420    ) -> Result<(), fidl::Error> {
5421        let _result = self.send_raw(result);
5422        self.drop_without_shutdown();
5423        _result
5424    }
5425
5426    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5427        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5428            result.map(|dai_formats| (dai_formats,)),
5429            self.tx_id,
5430            0x1eb37b0cddf79d69,
5431            fidl::encoding::DynamicFlags::empty(),
5432        )
5433    }
5434}
5435
5436#[must_use = "FIDL methods require a response to be sent"]
5437#[derive(Debug)]
5438pub struct DaiGetRingBufferFormatsResponder {
5439    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5440    tx_id: u32,
5441}
5442
5443/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5444/// if the responder is dropped without sending a response, so that the client
5445/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5446impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5447    fn drop(&mut self) {
5448        self.control_handle.shutdown();
5449        // Safety: drops once, never accessed again
5450        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5451    }
5452}
5453
5454impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
5455    type ControlHandle = DaiControlHandle;
5456
5457    fn control_handle(&self) -> &DaiControlHandle {
5458        &self.control_handle
5459    }
5460
5461    fn drop_without_shutdown(mut self) {
5462        // Safety: drops once, never accessed again due to mem::forget
5463        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5464        // Prevent Drop from running (which would shut down the channel)
5465        std::mem::forget(self);
5466    }
5467}
5468
5469impl DaiGetRingBufferFormatsResponder {
5470    /// Sends a response to the FIDL transaction.
5471    ///
5472    /// Sets the channel to shutdown if an error occurs.
5473    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5474        let _result = self.send_raw(result);
5475        if _result.is_err() {
5476            self.control_handle.shutdown();
5477        }
5478        self.drop_without_shutdown();
5479        _result
5480    }
5481
5482    /// Similar to "send" but does not shutdown the channel if an error occurs.
5483    pub fn send_no_shutdown_on_err(
5484        self,
5485        mut result: Result<&[SupportedFormats], i32>,
5486    ) -> Result<(), fidl::Error> {
5487        let _result = self.send_raw(result);
5488        self.drop_without_shutdown();
5489        _result
5490    }
5491
5492    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5493        self.control_handle
5494            .inner
5495            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5496                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5497                self.tx_id,
5498                0x760371081d8c92e4,
5499                fidl::encoding::DynamicFlags::empty(),
5500            )
5501    }
5502}
5503
5504#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5505pub struct DaiConnectorMarker;
5506
5507impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
5508    type Proxy = DaiConnectorProxy;
5509    type RequestStream = DaiConnectorRequestStream;
5510    #[cfg(target_os = "fuchsia")]
5511    type SynchronousProxy = DaiConnectorSynchronousProxy;
5512
5513    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5514}
5515
5516pub trait DaiConnectorProxyInterface: Send + Sync {
5517    fn r#connect(
5518        &self,
5519        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5520    ) -> Result<(), fidl::Error>;
5521}
5522#[derive(Debug)]
5523#[cfg(target_os = "fuchsia")]
5524pub struct DaiConnectorSynchronousProxy {
5525    client: fidl::client::sync::Client,
5526}
5527
5528#[cfg(target_os = "fuchsia")]
5529impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
5530    type Proxy = DaiConnectorProxy;
5531    type Protocol = DaiConnectorMarker;
5532
5533    fn from_channel(inner: fidl::Channel) -> Self {
5534        Self::new(inner)
5535    }
5536
5537    fn into_channel(self) -> fidl::Channel {
5538        self.client.into_channel()
5539    }
5540
5541    fn as_channel(&self) -> &fidl::Channel {
5542        self.client.as_channel()
5543    }
5544}
5545
5546#[cfg(target_os = "fuchsia")]
5547impl DaiConnectorSynchronousProxy {
5548    pub fn new(channel: fidl::Channel) -> Self {
5549        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5550        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5551    }
5552
5553    pub fn into_channel(self) -> fidl::Channel {
5554        self.client.into_channel()
5555    }
5556
5557    /// Waits until an event arrives and returns it. It is safe for other
5558    /// threads to make concurrent requests while waiting for an event.
5559    pub fn wait_for_event(
5560        &self,
5561        deadline: zx::MonotonicInstant,
5562    ) -> Result<DaiConnectorEvent, fidl::Error> {
5563        DaiConnectorEvent::decode(self.client.wait_for_event(deadline)?)
5564    }
5565
5566    /// This connects to a DAI protocol server.
5567    pub fn r#connect(
5568        &self,
5569        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5570    ) -> Result<(), fidl::Error> {
5571        self.client.send::<DaiConnectorConnectRequest>(
5572            (dai_protocol,),
5573            0x4e4db05c2eca1450,
5574            fidl::encoding::DynamicFlags::empty(),
5575        )
5576    }
5577}
5578
5579#[derive(Debug, Clone)]
5580pub struct DaiConnectorProxy {
5581    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5582}
5583
5584impl fidl::endpoints::Proxy for DaiConnectorProxy {
5585    type Protocol = DaiConnectorMarker;
5586
5587    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5588        Self::new(inner)
5589    }
5590
5591    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5592        self.client.into_channel().map_err(|client| Self { client })
5593    }
5594
5595    fn as_channel(&self) -> &::fidl::AsyncChannel {
5596        self.client.as_channel()
5597    }
5598}
5599
5600impl DaiConnectorProxy {
5601    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5602    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5603        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5604        Self { client: fidl::client::Client::new(channel, protocol_name) }
5605    }
5606
5607    /// Get a Stream of events from the remote end of the protocol.
5608    ///
5609    /// # Panics
5610    ///
5611    /// Panics if the event stream was already taken.
5612    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5613        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5614    }
5615
5616    /// This connects to a DAI protocol server.
5617    pub fn r#connect(
5618        &self,
5619        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5620    ) -> Result<(), fidl::Error> {
5621        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5622    }
5623}
5624
5625impl DaiConnectorProxyInterface for DaiConnectorProxy {
5626    fn r#connect(
5627        &self,
5628        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5629    ) -> Result<(), fidl::Error> {
5630        self.client.send::<DaiConnectorConnectRequest>(
5631            (dai_protocol,),
5632            0x4e4db05c2eca1450,
5633            fidl::encoding::DynamicFlags::empty(),
5634        )
5635    }
5636}
5637
5638pub struct DaiConnectorEventStream {
5639    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5640}
5641
5642impl std::marker::Unpin for DaiConnectorEventStream {}
5643
5644impl futures::stream::FusedStream for DaiConnectorEventStream {
5645    fn is_terminated(&self) -> bool {
5646        self.event_receiver.is_terminated()
5647    }
5648}
5649
5650impl futures::Stream for DaiConnectorEventStream {
5651    type Item = Result<DaiConnectorEvent, fidl::Error>;
5652
5653    fn poll_next(
5654        mut self: std::pin::Pin<&mut Self>,
5655        cx: &mut std::task::Context<'_>,
5656    ) -> std::task::Poll<Option<Self::Item>> {
5657        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5658            &mut self.event_receiver,
5659            cx
5660        )?) {
5661            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5662            None => std::task::Poll::Ready(None),
5663        }
5664    }
5665}
5666
5667#[derive(Debug)]
5668pub enum DaiConnectorEvent {}
5669
5670impl DaiConnectorEvent {
5671    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5672    fn decode(
5673        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5674    ) -> Result<DaiConnectorEvent, fidl::Error> {
5675        let (bytes, _handles) = buf.split_mut();
5676        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5677        debug_assert_eq!(tx_header.tx_id, 0);
5678        match tx_header.ordinal {
5679            _ => Err(fidl::Error::UnknownOrdinal {
5680                ordinal: tx_header.ordinal,
5681                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5682            }),
5683        }
5684    }
5685}
5686
5687/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5688pub struct DaiConnectorRequestStream {
5689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5690    is_terminated: bool,
5691}
5692
5693impl std::marker::Unpin for DaiConnectorRequestStream {}
5694
5695impl futures::stream::FusedStream for DaiConnectorRequestStream {
5696    fn is_terminated(&self) -> bool {
5697        self.is_terminated
5698    }
5699}
5700
5701impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
5702    type Protocol = DaiConnectorMarker;
5703    type ControlHandle = DaiConnectorControlHandle;
5704
5705    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5706        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5707    }
5708
5709    fn control_handle(&self) -> Self::ControlHandle {
5710        DaiConnectorControlHandle { inner: self.inner.clone() }
5711    }
5712
5713    fn into_inner(
5714        self,
5715    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5716    {
5717        (self.inner, self.is_terminated)
5718    }
5719
5720    fn from_inner(
5721        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5722        is_terminated: bool,
5723    ) -> Self {
5724        Self { inner, is_terminated }
5725    }
5726}
5727
5728impl futures::Stream for DaiConnectorRequestStream {
5729    type Item = Result<DaiConnectorRequest, fidl::Error>;
5730
5731    fn poll_next(
5732        mut self: std::pin::Pin<&mut Self>,
5733        cx: &mut std::task::Context<'_>,
5734    ) -> std::task::Poll<Option<Self::Item>> {
5735        let this = &mut *self;
5736        if this.inner.check_shutdown(cx) {
5737            this.is_terminated = true;
5738            return std::task::Poll::Ready(None);
5739        }
5740        if this.is_terminated {
5741            panic!("polled DaiConnectorRequestStream after completion");
5742        }
5743        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5744            |bytes, handles| {
5745                match this.inner.channel().read_etc(cx, bytes, handles) {
5746                    std::task::Poll::Ready(Ok(())) => {}
5747                    std::task::Poll::Pending => return std::task::Poll::Pending,
5748                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5749                        this.is_terminated = true;
5750                        return std::task::Poll::Ready(None);
5751                    }
5752                    std::task::Poll::Ready(Err(e)) => {
5753                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5754                            e.into(),
5755                        ))))
5756                    }
5757                }
5758
5759                // A message has been received from the channel
5760                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5761
5762                std::task::Poll::Ready(Some(match header.ordinal {
5763                    0x4e4db05c2eca1450 => {
5764                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5765                        let mut req = fidl::new_empty!(
5766                            DaiConnectorConnectRequest,
5767                            fidl::encoding::DefaultFuchsiaResourceDialect
5768                        );
5769                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5770                        let control_handle =
5771                            DaiConnectorControlHandle { inner: this.inner.clone() };
5772                        Ok(DaiConnectorRequest::Connect {
5773                            dai_protocol: req.dai_protocol,
5774
5775                            control_handle,
5776                        })
5777                    }
5778                    _ => Err(fidl::Error::UnknownOrdinal {
5779                        ordinal: header.ordinal,
5780                        protocol_name:
5781                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5782                    }),
5783                }))
5784            },
5785        )
5786    }
5787}
5788
5789/// For an overview of the DAI protocols see
5790/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5791/// # Deprecation
5792///
5793/// Not supported anymore, instead use an
5794/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5795/// with one DAI and one Ring Buffer, see
5796/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5797#[derive(Debug)]
5798pub enum DaiConnectorRequest {
5799    /// This connects to a DAI protocol server.
5800    Connect {
5801        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5802        control_handle: DaiConnectorControlHandle,
5803    },
5804}
5805
5806impl DaiConnectorRequest {
5807    #[allow(irrefutable_let_patterns)]
5808    pub fn into_connect(
5809        self,
5810    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5811        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5812            Some((dai_protocol, control_handle))
5813        } else {
5814            None
5815        }
5816    }
5817
5818    /// Name of the method defined in FIDL
5819    pub fn method_name(&self) -> &'static str {
5820        match *self {
5821            DaiConnectorRequest::Connect { .. } => "connect",
5822        }
5823    }
5824}
5825
5826#[derive(Debug, Clone)]
5827pub struct DaiConnectorControlHandle {
5828    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5829}
5830
5831impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
5832    fn shutdown(&self) {
5833        self.inner.shutdown()
5834    }
5835    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5836        self.inner.shutdown_with_epitaph(status)
5837    }
5838
5839    fn is_closed(&self) -> bool {
5840        self.inner.channel().is_closed()
5841    }
5842    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5843        self.inner.channel().on_closed()
5844    }
5845
5846    #[cfg(target_os = "fuchsia")]
5847    fn signal_peer(
5848        &self,
5849        clear_mask: zx::Signals,
5850        set_mask: zx::Signals,
5851    ) -> Result<(), zx_status::Status> {
5852        use fidl::Peered;
5853        self.inner.channel().signal_peer(clear_mask, set_mask)
5854    }
5855}
5856
5857impl DaiConnectorControlHandle {}
5858
5859#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5860pub struct HealthMarker;
5861
5862impl fidl::endpoints::ProtocolMarker for HealthMarker {
5863    type Proxy = HealthProxy;
5864    type RequestStream = HealthRequestStream;
5865    #[cfg(target_os = "fuchsia")]
5866    type SynchronousProxy = HealthSynchronousProxy;
5867
5868    const DEBUG_NAME: &'static str = "(anonymous) Health";
5869}
5870
5871pub trait HealthProxyInterface: Send + Sync {
5872    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
5873        + Send;
5874    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
5875}
5876#[derive(Debug)]
5877#[cfg(target_os = "fuchsia")]
5878pub struct HealthSynchronousProxy {
5879    client: fidl::client::sync::Client,
5880}
5881
5882#[cfg(target_os = "fuchsia")]
5883impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
5884    type Proxy = HealthProxy;
5885    type Protocol = HealthMarker;
5886
5887    fn from_channel(inner: fidl::Channel) -> Self {
5888        Self::new(inner)
5889    }
5890
5891    fn into_channel(self) -> fidl::Channel {
5892        self.client.into_channel()
5893    }
5894
5895    fn as_channel(&self) -> &fidl::Channel {
5896        self.client.as_channel()
5897    }
5898}
5899
5900#[cfg(target_os = "fuchsia")]
5901impl HealthSynchronousProxy {
5902    pub fn new(channel: fidl::Channel) -> Self {
5903        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5904        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5905    }
5906
5907    pub fn into_channel(self) -> fidl::Channel {
5908        self.client.into_channel()
5909    }
5910
5911    /// Waits until an event arrives and returns it. It is safe for other
5912    /// threads to make concurrent requests while waiting for an event.
5913    pub fn wait_for_event(
5914        &self,
5915        deadline: zx::MonotonicInstant,
5916    ) -> Result<HealthEvent, fidl::Error> {
5917        HealthEvent::decode(self.client.wait_for_event(deadline)?)
5918    }
5919
5920    /// Retrieves top level health state.
5921    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5922    pub fn r#get_health_state(
5923        &self,
5924        ___deadline: zx::MonotonicInstant,
5925    ) -> Result<HealthState, fidl::Error> {
5926        let _response =
5927            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
5928                (),
5929                0x4e146d6bca733a84,
5930                fidl::encoding::DynamicFlags::empty(),
5931                ___deadline,
5932            )?;
5933        Ok(_response.state)
5934    }
5935}
5936
5937#[derive(Debug, Clone)]
5938pub struct HealthProxy {
5939    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5940}
5941
5942impl fidl::endpoints::Proxy for HealthProxy {
5943    type Protocol = HealthMarker;
5944
5945    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5946        Self::new(inner)
5947    }
5948
5949    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5950        self.client.into_channel().map_err(|client| Self { client })
5951    }
5952
5953    fn as_channel(&self) -> &::fidl::AsyncChannel {
5954        self.client.as_channel()
5955    }
5956}
5957
5958impl HealthProxy {
5959    /// Create a new Proxy for fuchsia.hardware.audio/Health.
5960    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5961        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5962        Self { client: fidl::client::Client::new(channel, protocol_name) }
5963    }
5964
5965    /// Get a Stream of events from the remote end of the protocol.
5966    ///
5967    /// # Panics
5968    ///
5969    /// Panics if the event stream was already taken.
5970    pub fn take_event_stream(&self) -> HealthEventStream {
5971        HealthEventStream { event_receiver: self.client.take_event_receiver() }
5972    }
5973
5974    /// Retrieves top level health state.
5975    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5976    pub fn r#get_health_state(
5977        &self,
5978    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
5979    {
5980        HealthProxyInterface::r#get_health_state(self)
5981    }
5982}
5983
5984impl HealthProxyInterface for HealthProxy {
5985    type GetHealthStateResponseFut =
5986        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
5987    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
5988        fn _decode(
5989            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5990        ) -> Result<HealthState, fidl::Error> {
5991            let _response = fidl::client::decode_transaction_body::<
5992                HealthGetHealthStateResponse,
5993                fidl::encoding::DefaultFuchsiaResourceDialect,
5994                0x4e146d6bca733a84,
5995            >(_buf?)?;
5996            Ok(_response.state)
5997        }
5998        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
5999            (),
6000            0x4e146d6bca733a84,
6001            fidl::encoding::DynamicFlags::empty(),
6002            _decode,
6003        )
6004    }
6005}
6006
6007pub struct HealthEventStream {
6008    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6009}
6010
6011impl std::marker::Unpin for HealthEventStream {}
6012
6013impl futures::stream::FusedStream for HealthEventStream {
6014    fn is_terminated(&self) -> bool {
6015        self.event_receiver.is_terminated()
6016    }
6017}
6018
6019impl futures::Stream for HealthEventStream {
6020    type Item = Result<HealthEvent, fidl::Error>;
6021
6022    fn poll_next(
6023        mut self: std::pin::Pin<&mut Self>,
6024        cx: &mut std::task::Context<'_>,
6025    ) -> std::task::Poll<Option<Self::Item>> {
6026        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6027            &mut self.event_receiver,
6028            cx
6029        )?) {
6030            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6031            None => std::task::Poll::Ready(None),
6032        }
6033    }
6034}
6035
6036#[derive(Debug)]
6037pub enum HealthEvent {}
6038
6039impl HealthEvent {
6040    /// Decodes a message buffer as a [`HealthEvent`].
6041    fn decode(
6042        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6043    ) -> Result<HealthEvent, fidl::Error> {
6044        let (bytes, _handles) = buf.split_mut();
6045        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6046        debug_assert_eq!(tx_header.tx_id, 0);
6047        match tx_header.ordinal {
6048            _ => Err(fidl::Error::UnknownOrdinal {
6049                ordinal: tx_header.ordinal,
6050                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6051            }),
6052        }
6053    }
6054}
6055
6056/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6057pub struct HealthRequestStream {
6058    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6059    is_terminated: bool,
6060}
6061
6062impl std::marker::Unpin for HealthRequestStream {}
6063
6064impl futures::stream::FusedStream for HealthRequestStream {
6065    fn is_terminated(&self) -> bool {
6066        self.is_terminated
6067    }
6068}
6069
6070impl fidl::endpoints::RequestStream for HealthRequestStream {
6071    type Protocol = HealthMarker;
6072    type ControlHandle = HealthControlHandle;
6073
6074    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6075        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6076    }
6077
6078    fn control_handle(&self) -> Self::ControlHandle {
6079        HealthControlHandle { inner: self.inner.clone() }
6080    }
6081
6082    fn into_inner(
6083        self,
6084    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6085    {
6086        (self.inner, self.is_terminated)
6087    }
6088
6089    fn from_inner(
6090        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6091        is_terminated: bool,
6092    ) -> Self {
6093        Self { inner, is_terminated }
6094    }
6095}
6096
6097impl futures::Stream for HealthRequestStream {
6098    type Item = Result<HealthRequest, fidl::Error>;
6099
6100    fn poll_next(
6101        mut self: std::pin::Pin<&mut Self>,
6102        cx: &mut std::task::Context<'_>,
6103    ) -> std::task::Poll<Option<Self::Item>> {
6104        let this = &mut *self;
6105        if this.inner.check_shutdown(cx) {
6106            this.is_terminated = true;
6107            return std::task::Poll::Ready(None);
6108        }
6109        if this.is_terminated {
6110            panic!("polled HealthRequestStream after completion");
6111        }
6112        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6113            |bytes, handles| {
6114                match this.inner.channel().read_etc(cx, bytes, handles) {
6115                    std::task::Poll::Ready(Ok(())) => {}
6116                    std::task::Poll::Pending => return std::task::Poll::Pending,
6117                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6118                        this.is_terminated = true;
6119                        return std::task::Poll::Ready(None);
6120                    }
6121                    std::task::Poll::Ready(Err(e)) => {
6122                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6123                            e.into(),
6124                        ))))
6125                    }
6126                }
6127
6128                // A message has been received from the channel
6129                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6130
6131                std::task::Poll::Ready(Some(match header.ordinal {
6132                    0x4e146d6bca733a84 => {
6133                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6134                        let mut req = fidl::new_empty!(
6135                            fidl::encoding::EmptyPayload,
6136                            fidl::encoding::DefaultFuchsiaResourceDialect
6137                        );
6138                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6139                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6140                        Ok(HealthRequest::GetHealthState {
6141                            responder: HealthGetHealthStateResponder {
6142                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6143                                tx_id: header.tx_id,
6144                            },
6145                        })
6146                    }
6147                    _ => Err(fidl::Error::UnknownOrdinal {
6148                        ordinal: header.ordinal,
6149                        protocol_name:
6150                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6151                    }),
6152                }))
6153            },
6154        )
6155    }
6156}
6157
6158#[derive(Debug)]
6159pub enum HealthRequest {
6160    /// Retrieves top level health state.
6161    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6162    GetHealthState { responder: HealthGetHealthStateResponder },
6163}
6164
6165impl HealthRequest {
6166    #[allow(irrefutable_let_patterns)]
6167    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6168        if let HealthRequest::GetHealthState { responder } = self {
6169            Some((responder))
6170        } else {
6171            None
6172        }
6173    }
6174
6175    /// Name of the method defined in FIDL
6176    pub fn method_name(&self) -> &'static str {
6177        match *self {
6178            HealthRequest::GetHealthState { .. } => "get_health_state",
6179        }
6180    }
6181}
6182
6183#[derive(Debug, Clone)]
6184pub struct HealthControlHandle {
6185    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6186}
6187
6188impl fidl::endpoints::ControlHandle for HealthControlHandle {
6189    fn shutdown(&self) {
6190        self.inner.shutdown()
6191    }
6192    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6193        self.inner.shutdown_with_epitaph(status)
6194    }
6195
6196    fn is_closed(&self) -> bool {
6197        self.inner.channel().is_closed()
6198    }
6199    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6200        self.inner.channel().on_closed()
6201    }
6202
6203    #[cfg(target_os = "fuchsia")]
6204    fn signal_peer(
6205        &self,
6206        clear_mask: zx::Signals,
6207        set_mask: zx::Signals,
6208    ) -> Result<(), zx_status::Status> {
6209        use fidl::Peered;
6210        self.inner.channel().signal_peer(clear_mask, set_mask)
6211    }
6212}
6213
6214impl HealthControlHandle {}
6215
6216#[must_use = "FIDL methods require a response to be sent"]
6217#[derive(Debug)]
6218pub struct HealthGetHealthStateResponder {
6219    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6220    tx_id: u32,
6221}
6222
6223/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6224/// if the responder is dropped without sending a response, so that the client
6225/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6226impl std::ops::Drop for HealthGetHealthStateResponder {
6227    fn drop(&mut self) {
6228        self.control_handle.shutdown();
6229        // Safety: drops once, never accessed again
6230        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6231    }
6232}
6233
6234impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6235    type ControlHandle = HealthControlHandle;
6236
6237    fn control_handle(&self) -> &HealthControlHandle {
6238        &self.control_handle
6239    }
6240
6241    fn drop_without_shutdown(mut self) {
6242        // Safety: drops once, never accessed again due to mem::forget
6243        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6244        // Prevent Drop from running (which would shut down the channel)
6245        std::mem::forget(self);
6246    }
6247}
6248
6249impl HealthGetHealthStateResponder {
6250    /// Sends a response to the FIDL transaction.
6251    ///
6252    /// Sets the channel to shutdown if an error occurs.
6253    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6254        let _result = self.send_raw(state);
6255        if _result.is_err() {
6256            self.control_handle.shutdown();
6257        }
6258        self.drop_without_shutdown();
6259        _result
6260    }
6261
6262    /// Similar to "send" but does not shutdown the channel if an error occurs.
6263    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6264        let _result = self.send_raw(state);
6265        self.drop_without_shutdown();
6266        _result
6267    }
6268
6269    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6270        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6271            (state,),
6272            self.tx_id,
6273            0x4e146d6bca733a84,
6274            fidl::encoding::DynamicFlags::empty(),
6275        )
6276    }
6277}
6278
6279#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6280pub struct RingBufferMarker;
6281
6282impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
6283    type Proxy = RingBufferProxy;
6284    type RequestStream = RingBufferRequestStream;
6285    #[cfg(target_os = "fuchsia")]
6286    type SynchronousProxy = RingBufferSynchronousProxy;
6287
6288    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
6289}
6290pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
6291pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
6292
6293pub trait RingBufferProxyInterface: Send + Sync {
6294    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
6295        + Send;
6296    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6297    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
6298        + Send;
6299    fn r#watch_clock_recovery_position_info(
6300        &self,
6301    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
6302    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
6303        + Send;
6304    fn r#get_vmo(
6305        &self,
6306        min_frames: u32,
6307        clock_recovery_notifications_per_ring: u32,
6308    ) -> Self::GetVmoResponseFut;
6309    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
6310    fn r#start(&self) -> Self::StartResponseFut;
6311    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6312    fn r#stop(&self) -> Self::StopResponseFut;
6313    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
6314        + Send;
6315    fn r#set_active_channels(
6316        &self,
6317        active_channels_bitmask: u64,
6318    ) -> Self::SetActiveChannelsResponseFut;
6319    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
6320        + Send;
6321    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
6322}
6323#[derive(Debug)]
6324#[cfg(target_os = "fuchsia")]
6325pub struct RingBufferSynchronousProxy {
6326    client: fidl::client::sync::Client,
6327}
6328
6329#[cfg(target_os = "fuchsia")]
6330impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
6331    type Proxy = RingBufferProxy;
6332    type Protocol = RingBufferMarker;
6333
6334    fn from_channel(inner: fidl::Channel) -> Self {
6335        Self::new(inner)
6336    }
6337
6338    fn into_channel(self) -> fidl::Channel {
6339        self.client.into_channel()
6340    }
6341
6342    fn as_channel(&self) -> &fidl::Channel {
6343        self.client.as_channel()
6344    }
6345}
6346
6347#[cfg(target_os = "fuchsia")]
6348impl RingBufferSynchronousProxy {
6349    pub fn new(channel: fidl::Channel) -> Self {
6350        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6351        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6352    }
6353
6354    pub fn into_channel(self) -> fidl::Channel {
6355        self.client.into_channel()
6356    }
6357
6358    /// Waits until an event arrives and returns it. It is safe for other
6359    /// threads to make concurrent requests while waiting for an event.
6360    pub fn wait_for_event(
6361        &self,
6362        deadline: zx::MonotonicInstant,
6363    ) -> Result<RingBufferEvent, fidl::Error> {
6364        RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
6365    }
6366
6367    /// Accessor for top level static properties.
6368    pub fn r#get_properties(
6369        &self,
6370        ___deadline: zx::MonotonicInstant,
6371    ) -> Result<RingBufferProperties, fidl::Error> {
6372        let _response = self
6373            .client
6374            .send_query::<fidl::encoding::EmptyPayload, RingBufferGetPropertiesResponse>(
6375                (),
6376                0x12947f061a8fe1,
6377                fidl::encoding::DynamicFlags::empty(),
6378                ___deadline,
6379            )?;
6380        Ok(_response.properties)
6381    }
6382
6383    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6384    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6385    /// client calls until the position information has changed from what was most recently
6386    /// provided to that client. The driver must not respond to a
6387    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6388    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6389    /// progresses at the rate specified by the rate, sample format (and clock domain,
6390    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6391    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6392    /// estimated position to be used for clock recovery at most at
6393    /// `clock_recovery_notifications_per_ring` frequency.
6394    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6395    /// `clock_recovery_notifications_per_ring` was specified.
6396    /// Must be delivered with timestamps that are monotonically increasing.
6397    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6398    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6399    pub fn r#watch_clock_recovery_position_info(
6400        &self,
6401        ___deadline: zx::MonotonicInstant,
6402    ) -> Result<RingBufferPositionInfo, fidl::Error> {
6403        let _response = self.client.send_query::<
6404            fidl::encoding::EmptyPayload,
6405            RingBufferWatchClockRecoveryPositionInfoResponse,
6406        >(
6407            (),
6408            0x694d5b898a4167e5,
6409            fidl::encoding::DynamicFlags::empty(),
6410            ___deadline,
6411        )?;
6412        Ok(_response.position_info)
6413    }
6414
6415    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6416    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6417    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6418    ///
6419    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6420    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6421    /// with GetVmoError.INVALID_ARGS.
6422    ///
6423    /// The driver may increase the ring buffer size beyond `min_frames` plus
6424    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6425    /// alignment.
6426    ///
6427    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6428    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6429    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6430    ///
6431    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6432    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6433    /// handle must also include ZX_RIGHT_WRITE.
6434    ///
6435    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6436    /// `WatchClockRecoveryPositionInfo` client requests at most at
6437    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6438    /// for clock recovery.
6439    pub fn r#get_vmo(
6440        &self,
6441        mut min_frames: u32,
6442        mut clock_recovery_notifications_per_ring: u32,
6443        ___deadline: zx::MonotonicInstant,
6444    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6445        let _response = self.client.send_query::<
6446            RingBufferGetVmoRequest,
6447            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6448        >(
6449            (min_frames, clock_recovery_notifications_per_ring,),
6450            0x44c8f4f5680e853a,
6451            fidl::encoding::DynamicFlags::empty(),
6452            ___deadline,
6453        )?;
6454        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6455    }
6456
6457    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6458    /// when position began moving, starting at the beginning of the ring buffer,
6459    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6460    /// subject to the buffering described in `driver_transfer_bytes`.
6461    ///
6462    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6463    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6464    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6465    /// a second time before the first call has completed, then the channel must be closed with an
6466    /// error `ZX_ERR_BAD_STATE` returned.
6467    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
6468        let _response =
6469            self.client.send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse>(
6470                (),
6471                0x5dd780a769a8892d,
6472                fidl::encoding::DynamicFlags::empty(),
6473                ___deadline,
6474            )?;
6475        Ok(_response.start_time)
6476    }
6477
6478    /// Stop the ring buffer. Once this call's response is received, no further position
6479    /// notifications will be sent until `Start` is called again.
6480    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6481    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
6482        let _response =
6483            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
6484                (),
6485                0x49a73d9cf1d4e110,
6486                fidl::encoding::DynamicFlags::empty(),
6487                ___deadline,
6488            )?;
6489        Ok(_response)
6490    }
6491
6492    /// Sets which channels are active via a bitmask.
6493    /// The least significant bit corresponds to channel index 0.
6494    /// Channels not set (bits are 0) in the bitmask are inactive.
6495    /// By default all channels are active. Hence creating a RingBuffer turns on the
6496    /// hardware associated for all channels.
6497    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6498    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6499    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6500    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6501    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6502    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6503    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6504    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6505    /// advances (and position notifications sent as needed) regardless of the number of active
6506    /// channels, including if no channels are active. This means that the format in the
6507    /// ring buffer is not changed.
6508    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6509    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6510    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6511    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6512    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6513    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6514    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6515    /// hardware configuration was completed. If the requested channel configuration is already
6516    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6517    /// before the reply is sent. If called again with the same configuration, the reply must
6518    /// include the same `set_time` value as was previously returned.
6519    /// For input channels, it is not required that the driver zero-out inactive channels.
6520    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6521    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6522    pub fn r#set_active_channels(
6523        &self,
6524        mut active_channels_bitmask: u64,
6525        ___deadline: zx::MonotonicInstant,
6526    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6527        let _response = self.client.send_query::<
6528            RingBufferSetActiveChannelsRequest,
6529            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6530        >(
6531            (active_channels_bitmask,),
6532            0x605464c1d384f309,
6533            fidl::encoding::DynamicFlags::empty(),
6534            ___deadline,
6535        )?;
6536        Ok(_response.map(|x| x.set_time))
6537    }
6538
6539    /// Get information about delays via a hanging get. The driver will immediately reply to the
6540    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6541    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6542    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6543    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6544    pub fn r#watch_delay_info(
6545        &self,
6546        ___deadline: zx::MonotonicInstant,
6547    ) -> Result<DelayInfo, fidl::Error> {
6548        let _response = self.client.send_query::<
6549            fidl::encoding::EmptyPayload,
6550            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6551        >(
6552            (),
6553            0x6c1248db213fcf9f,
6554            fidl::encoding::DynamicFlags::FLEXIBLE,
6555            ___deadline,
6556        )?
6557        .into_result::<RingBufferMarker>("watch_delay_info")?;
6558        Ok(_response.delay_info)
6559    }
6560}
6561
6562#[derive(Debug, Clone)]
6563pub struct RingBufferProxy {
6564    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6565}
6566
6567impl fidl::endpoints::Proxy for RingBufferProxy {
6568    type Protocol = RingBufferMarker;
6569
6570    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6571        Self::new(inner)
6572    }
6573
6574    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6575        self.client.into_channel().map_err(|client| Self { client })
6576    }
6577
6578    fn as_channel(&self) -> &::fidl::AsyncChannel {
6579        self.client.as_channel()
6580    }
6581}
6582
6583impl RingBufferProxy {
6584    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
6585    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6586        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6587        Self { client: fidl::client::Client::new(channel, protocol_name) }
6588    }
6589
6590    /// Get a Stream of events from the remote end of the protocol.
6591    ///
6592    /// # Panics
6593    ///
6594    /// Panics if the event stream was already taken.
6595    pub fn take_event_stream(&self) -> RingBufferEventStream {
6596        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
6597    }
6598
6599    /// Accessor for top level static properties.
6600    pub fn r#get_properties(
6601        &self,
6602    ) -> fidl::client::QueryResponseFut<
6603        RingBufferProperties,
6604        fidl::encoding::DefaultFuchsiaResourceDialect,
6605    > {
6606        RingBufferProxyInterface::r#get_properties(self)
6607    }
6608
6609    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6610    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6611    /// client calls until the position information has changed from what was most recently
6612    /// provided to that client. The driver must not respond to a
6613    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6614    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6615    /// progresses at the rate specified by the rate, sample format (and clock domain,
6616    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6617    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6618    /// estimated position to be used for clock recovery at most at
6619    /// `clock_recovery_notifications_per_ring` frequency.
6620    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6621    /// `clock_recovery_notifications_per_ring` was specified.
6622    /// Must be delivered with timestamps that are monotonically increasing.
6623    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6624    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6625    pub fn r#watch_clock_recovery_position_info(
6626        &self,
6627    ) -> fidl::client::QueryResponseFut<
6628        RingBufferPositionInfo,
6629        fidl::encoding::DefaultFuchsiaResourceDialect,
6630    > {
6631        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
6632    }
6633
6634    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6635    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6636    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6637    ///
6638    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6639    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6640    /// with GetVmoError.INVALID_ARGS.
6641    ///
6642    /// The driver may increase the ring buffer size beyond `min_frames` plus
6643    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6644    /// alignment.
6645    ///
6646    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6647    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6648    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6649    ///
6650    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6651    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6652    /// handle must also include ZX_RIGHT_WRITE.
6653    ///
6654    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6655    /// `WatchClockRecoveryPositionInfo` client requests at most at
6656    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6657    /// for clock recovery.
6658    pub fn r#get_vmo(
6659        &self,
6660        mut min_frames: u32,
6661        mut clock_recovery_notifications_per_ring: u32,
6662    ) -> fidl::client::QueryResponseFut<
6663        RingBufferGetVmoResult,
6664        fidl::encoding::DefaultFuchsiaResourceDialect,
6665    > {
6666        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
6667    }
6668
6669    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6670    /// when position began moving, starting at the beginning of the ring buffer,
6671    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6672    /// subject to the buffering described in `driver_transfer_bytes`.
6673    ///
6674    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6675    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6676    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6677    /// a second time before the first call has completed, then the channel must be closed with an
6678    /// error `ZX_ERR_BAD_STATE` returned.
6679    pub fn r#start(
6680        &self,
6681    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
6682        RingBufferProxyInterface::r#start(self)
6683    }
6684
6685    /// Stop the ring buffer. Once this call's response is received, no further position
6686    /// notifications will be sent until `Start` is called again.
6687    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6688    pub fn r#stop(
6689        &self,
6690    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6691        RingBufferProxyInterface::r#stop(self)
6692    }
6693
6694    /// Sets which channels are active via a bitmask.
6695    /// The least significant bit corresponds to channel index 0.
6696    /// Channels not set (bits are 0) in the bitmask are inactive.
6697    /// By default all channels are active. Hence creating a RingBuffer turns on the
6698    /// hardware associated for all channels.
6699    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6700    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6701    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6702    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6703    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6704    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6705    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6706    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6707    /// advances (and position notifications sent as needed) regardless of the number of active
6708    /// channels, including if no channels are active. This means that the format in the
6709    /// ring buffer is not changed.
6710    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6711    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6712    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6713    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6714    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6715    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6716    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6717    /// hardware configuration was completed. If the requested channel configuration is already
6718    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6719    /// before the reply is sent. If called again with the same configuration, the reply must
6720    /// include the same `set_time` value as was previously returned.
6721    /// For input channels, it is not required that the driver zero-out inactive channels.
6722    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6723    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6724    pub fn r#set_active_channels(
6725        &self,
6726        mut active_channels_bitmask: u64,
6727    ) -> fidl::client::QueryResponseFut<
6728        RingBufferSetActiveChannelsResult,
6729        fidl::encoding::DefaultFuchsiaResourceDialect,
6730    > {
6731        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
6732    }
6733
6734    /// Get information about delays via a hanging get. The driver will immediately reply to the
6735    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6736    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6737    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6738    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6739    pub fn r#watch_delay_info(
6740        &self,
6741    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6742    {
6743        RingBufferProxyInterface::r#watch_delay_info(self)
6744    }
6745}
6746
6747impl RingBufferProxyInterface for RingBufferProxy {
6748    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6749        RingBufferProperties,
6750        fidl::encoding::DefaultFuchsiaResourceDialect,
6751    >;
6752    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6753        fn _decode(
6754            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6755        ) -> Result<RingBufferProperties, fidl::Error> {
6756            let _response = fidl::client::decode_transaction_body::<
6757                RingBufferGetPropertiesResponse,
6758                fidl::encoding::DefaultFuchsiaResourceDialect,
6759                0x12947f061a8fe1,
6760            >(_buf?)?;
6761            Ok(_response.properties)
6762        }
6763        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
6764            (),
6765            0x12947f061a8fe1,
6766            fidl::encoding::DynamicFlags::empty(),
6767            _decode,
6768        )
6769    }
6770
6771    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
6772        RingBufferPositionInfo,
6773        fidl::encoding::DefaultFuchsiaResourceDialect,
6774    >;
6775    fn r#watch_clock_recovery_position_info(
6776        &self,
6777    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
6778        fn _decode(
6779            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6780        ) -> Result<RingBufferPositionInfo, fidl::Error> {
6781            let _response = fidl::client::decode_transaction_body::<
6782                RingBufferWatchClockRecoveryPositionInfoResponse,
6783                fidl::encoding::DefaultFuchsiaResourceDialect,
6784                0x694d5b898a4167e5,
6785            >(_buf?)?;
6786            Ok(_response.position_info)
6787        }
6788        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
6789            (),
6790            0x694d5b898a4167e5,
6791            fidl::encoding::DynamicFlags::empty(),
6792            _decode,
6793        )
6794    }
6795
6796    type GetVmoResponseFut = fidl::client::QueryResponseFut<
6797        RingBufferGetVmoResult,
6798        fidl::encoding::DefaultFuchsiaResourceDialect,
6799    >;
6800    fn r#get_vmo(
6801        &self,
6802        mut min_frames: u32,
6803        mut clock_recovery_notifications_per_ring: u32,
6804    ) -> Self::GetVmoResponseFut {
6805        fn _decode(
6806            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6807        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6808            let _response = fidl::client::decode_transaction_body::<
6809                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6810                fidl::encoding::DefaultFuchsiaResourceDialect,
6811                0x44c8f4f5680e853a,
6812            >(_buf?)?;
6813            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6814        }
6815        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
6816            (min_frames, clock_recovery_notifications_per_ring),
6817            0x44c8f4f5680e853a,
6818            fidl::encoding::DynamicFlags::empty(),
6819            _decode,
6820        )
6821    }
6822
6823    type StartResponseFut =
6824        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
6825    fn r#start(&self) -> Self::StartResponseFut {
6826        fn _decode(
6827            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6828        ) -> Result<i64, fidl::Error> {
6829            let _response = fidl::client::decode_transaction_body::<
6830                RingBufferStartResponse,
6831                fidl::encoding::DefaultFuchsiaResourceDialect,
6832                0x5dd780a769a8892d,
6833            >(_buf?)?;
6834            Ok(_response.start_time)
6835        }
6836        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
6837            (),
6838            0x5dd780a769a8892d,
6839            fidl::encoding::DynamicFlags::empty(),
6840            _decode,
6841        )
6842    }
6843
6844    type StopResponseFut =
6845        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6846    fn r#stop(&self) -> Self::StopResponseFut {
6847        fn _decode(
6848            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6849        ) -> Result<(), fidl::Error> {
6850            let _response = fidl::client::decode_transaction_body::<
6851                fidl::encoding::EmptyPayload,
6852                fidl::encoding::DefaultFuchsiaResourceDialect,
6853                0x49a73d9cf1d4e110,
6854            >(_buf?)?;
6855            Ok(_response)
6856        }
6857        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
6858            (),
6859            0x49a73d9cf1d4e110,
6860            fidl::encoding::DynamicFlags::empty(),
6861            _decode,
6862        )
6863    }
6864
6865    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
6866        RingBufferSetActiveChannelsResult,
6867        fidl::encoding::DefaultFuchsiaResourceDialect,
6868    >;
6869    fn r#set_active_channels(
6870        &self,
6871        mut active_channels_bitmask: u64,
6872    ) -> Self::SetActiveChannelsResponseFut {
6873        fn _decode(
6874            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6875        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6876            let _response = fidl::client::decode_transaction_body::<
6877                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6878                fidl::encoding::DefaultFuchsiaResourceDialect,
6879                0x605464c1d384f309,
6880            >(_buf?)?;
6881            Ok(_response.map(|x| x.set_time))
6882        }
6883        self.client.send_query_and_decode::<
6884            RingBufferSetActiveChannelsRequest,
6885            RingBufferSetActiveChannelsResult,
6886        >(
6887            (active_channels_bitmask,),
6888            0x605464c1d384f309,
6889            fidl::encoding::DynamicFlags::empty(),
6890            _decode,
6891        )
6892    }
6893
6894    type WatchDelayInfoResponseFut =
6895        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
6896    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
6897        fn _decode(
6898            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6899        ) -> Result<DelayInfo, fidl::Error> {
6900            let _response = fidl::client::decode_transaction_body::<
6901                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6902                fidl::encoding::DefaultFuchsiaResourceDialect,
6903                0x6c1248db213fcf9f,
6904            >(_buf?)?
6905            .into_result::<RingBufferMarker>("watch_delay_info")?;
6906            Ok(_response.delay_info)
6907        }
6908        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
6909            (),
6910            0x6c1248db213fcf9f,
6911            fidl::encoding::DynamicFlags::FLEXIBLE,
6912            _decode,
6913        )
6914    }
6915}
6916
6917pub struct RingBufferEventStream {
6918    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6919}
6920
6921impl std::marker::Unpin for RingBufferEventStream {}
6922
6923impl futures::stream::FusedStream for RingBufferEventStream {
6924    fn is_terminated(&self) -> bool {
6925        self.event_receiver.is_terminated()
6926    }
6927}
6928
6929impl futures::Stream for RingBufferEventStream {
6930    type Item = Result<RingBufferEvent, fidl::Error>;
6931
6932    fn poll_next(
6933        mut self: std::pin::Pin<&mut Self>,
6934        cx: &mut std::task::Context<'_>,
6935    ) -> std::task::Poll<Option<Self::Item>> {
6936        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6937            &mut self.event_receiver,
6938            cx
6939        )?) {
6940            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
6941            None => std::task::Poll::Ready(None),
6942        }
6943    }
6944}
6945
6946#[derive(Debug)]
6947pub enum RingBufferEvent {
6948    #[non_exhaustive]
6949    _UnknownEvent {
6950        /// Ordinal of the event that was sent.
6951        ordinal: u64,
6952    },
6953}
6954
6955impl RingBufferEvent {
6956    /// Decodes a message buffer as a [`RingBufferEvent`].
6957    fn decode(
6958        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6959    ) -> Result<RingBufferEvent, fidl::Error> {
6960        let (bytes, _handles) = buf.split_mut();
6961        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6962        debug_assert_eq!(tx_header.tx_id, 0);
6963        match tx_header.ordinal {
6964            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6965                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6966            }
6967            _ => Err(fidl::Error::UnknownOrdinal {
6968                ordinal: tx_header.ordinal,
6969                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6970            }),
6971        }
6972    }
6973}
6974
6975/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
6976pub struct RingBufferRequestStream {
6977    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6978    is_terminated: bool,
6979}
6980
6981impl std::marker::Unpin for RingBufferRequestStream {}
6982
6983impl futures::stream::FusedStream for RingBufferRequestStream {
6984    fn is_terminated(&self) -> bool {
6985        self.is_terminated
6986    }
6987}
6988
6989impl fidl::endpoints::RequestStream for RingBufferRequestStream {
6990    type Protocol = RingBufferMarker;
6991    type ControlHandle = RingBufferControlHandle;
6992
6993    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6994        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6995    }
6996
6997    fn control_handle(&self) -> Self::ControlHandle {
6998        RingBufferControlHandle { inner: self.inner.clone() }
6999    }
7000
7001    fn into_inner(
7002        self,
7003    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7004    {
7005        (self.inner, self.is_terminated)
7006    }
7007
7008    fn from_inner(
7009        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7010        is_terminated: bool,
7011    ) -> Self {
7012        Self { inner, is_terminated }
7013    }
7014}
7015
7016impl futures::Stream for RingBufferRequestStream {
7017    type Item = Result<RingBufferRequest, fidl::Error>;
7018
7019    fn poll_next(
7020        mut self: std::pin::Pin<&mut Self>,
7021        cx: &mut std::task::Context<'_>,
7022    ) -> std::task::Poll<Option<Self::Item>> {
7023        let this = &mut *self;
7024        if this.inner.check_shutdown(cx) {
7025            this.is_terminated = true;
7026            return std::task::Poll::Ready(None);
7027        }
7028        if this.is_terminated {
7029            panic!("polled RingBufferRequestStream after completion");
7030        }
7031        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7032            |bytes, handles| {
7033                match this.inner.channel().read_etc(cx, bytes, handles) {
7034                    std::task::Poll::Ready(Ok(())) => {}
7035                    std::task::Poll::Pending => return std::task::Poll::Pending,
7036                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7037                        this.is_terminated = true;
7038                        return std::task::Poll::Ready(None);
7039                    }
7040                    std::task::Poll::Ready(Err(e)) => {
7041                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7042                            e.into(),
7043                        ))))
7044                    }
7045                }
7046
7047                // A message has been received from the channel
7048                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7049
7050                std::task::Poll::Ready(Some(match header.ordinal {
7051                    0x12947f061a8fe1 => {
7052                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7053                        let mut req = fidl::new_empty!(
7054                            fidl::encoding::EmptyPayload,
7055                            fidl::encoding::DefaultFuchsiaResourceDialect
7056                        );
7057                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7058                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7059                        Ok(RingBufferRequest::GetProperties {
7060                            responder: RingBufferGetPropertiesResponder {
7061                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7062                                tx_id: header.tx_id,
7063                            },
7064                        })
7065                    }
7066                    0x694d5b898a4167e5 => {
7067                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7068                        let mut req = fidl::new_empty!(
7069                            fidl::encoding::EmptyPayload,
7070                            fidl::encoding::DefaultFuchsiaResourceDialect
7071                        );
7072                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7073                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7074                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
7075                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
7076                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7077                                tx_id: header.tx_id,
7078                            },
7079                        })
7080                    }
7081                    0x44c8f4f5680e853a => {
7082                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7083                        let mut req = fidl::new_empty!(
7084                            RingBufferGetVmoRequest,
7085                            fidl::encoding::DefaultFuchsiaResourceDialect
7086                        );
7087                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
7088                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7089                        Ok(RingBufferRequest::GetVmo {
7090                            min_frames: req.min_frames,
7091                            clock_recovery_notifications_per_ring: req
7092                                .clock_recovery_notifications_per_ring,
7093
7094                            responder: RingBufferGetVmoResponder {
7095                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7096                                tx_id: header.tx_id,
7097                            },
7098                        })
7099                    }
7100                    0x5dd780a769a8892d => {
7101                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7102                        let mut req = fidl::new_empty!(
7103                            fidl::encoding::EmptyPayload,
7104                            fidl::encoding::DefaultFuchsiaResourceDialect
7105                        );
7106                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7107                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7108                        Ok(RingBufferRequest::Start {
7109                            responder: RingBufferStartResponder {
7110                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7111                                tx_id: header.tx_id,
7112                            },
7113                        })
7114                    }
7115                    0x49a73d9cf1d4e110 => {
7116                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7117                        let mut req = fidl::new_empty!(
7118                            fidl::encoding::EmptyPayload,
7119                            fidl::encoding::DefaultFuchsiaResourceDialect
7120                        );
7121                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7122                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7123                        Ok(RingBufferRequest::Stop {
7124                            responder: RingBufferStopResponder {
7125                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7126                                tx_id: header.tx_id,
7127                            },
7128                        })
7129                    }
7130                    0x605464c1d384f309 => {
7131                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7132                        let mut req = fidl::new_empty!(
7133                            RingBufferSetActiveChannelsRequest,
7134                            fidl::encoding::DefaultFuchsiaResourceDialect
7135                        );
7136                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
7137                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7138                        Ok(RingBufferRequest::SetActiveChannels {
7139                            active_channels_bitmask: req.active_channels_bitmask,
7140
7141                            responder: RingBufferSetActiveChannelsResponder {
7142                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7143                                tx_id: header.tx_id,
7144                            },
7145                        })
7146                    }
7147                    0x6c1248db213fcf9f => {
7148                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7149                        let mut req = fidl::new_empty!(
7150                            fidl::encoding::EmptyPayload,
7151                            fidl::encoding::DefaultFuchsiaResourceDialect
7152                        );
7153                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7154                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7155                        Ok(RingBufferRequest::WatchDelayInfo {
7156                            responder: RingBufferWatchDelayInfoResponder {
7157                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7158                                tx_id: header.tx_id,
7159                            },
7160                        })
7161                    }
7162                    _ if header.tx_id == 0
7163                        && header
7164                            .dynamic_flags()
7165                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7166                    {
7167                        Ok(RingBufferRequest::_UnknownMethod {
7168                            ordinal: header.ordinal,
7169                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7170                            method_type: fidl::MethodType::OneWay,
7171                        })
7172                    }
7173                    _ if header
7174                        .dynamic_flags()
7175                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7176                    {
7177                        this.inner.send_framework_err(
7178                            fidl::encoding::FrameworkErr::UnknownMethod,
7179                            header.tx_id,
7180                            header.ordinal,
7181                            header.dynamic_flags(),
7182                            (bytes, handles),
7183                        )?;
7184                        Ok(RingBufferRequest::_UnknownMethod {
7185                            ordinal: header.ordinal,
7186                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7187                            method_type: fidl::MethodType::TwoWay,
7188                        })
7189                    }
7190                    _ => Err(fidl::Error::UnknownOrdinal {
7191                        ordinal: header.ordinal,
7192                        protocol_name:
7193                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7194                    }),
7195                }))
7196            },
7197        )
7198    }
7199}
7200
7201#[derive(Debug)]
7202pub enum RingBufferRequest {
7203    /// Accessor for top level static properties.
7204    GetProperties { responder: RingBufferGetPropertiesResponder },
7205    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
7206    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
7207    /// client calls until the position information has changed from what was most recently
7208    /// provided to that client. The driver must not respond to a
7209    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
7210    /// At the `start_time` returned by `Start`, position is always 0. From there, it
7211    /// progresses at the rate specified by the rate, sample format (and clock domain,
7212    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
7213    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
7214    /// estimated position to be used for clock recovery at most at
7215    /// `clock_recovery_notifications_per_ring` frequency.
7216    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
7217    /// `clock_recovery_notifications_per_ring` was specified.
7218    /// Must be delivered with timestamps that are monotonically increasing.
7219    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
7220    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
7221    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
7222    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
7223    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
7224    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
7225    ///
7226    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
7227    /// that ring buffer contents can be transfered in and out, or else the call must be failed
7228    /// with GetVmoError.INVALID_ARGS.
7229    ///
7230    /// The driver may increase the ring buffer size beyond `min_frames` plus
7231    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
7232    /// alignment.
7233    ///
7234    /// Clients can treat the entire returned ring buffer as safe to access, except for the
7235    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
7236    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
7237    ///
7238    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7239    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
7240    /// handle must also include ZX_RIGHT_WRITE.
7241    ///
7242    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
7243    /// `WatchClockRecoveryPositionInfo` client requests at most at
7244    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
7245    /// for clock recovery.
7246    GetVmo {
7247        min_frames: u32,
7248        clock_recovery_notifications_per_ring: u32,
7249        responder: RingBufferGetVmoResponder,
7250    },
7251    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
7252    /// when position began moving, starting at the beginning of the ring buffer,
7253    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
7254    /// subject to the buffering described in `driver_transfer_bytes`.
7255    ///
7256    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
7257    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7258    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
7259    /// a second time before the first call has completed, then the channel must be closed with an
7260    /// error `ZX_ERR_BAD_STATE` returned.
7261    Start { responder: RingBufferStartResponder },
7262    /// Stop the ring buffer. Once this call's response is received, no further position
7263    /// notifications will be sent until `Start` is called again.
7264    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7265    Stop { responder: RingBufferStopResponder },
7266    /// Sets which channels are active via a bitmask.
7267    /// The least significant bit corresponds to channel index 0.
7268    /// Channels not set (bits are 0) in the bitmask are inactive.
7269    /// By default all channels are active. Hence creating a RingBuffer turns on the
7270    /// hardware associated for all channels.
7271    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
7272    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
7273    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
7274    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
7275    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
7276    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
7277    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
7278    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
7279    /// advances (and position notifications sent as needed) regardless of the number of active
7280    /// channels, including if no channels are active. This means that the format in the
7281    /// ring buffer is not changed.
7282    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
7283    /// If the mask is incorrect, i.e. enables channels outside the number of bits
7284    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
7285    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
7286    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
7287    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
7288    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
7289    /// hardware configuration was completed. If the requested channel configuration is already
7290    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
7291    /// before the reply is sent. If called again with the same configuration, the reply must
7292    /// include the same `set_time` value as was previously returned.
7293    /// For input channels, it is not required that the driver zero-out inactive channels.
7294    /// If `SetActiveChannels` is called for a second time before the first call has completed,
7295    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7296    SetActiveChannels {
7297        active_channels_bitmask: u64,
7298        responder: RingBufferSetActiveChannelsResponder,
7299    },
7300    /// Get information about delays via a hanging get. The driver will immediately reply to the
7301    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
7302    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
7303    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
7304    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7305    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
7306    /// An interaction was received which does not match any known method.
7307    #[non_exhaustive]
7308    _UnknownMethod {
7309        /// Ordinal of the method that was called.
7310        ordinal: u64,
7311        control_handle: RingBufferControlHandle,
7312        method_type: fidl::MethodType,
7313    },
7314}
7315
7316impl RingBufferRequest {
7317    #[allow(irrefutable_let_patterns)]
7318    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
7319        if let RingBufferRequest::GetProperties { responder } = self {
7320            Some((responder))
7321        } else {
7322            None
7323        }
7324    }
7325
7326    #[allow(irrefutable_let_patterns)]
7327    pub fn into_watch_clock_recovery_position_info(
7328        self,
7329    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
7330        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
7331            Some((responder))
7332        } else {
7333            None
7334        }
7335    }
7336
7337    #[allow(irrefutable_let_patterns)]
7338    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
7339        if let RingBufferRequest::GetVmo {
7340            min_frames,
7341            clock_recovery_notifications_per_ring,
7342            responder,
7343        } = self
7344        {
7345            Some((min_frames, clock_recovery_notifications_per_ring, responder))
7346        } else {
7347            None
7348        }
7349    }
7350
7351    #[allow(irrefutable_let_patterns)]
7352    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
7353        if let RingBufferRequest::Start { responder } = self {
7354            Some((responder))
7355        } else {
7356            None
7357        }
7358    }
7359
7360    #[allow(irrefutable_let_patterns)]
7361    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
7362        if let RingBufferRequest::Stop { responder } = self {
7363            Some((responder))
7364        } else {
7365            None
7366        }
7367    }
7368
7369    #[allow(irrefutable_let_patterns)]
7370    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
7371        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
7372            Some((active_channels_bitmask, responder))
7373        } else {
7374            None
7375        }
7376    }
7377
7378    #[allow(irrefutable_let_patterns)]
7379    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
7380        if let RingBufferRequest::WatchDelayInfo { responder } = self {
7381            Some((responder))
7382        } else {
7383            None
7384        }
7385    }
7386
7387    /// Name of the method defined in FIDL
7388    pub fn method_name(&self) -> &'static str {
7389        match *self {
7390            RingBufferRequest::GetProperties { .. } => "get_properties",
7391            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
7392                "watch_clock_recovery_position_info"
7393            }
7394            RingBufferRequest::GetVmo { .. } => "get_vmo",
7395            RingBufferRequest::Start { .. } => "start",
7396            RingBufferRequest::Stop { .. } => "stop",
7397            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
7398            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
7399            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7400                "unknown one-way method"
7401            }
7402            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7403                "unknown two-way method"
7404            }
7405        }
7406    }
7407}
7408
7409#[derive(Debug, Clone)]
7410pub struct RingBufferControlHandle {
7411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7412}
7413
7414impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
7415    fn shutdown(&self) {
7416        self.inner.shutdown()
7417    }
7418    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7419        self.inner.shutdown_with_epitaph(status)
7420    }
7421
7422    fn is_closed(&self) -> bool {
7423        self.inner.channel().is_closed()
7424    }
7425    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7426        self.inner.channel().on_closed()
7427    }
7428
7429    #[cfg(target_os = "fuchsia")]
7430    fn signal_peer(
7431        &self,
7432        clear_mask: zx::Signals,
7433        set_mask: zx::Signals,
7434    ) -> Result<(), zx_status::Status> {
7435        use fidl::Peered;
7436        self.inner.channel().signal_peer(clear_mask, set_mask)
7437    }
7438}
7439
7440impl RingBufferControlHandle {}
7441
7442#[must_use = "FIDL methods require a response to be sent"]
7443#[derive(Debug)]
7444pub struct RingBufferGetPropertiesResponder {
7445    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7446    tx_id: u32,
7447}
7448
7449/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7450/// if the responder is dropped without sending a response, so that the client
7451/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7452impl std::ops::Drop for RingBufferGetPropertiesResponder {
7453    fn drop(&mut self) {
7454        self.control_handle.shutdown();
7455        // Safety: drops once, never accessed again
7456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7457    }
7458}
7459
7460impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
7461    type ControlHandle = RingBufferControlHandle;
7462
7463    fn control_handle(&self) -> &RingBufferControlHandle {
7464        &self.control_handle
7465    }
7466
7467    fn drop_without_shutdown(mut self) {
7468        // Safety: drops once, never accessed again due to mem::forget
7469        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7470        // Prevent Drop from running (which would shut down the channel)
7471        std::mem::forget(self);
7472    }
7473}
7474
7475impl RingBufferGetPropertiesResponder {
7476    /// Sends a response to the FIDL transaction.
7477    ///
7478    /// Sets the channel to shutdown if an error occurs.
7479    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7480        let _result = self.send_raw(properties);
7481        if _result.is_err() {
7482            self.control_handle.shutdown();
7483        }
7484        self.drop_without_shutdown();
7485        _result
7486    }
7487
7488    /// Similar to "send" but does not shutdown the channel if an error occurs.
7489    pub fn send_no_shutdown_on_err(
7490        self,
7491        mut properties: &RingBufferProperties,
7492    ) -> Result<(), fidl::Error> {
7493        let _result = self.send_raw(properties);
7494        self.drop_without_shutdown();
7495        _result
7496    }
7497
7498    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7499        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
7500            (properties,),
7501            self.tx_id,
7502            0x12947f061a8fe1,
7503            fidl::encoding::DynamicFlags::empty(),
7504        )
7505    }
7506}
7507
7508#[must_use = "FIDL methods require a response to be sent"]
7509#[derive(Debug)]
7510pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
7511    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7512    tx_id: u32,
7513}
7514
7515/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7516/// if the responder is dropped without sending a response, so that the client
7517/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7518impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
7519    fn drop(&mut self) {
7520        self.control_handle.shutdown();
7521        // Safety: drops once, never accessed again
7522        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7523    }
7524}
7525
7526impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
7527    type ControlHandle = RingBufferControlHandle;
7528
7529    fn control_handle(&self) -> &RingBufferControlHandle {
7530        &self.control_handle
7531    }
7532
7533    fn drop_without_shutdown(mut self) {
7534        // Safety: drops once, never accessed again due to mem::forget
7535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7536        // Prevent Drop from running (which would shut down the channel)
7537        std::mem::forget(self);
7538    }
7539}
7540
7541impl RingBufferWatchClockRecoveryPositionInfoResponder {
7542    /// Sends a response to the FIDL transaction.
7543    ///
7544    /// Sets the channel to shutdown if an error occurs.
7545    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7546        let _result = self.send_raw(position_info);
7547        if _result.is_err() {
7548            self.control_handle.shutdown();
7549        }
7550        self.drop_without_shutdown();
7551        _result
7552    }
7553
7554    /// Similar to "send" but does not shutdown the channel if an error occurs.
7555    pub fn send_no_shutdown_on_err(
7556        self,
7557        mut position_info: &RingBufferPositionInfo,
7558    ) -> Result<(), fidl::Error> {
7559        let _result = self.send_raw(position_info);
7560        self.drop_without_shutdown();
7561        _result
7562    }
7563
7564    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7565        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
7566            (position_info,),
7567            self.tx_id,
7568            0x694d5b898a4167e5,
7569            fidl::encoding::DynamicFlags::empty(),
7570        )
7571    }
7572}
7573
7574#[must_use = "FIDL methods require a response to be sent"]
7575#[derive(Debug)]
7576pub struct RingBufferGetVmoResponder {
7577    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7578    tx_id: u32,
7579}
7580
7581/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7582/// if the responder is dropped without sending a response, so that the client
7583/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7584impl std::ops::Drop for RingBufferGetVmoResponder {
7585    fn drop(&mut self) {
7586        self.control_handle.shutdown();
7587        // Safety: drops once, never accessed again
7588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7589    }
7590}
7591
7592impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
7593    type ControlHandle = RingBufferControlHandle;
7594
7595    fn control_handle(&self) -> &RingBufferControlHandle {
7596        &self.control_handle
7597    }
7598
7599    fn drop_without_shutdown(mut self) {
7600        // Safety: drops once, never accessed again due to mem::forget
7601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7602        // Prevent Drop from running (which would shut down the channel)
7603        std::mem::forget(self);
7604    }
7605}
7606
7607impl RingBufferGetVmoResponder {
7608    /// Sends a response to the FIDL transaction.
7609    ///
7610    /// Sets the channel to shutdown if an error occurs.
7611    pub fn send(
7612        self,
7613        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7614    ) -> Result<(), fidl::Error> {
7615        let _result = self.send_raw(result);
7616        if _result.is_err() {
7617            self.control_handle.shutdown();
7618        }
7619        self.drop_without_shutdown();
7620        _result
7621    }
7622
7623    /// Similar to "send" but does not shutdown the channel if an error occurs.
7624    pub fn send_no_shutdown_on_err(
7625        self,
7626        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7627    ) -> Result<(), fidl::Error> {
7628        let _result = self.send_raw(result);
7629        self.drop_without_shutdown();
7630        _result
7631    }
7632
7633    fn send_raw(
7634        &self,
7635        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7636    ) -> Result<(), fidl::Error> {
7637        self.control_handle
7638            .inner
7639            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
7640                result,
7641                self.tx_id,
7642                0x44c8f4f5680e853a,
7643                fidl::encoding::DynamicFlags::empty(),
7644            )
7645    }
7646}
7647
7648#[must_use = "FIDL methods require a response to be sent"]
7649#[derive(Debug)]
7650pub struct RingBufferStartResponder {
7651    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7652    tx_id: u32,
7653}
7654
7655/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7656/// if the responder is dropped without sending a response, so that the client
7657/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7658impl std::ops::Drop for RingBufferStartResponder {
7659    fn drop(&mut self) {
7660        self.control_handle.shutdown();
7661        // Safety: drops once, never accessed again
7662        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7663    }
7664}
7665
7666impl fidl::endpoints::Responder for RingBufferStartResponder {
7667    type ControlHandle = RingBufferControlHandle;
7668
7669    fn control_handle(&self) -> &RingBufferControlHandle {
7670        &self.control_handle
7671    }
7672
7673    fn drop_without_shutdown(mut self) {
7674        // Safety: drops once, never accessed again due to mem::forget
7675        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7676        // Prevent Drop from running (which would shut down the channel)
7677        std::mem::forget(self);
7678    }
7679}
7680
7681impl RingBufferStartResponder {
7682    /// Sends a response to the FIDL transaction.
7683    ///
7684    /// Sets the channel to shutdown if an error occurs.
7685    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
7686        let _result = self.send_raw(start_time);
7687        if _result.is_err() {
7688            self.control_handle.shutdown();
7689        }
7690        self.drop_without_shutdown();
7691        _result
7692    }
7693
7694    /// Similar to "send" but does not shutdown the channel if an error occurs.
7695    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
7696        let _result = self.send_raw(start_time);
7697        self.drop_without_shutdown();
7698        _result
7699    }
7700
7701    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
7702        self.control_handle.inner.send::<RingBufferStartResponse>(
7703            (start_time,),
7704            self.tx_id,
7705            0x5dd780a769a8892d,
7706            fidl::encoding::DynamicFlags::empty(),
7707        )
7708    }
7709}
7710
7711#[must_use = "FIDL methods require a response to be sent"]
7712#[derive(Debug)]
7713pub struct RingBufferStopResponder {
7714    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7715    tx_id: u32,
7716}
7717
7718/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7719/// if the responder is dropped without sending a response, so that the client
7720/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7721impl std::ops::Drop for RingBufferStopResponder {
7722    fn drop(&mut self) {
7723        self.control_handle.shutdown();
7724        // Safety: drops once, never accessed again
7725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7726    }
7727}
7728
7729impl fidl::endpoints::Responder for RingBufferStopResponder {
7730    type ControlHandle = RingBufferControlHandle;
7731
7732    fn control_handle(&self) -> &RingBufferControlHandle {
7733        &self.control_handle
7734    }
7735
7736    fn drop_without_shutdown(mut self) {
7737        // Safety: drops once, never accessed again due to mem::forget
7738        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7739        // Prevent Drop from running (which would shut down the channel)
7740        std::mem::forget(self);
7741    }
7742}
7743
7744impl RingBufferStopResponder {
7745    /// Sends a response to the FIDL transaction.
7746    ///
7747    /// Sets the channel to shutdown if an error occurs.
7748    pub fn send(self) -> Result<(), fidl::Error> {
7749        let _result = self.send_raw();
7750        if _result.is_err() {
7751            self.control_handle.shutdown();
7752        }
7753        self.drop_without_shutdown();
7754        _result
7755    }
7756
7757    /// Similar to "send" but does not shutdown the channel if an error occurs.
7758    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7759        let _result = self.send_raw();
7760        self.drop_without_shutdown();
7761        _result
7762    }
7763
7764    fn send_raw(&self) -> Result<(), fidl::Error> {
7765        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7766            (),
7767            self.tx_id,
7768            0x49a73d9cf1d4e110,
7769            fidl::encoding::DynamicFlags::empty(),
7770        )
7771    }
7772}
7773
7774#[must_use = "FIDL methods require a response to be sent"]
7775#[derive(Debug)]
7776pub struct RingBufferSetActiveChannelsResponder {
7777    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7778    tx_id: u32,
7779}
7780
7781/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7782/// if the responder is dropped without sending a response, so that the client
7783/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7784impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
7785    fn drop(&mut self) {
7786        self.control_handle.shutdown();
7787        // Safety: drops once, never accessed again
7788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7789    }
7790}
7791
7792impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
7793    type ControlHandle = RingBufferControlHandle;
7794
7795    fn control_handle(&self) -> &RingBufferControlHandle {
7796        &self.control_handle
7797    }
7798
7799    fn drop_without_shutdown(mut self) {
7800        // Safety: drops once, never accessed again due to mem::forget
7801        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7802        // Prevent Drop from running (which would shut down the channel)
7803        std::mem::forget(self);
7804    }
7805}
7806
7807impl RingBufferSetActiveChannelsResponder {
7808    /// Sends a response to the FIDL transaction.
7809    ///
7810    /// Sets the channel to shutdown if an error occurs.
7811    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7812        let _result = self.send_raw(result);
7813        if _result.is_err() {
7814            self.control_handle.shutdown();
7815        }
7816        self.drop_without_shutdown();
7817        _result
7818    }
7819
7820    /// Similar to "send" but does not shutdown the channel if an error occurs.
7821    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7822        let _result = self.send_raw(result);
7823        self.drop_without_shutdown();
7824        _result
7825    }
7826
7827    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7828        self.control_handle.inner.send::<fidl::encoding::ResultType<
7829            RingBufferSetActiveChannelsResponse,
7830            i32,
7831        >>(
7832            result.map(|set_time| (set_time,)),
7833            self.tx_id,
7834            0x605464c1d384f309,
7835            fidl::encoding::DynamicFlags::empty(),
7836        )
7837    }
7838}
7839
7840#[must_use = "FIDL methods require a response to be sent"]
7841#[derive(Debug)]
7842pub struct RingBufferWatchDelayInfoResponder {
7843    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7844    tx_id: u32,
7845}
7846
7847/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7848/// if the responder is dropped without sending a response, so that the client
7849/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7850impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
7851    fn drop(&mut self) {
7852        self.control_handle.shutdown();
7853        // Safety: drops once, never accessed again
7854        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7855    }
7856}
7857
7858impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
7859    type ControlHandle = RingBufferControlHandle;
7860
7861    fn control_handle(&self) -> &RingBufferControlHandle {
7862        &self.control_handle
7863    }
7864
7865    fn drop_without_shutdown(mut self) {
7866        // Safety: drops once, never accessed again due to mem::forget
7867        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7868        // Prevent Drop from running (which would shut down the channel)
7869        std::mem::forget(self);
7870    }
7871}
7872
7873impl RingBufferWatchDelayInfoResponder {
7874    /// Sends a response to the FIDL transaction.
7875    ///
7876    /// Sets the channel to shutdown if an error occurs.
7877    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7878        let _result = self.send_raw(delay_info);
7879        if _result.is_err() {
7880            self.control_handle.shutdown();
7881        }
7882        self.drop_without_shutdown();
7883        _result
7884    }
7885
7886    /// Similar to "send" but does not shutdown the channel if an error occurs.
7887    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7888        let _result = self.send_raw(delay_info);
7889        self.drop_without_shutdown();
7890        _result
7891    }
7892
7893    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
7894        self.control_handle
7895            .inner
7896            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
7897                fidl::encoding::Flexible::new((delay_info,)),
7898                self.tx_id,
7899                0x6c1248db213fcf9f,
7900                fidl::encoding::DynamicFlags::FLEXIBLE,
7901            )
7902    }
7903}
7904
7905#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7906pub struct StreamConfigMarker;
7907
7908impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
7909    type Proxy = StreamConfigProxy;
7910    type RequestStream = StreamConfigRequestStream;
7911    #[cfg(target_os = "fuchsia")]
7912    type SynchronousProxy = StreamConfigSynchronousProxy;
7913
7914    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
7915}
7916
7917pub trait StreamConfigProxyInterface: Send + Sync {
7918    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
7919        + Send;
7920    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
7921    fn r#signal_processing_connect(
7922        &self,
7923        protocol: fidl::endpoints::ServerEnd<
7924            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
7925        >,
7926    ) -> Result<(), fidl::Error>;
7927    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
7928        + Send;
7929    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
7930    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
7931        + Send;
7932    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
7933    fn r#create_ring_buffer(
7934        &self,
7935        format: &Format,
7936        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
7937    ) -> Result<(), fidl::Error>;
7938    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
7939        + Send;
7940    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
7941    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
7942    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
7943        + Send;
7944    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
7945}
7946#[derive(Debug)]
7947#[cfg(target_os = "fuchsia")]
7948pub struct StreamConfigSynchronousProxy {
7949    client: fidl::client::sync::Client,
7950}
7951
7952#[cfg(target_os = "fuchsia")]
7953impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
7954    type Proxy = StreamConfigProxy;
7955    type Protocol = StreamConfigMarker;
7956
7957    fn from_channel(inner: fidl::Channel) -> Self {
7958        Self::new(inner)
7959    }
7960
7961    fn into_channel(self) -> fidl::Channel {
7962        self.client.into_channel()
7963    }
7964
7965    fn as_channel(&self) -> &fidl::Channel {
7966        self.client.as_channel()
7967    }
7968}
7969
7970#[cfg(target_os = "fuchsia")]
7971impl StreamConfigSynchronousProxy {
7972    pub fn new(channel: fidl::Channel) -> Self {
7973        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7974        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7975    }
7976
7977    pub fn into_channel(self) -> fidl::Channel {
7978        self.client.into_channel()
7979    }
7980
7981    /// Waits until an event arrives and returns it. It is safe for other
7982    /// threads to make concurrent requests while waiting for an event.
7983    pub fn wait_for_event(
7984        &self,
7985        deadline: zx::MonotonicInstant,
7986    ) -> Result<StreamConfigEvent, fidl::Error> {
7987        StreamConfigEvent::decode(self.client.wait_for_event(deadline)?)
7988    }
7989
7990    /// Retrieves top level health state.
7991    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
7992    pub fn r#get_health_state(
7993        &self,
7994        ___deadline: zx::MonotonicInstant,
7995    ) -> Result<HealthState, fidl::Error> {
7996        let _response =
7997            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
7998                (),
7999                0x4e146d6bca733a84,
8000                fidl::encoding::DynamicFlags::empty(),
8001                ___deadline,
8002            )?;
8003        Ok(_response.state)
8004    }
8005
8006    /// Connect to a `SignalProcessing` protocol.
8007    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8008    /// the maximum number of connections have already been created, for instance one, then the
8009    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8010    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8011    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8012    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8013    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8014    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8015    /// is intended to be composed, and hence the more verbose name allows differentiation and
8016    /// improved clarity.
8017    pub fn r#signal_processing_connect(
8018        &self,
8019        mut protocol: fidl::endpoints::ServerEnd<
8020            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8021        >,
8022    ) -> Result<(), fidl::Error> {
8023        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8024            (protocol,),
8025            0xa81907ce6066295,
8026            fidl::encoding::DynamicFlags::empty(),
8027        )
8028    }
8029
8030    /// Retrieves top level static properties.
8031    pub fn r#get_properties(
8032        &self,
8033        ___deadline: zx::MonotonicInstant,
8034    ) -> Result<StreamProperties, fidl::Error> {
8035        let _response = self
8036            .client
8037            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetPropertiesResponse>(
8038                (),
8039                0x7d89c02f3e2d3c01,
8040                fidl::encoding::DynamicFlags::empty(),
8041                ___deadline,
8042            )?;
8043        Ok(_response.properties)
8044    }
8045
8046    /// Gets formats supported by a given driver. When not all combinations supported by the
8047    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8048    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8049    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8050    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8051    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8052    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8053    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8054    /// <<16bits,32bits>,<48KHz,96KHz>>.
8055    pub fn r#get_supported_formats(
8056        &self,
8057        ___deadline: zx::MonotonicInstant,
8058    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8059        let _response = self
8060            .client
8061            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetSupportedFormatsResponse>(
8062                (),
8063                0x448efa7850cafe7e,
8064                fidl::encoding::DynamicFlags::empty(),
8065                ___deadline,
8066            )?;
8067        Ok(_response.supported_formats)
8068    }
8069
8070    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8071    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8072    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8073    /// ring buffer channel had been established and was still active, the driver must close that
8074    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8075    /// operations in the process.
8076    pub fn r#create_ring_buffer(
8077        &self,
8078        mut format: &Format,
8079        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8080    ) -> Result<(), fidl::Error> {
8081        self.client.send::<StreamConfigCreateRingBufferRequest>(
8082            (format, ring_buffer),
8083            0x2afb19dd13faa1ba,
8084            fidl::encoding::DynamicFlags::empty(),
8085        )
8086    }
8087
8088    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8089    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8090    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8091    /// from what was most recently reported.
8092    /// If `WatchGainState` is called for a second time before the first call has completed, then
8093    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8094    pub fn r#watch_gain_state(
8095        &self,
8096        ___deadline: zx::MonotonicInstant,
8097    ) -> Result<GainState, fidl::Error> {
8098        let _response = self
8099            .client
8100            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchGainStateResponse>(
8101                (),
8102                0x4772506136ab65c1,
8103                fidl::encoding::DynamicFlags::empty(),
8104                ___deadline,
8105            )?;
8106        Ok(_response.gain_state)
8107    }
8108
8109    /// Client update of the gain state.
8110    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8111        self.client.send::<StreamConfigSetGainRequest>(
8112            (target_state,),
8113            0x3943b41498c6a384,
8114            fidl::encoding::DynamicFlags::empty(),
8115        )
8116    }
8117
8118    /// Get the plug detect state via a hanging get. The driver will reply to the first
8119    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8120    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8121    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8122    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8123    pub fn r#watch_plug_state(
8124        &self,
8125        ___deadline: zx::MonotonicInstant,
8126    ) -> Result<PlugState, fidl::Error> {
8127        let _response = self
8128            .client
8129            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchPlugStateResponse>(
8130                (),
8131                0x497345a6f048b2a6,
8132                fidl::encoding::DynamicFlags::empty(),
8133                ___deadline,
8134            )?;
8135        Ok(_response.plug_state)
8136    }
8137}
8138
8139#[derive(Debug, Clone)]
8140pub struct StreamConfigProxy {
8141    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8142}
8143
8144impl fidl::endpoints::Proxy for StreamConfigProxy {
8145    type Protocol = StreamConfigMarker;
8146
8147    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8148        Self::new(inner)
8149    }
8150
8151    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8152        self.client.into_channel().map_err(|client| Self { client })
8153    }
8154
8155    fn as_channel(&self) -> &::fidl::AsyncChannel {
8156        self.client.as_channel()
8157    }
8158}
8159
8160impl StreamConfigProxy {
8161    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
8162    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8163        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8164        Self { client: fidl::client::Client::new(channel, protocol_name) }
8165    }
8166
8167    /// Get a Stream of events from the remote end of the protocol.
8168    ///
8169    /// # Panics
8170    ///
8171    /// Panics if the event stream was already taken.
8172    pub fn take_event_stream(&self) -> StreamConfigEventStream {
8173        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
8174    }
8175
8176    /// Retrieves top level health state.
8177    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8178    pub fn r#get_health_state(
8179        &self,
8180    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
8181    {
8182        StreamConfigProxyInterface::r#get_health_state(self)
8183    }
8184
8185    /// Connect to a `SignalProcessing` protocol.
8186    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8187    /// the maximum number of connections have already been created, for instance one, then the
8188    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8189    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8190    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8191    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8192    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8193    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8194    /// is intended to be composed, and hence the more verbose name allows differentiation and
8195    /// improved clarity.
8196    pub fn r#signal_processing_connect(
8197        &self,
8198        mut protocol: fidl::endpoints::ServerEnd<
8199            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8200        >,
8201    ) -> Result<(), fidl::Error> {
8202        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
8203    }
8204
8205    /// Retrieves top level static properties.
8206    pub fn r#get_properties(
8207        &self,
8208    ) -> fidl::client::QueryResponseFut<
8209        StreamProperties,
8210        fidl::encoding::DefaultFuchsiaResourceDialect,
8211    > {
8212        StreamConfigProxyInterface::r#get_properties(self)
8213    }
8214
8215    /// Gets formats supported by a given driver. When not all combinations supported by the
8216    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8217    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8218    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8219    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8220    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8221    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8222    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8223    /// <<16bits,32bits>,<48KHz,96KHz>>.
8224    pub fn r#get_supported_formats(
8225        &self,
8226    ) -> fidl::client::QueryResponseFut<
8227        Vec<SupportedFormats>,
8228        fidl::encoding::DefaultFuchsiaResourceDialect,
8229    > {
8230        StreamConfigProxyInterface::r#get_supported_formats(self)
8231    }
8232
8233    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8234    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8235    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8236    /// ring buffer channel had been established and was still active, the driver must close that
8237    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8238    /// operations in the process.
8239    pub fn r#create_ring_buffer(
8240        &self,
8241        mut format: &Format,
8242        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8243    ) -> Result<(), fidl::Error> {
8244        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
8245    }
8246
8247    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8248    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8249    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8250    /// from what was most recently reported.
8251    /// If `WatchGainState` is called for a second time before the first call has completed, then
8252    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8253    pub fn r#watch_gain_state(
8254        &self,
8255    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
8256    {
8257        StreamConfigProxyInterface::r#watch_gain_state(self)
8258    }
8259
8260    /// Client update of the gain state.
8261    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8262        StreamConfigProxyInterface::r#set_gain(self, target_state)
8263    }
8264
8265    /// Get the plug detect state via a hanging get. The driver will reply to the first
8266    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8267    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8268    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8269    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8270    pub fn r#watch_plug_state(
8271        &self,
8272    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
8273    {
8274        StreamConfigProxyInterface::r#watch_plug_state(self)
8275    }
8276}
8277
8278impl StreamConfigProxyInterface for StreamConfigProxy {
8279    type GetHealthStateResponseFut =
8280        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8281    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
8282        fn _decode(
8283            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8284        ) -> Result<HealthState, fidl::Error> {
8285            let _response = fidl::client::decode_transaction_body::<
8286                HealthGetHealthStateResponse,
8287                fidl::encoding::DefaultFuchsiaResourceDialect,
8288                0x4e146d6bca733a84,
8289            >(_buf?)?;
8290            Ok(_response.state)
8291        }
8292        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
8293            (),
8294            0x4e146d6bca733a84,
8295            fidl::encoding::DynamicFlags::empty(),
8296            _decode,
8297        )
8298    }
8299
8300    fn r#signal_processing_connect(
8301        &self,
8302        mut protocol: fidl::endpoints::ServerEnd<
8303            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8304        >,
8305    ) -> Result<(), fidl::Error> {
8306        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8307            (protocol,),
8308            0xa81907ce6066295,
8309            fidl::encoding::DynamicFlags::empty(),
8310        )
8311    }
8312
8313    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8314        StreamProperties,
8315        fidl::encoding::DefaultFuchsiaResourceDialect,
8316    >;
8317    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8318        fn _decode(
8319            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8320        ) -> Result<StreamProperties, fidl::Error> {
8321            let _response = fidl::client::decode_transaction_body::<
8322                StreamConfigGetPropertiesResponse,
8323                fidl::encoding::DefaultFuchsiaResourceDialect,
8324                0x7d89c02f3e2d3c01,
8325            >(_buf?)?;
8326            Ok(_response.properties)
8327        }
8328        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
8329            (),
8330            0x7d89c02f3e2d3c01,
8331            fidl::encoding::DynamicFlags::empty(),
8332            _decode,
8333        )
8334    }
8335
8336    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
8337        Vec<SupportedFormats>,
8338        fidl::encoding::DefaultFuchsiaResourceDialect,
8339    >;
8340    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
8341        fn _decode(
8342            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8343        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8344            let _response = fidl::client::decode_transaction_body::<
8345                StreamConfigGetSupportedFormatsResponse,
8346                fidl::encoding::DefaultFuchsiaResourceDialect,
8347                0x448efa7850cafe7e,
8348            >(_buf?)?;
8349            Ok(_response.supported_formats)
8350        }
8351        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
8352            (),
8353            0x448efa7850cafe7e,
8354            fidl::encoding::DynamicFlags::empty(),
8355            _decode,
8356        )
8357    }
8358
8359    fn r#create_ring_buffer(
8360        &self,
8361        mut format: &Format,
8362        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8363    ) -> Result<(), fidl::Error> {
8364        self.client.send::<StreamConfigCreateRingBufferRequest>(
8365            (format, ring_buffer),
8366            0x2afb19dd13faa1ba,
8367            fidl::encoding::DynamicFlags::empty(),
8368        )
8369    }
8370
8371    type WatchGainStateResponseFut =
8372        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8373    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
8374        fn _decode(
8375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8376        ) -> Result<GainState, fidl::Error> {
8377            let _response = fidl::client::decode_transaction_body::<
8378                StreamConfigWatchGainStateResponse,
8379                fidl::encoding::DefaultFuchsiaResourceDialect,
8380                0x4772506136ab65c1,
8381            >(_buf?)?;
8382            Ok(_response.gain_state)
8383        }
8384        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
8385            (),
8386            0x4772506136ab65c1,
8387            fidl::encoding::DynamicFlags::empty(),
8388            _decode,
8389        )
8390    }
8391
8392    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8393        self.client.send::<StreamConfigSetGainRequest>(
8394            (target_state,),
8395            0x3943b41498c6a384,
8396            fidl::encoding::DynamicFlags::empty(),
8397        )
8398    }
8399
8400    type WatchPlugStateResponseFut =
8401        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8402    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
8403        fn _decode(
8404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8405        ) -> Result<PlugState, fidl::Error> {
8406            let _response = fidl::client::decode_transaction_body::<
8407                StreamConfigWatchPlugStateResponse,
8408                fidl::encoding::DefaultFuchsiaResourceDialect,
8409                0x497345a6f048b2a6,
8410            >(_buf?)?;
8411            Ok(_response.plug_state)
8412        }
8413        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
8414            (),
8415            0x497345a6f048b2a6,
8416            fidl::encoding::DynamicFlags::empty(),
8417            _decode,
8418        )
8419    }
8420}
8421
8422pub struct StreamConfigEventStream {
8423    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8424}
8425
8426impl std::marker::Unpin for StreamConfigEventStream {}
8427
8428impl futures::stream::FusedStream for StreamConfigEventStream {
8429    fn is_terminated(&self) -> bool {
8430        self.event_receiver.is_terminated()
8431    }
8432}
8433
8434impl futures::Stream for StreamConfigEventStream {
8435    type Item = Result<StreamConfigEvent, fidl::Error>;
8436
8437    fn poll_next(
8438        mut self: std::pin::Pin<&mut Self>,
8439        cx: &mut std::task::Context<'_>,
8440    ) -> std::task::Poll<Option<Self::Item>> {
8441        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8442            &mut self.event_receiver,
8443            cx
8444        )?) {
8445            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
8446            None => std::task::Poll::Ready(None),
8447        }
8448    }
8449}
8450
8451#[derive(Debug)]
8452pub enum StreamConfigEvent {}
8453
8454impl StreamConfigEvent {
8455    /// Decodes a message buffer as a [`StreamConfigEvent`].
8456    fn decode(
8457        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8458    ) -> Result<StreamConfigEvent, fidl::Error> {
8459        let (bytes, _handles) = buf.split_mut();
8460        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8461        debug_assert_eq!(tx_header.tx_id, 0);
8462        match tx_header.ordinal {
8463            _ => Err(fidl::Error::UnknownOrdinal {
8464                ordinal: tx_header.ordinal,
8465                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8466            }),
8467        }
8468    }
8469}
8470
8471/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
8472pub struct StreamConfigRequestStream {
8473    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8474    is_terminated: bool,
8475}
8476
8477impl std::marker::Unpin for StreamConfigRequestStream {}
8478
8479impl futures::stream::FusedStream for StreamConfigRequestStream {
8480    fn is_terminated(&self) -> bool {
8481        self.is_terminated
8482    }
8483}
8484
8485impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
8486    type Protocol = StreamConfigMarker;
8487    type ControlHandle = StreamConfigControlHandle;
8488
8489    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8490        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8491    }
8492
8493    fn control_handle(&self) -> Self::ControlHandle {
8494        StreamConfigControlHandle { inner: self.inner.clone() }
8495    }
8496
8497    fn into_inner(
8498        self,
8499    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8500    {
8501        (self.inner, self.is_terminated)
8502    }
8503
8504    fn from_inner(
8505        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8506        is_terminated: bool,
8507    ) -> Self {
8508        Self { inner, is_terminated }
8509    }
8510}
8511
8512impl futures::Stream for StreamConfigRequestStream {
8513    type Item = Result<StreamConfigRequest, fidl::Error>;
8514
8515    fn poll_next(
8516        mut self: std::pin::Pin<&mut Self>,
8517        cx: &mut std::task::Context<'_>,
8518    ) -> std::task::Poll<Option<Self::Item>> {
8519        let this = &mut *self;
8520        if this.inner.check_shutdown(cx) {
8521            this.is_terminated = true;
8522            return std::task::Poll::Ready(None);
8523        }
8524        if this.is_terminated {
8525            panic!("polled StreamConfigRequestStream after completion");
8526        }
8527        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8528            |bytes, handles| {
8529                match this.inner.channel().read_etc(cx, bytes, handles) {
8530                    std::task::Poll::Ready(Ok(())) => {}
8531                    std::task::Poll::Pending => return std::task::Poll::Pending,
8532                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8533                        this.is_terminated = true;
8534                        return std::task::Poll::Ready(None);
8535                    }
8536                    std::task::Poll::Ready(Err(e)) => {
8537                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8538                            e.into(),
8539                        ))))
8540                    }
8541                }
8542
8543                // A message has been received from the channel
8544                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8545
8546                std::task::Poll::Ready(Some(match header.ordinal {
8547                    0x4e146d6bca733a84 => {
8548                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8549                        let mut req = fidl::new_empty!(
8550                            fidl::encoding::EmptyPayload,
8551                            fidl::encoding::DefaultFuchsiaResourceDialect
8552                        );
8553                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8554                        let control_handle =
8555                            StreamConfigControlHandle { inner: this.inner.clone() };
8556                        Ok(StreamConfigRequest::GetHealthState {
8557                            responder: StreamConfigGetHealthStateResponder {
8558                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8559                                tx_id: header.tx_id,
8560                            },
8561                        })
8562                    }
8563                    0xa81907ce6066295 => {
8564                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8565                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8566                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8567                        let control_handle =
8568                            StreamConfigControlHandle { inner: this.inner.clone() };
8569                        Ok(StreamConfigRequest::SignalProcessingConnect {
8570                            protocol: req.protocol,
8571
8572                            control_handle,
8573                        })
8574                    }
8575                    0x7d89c02f3e2d3c01 => {
8576                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8577                        let mut req = fidl::new_empty!(
8578                            fidl::encoding::EmptyPayload,
8579                            fidl::encoding::DefaultFuchsiaResourceDialect
8580                        );
8581                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8582                        let control_handle =
8583                            StreamConfigControlHandle { inner: this.inner.clone() };
8584                        Ok(StreamConfigRequest::GetProperties {
8585                            responder: StreamConfigGetPropertiesResponder {
8586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8587                                tx_id: header.tx_id,
8588                            },
8589                        })
8590                    }
8591                    0x448efa7850cafe7e => {
8592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8593                        let mut req = fidl::new_empty!(
8594                            fidl::encoding::EmptyPayload,
8595                            fidl::encoding::DefaultFuchsiaResourceDialect
8596                        );
8597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8598                        let control_handle =
8599                            StreamConfigControlHandle { inner: this.inner.clone() };
8600                        Ok(StreamConfigRequest::GetSupportedFormats {
8601                            responder: StreamConfigGetSupportedFormatsResponder {
8602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8603                                tx_id: header.tx_id,
8604                            },
8605                        })
8606                    }
8607                    0x2afb19dd13faa1ba => {
8608                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8609                        let mut req = fidl::new_empty!(
8610                            StreamConfigCreateRingBufferRequest,
8611                            fidl::encoding::DefaultFuchsiaResourceDialect
8612                        );
8613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
8614                        let control_handle =
8615                            StreamConfigControlHandle { inner: this.inner.clone() };
8616                        Ok(StreamConfigRequest::CreateRingBuffer {
8617                            format: req.format,
8618                            ring_buffer: req.ring_buffer,
8619
8620                            control_handle,
8621                        })
8622                    }
8623                    0x4772506136ab65c1 => {
8624                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8625                        let mut req = fidl::new_empty!(
8626                            fidl::encoding::EmptyPayload,
8627                            fidl::encoding::DefaultFuchsiaResourceDialect
8628                        );
8629                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8630                        let control_handle =
8631                            StreamConfigControlHandle { inner: this.inner.clone() };
8632                        Ok(StreamConfigRequest::WatchGainState {
8633                            responder: StreamConfigWatchGainStateResponder {
8634                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8635                                tx_id: header.tx_id,
8636                            },
8637                        })
8638                    }
8639                    0x3943b41498c6a384 => {
8640                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8641                        let mut req = fidl::new_empty!(
8642                            StreamConfigSetGainRequest,
8643                            fidl::encoding::DefaultFuchsiaResourceDialect
8644                        );
8645                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
8646                        let control_handle =
8647                            StreamConfigControlHandle { inner: this.inner.clone() };
8648                        Ok(StreamConfigRequest::SetGain {
8649                            target_state: req.target_state,
8650
8651                            control_handle,
8652                        })
8653                    }
8654                    0x497345a6f048b2a6 => {
8655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8656                        let mut req = fidl::new_empty!(
8657                            fidl::encoding::EmptyPayload,
8658                            fidl::encoding::DefaultFuchsiaResourceDialect
8659                        );
8660                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8661                        let control_handle =
8662                            StreamConfigControlHandle { inner: this.inner.clone() };
8663                        Ok(StreamConfigRequest::WatchPlugState {
8664                            responder: StreamConfigWatchPlugStateResponder {
8665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8666                                tx_id: header.tx_id,
8667                            },
8668                        })
8669                    }
8670                    _ => Err(fidl::Error::UnknownOrdinal {
8671                        ordinal: header.ordinal,
8672                        protocol_name:
8673                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8674                    }),
8675                }))
8676            },
8677        )
8678    }
8679}
8680
8681/// For an overview see
8682/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
8683/// # Deprecation
8684///
8685/// Not supported anymore, instead use an
8686/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
8687/// with one Ring Buffer, see
8688/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
8689#[derive(Debug)]
8690pub enum StreamConfigRequest {
8691    /// Retrieves top level health state.
8692    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8693    GetHealthState { responder: StreamConfigGetHealthStateResponder },
8694    /// Connect to a `SignalProcessing` protocol.
8695    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8696    /// the maximum number of connections have already been created, for instance one, then the
8697    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8698    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8699    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8700    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8701    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8702    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8703    /// is intended to be composed, and hence the more verbose name allows differentiation and
8704    /// improved clarity.
8705    SignalProcessingConnect {
8706        protocol: fidl::endpoints::ServerEnd<
8707            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8708        >,
8709        control_handle: StreamConfigControlHandle,
8710    },
8711    /// Retrieves top level static properties.
8712    GetProperties { responder: StreamConfigGetPropertiesResponder },
8713    /// Gets formats supported by a given driver. When not all combinations supported by the
8714    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8715    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8716    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8717    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8718    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8719    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8720    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8721    /// <<16bits,32bits>,<48KHz,96KHz>>.
8722    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
8723    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8724    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8725    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8726    /// ring buffer channel had been established and was still active, the driver must close that
8727    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8728    /// operations in the process.
8729    CreateRingBuffer {
8730        format: Format,
8731        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8732        control_handle: StreamConfigControlHandle,
8733    },
8734    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8735    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8736    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8737    /// from what was most recently reported.
8738    /// If `WatchGainState` is called for a second time before the first call has completed, then
8739    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8740    WatchGainState { responder: StreamConfigWatchGainStateResponder },
8741    /// Client update of the gain state.
8742    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
8743    /// Get the plug detect state via a hanging get. The driver will reply to the first
8744    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8745    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8746    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8747    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8748    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
8749}
8750
8751impl StreamConfigRequest {
8752    #[allow(irrefutable_let_patterns)]
8753    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
8754        if let StreamConfigRequest::GetHealthState { responder } = self {
8755            Some((responder))
8756        } else {
8757            None
8758        }
8759    }
8760
8761    #[allow(irrefutable_let_patterns)]
8762    pub fn into_signal_processing_connect(
8763        self,
8764    ) -> Option<(
8765        fidl::endpoints::ServerEnd<
8766            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8767        >,
8768        StreamConfigControlHandle,
8769    )> {
8770        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
8771            Some((protocol, control_handle))
8772        } else {
8773            None
8774        }
8775    }
8776
8777    #[allow(irrefutable_let_patterns)]
8778    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
8779        if let StreamConfigRequest::GetProperties { responder } = self {
8780            Some((responder))
8781        } else {
8782            None
8783        }
8784    }
8785
8786    #[allow(irrefutable_let_patterns)]
8787    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
8788        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
8789            Some((responder))
8790        } else {
8791            None
8792        }
8793    }
8794
8795    #[allow(irrefutable_let_patterns)]
8796    pub fn into_create_ring_buffer(
8797        self,
8798    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
8799    {
8800        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
8801        {
8802            Some((format, ring_buffer, control_handle))
8803        } else {
8804            None
8805        }
8806    }
8807
8808    #[allow(irrefutable_let_patterns)]
8809    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
8810        if let StreamConfigRequest::WatchGainState { responder } = self {
8811            Some((responder))
8812        } else {
8813            None
8814        }
8815    }
8816
8817    #[allow(irrefutable_let_patterns)]
8818    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
8819        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
8820            Some((target_state, control_handle))
8821        } else {
8822            None
8823        }
8824    }
8825
8826    #[allow(irrefutable_let_patterns)]
8827    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
8828        if let StreamConfigRequest::WatchPlugState { responder } = self {
8829            Some((responder))
8830        } else {
8831            None
8832        }
8833    }
8834
8835    /// Name of the method defined in FIDL
8836    pub fn method_name(&self) -> &'static str {
8837        match *self {
8838            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
8839            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
8840            StreamConfigRequest::GetProperties { .. } => "get_properties",
8841            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
8842            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
8843            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
8844            StreamConfigRequest::SetGain { .. } => "set_gain",
8845            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
8846        }
8847    }
8848}
8849
8850#[derive(Debug, Clone)]
8851pub struct StreamConfigControlHandle {
8852    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8853}
8854
8855impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
8856    fn shutdown(&self) {
8857        self.inner.shutdown()
8858    }
8859    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8860        self.inner.shutdown_with_epitaph(status)
8861    }
8862
8863    fn is_closed(&self) -> bool {
8864        self.inner.channel().is_closed()
8865    }
8866    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8867        self.inner.channel().on_closed()
8868    }
8869
8870    #[cfg(target_os = "fuchsia")]
8871    fn signal_peer(
8872        &self,
8873        clear_mask: zx::Signals,
8874        set_mask: zx::Signals,
8875    ) -> Result<(), zx_status::Status> {
8876        use fidl::Peered;
8877        self.inner.channel().signal_peer(clear_mask, set_mask)
8878    }
8879}
8880
8881impl StreamConfigControlHandle {}
8882
8883#[must_use = "FIDL methods require a response to be sent"]
8884#[derive(Debug)]
8885pub struct StreamConfigGetHealthStateResponder {
8886    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8887    tx_id: u32,
8888}
8889
8890/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8891/// if the responder is dropped without sending a response, so that the client
8892/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8893impl std::ops::Drop for StreamConfigGetHealthStateResponder {
8894    fn drop(&mut self) {
8895        self.control_handle.shutdown();
8896        // Safety: drops once, never accessed again
8897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8898    }
8899}
8900
8901impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
8902    type ControlHandle = StreamConfigControlHandle;
8903
8904    fn control_handle(&self) -> &StreamConfigControlHandle {
8905        &self.control_handle
8906    }
8907
8908    fn drop_without_shutdown(mut self) {
8909        // Safety: drops once, never accessed again due to mem::forget
8910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8911        // Prevent Drop from running (which would shut down the channel)
8912        std::mem::forget(self);
8913    }
8914}
8915
8916impl StreamConfigGetHealthStateResponder {
8917    /// Sends a response to the FIDL transaction.
8918    ///
8919    /// Sets the channel to shutdown if an error occurs.
8920    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8921        let _result = self.send_raw(state);
8922        if _result.is_err() {
8923            self.control_handle.shutdown();
8924        }
8925        self.drop_without_shutdown();
8926        _result
8927    }
8928
8929    /// Similar to "send" but does not shutdown the channel if an error occurs.
8930    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
8931        let _result = self.send_raw(state);
8932        self.drop_without_shutdown();
8933        _result
8934    }
8935
8936    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
8937        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
8938            (state,),
8939            self.tx_id,
8940            0x4e146d6bca733a84,
8941            fidl::encoding::DynamicFlags::empty(),
8942        )
8943    }
8944}
8945
8946#[must_use = "FIDL methods require a response to be sent"]
8947#[derive(Debug)]
8948pub struct StreamConfigGetPropertiesResponder {
8949    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
8950    tx_id: u32,
8951}
8952
8953/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
8954/// if the responder is dropped without sending a response, so that the client
8955/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8956impl std::ops::Drop for StreamConfigGetPropertiesResponder {
8957    fn drop(&mut self) {
8958        self.control_handle.shutdown();
8959        // Safety: drops once, never accessed again
8960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8961    }
8962}
8963
8964impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
8965    type ControlHandle = StreamConfigControlHandle;
8966
8967    fn control_handle(&self) -> &StreamConfigControlHandle {
8968        &self.control_handle
8969    }
8970
8971    fn drop_without_shutdown(mut self) {
8972        // Safety: drops once, never accessed again due to mem::forget
8973        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8974        // Prevent Drop from running (which would shut down the channel)
8975        std::mem::forget(self);
8976    }
8977}
8978
8979impl StreamConfigGetPropertiesResponder {
8980    /// Sends a response to the FIDL transaction.
8981    ///
8982    /// Sets the channel to shutdown if an error occurs.
8983    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
8984        let _result = self.send_raw(properties);
8985        if _result.is_err() {
8986            self.control_handle.shutdown();
8987        }
8988        self.drop_without_shutdown();
8989        _result
8990    }
8991
8992    /// Similar to "send" but does not shutdown the channel if an error occurs.
8993    pub fn send_no_shutdown_on_err(
8994        self,
8995        mut properties: &StreamProperties,
8996    ) -> Result<(), fidl::Error> {
8997        let _result = self.send_raw(properties);
8998        self.drop_without_shutdown();
8999        _result
9000    }
9001
9002    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
9003        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
9004            (properties,),
9005            self.tx_id,
9006            0x7d89c02f3e2d3c01,
9007            fidl::encoding::DynamicFlags::empty(),
9008        )
9009    }
9010}
9011
9012#[must_use = "FIDL methods require a response to be sent"]
9013#[derive(Debug)]
9014pub struct StreamConfigGetSupportedFormatsResponder {
9015    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9016    tx_id: u32,
9017}
9018
9019/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9020/// if the responder is dropped without sending a response, so that the client
9021/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9022impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
9023    fn drop(&mut self) {
9024        self.control_handle.shutdown();
9025        // Safety: drops once, never accessed again
9026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9027    }
9028}
9029
9030impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
9031    type ControlHandle = StreamConfigControlHandle;
9032
9033    fn control_handle(&self) -> &StreamConfigControlHandle {
9034        &self.control_handle
9035    }
9036
9037    fn drop_without_shutdown(mut self) {
9038        // Safety: drops once, never accessed again due to mem::forget
9039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9040        // Prevent Drop from running (which would shut down the channel)
9041        std::mem::forget(self);
9042    }
9043}
9044
9045impl StreamConfigGetSupportedFormatsResponder {
9046    /// Sends a response to the FIDL transaction.
9047    ///
9048    /// Sets the channel to shutdown if an error occurs.
9049    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9050        let _result = self.send_raw(supported_formats);
9051        if _result.is_err() {
9052            self.control_handle.shutdown();
9053        }
9054        self.drop_without_shutdown();
9055        _result
9056    }
9057
9058    /// Similar to "send" but does not shutdown the channel if an error occurs.
9059    pub fn send_no_shutdown_on_err(
9060        self,
9061        mut supported_formats: &[SupportedFormats],
9062    ) -> Result<(), fidl::Error> {
9063        let _result = self.send_raw(supported_formats);
9064        self.drop_without_shutdown();
9065        _result
9066    }
9067
9068    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9069        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
9070            (supported_formats,),
9071            self.tx_id,
9072            0x448efa7850cafe7e,
9073            fidl::encoding::DynamicFlags::empty(),
9074        )
9075    }
9076}
9077
9078#[must_use = "FIDL methods require a response to be sent"]
9079#[derive(Debug)]
9080pub struct StreamConfigWatchGainStateResponder {
9081    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9082    tx_id: u32,
9083}
9084
9085/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9086/// if the responder is dropped without sending a response, so that the client
9087/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9088impl std::ops::Drop for StreamConfigWatchGainStateResponder {
9089    fn drop(&mut self) {
9090        self.control_handle.shutdown();
9091        // Safety: drops once, never accessed again
9092        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9093    }
9094}
9095
9096impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
9097    type ControlHandle = StreamConfigControlHandle;
9098
9099    fn control_handle(&self) -> &StreamConfigControlHandle {
9100        &self.control_handle
9101    }
9102
9103    fn drop_without_shutdown(mut self) {
9104        // Safety: drops once, never accessed again due to mem::forget
9105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9106        // Prevent Drop from running (which would shut down the channel)
9107        std::mem::forget(self);
9108    }
9109}
9110
9111impl StreamConfigWatchGainStateResponder {
9112    /// Sends a response to the FIDL transaction.
9113    ///
9114    /// Sets the channel to shutdown if an error occurs.
9115    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9116        let _result = self.send_raw(gain_state);
9117        if _result.is_err() {
9118            self.control_handle.shutdown();
9119        }
9120        self.drop_without_shutdown();
9121        _result
9122    }
9123
9124    /// Similar to "send" but does not shutdown the channel if an error occurs.
9125    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9126        let _result = self.send_raw(gain_state);
9127        self.drop_without_shutdown();
9128        _result
9129    }
9130
9131    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9132        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
9133            (gain_state,),
9134            self.tx_id,
9135            0x4772506136ab65c1,
9136            fidl::encoding::DynamicFlags::empty(),
9137        )
9138    }
9139}
9140
9141#[must_use = "FIDL methods require a response to be sent"]
9142#[derive(Debug)]
9143pub struct StreamConfigWatchPlugStateResponder {
9144    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9145    tx_id: u32,
9146}
9147
9148/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9149/// if the responder is dropped without sending a response, so that the client
9150/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9151impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
9152    fn drop(&mut self) {
9153        self.control_handle.shutdown();
9154        // Safety: drops once, never accessed again
9155        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9156    }
9157}
9158
9159impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
9160    type ControlHandle = StreamConfigControlHandle;
9161
9162    fn control_handle(&self) -> &StreamConfigControlHandle {
9163        &self.control_handle
9164    }
9165
9166    fn drop_without_shutdown(mut self) {
9167        // Safety: drops once, never accessed again due to mem::forget
9168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9169        // Prevent Drop from running (which would shut down the channel)
9170        std::mem::forget(self);
9171    }
9172}
9173
9174impl StreamConfigWatchPlugStateResponder {
9175    /// Sends a response to the FIDL transaction.
9176    ///
9177    /// Sets the channel to shutdown if an error occurs.
9178    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9179        let _result = self.send_raw(plug_state);
9180        if _result.is_err() {
9181            self.control_handle.shutdown();
9182        }
9183        self.drop_without_shutdown();
9184        _result
9185    }
9186
9187    /// Similar to "send" but does not shutdown the channel if an error occurs.
9188    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9189        let _result = self.send_raw(plug_state);
9190        self.drop_without_shutdown();
9191        _result
9192    }
9193
9194    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9195        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
9196            (plug_state,),
9197            self.tx_id,
9198            0x497345a6f048b2a6,
9199            fidl::encoding::DynamicFlags::empty(),
9200        )
9201    }
9202}
9203
9204#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9205pub struct StreamConfigConnectorMarker;
9206
9207impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
9208    type Proxy = StreamConfigConnectorProxy;
9209    type RequestStream = StreamConfigConnectorRequestStream;
9210    #[cfg(target_os = "fuchsia")]
9211    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
9212
9213    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
9214}
9215
9216pub trait StreamConfigConnectorProxyInterface: Send + Sync {
9217    fn r#connect(
9218        &self,
9219        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9220    ) -> Result<(), fidl::Error>;
9221}
9222#[derive(Debug)]
9223#[cfg(target_os = "fuchsia")]
9224pub struct StreamConfigConnectorSynchronousProxy {
9225    client: fidl::client::sync::Client,
9226}
9227
9228#[cfg(target_os = "fuchsia")]
9229impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
9230    type Proxy = StreamConfigConnectorProxy;
9231    type Protocol = StreamConfigConnectorMarker;
9232
9233    fn from_channel(inner: fidl::Channel) -> Self {
9234        Self::new(inner)
9235    }
9236
9237    fn into_channel(self) -> fidl::Channel {
9238        self.client.into_channel()
9239    }
9240
9241    fn as_channel(&self) -> &fidl::Channel {
9242        self.client.as_channel()
9243    }
9244}
9245
9246#[cfg(target_os = "fuchsia")]
9247impl StreamConfigConnectorSynchronousProxy {
9248    pub fn new(channel: fidl::Channel) -> Self {
9249        let protocol_name =
9250            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9251        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9252    }
9253
9254    pub fn into_channel(self) -> fidl::Channel {
9255        self.client.into_channel()
9256    }
9257
9258    /// Waits until an event arrives and returns it. It is safe for other
9259    /// threads to make concurrent requests while waiting for an event.
9260    pub fn wait_for_event(
9261        &self,
9262        deadline: zx::MonotonicInstant,
9263    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9264        StreamConfigConnectorEvent::decode(self.client.wait_for_event(deadline)?)
9265    }
9266
9267    /// Connect to a `StreamConfig` protocol.
9268    /// This method allows a component to serve FIDL outside the devhost's control.
9269    pub fn r#connect(
9270        &self,
9271        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9272    ) -> Result<(), fidl::Error> {
9273        self.client.send::<StreamConfigConnectorConnectRequest>(
9274            (protocol,),
9275            0x22051ff3021eafec,
9276            fidl::encoding::DynamicFlags::empty(),
9277        )
9278    }
9279}
9280
9281#[derive(Debug, Clone)]
9282pub struct StreamConfigConnectorProxy {
9283    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9284}
9285
9286impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
9287    type Protocol = StreamConfigConnectorMarker;
9288
9289    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9290        Self::new(inner)
9291    }
9292
9293    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9294        self.client.into_channel().map_err(|client| Self { client })
9295    }
9296
9297    fn as_channel(&self) -> &::fidl::AsyncChannel {
9298        self.client.as_channel()
9299    }
9300}
9301
9302impl StreamConfigConnectorProxy {
9303    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
9304    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9305        let protocol_name =
9306            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9307        Self { client: fidl::client::Client::new(channel, protocol_name) }
9308    }
9309
9310    /// Get a Stream of events from the remote end of the protocol.
9311    ///
9312    /// # Panics
9313    ///
9314    /// Panics if the event stream was already taken.
9315    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
9316        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
9317    }
9318
9319    /// Connect to a `StreamConfig` protocol.
9320    /// This method allows a component to serve FIDL outside the devhost's control.
9321    pub fn r#connect(
9322        &self,
9323        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9324    ) -> Result<(), fidl::Error> {
9325        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
9326    }
9327}
9328
9329impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
9330    fn r#connect(
9331        &self,
9332        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9333    ) -> Result<(), fidl::Error> {
9334        self.client.send::<StreamConfigConnectorConnectRequest>(
9335            (protocol,),
9336            0x22051ff3021eafec,
9337            fidl::encoding::DynamicFlags::empty(),
9338        )
9339    }
9340}
9341
9342pub struct StreamConfigConnectorEventStream {
9343    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9344}
9345
9346impl std::marker::Unpin for StreamConfigConnectorEventStream {}
9347
9348impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
9349    fn is_terminated(&self) -> bool {
9350        self.event_receiver.is_terminated()
9351    }
9352}
9353
9354impl futures::Stream for StreamConfigConnectorEventStream {
9355    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
9356
9357    fn poll_next(
9358        mut self: std::pin::Pin<&mut Self>,
9359        cx: &mut std::task::Context<'_>,
9360    ) -> std::task::Poll<Option<Self::Item>> {
9361        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9362            &mut self.event_receiver,
9363            cx
9364        )?) {
9365            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
9366            None => std::task::Poll::Ready(None),
9367        }
9368    }
9369}
9370
9371#[derive(Debug)]
9372pub enum StreamConfigConnectorEvent {}
9373
9374impl StreamConfigConnectorEvent {
9375    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
9376    fn decode(
9377        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9378    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9379        let (bytes, _handles) = buf.split_mut();
9380        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9381        debug_assert_eq!(tx_header.tx_id, 0);
9382        match tx_header.ordinal {
9383            _ => Err(fidl::Error::UnknownOrdinal {
9384                ordinal: tx_header.ordinal,
9385                protocol_name:
9386                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9387            }),
9388        }
9389    }
9390}
9391
9392/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
9393pub struct StreamConfigConnectorRequestStream {
9394    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9395    is_terminated: bool,
9396}
9397
9398impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
9399
9400impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
9401    fn is_terminated(&self) -> bool {
9402        self.is_terminated
9403    }
9404}
9405
9406impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
9407    type Protocol = StreamConfigConnectorMarker;
9408    type ControlHandle = StreamConfigConnectorControlHandle;
9409
9410    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9411        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9412    }
9413
9414    fn control_handle(&self) -> Self::ControlHandle {
9415        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
9416    }
9417
9418    fn into_inner(
9419        self,
9420    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9421    {
9422        (self.inner, self.is_terminated)
9423    }
9424
9425    fn from_inner(
9426        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9427        is_terminated: bool,
9428    ) -> Self {
9429        Self { inner, is_terminated }
9430    }
9431}
9432
9433impl futures::Stream for StreamConfigConnectorRequestStream {
9434    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
9435
9436    fn poll_next(
9437        mut self: std::pin::Pin<&mut Self>,
9438        cx: &mut std::task::Context<'_>,
9439    ) -> std::task::Poll<Option<Self::Item>> {
9440        let this = &mut *self;
9441        if this.inner.check_shutdown(cx) {
9442            this.is_terminated = true;
9443            return std::task::Poll::Ready(None);
9444        }
9445        if this.is_terminated {
9446            panic!("polled StreamConfigConnectorRequestStream after completion");
9447        }
9448        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9449            |bytes, handles| {
9450                match this.inner.channel().read_etc(cx, bytes, handles) {
9451                    std::task::Poll::Ready(Ok(())) => {}
9452                    std::task::Poll::Pending => return std::task::Poll::Pending,
9453                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9454                        this.is_terminated = true;
9455                        return std::task::Poll::Ready(None);
9456                    }
9457                    std::task::Poll::Ready(Err(e)) => {
9458                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9459                            e.into(),
9460                        ))))
9461                    }
9462                }
9463
9464                // A message has been received from the channel
9465                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9466
9467                std::task::Poll::Ready(Some(match header.ordinal {
9468                0x22051ff3021eafec => {
9469                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9470                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9471                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9472                    let control_handle = StreamConfigConnectorControlHandle {
9473                        inner: this.inner.clone(),
9474                    };
9475                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
9476
9477                        control_handle,
9478                    })
9479                }
9480                _ => Err(fidl::Error::UnknownOrdinal {
9481                    ordinal: header.ordinal,
9482                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9483                }),
9484            }))
9485            },
9486        )
9487    }
9488}
9489
9490/// For an overview see
9491/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
9492/// # Deprecation
9493///
9494/// Not supported anymore, instead use an
9495/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9496/// with one Ring Buffer, see
9497/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9498#[derive(Debug)]
9499pub enum StreamConfigConnectorRequest {
9500    /// Connect to a `StreamConfig` protocol.
9501    /// This method allows a component to serve FIDL outside the devhost's control.
9502    Connect {
9503        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9504        control_handle: StreamConfigConnectorControlHandle,
9505    },
9506}
9507
9508impl StreamConfigConnectorRequest {
9509    #[allow(irrefutable_let_patterns)]
9510    pub fn into_connect(
9511        self,
9512    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
9513    {
9514        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
9515            Some((protocol, control_handle))
9516        } else {
9517            None
9518        }
9519    }
9520
9521    /// Name of the method defined in FIDL
9522    pub fn method_name(&self) -> &'static str {
9523        match *self {
9524            StreamConfigConnectorRequest::Connect { .. } => "connect",
9525        }
9526    }
9527}
9528
9529#[derive(Debug, Clone)]
9530pub struct StreamConfigConnectorControlHandle {
9531    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9532}
9533
9534impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
9535    fn shutdown(&self) {
9536        self.inner.shutdown()
9537    }
9538    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9539        self.inner.shutdown_with_epitaph(status)
9540    }
9541
9542    fn is_closed(&self) -> bool {
9543        self.inner.channel().is_closed()
9544    }
9545    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9546        self.inner.channel().on_closed()
9547    }
9548
9549    #[cfg(target_os = "fuchsia")]
9550    fn signal_peer(
9551        &self,
9552        clear_mask: zx::Signals,
9553        set_mask: zx::Signals,
9554    ) -> Result<(), zx_status::Status> {
9555        use fidl::Peered;
9556        self.inner.channel().signal_peer(clear_mask, set_mask)
9557    }
9558}
9559
9560impl StreamConfigConnectorControlHandle {}
9561
9562#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9563pub struct CodecConnectorServiceMarker;
9564
9565#[cfg(target_os = "fuchsia")]
9566impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
9567    type Proxy = CodecConnectorServiceProxy;
9568    type Request = CodecConnectorServiceRequest;
9569    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
9570}
9571
9572/// A request for one of the member protocols of CodecConnectorService.
9573///
9574/// # Deprecation
9575///
9576/// Not supported anymore, instead use an
9577/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9578/// with one DAI and no Ring Buffer, see
9579/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9580#[cfg(target_os = "fuchsia")]
9581pub enum CodecConnectorServiceRequest {
9582    CodecConnector(CodecConnectorRequestStream),
9583}
9584
9585#[cfg(target_os = "fuchsia")]
9586impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
9587    type Service = CodecConnectorServiceMarker;
9588
9589    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9590        match name {
9591            "codec_connector" => Self::CodecConnector(
9592                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9593                    _channel,
9594                ),
9595            ),
9596            _ => panic!("no such member protocol name for service CodecConnectorService"),
9597        }
9598    }
9599
9600    fn member_names() -> &'static [&'static str] {
9601        &["codec_connector"]
9602    }
9603}
9604/// # Deprecation
9605///
9606/// Not supported anymore, instead use an
9607/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9608/// with one DAI and no Ring Buffer, see
9609/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9610#[cfg(target_os = "fuchsia")]
9611pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9612
9613#[cfg(target_os = "fuchsia")]
9614impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
9615    type Service = CodecConnectorServiceMarker;
9616
9617    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9618        Self(opener)
9619    }
9620}
9621
9622#[cfg(target_os = "fuchsia")]
9623impl CodecConnectorServiceProxy {
9624    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
9625        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
9626        self.connect_channel_to_codec_connector(server_end)?;
9627        Ok(proxy)
9628    }
9629
9630    /// Like `connect_to_codec_connector`, but returns a sync proxy.
9631    /// See [`Self::connect_to_codec_connector`] for more details.
9632    pub fn connect_to_codec_connector_sync(
9633        &self,
9634    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
9635        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
9636        self.connect_channel_to_codec_connector(server_end)?;
9637        Ok(proxy)
9638    }
9639
9640    /// Like `connect_to_codec_connector`, but accepts a server end.
9641    /// See [`Self::connect_to_codec_connector`] for more details.
9642    pub fn connect_channel_to_codec_connector(
9643        &self,
9644        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
9645    ) -> Result<(), fidl::Error> {
9646        self.0.open_member("codec_connector", server_end.into_channel())
9647    }
9648
9649    pub fn instance_name(&self) -> &str {
9650        self.0.instance_name()
9651    }
9652}
9653
9654#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9655pub struct CodecServiceMarker;
9656
9657#[cfg(target_os = "fuchsia")]
9658impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
9659    type Proxy = CodecServiceProxy;
9660    type Request = CodecServiceRequest;
9661    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
9662}
9663
9664/// A request for one of the member protocols of CodecService.
9665///
9666/// # Deprecation
9667///
9668/// Not supported anymore, instead use an
9669/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9670/// with one DAI and no Ring Buffer, see
9671/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9672#[cfg(target_os = "fuchsia")]
9673pub enum CodecServiceRequest {
9674    Codec(CodecRequestStream),
9675}
9676
9677#[cfg(target_os = "fuchsia")]
9678impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
9679    type Service = CodecServiceMarker;
9680
9681    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9682        match name {
9683            "codec" => Self::Codec(
9684                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
9685            ),
9686            _ => panic!("no such member protocol name for service CodecService"),
9687        }
9688    }
9689
9690    fn member_names() -> &'static [&'static str] {
9691        &["codec"]
9692    }
9693}
9694/// # Deprecation
9695///
9696/// Not supported anymore, instead use an
9697/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9698/// with one DAI and no Ring Buffer, see
9699/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9700#[cfg(target_os = "fuchsia")]
9701pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9702
9703#[cfg(target_os = "fuchsia")]
9704impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
9705    type Service = CodecServiceMarker;
9706
9707    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9708        Self(opener)
9709    }
9710}
9711
9712#[cfg(target_os = "fuchsia")]
9713impl CodecServiceProxy {
9714    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
9715        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
9716        self.connect_channel_to_codec(server_end)?;
9717        Ok(proxy)
9718    }
9719
9720    /// Like `connect_to_codec`, but returns a sync proxy.
9721    /// See [`Self::connect_to_codec`] for more details.
9722    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
9723        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
9724        self.connect_channel_to_codec(server_end)?;
9725        Ok(proxy)
9726    }
9727
9728    /// Like `connect_to_codec`, but accepts a server end.
9729    /// See [`Self::connect_to_codec`] for more details.
9730    pub fn connect_channel_to_codec(
9731        &self,
9732        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
9733    ) -> Result<(), fidl::Error> {
9734        self.0.open_member("codec", server_end.into_channel())
9735    }
9736
9737    pub fn instance_name(&self) -> &str {
9738        self.0.instance_name()
9739    }
9740}
9741
9742#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9743pub struct CompositeConnectorServiceMarker;
9744
9745#[cfg(target_os = "fuchsia")]
9746impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
9747    type Proxy = CompositeConnectorServiceProxy;
9748    type Request = CompositeConnectorServiceRequest;
9749    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
9750}
9751
9752/// A request for one of the member protocols of CompositeConnectorService.
9753///
9754#[cfg(target_os = "fuchsia")]
9755pub enum CompositeConnectorServiceRequest {
9756    CompositeConnector(CompositeConnectorRequestStream),
9757}
9758
9759#[cfg(target_os = "fuchsia")]
9760impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
9761    type Service = CompositeConnectorServiceMarker;
9762
9763    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9764        match name {
9765            "composite_connector" => Self::CompositeConnector(
9766                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9767                    _channel,
9768                ),
9769            ),
9770            _ => panic!("no such member protocol name for service CompositeConnectorService"),
9771        }
9772    }
9773
9774    fn member_names() -> &'static [&'static str] {
9775        &["composite_connector"]
9776    }
9777}
9778#[cfg(target_os = "fuchsia")]
9779pub struct CompositeConnectorServiceProxy(
9780    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
9781);
9782
9783#[cfg(target_os = "fuchsia")]
9784impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
9785    type Service = CompositeConnectorServiceMarker;
9786
9787    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9788        Self(opener)
9789    }
9790}
9791
9792#[cfg(target_os = "fuchsia")]
9793impl CompositeConnectorServiceProxy {
9794    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
9795        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
9796        self.connect_channel_to_composite_connector(server_end)?;
9797        Ok(proxy)
9798    }
9799
9800    /// Like `connect_to_composite_connector`, but returns a sync proxy.
9801    /// See [`Self::connect_to_composite_connector`] for more details.
9802    pub fn connect_to_composite_connector_sync(
9803        &self,
9804    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
9805        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
9806        self.connect_channel_to_composite_connector(server_end)?;
9807        Ok(proxy)
9808    }
9809
9810    /// Like `connect_to_composite_connector`, but accepts a server end.
9811    /// See [`Self::connect_to_composite_connector`] for more details.
9812    pub fn connect_channel_to_composite_connector(
9813        &self,
9814        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
9815    ) -> Result<(), fidl::Error> {
9816        self.0.open_member("composite_connector", server_end.into_channel())
9817    }
9818
9819    pub fn instance_name(&self) -> &str {
9820        self.0.instance_name()
9821    }
9822}
9823
9824#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9825pub struct DaiConnectorServiceMarker;
9826
9827#[cfg(target_os = "fuchsia")]
9828impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
9829    type Proxy = DaiConnectorServiceProxy;
9830    type Request = DaiConnectorServiceRequest;
9831    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
9832}
9833
9834/// A request for one of the member protocols of DaiConnectorService.
9835///
9836/// # Deprecation
9837///
9838/// Not supported anymore, instead use an
9839/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9840/// with one DAI and one Ring Buffer, see
9841/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9842#[cfg(target_os = "fuchsia")]
9843pub enum DaiConnectorServiceRequest {
9844    DaiConnector(DaiConnectorRequestStream),
9845}
9846
9847#[cfg(target_os = "fuchsia")]
9848impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
9849    type Service = DaiConnectorServiceMarker;
9850
9851    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9852        match name {
9853            "dai_connector" => Self::DaiConnector(
9854                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9855                    _channel,
9856                ),
9857            ),
9858            _ => panic!("no such member protocol name for service DaiConnectorService"),
9859        }
9860    }
9861
9862    fn member_names() -> &'static [&'static str] {
9863        &["dai_connector"]
9864    }
9865}
9866/// # Deprecation
9867///
9868/// Not supported anymore, instead use an
9869/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9870/// with one DAI and one Ring Buffer, see
9871/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9872#[cfg(target_os = "fuchsia")]
9873pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9874
9875#[cfg(target_os = "fuchsia")]
9876impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
9877    type Service = DaiConnectorServiceMarker;
9878
9879    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9880        Self(opener)
9881    }
9882}
9883
9884#[cfg(target_os = "fuchsia")]
9885impl DaiConnectorServiceProxy {
9886    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
9887        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
9888        self.connect_channel_to_dai_connector(server_end)?;
9889        Ok(proxy)
9890    }
9891
9892    /// Like `connect_to_dai_connector`, but returns a sync proxy.
9893    /// See [`Self::connect_to_dai_connector`] for more details.
9894    pub fn connect_to_dai_connector_sync(
9895        &self,
9896    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
9897        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
9898        self.connect_channel_to_dai_connector(server_end)?;
9899        Ok(proxy)
9900    }
9901
9902    /// Like `connect_to_dai_connector`, but accepts a server end.
9903    /// See [`Self::connect_to_dai_connector`] for more details.
9904    pub fn connect_channel_to_dai_connector(
9905        &self,
9906        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
9907    ) -> Result<(), fidl::Error> {
9908        self.0.open_member("dai_connector", server_end.into_channel())
9909    }
9910
9911    pub fn instance_name(&self) -> &str {
9912        self.0.instance_name()
9913    }
9914}
9915
9916#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9917pub struct DaiServiceMarker;
9918
9919#[cfg(target_os = "fuchsia")]
9920impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
9921    type Proxy = DaiServiceProxy;
9922    type Request = DaiServiceRequest;
9923    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
9924}
9925
9926/// A request for one of the member protocols of DaiService.
9927///
9928/// # Deprecation
9929///
9930/// Not supported anymore, instead use an
9931/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9932/// with one DAI and one Ring Buffer, see
9933/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9934#[cfg(target_os = "fuchsia")]
9935pub enum DaiServiceRequest {
9936    Dai(DaiRequestStream),
9937}
9938
9939#[cfg(target_os = "fuchsia")]
9940impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
9941    type Service = DaiServiceMarker;
9942
9943    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9944        match name {
9945            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
9946                _channel,
9947            )),
9948            _ => panic!("no such member protocol name for service DaiService"),
9949        }
9950    }
9951
9952    fn member_names() -> &'static [&'static str] {
9953        &["dai"]
9954    }
9955}
9956/// # Deprecation
9957///
9958/// Not supported anymore, instead use an
9959/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9960/// with one DAI and one Ring Buffer, see
9961/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9962#[cfg(target_os = "fuchsia")]
9963pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9964
9965#[cfg(target_os = "fuchsia")]
9966impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
9967    type Service = DaiServiceMarker;
9968
9969    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9970        Self(opener)
9971    }
9972}
9973
9974#[cfg(target_os = "fuchsia")]
9975impl DaiServiceProxy {
9976    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
9977        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
9978        self.connect_channel_to_dai(server_end)?;
9979        Ok(proxy)
9980    }
9981
9982    /// Like `connect_to_dai`, but returns a sync proxy.
9983    /// See [`Self::connect_to_dai`] for more details.
9984    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
9985        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
9986        self.connect_channel_to_dai(server_end)?;
9987        Ok(proxy)
9988    }
9989
9990    /// Like `connect_to_dai`, but accepts a server end.
9991    /// See [`Self::connect_to_dai`] for more details.
9992    pub fn connect_channel_to_dai(
9993        &self,
9994        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
9995    ) -> Result<(), fidl::Error> {
9996        self.0.open_member("dai", server_end.into_channel())
9997    }
9998
9999    pub fn instance_name(&self) -> &str {
10000        self.0.instance_name()
10001    }
10002}
10003
10004#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10005pub struct DeviceServiceMarker;
10006
10007#[cfg(target_os = "fuchsia")]
10008impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
10009    type Proxy = DeviceServiceProxy;
10010    type Request = DeviceServiceRequest;
10011    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
10012}
10013
10014/// A request for one of the member protocols of DeviceService.
10015///
10016#[cfg(target_os = "fuchsia")]
10017pub enum DeviceServiceRequest {
10018    Device(CompositeRequestStream),
10019}
10020
10021#[cfg(target_os = "fuchsia")]
10022impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
10023    type Service = DeviceServiceMarker;
10024
10025    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10026        match name {
10027            "device" => Self::Device(
10028                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10029            ),
10030            _ => panic!("no such member protocol name for service DeviceService"),
10031        }
10032    }
10033
10034    fn member_names() -> &'static [&'static str] {
10035        &["device"]
10036    }
10037}
10038#[cfg(target_os = "fuchsia")]
10039pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10040
10041#[cfg(target_os = "fuchsia")]
10042impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
10043    type Service = DeviceServiceMarker;
10044
10045    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10046        Self(opener)
10047    }
10048}
10049
10050#[cfg(target_os = "fuchsia")]
10051impl DeviceServiceProxy {
10052    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
10053        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
10054        self.connect_channel_to_device(server_end)?;
10055        Ok(proxy)
10056    }
10057
10058    /// Like `connect_to_device`, but returns a sync proxy.
10059    /// See [`Self::connect_to_device`] for more details.
10060    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
10061        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
10062        self.connect_channel_to_device(server_end)?;
10063        Ok(proxy)
10064    }
10065
10066    /// Like `connect_to_device`, but accepts a server end.
10067    /// See [`Self::connect_to_device`] for more details.
10068    pub fn connect_channel_to_device(
10069        &self,
10070        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
10071    ) -> Result<(), fidl::Error> {
10072        self.0.open_member("device", server_end.into_channel())
10073    }
10074
10075    pub fn instance_name(&self) -> &str {
10076        self.0.instance_name()
10077    }
10078}
10079
10080#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10081pub struct StreamConfigConnectorInputServiceMarker;
10082
10083#[cfg(target_os = "fuchsia")]
10084impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
10085    type Proxy = StreamConfigConnectorInputServiceProxy;
10086    type Request = StreamConfigConnectorInputServiceRequest;
10087    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
10088}
10089
10090/// A request for one of the member protocols of StreamConfigConnectorInputService.
10091///
10092#[cfg(target_os = "fuchsia")]
10093pub enum StreamConfigConnectorInputServiceRequest {
10094    StreamConfigConnector(StreamConfigConnectorRequestStream),
10095}
10096
10097#[cfg(target_os = "fuchsia")]
10098impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
10099    type Service = StreamConfigConnectorInputServiceMarker;
10100
10101    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10102        match name {
10103            "stream_config_connector" => Self::StreamConfigConnector(
10104                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10105            ),
10106            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
10107        }
10108    }
10109
10110    fn member_names() -> &'static [&'static str] {
10111        &["stream_config_connector"]
10112    }
10113}
10114#[cfg(target_os = "fuchsia")]
10115pub struct StreamConfigConnectorInputServiceProxy(
10116    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10117);
10118
10119#[cfg(target_os = "fuchsia")]
10120impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
10121    type Service = StreamConfigConnectorInputServiceMarker;
10122
10123    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10124        Self(opener)
10125    }
10126}
10127
10128#[cfg(target_os = "fuchsia")]
10129impl StreamConfigConnectorInputServiceProxy {
10130    pub fn connect_to_stream_config_connector(
10131        &self,
10132    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10133        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10134        self.connect_channel_to_stream_config_connector(server_end)?;
10135        Ok(proxy)
10136    }
10137
10138    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10139    /// See [`Self::connect_to_stream_config_connector`] for more details.
10140    pub fn connect_to_stream_config_connector_sync(
10141        &self,
10142    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10143        let (proxy, server_end) =
10144            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10145        self.connect_channel_to_stream_config_connector(server_end)?;
10146        Ok(proxy)
10147    }
10148
10149    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10150    /// See [`Self::connect_to_stream_config_connector`] for more details.
10151    pub fn connect_channel_to_stream_config_connector(
10152        &self,
10153        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10154    ) -> Result<(), fidl::Error> {
10155        self.0.open_member("stream_config_connector", server_end.into_channel())
10156    }
10157
10158    pub fn instance_name(&self) -> &str {
10159        self.0.instance_name()
10160    }
10161}
10162
10163#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10164pub struct StreamConfigConnectorOutputServiceMarker;
10165
10166#[cfg(target_os = "fuchsia")]
10167impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
10168    type Proxy = StreamConfigConnectorOutputServiceProxy;
10169    type Request = StreamConfigConnectorOutputServiceRequest;
10170    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
10171}
10172
10173/// A request for one of the member protocols of StreamConfigConnectorOutputService.
10174///
10175#[cfg(target_os = "fuchsia")]
10176pub enum StreamConfigConnectorOutputServiceRequest {
10177    StreamConfigConnector(StreamConfigConnectorRequestStream),
10178}
10179
10180#[cfg(target_os = "fuchsia")]
10181impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
10182    type Service = StreamConfigConnectorOutputServiceMarker;
10183
10184    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10185        match name {
10186            "stream_config_connector" => Self::StreamConfigConnector(
10187                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10188            ),
10189            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
10190        }
10191    }
10192
10193    fn member_names() -> &'static [&'static str] {
10194        &["stream_config_connector"]
10195    }
10196}
10197#[cfg(target_os = "fuchsia")]
10198pub struct StreamConfigConnectorOutputServiceProxy(
10199    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10200);
10201
10202#[cfg(target_os = "fuchsia")]
10203impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
10204    type Service = StreamConfigConnectorOutputServiceMarker;
10205
10206    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10207        Self(opener)
10208    }
10209}
10210
10211#[cfg(target_os = "fuchsia")]
10212impl StreamConfigConnectorOutputServiceProxy {
10213    pub fn connect_to_stream_config_connector(
10214        &self,
10215    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10216        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10217        self.connect_channel_to_stream_config_connector(server_end)?;
10218        Ok(proxy)
10219    }
10220
10221    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10222    /// See [`Self::connect_to_stream_config_connector`] for more details.
10223    pub fn connect_to_stream_config_connector_sync(
10224        &self,
10225    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10226        let (proxy, server_end) =
10227            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10228        self.connect_channel_to_stream_config_connector(server_end)?;
10229        Ok(proxy)
10230    }
10231
10232    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10233    /// See [`Self::connect_to_stream_config_connector`] for more details.
10234    pub fn connect_channel_to_stream_config_connector(
10235        &self,
10236        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10237    ) -> Result<(), fidl::Error> {
10238        self.0.open_member("stream_config_connector", server_end.into_channel())
10239    }
10240
10241    pub fn instance_name(&self) -> &str {
10242        self.0.instance_name()
10243    }
10244}
10245
10246#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10247pub struct StreamConfigConnectorServiceMarker;
10248
10249#[cfg(target_os = "fuchsia")]
10250impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
10251    type Proxy = StreamConfigConnectorServiceProxy;
10252    type Request = StreamConfigConnectorServiceRequest;
10253    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
10254}
10255
10256/// A request for one of the member protocols of StreamConfigConnectorService.
10257///
10258/// # Deprecation
10259///
10260/// Not supported anymore, instead use an
10261/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10262/// with one Ring Buffer, see
10263/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10264#[cfg(target_os = "fuchsia")]
10265pub enum StreamConfigConnectorServiceRequest {
10266    StreamConfigConnector(StreamConfigConnectorRequestStream),
10267}
10268
10269#[cfg(target_os = "fuchsia")]
10270impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
10271    type Service = StreamConfigConnectorServiceMarker;
10272
10273    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10274        match name {
10275            "stream_config_connector" => Self::StreamConfigConnector(
10276                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10277            ),
10278            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
10279        }
10280    }
10281
10282    fn member_names() -> &'static [&'static str] {
10283        &["stream_config_connector"]
10284    }
10285}
10286/// # Deprecation
10287///
10288/// Not supported anymore, instead use an
10289/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10290/// with one Ring Buffer, see
10291/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10292#[cfg(target_os = "fuchsia")]
10293pub struct StreamConfigConnectorServiceProxy(
10294    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10295);
10296
10297#[cfg(target_os = "fuchsia")]
10298impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
10299    type Service = StreamConfigConnectorServiceMarker;
10300
10301    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10302        Self(opener)
10303    }
10304}
10305
10306#[cfg(target_os = "fuchsia")]
10307impl StreamConfigConnectorServiceProxy {
10308    pub fn connect_to_stream_config_connector(
10309        &self,
10310    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10311        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10312        self.connect_channel_to_stream_config_connector(server_end)?;
10313        Ok(proxy)
10314    }
10315
10316    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10317    /// See [`Self::connect_to_stream_config_connector`] for more details.
10318    pub fn connect_to_stream_config_connector_sync(
10319        &self,
10320    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10321        let (proxy, server_end) =
10322            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10323        self.connect_channel_to_stream_config_connector(server_end)?;
10324        Ok(proxy)
10325    }
10326
10327    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10328    /// See [`Self::connect_to_stream_config_connector`] for more details.
10329    pub fn connect_channel_to_stream_config_connector(
10330        &self,
10331        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10332    ) -> Result<(), fidl::Error> {
10333        self.0.open_member("stream_config_connector", server_end.into_channel())
10334    }
10335
10336    pub fn instance_name(&self) -> &str {
10337        self.0.instance_name()
10338    }
10339}
10340
10341#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10342pub struct StreamConfigServiceMarker;
10343
10344#[cfg(target_os = "fuchsia")]
10345impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
10346    type Proxy = StreamConfigServiceProxy;
10347    type Request = StreamConfigServiceRequest;
10348    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
10349}
10350
10351/// A request for one of the member protocols of StreamConfigService.
10352///
10353/// # Deprecation
10354///
10355/// Not supported anymore, instead use an
10356/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10357/// with one Ring Buffer, see
10358/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10359#[cfg(target_os = "fuchsia")]
10360pub enum StreamConfigServiceRequest {
10361    StreamConfig(StreamConfigRequestStream),
10362}
10363
10364#[cfg(target_os = "fuchsia")]
10365impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
10366    type Service = StreamConfigServiceMarker;
10367
10368    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10369        match name {
10370            "stream_config" => Self::StreamConfig(
10371                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
10372                    _channel,
10373                ),
10374            ),
10375            _ => panic!("no such member protocol name for service StreamConfigService"),
10376        }
10377    }
10378
10379    fn member_names() -> &'static [&'static str] {
10380        &["stream_config"]
10381    }
10382}
10383/// # Deprecation
10384///
10385/// Not supported anymore, instead use an
10386/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10387/// with one Ring Buffer, see
10388/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10389#[cfg(target_os = "fuchsia")]
10390pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10391
10392#[cfg(target_os = "fuchsia")]
10393impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
10394    type Service = StreamConfigServiceMarker;
10395
10396    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10397        Self(opener)
10398    }
10399}
10400
10401#[cfg(target_os = "fuchsia")]
10402impl StreamConfigServiceProxy {
10403    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
10404        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
10405        self.connect_channel_to_stream_config(server_end)?;
10406        Ok(proxy)
10407    }
10408
10409    /// Like `connect_to_stream_config`, but returns a sync proxy.
10410    /// See [`Self::connect_to_stream_config`] for more details.
10411    pub fn connect_to_stream_config_sync(
10412        &self,
10413    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
10414        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
10415        self.connect_channel_to_stream_config(server_end)?;
10416        Ok(proxy)
10417    }
10418
10419    /// Like `connect_to_stream_config`, but accepts a server end.
10420    /// See [`Self::connect_to_stream_config`] for more details.
10421    pub fn connect_channel_to_stream_config(
10422        &self,
10423        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
10424    ) -> Result<(), fidl::Error> {
10425        self.0.open_member("stream_config", server_end.into_channel())
10426    }
10427
10428    pub fn instance_name(&self) -> &str {
10429        self.0.instance_name()
10430    }
10431}
10432
10433mod internal {
10434    use super::*;
10435
10436    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10437        type Borrowed<'a> = &'a mut Self;
10438        fn take_or_borrow<'a>(
10439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10440        ) -> Self::Borrowed<'a> {
10441            value
10442        }
10443    }
10444
10445    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10446        type Owned = Self;
10447
10448        #[inline(always)]
10449        fn inline_align(_context: fidl::encoding::Context) -> usize {
10450            4
10451        }
10452
10453        #[inline(always)]
10454        fn inline_size(_context: fidl::encoding::Context) -> usize {
10455            4
10456        }
10457    }
10458
10459    unsafe impl
10460        fidl::encoding::Encode<
10461            CodecConnectorConnectRequest,
10462            fidl::encoding::DefaultFuchsiaResourceDialect,
10463        > for &mut CodecConnectorConnectRequest
10464    {
10465        #[inline]
10466        unsafe fn encode(
10467            self,
10468            encoder: &mut fidl::encoding::Encoder<
10469                '_,
10470                fidl::encoding::DefaultFuchsiaResourceDialect,
10471            >,
10472            offset: usize,
10473            _depth: fidl::encoding::Depth,
10474        ) -> fidl::Result<()> {
10475            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10476            // Delegate to tuple encoding.
10477            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10478                (
10479                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10480                ),
10481                encoder, offset, _depth
10482            )
10483        }
10484    }
10485    unsafe impl<
10486            T0: fidl::encoding::Encode<
10487                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10488                fidl::encoding::DefaultFuchsiaResourceDialect,
10489            >,
10490        >
10491        fidl::encoding::Encode<
10492            CodecConnectorConnectRequest,
10493            fidl::encoding::DefaultFuchsiaResourceDialect,
10494        > for (T0,)
10495    {
10496        #[inline]
10497        unsafe fn encode(
10498            self,
10499            encoder: &mut fidl::encoding::Encoder<
10500                '_,
10501                fidl::encoding::DefaultFuchsiaResourceDialect,
10502            >,
10503            offset: usize,
10504            depth: fidl::encoding::Depth,
10505        ) -> fidl::Result<()> {
10506            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10507            // Zero out padding regions. There's no need to apply masks
10508            // because the unmasked parts will be overwritten by fields.
10509            // Write the fields.
10510            self.0.encode(encoder, offset + 0, depth)?;
10511            Ok(())
10512        }
10513    }
10514
10515    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10516        for CodecConnectorConnectRequest
10517    {
10518        #[inline(always)]
10519        fn new_empty() -> Self {
10520            Self {
10521                codec_protocol: fidl::new_empty!(
10522                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10523                    fidl::encoding::DefaultFuchsiaResourceDialect
10524                ),
10525            }
10526        }
10527
10528        #[inline]
10529        unsafe fn decode(
10530            &mut self,
10531            decoder: &mut fidl::encoding::Decoder<
10532                '_,
10533                fidl::encoding::DefaultFuchsiaResourceDialect,
10534            >,
10535            offset: usize,
10536            _depth: fidl::encoding::Depth,
10537        ) -> fidl::Result<()> {
10538            decoder.debug_check_bounds::<Self>(offset);
10539            // Verify that padding bytes are zero.
10540            fidl::decode!(
10541                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10542                fidl::encoding::DefaultFuchsiaResourceDialect,
10543                &mut self.codec_protocol,
10544                decoder,
10545                offset + 0,
10546                _depth
10547            )?;
10548            Ok(())
10549        }
10550    }
10551
10552    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
10553        type Borrowed<'a> = &'a mut Self;
10554        fn take_or_borrow<'a>(
10555            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10556        ) -> Self::Borrowed<'a> {
10557            value
10558        }
10559    }
10560
10561    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
10562        type Owned = Self;
10563
10564        #[inline(always)]
10565        fn inline_align(_context: fidl::encoding::Context) -> usize {
10566            4
10567        }
10568
10569        #[inline(always)]
10570        fn inline_size(_context: fidl::encoding::Context) -> usize {
10571            4
10572        }
10573    }
10574
10575    unsafe impl
10576        fidl::encoding::Encode<
10577            CompositeConnectorConnectRequest,
10578            fidl::encoding::DefaultFuchsiaResourceDialect,
10579        > for &mut CompositeConnectorConnectRequest
10580    {
10581        #[inline]
10582        unsafe fn encode(
10583            self,
10584            encoder: &mut fidl::encoding::Encoder<
10585                '_,
10586                fidl::encoding::DefaultFuchsiaResourceDialect,
10587            >,
10588            offset: usize,
10589            _depth: fidl::encoding::Depth,
10590        ) -> fidl::Result<()> {
10591            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10592            // Delegate to tuple encoding.
10593            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10594                (
10595                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
10596                ),
10597                encoder, offset, _depth
10598            )
10599        }
10600    }
10601    unsafe impl<
10602            T0: fidl::encoding::Encode<
10603                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10604                fidl::encoding::DefaultFuchsiaResourceDialect,
10605            >,
10606        >
10607        fidl::encoding::Encode<
10608            CompositeConnectorConnectRequest,
10609            fidl::encoding::DefaultFuchsiaResourceDialect,
10610        > for (T0,)
10611    {
10612        #[inline]
10613        unsafe fn encode(
10614            self,
10615            encoder: &mut fidl::encoding::Encoder<
10616                '_,
10617                fidl::encoding::DefaultFuchsiaResourceDialect,
10618            >,
10619            offset: usize,
10620            depth: fidl::encoding::Depth,
10621        ) -> fidl::Result<()> {
10622            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10623            // Zero out padding regions. There's no need to apply masks
10624            // because the unmasked parts will be overwritten by fields.
10625            // Write the fields.
10626            self.0.encode(encoder, offset + 0, depth)?;
10627            Ok(())
10628        }
10629    }
10630
10631    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10632        for CompositeConnectorConnectRequest
10633    {
10634        #[inline(always)]
10635        fn new_empty() -> Self {
10636            Self {
10637                composite_protocol: fidl::new_empty!(
10638                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10639                    fidl::encoding::DefaultFuchsiaResourceDialect
10640                ),
10641            }
10642        }
10643
10644        #[inline]
10645        unsafe fn decode(
10646            &mut self,
10647            decoder: &mut fidl::encoding::Decoder<
10648                '_,
10649                fidl::encoding::DefaultFuchsiaResourceDialect,
10650            >,
10651            offset: usize,
10652            _depth: fidl::encoding::Depth,
10653        ) -> fidl::Result<()> {
10654            decoder.debug_check_bounds::<Self>(offset);
10655            // Verify that padding bytes are zero.
10656            fidl::decode!(
10657                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10658                fidl::encoding::DefaultFuchsiaResourceDialect,
10659                &mut self.composite_protocol,
10660                decoder,
10661                offset + 0,
10662                _depth
10663            )?;
10664            Ok(())
10665        }
10666    }
10667
10668    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
10669        type Borrowed<'a> = &'a mut Self;
10670        fn take_or_borrow<'a>(
10671            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10672        ) -> Self::Borrowed<'a> {
10673            value
10674        }
10675    }
10676
10677    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
10678        type Owned = Self;
10679
10680        #[inline(always)]
10681        fn inline_align(_context: fidl::encoding::Context) -> usize {
10682            8
10683        }
10684
10685        #[inline(always)]
10686        fn inline_size(_context: fidl::encoding::Context) -> usize {
10687            32
10688        }
10689    }
10690
10691    unsafe impl
10692        fidl::encoding::Encode<
10693            CompositeCreateRingBufferRequest,
10694            fidl::encoding::DefaultFuchsiaResourceDialect,
10695        > for &mut CompositeCreateRingBufferRequest
10696    {
10697        #[inline]
10698        unsafe fn encode(
10699            self,
10700            encoder: &mut fidl::encoding::Encoder<
10701                '_,
10702                fidl::encoding::DefaultFuchsiaResourceDialect,
10703            >,
10704            offset: usize,
10705            _depth: fidl::encoding::Depth,
10706        ) -> fidl::Result<()> {
10707            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10708            // Delegate to tuple encoding.
10709            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10710                (
10711                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
10712                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
10713                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10714                ),
10715                encoder, offset, _depth
10716            )
10717        }
10718    }
10719    unsafe impl<
10720            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10721            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
10722            T2: fidl::encoding::Encode<
10723                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10724                fidl::encoding::DefaultFuchsiaResourceDialect,
10725            >,
10726        >
10727        fidl::encoding::Encode<
10728            CompositeCreateRingBufferRequest,
10729            fidl::encoding::DefaultFuchsiaResourceDialect,
10730        > for (T0, T1, T2)
10731    {
10732        #[inline]
10733        unsafe fn encode(
10734            self,
10735            encoder: &mut fidl::encoding::Encoder<
10736                '_,
10737                fidl::encoding::DefaultFuchsiaResourceDialect,
10738            >,
10739            offset: usize,
10740            depth: fidl::encoding::Depth,
10741        ) -> fidl::Result<()> {
10742            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10743            // Zero out padding regions. There's no need to apply masks
10744            // because the unmasked parts will be overwritten by fields.
10745            unsafe {
10746                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
10747                (ptr as *mut u64).write_unaligned(0);
10748            }
10749            // Write the fields.
10750            self.0.encode(encoder, offset + 0, depth)?;
10751            self.1.encode(encoder, offset + 8, depth)?;
10752            self.2.encode(encoder, offset + 24, depth)?;
10753            Ok(())
10754        }
10755    }
10756
10757    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10758        for CompositeCreateRingBufferRequest
10759    {
10760        #[inline(always)]
10761        fn new_empty() -> Self {
10762            Self {
10763                processing_element_id: fidl::new_empty!(
10764                    u64,
10765                    fidl::encoding::DefaultFuchsiaResourceDialect
10766                ),
10767                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
10768                ring_buffer: fidl::new_empty!(
10769                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10770                    fidl::encoding::DefaultFuchsiaResourceDialect
10771                ),
10772            }
10773        }
10774
10775        #[inline]
10776        unsafe fn decode(
10777            &mut self,
10778            decoder: &mut fidl::encoding::Decoder<
10779                '_,
10780                fidl::encoding::DefaultFuchsiaResourceDialect,
10781            >,
10782            offset: usize,
10783            _depth: fidl::encoding::Depth,
10784        ) -> fidl::Result<()> {
10785            decoder.debug_check_bounds::<Self>(offset);
10786            // Verify that padding bytes are zero.
10787            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
10788            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10789            let mask = 0xffffffff00000000u64;
10790            let maskedval = padval & mask;
10791            if maskedval != 0 {
10792                return Err(fidl::Error::NonZeroPadding {
10793                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
10794                });
10795            }
10796            fidl::decode!(
10797                u64,
10798                fidl::encoding::DefaultFuchsiaResourceDialect,
10799                &mut self.processing_element_id,
10800                decoder,
10801                offset + 0,
10802                _depth
10803            )?;
10804            fidl::decode!(
10805                Format,
10806                fidl::encoding::DefaultFuchsiaResourceDialect,
10807                &mut self.format,
10808                decoder,
10809                offset + 8,
10810                _depth
10811            )?;
10812            fidl::decode!(
10813                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10814                fidl::encoding::DefaultFuchsiaResourceDialect,
10815                &mut self.ring_buffer,
10816                decoder,
10817                offset + 24,
10818                _depth
10819            )?;
10820            Ok(())
10821        }
10822    }
10823
10824    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
10825        type Borrowed<'a> = &'a mut Self;
10826        fn take_or_borrow<'a>(
10827            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10828        ) -> Self::Borrowed<'a> {
10829            value
10830        }
10831    }
10832
10833    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
10834        type Owned = Self;
10835
10836        #[inline(always)]
10837        fn inline_align(_context: fidl::encoding::Context) -> usize {
10838            4
10839        }
10840
10841        #[inline(always)]
10842        fn inline_size(_context: fidl::encoding::Context) -> usize {
10843            4
10844        }
10845    }
10846
10847    unsafe impl
10848        fidl::encoding::Encode<
10849            DaiConnectorConnectRequest,
10850            fidl::encoding::DefaultFuchsiaResourceDialect,
10851        > for &mut DaiConnectorConnectRequest
10852    {
10853        #[inline]
10854        unsafe fn encode(
10855            self,
10856            encoder: &mut fidl::encoding::Encoder<
10857                '_,
10858                fidl::encoding::DefaultFuchsiaResourceDialect,
10859            >,
10860            offset: usize,
10861            _depth: fidl::encoding::Depth,
10862        ) -> fidl::Result<()> {
10863            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10864            // Delegate to tuple encoding.
10865            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10866                (
10867                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
10868                ),
10869                encoder, offset, _depth
10870            )
10871        }
10872    }
10873    unsafe impl<
10874            T0: fidl::encoding::Encode<
10875                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10876                fidl::encoding::DefaultFuchsiaResourceDialect,
10877            >,
10878        >
10879        fidl::encoding::Encode<
10880            DaiConnectorConnectRequest,
10881            fidl::encoding::DefaultFuchsiaResourceDialect,
10882        > for (T0,)
10883    {
10884        #[inline]
10885        unsafe fn encode(
10886            self,
10887            encoder: &mut fidl::encoding::Encoder<
10888                '_,
10889                fidl::encoding::DefaultFuchsiaResourceDialect,
10890            >,
10891            offset: usize,
10892            depth: fidl::encoding::Depth,
10893        ) -> fidl::Result<()> {
10894            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
10895            // Zero out padding regions. There's no need to apply masks
10896            // because the unmasked parts will be overwritten by fields.
10897            // Write the fields.
10898            self.0.encode(encoder, offset + 0, depth)?;
10899            Ok(())
10900        }
10901    }
10902
10903    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10904        for DaiConnectorConnectRequest
10905    {
10906        #[inline(always)]
10907        fn new_empty() -> Self {
10908            Self {
10909                dai_protocol: fidl::new_empty!(
10910                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10911                    fidl::encoding::DefaultFuchsiaResourceDialect
10912                ),
10913            }
10914        }
10915
10916        #[inline]
10917        unsafe fn decode(
10918            &mut self,
10919            decoder: &mut fidl::encoding::Decoder<
10920                '_,
10921                fidl::encoding::DefaultFuchsiaResourceDialect,
10922            >,
10923            offset: usize,
10924            _depth: fidl::encoding::Depth,
10925        ) -> fidl::Result<()> {
10926            decoder.debug_check_bounds::<Self>(offset);
10927            // Verify that padding bytes are zero.
10928            fidl::decode!(
10929                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
10930                fidl::encoding::DefaultFuchsiaResourceDialect,
10931                &mut self.dai_protocol,
10932                decoder,
10933                offset + 0,
10934                _depth
10935            )?;
10936            Ok(())
10937        }
10938    }
10939
10940    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
10941        type Borrowed<'a> = &'a mut Self;
10942        fn take_or_borrow<'a>(
10943            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10944        ) -> Self::Borrowed<'a> {
10945            value
10946        }
10947    }
10948
10949    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
10950        type Owned = Self;
10951
10952        #[inline(always)]
10953        fn inline_align(_context: fidl::encoding::Context) -> usize {
10954            8
10955        }
10956
10957        #[inline(always)]
10958        fn inline_size(_context: fidl::encoding::Context) -> usize {
10959            72
10960        }
10961    }
10962
10963    unsafe impl
10964        fidl::encoding::Encode<
10965            DaiCreateRingBufferRequest,
10966            fidl::encoding::DefaultFuchsiaResourceDialect,
10967        > for &mut DaiCreateRingBufferRequest
10968    {
10969        #[inline]
10970        unsafe fn encode(
10971            self,
10972            encoder: &mut fidl::encoding::Encoder<
10973                '_,
10974                fidl::encoding::DefaultFuchsiaResourceDialect,
10975            >,
10976            offset: usize,
10977            _depth: fidl::encoding::Depth,
10978        ) -> fidl::Result<()> {
10979            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
10980            // Delegate to tuple encoding.
10981            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10982                (
10983                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
10984                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
10985                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10986                ),
10987                encoder, offset, _depth
10988            )
10989        }
10990    }
10991    unsafe impl<
10992            T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
10993            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
10994            T2: fidl::encoding::Encode<
10995                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10996                fidl::encoding::DefaultFuchsiaResourceDialect,
10997            >,
10998        >
10999        fidl::encoding::Encode<
11000            DaiCreateRingBufferRequest,
11001            fidl::encoding::DefaultFuchsiaResourceDialect,
11002        > for (T0, T1, T2)
11003    {
11004        #[inline]
11005        unsafe fn encode(
11006            self,
11007            encoder: &mut fidl::encoding::Encoder<
11008                '_,
11009                fidl::encoding::DefaultFuchsiaResourceDialect,
11010            >,
11011            offset: usize,
11012            depth: fidl::encoding::Depth,
11013        ) -> fidl::Result<()> {
11014            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11015            // Zero out padding regions. There's no need to apply masks
11016            // because the unmasked parts will be overwritten by fields.
11017            unsafe {
11018                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11019                (ptr as *mut u64).write_unaligned(0);
11020            }
11021            // Write the fields.
11022            self.0.encode(encoder, offset + 0, depth)?;
11023            self.1.encode(encoder, offset + 48, depth)?;
11024            self.2.encode(encoder, offset + 64, depth)?;
11025            Ok(())
11026        }
11027    }
11028
11029    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11030        for DaiCreateRingBufferRequest
11031    {
11032        #[inline(always)]
11033        fn new_empty() -> Self {
11034            Self {
11035                dai_format: fidl::new_empty!(
11036                    DaiFormat,
11037                    fidl::encoding::DefaultFuchsiaResourceDialect
11038                ),
11039                ring_buffer_format: fidl::new_empty!(
11040                    Format,
11041                    fidl::encoding::DefaultFuchsiaResourceDialect
11042                ),
11043                ring_buffer: fidl::new_empty!(
11044                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11045                    fidl::encoding::DefaultFuchsiaResourceDialect
11046                ),
11047            }
11048        }
11049
11050        #[inline]
11051        unsafe fn decode(
11052            &mut self,
11053            decoder: &mut fidl::encoding::Decoder<
11054                '_,
11055                fidl::encoding::DefaultFuchsiaResourceDialect,
11056            >,
11057            offset: usize,
11058            _depth: fidl::encoding::Depth,
11059        ) -> fidl::Result<()> {
11060            decoder.debug_check_bounds::<Self>(offset);
11061            // Verify that padding bytes are zero.
11062            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11063            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11064            let mask = 0xffffffff00000000u64;
11065            let maskedval = padval & mask;
11066            if maskedval != 0 {
11067                return Err(fidl::Error::NonZeroPadding {
11068                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11069                });
11070            }
11071            fidl::decode!(
11072                DaiFormat,
11073                fidl::encoding::DefaultFuchsiaResourceDialect,
11074                &mut self.dai_format,
11075                decoder,
11076                offset + 0,
11077                _depth
11078            )?;
11079            fidl::decode!(
11080                Format,
11081                fidl::encoding::DefaultFuchsiaResourceDialect,
11082                &mut self.ring_buffer_format,
11083                decoder,
11084                offset + 48,
11085                _depth
11086            )?;
11087            fidl::decode!(
11088                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11089                fidl::encoding::DefaultFuchsiaResourceDialect,
11090                &mut self.ring_buffer,
11091                decoder,
11092                offset + 64,
11093                _depth
11094            )?;
11095            Ok(())
11096        }
11097    }
11098
11099    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11100        type Borrowed<'a> = &'a mut Self;
11101        fn take_or_borrow<'a>(
11102            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11103        ) -> Self::Borrowed<'a> {
11104            value
11105        }
11106    }
11107
11108    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11109        type Owned = Self;
11110
11111        #[inline(always)]
11112        fn inline_align(_context: fidl::encoding::Context) -> usize {
11113            4
11114        }
11115
11116        #[inline(always)]
11117        fn inline_size(_context: fidl::encoding::Context) -> usize {
11118            8
11119        }
11120    }
11121
11122    unsafe impl
11123        fidl::encoding::Encode<
11124            RingBufferGetVmoResponse,
11125            fidl::encoding::DefaultFuchsiaResourceDialect,
11126        > for &mut RingBufferGetVmoResponse
11127    {
11128        #[inline]
11129        unsafe fn encode(
11130            self,
11131            encoder: &mut fidl::encoding::Encoder<
11132                '_,
11133                fidl::encoding::DefaultFuchsiaResourceDialect,
11134            >,
11135            offset: usize,
11136            _depth: fidl::encoding::Depth,
11137        ) -> fidl::Result<()> {
11138            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11139            // Delegate to tuple encoding.
11140            fidl::encoding::Encode::<
11141                RingBufferGetVmoResponse,
11142                fidl::encoding::DefaultFuchsiaResourceDialect,
11143            >::encode(
11144                (
11145                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11146                    <fidl::encoding::HandleType<
11147                        fidl::Vmo,
11148                        { fidl::ObjectType::VMO.into_raw() },
11149                        2147483648,
11150                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11151                        &mut self.ring_buffer
11152                    ),
11153                ),
11154                encoder,
11155                offset,
11156                _depth,
11157            )
11158        }
11159    }
11160    unsafe impl<
11161            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11162            T1: fidl::encoding::Encode<
11163                fidl::encoding::HandleType<
11164                    fidl::Vmo,
11165                    { fidl::ObjectType::VMO.into_raw() },
11166                    2147483648,
11167                >,
11168                fidl::encoding::DefaultFuchsiaResourceDialect,
11169            >,
11170        >
11171        fidl::encoding::Encode<
11172            RingBufferGetVmoResponse,
11173            fidl::encoding::DefaultFuchsiaResourceDialect,
11174        > for (T0, T1)
11175    {
11176        #[inline]
11177        unsafe fn encode(
11178            self,
11179            encoder: &mut fidl::encoding::Encoder<
11180                '_,
11181                fidl::encoding::DefaultFuchsiaResourceDialect,
11182            >,
11183            offset: usize,
11184            depth: fidl::encoding::Depth,
11185        ) -> fidl::Result<()> {
11186            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11187            // Zero out padding regions. There's no need to apply masks
11188            // because the unmasked parts will be overwritten by fields.
11189            // Write the fields.
11190            self.0.encode(encoder, offset + 0, depth)?;
11191            self.1.encode(encoder, offset + 4, depth)?;
11192            Ok(())
11193        }
11194    }
11195
11196    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11197        for RingBufferGetVmoResponse
11198    {
11199        #[inline(always)]
11200        fn new_empty() -> Self {
11201            Self {
11202                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11203                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11204            }
11205        }
11206
11207        #[inline]
11208        unsafe fn decode(
11209            &mut self,
11210            decoder: &mut fidl::encoding::Decoder<
11211                '_,
11212                fidl::encoding::DefaultFuchsiaResourceDialect,
11213            >,
11214            offset: usize,
11215            _depth: fidl::encoding::Depth,
11216        ) -> fidl::Result<()> {
11217            decoder.debug_check_bounds::<Self>(offset);
11218            // Verify that padding bytes are zero.
11219            fidl::decode!(
11220                u32,
11221                fidl::encoding::DefaultFuchsiaResourceDialect,
11222                &mut self.num_frames,
11223                decoder,
11224                offset + 0,
11225                _depth
11226            )?;
11227            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11228            Ok(())
11229        }
11230    }
11231
11232    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11233        type Borrowed<'a> = &'a mut Self;
11234        fn take_or_borrow<'a>(
11235            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11236        ) -> Self::Borrowed<'a> {
11237            value
11238        }
11239    }
11240
11241    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11242        type Owned = Self;
11243
11244        #[inline(always)]
11245        fn inline_align(_context: fidl::encoding::Context) -> usize {
11246            4
11247        }
11248
11249        #[inline(always)]
11250        fn inline_size(_context: fidl::encoding::Context) -> usize {
11251            4
11252        }
11253    }
11254
11255    unsafe impl
11256        fidl::encoding::Encode<
11257            StreamConfigConnectorConnectRequest,
11258            fidl::encoding::DefaultFuchsiaResourceDialect,
11259        > for &mut StreamConfigConnectorConnectRequest
11260    {
11261        #[inline]
11262        unsafe fn encode(
11263            self,
11264            encoder: &mut fidl::encoding::Encoder<
11265                '_,
11266                fidl::encoding::DefaultFuchsiaResourceDialect,
11267            >,
11268            offset: usize,
11269            _depth: fidl::encoding::Depth,
11270        ) -> fidl::Result<()> {
11271            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11272            // Delegate to tuple encoding.
11273            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11274                (
11275                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11276                ),
11277                encoder, offset, _depth
11278            )
11279        }
11280    }
11281    unsafe impl<
11282            T0: fidl::encoding::Encode<
11283                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11284                fidl::encoding::DefaultFuchsiaResourceDialect,
11285            >,
11286        >
11287        fidl::encoding::Encode<
11288            StreamConfigConnectorConnectRequest,
11289            fidl::encoding::DefaultFuchsiaResourceDialect,
11290        > for (T0,)
11291    {
11292        #[inline]
11293        unsafe fn encode(
11294            self,
11295            encoder: &mut fidl::encoding::Encoder<
11296                '_,
11297                fidl::encoding::DefaultFuchsiaResourceDialect,
11298            >,
11299            offset: usize,
11300            depth: fidl::encoding::Depth,
11301        ) -> fidl::Result<()> {
11302            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11303            // Zero out padding regions. There's no need to apply masks
11304            // because the unmasked parts will be overwritten by fields.
11305            // Write the fields.
11306            self.0.encode(encoder, offset + 0, depth)?;
11307            Ok(())
11308        }
11309    }
11310
11311    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11312        for StreamConfigConnectorConnectRequest
11313    {
11314        #[inline(always)]
11315        fn new_empty() -> Self {
11316            Self {
11317                protocol: fidl::new_empty!(
11318                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11319                    fidl::encoding::DefaultFuchsiaResourceDialect
11320                ),
11321            }
11322        }
11323
11324        #[inline]
11325        unsafe fn decode(
11326            &mut self,
11327            decoder: &mut fidl::encoding::Decoder<
11328                '_,
11329                fidl::encoding::DefaultFuchsiaResourceDialect,
11330            >,
11331            offset: usize,
11332            _depth: fidl::encoding::Depth,
11333        ) -> fidl::Result<()> {
11334            decoder.debug_check_bounds::<Self>(offset);
11335            // Verify that padding bytes are zero.
11336            fidl::decode!(
11337                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11338                fidl::encoding::DefaultFuchsiaResourceDialect,
11339                &mut self.protocol,
11340                decoder,
11341                offset + 0,
11342                _depth
11343            )?;
11344            Ok(())
11345        }
11346    }
11347
11348    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
11349        type Borrowed<'a> = &'a mut Self;
11350        fn take_or_borrow<'a>(
11351            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11352        ) -> Self::Borrowed<'a> {
11353            value
11354        }
11355    }
11356
11357    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
11358        type Owned = Self;
11359
11360        #[inline(always)]
11361        fn inline_align(_context: fidl::encoding::Context) -> usize {
11362            8
11363        }
11364
11365        #[inline(always)]
11366        fn inline_size(_context: fidl::encoding::Context) -> usize {
11367            24
11368        }
11369    }
11370
11371    unsafe impl
11372        fidl::encoding::Encode<
11373            StreamConfigCreateRingBufferRequest,
11374            fidl::encoding::DefaultFuchsiaResourceDialect,
11375        > for &mut StreamConfigCreateRingBufferRequest
11376    {
11377        #[inline]
11378        unsafe fn encode(
11379            self,
11380            encoder: &mut fidl::encoding::Encoder<
11381                '_,
11382                fidl::encoding::DefaultFuchsiaResourceDialect,
11383            >,
11384            offset: usize,
11385            _depth: fidl::encoding::Depth,
11386        ) -> fidl::Result<()> {
11387            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11388            // Delegate to tuple encoding.
11389            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11390                (
11391                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11392                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11393                ),
11394                encoder, offset, _depth
11395            )
11396        }
11397    }
11398    unsafe impl<
11399            T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11400            T1: fidl::encoding::Encode<
11401                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11402                fidl::encoding::DefaultFuchsiaResourceDialect,
11403            >,
11404        >
11405        fidl::encoding::Encode<
11406            StreamConfigCreateRingBufferRequest,
11407            fidl::encoding::DefaultFuchsiaResourceDialect,
11408        > for (T0, T1)
11409    {
11410        #[inline]
11411        unsafe fn encode(
11412            self,
11413            encoder: &mut fidl::encoding::Encoder<
11414                '_,
11415                fidl::encoding::DefaultFuchsiaResourceDialect,
11416            >,
11417            offset: usize,
11418            depth: fidl::encoding::Depth,
11419        ) -> fidl::Result<()> {
11420            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11421            // Zero out padding regions. There's no need to apply masks
11422            // because the unmasked parts will be overwritten by fields.
11423            unsafe {
11424                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11425                (ptr as *mut u64).write_unaligned(0);
11426            }
11427            // Write the fields.
11428            self.0.encode(encoder, offset + 0, depth)?;
11429            self.1.encode(encoder, offset + 16, depth)?;
11430            Ok(())
11431        }
11432    }
11433
11434    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11435        for StreamConfigCreateRingBufferRequest
11436    {
11437        #[inline(always)]
11438        fn new_empty() -> Self {
11439            Self {
11440                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
11441                ring_buffer: fidl::new_empty!(
11442                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11443                    fidl::encoding::DefaultFuchsiaResourceDialect
11444                ),
11445            }
11446        }
11447
11448        #[inline]
11449        unsafe fn decode(
11450            &mut self,
11451            decoder: &mut fidl::encoding::Decoder<
11452                '_,
11453                fidl::encoding::DefaultFuchsiaResourceDialect,
11454            >,
11455            offset: usize,
11456            _depth: fidl::encoding::Depth,
11457        ) -> fidl::Result<()> {
11458            decoder.debug_check_bounds::<Self>(offset);
11459            // Verify that padding bytes are zero.
11460            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11461            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11462            let mask = 0xffffffff00000000u64;
11463            let maskedval = padval & mask;
11464            if maskedval != 0 {
11465                return Err(fidl::Error::NonZeroPadding {
11466                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11467                });
11468            }
11469            fidl::decode!(
11470                Format,
11471                fidl::encoding::DefaultFuchsiaResourceDialect,
11472                &mut self.format,
11473                decoder,
11474                offset + 0,
11475                _depth
11476            )?;
11477            fidl::decode!(
11478                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11479                fidl::encoding::DefaultFuchsiaResourceDialect,
11480                &mut self.ring_buffer,
11481                decoder,
11482                offset + 16,
11483                _depth
11484            )?;
11485            Ok(())
11486        }
11487    }
11488}