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#[cfg(target_os = "fuchsia")]
384impl From<CodecSynchronousProxy> for zx::Handle {
385    fn from(value: CodecSynchronousProxy) -> Self {
386        value.into_channel().into()
387    }
388}
389
390#[cfg(target_os = "fuchsia")]
391impl From<fidl::Channel> for CodecSynchronousProxy {
392    fn from(value: fidl::Channel) -> Self {
393        Self::new(value)
394    }
395}
396
397#[cfg(target_os = "fuchsia")]
398impl fidl::endpoints::FromClient for CodecSynchronousProxy {
399    type Protocol = CodecMarker;
400
401    fn from_client(value: fidl::endpoints::ClientEnd<CodecMarker>) -> Self {
402        Self::new(value.into_channel())
403    }
404}
405
406#[derive(Debug, Clone)]
407pub struct CodecProxy {
408    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
409}
410
411impl fidl::endpoints::Proxy for CodecProxy {
412    type Protocol = CodecMarker;
413
414    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
415        Self::new(inner)
416    }
417
418    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
419        self.client.into_channel().map_err(|client| Self { client })
420    }
421
422    fn as_channel(&self) -> &::fidl::AsyncChannel {
423        self.client.as_channel()
424    }
425}
426
427impl CodecProxy {
428    /// Create a new Proxy for fuchsia.hardware.audio/Codec.
429    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
430        let protocol_name = <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
431        Self { client: fidl::client::Client::new(channel, protocol_name) }
432    }
433
434    /// Get a Stream of events from the remote end of the protocol.
435    ///
436    /// # Panics
437    ///
438    /// Panics if the event stream was already taken.
439    pub fn take_event_stream(&self) -> CodecEventStream {
440        CodecEventStream { event_receiver: self.client.take_event_receiver() }
441    }
442
443    /// Retrieves top level health state.
444    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
445    pub fn r#get_health_state(
446        &self,
447    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
448    {
449        CodecProxyInterface::r#get_health_state(self)
450    }
451
452    /// Connect to a `SignalProcessing` protocol.
453    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
454    /// the maximum number of connections have already been created, for instance one, then the
455    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
456    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
457    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
458    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
459    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
460    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
461    /// is intended to be composed, and hence the more verbose name allows differentiation and
462    /// improved clarity.
463    pub fn r#signal_processing_connect(
464        &self,
465        mut protocol: fidl::endpoints::ServerEnd<
466            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
467        >,
468    ) -> Result<(), fidl::Error> {
469        CodecProxyInterface::r#signal_processing_connect(self, protocol)
470    }
471
472    /// Resets the codec.
473    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
474    /// codec it will close the codec protocol channel, in this case the client may obtain a new
475    /// codec protocol channel and retry.
476    pub fn r#reset(
477        &self,
478    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
479        CodecProxyInterface::r#reset(self)
480    }
481
482    /// Retrieves top level static properties.
483    pub fn r#get_properties(
484        &self,
485    ) -> fidl::client::QueryResponseFut<
486        CodecProperties,
487        fidl::encoding::DefaultFuchsiaResourceDialect,
488    > {
489        CodecProxyInterface::r#get_properties(self)
490    }
491
492    /// Stops the codec operation.
493    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
494    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
495    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
496    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
497    /// in the CLOCK_MONOTONIC timeline.
498    /// If the driver cannot successfully configure the codec to stop, it will close the codec
499    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
500    pub fn r#stop(
501        &self,
502    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
503        CodecProxyInterface::r#stop(self)
504    }
505
506    /// Start/Re-start the codec operation.
507    /// `Start` returns when configuring the codec to start is completed. This method does not wait
508    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
509    /// into account), nor is any such delay reflected in the returned `start_time`.
510    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
511    /// in the CLOCK_MONOTONIC timeline.
512    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
513    /// in which case the client may obtain a new codec protocol channel and retry.
514    pub fn r#start(
515        &self,
516    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
517        CodecProxyInterface::r#start(self)
518    }
519
520    /// Returns whether a codec is bridgeable.
521    ///
522    /// # Deprecation
523    ///
524    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
525    /// A driver can still be configured to operate in bridged mode or not at boot time.
526    pub fn r#is_bridgeable(
527        &self,
528    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
529        CodecProxyInterface::r#is_bridgeable(self)
530    }
531
532    /// Sets a codec's bridged mode. This method is required, but it only needs to take action if
533    /// the codec supports bridged mode as specified by its reply to `IsBridgeable`.
534    ///
535    /// # Deprecation
536    ///
537    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
538    /// A driver can still be configured to operate in bridged mode or not at boot time.
539    pub fn r#set_bridged_mode(&self, mut enable_bridged_mode: bool) -> Result<(), fidl::Error> {
540        CodecProxyInterface::r#set_bridged_mode(self, enable_bridged_mode)
541    }
542
543    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
544    /// may reply with an error status and the controller may retry at a later time.
545    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
546    /// combinations of the parameters in DaiSupportedFormats may be supported.
547    pub fn r#get_dai_formats(
548        &self,
549    ) -> fidl::client::QueryResponseFut<
550        CodecGetDaiFormatsResult,
551        fidl::encoding::DefaultFuchsiaResourceDialect,
552    > {
553        CodecProxyInterface::r#get_dai_formats(self)
554    }
555
556    /// Sets the DAI format to be used in the interface between the controller and codec.
557    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
558    pub fn r#set_dai_format(
559        &self,
560        mut format: &DaiFormat,
561    ) -> fidl::client::QueryResponseFut<
562        CodecSetDaiFormatResult,
563        fidl::encoding::DefaultFuchsiaResourceDialect,
564    > {
565        CodecProxyInterface::r#set_dai_format(self, format)
566    }
567
568    /// Get the plug detect state via a hanging get. The driver will reply to the first
569    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
570    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
571    pub fn r#watch_plug_state(
572        &self,
573    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
574    {
575        CodecProxyInterface::r#watch_plug_state(self)
576    }
577}
578
579impl CodecProxyInterface for CodecProxy {
580    type GetHealthStateResponseFut =
581        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
582    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
583        fn _decode(
584            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
585        ) -> Result<HealthState, fidl::Error> {
586            let _response = fidl::client::decode_transaction_body::<
587                HealthGetHealthStateResponse,
588                fidl::encoding::DefaultFuchsiaResourceDialect,
589                0x4e146d6bca733a84,
590            >(_buf?)?;
591            Ok(_response.state)
592        }
593        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
594            (),
595            0x4e146d6bca733a84,
596            fidl::encoding::DynamicFlags::empty(),
597            _decode,
598        )
599    }
600
601    fn r#signal_processing_connect(
602        &self,
603        mut protocol: fidl::endpoints::ServerEnd<
604            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
605        >,
606    ) -> Result<(), fidl::Error> {
607        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
608            (protocol,),
609            0xa81907ce6066295,
610            fidl::encoding::DynamicFlags::empty(),
611        )
612    }
613
614    type ResetResponseFut =
615        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
616    fn r#reset(&self) -> Self::ResetResponseFut {
617        fn _decode(
618            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
619        ) -> Result<(), fidl::Error> {
620            let _response = fidl::client::decode_transaction_body::<
621                fidl::encoding::EmptyPayload,
622                fidl::encoding::DefaultFuchsiaResourceDialect,
623                0x50757ae579a7bd6b,
624            >(_buf?)?;
625            Ok(_response)
626        }
627        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
628            (),
629            0x50757ae579a7bd6b,
630            fidl::encoding::DynamicFlags::empty(),
631            _decode,
632        )
633    }
634
635    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
636        CodecProperties,
637        fidl::encoding::DefaultFuchsiaResourceDialect,
638    >;
639    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
640        fn _decode(
641            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
642        ) -> Result<CodecProperties, fidl::Error> {
643            let _response = fidl::client::decode_transaction_body::<
644                CodecGetPropertiesResponse,
645                fidl::encoding::DefaultFuchsiaResourceDialect,
646                0x7a0d138a6a1d9d90,
647            >(_buf?)?;
648            Ok(_response.properties)
649        }
650        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecProperties>(
651            (),
652            0x7a0d138a6a1d9d90,
653            fidl::encoding::DynamicFlags::empty(),
654            _decode,
655        )
656    }
657
658    type StopResponseFut =
659        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
660    fn r#stop(&self) -> Self::StopResponseFut {
661        fn _decode(
662            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
663        ) -> Result<i64, fidl::Error> {
664            let _response = fidl::client::decode_transaction_body::<
665                CodecStopResponse,
666                fidl::encoding::DefaultFuchsiaResourceDialect,
667                0x5c2e380df1332dbd,
668            >(_buf?)?;
669            Ok(_response.stop_time)
670        }
671        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
672            (),
673            0x5c2e380df1332dbd,
674            fidl::encoding::DynamicFlags::empty(),
675            _decode,
676        )
677    }
678
679    type StartResponseFut =
680        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
681    fn r#start(&self) -> Self::StartResponseFut {
682        fn _decode(
683            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
684        ) -> Result<i64, fidl::Error> {
685            let _response = fidl::client::decode_transaction_body::<
686                CodecStartResponse,
687                fidl::encoding::DefaultFuchsiaResourceDialect,
688                0x329cdacb286ab00,
689            >(_buf?)?;
690            Ok(_response.start_time)
691        }
692        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
693            (),
694            0x329cdacb286ab00,
695            fidl::encoding::DynamicFlags::empty(),
696            _decode,
697        )
698    }
699
700    type IsBridgeableResponseFut =
701        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
702    fn r#is_bridgeable(&self) -> Self::IsBridgeableResponseFut {
703        fn _decode(
704            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
705        ) -> Result<bool, fidl::Error> {
706            let _response = fidl::client::decode_transaction_body::<
707                CodecIsBridgeableResponse,
708                fidl::encoding::DefaultFuchsiaResourceDialect,
709                0x26b0684f603f88ec,
710            >(_buf?)?;
711            Ok(_response.supports_bridged_mode)
712        }
713        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
714            (),
715            0x26b0684f603f88ec,
716            fidl::encoding::DynamicFlags::empty(),
717            _decode,
718        )
719    }
720
721    fn r#set_bridged_mode(&self, mut enable_bridged_mode: bool) -> Result<(), fidl::Error> {
722        self.client.send::<CodecSetBridgedModeRequest>(
723            (enable_bridged_mode,),
724            0x2bd8f7bfd0b0aa36,
725            fidl::encoding::DynamicFlags::empty(),
726        )
727    }
728
729    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
730        CodecGetDaiFormatsResult,
731        fidl::encoding::DefaultFuchsiaResourceDialect,
732    >;
733    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
734        fn _decode(
735            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
736        ) -> Result<CodecGetDaiFormatsResult, fidl::Error> {
737            let _response = fidl::client::decode_transaction_body::<
738                fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>,
739                fidl::encoding::DefaultFuchsiaResourceDialect,
740                0xf8bbc46b4ba6a52,
741            >(_buf?)?;
742            Ok(_response.map(|x| x.formats))
743        }
744        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CodecGetDaiFormatsResult>(
745            (),
746            0xf8bbc46b4ba6a52,
747            fidl::encoding::DynamicFlags::empty(),
748            _decode,
749        )
750    }
751
752    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
753        CodecSetDaiFormatResult,
754        fidl::encoding::DefaultFuchsiaResourceDialect,
755    >;
756    fn r#set_dai_format(&self, mut format: &DaiFormat) -> Self::SetDaiFormatResponseFut {
757        fn _decode(
758            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
759        ) -> Result<CodecSetDaiFormatResult, fidl::Error> {
760            let _response = fidl::client::decode_transaction_body::<
761                fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>,
762                fidl::encoding::DefaultFuchsiaResourceDialect,
763                0x2f829df9e5a7a1ea,
764            >(_buf?)?;
765            Ok(_response.map(|x| x.state))
766        }
767        self.client.send_query_and_decode::<CodecSetDaiFormatRequest, CodecSetDaiFormatResult>(
768            (format,),
769            0x2f829df9e5a7a1ea,
770            fidl::encoding::DynamicFlags::empty(),
771            _decode,
772        )
773    }
774
775    type WatchPlugStateResponseFut =
776        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
777    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
778        fn _decode(
779            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
780        ) -> Result<PlugState, fidl::Error> {
781            let _response = fidl::client::decode_transaction_body::<
782                CodecWatchPlugStateResponse,
783                fidl::encoding::DefaultFuchsiaResourceDialect,
784                0x182b87f935ca7326,
785            >(_buf?)?;
786            Ok(_response.plug_state)
787        }
788        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
789            (),
790            0x182b87f935ca7326,
791            fidl::encoding::DynamicFlags::empty(),
792            _decode,
793        )
794    }
795}
796
797pub struct CodecEventStream {
798    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
799}
800
801impl std::marker::Unpin for CodecEventStream {}
802
803impl futures::stream::FusedStream for CodecEventStream {
804    fn is_terminated(&self) -> bool {
805        self.event_receiver.is_terminated()
806    }
807}
808
809impl futures::Stream for CodecEventStream {
810    type Item = Result<CodecEvent, fidl::Error>;
811
812    fn poll_next(
813        mut self: std::pin::Pin<&mut Self>,
814        cx: &mut std::task::Context<'_>,
815    ) -> std::task::Poll<Option<Self::Item>> {
816        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
817            &mut self.event_receiver,
818            cx
819        )?) {
820            Some(buf) => std::task::Poll::Ready(Some(CodecEvent::decode(buf))),
821            None => std::task::Poll::Ready(None),
822        }
823    }
824}
825
826#[derive(Debug)]
827pub enum CodecEvent {}
828
829impl CodecEvent {
830    /// Decodes a message buffer as a [`CodecEvent`].
831    fn decode(
832        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
833    ) -> Result<CodecEvent, fidl::Error> {
834        let (bytes, _handles) = buf.split_mut();
835        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
836        debug_assert_eq!(tx_header.tx_id, 0);
837        match tx_header.ordinal {
838            _ => Err(fidl::Error::UnknownOrdinal {
839                ordinal: tx_header.ordinal,
840                protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
841            }),
842        }
843    }
844}
845
846/// A Stream of incoming requests for fuchsia.hardware.audio/Codec.
847pub struct CodecRequestStream {
848    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
849    is_terminated: bool,
850}
851
852impl std::marker::Unpin for CodecRequestStream {}
853
854impl futures::stream::FusedStream for CodecRequestStream {
855    fn is_terminated(&self) -> bool {
856        self.is_terminated
857    }
858}
859
860impl fidl::endpoints::RequestStream for CodecRequestStream {
861    type Protocol = CodecMarker;
862    type ControlHandle = CodecControlHandle;
863
864    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
865        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
866    }
867
868    fn control_handle(&self) -> Self::ControlHandle {
869        CodecControlHandle { inner: self.inner.clone() }
870    }
871
872    fn into_inner(
873        self,
874    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
875    {
876        (self.inner, self.is_terminated)
877    }
878
879    fn from_inner(
880        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
881        is_terminated: bool,
882    ) -> Self {
883        Self { inner, is_terminated }
884    }
885}
886
887impl futures::Stream for CodecRequestStream {
888    type Item = Result<CodecRequest, fidl::Error>;
889
890    fn poll_next(
891        mut self: std::pin::Pin<&mut Self>,
892        cx: &mut std::task::Context<'_>,
893    ) -> std::task::Poll<Option<Self::Item>> {
894        let this = &mut *self;
895        if this.inner.check_shutdown(cx) {
896            this.is_terminated = true;
897            return std::task::Poll::Ready(None);
898        }
899        if this.is_terminated {
900            panic!("polled CodecRequestStream after completion");
901        }
902        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
903            |bytes, handles| {
904                match this.inner.channel().read_etc(cx, bytes, handles) {
905                    std::task::Poll::Ready(Ok(())) => {}
906                    std::task::Poll::Pending => return std::task::Poll::Pending,
907                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
908                        this.is_terminated = true;
909                        return std::task::Poll::Ready(None);
910                    }
911                    std::task::Poll::Ready(Err(e)) => {
912                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
913                            e.into(),
914                        ))))
915                    }
916                }
917
918                // A message has been received from the channel
919                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
920
921                std::task::Poll::Ready(Some(match header.ordinal {
922                    0x4e146d6bca733a84 => {
923                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
924                        let mut req = fidl::new_empty!(
925                            fidl::encoding::EmptyPayload,
926                            fidl::encoding::DefaultFuchsiaResourceDialect
927                        );
928                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
929                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
930                        Ok(CodecRequest::GetHealthState {
931                            responder: CodecGetHealthStateResponder {
932                                control_handle: std::mem::ManuallyDrop::new(control_handle),
933                                tx_id: header.tx_id,
934                            },
935                        })
936                    }
937                    0xa81907ce6066295 => {
938                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
939                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
940                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
941                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
942                        Ok(CodecRequest::SignalProcessingConnect {
943                            protocol: req.protocol,
944
945                            control_handle,
946                        })
947                    }
948                    0x50757ae579a7bd6b => {
949                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
950                        let mut req = fidl::new_empty!(
951                            fidl::encoding::EmptyPayload,
952                            fidl::encoding::DefaultFuchsiaResourceDialect
953                        );
954                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
955                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
956                        Ok(CodecRequest::Reset {
957                            responder: CodecResetResponder {
958                                control_handle: std::mem::ManuallyDrop::new(control_handle),
959                                tx_id: header.tx_id,
960                            },
961                        })
962                    }
963                    0x7a0d138a6a1d9d90 => {
964                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
965                        let mut req = fidl::new_empty!(
966                            fidl::encoding::EmptyPayload,
967                            fidl::encoding::DefaultFuchsiaResourceDialect
968                        );
969                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
970                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
971                        Ok(CodecRequest::GetProperties {
972                            responder: CodecGetPropertiesResponder {
973                                control_handle: std::mem::ManuallyDrop::new(control_handle),
974                                tx_id: header.tx_id,
975                            },
976                        })
977                    }
978                    0x5c2e380df1332dbd => {
979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
980                        let mut req = fidl::new_empty!(
981                            fidl::encoding::EmptyPayload,
982                            fidl::encoding::DefaultFuchsiaResourceDialect
983                        );
984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
985                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
986                        Ok(CodecRequest::Stop {
987                            responder: CodecStopResponder {
988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
989                                tx_id: header.tx_id,
990                            },
991                        })
992                    }
993                    0x329cdacb286ab00 => {
994                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
995                        let mut req = fidl::new_empty!(
996                            fidl::encoding::EmptyPayload,
997                            fidl::encoding::DefaultFuchsiaResourceDialect
998                        );
999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1000                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1001                        Ok(CodecRequest::Start {
1002                            responder: CodecStartResponder {
1003                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1004                                tx_id: header.tx_id,
1005                            },
1006                        })
1007                    }
1008                    0x26b0684f603f88ec => {
1009                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1010                        let mut req = fidl::new_empty!(
1011                            fidl::encoding::EmptyPayload,
1012                            fidl::encoding::DefaultFuchsiaResourceDialect
1013                        );
1014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1015                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1016                        Ok(CodecRequest::IsBridgeable {
1017                            responder: CodecIsBridgeableResponder {
1018                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1019                                tx_id: header.tx_id,
1020                            },
1021                        })
1022                    }
1023                    0x2bd8f7bfd0b0aa36 => {
1024                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1025                        let mut req = fidl::new_empty!(
1026                            CodecSetBridgedModeRequest,
1027                            fidl::encoding::DefaultFuchsiaResourceDialect
1028                        );
1029                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetBridgedModeRequest>(&header, _body_bytes, handles, &mut req)?;
1030                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1031                        Ok(CodecRequest::SetBridgedMode {
1032                            enable_bridged_mode: req.enable_bridged_mode,
1033
1034                            control_handle,
1035                        })
1036                    }
1037                    0xf8bbc46b4ba6a52 => {
1038                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1039                        let mut req = fidl::new_empty!(
1040                            fidl::encoding::EmptyPayload,
1041                            fidl::encoding::DefaultFuchsiaResourceDialect
1042                        );
1043                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1044                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1045                        Ok(CodecRequest::GetDaiFormats {
1046                            responder: CodecGetDaiFormatsResponder {
1047                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1048                                tx_id: header.tx_id,
1049                            },
1050                        })
1051                    }
1052                    0x2f829df9e5a7a1ea => {
1053                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1054                        let mut req = fidl::new_empty!(
1055                            CodecSetDaiFormatRequest,
1056                            fidl::encoding::DefaultFuchsiaResourceDialect
1057                        );
1058                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
1059                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1060                        Ok(CodecRequest::SetDaiFormat {
1061                            format: req.format,
1062
1063                            responder: CodecSetDaiFormatResponder {
1064                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1065                                tx_id: header.tx_id,
1066                            },
1067                        })
1068                    }
1069                    0x182b87f935ca7326 => {
1070                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1071                        let mut req = fidl::new_empty!(
1072                            fidl::encoding::EmptyPayload,
1073                            fidl::encoding::DefaultFuchsiaResourceDialect
1074                        );
1075                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1076                        let control_handle = CodecControlHandle { inner: this.inner.clone() };
1077                        Ok(CodecRequest::WatchPlugState {
1078                            responder: CodecWatchPlugStateResponder {
1079                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1080                                tx_id: header.tx_id,
1081                            },
1082                        })
1083                    }
1084                    _ => Err(fidl::Error::UnknownOrdinal {
1085                        ordinal: header.ordinal,
1086                        protocol_name: <CodecMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1087                    }),
1088                }))
1089            },
1090        )
1091    }
1092}
1093
1094/// For an overview see
1095/// [[Audio Codec Interface]](https://fuchsia.dev/fuchsia-src/development/audio/drivers/codec).
1096/// # Deprecation
1097///
1098/// Not supported anymore, instead use an
1099/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
1100/// with one DAI and no Ring Buffer, see
1101/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
1102#[derive(Debug)]
1103pub enum CodecRequest {
1104    /// Retrieves top level health state.
1105    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
1106    GetHealthState { responder: CodecGetHealthStateResponder },
1107    /// Connect to a `SignalProcessing` protocol.
1108    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
1109    /// the maximum number of connections have already been created, for instance one, then the
1110    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
1111    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
1112    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
1113    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
1114    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
1115    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
1116    /// is intended to be composed, and hence the more verbose name allows differentiation and
1117    /// improved clarity.
1118    SignalProcessingConnect {
1119        protocol: fidl::endpoints::ServerEnd<
1120            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1121        >,
1122        control_handle: CodecControlHandle,
1123    },
1124    /// Resets the codec.
1125    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the
1126    /// codec it will close the codec protocol channel, in this case the client may obtain a new
1127    /// codec protocol channel and retry.
1128    Reset { responder: CodecResetResponder },
1129    /// Retrieves top level static properties.
1130    GetProperties { responder: CodecGetPropertiesResponder },
1131    /// Stops the codec operation.
1132    /// `Stop` returns when configuring the codec to stop is completed. This method does not wait
1133    /// for the hardware to actually stop playback/capture (i.e. `turn_off_delay` impact is not
1134    /// taken into account), nor is any such delay reflected in the returned `stop_time`.
1135    /// `stop_time` indicates when the driver finished configuring the codec to stop, as measured
1136    /// in the CLOCK_MONOTONIC timeline.
1137    /// If the driver cannot successfully configure the codec to stop, it will close the codec
1138    /// protocol channel, in which case the client may obtain a new codec protocol channel and retry.
1139    Stop { responder: CodecStopResponder },
1140    /// Start/Re-start the codec operation.
1141    /// `Start` returns when configuring the codec to start is completed. This method does not wait
1142    /// for the hardware to actually start playback/capture (i.e. `turn_on_delay` impact is not taken
1143    /// into account), nor is any such delay reflected in the returned `start_time`.
1144    /// `start_time` indicates when the driver finished configuring the codec to start, as measured
1145    /// in the CLOCK_MONOTONIC timeline.
1146    /// If the driver can't successfully start the codec, it will close the codec protocol channel,
1147    /// in which case the client may obtain a new codec protocol channel and retry.
1148    Start { responder: CodecStartResponder },
1149    /// Returns whether a codec is bridgeable.
1150    ///
1151    /// # Deprecation
1152    ///
1153    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
1154    /// A driver can still be configured to operate in bridged mode or not at boot time.
1155    IsBridgeable { responder: CodecIsBridgeableResponder },
1156    /// Sets a codec's bridged mode. This method is required, but it only needs to take action if
1157    /// the codec supports bridged mode as specified by its reply to `IsBridgeable`.
1158    ///
1159    /// # Deprecation
1160    ///
1161    /// Not supported anymore, bridged configurations are no longer changeable at runtime.
1162    /// A driver can still be configured to operate in bridged mode or not at boot time.
1163    SetBridgedMode { enable_bridged_mode: bool, control_handle: CodecControlHandle },
1164    /// Retrieves the DAI formats supported by the codec, if not available at the time the codec
1165    /// may reply with an error status and the controller may retry at a later time.
1166    /// Retrieving multiple DaiSupportedFormats allows for cases where exclusive
1167    /// combinations of the parameters in DaiSupportedFormats may be supported.
1168    GetDaiFormats { responder: CodecGetDaiFormatsResponder },
1169    /// Sets the DAI format to be used in the interface between the controller and codec.
1170    /// Returns an error if not supported at the time of the request (e.g. for removable hardware).
1171    SetDaiFormat { format: DaiFormat, responder: CodecSetDaiFormatResponder },
1172    /// Get the plug detect state via a hanging get. The driver will reply to the first
1173    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
1174    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
1175    WatchPlugState { responder: CodecWatchPlugStateResponder },
1176}
1177
1178impl CodecRequest {
1179    #[allow(irrefutable_let_patterns)]
1180    pub fn into_get_health_state(self) -> Option<(CodecGetHealthStateResponder)> {
1181        if let CodecRequest::GetHealthState { responder } = self {
1182            Some((responder))
1183        } else {
1184            None
1185        }
1186    }
1187
1188    #[allow(irrefutable_let_patterns)]
1189    pub fn into_signal_processing_connect(
1190        self,
1191    ) -> Option<(
1192        fidl::endpoints::ServerEnd<
1193            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
1194        >,
1195        CodecControlHandle,
1196    )> {
1197        if let CodecRequest::SignalProcessingConnect { protocol, control_handle } = self {
1198            Some((protocol, control_handle))
1199        } else {
1200            None
1201        }
1202    }
1203
1204    #[allow(irrefutable_let_patterns)]
1205    pub fn into_reset(self) -> Option<(CodecResetResponder)> {
1206        if let CodecRequest::Reset { responder } = self {
1207            Some((responder))
1208        } else {
1209            None
1210        }
1211    }
1212
1213    #[allow(irrefutable_let_patterns)]
1214    pub fn into_get_properties(self) -> Option<(CodecGetPropertiesResponder)> {
1215        if let CodecRequest::GetProperties { responder } = self {
1216            Some((responder))
1217        } else {
1218            None
1219        }
1220    }
1221
1222    #[allow(irrefutable_let_patterns)]
1223    pub fn into_stop(self) -> Option<(CodecStopResponder)> {
1224        if let CodecRequest::Stop { responder } = self {
1225            Some((responder))
1226        } else {
1227            None
1228        }
1229    }
1230
1231    #[allow(irrefutable_let_patterns)]
1232    pub fn into_start(self) -> Option<(CodecStartResponder)> {
1233        if let CodecRequest::Start { responder } = self {
1234            Some((responder))
1235        } else {
1236            None
1237        }
1238    }
1239
1240    #[allow(irrefutable_let_patterns)]
1241    pub fn into_is_bridgeable(self) -> Option<(CodecIsBridgeableResponder)> {
1242        if let CodecRequest::IsBridgeable { responder } = self {
1243            Some((responder))
1244        } else {
1245            None
1246        }
1247    }
1248
1249    #[allow(irrefutable_let_patterns)]
1250    pub fn into_set_bridged_mode(self) -> Option<(bool, CodecControlHandle)> {
1251        if let CodecRequest::SetBridgedMode { enable_bridged_mode, control_handle } = self {
1252            Some((enable_bridged_mode, control_handle))
1253        } else {
1254            None
1255        }
1256    }
1257
1258    #[allow(irrefutable_let_patterns)]
1259    pub fn into_get_dai_formats(self) -> Option<(CodecGetDaiFormatsResponder)> {
1260        if let CodecRequest::GetDaiFormats { responder } = self {
1261            Some((responder))
1262        } else {
1263            None
1264        }
1265    }
1266
1267    #[allow(irrefutable_let_patterns)]
1268    pub fn into_set_dai_format(self) -> Option<(DaiFormat, CodecSetDaiFormatResponder)> {
1269        if let CodecRequest::SetDaiFormat { format, responder } = self {
1270            Some((format, responder))
1271        } else {
1272            None
1273        }
1274    }
1275
1276    #[allow(irrefutable_let_patterns)]
1277    pub fn into_watch_plug_state(self) -> Option<(CodecWatchPlugStateResponder)> {
1278        if let CodecRequest::WatchPlugState { responder } = self {
1279            Some((responder))
1280        } else {
1281            None
1282        }
1283    }
1284
1285    /// Name of the method defined in FIDL
1286    pub fn method_name(&self) -> &'static str {
1287        match *self {
1288            CodecRequest::GetHealthState { .. } => "get_health_state",
1289            CodecRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
1290            CodecRequest::Reset { .. } => "reset",
1291            CodecRequest::GetProperties { .. } => "get_properties",
1292            CodecRequest::Stop { .. } => "stop",
1293            CodecRequest::Start { .. } => "start",
1294            CodecRequest::IsBridgeable { .. } => "is_bridgeable",
1295            CodecRequest::SetBridgedMode { .. } => "set_bridged_mode",
1296            CodecRequest::GetDaiFormats { .. } => "get_dai_formats",
1297            CodecRequest::SetDaiFormat { .. } => "set_dai_format",
1298            CodecRequest::WatchPlugState { .. } => "watch_plug_state",
1299        }
1300    }
1301}
1302
1303#[derive(Debug, Clone)]
1304pub struct CodecControlHandle {
1305    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1306}
1307
1308impl fidl::endpoints::ControlHandle for CodecControlHandle {
1309    fn shutdown(&self) {
1310        self.inner.shutdown()
1311    }
1312    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1313        self.inner.shutdown_with_epitaph(status)
1314    }
1315
1316    fn is_closed(&self) -> bool {
1317        self.inner.channel().is_closed()
1318    }
1319    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1320        self.inner.channel().on_closed()
1321    }
1322
1323    #[cfg(target_os = "fuchsia")]
1324    fn signal_peer(
1325        &self,
1326        clear_mask: zx::Signals,
1327        set_mask: zx::Signals,
1328    ) -> Result<(), zx_status::Status> {
1329        use fidl::Peered;
1330        self.inner.channel().signal_peer(clear_mask, set_mask)
1331    }
1332}
1333
1334impl CodecControlHandle {}
1335
1336#[must_use = "FIDL methods require a response to be sent"]
1337#[derive(Debug)]
1338pub struct CodecGetHealthStateResponder {
1339    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1340    tx_id: u32,
1341}
1342
1343/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1344/// if the responder is dropped without sending a response, so that the client
1345/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1346impl std::ops::Drop for CodecGetHealthStateResponder {
1347    fn drop(&mut self) {
1348        self.control_handle.shutdown();
1349        // Safety: drops once, never accessed again
1350        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1351    }
1352}
1353
1354impl fidl::endpoints::Responder for CodecGetHealthStateResponder {
1355    type ControlHandle = CodecControlHandle;
1356
1357    fn control_handle(&self) -> &CodecControlHandle {
1358        &self.control_handle
1359    }
1360
1361    fn drop_without_shutdown(mut self) {
1362        // Safety: drops once, never accessed again due to mem::forget
1363        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1364        // Prevent Drop from running (which would shut down the channel)
1365        std::mem::forget(self);
1366    }
1367}
1368
1369impl CodecGetHealthStateResponder {
1370    /// Sends a response to the FIDL transaction.
1371    ///
1372    /// Sets the channel to shutdown if an error occurs.
1373    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1374        let _result = self.send_raw(state);
1375        if _result.is_err() {
1376            self.control_handle.shutdown();
1377        }
1378        self.drop_without_shutdown();
1379        _result
1380    }
1381
1382    /// Similar to "send" but does not shutdown the channel if an error occurs.
1383    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
1384        let _result = self.send_raw(state);
1385        self.drop_without_shutdown();
1386        _result
1387    }
1388
1389    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
1390        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
1391            (state,),
1392            self.tx_id,
1393            0x4e146d6bca733a84,
1394            fidl::encoding::DynamicFlags::empty(),
1395        )
1396    }
1397}
1398
1399#[must_use = "FIDL methods require a response to be sent"]
1400#[derive(Debug)]
1401pub struct CodecResetResponder {
1402    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1403    tx_id: u32,
1404}
1405
1406/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1407/// if the responder is dropped without sending a response, so that the client
1408/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1409impl std::ops::Drop for CodecResetResponder {
1410    fn drop(&mut self) {
1411        self.control_handle.shutdown();
1412        // Safety: drops once, never accessed again
1413        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1414    }
1415}
1416
1417impl fidl::endpoints::Responder for CodecResetResponder {
1418    type ControlHandle = CodecControlHandle;
1419
1420    fn control_handle(&self) -> &CodecControlHandle {
1421        &self.control_handle
1422    }
1423
1424    fn drop_without_shutdown(mut self) {
1425        // Safety: drops once, never accessed again due to mem::forget
1426        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1427        // Prevent Drop from running (which would shut down the channel)
1428        std::mem::forget(self);
1429    }
1430}
1431
1432impl CodecResetResponder {
1433    /// Sends a response to the FIDL transaction.
1434    ///
1435    /// Sets the channel to shutdown if an error occurs.
1436    pub fn send(self) -> Result<(), fidl::Error> {
1437        let _result = self.send_raw();
1438        if _result.is_err() {
1439            self.control_handle.shutdown();
1440        }
1441        self.drop_without_shutdown();
1442        _result
1443    }
1444
1445    /// Similar to "send" but does not shutdown the channel if an error occurs.
1446    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1447        let _result = self.send_raw();
1448        self.drop_without_shutdown();
1449        _result
1450    }
1451
1452    fn send_raw(&self) -> Result<(), fidl::Error> {
1453        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1454            (),
1455            self.tx_id,
1456            0x50757ae579a7bd6b,
1457            fidl::encoding::DynamicFlags::empty(),
1458        )
1459    }
1460}
1461
1462#[must_use = "FIDL methods require a response to be sent"]
1463#[derive(Debug)]
1464pub struct CodecGetPropertiesResponder {
1465    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1466    tx_id: u32,
1467}
1468
1469/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1470/// if the responder is dropped without sending a response, so that the client
1471/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1472impl std::ops::Drop for CodecGetPropertiesResponder {
1473    fn drop(&mut self) {
1474        self.control_handle.shutdown();
1475        // Safety: drops once, never accessed again
1476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1477    }
1478}
1479
1480impl fidl::endpoints::Responder for CodecGetPropertiesResponder {
1481    type ControlHandle = CodecControlHandle;
1482
1483    fn control_handle(&self) -> &CodecControlHandle {
1484        &self.control_handle
1485    }
1486
1487    fn drop_without_shutdown(mut self) {
1488        // Safety: drops once, never accessed again due to mem::forget
1489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1490        // Prevent Drop from running (which would shut down the channel)
1491        std::mem::forget(self);
1492    }
1493}
1494
1495impl CodecGetPropertiesResponder {
1496    /// Sends a response to the FIDL transaction.
1497    ///
1498    /// Sets the channel to shutdown if an error occurs.
1499    pub fn send(self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1500        let _result = self.send_raw(properties);
1501        if _result.is_err() {
1502            self.control_handle.shutdown();
1503        }
1504        self.drop_without_shutdown();
1505        _result
1506    }
1507
1508    /// Similar to "send" but does not shutdown the channel if an error occurs.
1509    pub fn send_no_shutdown_on_err(
1510        self,
1511        mut properties: &CodecProperties,
1512    ) -> Result<(), fidl::Error> {
1513        let _result = self.send_raw(properties);
1514        self.drop_without_shutdown();
1515        _result
1516    }
1517
1518    fn send_raw(&self, mut properties: &CodecProperties) -> Result<(), fidl::Error> {
1519        self.control_handle.inner.send::<CodecGetPropertiesResponse>(
1520            (properties,),
1521            self.tx_id,
1522            0x7a0d138a6a1d9d90,
1523            fidl::encoding::DynamicFlags::empty(),
1524        )
1525    }
1526}
1527
1528#[must_use = "FIDL methods require a response to be sent"]
1529#[derive(Debug)]
1530pub struct CodecStopResponder {
1531    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1532    tx_id: u32,
1533}
1534
1535/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1536/// if the responder is dropped without sending a response, so that the client
1537/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1538impl std::ops::Drop for CodecStopResponder {
1539    fn drop(&mut self) {
1540        self.control_handle.shutdown();
1541        // Safety: drops once, never accessed again
1542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1543    }
1544}
1545
1546impl fidl::endpoints::Responder for CodecStopResponder {
1547    type ControlHandle = CodecControlHandle;
1548
1549    fn control_handle(&self) -> &CodecControlHandle {
1550        &self.control_handle
1551    }
1552
1553    fn drop_without_shutdown(mut self) {
1554        // Safety: drops once, never accessed again due to mem::forget
1555        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1556        // Prevent Drop from running (which would shut down the channel)
1557        std::mem::forget(self);
1558    }
1559}
1560
1561impl CodecStopResponder {
1562    /// Sends a response to the FIDL transaction.
1563    ///
1564    /// Sets the channel to shutdown if an error occurs.
1565    pub fn send(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1566        let _result = self.send_raw(stop_time);
1567        if _result.is_err() {
1568            self.control_handle.shutdown();
1569        }
1570        self.drop_without_shutdown();
1571        _result
1572    }
1573
1574    /// Similar to "send" but does not shutdown the channel if an error occurs.
1575    pub fn send_no_shutdown_on_err(self, mut stop_time: i64) -> Result<(), fidl::Error> {
1576        let _result = self.send_raw(stop_time);
1577        self.drop_without_shutdown();
1578        _result
1579    }
1580
1581    fn send_raw(&self, mut stop_time: i64) -> Result<(), fidl::Error> {
1582        self.control_handle.inner.send::<CodecStopResponse>(
1583            (stop_time,),
1584            self.tx_id,
1585            0x5c2e380df1332dbd,
1586            fidl::encoding::DynamicFlags::empty(),
1587        )
1588    }
1589}
1590
1591#[must_use = "FIDL methods require a response to be sent"]
1592#[derive(Debug)]
1593pub struct CodecStartResponder {
1594    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1595    tx_id: u32,
1596}
1597
1598/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1599/// if the responder is dropped without sending a response, so that the client
1600/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1601impl std::ops::Drop for CodecStartResponder {
1602    fn drop(&mut self) {
1603        self.control_handle.shutdown();
1604        // Safety: drops once, never accessed again
1605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1606    }
1607}
1608
1609impl fidl::endpoints::Responder for CodecStartResponder {
1610    type ControlHandle = CodecControlHandle;
1611
1612    fn control_handle(&self) -> &CodecControlHandle {
1613        &self.control_handle
1614    }
1615
1616    fn drop_without_shutdown(mut self) {
1617        // Safety: drops once, never accessed again due to mem::forget
1618        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1619        // Prevent Drop from running (which would shut down the channel)
1620        std::mem::forget(self);
1621    }
1622}
1623
1624impl CodecStartResponder {
1625    /// Sends a response to the FIDL transaction.
1626    ///
1627    /// Sets the channel to shutdown if an error occurs.
1628    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
1629        let _result = self.send_raw(start_time);
1630        if _result.is_err() {
1631            self.control_handle.shutdown();
1632        }
1633        self.drop_without_shutdown();
1634        _result
1635    }
1636
1637    /// Similar to "send" but does not shutdown the channel if an error occurs.
1638    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
1639        let _result = self.send_raw(start_time);
1640        self.drop_without_shutdown();
1641        _result
1642    }
1643
1644    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
1645        self.control_handle.inner.send::<CodecStartResponse>(
1646            (start_time,),
1647            self.tx_id,
1648            0x329cdacb286ab00,
1649            fidl::encoding::DynamicFlags::empty(),
1650        )
1651    }
1652}
1653
1654#[must_use = "FIDL methods require a response to be sent"]
1655#[derive(Debug)]
1656pub struct CodecIsBridgeableResponder {
1657    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1658    tx_id: u32,
1659}
1660
1661/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1662/// if the responder is dropped without sending a response, so that the client
1663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1664impl std::ops::Drop for CodecIsBridgeableResponder {
1665    fn drop(&mut self) {
1666        self.control_handle.shutdown();
1667        // Safety: drops once, never accessed again
1668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1669    }
1670}
1671
1672impl fidl::endpoints::Responder for CodecIsBridgeableResponder {
1673    type ControlHandle = CodecControlHandle;
1674
1675    fn control_handle(&self) -> &CodecControlHandle {
1676        &self.control_handle
1677    }
1678
1679    fn drop_without_shutdown(mut self) {
1680        // Safety: drops once, never accessed again due to mem::forget
1681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1682        // Prevent Drop from running (which would shut down the channel)
1683        std::mem::forget(self);
1684    }
1685}
1686
1687impl CodecIsBridgeableResponder {
1688    /// Sends a response to the FIDL transaction.
1689    ///
1690    /// Sets the channel to shutdown if an error occurs.
1691    pub fn send(self, mut supports_bridged_mode: bool) -> Result<(), fidl::Error> {
1692        let _result = self.send_raw(supports_bridged_mode);
1693        if _result.is_err() {
1694            self.control_handle.shutdown();
1695        }
1696        self.drop_without_shutdown();
1697        _result
1698    }
1699
1700    /// Similar to "send" but does not shutdown the channel if an error occurs.
1701    pub fn send_no_shutdown_on_err(
1702        self,
1703        mut supports_bridged_mode: bool,
1704    ) -> Result<(), fidl::Error> {
1705        let _result = self.send_raw(supports_bridged_mode);
1706        self.drop_without_shutdown();
1707        _result
1708    }
1709
1710    fn send_raw(&self, mut supports_bridged_mode: bool) -> Result<(), fidl::Error> {
1711        self.control_handle.inner.send::<CodecIsBridgeableResponse>(
1712            (supports_bridged_mode,),
1713            self.tx_id,
1714            0x26b0684f603f88ec,
1715            fidl::encoding::DynamicFlags::empty(),
1716        )
1717    }
1718}
1719
1720#[must_use = "FIDL methods require a response to be sent"]
1721#[derive(Debug)]
1722pub struct CodecGetDaiFormatsResponder {
1723    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1724    tx_id: u32,
1725}
1726
1727/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1728/// if the responder is dropped without sending a response, so that the client
1729/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1730impl std::ops::Drop for CodecGetDaiFormatsResponder {
1731    fn drop(&mut self) {
1732        self.control_handle.shutdown();
1733        // Safety: drops once, never accessed again
1734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1735    }
1736}
1737
1738impl fidl::endpoints::Responder for CodecGetDaiFormatsResponder {
1739    type ControlHandle = CodecControlHandle;
1740
1741    fn control_handle(&self) -> &CodecControlHandle {
1742        &self.control_handle
1743    }
1744
1745    fn drop_without_shutdown(mut self) {
1746        // Safety: drops once, never accessed again due to mem::forget
1747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1748        // Prevent Drop from running (which would shut down the channel)
1749        std::mem::forget(self);
1750    }
1751}
1752
1753impl CodecGetDaiFormatsResponder {
1754    /// Sends a response to the FIDL transaction.
1755    ///
1756    /// Sets the channel to shutdown if an error occurs.
1757    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1758        let _result = self.send_raw(result);
1759        if _result.is_err() {
1760            self.control_handle.shutdown();
1761        }
1762        self.drop_without_shutdown();
1763        _result
1764    }
1765
1766    /// Similar to "send" but does not shutdown the channel if an error occurs.
1767    pub fn send_no_shutdown_on_err(
1768        self,
1769        mut result: Result<&[DaiSupportedFormats], i32>,
1770    ) -> Result<(), fidl::Error> {
1771        let _result = self.send_raw(result);
1772        self.drop_without_shutdown();
1773        _result
1774    }
1775
1776    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
1777        self.control_handle
1778            .inner
1779            .send::<fidl::encoding::ResultType<CodecGetDaiFormatsResponse, i32>>(
1780                result.map(|formats| (formats,)),
1781                self.tx_id,
1782                0xf8bbc46b4ba6a52,
1783                fidl::encoding::DynamicFlags::empty(),
1784            )
1785    }
1786}
1787
1788#[must_use = "FIDL methods require a response to be sent"]
1789#[derive(Debug)]
1790pub struct CodecSetDaiFormatResponder {
1791    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1792    tx_id: u32,
1793}
1794
1795/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1796/// if the responder is dropped without sending a response, so that the client
1797/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1798impl std::ops::Drop for CodecSetDaiFormatResponder {
1799    fn drop(&mut self) {
1800        self.control_handle.shutdown();
1801        // Safety: drops once, never accessed again
1802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1803    }
1804}
1805
1806impl fidl::endpoints::Responder for CodecSetDaiFormatResponder {
1807    type ControlHandle = CodecControlHandle;
1808
1809    fn control_handle(&self) -> &CodecControlHandle {
1810        &self.control_handle
1811    }
1812
1813    fn drop_without_shutdown(mut self) {
1814        // Safety: drops once, never accessed again due to mem::forget
1815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1816        // Prevent Drop from running (which would shut down the channel)
1817        std::mem::forget(self);
1818    }
1819}
1820
1821impl CodecSetDaiFormatResponder {
1822    /// Sends a response to the FIDL transaction.
1823    ///
1824    /// Sets the channel to shutdown if an error occurs.
1825    pub fn send(self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1826        let _result = self.send_raw(result);
1827        if _result.is_err() {
1828            self.control_handle.shutdown();
1829        }
1830        self.drop_without_shutdown();
1831        _result
1832    }
1833
1834    /// Similar to "send" but does not shutdown the channel if an error occurs.
1835    pub fn send_no_shutdown_on_err(
1836        self,
1837        mut result: Result<&CodecFormatInfo, i32>,
1838    ) -> Result<(), fidl::Error> {
1839        let _result = self.send_raw(result);
1840        self.drop_without_shutdown();
1841        _result
1842    }
1843
1844    fn send_raw(&self, mut result: Result<&CodecFormatInfo, i32>) -> Result<(), fidl::Error> {
1845        self.control_handle
1846            .inner
1847            .send::<fidl::encoding::ResultType<CodecSetDaiFormatResponse, i32>>(
1848                result.map(|state| (state,)),
1849                self.tx_id,
1850                0x2f829df9e5a7a1ea,
1851                fidl::encoding::DynamicFlags::empty(),
1852            )
1853    }
1854}
1855
1856#[must_use = "FIDL methods require a response to be sent"]
1857#[derive(Debug)]
1858pub struct CodecWatchPlugStateResponder {
1859    control_handle: std::mem::ManuallyDrop<CodecControlHandle>,
1860    tx_id: u32,
1861}
1862
1863/// Set the the channel to be shutdown (see [`CodecControlHandle::shutdown`])
1864/// if the responder is dropped without sending a response, so that the client
1865/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1866impl std::ops::Drop for CodecWatchPlugStateResponder {
1867    fn drop(&mut self) {
1868        self.control_handle.shutdown();
1869        // Safety: drops once, never accessed again
1870        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1871    }
1872}
1873
1874impl fidl::endpoints::Responder for CodecWatchPlugStateResponder {
1875    type ControlHandle = CodecControlHandle;
1876
1877    fn control_handle(&self) -> &CodecControlHandle {
1878        &self.control_handle
1879    }
1880
1881    fn drop_without_shutdown(mut self) {
1882        // Safety: drops once, never accessed again due to mem::forget
1883        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1884        // Prevent Drop from running (which would shut down the channel)
1885        std::mem::forget(self);
1886    }
1887}
1888
1889impl CodecWatchPlugStateResponder {
1890    /// Sends a response to the FIDL transaction.
1891    ///
1892    /// Sets the channel to shutdown if an error occurs.
1893    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1894        let _result = self.send_raw(plug_state);
1895        if _result.is_err() {
1896            self.control_handle.shutdown();
1897        }
1898        self.drop_without_shutdown();
1899        _result
1900    }
1901
1902    /// Similar to "send" but does not shutdown the channel if an error occurs.
1903    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1904        let _result = self.send_raw(plug_state);
1905        self.drop_without_shutdown();
1906        _result
1907    }
1908
1909    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
1910        self.control_handle.inner.send::<CodecWatchPlugStateResponse>(
1911            (plug_state,),
1912            self.tx_id,
1913            0x182b87f935ca7326,
1914            fidl::encoding::DynamicFlags::empty(),
1915        )
1916    }
1917}
1918
1919#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1920pub struct CodecConnectorMarker;
1921
1922impl fidl::endpoints::ProtocolMarker for CodecConnectorMarker {
1923    type Proxy = CodecConnectorProxy;
1924    type RequestStream = CodecConnectorRequestStream;
1925    #[cfg(target_os = "fuchsia")]
1926    type SynchronousProxy = CodecConnectorSynchronousProxy;
1927
1928    const DEBUG_NAME: &'static str = "(anonymous) CodecConnector";
1929}
1930
1931pub trait CodecConnectorProxyInterface: Send + Sync {
1932    fn r#connect(
1933        &self,
1934        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1935    ) -> Result<(), fidl::Error>;
1936}
1937#[derive(Debug)]
1938#[cfg(target_os = "fuchsia")]
1939pub struct CodecConnectorSynchronousProxy {
1940    client: fidl::client::sync::Client,
1941}
1942
1943#[cfg(target_os = "fuchsia")]
1944impl fidl::endpoints::SynchronousProxy for CodecConnectorSynchronousProxy {
1945    type Proxy = CodecConnectorProxy;
1946    type Protocol = CodecConnectorMarker;
1947
1948    fn from_channel(inner: fidl::Channel) -> Self {
1949        Self::new(inner)
1950    }
1951
1952    fn into_channel(self) -> fidl::Channel {
1953        self.client.into_channel()
1954    }
1955
1956    fn as_channel(&self) -> &fidl::Channel {
1957        self.client.as_channel()
1958    }
1959}
1960
1961#[cfg(target_os = "fuchsia")]
1962impl CodecConnectorSynchronousProxy {
1963    pub fn new(channel: fidl::Channel) -> Self {
1964        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1965        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1966    }
1967
1968    pub fn into_channel(self) -> fidl::Channel {
1969        self.client.into_channel()
1970    }
1971
1972    /// Waits until an event arrives and returns it. It is safe for other
1973    /// threads to make concurrent requests while waiting for an event.
1974    pub fn wait_for_event(
1975        &self,
1976        deadline: zx::MonotonicInstant,
1977    ) -> Result<CodecConnectorEvent, fidl::Error> {
1978        CodecConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1979    }
1980
1981    /// Connect to a Codec protocol server.
1982    /// This indirection into the Codec protocol allows us to support independent codec client
1983    /// connections.
1984    pub fn r#connect(
1985        &self,
1986        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
1987    ) -> Result<(), fidl::Error> {
1988        self.client.send::<CodecConnectorConnectRequest>(
1989            (codec_protocol,),
1990            0x1413f551544026c9,
1991            fidl::encoding::DynamicFlags::empty(),
1992        )
1993    }
1994}
1995
1996#[cfg(target_os = "fuchsia")]
1997impl From<CodecConnectorSynchronousProxy> for zx::Handle {
1998    fn from(value: CodecConnectorSynchronousProxy) -> Self {
1999        value.into_channel().into()
2000    }
2001}
2002
2003#[cfg(target_os = "fuchsia")]
2004impl From<fidl::Channel> for CodecConnectorSynchronousProxy {
2005    fn from(value: fidl::Channel) -> Self {
2006        Self::new(value)
2007    }
2008}
2009
2010#[cfg(target_os = "fuchsia")]
2011impl fidl::endpoints::FromClient for CodecConnectorSynchronousProxy {
2012    type Protocol = CodecConnectorMarker;
2013
2014    fn from_client(value: fidl::endpoints::ClientEnd<CodecConnectorMarker>) -> Self {
2015        Self::new(value.into_channel())
2016    }
2017}
2018
2019#[derive(Debug, Clone)]
2020pub struct CodecConnectorProxy {
2021    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2022}
2023
2024impl fidl::endpoints::Proxy for CodecConnectorProxy {
2025    type Protocol = CodecConnectorMarker;
2026
2027    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2028        Self::new(inner)
2029    }
2030
2031    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2032        self.client.into_channel().map_err(|client| Self { client })
2033    }
2034
2035    fn as_channel(&self) -> &::fidl::AsyncChannel {
2036        self.client.as_channel()
2037    }
2038}
2039
2040impl CodecConnectorProxy {
2041    /// Create a new Proxy for fuchsia.hardware.audio/CodecConnector.
2042    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2043        let protocol_name = <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2044        Self { client: fidl::client::Client::new(channel, protocol_name) }
2045    }
2046
2047    /// Get a Stream of events from the remote end of the protocol.
2048    ///
2049    /// # Panics
2050    ///
2051    /// Panics if the event stream was already taken.
2052    pub fn take_event_stream(&self) -> CodecConnectorEventStream {
2053        CodecConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2054    }
2055
2056    /// Connect to a Codec protocol server.
2057    /// This indirection into the Codec protocol allows us to support independent codec client
2058    /// connections.
2059    pub fn r#connect(
2060        &self,
2061        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2062    ) -> Result<(), fidl::Error> {
2063        CodecConnectorProxyInterface::r#connect(self, codec_protocol)
2064    }
2065}
2066
2067impl CodecConnectorProxyInterface for CodecConnectorProxy {
2068    fn r#connect(
2069        &self,
2070        mut codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2071    ) -> Result<(), fidl::Error> {
2072        self.client.send::<CodecConnectorConnectRequest>(
2073            (codec_protocol,),
2074            0x1413f551544026c9,
2075            fidl::encoding::DynamicFlags::empty(),
2076        )
2077    }
2078}
2079
2080pub struct CodecConnectorEventStream {
2081    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2082}
2083
2084impl std::marker::Unpin for CodecConnectorEventStream {}
2085
2086impl futures::stream::FusedStream for CodecConnectorEventStream {
2087    fn is_terminated(&self) -> bool {
2088        self.event_receiver.is_terminated()
2089    }
2090}
2091
2092impl futures::Stream for CodecConnectorEventStream {
2093    type Item = Result<CodecConnectorEvent, fidl::Error>;
2094
2095    fn poll_next(
2096        mut self: std::pin::Pin<&mut Self>,
2097        cx: &mut std::task::Context<'_>,
2098    ) -> std::task::Poll<Option<Self::Item>> {
2099        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2100            &mut self.event_receiver,
2101            cx
2102        )?) {
2103            Some(buf) => std::task::Poll::Ready(Some(CodecConnectorEvent::decode(buf))),
2104            None => std::task::Poll::Ready(None),
2105        }
2106    }
2107}
2108
2109#[derive(Debug)]
2110pub enum CodecConnectorEvent {}
2111
2112impl CodecConnectorEvent {
2113    /// Decodes a message buffer as a [`CodecConnectorEvent`].
2114    fn decode(
2115        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2116    ) -> Result<CodecConnectorEvent, fidl::Error> {
2117        let (bytes, _handles) = buf.split_mut();
2118        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2119        debug_assert_eq!(tx_header.tx_id, 0);
2120        match tx_header.ordinal {
2121            _ => Err(fidl::Error::UnknownOrdinal {
2122                ordinal: tx_header.ordinal,
2123                protocol_name:
2124                    <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2125            }),
2126        }
2127    }
2128}
2129
2130/// A Stream of incoming requests for fuchsia.hardware.audio/CodecConnector.
2131pub struct CodecConnectorRequestStream {
2132    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2133    is_terminated: bool,
2134}
2135
2136impl std::marker::Unpin for CodecConnectorRequestStream {}
2137
2138impl futures::stream::FusedStream for CodecConnectorRequestStream {
2139    fn is_terminated(&self) -> bool {
2140        self.is_terminated
2141    }
2142}
2143
2144impl fidl::endpoints::RequestStream for CodecConnectorRequestStream {
2145    type Protocol = CodecConnectorMarker;
2146    type ControlHandle = CodecConnectorControlHandle;
2147
2148    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2149        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2150    }
2151
2152    fn control_handle(&self) -> Self::ControlHandle {
2153        CodecConnectorControlHandle { inner: self.inner.clone() }
2154    }
2155
2156    fn into_inner(
2157        self,
2158    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2159    {
2160        (self.inner, self.is_terminated)
2161    }
2162
2163    fn from_inner(
2164        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2165        is_terminated: bool,
2166    ) -> Self {
2167        Self { inner, is_terminated }
2168    }
2169}
2170
2171impl futures::Stream for CodecConnectorRequestStream {
2172    type Item = Result<CodecConnectorRequest, fidl::Error>;
2173
2174    fn poll_next(
2175        mut self: std::pin::Pin<&mut Self>,
2176        cx: &mut std::task::Context<'_>,
2177    ) -> std::task::Poll<Option<Self::Item>> {
2178        let this = &mut *self;
2179        if this.inner.check_shutdown(cx) {
2180            this.is_terminated = true;
2181            return std::task::Poll::Ready(None);
2182        }
2183        if this.is_terminated {
2184            panic!("polled CodecConnectorRequestStream after completion");
2185        }
2186        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2187            |bytes, handles| {
2188                match this.inner.channel().read_etc(cx, bytes, handles) {
2189                    std::task::Poll::Ready(Ok(())) => {}
2190                    std::task::Poll::Pending => return std::task::Poll::Pending,
2191                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2192                        this.is_terminated = true;
2193                        return std::task::Poll::Ready(None);
2194                    }
2195                    std::task::Poll::Ready(Err(e)) => {
2196                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2197                            e.into(),
2198                        ))))
2199                    }
2200                }
2201
2202                // A message has been received from the channel
2203                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2204
2205                std::task::Poll::Ready(Some(match header.ordinal {
2206                    0x1413f551544026c9 => {
2207                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2208                        let mut req = fidl::new_empty!(
2209                            CodecConnectorConnectRequest,
2210                            fidl::encoding::DefaultFuchsiaResourceDialect
2211                        );
2212                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CodecConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2213                        let control_handle =
2214                            CodecConnectorControlHandle { inner: this.inner.clone() };
2215                        Ok(CodecConnectorRequest::Connect {
2216                            codec_protocol: req.codec_protocol,
2217
2218                            control_handle,
2219                        })
2220                    }
2221                    _ => Err(fidl::Error::UnknownOrdinal {
2222                        ordinal: header.ordinal,
2223                        protocol_name:
2224                            <CodecConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2225                    }),
2226                }))
2227            },
2228        )
2229    }
2230}
2231
2232/// For an overview of the Codec protocols see
2233/// [Codec Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_codec.md)
2234/// # Deprecation
2235///
2236/// Not supported anymore, instead use an
2237/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
2238/// with one DAI and no Ring Buffer, see
2239/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
2240#[derive(Debug)]
2241pub enum CodecConnectorRequest {
2242    /// Connect to a Codec protocol server.
2243    /// This indirection into the Codec protocol allows us to support independent codec client
2244    /// connections.
2245    Connect {
2246        codec_protocol: fidl::endpoints::ServerEnd<CodecMarker>,
2247        control_handle: CodecConnectorControlHandle,
2248    },
2249}
2250
2251impl CodecConnectorRequest {
2252    #[allow(irrefutable_let_patterns)]
2253    pub fn into_connect(
2254        self,
2255    ) -> Option<(fidl::endpoints::ServerEnd<CodecMarker>, CodecConnectorControlHandle)> {
2256        if let CodecConnectorRequest::Connect { codec_protocol, control_handle } = self {
2257            Some((codec_protocol, control_handle))
2258        } else {
2259            None
2260        }
2261    }
2262
2263    /// Name of the method defined in FIDL
2264    pub fn method_name(&self) -> &'static str {
2265        match *self {
2266            CodecConnectorRequest::Connect { .. } => "connect",
2267        }
2268    }
2269}
2270
2271#[derive(Debug, Clone)]
2272pub struct CodecConnectorControlHandle {
2273    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2274}
2275
2276impl fidl::endpoints::ControlHandle for CodecConnectorControlHandle {
2277    fn shutdown(&self) {
2278        self.inner.shutdown()
2279    }
2280    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2281        self.inner.shutdown_with_epitaph(status)
2282    }
2283
2284    fn is_closed(&self) -> bool {
2285        self.inner.channel().is_closed()
2286    }
2287    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2288        self.inner.channel().on_closed()
2289    }
2290
2291    #[cfg(target_os = "fuchsia")]
2292    fn signal_peer(
2293        &self,
2294        clear_mask: zx::Signals,
2295        set_mask: zx::Signals,
2296    ) -> Result<(), zx_status::Status> {
2297        use fidl::Peered;
2298        self.inner.channel().signal_peer(clear_mask, set_mask)
2299    }
2300}
2301
2302impl CodecConnectorControlHandle {}
2303
2304#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2305pub struct CompositeMarker;
2306
2307impl fidl::endpoints::ProtocolMarker for CompositeMarker {
2308    type Proxy = CompositeProxy;
2309    type RequestStream = CompositeRequestStream;
2310    #[cfg(target_os = "fuchsia")]
2311    type SynchronousProxy = CompositeSynchronousProxy;
2312
2313    const DEBUG_NAME: &'static str = "(anonymous) Composite";
2314}
2315pub type CompositeResetResult = Result<(), DriverError>;
2316pub type CompositeGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, DriverError>;
2317pub type CompositeCreateRingBufferResult = Result<(), DriverError>;
2318pub type CompositeGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, DriverError>;
2319pub type CompositeSetDaiFormatResult = Result<(), DriverError>;
2320
2321pub trait CompositeProxyInterface: Send + Sync {
2322    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
2323        + Send;
2324    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
2325    fn r#signal_processing_connect(
2326        &self,
2327        protocol: fidl::endpoints::ServerEnd<
2328            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2329        >,
2330    ) -> Result<(), fidl::Error>;
2331    type ResetResponseFut: std::future::Future<Output = Result<CompositeResetResult, fidl::Error>>
2332        + Send;
2333    fn r#reset(&self) -> Self::ResetResponseFut;
2334    type GetPropertiesResponseFut: std::future::Future<Output = Result<CompositeProperties, fidl::Error>>
2335        + Send;
2336    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
2337    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<CompositeGetRingBufferFormatsResult, fidl::Error>>
2338        + Send;
2339    fn r#get_ring_buffer_formats(
2340        &self,
2341        processing_element_id: u64,
2342    ) -> Self::GetRingBufferFormatsResponseFut;
2343    type CreateRingBufferResponseFut: std::future::Future<Output = Result<CompositeCreateRingBufferResult, fidl::Error>>
2344        + Send;
2345    fn r#create_ring_buffer(
2346        &self,
2347        processing_element_id: u64,
2348        format: &Format,
2349        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2350    ) -> Self::CreateRingBufferResponseFut;
2351    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<CompositeGetDaiFormatsResult, fidl::Error>>
2352        + Send;
2353    fn r#get_dai_formats(&self, processing_element_id: u64) -> Self::GetDaiFormatsResponseFut;
2354    type SetDaiFormatResponseFut: std::future::Future<Output = Result<CompositeSetDaiFormatResult, fidl::Error>>
2355        + Send;
2356    fn r#set_dai_format(
2357        &self,
2358        processing_element_id: u64,
2359        format: &DaiFormat,
2360    ) -> Self::SetDaiFormatResponseFut;
2361}
2362#[derive(Debug)]
2363#[cfg(target_os = "fuchsia")]
2364pub struct CompositeSynchronousProxy {
2365    client: fidl::client::sync::Client,
2366}
2367
2368#[cfg(target_os = "fuchsia")]
2369impl fidl::endpoints::SynchronousProxy for CompositeSynchronousProxy {
2370    type Proxy = CompositeProxy;
2371    type Protocol = CompositeMarker;
2372
2373    fn from_channel(inner: fidl::Channel) -> Self {
2374        Self::new(inner)
2375    }
2376
2377    fn into_channel(self) -> fidl::Channel {
2378        self.client.into_channel()
2379    }
2380
2381    fn as_channel(&self) -> &fidl::Channel {
2382        self.client.as_channel()
2383    }
2384}
2385
2386#[cfg(target_os = "fuchsia")]
2387impl CompositeSynchronousProxy {
2388    pub fn new(channel: fidl::Channel) -> Self {
2389        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2390        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2391    }
2392
2393    pub fn into_channel(self) -> fidl::Channel {
2394        self.client.into_channel()
2395    }
2396
2397    /// Waits until an event arrives and returns it. It is safe for other
2398    /// threads to make concurrent requests while waiting for an event.
2399    pub fn wait_for_event(
2400        &self,
2401        deadline: zx::MonotonicInstant,
2402    ) -> Result<CompositeEvent, fidl::Error> {
2403        CompositeEvent::decode(self.client.wait_for_event(deadline)?)
2404    }
2405
2406    /// Retrieves top level health state.
2407    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2408    pub fn r#get_health_state(
2409        &self,
2410        ___deadline: zx::MonotonicInstant,
2411    ) -> Result<HealthState, fidl::Error> {
2412        let _response =
2413            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
2414                (),
2415                0x4e146d6bca733a84,
2416                fidl::encoding::DynamicFlags::empty(),
2417                ___deadline,
2418            )?;
2419        Ok(_response.state)
2420    }
2421
2422    /// Connect to a `SignalProcessing` protocol.
2423    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2424    /// the maximum number of connections have already been created, for instance one, then the
2425    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2426    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2427    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2428    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2429    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2430    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2431    /// is intended to be composed, and hence the more verbose name allows differentiation and
2432    /// improved clarity.
2433    pub fn r#signal_processing_connect(
2434        &self,
2435        mut protocol: fidl::endpoints::ServerEnd<
2436            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2437        >,
2438    ) -> Result<(), fidl::Error> {
2439        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2440            (protocol,),
2441            0xa81907ce6066295,
2442            fidl::encoding::DynamicFlags::empty(),
2443        )
2444    }
2445
2446    /// Resets the hardware including all DAI interconnects and signal processing.
2447    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2448    ///
2449    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2450    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2451    /// any processing elements, and reconstruct any ring buffers.
2452    ///
2453    /// If the driver can't successfully reset the hardware, it will return an error and then close
2454    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2455    pub fn r#reset(
2456        &self,
2457        ___deadline: zx::MonotonicInstant,
2458    ) -> Result<CompositeResetResult, fidl::Error> {
2459        let _response = self.client.send_query::<
2460            fidl::encoding::EmptyPayload,
2461            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2462        >(
2463            (),
2464            0xac355fb98341996,
2465            fidl::encoding::DynamicFlags::empty(),
2466            ___deadline,
2467        )?;
2468        Ok(_response.map(|x| x))
2469    }
2470
2471    /// Retrieves top level static properties.
2472    pub fn r#get_properties(
2473        &self,
2474        ___deadline: zx::MonotonicInstant,
2475    ) -> Result<CompositeProperties, fidl::Error> {
2476        let _response = self
2477            .client
2478            .send_query::<fidl::encoding::EmptyPayload, CompositeGetPropertiesResponse>(
2479                (),
2480                0x31846fa0a459942b,
2481                fidl::encoding::DynamicFlags::empty(),
2482                ___deadline,
2483            )?;
2484        Ok(_response.properties)
2485    }
2486
2487    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2488    /// in the topology supported by this driver as returned by `GetElements` from
2489    /// fuchsia.hardware.audio.signalprocessing.
2490    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2491    /// client may retry at a later time.
2492    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2493    /// by `GetElements`.
2494    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2495    /// `RING_BUFFER`.
2496    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2497    /// the parameters in `SupportedFormats` may be supported.
2498    pub fn r#get_ring_buffer_formats(
2499        &self,
2500        mut processing_element_id: u64,
2501        ___deadline: zx::MonotonicInstant,
2502    ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2503        let _response = self.client.send_query::<
2504            CompositeGetRingBufferFormatsRequest,
2505            fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2506        >(
2507            (processing_element_id,),
2508            0x1d89b701b6816ac4,
2509            fidl::encoding::DynamicFlags::empty(),
2510            ___deadline,
2511        )?;
2512        Ok(_response.map(|x| x.ring_buffer_formats))
2513    }
2514
2515    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2516    /// processing element specified by `processing_element_id`. The format is based on information
2517    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2518    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2519    /// audio buffer provided by the driver.
2520    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2521    /// by `GetElements`.
2522    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2523    /// `RING_BUFFER`.
2524    pub fn r#create_ring_buffer(
2525        &self,
2526        mut processing_element_id: u64,
2527        mut format: &Format,
2528        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2529        ___deadline: zx::MonotonicInstant,
2530    ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2531        let _response = self.client.send_query::<
2532            CompositeCreateRingBufferRequest,
2533            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2534        >(
2535            (processing_element_id, format, ring_buffer,),
2536            0x28c5685f85262033,
2537            fidl::encoding::DynamicFlags::empty(),
2538            ___deadline,
2539        )?;
2540        Ok(_response.map(|x| x))
2541    }
2542
2543    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2544    /// in the topology supported by this driver as returned by `GetElements` from
2545    /// fuchsia.hardware.audio.signalprocessing.
2546    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2547    /// may retry at a later time.
2548    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2549    /// by `GetElements`.
2550    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2551    /// `DAI_INTERCONNECT`.
2552    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2553    /// the parameters in SupportedFormats may be supported.
2554    pub fn r#get_dai_formats(
2555        &self,
2556        mut processing_element_id: u64,
2557        ___deadline: zx::MonotonicInstant,
2558    ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2559        let _response = self.client.send_query::<
2560            CompositeGetDaiFormatsRequest,
2561            fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2562        >(
2563            (processing_element_id,),
2564            0x3cbeaed59c8f69b,
2565            fidl::encoding::DynamicFlags::empty(),
2566            ___deadline,
2567        )?;
2568        Ok(_response.map(|x| x.dai_formats))
2569    }
2570
2571    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2572    /// processing element specified by `processing_element_id`. The format is based on information
2573    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2574    /// requirement.
2575    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2576    /// by `GetElements`.
2577    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2578    /// `DAI_INTERCONNECT`.
2579    pub fn r#set_dai_format(
2580        &self,
2581        mut processing_element_id: u64,
2582        mut format: &DaiFormat,
2583        ___deadline: zx::MonotonicInstant,
2584    ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2585        let _response = self.client.send_query::<
2586            CompositeSetDaiFormatRequest,
2587            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2588        >(
2589            (processing_element_id, format,),
2590            0x155acf5cc0dc8a84,
2591            fidl::encoding::DynamicFlags::empty(),
2592            ___deadline,
2593        )?;
2594        Ok(_response.map(|x| x))
2595    }
2596}
2597
2598#[cfg(target_os = "fuchsia")]
2599impl From<CompositeSynchronousProxy> for zx::Handle {
2600    fn from(value: CompositeSynchronousProxy) -> Self {
2601        value.into_channel().into()
2602    }
2603}
2604
2605#[cfg(target_os = "fuchsia")]
2606impl From<fidl::Channel> for CompositeSynchronousProxy {
2607    fn from(value: fidl::Channel) -> Self {
2608        Self::new(value)
2609    }
2610}
2611
2612#[cfg(target_os = "fuchsia")]
2613impl fidl::endpoints::FromClient for CompositeSynchronousProxy {
2614    type Protocol = CompositeMarker;
2615
2616    fn from_client(value: fidl::endpoints::ClientEnd<CompositeMarker>) -> Self {
2617        Self::new(value.into_channel())
2618    }
2619}
2620
2621#[derive(Debug, Clone)]
2622pub struct CompositeProxy {
2623    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2624}
2625
2626impl fidl::endpoints::Proxy for CompositeProxy {
2627    type Protocol = CompositeMarker;
2628
2629    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2630        Self::new(inner)
2631    }
2632
2633    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2634        self.client.into_channel().map_err(|client| Self { client })
2635    }
2636
2637    fn as_channel(&self) -> &::fidl::AsyncChannel {
2638        self.client.as_channel()
2639    }
2640}
2641
2642impl CompositeProxy {
2643    /// Create a new Proxy for fuchsia.hardware.audio/Composite.
2644    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2645        let protocol_name = <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2646        Self { client: fidl::client::Client::new(channel, protocol_name) }
2647    }
2648
2649    /// Get a Stream of events from the remote end of the protocol.
2650    ///
2651    /// # Panics
2652    ///
2653    /// Panics if the event stream was already taken.
2654    pub fn take_event_stream(&self) -> CompositeEventStream {
2655        CompositeEventStream { event_receiver: self.client.take_event_receiver() }
2656    }
2657
2658    /// Retrieves top level health state.
2659    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
2660    pub fn r#get_health_state(
2661        &self,
2662    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
2663    {
2664        CompositeProxyInterface::r#get_health_state(self)
2665    }
2666
2667    /// Connect to a `SignalProcessing` protocol.
2668    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
2669    /// the maximum number of connections have already been created, for instance one, then the
2670    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
2671    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
2672    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
2673    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
2674    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
2675    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
2676    /// is intended to be composed, and hence the more verbose name allows differentiation and
2677    /// improved clarity.
2678    pub fn r#signal_processing_connect(
2679        &self,
2680        mut protocol: fidl::endpoints::ServerEnd<
2681            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2682        >,
2683    ) -> Result<(), fidl::Error> {
2684        CompositeProxyInterface::r#signal_processing_connect(self, protocol)
2685    }
2686
2687    /// Resets the hardware including all DAI interconnects and signal processing.
2688    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
2689    ///
2690    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
2691    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
2692    /// any processing elements, and reconstruct any ring buffers.
2693    ///
2694    /// If the driver can't successfully reset the hardware, it will return an error and then close
2695    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
2696    pub fn r#reset(
2697        &self,
2698    ) -> fidl::client::QueryResponseFut<
2699        CompositeResetResult,
2700        fidl::encoding::DefaultFuchsiaResourceDialect,
2701    > {
2702        CompositeProxyInterface::r#reset(self)
2703    }
2704
2705    /// Retrieves top level static properties.
2706    pub fn r#get_properties(
2707        &self,
2708    ) -> fidl::client::QueryResponseFut<
2709        CompositeProperties,
2710        fidl::encoding::DefaultFuchsiaResourceDialect,
2711    > {
2712        CompositeProxyInterface::r#get_properties(self)
2713    }
2714
2715    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
2716    /// in the topology supported by this driver as returned by `GetElements` from
2717    /// fuchsia.hardware.audio.signalprocessing.
2718    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
2719    /// client may retry at a later time.
2720    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2721    /// by `GetElements`.
2722    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2723    /// `RING_BUFFER`.
2724    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
2725    /// the parameters in `SupportedFormats` may be supported.
2726    pub fn r#get_ring_buffer_formats(
2727        &self,
2728        mut processing_element_id: u64,
2729    ) -> fidl::client::QueryResponseFut<
2730        CompositeGetRingBufferFormatsResult,
2731        fidl::encoding::DefaultFuchsiaResourceDialect,
2732    > {
2733        CompositeProxyInterface::r#get_ring_buffer_formats(self, processing_element_id)
2734    }
2735
2736    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
2737    /// processing element specified by `processing_element_id`. The format is based on information
2738    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
2739    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
2740    /// audio buffer provided by the driver.
2741    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2742    /// by `GetElements`.
2743    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2744    /// `RING_BUFFER`.
2745    pub fn r#create_ring_buffer(
2746        &self,
2747        mut processing_element_id: u64,
2748        mut format: &Format,
2749        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2750    ) -> fidl::client::QueryResponseFut<
2751        CompositeCreateRingBufferResult,
2752        fidl::encoding::DefaultFuchsiaResourceDialect,
2753    > {
2754        CompositeProxyInterface::r#create_ring_buffer(
2755            self,
2756            processing_element_id,
2757            format,
2758            ring_buffer,
2759        )
2760    }
2761
2762    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
2763    /// in the topology supported by this driver as returned by `GetElements` from
2764    /// fuchsia.hardware.audio.signalprocessing.
2765    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
2766    /// may retry at a later time.
2767    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2768    /// by `GetElements`.
2769    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2770    /// `DAI_INTERCONNECT`.
2771    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
2772    /// the parameters in SupportedFormats may be supported.
2773    pub fn r#get_dai_formats(
2774        &self,
2775        mut processing_element_id: u64,
2776    ) -> fidl::client::QueryResponseFut<
2777        CompositeGetDaiFormatsResult,
2778        fidl::encoding::DefaultFuchsiaResourceDialect,
2779    > {
2780        CompositeProxyInterface::r#get_dai_formats(self, processing_element_id)
2781    }
2782
2783    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
2784    /// processing element specified by `processing_element_id`. The format is based on information
2785    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
2786    /// requirement.
2787    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
2788    /// by `GetElements`.
2789    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
2790    /// `DAI_INTERCONNECT`.
2791    pub fn r#set_dai_format(
2792        &self,
2793        mut processing_element_id: u64,
2794        mut format: &DaiFormat,
2795    ) -> fidl::client::QueryResponseFut<
2796        CompositeSetDaiFormatResult,
2797        fidl::encoding::DefaultFuchsiaResourceDialect,
2798    > {
2799        CompositeProxyInterface::r#set_dai_format(self, processing_element_id, format)
2800    }
2801}
2802
2803impl CompositeProxyInterface for CompositeProxy {
2804    type GetHealthStateResponseFut =
2805        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
2806    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
2807        fn _decode(
2808            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2809        ) -> Result<HealthState, fidl::Error> {
2810            let _response = fidl::client::decode_transaction_body::<
2811                HealthGetHealthStateResponse,
2812                fidl::encoding::DefaultFuchsiaResourceDialect,
2813                0x4e146d6bca733a84,
2814            >(_buf?)?;
2815            Ok(_response.state)
2816        }
2817        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
2818            (),
2819            0x4e146d6bca733a84,
2820            fidl::encoding::DynamicFlags::empty(),
2821            _decode,
2822        )
2823    }
2824
2825    fn r#signal_processing_connect(
2826        &self,
2827        mut protocol: fidl::endpoints::ServerEnd<
2828            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
2829        >,
2830    ) -> Result<(), fidl::Error> {
2831        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
2832            (protocol,),
2833            0xa81907ce6066295,
2834            fidl::encoding::DynamicFlags::empty(),
2835        )
2836    }
2837
2838    type ResetResponseFut = fidl::client::QueryResponseFut<
2839        CompositeResetResult,
2840        fidl::encoding::DefaultFuchsiaResourceDialect,
2841    >;
2842    fn r#reset(&self) -> Self::ResetResponseFut {
2843        fn _decode(
2844            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2845        ) -> Result<CompositeResetResult, fidl::Error> {
2846            let _response = fidl::client::decode_transaction_body::<
2847                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2848                fidl::encoding::DefaultFuchsiaResourceDialect,
2849                0xac355fb98341996,
2850            >(_buf?)?;
2851            Ok(_response.map(|x| x))
2852        }
2853        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeResetResult>(
2854            (),
2855            0xac355fb98341996,
2856            fidl::encoding::DynamicFlags::empty(),
2857            _decode,
2858        )
2859    }
2860
2861    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
2862        CompositeProperties,
2863        fidl::encoding::DefaultFuchsiaResourceDialect,
2864    >;
2865    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
2866        fn _decode(
2867            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2868        ) -> Result<CompositeProperties, fidl::Error> {
2869            let _response = fidl::client::decode_transaction_body::<
2870                CompositeGetPropertiesResponse,
2871                fidl::encoding::DefaultFuchsiaResourceDialect,
2872                0x31846fa0a459942b,
2873            >(_buf?)?;
2874            Ok(_response.properties)
2875        }
2876        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CompositeProperties>(
2877            (),
2878            0x31846fa0a459942b,
2879            fidl::encoding::DynamicFlags::empty(),
2880            _decode,
2881        )
2882    }
2883
2884    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
2885        CompositeGetRingBufferFormatsResult,
2886        fidl::encoding::DefaultFuchsiaResourceDialect,
2887    >;
2888    fn r#get_ring_buffer_formats(
2889        &self,
2890        mut processing_element_id: u64,
2891    ) -> Self::GetRingBufferFormatsResponseFut {
2892        fn _decode(
2893            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2894        ) -> Result<CompositeGetRingBufferFormatsResult, fidl::Error> {
2895            let _response = fidl::client::decode_transaction_body::<
2896                fidl::encoding::ResultType<CompositeGetRingBufferFormatsResponse, DriverError>,
2897                fidl::encoding::DefaultFuchsiaResourceDialect,
2898                0x1d89b701b6816ac4,
2899            >(_buf?)?;
2900            Ok(_response.map(|x| x.ring_buffer_formats))
2901        }
2902        self.client.send_query_and_decode::<
2903            CompositeGetRingBufferFormatsRequest,
2904            CompositeGetRingBufferFormatsResult,
2905        >(
2906            (processing_element_id,),
2907            0x1d89b701b6816ac4,
2908            fidl::encoding::DynamicFlags::empty(),
2909            _decode,
2910        )
2911    }
2912
2913    type CreateRingBufferResponseFut = fidl::client::QueryResponseFut<
2914        CompositeCreateRingBufferResult,
2915        fidl::encoding::DefaultFuchsiaResourceDialect,
2916    >;
2917    fn r#create_ring_buffer(
2918        &self,
2919        mut processing_element_id: u64,
2920        mut format: &Format,
2921        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
2922    ) -> Self::CreateRingBufferResponseFut {
2923        fn _decode(
2924            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2925        ) -> Result<CompositeCreateRingBufferResult, fidl::Error> {
2926            let _response = fidl::client::decode_transaction_body::<
2927                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2928                fidl::encoding::DefaultFuchsiaResourceDialect,
2929                0x28c5685f85262033,
2930            >(_buf?)?;
2931            Ok(_response.map(|x| x))
2932        }
2933        self.client.send_query_and_decode::<
2934            CompositeCreateRingBufferRequest,
2935            CompositeCreateRingBufferResult,
2936        >(
2937            (processing_element_id, format, ring_buffer,),
2938            0x28c5685f85262033,
2939            fidl::encoding::DynamicFlags::empty(),
2940            _decode,
2941        )
2942    }
2943
2944    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
2945        CompositeGetDaiFormatsResult,
2946        fidl::encoding::DefaultFuchsiaResourceDialect,
2947    >;
2948    fn r#get_dai_formats(&self, mut processing_element_id: u64) -> Self::GetDaiFormatsResponseFut {
2949        fn _decode(
2950            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2951        ) -> Result<CompositeGetDaiFormatsResult, fidl::Error> {
2952            let _response = fidl::client::decode_transaction_body::<
2953                fidl::encoding::ResultType<CompositeGetDaiFormatsResponse, DriverError>,
2954                fidl::encoding::DefaultFuchsiaResourceDialect,
2955                0x3cbeaed59c8f69b,
2956            >(_buf?)?;
2957            Ok(_response.map(|x| x.dai_formats))
2958        }
2959        self.client
2960            .send_query_and_decode::<CompositeGetDaiFormatsRequest, CompositeGetDaiFormatsResult>(
2961                (processing_element_id,),
2962                0x3cbeaed59c8f69b,
2963                fidl::encoding::DynamicFlags::empty(),
2964                _decode,
2965            )
2966    }
2967
2968    type SetDaiFormatResponseFut = fidl::client::QueryResponseFut<
2969        CompositeSetDaiFormatResult,
2970        fidl::encoding::DefaultFuchsiaResourceDialect,
2971    >;
2972    fn r#set_dai_format(
2973        &self,
2974        mut processing_element_id: u64,
2975        mut format: &DaiFormat,
2976    ) -> Self::SetDaiFormatResponseFut {
2977        fn _decode(
2978            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2979        ) -> Result<CompositeSetDaiFormatResult, fidl::Error> {
2980            let _response = fidl::client::decode_transaction_body::<
2981                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, DriverError>,
2982                fidl::encoding::DefaultFuchsiaResourceDialect,
2983                0x155acf5cc0dc8a84,
2984            >(_buf?)?;
2985            Ok(_response.map(|x| x))
2986        }
2987        self.client
2988            .send_query_and_decode::<CompositeSetDaiFormatRequest, CompositeSetDaiFormatResult>(
2989                (processing_element_id, format),
2990                0x155acf5cc0dc8a84,
2991                fidl::encoding::DynamicFlags::empty(),
2992                _decode,
2993            )
2994    }
2995}
2996
2997pub struct CompositeEventStream {
2998    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2999}
3000
3001impl std::marker::Unpin for CompositeEventStream {}
3002
3003impl futures::stream::FusedStream for CompositeEventStream {
3004    fn is_terminated(&self) -> bool {
3005        self.event_receiver.is_terminated()
3006    }
3007}
3008
3009impl futures::Stream for CompositeEventStream {
3010    type Item = Result<CompositeEvent, fidl::Error>;
3011
3012    fn poll_next(
3013        mut self: std::pin::Pin<&mut Self>,
3014        cx: &mut std::task::Context<'_>,
3015    ) -> std::task::Poll<Option<Self::Item>> {
3016        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3017            &mut self.event_receiver,
3018            cx
3019        )?) {
3020            Some(buf) => std::task::Poll::Ready(Some(CompositeEvent::decode(buf))),
3021            None => std::task::Poll::Ready(None),
3022        }
3023    }
3024}
3025
3026#[derive(Debug)]
3027pub enum CompositeEvent {}
3028
3029impl CompositeEvent {
3030    /// Decodes a message buffer as a [`CompositeEvent`].
3031    fn decode(
3032        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3033    ) -> Result<CompositeEvent, fidl::Error> {
3034        let (bytes, _handles) = buf.split_mut();
3035        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3036        debug_assert_eq!(tx_header.tx_id, 0);
3037        match tx_header.ordinal {
3038            _ => Err(fidl::Error::UnknownOrdinal {
3039                ordinal: tx_header.ordinal,
3040                protocol_name: <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3041            }),
3042        }
3043    }
3044}
3045
3046/// A Stream of incoming requests for fuchsia.hardware.audio/Composite.
3047pub struct CompositeRequestStream {
3048    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3049    is_terminated: bool,
3050}
3051
3052impl std::marker::Unpin for CompositeRequestStream {}
3053
3054impl futures::stream::FusedStream for CompositeRequestStream {
3055    fn is_terminated(&self) -> bool {
3056        self.is_terminated
3057    }
3058}
3059
3060impl fidl::endpoints::RequestStream for CompositeRequestStream {
3061    type Protocol = CompositeMarker;
3062    type ControlHandle = CompositeControlHandle;
3063
3064    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3065        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3066    }
3067
3068    fn control_handle(&self) -> Self::ControlHandle {
3069        CompositeControlHandle { inner: self.inner.clone() }
3070    }
3071
3072    fn into_inner(
3073        self,
3074    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3075    {
3076        (self.inner, self.is_terminated)
3077    }
3078
3079    fn from_inner(
3080        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3081        is_terminated: bool,
3082    ) -> Self {
3083        Self { inner, is_terminated }
3084    }
3085}
3086
3087impl futures::Stream for CompositeRequestStream {
3088    type Item = Result<CompositeRequest, fidl::Error>;
3089
3090    fn poll_next(
3091        mut self: std::pin::Pin<&mut Self>,
3092        cx: &mut std::task::Context<'_>,
3093    ) -> std::task::Poll<Option<Self::Item>> {
3094        let this = &mut *self;
3095        if this.inner.check_shutdown(cx) {
3096            this.is_terminated = true;
3097            return std::task::Poll::Ready(None);
3098        }
3099        if this.is_terminated {
3100            panic!("polled CompositeRequestStream after completion");
3101        }
3102        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3103            |bytes, handles| {
3104                match this.inner.channel().read_etc(cx, bytes, handles) {
3105                    std::task::Poll::Ready(Ok(())) => {}
3106                    std::task::Poll::Pending => return std::task::Poll::Pending,
3107                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3108                        this.is_terminated = true;
3109                        return std::task::Poll::Ready(None);
3110                    }
3111                    std::task::Poll::Ready(Err(e)) => {
3112                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3113                            e.into(),
3114                        ))))
3115                    }
3116                }
3117
3118                // A message has been received from the channel
3119                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3120
3121                std::task::Poll::Ready(Some(match header.ordinal {
3122                    0x4e146d6bca733a84 => {
3123                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3124                        let mut req = fidl::new_empty!(
3125                            fidl::encoding::EmptyPayload,
3126                            fidl::encoding::DefaultFuchsiaResourceDialect
3127                        );
3128                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3129                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3130                        Ok(CompositeRequest::GetHealthState {
3131                            responder: CompositeGetHealthStateResponder {
3132                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3133                                tx_id: header.tx_id,
3134                            },
3135                        })
3136                    }
3137                    0xa81907ce6066295 => {
3138                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3139                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3140                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3141                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3142                        Ok(CompositeRequest::SignalProcessingConnect {
3143                            protocol: req.protocol,
3144
3145                            control_handle,
3146                        })
3147                    }
3148                    0xac355fb98341996 => {
3149                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3150                        let mut req = fidl::new_empty!(
3151                            fidl::encoding::EmptyPayload,
3152                            fidl::encoding::DefaultFuchsiaResourceDialect
3153                        );
3154                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3155                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3156                        Ok(CompositeRequest::Reset {
3157                            responder: CompositeResetResponder {
3158                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3159                                tx_id: header.tx_id,
3160                            },
3161                        })
3162                    }
3163                    0x31846fa0a459942b => {
3164                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3165                        let mut req = fidl::new_empty!(
3166                            fidl::encoding::EmptyPayload,
3167                            fidl::encoding::DefaultFuchsiaResourceDialect
3168                        );
3169                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3170                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3171                        Ok(CompositeRequest::GetProperties {
3172                            responder: CompositeGetPropertiesResponder {
3173                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3174                                tx_id: header.tx_id,
3175                            },
3176                        })
3177                    }
3178                    0x1d89b701b6816ac4 => {
3179                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3180                        let mut req = fidl::new_empty!(
3181                            CompositeGetRingBufferFormatsRequest,
3182                            fidl::encoding::DefaultFuchsiaResourceDialect
3183                        );
3184                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetRingBufferFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3185                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3186                        Ok(CompositeRequest::GetRingBufferFormats {
3187                            processing_element_id: req.processing_element_id,
3188
3189                            responder: CompositeGetRingBufferFormatsResponder {
3190                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3191                                tx_id: header.tx_id,
3192                            },
3193                        })
3194                    }
3195                    0x28c5685f85262033 => {
3196                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3197                        let mut req = fidl::new_empty!(
3198                            CompositeCreateRingBufferRequest,
3199                            fidl::encoding::DefaultFuchsiaResourceDialect
3200                        );
3201                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
3202                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3203                        Ok(CompositeRequest::CreateRingBuffer {
3204                            processing_element_id: req.processing_element_id,
3205                            format: req.format,
3206                            ring_buffer: req.ring_buffer,
3207
3208                            responder: CompositeCreateRingBufferResponder {
3209                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3210                                tx_id: header.tx_id,
3211                            },
3212                        })
3213                    }
3214                    0x3cbeaed59c8f69b => {
3215                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3216                        let mut req = fidl::new_empty!(
3217                            CompositeGetDaiFormatsRequest,
3218                            fidl::encoding::DefaultFuchsiaResourceDialect
3219                        );
3220                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeGetDaiFormatsRequest>(&header, _body_bytes, handles, &mut req)?;
3221                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3222                        Ok(CompositeRequest::GetDaiFormats {
3223                            processing_element_id: req.processing_element_id,
3224
3225                            responder: CompositeGetDaiFormatsResponder {
3226                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3227                                tx_id: header.tx_id,
3228                            },
3229                        })
3230                    }
3231                    0x155acf5cc0dc8a84 => {
3232                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3233                        let mut req = fidl::new_empty!(
3234                            CompositeSetDaiFormatRequest,
3235                            fidl::encoding::DefaultFuchsiaResourceDialect
3236                        );
3237                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeSetDaiFormatRequest>(&header, _body_bytes, handles, &mut req)?;
3238                        let control_handle = CompositeControlHandle { inner: this.inner.clone() };
3239                        Ok(CompositeRequest::SetDaiFormat {
3240                            processing_element_id: req.processing_element_id,
3241                            format: req.format,
3242
3243                            responder: CompositeSetDaiFormatResponder {
3244                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3245                                tx_id: header.tx_id,
3246                            },
3247                        })
3248                    }
3249                    _ => Err(fidl::Error::UnknownOrdinal {
3250                        ordinal: header.ordinal,
3251                        protocol_name:
3252                            <CompositeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3253                    }),
3254                }))
3255            },
3256        )
3257    }
3258}
3259
3260/// The `Composite` interface is a FIDL protocol exposed by audio drivers. The `Composite` interface
3261/// is generic and allows the configuration of various audio hardware types including those supported
3262/// by the `StreamConfig`, `Dai` and `Codec` FIDL interfaces. The `Composite` interface is more
3263/// generic and provides more flexible routing within audio subsystems. Also see
3264/// [Audio Driver Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md)
3265/// The hardware abstracted by the Composite protocol will be turned off (placed in its lowest
3266/// supported power state) until a call to any APIs that requires the hardware to be turned on
3267/// (placed in a higher power state).
3268#[derive(Debug)]
3269pub enum CompositeRequest {
3270    /// Retrieves top level health state.
3271    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
3272    GetHealthState { responder: CompositeGetHealthStateResponder },
3273    /// Connect to a `SignalProcessing` protocol.
3274    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
3275    /// the maximum number of connections have already been created, for instance one, then the
3276    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
3277    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
3278    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
3279    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
3280    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
3281    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
3282    /// is intended to be composed, and hence the more verbose name allows differentiation and
3283    /// improved clarity.
3284    SignalProcessingConnect {
3285        protocol: fidl::endpoints::ServerEnd<
3286            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3287        >,
3288        control_handle: CompositeControlHandle,
3289    },
3290    /// Resets the hardware including all DAI interconnects and signal processing.
3291    /// As a result, all channels obtained by `CreateRingBuffer` will be closed.
3292    ///
3293    /// `Reset` returns when the hardware is fully reset. At this point, a client would need to
3294    /// reconfigure any DAI interconnects, select a signal processing topology and reconfigure
3295    /// any processing elements, and reconstruct any ring buffers.
3296    ///
3297    /// If the driver can't successfully reset the hardware, it will return an error and then close
3298    /// the protocol channel, in this case the client may obtain a new protocol channel and retry.
3299    Reset { responder: CompositeResetResponder },
3300    /// Retrieves top level static properties.
3301    GetProperties { responder: CompositeGetPropertiesResponder },
3302    /// Retrieves the ring buffer formats supported by a `RING_BUFFER` processing element
3303    /// in the topology supported by this driver as returned by `GetElements` from
3304    /// fuchsia.hardware.audio.signalprocessing.
3305    /// Returns `SHOULD_WAIT` if the ring buffer formats are not available at the time, the
3306    /// client may retry at a later time.
3307    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3308    /// by `GetElements`.
3309    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3310    /// `RING_BUFFER`.
3311    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
3312    /// the parameters in `SupportedFormats` may be supported.
3313    GetRingBufferFormats {
3314        processing_element_id: u64,
3315        responder: CompositeGetRingBufferFormatsResponder,
3316    },
3317    /// `CreateRingBuffer` is sent by clients to select a ring buffer format for the `RING_BUFFER`
3318    /// processing element specified by `processing_element_id`. The format is based on information
3319    /// that the driver provides in `GetRingBufferFormats`, what is supported by the client, and
3320    /// any other requirement. The returned `ring_buffer` channel is used to access and control the
3321    /// audio buffer provided by the driver.
3322    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3323    /// by `GetElements`.
3324    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3325    /// `RING_BUFFER`.
3326    CreateRingBuffer {
3327        processing_element_id: u64,
3328        format: Format,
3329        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
3330        responder: CompositeCreateRingBufferResponder,
3331    },
3332    /// Retrieves the DAI formats supported by a `DAI_INTERCONNECT` processing element
3333    /// in the topology supported by this driver as returned by `GetElements` from
3334    /// fuchsia.hardware.audio.signalprocessing.
3335    /// Returns `SHOULD_WAIT` if the DAI formats are not available at the time, the client
3336    /// may retry at a later time.
3337    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3338    /// by `GetElements`.
3339    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3340    /// `DAI_INTERCONNECT`.
3341    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
3342    /// the parameters in SupportedFormats may be supported.
3343    GetDaiFormats { processing_element_id: u64, responder: CompositeGetDaiFormatsResponder },
3344    /// `SetDaiFormat` is sent by clients to select a DAI format for the `DAI_INTERCONNECT`
3345    /// processing element specified by `processing_element_id`. The format is based on information
3346    /// that the driver provides in `GetDaiFormats`, what is supported by the client, and any other
3347    /// requirement.
3348    /// Returns `INVALID_ARGS` if the `processing_element_id` does not match an id returned
3349    /// by `GetElements`.
3350    /// Returns `WRONG_TYPE` if the `ElementType` of the element represented by the id is not
3351    /// `DAI_INTERCONNECT`.
3352    SetDaiFormat {
3353        processing_element_id: u64,
3354        format: DaiFormat,
3355        responder: CompositeSetDaiFormatResponder,
3356    },
3357}
3358
3359impl CompositeRequest {
3360    #[allow(irrefutable_let_patterns)]
3361    pub fn into_get_health_state(self) -> Option<(CompositeGetHealthStateResponder)> {
3362        if let CompositeRequest::GetHealthState { responder } = self {
3363            Some((responder))
3364        } else {
3365            None
3366        }
3367    }
3368
3369    #[allow(irrefutable_let_patterns)]
3370    pub fn into_signal_processing_connect(
3371        self,
3372    ) -> Option<(
3373        fidl::endpoints::ServerEnd<
3374            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
3375        >,
3376        CompositeControlHandle,
3377    )> {
3378        if let CompositeRequest::SignalProcessingConnect { protocol, control_handle } = self {
3379            Some((protocol, control_handle))
3380        } else {
3381            None
3382        }
3383    }
3384
3385    #[allow(irrefutable_let_patterns)]
3386    pub fn into_reset(self) -> Option<(CompositeResetResponder)> {
3387        if let CompositeRequest::Reset { responder } = self {
3388            Some((responder))
3389        } else {
3390            None
3391        }
3392    }
3393
3394    #[allow(irrefutable_let_patterns)]
3395    pub fn into_get_properties(self) -> Option<(CompositeGetPropertiesResponder)> {
3396        if let CompositeRequest::GetProperties { responder } = self {
3397            Some((responder))
3398        } else {
3399            None
3400        }
3401    }
3402
3403    #[allow(irrefutable_let_patterns)]
3404    pub fn into_get_ring_buffer_formats(
3405        self,
3406    ) -> Option<(u64, CompositeGetRingBufferFormatsResponder)> {
3407        if let CompositeRequest::GetRingBufferFormats { processing_element_id, responder } = self {
3408            Some((processing_element_id, responder))
3409        } else {
3410            None
3411        }
3412    }
3413
3414    #[allow(irrefutable_let_patterns)]
3415    pub fn into_create_ring_buffer(
3416        self,
3417    ) -> Option<(
3418        u64,
3419        Format,
3420        fidl::endpoints::ServerEnd<RingBufferMarker>,
3421        CompositeCreateRingBufferResponder,
3422    )> {
3423        if let CompositeRequest::CreateRingBuffer {
3424            processing_element_id,
3425            format,
3426            ring_buffer,
3427            responder,
3428        } = self
3429        {
3430            Some((processing_element_id, format, ring_buffer, responder))
3431        } else {
3432            None
3433        }
3434    }
3435
3436    #[allow(irrefutable_let_patterns)]
3437    pub fn into_get_dai_formats(self) -> Option<(u64, CompositeGetDaiFormatsResponder)> {
3438        if let CompositeRequest::GetDaiFormats { processing_element_id, responder } = self {
3439            Some((processing_element_id, responder))
3440        } else {
3441            None
3442        }
3443    }
3444
3445    #[allow(irrefutable_let_patterns)]
3446    pub fn into_set_dai_format(self) -> Option<(u64, DaiFormat, CompositeSetDaiFormatResponder)> {
3447        if let CompositeRequest::SetDaiFormat { processing_element_id, format, responder } = self {
3448            Some((processing_element_id, format, responder))
3449        } else {
3450            None
3451        }
3452    }
3453
3454    /// Name of the method defined in FIDL
3455    pub fn method_name(&self) -> &'static str {
3456        match *self {
3457            CompositeRequest::GetHealthState { .. } => "get_health_state",
3458            CompositeRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
3459            CompositeRequest::Reset { .. } => "reset",
3460            CompositeRequest::GetProperties { .. } => "get_properties",
3461            CompositeRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
3462            CompositeRequest::CreateRingBuffer { .. } => "create_ring_buffer",
3463            CompositeRequest::GetDaiFormats { .. } => "get_dai_formats",
3464            CompositeRequest::SetDaiFormat { .. } => "set_dai_format",
3465        }
3466    }
3467}
3468
3469#[derive(Debug, Clone)]
3470pub struct CompositeControlHandle {
3471    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3472}
3473
3474impl fidl::endpoints::ControlHandle for CompositeControlHandle {
3475    fn shutdown(&self) {
3476        self.inner.shutdown()
3477    }
3478    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3479        self.inner.shutdown_with_epitaph(status)
3480    }
3481
3482    fn is_closed(&self) -> bool {
3483        self.inner.channel().is_closed()
3484    }
3485    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3486        self.inner.channel().on_closed()
3487    }
3488
3489    #[cfg(target_os = "fuchsia")]
3490    fn signal_peer(
3491        &self,
3492        clear_mask: zx::Signals,
3493        set_mask: zx::Signals,
3494    ) -> Result<(), zx_status::Status> {
3495        use fidl::Peered;
3496        self.inner.channel().signal_peer(clear_mask, set_mask)
3497    }
3498}
3499
3500impl CompositeControlHandle {}
3501
3502#[must_use = "FIDL methods require a response to be sent"]
3503#[derive(Debug)]
3504pub struct CompositeGetHealthStateResponder {
3505    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3506    tx_id: u32,
3507}
3508
3509/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3510/// if the responder is dropped without sending a response, so that the client
3511/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3512impl std::ops::Drop for CompositeGetHealthStateResponder {
3513    fn drop(&mut self) {
3514        self.control_handle.shutdown();
3515        // Safety: drops once, never accessed again
3516        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3517    }
3518}
3519
3520impl fidl::endpoints::Responder for CompositeGetHealthStateResponder {
3521    type ControlHandle = CompositeControlHandle;
3522
3523    fn control_handle(&self) -> &CompositeControlHandle {
3524        &self.control_handle
3525    }
3526
3527    fn drop_without_shutdown(mut self) {
3528        // Safety: drops once, never accessed again due to mem::forget
3529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3530        // Prevent Drop from running (which would shut down the channel)
3531        std::mem::forget(self);
3532    }
3533}
3534
3535impl CompositeGetHealthStateResponder {
3536    /// Sends a response to the FIDL transaction.
3537    ///
3538    /// Sets the channel to shutdown if an error occurs.
3539    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3540        let _result = self.send_raw(state);
3541        if _result.is_err() {
3542            self.control_handle.shutdown();
3543        }
3544        self.drop_without_shutdown();
3545        _result
3546    }
3547
3548    /// Similar to "send" but does not shutdown the channel if an error occurs.
3549    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
3550        let _result = self.send_raw(state);
3551        self.drop_without_shutdown();
3552        _result
3553    }
3554
3555    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
3556        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
3557            (state,),
3558            self.tx_id,
3559            0x4e146d6bca733a84,
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 CompositeResetResponder {
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 CompositeResetResponder {
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 CompositeResetResponder {
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 CompositeResetResponder {
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 result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3603        let _result = self.send_raw(result);
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 result: Result<(), DriverError>,
3615    ) -> Result<(), fidl::Error> {
3616        let _result = self.send_raw(result);
3617        self.drop_without_shutdown();
3618        _result
3619    }
3620
3621    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3622        self.control_handle.inner.send::<fidl::encoding::ResultType<
3623            fidl::encoding::EmptyStruct,
3624            DriverError,
3625        >>(
3626            result,
3627            self.tx_id,
3628            0xac355fb98341996,
3629            fidl::encoding::DynamicFlags::empty(),
3630        )
3631    }
3632}
3633
3634#[must_use = "FIDL methods require a response to be sent"]
3635#[derive(Debug)]
3636pub struct CompositeGetPropertiesResponder {
3637    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3638    tx_id: u32,
3639}
3640
3641/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3642/// if the responder is dropped without sending a response, so that the client
3643/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3644impl std::ops::Drop for CompositeGetPropertiesResponder {
3645    fn drop(&mut self) {
3646        self.control_handle.shutdown();
3647        // Safety: drops once, never accessed again
3648        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3649    }
3650}
3651
3652impl fidl::endpoints::Responder for CompositeGetPropertiesResponder {
3653    type ControlHandle = CompositeControlHandle;
3654
3655    fn control_handle(&self) -> &CompositeControlHandle {
3656        &self.control_handle
3657    }
3658
3659    fn drop_without_shutdown(mut self) {
3660        // Safety: drops once, never accessed again due to mem::forget
3661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3662        // Prevent Drop from running (which would shut down the channel)
3663        std::mem::forget(self);
3664    }
3665}
3666
3667impl CompositeGetPropertiesResponder {
3668    /// Sends a response to the FIDL transaction.
3669    ///
3670    /// Sets the channel to shutdown if an error occurs.
3671    pub fn send(self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3672        let _result = self.send_raw(properties);
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 properties: &CompositeProperties,
3684    ) -> Result<(), fidl::Error> {
3685        let _result = self.send_raw(properties);
3686        self.drop_without_shutdown();
3687        _result
3688    }
3689
3690    fn send_raw(&self, mut properties: &CompositeProperties) -> Result<(), fidl::Error> {
3691        self.control_handle.inner.send::<CompositeGetPropertiesResponse>(
3692            (properties,),
3693            self.tx_id,
3694            0x31846fa0a459942b,
3695            fidl::encoding::DynamicFlags::empty(),
3696        )
3697    }
3698}
3699
3700#[must_use = "FIDL methods require a response to be sent"]
3701#[derive(Debug)]
3702pub struct CompositeGetRingBufferFormatsResponder {
3703    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3704    tx_id: u32,
3705}
3706
3707/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3708/// if the responder is dropped without sending a response, so that the client
3709/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3710impl std::ops::Drop for CompositeGetRingBufferFormatsResponder {
3711    fn drop(&mut self) {
3712        self.control_handle.shutdown();
3713        // Safety: drops once, never accessed again
3714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3715    }
3716}
3717
3718impl fidl::endpoints::Responder for CompositeGetRingBufferFormatsResponder {
3719    type ControlHandle = CompositeControlHandle;
3720
3721    fn control_handle(&self) -> &CompositeControlHandle {
3722        &self.control_handle
3723    }
3724
3725    fn drop_without_shutdown(mut self) {
3726        // Safety: drops once, never accessed again due to mem::forget
3727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3728        // Prevent Drop from running (which would shut down the channel)
3729        std::mem::forget(self);
3730    }
3731}
3732
3733impl CompositeGetRingBufferFormatsResponder {
3734    /// Sends a response to the FIDL transaction.
3735    ///
3736    /// Sets the channel to shutdown if an error occurs.
3737    pub fn send(
3738        self,
3739        mut result: Result<&[SupportedFormats], DriverError>,
3740    ) -> Result<(), fidl::Error> {
3741        let _result = self.send_raw(result);
3742        if _result.is_err() {
3743            self.control_handle.shutdown();
3744        }
3745        self.drop_without_shutdown();
3746        _result
3747    }
3748
3749    /// Similar to "send" but does not shutdown the channel if an error occurs.
3750    pub fn send_no_shutdown_on_err(
3751        self,
3752        mut result: Result<&[SupportedFormats], DriverError>,
3753    ) -> Result<(), fidl::Error> {
3754        let _result = self.send_raw(result);
3755        self.drop_without_shutdown();
3756        _result
3757    }
3758
3759    fn send_raw(
3760        &self,
3761        mut result: Result<&[SupportedFormats], DriverError>,
3762    ) -> Result<(), fidl::Error> {
3763        self.control_handle.inner.send::<fidl::encoding::ResultType<
3764            CompositeGetRingBufferFormatsResponse,
3765            DriverError,
3766        >>(
3767            result.map(|ring_buffer_formats| (ring_buffer_formats,)),
3768            self.tx_id,
3769            0x1d89b701b6816ac4,
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 CompositeCreateRingBufferResponder {
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 CompositeCreateRingBufferResponder {
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 CompositeCreateRingBufferResponder {
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 CompositeCreateRingBufferResponder {
3809    /// Sends a response to the FIDL transaction.
3810    ///
3811    /// Sets the channel to shutdown if an error occurs.
3812    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3813        let _result = self.send_raw(result);
3814        if _result.is_err() {
3815            self.control_handle.shutdown();
3816        }
3817        self.drop_without_shutdown();
3818        _result
3819    }
3820
3821    /// Similar to "send" but does not shutdown the channel if an error occurs.
3822    pub fn send_no_shutdown_on_err(
3823        self,
3824        mut result: Result<(), DriverError>,
3825    ) -> Result<(), fidl::Error> {
3826        let _result = self.send_raw(result);
3827        self.drop_without_shutdown();
3828        _result
3829    }
3830
3831    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3832        self.control_handle.inner.send::<fidl::encoding::ResultType<
3833            fidl::encoding::EmptyStruct,
3834            DriverError,
3835        >>(
3836            result,
3837            self.tx_id,
3838            0x28c5685f85262033,
3839            fidl::encoding::DynamicFlags::empty(),
3840        )
3841    }
3842}
3843
3844#[must_use = "FIDL methods require a response to be sent"]
3845#[derive(Debug)]
3846pub struct CompositeGetDaiFormatsResponder {
3847    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3848    tx_id: u32,
3849}
3850
3851/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3852/// if the responder is dropped without sending a response, so that the client
3853/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3854impl std::ops::Drop for CompositeGetDaiFormatsResponder {
3855    fn drop(&mut self) {
3856        self.control_handle.shutdown();
3857        // Safety: drops once, never accessed again
3858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3859    }
3860}
3861
3862impl fidl::endpoints::Responder for CompositeGetDaiFormatsResponder {
3863    type ControlHandle = CompositeControlHandle;
3864
3865    fn control_handle(&self) -> &CompositeControlHandle {
3866        &self.control_handle
3867    }
3868
3869    fn drop_without_shutdown(mut self) {
3870        // Safety: drops once, never accessed again due to mem::forget
3871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3872        // Prevent Drop from running (which would shut down the channel)
3873        std::mem::forget(self);
3874    }
3875}
3876
3877impl CompositeGetDaiFormatsResponder {
3878    /// Sends a response to the FIDL transaction.
3879    ///
3880    /// Sets the channel to shutdown if an error occurs.
3881    pub fn send(
3882        self,
3883        mut result: Result<&[DaiSupportedFormats], DriverError>,
3884    ) -> Result<(), fidl::Error> {
3885        let _result = self.send_raw(result);
3886        if _result.is_err() {
3887            self.control_handle.shutdown();
3888        }
3889        self.drop_without_shutdown();
3890        _result
3891    }
3892
3893    /// Similar to "send" but does not shutdown the channel if an error occurs.
3894    pub fn send_no_shutdown_on_err(
3895        self,
3896        mut result: Result<&[DaiSupportedFormats], DriverError>,
3897    ) -> Result<(), fidl::Error> {
3898        let _result = self.send_raw(result);
3899        self.drop_without_shutdown();
3900        _result
3901    }
3902
3903    fn send_raw(
3904        &self,
3905        mut result: Result<&[DaiSupportedFormats], DriverError>,
3906    ) -> Result<(), fidl::Error> {
3907        self.control_handle.inner.send::<fidl::encoding::ResultType<
3908            CompositeGetDaiFormatsResponse,
3909            DriverError,
3910        >>(
3911            result.map(|dai_formats| (dai_formats,)),
3912            self.tx_id,
3913            0x3cbeaed59c8f69b,
3914            fidl::encoding::DynamicFlags::empty(),
3915        )
3916    }
3917}
3918
3919#[must_use = "FIDL methods require a response to be sent"]
3920#[derive(Debug)]
3921pub struct CompositeSetDaiFormatResponder {
3922    control_handle: std::mem::ManuallyDrop<CompositeControlHandle>,
3923    tx_id: u32,
3924}
3925
3926/// Set the the channel to be shutdown (see [`CompositeControlHandle::shutdown`])
3927/// if the responder is dropped without sending a response, so that the client
3928/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3929impl std::ops::Drop for CompositeSetDaiFormatResponder {
3930    fn drop(&mut self) {
3931        self.control_handle.shutdown();
3932        // Safety: drops once, never accessed again
3933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3934    }
3935}
3936
3937impl fidl::endpoints::Responder for CompositeSetDaiFormatResponder {
3938    type ControlHandle = CompositeControlHandle;
3939
3940    fn control_handle(&self) -> &CompositeControlHandle {
3941        &self.control_handle
3942    }
3943
3944    fn drop_without_shutdown(mut self) {
3945        // Safety: drops once, never accessed again due to mem::forget
3946        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3947        // Prevent Drop from running (which would shut down the channel)
3948        std::mem::forget(self);
3949    }
3950}
3951
3952impl CompositeSetDaiFormatResponder {
3953    /// Sends a response to the FIDL transaction.
3954    ///
3955    /// Sets the channel to shutdown if an error occurs.
3956    pub fn send(self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3957        let _result = self.send_raw(result);
3958        if _result.is_err() {
3959            self.control_handle.shutdown();
3960        }
3961        self.drop_without_shutdown();
3962        _result
3963    }
3964
3965    /// Similar to "send" but does not shutdown the channel if an error occurs.
3966    pub fn send_no_shutdown_on_err(
3967        self,
3968        mut result: Result<(), DriverError>,
3969    ) -> Result<(), fidl::Error> {
3970        let _result = self.send_raw(result);
3971        self.drop_without_shutdown();
3972        _result
3973    }
3974
3975    fn send_raw(&self, mut result: Result<(), DriverError>) -> Result<(), fidl::Error> {
3976        self.control_handle.inner.send::<fidl::encoding::ResultType<
3977            fidl::encoding::EmptyStruct,
3978            DriverError,
3979        >>(
3980            result,
3981            self.tx_id,
3982            0x155acf5cc0dc8a84,
3983            fidl::encoding::DynamicFlags::empty(),
3984        )
3985    }
3986}
3987
3988#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3989pub struct CompositeConnectorMarker;
3990
3991impl fidl::endpoints::ProtocolMarker for CompositeConnectorMarker {
3992    type Proxy = CompositeConnectorProxy;
3993    type RequestStream = CompositeConnectorRequestStream;
3994    #[cfg(target_os = "fuchsia")]
3995    type SynchronousProxy = CompositeConnectorSynchronousProxy;
3996
3997    const DEBUG_NAME: &'static str = "(anonymous) CompositeConnector";
3998}
3999
4000pub trait CompositeConnectorProxyInterface: Send + Sync {
4001    fn r#connect(
4002        &self,
4003        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4004    ) -> Result<(), fidl::Error>;
4005}
4006#[derive(Debug)]
4007#[cfg(target_os = "fuchsia")]
4008pub struct CompositeConnectorSynchronousProxy {
4009    client: fidl::client::sync::Client,
4010}
4011
4012#[cfg(target_os = "fuchsia")]
4013impl fidl::endpoints::SynchronousProxy for CompositeConnectorSynchronousProxy {
4014    type Proxy = CompositeConnectorProxy;
4015    type Protocol = CompositeConnectorMarker;
4016
4017    fn from_channel(inner: fidl::Channel) -> Self {
4018        Self::new(inner)
4019    }
4020
4021    fn into_channel(self) -> fidl::Channel {
4022        self.client.into_channel()
4023    }
4024
4025    fn as_channel(&self) -> &fidl::Channel {
4026        self.client.as_channel()
4027    }
4028}
4029
4030#[cfg(target_os = "fuchsia")]
4031impl CompositeConnectorSynchronousProxy {
4032    pub fn new(channel: fidl::Channel) -> Self {
4033        let protocol_name =
4034            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4035        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4036    }
4037
4038    pub fn into_channel(self) -> fidl::Channel {
4039        self.client.into_channel()
4040    }
4041
4042    /// Waits until an event arrives and returns it. It is safe for other
4043    /// threads to make concurrent requests while waiting for an event.
4044    pub fn wait_for_event(
4045        &self,
4046        deadline: zx::MonotonicInstant,
4047    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4048        CompositeConnectorEvent::decode(self.client.wait_for_event(deadline)?)
4049    }
4050
4051    /// Connect to a `Device` protocol.
4052    /// This method allows a component to serve FIDL outside the devhost's control.
4053    pub fn r#connect(
4054        &self,
4055        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4056    ) -> Result<(), fidl::Error> {
4057        self.client.send::<CompositeConnectorConnectRequest>(
4058            (composite_protocol,),
4059            0x7ee557529079e466,
4060            fidl::encoding::DynamicFlags::empty(),
4061        )
4062    }
4063}
4064
4065#[cfg(target_os = "fuchsia")]
4066impl From<CompositeConnectorSynchronousProxy> for zx::Handle {
4067    fn from(value: CompositeConnectorSynchronousProxy) -> Self {
4068        value.into_channel().into()
4069    }
4070}
4071
4072#[cfg(target_os = "fuchsia")]
4073impl From<fidl::Channel> for CompositeConnectorSynchronousProxy {
4074    fn from(value: fidl::Channel) -> Self {
4075        Self::new(value)
4076    }
4077}
4078
4079#[cfg(target_os = "fuchsia")]
4080impl fidl::endpoints::FromClient for CompositeConnectorSynchronousProxy {
4081    type Protocol = CompositeConnectorMarker;
4082
4083    fn from_client(value: fidl::endpoints::ClientEnd<CompositeConnectorMarker>) -> Self {
4084        Self::new(value.into_channel())
4085    }
4086}
4087
4088#[derive(Debug, Clone)]
4089pub struct CompositeConnectorProxy {
4090    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4091}
4092
4093impl fidl::endpoints::Proxy for CompositeConnectorProxy {
4094    type Protocol = CompositeConnectorMarker;
4095
4096    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4097        Self::new(inner)
4098    }
4099
4100    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4101        self.client.into_channel().map_err(|client| Self { client })
4102    }
4103
4104    fn as_channel(&self) -> &::fidl::AsyncChannel {
4105        self.client.as_channel()
4106    }
4107}
4108
4109impl CompositeConnectorProxy {
4110    /// Create a new Proxy for fuchsia.hardware.audio/CompositeConnector.
4111    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4112        let protocol_name =
4113            <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4114        Self { client: fidl::client::Client::new(channel, protocol_name) }
4115    }
4116
4117    /// Get a Stream of events from the remote end of the protocol.
4118    ///
4119    /// # Panics
4120    ///
4121    /// Panics if the event stream was already taken.
4122    pub fn take_event_stream(&self) -> CompositeConnectorEventStream {
4123        CompositeConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4124    }
4125
4126    /// Connect to a `Device` protocol.
4127    /// This method allows a component to serve FIDL outside the devhost's control.
4128    pub fn r#connect(
4129        &self,
4130        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4131    ) -> Result<(), fidl::Error> {
4132        CompositeConnectorProxyInterface::r#connect(self, composite_protocol)
4133    }
4134}
4135
4136impl CompositeConnectorProxyInterface for CompositeConnectorProxy {
4137    fn r#connect(
4138        &self,
4139        mut composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4140    ) -> Result<(), fidl::Error> {
4141        self.client.send::<CompositeConnectorConnectRequest>(
4142            (composite_protocol,),
4143            0x7ee557529079e466,
4144            fidl::encoding::DynamicFlags::empty(),
4145        )
4146    }
4147}
4148
4149pub struct CompositeConnectorEventStream {
4150    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4151}
4152
4153impl std::marker::Unpin for CompositeConnectorEventStream {}
4154
4155impl futures::stream::FusedStream for CompositeConnectorEventStream {
4156    fn is_terminated(&self) -> bool {
4157        self.event_receiver.is_terminated()
4158    }
4159}
4160
4161impl futures::Stream for CompositeConnectorEventStream {
4162    type Item = Result<CompositeConnectorEvent, fidl::Error>;
4163
4164    fn poll_next(
4165        mut self: std::pin::Pin<&mut Self>,
4166        cx: &mut std::task::Context<'_>,
4167    ) -> std::task::Poll<Option<Self::Item>> {
4168        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4169            &mut self.event_receiver,
4170            cx
4171        )?) {
4172            Some(buf) => std::task::Poll::Ready(Some(CompositeConnectorEvent::decode(buf))),
4173            None => std::task::Poll::Ready(None),
4174        }
4175    }
4176}
4177
4178#[derive(Debug)]
4179pub enum CompositeConnectorEvent {}
4180
4181impl CompositeConnectorEvent {
4182    /// Decodes a message buffer as a [`CompositeConnectorEvent`].
4183    fn decode(
4184        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4185    ) -> Result<CompositeConnectorEvent, fidl::Error> {
4186        let (bytes, _handles) = buf.split_mut();
4187        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4188        debug_assert_eq!(tx_header.tx_id, 0);
4189        match tx_header.ordinal {
4190            _ => Err(fidl::Error::UnknownOrdinal {
4191                ordinal: tx_header.ordinal,
4192                protocol_name:
4193                    <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4194            }),
4195        }
4196    }
4197}
4198
4199/// A Stream of incoming requests for fuchsia.hardware.audio/CompositeConnector.
4200pub struct CompositeConnectorRequestStream {
4201    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4202    is_terminated: bool,
4203}
4204
4205impl std::marker::Unpin for CompositeConnectorRequestStream {}
4206
4207impl futures::stream::FusedStream for CompositeConnectorRequestStream {
4208    fn is_terminated(&self) -> bool {
4209        self.is_terminated
4210    }
4211}
4212
4213impl fidl::endpoints::RequestStream for CompositeConnectorRequestStream {
4214    type Protocol = CompositeConnectorMarker;
4215    type ControlHandle = CompositeConnectorControlHandle;
4216
4217    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4218        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4219    }
4220
4221    fn control_handle(&self) -> Self::ControlHandle {
4222        CompositeConnectorControlHandle { inner: self.inner.clone() }
4223    }
4224
4225    fn into_inner(
4226        self,
4227    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4228    {
4229        (self.inner, self.is_terminated)
4230    }
4231
4232    fn from_inner(
4233        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4234        is_terminated: bool,
4235    ) -> Self {
4236        Self { inner, is_terminated }
4237    }
4238}
4239
4240impl futures::Stream for CompositeConnectorRequestStream {
4241    type Item = Result<CompositeConnectorRequest, fidl::Error>;
4242
4243    fn poll_next(
4244        mut self: std::pin::Pin<&mut Self>,
4245        cx: &mut std::task::Context<'_>,
4246    ) -> std::task::Poll<Option<Self::Item>> {
4247        let this = &mut *self;
4248        if this.inner.check_shutdown(cx) {
4249            this.is_terminated = true;
4250            return std::task::Poll::Ready(None);
4251        }
4252        if this.is_terminated {
4253            panic!("polled CompositeConnectorRequestStream after completion");
4254        }
4255        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4256            |bytes, handles| {
4257                match this.inner.channel().read_etc(cx, bytes, handles) {
4258                    std::task::Poll::Ready(Ok(())) => {}
4259                    std::task::Poll::Pending => return std::task::Poll::Pending,
4260                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4261                        this.is_terminated = true;
4262                        return std::task::Poll::Ready(None);
4263                    }
4264                    std::task::Poll::Ready(Err(e)) => {
4265                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4266                            e.into(),
4267                        ))))
4268                    }
4269                }
4270
4271                // A message has been received from the channel
4272                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4273
4274                std::task::Poll::Ready(Some(match header.ordinal {
4275                0x7ee557529079e466 => {
4276                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4277                    let mut req = fidl::new_empty!(CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4278                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CompositeConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4279                    let control_handle = CompositeConnectorControlHandle {
4280                        inner: this.inner.clone(),
4281                    };
4282                    Ok(CompositeConnectorRequest::Connect {composite_protocol: req.composite_protocol,
4283
4284                        control_handle,
4285                    })
4286                }
4287                _ => Err(fidl::Error::UnknownOrdinal {
4288                    ordinal: header.ordinal,
4289                    protocol_name: <CompositeConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4290                }),
4291            }))
4292            },
4293        )
4294    }
4295}
4296
4297/// For an overview see
4298/// [Audio Composite Devices](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite.md).
4299#[derive(Debug)]
4300pub enum CompositeConnectorRequest {
4301    /// Connect to a `Device` protocol.
4302    /// This method allows a component to serve FIDL outside the devhost's control.
4303    Connect {
4304        composite_protocol: fidl::endpoints::ServerEnd<CompositeMarker>,
4305        control_handle: CompositeConnectorControlHandle,
4306    },
4307}
4308
4309impl CompositeConnectorRequest {
4310    #[allow(irrefutable_let_patterns)]
4311    pub fn into_connect(
4312        self,
4313    ) -> Option<(fidl::endpoints::ServerEnd<CompositeMarker>, CompositeConnectorControlHandle)>
4314    {
4315        if let CompositeConnectorRequest::Connect { composite_protocol, control_handle } = self {
4316            Some((composite_protocol, control_handle))
4317        } else {
4318            None
4319        }
4320    }
4321
4322    /// Name of the method defined in FIDL
4323    pub fn method_name(&self) -> &'static str {
4324        match *self {
4325            CompositeConnectorRequest::Connect { .. } => "connect",
4326        }
4327    }
4328}
4329
4330#[derive(Debug, Clone)]
4331pub struct CompositeConnectorControlHandle {
4332    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4333}
4334
4335impl fidl::endpoints::ControlHandle for CompositeConnectorControlHandle {
4336    fn shutdown(&self) {
4337        self.inner.shutdown()
4338    }
4339    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4340        self.inner.shutdown_with_epitaph(status)
4341    }
4342
4343    fn is_closed(&self) -> bool {
4344        self.inner.channel().is_closed()
4345    }
4346    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4347        self.inner.channel().on_closed()
4348    }
4349
4350    #[cfg(target_os = "fuchsia")]
4351    fn signal_peer(
4352        &self,
4353        clear_mask: zx::Signals,
4354        set_mask: zx::Signals,
4355    ) -> Result<(), zx_status::Status> {
4356        use fidl::Peered;
4357        self.inner.channel().signal_peer(clear_mask, set_mask)
4358    }
4359}
4360
4361impl CompositeConnectorControlHandle {}
4362
4363#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4364pub struct DaiMarker;
4365
4366impl fidl::endpoints::ProtocolMarker for DaiMarker {
4367    type Proxy = DaiProxy;
4368    type RequestStream = DaiRequestStream;
4369    #[cfg(target_os = "fuchsia")]
4370    type SynchronousProxy = DaiSynchronousProxy;
4371
4372    const DEBUG_NAME: &'static str = "(anonymous) Dai";
4373}
4374pub type DaiGetDaiFormatsResult = Result<Vec<DaiSupportedFormats>, i32>;
4375pub type DaiGetRingBufferFormatsResult = Result<Vec<SupportedFormats>, i32>;
4376
4377pub trait DaiProxyInterface: Send + Sync {
4378    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
4379        + Send;
4380    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
4381    fn r#signal_processing_connect(
4382        &self,
4383        protocol: fidl::endpoints::ServerEnd<
4384            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4385        >,
4386    ) -> Result<(), fidl::Error>;
4387    type ResetResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4388    fn r#reset(&self) -> Self::ResetResponseFut;
4389    type GetPropertiesResponseFut: std::future::Future<Output = Result<DaiProperties, fidl::Error>>
4390        + Send;
4391    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
4392    type GetDaiFormatsResponseFut: std::future::Future<Output = Result<DaiGetDaiFormatsResult, fidl::Error>>
4393        + Send;
4394    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut;
4395    type GetRingBufferFormatsResponseFut: std::future::Future<Output = Result<DaiGetRingBufferFormatsResult, fidl::Error>>
4396        + Send;
4397    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut;
4398    fn r#create_ring_buffer(
4399        &self,
4400        dai_format: &DaiFormat,
4401        ring_buffer_format: &Format,
4402        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4403    ) -> Result<(), fidl::Error>;
4404}
4405#[derive(Debug)]
4406#[cfg(target_os = "fuchsia")]
4407pub struct DaiSynchronousProxy {
4408    client: fidl::client::sync::Client,
4409}
4410
4411#[cfg(target_os = "fuchsia")]
4412impl fidl::endpoints::SynchronousProxy for DaiSynchronousProxy {
4413    type Proxy = DaiProxy;
4414    type Protocol = DaiMarker;
4415
4416    fn from_channel(inner: fidl::Channel) -> Self {
4417        Self::new(inner)
4418    }
4419
4420    fn into_channel(self) -> fidl::Channel {
4421        self.client.into_channel()
4422    }
4423
4424    fn as_channel(&self) -> &fidl::Channel {
4425        self.client.as_channel()
4426    }
4427}
4428
4429#[cfg(target_os = "fuchsia")]
4430impl DaiSynchronousProxy {
4431    pub fn new(channel: fidl::Channel) -> Self {
4432        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4433        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4434    }
4435
4436    pub fn into_channel(self) -> fidl::Channel {
4437        self.client.into_channel()
4438    }
4439
4440    /// Waits until an event arrives and returns it. It is safe for other
4441    /// threads to make concurrent requests while waiting for an event.
4442    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<DaiEvent, fidl::Error> {
4443        DaiEvent::decode(self.client.wait_for_event(deadline)?)
4444    }
4445
4446    /// Retrieves top level health state.
4447    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4448    pub fn r#get_health_state(
4449        &self,
4450        ___deadline: zx::MonotonicInstant,
4451    ) -> Result<HealthState, fidl::Error> {
4452        let _response =
4453            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
4454                (),
4455                0x4e146d6bca733a84,
4456                fidl::encoding::DynamicFlags::empty(),
4457                ___deadline,
4458            )?;
4459        Ok(_response.state)
4460    }
4461
4462    /// Connect to a `SignalProcessing` protocol.
4463    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4464    /// the maximum number of connections have already been created, for instance one, then the
4465    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4466    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4467    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4468    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4469    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4470    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4471    /// is intended to be composed, and hence the more verbose name allows differentiation and
4472    /// improved clarity.
4473    pub fn r#signal_processing_connect(
4474        &self,
4475        mut protocol: fidl::endpoints::ServerEnd<
4476            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4477        >,
4478    ) -> Result<(), fidl::Error> {
4479        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4480            (protocol,),
4481            0xa81907ce6066295,
4482            fidl::encoding::DynamicFlags::empty(),
4483        )
4484    }
4485
4486    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4487    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4488    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4489    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4490    /// protocol channel and retry.
4491    pub fn r#reset(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
4492        let _response =
4493            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
4494                (),
4495                0x69e5fa9fa2f78c14,
4496                fidl::encoding::DynamicFlags::empty(),
4497                ___deadline,
4498            )?;
4499        Ok(_response)
4500    }
4501
4502    /// Retrieves top level static properties.
4503    pub fn r#get_properties(
4504        &self,
4505        ___deadline: zx::MonotonicInstant,
4506    ) -> Result<DaiProperties, fidl::Error> {
4507        let _response =
4508            self.client.send_query::<fidl::encoding::EmptyPayload, DaiGetPropertiesResponse>(
4509                (),
4510                0x2c25a1a66149510b,
4511                fidl::encoding::DynamicFlags::empty(),
4512                ___deadline,
4513            )?;
4514        Ok(_response.properties)
4515    }
4516
4517    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4518    /// may reply with an error status and the client may retry at a later time.
4519    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4520    /// the parameters in SupportedFormats may be supported.
4521    pub fn r#get_dai_formats(
4522        &self,
4523        ___deadline: zx::MonotonicInstant,
4524    ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4525        let _response = self.client.send_query::<
4526            fidl::encoding::EmptyPayload,
4527            fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4528        >(
4529            (),
4530            0x1eb37b0cddf79d69,
4531            fidl::encoding::DynamicFlags::empty(),
4532            ___deadline,
4533        )?;
4534        Ok(_response.map(|x| x.dai_formats))
4535    }
4536
4537    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4538    /// may reply with an error status and the client may retry at a later time.
4539    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4540    /// the parameters in `SupportedFormats` may be supported.
4541    pub fn r#get_ring_buffer_formats(
4542        &self,
4543        ___deadline: zx::MonotonicInstant,
4544    ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4545        let _response = self.client.send_query::<
4546            fidl::encoding::EmptyPayload,
4547            fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4548        >(
4549            (),
4550            0x760371081d8c92e4,
4551            fidl::encoding::DynamicFlags::empty(),
4552            ___deadline,
4553        )?;
4554        Ok(_response.map(|x| x.ring_buffer_formats))
4555    }
4556
4557    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4558    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4559    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4560    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4561    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4562    /// gracefully quiesce any on-going streaming operations in the process.
4563    pub fn r#create_ring_buffer(
4564        &self,
4565        mut dai_format: &DaiFormat,
4566        mut ring_buffer_format: &Format,
4567        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4568    ) -> Result<(), fidl::Error> {
4569        self.client.send::<DaiCreateRingBufferRequest>(
4570            (dai_format, ring_buffer_format, ring_buffer),
4571            0x5af9760589a75257,
4572            fidl::encoding::DynamicFlags::empty(),
4573        )
4574    }
4575}
4576
4577#[cfg(target_os = "fuchsia")]
4578impl From<DaiSynchronousProxy> for zx::Handle {
4579    fn from(value: DaiSynchronousProxy) -> Self {
4580        value.into_channel().into()
4581    }
4582}
4583
4584#[cfg(target_os = "fuchsia")]
4585impl From<fidl::Channel> for DaiSynchronousProxy {
4586    fn from(value: fidl::Channel) -> Self {
4587        Self::new(value)
4588    }
4589}
4590
4591#[cfg(target_os = "fuchsia")]
4592impl fidl::endpoints::FromClient for DaiSynchronousProxy {
4593    type Protocol = DaiMarker;
4594
4595    fn from_client(value: fidl::endpoints::ClientEnd<DaiMarker>) -> Self {
4596        Self::new(value.into_channel())
4597    }
4598}
4599
4600#[derive(Debug, Clone)]
4601pub struct DaiProxy {
4602    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4603}
4604
4605impl fidl::endpoints::Proxy for DaiProxy {
4606    type Protocol = DaiMarker;
4607
4608    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4609        Self::new(inner)
4610    }
4611
4612    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4613        self.client.into_channel().map_err(|client| Self { client })
4614    }
4615
4616    fn as_channel(&self) -> &::fidl::AsyncChannel {
4617        self.client.as_channel()
4618    }
4619}
4620
4621impl DaiProxy {
4622    /// Create a new Proxy for fuchsia.hardware.audio/Dai.
4623    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4624        let protocol_name = <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4625        Self { client: fidl::client::Client::new(channel, protocol_name) }
4626    }
4627
4628    /// Get a Stream of events from the remote end of the protocol.
4629    ///
4630    /// # Panics
4631    ///
4632    /// Panics if the event stream was already taken.
4633    pub fn take_event_stream(&self) -> DaiEventStream {
4634        DaiEventStream { event_receiver: self.client.take_event_receiver() }
4635    }
4636
4637    /// Retrieves top level health state.
4638    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
4639    pub fn r#get_health_state(
4640        &self,
4641    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
4642    {
4643        DaiProxyInterface::r#get_health_state(self)
4644    }
4645
4646    /// Connect to a `SignalProcessing` protocol.
4647    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
4648    /// the maximum number of connections have already been created, for instance one, then the
4649    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
4650    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
4651    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
4652    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
4653    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
4654    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
4655    /// is intended to be composed, and hence the more verbose name allows differentiation and
4656    /// improved clarity.
4657    pub fn r#signal_processing_connect(
4658        &self,
4659        mut protocol: fidl::endpoints::ServerEnd<
4660            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4661        >,
4662    ) -> Result<(), fidl::Error> {
4663        DaiProxyInterface::r#signal_processing_connect(self, protocol)
4664    }
4665
4666    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
4667    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
4668    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
4669    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
4670    /// protocol channel and retry.
4671    pub fn r#reset(
4672        &self,
4673    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4674        DaiProxyInterface::r#reset(self)
4675    }
4676
4677    /// Retrieves top level static properties.
4678    pub fn r#get_properties(
4679        &self,
4680    ) -> fidl::client::QueryResponseFut<DaiProperties, fidl::encoding::DefaultFuchsiaResourceDialect>
4681    {
4682        DaiProxyInterface::r#get_properties(self)
4683    }
4684
4685    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
4686    /// may reply with an error status and the client may retry at a later time.
4687    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
4688    /// the parameters in SupportedFormats may be supported.
4689    pub fn r#get_dai_formats(
4690        &self,
4691    ) -> fidl::client::QueryResponseFut<
4692        DaiGetDaiFormatsResult,
4693        fidl::encoding::DefaultFuchsiaResourceDialect,
4694    > {
4695        DaiProxyInterface::r#get_dai_formats(self)
4696    }
4697
4698    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
4699    /// may reply with an error status and the client may retry at a later time.
4700    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
4701    /// the parameters in `SupportedFormats` may be supported.
4702    pub fn r#get_ring_buffer_formats(
4703        &self,
4704    ) -> fidl::client::QueryResponseFut<
4705        DaiGetRingBufferFormatsResult,
4706        fidl::encoding::DefaultFuchsiaResourceDialect,
4707    > {
4708        DaiProxyInterface::r#get_ring_buffer_formats(self)
4709    }
4710
4711    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
4712    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
4713    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
4714    /// used to control the audio buffer, if a previous ring buffer channel had been established and
4715    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
4716    /// gracefully quiesce any on-going streaming operations in the process.
4717    pub fn r#create_ring_buffer(
4718        &self,
4719        mut dai_format: &DaiFormat,
4720        mut ring_buffer_format: &Format,
4721        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4722    ) -> Result<(), fidl::Error> {
4723        DaiProxyInterface::r#create_ring_buffer(self, dai_format, ring_buffer_format, ring_buffer)
4724    }
4725}
4726
4727impl DaiProxyInterface for DaiProxy {
4728    type GetHealthStateResponseFut =
4729        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
4730    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
4731        fn _decode(
4732            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4733        ) -> Result<HealthState, fidl::Error> {
4734            let _response = fidl::client::decode_transaction_body::<
4735                HealthGetHealthStateResponse,
4736                fidl::encoding::DefaultFuchsiaResourceDialect,
4737                0x4e146d6bca733a84,
4738            >(_buf?)?;
4739            Ok(_response.state)
4740        }
4741        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
4742            (),
4743            0x4e146d6bca733a84,
4744            fidl::encoding::DynamicFlags::empty(),
4745            _decode,
4746        )
4747    }
4748
4749    fn r#signal_processing_connect(
4750        &self,
4751        mut protocol: fidl::endpoints::ServerEnd<
4752            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
4753        >,
4754    ) -> Result<(), fidl::Error> {
4755        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
4756            (protocol,),
4757            0xa81907ce6066295,
4758            fidl::encoding::DynamicFlags::empty(),
4759        )
4760    }
4761
4762    type ResetResponseFut =
4763        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4764    fn r#reset(&self) -> Self::ResetResponseFut {
4765        fn _decode(
4766            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4767        ) -> Result<(), fidl::Error> {
4768            let _response = fidl::client::decode_transaction_body::<
4769                fidl::encoding::EmptyPayload,
4770                fidl::encoding::DefaultFuchsiaResourceDialect,
4771                0x69e5fa9fa2f78c14,
4772            >(_buf?)?;
4773            Ok(_response)
4774        }
4775        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
4776            (),
4777            0x69e5fa9fa2f78c14,
4778            fidl::encoding::DynamicFlags::empty(),
4779            _decode,
4780        )
4781    }
4782
4783    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
4784        DaiProperties,
4785        fidl::encoding::DefaultFuchsiaResourceDialect,
4786    >;
4787    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
4788        fn _decode(
4789            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4790        ) -> Result<DaiProperties, fidl::Error> {
4791            let _response = fidl::client::decode_transaction_body::<
4792                DaiGetPropertiesResponse,
4793                fidl::encoding::DefaultFuchsiaResourceDialect,
4794                0x2c25a1a66149510b,
4795            >(_buf?)?;
4796            Ok(_response.properties)
4797        }
4798        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiProperties>(
4799            (),
4800            0x2c25a1a66149510b,
4801            fidl::encoding::DynamicFlags::empty(),
4802            _decode,
4803        )
4804    }
4805
4806    type GetDaiFormatsResponseFut = fidl::client::QueryResponseFut<
4807        DaiGetDaiFormatsResult,
4808        fidl::encoding::DefaultFuchsiaResourceDialect,
4809    >;
4810    fn r#get_dai_formats(&self) -> Self::GetDaiFormatsResponseFut {
4811        fn _decode(
4812            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4813        ) -> Result<DaiGetDaiFormatsResult, fidl::Error> {
4814            let _response = fidl::client::decode_transaction_body::<
4815                fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>,
4816                fidl::encoding::DefaultFuchsiaResourceDialect,
4817                0x1eb37b0cddf79d69,
4818            >(_buf?)?;
4819            Ok(_response.map(|x| x.dai_formats))
4820        }
4821        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetDaiFormatsResult>(
4822            (),
4823            0x1eb37b0cddf79d69,
4824            fidl::encoding::DynamicFlags::empty(),
4825            _decode,
4826        )
4827    }
4828
4829    type GetRingBufferFormatsResponseFut = fidl::client::QueryResponseFut<
4830        DaiGetRingBufferFormatsResult,
4831        fidl::encoding::DefaultFuchsiaResourceDialect,
4832    >;
4833    fn r#get_ring_buffer_formats(&self) -> Self::GetRingBufferFormatsResponseFut {
4834        fn _decode(
4835            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4836        ) -> Result<DaiGetRingBufferFormatsResult, fidl::Error> {
4837            let _response = fidl::client::decode_transaction_body::<
4838                fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>,
4839                fidl::encoding::DefaultFuchsiaResourceDialect,
4840                0x760371081d8c92e4,
4841            >(_buf?)?;
4842            Ok(_response.map(|x| x.ring_buffer_formats))
4843        }
4844        self.client
4845            .send_query_and_decode::<fidl::encoding::EmptyPayload, DaiGetRingBufferFormatsResult>(
4846                (),
4847                0x760371081d8c92e4,
4848                fidl::encoding::DynamicFlags::empty(),
4849                _decode,
4850            )
4851    }
4852
4853    fn r#create_ring_buffer(
4854        &self,
4855        mut dai_format: &DaiFormat,
4856        mut ring_buffer_format: &Format,
4857        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
4858    ) -> Result<(), fidl::Error> {
4859        self.client.send::<DaiCreateRingBufferRequest>(
4860            (dai_format, ring_buffer_format, ring_buffer),
4861            0x5af9760589a75257,
4862            fidl::encoding::DynamicFlags::empty(),
4863        )
4864    }
4865}
4866
4867pub struct DaiEventStream {
4868    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4869}
4870
4871impl std::marker::Unpin for DaiEventStream {}
4872
4873impl futures::stream::FusedStream for DaiEventStream {
4874    fn is_terminated(&self) -> bool {
4875        self.event_receiver.is_terminated()
4876    }
4877}
4878
4879impl futures::Stream for DaiEventStream {
4880    type Item = Result<DaiEvent, fidl::Error>;
4881
4882    fn poll_next(
4883        mut self: std::pin::Pin<&mut Self>,
4884        cx: &mut std::task::Context<'_>,
4885    ) -> std::task::Poll<Option<Self::Item>> {
4886        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4887            &mut self.event_receiver,
4888            cx
4889        )?) {
4890            Some(buf) => std::task::Poll::Ready(Some(DaiEvent::decode(buf))),
4891            None => std::task::Poll::Ready(None),
4892        }
4893    }
4894}
4895
4896#[derive(Debug)]
4897pub enum DaiEvent {}
4898
4899impl DaiEvent {
4900    /// Decodes a message buffer as a [`DaiEvent`].
4901    fn decode(
4902        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4903    ) -> Result<DaiEvent, fidl::Error> {
4904        let (bytes, _handles) = buf.split_mut();
4905        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4906        debug_assert_eq!(tx_header.tx_id, 0);
4907        match tx_header.ordinal {
4908            _ => Err(fidl::Error::UnknownOrdinal {
4909                ordinal: tx_header.ordinal,
4910                protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4911            }),
4912        }
4913    }
4914}
4915
4916/// A Stream of incoming requests for fuchsia.hardware.audio/Dai.
4917pub struct DaiRequestStream {
4918    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4919    is_terminated: bool,
4920}
4921
4922impl std::marker::Unpin for DaiRequestStream {}
4923
4924impl futures::stream::FusedStream for DaiRequestStream {
4925    fn is_terminated(&self) -> bool {
4926        self.is_terminated
4927    }
4928}
4929
4930impl fidl::endpoints::RequestStream for DaiRequestStream {
4931    type Protocol = DaiMarker;
4932    type ControlHandle = DaiControlHandle;
4933
4934    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4935        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4936    }
4937
4938    fn control_handle(&self) -> Self::ControlHandle {
4939        DaiControlHandle { inner: self.inner.clone() }
4940    }
4941
4942    fn into_inner(
4943        self,
4944    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4945    {
4946        (self.inner, self.is_terminated)
4947    }
4948
4949    fn from_inner(
4950        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4951        is_terminated: bool,
4952    ) -> Self {
4953        Self { inner, is_terminated }
4954    }
4955}
4956
4957impl futures::Stream for DaiRequestStream {
4958    type Item = Result<DaiRequest, fidl::Error>;
4959
4960    fn poll_next(
4961        mut self: std::pin::Pin<&mut Self>,
4962        cx: &mut std::task::Context<'_>,
4963    ) -> std::task::Poll<Option<Self::Item>> {
4964        let this = &mut *self;
4965        if this.inner.check_shutdown(cx) {
4966            this.is_terminated = true;
4967            return std::task::Poll::Ready(None);
4968        }
4969        if this.is_terminated {
4970            panic!("polled DaiRequestStream after completion");
4971        }
4972        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4973            |bytes, handles| {
4974                match this.inner.channel().read_etc(cx, bytes, handles) {
4975                    std::task::Poll::Ready(Ok(())) => {}
4976                    std::task::Poll::Pending => return std::task::Poll::Pending,
4977                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4978                        this.is_terminated = true;
4979                        return std::task::Poll::Ready(None);
4980                    }
4981                    std::task::Poll::Ready(Err(e)) => {
4982                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4983                            e.into(),
4984                        ))))
4985                    }
4986                }
4987
4988                // A message has been received from the channel
4989                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4990
4991                std::task::Poll::Ready(Some(match header.ordinal {
4992                    0x4e146d6bca733a84 => {
4993                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4994                        let mut req = fidl::new_empty!(
4995                            fidl::encoding::EmptyPayload,
4996                            fidl::encoding::DefaultFuchsiaResourceDialect
4997                        );
4998                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4999                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5000                        Ok(DaiRequest::GetHealthState {
5001                            responder: DaiGetHealthStateResponder {
5002                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5003                                tx_id: header.tx_id,
5004                            },
5005                        })
5006                    }
5007                    0xa81907ce6066295 => {
5008                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5009                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5010                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5011                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5012                        Ok(DaiRequest::SignalProcessingConnect {
5013                            protocol: req.protocol,
5014
5015                            control_handle,
5016                        })
5017                    }
5018                    0x69e5fa9fa2f78c14 => {
5019                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5020                        let mut req = fidl::new_empty!(
5021                            fidl::encoding::EmptyPayload,
5022                            fidl::encoding::DefaultFuchsiaResourceDialect
5023                        );
5024                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5025                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5026                        Ok(DaiRequest::Reset {
5027                            responder: DaiResetResponder {
5028                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5029                                tx_id: header.tx_id,
5030                            },
5031                        })
5032                    }
5033                    0x2c25a1a66149510b => {
5034                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5035                        let mut req = fidl::new_empty!(
5036                            fidl::encoding::EmptyPayload,
5037                            fidl::encoding::DefaultFuchsiaResourceDialect
5038                        );
5039                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5040                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5041                        Ok(DaiRequest::GetProperties {
5042                            responder: DaiGetPropertiesResponder {
5043                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5044                                tx_id: header.tx_id,
5045                            },
5046                        })
5047                    }
5048                    0x1eb37b0cddf79d69 => {
5049                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5050                        let mut req = fidl::new_empty!(
5051                            fidl::encoding::EmptyPayload,
5052                            fidl::encoding::DefaultFuchsiaResourceDialect
5053                        );
5054                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5055                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5056                        Ok(DaiRequest::GetDaiFormats {
5057                            responder: DaiGetDaiFormatsResponder {
5058                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5059                                tx_id: header.tx_id,
5060                            },
5061                        })
5062                    }
5063                    0x760371081d8c92e4 => {
5064                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5065                        let mut req = fidl::new_empty!(
5066                            fidl::encoding::EmptyPayload,
5067                            fidl::encoding::DefaultFuchsiaResourceDialect
5068                        );
5069                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5070                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5071                        Ok(DaiRequest::GetRingBufferFormats {
5072                            responder: DaiGetRingBufferFormatsResponder {
5073                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5074                                tx_id: header.tx_id,
5075                            },
5076                        })
5077                    }
5078                    0x5af9760589a75257 => {
5079                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5080                        let mut req = fidl::new_empty!(
5081                            DaiCreateRingBufferRequest,
5082                            fidl::encoding::DefaultFuchsiaResourceDialect
5083                        );
5084                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
5085                        let control_handle = DaiControlHandle { inner: this.inner.clone() };
5086                        Ok(DaiRequest::CreateRingBuffer {
5087                            dai_format: req.dai_format,
5088                            ring_buffer_format: req.ring_buffer_format,
5089                            ring_buffer: req.ring_buffer,
5090
5091                            control_handle,
5092                        })
5093                    }
5094                    _ => Err(fidl::Error::UnknownOrdinal {
5095                        ordinal: header.ordinal,
5096                        protocol_name: <DaiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5097                    }),
5098                }))
5099            },
5100        )
5101    }
5102}
5103
5104/// For an overview see
5105/// [Digital Audio Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_dai).
5106/// # Deprecation
5107///
5108/// Not supported anymore, instead use an
5109/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5110/// with one DAI and one Ring Buffer, see
5111/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5112#[derive(Debug)]
5113pub enum DaiRequest {
5114    /// Retrieves top level health state.
5115    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
5116    GetHealthState { responder: DaiGetHealthStateResponder },
5117    /// Connect to a `SignalProcessing` protocol.
5118    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
5119    /// the maximum number of connections have already been created, for instance one, then the
5120    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
5121    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
5122    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
5123    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
5124    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
5125    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
5126    /// is intended to be composed, and hence the more verbose name allows differentiation and
5127    /// improved clarity.
5128    SignalProcessingConnect {
5129        protocol: fidl::endpoints::ServerEnd<
5130            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5131        >,
5132        control_handle: DaiControlHandle,
5133    },
5134    /// Resets the DAI HW. The `ring_buffer` channel obtained via `CreateRingBuffer` may be closed
5135    /// by the driver, in this case the client needs to obtain a new `ring_buffer`.
5136    /// `Reset` returns when the reset is completed. If the driver can't successfully reset the HW,
5137    /// it will close the DAI protocol channel, in this case the client may obtain a new DAI
5138    /// protocol channel and retry.
5139    Reset { responder: DaiResetResponder },
5140    /// Retrieves top level static properties.
5141    GetProperties { responder: DaiGetPropertiesResponder },
5142    /// Retrieves the DAI formats supported by the DAI, if not available at the time the DAI
5143    /// may reply with an error status and the client may retry at a later time.
5144    /// Retrieving multiple `DaiSupportedFormats` allows for cases where exclusive combinations of
5145    /// the parameters in SupportedFormats may be supported.
5146    GetDaiFormats { responder: DaiGetDaiFormatsResponder },
5147    /// Retrieves the ring buffer formats supported by the DAI, if not available at the time the DAI
5148    /// may reply with an error status and the client may retry at a later time.
5149    /// Retrieving multiple `SupportedFormats` allows for cases where exclusive combinations of
5150    /// the parameters in `SupportedFormats` may be supported.
5151    GetRingBufferFormats { responder: DaiGetRingBufferFormatsResponder },
5152    /// `CreateRingBuffer` is sent by clients to select both a DAI format and a ring buffer format
5153    /// based on information that the driver provides in `GetDaiFormats` and `GetRingBufferFormats`,
5154    /// what is supported by the client, and any other requirement. The `ring_buffer` channel is
5155    /// used to control the audio buffer, if a previous ring buffer channel had been established and
5156    /// was still active, the driver must close that (ring buffer) channel and make every attempt to
5157    /// gracefully quiesce any on-going streaming operations in the process.
5158    CreateRingBuffer {
5159        dai_format: DaiFormat,
5160        ring_buffer_format: Format,
5161        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
5162        control_handle: DaiControlHandle,
5163    },
5164}
5165
5166impl DaiRequest {
5167    #[allow(irrefutable_let_patterns)]
5168    pub fn into_get_health_state(self) -> Option<(DaiGetHealthStateResponder)> {
5169        if let DaiRequest::GetHealthState { responder } = self {
5170            Some((responder))
5171        } else {
5172            None
5173        }
5174    }
5175
5176    #[allow(irrefutable_let_patterns)]
5177    pub fn into_signal_processing_connect(
5178        self,
5179    ) -> Option<(
5180        fidl::endpoints::ServerEnd<
5181            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
5182        >,
5183        DaiControlHandle,
5184    )> {
5185        if let DaiRequest::SignalProcessingConnect { protocol, control_handle } = self {
5186            Some((protocol, control_handle))
5187        } else {
5188            None
5189        }
5190    }
5191
5192    #[allow(irrefutable_let_patterns)]
5193    pub fn into_reset(self) -> Option<(DaiResetResponder)> {
5194        if let DaiRequest::Reset { responder } = self {
5195            Some((responder))
5196        } else {
5197            None
5198        }
5199    }
5200
5201    #[allow(irrefutable_let_patterns)]
5202    pub fn into_get_properties(self) -> Option<(DaiGetPropertiesResponder)> {
5203        if let DaiRequest::GetProperties { responder } = self {
5204            Some((responder))
5205        } else {
5206            None
5207        }
5208    }
5209
5210    #[allow(irrefutable_let_patterns)]
5211    pub fn into_get_dai_formats(self) -> Option<(DaiGetDaiFormatsResponder)> {
5212        if let DaiRequest::GetDaiFormats { responder } = self {
5213            Some((responder))
5214        } else {
5215            None
5216        }
5217    }
5218
5219    #[allow(irrefutable_let_patterns)]
5220    pub fn into_get_ring_buffer_formats(self) -> Option<(DaiGetRingBufferFormatsResponder)> {
5221        if let DaiRequest::GetRingBufferFormats { responder } = self {
5222            Some((responder))
5223        } else {
5224            None
5225        }
5226    }
5227
5228    #[allow(irrefutable_let_patterns)]
5229    pub fn into_create_ring_buffer(
5230        self,
5231    ) -> Option<(DaiFormat, Format, fidl::endpoints::ServerEnd<RingBufferMarker>, DaiControlHandle)>
5232    {
5233        if let DaiRequest::CreateRingBuffer {
5234            dai_format,
5235            ring_buffer_format,
5236            ring_buffer,
5237            control_handle,
5238        } = self
5239        {
5240            Some((dai_format, ring_buffer_format, ring_buffer, control_handle))
5241        } else {
5242            None
5243        }
5244    }
5245
5246    /// Name of the method defined in FIDL
5247    pub fn method_name(&self) -> &'static str {
5248        match *self {
5249            DaiRequest::GetHealthState { .. } => "get_health_state",
5250            DaiRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
5251            DaiRequest::Reset { .. } => "reset",
5252            DaiRequest::GetProperties { .. } => "get_properties",
5253            DaiRequest::GetDaiFormats { .. } => "get_dai_formats",
5254            DaiRequest::GetRingBufferFormats { .. } => "get_ring_buffer_formats",
5255            DaiRequest::CreateRingBuffer { .. } => "create_ring_buffer",
5256        }
5257    }
5258}
5259
5260#[derive(Debug, Clone)]
5261pub struct DaiControlHandle {
5262    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5263}
5264
5265impl fidl::endpoints::ControlHandle for DaiControlHandle {
5266    fn shutdown(&self) {
5267        self.inner.shutdown()
5268    }
5269    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5270        self.inner.shutdown_with_epitaph(status)
5271    }
5272
5273    fn is_closed(&self) -> bool {
5274        self.inner.channel().is_closed()
5275    }
5276    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5277        self.inner.channel().on_closed()
5278    }
5279
5280    #[cfg(target_os = "fuchsia")]
5281    fn signal_peer(
5282        &self,
5283        clear_mask: zx::Signals,
5284        set_mask: zx::Signals,
5285    ) -> Result<(), zx_status::Status> {
5286        use fidl::Peered;
5287        self.inner.channel().signal_peer(clear_mask, set_mask)
5288    }
5289}
5290
5291impl DaiControlHandle {}
5292
5293#[must_use = "FIDL methods require a response to be sent"]
5294#[derive(Debug)]
5295pub struct DaiGetHealthStateResponder {
5296    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5297    tx_id: u32,
5298}
5299
5300/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5301/// if the responder is dropped without sending a response, so that the client
5302/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5303impl std::ops::Drop for DaiGetHealthStateResponder {
5304    fn drop(&mut self) {
5305        self.control_handle.shutdown();
5306        // Safety: drops once, never accessed again
5307        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5308    }
5309}
5310
5311impl fidl::endpoints::Responder for DaiGetHealthStateResponder {
5312    type ControlHandle = DaiControlHandle;
5313
5314    fn control_handle(&self) -> &DaiControlHandle {
5315        &self.control_handle
5316    }
5317
5318    fn drop_without_shutdown(mut self) {
5319        // Safety: drops once, never accessed again due to mem::forget
5320        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5321        // Prevent Drop from running (which would shut down the channel)
5322        std::mem::forget(self);
5323    }
5324}
5325
5326impl DaiGetHealthStateResponder {
5327    /// Sends a response to the FIDL transaction.
5328    ///
5329    /// Sets the channel to shutdown if an error occurs.
5330    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5331        let _result = self.send_raw(state);
5332        if _result.is_err() {
5333            self.control_handle.shutdown();
5334        }
5335        self.drop_without_shutdown();
5336        _result
5337    }
5338
5339    /// Similar to "send" but does not shutdown the channel if an error occurs.
5340    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
5341        let _result = self.send_raw(state);
5342        self.drop_without_shutdown();
5343        _result
5344    }
5345
5346    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
5347        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
5348            (state,),
5349            self.tx_id,
5350            0x4e146d6bca733a84,
5351            fidl::encoding::DynamicFlags::empty(),
5352        )
5353    }
5354}
5355
5356#[must_use = "FIDL methods require a response to be sent"]
5357#[derive(Debug)]
5358pub struct DaiResetResponder {
5359    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5360    tx_id: u32,
5361}
5362
5363/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5364/// if the responder is dropped without sending a response, so that the client
5365/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5366impl std::ops::Drop for DaiResetResponder {
5367    fn drop(&mut self) {
5368        self.control_handle.shutdown();
5369        // Safety: drops once, never accessed again
5370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5371    }
5372}
5373
5374impl fidl::endpoints::Responder for DaiResetResponder {
5375    type ControlHandle = DaiControlHandle;
5376
5377    fn control_handle(&self) -> &DaiControlHandle {
5378        &self.control_handle
5379    }
5380
5381    fn drop_without_shutdown(mut self) {
5382        // Safety: drops once, never accessed again due to mem::forget
5383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5384        // Prevent Drop from running (which would shut down the channel)
5385        std::mem::forget(self);
5386    }
5387}
5388
5389impl DaiResetResponder {
5390    /// Sends a response to the FIDL transaction.
5391    ///
5392    /// Sets the channel to shutdown if an error occurs.
5393    pub fn send(self) -> Result<(), fidl::Error> {
5394        let _result = self.send_raw();
5395        if _result.is_err() {
5396            self.control_handle.shutdown();
5397        }
5398        self.drop_without_shutdown();
5399        _result
5400    }
5401
5402    /// Similar to "send" but does not shutdown the channel if an error occurs.
5403    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5404        let _result = self.send_raw();
5405        self.drop_without_shutdown();
5406        _result
5407    }
5408
5409    fn send_raw(&self) -> Result<(), fidl::Error> {
5410        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5411            (),
5412            self.tx_id,
5413            0x69e5fa9fa2f78c14,
5414            fidl::encoding::DynamicFlags::empty(),
5415        )
5416    }
5417}
5418
5419#[must_use = "FIDL methods require a response to be sent"]
5420#[derive(Debug)]
5421pub struct DaiGetPropertiesResponder {
5422    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5423    tx_id: u32,
5424}
5425
5426/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5427/// if the responder is dropped without sending a response, so that the client
5428/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5429impl std::ops::Drop for DaiGetPropertiesResponder {
5430    fn drop(&mut self) {
5431        self.control_handle.shutdown();
5432        // Safety: drops once, never accessed again
5433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5434    }
5435}
5436
5437impl fidl::endpoints::Responder for DaiGetPropertiesResponder {
5438    type ControlHandle = DaiControlHandle;
5439
5440    fn control_handle(&self) -> &DaiControlHandle {
5441        &self.control_handle
5442    }
5443
5444    fn drop_without_shutdown(mut self) {
5445        // Safety: drops once, never accessed again due to mem::forget
5446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5447        // Prevent Drop from running (which would shut down the channel)
5448        std::mem::forget(self);
5449    }
5450}
5451
5452impl DaiGetPropertiesResponder {
5453    /// Sends a response to the FIDL transaction.
5454    ///
5455    /// Sets the channel to shutdown if an error occurs.
5456    pub fn send(self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5457        let _result = self.send_raw(properties);
5458        if _result.is_err() {
5459            self.control_handle.shutdown();
5460        }
5461        self.drop_without_shutdown();
5462        _result
5463    }
5464
5465    /// Similar to "send" but does not shutdown the channel if an error occurs.
5466    pub fn send_no_shutdown_on_err(
5467        self,
5468        mut properties: &DaiProperties,
5469    ) -> Result<(), fidl::Error> {
5470        let _result = self.send_raw(properties);
5471        self.drop_without_shutdown();
5472        _result
5473    }
5474
5475    fn send_raw(&self, mut properties: &DaiProperties) -> Result<(), fidl::Error> {
5476        self.control_handle.inner.send::<DaiGetPropertiesResponse>(
5477            (properties,),
5478            self.tx_id,
5479            0x2c25a1a66149510b,
5480            fidl::encoding::DynamicFlags::empty(),
5481        )
5482    }
5483}
5484
5485#[must_use = "FIDL methods require a response to be sent"]
5486#[derive(Debug)]
5487pub struct DaiGetDaiFormatsResponder {
5488    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5489    tx_id: u32,
5490}
5491
5492/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5493/// if the responder is dropped without sending a response, so that the client
5494/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5495impl std::ops::Drop for DaiGetDaiFormatsResponder {
5496    fn drop(&mut self) {
5497        self.control_handle.shutdown();
5498        // Safety: drops once, never accessed again
5499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5500    }
5501}
5502
5503impl fidl::endpoints::Responder for DaiGetDaiFormatsResponder {
5504    type ControlHandle = DaiControlHandle;
5505
5506    fn control_handle(&self) -> &DaiControlHandle {
5507        &self.control_handle
5508    }
5509
5510    fn drop_without_shutdown(mut self) {
5511        // Safety: drops once, never accessed again due to mem::forget
5512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5513        // Prevent Drop from running (which would shut down the channel)
5514        std::mem::forget(self);
5515    }
5516}
5517
5518impl DaiGetDaiFormatsResponder {
5519    /// Sends a response to the FIDL transaction.
5520    ///
5521    /// Sets the channel to shutdown if an error occurs.
5522    pub fn send(self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5523        let _result = self.send_raw(result);
5524        if _result.is_err() {
5525            self.control_handle.shutdown();
5526        }
5527        self.drop_without_shutdown();
5528        _result
5529    }
5530
5531    /// Similar to "send" but does not shutdown the channel if an error occurs.
5532    pub fn send_no_shutdown_on_err(
5533        self,
5534        mut result: Result<&[DaiSupportedFormats], i32>,
5535    ) -> Result<(), fidl::Error> {
5536        let _result = self.send_raw(result);
5537        self.drop_without_shutdown();
5538        _result
5539    }
5540
5541    fn send_raw(&self, mut result: Result<&[DaiSupportedFormats], i32>) -> Result<(), fidl::Error> {
5542        self.control_handle.inner.send::<fidl::encoding::ResultType<DaiGetDaiFormatsResponse, i32>>(
5543            result.map(|dai_formats| (dai_formats,)),
5544            self.tx_id,
5545            0x1eb37b0cddf79d69,
5546            fidl::encoding::DynamicFlags::empty(),
5547        )
5548    }
5549}
5550
5551#[must_use = "FIDL methods require a response to be sent"]
5552#[derive(Debug)]
5553pub struct DaiGetRingBufferFormatsResponder {
5554    control_handle: std::mem::ManuallyDrop<DaiControlHandle>,
5555    tx_id: u32,
5556}
5557
5558/// Set the the channel to be shutdown (see [`DaiControlHandle::shutdown`])
5559/// if the responder is dropped without sending a response, so that the client
5560/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5561impl std::ops::Drop for DaiGetRingBufferFormatsResponder {
5562    fn drop(&mut self) {
5563        self.control_handle.shutdown();
5564        // Safety: drops once, never accessed again
5565        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5566    }
5567}
5568
5569impl fidl::endpoints::Responder for DaiGetRingBufferFormatsResponder {
5570    type ControlHandle = DaiControlHandle;
5571
5572    fn control_handle(&self) -> &DaiControlHandle {
5573        &self.control_handle
5574    }
5575
5576    fn drop_without_shutdown(mut self) {
5577        // Safety: drops once, never accessed again due to mem::forget
5578        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5579        // Prevent Drop from running (which would shut down the channel)
5580        std::mem::forget(self);
5581    }
5582}
5583
5584impl DaiGetRingBufferFormatsResponder {
5585    /// Sends a response to the FIDL transaction.
5586    ///
5587    /// Sets the channel to shutdown if an error occurs.
5588    pub fn send(self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5589        let _result = self.send_raw(result);
5590        if _result.is_err() {
5591            self.control_handle.shutdown();
5592        }
5593        self.drop_without_shutdown();
5594        _result
5595    }
5596
5597    /// Similar to "send" but does not shutdown the channel if an error occurs.
5598    pub fn send_no_shutdown_on_err(
5599        self,
5600        mut result: Result<&[SupportedFormats], i32>,
5601    ) -> Result<(), fidl::Error> {
5602        let _result = self.send_raw(result);
5603        self.drop_without_shutdown();
5604        _result
5605    }
5606
5607    fn send_raw(&self, mut result: Result<&[SupportedFormats], i32>) -> Result<(), fidl::Error> {
5608        self.control_handle
5609            .inner
5610            .send::<fidl::encoding::ResultType<DaiGetRingBufferFormatsResponse, i32>>(
5611                result.map(|ring_buffer_formats| (ring_buffer_formats,)),
5612                self.tx_id,
5613                0x760371081d8c92e4,
5614                fidl::encoding::DynamicFlags::empty(),
5615            )
5616    }
5617}
5618
5619#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5620pub struct DaiConnectorMarker;
5621
5622impl fidl::endpoints::ProtocolMarker for DaiConnectorMarker {
5623    type Proxy = DaiConnectorProxy;
5624    type RequestStream = DaiConnectorRequestStream;
5625    #[cfg(target_os = "fuchsia")]
5626    type SynchronousProxy = DaiConnectorSynchronousProxy;
5627
5628    const DEBUG_NAME: &'static str = "(anonymous) DaiConnector";
5629}
5630
5631pub trait DaiConnectorProxyInterface: Send + Sync {
5632    fn r#connect(
5633        &self,
5634        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5635    ) -> Result<(), fidl::Error>;
5636}
5637#[derive(Debug)]
5638#[cfg(target_os = "fuchsia")]
5639pub struct DaiConnectorSynchronousProxy {
5640    client: fidl::client::sync::Client,
5641}
5642
5643#[cfg(target_os = "fuchsia")]
5644impl fidl::endpoints::SynchronousProxy for DaiConnectorSynchronousProxy {
5645    type Proxy = DaiConnectorProxy;
5646    type Protocol = DaiConnectorMarker;
5647
5648    fn from_channel(inner: fidl::Channel) -> Self {
5649        Self::new(inner)
5650    }
5651
5652    fn into_channel(self) -> fidl::Channel {
5653        self.client.into_channel()
5654    }
5655
5656    fn as_channel(&self) -> &fidl::Channel {
5657        self.client.as_channel()
5658    }
5659}
5660
5661#[cfg(target_os = "fuchsia")]
5662impl DaiConnectorSynchronousProxy {
5663    pub fn new(channel: fidl::Channel) -> Self {
5664        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5665        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5666    }
5667
5668    pub fn into_channel(self) -> fidl::Channel {
5669        self.client.into_channel()
5670    }
5671
5672    /// Waits until an event arrives and returns it. It is safe for other
5673    /// threads to make concurrent requests while waiting for an event.
5674    pub fn wait_for_event(
5675        &self,
5676        deadline: zx::MonotonicInstant,
5677    ) -> Result<DaiConnectorEvent, fidl::Error> {
5678        DaiConnectorEvent::decode(self.client.wait_for_event(deadline)?)
5679    }
5680
5681    /// This connects to a DAI protocol server.
5682    pub fn r#connect(
5683        &self,
5684        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5685    ) -> Result<(), fidl::Error> {
5686        self.client.send::<DaiConnectorConnectRequest>(
5687            (dai_protocol,),
5688            0x4e4db05c2eca1450,
5689            fidl::encoding::DynamicFlags::empty(),
5690        )
5691    }
5692}
5693
5694#[cfg(target_os = "fuchsia")]
5695impl From<DaiConnectorSynchronousProxy> for zx::Handle {
5696    fn from(value: DaiConnectorSynchronousProxy) -> Self {
5697        value.into_channel().into()
5698    }
5699}
5700
5701#[cfg(target_os = "fuchsia")]
5702impl From<fidl::Channel> for DaiConnectorSynchronousProxy {
5703    fn from(value: fidl::Channel) -> Self {
5704        Self::new(value)
5705    }
5706}
5707
5708#[cfg(target_os = "fuchsia")]
5709impl fidl::endpoints::FromClient for DaiConnectorSynchronousProxy {
5710    type Protocol = DaiConnectorMarker;
5711
5712    fn from_client(value: fidl::endpoints::ClientEnd<DaiConnectorMarker>) -> Self {
5713        Self::new(value.into_channel())
5714    }
5715}
5716
5717#[derive(Debug, Clone)]
5718pub struct DaiConnectorProxy {
5719    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5720}
5721
5722impl fidl::endpoints::Proxy for DaiConnectorProxy {
5723    type Protocol = DaiConnectorMarker;
5724
5725    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5726        Self::new(inner)
5727    }
5728
5729    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5730        self.client.into_channel().map_err(|client| Self { client })
5731    }
5732
5733    fn as_channel(&self) -> &::fidl::AsyncChannel {
5734        self.client.as_channel()
5735    }
5736}
5737
5738impl DaiConnectorProxy {
5739    /// Create a new Proxy for fuchsia.hardware.audio/DaiConnector.
5740    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5741        let protocol_name = <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5742        Self { client: fidl::client::Client::new(channel, protocol_name) }
5743    }
5744
5745    /// Get a Stream of events from the remote end of the protocol.
5746    ///
5747    /// # Panics
5748    ///
5749    /// Panics if the event stream was already taken.
5750    pub fn take_event_stream(&self) -> DaiConnectorEventStream {
5751        DaiConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5752    }
5753
5754    /// This connects to a DAI protocol server.
5755    pub fn r#connect(
5756        &self,
5757        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5758    ) -> Result<(), fidl::Error> {
5759        DaiConnectorProxyInterface::r#connect(self, dai_protocol)
5760    }
5761}
5762
5763impl DaiConnectorProxyInterface for DaiConnectorProxy {
5764    fn r#connect(
5765        &self,
5766        mut dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5767    ) -> Result<(), fidl::Error> {
5768        self.client.send::<DaiConnectorConnectRequest>(
5769            (dai_protocol,),
5770            0x4e4db05c2eca1450,
5771            fidl::encoding::DynamicFlags::empty(),
5772        )
5773    }
5774}
5775
5776pub struct DaiConnectorEventStream {
5777    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5778}
5779
5780impl std::marker::Unpin for DaiConnectorEventStream {}
5781
5782impl futures::stream::FusedStream for DaiConnectorEventStream {
5783    fn is_terminated(&self) -> bool {
5784        self.event_receiver.is_terminated()
5785    }
5786}
5787
5788impl futures::Stream for DaiConnectorEventStream {
5789    type Item = Result<DaiConnectorEvent, fidl::Error>;
5790
5791    fn poll_next(
5792        mut self: std::pin::Pin<&mut Self>,
5793        cx: &mut std::task::Context<'_>,
5794    ) -> std::task::Poll<Option<Self::Item>> {
5795        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5796            &mut self.event_receiver,
5797            cx
5798        )?) {
5799            Some(buf) => std::task::Poll::Ready(Some(DaiConnectorEvent::decode(buf))),
5800            None => std::task::Poll::Ready(None),
5801        }
5802    }
5803}
5804
5805#[derive(Debug)]
5806pub enum DaiConnectorEvent {}
5807
5808impl DaiConnectorEvent {
5809    /// Decodes a message buffer as a [`DaiConnectorEvent`].
5810    fn decode(
5811        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5812    ) -> Result<DaiConnectorEvent, fidl::Error> {
5813        let (bytes, _handles) = buf.split_mut();
5814        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5815        debug_assert_eq!(tx_header.tx_id, 0);
5816        match tx_header.ordinal {
5817            _ => Err(fidl::Error::UnknownOrdinal {
5818                ordinal: tx_header.ordinal,
5819                protocol_name: <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5820            }),
5821        }
5822    }
5823}
5824
5825/// A Stream of incoming requests for fuchsia.hardware.audio/DaiConnector.
5826pub struct DaiConnectorRequestStream {
5827    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5828    is_terminated: bool,
5829}
5830
5831impl std::marker::Unpin for DaiConnectorRequestStream {}
5832
5833impl futures::stream::FusedStream for DaiConnectorRequestStream {
5834    fn is_terminated(&self) -> bool {
5835        self.is_terminated
5836    }
5837}
5838
5839impl fidl::endpoints::RequestStream for DaiConnectorRequestStream {
5840    type Protocol = DaiConnectorMarker;
5841    type ControlHandle = DaiConnectorControlHandle;
5842
5843    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5844        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5845    }
5846
5847    fn control_handle(&self) -> Self::ControlHandle {
5848        DaiConnectorControlHandle { inner: self.inner.clone() }
5849    }
5850
5851    fn into_inner(
5852        self,
5853    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5854    {
5855        (self.inner, self.is_terminated)
5856    }
5857
5858    fn from_inner(
5859        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5860        is_terminated: bool,
5861    ) -> Self {
5862        Self { inner, is_terminated }
5863    }
5864}
5865
5866impl futures::Stream for DaiConnectorRequestStream {
5867    type Item = Result<DaiConnectorRequest, fidl::Error>;
5868
5869    fn poll_next(
5870        mut self: std::pin::Pin<&mut Self>,
5871        cx: &mut std::task::Context<'_>,
5872    ) -> std::task::Poll<Option<Self::Item>> {
5873        let this = &mut *self;
5874        if this.inner.check_shutdown(cx) {
5875            this.is_terminated = true;
5876            return std::task::Poll::Ready(None);
5877        }
5878        if this.is_terminated {
5879            panic!("polled DaiConnectorRequestStream after completion");
5880        }
5881        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5882            |bytes, handles| {
5883                match this.inner.channel().read_etc(cx, bytes, handles) {
5884                    std::task::Poll::Ready(Ok(())) => {}
5885                    std::task::Poll::Pending => return std::task::Poll::Pending,
5886                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5887                        this.is_terminated = true;
5888                        return std::task::Poll::Ready(None);
5889                    }
5890                    std::task::Poll::Ready(Err(e)) => {
5891                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5892                            e.into(),
5893                        ))))
5894                    }
5895                }
5896
5897                // A message has been received from the channel
5898                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5899
5900                std::task::Poll::Ready(Some(match header.ordinal {
5901                    0x4e4db05c2eca1450 => {
5902                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5903                        let mut req = fidl::new_empty!(
5904                            DaiConnectorConnectRequest,
5905                            fidl::encoding::DefaultFuchsiaResourceDialect
5906                        );
5907                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DaiConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5908                        let control_handle =
5909                            DaiConnectorControlHandle { inner: this.inner.clone() };
5910                        Ok(DaiConnectorRequest::Connect {
5911                            dai_protocol: req.dai_protocol,
5912
5913                            control_handle,
5914                        })
5915                    }
5916                    _ => Err(fidl::Error::UnknownOrdinal {
5917                        ordinal: header.ordinal,
5918                        protocol_name:
5919                            <DaiConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5920                    }),
5921                }))
5922            },
5923        )
5924    }
5925}
5926
5927/// For an overview of the DAI protocols see
5928/// [Digital Audio Interface](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_dai.md)
5929/// # Deprecation
5930///
5931/// Not supported anymore, instead use an
5932/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
5933/// with one DAI and one Ring Buffer, see
5934/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
5935#[derive(Debug)]
5936pub enum DaiConnectorRequest {
5937    /// This connects to a DAI protocol server.
5938    Connect {
5939        dai_protocol: fidl::endpoints::ServerEnd<DaiMarker>,
5940        control_handle: DaiConnectorControlHandle,
5941    },
5942}
5943
5944impl DaiConnectorRequest {
5945    #[allow(irrefutable_let_patterns)]
5946    pub fn into_connect(
5947        self,
5948    ) -> Option<(fidl::endpoints::ServerEnd<DaiMarker>, DaiConnectorControlHandle)> {
5949        if let DaiConnectorRequest::Connect { dai_protocol, control_handle } = self {
5950            Some((dai_protocol, control_handle))
5951        } else {
5952            None
5953        }
5954    }
5955
5956    /// Name of the method defined in FIDL
5957    pub fn method_name(&self) -> &'static str {
5958        match *self {
5959            DaiConnectorRequest::Connect { .. } => "connect",
5960        }
5961    }
5962}
5963
5964#[derive(Debug, Clone)]
5965pub struct DaiConnectorControlHandle {
5966    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5967}
5968
5969impl fidl::endpoints::ControlHandle for DaiConnectorControlHandle {
5970    fn shutdown(&self) {
5971        self.inner.shutdown()
5972    }
5973    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5974        self.inner.shutdown_with_epitaph(status)
5975    }
5976
5977    fn is_closed(&self) -> bool {
5978        self.inner.channel().is_closed()
5979    }
5980    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5981        self.inner.channel().on_closed()
5982    }
5983
5984    #[cfg(target_os = "fuchsia")]
5985    fn signal_peer(
5986        &self,
5987        clear_mask: zx::Signals,
5988        set_mask: zx::Signals,
5989    ) -> Result<(), zx_status::Status> {
5990        use fidl::Peered;
5991        self.inner.channel().signal_peer(clear_mask, set_mask)
5992    }
5993}
5994
5995impl DaiConnectorControlHandle {}
5996
5997#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5998pub struct HealthMarker;
5999
6000impl fidl::endpoints::ProtocolMarker for HealthMarker {
6001    type Proxy = HealthProxy;
6002    type RequestStream = HealthRequestStream;
6003    #[cfg(target_os = "fuchsia")]
6004    type SynchronousProxy = HealthSynchronousProxy;
6005
6006    const DEBUG_NAME: &'static str = "(anonymous) Health";
6007}
6008
6009pub trait HealthProxyInterface: Send + Sync {
6010    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
6011        + Send;
6012    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
6013}
6014#[derive(Debug)]
6015#[cfg(target_os = "fuchsia")]
6016pub struct HealthSynchronousProxy {
6017    client: fidl::client::sync::Client,
6018}
6019
6020#[cfg(target_os = "fuchsia")]
6021impl fidl::endpoints::SynchronousProxy for HealthSynchronousProxy {
6022    type Proxy = HealthProxy;
6023    type Protocol = HealthMarker;
6024
6025    fn from_channel(inner: fidl::Channel) -> Self {
6026        Self::new(inner)
6027    }
6028
6029    fn into_channel(self) -> fidl::Channel {
6030        self.client.into_channel()
6031    }
6032
6033    fn as_channel(&self) -> &fidl::Channel {
6034        self.client.as_channel()
6035    }
6036}
6037
6038#[cfg(target_os = "fuchsia")]
6039impl HealthSynchronousProxy {
6040    pub fn new(channel: fidl::Channel) -> Self {
6041        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6042        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6043    }
6044
6045    pub fn into_channel(self) -> fidl::Channel {
6046        self.client.into_channel()
6047    }
6048
6049    /// Waits until an event arrives and returns it. It is safe for other
6050    /// threads to make concurrent requests while waiting for an event.
6051    pub fn wait_for_event(
6052        &self,
6053        deadline: zx::MonotonicInstant,
6054    ) -> Result<HealthEvent, fidl::Error> {
6055        HealthEvent::decode(self.client.wait_for_event(deadline)?)
6056    }
6057
6058    /// Retrieves top level health state.
6059    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6060    pub fn r#get_health_state(
6061        &self,
6062        ___deadline: zx::MonotonicInstant,
6063    ) -> Result<HealthState, fidl::Error> {
6064        let _response =
6065            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
6066                (),
6067                0x4e146d6bca733a84,
6068                fidl::encoding::DynamicFlags::empty(),
6069                ___deadline,
6070            )?;
6071        Ok(_response.state)
6072    }
6073}
6074
6075#[cfg(target_os = "fuchsia")]
6076impl From<HealthSynchronousProxy> for zx::Handle {
6077    fn from(value: HealthSynchronousProxy) -> Self {
6078        value.into_channel().into()
6079    }
6080}
6081
6082#[cfg(target_os = "fuchsia")]
6083impl From<fidl::Channel> for HealthSynchronousProxy {
6084    fn from(value: fidl::Channel) -> Self {
6085        Self::new(value)
6086    }
6087}
6088
6089#[cfg(target_os = "fuchsia")]
6090impl fidl::endpoints::FromClient for HealthSynchronousProxy {
6091    type Protocol = HealthMarker;
6092
6093    fn from_client(value: fidl::endpoints::ClientEnd<HealthMarker>) -> Self {
6094        Self::new(value.into_channel())
6095    }
6096}
6097
6098#[derive(Debug, Clone)]
6099pub struct HealthProxy {
6100    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6101}
6102
6103impl fidl::endpoints::Proxy for HealthProxy {
6104    type Protocol = HealthMarker;
6105
6106    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6107        Self::new(inner)
6108    }
6109
6110    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6111        self.client.into_channel().map_err(|client| Self { client })
6112    }
6113
6114    fn as_channel(&self) -> &::fidl::AsyncChannel {
6115        self.client.as_channel()
6116    }
6117}
6118
6119impl HealthProxy {
6120    /// Create a new Proxy for fuchsia.hardware.audio/Health.
6121    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6122        let protocol_name = <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6123        Self { client: fidl::client::Client::new(channel, protocol_name) }
6124    }
6125
6126    /// Get a Stream of events from the remote end of the protocol.
6127    ///
6128    /// # Panics
6129    ///
6130    /// Panics if the event stream was already taken.
6131    pub fn take_event_stream(&self) -> HealthEventStream {
6132        HealthEventStream { event_receiver: self.client.take_event_receiver() }
6133    }
6134
6135    /// Retrieves top level health state.
6136    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6137    pub fn r#get_health_state(
6138        &self,
6139    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
6140    {
6141        HealthProxyInterface::r#get_health_state(self)
6142    }
6143}
6144
6145impl HealthProxyInterface for HealthProxy {
6146    type GetHealthStateResponseFut =
6147        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
6148    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
6149        fn _decode(
6150            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6151        ) -> Result<HealthState, fidl::Error> {
6152            let _response = fidl::client::decode_transaction_body::<
6153                HealthGetHealthStateResponse,
6154                fidl::encoding::DefaultFuchsiaResourceDialect,
6155                0x4e146d6bca733a84,
6156            >(_buf?)?;
6157            Ok(_response.state)
6158        }
6159        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
6160            (),
6161            0x4e146d6bca733a84,
6162            fidl::encoding::DynamicFlags::empty(),
6163            _decode,
6164        )
6165    }
6166}
6167
6168pub struct HealthEventStream {
6169    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6170}
6171
6172impl std::marker::Unpin for HealthEventStream {}
6173
6174impl futures::stream::FusedStream for HealthEventStream {
6175    fn is_terminated(&self) -> bool {
6176        self.event_receiver.is_terminated()
6177    }
6178}
6179
6180impl futures::Stream for HealthEventStream {
6181    type Item = Result<HealthEvent, fidl::Error>;
6182
6183    fn poll_next(
6184        mut self: std::pin::Pin<&mut Self>,
6185        cx: &mut std::task::Context<'_>,
6186    ) -> std::task::Poll<Option<Self::Item>> {
6187        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6188            &mut self.event_receiver,
6189            cx
6190        )?) {
6191            Some(buf) => std::task::Poll::Ready(Some(HealthEvent::decode(buf))),
6192            None => std::task::Poll::Ready(None),
6193        }
6194    }
6195}
6196
6197#[derive(Debug)]
6198pub enum HealthEvent {}
6199
6200impl HealthEvent {
6201    /// Decodes a message buffer as a [`HealthEvent`].
6202    fn decode(
6203        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6204    ) -> Result<HealthEvent, fidl::Error> {
6205        let (bytes, _handles) = buf.split_mut();
6206        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6207        debug_assert_eq!(tx_header.tx_id, 0);
6208        match tx_header.ordinal {
6209            _ => Err(fidl::Error::UnknownOrdinal {
6210                ordinal: tx_header.ordinal,
6211                protocol_name: <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6212            }),
6213        }
6214    }
6215}
6216
6217/// A Stream of incoming requests for fuchsia.hardware.audio/Health.
6218pub struct HealthRequestStream {
6219    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6220    is_terminated: bool,
6221}
6222
6223impl std::marker::Unpin for HealthRequestStream {}
6224
6225impl futures::stream::FusedStream for HealthRequestStream {
6226    fn is_terminated(&self) -> bool {
6227        self.is_terminated
6228    }
6229}
6230
6231impl fidl::endpoints::RequestStream for HealthRequestStream {
6232    type Protocol = HealthMarker;
6233    type ControlHandle = HealthControlHandle;
6234
6235    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6236        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6237    }
6238
6239    fn control_handle(&self) -> Self::ControlHandle {
6240        HealthControlHandle { inner: self.inner.clone() }
6241    }
6242
6243    fn into_inner(
6244        self,
6245    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6246    {
6247        (self.inner, self.is_terminated)
6248    }
6249
6250    fn from_inner(
6251        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6252        is_terminated: bool,
6253    ) -> Self {
6254        Self { inner, is_terminated }
6255    }
6256}
6257
6258impl futures::Stream for HealthRequestStream {
6259    type Item = Result<HealthRequest, fidl::Error>;
6260
6261    fn poll_next(
6262        mut self: std::pin::Pin<&mut Self>,
6263        cx: &mut std::task::Context<'_>,
6264    ) -> std::task::Poll<Option<Self::Item>> {
6265        let this = &mut *self;
6266        if this.inner.check_shutdown(cx) {
6267            this.is_terminated = true;
6268            return std::task::Poll::Ready(None);
6269        }
6270        if this.is_terminated {
6271            panic!("polled HealthRequestStream after completion");
6272        }
6273        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6274            |bytes, handles| {
6275                match this.inner.channel().read_etc(cx, bytes, handles) {
6276                    std::task::Poll::Ready(Ok(())) => {}
6277                    std::task::Poll::Pending => return std::task::Poll::Pending,
6278                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6279                        this.is_terminated = true;
6280                        return std::task::Poll::Ready(None);
6281                    }
6282                    std::task::Poll::Ready(Err(e)) => {
6283                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6284                            e.into(),
6285                        ))))
6286                    }
6287                }
6288
6289                // A message has been received from the channel
6290                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6291
6292                std::task::Poll::Ready(Some(match header.ordinal {
6293                    0x4e146d6bca733a84 => {
6294                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6295                        let mut req = fidl::new_empty!(
6296                            fidl::encoding::EmptyPayload,
6297                            fidl::encoding::DefaultFuchsiaResourceDialect
6298                        );
6299                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6300                        let control_handle = HealthControlHandle { inner: this.inner.clone() };
6301                        Ok(HealthRequest::GetHealthState {
6302                            responder: HealthGetHealthStateResponder {
6303                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6304                                tx_id: header.tx_id,
6305                            },
6306                        })
6307                    }
6308                    _ => Err(fidl::Error::UnknownOrdinal {
6309                        ordinal: header.ordinal,
6310                        protocol_name:
6311                            <HealthMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6312                    }),
6313                }))
6314            },
6315        )
6316    }
6317}
6318
6319#[derive(Debug)]
6320pub enum HealthRequest {
6321    /// Retrieves top level health state.
6322    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
6323    GetHealthState { responder: HealthGetHealthStateResponder },
6324}
6325
6326impl HealthRequest {
6327    #[allow(irrefutable_let_patterns)]
6328    pub fn into_get_health_state(self) -> Option<(HealthGetHealthStateResponder)> {
6329        if let HealthRequest::GetHealthState { responder } = self {
6330            Some((responder))
6331        } else {
6332            None
6333        }
6334    }
6335
6336    /// Name of the method defined in FIDL
6337    pub fn method_name(&self) -> &'static str {
6338        match *self {
6339            HealthRequest::GetHealthState { .. } => "get_health_state",
6340        }
6341    }
6342}
6343
6344#[derive(Debug, Clone)]
6345pub struct HealthControlHandle {
6346    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6347}
6348
6349impl fidl::endpoints::ControlHandle for HealthControlHandle {
6350    fn shutdown(&self) {
6351        self.inner.shutdown()
6352    }
6353    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6354        self.inner.shutdown_with_epitaph(status)
6355    }
6356
6357    fn is_closed(&self) -> bool {
6358        self.inner.channel().is_closed()
6359    }
6360    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6361        self.inner.channel().on_closed()
6362    }
6363
6364    #[cfg(target_os = "fuchsia")]
6365    fn signal_peer(
6366        &self,
6367        clear_mask: zx::Signals,
6368        set_mask: zx::Signals,
6369    ) -> Result<(), zx_status::Status> {
6370        use fidl::Peered;
6371        self.inner.channel().signal_peer(clear_mask, set_mask)
6372    }
6373}
6374
6375impl HealthControlHandle {}
6376
6377#[must_use = "FIDL methods require a response to be sent"]
6378#[derive(Debug)]
6379pub struct HealthGetHealthStateResponder {
6380    control_handle: std::mem::ManuallyDrop<HealthControlHandle>,
6381    tx_id: u32,
6382}
6383
6384/// Set the the channel to be shutdown (see [`HealthControlHandle::shutdown`])
6385/// if the responder is dropped without sending a response, so that the client
6386/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6387impl std::ops::Drop for HealthGetHealthStateResponder {
6388    fn drop(&mut self) {
6389        self.control_handle.shutdown();
6390        // Safety: drops once, never accessed again
6391        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6392    }
6393}
6394
6395impl fidl::endpoints::Responder for HealthGetHealthStateResponder {
6396    type ControlHandle = HealthControlHandle;
6397
6398    fn control_handle(&self) -> &HealthControlHandle {
6399        &self.control_handle
6400    }
6401
6402    fn drop_without_shutdown(mut self) {
6403        // Safety: drops once, never accessed again due to mem::forget
6404        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6405        // Prevent Drop from running (which would shut down the channel)
6406        std::mem::forget(self);
6407    }
6408}
6409
6410impl HealthGetHealthStateResponder {
6411    /// Sends a response to the FIDL transaction.
6412    ///
6413    /// Sets the channel to shutdown if an error occurs.
6414    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6415        let _result = self.send_raw(state);
6416        if _result.is_err() {
6417            self.control_handle.shutdown();
6418        }
6419        self.drop_without_shutdown();
6420        _result
6421    }
6422
6423    /// Similar to "send" but does not shutdown the channel if an error occurs.
6424    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
6425        let _result = self.send_raw(state);
6426        self.drop_without_shutdown();
6427        _result
6428    }
6429
6430    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
6431        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
6432            (state,),
6433            self.tx_id,
6434            0x4e146d6bca733a84,
6435            fidl::encoding::DynamicFlags::empty(),
6436        )
6437    }
6438}
6439
6440#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6441pub struct RingBufferMarker;
6442
6443impl fidl::endpoints::ProtocolMarker for RingBufferMarker {
6444    type Proxy = RingBufferProxy;
6445    type RequestStream = RingBufferRequestStream;
6446    #[cfg(target_os = "fuchsia")]
6447    type SynchronousProxy = RingBufferSynchronousProxy;
6448
6449    const DEBUG_NAME: &'static str = "(anonymous) RingBuffer";
6450}
6451pub type RingBufferGetVmoResult = Result<(u32, fidl::Vmo), GetVmoError>;
6452pub type RingBufferSetActiveChannelsResult = Result<i64, i32>;
6453
6454pub trait RingBufferProxyInterface: Send + Sync {
6455    type GetPropertiesResponseFut: std::future::Future<Output = Result<RingBufferProperties, fidl::Error>>
6456        + Send;
6457    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
6458    type WatchClockRecoveryPositionInfoResponseFut: std::future::Future<Output = Result<RingBufferPositionInfo, fidl::Error>>
6459        + Send;
6460    fn r#watch_clock_recovery_position_info(
6461        &self,
6462    ) -> Self::WatchClockRecoveryPositionInfoResponseFut;
6463    type GetVmoResponseFut: std::future::Future<Output = Result<RingBufferGetVmoResult, fidl::Error>>
6464        + Send;
6465    fn r#get_vmo(
6466        &self,
6467        min_frames: u32,
6468        clock_recovery_notifications_per_ring: u32,
6469    ) -> Self::GetVmoResponseFut;
6470    type StartResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
6471    fn r#start(&self) -> Self::StartResponseFut;
6472    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6473    fn r#stop(&self) -> Self::StopResponseFut;
6474    type SetActiveChannelsResponseFut: std::future::Future<Output = Result<RingBufferSetActiveChannelsResult, fidl::Error>>
6475        + Send;
6476    fn r#set_active_channels(
6477        &self,
6478        active_channels_bitmask: u64,
6479    ) -> Self::SetActiveChannelsResponseFut;
6480    type WatchDelayInfoResponseFut: std::future::Future<Output = Result<DelayInfo, fidl::Error>>
6481        + Send;
6482    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut;
6483}
6484#[derive(Debug)]
6485#[cfg(target_os = "fuchsia")]
6486pub struct RingBufferSynchronousProxy {
6487    client: fidl::client::sync::Client,
6488}
6489
6490#[cfg(target_os = "fuchsia")]
6491impl fidl::endpoints::SynchronousProxy for RingBufferSynchronousProxy {
6492    type Proxy = RingBufferProxy;
6493    type Protocol = RingBufferMarker;
6494
6495    fn from_channel(inner: fidl::Channel) -> Self {
6496        Self::new(inner)
6497    }
6498
6499    fn into_channel(self) -> fidl::Channel {
6500        self.client.into_channel()
6501    }
6502
6503    fn as_channel(&self) -> &fidl::Channel {
6504        self.client.as_channel()
6505    }
6506}
6507
6508#[cfg(target_os = "fuchsia")]
6509impl RingBufferSynchronousProxy {
6510    pub fn new(channel: fidl::Channel) -> Self {
6511        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6512        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6513    }
6514
6515    pub fn into_channel(self) -> fidl::Channel {
6516        self.client.into_channel()
6517    }
6518
6519    /// Waits until an event arrives and returns it. It is safe for other
6520    /// threads to make concurrent requests while waiting for an event.
6521    pub fn wait_for_event(
6522        &self,
6523        deadline: zx::MonotonicInstant,
6524    ) -> Result<RingBufferEvent, fidl::Error> {
6525        RingBufferEvent::decode(self.client.wait_for_event(deadline)?)
6526    }
6527
6528    /// Accessor for top level static properties.
6529    pub fn r#get_properties(
6530        &self,
6531        ___deadline: zx::MonotonicInstant,
6532    ) -> Result<RingBufferProperties, fidl::Error> {
6533        let _response = self
6534            .client
6535            .send_query::<fidl::encoding::EmptyPayload, RingBufferGetPropertiesResponse>(
6536                (),
6537                0x12947f061a8fe1,
6538                fidl::encoding::DynamicFlags::empty(),
6539                ___deadline,
6540            )?;
6541        Ok(_response.properties)
6542    }
6543
6544    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6545    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6546    /// client calls until the position information has changed from what was most recently
6547    /// provided to that client. The driver must not respond to a
6548    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6549    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6550    /// progresses at the rate specified by the rate, sample format (and clock domain,
6551    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6552    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6553    /// estimated position to be used for clock recovery at most at
6554    /// `clock_recovery_notifications_per_ring` frequency.
6555    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6556    /// `clock_recovery_notifications_per_ring` was specified.
6557    /// Must be delivered with timestamps that are monotonically increasing.
6558    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6559    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6560    pub fn r#watch_clock_recovery_position_info(
6561        &self,
6562        ___deadline: zx::MonotonicInstant,
6563    ) -> Result<RingBufferPositionInfo, fidl::Error> {
6564        let _response = self.client.send_query::<
6565            fidl::encoding::EmptyPayload,
6566            RingBufferWatchClockRecoveryPositionInfoResponse,
6567        >(
6568            (),
6569            0x694d5b898a4167e5,
6570            fidl::encoding::DynamicFlags::empty(),
6571            ___deadline,
6572        )?;
6573        Ok(_response.position_info)
6574    }
6575
6576    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6577    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6578    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6579    ///
6580    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6581    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6582    /// with GetVmoError.INVALID_ARGS.
6583    ///
6584    /// The driver may increase the ring buffer size beyond `min_frames` plus
6585    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6586    /// alignment.
6587    ///
6588    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6589    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6590    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6591    ///
6592    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6593    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6594    /// handle must also include ZX_RIGHT_WRITE.
6595    ///
6596    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6597    /// `WatchClockRecoveryPositionInfo` client requests at most at
6598    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6599    /// for clock recovery.
6600    pub fn r#get_vmo(
6601        &self,
6602        mut min_frames: u32,
6603        mut clock_recovery_notifications_per_ring: u32,
6604        ___deadline: zx::MonotonicInstant,
6605    ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6606        let _response = self.client.send_query::<
6607            RingBufferGetVmoRequest,
6608            fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6609        >(
6610            (min_frames, clock_recovery_notifications_per_ring,),
6611            0x44c8f4f5680e853a,
6612            fidl::encoding::DynamicFlags::empty(),
6613            ___deadline,
6614        )?;
6615        Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6616    }
6617
6618    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6619    /// when position began moving, starting at the beginning of the ring buffer,
6620    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6621    /// subject to the buffering described in `driver_transfer_bytes`.
6622    ///
6623    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6624    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6625    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6626    /// a second time before the first call has completed, then the channel must be closed with an
6627    /// error `ZX_ERR_BAD_STATE` returned.
6628    pub fn r#start(&self, ___deadline: zx::MonotonicInstant) -> Result<i64, fidl::Error> {
6629        let _response =
6630            self.client.send_query::<fidl::encoding::EmptyPayload, RingBufferStartResponse>(
6631                (),
6632                0x5dd780a769a8892d,
6633                fidl::encoding::DynamicFlags::empty(),
6634                ___deadline,
6635            )?;
6636        Ok(_response.start_time)
6637    }
6638
6639    /// Stop the ring buffer. Once this call's response is received, no further position
6640    /// notifications will be sent until `Start` is called again.
6641    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6642    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
6643        let _response =
6644            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
6645                (),
6646                0x49a73d9cf1d4e110,
6647                fidl::encoding::DynamicFlags::empty(),
6648                ___deadline,
6649            )?;
6650        Ok(_response)
6651    }
6652
6653    /// Sets which channels are active via a bitmask.
6654    /// The least significant bit corresponds to channel index 0.
6655    /// Channels not set (bits are 0) in the bitmask are inactive.
6656    /// By default all channels are active. Hence creating a RingBuffer turns on the
6657    /// hardware associated for all channels.
6658    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6659    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6660    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6661    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6662    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6663    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6664    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6665    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6666    /// advances (and position notifications sent as needed) regardless of the number of active
6667    /// channels, including if no channels are active. This means that the format in the
6668    /// ring buffer is not changed.
6669    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6670    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6671    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6672    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6673    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6674    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6675    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6676    /// hardware configuration was completed. If the requested channel configuration is already
6677    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6678    /// before the reply is sent. If called again with the same configuration, the reply must
6679    /// include the same `set_time` value as was previously returned.
6680    /// For input channels, it is not required that the driver zero-out inactive channels.
6681    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6682    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6683    pub fn r#set_active_channels(
6684        &self,
6685        mut active_channels_bitmask: u64,
6686        ___deadline: zx::MonotonicInstant,
6687    ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
6688        let _response = self.client.send_query::<
6689            RingBufferSetActiveChannelsRequest,
6690            fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
6691        >(
6692            (active_channels_bitmask,),
6693            0x605464c1d384f309,
6694            fidl::encoding::DynamicFlags::empty(),
6695            ___deadline,
6696        )?;
6697        Ok(_response.map(|x| x.set_time))
6698    }
6699
6700    /// Get information about delays via a hanging get. The driver will immediately reply to the
6701    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6702    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6703    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6704    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6705    pub fn r#watch_delay_info(
6706        &self,
6707        ___deadline: zx::MonotonicInstant,
6708    ) -> Result<DelayInfo, fidl::Error> {
6709        let _response = self.client.send_query::<
6710            fidl::encoding::EmptyPayload,
6711            fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
6712        >(
6713            (),
6714            0x6c1248db213fcf9f,
6715            fidl::encoding::DynamicFlags::FLEXIBLE,
6716            ___deadline,
6717        )?
6718        .into_result::<RingBufferMarker>("watch_delay_info")?;
6719        Ok(_response.delay_info)
6720    }
6721}
6722
6723#[cfg(target_os = "fuchsia")]
6724impl From<RingBufferSynchronousProxy> for zx::Handle {
6725    fn from(value: RingBufferSynchronousProxy) -> Self {
6726        value.into_channel().into()
6727    }
6728}
6729
6730#[cfg(target_os = "fuchsia")]
6731impl From<fidl::Channel> for RingBufferSynchronousProxy {
6732    fn from(value: fidl::Channel) -> Self {
6733        Self::new(value)
6734    }
6735}
6736
6737#[cfg(target_os = "fuchsia")]
6738impl fidl::endpoints::FromClient for RingBufferSynchronousProxy {
6739    type Protocol = RingBufferMarker;
6740
6741    fn from_client(value: fidl::endpoints::ClientEnd<RingBufferMarker>) -> Self {
6742        Self::new(value.into_channel())
6743    }
6744}
6745
6746#[derive(Debug, Clone)]
6747pub struct RingBufferProxy {
6748    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6749}
6750
6751impl fidl::endpoints::Proxy for RingBufferProxy {
6752    type Protocol = RingBufferMarker;
6753
6754    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6755        Self::new(inner)
6756    }
6757
6758    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6759        self.client.into_channel().map_err(|client| Self { client })
6760    }
6761
6762    fn as_channel(&self) -> &::fidl::AsyncChannel {
6763        self.client.as_channel()
6764    }
6765}
6766
6767impl RingBufferProxy {
6768    /// Create a new Proxy for fuchsia.hardware.audio/RingBuffer.
6769    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6770        let protocol_name = <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6771        Self { client: fidl::client::Client::new(channel, protocol_name) }
6772    }
6773
6774    /// Get a Stream of events from the remote end of the protocol.
6775    ///
6776    /// # Panics
6777    ///
6778    /// Panics if the event stream was already taken.
6779    pub fn take_event_stream(&self) -> RingBufferEventStream {
6780        RingBufferEventStream { event_receiver: self.client.take_event_receiver() }
6781    }
6782
6783    /// Accessor for top level static properties.
6784    pub fn r#get_properties(
6785        &self,
6786    ) -> fidl::client::QueryResponseFut<
6787        RingBufferProperties,
6788        fidl::encoding::DefaultFuchsiaResourceDialect,
6789    > {
6790        RingBufferProxyInterface::r#get_properties(self)
6791    }
6792
6793    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
6794    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
6795    /// client calls until the position information has changed from what was most recently
6796    /// provided to that client. The driver must not respond to a
6797    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
6798    /// At the `start_time` returned by `Start`, position is always 0. From there, it
6799    /// progresses at the rate specified by the rate, sample format (and clock domain,
6800    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
6801    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
6802    /// estimated position to be used for clock recovery at most at
6803    /// `clock_recovery_notifications_per_ring` frequency.
6804    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
6805    /// `clock_recovery_notifications_per_ring` was specified.
6806    /// Must be delivered with timestamps that are monotonically increasing.
6807    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
6808    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
6809    pub fn r#watch_clock_recovery_position_info(
6810        &self,
6811    ) -> fidl::client::QueryResponseFut<
6812        RingBufferPositionInfo,
6813        fidl::encoding::DefaultFuchsiaResourceDialect,
6814    > {
6815        RingBufferProxyInterface::r#watch_clock_recovery_position_info(self)
6816    }
6817
6818    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
6819    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
6820    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
6821    ///
6822    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
6823    /// that ring buffer contents can be transfered in and out, or else the call must be failed
6824    /// with GetVmoError.INVALID_ARGS.
6825    ///
6826    /// The driver may increase the ring buffer size beyond `min_frames` plus
6827    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
6828    /// alignment.
6829    ///
6830    /// Clients can treat the entire returned ring buffer as safe to access, except for the
6831    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
6832    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
6833    ///
6834    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
6835    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
6836    /// handle must also include ZX_RIGHT_WRITE.
6837    ///
6838    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
6839    /// `WatchClockRecoveryPositionInfo` client requests at most at
6840    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
6841    /// for clock recovery.
6842    pub fn r#get_vmo(
6843        &self,
6844        mut min_frames: u32,
6845        mut clock_recovery_notifications_per_ring: u32,
6846    ) -> fidl::client::QueryResponseFut<
6847        RingBufferGetVmoResult,
6848        fidl::encoding::DefaultFuchsiaResourceDialect,
6849    > {
6850        RingBufferProxyInterface::r#get_vmo(self, min_frames, clock_recovery_notifications_per_ring)
6851    }
6852
6853    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
6854    /// when position began moving, starting at the beginning of the ring buffer,
6855    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
6856    /// subject to the buffering described in `driver_transfer_bytes`.
6857    ///
6858    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
6859    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6860    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
6861    /// a second time before the first call has completed, then the channel must be closed with an
6862    /// error `ZX_ERR_BAD_STATE` returned.
6863    pub fn r#start(
6864        &self,
6865    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
6866        RingBufferProxyInterface::r#start(self)
6867    }
6868
6869    /// Stop the ring buffer. Once this call's response is received, no further position
6870    /// notifications will be sent until `Start` is called again.
6871    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
6872    pub fn r#stop(
6873        &self,
6874    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6875        RingBufferProxyInterface::r#stop(self)
6876    }
6877
6878    /// Sets which channels are active via a bitmask.
6879    /// The least significant bit corresponds to channel index 0.
6880    /// Channels not set (bits are 0) in the bitmask are inactive.
6881    /// By default all channels are active. Hence creating a RingBuffer turns on the
6882    /// hardware associated for all channels.
6883    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
6884    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
6885    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
6886    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
6887    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
6888    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
6889    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
6890    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
6891    /// advances (and position notifications sent as needed) regardless of the number of active
6892    /// channels, including if no channels are active. This means that the format in the
6893    /// ring buffer is not changed.
6894    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
6895    /// If the mask is incorrect, i.e. enables channels outside the number of bits
6896    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
6897    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
6898    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
6899    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
6900    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
6901    /// hardware configuration was completed. If the requested channel configuration is already
6902    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
6903    /// before the reply is sent. If called again with the same configuration, the reply must
6904    /// include the same `set_time` value as was previously returned.
6905    /// For input channels, it is not required that the driver zero-out inactive channels.
6906    /// If `SetActiveChannels` is called for a second time before the first call has completed,
6907    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6908    pub fn r#set_active_channels(
6909        &self,
6910        mut active_channels_bitmask: u64,
6911    ) -> fidl::client::QueryResponseFut<
6912        RingBufferSetActiveChannelsResult,
6913        fidl::encoding::DefaultFuchsiaResourceDialect,
6914    > {
6915        RingBufferProxyInterface::r#set_active_channels(self, active_channels_bitmask)
6916    }
6917
6918    /// Get information about delays via a hanging get. The driver will immediately reply to the
6919    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
6920    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
6921    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
6922    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
6923    pub fn r#watch_delay_info(
6924        &self,
6925    ) -> fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
6926    {
6927        RingBufferProxyInterface::r#watch_delay_info(self)
6928    }
6929}
6930
6931impl RingBufferProxyInterface for RingBufferProxy {
6932    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
6933        RingBufferProperties,
6934        fidl::encoding::DefaultFuchsiaResourceDialect,
6935    >;
6936    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
6937        fn _decode(
6938            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6939        ) -> Result<RingBufferProperties, fidl::Error> {
6940            let _response = fidl::client::decode_transaction_body::<
6941                RingBufferGetPropertiesResponse,
6942                fidl::encoding::DefaultFuchsiaResourceDialect,
6943                0x12947f061a8fe1,
6944            >(_buf?)?;
6945            Ok(_response.properties)
6946        }
6947        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferProperties>(
6948            (),
6949            0x12947f061a8fe1,
6950            fidl::encoding::DynamicFlags::empty(),
6951            _decode,
6952        )
6953    }
6954
6955    type WatchClockRecoveryPositionInfoResponseFut = fidl::client::QueryResponseFut<
6956        RingBufferPositionInfo,
6957        fidl::encoding::DefaultFuchsiaResourceDialect,
6958    >;
6959    fn r#watch_clock_recovery_position_info(
6960        &self,
6961    ) -> Self::WatchClockRecoveryPositionInfoResponseFut {
6962        fn _decode(
6963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6964        ) -> Result<RingBufferPositionInfo, fidl::Error> {
6965            let _response = fidl::client::decode_transaction_body::<
6966                RingBufferWatchClockRecoveryPositionInfoResponse,
6967                fidl::encoding::DefaultFuchsiaResourceDialect,
6968                0x694d5b898a4167e5,
6969            >(_buf?)?;
6970            Ok(_response.position_info)
6971        }
6972        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RingBufferPositionInfo>(
6973            (),
6974            0x694d5b898a4167e5,
6975            fidl::encoding::DynamicFlags::empty(),
6976            _decode,
6977        )
6978    }
6979
6980    type GetVmoResponseFut = fidl::client::QueryResponseFut<
6981        RingBufferGetVmoResult,
6982        fidl::encoding::DefaultFuchsiaResourceDialect,
6983    >;
6984    fn r#get_vmo(
6985        &self,
6986        mut min_frames: u32,
6987        mut clock_recovery_notifications_per_ring: u32,
6988    ) -> Self::GetVmoResponseFut {
6989        fn _decode(
6990            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6991        ) -> Result<RingBufferGetVmoResult, fidl::Error> {
6992            let _response = fidl::client::decode_transaction_body::<
6993                fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>,
6994                fidl::encoding::DefaultFuchsiaResourceDialect,
6995                0x44c8f4f5680e853a,
6996            >(_buf?)?;
6997            Ok(_response.map(|x| (x.num_frames, x.ring_buffer)))
6998        }
6999        self.client.send_query_and_decode::<RingBufferGetVmoRequest, RingBufferGetVmoResult>(
7000            (min_frames, clock_recovery_notifications_per_ring),
7001            0x44c8f4f5680e853a,
7002            fidl::encoding::DynamicFlags::empty(),
7003            _decode,
7004        )
7005    }
7006
7007    type StartResponseFut =
7008        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
7009    fn r#start(&self) -> Self::StartResponseFut {
7010        fn _decode(
7011            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7012        ) -> Result<i64, fidl::Error> {
7013            let _response = fidl::client::decode_transaction_body::<
7014                RingBufferStartResponse,
7015                fidl::encoding::DefaultFuchsiaResourceDialect,
7016                0x5dd780a769a8892d,
7017            >(_buf?)?;
7018            Ok(_response.start_time)
7019        }
7020        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i64>(
7021            (),
7022            0x5dd780a769a8892d,
7023            fidl::encoding::DynamicFlags::empty(),
7024            _decode,
7025        )
7026    }
7027
7028    type StopResponseFut =
7029        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7030    fn r#stop(&self) -> Self::StopResponseFut {
7031        fn _decode(
7032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7033        ) -> Result<(), fidl::Error> {
7034            let _response = fidl::client::decode_transaction_body::<
7035                fidl::encoding::EmptyPayload,
7036                fidl::encoding::DefaultFuchsiaResourceDialect,
7037                0x49a73d9cf1d4e110,
7038            >(_buf?)?;
7039            Ok(_response)
7040        }
7041        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
7042            (),
7043            0x49a73d9cf1d4e110,
7044            fidl::encoding::DynamicFlags::empty(),
7045            _decode,
7046        )
7047    }
7048
7049    type SetActiveChannelsResponseFut = fidl::client::QueryResponseFut<
7050        RingBufferSetActiveChannelsResult,
7051        fidl::encoding::DefaultFuchsiaResourceDialect,
7052    >;
7053    fn r#set_active_channels(
7054        &self,
7055        mut active_channels_bitmask: u64,
7056    ) -> Self::SetActiveChannelsResponseFut {
7057        fn _decode(
7058            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7059        ) -> Result<RingBufferSetActiveChannelsResult, fidl::Error> {
7060            let _response = fidl::client::decode_transaction_body::<
7061                fidl::encoding::ResultType<RingBufferSetActiveChannelsResponse, i32>,
7062                fidl::encoding::DefaultFuchsiaResourceDialect,
7063                0x605464c1d384f309,
7064            >(_buf?)?;
7065            Ok(_response.map(|x| x.set_time))
7066        }
7067        self.client.send_query_and_decode::<
7068            RingBufferSetActiveChannelsRequest,
7069            RingBufferSetActiveChannelsResult,
7070        >(
7071            (active_channels_bitmask,),
7072            0x605464c1d384f309,
7073            fidl::encoding::DynamicFlags::empty(),
7074            _decode,
7075        )
7076    }
7077
7078    type WatchDelayInfoResponseFut =
7079        fidl::client::QueryResponseFut<DelayInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
7080    fn r#watch_delay_info(&self) -> Self::WatchDelayInfoResponseFut {
7081        fn _decode(
7082            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7083        ) -> Result<DelayInfo, fidl::Error> {
7084            let _response = fidl::client::decode_transaction_body::<
7085                fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>,
7086                fidl::encoding::DefaultFuchsiaResourceDialect,
7087                0x6c1248db213fcf9f,
7088            >(_buf?)?
7089            .into_result::<RingBufferMarker>("watch_delay_info")?;
7090            Ok(_response.delay_info)
7091        }
7092        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DelayInfo>(
7093            (),
7094            0x6c1248db213fcf9f,
7095            fidl::encoding::DynamicFlags::FLEXIBLE,
7096            _decode,
7097        )
7098    }
7099}
7100
7101pub struct RingBufferEventStream {
7102    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7103}
7104
7105impl std::marker::Unpin for RingBufferEventStream {}
7106
7107impl futures::stream::FusedStream for RingBufferEventStream {
7108    fn is_terminated(&self) -> bool {
7109        self.event_receiver.is_terminated()
7110    }
7111}
7112
7113impl futures::Stream for RingBufferEventStream {
7114    type Item = Result<RingBufferEvent, fidl::Error>;
7115
7116    fn poll_next(
7117        mut self: std::pin::Pin<&mut Self>,
7118        cx: &mut std::task::Context<'_>,
7119    ) -> std::task::Poll<Option<Self::Item>> {
7120        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7121            &mut self.event_receiver,
7122            cx
7123        )?) {
7124            Some(buf) => std::task::Poll::Ready(Some(RingBufferEvent::decode(buf))),
7125            None => std::task::Poll::Ready(None),
7126        }
7127    }
7128}
7129
7130#[derive(Debug)]
7131pub enum RingBufferEvent {
7132    #[non_exhaustive]
7133    _UnknownEvent {
7134        /// Ordinal of the event that was sent.
7135        ordinal: u64,
7136    },
7137}
7138
7139impl RingBufferEvent {
7140    /// Decodes a message buffer as a [`RingBufferEvent`].
7141    fn decode(
7142        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7143    ) -> Result<RingBufferEvent, fidl::Error> {
7144        let (bytes, _handles) = buf.split_mut();
7145        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7146        debug_assert_eq!(tx_header.tx_id, 0);
7147        match tx_header.ordinal {
7148            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7149                Ok(RingBufferEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7150            }
7151            _ => Err(fidl::Error::UnknownOrdinal {
7152                ordinal: tx_header.ordinal,
7153                protocol_name: <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7154            }),
7155        }
7156    }
7157}
7158
7159/// A Stream of incoming requests for fuchsia.hardware.audio/RingBuffer.
7160pub struct RingBufferRequestStream {
7161    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7162    is_terminated: bool,
7163}
7164
7165impl std::marker::Unpin for RingBufferRequestStream {}
7166
7167impl futures::stream::FusedStream for RingBufferRequestStream {
7168    fn is_terminated(&self) -> bool {
7169        self.is_terminated
7170    }
7171}
7172
7173impl fidl::endpoints::RequestStream for RingBufferRequestStream {
7174    type Protocol = RingBufferMarker;
7175    type ControlHandle = RingBufferControlHandle;
7176
7177    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7178        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7179    }
7180
7181    fn control_handle(&self) -> Self::ControlHandle {
7182        RingBufferControlHandle { inner: self.inner.clone() }
7183    }
7184
7185    fn into_inner(
7186        self,
7187    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7188    {
7189        (self.inner, self.is_terminated)
7190    }
7191
7192    fn from_inner(
7193        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7194        is_terminated: bool,
7195    ) -> Self {
7196        Self { inner, is_terminated }
7197    }
7198}
7199
7200impl futures::Stream for RingBufferRequestStream {
7201    type Item = Result<RingBufferRequest, fidl::Error>;
7202
7203    fn poll_next(
7204        mut self: std::pin::Pin<&mut Self>,
7205        cx: &mut std::task::Context<'_>,
7206    ) -> std::task::Poll<Option<Self::Item>> {
7207        let this = &mut *self;
7208        if this.inner.check_shutdown(cx) {
7209            this.is_terminated = true;
7210            return std::task::Poll::Ready(None);
7211        }
7212        if this.is_terminated {
7213            panic!("polled RingBufferRequestStream after completion");
7214        }
7215        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7216            |bytes, handles| {
7217                match this.inner.channel().read_etc(cx, bytes, handles) {
7218                    std::task::Poll::Ready(Ok(())) => {}
7219                    std::task::Poll::Pending => return std::task::Poll::Pending,
7220                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7221                        this.is_terminated = true;
7222                        return std::task::Poll::Ready(None);
7223                    }
7224                    std::task::Poll::Ready(Err(e)) => {
7225                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7226                            e.into(),
7227                        ))))
7228                    }
7229                }
7230
7231                // A message has been received from the channel
7232                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7233
7234                std::task::Poll::Ready(Some(match header.ordinal {
7235                    0x12947f061a8fe1 => {
7236                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7237                        let mut req = fidl::new_empty!(
7238                            fidl::encoding::EmptyPayload,
7239                            fidl::encoding::DefaultFuchsiaResourceDialect
7240                        );
7241                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7242                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7243                        Ok(RingBufferRequest::GetProperties {
7244                            responder: RingBufferGetPropertiesResponder {
7245                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7246                                tx_id: header.tx_id,
7247                            },
7248                        })
7249                    }
7250                    0x694d5b898a4167e5 => {
7251                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7252                        let mut req = fidl::new_empty!(
7253                            fidl::encoding::EmptyPayload,
7254                            fidl::encoding::DefaultFuchsiaResourceDialect
7255                        );
7256                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7257                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7258                        Ok(RingBufferRequest::WatchClockRecoveryPositionInfo {
7259                            responder: RingBufferWatchClockRecoveryPositionInfoResponder {
7260                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7261                                tx_id: header.tx_id,
7262                            },
7263                        })
7264                    }
7265                    0x44c8f4f5680e853a => {
7266                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7267                        let mut req = fidl::new_empty!(
7268                            RingBufferGetVmoRequest,
7269                            fidl::encoding::DefaultFuchsiaResourceDialect
7270                        );
7271                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferGetVmoRequest>(&header, _body_bytes, handles, &mut req)?;
7272                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7273                        Ok(RingBufferRequest::GetVmo {
7274                            min_frames: req.min_frames,
7275                            clock_recovery_notifications_per_ring: req
7276                                .clock_recovery_notifications_per_ring,
7277
7278                            responder: RingBufferGetVmoResponder {
7279                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7280                                tx_id: header.tx_id,
7281                            },
7282                        })
7283                    }
7284                    0x5dd780a769a8892d => {
7285                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7286                        let mut req = fidl::new_empty!(
7287                            fidl::encoding::EmptyPayload,
7288                            fidl::encoding::DefaultFuchsiaResourceDialect
7289                        );
7290                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7291                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7292                        Ok(RingBufferRequest::Start {
7293                            responder: RingBufferStartResponder {
7294                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7295                                tx_id: header.tx_id,
7296                            },
7297                        })
7298                    }
7299                    0x49a73d9cf1d4e110 => {
7300                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7301                        let mut req = fidl::new_empty!(
7302                            fidl::encoding::EmptyPayload,
7303                            fidl::encoding::DefaultFuchsiaResourceDialect
7304                        );
7305                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7306                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7307                        Ok(RingBufferRequest::Stop {
7308                            responder: RingBufferStopResponder {
7309                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7310                                tx_id: header.tx_id,
7311                            },
7312                        })
7313                    }
7314                    0x605464c1d384f309 => {
7315                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7316                        let mut req = fidl::new_empty!(
7317                            RingBufferSetActiveChannelsRequest,
7318                            fidl::encoding::DefaultFuchsiaResourceDialect
7319                        );
7320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RingBufferSetActiveChannelsRequest>(&header, _body_bytes, handles, &mut req)?;
7321                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7322                        Ok(RingBufferRequest::SetActiveChannels {
7323                            active_channels_bitmask: req.active_channels_bitmask,
7324
7325                            responder: RingBufferSetActiveChannelsResponder {
7326                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7327                                tx_id: header.tx_id,
7328                            },
7329                        })
7330                    }
7331                    0x6c1248db213fcf9f => {
7332                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7333                        let mut req = fidl::new_empty!(
7334                            fidl::encoding::EmptyPayload,
7335                            fidl::encoding::DefaultFuchsiaResourceDialect
7336                        );
7337                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7338                        let control_handle = RingBufferControlHandle { inner: this.inner.clone() };
7339                        Ok(RingBufferRequest::WatchDelayInfo {
7340                            responder: RingBufferWatchDelayInfoResponder {
7341                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7342                                tx_id: header.tx_id,
7343                            },
7344                        })
7345                    }
7346                    _ if header.tx_id == 0
7347                        && header
7348                            .dynamic_flags()
7349                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7350                    {
7351                        Ok(RingBufferRequest::_UnknownMethod {
7352                            ordinal: header.ordinal,
7353                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7354                            method_type: fidl::MethodType::OneWay,
7355                        })
7356                    }
7357                    _ if header
7358                        .dynamic_flags()
7359                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7360                    {
7361                        this.inner.send_framework_err(
7362                            fidl::encoding::FrameworkErr::UnknownMethod,
7363                            header.tx_id,
7364                            header.ordinal,
7365                            header.dynamic_flags(),
7366                            (bytes, handles),
7367                        )?;
7368                        Ok(RingBufferRequest::_UnknownMethod {
7369                            ordinal: header.ordinal,
7370                            control_handle: RingBufferControlHandle { inner: this.inner.clone() },
7371                            method_type: fidl::MethodType::TwoWay,
7372                        })
7373                    }
7374                    _ => Err(fidl::Error::UnknownOrdinal {
7375                        ordinal: header.ordinal,
7376                        protocol_name:
7377                            <RingBufferMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7378                    }),
7379                }))
7380            },
7381        )
7382    }
7383}
7384
7385#[derive(Debug)]
7386pub enum RingBufferRequest {
7387    /// Accessor for top level static properties.
7388    GetProperties { responder: RingBufferGetPropertiesResponder },
7389    /// Gets the ring buffer current position via a hanging get. The driver must respond to a
7390    /// client's first `WatchClockRecoveryPositionInfo` call, but will not respond to subsequent
7391    /// client calls until the position information has changed from what was most recently
7392    /// provided to that client. The driver must not respond to a
7393    /// `WatchClockRecoveryPositionInfo` until after it has replied to the `Start` command.
7394    /// At the `start_time` returned by `Start`, position is always 0. From there, it
7395    /// progresses at the rate specified by the rate, sample format (and clock domain,
7396    /// if the device is not in the same clock domain as`CLOCK_MONOTONIC`).
7397    /// If `clock_recovery_notifications_per_ring` is not zero, the driver will reply with its
7398    /// estimated position to be used for clock recovery at most at
7399    /// `clock_recovery_notifications_per_ring` frequency.
7400    /// `WatchClockRecoveryPositionInfo` may only be called after `GetVmo` was called, hence a
7401    /// `clock_recovery_notifications_per_ring` was specified.
7402    /// Must be delivered with timestamps that are monotonically increasing.
7403    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if there is
7404    /// already a pending `WatchClockRecoveryPositionInfo` for this client.
7405    WatchClockRecoveryPositionInfo { responder: RingBufferWatchClockRecoveryPositionInfoResponder },
7406    /// Requests a shared buffer to be used for moving bulk audio data between client and driver.
7407    /// The client requests `min_frames` as the size for part of the ring buffer it needs.
7408    /// The driver returns the actual size of allocated ring buffer space in `num_frames`.
7409    ///
7410    /// `num_frames` must be at least `min_frames` plus `driver_transfer_bytes` (in frames) such
7411    /// that ring buffer contents can be transfered in and out, or else the call must be failed
7412    /// with GetVmoError.INVALID_ARGS.
7413    ///
7414    /// The driver may increase the ring buffer size beyond `min_frames` plus
7415    /// `driver_transfer_bytes` (in frames) due to any internal requirements, for instance
7416    /// alignment.
7417    ///
7418    /// Clients can treat the entire returned ring buffer as safe to access, except for the
7419    /// `driver_transfer_bytes` immediately adjacent to the current position, see the
7420    /// `driver_transfer_bytes` parameter specification in `RingBufferProperties` for more details.
7421    ///
7422    /// The returned VMO handle must include ZX_RIGHT_TRANSFER, ZX_RIGHT_READ and ZX_RIGHT_MAP.
7423    /// If the ring buffer is "outgoing" (conveys audio data from client to device), then the
7424    /// handle must also include ZX_RIGHT_WRITE.
7425    ///
7426    /// If `clock_recovery_notifications_per_ring` is non-zero, the driver will send replies to
7427    /// `WatchClockRecoveryPositionInfo` client requests at most at
7428    /// `clock_recovery_notifications_per_ring` frequency. These notifications are meant to be used
7429    /// for clock recovery.
7430    GetVmo {
7431        min_frames: u32,
7432        clock_recovery_notifications_per_ring: u32,
7433        responder: RingBufferGetVmoResponder,
7434    },
7435    /// Start the ring buffer. The `start_time` value (in the CLOCK_MONOTONIC timeline) indicates
7436    /// when position began moving, starting at the beginning of the ring buffer,
7437    /// i.e. the driver/HW has started to read or write from or to the ring buffer position 0,
7438    /// subject to the buffering described in `driver_transfer_bytes`.
7439    ///
7440    /// If `Start` is called before `SetActiveChannels`, then by default all channels are active.
7441    /// If `Start` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7442    /// If `Start` is called while this RingBuffer is already started, or if `Start` is called for
7443    /// a second time before the first call has completed, then the channel must be closed with an
7444    /// error `ZX_ERR_BAD_STATE` returned.
7445    Start { responder: RingBufferStartResponder },
7446    /// Stop the ring buffer. Once this call's response is received, no further position
7447    /// notifications will be sent until `Start` is called again.
7448    /// If `Stop` is called before `GetVmo`, the channel must be closed with `ZX_ERR_BAD_STATE`.
7449    Stop { responder: RingBufferStopResponder },
7450    /// Sets which channels are active via a bitmask.
7451    /// The least significant bit corresponds to channel index 0.
7452    /// Channels not set (bits are 0) in the bitmask are inactive.
7453    /// By default all channels are active. Hence creating a RingBuffer turns on the
7454    /// hardware associated for all channels.
7455    /// Inactive channels indicate to the driver that it may turn off hardware associated with the
7456    /// inactive channels. A subsequent `SetActiveChannels` setting an inactive channel to active
7457    /// may incur in a `turn_on_delay` to actually restart playback/capture of the channels.
7458    /// The total number of channels is the `number_of_channels` in `Format`, specifically in
7459    /// `PcmFormat`, i.e. this bitmask has up to `number_of_channels` bits set (maximum 64).
7460    /// Deactivating one, several, or all channels does not `Stop` the ring buffer.
7461    /// `SetActiveChannels` does not change the ring buffer's behavior with regard to
7462    /// `Start`/`Stop`, specifically position.  Once `Start` is called, a ring buffer's position
7463    /// advances (and position notifications sent as needed) regardless of the number of active
7464    /// channels, including if no channels are active. This means that the format in the
7465    /// ring buffer is not changed.
7466    /// If the driver does not support deactivating channels it must return `ZX_ERR_NOT_SUPPORTED`.
7467    /// If the mask is incorrect, i.e. enables channels outside the number of bits
7468    /// to use for a given `number_of_channels`, then the driver must return `ZX_ERR_INVALID_ARGS`.
7469    /// The `set_time` value (in the CLOCK_MONOTONIC timeline) indicates when configuring
7470    /// the hardware to activate or deactivate channels is completed. `set_time` does not include
7471    /// the potential `turn_on_delay`, the driver does not delay the reply waiting for the
7472    /// hardware to actually turn on, the driver replies with a `set_time` indicating when the
7473    /// hardware configuration was completed. If the requested channel configuration is already
7474    /// active, the returned `set_time` can be before `SetActiveChannels` was called but must be
7475    /// before the reply is sent. If called again with the same configuration, the reply must
7476    /// include the same `set_time` value as was previously returned.
7477    /// For input channels, it is not required that the driver zero-out inactive channels.
7478    /// If `SetActiveChannels` is called for a second time before the first call has completed,
7479    /// the channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7480    SetActiveChannels {
7481        active_channels_bitmask: u64,
7482        responder: RingBufferSetActiveChannelsResponder,
7483    },
7484    /// Get information about delays via a hanging get. The driver will immediately reply to the
7485    /// first `WatchDelayInfo` sent by the client. The driver will not respond to subsequent client
7486    /// `WatchDelayInfo` calls until the delay info changes from what was most recently reported.
7487    /// If `WatchDelayInfo` is called for a second time before the first call has completed, the
7488    /// channel must be closed with an error `ZX_ERR_BAD_STATE` returned.
7489    WatchDelayInfo { responder: RingBufferWatchDelayInfoResponder },
7490    /// An interaction was received which does not match any known method.
7491    #[non_exhaustive]
7492    _UnknownMethod {
7493        /// Ordinal of the method that was called.
7494        ordinal: u64,
7495        control_handle: RingBufferControlHandle,
7496        method_type: fidl::MethodType,
7497    },
7498}
7499
7500impl RingBufferRequest {
7501    #[allow(irrefutable_let_patterns)]
7502    pub fn into_get_properties(self) -> Option<(RingBufferGetPropertiesResponder)> {
7503        if let RingBufferRequest::GetProperties { responder } = self {
7504            Some((responder))
7505        } else {
7506            None
7507        }
7508    }
7509
7510    #[allow(irrefutable_let_patterns)]
7511    pub fn into_watch_clock_recovery_position_info(
7512        self,
7513    ) -> Option<(RingBufferWatchClockRecoveryPositionInfoResponder)> {
7514        if let RingBufferRequest::WatchClockRecoveryPositionInfo { responder } = self {
7515            Some((responder))
7516        } else {
7517            None
7518        }
7519    }
7520
7521    #[allow(irrefutable_let_patterns)]
7522    pub fn into_get_vmo(self) -> Option<(u32, u32, RingBufferGetVmoResponder)> {
7523        if let RingBufferRequest::GetVmo {
7524            min_frames,
7525            clock_recovery_notifications_per_ring,
7526            responder,
7527        } = self
7528        {
7529            Some((min_frames, clock_recovery_notifications_per_ring, responder))
7530        } else {
7531            None
7532        }
7533    }
7534
7535    #[allow(irrefutable_let_patterns)]
7536    pub fn into_start(self) -> Option<(RingBufferStartResponder)> {
7537        if let RingBufferRequest::Start { responder } = self {
7538            Some((responder))
7539        } else {
7540            None
7541        }
7542    }
7543
7544    #[allow(irrefutable_let_patterns)]
7545    pub fn into_stop(self) -> Option<(RingBufferStopResponder)> {
7546        if let RingBufferRequest::Stop { responder } = self {
7547            Some((responder))
7548        } else {
7549            None
7550        }
7551    }
7552
7553    #[allow(irrefutable_let_patterns)]
7554    pub fn into_set_active_channels(self) -> Option<(u64, RingBufferSetActiveChannelsResponder)> {
7555        if let RingBufferRequest::SetActiveChannels { active_channels_bitmask, responder } = self {
7556            Some((active_channels_bitmask, responder))
7557        } else {
7558            None
7559        }
7560    }
7561
7562    #[allow(irrefutable_let_patterns)]
7563    pub fn into_watch_delay_info(self) -> Option<(RingBufferWatchDelayInfoResponder)> {
7564        if let RingBufferRequest::WatchDelayInfo { responder } = self {
7565            Some((responder))
7566        } else {
7567            None
7568        }
7569    }
7570
7571    /// Name of the method defined in FIDL
7572    pub fn method_name(&self) -> &'static str {
7573        match *self {
7574            RingBufferRequest::GetProperties { .. } => "get_properties",
7575            RingBufferRequest::WatchClockRecoveryPositionInfo { .. } => {
7576                "watch_clock_recovery_position_info"
7577            }
7578            RingBufferRequest::GetVmo { .. } => "get_vmo",
7579            RingBufferRequest::Start { .. } => "start",
7580            RingBufferRequest::Stop { .. } => "stop",
7581            RingBufferRequest::SetActiveChannels { .. } => "set_active_channels",
7582            RingBufferRequest::WatchDelayInfo { .. } => "watch_delay_info",
7583            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7584                "unknown one-way method"
7585            }
7586            RingBufferRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7587                "unknown two-way method"
7588            }
7589        }
7590    }
7591}
7592
7593#[derive(Debug, Clone)]
7594pub struct RingBufferControlHandle {
7595    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7596}
7597
7598impl fidl::endpoints::ControlHandle for RingBufferControlHandle {
7599    fn shutdown(&self) {
7600        self.inner.shutdown()
7601    }
7602    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7603        self.inner.shutdown_with_epitaph(status)
7604    }
7605
7606    fn is_closed(&self) -> bool {
7607        self.inner.channel().is_closed()
7608    }
7609    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7610        self.inner.channel().on_closed()
7611    }
7612
7613    #[cfg(target_os = "fuchsia")]
7614    fn signal_peer(
7615        &self,
7616        clear_mask: zx::Signals,
7617        set_mask: zx::Signals,
7618    ) -> Result<(), zx_status::Status> {
7619        use fidl::Peered;
7620        self.inner.channel().signal_peer(clear_mask, set_mask)
7621    }
7622}
7623
7624impl RingBufferControlHandle {}
7625
7626#[must_use = "FIDL methods require a response to be sent"]
7627#[derive(Debug)]
7628pub struct RingBufferGetPropertiesResponder {
7629    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7630    tx_id: u32,
7631}
7632
7633/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7634/// if the responder is dropped without sending a response, so that the client
7635/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7636impl std::ops::Drop for RingBufferGetPropertiesResponder {
7637    fn drop(&mut self) {
7638        self.control_handle.shutdown();
7639        // Safety: drops once, never accessed again
7640        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7641    }
7642}
7643
7644impl fidl::endpoints::Responder for RingBufferGetPropertiesResponder {
7645    type ControlHandle = RingBufferControlHandle;
7646
7647    fn control_handle(&self) -> &RingBufferControlHandle {
7648        &self.control_handle
7649    }
7650
7651    fn drop_without_shutdown(mut self) {
7652        // Safety: drops once, never accessed again due to mem::forget
7653        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7654        // Prevent Drop from running (which would shut down the channel)
7655        std::mem::forget(self);
7656    }
7657}
7658
7659impl RingBufferGetPropertiesResponder {
7660    /// Sends a response to the FIDL transaction.
7661    ///
7662    /// Sets the channel to shutdown if an error occurs.
7663    pub fn send(self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7664        let _result = self.send_raw(properties);
7665        if _result.is_err() {
7666            self.control_handle.shutdown();
7667        }
7668        self.drop_without_shutdown();
7669        _result
7670    }
7671
7672    /// Similar to "send" but does not shutdown the channel if an error occurs.
7673    pub fn send_no_shutdown_on_err(
7674        self,
7675        mut properties: &RingBufferProperties,
7676    ) -> Result<(), fidl::Error> {
7677        let _result = self.send_raw(properties);
7678        self.drop_without_shutdown();
7679        _result
7680    }
7681
7682    fn send_raw(&self, mut properties: &RingBufferProperties) -> Result<(), fidl::Error> {
7683        self.control_handle.inner.send::<RingBufferGetPropertiesResponse>(
7684            (properties,),
7685            self.tx_id,
7686            0x12947f061a8fe1,
7687            fidl::encoding::DynamicFlags::empty(),
7688        )
7689    }
7690}
7691
7692#[must_use = "FIDL methods require a response to be sent"]
7693#[derive(Debug)]
7694pub struct RingBufferWatchClockRecoveryPositionInfoResponder {
7695    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7696    tx_id: u32,
7697}
7698
7699/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7700/// if the responder is dropped without sending a response, so that the client
7701/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7702impl std::ops::Drop for RingBufferWatchClockRecoveryPositionInfoResponder {
7703    fn drop(&mut self) {
7704        self.control_handle.shutdown();
7705        // Safety: drops once, never accessed again
7706        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7707    }
7708}
7709
7710impl fidl::endpoints::Responder for RingBufferWatchClockRecoveryPositionInfoResponder {
7711    type ControlHandle = RingBufferControlHandle;
7712
7713    fn control_handle(&self) -> &RingBufferControlHandle {
7714        &self.control_handle
7715    }
7716
7717    fn drop_without_shutdown(mut self) {
7718        // Safety: drops once, never accessed again due to mem::forget
7719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7720        // Prevent Drop from running (which would shut down the channel)
7721        std::mem::forget(self);
7722    }
7723}
7724
7725impl RingBufferWatchClockRecoveryPositionInfoResponder {
7726    /// Sends a response to the FIDL transaction.
7727    ///
7728    /// Sets the channel to shutdown if an error occurs.
7729    pub fn send(self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7730        let _result = self.send_raw(position_info);
7731        if _result.is_err() {
7732            self.control_handle.shutdown();
7733        }
7734        self.drop_without_shutdown();
7735        _result
7736    }
7737
7738    /// Similar to "send" but does not shutdown the channel if an error occurs.
7739    pub fn send_no_shutdown_on_err(
7740        self,
7741        mut position_info: &RingBufferPositionInfo,
7742    ) -> Result<(), fidl::Error> {
7743        let _result = self.send_raw(position_info);
7744        self.drop_without_shutdown();
7745        _result
7746    }
7747
7748    fn send_raw(&self, mut position_info: &RingBufferPositionInfo) -> Result<(), fidl::Error> {
7749        self.control_handle.inner.send::<RingBufferWatchClockRecoveryPositionInfoResponse>(
7750            (position_info,),
7751            self.tx_id,
7752            0x694d5b898a4167e5,
7753            fidl::encoding::DynamicFlags::empty(),
7754        )
7755    }
7756}
7757
7758#[must_use = "FIDL methods require a response to be sent"]
7759#[derive(Debug)]
7760pub struct RingBufferGetVmoResponder {
7761    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7762    tx_id: u32,
7763}
7764
7765/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7766/// if the responder is dropped without sending a response, so that the client
7767/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7768impl std::ops::Drop for RingBufferGetVmoResponder {
7769    fn drop(&mut self) {
7770        self.control_handle.shutdown();
7771        // Safety: drops once, never accessed again
7772        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7773    }
7774}
7775
7776impl fidl::endpoints::Responder for RingBufferGetVmoResponder {
7777    type ControlHandle = RingBufferControlHandle;
7778
7779    fn control_handle(&self) -> &RingBufferControlHandle {
7780        &self.control_handle
7781    }
7782
7783    fn drop_without_shutdown(mut self) {
7784        // Safety: drops once, never accessed again due to mem::forget
7785        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7786        // Prevent Drop from running (which would shut down the channel)
7787        std::mem::forget(self);
7788    }
7789}
7790
7791impl RingBufferGetVmoResponder {
7792    /// Sends a response to the FIDL transaction.
7793    ///
7794    /// Sets the channel to shutdown if an error occurs.
7795    pub fn send(
7796        self,
7797        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7798    ) -> Result<(), fidl::Error> {
7799        let _result = self.send_raw(result);
7800        if _result.is_err() {
7801            self.control_handle.shutdown();
7802        }
7803        self.drop_without_shutdown();
7804        _result
7805    }
7806
7807    /// Similar to "send" but does not shutdown the channel if an error occurs.
7808    pub fn send_no_shutdown_on_err(
7809        self,
7810        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7811    ) -> Result<(), fidl::Error> {
7812        let _result = self.send_raw(result);
7813        self.drop_without_shutdown();
7814        _result
7815    }
7816
7817    fn send_raw(
7818        &self,
7819        mut result: Result<(u32, fidl::Vmo), GetVmoError>,
7820    ) -> Result<(), fidl::Error> {
7821        self.control_handle
7822            .inner
7823            .send::<fidl::encoding::ResultType<RingBufferGetVmoResponse, GetVmoError>>(
7824                result,
7825                self.tx_id,
7826                0x44c8f4f5680e853a,
7827                fidl::encoding::DynamicFlags::empty(),
7828            )
7829    }
7830}
7831
7832#[must_use = "FIDL methods require a response to be sent"]
7833#[derive(Debug)]
7834pub struct RingBufferStartResponder {
7835    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7836    tx_id: u32,
7837}
7838
7839/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7840/// if the responder is dropped without sending a response, so that the client
7841/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7842impl std::ops::Drop for RingBufferStartResponder {
7843    fn drop(&mut self) {
7844        self.control_handle.shutdown();
7845        // Safety: drops once, never accessed again
7846        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7847    }
7848}
7849
7850impl fidl::endpoints::Responder for RingBufferStartResponder {
7851    type ControlHandle = RingBufferControlHandle;
7852
7853    fn control_handle(&self) -> &RingBufferControlHandle {
7854        &self.control_handle
7855    }
7856
7857    fn drop_without_shutdown(mut self) {
7858        // Safety: drops once, never accessed again due to mem::forget
7859        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7860        // Prevent Drop from running (which would shut down the channel)
7861        std::mem::forget(self);
7862    }
7863}
7864
7865impl RingBufferStartResponder {
7866    /// Sends a response to the FIDL transaction.
7867    ///
7868    /// Sets the channel to shutdown if an error occurs.
7869    pub fn send(self, mut start_time: i64) -> Result<(), fidl::Error> {
7870        let _result = self.send_raw(start_time);
7871        if _result.is_err() {
7872            self.control_handle.shutdown();
7873        }
7874        self.drop_without_shutdown();
7875        _result
7876    }
7877
7878    /// Similar to "send" but does not shutdown the channel if an error occurs.
7879    pub fn send_no_shutdown_on_err(self, mut start_time: i64) -> Result<(), fidl::Error> {
7880        let _result = self.send_raw(start_time);
7881        self.drop_without_shutdown();
7882        _result
7883    }
7884
7885    fn send_raw(&self, mut start_time: i64) -> Result<(), fidl::Error> {
7886        self.control_handle.inner.send::<RingBufferStartResponse>(
7887            (start_time,),
7888            self.tx_id,
7889            0x5dd780a769a8892d,
7890            fidl::encoding::DynamicFlags::empty(),
7891        )
7892    }
7893}
7894
7895#[must_use = "FIDL methods require a response to be sent"]
7896#[derive(Debug)]
7897pub struct RingBufferStopResponder {
7898    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7899    tx_id: u32,
7900}
7901
7902/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7903/// if the responder is dropped without sending a response, so that the client
7904/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7905impl std::ops::Drop for RingBufferStopResponder {
7906    fn drop(&mut self) {
7907        self.control_handle.shutdown();
7908        // Safety: drops once, never accessed again
7909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7910    }
7911}
7912
7913impl fidl::endpoints::Responder for RingBufferStopResponder {
7914    type ControlHandle = RingBufferControlHandle;
7915
7916    fn control_handle(&self) -> &RingBufferControlHandle {
7917        &self.control_handle
7918    }
7919
7920    fn drop_without_shutdown(mut self) {
7921        // Safety: drops once, never accessed again due to mem::forget
7922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7923        // Prevent Drop from running (which would shut down the channel)
7924        std::mem::forget(self);
7925    }
7926}
7927
7928impl RingBufferStopResponder {
7929    /// Sends a response to the FIDL transaction.
7930    ///
7931    /// Sets the channel to shutdown if an error occurs.
7932    pub fn send(self) -> Result<(), fidl::Error> {
7933        let _result = self.send_raw();
7934        if _result.is_err() {
7935            self.control_handle.shutdown();
7936        }
7937        self.drop_without_shutdown();
7938        _result
7939    }
7940
7941    /// Similar to "send" but does not shutdown the channel if an error occurs.
7942    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7943        let _result = self.send_raw();
7944        self.drop_without_shutdown();
7945        _result
7946    }
7947
7948    fn send_raw(&self) -> Result<(), fidl::Error> {
7949        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7950            (),
7951            self.tx_id,
7952            0x49a73d9cf1d4e110,
7953            fidl::encoding::DynamicFlags::empty(),
7954        )
7955    }
7956}
7957
7958#[must_use = "FIDL methods require a response to be sent"]
7959#[derive(Debug)]
7960pub struct RingBufferSetActiveChannelsResponder {
7961    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
7962    tx_id: u32,
7963}
7964
7965/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
7966/// if the responder is dropped without sending a response, so that the client
7967/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7968impl std::ops::Drop for RingBufferSetActiveChannelsResponder {
7969    fn drop(&mut self) {
7970        self.control_handle.shutdown();
7971        // Safety: drops once, never accessed again
7972        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7973    }
7974}
7975
7976impl fidl::endpoints::Responder for RingBufferSetActiveChannelsResponder {
7977    type ControlHandle = RingBufferControlHandle;
7978
7979    fn control_handle(&self) -> &RingBufferControlHandle {
7980        &self.control_handle
7981    }
7982
7983    fn drop_without_shutdown(mut self) {
7984        // Safety: drops once, never accessed again due to mem::forget
7985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7986        // Prevent Drop from running (which would shut down the channel)
7987        std::mem::forget(self);
7988    }
7989}
7990
7991impl RingBufferSetActiveChannelsResponder {
7992    /// Sends a response to the FIDL transaction.
7993    ///
7994    /// Sets the channel to shutdown if an error occurs.
7995    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
7996        let _result = self.send_raw(result);
7997        if _result.is_err() {
7998            self.control_handle.shutdown();
7999        }
8000        self.drop_without_shutdown();
8001        _result
8002    }
8003
8004    /// Similar to "send" but does not shutdown the channel if an error occurs.
8005    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
8006        let _result = self.send_raw(result);
8007        self.drop_without_shutdown();
8008        _result
8009    }
8010
8011    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
8012        self.control_handle.inner.send::<fidl::encoding::ResultType<
8013            RingBufferSetActiveChannelsResponse,
8014            i32,
8015        >>(
8016            result.map(|set_time| (set_time,)),
8017            self.tx_id,
8018            0x605464c1d384f309,
8019            fidl::encoding::DynamicFlags::empty(),
8020        )
8021    }
8022}
8023
8024#[must_use = "FIDL methods require a response to be sent"]
8025#[derive(Debug)]
8026pub struct RingBufferWatchDelayInfoResponder {
8027    control_handle: std::mem::ManuallyDrop<RingBufferControlHandle>,
8028    tx_id: u32,
8029}
8030
8031/// Set the the channel to be shutdown (see [`RingBufferControlHandle::shutdown`])
8032/// if the responder is dropped without sending a response, so that the client
8033/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8034impl std::ops::Drop for RingBufferWatchDelayInfoResponder {
8035    fn drop(&mut self) {
8036        self.control_handle.shutdown();
8037        // Safety: drops once, never accessed again
8038        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8039    }
8040}
8041
8042impl fidl::endpoints::Responder for RingBufferWatchDelayInfoResponder {
8043    type ControlHandle = RingBufferControlHandle;
8044
8045    fn control_handle(&self) -> &RingBufferControlHandle {
8046        &self.control_handle
8047    }
8048
8049    fn drop_without_shutdown(mut self) {
8050        // Safety: drops once, never accessed again due to mem::forget
8051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8052        // Prevent Drop from running (which would shut down the channel)
8053        std::mem::forget(self);
8054    }
8055}
8056
8057impl RingBufferWatchDelayInfoResponder {
8058    /// Sends a response to the FIDL transaction.
8059    ///
8060    /// Sets the channel to shutdown if an error occurs.
8061    pub fn send(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
8062        let _result = self.send_raw(delay_info);
8063        if _result.is_err() {
8064            self.control_handle.shutdown();
8065        }
8066        self.drop_without_shutdown();
8067        _result
8068    }
8069
8070    /// Similar to "send" but does not shutdown the channel if an error occurs.
8071    pub fn send_no_shutdown_on_err(self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
8072        let _result = self.send_raw(delay_info);
8073        self.drop_without_shutdown();
8074        _result
8075    }
8076
8077    fn send_raw(&self, mut delay_info: &DelayInfo) -> Result<(), fidl::Error> {
8078        self.control_handle
8079            .inner
8080            .send::<fidl::encoding::FlexibleType<RingBufferWatchDelayInfoResponse>>(
8081                fidl::encoding::Flexible::new((delay_info,)),
8082                self.tx_id,
8083                0x6c1248db213fcf9f,
8084                fidl::encoding::DynamicFlags::FLEXIBLE,
8085            )
8086    }
8087}
8088
8089#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8090pub struct StreamConfigMarker;
8091
8092impl fidl::endpoints::ProtocolMarker for StreamConfigMarker {
8093    type Proxy = StreamConfigProxy;
8094    type RequestStream = StreamConfigRequestStream;
8095    #[cfg(target_os = "fuchsia")]
8096    type SynchronousProxy = StreamConfigSynchronousProxy;
8097
8098    const DEBUG_NAME: &'static str = "(anonymous) StreamConfig";
8099}
8100
8101pub trait StreamConfigProxyInterface: Send + Sync {
8102    type GetHealthStateResponseFut: std::future::Future<Output = Result<HealthState, fidl::Error>>
8103        + Send;
8104    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut;
8105    fn r#signal_processing_connect(
8106        &self,
8107        protocol: fidl::endpoints::ServerEnd<
8108            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8109        >,
8110    ) -> Result<(), fidl::Error>;
8111    type GetPropertiesResponseFut: std::future::Future<Output = Result<StreamProperties, fidl::Error>>
8112        + Send;
8113    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut;
8114    type GetSupportedFormatsResponseFut: std::future::Future<Output = Result<Vec<SupportedFormats>, fidl::Error>>
8115        + Send;
8116    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut;
8117    fn r#create_ring_buffer(
8118        &self,
8119        format: &Format,
8120        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8121    ) -> Result<(), fidl::Error>;
8122    type WatchGainStateResponseFut: std::future::Future<Output = Result<GainState, fidl::Error>>
8123        + Send;
8124    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut;
8125    fn r#set_gain(&self, target_state: &GainState) -> Result<(), fidl::Error>;
8126    type WatchPlugStateResponseFut: std::future::Future<Output = Result<PlugState, fidl::Error>>
8127        + Send;
8128    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut;
8129}
8130#[derive(Debug)]
8131#[cfg(target_os = "fuchsia")]
8132pub struct StreamConfigSynchronousProxy {
8133    client: fidl::client::sync::Client,
8134}
8135
8136#[cfg(target_os = "fuchsia")]
8137impl fidl::endpoints::SynchronousProxy for StreamConfigSynchronousProxy {
8138    type Proxy = StreamConfigProxy;
8139    type Protocol = StreamConfigMarker;
8140
8141    fn from_channel(inner: fidl::Channel) -> Self {
8142        Self::new(inner)
8143    }
8144
8145    fn into_channel(self) -> fidl::Channel {
8146        self.client.into_channel()
8147    }
8148
8149    fn as_channel(&self) -> &fidl::Channel {
8150        self.client.as_channel()
8151    }
8152}
8153
8154#[cfg(target_os = "fuchsia")]
8155impl StreamConfigSynchronousProxy {
8156    pub fn new(channel: fidl::Channel) -> Self {
8157        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8158        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8159    }
8160
8161    pub fn into_channel(self) -> fidl::Channel {
8162        self.client.into_channel()
8163    }
8164
8165    /// Waits until an event arrives and returns it. It is safe for other
8166    /// threads to make concurrent requests while waiting for an event.
8167    pub fn wait_for_event(
8168        &self,
8169        deadline: zx::MonotonicInstant,
8170    ) -> Result<StreamConfigEvent, fidl::Error> {
8171        StreamConfigEvent::decode(self.client.wait_for_event(deadline)?)
8172    }
8173
8174    /// Retrieves top level health state.
8175    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8176    pub fn r#get_health_state(
8177        &self,
8178        ___deadline: zx::MonotonicInstant,
8179    ) -> Result<HealthState, fidl::Error> {
8180        let _response =
8181            self.client.send_query::<fidl::encoding::EmptyPayload, HealthGetHealthStateResponse>(
8182                (),
8183                0x4e146d6bca733a84,
8184                fidl::encoding::DynamicFlags::empty(),
8185                ___deadline,
8186            )?;
8187        Ok(_response.state)
8188    }
8189
8190    /// Connect to a `SignalProcessing` protocol.
8191    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8192    /// the maximum number of connections have already been created, for instance one, then the
8193    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8194    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8195    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8196    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8197    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8198    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8199    /// is intended to be composed, and hence the more verbose name allows differentiation and
8200    /// improved clarity.
8201    pub fn r#signal_processing_connect(
8202        &self,
8203        mut protocol: fidl::endpoints::ServerEnd<
8204            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8205        >,
8206    ) -> Result<(), fidl::Error> {
8207        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8208            (protocol,),
8209            0xa81907ce6066295,
8210            fidl::encoding::DynamicFlags::empty(),
8211        )
8212    }
8213
8214    /// Retrieves top level static properties.
8215    pub fn r#get_properties(
8216        &self,
8217        ___deadline: zx::MonotonicInstant,
8218    ) -> Result<StreamProperties, fidl::Error> {
8219        let _response = self
8220            .client
8221            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetPropertiesResponse>(
8222                (),
8223                0x7d89c02f3e2d3c01,
8224                fidl::encoding::DynamicFlags::empty(),
8225                ___deadline,
8226            )?;
8227        Ok(_response.properties)
8228    }
8229
8230    /// Gets formats supported by a given driver. When not all combinations supported by the
8231    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8232    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8233    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8234    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8235    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8236    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8237    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8238    /// <<16bits,32bits>,<48KHz,96KHz>>.
8239    pub fn r#get_supported_formats(
8240        &self,
8241        ___deadline: zx::MonotonicInstant,
8242    ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8243        let _response = self
8244            .client
8245            .send_query::<fidl::encoding::EmptyPayload, StreamConfigGetSupportedFormatsResponse>(
8246                (),
8247                0x448efa7850cafe7e,
8248                fidl::encoding::DynamicFlags::empty(),
8249                ___deadline,
8250            )?;
8251        Ok(_response.supported_formats)
8252    }
8253
8254    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8255    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8256    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8257    /// ring buffer channel had been established and was still active, the driver must close that
8258    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8259    /// operations in the process.
8260    pub fn r#create_ring_buffer(
8261        &self,
8262        mut format: &Format,
8263        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8264    ) -> Result<(), fidl::Error> {
8265        self.client.send::<StreamConfigCreateRingBufferRequest>(
8266            (format, ring_buffer),
8267            0x2afb19dd13faa1ba,
8268            fidl::encoding::DynamicFlags::empty(),
8269        )
8270    }
8271
8272    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8273    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8274    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8275    /// from what was most recently reported.
8276    /// If `WatchGainState` is called for a second time before the first call has completed, then
8277    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8278    pub fn r#watch_gain_state(
8279        &self,
8280        ___deadline: zx::MonotonicInstant,
8281    ) -> Result<GainState, fidl::Error> {
8282        let _response = self
8283            .client
8284            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchGainStateResponse>(
8285                (),
8286                0x4772506136ab65c1,
8287                fidl::encoding::DynamicFlags::empty(),
8288                ___deadline,
8289            )?;
8290        Ok(_response.gain_state)
8291    }
8292
8293    /// Client update of the gain state.
8294    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8295        self.client.send::<StreamConfigSetGainRequest>(
8296            (target_state,),
8297            0x3943b41498c6a384,
8298            fidl::encoding::DynamicFlags::empty(),
8299        )
8300    }
8301
8302    /// Get the plug detect state via a hanging get. The driver will reply to the first
8303    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8304    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8305    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8306    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8307    pub fn r#watch_plug_state(
8308        &self,
8309        ___deadline: zx::MonotonicInstant,
8310    ) -> Result<PlugState, fidl::Error> {
8311        let _response = self
8312            .client
8313            .send_query::<fidl::encoding::EmptyPayload, StreamConfigWatchPlugStateResponse>(
8314                (),
8315                0x497345a6f048b2a6,
8316                fidl::encoding::DynamicFlags::empty(),
8317                ___deadline,
8318            )?;
8319        Ok(_response.plug_state)
8320    }
8321}
8322
8323#[cfg(target_os = "fuchsia")]
8324impl From<StreamConfigSynchronousProxy> for zx::Handle {
8325    fn from(value: StreamConfigSynchronousProxy) -> Self {
8326        value.into_channel().into()
8327    }
8328}
8329
8330#[cfg(target_os = "fuchsia")]
8331impl From<fidl::Channel> for StreamConfigSynchronousProxy {
8332    fn from(value: fidl::Channel) -> Self {
8333        Self::new(value)
8334    }
8335}
8336
8337#[cfg(target_os = "fuchsia")]
8338impl fidl::endpoints::FromClient for StreamConfigSynchronousProxy {
8339    type Protocol = StreamConfigMarker;
8340
8341    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigMarker>) -> Self {
8342        Self::new(value.into_channel())
8343    }
8344}
8345
8346#[derive(Debug, Clone)]
8347pub struct StreamConfigProxy {
8348    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8349}
8350
8351impl fidl::endpoints::Proxy for StreamConfigProxy {
8352    type Protocol = StreamConfigMarker;
8353
8354    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8355        Self::new(inner)
8356    }
8357
8358    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8359        self.client.into_channel().map_err(|client| Self { client })
8360    }
8361
8362    fn as_channel(&self) -> &::fidl::AsyncChannel {
8363        self.client.as_channel()
8364    }
8365}
8366
8367impl StreamConfigProxy {
8368    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfig.
8369    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8370        let protocol_name = <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8371        Self { client: fidl::client::Client::new(channel, protocol_name) }
8372    }
8373
8374    /// Get a Stream of events from the remote end of the protocol.
8375    ///
8376    /// # Panics
8377    ///
8378    /// Panics if the event stream was already taken.
8379    pub fn take_event_stream(&self) -> StreamConfigEventStream {
8380        StreamConfigEventStream { event_receiver: self.client.take_event_receiver() }
8381    }
8382
8383    /// Retrieves top level health state.
8384    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8385    pub fn r#get_health_state(
8386        &self,
8387    ) -> fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>
8388    {
8389        StreamConfigProxyInterface::r#get_health_state(self)
8390    }
8391
8392    /// Connect to a `SignalProcessing` protocol.
8393    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8394    /// the maximum number of connections have already been created, for instance one, then the
8395    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8396    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8397    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8398    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8399    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8400    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8401    /// is intended to be composed, and hence the more verbose name allows differentiation and
8402    /// improved clarity.
8403    pub fn r#signal_processing_connect(
8404        &self,
8405        mut protocol: fidl::endpoints::ServerEnd<
8406            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8407        >,
8408    ) -> Result<(), fidl::Error> {
8409        StreamConfigProxyInterface::r#signal_processing_connect(self, protocol)
8410    }
8411
8412    /// Retrieves top level static properties.
8413    pub fn r#get_properties(
8414        &self,
8415    ) -> fidl::client::QueryResponseFut<
8416        StreamProperties,
8417        fidl::encoding::DefaultFuchsiaResourceDialect,
8418    > {
8419        StreamConfigProxyInterface::r#get_properties(self)
8420    }
8421
8422    /// Gets formats supported by a given driver. When not all combinations supported by the
8423    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8424    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8425    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8426    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8427    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8428    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8429    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8430    /// <<16bits,32bits>,<48KHz,96KHz>>.
8431    pub fn r#get_supported_formats(
8432        &self,
8433    ) -> fidl::client::QueryResponseFut<
8434        Vec<SupportedFormats>,
8435        fidl::encoding::DefaultFuchsiaResourceDialect,
8436    > {
8437        StreamConfigProxyInterface::r#get_supported_formats(self)
8438    }
8439
8440    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8441    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8442    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8443    /// ring buffer channel had been established and was still active, the driver must close that
8444    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8445    /// operations in the process.
8446    pub fn r#create_ring_buffer(
8447        &self,
8448        mut format: &Format,
8449        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8450    ) -> Result<(), fidl::Error> {
8451        StreamConfigProxyInterface::r#create_ring_buffer(self, format, ring_buffer)
8452    }
8453
8454    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8455    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8456    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8457    /// from what was most recently reported.
8458    /// If `WatchGainState` is called for a second time before the first call has completed, then
8459    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8460    pub fn r#watch_gain_state(
8461        &self,
8462    ) -> fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>
8463    {
8464        StreamConfigProxyInterface::r#watch_gain_state(self)
8465    }
8466
8467    /// Client update of the gain state.
8468    pub fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8469        StreamConfigProxyInterface::r#set_gain(self, target_state)
8470    }
8471
8472    /// Get the plug detect state via a hanging get. The driver will reply to the first
8473    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8474    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8475    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8476    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8477    pub fn r#watch_plug_state(
8478        &self,
8479    ) -> fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>
8480    {
8481        StreamConfigProxyInterface::r#watch_plug_state(self)
8482    }
8483}
8484
8485impl StreamConfigProxyInterface for StreamConfigProxy {
8486    type GetHealthStateResponseFut =
8487        fidl::client::QueryResponseFut<HealthState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8488    fn r#get_health_state(&self) -> Self::GetHealthStateResponseFut {
8489        fn _decode(
8490            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8491        ) -> Result<HealthState, fidl::Error> {
8492            let _response = fidl::client::decode_transaction_body::<
8493                HealthGetHealthStateResponse,
8494                fidl::encoding::DefaultFuchsiaResourceDialect,
8495                0x4e146d6bca733a84,
8496            >(_buf?)?;
8497            Ok(_response.state)
8498        }
8499        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HealthState>(
8500            (),
8501            0x4e146d6bca733a84,
8502            fidl::encoding::DynamicFlags::empty(),
8503            _decode,
8504        )
8505    }
8506
8507    fn r#signal_processing_connect(
8508        &self,
8509        mut protocol: fidl::endpoints::ServerEnd<
8510            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8511        >,
8512    ) -> Result<(), fidl::Error> {
8513        self.client.send::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(
8514            (protocol,),
8515            0xa81907ce6066295,
8516            fidl::encoding::DynamicFlags::empty(),
8517        )
8518    }
8519
8520    type GetPropertiesResponseFut = fidl::client::QueryResponseFut<
8521        StreamProperties,
8522        fidl::encoding::DefaultFuchsiaResourceDialect,
8523    >;
8524    fn r#get_properties(&self) -> Self::GetPropertiesResponseFut {
8525        fn _decode(
8526            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8527        ) -> Result<StreamProperties, fidl::Error> {
8528            let _response = fidl::client::decode_transaction_body::<
8529                StreamConfigGetPropertiesResponse,
8530                fidl::encoding::DefaultFuchsiaResourceDialect,
8531                0x7d89c02f3e2d3c01,
8532            >(_buf?)?;
8533            Ok(_response.properties)
8534        }
8535        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, StreamProperties>(
8536            (),
8537            0x7d89c02f3e2d3c01,
8538            fidl::encoding::DynamicFlags::empty(),
8539            _decode,
8540        )
8541    }
8542
8543    type GetSupportedFormatsResponseFut = fidl::client::QueryResponseFut<
8544        Vec<SupportedFormats>,
8545        fidl::encoding::DefaultFuchsiaResourceDialect,
8546    >;
8547    fn r#get_supported_formats(&self) -> Self::GetSupportedFormatsResponseFut {
8548        fn _decode(
8549            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8550        ) -> Result<Vec<SupportedFormats>, fidl::Error> {
8551            let _response = fidl::client::decode_transaction_body::<
8552                StreamConfigGetSupportedFormatsResponse,
8553                fidl::encoding::DefaultFuchsiaResourceDialect,
8554                0x448efa7850cafe7e,
8555            >(_buf?)?;
8556            Ok(_response.supported_formats)
8557        }
8558        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<SupportedFormats>>(
8559            (),
8560            0x448efa7850cafe7e,
8561            fidl::encoding::DynamicFlags::empty(),
8562            _decode,
8563        )
8564    }
8565
8566    fn r#create_ring_buffer(
8567        &self,
8568        mut format: &Format,
8569        mut ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8570    ) -> Result<(), fidl::Error> {
8571        self.client.send::<StreamConfigCreateRingBufferRequest>(
8572            (format, ring_buffer),
8573            0x2afb19dd13faa1ba,
8574            fidl::encoding::DynamicFlags::empty(),
8575        )
8576    }
8577
8578    type WatchGainStateResponseFut =
8579        fidl::client::QueryResponseFut<GainState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8580    fn r#watch_gain_state(&self) -> Self::WatchGainStateResponseFut {
8581        fn _decode(
8582            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8583        ) -> Result<GainState, fidl::Error> {
8584            let _response = fidl::client::decode_transaction_body::<
8585                StreamConfigWatchGainStateResponse,
8586                fidl::encoding::DefaultFuchsiaResourceDialect,
8587                0x4772506136ab65c1,
8588            >(_buf?)?;
8589            Ok(_response.gain_state)
8590        }
8591        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GainState>(
8592            (),
8593            0x4772506136ab65c1,
8594            fidl::encoding::DynamicFlags::empty(),
8595            _decode,
8596        )
8597    }
8598
8599    fn r#set_gain(&self, mut target_state: &GainState) -> Result<(), fidl::Error> {
8600        self.client.send::<StreamConfigSetGainRequest>(
8601            (target_state,),
8602            0x3943b41498c6a384,
8603            fidl::encoding::DynamicFlags::empty(),
8604        )
8605    }
8606
8607    type WatchPlugStateResponseFut =
8608        fidl::client::QueryResponseFut<PlugState, fidl::encoding::DefaultFuchsiaResourceDialect>;
8609    fn r#watch_plug_state(&self) -> Self::WatchPlugStateResponseFut {
8610        fn _decode(
8611            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8612        ) -> Result<PlugState, fidl::Error> {
8613            let _response = fidl::client::decode_transaction_body::<
8614                StreamConfigWatchPlugStateResponse,
8615                fidl::encoding::DefaultFuchsiaResourceDialect,
8616                0x497345a6f048b2a6,
8617            >(_buf?)?;
8618            Ok(_response.plug_state)
8619        }
8620        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlugState>(
8621            (),
8622            0x497345a6f048b2a6,
8623            fidl::encoding::DynamicFlags::empty(),
8624            _decode,
8625        )
8626    }
8627}
8628
8629pub struct StreamConfigEventStream {
8630    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8631}
8632
8633impl std::marker::Unpin for StreamConfigEventStream {}
8634
8635impl futures::stream::FusedStream for StreamConfigEventStream {
8636    fn is_terminated(&self) -> bool {
8637        self.event_receiver.is_terminated()
8638    }
8639}
8640
8641impl futures::Stream for StreamConfigEventStream {
8642    type Item = Result<StreamConfigEvent, fidl::Error>;
8643
8644    fn poll_next(
8645        mut self: std::pin::Pin<&mut Self>,
8646        cx: &mut std::task::Context<'_>,
8647    ) -> std::task::Poll<Option<Self::Item>> {
8648        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8649            &mut self.event_receiver,
8650            cx
8651        )?) {
8652            Some(buf) => std::task::Poll::Ready(Some(StreamConfigEvent::decode(buf))),
8653            None => std::task::Poll::Ready(None),
8654        }
8655    }
8656}
8657
8658#[derive(Debug)]
8659pub enum StreamConfigEvent {}
8660
8661impl StreamConfigEvent {
8662    /// Decodes a message buffer as a [`StreamConfigEvent`].
8663    fn decode(
8664        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8665    ) -> Result<StreamConfigEvent, fidl::Error> {
8666        let (bytes, _handles) = buf.split_mut();
8667        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8668        debug_assert_eq!(tx_header.tx_id, 0);
8669        match tx_header.ordinal {
8670            _ => Err(fidl::Error::UnknownOrdinal {
8671                ordinal: tx_header.ordinal,
8672                protocol_name: <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8673            }),
8674        }
8675    }
8676}
8677
8678/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfig.
8679pub struct StreamConfigRequestStream {
8680    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8681    is_terminated: bool,
8682}
8683
8684impl std::marker::Unpin for StreamConfigRequestStream {}
8685
8686impl futures::stream::FusedStream for StreamConfigRequestStream {
8687    fn is_terminated(&self) -> bool {
8688        self.is_terminated
8689    }
8690}
8691
8692impl fidl::endpoints::RequestStream for StreamConfigRequestStream {
8693    type Protocol = StreamConfigMarker;
8694    type ControlHandle = StreamConfigControlHandle;
8695
8696    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8697        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8698    }
8699
8700    fn control_handle(&self) -> Self::ControlHandle {
8701        StreamConfigControlHandle { inner: self.inner.clone() }
8702    }
8703
8704    fn into_inner(
8705        self,
8706    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8707    {
8708        (self.inner, self.is_terminated)
8709    }
8710
8711    fn from_inner(
8712        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8713        is_terminated: bool,
8714    ) -> Self {
8715        Self { inner, is_terminated }
8716    }
8717}
8718
8719impl futures::Stream for StreamConfigRequestStream {
8720    type Item = Result<StreamConfigRequest, fidl::Error>;
8721
8722    fn poll_next(
8723        mut self: std::pin::Pin<&mut Self>,
8724        cx: &mut std::task::Context<'_>,
8725    ) -> std::task::Poll<Option<Self::Item>> {
8726        let this = &mut *self;
8727        if this.inner.check_shutdown(cx) {
8728            this.is_terminated = true;
8729            return std::task::Poll::Ready(None);
8730        }
8731        if this.is_terminated {
8732            panic!("polled StreamConfigRequestStream after completion");
8733        }
8734        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8735            |bytes, handles| {
8736                match this.inner.channel().read_etc(cx, bytes, handles) {
8737                    std::task::Poll::Ready(Ok(())) => {}
8738                    std::task::Poll::Pending => return std::task::Poll::Pending,
8739                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8740                        this.is_terminated = true;
8741                        return std::task::Poll::Ready(None);
8742                    }
8743                    std::task::Poll::Ready(Err(e)) => {
8744                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8745                            e.into(),
8746                        ))))
8747                    }
8748                }
8749
8750                // A message has been received from the channel
8751                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8752
8753                std::task::Poll::Ready(Some(match header.ordinal {
8754                    0x4e146d6bca733a84 => {
8755                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8756                        let mut req = fidl::new_empty!(
8757                            fidl::encoding::EmptyPayload,
8758                            fidl::encoding::DefaultFuchsiaResourceDialect
8759                        );
8760                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8761                        let control_handle =
8762                            StreamConfigControlHandle { inner: this.inner.clone() };
8763                        Ok(StreamConfigRequest::GetHealthState {
8764                            responder: StreamConfigGetHealthStateResponder {
8765                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8766                                tx_id: header.tx_id,
8767                            },
8768                        })
8769                    }
8770                    0xa81907ce6066295 => {
8771                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8772                        let mut req = fidl::new_empty!(fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8773                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_hardware_audio_signalprocessing::ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8774                        let control_handle =
8775                            StreamConfigControlHandle { inner: this.inner.clone() };
8776                        Ok(StreamConfigRequest::SignalProcessingConnect {
8777                            protocol: req.protocol,
8778
8779                            control_handle,
8780                        })
8781                    }
8782                    0x7d89c02f3e2d3c01 => {
8783                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8784                        let mut req = fidl::new_empty!(
8785                            fidl::encoding::EmptyPayload,
8786                            fidl::encoding::DefaultFuchsiaResourceDialect
8787                        );
8788                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8789                        let control_handle =
8790                            StreamConfigControlHandle { inner: this.inner.clone() };
8791                        Ok(StreamConfigRequest::GetProperties {
8792                            responder: StreamConfigGetPropertiesResponder {
8793                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8794                                tx_id: header.tx_id,
8795                            },
8796                        })
8797                    }
8798                    0x448efa7850cafe7e => {
8799                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8800                        let mut req = fidl::new_empty!(
8801                            fidl::encoding::EmptyPayload,
8802                            fidl::encoding::DefaultFuchsiaResourceDialect
8803                        );
8804                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8805                        let control_handle =
8806                            StreamConfigControlHandle { inner: this.inner.clone() };
8807                        Ok(StreamConfigRequest::GetSupportedFormats {
8808                            responder: StreamConfigGetSupportedFormatsResponder {
8809                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8810                                tx_id: header.tx_id,
8811                            },
8812                        })
8813                    }
8814                    0x2afb19dd13faa1ba => {
8815                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8816                        let mut req = fidl::new_empty!(
8817                            StreamConfigCreateRingBufferRequest,
8818                            fidl::encoding::DefaultFuchsiaResourceDialect
8819                        );
8820                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigCreateRingBufferRequest>(&header, _body_bytes, handles, &mut req)?;
8821                        let control_handle =
8822                            StreamConfigControlHandle { inner: this.inner.clone() };
8823                        Ok(StreamConfigRequest::CreateRingBuffer {
8824                            format: req.format,
8825                            ring_buffer: req.ring_buffer,
8826
8827                            control_handle,
8828                        })
8829                    }
8830                    0x4772506136ab65c1 => {
8831                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8832                        let mut req = fidl::new_empty!(
8833                            fidl::encoding::EmptyPayload,
8834                            fidl::encoding::DefaultFuchsiaResourceDialect
8835                        );
8836                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8837                        let control_handle =
8838                            StreamConfigControlHandle { inner: this.inner.clone() };
8839                        Ok(StreamConfigRequest::WatchGainState {
8840                            responder: StreamConfigWatchGainStateResponder {
8841                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8842                                tx_id: header.tx_id,
8843                            },
8844                        })
8845                    }
8846                    0x3943b41498c6a384 => {
8847                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8848                        let mut req = fidl::new_empty!(
8849                            StreamConfigSetGainRequest,
8850                            fidl::encoding::DefaultFuchsiaResourceDialect
8851                        );
8852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigSetGainRequest>(&header, _body_bytes, handles, &mut req)?;
8853                        let control_handle =
8854                            StreamConfigControlHandle { inner: this.inner.clone() };
8855                        Ok(StreamConfigRequest::SetGain {
8856                            target_state: req.target_state,
8857
8858                            control_handle,
8859                        })
8860                    }
8861                    0x497345a6f048b2a6 => {
8862                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8863                        let mut req = fidl::new_empty!(
8864                            fidl::encoding::EmptyPayload,
8865                            fidl::encoding::DefaultFuchsiaResourceDialect
8866                        );
8867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8868                        let control_handle =
8869                            StreamConfigControlHandle { inner: this.inner.clone() };
8870                        Ok(StreamConfigRequest::WatchPlugState {
8871                            responder: StreamConfigWatchPlugStateResponder {
8872                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8873                                tx_id: header.tx_id,
8874                            },
8875                        })
8876                    }
8877                    _ => Err(fidl::Error::UnknownOrdinal {
8878                        ordinal: header.ordinal,
8879                        protocol_name:
8880                            <StreamConfigMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8881                    }),
8882                }))
8883            },
8884        )
8885    }
8886}
8887
8888/// For an overview see
8889/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming)
8890/// # Deprecation
8891///
8892/// Not supported anymore, instead use an
8893/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
8894/// with one Ring Buffer, see
8895/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
8896#[derive(Debug)]
8897pub enum StreamConfigRequest {
8898    /// Retrieves top level health state.
8899    /// A driver not responding promptly can be used as an indication of an unhealthy driver.
8900    GetHealthState { responder: StreamConfigGetHealthStateResponder },
8901    /// Connect to a `SignalProcessing` protocol.
8902    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
8903    /// the maximum number of connections have already been created, for instance one, then the
8904    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
8905    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
8906    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
8907    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
8908    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
8909    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
8910    /// is intended to be composed, and hence the more verbose name allows differentiation and
8911    /// improved clarity.
8912    SignalProcessingConnect {
8913        protocol: fidl::endpoints::ServerEnd<
8914            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8915        >,
8916        control_handle: StreamConfigControlHandle,
8917    },
8918    /// Retrieves top level static properties.
8919    GetProperties { responder: StreamConfigGetPropertiesResponder },
8920    /// Gets formats supported by a given driver. When not all combinations supported by the
8921    /// driver can be described with one `SupportedFormats`, the driver returns more than one
8922    /// `SupportedFormats` in the returned vector. For example, if one `SupportedFormats` allows
8923    /// for 32 bits samples at 48KHz, and 16 bits samples at 96KHz, but not 32 bits samples at
8924    /// 96KHz, then the driver replies with 2 `SupportedFormats`: <<32bits>,<48KHz>> and
8925    /// <<16bits>,<96KHz>>. For simplicity, this example ignores parameters other than rate and
8926    /// bits per sample. In the case where the driver supports either 16 or 32 bits samples at
8927    /// either 48 or 96KHz, the driver would reply with 1 `SupportedFormats`:
8928    /// <<16bits,32bits>,<48KHz,96KHz>>.
8929    GetSupportedFormats { responder: StreamConfigGetSupportedFormatsResponder },
8930    /// `CreateRingBuffer` is sent by clients to select a stream format based on information that
8931    /// the driver provides in `GetSupportedFormats` what is supported by the client, and any other
8932    /// requirement. The `ring_buffer` channel is used to control the audio buffer, if a previous
8933    /// ring buffer channel had been established and was still active, the driver must close that
8934    /// (ring buffer) channel and make every attempt to gracefully quiesce any on-going streaming
8935    /// operations in the process.
8936    CreateRingBuffer {
8937        format: Format,
8938        ring_buffer: fidl::endpoints::ServerEnd<RingBufferMarker>,
8939        control_handle: StreamConfigControlHandle,
8940    },
8941    /// Get the gain state via a hanging get. The driver will reply to the first `WatchGainState`
8942    /// sent by the client and this reply must include a `gain_db` set to 0dB or lower. The driver
8943    /// will not respond to subsequent client `WatchGainState` calls until the gain state changes
8944    /// from what was most recently reported.
8945    /// If `WatchGainState` is called for a second time before the first call has completed, then
8946    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8947    WatchGainState { responder: StreamConfigWatchGainStateResponder },
8948    /// Client update of the gain state.
8949    SetGain { target_state: GainState, control_handle: StreamConfigControlHandle },
8950    /// Get the plug detect state via a hanging get. The driver will reply to the first
8951    /// `WatchPlugState` sent by the client. The driver will not respond to subsequent client
8952    /// `WatchPlugState` calls until the plug state changes from what was most recently reported.
8953    /// If `WatchPlugState` is called for a second time before the first call has completed, then
8954    /// the protocol channel must be closed with the error `ZX_ERR_BAD_STATE`.
8955    WatchPlugState { responder: StreamConfigWatchPlugStateResponder },
8956}
8957
8958impl StreamConfigRequest {
8959    #[allow(irrefutable_let_patterns)]
8960    pub fn into_get_health_state(self) -> Option<(StreamConfigGetHealthStateResponder)> {
8961        if let StreamConfigRequest::GetHealthState { responder } = self {
8962            Some((responder))
8963        } else {
8964            None
8965        }
8966    }
8967
8968    #[allow(irrefutable_let_patterns)]
8969    pub fn into_signal_processing_connect(
8970        self,
8971    ) -> Option<(
8972        fidl::endpoints::ServerEnd<
8973            fidl_fuchsia_hardware_audio_signalprocessing::SignalProcessingMarker,
8974        >,
8975        StreamConfigControlHandle,
8976    )> {
8977        if let StreamConfigRequest::SignalProcessingConnect { protocol, control_handle } = self {
8978            Some((protocol, control_handle))
8979        } else {
8980            None
8981        }
8982    }
8983
8984    #[allow(irrefutable_let_patterns)]
8985    pub fn into_get_properties(self) -> Option<(StreamConfigGetPropertiesResponder)> {
8986        if let StreamConfigRequest::GetProperties { responder } = self {
8987            Some((responder))
8988        } else {
8989            None
8990        }
8991    }
8992
8993    #[allow(irrefutable_let_patterns)]
8994    pub fn into_get_supported_formats(self) -> Option<(StreamConfigGetSupportedFormatsResponder)> {
8995        if let StreamConfigRequest::GetSupportedFormats { responder } = self {
8996            Some((responder))
8997        } else {
8998            None
8999        }
9000    }
9001
9002    #[allow(irrefutable_let_patterns)]
9003    pub fn into_create_ring_buffer(
9004        self,
9005    ) -> Option<(Format, fidl::endpoints::ServerEnd<RingBufferMarker>, StreamConfigControlHandle)>
9006    {
9007        if let StreamConfigRequest::CreateRingBuffer { format, ring_buffer, control_handle } = self
9008        {
9009            Some((format, ring_buffer, control_handle))
9010        } else {
9011            None
9012        }
9013    }
9014
9015    #[allow(irrefutable_let_patterns)]
9016    pub fn into_watch_gain_state(self) -> Option<(StreamConfigWatchGainStateResponder)> {
9017        if let StreamConfigRequest::WatchGainState { responder } = self {
9018            Some((responder))
9019        } else {
9020            None
9021        }
9022    }
9023
9024    #[allow(irrefutable_let_patterns)]
9025    pub fn into_set_gain(self) -> Option<(GainState, StreamConfigControlHandle)> {
9026        if let StreamConfigRequest::SetGain { target_state, control_handle } = self {
9027            Some((target_state, control_handle))
9028        } else {
9029            None
9030        }
9031    }
9032
9033    #[allow(irrefutable_let_patterns)]
9034    pub fn into_watch_plug_state(self) -> Option<(StreamConfigWatchPlugStateResponder)> {
9035        if let StreamConfigRequest::WatchPlugState { responder } = self {
9036            Some((responder))
9037        } else {
9038            None
9039        }
9040    }
9041
9042    /// Name of the method defined in FIDL
9043    pub fn method_name(&self) -> &'static str {
9044        match *self {
9045            StreamConfigRequest::GetHealthState { .. } => "get_health_state",
9046            StreamConfigRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
9047            StreamConfigRequest::GetProperties { .. } => "get_properties",
9048            StreamConfigRequest::GetSupportedFormats { .. } => "get_supported_formats",
9049            StreamConfigRequest::CreateRingBuffer { .. } => "create_ring_buffer",
9050            StreamConfigRequest::WatchGainState { .. } => "watch_gain_state",
9051            StreamConfigRequest::SetGain { .. } => "set_gain",
9052            StreamConfigRequest::WatchPlugState { .. } => "watch_plug_state",
9053        }
9054    }
9055}
9056
9057#[derive(Debug, Clone)]
9058pub struct StreamConfigControlHandle {
9059    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9060}
9061
9062impl fidl::endpoints::ControlHandle for StreamConfigControlHandle {
9063    fn shutdown(&self) {
9064        self.inner.shutdown()
9065    }
9066    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9067        self.inner.shutdown_with_epitaph(status)
9068    }
9069
9070    fn is_closed(&self) -> bool {
9071        self.inner.channel().is_closed()
9072    }
9073    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9074        self.inner.channel().on_closed()
9075    }
9076
9077    #[cfg(target_os = "fuchsia")]
9078    fn signal_peer(
9079        &self,
9080        clear_mask: zx::Signals,
9081        set_mask: zx::Signals,
9082    ) -> Result<(), zx_status::Status> {
9083        use fidl::Peered;
9084        self.inner.channel().signal_peer(clear_mask, set_mask)
9085    }
9086}
9087
9088impl StreamConfigControlHandle {}
9089
9090#[must_use = "FIDL methods require a response to be sent"]
9091#[derive(Debug)]
9092pub struct StreamConfigGetHealthStateResponder {
9093    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9094    tx_id: u32,
9095}
9096
9097/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9098/// if the responder is dropped without sending a response, so that the client
9099/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9100impl std::ops::Drop for StreamConfigGetHealthStateResponder {
9101    fn drop(&mut self) {
9102        self.control_handle.shutdown();
9103        // Safety: drops once, never accessed again
9104        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9105    }
9106}
9107
9108impl fidl::endpoints::Responder for StreamConfigGetHealthStateResponder {
9109    type ControlHandle = StreamConfigControlHandle;
9110
9111    fn control_handle(&self) -> &StreamConfigControlHandle {
9112        &self.control_handle
9113    }
9114
9115    fn drop_without_shutdown(mut self) {
9116        // Safety: drops once, never accessed again due to mem::forget
9117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9118        // Prevent Drop from running (which would shut down the channel)
9119        std::mem::forget(self);
9120    }
9121}
9122
9123impl StreamConfigGetHealthStateResponder {
9124    /// Sends a response to the FIDL transaction.
9125    ///
9126    /// Sets the channel to shutdown if an error occurs.
9127    pub fn send(self, mut state: &HealthState) -> Result<(), fidl::Error> {
9128        let _result = self.send_raw(state);
9129        if _result.is_err() {
9130            self.control_handle.shutdown();
9131        }
9132        self.drop_without_shutdown();
9133        _result
9134    }
9135
9136    /// Similar to "send" but does not shutdown the channel if an error occurs.
9137    pub fn send_no_shutdown_on_err(self, mut state: &HealthState) -> Result<(), fidl::Error> {
9138        let _result = self.send_raw(state);
9139        self.drop_without_shutdown();
9140        _result
9141    }
9142
9143    fn send_raw(&self, mut state: &HealthState) -> Result<(), fidl::Error> {
9144        self.control_handle.inner.send::<HealthGetHealthStateResponse>(
9145            (state,),
9146            self.tx_id,
9147            0x4e146d6bca733a84,
9148            fidl::encoding::DynamicFlags::empty(),
9149        )
9150    }
9151}
9152
9153#[must_use = "FIDL methods require a response to be sent"]
9154#[derive(Debug)]
9155pub struct StreamConfigGetPropertiesResponder {
9156    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9157    tx_id: u32,
9158}
9159
9160/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9161/// if the responder is dropped without sending a response, so that the client
9162/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9163impl std::ops::Drop for StreamConfigGetPropertiesResponder {
9164    fn drop(&mut self) {
9165        self.control_handle.shutdown();
9166        // Safety: drops once, never accessed again
9167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9168    }
9169}
9170
9171impl fidl::endpoints::Responder for StreamConfigGetPropertiesResponder {
9172    type ControlHandle = StreamConfigControlHandle;
9173
9174    fn control_handle(&self) -> &StreamConfigControlHandle {
9175        &self.control_handle
9176    }
9177
9178    fn drop_without_shutdown(mut self) {
9179        // Safety: drops once, never accessed again due to mem::forget
9180        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9181        // Prevent Drop from running (which would shut down the channel)
9182        std::mem::forget(self);
9183    }
9184}
9185
9186impl StreamConfigGetPropertiesResponder {
9187    /// Sends a response to the FIDL transaction.
9188    ///
9189    /// Sets the channel to shutdown if an error occurs.
9190    pub fn send(self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
9191        let _result = self.send_raw(properties);
9192        if _result.is_err() {
9193            self.control_handle.shutdown();
9194        }
9195        self.drop_without_shutdown();
9196        _result
9197    }
9198
9199    /// Similar to "send" but does not shutdown the channel if an error occurs.
9200    pub fn send_no_shutdown_on_err(
9201        self,
9202        mut properties: &StreamProperties,
9203    ) -> Result<(), fidl::Error> {
9204        let _result = self.send_raw(properties);
9205        self.drop_without_shutdown();
9206        _result
9207    }
9208
9209    fn send_raw(&self, mut properties: &StreamProperties) -> Result<(), fidl::Error> {
9210        self.control_handle.inner.send::<StreamConfigGetPropertiesResponse>(
9211            (properties,),
9212            self.tx_id,
9213            0x7d89c02f3e2d3c01,
9214            fidl::encoding::DynamicFlags::empty(),
9215        )
9216    }
9217}
9218
9219#[must_use = "FIDL methods require a response to be sent"]
9220#[derive(Debug)]
9221pub struct StreamConfigGetSupportedFormatsResponder {
9222    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9223    tx_id: u32,
9224}
9225
9226/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9227/// if the responder is dropped without sending a response, so that the client
9228/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9229impl std::ops::Drop for StreamConfigGetSupportedFormatsResponder {
9230    fn drop(&mut self) {
9231        self.control_handle.shutdown();
9232        // Safety: drops once, never accessed again
9233        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9234    }
9235}
9236
9237impl fidl::endpoints::Responder for StreamConfigGetSupportedFormatsResponder {
9238    type ControlHandle = StreamConfigControlHandle;
9239
9240    fn control_handle(&self) -> &StreamConfigControlHandle {
9241        &self.control_handle
9242    }
9243
9244    fn drop_without_shutdown(mut self) {
9245        // Safety: drops once, never accessed again due to mem::forget
9246        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9247        // Prevent Drop from running (which would shut down the channel)
9248        std::mem::forget(self);
9249    }
9250}
9251
9252impl StreamConfigGetSupportedFormatsResponder {
9253    /// Sends a response to the FIDL transaction.
9254    ///
9255    /// Sets the channel to shutdown if an error occurs.
9256    pub fn send(self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9257        let _result = self.send_raw(supported_formats);
9258        if _result.is_err() {
9259            self.control_handle.shutdown();
9260        }
9261        self.drop_without_shutdown();
9262        _result
9263    }
9264
9265    /// Similar to "send" but does not shutdown the channel if an error occurs.
9266    pub fn send_no_shutdown_on_err(
9267        self,
9268        mut supported_formats: &[SupportedFormats],
9269    ) -> Result<(), fidl::Error> {
9270        let _result = self.send_raw(supported_formats);
9271        self.drop_without_shutdown();
9272        _result
9273    }
9274
9275    fn send_raw(&self, mut supported_formats: &[SupportedFormats]) -> Result<(), fidl::Error> {
9276        self.control_handle.inner.send::<StreamConfigGetSupportedFormatsResponse>(
9277            (supported_formats,),
9278            self.tx_id,
9279            0x448efa7850cafe7e,
9280            fidl::encoding::DynamicFlags::empty(),
9281        )
9282    }
9283}
9284
9285#[must_use = "FIDL methods require a response to be sent"]
9286#[derive(Debug)]
9287pub struct StreamConfigWatchGainStateResponder {
9288    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9289    tx_id: u32,
9290}
9291
9292/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9293/// if the responder is dropped without sending a response, so that the client
9294/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9295impl std::ops::Drop for StreamConfigWatchGainStateResponder {
9296    fn drop(&mut self) {
9297        self.control_handle.shutdown();
9298        // Safety: drops once, never accessed again
9299        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9300    }
9301}
9302
9303impl fidl::endpoints::Responder for StreamConfigWatchGainStateResponder {
9304    type ControlHandle = StreamConfigControlHandle;
9305
9306    fn control_handle(&self) -> &StreamConfigControlHandle {
9307        &self.control_handle
9308    }
9309
9310    fn drop_without_shutdown(mut self) {
9311        // Safety: drops once, never accessed again due to mem::forget
9312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9313        // Prevent Drop from running (which would shut down the channel)
9314        std::mem::forget(self);
9315    }
9316}
9317
9318impl StreamConfigWatchGainStateResponder {
9319    /// Sends a response to the FIDL transaction.
9320    ///
9321    /// Sets the channel to shutdown if an error occurs.
9322    pub fn send(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9323        let _result = self.send_raw(gain_state);
9324        if _result.is_err() {
9325            self.control_handle.shutdown();
9326        }
9327        self.drop_without_shutdown();
9328        _result
9329    }
9330
9331    /// Similar to "send" but does not shutdown the channel if an error occurs.
9332    pub fn send_no_shutdown_on_err(self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9333        let _result = self.send_raw(gain_state);
9334        self.drop_without_shutdown();
9335        _result
9336    }
9337
9338    fn send_raw(&self, mut gain_state: &GainState) -> Result<(), fidl::Error> {
9339        self.control_handle.inner.send::<StreamConfigWatchGainStateResponse>(
9340            (gain_state,),
9341            self.tx_id,
9342            0x4772506136ab65c1,
9343            fidl::encoding::DynamicFlags::empty(),
9344        )
9345    }
9346}
9347
9348#[must_use = "FIDL methods require a response to be sent"]
9349#[derive(Debug)]
9350pub struct StreamConfigWatchPlugStateResponder {
9351    control_handle: std::mem::ManuallyDrop<StreamConfigControlHandle>,
9352    tx_id: u32,
9353}
9354
9355/// Set the the channel to be shutdown (see [`StreamConfigControlHandle::shutdown`])
9356/// if the responder is dropped without sending a response, so that the client
9357/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9358impl std::ops::Drop for StreamConfigWatchPlugStateResponder {
9359    fn drop(&mut self) {
9360        self.control_handle.shutdown();
9361        // Safety: drops once, never accessed again
9362        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9363    }
9364}
9365
9366impl fidl::endpoints::Responder for StreamConfigWatchPlugStateResponder {
9367    type ControlHandle = StreamConfigControlHandle;
9368
9369    fn control_handle(&self) -> &StreamConfigControlHandle {
9370        &self.control_handle
9371    }
9372
9373    fn drop_without_shutdown(mut self) {
9374        // Safety: drops once, never accessed again due to mem::forget
9375        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9376        // Prevent Drop from running (which would shut down the channel)
9377        std::mem::forget(self);
9378    }
9379}
9380
9381impl StreamConfigWatchPlugStateResponder {
9382    /// Sends a response to the FIDL transaction.
9383    ///
9384    /// Sets the channel to shutdown if an error occurs.
9385    pub fn send(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9386        let _result = self.send_raw(plug_state);
9387        if _result.is_err() {
9388            self.control_handle.shutdown();
9389        }
9390        self.drop_without_shutdown();
9391        _result
9392    }
9393
9394    /// Similar to "send" but does not shutdown the channel if an error occurs.
9395    pub fn send_no_shutdown_on_err(self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9396        let _result = self.send_raw(plug_state);
9397        self.drop_without_shutdown();
9398        _result
9399    }
9400
9401    fn send_raw(&self, mut plug_state: &PlugState) -> Result<(), fidl::Error> {
9402        self.control_handle.inner.send::<StreamConfigWatchPlugStateResponse>(
9403            (plug_state,),
9404            self.tx_id,
9405            0x497345a6f048b2a6,
9406            fidl::encoding::DynamicFlags::empty(),
9407        )
9408    }
9409}
9410
9411#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9412pub struct StreamConfigConnectorMarker;
9413
9414impl fidl::endpoints::ProtocolMarker for StreamConfigConnectorMarker {
9415    type Proxy = StreamConfigConnectorProxy;
9416    type RequestStream = StreamConfigConnectorRequestStream;
9417    #[cfg(target_os = "fuchsia")]
9418    type SynchronousProxy = StreamConfigConnectorSynchronousProxy;
9419
9420    const DEBUG_NAME: &'static str = "(anonymous) StreamConfigConnector";
9421}
9422
9423pub trait StreamConfigConnectorProxyInterface: Send + Sync {
9424    fn r#connect(
9425        &self,
9426        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9427    ) -> Result<(), fidl::Error>;
9428}
9429#[derive(Debug)]
9430#[cfg(target_os = "fuchsia")]
9431pub struct StreamConfigConnectorSynchronousProxy {
9432    client: fidl::client::sync::Client,
9433}
9434
9435#[cfg(target_os = "fuchsia")]
9436impl fidl::endpoints::SynchronousProxy for StreamConfigConnectorSynchronousProxy {
9437    type Proxy = StreamConfigConnectorProxy;
9438    type Protocol = StreamConfigConnectorMarker;
9439
9440    fn from_channel(inner: fidl::Channel) -> Self {
9441        Self::new(inner)
9442    }
9443
9444    fn into_channel(self) -> fidl::Channel {
9445        self.client.into_channel()
9446    }
9447
9448    fn as_channel(&self) -> &fidl::Channel {
9449        self.client.as_channel()
9450    }
9451}
9452
9453#[cfg(target_os = "fuchsia")]
9454impl StreamConfigConnectorSynchronousProxy {
9455    pub fn new(channel: fidl::Channel) -> Self {
9456        let protocol_name =
9457            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9458        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9459    }
9460
9461    pub fn into_channel(self) -> fidl::Channel {
9462        self.client.into_channel()
9463    }
9464
9465    /// Waits until an event arrives and returns it. It is safe for other
9466    /// threads to make concurrent requests while waiting for an event.
9467    pub fn wait_for_event(
9468        &self,
9469        deadline: zx::MonotonicInstant,
9470    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9471        StreamConfigConnectorEvent::decode(self.client.wait_for_event(deadline)?)
9472    }
9473
9474    /// Connect to a `StreamConfig` protocol.
9475    /// This method allows a component to serve FIDL outside the devhost's control.
9476    pub fn r#connect(
9477        &self,
9478        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9479    ) -> Result<(), fidl::Error> {
9480        self.client.send::<StreamConfigConnectorConnectRequest>(
9481            (protocol,),
9482            0x22051ff3021eafec,
9483            fidl::encoding::DynamicFlags::empty(),
9484        )
9485    }
9486}
9487
9488#[cfg(target_os = "fuchsia")]
9489impl From<StreamConfigConnectorSynchronousProxy> for zx::Handle {
9490    fn from(value: StreamConfigConnectorSynchronousProxy) -> Self {
9491        value.into_channel().into()
9492    }
9493}
9494
9495#[cfg(target_os = "fuchsia")]
9496impl From<fidl::Channel> for StreamConfigConnectorSynchronousProxy {
9497    fn from(value: fidl::Channel) -> Self {
9498        Self::new(value)
9499    }
9500}
9501
9502#[cfg(target_os = "fuchsia")]
9503impl fidl::endpoints::FromClient for StreamConfigConnectorSynchronousProxy {
9504    type Protocol = StreamConfigConnectorMarker;
9505
9506    fn from_client(value: fidl::endpoints::ClientEnd<StreamConfigConnectorMarker>) -> Self {
9507        Self::new(value.into_channel())
9508    }
9509}
9510
9511#[derive(Debug, Clone)]
9512pub struct StreamConfigConnectorProxy {
9513    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9514}
9515
9516impl fidl::endpoints::Proxy for StreamConfigConnectorProxy {
9517    type Protocol = StreamConfigConnectorMarker;
9518
9519    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9520        Self::new(inner)
9521    }
9522
9523    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9524        self.client.into_channel().map_err(|client| Self { client })
9525    }
9526
9527    fn as_channel(&self) -> &::fidl::AsyncChannel {
9528        self.client.as_channel()
9529    }
9530}
9531
9532impl StreamConfigConnectorProxy {
9533    /// Create a new Proxy for fuchsia.hardware.audio/StreamConfigConnector.
9534    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9535        let protocol_name =
9536            <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9537        Self { client: fidl::client::Client::new(channel, protocol_name) }
9538    }
9539
9540    /// Get a Stream of events from the remote end of the protocol.
9541    ///
9542    /// # Panics
9543    ///
9544    /// Panics if the event stream was already taken.
9545    pub fn take_event_stream(&self) -> StreamConfigConnectorEventStream {
9546        StreamConfigConnectorEventStream { event_receiver: self.client.take_event_receiver() }
9547    }
9548
9549    /// Connect to a `StreamConfig` protocol.
9550    /// This method allows a component to serve FIDL outside the devhost's control.
9551    pub fn r#connect(
9552        &self,
9553        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9554    ) -> Result<(), fidl::Error> {
9555        StreamConfigConnectorProxyInterface::r#connect(self, protocol)
9556    }
9557}
9558
9559impl StreamConfigConnectorProxyInterface for StreamConfigConnectorProxy {
9560    fn r#connect(
9561        &self,
9562        mut protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9563    ) -> Result<(), fidl::Error> {
9564        self.client.send::<StreamConfigConnectorConnectRequest>(
9565            (protocol,),
9566            0x22051ff3021eafec,
9567            fidl::encoding::DynamicFlags::empty(),
9568        )
9569    }
9570}
9571
9572pub struct StreamConfigConnectorEventStream {
9573    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9574}
9575
9576impl std::marker::Unpin for StreamConfigConnectorEventStream {}
9577
9578impl futures::stream::FusedStream for StreamConfigConnectorEventStream {
9579    fn is_terminated(&self) -> bool {
9580        self.event_receiver.is_terminated()
9581    }
9582}
9583
9584impl futures::Stream for StreamConfigConnectorEventStream {
9585    type Item = Result<StreamConfigConnectorEvent, fidl::Error>;
9586
9587    fn poll_next(
9588        mut self: std::pin::Pin<&mut Self>,
9589        cx: &mut std::task::Context<'_>,
9590    ) -> std::task::Poll<Option<Self::Item>> {
9591        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9592            &mut self.event_receiver,
9593            cx
9594        )?) {
9595            Some(buf) => std::task::Poll::Ready(Some(StreamConfigConnectorEvent::decode(buf))),
9596            None => std::task::Poll::Ready(None),
9597        }
9598    }
9599}
9600
9601#[derive(Debug)]
9602pub enum StreamConfigConnectorEvent {}
9603
9604impl StreamConfigConnectorEvent {
9605    /// Decodes a message buffer as a [`StreamConfigConnectorEvent`].
9606    fn decode(
9607        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9608    ) -> Result<StreamConfigConnectorEvent, fidl::Error> {
9609        let (bytes, _handles) = buf.split_mut();
9610        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9611        debug_assert_eq!(tx_header.tx_id, 0);
9612        match tx_header.ordinal {
9613            _ => Err(fidl::Error::UnknownOrdinal {
9614                ordinal: tx_header.ordinal,
9615                protocol_name:
9616                    <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9617            }),
9618        }
9619    }
9620}
9621
9622/// A Stream of incoming requests for fuchsia.hardware.audio/StreamConfigConnector.
9623pub struct StreamConfigConnectorRequestStream {
9624    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9625    is_terminated: bool,
9626}
9627
9628impl std::marker::Unpin for StreamConfigConnectorRequestStream {}
9629
9630impl futures::stream::FusedStream for StreamConfigConnectorRequestStream {
9631    fn is_terminated(&self) -> bool {
9632        self.is_terminated
9633    }
9634}
9635
9636impl fidl::endpoints::RequestStream for StreamConfigConnectorRequestStream {
9637    type Protocol = StreamConfigConnectorMarker;
9638    type ControlHandle = StreamConfigConnectorControlHandle;
9639
9640    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9641        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9642    }
9643
9644    fn control_handle(&self) -> Self::ControlHandle {
9645        StreamConfigConnectorControlHandle { inner: self.inner.clone() }
9646    }
9647
9648    fn into_inner(
9649        self,
9650    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9651    {
9652        (self.inner, self.is_terminated)
9653    }
9654
9655    fn from_inner(
9656        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9657        is_terminated: bool,
9658    ) -> Self {
9659        Self { inner, is_terminated }
9660    }
9661}
9662
9663impl futures::Stream for StreamConfigConnectorRequestStream {
9664    type Item = Result<StreamConfigConnectorRequest, fidl::Error>;
9665
9666    fn poll_next(
9667        mut self: std::pin::Pin<&mut Self>,
9668        cx: &mut std::task::Context<'_>,
9669    ) -> std::task::Poll<Option<Self::Item>> {
9670        let this = &mut *self;
9671        if this.inner.check_shutdown(cx) {
9672            this.is_terminated = true;
9673            return std::task::Poll::Ready(None);
9674        }
9675        if this.is_terminated {
9676            panic!("polled StreamConfigConnectorRequestStream after completion");
9677        }
9678        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9679            |bytes, handles| {
9680                match this.inner.channel().read_etc(cx, bytes, handles) {
9681                    std::task::Poll::Ready(Ok(())) => {}
9682                    std::task::Poll::Pending => return std::task::Poll::Pending,
9683                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9684                        this.is_terminated = true;
9685                        return std::task::Poll::Ready(None);
9686                    }
9687                    std::task::Poll::Ready(Err(e)) => {
9688                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9689                            e.into(),
9690                        ))))
9691                    }
9692                }
9693
9694                // A message has been received from the channel
9695                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9696
9697                std::task::Poll::Ready(Some(match header.ordinal {
9698                0x22051ff3021eafec => {
9699                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9700                    let mut req = fidl::new_empty!(StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9701                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StreamConfigConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
9702                    let control_handle = StreamConfigConnectorControlHandle {
9703                        inner: this.inner.clone(),
9704                    };
9705                    Ok(StreamConfigConnectorRequest::Connect {protocol: req.protocol,
9706
9707                        control_handle,
9708                    })
9709                }
9710                _ => Err(fidl::Error::UnknownOrdinal {
9711                    ordinal: header.ordinal,
9712                    protocol_name: <StreamConfigConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9713                }),
9714            }))
9715            },
9716        )
9717    }
9718}
9719
9720/// For an overview see
9721/// [Audio Driver Streaming Interface](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_streaming).
9722/// # Deprecation
9723///
9724/// Not supported anymore, instead use an
9725/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9726/// with one Ring Buffer, see
9727/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9728#[derive(Debug)]
9729pub enum StreamConfigConnectorRequest {
9730    /// Connect to a `StreamConfig` protocol.
9731    /// This method allows a component to serve FIDL outside the devhost's control.
9732    Connect {
9733        protocol: fidl::endpoints::ServerEnd<StreamConfigMarker>,
9734        control_handle: StreamConfigConnectorControlHandle,
9735    },
9736}
9737
9738impl StreamConfigConnectorRequest {
9739    #[allow(irrefutable_let_patterns)]
9740    pub fn into_connect(
9741        self,
9742    ) -> Option<(fidl::endpoints::ServerEnd<StreamConfigMarker>, StreamConfigConnectorControlHandle)>
9743    {
9744        if let StreamConfigConnectorRequest::Connect { protocol, control_handle } = self {
9745            Some((protocol, control_handle))
9746        } else {
9747            None
9748        }
9749    }
9750
9751    /// Name of the method defined in FIDL
9752    pub fn method_name(&self) -> &'static str {
9753        match *self {
9754            StreamConfigConnectorRequest::Connect { .. } => "connect",
9755        }
9756    }
9757}
9758
9759#[derive(Debug, Clone)]
9760pub struct StreamConfigConnectorControlHandle {
9761    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9762}
9763
9764impl fidl::endpoints::ControlHandle for StreamConfigConnectorControlHandle {
9765    fn shutdown(&self) {
9766        self.inner.shutdown()
9767    }
9768    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9769        self.inner.shutdown_with_epitaph(status)
9770    }
9771
9772    fn is_closed(&self) -> bool {
9773        self.inner.channel().is_closed()
9774    }
9775    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9776        self.inner.channel().on_closed()
9777    }
9778
9779    #[cfg(target_os = "fuchsia")]
9780    fn signal_peer(
9781        &self,
9782        clear_mask: zx::Signals,
9783        set_mask: zx::Signals,
9784    ) -> Result<(), zx_status::Status> {
9785        use fidl::Peered;
9786        self.inner.channel().signal_peer(clear_mask, set_mask)
9787    }
9788}
9789
9790impl StreamConfigConnectorControlHandle {}
9791
9792#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9793pub struct CodecConnectorServiceMarker;
9794
9795#[cfg(target_os = "fuchsia")]
9796impl fidl::endpoints::ServiceMarker for CodecConnectorServiceMarker {
9797    type Proxy = CodecConnectorServiceProxy;
9798    type Request = CodecConnectorServiceRequest;
9799    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecConnectorService";
9800}
9801
9802/// A request for one of the member protocols of CodecConnectorService.
9803///
9804/// # Deprecation
9805///
9806/// Not supported anymore, instead use an
9807/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9808/// with one DAI and no Ring Buffer, see
9809/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9810#[cfg(target_os = "fuchsia")]
9811pub enum CodecConnectorServiceRequest {
9812    CodecConnector(CodecConnectorRequestStream),
9813}
9814
9815#[cfg(target_os = "fuchsia")]
9816impl fidl::endpoints::ServiceRequest for CodecConnectorServiceRequest {
9817    type Service = CodecConnectorServiceMarker;
9818
9819    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9820        match name {
9821            "codec_connector" => Self::CodecConnector(
9822                <CodecConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9823                    _channel,
9824                ),
9825            ),
9826            _ => panic!("no such member protocol name for service CodecConnectorService"),
9827        }
9828    }
9829
9830    fn member_names() -> &'static [&'static str] {
9831        &["codec_connector"]
9832    }
9833}
9834/// # Deprecation
9835///
9836/// Not supported anymore, instead use an
9837/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9838/// with one DAI and no Ring Buffer, see
9839/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9840#[cfg(target_os = "fuchsia")]
9841pub struct CodecConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9842
9843#[cfg(target_os = "fuchsia")]
9844impl fidl::endpoints::ServiceProxy for CodecConnectorServiceProxy {
9845    type Service = CodecConnectorServiceMarker;
9846
9847    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9848        Self(opener)
9849    }
9850}
9851
9852#[cfg(target_os = "fuchsia")]
9853impl CodecConnectorServiceProxy {
9854    pub fn connect_to_codec_connector(&self) -> Result<CodecConnectorProxy, fidl::Error> {
9855        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecConnectorMarker>();
9856        self.connect_channel_to_codec_connector(server_end)?;
9857        Ok(proxy)
9858    }
9859
9860    /// Like `connect_to_codec_connector`, but returns a sync proxy.
9861    /// See [`Self::connect_to_codec_connector`] for more details.
9862    pub fn connect_to_codec_connector_sync(
9863        &self,
9864    ) -> Result<CodecConnectorSynchronousProxy, fidl::Error> {
9865        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecConnectorMarker>();
9866        self.connect_channel_to_codec_connector(server_end)?;
9867        Ok(proxy)
9868    }
9869
9870    /// Like `connect_to_codec_connector`, but accepts a server end.
9871    /// See [`Self::connect_to_codec_connector`] for more details.
9872    pub fn connect_channel_to_codec_connector(
9873        &self,
9874        server_end: fidl::endpoints::ServerEnd<CodecConnectorMarker>,
9875    ) -> Result<(), fidl::Error> {
9876        self.0.open_member("codec_connector", server_end.into_channel())
9877    }
9878
9879    pub fn instance_name(&self) -> &str {
9880        self.0.instance_name()
9881    }
9882}
9883
9884#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9885pub struct CodecServiceMarker;
9886
9887#[cfg(target_os = "fuchsia")]
9888impl fidl::endpoints::ServiceMarker for CodecServiceMarker {
9889    type Proxy = CodecServiceProxy;
9890    type Request = CodecServiceRequest;
9891    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CodecService";
9892}
9893
9894/// A request for one of the member protocols of CodecService.
9895///
9896/// # Deprecation
9897///
9898/// Not supported anymore, instead use an
9899/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9900/// with one DAI and no Ring Buffer, see
9901/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9902#[cfg(target_os = "fuchsia")]
9903pub enum CodecServiceRequest {
9904    Codec(CodecRequestStream),
9905}
9906
9907#[cfg(target_os = "fuchsia")]
9908impl fidl::endpoints::ServiceRequest for CodecServiceRequest {
9909    type Service = CodecServiceMarker;
9910
9911    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9912        match name {
9913            "codec" => Self::Codec(
9914                <CodecRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
9915            ),
9916            _ => panic!("no such member protocol name for service CodecService"),
9917        }
9918    }
9919
9920    fn member_names() -> &'static [&'static str] {
9921        &["codec"]
9922    }
9923}
9924/// # Deprecation
9925///
9926/// Not supported anymore, instead use an
9927/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
9928/// with one DAI and no Ring Buffer, see
9929/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
9930#[cfg(target_os = "fuchsia")]
9931pub struct CodecServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
9932
9933#[cfg(target_os = "fuchsia")]
9934impl fidl::endpoints::ServiceProxy for CodecServiceProxy {
9935    type Service = CodecServiceMarker;
9936
9937    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
9938        Self(opener)
9939    }
9940}
9941
9942#[cfg(target_os = "fuchsia")]
9943impl CodecServiceProxy {
9944    pub fn connect_to_codec(&self) -> Result<CodecProxy, fidl::Error> {
9945        let (proxy, server_end) = fidl::endpoints::create_proxy::<CodecMarker>();
9946        self.connect_channel_to_codec(server_end)?;
9947        Ok(proxy)
9948    }
9949
9950    /// Like `connect_to_codec`, but returns a sync proxy.
9951    /// See [`Self::connect_to_codec`] for more details.
9952    pub fn connect_to_codec_sync(&self) -> Result<CodecSynchronousProxy, fidl::Error> {
9953        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CodecMarker>();
9954        self.connect_channel_to_codec(server_end)?;
9955        Ok(proxy)
9956    }
9957
9958    /// Like `connect_to_codec`, but accepts a server end.
9959    /// See [`Self::connect_to_codec`] for more details.
9960    pub fn connect_channel_to_codec(
9961        &self,
9962        server_end: fidl::endpoints::ServerEnd<CodecMarker>,
9963    ) -> Result<(), fidl::Error> {
9964        self.0.open_member("codec", server_end.into_channel())
9965    }
9966
9967    pub fn instance_name(&self) -> &str {
9968        self.0.instance_name()
9969    }
9970}
9971
9972#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9973pub struct CompositeConnectorServiceMarker;
9974
9975#[cfg(target_os = "fuchsia")]
9976impl fidl::endpoints::ServiceMarker for CompositeConnectorServiceMarker {
9977    type Proxy = CompositeConnectorServiceProxy;
9978    type Request = CompositeConnectorServiceRequest;
9979    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.CompositeConnectorService";
9980}
9981
9982/// A request for one of the member protocols of CompositeConnectorService.
9983///
9984#[cfg(target_os = "fuchsia")]
9985pub enum CompositeConnectorServiceRequest {
9986    CompositeConnector(CompositeConnectorRequestStream),
9987}
9988
9989#[cfg(target_os = "fuchsia")]
9990impl fidl::endpoints::ServiceRequest for CompositeConnectorServiceRequest {
9991    type Service = CompositeConnectorServiceMarker;
9992
9993    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
9994        match name {
9995            "composite_connector" => Self::CompositeConnector(
9996                <CompositeConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
9997                    _channel,
9998                ),
9999            ),
10000            _ => panic!("no such member protocol name for service CompositeConnectorService"),
10001        }
10002    }
10003
10004    fn member_names() -> &'static [&'static str] {
10005        &["composite_connector"]
10006    }
10007}
10008#[cfg(target_os = "fuchsia")]
10009pub struct CompositeConnectorServiceProxy(
10010    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10011);
10012
10013#[cfg(target_os = "fuchsia")]
10014impl fidl::endpoints::ServiceProxy for CompositeConnectorServiceProxy {
10015    type Service = CompositeConnectorServiceMarker;
10016
10017    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10018        Self(opener)
10019    }
10020}
10021
10022#[cfg(target_os = "fuchsia")]
10023impl CompositeConnectorServiceProxy {
10024    pub fn connect_to_composite_connector(&self) -> Result<CompositeConnectorProxy, fidl::Error> {
10025        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeConnectorMarker>();
10026        self.connect_channel_to_composite_connector(server_end)?;
10027        Ok(proxy)
10028    }
10029
10030    /// Like `connect_to_composite_connector`, but returns a sync proxy.
10031    /// See [`Self::connect_to_composite_connector`] for more details.
10032    pub fn connect_to_composite_connector_sync(
10033        &self,
10034    ) -> Result<CompositeConnectorSynchronousProxy, fidl::Error> {
10035        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeConnectorMarker>();
10036        self.connect_channel_to_composite_connector(server_end)?;
10037        Ok(proxy)
10038    }
10039
10040    /// Like `connect_to_composite_connector`, but accepts a server end.
10041    /// See [`Self::connect_to_composite_connector`] for more details.
10042    pub fn connect_channel_to_composite_connector(
10043        &self,
10044        server_end: fidl::endpoints::ServerEnd<CompositeConnectorMarker>,
10045    ) -> Result<(), fidl::Error> {
10046        self.0.open_member("composite_connector", server_end.into_channel())
10047    }
10048
10049    pub fn instance_name(&self) -> &str {
10050        self.0.instance_name()
10051    }
10052}
10053
10054#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10055pub struct DaiConnectorServiceMarker;
10056
10057#[cfg(target_os = "fuchsia")]
10058impl fidl::endpoints::ServiceMarker for DaiConnectorServiceMarker {
10059    type Proxy = DaiConnectorServiceProxy;
10060    type Request = DaiConnectorServiceRequest;
10061    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiConnectorService";
10062}
10063
10064/// A request for one of the member protocols of DaiConnectorService.
10065///
10066/// # Deprecation
10067///
10068/// Not supported anymore, instead use an
10069/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10070/// with one DAI and one Ring Buffer, see
10071/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10072#[cfg(target_os = "fuchsia")]
10073pub enum DaiConnectorServiceRequest {
10074    DaiConnector(DaiConnectorRequestStream),
10075}
10076
10077#[cfg(target_os = "fuchsia")]
10078impl fidl::endpoints::ServiceRequest for DaiConnectorServiceRequest {
10079    type Service = DaiConnectorServiceMarker;
10080
10081    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10082        match name {
10083            "dai_connector" => Self::DaiConnector(
10084                <DaiConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(
10085                    _channel,
10086                ),
10087            ),
10088            _ => panic!("no such member protocol name for service DaiConnectorService"),
10089        }
10090    }
10091
10092    fn member_names() -> &'static [&'static str] {
10093        &["dai_connector"]
10094    }
10095}
10096/// # Deprecation
10097///
10098/// Not supported anymore, instead use an
10099/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10100/// with one DAI and one Ring Buffer, see
10101/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10102#[cfg(target_os = "fuchsia")]
10103pub struct DaiConnectorServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10104
10105#[cfg(target_os = "fuchsia")]
10106impl fidl::endpoints::ServiceProxy for DaiConnectorServiceProxy {
10107    type Service = DaiConnectorServiceMarker;
10108
10109    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10110        Self(opener)
10111    }
10112}
10113
10114#[cfg(target_os = "fuchsia")]
10115impl DaiConnectorServiceProxy {
10116    pub fn connect_to_dai_connector(&self) -> Result<DaiConnectorProxy, fidl::Error> {
10117        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiConnectorMarker>();
10118        self.connect_channel_to_dai_connector(server_end)?;
10119        Ok(proxy)
10120    }
10121
10122    /// Like `connect_to_dai_connector`, but returns a sync proxy.
10123    /// See [`Self::connect_to_dai_connector`] for more details.
10124    pub fn connect_to_dai_connector_sync(
10125        &self,
10126    ) -> Result<DaiConnectorSynchronousProxy, fidl::Error> {
10127        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiConnectorMarker>();
10128        self.connect_channel_to_dai_connector(server_end)?;
10129        Ok(proxy)
10130    }
10131
10132    /// Like `connect_to_dai_connector`, but accepts a server end.
10133    /// See [`Self::connect_to_dai_connector`] for more details.
10134    pub fn connect_channel_to_dai_connector(
10135        &self,
10136        server_end: fidl::endpoints::ServerEnd<DaiConnectorMarker>,
10137    ) -> Result<(), fidl::Error> {
10138        self.0.open_member("dai_connector", server_end.into_channel())
10139    }
10140
10141    pub fn instance_name(&self) -> &str {
10142        self.0.instance_name()
10143    }
10144}
10145
10146#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10147pub struct DaiServiceMarker;
10148
10149#[cfg(target_os = "fuchsia")]
10150impl fidl::endpoints::ServiceMarker for DaiServiceMarker {
10151    type Proxy = DaiServiceProxy;
10152    type Request = DaiServiceRequest;
10153    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DaiService";
10154}
10155
10156/// A request for one of the member protocols of DaiService.
10157///
10158/// # Deprecation
10159///
10160/// Not supported anymore, instead use an
10161/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10162/// with one DAI and one Ring Buffer, see
10163/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10164#[cfg(target_os = "fuchsia")]
10165pub enum DaiServiceRequest {
10166    Dai(DaiRequestStream),
10167}
10168
10169#[cfg(target_os = "fuchsia")]
10170impl fidl::endpoints::ServiceRequest for DaiServiceRequest {
10171    type Service = DaiServiceMarker;
10172
10173    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10174        match name {
10175            "dai" => Self::Dai(<DaiRequestStream as fidl::endpoints::RequestStream>::from_channel(
10176                _channel,
10177            )),
10178            _ => panic!("no such member protocol name for service DaiService"),
10179        }
10180    }
10181
10182    fn member_names() -> &'static [&'static str] {
10183        &["dai"]
10184    }
10185}
10186/// # Deprecation
10187///
10188/// Not supported anymore, instead use an
10189/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10190/// with one DAI and one Ring Buffer, see
10191/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10192#[cfg(target_os = "fuchsia")]
10193pub struct DaiServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10194
10195#[cfg(target_os = "fuchsia")]
10196impl fidl::endpoints::ServiceProxy for DaiServiceProxy {
10197    type Service = DaiServiceMarker;
10198
10199    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10200        Self(opener)
10201    }
10202}
10203
10204#[cfg(target_os = "fuchsia")]
10205impl DaiServiceProxy {
10206    pub fn connect_to_dai(&self) -> Result<DaiProxy, fidl::Error> {
10207        let (proxy, server_end) = fidl::endpoints::create_proxy::<DaiMarker>();
10208        self.connect_channel_to_dai(server_end)?;
10209        Ok(proxy)
10210    }
10211
10212    /// Like `connect_to_dai`, but returns a sync proxy.
10213    /// See [`Self::connect_to_dai`] for more details.
10214    pub fn connect_to_dai_sync(&self) -> Result<DaiSynchronousProxy, fidl::Error> {
10215        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DaiMarker>();
10216        self.connect_channel_to_dai(server_end)?;
10217        Ok(proxy)
10218    }
10219
10220    /// Like `connect_to_dai`, but accepts a server end.
10221    /// See [`Self::connect_to_dai`] for more details.
10222    pub fn connect_channel_to_dai(
10223        &self,
10224        server_end: fidl::endpoints::ServerEnd<DaiMarker>,
10225    ) -> Result<(), fidl::Error> {
10226        self.0.open_member("dai", server_end.into_channel())
10227    }
10228
10229    pub fn instance_name(&self) -> &str {
10230        self.0.instance_name()
10231    }
10232}
10233
10234#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10235pub struct DeviceServiceMarker;
10236
10237#[cfg(target_os = "fuchsia")]
10238impl fidl::endpoints::ServiceMarker for DeviceServiceMarker {
10239    type Proxy = DeviceServiceProxy;
10240    type Request = DeviceServiceRequest;
10241    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.DeviceService";
10242}
10243
10244/// A request for one of the member protocols of DeviceService.
10245///
10246#[cfg(target_os = "fuchsia")]
10247pub enum DeviceServiceRequest {
10248    Device(CompositeRequestStream),
10249}
10250
10251#[cfg(target_os = "fuchsia")]
10252impl fidl::endpoints::ServiceRequest for DeviceServiceRequest {
10253    type Service = DeviceServiceMarker;
10254
10255    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10256        match name {
10257            "device" => Self::Device(
10258                <CompositeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10259            ),
10260            _ => panic!("no such member protocol name for service DeviceService"),
10261        }
10262    }
10263
10264    fn member_names() -> &'static [&'static str] {
10265        &["device"]
10266    }
10267}
10268#[cfg(target_os = "fuchsia")]
10269pub struct DeviceServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10270
10271#[cfg(target_os = "fuchsia")]
10272impl fidl::endpoints::ServiceProxy for DeviceServiceProxy {
10273    type Service = DeviceServiceMarker;
10274
10275    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10276        Self(opener)
10277    }
10278}
10279
10280#[cfg(target_os = "fuchsia")]
10281impl DeviceServiceProxy {
10282    pub fn connect_to_device(&self) -> Result<CompositeProxy, fidl::Error> {
10283        let (proxy, server_end) = fidl::endpoints::create_proxy::<CompositeMarker>();
10284        self.connect_channel_to_device(server_end)?;
10285        Ok(proxy)
10286    }
10287
10288    /// Like `connect_to_device`, but returns a sync proxy.
10289    /// See [`Self::connect_to_device`] for more details.
10290    pub fn connect_to_device_sync(&self) -> Result<CompositeSynchronousProxy, fidl::Error> {
10291        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CompositeMarker>();
10292        self.connect_channel_to_device(server_end)?;
10293        Ok(proxy)
10294    }
10295
10296    /// Like `connect_to_device`, but accepts a server end.
10297    /// See [`Self::connect_to_device`] for more details.
10298    pub fn connect_channel_to_device(
10299        &self,
10300        server_end: fidl::endpoints::ServerEnd<CompositeMarker>,
10301    ) -> Result<(), fidl::Error> {
10302        self.0.open_member("device", server_end.into_channel())
10303    }
10304
10305    pub fn instance_name(&self) -> &str {
10306        self.0.instance_name()
10307    }
10308}
10309
10310#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10311pub struct StreamConfigConnectorInputServiceMarker;
10312
10313#[cfg(target_os = "fuchsia")]
10314impl fidl::endpoints::ServiceMarker for StreamConfigConnectorInputServiceMarker {
10315    type Proxy = StreamConfigConnectorInputServiceProxy;
10316    type Request = StreamConfigConnectorInputServiceRequest;
10317    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorInputService";
10318}
10319
10320/// A request for one of the member protocols of StreamConfigConnectorInputService.
10321///
10322#[cfg(target_os = "fuchsia")]
10323pub enum StreamConfigConnectorInputServiceRequest {
10324    StreamConfigConnector(StreamConfigConnectorRequestStream),
10325}
10326
10327#[cfg(target_os = "fuchsia")]
10328impl fidl::endpoints::ServiceRequest for StreamConfigConnectorInputServiceRequest {
10329    type Service = StreamConfigConnectorInputServiceMarker;
10330
10331    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10332        match name {
10333            "stream_config_connector" => Self::StreamConfigConnector(
10334                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10335            ),
10336            _ => panic!("no such member protocol name for service StreamConfigConnectorInputService"),
10337        }
10338    }
10339
10340    fn member_names() -> &'static [&'static str] {
10341        &["stream_config_connector"]
10342    }
10343}
10344#[cfg(target_os = "fuchsia")]
10345pub struct StreamConfigConnectorInputServiceProxy(
10346    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10347);
10348
10349#[cfg(target_os = "fuchsia")]
10350impl fidl::endpoints::ServiceProxy for StreamConfigConnectorInputServiceProxy {
10351    type Service = StreamConfigConnectorInputServiceMarker;
10352
10353    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10354        Self(opener)
10355    }
10356}
10357
10358#[cfg(target_os = "fuchsia")]
10359impl StreamConfigConnectorInputServiceProxy {
10360    pub fn connect_to_stream_config_connector(
10361        &self,
10362    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10363        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10364        self.connect_channel_to_stream_config_connector(server_end)?;
10365        Ok(proxy)
10366    }
10367
10368    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10369    /// See [`Self::connect_to_stream_config_connector`] for more details.
10370    pub fn connect_to_stream_config_connector_sync(
10371        &self,
10372    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10373        let (proxy, server_end) =
10374            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10375        self.connect_channel_to_stream_config_connector(server_end)?;
10376        Ok(proxy)
10377    }
10378
10379    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10380    /// See [`Self::connect_to_stream_config_connector`] for more details.
10381    pub fn connect_channel_to_stream_config_connector(
10382        &self,
10383        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10384    ) -> Result<(), fidl::Error> {
10385        self.0.open_member("stream_config_connector", server_end.into_channel())
10386    }
10387
10388    pub fn instance_name(&self) -> &str {
10389        self.0.instance_name()
10390    }
10391}
10392
10393#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10394pub struct StreamConfigConnectorOutputServiceMarker;
10395
10396#[cfg(target_os = "fuchsia")]
10397impl fidl::endpoints::ServiceMarker for StreamConfigConnectorOutputServiceMarker {
10398    type Proxy = StreamConfigConnectorOutputServiceProxy;
10399    type Request = StreamConfigConnectorOutputServiceRequest;
10400    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorOutputService";
10401}
10402
10403/// A request for one of the member protocols of StreamConfigConnectorOutputService.
10404///
10405#[cfg(target_os = "fuchsia")]
10406pub enum StreamConfigConnectorOutputServiceRequest {
10407    StreamConfigConnector(StreamConfigConnectorRequestStream),
10408}
10409
10410#[cfg(target_os = "fuchsia")]
10411impl fidl::endpoints::ServiceRequest for StreamConfigConnectorOutputServiceRequest {
10412    type Service = StreamConfigConnectorOutputServiceMarker;
10413
10414    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10415        match name {
10416            "stream_config_connector" => Self::StreamConfigConnector(
10417                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10418            ),
10419            _ => panic!("no such member protocol name for service StreamConfigConnectorOutputService"),
10420        }
10421    }
10422
10423    fn member_names() -> &'static [&'static str] {
10424        &["stream_config_connector"]
10425    }
10426}
10427#[cfg(target_os = "fuchsia")]
10428pub struct StreamConfigConnectorOutputServiceProxy(
10429    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10430);
10431
10432#[cfg(target_os = "fuchsia")]
10433impl fidl::endpoints::ServiceProxy for StreamConfigConnectorOutputServiceProxy {
10434    type Service = StreamConfigConnectorOutputServiceMarker;
10435
10436    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10437        Self(opener)
10438    }
10439}
10440
10441#[cfg(target_os = "fuchsia")]
10442impl StreamConfigConnectorOutputServiceProxy {
10443    pub fn connect_to_stream_config_connector(
10444        &self,
10445    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10446        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10447        self.connect_channel_to_stream_config_connector(server_end)?;
10448        Ok(proxy)
10449    }
10450
10451    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10452    /// See [`Self::connect_to_stream_config_connector`] for more details.
10453    pub fn connect_to_stream_config_connector_sync(
10454        &self,
10455    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10456        let (proxy, server_end) =
10457            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10458        self.connect_channel_to_stream_config_connector(server_end)?;
10459        Ok(proxy)
10460    }
10461
10462    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10463    /// See [`Self::connect_to_stream_config_connector`] for more details.
10464    pub fn connect_channel_to_stream_config_connector(
10465        &self,
10466        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10467    ) -> Result<(), fidl::Error> {
10468        self.0.open_member("stream_config_connector", server_end.into_channel())
10469    }
10470
10471    pub fn instance_name(&self) -> &str {
10472        self.0.instance_name()
10473    }
10474}
10475
10476#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10477pub struct StreamConfigConnectorServiceMarker;
10478
10479#[cfg(target_os = "fuchsia")]
10480impl fidl::endpoints::ServiceMarker for StreamConfigConnectorServiceMarker {
10481    type Proxy = StreamConfigConnectorServiceProxy;
10482    type Request = StreamConfigConnectorServiceRequest;
10483    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigConnectorService";
10484}
10485
10486/// A request for one of the member protocols of StreamConfigConnectorService.
10487///
10488/// # Deprecation
10489///
10490/// Not supported anymore, instead use an
10491/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10492/// with one Ring Buffer, see
10493/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10494#[cfg(target_os = "fuchsia")]
10495pub enum StreamConfigConnectorServiceRequest {
10496    StreamConfigConnector(StreamConfigConnectorRequestStream),
10497}
10498
10499#[cfg(target_os = "fuchsia")]
10500impl fidl::endpoints::ServiceRequest for StreamConfigConnectorServiceRequest {
10501    type Service = StreamConfigConnectorServiceMarker;
10502
10503    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10504        match name {
10505            "stream_config_connector" => Self::StreamConfigConnector(
10506                <StreamConfigConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
10507            ),
10508            _ => panic!("no such member protocol name for service StreamConfigConnectorService"),
10509        }
10510    }
10511
10512    fn member_names() -> &'static [&'static str] {
10513        &["stream_config_connector"]
10514    }
10515}
10516/// # Deprecation
10517///
10518/// Not supported anymore, instead use an
10519/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10520/// with one Ring Buffer, see
10521/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10522#[cfg(target_os = "fuchsia")]
10523pub struct StreamConfigConnectorServiceProxy(
10524    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
10525);
10526
10527#[cfg(target_os = "fuchsia")]
10528impl fidl::endpoints::ServiceProxy for StreamConfigConnectorServiceProxy {
10529    type Service = StreamConfigConnectorServiceMarker;
10530
10531    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10532        Self(opener)
10533    }
10534}
10535
10536#[cfg(target_os = "fuchsia")]
10537impl StreamConfigConnectorServiceProxy {
10538    pub fn connect_to_stream_config_connector(
10539        &self,
10540    ) -> Result<StreamConfigConnectorProxy, fidl::Error> {
10541        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigConnectorMarker>();
10542        self.connect_channel_to_stream_config_connector(server_end)?;
10543        Ok(proxy)
10544    }
10545
10546    /// Like `connect_to_stream_config_connector`, but returns a sync proxy.
10547    /// See [`Self::connect_to_stream_config_connector`] for more details.
10548    pub fn connect_to_stream_config_connector_sync(
10549        &self,
10550    ) -> Result<StreamConfigConnectorSynchronousProxy, fidl::Error> {
10551        let (proxy, server_end) =
10552            fidl::endpoints::create_sync_proxy::<StreamConfigConnectorMarker>();
10553        self.connect_channel_to_stream_config_connector(server_end)?;
10554        Ok(proxy)
10555    }
10556
10557    /// Like `connect_to_stream_config_connector`, but accepts a server end.
10558    /// See [`Self::connect_to_stream_config_connector`] for more details.
10559    pub fn connect_channel_to_stream_config_connector(
10560        &self,
10561        server_end: fidl::endpoints::ServerEnd<StreamConfigConnectorMarker>,
10562    ) -> Result<(), fidl::Error> {
10563        self.0.open_member("stream_config_connector", server_end.into_channel())
10564    }
10565
10566    pub fn instance_name(&self) -> &str {
10567        self.0.instance_name()
10568    }
10569}
10570
10571#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10572pub struct StreamConfigServiceMarker;
10573
10574#[cfg(target_os = "fuchsia")]
10575impl fidl::endpoints::ServiceMarker for StreamConfigServiceMarker {
10576    type Proxy = StreamConfigServiceProxy;
10577    type Request = StreamConfigServiceRequest;
10578    const SERVICE_NAME: &'static str = "fuchsia.hardware.audio.StreamConfigService";
10579}
10580
10581/// A request for one of the member protocols of StreamConfigService.
10582///
10583/// # Deprecation
10584///
10585/// Not supported anymore, instead use an
10586/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10587/// with one Ring Buffer, see
10588/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10589#[cfg(target_os = "fuchsia")]
10590pub enum StreamConfigServiceRequest {
10591    StreamConfig(StreamConfigRequestStream),
10592}
10593
10594#[cfg(target_os = "fuchsia")]
10595impl fidl::endpoints::ServiceRequest for StreamConfigServiceRequest {
10596    type Service = StreamConfigServiceMarker;
10597
10598    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
10599        match name {
10600            "stream_config" => Self::StreamConfig(
10601                <StreamConfigRequestStream as fidl::endpoints::RequestStream>::from_channel(
10602                    _channel,
10603                ),
10604            ),
10605            _ => panic!("no such member protocol name for service StreamConfigService"),
10606        }
10607    }
10608
10609    fn member_names() -> &'static [&'static str] {
10610        &["stream_config"]
10611    }
10612}
10613/// # Deprecation
10614///
10615/// Not supported anymore, instead use an
10616/// [Audio Composite](https://fuchsia.dev/fuchsia-src/development/audio/drivers/composite)
10617/// with one Ring Buffer, see
10618/// [Audio Drivers Architecture](https://fuchsia.dev/fuchsia-src/development/audio/drivers/architecture)
10619#[cfg(target_os = "fuchsia")]
10620pub struct StreamConfigServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
10621
10622#[cfg(target_os = "fuchsia")]
10623impl fidl::endpoints::ServiceProxy for StreamConfigServiceProxy {
10624    type Service = StreamConfigServiceMarker;
10625
10626    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
10627        Self(opener)
10628    }
10629}
10630
10631#[cfg(target_os = "fuchsia")]
10632impl StreamConfigServiceProxy {
10633    pub fn connect_to_stream_config(&self) -> Result<StreamConfigProxy, fidl::Error> {
10634        let (proxy, server_end) = fidl::endpoints::create_proxy::<StreamConfigMarker>();
10635        self.connect_channel_to_stream_config(server_end)?;
10636        Ok(proxy)
10637    }
10638
10639    /// Like `connect_to_stream_config`, but returns a sync proxy.
10640    /// See [`Self::connect_to_stream_config`] for more details.
10641    pub fn connect_to_stream_config_sync(
10642        &self,
10643    ) -> Result<StreamConfigSynchronousProxy, fidl::Error> {
10644        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<StreamConfigMarker>();
10645        self.connect_channel_to_stream_config(server_end)?;
10646        Ok(proxy)
10647    }
10648
10649    /// Like `connect_to_stream_config`, but accepts a server end.
10650    /// See [`Self::connect_to_stream_config`] for more details.
10651    pub fn connect_channel_to_stream_config(
10652        &self,
10653        server_end: fidl::endpoints::ServerEnd<StreamConfigMarker>,
10654    ) -> Result<(), fidl::Error> {
10655        self.0.open_member("stream_config", server_end.into_channel())
10656    }
10657
10658    pub fn instance_name(&self) -> &str {
10659        self.0.instance_name()
10660    }
10661}
10662
10663mod internal {
10664    use super::*;
10665
10666    impl fidl::encoding::ResourceTypeMarker for CodecConnectorConnectRequest {
10667        type Borrowed<'a> = &'a mut Self;
10668        fn take_or_borrow<'a>(
10669            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10670        ) -> Self::Borrowed<'a> {
10671            value
10672        }
10673    }
10674
10675    unsafe impl fidl::encoding::TypeMarker for CodecConnectorConnectRequest {
10676        type Owned = Self;
10677
10678        #[inline(always)]
10679        fn inline_align(_context: fidl::encoding::Context) -> usize {
10680            4
10681        }
10682
10683        #[inline(always)]
10684        fn inline_size(_context: fidl::encoding::Context) -> usize {
10685            4
10686        }
10687    }
10688
10689    unsafe impl
10690        fidl::encoding::Encode<
10691            CodecConnectorConnectRequest,
10692            fidl::encoding::DefaultFuchsiaResourceDialect,
10693        > for &mut CodecConnectorConnectRequest
10694    {
10695        #[inline]
10696        unsafe fn encode(
10697            self,
10698            encoder: &mut fidl::encoding::Encoder<
10699                '_,
10700                fidl::encoding::DefaultFuchsiaResourceDialect,
10701            >,
10702            offset: usize,
10703            _depth: fidl::encoding::Depth,
10704        ) -> fidl::Result<()> {
10705            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10706            // Delegate to tuple encoding.
10707            fidl::encoding::Encode::<CodecConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10708                (
10709                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.codec_protocol),
10710                ),
10711                encoder, offset, _depth
10712            )
10713        }
10714    }
10715    unsafe impl<
10716            T0: fidl::encoding::Encode<
10717                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10718                fidl::encoding::DefaultFuchsiaResourceDialect,
10719            >,
10720        >
10721        fidl::encoding::Encode<
10722            CodecConnectorConnectRequest,
10723            fidl::encoding::DefaultFuchsiaResourceDialect,
10724        > for (T0,)
10725    {
10726        #[inline]
10727        unsafe fn encode(
10728            self,
10729            encoder: &mut fidl::encoding::Encoder<
10730                '_,
10731                fidl::encoding::DefaultFuchsiaResourceDialect,
10732            >,
10733            offset: usize,
10734            depth: fidl::encoding::Depth,
10735        ) -> fidl::Result<()> {
10736            encoder.debug_check_bounds::<CodecConnectorConnectRequest>(offset);
10737            // Zero out padding regions. There's no need to apply masks
10738            // because the unmasked parts will be overwritten by fields.
10739            // Write the fields.
10740            self.0.encode(encoder, offset + 0, depth)?;
10741            Ok(())
10742        }
10743    }
10744
10745    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10746        for CodecConnectorConnectRequest
10747    {
10748        #[inline(always)]
10749        fn new_empty() -> Self {
10750            Self {
10751                codec_protocol: fidl::new_empty!(
10752                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10753                    fidl::encoding::DefaultFuchsiaResourceDialect
10754                ),
10755            }
10756        }
10757
10758        #[inline]
10759        unsafe fn decode(
10760            &mut self,
10761            decoder: &mut fidl::encoding::Decoder<
10762                '_,
10763                fidl::encoding::DefaultFuchsiaResourceDialect,
10764            >,
10765            offset: usize,
10766            _depth: fidl::encoding::Depth,
10767        ) -> fidl::Result<()> {
10768            decoder.debug_check_bounds::<Self>(offset);
10769            // Verify that padding bytes are zero.
10770            fidl::decode!(
10771                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CodecMarker>>,
10772                fidl::encoding::DefaultFuchsiaResourceDialect,
10773                &mut self.codec_protocol,
10774                decoder,
10775                offset + 0,
10776                _depth
10777            )?;
10778            Ok(())
10779        }
10780    }
10781
10782    impl fidl::encoding::ResourceTypeMarker for CompositeConnectorConnectRequest {
10783        type Borrowed<'a> = &'a mut Self;
10784        fn take_or_borrow<'a>(
10785            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10786        ) -> Self::Borrowed<'a> {
10787            value
10788        }
10789    }
10790
10791    unsafe impl fidl::encoding::TypeMarker for CompositeConnectorConnectRequest {
10792        type Owned = Self;
10793
10794        #[inline(always)]
10795        fn inline_align(_context: fidl::encoding::Context) -> usize {
10796            4
10797        }
10798
10799        #[inline(always)]
10800        fn inline_size(_context: fidl::encoding::Context) -> usize {
10801            4
10802        }
10803    }
10804
10805    unsafe impl
10806        fidl::encoding::Encode<
10807            CompositeConnectorConnectRequest,
10808            fidl::encoding::DefaultFuchsiaResourceDialect,
10809        > for &mut CompositeConnectorConnectRequest
10810    {
10811        #[inline]
10812        unsafe fn encode(
10813            self,
10814            encoder: &mut fidl::encoding::Encoder<
10815                '_,
10816                fidl::encoding::DefaultFuchsiaResourceDialect,
10817            >,
10818            offset: usize,
10819            _depth: fidl::encoding::Depth,
10820        ) -> fidl::Result<()> {
10821            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10822            // Delegate to tuple encoding.
10823            fidl::encoding::Encode::<CompositeConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10824                (
10825                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.composite_protocol),
10826                ),
10827                encoder, offset, _depth
10828            )
10829        }
10830    }
10831    unsafe impl<
10832            T0: fidl::encoding::Encode<
10833                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10834                fidl::encoding::DefaultFuchsiaResourceDialect,
10835            >,
10836        >
10837        fidl::encoding::Encode<
10838            CompositeConnectorConnectRequest,
10839            fidl::encoding::DefaultFuchsiaResourceDialect,
10840        > for (T0,)
10841    {
10842        #[inline]
10843        unsafe fn encode(
10844            self,
10845            encoder: &mut fidl::encoding::Encoder<
10846                '_,
10847                fidl::encoding::DefaultFuchsiaResourceDialect,
10848            >,
10849            offset: usize,
10850            depth: fidl::encoding::Depth,
10851        ) -> fidl::Result<()> {
10852            encoder.debug_check_bounds::<CompositeConnectorConnectRequest>(offset);
10853            // Zero out padding regions. There's no need to apply masks
10854            // because the unmasked parts will be overwritten by fields.
10855            // Write the fields.
10856            self.0.encode(encoder, offset + 0, depth)?;
10857            Ok(())
10858        }
10859    }
10860
10861    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10862        for CompositeConnectorConnectRequest
10863    {
10864        #[inline(always)]
10865        fn new_empty() -> Self {
10866            Self {
10867                composite_protocol: fidl::new_empty!(
10868                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10869                    fidl::encoding::DefaultFuchsiaResourceDialect
10870                ),
10871            }
10872        }
10873
10874        #[inline]
10875        unsafe fn decode(
10876            &mut self,
10877            decoder: &mut fidl::encoding::Decoder<
10878                '_,
10879                fidl::encoding::DefaultFuchsiaResourceDialect,
10880            >,
10881            offset: usize,
10882            _depth: fidl::encoding::Depth,
10883        ) -> fidl::Result<()> {
10884            decoder.debug_check_bounds::<Self>(offset);
10885            // Verify that padding bytes are zero.
10886            fidl::decode!(
10887                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CompositeMarker>>,
10888                fidl::encoding::DefaultFuchsiaResourceDialect,
10889                &mut self.composite_protocol,
10890                decoder,
10891                offset + 0,
10892                _depth
10893            )?;
10894            Ok(())
10895        }
10896    }
10897
10898    impl fidl::encoding::ResourceTypeMarker for CompositeCreateRingBufferRequest {
10899        type Borrowed<'a> = &'a mut Self;
10900        fn take_or_borrow<'a>(
10901            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10902        ) -> Self::Borrowed<'a> {
10903            value
10904        }
10905    }
10906
10907    unsafe impl fidl::encoding::TypeMarker for CompositeCreateRingBufferRequest {
10908        type Owned = Self;
10909
10910        #[inline(always)]
10911        fn inline_align(_context: fidl::encoding::Context) -> usize {
10912            8
10913        }
10914
10915        #[inline(always)]
10916        fn inline_size(_context: fidl::encoding::Context) -> usize {
10917            32
10918        }
10919    }
10920
10921    unsafe impl
10922        fidl::encoding::Encode<
10923            CompositeCreateRingBufferRequest,
10924            fidl::encoding::DefaultFuchsiaResourceDialect,
10925        > for &mut CompositeCreateRingBufferRequest
10926    {
10927        #[inline]
10928        unsafe fn encode(
10929            self,
10930            encoder: &mut fidl::encoding::Encoder<
10931                '_,
10932                fidl::encoding::DefaultFuchsiaResourceDialect,
10933            >,
10934            offset: usize,
10935            _depth: fidl::encoding::Depth,
10936        ) -> fidl::Result<()> {
10937            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10938            // Delegate to tuple encoding.
10939            fidl::encoding::Encode::<CompositeCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10940                (
10941                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.processing_element_id),
10942                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
10943                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
10944                ),
10945                encoder, offset, _depth
10946            )
10947        }
10948    }
10949    unsafe impl<
10950            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10951            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
10952            T2: fidl::encoding::Encode<
10953                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
10954                fidl::encoding::DefaultFuchsiaResourceDialect,
10955            >,
10956        >
10957        fidl::encoding::Encode<
10958            CompositeCreateRingBufferRequest,
10959            fidl::encoding::DefaultFuchsiaResourceDialect,
10960        > for (T0, T1, T2)
10961    {
10962        #[inline]
10963        unsafe fn encode(
10964            self,
10965            encoder: &mut fidl::encoding::Encoder<
10966                '_,
10967                fidl::encoding::DefaultFuchsiaResourceDialect,
10968            >,
10969            offset: usize,
10970            depth: fidl::encoding::Depth,
10971        ) -> fidl::Result<()> {
10972            encoder.debug_check_bounds::<CompositeCreateRingBufferRequest>(offset);
10973            // Zero out padding regions. There's no need to apply masks
10974            // because the unmasked parts will be overwritten by fields.
10975            unsafe {
10976                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
10977                (ptr as *mut u64).write_unaligned(0);
10978            }
10979            // Write the fields.
10980            self.0.encode(encoder, offset + 0, depth)?;
10981            self.1.encode(encoder, offset + 8, depth)?;
10982            self.2.encode(encoder, offset + 24, depth)?;
10983            Ok(())
10984        }
10985    }
10986
10987    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10988        for CompositeCreateRingBufferRequest
10989    {
10990        #[inline(always)]
10991        fn new_empty() -> Self {
10992            Self {
10993                processing_element_id: fidl::new_empty!(
10994                    u64,
10995                    fidl::encoding::DefaultFuchsiaResourceDialect
10996                ),
10997                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
10998                ring_buffer: fidl::new_empty!(
10999                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11000                    fidl::encoding::DefaultFuchsiaResourceDialect
11001                ),
11002            }
11003        }
11004
11005        #[inline]
11006        unsafe fn decode(
11007            &mut self,
11008            decoder: &mut fidl::encoding::Decoder<
11009                '_,
11010                fidl::encoding::DefaultFuchsiaResourceDialect,
11011            >,
11012            offset: usize,
11013            _depth: fidl::encoding::Depth,
11014        ) -> fidl::Result<()> {
11015            decoder.debug_check_bounds::<Self>(offset);
11016            // Verify that padding bytes are zero.
11017            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
11018            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11019            let mask = 0xffffffff00000000u64;
11020            let maskedval = padval & mask;
11021            if maskedval != 0 {
11022                return Err(fidl::Error::NonZeroPadding {
11023                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
11024                });
11025            }
11026            fidl::decode!(
11027                u64,
11028                fidl::encoding::DefaultFuchsiaResourceDialect,
11029                &mut self.processing_element_id,
11030                decoder,
11031                offset + 0,
11032                _depth
11033            )?;
11034            fidl::decode!(
11035                Format,
11036                fidl::encoding::DefaultFuchsiaResourceDialect,
11037                &mut self.format,
11038                decoder,
11039                offset + 8,
11040                _depth
11041            )?;
11042            fidl::decode!(
11043                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11044                fidl::encoding::DefaultFuchsiaResourceDialect,
11045                &mut self.ring_buffer,
11046                decoder,
11047                offset + 24,
11048                _depth
11049            )?;
11050            Ok(())
11051        }
11052    }
11053
11054    impl fidl::encoding::ResourceTypeMarker for DaiConnectorConnectRequest {
11055        type Borrowed<'a> = &'a mut Self;
11056        fn take_or_borrow<'a>(
11057            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11058        ) -> Self::Borrowed<'a> {
11059            value
11060        }
11061    }
11062
11063    unsafe impl fidl::encoding::TypeMarker for DaiConnectorConnectRequest {
11064        type Owned = Self;
11065
11066        #[inline(always)]
11067        fn inline_align(_context: fidl::encoding::Context) -> usize {
11068            4
11069        }
11070
11071        #[inline(always)]
11072        fn inline_size(_context: fidl::encoding::Context) -> usize {
11073            4
11074        }
11075    }
11076
11077    unsafe impl
11078        fidl::encoding::Encode<
11079            DaiConnectorConnectRequest,
11080            fidl::encoding::DefaultFuchsiaResourceDialect,
11081        > for &mut DaiConnectorConnectRequest
11082    {
11083        #[inline]
11084        unsafe fn encode(
11085            self,
11086            encoder: &mut fidl::encoding::Encoder<
11087                '_,
11088                fidl::encoding::DefaultFuchsiaResourceDialect,
11089            >,
11090            offset: usize,
11091            _depth: fidl::encoding::Depth,
11092        ) -> fidl::Result<()> {
11093            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11094            // Delegate to tuple encoding.
11095            fidl::encoding::Encode::<DaiConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11096                (
11097                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.dai_protocol),
11098                ),
11099                encoder, offset, _depth
11100            )
11101        }
11102    }
11103    unsafe impl<
11104            T0: fidl::encoding::Encode<
11105                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
11106                fidl::encoding::DefaultFuchsiaResourceDialect,
11107            >,
11108        >
11109        fidl::encoding::Encode<
11110            DaiConnectorConnectRequest,
11111            fidl::encoding::DefaultFuchsiaResourceDialect,
11112        > for (T0,)
11113    {
11114        #[inline]
11115        unsafe fn encode(
11116            self,
11117            encoder: &mut fidl::encoding::Encoder<
11118                '_,
11119                fidl::encoding::DefaultFuchsiaResourceDialect,
11120            >,
11121            offset: usize,
11122            depth: fidl::encoding::Depth,
11123        ) -> fidl::Result<()> {
11124            encoder.debug_check_bounds::<DaiConnectorConnectRequest>(offset);
11125            // Zero out padding regions. There's no need to apply masks
11126            // because the unmasked parts will be overwritten by fields.
11127            // Write the fields.
11128            self.0.encode(encoder, offset + 0, depth)?;
11129            Ok(())
11130        }
11131    }
11132
11133    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11134        for DaiConnectorConnectRequest
11135    {
11136        #[inline(always)]
11137        fn new_empty() -> Self {
11138            Self {
11139                dai_protocol: fidl::new_empty!(
11140                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
11141                    fidl::encoding::DefaultFuchsiaResourceDialect
11142                ),
11143            }
11144        }
11145
11146        #[inline]
11147        unsafe fn decode(
11148            &mut self,
11149            decoder: &mut fidl::encoding::Decoder<
11150                '_,
11151                fidl::encoding::DefaultFuchsiaResourceDialect,
11152            >,
11153            offset: usize,
11154            _depth: fidl::encoding::Depth,
11155        ) -> fidl::Result<()> {
11156            decoder.debug_check_bounds::<Self>(offset);
11157            // Verify that padding bytes are zero.
11158            fidl::decode!(
11159                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DaiMarker>>,
11160                fidl::encoding::DefaultFuchsiaResourceDialect,
11161                &mut self.dai_protocol,
11162                decoder,
11163                offset + 0,
11164                _depth
11165            )?;
11166            Ok(())
11167        }
11168    }
11169
11170    impl fidl::encoding::ResourceTypeMarker for DaiCreateRingBufferRequest {
11171        type Borrowed<'a> = &'a mut Self;
11172        fn take_or_borrow<'a>(
11173            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11174        ) -> Self::Borrowed<'a> {
11175            value
11176        }
11177    }
11178
11179    unsafe impl fidl::encoding::TypeMarker for DaiCreateRingBufferRequest {
11180        type Owned = Self;
11181
11182        #[inline(always)]
11183        fn inline_align(_context: fidl::encoding::Context) -> usize {
11184            8
11185        }
11186
11187        #[inline(always)]
11188        fn inline_size(_context: fidl::encoding::Context) -> usize {
11189            72
11190        }
11191    }
11192
11193    unsafe impl
11194        fidl::encoding::Encode<
11195            DaiCreateRingBufferRequest,
11196            fidl::encoding::DefaultFuchsiaResourceDialect,
11197        > for &mut DaiCreateRingBufferRequest
11198    {
11199        #[inline]
11200        unsafe fn encode(
11201            self,
11202            encoder: &mut fidl::encoding::Encoder<
11203                '_,
11204                fidl::encoding::DefaultFuchsiaResourceDialect,
11205            >,
11206            offset: usize,
11207            _depth: fidl::encoding::Depth,
11208        ) -> fidl::Result<()> {
11209            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11210            // Delegate to tuple encoding.
11211            fidl::encoding::Encode::<DaiCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11212                (
11213                    <DaiFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.dai_format),
11214                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.ring_buffer_format),
11215                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11216                ),
11217                encoder, offset, _depth
11218            )
11219        }
11220    }
11221    unsafe impl<
11222            T0: fidl::encoding::Encode<DaiFormat, fidl::encoding::DefaultFuchsiaResourceDialect>,
11223            T1: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11224            T2: fidl::encoding::Encode<
11225                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11226                fidl::encoding::DefaultFuchsiaResourceDialect,
11227            >,
11228        >
11229        fidl::encoding::Encode<
11230            DaiCreateRingBufferRequest,
11231            fidl::encoding::DefaultFuchsiaResourceDialect,
11232        > for (T0, T1, T2)
11233    {
11234        #[inline]
11235        unsafe fn encode(
11236            self,
11237            encoder: &mut fidl::encoding::Encoder<
11238                '_,
11239                fidl::encoding::DefaultFuchsiaResourceDialect,
11240            >,
11241            offset: usize,
11242            depth: fidl::encoding::Depth,
11243        ) -> fidl::Result<()> {
11244            encoder.debug_check_bounds::<DaiCreateRingBufferRequest>(offset);
11245            // Zero out padding regions. There's no need to apply masks
11246            // because the unmasked parts will be overwritten by fields.
11247            unsafe {
11248                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
11249                (ptr as *mut u64).write_unaligned(0);
11250            }
11251            // Write the fields.
11252            self.0.encode(encoder, offset + 0, depth)?;
11253            self.1.encode(encoder, offset + 48, depth)?;
11254            self.2.encode(encoder, offset + 64, depth)?;
11255            Ok(())
11256        }
11257    }
11258
11259    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11260        for DaiCreateRingBufferRequest
11261    {
11262        #[inline(always)]
11263        fn new_empty() -> Self {
11264            Self {
11265                dai_format: fidl::new_empty!(
11266                    DaiFormat,
11267                    fidl::encoding::DefaultFuchsiaResourceDialect
11268                ),
11269                ring_buffer_format: fidl::new_empty!(
11270                    Format,
11271                    fidl::encoding::DefaultFuchsiaResourceDialect
11272                ),
11273                ring_buffer: fidl::new_empty!(
11274                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11275                    fidl::encoding::DefaultFuchsiaResourceDialect
11276                ),
11277            }
11278        }
11279
11280        #[inline]
11281        unsafe fn decode(
11282            &mut self,
11283            decoder: &mut fidl::encoding::Decoder<
11284                '_,
11285                fidl::encoding::DefaultFuchsiaResourceDialect,
11286            >,
11287            offset: usize,
11288            _depth: fidl::encoding::Depth,
11289        ) -> fidl::Result<()> {
11290            decoder.debug_check_bounds::<Self>(offset);
11291            // Verify that padding bytes are zero.
11292            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
11293            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11294            let mask = 0xffffffff00000000u64;
11295            let maskedval = padval & mask;
11296            if maskedval != 0 {
11297                return Err(fidl::Error::NonZeroPadding {
11298                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
11299                });
11300            }
11301            fidl::decode!(
11302                DaiFormat,
11303                fidl::encoding::DefaultFuchsiaResourceDialect,
11304                &mut self.dai_format,
11305                decoder,
11306                offset + 0,
11307                _depth
11308            )?;
11309            fidl::decode!(
11310                Format,
11311                fidl::encoding::DefaultFuchsiaResourceDialect,
11312                &mut self.ring_buffer_format,
11313                decoder,
11314                offset + 48,
11315                _depth
11316            )?;
11317            fidl::decode!(
11318                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11319                fidl::encoding::DefaultFuchsiaResourceDialect,
11320                &mut self.ring_buffer,
11321                decoder,
11322                offset + 64,
11323                _depth
11324            )?;
11325            Ok(())
11326        }
11327    }
11328
11329    impl fidl::encoding::ResourceTypeMarker for RingBufferGetVmoResponse {
11330        type Borrowed<'a> = &'a mut Self;
11331        fn take_or_borrow<'a>(
11332            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11333        ) -> Self::Borrowed<'a> {
11334            value
11335        }
11336    }
11337
11338    unsafe impl fidl::encoding::TypeMarker for RingBufferGetVmoResponse {
11339        type Owned = Self;
11340
11341        #[inline(always)]
11342        fn inline_align(_context: fidl::encoding::Context) -> usize {
11343            4
11344        }
11345
11346        #[inline(always)]
11347        fn inline_size(_context: fidl::encoding::Context) -> usize {
11348            8
11349        }
11350    }
11351
11352    unsafe impl
11353        fidl::encoding::Encode<
11354            RingBufferGetVmoResponse,
11355            fidl::encoding::DefaultFuchsiaResourceDialect,
11356        > for &mut RingBufferGetVmoResponse
11357    {
11358        #[inline]
11359        unsafe fn encode(
11360            self,
11361            encoder: &mut fidl::encoding::Encoder<
11362                '_,
11363                fidl::encoding::DefaultFuchsiaResourceDialect,
11364            >,
11365            offset: usize,
11366            _depth: fidl::encoding::Depth,
11367        ) -> fidl::Result<()> {
11368            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11369            // Delegate to tuple encoding.
11370            fidl::encoding::Encode::<
11371                RingBufferGetVmoResponse,
11372                fidl::encoding::DefaultFuchsiaResourceDialect,
11373            >::encode(
11374                (
11375                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_frames),
11376                    <fidl::encoding::HandleType<
11377                        fidl::Vmo,
11378                        { fidl::ObjectType::VMO.into_raw() },
11379                        2147483648,
11380                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11381                        &mut self.ring_buffer
11382                    ),
11383                ),
11384                encoder,
11385                offset,
11386                _depth,
11387            )
11388        }
11389    }
11390    unsafe impl<
11391            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11392            T1: fidl::encoding::Encode<
11393                fidl::encoding::HandleType<
11394                    fidl::Vmo,
11395                    { fidl::ObjectType::VMO.into_raw() },
11396                    2147483648,
11397                >,
11398                fidl::encoding::DefaultFuchsiaResourceDialect,
11399            >,
11400        >
11401        fidl::encoding::Encode<
11402            RingBufferGetVmoResponse,
11403            fidl::encoding::DefaultFuchsiaResourceDialect,
11404        > for (T0, T1)
11405    {
11406        #[inline]
11407        unsafe fn encode(
11408            self,
11409            encoder: &mut fidl::encoding::Encoder<
11410                '_,
11411                fidl::encoding::DefaultFuchsiaResourceDialect,
11412            >,
11413            offset: usize,
11414            depth: fidl::encoding::Depth,
11415        ) -> fidl::Result<()> {
11416            encoder.debug_check_bounds::<RingBufferGetVmoResponse>(offset);
11417            // Zero out padding regions. There's no need to apply masks
11418            // because the unmasked parts will be overwritten by fields.
11419            // Write the fields.
11420            self.0.encode(encoder, offset + 0, depth)?;
11421            self.1.encode(encoder, offset + 4, depth)?;
11422            Ok(())
11423        }
11424    }
11425
11426    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11427        for RingBufferGetVmoResponse
11428    {
11429        #[inline(always)]
11430        fn new_empty() -> Self {
11431            Self {
11432                num_frames: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11433                ring_buffer: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11434            }
11435        }
11436
11437        #[inline]
11438        unsafe fn decode(
11439            &mut self,
11440            decoder: &mut fidl::encoding::Decoder<
11441                '_,
11442                fidl::encoding::DefaultFuchsiaResourceDialect,
11443            >,
11444            offset: usize,
11445            _depth: fidl::encoding::Depth,
11446        ) -> fidl::Result<()> {
11447            decoder.debug_check_bounds::<Self>(offset);
11448            // Verify that padding bytes are zero.
11449            fidl::decode!(
11450                u32,
11451                fidl::encoding::DefaultFuchsiaResourceDialect,
11452                &mut self.num_frames,
11453                decoder,
11454                offset + 0,
11455                _depth
11456            )?;
11457            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.ring_buffer, decoder, offset + 4, _depth)?;
11458            Ok(())
11459        }
11460    }
11461
11462    impl fidl::encoding::ResourceTypeMarker for StreamConfigConnectorConnectRequest {
11463        type Borrowed<'a> = &'a mut Self;
11464        fn take_or_borrow<'a>(
11465            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11466        ) -> Self::Borrowed<'a> {
11467            value
11468        }
11469    }
11470
11471    unsafe impl fidl::encoding::TypeMarker for StreamConfigConnectorConnectRequest {
11472        type Owned = Self;
11473
11474        #[inline(always)]
11475        fn inline_align(_context: fidl::encoding::Context) -> usize {
11476            4
11477        }
11478
11479        #[inline(always)]
11480        fn inline_size(_context: fidl::encoding::Context) -> usize {
11481            4
11482        }
11483    }
11484
11485    unsafe impl
11486        fidl::encoding::Encode<
11487            StreamConfigConnectorConnectRequest,
11488            fidl::encoding::DefaultFuchsiaResourceDialect,
11489        > for &mut StreamConfigConnectorConnectRequest
11490    {
11491        #[inline]
11492        unsafe fn encode(
11493            self,
11494            encoder: &mut fidl::encoding::Encoder<
11495                '_,
11496                fidl::encoding::DefaultFuchsiaResourceDialect,
11497            >,
11498            offset: usize,
11499            _depth: fidl::encoding::Depth,
11500        ) -> fidl::Result<()> {
11501            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11502            // Delegate to tuple encoding.
11503            fidl::encoding::Encode::<StreamConfigConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11504                (
11505                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.protocol),
11506                ),
11507                encoder, offset, _depth
11508            )
11509        }
11510    }
11511    unsafe impl<
11512            T0: fidl::encoding::Encode<
11513                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11514                fidl::encoding::DefaultFuchsiaResourceDialect,
11515            >,
11516        >
11517        fidl::encoding::Encode<
11518            StreamConfigConnectorConnectRequest,
11519            fidl::encoding::DefaultFuchsiaResourceDialect,
11520        > for (T0,)
11521    {
11522        #[inline]
11523        unsafe fn encode(
11524            self,
11525            encoder: &mut fidl::encoding::Encoder<
11526                '_,
11527                fidl::encoding::DefaultFuchsiaResourceDialect,
11528            >,
11529            offset: usize,
11530            depth: fidl::encoding::Depth,
11531        ) -> fidl::Result<()> {
11532            encoder.debug_check_bounds::<StreamConfigConnectorConnectRequest>(offset);
11533            // Zero out padding regions. There's no need to apply masks
11534            // because the unmasked parts will be overwritten by fields.
11535            // Write the fields.
11536            self.0.encode(encoder, offset + 0, depth)?;
11537            Ok(())
11538        }
11539    }
11540
11541    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11542        for StreamConfigConnectorConnectRequest
11543    {
11544        #[inline(always)]
11545        fn new_empty() -> Self {
11546            Self {
11547                protocol: fidl::new_empty!(
11548                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11549                    fidl::encoding::DefaultFuchsiaResourceDialect
11550                ),
11551            }
11552        }
11553
11554        #[inline]
11555        unsafe fn decode(
11556            &mut self,
11557            decoder: &mut fidl::encoding::Decoder<
11558                '_,
11559                fidl::encoding::DefaultFuchsiaResourceDialect,
11560            >,
11561            offset: usize,
11562            _depth: fidl::encoding::Depth,
11563        ) -> fidl::Result<()> {
11564            decoder.debug_check_bounds::<Self>(offset);
11565            // Verify that padding bytes are zero.
11566            fidl::decode!(
11567                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<StreamConfigMarker>>,
11568                fidl::encoding::DefaultFuchsiaResourceDialect,
11569                &mut self.protocol,
11570                decoder,
11571                offset + 0,
11572                _depth
11573            )?;
11574            Ok(())
11575        }
11576    }
11577
11578    impl fidl::encoding::ResourceTypeMarker for StreamConfigCreateRingBufferRequest {
11579        type Borrowed<'a> = &'a mut Self;
11580        fn take_or_borrow<'a>(
11581            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11582        ) -> Self::Borrowed<'a> {
11583            value
11584        }
11585    }
11586
11587    unsafe impl fidl::encoding::TypeMarker for StreamConfigCreateRingBufferRequest {
11588        type Owned = Self;
11589
11590        #[inline(always)]
11591        fn inline_align(_context: fidl::encoding::Context) -> usize {
11592            8
11593        }
11594
11595        #[inline(always)]
11596        fn inline_size(_context: fidl::encoding::Context) -> usize {
11597            24
11598        }
11599    }
11600
11601    unsafe impl
11602        fidl::encoding::Encode<
11603            StreamConfigCreateRingBufferRequest,
11604            fidl::encoding::DefaultFuchsiaResourceDialect,
11605        > for &mut StreamConfigCreateRingBufferRequest
11606    {
11607        #[inline]
11608        unsafe fn encode(
11609            self,
11610            encoder: &mut fidl::encoding::Encoder<
11611                '_,
11612                fidl::encoding::DefaultFuchsiaResourceDialect,
11613            >,
11614            offset: usize,
11615            _depth: fidl::encoding::Depth,
11616        ) -> fidl::Result<()> {
11617            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11618            // Delegate to tuple encoding.
11619            fidl::encoding::Encode::<StreamConfigCreateRingBufferRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11620                (
11621                    <Format as fidl::encoding::ValueTypeMarker>::borrow(&self.format),
11622                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.ring_buffer),
11623                ),
11624                encoder, offset, _depth
11625            )
11626        }
11627    }
11628    unsafe impl<
11629            T0: fidl::encoding::Encode<Format, fidl::encoding::DefaultFuchsiaResourceDialect>,
11630            T1: fidl::encoding::Encode<
11631                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11632                fidl::encoding::DefaultFuchsiaResourceDialect,
11633            >,
11634        >
11635        fidl::encoding::Encode<
11636            StreamConfigCreateRingBufferRequest,
11637            fidl::encoding::DefaultFuchsiaResourceDialect,
11638        > for (T0, T1)
11639    {
11640        #[inline]
11641        unsafe fn encode(
11642            self,
11643            encoder: &mut fidl::encoding::Encoder<
11644                '_,
11645                fidl::encoding::DefaultFuchsiaResourceDialect,
11646            >,
11647            offset: usize,
11648            depth: fidl::encoding::Depth,
11649        ) -> fidl::Result<()> {
11650            encoder.debug_check_bounds::<StreamConfigCreateRingBufferRequest>(offset);
11651            // Zero out padding regions. There's no need to apply masks
11652            // because the unmasked parts will be overwritten by fields.
11653            unsafe {
11654                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11655                (ptr as *mut u64).write_unaligned(0);
11656            }
11657            // Write the fields.
11658            self.0.encode(encoder, offset + 0, depth)?;
11659            self.1.encode(encoder, offset + 16, depth)?;
11660            Ok(())
11661        }
11662    }
11663
11664    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11665        for StreamConfigCreateRingBufferRequest
11666    {
11667        #[inline(always)]
11668        fn new_empty() -> Self {
11669            Self {
11670                format: fidl::new_empty!(Format, fidl::encoding::DefaultFuchsiaResourceDialect),
11671                ring_buffer: fidl::new_empty!(
11672                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11673                    fidl::encoding::DefaultFuchsiaResourceDialect
11674                ),
11675            }
11676        }
11677
11678        #[inline]
11679        unsafe fn decode(
11680            &mut self,
11681            decoder: &mut fidl::encoding::Decoder<
11682                '_,
11683                fidl::encoding::DefaultFuchsiaResourceDialect,
11684            >,
11685            offset: usize,
11686            _depth: fidl::encoding::Depth,
11687        ) -> fidl::Result<()> {
11688            decoder.debug_check_bounds::<Self>(offset);
11689            // Verify that padding bytes are zero.
11690            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11691            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11692            let mask = 0xffffffff00000000u64;
11693            let maskedval = padval & mask;
11694            if maskedval != 0 {
11695                return Err(fidl::Error::NonZeroPadding {
11696                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11697                });
11698            }
11699            fidl::decode!(
11700                Format,
11701                fidl::encoding::DefaultFuchsiaResourceDialect,
11702                &mut self.format,
11703                decoder,
11704                offset + 0,
11705                _depth
11706            )?;
11707            fidl::decode!(
11708                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RingBufferMarker>>,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710                &mut self.ring_buffer,
11711                decoder,
11712                offset + 16,
11713                _depth
11714            )?;
11715            Ok(())
11716        }
11717    }
11718}