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 DeviceControlHandle {
1348    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1349        self.inner.shutdown_with_epitaph(status.into())
1350    }
1351}
1352
1353impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1354    fn shutdown(&self) {
1355        self.inner.shutdown()
1356    }
1357
1358    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1359        self.inner.shutdown_with_epitaph(status)
1360    }
1361
1362    fn is_closed(&self) -> bool {
1363        self.inner.channel().is_closed()
1364    }
1365    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1366        self.inner.channel().on_closed()
1367    }
1368
1369    #[cfg(target_os = "fuchsia")]
1370    fn signal_peer(
1371        &self,
1372        clear_mask: zx::Signals,
1373        set_mask: zx::Signals,
1374    ) -> Result<(), zx_status::Status> {
1375        use fidl::Peered;
1376        self.inner.channel().signal_peer(clear_mask, set_mask)
1377    }
1378}
1379
1380impl DeviceControlHandle {}
1381
1382#[must_use = "FIDL methods require a response to be sent"]
1383#[derive(Debug)]
1384pub struct DeviceGetFanLevelResponder {
1385    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1386    tx_id: u32,
1387}
1388
1389/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1390/// if the responder is dropped without sending a response, so that the client
1391/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1392impl std::ops::Drop for DeviceGetFanLevelResponder {
1393    fn drop(&mut self) {
1394        self.control_handle.shutdown();
1395        // Safety: drops once, never accessed again
1396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1397    }
1398}
1399
1400impl fidl::endpoints::Responder for DeviceGetFanLevelResponder {
1401    type ControlHandle = DeviceControlHandle;
1402
1403    fn control_handle(&self) -> &DeviceControlHandle {
1404        &self.control_handle
1405    }
1406
1407    fn drop_without_shutdown(mut self) {
1408        // Safety: drops once, never accessed again due to mem::forget
1409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1410        // Prevent Drop from running (which would shut down the channel)
1411        std::mem::forget(self);
1412    }
1413}
1414
1415impl DeviceGetFanLevelResponder {
1416    /// Sends a response to the FIDL transaction.
1417    ///
1418    /// Sets the channel to shutdown if an error occurs.
1419    pub fn send(self, mut status: i32, mut fan_level: u32) -> Result<(), fidl::Error> {
1420        let _result = self.send_raw(status, fan_level);
1421        if _result.is_err() {
1422            self.control_handle.shutdown();
1423        }
1424        self.drop_without_shutdown();
1425        _result
1426    }
1427
1428    /// Similar to "send" but does not shutdown the channel if an error occurs.
1429    pub fn send_no_shutdown_on_err(
1430        self,
1431        mut status: i32,
1432        mut fan_level: u32,
1433    ) -> Result<(), fidl::Error> {
1434        let _result = self.send_raw(status, fan_level);
1435        self.drop_without_shutdown();
1436        _result
1437    }
1438
1439    fn send_raw(&self, mut status: i32, mut fan_level: u32) -> Result<(), fidl::Error> {
1440        self.control_handle.inner.send::<fidl_fuchsia_hardware_fan::FanGetFanLevelResponse>(
1441            (status, fan_level),
1442            self.tx_id,
1443            0x63439dc551ef6dea,
1444            fidl::encoding::DynamicFlags::empty(),
1445        )
1446    }
1447}
1448
1449#[must_use = "FIDL methods require a response to be sent"]
1450#[derive(Debug)]
1451pub struct DeviceSetFanLevelResponder {
1452    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1453    tx_id: u32,
1454}
1455
1456/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1457/// if the responder is dropped without sending a response, so that the client
1458/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1459impl std::ops::Drop for DeviceSetFanLevelResponder {
1460    fn drop(&mut self) {
1461        self.control_handle.shutdown();
1462        // Safety: drops once, never accessed again
1463        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1464    }
1465}
1466
1467impl fidl::endpoints::Responder for DeviceSetFanLevelResponder {
1468    type ControlHandle = DeviceControlHandle;
1469
1470    fn control_handle(&self) -> &DeviceControlHandle {
1471        &self.control_handle
1472    }
1473
1474    fn drop_without_shutdown(mut self) {
1475        // Safety: drops once, never accessed again due to mem::forget
1476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1477        // Prevent Drop from running (which would shut down the channel)
1478        std::mem::forget(self);
1479    }
1480}
1481
1482impl DeviceSetFanLevelResponder {
1483    /// Sends a response to the FIDL transaction.
1484    ///
1485    /// Sets the channel to shutdown if an error occurs.
1486    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1487        let _result = self.send_raw(status);
1488        if _result.is_err() {
1489            self.control_handle.shutdown();
1490        }
1491        self.drop_without_shutdown();
1492        _result
1493    }
1494
1495    /// Similar to "send" but does not shutdown the channel if an error occurs.
1496    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1497        let _result = self.send_raw(status);
1498        self.drop_without_shutdown();
1499        _result
1500    }
1501
1502    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1503        self.control_handle.inner.send::<fidl_fuchsia_hardware_fan::FanSetFanLevelResponse>(
1504            (status,),
1505            self.tx_id,
1506            0x6552ae76e9703ffb,
1507            fidl::encoding::DynamicFlags::empty(),
1508        )
1509    }
1510}
1511
1512#[must_use = "FIDL methods require a response to be sent"]
1513#[derive(Debug)]
1514pub struct DeviceGetTemperatureCelsiusResponder {
1515    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1516    tx_id: u32,
1517}
1518
1519/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1520/// if the responder is dropped without sending a response, so that the client
1521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1522impl std::ops::Drop for DeviceGetTemperatureCelsiusResponder {
1523    fn drop(&mut self) {
1524        self.control_handle.shutdown();
1525        // Safety: drops once, never accessed again
1526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1527    }
1528}
1529
1530impl fidl::endpoints::Responder for DeviceGetTemperatureCelsiusResponder {
1531    type ControlHandle = DeviceControlHandle;
1532
1533    fn control_handle(&self) -> &DeviceControlHandle {
1534        &self.control_handle
1535    }
1536
1537    fn drop_without_shutdown(mut self) {
1538        // Safety: drops once, never accessed again due to mem::forget
1539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1540        // Prevent Drop from running (which would shut down the channel)
1541        std::mem::forget(self);
1542    }
1543}
1544
1545impl DeviceGetTemperatureCelsiusResponder {
1546    /// Sends a response to the FIDL transaction.
1547    ///
1548    /// Sets the channel to shutdown if an error occurs.
1549    pub fn send(self, mut status: i32, mut temp: f32) -> Result<(), fidl::Error> {
1550        let _result = self.send_raw(status, temp);
1551        if _result.is_err() {
1552            self.control_handle.shutdown();
1553        }
1554        self.drop_without_shutdown();
1555        _result
1556    }
1557
1558    /// Similar to "send" but does not shutdown the channel if an error occurs.
1559    pub fn send_no_shutdown_on_err(
1560        self,
1561        mut status: i32,
1562        mut temp: f32,
1563    ) -> Result<(), fidl::Error> {
1564        let _result = self.send_raw(status, temp);
1565        self.drop_without_shutdown();
1566        _result
1567    }
1568
1569    fn send_raw(&self, mut status: i32, mut temp: f32) -> Result<(), fidl::Error> {
1570        self.control_handle
1571            .inner
1572            .send::<fidl_fuchsia_hardware_temperature::DeviceGetTemperatureCelsiusResponse>(
1573            (status, temp),
1574            self.tx_id,
1575            0x755e08b84736133c,
1576            fidl::encoding::DynamicFlags::empty(),
1577        )
1578    }
1579}
1580
1581#[must_use = "FIDL methods require a response to be sent"]
1582#[derive(Debug)]
1583pub struct DeviceGetSensorNameResponder {
1584    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1585    tx_id: u32,
1586}
1587
1588/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1589/// if the responder is dropped without sending a response, so that the client
1590/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1591impl std::ops::Drop for DeviceGetSensorNameResponder {
1592    fn drop(&mut self) {
1593        self.control_handle.shutdown();
1594        // Safety: drops once, never accessed again
1595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1596    }
1597}
1598
1599impl fidl::endpoints::Responder for DeviceGetSensorNameResponder {
1600    type ControlHandle = DeviceControlHandle;
1601
1602    fn control_handle(&self) -> &DeviceControlHandle {
1603        &self.control_handle
1604    }
1605
1606    fn drop_without_shutdown(mut self) {
1607        // Safety: drops once, never accessed again due to mem::forget
1608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1609        // Prevent Drop from running (which would shut down the channel)
1610        std::mem::forget(self);
1611    }
1612}
1613
1614impl DeviceGetSensorNameResponder {
1615    /// Sends a response to the FIDL transaction.
1616    ///
1617    /// Sets the channel to shutdown if an error occurs.
1618    pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
1619        let _result = self.send_raw(name);
1620        if _result.is_err() {
1621            self.control_handle.shutdown();
1622        }
1623        self.drop_without_shutdown();
1624        _result
1625    }
1626
1627    /// Similar to "send" but does not shutdown the channel if an error occurs.
1628    pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
1629        let _result = self.send_raw(name);
1630        self.drop_without_shutdown();
1631        _result
1632    }
1633
1634    fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
1635        self.control_handle
1636            .inner
1637            .send::<fidl_fuchsia_hardware_temperature::DeviceGetSensorNameResponse>(
1638                (name,),
1639                self.tx_id,
1640                0x4cbd7abaeafc02c1,
1641                fidl::encoding::DynamicFlags::empty(),
1642            )
1643    }
1644}
1645
1646#[must_use = "FIDL methods require a response to be sent"]
1647#[derive(Debug)]
1648pub struct DeviceGetInfoResponder {
1649    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1650    tx_id: u32,
1651}
1652
1653/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1654/// if the responder is dropped without sending a response, so that the client
1655/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1656impl std::ops::Drop for DeviceGetInfoResponder {
1657    fn drop(&mut self) {
1658        self.control_handle.shutdown();
1659        // Safety: drops once, never accessed again
1660        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1661    }
1662}
1663
1664impl fidl::endpoints::Responder for DeviceGetInfoResponder {
1665    type ControlHandle = DeviceControlHandle;
1666
1667    fn control_handle(&self) -> &DeviceControlHandle {
1668        &self.control_handle
1669    }
1670
1671    fn drop_without_shutdown(mut self) {
1672        // Safety: drops once, never accessed again due to mem::forget
1673        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1674        // Prevent Drop from running (which would shut down the channel)
1675        std::mem::forget(self);
1676    }
1677}
1678
1679impl DeviceGetInfoResponder {
1680    /// Sends a response to the FIDL transaction.
1681    ///
1682    /// Sets the channel to shutdown if an error occurs.
1683    pub fn send(self, mut status: i32, mut info: Option<&ThermalInfo>) -> Result<(), fidl::Error> {
1684        let _result = self.send_raw(status, info);
1685        if _result.is_err() {
1686            self.control_handle.shutdown();
1687        }
1688        self.drop_without_shutdown();
1689        _result
1690    }
1691
1692    /// Similar to "send" but does not shutdown the channel if an error occurs.
1693    pub fn send_no_shutdown_on_err(
1694        self,
1695        mut status: i32,
1696        mut info: Option<&ThermalInfo>,
1697    ) -> Result<(), fidl::Error> {
1698        let _result = self.send_raw(status, info);
1699        self.drop_without_shutdown();
1700        _result
1701    }
1702
1703    fn send_raw(&self, mut status: i32, mut info: Option<&ThermalInfo>) -> Result<(), fidl::Error> {
1704        self.control_handle.inner.send::<DeviceGetInfoResponse>(
1705            (status, info),
1706            self.tx_id,
1707            0x350d7a106835fbda,
1708            fidl::encoding::DynamicFlags::empty(),
1709        )
1710    }
1711}
1712
1713#[must_use = "FIDL methods require a response to be sent"]
1714#[derive(Debug)]
1715pub struct DeviceGetDeviceInfoResponder {
1716    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1717    tx_id: u32,
1718}
1719
1720/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1721/// if the responder is dropped without sending a response, so that the client
1722/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1723impl std::ops::Drop for DeviceGetDeviceInfoResponder {
1724    fn drop(&mut self) {
1725        self.control_handle.shutdown();
1726        // Safety: drops once, never accessed again
1727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1728    }
1729}
1730
1731impl fidl::endpoints::Responder for DeviceGetDeviceInfoResponder {
1732    type ControlHandle = DeviceControlHandle;
1733
1734    fn control_handle(&self) -> &DeviceControlHandle {
1735        &self.control_handle
1736    }
1737
1738    fn drop_without_shutdown(mut self) {
1739        // Safety: drops once, never accessed again due to mem::forget
1740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1741        // Prevent Drop from running (which would shut down the channel)
1742        std::mem::forget(self);
1743    }
1744}
1745
1746impl DeviceGetDeviceInfoResponder {
1747    /// Sends a response to the FIDL transaction.
1748    ///
1749    /// Sets the channel to shutdown if an error occurs.
1750    pub fn send(
1751        self,
1752        mut status: i32,
1753        mut info: Option<&ThermalDeviceInfo>,
1754    ) -> Result<(), fidl::Error> {
1755        let _result = self.send_raw(status, info);
1756        if _result.is_err() {
1757            self.control_handle.shutdown();
1758        }
1759        self.drop_without_shutdown();
1760        _result
1761    }
1762
1763    /// Similar to "send" but does not shutdown the channel if an error occurs.
1764    pub fn send_no_shutdown_on_err(
1765        self,
1766        mut status: i32,
1767        mut info: Option<&ThermalDeviceInfo>,
1768    ) -> Result<(), fidl::Error> {
1769        let _result = self.send_raw(status, info);
1770        self.drop_without_shutdown();
1771        _result
1772    }
1773
1774    fn send_raw(
1775        &self,
1776        mut status: i32,
1777        mut info: Option<&ThermalDeviceInfo>,
1778    ) -> Result<(), fidl::Error> {
1779        self.control_handle.inner.send::<DeviceGetDeviceInfoResponse>(
1780            (status, info),
1781            self.tx_id,
1782            0x5c35349ec9cd7c79,
1783            fidl::encoding::DynamicFlags::empty(),
1784        )
1785    }
1786}
1787
1788#[must_use = "FIDL methods require a response to be sent"]
1789#[derive(Debug)]
1790pub struct DeviceGetDvfsInfoResponder {
1791    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1792    tx_id: u32,
1793}
1794
1795/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1796/// if the responder is dropped without sending a response, so that the client
1797/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1798impl std::ops::Drop for DeviceGetDvfsInfoResponder {
1799    fn drop(&mut self) {
1800        self.control_handle.shutdown();
1801        // Safety: drops once, never accessed again
1802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1803    }
1804}
1805
1806impl fidl::endpoints::Responder for DeviceGetDvfsInfoResponder {
1807    type ControlHandle = DeviceControlHandle;
1808
1809    fn control_handle(&self) -> &DeviceControlHandle {
1810        &self.control_handle
1811    }
1812
1813    fn drop_without_shutdown(mut self) {
1814        // Safety: drops once, never accessed again due to mem::forget
1815        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1816        // Prevent Drop from running (which would shut down the channel)
1817        std::mem::forget(self);
1818    }
1819}
1820
1821impl DeviceGetDvfsInfoResponder {
1822    /// Sends a response to the FIDL transaction.
1823    ///
1824    /// Sets the channel to shutdown if an error occurs.
1825    pub fn send(
1826        self,
1827        mut status: i32,
1828        mut info: Option<&OperatingPoint>,
1829    ) -> Result<(), fidl::Error> {
1830        let _result = self.send_raw(status, info);
1831        if _result.is_err() {
1832            self.control_handle.shutdown();
1833        }
1834        self.drop_without_shutdown();
1835        _result
1836    }
1837
1838    /// Similar to "send" but does not shutdown the channel if an error occurs.
1839    pub fn send_no_shutdown_on_err(
1840        self,
1841        mut status: i32,
1842        mut info: Option<&OperatingPoint>,
1843    ) -> Result<(), fidl::Error> {
1844        let _result = self.send_raw(status, info);
1845        self.drop_without_shutdown();
1846        _result
1847    }
1848
1849    fn send_raw(
1850        &self,
1851        mut status: i32,
1852        mut info: Option<&OperatingPoint>,
1853    ) -> Result<(), fidl::Error> {
1854        self.control_handle.inner.send::<DeviceGetDvfsInfoResponse>(
1855            (status, info),
1856            self.tx_id,
1857            0xb2e9de2423e77eb,
1858            fidl::encoding::DynamicFlags::empty(),
1859        )
1860    }
1861}
1862
1863#[must_use = "FIDL methods require a response to be sent"]
1864#[derive(Debug)]
1865pub struct DeviceGetStateChangeEventResponder {
1866    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1867    tx_id: u32,
1868}
1869
1870/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1871/// if the responder is dropped without sending a response, so that the client
1872/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1873impl std::ops::Drop for DeviceGetStateChangeEventResponder {
1874    fn drop(&mut self) {
1875        self.control_handle.shutdown();
1876        // Safety: drops once, never accessed again
1877        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1878    }
1879}
1880
1881impl fidl::endpoints::Responder for DeviceGetStateChangeEventResponder {
1882    type ControlHandle = DeviceControlHandle;
1883
1884    fn control_handle(&self) -> &DeviceControlHandle {
1885        &self.control_handle
1886    }
1887
1888    fn drop_without_shutdown(mut self) {
1889        // Safety: drops once, never accessed again due to mem::forget
1890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1891        // Prevent Drop from running (which would shut down the channel)
1892        std::mem::forget(self);
1893    }
1894}
1895
1896impl DeviceGetStateChangeEventResponder {
1897    /// Sends a response to the FIDL transaction.
1898    ///
1899    /// Sets the channel to shutdown if an error occurs.
1900    pub fn send(self, mut status: i32, mut handle: Option<fidl::Event>) -> Result<(), fidl::Error> {
1901        let _result = self.send_raw(status, handle);
1902        if _result.is_err() {
1903            self.control_handle.shutdown();
1904        }
1905        self.drop_without_shutdown();
1906        _result
1907    }
1908
1909    /// Similar to "send" but does not shutdown the channel if an error occurs.
1910    pub fn send_no_shutdown_on_err(
1911        self,
1912        mut status: i32,
1913        mut handle: Option<fidl::Event>,
1914    ) -> Result<(), fidl::Error> {
1915        let _result = self.send_raw(status, handle);
1916        self.drop_without_shutdown();
1917        _result
1918    }
1919
1920    fn send_raw(
1921        &self,
1922        mut status: i32,
1923        mut handle: Option<fidl::Event>,
1924    ) -> Result<(), fidl::Error> {
1925        self.control_handle.inner.send::<DeviceGetStateChangeEventResponse>(
1926            (status, handle),
1927            self.tx_id,
1928            0x3f6e614172af0a87,
1929            fidl::encoding::DynamicFlags::empty(),
1930        )
1931    }
1932}
1933
1934#[must_use = "FIDL methods require a response to be sent"]
1935#[derive(Debug)]
1936pub struct DeviceGetStateChangePortResponder {
1937    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1938    tx_id: u32,
1939}
1940
1941/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1942/// if the responder is dropped without sending a response, so that the client
1943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1944impl std::ops::Drop for DeviceGetStateChangePortResponder {
1945    fn drop(&mut self) {
1946        self.control_handle.shutdown();
1947        // Safety: drops once, never accessed again
1948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1949    }
1950}
1951
1952impl fidl::endpoints::Responder for DeviceGetStateChangePortResponder {
1953    type ControlHandle = DeviceControlHandle;
1954
1955    fn control_handle(&self) -> &DeviceControlHandle {
1956        &self.control_handle
1957    }
1958
1959    fn drop_without_shutdown(mut self) {
1960        // Safety: drops once, never accessed again due to mem::forget
1961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1962        // Prevent Drop from running (which would shut down the channel)
1963        std::mem::forget(self);
1964    }
1965}
1966
1967impl DeviceGetStateChangePortResponder {
1968    /// Sends a response to the FIDL transaction.
1969    ///
1970    /// Sets the channel to shutdown if an error occurs.
1971    pub fn send(self, mut status: i32, mut handle: Option<fidl::Port>) -> Result<(), fidl::Error> {
1972        let _result = self.send_raw(status, handle);
1973        if _result.is_err() {
1974            self.control_handle.shutdown();
1975        }
1976        self.drop_without_shutdown();
1977        _result
1978    }
1979
1980    /// Similar to "send" but does not shutdown the channel if an error occurs.
1981    pub fn send_no_shutdown_on_err(
1982        self,
1983        mut status: i32,
1984        mut handle: Option<fidl::Port>,
1985    ) -> Result<(), fidl::Error> {
1986        let _result = self.send_raw(status, handle);
1987        self.drop_without_shutdown();
1988        _result
1989    }
1990
1991    fn send_raw(&self, mut status: i32, mut handle: Option<fidl::Port>) -> Result<(), fidl::Error> {
1992        self.control_handle.inner.send::<DeviceGetStateChangePortResponse>(
1993            (status, handle),
1994            self.tx_id,
1995            0x7eef3857e900208,
1996            fidl::encoding::DynamicFlags::empty(),
1997        )
1998    }
1999}
2000
2001#[must_use = "FIDL methods require a response to be sent"]
2002#[derive(Debug)]
2003pub struct DeviceSetTripCelsiusResponder {
2004    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2005    tx_id: u32,
2006}
2007
2008/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2009/// if the responder is dropped without sending a response, so that the client
2010/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2011impl std::ops::Drop for DeviceSetTripCelsiusResponder {
2012    fn drop(&mut self) {
2013        self.control_handle.shutdown();
2014        // Safety: drops once, never accessed again
2015        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2016    }
2017}
2018
2019impl fidl::endpoints::Responder for DeviceSetTripCelsiusResponder {
2020    type ControlHandle = DeviceControlHandle;
2021
2022    fn control_handle(&self) -> &DeviceControlHandle {
2023        &self.control_handle
2024    }
2025
2026    fn drop_without_shutdown(mut self) {
2027        // Safety: drops once, never accessed again due to mem::forget
2028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2029        // Prevent Drop from running (which would shut down the channel)
2030        std::mem::forget(self);
2031    }
2032}
2033
2034impl DeviceSetTripCelsiusResponder {
2035    /// Sends a response to the FIDL transaction.
2036    ///
2037    /// Sets the channel to shutdown if an error occurs.
2038    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2039        let _result = self.send_raw(status);
2040        if _result.is_err() {
2041            self.control_handle.shutdown();
2042        }
2043        self.drop_without_shutdown();
2044        _result
2045    }
2046
2047    /// Similar to "send" but does not shutdown the channel if an error occurs.
2048    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2049        let _result = self.send_raw(status);
2050        self.drop_without_shutdown();
2051        _result
2052    }
2053
2054    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2055        self.control_handle.inner.send::<DeviceSetTripCelsiusResponse>(
2056            (status,),
2057            self.tx_id,
2058            0x25e3eafaa78a203e,
2059            fidl::encoding::DynamicFlags::empty(),
2060        )
2061    }
2062}
2063
2064#[must_use = "FIDL methods require a response to be sent"]
2065#[derive(Debug)]
2066pub struct DeviceGetDvfsOperatingPointResponder {
2067    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2068    tx_id: u32,
2069}
2070
2071/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2072/// if the responder is dropped without sending a response, so that the client
2073/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2074impl std::ops::Drop for DeviceGetDvfsOperatingPointResponder {
2075    fn drop(&mut self) {
2076        self.control_handle.shutdown();
2077        // Safety: drops once, never accessed again
2078        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2079    }
2080}
2081
2082impl fidl::endpoints::Responder for DeviceGetDvfsOperatingPointResponder {
2083    type ControlHandle = DeviceControlHandle;
2084
2085    fn control_handle(&self) -> &DeviceControlHandle {
2086        &self.control_handle
2087    }
2088
2089    fn drop_without_shutdown(mut self) {
2090        // Safety: drops once, never accessed again due to mem::forget
2091        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2092        // Prevent Drop from running (which would shut down the channel)
2093        std::mem::forget(self);
2094    }
2095}
2096
2097impl DeviceGetDvfsOperatingPointResponder {
2098    /// Sends a response to the FIDL transaction.
2099    ///
2100    /// Sets the channel to shutdown if an error occurs.
2101    pub fn send(self, mut status: i32, mut op_idx: u16) -> Result<(), fidl::Error> {
2102        let _result = self.send_raw(status, op_idx);
2103        if _result.is_err() {
2104            self.control_handle.shutdown();
2105        }
2106        self.drop_without_shutdown();
2107        _result
2108    }
2109
2110    /// Similar to "send" but does not shutdown the channel if an error occurs.
2111    pub fn send_no_shutdown_on_err(
2112        self,
2113        mut status: i32,
2114        mut op_idx: u16,
2115    ) -> Result<(), fidl::Error> {
2116        let _result = self.send_raw(status, op_idx);
2117        self.drop_without_shutdown();
2118        _result
2119    }
2120
2121    fn send_raw(&self, mut status: i32, mut op_idx: u16) -> Result<(), fidl::Error> {
2122        self.control_handle.inner.send::<DeviceGetDvfsOperatingPointResponse>(
2123            (status, op_idx),
2124            self.tx_id,
2125            0x56d566ab5a9ba330,
2126            fidl::encoding::DynamicFlags::empty(),
2127        )
2128    }
2129}
2130
2131#[must_use = "FIDL methods require a response to be sent"]
2132#[derive(Debug)]
2133pub struct DeviceSetDvfsOperatingPointResponder {
2134    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2135    tx_id: u32,
2136}
2137
2138/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2139/// if the responder is dropped without sending a response, so that the client
2140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2141impl std::ops::Drop for DeviceSetDvfsOperatingPointResponder {
2142    fn drop(&mut self) {
2143        self.control_handle.shutdown();
2144        // Safety: drops once, never accessed again
2145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2146    }
2147}
2148
2149impl fidl::endpoints::Responder for DeviceSetDvfsOperatingPointResponder {
2150    type ControlHandle = DeviceControlHandle;
2151
2152    fn control_handle(&self) -> &DeviceControlHandle {
2153        &self.control_handle
2154    }
2155
2156    fn drop_without_shutdown(mut self) {
2157        // Safety: drops once, never accessed again due to mem::forget
2158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2159        // Prevent Drop from running (which would shut down the channel)
2160        std::mem::forget(self);
2161    }
2162}
2163
2164impl DeviceSetDvfsOperatingPointResponder {
2165    /// Sends a response to the FIDL transaction.
2166    ///
2167    /// Sets the channel to shutdown if an error occurs.
2168    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2169        let _result = self.send_raw(status);
2170        if _result.is_err() {
2171            self.control_handle.shutdown();
2172        }
2173        self.drop_without_shutdown();
2174        _result
2175    }
2176
2177    /// Similar to "send" but does not shutdown the channel if an error occurs.
2178    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2179        let _result = self.send_raw(status);
2180        self.drop_without_shutdown();
2181        _result
2182    }
2183
2184    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2185        self.control_handle.inner.send::<DeviceSetDvfsOperatingPointResponse>(
2186            (status,),
2187            self.tx_id,
2188            0x9c2508074fe4351,
2189            fidl::encoding::DynamicFlags::empty(),
2190        )
2191    }
2192}
2193
2194#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2195pub struct ServiceMarker;
2196
2197#[cfg(target_os = "fuchsia")]
2198impl fidl::endpoints::ServiceMarker for ServiceMarker {
2199    type Proxy = ServiceProxy;
2200    type Request = ServiceRequest;
2201    const SERVICE_NAME: &'static str = "fuchsia.hardware.thermal.Service";
2202}
2203
2204/// A request for one of the member protocols of Service.
2205///
2206#[cfg(target_os = "fuchsia")]
2207pub enum ServiceRequest {
2208    Device(DeviceRequestStream),
2209}
2210
2211#[cfg(target_os = "fuchsia")]
2212impl fidl::endpoints::ServiceRequest for ServiceRequest {
2213    type Service = ServiceMarker;
2214
2215    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2216        match name {
2217            "device" => Self::Device(
2218                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2219            ),
2220            _ => panic!("no such member protocol name for service Service"),
2221        }
2222    }
2223
2224    fn member_names() -> &'static [&'static str] {
2225        &["device"]
2226    }
2227}
2228#[cfg(target_os = "fuchsia")]
2229pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2230
2231#[cfg(target_os = "fuchsia")]
2232impl fidl::endpoints::ServiceProxy for ServiceProxy {
2233    type Service = ServiceMarker;
2234
2235    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2236        Self(opener)
2237    }
2238}
2239
2240#[cfg(target_os = "fuchsia")]
2241impl ServiceProxy {
2242    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2243        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2244        self.connect_channel_to_device(server_end)?;
2245        Ok(proxy)
2246    }
2247
2248    /// Like `connect_to_device`, but returns a sync proxy.
2249    /// See [`Self::connect_to_device`] for more details.
2250    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2251        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2252        self.connect_channel_to_device(server_end)?;
2253        Ok(proxy)
2254    }
2255
2256    /// Like `connect_to_device`, but accepts a server end.
2257    /// See [`Self::connect_to_device`] for more details.
2258    pub fn connect_channel_to_device(
2259        &self,
2260        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2261    ) -> Result<(), fidl::Error> {
2262        self.0.open_member("device", server_end.into_channel())
2263    }
2264
2265    pub fn instance_name(&self) -> &str {
2266        self.0.instance_name()
2267    }
2268}
2269
2270mod internal {
2271    use super::*;
2272
2273    impl fidl::encoding::ResourceTypeMarker for DeviceGetStateChangeEventResponse {
2274        type Borrowed<'a> = &'a mut Self;
2275        fn take_or_borrow<'a>(
2276            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2277        ) -> Self::Borrowed<'a> {
2278            value
2279        }
2280    }
2281
2282    unsafe impl fidl::encoding::TypeMarker for DeviceGetStateChangeEventResponse {
2283        type Owned = Self;
2284
2285        #[inline(always)]
2286        fn inline_align(_context: fidl::encoding::Context) -> usize {
2287            4
2288        }
2289
2290        #[inline(always)]
2291        fn inline_size(_context: fidl::encoding::Context) -> usize {
2292            8
2293        }
2294    }
2295
2296    unsafe impl
2297        fidl::encoding::Encode<
2298            DeviceGetStateChangeEventResponse,
2299            fidl::encoding::DefaultFuchsiaResourceDialect,
2300        > for &mut DeviceGetStateChangeEventResponse
2301    {
2302        #[inline]
2303        unsafe fn encode(
2304            self,
2305            encoder: &mut fidl::encoding::Encoder<
2306                '_,
2307                fidl::encoding::DefaultFuchsiaResourceDialect,
2308            >,
2309            offset: usize,
2310            _depth: fidl::encoding::Depth,
2311        ) -> fidl::Result<()> {
2312            encoder.debug_check_bounds::<DeviceGetStateChangeEventResponse>(offset);
2313            // Delegate to tuple encoding.
2314            fidl::encoding::Encode::<
2315                DeviceGetStateChangeEventResponse,
2316                fidl::encoding::DefaultFuchsiaResourceDialect,
2317            >::encode(
2318                (
2319                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2320                    <fidl::encoding::Optional<
2321                        fidl::encoding::HandleType<
2322                            fidl::Event,
2323                            { fidl::ObjectType::EVENT.into_raw() },
2324                            2147483648,
2325                        >,
2326                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2327                        &mut self.handle
2328                    ),
2329                ),
2330                encoder,
2331                offset,
2332                _depth,
2333            )
2334        }
2335    }
2336    unsafe impl<
2337        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2338        T1: fidl::encoding::Encode<
2339                fidl::encoding::Optional<
2340                    fidl::encoding::HandleType<
2341                        fidl::Event,
2342                        { fidl::ObjectType::EVENT.into_raw() },
2343                        2147483648,
2344                    >,
2345                >,
2346                fidl::encoding::DefaultFuchsiaResourceDialect,
2347            >,
2348    >
2349        fidl::encoding::Encode<
2350            DeviceGetStateChangeEventResponse,
2351            fidl::encoding::DefaultFuchsiaResourceDialect,
2352        > for (T0, T1)
2353    {
2354        #[inline]
2355        unsafe fn encode(
2356            self,
2357            encoder: &mut fidl::encoding::Encoder<
2358                '_,
2359                fidl::encoding::DefaultFuchsiaResourceDialect,
2360            >,
2361            offset: usize,
2362            depth: fidl::encoding::Depth,
2363        ) -> fidl::Result<()> {
2364            encoder.debug_check_bounds::<DeviceGetStateChangeEventResponse>(offset);
2365            // Zero out padding regions. There's no need to apply masks
2366            // because the unmasked parts will be overwritten by fields.
2367            // Write the fields.
2368            self.0.encode(encoder, offset + 0, depth)?;
2369            self.1.encode(encoder, offset + 4, depth)?;
2370            Ok(())
2371        }
2372    }
2373
2374    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2375        for DeviceGetStateChangeEventResponse
2376    {
2377        #[inline(always)]
2378        fn new_empty() -> Self {
2379            Self {
2380                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2381                handle: fidl::new_empty!(
2382                    fidl::encoding::Optional<
2383                        fidl::encoding::HandleType<
2384                            fidl::Event,
2385                            { fidl::ObjectType::EVENT.into_raw() },
2386                            2147483648,
2387                        >,
2388                    >,
2389                    fidl::encoding::DefaultFuchsiaResourceDialect
2390                ),
2391            }
2392        }
2393
2394        #[inline]
2395        unsafe fn decode(
2396            &mut self,
2397            decoder: &mut fidl::encoding::Decoder<
2398                '_,
2399                fidl::encoding::DefaultFuchsiaResourceDialect,
2400            >,
2401            offset: usize,
2402            _depth: fidl::encoding::Depth,
2403        ) -> fidl::Result<()> {
2404            decoder.debug_check_bounds::<Self>(offset);
2405            // Verify that padding bytes are zero.
2406            fidl::decode!(
2407                i32,
2408                fidl::encoding::DefaultFuchsiaResourceDialect,
2409                &mut self.status,
2410                decoder,
2411                offset + 0,
2412                _depth
2413            )?;
2414            fidl::decode!(
2415                fidl::encoding::Optional<
2416                    fidl::encoding::HandleType<
2417                        fidl::Event,
2418                        { fidl::ObjectType::EVENT.into_raw() },
2419                        2147483648,
2420                    >,
2421                >,
2422                fidl::encoding::DefaultFuchsiaResourceDialect,
2423                &mut self.handle,
2424                decoder,
2425                offset + 4,
2426                _depth
2427            )?;
2428            Ok(())
2429        }
2430    }
2431
2432    impl fidl::encoding::ResourceTypeMarker for DeviceGetStateChangePortResponse {
2433        type Borrowed<'a> = &'a mut Self;
2434        fn take_or_borrow<'a>(
2435            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2436        ) -> Self::Borrowed<'a> {
2437            value
2438        }
2439    }
2440
2441    unsafe impl fidl::encoding::TypeMarker for DeviceGetStateChangePortResponse {
2442        type Owned = Self;
2443
2444        #[inline(always)]
2445        fn inline_align(_context: fidl::encoding::Context) -> usize {
2446            4
2447        }
2448
2449        #[inline(always)]
2450        fn inline_size(_context: fidl::encoding::Context) -> usize {
2451            8
2452        }
2453    }
2454
2455    unsafe impl
2456        fidl::encoding::Encode<
2457            DeviceGetStateChangePortResponse,
2458            fidl::encoding::DefaultFuchsiaResourceDialect,
2459        > for &mut DeviceGetStateChangePortResponse
2460    {
2461        #[inline]
2462        unsafe fn encode(
2463            self,
2464            encoder: &mut fidl::encoding::Encoder<
2465                '_,
2466                fidl::encoding::DefaultFuchsiaResourceDialect,
2467            >,
2468            offset: usize,
2469            _depth: fidl::encoding::Depth,
2470        ) -> fidl::Result<()> {
2471            encoder.debug_check_bounds::<DeviceGetStateChangePortResponse>(offset);
2472            // Delegate to tuple encoding.
2473            fidl::encoding::Encode::<
2474                DeviceGetStateChangePortResponse,
2475                fidl::encoding::DefaultFuchsiaResourceDialect,
2476            >::encode(
2477                (
2478                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2479                    <fidl::encoding::Optional<
2480                        fidl::encoding::HandleType<
2481                            fidl::Port,
2482                            { fidl::ObjectType::PORT.into_raw() },
2483                            2147483648,
2484                        >,
2485                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2486                        &mut self.handle
2487                    ),
2488                ),
2489                encoder,
2490                offset,
2491                _depth,
2492            )
2493        }
2494    }
2495    unsafe impl<
2496        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2497        T1: fidl::encoding::Encode<
2498                fidl::encoding::Optional<
2499                    fidl::encoding::HandleType<
2500                        fidl::Port,
2501                        { fidl::ObjectType::PORT.into_raw() },
2502                        2147483648,
2503                    >,
2504                >,
2505                fidl::encoding::DefaultFuchsiaResourceDialect,
2506            >,
2507    >
2508        fidl::encoding::Encode<
2509            DeviceGetStateChangePortResponse,
2510            fidl::encoding::DefaultFuchsiaResourceDialect,
2511        > for (T0, T1)
2512    {
2513        #[inline]
2514        unsafe fn encode(
2515            self,
2516            encoder: &mut fidl::encoding::Encoder<
2517                '_,
2518                fidl::encoding::DefaultFuchsiaResourceDialect,
2519            >,
2520            offset: usize,
2521            depth: fidl::encoding::Depth,
2522        ) -> fidl::Result<()> {
2523            encoder.debug_check_bounds::<DeviceGetStateChangePortResponse>(offset);
2524            // Zero out padding regions. There's no need to apply masks
2525            // because the unmasked parts will be overwritten by fields.
2526            // Write the fields.
2527            self.0.encode(encoder, offset + 0, depth)?;
2528            self.1.encode(encoder, offset + 4, depth)?;
2529            Ok(())
2530        }
2531    }
2532
2533    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2534        for DeviceGetStateChangePortResponse
2535    {
2536        #[inline(always)]
2537        fn new_empty() -> Self {
2538            Self {
2539                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2540                handle: fidl::new_empty!(
2541                    fidl::encoding::Optional<
2542                        fidl::encoding::HandleType<
2543                            fidl::Port,
2544                            { fidl::ObjectType::PORT.into_raw() },
2545                            2147483648,
2546                        >,
2547                    >,
2548                    fidl::encoding::DefaultFuchsiaResourceDialect
2549                ),
2550            }
2551        }
2552
2553        #[inline]
2554        unsafe fn decode(
2555            &mut self,
2556            decoder: &mut fidl::encoding::Decoder<
2557                '_,
2558                fidl::encoding::DefaultFuchsiaResourceDialect,
2559            >,
2560            offset: usize,
2561            _depth: fidl::encoding::Depth,
2562        ) -> fidl::Result<()> {
2563            decoder.debug_check_bounds::<Self>(offset);
2564            // Verify that padding bytes are zero.
2565            fidl::decode!(
2566                i32,
2567                fidl::encoding::DefaultFuchsiaResourceDialect,
2568                &mut self.status,
2569                decoder,
2570                offset + 0,
2571                _depth
2572            )?;
2573            fidl::decode!(
2574                fidl::encoding::Optional<
2575                    fidl::encoding::HandleType<
2576                        fidl::Port,
2577                        { fidl::ObjectType::PORT.into_raw() },
2578                        2147483648,
2579                    >,
2580                >,
2581                fidl::encoding::DefaultFuchsiaResourceDialect,
2582                &mut self.handle,
2583                decoder,
2584                offset + 4,
2585                _depth
2586            )?;
2587            Ok(())
2588        }
2589    }
2590}