Skip to main content

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