fidl_fuchsia_hardware_qcom_hvdcpopti/
fidl_fuchsia_hardware_qcom_hvdcpopti.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_qcom_hvdcpopti__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DataProviderOnFifoDataRequest {
16    pub data: Vec<u8>,
17    /// Optional wake lease for power baton passing.
18    pub wake_lease: Option<fidl::EventPair>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for DataProviderOnFifoDataRequest
23{
24}
25
26#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
27pub struct DeviceGetDataProviderResponse {
28    pub provider: fidl::endpoints::ClientEnd<DataProviderMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32    for DeviceGetDataProviderResponse
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct BatteryMarker;
38
39impl fidl::endpoints::ProtocolMarker for BatteryMarker {
40    type Proxy = BatteryProxy;
41    type RequestStream = BatteryRequestStream;
42    #[cfg(target_os = "fuchsia")]
43    type SynchronousProxy = BatterySynchronousProxy;
44
45    const DEBUG_NAME: &'static str = "fuchsia.hardware.qcom.hvdcpopti.Battery";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for BatteryMarker {}
48pub type BatteryGetBatteryProfileResult = Result<[u8; 596], i32>;
49
50pub trait BatteryProxyInterface: Send + Sync {
51    type GetBatteryConfigResponseFut: std::future::Future<Output = Result<[u8; 304], fidl::Error>>
52        + Send;
53    fn r#get_battery_config(&self) -> Self::GetBatteryConfigResponseFut;
54    type GetBatteryProfileResponseFut: std::future::Future<Output = Result<BatteryGetBatteryProfileResult, fidl::Error>>
55        + Send;
56    fn r#get_battery_profile(&self, request: &[u8; 8]) -> Self::GetBatteryProfileResponseFut;
57}
58#[derive(Debug)]
59#[cfg(target_os = "fuchsia")]
60pub struct BatterySynchronousProxy {
61    client: fidl::client::sync::Client,
62}
63
64#[cfg(target_os = "fuchsia")]
65impl fidl::endpoints::SynchronousProxy for BatterySynchronousProxy {
66    type Proxy = BatteryProxy;
67    type Protocol = BatteryMarker;
68
69    fn from_channel(inner: fidl::Channel) -> Self {
70        Self::new(inner)
71    }
72
73    fn into_channel(self) -> fidl::Channel {
74        self.client.into_channel()
75    }
76
77    fn as_channel(&self) -> &fidl::Channel {
78        self.client.as_channel()
79    }
80}
81
82#[cfg(target_os = "fuchsia")]
83impl BatterySynchronousProxy {
84    pub fn new(channel: fidl::Channel) -> Self {
85        let protocol_name = <BatteryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
86        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
87    }
88
89    pub fn into_channel(self) -> fidl::Channel {
90        self.client.into_channel()
91    }
92
93    /// Waits until an event arrives and returns it. It is safe for other
94    /// threads to make concurrent requests while waiting for an event.
95    pub fn wait_for_event(
96        &self,
97        deadline: zx::MonotonicInstant,
98    ) -> Result<BatteryEvent, fidl::Error> {
99        BatteryEvent::decode(self.client.wait_for_event(deadline)?)
100    }
101
102    pub fn r#get_battery_config(
103        &self,
104        ___deadline: zx::MonotonicInstant,
105    ) -> Result<[u8; 304], fidl::Error> {
106        let _response = self
107            .client
108            .send_query::<fidl::encoding::EmptyPayload, BatteryGetBatteryConfigResponse>(
109                (),
110                0x393e949a2c548044,
111                fidl::encoding::DynamicFlags::empty(),
112                ___deadline,
113            )?;
114        Ok(_response.config)
115    }
116
117    pub fn r#get_battery_profile(
118        &self,
119        mut request: &[u8; 8],
120        ___deadline: zx::MonotonicInstant,
121    ) -> Result<BatteryGetBatteryProfileResult, fidl::Error> {
122        let _response = self.client.send_query::<
123            BatteryGetBatteryProfileRequest,
124            fidl::encoding::ResultType<BatteryGetBatteryProfileResponse, i32>,
125        >(
126            (request,),
127            0x48ee727ade37c43b,
128            fidl::encoding::DynamicFlags::empty(),
129            ___deadline,
130        )?;
131        Ok(_response.map(|x| x.profile))
132    }
133}
134
135#[cfg(target_os = "fuchsia")]
136impl From<BatterySynchronousProxy> for zx::NullableHandle {
137    fn from(value: BatterySynchronousProxy) -> Self {
138        value.into_channel().into()
139    }
140}
141
142#[cfg(target_os = "fuchsia")]
143impl From<fidl::Channel> for BatterySynchronousProxy {
144    fn from(value: fidl::Channel) -> Self {
145        Self::new(value)
146    }
147}
148
149#[cfg(target_os = "fuchsia")]
150impl fidl::endpoints::FromClient for BatterySynchronousProxy {
151    type Protocol = BatteryMarker;
152
153    fn from_client(value: fidl::endpoints::ClientEnd<BatteryMarker>) -> Self {
154        Self::new(value.into_channel())
155    }
156}
157
158#[derive(Debug, Clone)]
159pub struct BatteryProxy {
160    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
161}
162
163impl fidl::endpoints::Proxy for BatteryProxy {
164    type Protocol = BatteryMarker;
165
166    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
167        Self::new(inner)
168    }
169
170    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
171        self.client.into_channel().map_err(|client| Self { client })
172    }
173
174    fn as_channel(&self) -> &::fidl::AsyncChannel {
175        self.client.as_channel()
176    }
177}
178
179impl BatteryProxy {
180    /// Create a new Proxy for fuchsia.hardware.qcom.hvdcpopti/Battery.
181    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
182        let protocol_name = <BatteryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
183        Self { client: fidl::client::Client::new(channel, protocol_name) }
184    }
185
186    /// Get a Stream of events from the remote end of the protocol.
187    ///
188    /// # Panics
189    ///
190    /// Panics if the event stream was already taken.
191    pub fn take_event_stream(&self) -> BatteryEventStream {
192        BatteryEventStream { event_receiver: self.client.take_event_receiver() }
193    }
194
195    pub fn r#get_battery_config(
196        &self,
197    ) -> fidl::client::QueryResponseFut<[u8; 304], fidl::encoding::DefaultFuchsiaResourceDialect>
198    {
199        BatteryProxyInterface::r#get_battery_config(self)
200    }
201
202    pub fn r#get_battery_profile(
203        &self,
204        mut request: &[u8; 8],
205    ) -> fidl::client::QueryResponseFut<
206        BatteryGetBatteryProfileResult,
207        fidl::encoding::DefaultFuchsiaResourceDialect,
208    > {
209        BatteryProxyInterface::r#get_battery_profile(self, request)
210    }
211}
212
213impl BatteryProxyInterface for BatteryProxy {
214    type GetBatteryConfigResponseFut =
215        fidl::client::QueryResponseFut<[u8; 304], fidl::encoding::DefaultFuchsiaResourceDialect>;
216    fn r#get_battery_config(&self) -> Self::GetBatteryConfigResponseFut {
217        fn _decode(
218            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
219        ) -> Result<[u8; 304], fidl::Error> {
220            let _response = fidl::client::decode_transaction_body::<
221                BatteryGetBatteryConfigResponse,
222                fidl::encoding::DefaultFuchsiaResourceDialect,
223                0x393e949a2c548044,
224            >(_buf?)?;
225            Ok(_response.config)
226        }
227        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 304]>(
228            (),
229            0x393e949a2c548044,
230            fidl::encoding::DynamicFlags::empty(),
231            _decode,
232        )
233    }
234
235    type GetBatteryProfileResponseFut = fidl::client::QueryResponseFut<
236        BatteryGetBatteryProfileResult,
237        fidl::encoding::DefaultFuchsiaResourceDialect,
238    >;
239    fn r#get_battery_profile(&self, mut request: &[u8; 8]) -> Self::GetBatteryProfileResponseFut {
240        fn _decode(
241            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
242        ) -> Result<BatteryGetBatteryProfileResult, fidl::Error> {
243            let _response = fidl::client::decode_transaction_body::<
244                fidl::encoding::ResultType<BatteryGetBatteryProfileResponse, i32>,
245                fidl::encoding::DefaultFuchsiaResourceDialect,
246                0x48ee727ade37c43b,
247            >(_buf?)?;
248            Ok(_response.map(|x| x.profile))
249        }
250        self.client.send_query_and_decode::<
251            BatteryGetBatteryProfileRequest,
252            BatteryGetBatteryProfileResult,
253        >(
254            (request,),
255            0x48ee727ade37c43b,
256            fidl::encoding::DynamicFlags::empty(),
257            _decode,
258        )
259    }
260}
261
262pub struct BatteryEventStream {
263    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
264}
265
266impl std::marker::Unpin for BatteryEventStream {}
267
268impl futures::stream::FusedStream for BatteryEventStream {
269    fn is_terminated(&self) -> bool {
270        self.event_receiver.is_terminated()
271    }
272}
273
274impl futures::Stream for BatteryEventStream {
275    type Item = Result<BatteryEvent, fidl::Error>;
276
277    fn poll_next(
278        mut self: std::pin::Pin<&mut Self>,
279        cx: &mut std::task::Context<'_>,
280    ) -> std::task::Poll<Option<Self::Item>> {
281        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
282            &mut self.event_receiver,
283            cx
284        )?) {
285            Some(buf) => std::task::Poll::Ready(Some(BatteryEvent::decode(buf))),
286            None => std::task::Poll::Ready(None),
287        }
288    }
289}
290
291#[derive(Debug)]
292pub enum BatteryEvent {}
293
294impl BatteryEvent {
295    /// Decodes a message buffer as a [`BatteryEvent`].
296    fn decode(
297        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
298    ) -> Result<BatteryEvent, fidl::Error> {
299        let (bytes, _handles) = buf.split_mut();
300        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
301        debug_assert_eq!(tx_header.tx_id, 0);
302        match tx_header.ordinal {
303            _ => Err(fidl::Error::UnknownOrdinal {
304                ordinal: tx_header.ordinal,
305                protocol_name: <BatteryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
306            }),
307        }
308    }
309}
310
311/// A Stream of incoming requests for fuchsia.hardware.qcom.hvdcpopti/Battery.
312pub struct BatteryRequestStream {
313    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
314    is_terminated: bool,
315}
316
317impl std::marker::Unpin for BatteryRequestStream {}
318
319impl futures::stream::FusedStream for BatteryRequestStream {
320    fn is_terminated(&self) -> bool {
321        self.is_terminated
322    }
323}
324
325impl fidl::endpoints::RequestStream for BatteryRequestStream {
326    type Protocol = BatteryMarker;
327    type ControlHandle = BatteryControlHandle;
328
329    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
330        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
331    }
332
333    fn control_handle(&self) -> Self::ControlHandle {
334        BatteryControlHandle { inner: self.inner.clone() }
335    }
336
337    fn into_inner(
338        self,
339    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
340    {
341        (self.inner, self.is_terminated)
342    }
343
344    fn from_inner(
345        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
346        is_terminated: bool,
347    ) -> Self {
348        Self { inner, is_terminated }
349    }
350}
351
352impl futures::Stream for BatteryRequestStream {
353    type Item = Result<BatteryRequest, fidl::Error>;
354
355    fn poll_next(
356        mut self: std::pin::Pin<&mut Self>,
357        cx: &mut std::task::Context<'_>,
358    ) -> std::task::Poll<Option<Self::Item>> {
359        let this = &mut *self;
360        if this.inner.check_shutdown(cx) {
361            this.is_terminated = true;
362            return std::task::Poll::Ready(None);
363        }
364        if this.is_terminated {
365            panic!("polled BatteryRequestStream after completion");
366        }
367        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
368            |bytes, handles| {
369                match this.inner.channel().read_etc(cx, bytes, handles) {
370                    std::task::Poll::Ready(Ok(())) => {}
371                    std::task::Poll::Pending => return std::task::Poll::Pending,
372                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
373                        this.is_terminated = true;
374                        return std::task::Poll::Ready(None);
375                    }
376                    std::task::Poll::Ready(Err(e)) => {
377                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
378                            e.into(),
379                        ))));
380                    }
381                }
382
383                // A message has been received from the channel
384                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
385
386                std::task::Poll::Ready(Some(match header.ordinal {
387                    0x393e949a2c548044 => {
388                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
389                        let mut req = fidl::new_empty!(
390                            fidl::encoding::EmptyPayload,
391                            fidl::encoding::DefaultFuchsiaResourceDialect
392                        );
393                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
394                        let control_handle = BatteryControlHandle { inner: this.inner.clone() };
395                        Ok(BatteryRequest::GetBatteryConfig {
396                            responder: BatteryGetBatteryConfigResponder {
397                                control_handle: std::mem::ManuallyDrop::new(control_handle),
398                                tx_id: header.tx_id,
399                            },
400                        })
401                    }
402                    0x48ee727ade37c43b => {
403                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
404                        let mut req = fidl::new_empty!(
405                            BatteryGetBatteryProfileRequest,
406                            fidl::encoding::DefaultFuchsiaResourceDialect
407                        );
408                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatteryGetBatteryProfileRequest>(&header, _body_bytes, handles, &mut req)?;
409                        let control_handle = BatteryControlHandle { inner: this.inner.clone() };
410                        Ok(BatteryRequest::GetBatteryProfile {
411                            request: req.request,
412
413                            responder: BatteryGetBatteryProfileResponder {
414                                control_handle: std::mem::ManuallyDrop::new(control_handle),
415                                tx_id: header.tx_id,
416                            },
417                        })
418                    }
419                    _ => Err(fidl::Error::UnknownOrdinal {
420                        ordinal: header.ordinal,
421                        protocol_name:
422                            <BatteryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
423                    }),
424                }))
425            },
426        )
427    }
428}
429
430#[derive(Debug)]
431pub enum BatteryRequest {
432    GetBatteryConfig { responder: BatteryGetBatteryConfigResponder },
433    GetBatteryProfile { request: [u8; 8], responder: BatteryGetBatteryProfileResponder },
434}
435
436impl BatteryRequest {
437    #[allow(irrefutable_let_patterns)]
438    pub fn into_get_battery_config(self) -> Option<(BatteryGetBatteryConfigResponder)> {
439        if let BatteryRequest::GetBatteryConfig { responder } = self {
440            Some((responder))
441        } else {
442            None
443        }
444    }
445
446    #[allow(irrefutable_let_patterns)]
447    pub fn into_get_battery_profile(self) -> Option<([u8; 8], BatteryGetBatteryProfileResponder)> {
448        if let BatteryRequest::GetBatteryProfile { request, responder } = self {
449            Some((request, responder))
450        } else {
451            None
452        }
453    }
454
455    /// Name of the method defined in FIDL
456    pub fn method_name(&self) -> &'static str {
457        match *self {
458            BatteryRequest::GetBatteryConfig { .. } => "get_battery_config",
459            BatteryRequest::GetBatteryProfile { .. } => "get_battery_profile",
460        }
461    }
462}
463
464#[derive(Debug, Clone)]
465pub struct BatteryControlHandle {
466    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
467}
468
469impl fidl::endpoints::ControlHandle for BatteryControlHandle {
470    fn shutdown(&self) {
471        self.inner.shutdown()
472    }
473
474    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
475        self.inner.shutdown_with_epitaph(status)
476    }
477
478    fn is_closed(&self) -> bool {
479        self.inner.channel().is_closed()
480    }
481    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
482        self.inner.channel().on_closed()
483    }
484
485    #[cfg(target_os = "fuchsia")]
486    fn signal_peer(
487        &self,
488        clear_mask: zx::Signals,
489        set_mask: zx::Signals,
490    ) -> Result<(), zx_status::Status> {
491        use fidl::Peered;
492        self.inner.channel().signal_peer(clear_mask, set_mask)
493    }
494}
495
496impl BatteryControlHandle {}
497
498#[must_use = "FIDL methods require a response to be sent"]
499#[derive(Debug)]
500pub struct BatteryGetBatteryConfigResponder {
501    control_handle: std::mem::ManuallyDrop<BatteryControlHandle>,
502    tx_id: u32,
503}
504
505/// Set the the channel to be shutdown (see [`BatteryControlHandle::shutdown`])
506/// if the responder is dropped without sending a response, so that the client
507/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
508impl std::ops::Drop for BatteryGetBatteryConfigResponder {
509    fn drop(&mut self) {
510        self.control_handle.shutdown();
511        // Safety: drops once, never accessed again
512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
513    }
514}
515
516impl fidl::endpoints::Responder for BatteryGetBatteryConfigResponder {
517    type ControlHandle = BatteryControlHandle;
518
519    fn control_handle(&self) -> &BatteryControlHandle {
520        &self.control_handle
521    }
522
523    fn drop_without_shutdown(mut self) {
524        // Safety: drops once, never accessed again due to mem::forget
525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
526        // Prevent Drop from running (which would shut down the channel)
527        std::mem::forget(self);
528    }
529}
530
531impl BatteryGetBatteryConfigResponder {
532    /// Sends a response to the FIDL transaction.
533    ///
534    /// Sets the channel to shutdown if an error occurs.
535    pub fn send(self, mut config: &[u8; 304]) -> Result<(), fidl::Error> {
536        let _result = self.send_raw(config);
537        if _result.is_err() {
538            self.control_handle.shutdown();
539        }
540        self.drop_without_shutdown();
541        _result
542    }
543
544    /// Similar to "send" but does not shutdown the channel if an error occurs.
545    pub fn send_no_shutdown_on_err(self, mut config: &[u8; 304]) -> Result<(), fidl::Error> {
546        let _result = self.send_raw(config);
547        self.drop_without_shutdown();
548        _result
549    }
550
551    fn send_raw(&self, mut config: &[u8; 304]) -> Result<(), fidl::Error> {
552        self.control_handle.inner.send::<BatteryGetBatteryConfigResponse>(
553            (config,),
554            self.tx_id,
555            0x393e949a2c548044,
556            fidl::encoding::DynamicFlags::empty(),
557        )
558    }
559}
560
561#[must_use = "FIDL methods require a response to be sent"]
562#[derive(Debug)]
563pub struct BatteryGetBatteryProfileResponder {
564    control_handle: std::mem::ManuallyDrop<BatteryControlHandle>,
565    tx_id: u32,
566}
567
568/// Set the the channel to be shutdown (see [`BatteryControlHandle::shutdown`])
569/// if the responder is dropped without sending a response, so that the client
570/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
571impl std::ops::Drop for BatteryGetBatteryProfileResponder {
572    fn drop(&mut self) {
573        self.control_handle.shutdown();
574        // Safety: drops once, never accessed again
575        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
576    }
577}
578
579impl fidl::endpoints::Responder for BatteryGetBatteryProfileResponder {
580    type ControlHandle = BatteryControlHandle;
581
582    fn control_handle(&self) -> &BatteryControlHandle {
583        &self.control_handle
584    }
585
586    fn drop_without_shutdown(mut self) {
587        // Safety: drops once, never accessed again due to mem::forget
588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
589        // Prevent Drop from running (which would shut down the channel)
590        std::mem::forget(self);
591    }
592}
593
594impl BatteryGetBatteryProfileResponder {
595    /// Sends a response to the FIDL transaction.
596    ///
597    /// Sets the channel to shutdown if an error occurs.
598    pub fn send(self, mut result: Result<&[u8; 596], i32>) -> Result<(), fidl::Error> {
599        let _result = self.send_raw(result);
600        if _result.is_err() {
601            self.control_handle.shutdown();
602        }
603        self.drop_without_shutdown();
604        _result
605    }
606
607    /// Similar to "send" but does not shutdown the channel if an error occurs.
608    pub fn send_no_shutdown_on_err(
609        self,
610        mut result: Result<&[u8; 596], i32>,
611    ) -> Result<(), fidl::Error> {
612        let _result = self.send_raw(result);
613        self.drop_without_shutdown();
614        _result
615    }
616
617    fn send_raw(&self, mut result: Result<&[u8; 596], i32>) -> Result<(), fidl::Error> {
618        self.control_handle
619            .inner
620            .send::<fidl::encoding::ResultType<BatteryGetBatteryProfileResponse, i32>>(
621                result.map(|profile| (profile,)),
622                self.tx_id,
623                0x48ee727ade37c43b,
624                fidl::encoding::DynamicFlags::empty(),
625            )
626    }
627}
628
629#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
630pub struct DataProviderMarker;
631
632impl fidl::endpoints::ProtocolMarker for DataProviderMarker {
633    type Proxy = DataProviderProxy;
634    type RequestStream = DataProviderRequestStream;
635    #[cfg(target_os = "fuchsia")]
636    type SynchronousProxy = DataProviderSynchronousProxy;
637
638    const DEBUG_NAME: &'static str = "(anonymous) DataProvider";
639}
640
641pub trait DataProviderProxyInterface: Send + Sync {}
642#[derive(Debug)]
643#[cfg(target_os = "fuchsia")]
644pub struct DataProviderSynchronousProxy {
645    client: fidl::client::sync::Client,
646}
647
648#[cfg(target_os = "fuchsia")]
649impl fidl::endpoints::SynchronousProxy for DataProviderSynchronousProxy {
650    type Proxy = DataProviderProxy;
651    type Protocol = DataProviderMarker;
652
653    fn from_channel(inner: fidl::Channel) -> Self {
654        Self::new(inner)
655    }
656
657    fn into_channel(self) -> fidl::Channel {
658        self.client.into_channel()
659    }
660
661    fn as_channel(&self) -> &fidl::Channel {
662        self.client.as_channel()
663    }
664}
665
666#[cfg(target_os = "fuchsia")]
667impl DataProviderSynchronousProxy {
668    pub fn new(channel: fidl::Channel) -> Self {
669        let protocol_name = <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
670        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
671    }
672
673    pub fn into_channel(self) -> fidl::Channel {
674        self.client.into_channel()
675    }
676
677    /// Waits until an event arrives and returns it. It is safe for other
678    /// threads to make concurrent requests while waiting for an event.
679    pub fn wait_for_event(
680        &self,
681        deadline: zx::MonotonicInstant,
682    ) -> Result<DataProviderEvent, fidl::Error> {
683        DataProviderEvent::decode(self.client.wait_for_event(deadline)?)
684    }
685}
686
687#[cfg(target_os = "fuchsia")]
688impl From<DataProviderSynchronousProxy> for zx::NullableHandle {
689    fn from(value: DataProviderSynchronousProxy) -> Self {
690        value.into_channel().into()
691    }
692}
693
694#[cfg(target_os = "fuchsia")]
695impl From<fidl::Channel> for DataProviderSynchronousProxy {
696    fn from(value: fidl::Channel) -> Self {
697        Self::new(value)
698    }
699}
700
701#[cfg(target_os = "fuchsia")]
702impl fidl::endpoints::FromClient for DataProviderSynchronousProxy {
703    type Protocol = DataProviderMarker;
704
705    fn from_client(value: fidl::endpoints::ClientEnd<DataProviderMarker>) -> Self {
706        Self::new(value.into_channel())
707    }
708}
709
710#[derive(Debug, Clone)]
711pub struct DataProviderProxy {
712    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
713}
714
715impl fidl::endpoints::Proxy for DataProviderProxy {
716    type Protocol = DataProviderMarker;
717
718    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
719        Self::new(inner)
720    }
721
722    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
723        self.client.into_channel().map_err(|client| Self { client })
724    }
725
726    fn as_channel(&self) -> &::fidl::AsyncChannel {
727        self.client.as_channel()
728    }
729}
730
731impl DataProviderProxy {
732    /// Create a new Proxy for fuchsia.hardware.qcom.hvdcpopti/DataProvider.
733    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
734        let protocol_name = <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
735        Self { client: fidl::client::Client::new(channel, protocol_name) }
736    }
737
738    /// Get a Stream of events from the remote end of the protocol.
739    ///
740    /// # Panics
741    ///
742    /// Panics if the event stream was already taken.
743    pub fn take_event_stream(&self) -> DataProviderEventStream {
744        DataProviderEventStream { event_receiver: self.client.take_event_receiver() }
745    }
746}
747
748impl DataProviderProxyInterface for DataProviderProxy {}
749
750pub struct DataProviderEventStream {
751    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
752}
753
754impl std::marker::Unpin for DataProviderEventStream {}
755
756impl futures::stream::FusedStream for DataProviderEventStream {
757    fn is_terminated(&self) -> bool {
758        self.event_receiver.is_terminated()
759    }
760}
761
762impl futures::Stream for DataProviderEventStream {
763    type Item = Result<DataProviderEvent, fidl::Error>;
764
765    fn poll_next(
766        mut self: std::pin::Pin<&mut Self>,
767        cx: &mut std::task::Context<'_>,
768    ) -> std::task::Poll<Option<Self::Item>> {
769        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
770            &mut self.event_receiver,
771            cx
772        )?) {
773            Some(buf) => std::task::Poll::Ready(Some(DataProviderEvent::decode(buf))),
774            None => std::task::Poll::Ready(None),
775        }
776    }
777}
778
779#[derive(Debug)]
780pub enum DataProviderEvent {
781    OnFifoData { data: Vec<u8>, wake_lease: Option<fidl::EventPair> },
782}
783
784impl DataProviderEvent {
785    #[allow(irrefutable_let_patterns)]
786    pub fn into_on_fifo_data(self) -> Option<(Vec<u8>, Option<fidl::EventPair>)> {
787        if let DataProviderEvent::OnFifoData { data, wake_lease } = self {
788            Some((data, wake_lease))
789        } else {
790            None
791        }
792    }
793
794    /// Decodes a message buffer as a [`DataProviderEvent`].
795    fn decode(
796        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
797    ) -> Result<DataProviderEvent, fidl::Error> {
798        let (bytes, _handles) = buf.split_mut();
799        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
800        debug_assert_eq!(tx_header.tx_id, 0);
801        match tx_header.ordinal {
802            0x73c61125c7fa844a => {
803                let mut out = fidl::new_empty!(
804                    DataProviderOnFifoDataRequest,
805                    fidl::encoding::DefaultFuchsiaResourceDialect
806                );
807                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DataProviderOnFifoDataRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
808                Ok((DataProviderEvent::OnFifoData { data: out.data, wake_lease: out.wake_lease }))
809            }
810            _ => Err(fidl::Error::UnknownOrdinal {
811                ordinal: tx_header.ordinal,
812                protocol_name: <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
813            }),
814        }
815    }
816}
817
818/// A Stream of incoming requests for fuchsia.hardware.qcom.hvdcpopti/DataProvider.
819pub struct DataProviderRequestStream {
820    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
821    is_terminated: bool,
822}
823
824impl std::marker::Unpin for DataProviderRequestStream {}
825
826impl futures::stream::FusedStream for DataProviderRequestStream {
827    fn is_terminated(&self) -> bool {
828        self.is_terminated
829    }
830}
831
832impl fidl::endpoints::RequestStream for DataProviderRequestStream {
833    type Protocol = DataProviderMarker;
834    type ControlHandle = DataProviderControlHandle;
835
836    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
837        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
838    }
839
840    fn control_handle(&self) -> Self::ControlHandle {
841        DataProviderControlHandle { inner: self.inner.clone() }
842    }
843
844    fn into_inner(
845        self,
846    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
847    {
848        (self.inner, self.is_terminated)
849    }
850
851    fn from_inner(
852        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
853        is_terminated: bool,
854    ) -> Self {
855        Self { inner, is_terminated }
856    }
857}
858
859impl futures::Stream for DataProviderRequestStream {
860    type Item = Result<DataProviderRequest, fidl::Error>;
861
862    fn poll_next(
863        mut self: std::pin::Pin<&mut Self>,
864        cx: &mut std::task::Context<'_>,
865    ) -> std::task::Poll<Option<Self::Item>> {
866        let this = &mut *self;
867        if this.inner.check_shutdown(cx) {
868            this.is_terminated = true;
869            return std::task::Poll::Ready(None);
870        }
871        if this.is_terminated {
872            panic!("polled DataProviderRequestStream after completion");
873        }
874        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
875            |bytes, handles| {
876                match this.inner.channel().read_etc(cx, bytes, handles) {
877                    std::task::Poll::Ready(Ok(())) => {}
878                    std::task::Poll::Pending => return std::task::Poll::Pending,
879                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
880                        this.is_terminated = true;
881                        return std::task::Poll::Ready(None);
882                    }
883                    std::task::Poll::Ready(Err(e)) => {
884                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
885                            e.into(),
886                        ))));
887                    }
888                }
889
890                // A message has been received from the channel
891                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
892
893                std::task::Poll::Ready(Some(match header.ordinal {
894                    _ => Err(fidl::Error::UnknownOrdinal {
895                        ordinal: header.ordinal,
896                        protocol_name:
897                            <DataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
898                    }),
899                }))
900            },
901        )
902    }
903}
904
905#[derive(Debug)]
906pub enum DataProviderRequest {}
907
908impl DataProviderRequest {
909    /// Name of the method defined in FIDL
910    pub fn method_name(&self) -> &'static str {
911        match *self {}
912    }
913}
914
915#[derive(Debug, Clone)]
916pub struct DataProviderControlHandle {
917    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
918}
919
920impl fidl::endpoints::ControlHandle for DataProviderControlHandle {
921    fn shutdown(&self) {
922        self.inner.shutdown()
923    }
924
925    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
926        self.inner.shutdown_with_epitaph(status)
927    }
928
929    fn is_closed(&self) -> bool {
930        self.inner.channel().is_closed()
931    }
932    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
933        self.inner.channel().on_closed()
934    }
935
936    #[cfg(target_os = "fuchsia")]
937    fn signal_peer(
938        &self,
939        clear_mask: zx::Signals,
940        set_mask: zx::Signals,
941    ) -> Result<(), zx_status::Status> {
942        use fidl::Peered;
943        self.inner.channel().signal_peer(clear_mask, set_mask)
944    }
945}
946
947impl DataProviderControlHandle {
948    pub fn send_on_fifo_data(
949        &self,
950        mut data: &[u8],
951        mut wake_lease: Option<fidl::EventPair>,
952    ) -> Result<(), fidl::Error> {
953        self.inner.send::<DataProviderOnFifoDataRequest>(
954            (data, wake_lease),
955            0,
956            0x73c61125c7fa844a,
957            fidl::encoding::DynamicFlags::empty(),
958        )
959    }
960}
961
962#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
963pub struct DeviceMarker;
964
965impl fidl::endpoints::ProtocolMarker for DeviceMarker {
966    type Proxy = DeviceProxy;
967    type RequestStream = DeviceRequestStream;
968    #[cfg(target_os = "fuchsia")]
969    type SynchronousProxy = DeviceSynchronousProxy;
970
971    const DEBUG_NAME: &'static str = "fuchsia.hardware.qcom.hvdcpopti.Device";
972}
973impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
974pub type DeviceGetEssentialParamsResult = Result<[u8; 48], i32>;
975pub type DeviceSetEssentialParamsResult = Result<(), i32>;
976
977pub trait DeviceProxyInterface: Send + Sync {
978    type GetEssentialParamsResponseFut: std::future::Future<Output = Result<DeviceGetEssentialParamsResult, fidl::Error>>
979        + Send;
980    fn r#get_essential_params(&self) -> Self::GetEssentialParamsResponseFut;
981    type SetEssentialParamsResponseFut: std::future::Future<Output = Result<DeviceSetEssentialParamsResult, fidl::Error>>
982        + Send;
983    fn r#set_essential_params(&self, params: &[u8; 48]) -> Self::SetEssentialParamsResponseFut;
984    type GetConfigResponseFut: std::future::Future<Output = Result<[u8; 104], fidl::Error>> + Send;
985    fn r#get_config(&self) -> Self::GetConfigResponseFut;
986    type GetDataProviderResponseFut: std::future::Future<
987            Output = Result<fidl::endpoints::ClientEnd<DataProviderMarker>, fidl::Error>,
988        > + Send;
989    fn r#get_data_provider(&self) -> Self::GetDataProviderResponseFut;
990    type SetProcessedFifoDataResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
991        + Send;
992    fn r#set_processed_fifo_data(&self, data: &[u8; 152]) -> Self::SetProcessedFifoDataResponseFut;
993    type GetStepAndJeitaParamsResponseFut: std::future::Future<Output = Result<[u8; 247], fidl::Error>>
994        + Send;
995    fn r#get_step_and_jeita_params(&self) -> Self::GetStepAndJeitaParamsResponseFut;
996}
997#[derive(Debug)]
998#[cfg(target_os = "fuchsia")]
999pub struct DeviceSynchronousProxy {
1000    client: fidl::client::sync::Client,
1001}
1002
1003#[cfg(target_os = "fuchsia")]
1004impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
1005    type Proxy = DeviceProxy;
1006    type Protocol = DeviceMarker;
1007
1008    fn from_channel(inner: fidl::Channel) -> Self {
1009        Self::new(inner)
1010    }
1011
1012    fn into_channel(self) -> fidl::Channel {
1013        self.client.into_channel()
1014    }
1015
1016    fn as_channel(&self) -> &fidl::Channel {
1017        self.client.as_channel()
1018    }
1019}
1020
1021#[cfg(target_os = "fuchsia")]
1022impl DeviceSynchronousProxy {
1023    pub fn new(channel: fidl::Channel) -> Self {
1024        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1025        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1026    }
1027
1028    pub fn into_channel(self) -> fidl::Channel {
1029        self.client.into_channel()
1030    }
1031
1032    /// Waits until an event arrives and returns it. It is safe for other
1033    /// threads to make concurrent requests while waiting for an event.
1034    pub fn wait_for_event(
1035        &self,
1036        deadline: zx::MonotonicInstant,
1037    ) -> Result<DeviceEvent, fidl::Error> {
1038        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1039    }
1040
1041    pub fn r#get_essential_params(
1042        &self,
1043        ___deadline: zx::MonotonicInstant,
1044    ) -> Result<DeviceGetEssentialParamsResult, fidl::Error> {
1045        let _response = self.client.send_query::<
1046            fidl::encoding::EmptyPayload,
1047            fidl::encoding::ResultType<DeviceGetEssentialParamsResponse, i32>,
1048        >(
1049            (),
1050            0x2093fd296e2d8996,
1051            fidl::encoding::DynamicFlags::empty(),
1052            ___deadline,
1053        )?;
1054        Ok(_response.map(|x| x.params))
1055    }
1056
1057    pub fn r#set_essential_params(
1058        &self,
1059        mut params: &[u8; 48],
1060        ___deadline: zx::MonotonicInstant,
1061    ) -> Result<DeviceSetEssentialParamsResult, fidl::Error> {
1062        let _response = self.client.send_query::<
1063            DeviceSetEssentialParamsRequest,
1064            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1065        >(
1066            (params,),
1067            0x55b14f267312168c,
1068            fidl::encoding::DynamicFlags::empty(),
1069            ___deadline,
1070        )?;
1071        Ok(_response.map(|x| x))
1072    }
1073
1074    pub fn r#get_config(
1075        &self,
1076        ___deadline: zx::MonotonicInstant,
1077    ) -> Result<[u8; 104], fidl::Error> {
1078        let _response =
1079            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetConfigResponse>(
1080                (),
1081                0x41a72f916b11e11f,
1082                fidl::encoding::DynamicFlags::empty(),
1083                ___deadline,
1084            )?;
1085        Ok(_response.config)
1086    }
1087
1088    pub fn r#get_data_provider(
1089        &self,
1090        ___deadline: zx::MonotonicInstant,
1091    ) -> Result<fidl::endpoints::ClientEnd<DataProviderMarker>, fidl::Error> {
1092        let _response =
1093            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDataProviderResponse>(
1094                (),
1095                0x9fe048bef0e3577,
1096                fidl::encoding::DynamicFlags::empty(),
1097                ___deadline,
1098            )?;
1099        Ok(_response.provider)
1100    }
1101
1102    pub fn r#set_processed_fifo_data(
1103        &self,
1104        mut data: &[u8; 152],
1105        ___deadline: zx::MonotonicInstant,
1106    ) -> Result<(), fidl::Error> {
1107        let _response = self
1108            .client
1109            .send_query::<DeviceSetProcessedFifoDataRequest, fidl::encoding::EmptyPayload>(
1110                (data,),
1111                0x4689e121bf9e884,
1112                fidl::encoding::DynamicFlags::empty(),
1113                ___deadline,
1114            )?;
1115        Ok(_response)
1116    }
1117
1118    pub fn r#get_step_and_jeita_params(
1119        &self,
1120        ___deadline: zx::MonotonicInstant,
1121    ) -> Result<[u8; 247], fidl::Error> {
1122        let _response = self
1123            .client
1124            .send_query::<fidl::encoding::EmptyPayload, DeviceGetStepAndJeitaParamsResponse>(
1125                (),
1126                0x1c7ba411ae13b250,
1127                fidl::encoding::DynamicFlags::empty(),
1128                ___deadline,
1129            )?;
1130        Ok(_response.params)
1131    }
1132}
1133
1134#[cfg(target_os = "fuchsia")]
1135impl From<DeviceSynchronousProxy> for zx::NullableHandle {
1136    fn from(value: DeviceSynchronousProxy) -> Self {
1137        value.into_channel().into()
1138    }
1139}
1140
1141#[cfg(target_os = "fuchsia")]
1142impl From<fidl::Channel> for DeviceSynchronousProxy {
1143    fn from(value: fidl::Channel) -> Self {
1144        Self::new(value)
1145    }
1146}
1147
1148#[cfg(target_os = "fuchsia")]
1149impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
1150    type Protocol = DeviceMarker;
1151
1152    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
1153        Self::new(value.into_channel())
1154    }
1155}
1156
1157#[derive(Debug, Clone)]
1158pub struct DeviceProxy {
1159    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1160}
1161
1162impl fidl::endpoints::Proxy for DeviceProxy {
1163    type Protocol = DeviceMarker;
1164
1165    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1166        Self::new(inner)
1167    }
1168
1169    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1170        self.client.into_channel().map_err(|client| Self { client })
1171    }
1172
1173    fn as_channel(&self) -> &::fidl::AsyncChannel {
1174        self.client.as_channel()
1175    }
1176}
1177
1178impl DeviceProxy {
1179    /// Create a new Proxy for fuchsia.hardware.qcom.hvdcpopti/Device.
1180    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1181        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1182        Self { client: fidl::client::Client::new(channel, protocol_name) }
1183    }
1184
1185    /// Get a Stream of events from the remote end of the protocol.
1186    ///
1187    /// # Panics
1188    ///
1189    /// Panics if the event stream was already taken.
1190    pub fn take_event_stream(&self) -> DeviceEventStream {
1191        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1192    }
1193
1194    pub fn r#get_essential_params(
1195        &self,
1196    ) -> fidl::client::QueryResponseFut<
1197        DeviceGetEssentialParamsResult,
1198        fidl::encoding::DefaultFuchsiaResourceDialect,
1199    > {
1200        DeviceProxyInterface::r#get_essential_params(self)
1201    }
1202
1203    pub fn r#set_essential_params(
1204        &self,
1205        mut params: &[u8; 48],
1206    ) -> fidl::client::QueryResponseFut<
1207        DeviceSetEssentialParamsResult,
1208        fidl::encoding::DefaultFuchsiaResourceDialect,
1209    > {
1210        DeviceProxyInterface::r#set_essential_params(self, params)
1211    }
1212
1213    pub fn r#get_config(
1214        &self,
1215    ) -> fidl::client::QueryResponseFut<[u8; 104], fidl::encoding::DefaultFuchsiaResourceDialect>
1216    {
1217        DeviceProxyInterface::r#get_config(self)
1218    }
1219
1220    pub fn r#get_data_provider(
1221        &self,
1222    ) -> fidl::client::QueryResponseFut<
1223        fidl::endpoints::ClientEnd<DataProviderMarker>,
1224        fidl::encoding::DefaultFuchsiaResourceDialect,
1225    > {
1226        DeviceProxyInterface::r#get_data_provider(self)
1227    }
1228
1229    pub fn r#set_processed_fifo_data(
1230        &self,
1231        mut data: &[u8; 152],
1232    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1233        DeviceProxyInterface::r#set_processed_fifo_data(self, data)
1234    }
1235
1236    pub fn r#get_step_and_jeita_params(
1237        &self,
1238    ) -> fidl::client::QueryResponseFut<[u8; 247], fidl::encoding::DefaultFuchsiaResourceDialect>
1239    {
1240        DeviceProxyInterface::r#get_step_and_jeita_params(self)
1241    }
1242}
1243
1244impl DeviceProxyInterface for DeviceProxy {
1245    type GetEssentialParamsResponseFut = fidl::client::QueryResponseFut<
1246        DeviceGetEssentialParamsResult,
1247        fidl::encoding::DefaultFuchsiaResourceDialect,
1248    >;
1249    fn r#get_essential_params(&self) -> Self::GetEssentialParamsResponseFut {
1250        fn _decode(
1251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1252        ) -> Result<DeviceGetEssentialParamsResult, fidl::Error> {
1253            let _response = fidl::client::decode_transaction_body::<
1254                fidl::encoding::ResultType<DeviceGetEssentialParamsResponse, i32>,
1255                fidl::encoding::DefaultFuchsiaResourceDialect,
1256                0x2093fd296e2d8996,
1257            >(_buf?)?;
1258            Ok(_response.map(|x| x.params))
1259        }
1260        self.client
1261            .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetEssentialParamsResult>(
1262                (),
1263                0x2093fd296e2d8996,
1264                fidl::encoding::DynamicFlags::empty(),
1265                _decode,
1266            )
1267    }
1268
1269    type SetEssentialParamsResponseFut = fidl::client::QueryResponseFut<
1270        DeviceSetEssentialParamsResult,
1271        fidl::encoding::DefaultFuchsiaResourceDialect,
1272    >;
1273    fn r#set_essential_params(&self, mut params: &[u8; 48]) -> Self::SetEssentialParamsResponseFut {
1274        fn _decode(
1275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1276        ) -> Result<DeviceSetEssentialParamsResult, fidl::Error> {
1277            let _response = fidl::client::decode_transaction_body::<
1278                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1279                fidl::encoding::DefaultFuchsiaResourceDialect,
1280                0x55b14f267312168c,
1281            >(_buf?)?;
1282            Ok(_response.map(|x| x))
1283        }
1284        self.client.send_query_and_decode::<
1285            DeviceSetEssentialParamsRequest,
1286            DeviceSetEssentialParamsResult,
1287        >(
1288            (params,),
1289            0x55b14f267312168c,
1290            fidl::encoding::DynamicFlags::empty(),
1291            _decode,
1292        )
1293    }
1294
1295    type GetConfigResponseFut =
1296        fidl::client::QueryResponseFut<[u8; 104], fidl::encoding::DefaultFuchsiaResourceDialect>;
1297    fn r#get_config(&self) -> Self::GetConfigResponseFut {
1298        fn _decode(
1299            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1300        ) -> Result<[u8; 104], fidl::Error> {
1301            let _response = fidl::client::decode_transaction_body::<
1302                DeviceGetConfigResponse,
1303                fidl::encoding::DefaultFuchsiaResourceDialect,
1304                0x41a72f916b11e11f,
1305            >(_buf?)?;
1306            Ok(_response.config)
1307        }
1308        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 104]>(
1309            (),
1310            0x41a72f916b11e11f,
1311            fidl::encoding::DynamicFlags::empty(),
1312            _decode,
1313        )
1314    }
1315
1316    type GetDataProviderResponseFut = fidl::client::QueryResponseFut<
1317        fidl::endpoints::ClientEnd<DataProviderMarker>,
1318        fidl::encoding::DefaultFuchsiaResourceDialect,
1319    >;
1320    fn r#get_data_provider(&self) -> Self::GetDataProviderResponseFut {
1321        fn _decode(
1322            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1323        ) -> Result<fidl::endpoints::ClientEnd<DataProviderMarker>, fidl::Error> {
1324            let _response = fidl::client::decode_transaction_body::<
1325                DeviceGetDataProviderResponse,
1326                fidl::encoding::DefaultFuchsiaResourceDialect,
1327                0x9fe048bef0e3577,
1328            >(_buf?)?;
1329            Ok(_response.provider)
1330        }
1331        self.client.send_query_and_decode::<
1332            fidl::encoding::EmptyPayload,
1333            fidl::endpoints::ClientEnd<DataProviderMarker>,
1334        >(
1335            (),
1336            0x9fe048bef0e3577,
1337            fidl::encoding::DynamicFlags::empty(),
1338            _decode,
1339        )
1340    }
1341
1342    type SetProcessedFifoDataResponseFut =
1343        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1344    fn r#set_processed_fifo_data(
1345        &self,
1346        mut data: &[u8; 152],
1347    ) -> Self::SetProcessedFifoDataResponseFut {
1348        fn _decode(
1349            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1350        ) -> Result<(), fidl::Error> {
1351            let _response = fidl::client::decode_transaction_body::<
1352                fidl::encoding::EmptyPayload,
1353                fidl::encoding::DefaultFuchsiaResourceDialect,
1354                0x4689e121bf9e884,
1355            >(_buf?)?;
1356            Ok(_response)
1357        }
1358        self.client.send_query_and_decode::<DeviceSetProcessedFifoDataRequest, ()>(
1359            (data,),
1360            0x4689e121bf9e884,
1361            fidl::encoding::DynamicFlags::empty(),
1362            _decode,
1363        )
1364    }
1365
1366    type GetStepAndJeitaParamsResponseFut =
1367        fidl::client::QueryResponseFut<[u8; 247], fidl::encoding::DefaultFuchsiaResourceDialect>;
1368    fn r#get_step_and_jeita_params(&self) -> Self::GetStepAndJeitaParamsResponseFut {
1369        fn _decode(
1370            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1371        ) -> Result<[u8; 247], fidl::Error> {
1372            let _response = fidl::client::decode_transaction_body::<
1373                DeviceGetStepAndJeitaParamsResponse,
1374                fidl::encoding::DefaultFuchsiaResourceDialect,
1375                0x1c7ba411ae13b250,
1376            >(_buf?)?;
1377            Ok(_response.params)
1378        }
1379        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, [u8; 247]>(
1380            (),
1381            0x1c7ba411ae13b250,
1382            fidl::encoding::DynamicFlags::empty(),
1383            _decode,
1384        )
1385    }
1386}
1387
1388pub struct DeviceEventStream {
1389    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1390}
1391
1392impl std::marker::Unpin for DeviceEventStream {}
1393
1394impl futures::stream::FusedStream for DeviceEventStream {
1395    fn is_terminated(&self) -> bool {
1396        self.event_receiver.is_terminated()
1397    }
1398}
1399
1400impl futures::Stream for DeviceEventStream {
1401    type Item = Result<DeviceEvent, fidl::Error>;
1402
1403    fn poll_next(
1404        mut self: std::pin::Pin<&mut Self>,
1405        cx: &mut std::task::Context<'_>,
1406    ) -> std::task::Poll<Option<Self::Item>> {
1407        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1408            &mut self.event_receiver,
1409            cx
1410        )?) {
1411            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1412            None => std::task::Poll::Ready(None),
1413        }
1414    }
1415}
1416
1417#[derive(Debug)]
1418pub enum DeviceEvent {}
1419
1420impl DeviceEvent {
1421    /// Decodes a message buffer as a [`DeviceEvent`].
1422    fn decode(
1423        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1424    ) -> Result<DeviceEvent, fidl::Error> {
1425        let (bytes, _handles) = buf.split_mut();
1426        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1427        debug_assert_eq!(tx_header.tx_id, 0);
1428        match tx_header.ordinal {
1429            _ => Err(fidl::Error::UnknownOrdinal {
1430                ordinal: tx_header.ordinal,
1431                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1432            }),
1433        }
1434    }
1435}
1436
1437/// A Stream of incoming requests for fuchsia.hardware.qcom.hvdcpopti/Device.
1438pub struct DeviceRequestStream {
1439    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1440    is_terminated: bool,
1441}
1442
1443impl std::marker::Unpin for DeviceRequestStream {}
1444
1445impl futures::stream::FusedStream for DeviceRequestStream {
1446    fn is_terminated(&self) -> bool {
1447        self.is_terminated
1448    }
1449}
1450
1451impl fidl::endpoints::RequestStream for DeviceRequestStream {
1452    type Protocol = DeviceMarker;
1453    type ControlHandle = DeviceControlHandle;
1454
1455    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1456        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1457    }
1458
1459    fn control_handle(&self) -> Self::ControlHandle {
1460        DeviceControlHandle { inner: self.inner.clone() }
1461    }
1462
1463    fn into_inner(
1464        self,
1465    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1466    {
1467        (self.inner, self.is_terminated)
1468    }
1469
1470    fn from_inner(
1471        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1472        is_terminated: bool,
1473    ) -> Self {
1474        Self { inner, is_terminated }
1475    }
1476}
1477
1478impl futures::Stream for DeviceRequestStream {
1479    type Item = Result<DeviceRequest, fidl::Error>;
1480
1481    fn poll_next(
1482        mut self: std::pin::Pin<&mut Self>,
1483        cx: &mut std::task::Context<'_>,
1484    ) -> std::task::Poll<Option<Self::Item>> {
1485        let this = &mut *self;
1486        if this.inner.check_shutdown(cx) {
1487            this.is_terminated = true;
1488            return std::task::Poll::Ready(None);
1489        }
1490        if this.is_terminated {
1491            panic!("polled DeviceRequestStream after completion");
1492        }
1493        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1494            |bytes, handles| {
1495                match this.inner.channel().read_etc(cx, bytes, handles) {
1496                    std::task::Poll::Ready(Ok(())) => {}
1497                    std::task::Poll::Pending => return std::task::Poll::Pending,
1498                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1499                        this.is_terminated = true;
1500                        return std::task::Poll::Ready(None);
1501                    }
1502                    std::task::Poll::Ready(Err(e)) => {
1503                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1504                            e.into(),
1505                        ))));
1506                    }
1507                }
1508
1509                // A message has been received from the channel
1510                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1511
1512                std::task::Poll::Ready(Some(match header.ordinal {
1513                    0x2093fd296e2d8996 => {
1514                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1515                        let mut req = fidl::new_empty!(
1516                            fidl::encoding::EmptyPayload,
1517                            fidl::encoding::DefaultFuchsiaResourceDialect
1518                        );
1519                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1520                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1521                        Ok(DeviceRequest::GetEssentialParams {
1522                            responder: DeviceGetEssentialParamsResponder {
1523                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1524                                tx_id: header.tx_id,
1525                            },
1526                        })
1527                    }
1528                    0x55b14f267312168c => {
1529                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1530                        let mut req = fidl::new_empty!(
1531                            DeviceSetEssentialParamsRequest,
1532                            fidl::encoding::DefaultFuchsiaResourceDialect
1533                        );
1534                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetEssentialParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1535                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1536                        Ok(DeviceRequest::SetEssentialParams {
1537                            params: req.params,
1538
1539                            responder: DeviceSetEssentialParamsResponder {
1540                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1541                                tx_id: header.tx_id,
1542                            },
1543                        })
1544                    }
1545                    0x41a72f916b11e11f => {
1546                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1547                        let mut req = fidl::new_empty!(
1548                            fidl::encoding::EmptyPayload,
1549                            fidl::encoding::DefaultFuchsiaResourceDialect
1550                        );
1551                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1552                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1553                        Ok(DeviceRequest::GetConfig {
1554                            responder: DeviceGetConfigResponder {
1555                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1556                                tx_id: header.tx_id,
1557                            },
1558                        })
1559                    }
1560                    0x9fe048bef0e3577 => {
1561                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1562                        let mut req = fidl::new_empty!(
1563                            fidl::encoding::EmptyPayload,
1564                            fidl::encoding::DefaultFuchsiaResourceDialect
1565                        );
1566                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1567                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1568                        Ok(DeviceRequest::GetDataProvider {
1569                            responder: DeviceGetDataProviderResponder {
1570                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1571                                tx_id: header.tx_id,
1572                            },
1573                        })
1574                    }
1575                    0x4689e121bf9e884 => {
1576                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1577                        let mut req = fidl::new_empty!(
1578                            DeviceSetProcessedFifoDataRequest,
1579                            fidl::encoding::DefaultFuchsiaResourceDialect
1580                        );
1581                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetProcessedFifoDataRequest>(&header, _body_bytes, handles, &mut req)?;
1582                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1583                        Ok(DeviceRequest::SetProcessedFifoData {
1584                            data: req.data,
1585
1586                            responder: DeviceSetProcessedFifoDataResponder {
1587                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1588                                tx_id: header.tx_id,
1589                            },
1590                        })
1591                    }
1592                    0x1c7ba411ae13b250 => {
1593                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1594                        let mut req = fidl::new_empty!(
1595                            fidl::encoding::EmptyPayload,
1596                            fidl::encoding::DefaultFuchsiaResourceDialect
1597                        );
1598                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1599                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1600                        Ok(DeviceRequest::GetStepAndJeitaParams {
1601                            responder: DeviceGetStepAndJeitaParamsResponder {
1602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1603                                tx_id: header.tx_id,
1604                            },
1605                        })
1606                    }
1607                    _ => Err(fidl::Error::UnknownOrdinal {
1608                        ordinal: header.ordinal,
1609                        protocol_name:
1610                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1611                    }),
1612                }))
1613            },
1614        )
1615    }
1616}
1617
1618/// Used by driver to interface with Starnix and speak to the hvdcp_opti daemon.
1619#[derive(Debug)]
1620pub enum DeviceRequest {
1621    GetEssentialParams { responder: DeviceGetEssentialParamsResponder },
1622    SetEssentialParams { params: [u8; 48], responder: DeviceSetEssentialParamsResponder },
1623    GetConfig { responder: DeviceGetConfigResponder },
1624    GetDataProvider { responder: DeviceGetDataProviderResponder },
1625    SetProcessedFifoData { data: [u8; 152], responder: DeviceSetProcessedFifoDataResponder },
1626    GetStepAndJeitaParams { responder: DeviceGetStepAndJeitaParamsResponder },
1627}
1628
1629impl DeviceRequest {
1630    #[allow(irrefutable_let_patterns)]
1631    pub fn into_get_essential_params(self) -> Option<(DeviceGetEssentialParamsResponder)> {
1632        if let DeviceRequest::GetEssentialParams { responder } = self {
1633            Some((responder))
1634        } else {
1635            None
1636        }
1637    }
1638
1639    #[allow(irrefutable_let_patterns)]
1640    pub fn into_set_essential_params(
1641        self,
1642    ) -> Option<([u8; 48], DeviceSetEssentialParamsResponder)> {
1643        if let DeviceRequest::SetEssentialParams { params, responder } = self {
1644            Some((params, responder))
1645        } else {
1646            None
1647        }
1648    }
1649
1650    #[allow(irrefutable_let_patterns)]
1651    pub fn into_get_config(self) -> Option<(DeviceGetConfigResponder)> {
1652        if let DeviceRequest::GetConfig { responder } = self { Some((responder)) } else { None }
1653    }
1654
1655    #[allow(irrefutable_let_patterns)]
1656    pub fn into_get_data_provider(self) -> Option<(DeviceGetDataProviderResponder)> {
1657        if let DeviceRequest::GetDataProvider { responder } = self {
1658            Some((responder))
1659        } else {
1660            None
1661        }
1662    }
1663
1664    #[allow(irrefutable_let_patterns)]
1665    pub fn into_set_processed_fifo_data(
1666        self,
1667    ) -> Option<([u8; 152], DeviceSetProcessedFifoDataResponder)> {
1668        if let DeviceRequest::SetProcessedFifoData { data, responder } = self {
1669            Some((data, responder))
1670        } else {
1671            None
1672        }
1673    }
1674
1675    #[allow(irrefutable_let_patterns)]
1676    pub fn into_get_step_and_jeita_params(self) -> Option<(DeviceGetStepAndJeitaParamsResponder)> {
1677        if let DeviceRequest::GetStepAndJeitaParams { responder } = self {
1678            Some((responder))
1679        } else {
1680            None
1681        }
1682    }
1683
1684    /// Name of the method defined in FIDL
1685    pub fn method_name(&self) -> &'static str {
1686        match *self {
1687            DeviceRequest::GetEssentialParams { .. } => "get_essential_params",
1688            DeviceRequest::SetEssentialParams { .. } => "set_essential_params",
1689            DeviceRequest::GetConfig { .. } => "get_config",
1690            DeviceRequest::GetDataProvider { .. } => "get_data_provider",
1691            DeviceRequest::SetProcessedFifoData { .. } => "set_processed_fifo_data",
1692            DeviceRequest::GetStepAndJeitaParams { .. } => "get_step_and_jeita_params",
1693        }
1694    }
1695}
1696
1697#[derive(Debug, Clone)]
1698pub struct DeviceControlHandle {
1699    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1700}
1701
1702impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1703    fn shutdown(&self) {
1704        self.inner.shutdown()
1705    }
1706
1707    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1708        self.inner.shutdown_with_epitaph(status)
1709    }
1710
1711    fn is_closed(&self) -> bool {
1712        self.inner.channel().is_closed()
1713    }
1714    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1715        self.inner.channel().on_closed()
1716    }
1717
1718    #[cfg(target_os = "fuchsia")]
1719    fn signal_peer(
1720        &self,
1721        clear_mask: zx::Signals,
1722        set_mask: zx::Signals,
1723    ) -> Result<(), zx_status::Status> {
1724        use fidl::Peered;
1725        self.inner.channel().signal_peer(clear_mask, set_mask)
1726    }
1727}
1728
1729impl DeviceControlHandle {}
1730
1731#[must_use = "FIDL methods require a response to be sent"]
1732#[derive(Debug)]
1733pub struct DeviceGetEssentialParamsResponder {
1734    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1735    tx_id: u32,
1736}
1737
1738/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1739/// if the responder is dropped without sending a response, so that the client
1740/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1741impl std::ops::Drop for DeviceGetEssentialParamsResponder {
1742    fn drop(&mut self) {
1743        self.control_handle.shutdown();
1744        // Safety: drops once, never accessed again
1745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1746    }
1747}
1748
1749impl fidl::endpoints::Responder for DeviceGetEssentialParamsResponder {
1750    type ControlHandle = DeviceControlHandle;
1751
1752    fn control_handle(&self) -> &DeviceControlHandle {
1753        &self.control_handle
1754    }
1755
1756    fn drop_without_shutdown(mut self) {
1757        // Safety: drops once, never accessed again due to mem::forget
1758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1759        // Prevent Drop from running (which would shut down the channel)
1760        std::mem::forget(self);
1761    }
1762}
1763
1764impl DeviceGetEssentialParamsResponder {
1765    /// Sends a response to the FIDL transaction.
1766    ///
1767    /// Sets the channel to shutdown if an error occurs.
1768    pub fn send(self, mut result: Result<&[u8; 48], i32>) -> Result<(), fidl::Error> {
1769        let _result = self.send_raw(result);
1770        if _result.is_err() {
1771            self.control_handle.shutdown();
1772        }
1773        self.drop_without_shutdown();
1774        _result
1775    }
1776
1777    /// Similar to "send" but does not shutdown the channel if an error occurs.
1778    pub fn send_no_shutdown_on_err(
1779        self,
1780        mut result: Result<&[u8; 48], i32>,
1781    ) -> Result<(), fidl::Error> {
1782        let _result = self.send_raw(result);
1783        self.drop_without_shutdown();
1784        _result
1785    }
1786
1787    fn send_raw(&self, mut result: Result<&[u8; 48], i32>) -> Result<(), fidl::Error> {
1788        self.control_handle
1789            .inner
1790            .send::<fidl::encoding::ResultType<DeviceGetEssentialParamsResponse, i32>>(
1791                result.map(|params| (params,)),
1792                self.tx_id,
1793                0x2093fd296e2d8996,
1794                fidl::encoding::DynamicFlags::empty(),
1795            )
1796    }
1797}
1798
1799#[must_use = "FIDL methods require a response to be sent"]
1800#[derive(Debug)]
1801pub struct DeviceSetEssentialParamsResponder {
1802    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1803    tx_id: u32,
1804}
1805
1806/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1807/// if the responder is dropped without sending a response, so that the client
1808/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1809impl std::ops::Drop for DeviceSetEssentialParamsResponder {
1810    fn drop(&mut self) {
1811        self.control_handle.shutdown();
1812        // Safety: drops once, never accessed again
1813        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1814    }
1815}
1816
1817impl fidl::endpoints::Responder for DeviceSetEssentialParamsResponder {
1818    type ControlHandle = DeviceControlHandle;
1819
1820    fn control_handle(&self) -> &DeviceControlHandle {
1821        &self.control_handle
1822    }
1823
1824    fn drop_without_shutdown(mut self) {
1825        // Safety: drops once, never accessed again due to mem::forget
1826        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1827        // Prevent Drop from running (which would shut down the channel)
1828        std::mem::forget(self);
1829    }
1830}
1831
1832impl DeviceSetEssentialParamsResponder {
1833    /// Sends a response to the FIDL transaction.
1834    ///
1835    /// Sets the channel to shutdown if an error occurs.
1836    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1837        let _result = self.send_raw(result);
1838        if _result.is_err() {
1839            self.control_handle.shutdown();
1840        }
1841        self.drop_without_shutdown();
1842        _result
1843    }
1844
1845    /// Similar to "send" but does not shutdown the channel if an error occurs.
1846    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1847        let _result = self.send_raw(result);
1848        self.drop_without_shutdown();
1849        _result
1850    }
1851
1852    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1853        self.control_handle
1854            .inner
1855            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1856                result,
1857                self.tx_id,
1858                0x55b14f267312168c,
1859                fidl::encoding::DynamicFlags::empty(),
1860            )
1861    }
1862}
1863
1864#[must_use = "FIDL methods require a response to be sent"]
1865#[derive(Debug)]
1866pub struct DeviceGetConfigResponder {
1867    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1868    tx_id: u32,
1869}
1870
1871/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1872/// if the responder is dropped without sending a response, so that the client
1873/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1874impl std::ops::Drop for DeviceGetConfigResponder {
1875    fn drop(&mut self) {
1876        self.control_handle.shutdown();
1877        // Safety: drops once, never accessed again
1878        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1879    }
1880}
1881
1882impl fidl::endpoints::Responder for DeviceGetConfigResponder {
1883    type ControlHandle = DeviceControlHandle;
1884
1885    fn control_handle(&self) -> &DeviceControlHandle {
1886        &self.control_handle
1887    }
1888
1889    fn drop_without_shutdown(mut self) {
1890        // Safety: drops once, never accessed again due to mem::forget
1891        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1892        // Prevent Drop from running (which would shut down the channel)
1893        std::mem::forget(self);
1894    }
1895}
1896
1897impl DeviceGetConfigResponder {
1898    /// Sends a response to the FIDL transaction.
1899    ///
1900    /// Sets the channel to shutdown if an error occurs.
1901    pub fn send(self, mut config: &[u8; 104]) -> Result<(), fidl::Error> {
1902        let _result = self.send_raw(config);
1903        if _result.is_err() {
1904            self.control_handle.shutdown();
1905        }
1906        self.drop_without_shutdown();
1907        _result
1908    }
1909
1910    /// Similar to "send" but does not shutdown the channel if an error occurs.
1911    pub fn send_no_shutdown_on_err(self, mut config: &[u8; 104]) -> Result<(), fidl::Error> {
1912        let _result = self.send_raw(config);
1913        self.drop_without_shutdown();
1914        _result
1915    }
1916
1917    fn send_raw(&self, mut config: &[u8; 104]) -> Result<(), fidl::Error> {
1918        self.control_handle.inner.send::<DeviceGetConfigResponse>(
1919            (config,),
1920            self.tx_id,
1921            0x41a72f916b11e11f,
1922            fidl::encoding::DynamicFlags::empty(),
1923        )
1924    }
1925}
1926
1927#[must_use = "FIDL methods require a response to be sent"]
1928#[derive(Debug)]
1929pub struct DeviceGetDataProviderResponder {
1930    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1931    tx_id: u32,
1932}
1933
1934/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1935/// if the responder is dropped without sending a response, so that the client
1936/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1937impl std::ops::Drop for DeviceGetDataProviderResponder {
1938    fn drop(&mut self) {
1939        self.control_handle.shutdown();
1940        // Safety: drops once, never accessed again
1941        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1942    }
1943}
1944
1945impl fidl::endpoints::Responder for DeviceGetDataProviderResponder {
1946    type ControlHandle = DeviceControlHandle;
1947
1948    fn control_handle(&self) -> &DeviceControlHandle {
1949        &self.control_handle
1950    }
1951
1952    fn drop_without_shutdown(mut self) {
1953        // Safety: drops once, never accessed again due to mem::forget
1954        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1955        // Prevent Drop from running (which would shut down the channel)
1956        std::mem::forget(self);
1957    }
1958}
1959
1960impl DeviceGetDataProviderResponder {
1961    /// Sends a response to the FIDL transaction.
1962    ///
1963    /// Sets the channel to shutdown if an error occurs.
1964    pub fn send(
1965        self,
1966        mut provider: fidl::endpoints::ClientEnd<DataProviderMarker>,
1967    ) -> Result<(), fidl::Error> {
1968        let _result = self.send_raw(provider);
1969        if _result.is_err() {
1970            self.control_handle.shutdown();
1971        }
1972        self.drop_without_shutdown();
1973        _result
1974    }
1975
1976    /// Similar to "send" but does not shutdown the channel if an error occurs.
1977    pub fn send_no_shutdown_on_err(
1978        self,
1979        mut provider: fidl::endpoints::ClientEnd<DataProviderMarker>,
1980    ) -> Result<(), fidl::Error> {
1981        let _result = self.send_raw(provider);
1982        self.drop_without_shutdown();
1983        _result
1984    }
1985
1986    fn send_raw(
1987        &self,
1988        mut provider: fidl::endpoints::ClientEnd<DataProviderMarker>,
1989    ) -> Result<(), fidl::Error> {
1990        self.control_handle.inner.send::<DeviceGetDataProviderResponse>(
1991            (provider,),
1992            self.tx_id,
1993            0x9fe048bef0e3577,
1994            fidl::encoding::DynamicFlags::empty(),
1995        )
1996    }
1997}
1998
1999#[must_use = "FIDL methods require a response to be sent"]
2000#[derive(Debug)]
2001pub struct DeviceSetProcessedFifoDataResponder {
2002    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2003    tx_id: u32,
2004}
2005
2006/// Set the the channel to be shutdown (see [`DeviceControlHandle::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 DeviceSetProcessedFifoDataResponder {
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 fidl::endpoints::Responder for DeviceSetProcessedFifoDataResponder {
2018    type ControlHandle = DeviceControlHandle;
2019
2020    fn control_handle(&self) -> &DeviceControlHandle {
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 DeviceSetProcessedFifoDataResponder {
2033    /// Sends a response to the FIDL transaction.
2034    ///
2035    /// Sets the channel to shutdown if an error occurs.
2036    pub fn send(self) -> Result<(), fidl::Error> {
2037        let _result = self.send_raw();
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(self) -> Result<(), fidl::Error> {
2047        let _result = self.send_raw();
2048        self.drop_without_shutdown();
2049        _result
2050    }
2051
2052    fn send_raw(&self) -> Result<(), fidl::Error> {
2053        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2054            (),
2055            self.tx_id,
2056            0x4689e121bf9e884,
2057            fidl::encoding::DynamicFlags::empty(),
2058        )
2059    }
2060}
2061
2062#[must_use = "FIDL methods require a response to be sent"]
2063#[derive(Debug)]
2064pub struct DeviceGetStepAndJeitaParamsResponder {
2065    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2066    tx_id: u32,
2067}
2068
2069/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2070/// if the responder is dropped without sending a response, so that the client
2071/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2072impl std::ops::Drop for DeviceGetStepAndJeitaParamsResponder {
2073    fn drop(&mut self) {
2074        self.control_handle.shutdown();
2075        // Safety: drops once, never accessed again
2076        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2077    }
2078}
2079
2080impl fidl::endpoints::Responder for DeviceGetStepAndJeitaParamsResponder {
2081    type ControlHandle = DeviceControlHandle;
2082
2083    fn control_handle(&self) -> &DeviceControlHandle {
2084        &self.control_handle
2085    }
2086
2087    fn drop_without_shutdown(mut self) {
2088        // Safety: drops once, never accessed again due to mem::forget
2089        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2090        // Prevent Drop from running (which would shut down the channel)
2091        std::mem::forget(self);
2092    }
2093}
2094
2095impl DeviceGetStepAndJeitaParamsResponder {
2096    /// Sends a response to the FIDL transaction.
2097    ///
2098    /// Sets the channel to shutdown if an error occurs.
2099    pub fn send(self, mut params: &[u8; 247]) -> Result<(), fidl::Error> {
2100        let _result = self.send_raw(params);
2101        if _result.is_err() {
2102            self.control_handle.shutdown();
2103        }
2104        self.drop_without_shutdown();
2105        _result
2106    }
2107
2108    /// Similar to "send" but does not shutdown the channel if an error occurs.
2109    pub fn send_no_shutdown_on_err(self, mut params: &[u8; 247]) -> Result<(), fidl::Error> {
2110        let _result = self.send_raw(params);
2111        self.drop_without_shutdown();
2112        _result
2113    }
2114
2115    fn send_raw(&self, mut params: &[u8; 247]) -> Result<(), fidl::Error> {
2116        self.control_handle.inner.send::<DeviceGetStepAndJeitaParamsResponse>(
2117            (params,),
2118            self.tx_id,
2119            0x1c7ba411ae13b250,
2120            fidl::encoding::DynamicFlags::empty(),
2121        )
2122    }
2123}
2124
2125#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2126pub struct IioMarker;
2127
2128impl fidl::endpoints::ProtocolMarker for IioMarker {
2129    type Proxy = IioProxy;
2130    type RequestStream = IioRequestStream;
2131    #[cfg(target_os = "fuchsia")]
2132    type SynchronousProxy = IioSynchronousProxy;
2133
2134    const DEBUG_NAME: &'static str = "fuchsia.hardware.qcom.hvdcpopti.Iio";
2135}
2136impl fidl::endpoints::DiscoverableProtocolMarker for IioMarker {}
2137pub type IioGetIioValueResult = Result<i32, i32>;
2138
2139pub trait IioProxyInterface: Send + Sync {
2140    type GetIioValueResponseFut: std::future::Future<Output = Result<IioGetIioValueResult, fidl::Error>>
2141        + Send;
2142    fn r#get_iio_value(&self, label: &str) -> Self::GetIioValueResponseFut;
2143}
2144#[derive(Debug)]
2145#[cfg(target_os = "fuchsia")]
2146pub struct IioSynchronousProxy {
2147    client: fidl::client::sync::Client,
2148}
2149
2150#[cfg(target_os = "fuchsia")]
2151impl fidl::endpoints::SynchronousProxy for IioSynchronousProxy {
2152    type Proxy = IioProxy;
2153    type Protocol = IioMarker;
2154
2155    fn from_channel(inner: fidl::Channel) -> Self {
2156        Self::new(inner)
2157    }
2158
2159    fn into_channel(self) -> fidl::Channel {
2160        self.client.into_channel()
2161    }
2162
2163    fn as_channel(&self) -> &fidl::Channel {
2164        self.client.as_channel()
2165    }
2166}
2167
2168#[cfg(target_os = "fuchsia")]
2169impl IioSynchronousProxy {
2170    pub fn new(channel: fidl::Channel) -> Self {
2171        let protocol_name = <IioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2172        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2173    }
2174
2175    pub fn into_channel(self) -> fidl::Channel {
2176        self.client.into_channel()
2177    }
2178
2179    /// Waits until an event arrives and returns it. It is safe for other
2180    /// threads to make concurrent requests while waiting for an event.
2181    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<IioEvent, fidl::Error> {
2182        IioEvent::decode(self.client.wait_for_event(deadline)?)
2183    }
2184
2185    /// Gets Industrial I/O (IIO) reading value. Values available depend on what the server
2186    /// supports. May overlap with other configs in fuchsia.power.battery, but will be cleaned
2187    /// up with sysfs cleanup.
2188    pub fn r#get_iio_value(
2189        &self,
2190        mut label: &str,
2191        ___deadline: zx::MonotonicInstant,
2192    ) -> Result<IioGetIioValueResult, fidl::Error> {
2193        let _response = self.client.send_query::<
2194            IioGetIioValueRequest,
2195            fidl::encoding::ResultType<IioGetIioValueResponse, i32>,
2196        >(
2197            (label,),
2198            0x6647435fd885de5e,
2199            fidl::encoding::DynamicFlags::empty(),
2200            ___deadline,
2201        )?;
2202        Ok(_response.map(|x| x.value))
2203    }
2204}
2205
2206#[cfg(target_os = "fuchsia")]
2207impl From<IioSynchronousProxy> for zx::NullableHandle {
2208    fn from(value: IioSynchronousProxy) -> Self {
2209        value.into_channel().into()
2210    }
2211}
2212
2213#[cfg(target_os = "fuchsia")]
2214impl From<fidl::Channel> for IioSynchronousProxy {
2215    fn from(value: fidl::Channel) -> Self {
2216        Self::new(value)
2217    }
2218}
2219
2220#[cfg(target_os = "fuchsia")]
2221impl fidl::endpoints::FromClient for IioSynchronousProxy {
2222    type Protocol = IioMarker;
2223
2224    fn from_client(value: fidl::endpoints::ClientEnd<IioMarker>) -> Self {
2225        Self::new(value.into_channel())
2226    }
2227}
2228
2229#[derive(Debug, Clone)]
2230pub struct IioProxy {
2231    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2232}
2233
2234impl fidl::endpoints::Proxy for IioProxy {
2235    type Protocol = IioMarker;
2236
2237    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2238        Self::new(inner)
2239    }
2240
2241    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2242        self.client.into_channel().map_err(|client| Self { client })
2243    }
2244
2245    fn as_channel(&self) -> &::fidl::AsyncChannel {
2246        self.client.as_channel()
2247    }
2248}
2249
2250impl IioProxy {
2251    /// Create a new Proxy for fuchsia.hardware.qcom.hvdcpopti/Iio.
2252    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2253        let protocol_name = <IioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2254        Self { client: fidl::client::Client::new(channel, protocol_name) }
2255    }
2256
2257    /// Get a Stream of events from the remote end of the protocol.
2258    ///
2259    /// # Panics
2260    ///
2261    /// Panics if the event stream was already taken.
2262    pub fn take_event_stream(&self) -> IioEventStream {
2263        IioEventStream { event_receiver: self.client.take_event_receiver() }
2264    }
2265
2266    /// Gets Industrial I/O (IIO) reading value. Values available depend on what the server
2267    /// supports. May overlap with other configs in fuchsia.power.battery, but will be cleaned
2268    /// up with sysfs cleanup.
2269    pub fn r#get_iio_value(
2270        &self,
2271        mut label: &str,
2272    ) -> fidl::client::QueryResponseFut<
2273        IioGetIioValueResult,
2274        fidl::encoding::DefaultFuchsiaResourceDialect,
2275    > {
2276        IioProxyInterface::r#get_iio_value(self, label)
2277    }
2278}
2279
2280impl IioProxyInterface for IioProxy {
2281    type GetIioValueResponseFut = fidl::client::QueryResponseFut<
2282        IioGetIioValueResult,
2283        fidl::encoding::DefaultFuchsiaResourceDialect,
2284    >;
2285    fn r#get_iio_value(&self, mut label: &str) -> Self::GetIioValueResponseFut {
2286        fn _decode(
2287            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2288        ) -> Result<IioGetIioValueResult, fidl::Error> {
2289            let _response = fidl::client::decode_transaction_body::<
2290                fidl::encoding::ResultType<IioGetIioValueResponse, i32>,
2291                fidl::encoding::DefaultFuchsiaResourceDialect,
2292                0x6647435fd885de5e,
2293            >(_buf?)?;
2294            Ok(_response.map(|x| x.value))
2295        }
2296        self.client.send_query_and_decode::<IioGetIioValueRequest, IioGetIioValueResult>(
2297            (label,),
2298            0x6647435fd885de5e,
2299            fidl::encoding::DynamicFlags::empty(),
2300            _decode,
2301        )
2302    }
2303}
2304
2305pub struct IioEventStream {
2306    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2307}
2308
2309impl std::marker::Unpin for IioEventStream {}
2310
2311impl futures::stream::FusedStream for IioEventStream {
2312    fn is_terminated(&self) -> bool {
2313        self.event_receiver.is_terminated()
2314    }
2315}
2316
2317impl futures::Stream for IioEventStream {
2318    type Item = Result<IioEvent, fidl::Error>;
2319
2320    fn poll_next(
2321        mut self: std::pin::Pin<&mut Self>,
2322        cx: &mut std::task::Context<'_>,
2323    ) -> std::task::Poll<Option<Self::Item>> {
2324        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2325            &mut self.event_receiver,
2326            cx
2327        )?) {
2328            Some(buf) => std::task::Poll::Ready(Some(IioEvent::decode(buf))),
2329            None => std::task::Poll::Ready(None),
2330        }
2331    }
2332}
2333
2334#[derive(Debug)]
2335pub enum IioEvent {}
2336
2337impl IioEvent {
2338    /// Decodes a message buffer as a [`IioEvent`].
2339    fn decode(
2340        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2341    ) -> Result<IioEvent, fidl::Error> {
2342        let (bytes, _handles) = buf.split_mut();
2343        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2344        debug_assert_eq!(tx_header.tx_id, 0);
2345        match tx_header.ordinal {
2346            _ => Err(fidl::Error::UnknownOrdinal {
2347                ordinal: tx_header.ordinal,
2348                protocol_name: <IioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2349            }),
2350        }
2351    }
2352}
2353
2354/// A Stream of incoming requests for fuchsia.hardware.qcom.hvdcpopti/Iio.
2355pub struct IioRequestStream {
2356    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2357    is_terminated: bool,
2358}
2359
2360impl std::marker::Unpin for IioRequestStream {}
2361
2362impl futures::stream::FusedStream for IioRequestStream {
2363    fn is_terminated(&self) -> bool {
2364        self.is_terminated
2365    }
2366}
2367
2368impl fidl::endpoints::RequestStream for IioRequestStream {
2369    type Protocol = IioMarker;
2370    type ControlHandle = IioControlHandle;
2371
2372    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2373        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2374    }
2375
2376    fn control_handle(&self) -> Self::ControlHandle {
2377        IioControlHandle { inner: self.inner.clone() }
2378    }
2379
2380    fn into_inner(
2381        self,
2382    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2383    {
2384        (self.inner, self.is_terminated)
2385    }
2386
2387    fn from_inner(
2388        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2389        is_terminated: bool,
2390    ) -> Self {
2391        Self { inner, is_terminated }
2392    }
2393}
2394
2395impl futures::Stream for IioRequestStream {
2396    type Item = Result<IioRequest, fidl::Error>;
2397
2398    fn poll_next(
2399        mut self: std::pin::Pin<&mut Self>,
2400        cx: &mut std::task::Context<'_>,
2401    ) -> std::task::Poll<Option<Self::Item>> {
2402        let this = &mut *self;
2403        if this.inner.check_shutdown(cx) {
2404            this.is_terminated = true;
2405            return std::task::Poll::Ready(None);
2406        }
2407        if this.is_terminated {
2408            panic!("polled IioRequestStream after completion");
2409        }
2410        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2411            |bytes, handles| {
2412                match this.inner.channel().read_etc(cx, bytes, handles) {
2413                    std::task::Poll::Ready(Ok(())) => {}
2414                    std::task::Poll::Pending => return std::task::Poll::Pending,
2415                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2416                        this.is_terminated = true;
2417                        return std::task::Poll::Ready(None);
2418                    }
2419                    std::task::Poll::Ready(Err(e)) => {
2420                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2421                            e.into(),
2422                        ))));
2423                    }
2424                }
2425
2426                // A message has been received from the channel
2427                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2428
2429                std::task::Poll::Ready(Some(match header.ordinal {
2430                    0x6647435fd885de5e => {
2431                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2432                        let mut req = fidl::new_empty!(
2433                            IioGetIioValueRequest,
2434                            fidl::encoding::DefaultFuchsiaResourceDialect
2435                        );
2436                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IioGetIioValueRequest>(&header, _body_bytes, handles, &mut req)?;
2437                        let control_handle = IioControlHandle { inner: this.inner.clone() };
2438                        Ok(IioRequest::GetIioValue {
2439                            label: req.label,
2440
2441                            responder: IioGetIioValueResponder {
2442                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2443                                tx_id: header.tx_id,
2444                            },
2445                        })
2446                    }
2447                    _ => Err(fidl::Error::UnknownOrdinal {
2448                        ordinal: header.ordinal,
2449                        protocol_name: <IioMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2450                    }),
2451                }))
2452            },
2453        )
2454    }
2455}
2456
2457#[derive(Debug)]
2458pub enum IioRequest {
2459    /// Gets Industrial I/O (IIO) reading value. Values available depend on what the server
2460    /// supports. May overlap with other configs in fuchsia.power.battery, but will be cleaned
2461    /// up with sysfs cleanup.
2462    GetIioValue { label: String, responder: IioGetIioValueResponder },
2463}
2464
2465impl IioRequest {
2466    #[allow(irrefutable_let_patterns)]
2467    pub fn into_get_iio_value(self) -> Option<(String, IioGetIioValueResponder)> {
2468        if let IioRequest::GetIioValue { label, responder } = self {
2469            Some((label, responder))
2470        } else {
2471            None
2472        }
2473    }
2474
2475    /// Name of the method defined in FIDL
2476    pub fn method_name(&self) -> &'static str {
2477        match *self {
2478            IioRequest::GetIioValue { .. } => "get_iio_value",
2479        }
2480    }
2481}
2482
2483#[derive(Debug, Clone)]
2484pub struct IioControlHandle {
2485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2486}
2487
2488impl fidl::endpoints::ControlHandle for IioControlHandle {
2489    fn shutdown(&self) {
2490        self.inner.shutdown()
2491    }
2492
2493    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2494        self.inner.shutdown_with_epitaph(status)
2495    }
2496
2497    fn is_closed(&self) -> bool {
2498        self.inner.channel().is_closed()
2499    }
2500    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2501        self.inner.channel().on_closed()
2502    }
2503
2504    #[cfg(target_os = "fuchsia")]
2505    fn signal_peer(
2506        &self,
2507        clear_mask: zx::Signals,
2508        set_mask: zx::Signals,
2509    ) -> Result<(), zx_status::Status> {
2510        use fidl::Peered;
2511        self.inner.channel().signal_peer(clear_mask, set_mask)
2512    }
2513}
2514
2515impl IioControlHandle {}
2516
2517#[must_use = "FIDL methods require a response to be sent"]
2518#[derive(Debug)]
2519pub struct IioGetIioValueResponder {
2520    control_handle: std::mem::ManuallyDrop<IioControlHandle>,
2521    tx_id: u32,
2522}
2523
2524/// Set the the channel to be shutdown (see [`IioControlHandle::shutdown`])
2525/// if the responder is dropped without sending a response, so that the client
2526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2527impl std::ops::Drop for IioGetIioValueResponder {
2528    fn drop(&mut self) {
2529        self.control_handle.shutdown();
2530        // Safety: drops once, never accessed again
2531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2532    }
2533}
2534
2535impl fidl::endpoints::Responder for IioGetIioValueResponder {
2536    type ControlHandle = IioControlHandle;
2537
2538    fn control_handle(&self) -> &IioControlHandle {
2539        &self.control_handle
2540    }
2541
2542    fn drop_without_shutdown(mut self) {
2543        // Safety: drops once, never accessed again due to mem::forget
2544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2545        // Prevent Drop from running (which would shut down the channel)
2546        std::mem::forget(self);
2547    }
2548}
2549
2550impl IioGetIioValueResponder {
2551    /// Sends a response to the FIDL transaction.
2552    ///
2553    /// Sets the channel to shutdown if an error occurs.
2554    pub fn send(self, mut result: Result<i32, i32>) -> Result<(), fidl::Error> {
2555        let _result = self.send_raw(result);
2556        if _result.is_err() {
2557            self.control_handle.shutdown();
2558        }
2559        self.drop_without_shutdown();
2560        _result
2561    }
2562
2563    /// Similar to "send" but does not shutdown the channel if an error occurs.
2564    pub fn send_no_shutdown_on_err(self, mut result: Result<i32, i32>) -> Result<(), fidl::Error> {
2565        let _result = self.send_raw(result);
2566        self.drop_without_shutdown();
2567        _result
2568    }
2569
2570    fn send_raw(&self, mut result: Result<i32, i32>) -> Result<(), fidl::Error> {
2571        self.control_handle.inner.send::<fidl::encoding::ResultType<IioGetIioValueResponse, i32>>(
2572            result.map(|value| (value,)),
2573            self.tx_id,
2574            0x6647435fd885de5e,
2575            fidl::encoding::DynamicFlags::empty(),
2576        )
2577    }
2578}
2579
2580#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2581pub struct ServiceMarker;
2582
2583#[cfg(target_os = "fuchsia")]
2584impl fidl::endpoints::ServiceMarker for ServiceMarker {
2585    type Proxy = ServiceProxy;
2586    type Request = ServiceRequest;
2587    const SERVICE_NAME: &'static str = "fuchsia.hardware.qcom.hvdcpopti.Service";
2588}
2589
2590/// A request for one of the member protocols of Service.
2591///
2592#[cfg(target_os = "fuchsia")]
2593pub enum ServiceRequest {
2594    Device(DeviceRequestStream),
2595    Battery(BatteryRequestStream),
2596    Iio(IioRequestStream),
2597}
2598
2599#[cfg(target_os = "fuchsia")]
2600impl fidl::endpoints::ServiceRequest for ServiceRequest {
2601    type Service = ServiceMarker;
2602
2603    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2604        match name {
2605            "device" => Self::Device(
2606                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2607            ),
2608            "battery" => Self::Battery(
2609                <BatteryRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2610            ),
2611            "iio" => Self::Iio(<IioRequestStream as fidl::endpoints::RequestStream>::from_channel(
2612                _channel,
2613            )),
2614            _ => panic!("no such member protocol name for service Service"),
2615        }
2616    }
2617
2618    fn member_names() -> &'static [&'static str] {
2619        &["device", "battery", "iio"]
2620    }
2621}
2622#[cfg(target_os = "fuchsia")]
2623pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2624
2625#[cfg(target_os = "fuchsia")]
2626impl fidl::endpoints::ServiceProxy for ServiceProxy {
2627    type Service = ServiceMarker;
2628
2629    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2630        Self(opener)
2631    }
2632}
2633
2634#[cfg(target_os = "fuchsia")]
2635impl ServiceProxy {
2636    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2637        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2638        self.connect_channel_to_device(server_end)?;
2639        Ok(proxy)
2640    }
2641
2642    /// Like `connect_to_device`, but returns a sync proxy.
2643    /// See [`Self::connect_to_device`] for more details.
2644    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2645        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2646        self.connect_channel_to_device(server_end)?;
2647        Ok(proxy)
2648    }
2649
2650    /// Like `connect_to_device`, but accepts a server end.
2651    /// See [`Self::connect_to_device`] for more details.
2652    pub fn connect_channel_to_device(
2653        &self,
2654        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2655    ) -> Result<(), fidl::Error> {
2656        self.0.open_member("device", server_end.into_channel())
2657    }
2658    pub fn connect_to_battery(&self) -> Result<BatteryProxy, fidl::Error> {
2659        let (proxy, server_end) = fidl::endpoints::create_proxy::<BatteryMarker>();
2660        self.connect_channel_to_battery(server_end)?;
2661        Ok(proxy)
2662    }
2663
2664    /// Like `connect_to_battery`, but returns a sync proxy.
2665    /// See [`Self::connect_to_battery`] for more details.
2666    pub fn connect_to_battery_sync(&self) -> Result<BatterySynchronousProxy, fidl::Error> {
2667        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<BatteryMarker>();
2668        self.connect_channel_to_battery(server_end)?;
2669        Ok(proxy)
2670    }
2671
2672    /// Like `connect_to_battery`, but accepts a server end.
2673    /// See [`Self::connect_to_battery`] for more details.
2674    pub fn connect_channel_to_battery(
2675        &self,
2676        server_end: fidl::endpoints::ServerEnd<BatteryMarker>,
2677    ) -> Result<(), fidl::Error> {
2678        self.0.open_member("battery", server_end.into_channel())
2679    }
2680    pub fn connect_to_iio(&self) -> Result<IioProxy, fidl::Error> {
2681        let (proxy, server_end) = fidl::endpoints::create_proxy::<IioMarker>();
2682        self.connect_channel_to_iio(server_end)?;
2683        Ok(proxy)
2684    }
2685
2686    /// Like `connect_to_iio`, but returns a sync proxy.
2687    /// See [`Self::connect_to_iio`] for more details.
2688    pub fn connect_to_iio_sync(&self) -> Result<IioSynchronousProxy, fidl::Error> {
2689        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<IioMarker>();
2690        self.connect_channel_to_iio(server_end)?;
2691        Ok(proxy)
2692    }
2693
2694    /// Like `connect_to_iio`, but accepts a server end.
2695    /// See [`Self::connect_to_iio`] for more details.
2696    pub fn connect_channel_to_iio(
2697        &self,
2698        server_end: fidl::endpoints::ServerEnd<IioMarker>,
2699    ) -> Result<(), fidl::Error> {
2700        self.0.open_member("iio", server_end.into_channel())
2701    }
2702
2703    pub fn instance_name(&self) -> &str {
2704        self.0.instance_name()
2705    }
2706}
2707
2708mod internal {
2709    use super::*;
2710
2711    impl fidl::encoding::ResourceTypeMarker for DataProviderOnFifoDataRequest {
2712        type Borrowed<'a> = &'a mut Self;
2713        fn take_or_borrow<'a>(
2714            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2715        ) -> Self::Borrowed<'a> {
2716            value
2717        }
2718    }
2719
2720    unsafe impl fidl::encoding::TypeMarker for DataProviderOnFifoDataRequest {
2721        type Owned = Self;
2722
2723        #[inline(always)]
2724        fn inline_align(_context: fidl::encoding::Context) -> usize {
2725            8
2726        }
2727
2728        #[inline(always)]
2729        fn inline_size(_context: fidl::encoding::Context) -> usize {
2730            24
2731        }
2732    }
2733
2734    unsafe impl
2735        fidl::encoding::Encode<
2736            DataProviderOnFifoDataRequest,
2737            fidl::encoding::DefaultFuchsiaResourceDialect,
2738        > for &mut DataProviderOnFifoDataRequest
2739    {
2740        #[inline]
2741        unsafe fn encode(
2742            self,
2743            encoder: &mut fidl::encoding::Encoder<
2744                '_,
2745                fidl::encoding::DefaultFuchsiaResourceDialect,
2746            >,
2747            offset: usize,
2748            _depth: fidl::encoding::Depth,
2749        ) -> fidl::Result<()> {
2750            encoder.debug_check_bounds::<DataProviderOnFifoDataRequest>(offset);
2751            // Delegate to tuple encoding.
2752            fidl::encoding::Encode::<
2753                DataProviderOnFifoDataRequest,
2754                fidl::encoding::DefaultFuchsiaResourceDialect,
2755            >::encode(
2756                (
2757                    <fidl::encoding::Vector<u8, 1748> as fidl::encoding::ValueTypeMarker>::borrow(
2758                        &self.data,
2759                    ),
2760                    <fidl::encoding::Optional<
2761                        fidl::encoding::HandleType<
2762                            fidl::EventPair,
2763                            { fidl::ObjectType::EVENTPAIR.into_raw() },
2764                            16387,
2765                        >,
2766                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2767                        &mut self.wake_lease
2768                    ),
2769                ),
2770                encoder,
2771                offset,
2772                _depth,
2773            )
2774        }
2775    }
2776    unsafe impl<
2777        T0: fidl::encoding::Encode<
2778                fidl::encoding::Vector<u8, 1748>,
2779                fidl::encoding::DefaultFuchsiaResourceDialect,
2780            >,
2781        T1: fidl::encoding::Encode<
2782                fidl::encoding::Optional<
2783                    fidl::encoding::HandleType<
2784                        fidl::EventPair,
2785                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2786                        16387,
2787                    >,
2788                >,
2789                fidl::encoding::DefaultFuchsiaResourceDialect,
2790            >,
2791    >
2792        fidl::encoding::Encode<
2793            DataProviderOnFifoDataRequest,
2794            fidl::encoding::DefaultFuchsiaResourceDialect,
2795        > for (T0, T1)
2796    {
2797        #[inline]
2798        unsafe fn encode(
2799            self,
2800            encoder: &mut fidl::encoding::Encoder<
2801                '_,
2802                fidl::encoding::DefaultFuchsiaResourceDialect,
2803            >,
2804            offset: usize,
2805            depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            encoder.debug_check_bounds::<DataProviderOnFifoDataRequest>(offset);
2808            // Zero out padding regions. There's no need to apply masks
2809            // because the unmasked parts will be overwritten by fields.
2810            unsafe {
2811                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2812                (ptr as *mut u64).write_unaligned(0);
2813            }
2814            // Write the fields.
2815            self.0.encode(encoder, offset + 0, depth)?;
2816            self.1.encode(encoder, offset + 16, depth)?;
2817            Ok(())
2818        }
2819    }
2820
2821    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2822        for DataProviderOnFifoDataRequest
2823    {
2824        #[inline(always)]
2825        fn new_empty() -> Self {
2826            Self {
2827                data: fidl::new_empty!(fidl::encoding::Vector<u8, 1748>, fidl::encoding::DefaultFuchsiaResourceDialect),
2828                wake_lease: fidl::new_empty!(
2829                    fidl::encoding::Optional<
2830                        fidl::encoding::HandleType<
2831                            fidl::EventPair,
2832                            { fidl::ObjectType::EVENTPAIR.into_raw() },
2833                            16387,
2834                        >,
2835                    >,
2836                    fidl::encoding::DefaultFuchsiaResourceDialect
2837                ),
2838            }
2839        }
2840
2841        #[inline]
2842        unsafe fn decode(
2843            &mut self,
2844            decoder: &mut fidl::encoding::Decoder<
2845                '_,
2846                fidl::encoding::DefaultFuchsiaResourceDialect,
2847            >,
2848            offset: usize,
2849            _depth: fidl::encoding::Depth,
2850        ) -> fidl::Result<()> {
2851            decoder.debug_check_bounds::<Self>(offset);
2852            // Verify that padding bytes are zero.
2853            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2854            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2855            let mask = 0xffffffff00000000u64;
2856            let maskedval = padval & mask;
2857            if maskedval != 0 {
2858                return Err(fidl::Error::NonZeroPadding {
2859                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2860                });
2861            }
2862            fidl::decode!(fidl::encoding::Vector<u8, 1748>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.data, decoder, offset + 0, _depth)?;
2863            fidl::decode!(
2864                fidl::encoding::Optional<
2865                    fidl::encoding::HandleType<
2866                        fidl::EventPair,
2867                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2868                        16387,
2869                    >,
2870                >,
2871                fidl::encoding::DefaultFuchsiaResourceDialect,
2872                &mut self.wake_lease,
2873                decoder,
2874                offset + 16,
2875                _depth
2876            )?;
2877            Ok(())
2878        }
2879    }
2880
2881    impl fidl::encoding::ResourceTypeMarker for DeviceGetDataProviderResponse {
2882        type Borrowed<'a> = &'a mut Self;
2883        fn take_or_borrow<'a>(
2884            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2885        ) -> Self::Borrowed<'a> {
2886            value
2887        }
2888    }
2889
2890    unsafe impl fidl::encoding::TypeMarker for DeviceGetDataProviderResponse {
2891        type Owned = Self;
2892
2893        #[inline(always)]
2894        fn inline_align(_context: fidl::encoding::Context) -> usize {
2895            4
2896        }
2897
2898        #[inline(always)]
2899        fn inline_size(_context: fidl::encoding::Context) -> usize {
2900            4
2901        }
2902    }
2903
2904    unsafe impl
2905        fidl::encoding::Encode<
2906            DeviceGetDataProviderResponse,
2907            fidl::encoding::DefaultFuchsiaResourceDialect,
2908        > for &mut DeviceGetDataProviderResponse
2909    {
2910        #[inline]
2911        unsafe fn encode(
2912            self,
2913            encoder: &mut fidl::encoding::Encoder<
2914                '_,
2915                fidl::encoding::DefaultFuchsiaResourceDialect,
2916            >,
2917            offset: usize,
2918            _depth: fidl::encoding::Depth,
2919        ) -> fidl::Result<()> {
2920            encoder.debug_check_bounds::<DeviceGetDataProviderResponse>(offset);
2921            // Delegate to tuple encoding.
2922            fidl::encoding::Encode::<DeviceGetDataProviderResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2923                (
2924                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DataProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
2925                ),
2926                encoder, offset, _depth
2927            )
2928        }
2929    }
2930    unsafe impl<
2931        T0: fidl::encoding::Encode<
2932                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DataProviderMarker>>,
2933                fidl::encoding::DefaultFuchsiaResourceDialect,
2934            >,
2935    >
2936        fidl::encoding::Encode<
2937            DeviceGetDataProviderResponse,
2938            fidl::encoding::DefaultFuchsiaResourceDialect,
2939        > for (T0,)
2940    {
2941        #[inline]
2942        unsafe fn encode(
2943            self,
2944            encoder: &mut fidl::encoding::Encoder<
2945                '_,
2946                fidl::encoding::DefaultFuchsiaResourceDialect,
2947            >,
2948            offset: usize,
2949            depth: fidl::encoding::Depth,
2950        ) -> fidl::Result<()> {
2951            encoder.debug_check_bounds::<DeviceGetDataProviderResponse>(offset);
2952            // Zero out padding regions. There's no need to apply masks
2953            // because the unmasked parts will be overwritten by fields.
2954            // Write the fields.
2955            self.0.encode(encoder, offset + 0, depth)?;
2956            Ok(())
2957        }
2958    }
2959
2960    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2961        for DeviceGetDataProviderResponse
2962    {
2963        #[inline(always)]
2964        fn new_empty() -> Self {
2965            Self {
2966                provider: fidl::new_empty!(
2967                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DataProviderMarker>>,
2968                    fidl::encoding::DefaultFuchsiaResourceDialect
2969                ),
2970            }
2971        }
2972
2973        #[inline]
2974        unsafe fn decode(
2975            &mut self,
2976            decoder: &mut fidl::encoding::Decoder<
2977                '_,
2978                fidl::encoding::DefaultFuchsiaResourceDialect,
2979            >,
2980            offset: usize,
2981            _depth: fidl::encoding::Depth,
2982        ) -> fidl::Result<()> {
2983            decoder.debug_check_bounds::<Self>(offset);
2984            // Verify that padding bytes are zero.
2985            fidl::decode!(
2986                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DataProviderMarker>>,
2987                fidl::encoding::DefaultFuchsiaResourceDialect,
2988                &mut self.provider,
2989                decoder,
2990                offset + 0,
2991                _depth
2992            )?;
2993            Ok(())
2994        }
2995    }
2996}