Skip to main content

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