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