Skip to main content

fdomain_fuchsia_hardware_audio_signalprocessing/
fdomain_fuchsia_hardware_audio_signalprocessing.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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_hardware_audio_signalprocessing__common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct ConnectorSignalProcessingConnectRequest {
15    pub protocol: fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
19    for ConnectorSignalProcessingConnectRequest
20{
21}
22
23#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
24pub struct ConnectorMarker;
25
26impl fdomain_client::fidl::ProtocolMarker for ConnectorMarker {
27    type Proxy = ConnectorProxy;
28    type RequestStream = ConnectorRequestStream;
29
30    const DEBUG_NAME: &'static str = "(anonymous) Connector";
31}
32
33pub trait ConnectorProxyInterface: Send + Sync {
34    fn r#signal_processing_connect(
35        &self,
36        protocol: fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
37    ) -> Result<(), fidl::Error>;
38}
39
40#[derive(Debug, Clone)]
41pub struct ConnectorProxy {
42    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
43}
44
45impl fdomain_client::fidl::Proxy for ConnectorProxy {
46    type Protocol = ConnectorMarker;
47
48    fn from_channel(inner: fdomain_client::Channel) -> Self {
49        Self::new(inner)
50    }
51
52    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
53        self.client.into_channel().map_err(|client| Self { client })
54    }
55
56    fn as_channel(&self) -> &fdomain_client::Channel {
57        self.client.as_channel()
58    }
59}
60
61impl ConnectorProxy {
62    /// Create a new Proxy for fuchsia.hardware.audio.signalprocessing/Connector.
63    pub fn new(channel: fdomain_client::Channel) -> Self {
64        let protocol_name = <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
65        Self { client: fidl::client::Client::new(channel, protocol_name) }
66    }
67
68    /// Get a Stream of events from the remote end of the protocol.
69    ///
70    /// # Panics
71    ///
72    /// Panics if the event stream was already taken.
73    pub fn take_event_stream(&self) -> ConnectorEventStream {
74        ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
75    }
76
77    /// Connect to a `SignalProcessing` protocol.
78    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
79    /// the maximum number of connections have already been created, for instance one, then the
80    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
81    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
82    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
83    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
84    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
85    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
86    /// is intended to be composed, and hence the more verbose name allows differentiation and
87    /// improved clarity.
88    pub fn r#signal_processing_connect(
89        &self,
90        mut protocol: fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
91    ) -> Result<(), fidl::Error> {
92        ConnectorProxyInterface::r#signal_processing_connect(self, protocol)
93    }
94}
95
96impl ConnectorProxyInterface for ConnectorProxy {
97    fn r#signal_processing_connect(
98        &self,
99        mut protocol: fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
100    ) -> Result<(), fidl::Error> {
101        self.client.send::<ConnectorSignalProcessingConnectRequest>(
102            (protocol,),
103            0xa81907ce6066295,
104            fidl::encoding::DynamicFlags::empty(),
105        )
106    }
107}
108
109pub struct ConnectorEventStream {
110    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
111}
112
113impl std::marker::Unpin for ConnectorEventStream {}
114
115impl futures::stream::FusedStream for ConnectorEventStream {
116    fn is_terminated(&self) -> bool {
117        self.event_receiver.is_terminated()
118    }
119}
120
121impl futures::Stream for ConnectorEventStream {
122    type Item = Result<ConnectorEvent, fidl::Error>;
123
124    fn poll_next(
125        mut self: std::pin::Pin<&mut Self>,
126        cx: &mut std::task::Context<'_>,
127    ) -> std::task::Poll<Option<Self::Item>> {
128        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
129            &mut self.event_receiver,
130            cx
131        )?) {
132            Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
133            None => std::task::Poll::Ready(None),
134        }
135    }
136}
137
138#[derive(Debug)]
139pub enum ConnectorEvent {}
140
141impl ConnectorEvent {
142    /// Decodes a message buffer as a [`ConnectorEvent`].
143    fn decode(
144        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
145    ) -> Result<ConnectorEvent, fidl::Error> {
146        let (bytes, _handles) = buf.split_mut();
147        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
148        debug_assert_eq!(tx_header.tx_id, 0);
149        match tx_header.ordinal {
150            _ => Err(fidl::Error::UnknownOrdinal {
151                ordinal: tx_header.ordinal,
152                protocol_name:
153                    <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
154            }),
155        }
156    }
157}
158
159/// A Stream of incoming requests for fuchsia.hardware.audio.signalprocessing/Connector.
160pub struct ConnectorRequestStream {
161    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
162    is_terminated: bool,
163}
164
165impl std::marker::Unpin for ConnectorRequestStream {}
166
167impl futures::stream::FusedStream for ConnectorRequestStream {
168    fn is_terminated(&self) -> bool {
169        self.is_terminated
170    }
171}
172
173impl fdomain_client::fidl::RequestStream for ConnectorRequestStream {
174    type Protocol = ConnectorMarker;
175    type ControlHandle = ConnectorControlHandle;
176
177    fn from_channel(channel: fdomain_client::Channel) -> Self {
178        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
179    }
180
181    fn control_handle(&self) -> Self::ControlHandle {
182        ConnectorControlHandle { inner: self.inner.clone() }
183    }
184
185    fn into_inner(
186        self,
187    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
188    {
189        (self.inner, self.is_terminated)
190    }
191
192    fn from_inner(
193        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
194        is_terminated: bool,
195    ) -> Self {
196        Self { inner, is_terminated }
197    }
198}
199
200impl futures::Stream for ConnectorRequestStream {
201    type Item = Result<ConnectorRequest, fidl::Error>;
202
203    fn poll_next(
204        mut self: std::pin::Pin<&mut Self>,
205        cx: &mut std::task::Context<'_>,
206    ) -> std::task::Poll<Option<Self::Item>> {
207        let this = &mut *self;
208        if this.inner.check_shutdown(cx) {
209            this.is_terminated = true;
210            return std::task::Poll::Ready(None);
211        }
212        if this.is_terminated {
213            panic!("polled ConnectorRequestStream after completion");
214        }
215        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
216            |bytes, handles| {
217                match this.inner.channel().read_etc(cx, bytes, handles) {
218                    std::task::Poll::Ready(Ok(())) => {}
219                    std::task::Poll::Pending => return std::task::Poll::Pending,
220                    std::task::Poll::Ready(Err(None)) => {
221                        this.is_terminated = true;
222                        return std::task::Poll::Ready(None);
223                    }
224                    std::task::Poll::Ready(Err(Some(e))) => {
225                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
226                            e.into(),
227                        ))));
228                    }
229                }
230
231                // A message has been received from the channel
232                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
233
234                std::task::Poll::Ready(Some(match header.ordinal {
235                    0xa81907ce6066295 => {
236                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
237                        let mut req = fidl::new_empty!(
238                            ConnectorSignalProcessingConnectRequest,
239                            fdomain_client::fidl::FDomainResourceDialect
240                        );
241                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ConnectorSignalProcessingConnectRequest>(&header, _body_bytes, handles, &mut req)?;
242                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
243                        Ok(ConnectorRequest::SignalProcessingConnect {
244                            protocol: req.protocol,
245
246                            control_handle,
247                        })
248                    }
249                    _ => Err(fidl::Error::UnknownOrdinal {
250                        ordinal: header.ordinal,
251                        protocol_name:
252                            <ConnectorMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
253                    }),
254                }))
255            },
256        )
257    }
258}
259
260/// For an overview of the signal processing protocols see
261/// [Audio Signal Processing](//docs/concepts/drivers/driver_architectures/audio_drivers/audio_signal_processing.md)
262#[derive(Debug)]
263pub enum ConnectorRequest {
264    /// Connect to a `SignalProcessing` protocol.
265    /// Multiple connections may be supported, if a new connection request is not supported, i.e.
266    /// the maximum number of connections have already been created, for instance one, then the
267    /// `protocol` channel (not the channel upon which `SignalProcessingConnect` is being called)
268    /// will be closed with a `ZX_ERR_ALREADY_BOUND` epitaph.
269    /// If signal processing is not supported at all, then the `protocol` channel (again, not the
270    /// channel upon which `SignalProcessingConnect` is being called) will be closed with a
271    /// `ZX_ERR_NOT_SUPPORTED` epitaph.
272    /// This method is named `SignalProcessingConnect` instead of `Connect` because this protocol
273    /// is intended to be composed, and hence the more verbose name allows differentiation and
274    /// improved clarity.
275    SignalProcessingConnect {
276        protocol: fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
277        control_handle: ConnectorControlHandle,
278    },
279}
280
281impl ConnectorRequest {
282    #[allow(irrefutable_let_patterns)]
283    pub fn into_signal_processing_connect(
284        self,
285    ) -> Option<(fdomain_client::fidl::ServerEnd<SignalProcessingMarker>, ConnectorControlHandle)>
286    {
287        if let ConnectorRequest::SignalProcessingConnect { protocol, control_handle } = self {
288            Some((protocol, control_handle))
289        } else {
290            None
291        }
292    }
293
294    /// Name of the method defined in FIDL
295    pub fn method_name(&self) -> &'static str {
296        match *self {
297            ConnectorRequest::SignalProcessingConnect { .. } => "signal_processing_connect",
298        }
299    }
300}
301
302#[derive(Debug, Clone)]
303pub struct ConnectorControlHandle {
304    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
305}
306
307impl fdomain_client::fidl::ControlHandle for ConnectorControlHandle {
308    fn shutdown(&self) {
309        self.inner.shutdown()
310    }
311
312    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
313        self.inner.shutdown_with_epitaph(status)
314    }
315
316    fn is_closed(&self) -> bool {
317        self.inner.channel().is_closed()
318    }
319    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
320        self.inner.channel().on_closed()
321    }
322}
323
324impl ConnectorControlHandle {}
325
326#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
327pub struct ReaderMarker;
328
329impl fdomain_client::fidl::ProtocolMarker for ReaderMarker {
330    type Proxy = ReaderProxy;
331    type RequestStream = ReaderRequestStream;
332
333    const DEBUG_NAME: &'static str = "(anonymous) Reader";
334}
335pub type ReaderGetElementsResult = Result<Vec<Element>, i32>;
336pub type ReaderGetTopologiesResult = Result<Vec<Topology>, i32>;
337
338pub trait ReaderProxyInterface: Send + Sync {
339    type GetElementsResponseFut: std::future::Future<Output = Result<ReaderGetElementsResult, fidl::Error>>
340        + Send;
341    fn r#get_elements(&self) -> Self::GetElementsResponseFut;
342    type WatchElementStateResponseFut: std::future::Future<Output = Result<ElementState, fidl::Error>>
343        + Send;
344    fn r#watch_element_state(
345        &self,
346        processing_element_id: u64,
347    ) -> Self::WatchElementStateResponseFut;
348    type GetTopologiesResponseFut: std::future::Future<Output = Result<ReaderGetTopologiesResult, fidl::Error>>
349        + Send;
350    fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut;
351    type WatchTopologyResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
352    fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut;
353}
354
355#[derive(Debug, Clone)]
356pub struct ReaderProxy {
357    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
358}
359
360impl fdomain_client::fidl::Proxy for ReaderProxy {
361    type Protocol = ReaderMarker;
362
363    fn from_channel(inner: fdomain_client::Channel) -> Self {
364        Self::new(inner)
365    }
366
367    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
368        self.client.into_channel().map_err(|client| Self { client })
369    }
370
371    fn as_channel(&self) -> &fdomain_client::Channel {
372        self.client.as_channel()
373    }
374}
375
376impl ReaderProxy {
377    /// Create a new Proxy for fuchsia.hardware.audio.signalprocessing/Reader.
378    pub fn new(channel: fdomain_client::Channel) -> Self {
379        let protocol_name = <ReaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
380        Self { client: fidl::client::Client::new(channel, protocol_name) }
381    }
382
383    /// Get a Stream of events from the remote end of the protocol.
384    ///
385    /// # Panics
386    ///
387    /// Panics if the event stream was already taken.
388    pub fn take_event_stream(&self) -> ReaderEventStream {
389        ReaderEventStream { event_receiver: self.client.take_event_receiver() }
390    }
391
392    /// Returns a vector of supported processing elements.
393    /// This vector must include one or more processing elements.
394    pub fn r#get_elements(
395        &self,
396    ) -> fidl::client::QueryResponseFut<
397        ReaderGetElementsResult,
398        fdomain_client::fidl::FDomainResourceDialect,
399    > {
400        ReaderProxyInterface::r#get_elements(self)
401    }
402
403    /// Get the processing element state via a hanging get.
404    /// For a given `processing_element_id`, the driver will immediately reply to the first
405    /// `WatchElementState` sent by the client. The driver will not respond to subsequent client
406    /// `WatchElementState` calls for that `processing_element_id` until any portion of the
407    /// `ElementState` has changed from what was most recently reported for that element.
408    ///
409    /// The driver will close the protocol channel with an error of `ZX_ERR_INVALID_ARGS`, if
410    /// `processing_element_id` does not match an ElementId returned by `GetElements`.
411    ///
412    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
413    /// method is called again while there is already a pending `WatchElementState` for this client
414    /// and `processing_element_id`.
415    pub fn r#watch_element_state(
416        &self,
417        mut processing_element_id: u64,
418    ) -> fidl::client::QueryResponseFut<ElementState, fdomain_client::fidl::FDomainResourceDialect>
419    {
420        ReaderProxyInterface::r#watch_element_state(self, processing_element_id)
421    }
422
423    /// Returns a vector of supported topologies.
424    /// This vector must include one or more topologies.
425    /// If more than one topology is returned, then the client may select any topology from the
426    /// list by calling `SetTopology`.
427    /// If only one topology is returned, `SetTopology` can still be called but causes no change.
428    ///
429    /// Each Element must be included in at least one Topology, but need not be included in every
430    /// Topology.
431    pub fn r#get_topologies(
432        &self,
433    ) -> fidl::client::QueryResponseFut<
434        ReaderGetTopologiesResult,
435        fdomain_client::fidl::FDomainResourceDialect,
436    > {
437        ReaderProxyInterface::r#get_topologies(self)
438    }
439
440    /// Get the current topology via a hanging get.
441    /// The driver will immediately reply to the first `WatchTopology` sent by each client.
442    /// The driver will not respond to subsequent `WatchTopology` calls from that client until the
443    /// signal processing topology changes; this occurs as a result of a `SetTopology` call.
444    ///
445    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
446    /// method is called again while there is already a pending `WatchTopology` for this client.
447    pub fn r#watch_topology(
448        &self,
449    ) -> fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect> {
450        ReaderProxyInterface::r#watch_topology(self)
451    }
452}
453
454impl ReaderProxyInterface for ReaderProxy {
455    type GetElementsResponseFut = fidl::client::QueryResponseFut<
456        ReaderGetElementsResult,
457        fdomain_client::fidl::FDomainResourceDialect,
458    >;
459    fn r#get_elements(&self) -> Self::GetElementsResponseFut {
460        fn _decode(
461            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
462        ) -> Result<ReaderGetElementsResult, fidl::Error> {
463            let _response = fidl::client::decode_transaction_body::<
464                fidl::encoding::ResultType<ReaderGetElementsResponse, i32>,
465                fdomain_client::fidl::FDomainResourceDialect,
466                0x1b14ff4adf5dc6f8,
467            >(_buf?)?;
468            Ok(_response.map(|x| x.processing_elements))
469        }
470        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ReaderGetElementsResult>(
471            (),
472            0x1b14ff4adf5dc6f8,
473            fidl::encoding::DynamicFlags::empty(),
474            _decode,
475        )
476    }
477
478    type WatchElementStateResponseFut =
479        fidl::client::QueryResponseFut<ElementState, fdomain_client::fidl::FDomainResourceDialect>;
480    fn r#watch_element_state(
481        &self,
482        mut processing_element_id: u64,
483    ) -> Self::WatchElementStateResponseFut {
484        fn _decode(
485            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
486        ) -> Result<ElementState, fidl::Error> {
487            let _response = fidl::client::decode_transaction_body::<
488                ReaderWatchElementStateResponse,
489                fdomain_client::fidl::FDomainResourceDialect,
490                0x524da8772a69056f,
491            >(_buf?)?;
492            Ok(_response.state)
493        }
494        self.client.send_query_and_decode::<ReaderWatchElementStateRequest, ElementState>(
495            (processing_element_id,),
496            0x524da8772a69056f,
497            fidl::encoding::DynamicFlags::empty(),
498            _decode,
499        )
500    }
501
502    type GetTopologiesResponseFut = fidl::client::QueryResponseFut<
503        ReaderGetTopologiesResult,
504        fdomain_client::fidl::FDomainResourceDialect,
505    >;
506    fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut {
507        fn _decode(
508            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
509        ) -> Result<ReaderGetTopologiesResult, fidl::Error> {
510            let _response = fidl::client::decode_transaction_body::<
511                fidl::encoding::ResultType<ReaderGetTopologiesResponse, i32>,
512                fdomain_client::fidl::FDomainResourceDialect,
513                0x73ffb73af24d30b6,
514            >(_buf?)?;
515            Ok(_response.map(|x| x.topologies))
516        }
517        self.client
518            .send_query_and_decode::<fidl::encoding::EmptyPayload, ReaderGetTopologiesResult>(
519                (),
520                0x73ffb73af24d30b6,
521                fidl::encoding::DynamicFlags::empty(),
522                _decode,
523            )
524    }
525
526    type WatchTopologyResponseFut =
527        fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect>;
528    fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut {
529        fn _decode(
530            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
531        ) -> Result<u64, fidl::Error> {
532            let _response = fidl::client::decode_transaction_body::<
533                fidl::encoding::FlexibleType<ReaderWatchTopologyResponse>,
534                fdomain_client::fidl::FDomainResourceDialect,
535                0x66d172acdb36a729,
536            >(_buf?)?
537            .into_result_fdomain::<ReaderMarker>("watch_topology")?;
538            Ok(_response.topology_id)
539        }
540        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
541            (),
542            0x66d172acdb36a729,
543            fidl::encoding::DynamicFlags::FLEXIBLE,
544            _decode,
545        )
546    }
547}
548
549pub struct ReaderEventStream {
550    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
551}
552
553impl std::marker::Unpin for ReaderEventStream {}
554
555impl futures::stream::FusedStream for ReaderEventStream {
556    fn is_terminated(&self) -> bool {
557        self.event_receiver.is_terminated()
558    }
559}
560
561impl futures::Stream for ReaderEventStream {
562    type Item = Result<ReaderEvent, fidl::Error>;
563
564    fn poll_next(
565        mut self: std::pin::Pin<&mut Self>,
566        cx: &mut std::task::Context<'_>,
567    ) -> std::task::Poll<Option<Self::Item>> {
568        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
569            &mut self.event_receiver,
570            cx
571        )?) {
572            Some(buf) => std::task::Poll::Ready(Some(ReaderEvent::decode(buf))),
573            None => std::task::Poll::Ready(None),
574        }
575    }
576}
577
578#[derive(Debug)]
579pub enum ReaderEvent {
580    #[non_exhaustive]
581    _UnknownEvent {
582        /// Ordinal of the event that was sent.
583        ordinal: u64,
584    },
585}
586
587impl ReaderEvent {
588    /// Decodes a message buffer as a [`ReaderEvent`].
589    fn decode(
590        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
591    ) -> Result<ReaderEvent, fidl::Error> {
592        let (bytes, _handles) = buf.split_mut();
593        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
594        debug_assert_eq!(tx_header.tx_id, 0);
595        match tx_header.ordinal {
596            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
597                Ok(ReaderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
598            }
599            _ => Err(fidl::Error::UnknownOrdinal {
600                ordinal: tx_header.ordinal,
601                protocol_name: <ReaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
602            }),
603        }
604    }
605}
606
607/// A Stream of incoming requests for fuchsia.hardware.audio.signalprocessing/Reader.
608pub struct ReaderRequestStream {
609    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
610    is_terminated: bool,
611}
612
613impl std::marker::Unpin for ReaderRequestStream {}
614
615impl futures::stream::FusedStream for ReaderRequestStream {
616    fn is_terminated(&self) -> bool {
617        self.is_terminated
618    }
619}
620
621impl fdomain_client::fidl::RequestStream for ReaderRequestStream {
622    type Protocol = ReaderMarker;
623    type ControlHandle = ReaderControlHandle;
624
625    fn from_channel(channel: fdomain_client::Channel) -> Self {
626        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
627    }
628
629    fn control_handle(&self) -> Self::ControlHandle {
630        ReaderControlHandle { inner: self.inner.clone() }
631    }
632
633    fn into_inner(
634        self,
635    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
636    {
637        (self.inner, self.is_terminated)
638    }
639
640    fn from_inner(
641        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
642        is_terminated: bool,
643    ) -> Self {
644        Self { inner, is_terminated }
645    }
646}
647
648impl futures::Stream for ReaderRequestStream {
649    type Item = Result<ReaderRequest, fidl::Error>;
650
651    fn poll_next(
652        mut self: std::pin::Pin<&mut Self>,
653        cx: &mut std::task::Context<'_>,
654    ) -> std::task::Poll<Option<Self::Item>> {
655        let this = &mut *self;
656        if this.inner.check_shutdown(cx) {
657            this.is_terminated = true;
658            return std::task::Poll::Ready(None);
659        }
660        if this.is_terminated {
661            panic!("polled ReaderRequestStream after completion");
662        }
663        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
664            |bytes, handles| {
665                match this.inner.channel().read_etc(cx, bytes, handles) {
666                    std::task::Poll::Ready(Ok(())) => {}
667                    std::task::Poll::Pending => return std::task::Poll::Pending,
668                    std::task::Poll::Ready(Err(None)) => {
669                        this.is_terminated = true;
670                        return std::task::Poll::Ready(None);
671                    }
672                    std::task::Poll::Ready(Err(Some(e))) => {
673                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
674                            e.into(),
675                        ))));
676                    }
677                }
678
679                // A message has been received from the channel
680                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
681
682                std::task::Poll::Ready(Some(match header.ordinal {
683                    0x1b14ff4adf5dc6f8 => {
684                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
685                        let mut req = fidl::new_empty!(
686                            fidl::encoding::EmptyPayload,
687                            fdomain_client::fidl::FDomainResourceDialect
688                        );
689                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
690                        let control_handle = ReaderControlHandle { inner: this.inner.clone() };
691                        Ok(ReaderRequest::GetElements {
692                            responder: ReaderGetElementsResponder {
693                                control_handle: std::mem::ManuallyDrop::new(control_handle),
694                                tx_id: header.tx_id,
695                            },
696                        })
697                    }
698                    0x524da8772a69056f => {
699                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
700                        let mut req = fidl::new_empty!(
701                            ReaderWatchElementStateRequest,
702                            fdomain_client::fidl::FDomainResourceDialect
703                        );
704                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ReaderWatchElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
705                        let control_handle = ReaderControlHandle { inner: this.inner.clone() };
706                        Ok(ReaderRequest::WatchElementState {
707                            processing_element_id: req.processing_element_id,
708
709                            responder: ReaderWatchElementStateResponder {
710                                control_handle: std::mem::ManuallyDrop::new(control_handle),
711                                tx_id: header.tx_id,
712                            },
713                        })
714                    }
715                    0x73ffb73af24d30b6 => {
716                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
717                        let mut req = fidl::new_empty!(
718                            fidl::encoding::EmptyPayload,
719                            fdomain_client::fidl::FDomainResourceDialect
720                        );
721                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
722                        let control_handle = ReaderControlHandle { inner: this.inner.clone() };
723                        Ok(ReaderRequest::GetTopologies {
724                            responder: ReaderGetTopologiesResponder {
725                                control_handle: std::mem::ManuallyDrop::new(control_handle),
726                                tx_id: header.tx_id,
727                            },
728                        })
729                    }
730                    0x66d172acdb36a729 => {
731                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
732                        let mut req = fidl::new_empty!(
733                            fidl::encoding::EmptyPayload,
734                            fdomain_client::fidl::FDomainResourceDialect
735                        );
736                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
737                        let control_handle = ReaderControlHandle { inner: this.inner.clone() };
738                        Ok(ReaderRequest::WatchTopology {
739                            responder: ReaderWatchTopologyResponder {
740                                control_handle: std::mem::ManuallyDrop::new(control_handle),
741                                tx_id: header.tx_id,
742                            },
743                        })
744                    }
745                    _ if header.tx_id == 0
746                        && header
747                            .dynamic_flags()
748                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
749                    {
750                        Ok(ReaderRequest::_UnknownMethod {
751                            ordinal: header.ordinal,
752                            control_handle: ReaderControlHandle { inner: this.inner.clone() },
753                            method_type: fidl::MethodType::OneWay,
754                        })
755                    }
756                    _ if header
757                        .dynamic_flags()
758                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
759                    {
760                        this.inner.send_framework_err(
761                            fidl::encoding::FrameworkErr::UnknownMethod,
762                            header.tx_id,
763                            header.ordinal,
764                            header.dynamic_flags(),
765                            (bytes, handles),
766                        )?;
767                        Ok(ReaderRequest::_UnknownMethod {
768                            ordinal: header.ordinal,
769                            control_handle: ReaderControlHandle { inner: this.inner.clone() },
770                            method_type: fidl::MethodType::TwoWay,
771                        })
772                    }
773                    _ => Err(fidl::Error::UnknownOrdinal {
774                        ordinal: header.ordinal,
775                        protocol_name:
776                            <ReaderMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
777                    }),
778                }))
779            },
780        )
781    }
782}
783
784/// This protocol is required for Composite audio drivers, and unsupported for other audio driver
785/// types (Codec, Dai, StreamConfig).
786///
787/// For an overview see
788/// [[Signal Processing Interface]](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_signal_processing).
789#[derive(Debug)]
790pub enum ReaderRequest {
791    /// Returns a vector of supported processing elements.
792    /// This vector must include one or more processing elements.
793    GetElements { responder: ReaderGetElementsResponder },
794    /// Get the processing element state via a hanging get.
795    /// For a given `processing_element_id`, the driver will immediately reply to the first
796    /// `WatchElementState` sent by the client. The driver will not respond to subsequent client
797    /// `WatchElementState` calls for that `processing_element_id` until any portion of the
798    /// `ElementState` has changed from what was most recently reported for that element.
799    ///
800    /// The driver will close the protocol channel with an error of `ZX_ERR_INVALID_ARGS`, if
801    /// `processing_element_id` does not match an ElementId returned by `GetElements`.
802    ///
803    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
804    /// method is called again while there is already a pending `WatchElementState` for this client
805    /// and `processing_element_id`.
806    WatchElementState { processing_element_id: u64, responder: ReaderWatchElementStateResponder },
807    /// Returns a vector of supported topologies.
808    /// This vector must include one or more topologies.
809    /// If more than one topology is returned, then the client may select any topology from the
810    /// list by calling `SetTopology`.
811    /// If only one topology is returned, `SetTopology` can still be called but causes no change.
812    ///
813    /// Each Element must be included in at least one Topology, but need not be included in every
814    /// Topology.
815    GetTopologies { responder: ReaderGetTopologiesResponder },
816    /// Get the current topology via a hanging get.
817    /// The driver will immediately reply to the first `WatchTopology` sent by each client.
818    /// The driver will not respond to subsequent `WatchTopology` calls from that client until the
819    /// signal processing topology changes; this occurs as a result of a `SetTopology` call.
820    ///
821    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
822    /// method is called again while there is already a pending `WatchTopology` for this client.
823    WatchTopology { responder: ReaderWatchTopologyResponder },
824    /// An interaction was received which does not match any known method.
825    #[non_exhaustive]
826    _UnknownMethod {
827        /// Ordinal of the method that was called.
828        ordinal: u64,
829        control_handle: ReaderControlHandle,
830        method_type: fidl::MethodType,
831    },
832}
833
834impl ReaderRequest {
835    #[allow(irrefutable_let_patterns)]
836    pub fn into_get_elements(self) -> Option<(ReaderGetElementsResponder)> {
837        if let ReaderRequest::GetElements { responder } = self { Some((responder)) } else { None }
838    }
839
840    #[allow(irrefutable_let_patterns)]
841    pub fn into_watch_element_state(self) -> Option<(u64, ReaderWatchElementStateResponder)> {
842        if let ReaderRequest::WatchElementState { processing_element_id, responder } = self {
843            Some((processing_element_id, responder))
844        } else {
845            None
846        }
847    }
848
849    #[allow(irrefutable_let_patterns)]
850    pub fn into_get_topologies(self) -> Option<(ReaderGetTopologiesResponder)> {
851        if let ReaderRequest::GetTopologies { responder } = self { Some((responder)) } else { None }
852    }
853
854    #[allow(irrefutable_let_patterns)]
855    pub fn into_watch_topology(self) -> Option<(ReaderWatchTopologyResponder)> {
856        if let ReaderRequest::WatchTopology { responder } = self { Some((responder)) } else { None }
857    }
858
859    /// Name of the method defined in FIDL
860    pub fn method_name(&self) -> &'static str {
861        match *self {
862            ReaderRequest::GetElements { .. } => "get_elements",
863            ReaderRequest::WatchElementState { .. } => "watch_element_state",
864            ReaderRequest::GetTopologies { .. } => "get_topologies",
865            ReaderRequest::WatchTopology { .. } => "watch_topology",
866            ReaderRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
867                "unknown one-way method"
868            }
869            ReaderRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
870                "unknown two-way method"
871            }
872        }
873    }
874}
875
876#[derive(Debug, Clone)]
877pub struct ReaderControlHandle {
878    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
879}
880
881impl fdomain_client::fidl::ControlHandle for ReaderControlHandle {
882    fn shutdown(&self) {
883        self.inner.shutdown()
884    }
885
886    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
887        self.inner.shutdown_with_epitaph(status)
888    }
889
890    fn is_closed(&self) -> bool {
891        self.inner.channel().is_closed()
892    }
893    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
894        self.inner.channel().on_closed()
895    }
896}
897
898impl ReaderControlHandle {}
899
900#[must_use = "FIDL methods require a response to be sent"]
901#[derive(Debug)]
902pub struct ReaderGetElementsResponder {
903    control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
904    tx_id: u32,
905}
906
907/// Set the the channel to be shutdown (see [`ReaderControlHandle::shutdown`])
908/// if the responder is dropped without sending a response, so that the client
909/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
910impl std::ops::Drop for ReaderGetElementsResponder {
911    fn drop(&mut self) {
912        self.control_handle.shutdown();
913        // Safety: drops once, never accessed again
914        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
915    }
916}
917
918impl fdomain_client::fidl::Responder for ReaderGetElementsResponder {
919    type ControlHandle = ReaderControlHandle;
920
921    fn control_handle(&self) -> &ReaderControlHandle {
922        &self.control_handle
923    }
924
925    fn drop_without_shutdown(mut self) {
926        // Safety: drops once, never accessed again due to mem::forget
927        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
928        // Prevent Drop from running (which would shut down the channel)
929        std::mem::forget(self);
930    }
931}
932
933impl ReaderGetElementsResponder {
934    /// Sends a response to the FIDL transaction.
935    ///
936    /// Sets the channel to shutdown if an error occurs.
937    pub fn send(self, mut result: Result<&[Element], i32>) -> Result<(), fidl::Error> {
938        let _result = self.send_raw(result);
939        if _result.is_err() {
940            self.control_handle.shutdown();
941        }
942        self.drop_without_shutdown();
943        _result
944    }
945
946    /// Similar to "send" but does not shutdown the channel if an error occurs.
947    pub fn send_no_shutdown_on_err(
948        self,
949        mut result: Result<&[Element], i32>,
950    ) -> Result<(), fidl::Error> {
951        let _result = self.send_raw(result);
952        self.drop_without_shutdown();
953        _result
954    }
955
956    fn send_raw(&self, mut result: Result<&[Element], i32>) -> Result<(), fidl::Error> {
957        self.control_handle
958            .inner
959            .send::<fidl::encoding::ResultType<ReaderGetElementsResponse, i32>>(
960                result.map(|processing_elements| (processing_elements,)),
961                self.tx_id,
962                0x1b14ff4adf5dc6f8,
963                fidl::encoding::DynamicFlags::empty(),
964            )
965    }
966}
967
968#[must_use = "FIDL methods require a response to be sent"]
969#[derive(Debug)]
970pub struct ReaderWatchElementStateResponder {
971    control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
972    tx_id: u32,
973}
974
975/// Set the the channel to be shutdown (see [`ReaderControlHandle::shutdown`])
976/// if the responder is dropped without sending a response, so that the client
977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
978impl std::ops::Drop for ReaderWatchElementStateResponder {
979    fn drop(&mut self) {
980        self.control_handle.shutdown();
981        // Safety: drops once, never accessed again
982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
983    }
984}
985
986impl fdomain_client::fidl::Responder for ReaderWatchElementStateResponder {
987    type ControlHandle = ReaderControlHandle;
988
989    fn control_handle(&self) -> &ReaderControlHandle {
990        &self.control_handle
991    }
992
993    fn drop_without_shutdown(mut self) {
994        // Safety: drops once, never accessed again due to mem::forget
995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
996        // Prevent Drop from running (which would shut down the channel)
997        std::mem::forget(self);
998    }
999}
1000
1001impl ReaderWatchElementStateResponder {
1002    /// Sends a response to the FIDL transaction.
1003    ///
1004    /// Sets the channel to shutdown if an error occurs.
1005    pub fn send(self, mut state: &ElementState) -> Result<(), fidl::Error> {
1006        let _result = self.send_raw(state);
1007        if _result.is_err() {
1008            self.control_handle.shutdown();
1009        }
1010        self.drop_without_shutdown();
1011        _result
1012    }
1013
1014    /// Similar to "send" but does not shutdown the channel if an error occurs.
1015    pub fn send_no_shutdown_on_err(self, mut state: &ElementState) -> Result<(), fidl::Error> {
1016        let _result = self.send_raw(state);
1017        self.drop_without_shutdown();
1018        _result
1019    }
1020
1021    fn send_raw(&self, mut state: &ElementState) -> Result<(), fidl::Error> {
1022        self.control_handle.inner.send::<ReaderWatchElementStateResponse>(
1023            (state,),
1024            self.tx_id,
1025            0x524da8772a69056f,
1026            fidl::encoding::DynamicFlags::empty(),
1027        )
1028    }
1029}
1030
1031#[must_use = "FIDL methods require a response to be sent"]
1032#[derive(Debug)]
1033pub struct ReaderGetTopologiesResponder {
1034    control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
1035    tx_id: u32,
1036}
1037
1038/// Set the the channel to be shutdown (see [`ReaderControlHandle::shutdown`])
1039/// if the responder is dropped without sending a response, so that the client
1040/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1041impl std::ops::Drop for ReaderGetTopologiesResponder {
1042    fn drop(&mut self) {
1043        self.control_handle.shutdown();
1044        // Safety: drops once, never accessed again
1045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1046    }
1047}
1048
1049impl fdomain_client::fidl::Responder for ReaderGetTopologiesResponder {
1050    type ControlHandle = ReaderControlHandle;
1051
1052    fn control_handle(&self) -> &ReaderControlHandle {
1053        &self.control_handle
1054    }
1055
1056    fn drop_without_shutdown(mut self) {
1057        // Safety: drops once, never accessed again due to mem::forget
1058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1059        // Prevent Drop from running (which would shut down the channel)
1060        std::mem::forget(self);
1061    }
1062}
1063
1064impl ReaderGetTopologiesResponder {
1065    /// Sends a response to the FIDL transaction.
1066    ///
1067    /// Sets the channel to shutdown if an error occurs.
1068    pub fn send(self, mut result: Result<&[Topology], i32>) -> Result<(), fidl::Error> {
1069        let _result = self.send_raw(result);
1070        if _result.is_err() {
1071            self.control_handle.shutdown();
1072        }
1073        self.drop_without_shutdown();
1074        _result
1075    }
1076
1077    /// Similar to "send" but does not shutdown the channel if an error occurs.
1078    pub fn send_no_shutdown_on_err(
1079        self,
1080        mut result: Result<&[Topology], i32>,
1081    ) -> Result<(), fidl::Error> {
1082        let _result = self.send_raw(result);
1083        self.drop_without_shutdown();
1084        _result
1085    }
1086
1087    fn send_raw(&self, mut result: Result<&[Topology], i32>) -> Result<(), fidl::Error> {
1088        self.control_handle
1089            .inner
1090            .send::<fidl::encoding::ResultType<ReaderGetTopologiesResponse, i32>>(
1091                result.map(|topologies| (topologies,)),
1092                self.tx_id,
1093                0x73ffb73af24d30b6,
1094                fidl::encoding::DynamicFlags::empty(),
1095            )
1096    }
1097}
1098
1099#[must_use = "FIDL methods require a response to be sent"]
1100#[derive(Debug)]
1101pub struct ReaderWatchTopologyResponder {
1102    control_handle: std::mem::ManuallyDrop<ReaderControlHandle>,
1103    tx_id: u32,
1104}
1105
1106/// Set the the channel to be shutdown (see [`ReaderControlHandle::shutdown`])
1107/// if the responder is dropped without sending a response, so that the client
1108/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1109impl std::ops::Drop for ReaderWatchTopologyResponder {
1110    fn drop(&mut self) {
1111        self.control_handle.shutdown();
1112        // Safety: drops once, never accessed again
1113        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1114    }
1115}
1116
1117impl fdomain_client::fidl::Responder for ReaderWatchTopologyResponder {
1118    type ControlHandle = ReaderControlHandle;
1119
1120    fn control_handle(&self) -> &ReaderControlHandle {
1121        &self.control_handle
1122    }
1123
1124    fn drop_without_shutdown(mut self) {
1125        // Safety: drops once, never accessed again due to mem::forget
1126        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1127        // Prevent Drop from running (which would shut down the channel)
1128        std::mem::forget(self);
1129    }
1130}
1131
1132impl ReaderWatchTopologyResponder {
1133    /// Sends a response to the FIDL transaction.
1134    ///
1135    /// Sets the channel to shutdown if an error occurs.
1136    pub fn send(self, mut topology_id: u64) -> Result<(), fidl::Error> {
1137        let _result = self.send_raw(topology_id);
1138        if _result.is_err() {
1139            self.control_handle.shutdown();
1140        }
1141        self.drop_without_shutdown();
1142        _result
1143    }
1144
1145    /// Similar to "send" but does not shutdown the channel if an error occurs.
1146    pub fn send_no_shutdown_on_err(self, mut topology_id: u64) -> Result<(), fidl::Error> {
1147        let _result = self.send_raw(topology_id);
1148        self.drop_without_shutdown();
1149        _result
1150    }
1151
1152    fn send_raw(&self, mut topology_id: u64) -> Result<(), fidl::Error> {
1153        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ReaderWatchTopologyResponse>>(
1154            fidl::encoding::Flexible::new((topology_id,)),
1155            self.tx_id,
1156            0x66d172acdb36a729,
1157            fidl::encoding::DynamicFlags::FLEXIBLE,
1158        )
1159    }
1160}
1161
1162#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1163pub struct SignalProcessingMarker;
1164
1165impl fdomain_client::fidl::ProtocolMarker for SignalProcessingMarker {
1166    type Proxy = SignalProcessingProxy;
1167    type RequestStream = SignalProcessingRequestStream;
1168
1169    const DEBUG_NAME: &'static str = "(anonymous) SignalProcessing";
1170}
1171pub type SignalProcessingSetTopologyResult = Result<(), i32>;
1172pub type SignalProcessingSetElementStateResult = Result<(), i32>;
1173
1174pub trait SignalProcessingProxyInterface: Send + Sync {
1175    type GetElementsResponseFut: std::future::Future<Output = Result<ReaderGetElementsResult, fidl::Error>>
1176        + Send;
1177    fn r#get_elements(&self) -> Self::GetElementsResponseFut;
1178    type WatchElementStateResponseFut: std::future::Future<Output = Result<ElementState, fidl::Error>>
1179        + Send;
1180    fn r#watch_element_state(
1181        &self,
1182        processing_element_id: u64,
1183    ) -> Self::WatchElementStateResponseFut;
1184    type GetTopologiesResponseFut: std::future::Future<Output = Result<ReaderGetTopologiesResult, fidl::Error>>
1185        + Send;
1186    fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut;
1187    type WatchTopologyResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
1188    fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut;
1189    type SetTopologyResponseFut: std::future::Future<Output = Result<SignalProcessingSetTopologyResult, fidl::Error>>
1190        + Send;
1191    fn r#set_topology(&self, topology_id: u64) -> Self::SetTopologyResponseFut;
1192    type SetElementStateResponseFut: std::future::Future<Output = Result<SignalProcessingSetElementStateResult, fidl::Error>>
1193        + Send;
1194    fn r#set_element_state(
1195        &self,
1196        processing_element_id: u64,
1197        state: &SettableElementState,
1198    ) -> Self::SetElementStateResponseFut;
1199}
1200
1201#[derive(Debug, Clone)]
1202pub struct SignalProcessingProxy {
1203    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1204}
1205
1206impl fdomain_client::fidl::Proxy for SignalProcessingProxy {
1207    type Protocol = SignalProcessingMarker;
1208
1209    fn from_channel(inner: fdomain_client::Channel) -> Self {
1210        Self::new(inner)
1211    }
1212
1213    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1214        self.client.into_channel().map_err(|client| Self { client })
1215    }
1216
1217    fn as_channel(&self) -> &fdomain_client::Channel {
1218        self.client.as_channel()
1219    }
1220}
1221
1222impl SignalProcessingProxy {
1223    /// Create a new Proxy for fuchsia.hardware.audio.signalprocessing/SignalProcessing.
1224    pub fn new(channel: fdomain_client::Channel) -> Self {
1225        let protocol_name =
1226            <SignalProcessingMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1227        Self { client: fidl::client::Client::new(channel, protocol_name) }
1228    }
1229
1230    /// Get a Stream of events from the remote end of the protocol.
1231    ///
1232    /// # Panics
1233    ///
1234    /// Panics if the event stream was already taken.
1235    pub fn take_event_stream(&self) -> SignalProcessingEventStream {
1236        SignalProcessingEventStream { event_receiver: self.client.take_event_receiver() }
1237    }
1238
1239    /// Returns a vector of supported processing elements.
1240    /// This vector must include one or more processing elements.
1241    pub fn r#get_elements(
1242        &self,
1243    ) -> fidl::client::QueryResponseFut<
1244        ReaderGetElementsResult,
1245        fdomain_client::fidl::FDomainResourceDialect,
1246    > {
1247        SignalProcessingProxyInterface::r#get_elements(self)
1248    }
1249
1250    /// Get the processing element state via a hanging get.
1251    /// For a given `processing_element_id`, the driver will immediately reply to the first
1252    /// `WatchElementState` sent by the client. The driver will not respond to subsequent client
1253    /// `WatchElementState` calls for that `processing_element_id` until any portion of the
1254    /// `ElementState` has changed from what was most recently reported for that element.
1255    ///
1256    /// The driver will close the protocol channel with an error of `ZX_ERR_INVALID_ARGS`, if
1257    /// `processing_element_id` does not match an ElementId returned by `GetElements`.
1258    ///
1259    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
1260    /// method is called again while there is already a pending `WatchElementState` for this client
1261    /// and `processing_element_id`.
1262    pub fn r#watch_element_state(
1263        &self,
1264        mut processing_element_id: u64,
1265    ) -> fidl::client::QueryResponseFut<ElementState, fdomain_client::fidl::FDomainResourceDialect>
1266    {
1267        SignalProcessingProxyInterface::r#watch_element_state(self, processing_element_id)
1268    }
1269
1270    /// Returns a vector of supported topologies.
1271    /// This vector must include one or more topologies.
1272    /// If more than one topology is returned, then the client may select any topology from the
1273    /// list by calling `SetTopology`.
1274    /// If only one topology is returned, `SetTopology` can still be called but causes no change.
1275    ///
1276    /// Each Element must be included in at least one Topology, but need not be included in every
1277    /// Topology.
1278    pub fn r#get_topologies(
1279        &self,
1280    ) -> fidl::client::QueryResponseFut<
1281        ReaderGetTopologiesResult,
1282        fdomain_client::fidl::FDomainResourceDialect,
1283    > {
1284        SignalProcessingProxyInterface::r#get_topologies(self)
1285    }
1286
1287    /// Get the current topology via a hanging get.
1288    /// The driver will immediately reply to the first `WatchTopology` sent by each client.
1289    /// The driver will not respond to subsequent `WatchTopology` calls from that client until the
1290    /// signal processing topology changes; this occurs as a result of a `SetTopology` call.
1291    ///
1292    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
1293    /// method is called again while there is already a pending `WatchTopology` for this client.
1294    pub fn r#watch_topology(
1295        &self,
1296    ) -> fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect> {
1297        SignalProcessingProxyInterface::r#watch_topology(self)
1298    }
1299
1300    /// Sets the currently active topology by specifying a `topology_id`, which matches to an entry
1301    /// in the vector returned by `GetTopologies`.
1302    /// The currently active topology is communicated by `WatchTopology` responses. To change which
1303    /// topology is active, a client uses `SetTopology`.
1304    ///
1305    /// If `GetTopologies` returns only one `Topology`, `SetTopology` is optional and has no effect.
1306    ///
1307    /// This call will fail and return `ZX_ERR_INVALID_ARGS` if the specified `topology_id` is not
1308    /// found within the`topologies` returned by `GetTopologies`.
1309    ///
1310    /// `SetTopology` may be called before or after non-`SignalProcessing` protocol calls.
1311    /// If called after non-`SignalProcessing` protocol calls, then `SetTopology` may return
1312    /// `ZX_ERR_BAD_STATE` to indicate that the operation can not proceed without renegotiation of
1313    /// the driver state. See `SetElementState` for further discussion.
1314    pub fn r#set_topology(
1315        &self,
1316        mut topology_id: u64,
1317    ) -> fidl::client::QueryResponseFut<
1318        SignalProcessingSetTopologyResult,
1319        fdomain_client::fidl::FDomainResourceDialect,
1320    > {
1321        SignalProcessingProxyInterface::r#set_topology(self, topology_id)
1322    }
1323
1324    /// Controls the processing element specified by `processing_element_id`, a unique ElementId
1325    /// returned by `GetElements`.
1326    /// The `state` specified in calls to `SetElementState` is a `SettableElementState`. This is a
1327    /// subset of `ElementState` because some fields returned by `WatchElementState` (e.g. `latency`
1328    /// or `plug_state`) can only be observed (not set) by the client.
1329    ///
1330    /// Returns `ZX_ERR_INVALID_ARGS` if `processing_element_id` does not match a known ElementId
1331    /// returned by `GetElements`, or if `state` is not valid for the element. This entails any
1332    /// violation of the rules specified in this protocol.
1333    ///
1334    /// Examples:
1335    /// `state` specifies that an element should be stopped or bypassed, but the corresponding
1336    ///     element does not specify (or explicitly set to false) `can_stop` or `can_bypass`.
1337    /// `state` includes a `type_specific` entry, but that `SettableTypeSpecificElementState` does
1338    ///     not match the `ElementType` of the element corresponding to `processing_element_id`.
1339    /// `state` changes an `EqualizerBandState` for an `EQUALIZER` element (so far so good), but
1340    ///     specifies a change to `frequency` when this element did not set `CAN_CONTROL_FREQUENCY`
1341    ///     in its `supported_controls`.
1342    /// `state` specifies a `GainElementState` for a `GAIN` element with a `gain` value that is
1343    ///     -infinity, NAN, or outside the Element's stated [`min_gain`, `max_gain`] range.
1344    ///
1345    /// Callers may intersperse method calls to the `SignalProcessing` protocol with calls to other
1346    /// driver protocols. Some non-`SignalProcessing` configuration changes may require a
1347    /// renegotiation of the driver state before certain elements can receive a `SetElementState`.
1348    /// For example, if a `DaiFormat` is changed, then `SetElementState` changing an `AGL` element's
1349    /// parameters may not require renegotiation of driver state because changing gain parameters
1350    /// usually does not change the set of supported audio formats.
1351    /// By contrast, following the same `DaiFormat` change, before `SetElementState` can be called
1352    /// on a `CONNECTION_POINT` element, the driver state may need to be reestablished because the
1353    /// format change may invalidate the set of supported formats returned in a previous
1354    /// `GetDaiFormats` protocol call for another part of the Topology.
1355    ///
1356    /// It is the driver's job to determine when renegotiation is required. When this is needed,
1357    /// the related `SetElementState` call must return `ZX_ERR_BAD_STATE` and the client must
1358    /// close the protocol channel entirely, such that the protocol negotiations are started over.
1359    /// The client then must re-invoke the `SetElementState` call that returned
1360    /// `ZX_ERR_BAD_STATE` before any non-`SignalProcessing` protocol calls.
1361    pub fn r#set_element_state(
1362        &self,
1363        mut processing_element_id: u64,
1364        mut state: &SettableElementState,
1365    ) -> fidl::client::QueryResponseFut<
1366        SignalProcessingSetElementStateResult,
1367        fdomain_client::fidl::FDomainResourceDialect,
1368    > {
1369        SignalProcessingProxyInterface::r#set_element_state(self, processing_element_id, state)
1370    }
1371}
1372
1373impl SignalProcessingProxyInterface for SignalProcessingProxy {
1374    type GetElementsResponseFut = fidl::client::QueryResponseFut<
1375        ReaderGetElementsResult,
1376        fdomain_client::fidl::FDomainResourceDialect,
1377    >;
1378    fn r#get_elements(&self) -> Self::GetElementsResponseFut {
1379        fn _decode(
1380            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1381        ) -> Result<ReaderGetElementsResult, fidl::Error> {
1382            let _response = fidl::client::decode_transaction_body::<
1383                fidl::encoding::ResultType<ReaderGetElementsResponse, i32>,
1384                fdomain_client::fidl::FDomainResourceDialect,
1385                0x1b14ff4adf5dc6f8,
1386            >(_buf?)?;
1387            Ok(_response.map(|x| x.processing_elements))
1388        }
1389        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ReaderGetElementsResult>(
1390            (),
1391            0x1b14ff4adf5dc6f8,
1392            fidl::encoding::DynamicFlags::empty(),
1393            _decode,
1394        )
1395    }
1396
1397    type WatchElementStateResponseFut =
1398        fidl::client::QueryResponseFut<ElementState, fdomain_client::fidl::FDomainResourceDialect>;
1399    fn r#watch_element_state(
1400        &self,
1401        mut processing_element_id: u64,
1402    ) -> Self::WatchElementStateResponseFut {
1403        fn _decode(
1404            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1405        ) -> Result<ElementState, fidl::Error> {
1406            let _response = fidl::client::decode_transaction_body::<
1407                ReaderWatchElementStateResponse,
1408                fdomain_client::fidl::FDomainResourceDialect,
1409                0x524da8772a69056f,
1410            >(_buf?)?;
1411            Ok(_response.state)
1412        }
1413        self.client.send_query_and_decode::<ReaderWatchElementStateRequest, ElementState>(
1414            (processing_element_id,),
1415            0x524da8772a69056f,
1416            fidl::encoding::DynamicFlags::empty(),
1417            _decode,
1418        )
1419    }
1420
1421    type GetTopologiesResponseFut = fidl::client::QueryResponseFut<
1422        ReaderGetTopologiesResult,
1423        fdomain_client::fidl::FDomainResourceDialect,
1424    >;
1425    fn r#get_topologies(&self) -> Self::GetTopologiesResponseFut {
1426        fn _decode(
1427            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1428        ) -> Result<ReaderGetTopologiesResult, fidl::Error> {
1429            let _response = fidl::client::decode_transaction_body::<
1430                fidl::encoding::ResultType<ReaderGetTopologiesResponse, i32>,
1431                fdomain_client::fidl::FDomainResourceDialect,
1432                0x73ffb73af24d30b6,
1433            >(_buf?)?;
1434            Ok(_response.map(|x| x.topologies))
1435        }
1436        self.client
1437            .send_query_and_decode::<fidl::encoding::EmptyPayload, ReaderGetTopologiesResult>(
1438                (),
1439                0x73ffb73af24d30b6,
1440                fidl::encoding::DynamicFlags::empty(),
1441                _decode,
1442            )
1443    }
1444
1445    type WatchTopologyResponseFut =
1446        fidl::client::QueryResponseFut<u64, fdomain_client::fidl::FDomainResourceDialect>;
1447    fn r#watch_topology(&self) -> Self::WatchTopologyResponseFut {
1448        fn _decode(
1449            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1450        ) -> Result<u64, fidl::Error> {
1451            let _response = fidl::client::decode_transaction_body::<
1452                fidl::encoding::FlexibleType<ReaderWatchTopologyResponse>,
1453                fdomain_client::fidl::FDomainResourceDialect,
1454                0x66d172acdb36a729,
1455            >(_buf?)?
1456            .into_result_fdomain::<SignalProcessingMarker>("watch_topology")?;
1457            Ok(_response.topology_id)
1458        }
1459        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
1460            (),
1461            0x66d172acdb36a729,
1462            fidl::encoding::DynamicFlags::FLEXIBLE,
1463            _decode,
1464        )
1465    }
1466
1467    type SetTopologyResponseFut = fidl::client::QueryResponseFut<
1468        SignalProcessingSetTopologyResult,
1469        fdomain_client::fidl::FDomainResourceDialect,
1470    >;
1471    fn r#set_topology(&self, mut topology_id: u64) -> Self::SetTopologyResponseFut {
1472        fn _decode(
1473            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1474        ) -> Result<SignalProcessingSetTopologyResult, fidl::Error> {
1475            let _response = fidl::client::decode_transaction_body::<
1476                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1477                fdomain_client::fidl::FDomainResourceDialect,
1478                0x1d9a7f9b8fee790c,
1479            >(_buf?)?;
1480            Ok(_response.map(|x| x))
1481        }
1482        self.client.send_query_and_decode::<
1483            SignalProcessingSetTopologyRequest,
1484            SignalProcessingSetTopologyResult,
1485        >(
1486            (topology_id,),
1487            0x1d9a7f9b8fee790c,
1488            fidl::encoding::DynamicFlags::empty(),
1489            _decode,
1490        )
1491    }
1492
1493    type SetElementStateResponseFut = fidl::client::QueryResponseFut<
1494        SignalProcessingSetElementStateResult,
1495        fdomain_client::fidl::FDomainResourceDialect,
1496    >;
1497    fn r#set_element_state(
1498        &self,
1499        mut processing_element_id: u64,
1500        mut state: &SettableElementState,
1501    ) -> Self::SetElementStateResponseFut {
1502        fn _decode(
1503            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1504        ) -> Result<SignalProcessingSetElementStateResult, fidl::Error> {
1505            let _response = fidl::client::decode_transaction_body::<
1506                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1507                fdomain_client::fidl::FDomainResourceDialect,
1508                0x38c3b2d4bae698f4,
1509            >(_buf?)?;
1510            Ok(_response.map(|x| x))
1511        }
1512        self.client.send_query_and_decode::<
1513            SignalProcessingSetElementStateRequest,
1514            SignalProcessingSetElementStateResult,
1515        >(
1516            (processing_element_id, state,),
1517            0x38c3b2d4bae698f4,
1518            fidl::encoding::DynamicFlags::empty(),
1519            _decode,
1520        )
1521    }
1522}
1523
1524pub struct SignalProcessingEventStream {
1525    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1526}
1527
1528impl std::marker::Unpin for SignalProcessingEventStream {}
1529
1530impl futures::stream::FusedStream for SignalProcessingEventStream {
1531    fn is_terminated(&self) -> bool {
1532        self.event_receiver.is_terminated()
1533    }
1534}
1535
1536impl futures::Stream for SignalProcessingEventStream {
1537    type Item = Result<SignalProcessingEvent, fidl::Error>;
1538
1539    fn poll_next(
1540        mut self: std::pin::Pin<&mut Self>,
1541        cx: &mut std::task::Context<'_>,
1542    ) -> std::task::Poll<Option<Self::Item>> {
1543        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1544            &mut self.event_receiver,
1545            cx
1546        )?) {
1547            Some(buf) => std::task::Poll::Ready(Some(SignalProcessingEvent::decode(buf))),
1548            None => std::task::Poll::Ready(None),
1549        }
1550    }
1551}
1552
1553#[derive(Debug)]
1554pub enum SignalProcessingEvent {
1555    #[non_exhaustive]
1556    _UnknownEvent {
1557        /// Ordinal of the event that was sent.
1558        ordinal: u64,
1559    },
1560}
1561
1562impl SignalProcessingEvent {
1563    /// Decodes a message buffer as a [`SignalProcessingEvent`].
1564    fn decode(
1565        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1566    ) -> Result<SignalProcessingEvent, fidl::Error> {
1567        let (bytes, _handles) = buf.split_mut();
1568        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1569        debug_assert_eq!(tx_header.tx_id, 0);
1570        match tx_header.ordinal {
1571            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1572                Ok(SignalProcessingEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1573            }
1574            _ => Err(fidl::Error::UnknownOrdinal {
1575                ordinal: tx_header.ordinal,
1576                protocol_name:
1577                    <SignalProcessingMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1578            }),
1579        }
1580    }
1581}
1582
1583/// A Stream of incoming requests for fuchsia.hardware.audio.signalprocessing/SignalProcessing.
1584pub struct SignalProcessingRequestStream {
1585    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1586    is_terminated: bool,
1587}
1588
1589impl std::marker::Unpin for SignalProcessingRequestStream {}
1590
1591impl futures::stream::FusedStream for SignalProcessingRequestStream {
1592    fn is_terminated(&self) -> bool {
1593        self.is_terminated
1594    }
1595}
1596
1597impl fdomain_client::fidl::RequestStream for SignalProcessingRequestStream {
1598    type Protocol = SignalProcessingMarker;
1599    type ControlHandle = SignalProcessingControlHandle;
1600
1601    fn from_channel(channel: fdomain_client::Channel) -> Self {
1602        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1603    }
1604
1605    fn control_handle(&self) -> Self::ControlHandle {
1606        SignalProcessingControlHandle { inner: self.inner.clone() }
1607    }
1608
1609    fn into_inner(
1610        self,
1611    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1612    {
1613        (self.inner, self.is_terminated)
1614    }
1615
1616    fn from_inner(
1617        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1618        is_terminated: bool,
1619    ) -> Self {
1620        Self { inner, is_terminated }
1621    }
1622}
1623
1624impl futures::Stream for SignalProcessingRequestStream {
1625    type Item = Result<SignalProcessingRequest, fidl::Error>;
1626
1627    fn poll_next(
1628        mut self: std::pin::Pin<&mut Self>,
1629        cx: &mut std::task::Context<'_>,
1630    ) -> std::task::Poll<Option<Self::Item>> {
1631        let this = &mut *self;
1632        if this.inner.check_shutdown(cx) {
1633            this.is_terminated = true;
1634            return std::task::Poll::Ready(None);
1635        }
1636        if this.is_terminated {
1637            panic!("polled SignalProcessingRequestStream after completion");
1638        }
1639        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1640            |bytes, handles| {
1641                match this.inner.channel().read_etc(cx, bytes, handles) {
1642                    std::task::Poll::Ready(Ok(())) => {}
1643                    std::task::Poll::Pending => return std::task::Poll::Pending,
1644                    std::task::Poll::Ready(Err(None)) => {
1645                        this.is_terminated = true;
1646                        return std::task::Poll::Ready(None);
1647                    }
1648                    std::task::Poll::Ready(Err(Some(e))) => {
1649                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1650                            e.into(),
1651                        ))));
1652                    }
1653                }
1654
1655                // A message has been received from the channel
1656                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1657
1658                std::task::Poll::Ready(Some(match header.ordinal {
1659                0x1b14ff4adf5dc6f8 => {
1660                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1661                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1662                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1663                    let control_handle = SignalProcessingControlHandle {
1664                        inner: this.inner.clone(),
1665                    };
1666                    Ok(SignalProcessingRequest::GetElements {
1667                        responder: SignalProcessingGetElementsResponder {
1668                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1669                            tx_id: header.tx_id,
1670                        },
1671                    })
1672                }
1673                0x524da8772a69056f => {
1674                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1675                    let mut req = fidl::new_empty!(ReaderWatchElementStateRequest, fdomain_client::fidl::FDomainResourceDialect);
1676                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ReaderWatchElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
1677                    let control_handle = SignalProcessingControlHandle {
1678                        inner: this.inner.clone(),
1679                    };
1680                    Ok(SignalProcessingRequest::WatchElementState {processing_element_id: req.processing_element_id,
1681
1682                        responder: SignalProcessingWatchElementStateResponder {
1683                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1684                            tx_id: header.tx_id,
1685                        },
1686                    })
1687                }
1688                0x73ffb73af24d30b6 => {
1689                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1690                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1691                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1692                    let control_handle = SignalProcessingControlHandle {
1693                        inner: this.inner.clone(),
1694                    };
1695                    Ok(SignalProcessingRequest::GetTopologies {
1696                        responder: SignalProcessingGetTopologiesResponder {
1697                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1698                            tx_id: header.tx_id,
1699                        },
1700                    })
1701                }
1702                0x66d172acdb36a729 => {
1703                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1704                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
1705                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1706                    let control_handle = SignalProcessingControlHandle {
1707                        inner: this.inner.clone(),
1708                    };
1709                    Ok(SignalProcessingRequest::WatchTopology {
1710                        responder: SignalProcessingWatchTopologyResponder {
1711                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1712                            tx_id: header.tx_id,
1713                        },
1714                    })
1715                }
1716                0x1d9a7f9b8fee790c => {
1717                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1718                    let mut req = fidl::new_empty!(SignalProcessingSetTopologyRequest, fdomain_client::fidl::FDomainResourceDialect);
1719                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SignalProcessingSetTopologyRequest>(&header, _body_bytes, handles, &mut req)?;
1720                    let control_handle = SignalProcessingControlHandle {
1721                        inner: this.inner.clone(),
1722                    };
1723                    Ok(SignalProcessingRequest::SetTopology {topology_id: req.topology_id,
1724
1725                        responder: SignalProcessingSetTopologyResponder {
1726                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1727                            tx_id: header.tx_id,
1728                        },
1729                    })
1730                }
1731                0x38c3b2d4bae698f4 => {
1732                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1733                    let mut req = fidl::new_empty!(SignalProcessingSetElementStateRequest, fdomain_client::fidl::FDomainResourceDialect);
1734                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<SignalProcessingSetElementStateRequest>(&header, _body_bytes, handles, &mut req)?;
1735                    let control_handle = SignalProcessingControlHandle {
1736                        inner: this.inner.clone(),
1737                    };
1738                    Ok(SignalProcessingRequest::SetElementState {processing_element_id: req.processing_element_id,
1739state: req.state,
1740
1741                        responder: SignalProcessingSetElementStateResponder {
1742                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1743                            tx_id: header.tx_id,
1744                        },
1745                    })
1746                }
1747                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1748                    Ok(SignalProcessingRequest::_UnknownMethod {
1749                        ordinal: header.ordinal,
1750                        control_handle: SignalProcessingControlHandle { inner: this.inner.clone() },
1751                        method_type: fidl::MethodType::OneWay,
1752                    })
1753                }
1754                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1755                    this.inner.send_framework_err(
1756                        fidl::encoding::FrameworkErr::UnknownMethod,
1757                        header.tx_id,
1758                        header.ordinal,
1759                        header.dynamic_flags(),
1760                        (bytes, handles),
1761                    )?;
1762                    Ok(SignalProcessingRequest::_UnknownMethod {
1763                        ordinal: header.ordinal,
1764                        control_handle: SignalProcessingControlHandle { inner: this.inner.clone() },
1765                        method_type: fidl::MethodType::TwoWay,
1766                    })
1767                }
1768                _ => Err(fidl::Error::UnknownOrdinal {
1769                    ordinal: header.ordinal,
1770                    protocol_name: <SignalProcessingMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1771                }),
1772            }))
1773            },
1774        )
1775    }
1776}
1777
1778/// This protocol is required for Composite audio drivers, and unsupported for other audio driver
1779/// types (Codec, Dai, StreamConfig).
1780///
1781/// For an overview see
1782/// [[Signal Processing Interface]](https://fuchsia.dev/fuchsia-src/concepts/drivers/driver_architectures/audio_drivers/audio_signal_processing).
1783#[derive(Debug)]
1784pub enum SignalProcessingRequest {
1785    /// Returns a vector of supported processing elements.
1786    /// This vector must include one or more processing elements.
1787    GetElements { responder: SignalProcessingGetElementsResponder },
1788    /// Get the processing element state via a hanging get.
1789    /// For a given `processing_element_id`, the driver will immediately reply to the first
1790    /// `WatchElementState` sent by the client. The driver will not respond to subsequent client
1791    /// `WatchElementState` calls for that `processing_element_id` until any portion of the
1792    /// `ElementState` has changed from what was most recently reported for that element.
1793    ///
1794    /// The driver will close the protocol channel with an error of `ZX_ERR_INVALID_ARGS`, if
1795    /// `processing_element_id` does not match an ElementId returned by `GetElements`.
1796    ///
1797    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
1798    /// method is called again while there is already a pending `WatchElementState` for this client
1799    /// and `processing_element_id`.
1800    WatchElementState {
1801        processing_element_id: u64,
1802        responder: SignalProcessingWatchElementStateResponder,
1803    },
1804    /// Returns a vector of supported topologies.
1805    /// This vector must include one or more topologies.
1806    /// If more than one topology is returned, then the client may select any topology from the
1807    /// list by calling `SetTopology`.
1808    /// If only one topology is returned, `SetTopology` can still be called but causes no change.
1809    ///
1810    /// Each Element must be included in at least one Topology, but need not be included in every
1811    /// Topology.
1812    GetTopologies { responder: SignalProcessingGetTopologiesResponder },
1813    /// Get the current topology via a hanging get.
1814    /// The driver will immediately reply to the first `WatchTopology` sent by each client.
1815    /// The driver will not respond to subsequent `WatchTopology` calls from that client until the
1816    /// signal processing topology changes; this occurs as a result of a `SetTopology` call.
1817    ///
1818    /// The driver will close the protocol channel with an error of `ZX_ERR_BAD_STATE`, if this
1819    /// method is called again while there is already a pending `WatchTopology` for this client.
1820    WatchTopology { responder: SignalProcessingWatchTopologyResponder },
1821    /// Sets the currently active topology by specifying a `topology_id`, which matches to an entry
1822    /// in the vector returned by `GetTopologies`.
1823    /// The currently active topology is communicated by `WatchTopology` responses. To change which
1824    /// topology is active, a client uses `SetTopology`.
1825    ///
1826    /// If `GetTopologies` returns only one `Topology`, `SetTopology` is optional and has no effect.
1827    ///
1828    /// This call will fail and return `ZX_ERR_INVALID_ARGS` if the specified `topology_id` is not
1829    /// found within the`topologies` returned by `GetTopologies`.
1830    ///
1831    /// `SetTopology` may be called before or after non-`SignalProcessing` protocol calls.
1832    /// If called after non-`SignalProcessing` protocol calls, then `SetTopology` may return
1833    /// `ZX_ERR_BAD_STATE` to indicate that the operation can not proceed without renegotiation of
1834    /// the driver state. See `SetElementState` for further discussion.
1835    SetTopology { topology_id: u64, responder: SignalProcessingSetTopologyResponder },
1836    /// Controls the processing element specified by `processing_element_id`, a unique ElementId
1837    /// returned by `GetElements`.
1838    /// The `state` specified in calls to `SetElementState` is a `SettableElementState`. This is a
1839    /// subset of `ElementState` because some fields returned by `WatchElementState` (e.g. `latency`
1840    /// or `plug_state`) can only be observed (not set) by the client.
1841    ///
1842    /// Returns `ZX_ERR_INVALID_ARGS` if `processing_element_id` does not match a known ElementId
1843    /// returned by `GetElements`, or if `state` is not valid for the element. This entails any
1844    /// violation of the rules specified in this protocol.
1845    ///
1846    /// Examples:
1847    /// `state` specifies that an element should be stopped or bypassed, but the corresponding
1848    ///     element does not specify (or explicitly set to false) `can_stop` or `can_bypass`.
1849    /// `state` includes a `type_specific` entry, but that `SettableTypeSpecificElementState` does
1850    ///     not match the `ElementType` of the element corresponding to `processing_element_id`.
1851    /// `state` changes an `EqualizerBandState` for an `EQUALIZER` element (so far so good), but
1852    ///     specifies a change to `frequency` when this element did not set `CAN_CONTROL_FREQUENCY`
1853    ///     in its `supported_controls`.
1854    /// `state` specifies a `GainElementState` for a `GAIN` element with a `gain` value that is
1855    ///     -infinity, NAN, or outside the Element's stated [`min_gain`, `max_gain`] range.
1856    ///
1857    /// Callers may intersperse method calls to the `SignalProcessing` protocol with calls to other
1858    /// driver protocols. Some non-`SignalProcessing` configuration changes may require a
1859    /// renegotiation of the driver state before certain elements can receive a `SetElementState`.
1860    /// For example, if a `DaiFormat` is changed, then `SetElementState` changing an `AGL` element's
1861    /// parameters may not require renegotiation of driver state because changing gain parameters
1862    /// usually does not change the set of supported audio formats.
1863    /// By contrast, following the same `DaiFormat` change, before `SetElementState` can be called
1864    /// on a `CONNECTION_POINT` element, the driver state may need to be reestablished because the
1865    /// format change may invalidate the set of supported formats returned in a previous
1866    /// `GetDaiFormats` protocol call for another part of the Topology.
1867    ///
1868    /// It is the driver's job to determine when renegotiation is required. When this is needed,
1869    /// the related `SetElementState` call must return `ZX_ERR_BAD_STATE` and the client must
1870    /// close the protocol channel entirely, such that the protocol negotiations are started over.
1871    /// The client then must re-invoke the `SetElementState` call that returned
1872    /// `ZX_ERR_BAD_STATE` before any non-`SignalProcessing` protocol calls.
1873    SetElementState {
1874        processing_element_id: u64,
1875        state: SettableElementState,
1876        responder: SignalProcessingSetElementStateResponder,
1877    },
1878    /// An interaction was received which does not match any known method.
1879    #[non_exhaustive]
1880    _UnknownMethod {
1881        /// Ordinal of the method that was called.
1882        ordinal: u64,
1883        control_handle: SignalProcessingControlHandle,
1884        method_type: fidl::MethodType,
1885    },
1886}
1887
1888impl SignalProcessingRequest {
1889    #[allow(irrefutable_let_patterns)]
1890    pub fn into_get_elements(self) -> Option<(SignalProcessingGetElementsResponder)> {
1891        if let SignalProcessingRequest::GetElements { responder } = self {
1892            Some((responder))
1893        } else {
1894            None
1895        }
1896    }
1897
1898    #[allow(irrefutable_let_patterns)]
1899    pub fn into_watch_element_state(
1900        self,
1901    ) -> Option<(u64, SignalProcessingWatchElementStateResponder)> {
1902        if let SignalProcessingRequest::WatchElementState { processing_element_id, responder } =
1903            self
1904        {
1905            Some((processing_element_id, responder))
1906        } else {
1907            None
1908        }
1909    }
1910
1911    #[allow(irrefutable_let_patterns)]
1912    pub fn into_get_topologies(self) -> Option<(SignalProcessingGetTopologiesResponder)> {
1913        if let SignalProcessingRequest::GetTopologies { responder } = self {
1914            Some((responder))
1915        } else {
1916            None
1917        }
1918    }
1919
1920    #[allow(irrefutable_let_patterns)]
1921    pub fn into_watch_topology(self) -> Option<(SignalProcessingWatchTopologyResponder)> {
1922        if let SignalProcessingRequest::WatchTopology { responder } = self {
1923            Some((responder))
1924        } else {
1925            None
1926        }
1927    }
1928
1929    #[allow(irrefutable_let_patterns)]
1930    pub fn into_set_topology(self) -> Option<(u64, SignalProcessingSetTopologyResponder)> {
1931        if let SignalProcessingRequest::SetTopology { topology_id, responder } = self {
1932            Some((topology_id, responder))
1933        } else {
1934            None
1935        }
1936    }
1937
1938    #[allow(irrefutable_let_patterns)]
1939    pub fn into_set_element_state(
1940        self,
1941    ) -> Option<(u64, SettableElementState, SignalProcessingSetElementStateResponder)> {
1942        if let SignalProcessingRequest::SetElementState {
1943            processing_element_id,
1944            state,
1945            responder,
1946        } = self
1947        {
1948            Some((processing_element_id, state, responder))
1949        } else {
1950            None
1951        }
1952    }
1953
1954    /// Name of the method defined in FIDL
1955    pub fn method_name(&self) -> &'static str {
1956        match *self {
1957            SignalProcessingRequest::GetElements { .. } => "get_elements",
1958            SignalProcessingRequest::WatchElementState { .. } => "watch_element_state",
1959            SignalProcessingRequest::GetTopologies { .. } => "get_topologies",
1960            SignalProcessingRequest::WatchTopology { .. } => "watch_topology",
1961            SignalProcessingRequest::SetTopology { .. } => "set_topology",
1962            SignalProcessingRequest::SetElementState { .. } => "set_element_state",
1963            SignalProcessingRequest::_UnknownMethod {
1964                method_type: fidl::MethodType::OneWay,
1965                ..
1966            } => "unknown one-way method",
1967            SignalProcessingRequest::_UnknownMethod {
1968                method_type: fidl::MethodType::TwoWay,
1969                ..
1970            } => "unknown two-way method",
1971        }
1972    }
1973}
1974
1975#[derive(Debug, Clone)]
1976pub struct SignalProcessingControlHandle {
1977    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1978}
1979
1980impl fdomain_client::fidl::ControlHandle for SignalProcessingControlHandle {
1981    fn shutdown(&self) {
1982        self.inner.shutdown()
1983    }
1984
1985    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1986        self.inner.shutdown_with_epitaph(status)
1987    }
1988
1989    fn is_closed(&self) -> bool {
1990        self.inner.channel().is_closed()
1991    }
1992    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1993        self.inner.channel().on_closed()
1994    }
1995}
1996
1997impl SignalProcessingControlHandle {}
1998
1999#[must_use = "FIDL methods require a response to be sent"]
2000#[derive(Debug)]
2001pub struct SignalProcessingGetElementsResponder {
2002    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2003    tx_id: u32,
2004}
2005
2006/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2007/// if the responder is dropped without sending a response, so that the client
2008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2009impl std::ops::Drop for SignalProcessingGetElementsResponder {
2010    fn drop(&mut self) {
2011        self.control_handle.shutdown();
2012        // Safety: drops once, never accessed again
2013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2014    }
2015}
2016
2017impl fdomain_client::fidl::Responder for SignalProcessingGetElementsResponder {
2018    type ControlHandle = SignalProcessingControlHandle;
2019
2020    fn control_handle(&self) -> &SignalProcessingControlHandle {
2021        &self.control_handle
2022    }
2023
2024    fn drop_without_shutdown(mut self) {
2025        // Safety: drops once, never accessed again due to mem::forget
2026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2027        // Prevent Drop from running (which would shut down the channel)
2028        std::mem::forget(self);
2029    }
2030}
2031
2032impl SignalProcessingGetElementsResponder {
2033    /// Sends a response to the FIDL transaction.
2034    ///
2035    /// Sets the channel to shutdown if an error occurs.
2036    pub fn send(self, mut result: Result<&[Element], i32>) -> Result<(), fidl::Error> {
2037        let _result = self.send_raw(result);
2038        if _result.is_err() {
2039            self.control_handle.shutdown();
2040        }
2041        self.drop_without_shutdown();
2042        _result
2043    }
2044
2045    /// Similar to "send" but does not shutdown the channel if an error occurs.
2046    pub fn send_no_shutdown_on_err(
2047        self,
2048        mut result: Result<&[Element], i32>,
2049    ) -> Result<(), fidl::Error> {
2050        let _result = self.send_raw(result);
2051        self.drop_without_shutdown();
2052        _result
2053    }
2054
2055    fn send_raw(&self, mut result: Result<&[Element], i32>) -> Result<(), fidl::Error> {
2056        self.control_handle
2057            .inner
2058            .send::<fidl::encoding::ResultType<ReaderGetElementsResponse, i32>>(
2059                result.map(|processing_elements| (processing_elements,)),
2060                self.tx_id,
2061                0x1b14ff4adf5dc6f8,
2062                fidl::encoding::DynamicFlags::empty(),
2063            )
2064    }
2065}
2066
2067#[must_use = "FIDL methods require a response to be sent"]
2068#[derive(Debug)]
2069pub struct SignalProcessingWatchElementStateResponder {
2070    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2071    tx_id: u32,
2072}
2073
2074/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2075/// if the responder is dropped without sending a response, so that the client
2076/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2077impl std::ops::Drop for SignalProcessingWatchElementStateResponder {
2078    fn drop(&mut self) {
2079        self.control_handle.shutdown();
2080        // Safety: drops once, never accessed again
2081        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2082    }
2083}
2084
2085impl fdomain_client::fidl::Responder for SignalProcessingWatchElementStateResponder {
2086    type ControlHandle = SignalProcessingControlHandle;
2087
2088    fn control_handle(&self) -> &SignalProcessingControlHandle {
2089        &self.control_handle
2090    }
2091
2092    fn drop_without_shutdown(mut self) {
2093        // Safety: drops once, never accessed again due to mem::forget
2094        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2095        // Prevent Drop from running (which would shut down the channel)
2096        std::mem::forget(self);
2097    }
2098}
2099
2100impl SignalProcessingWatchElementStateResponder {
2101    /// Sends a response to the FIDL transaction.
2102    ///
2103    /// Sets the channel to shutdown if an error occurs.
2104    pub fn send(self, mut state: &ElementState) -> Result<(), fidl::Error> {
2105        let _result = self.send_raw(state);
2106        if _result.is_err() {
2107            self.control_handle.shutdown();
2108        }
2109        self.drop_without_shutdown();
2110        _result
2111    }
2112
2113    /// Similar to "send" but does not shutdown the channel if an error occurs.
2114    pub fn send_no_shutdown_on_err(self, mut state: &ElementState) -> Result<(), fidl::Error> {
2115        let _result = self.send_raw(state);
2116        self.drop_without_shutdown();
2117        _result
2118    }
2119
2120    fn send_raw(&self, mut state: &ElementState) -> Result<(), fidl::Error> {
2121        self.control_handle.inner.send::<ReaderWatchElementStateResponse>(
2122            (state,),
2123            self.tx_id,
2124            0x524da8772a69056f,
2125            fidl::encoding::DynamicFlags::empty(),
2126        )
2127    }
2128}
2129
2130#[must_use = "FIDL methods require a response to be sent"]
2131#[derive(Debug)]
2132pub struct SignalProcessingGetTopologiesResponder {
2133    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2134    tx_id: u32,
2135}
2136
2137/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2138/// if the responder is dropped without sending a response, so that the client
2139/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2140impl std::ops::Drop for SignalProcessingGetTopologiesResponder {
2141    fn drop(&mut self) {
2142        self.control_handle.shutdown();
2143        // Safety: drops once, never accessed again
2144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2145    }
2146}
2147
2148impl fdomain_client::fidl::Responder for SignalProcessingGetTopologiesResponder {
2149    type ControlHandle = SignalProcessingControlHandle;
2150
2151    fn control_handle(&self) -> &SignalProcessingControlHandle {
2152        &self.control_handle
2153    }
2154
2155    fn drop_without_shutdown(mut self) {
2156        // Safety: drops once, never accessed again due to mem::forget
2157        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2158        // Prevent Drop from running (which would shut down the channel)
2159        std::mem::forget(self);
2160    }
2161}
2162
2163impl SignalProcessingGetTopologiesResponder {
2164    /// Sends a response to the FIDL transaction.
2165    ///
2166    /// Sets the channel to shutdown if an error occurs.
2167    pub fn send(self, mut result: Result<&[Topology], i32>) -> Result<(), fidl::Error> {
2168        let _result = self.send_raw(result);
2169        if _result.is_err() {
2170            self.control_handle.shutdown();
2171        }
2172        self.drop_without_shutdown();
2173        _result
2174    }
2175
2176    /// Similar to "send" but does not shutdown the channel if an error occurs.
2177    pub fn send_no_shutdown_on_err(
2178        self,
2179        mut result: Result<&[Topology], i32>,
2180    ) -> Result<(), fidl::Error> {
2181        let _result = self.send_raw(result);
2182        self.drop_without_shutdown();
2183        _result
2184    }
2185
2186    fn send_raw(&self, mut result: Result<&[Topology], i32>) -> Result<(), fidl::Error> {
2187        self.control_handle
2188            .inner
2189            .send::<fidl::encoding::ResultType<ReaderGetTopologiesResponse, i32>>(
2190                result.map(|topologies| (topologies,)),
2191                self.tx_id,
2192                0x73ffb73af24d30b6,
2193                fidl::encoding::DynamicFlags::empty(),
2194            )
2195    }
2196}
2197
2198#[must_use = "FIDL methods require a response to be sent"]
2199#[derive(Debug)]
2200pub struct SignalProcessingWatchTopologyResponder {
2201    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2202    tx_id: u32,
2203}
2204
2205/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2206/// if the responder is dropped without sending a response, so that the client
2207/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2208impl std::ops::Drop for SignalProcessingWatchTopologyResponder {
2209    fn drop(&mut self) {
2210        self.control_handle.shutdown();
2211        // Safety: drops once, never accessed again
2212        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2213    }
2214}
2215
2216impl fdomain_client::fidl::Responder for SignalProcessingWatchTopologyResponder {
2217    type ControlHandle = SignalProcessingControlHandle;
2218
2219    fn control_handle(&self) -> &SignalProcessingControlHandle {
2220        &self.control_handle
2221    }
2222
2223    fn drop_without_shutdown(mut self) {
2224        // Safety: drops once, never accessed again due to mem::forget
2225        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2226        // Prevent Drop from running (which would shut down the channel)
2227        std::mem::forget(self);
2228    }
2229}
2230
2231impl SignalProcessingWatchTopologyResponder {
2232    /// Sends a response to the FIDL transaction.
2233    ///
2234    /// Sets the channel to shutdown if an error occurs.
2235    pub fn send(self, mut topology_id: u64) -> Result<(), fidl::Error> {
2236        let _result = self.send_raw(topology_id);
2237        if _result.is_err() {
2238            self.control_handle.shutdown();
2239        }
2240        self.drop_without_shutdown();
2241        _result
2242    }
2243
2244    /// Similar to "send" but does not shutdown the channel if an error occurs.
2245    pub fn send_no_shutdown_on_err(self, mut topology_id: u64) -> Result<(), fidl::Error> {
2246        let _result = self.send_raw(topology_id);
2247        self.drop_without_shutdown();
2248        _result
2249    }
2250
2251    fn send_raw(&self, mut topology_id: u64) -> Result<(), fidl::Error> {
2252        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ReaderWatchTopologyResponse>>(
2253            fidl::encoding::Flexible::new((topology_id,)),
2254            self.tx_id,
2255            0x66d172acdb36a729,
2256            fidl::encoding::DynamicFlags::FLEXIBLE,
2257        )
2258    }
2259}
2260
2261#[must_use = "FIDL methods require a response to be sent"]
2262#[derive(Debug)]
2263pub struct SignalProcessingSetTopologyResponder {
2264    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2265    tx_id: u32,
2266}
2267
2268/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2269/// if the responder is dropped without sending a response, so that the client
2270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2271impl std::ops::Drop for SignalProcessingSetTopologyResponder {
2272    fn drop(&mut self) {
2273        self.control_handle.shutdown();
2274        // Safety: drops once, never accessed again
2275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2276    }
2277}
2278
2279impl fdomain_client::fidl::Responder for SignalProcessingSetTopologyResponder {
2280    type ControlHandle = SignalProcessingControlHandle;
2281
2282    fn control_handle(&self) -> &SignalProcessingControlHandle {
2283        &self.control_handle
2284    }
2285
2286    fn drop_without_shutdown(mut self) {
2287        // Safety: drops once, never accessed again due to mem::forget
2288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2289        // Prevent Drop from running (which would shut down the channel)
2290        std::mem::forget(self);
2291    }
2292}
2293
2294impl SignalProcessingSetTopologyResponder {
2295    /// Sends a response to the FIDL transaction.
2296    ///
2297    /// Sets the channel to shutdown if an error occurs.
2298    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2299        let _result = self.send_raw(result);
2300        if _result.is_err() {
2301            self.control_handle.shutdown();
2302        }
2303        self.drop_without_shutdown();
2304        _result
2305    }
2306
2307    /// Similar to "send" but does not shutdown the channel if an error occurs.
2308    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2309        let _result = self.send_raw(result);
2310        self.drop_without_shutdown();
2311        _result
2312    }
2313
2314    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2315        self.control_handle
2316            .inner
2317            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2318                result,
2319                self.tx_id,
2320                0x1d9a7f9b8fee790c,
2321                fidl::encoding::DynamicFlags::empty(),
2322            )
2323    }
2324}
2325
2326#[must_use = "FIDL methods require a response to be sent"]
2327#[derive(Debug)]
2328pub struct SignalProcessingSetElementStateResponder {
2329    control_handle: std::mem::ManuallyDrop<SignalProcessingControlHandle>,
2330    tx_id: u32,
2331}
2332
2333/// Set the the channel to be shutdown (see [`SignalProcessingControlHandle::shutdown`])
2334/// if the responder is dropped without sending a response, so that the client
2335/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2336impl std::ops::Drop for SignalProcessingSetElementStateResponder {
2337    fn drop(&mut self) {
2338        self.control_handle.shutdown();
2339        // Safety: drops once, never accessed again
2340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2341    }
2342}
2343
2344impl fdomain_client::fidl::Responder for SignalProcessingSetElementStateResponder {
2345    type ControlHandle = SignalProcessingControlHandle;
2346
2347    fn control_handle(&self) -> &SignalProcessingControlHandle {
2348        &self.control_handle
2349    }
2350
2351    fn drop_without_shutdown(mut self) {
2352        // Safety: drops once, never accessed again due to mem::forget
2353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2354        // Prevent Drop from running (which would shut down the channel)
2355        std::mem::forget(self);
2356    }
2357}
2358
2359impl SignalProcessingSetElementStateResponder {
2360    /// Sends a response to the FIDL transaction.
2361    ///
2362    /// Sets the channel to shutdown if an error occurs.
2363    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2364        let _result = self.send_raw(result);
2365        if _result.is_err() {
2366            self.control_handle.shutdown();
2367        }
2368        self.drop_without_shutdown();
2369        _result
2370    }
2371
2372    /// Similar to "send" but does not shutdown the channel if an error occurs.
2373    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2374        let _result = self.send_raw(result);
2375        self.drop_without_shutdown();
2376        _result
2377    }
2378
2379    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2380        self.control_handle
2381            .inner
2382            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2383                result,
2384                self.tx_id,
2385                0x38c3b2d4bae698f4,
2386                fidl::encoding::DynamicFlags::empty(),
2387            )
2388    }
2389}
2390
2391mod internal {
2392    use super::*;
2393
2394    impl fidl::encoding::ResourceTypeMarker for ConnectorSignalProcessingConnectRequest {
2395        type Borrowed<'a> = &'a mut Self;
2396        fn take_or_borrow<'a>(
2397            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2398        ) -> Self::Borrowed<'a> {
2399            value
2400        }
2401    }
2402
2403    unsafe impl fidl::encoding::TypeMarker for ConnectorSignalProcessingConnectRequest {
2404        type Owned = Self;
2405
2406        #[inline(always)]
2407        fn inline_align(_context: fidl::encoding::Context) -> usize {
2408            4
2409        }
2410
2411        #[inline(always)]
2412        fn inline_size(_context: fidl::encoding::Context) -> usize {
2413            4
2414        }
2415    }
2416
2417    unsafe impl
2418        fidl::encoding::Encode<
2419            ConnectorSignalProcessingConnectRequest,
2420            fdomain_client::fidl::FDomainResourceDialect,
2421        > for &mut ConnectorSignalProcessingConnectRequest
2422    {
2423        #[inline]
2424        unsafe fn encode(
2425            self,
2426            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2427            offset: usize,
2428            _depth: fidl::encoding::Depth,
2429        ) -> fidl::Result<()> {
2430            encoder.debug_check_bounds::<ConnectorSignalProcessingConnectRequest>(offset);
2431            // Delegate to tuple encoding.
2432            fidl::encoding::Encode::<
2433                ConnectorSignalProcessingConnectRequest,
2434                fdomain_client::fidl::FDomainResourceDialect,
2435            >::encode(
2436                (
2437                    <fidl::encoding::Endpoint<
2438                        fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
2439                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2440                        &mut self.protocol
2441                    ),
2442                ),
2443                encoder,
2444                offset,
2445                _depth,
2446            )
2447        }
2448    }
2449    unsafe impl<
2450        T0: fidl::encoding::Encode<
2451                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SignalProcessingMarker>>,
2452                fdomain_client::fidl::FDomainResourceDialect,
2453            >,
2454    >
2455        fidl::encoding::Encode<
2456            ConnectorSignalProcessingConnectRequest,
2457            fdomain_client::fidl::FDomainResourceDialect,
2458        > for (T0,)
2459    {
2460        #[inline]
2461        unsafe fn encode(
2462            self,
2463            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2464            offset: usize,
2465            depth: fidl::encoding::Depth,
2466        ) -> fidl::Result<()> {
2467            encoder.debug_check_bounds::<ConnectorSignalProcessingConnectRequest>(offset);
2468            // Zero out padding regions. There's no need to apply masks
2469            // because the unmasked parts will be overwritten by fields.
2470            // Write the fields.
2471            self.0.encode(encoder, offset + 0, depth)?;
2472            Ok(())
2473        }
2474    }
2475
2476    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
2477        for ConnectorSignalProcessingConnectRequest
2478    {
2479        #[inline(always)]
2480        fn new_empty() -> Self {
2481            Self {
2482                protocol: fidl::new_empty!(
2483                    fidl::encoding::Endpoint<
2484                        fdomain_client::fidl::ServerEnd<SignalProcessingMarker>,
2485                    >,
2486                    fdomain_client::fidl::FDomainResourceDialect
2487                ),
2488            }
2489        }
2490
2491        #[inline]
2492        unsafe fn decode(
2493            &mut self,
2494            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
2495            offset: usize,
2496            _depth: fidl::encoding::Depth,
2497        ) -> fidl::Result<()> {
2498            decoder.debug_check_bounds::<Self>(offset);
2499            // Verify that padding bytes are zero.
2500            fidl::decode!(
2501                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<SignalProcessingMarker>>,
2502                fdomain_client::fidl::FDomainResourceDialect,
2503                &mut self.protocol,
2504                decoder,
2505                offset + 0,
2506                _depth
2507            )?;
2508            Ok(())
2509        }
2510    }
2511}