Skip to main content

fidl_test_hardwarepowercontrol_common/
fidl_test_hardwarepowercontrol_common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const DEFAULT_CHARGING_CURRENT_UA: i32 = 250014;
12
13pub const DEFAULT_FULL_CAPACITY_UAH: u32 = 420000;
14
15pub const DEFAULT_LEVEL_PERCENT: f32 = 98.7;
16
17pub const DEFAULT_PRESENT_VOLTAGE_MV: u32 = 4752;
18
19pub const DEFAULT_REMAINING_CHARGE_UAH: u32 = 382000;
20
21pub const DEFAULT_ROUNDED_LEVEL_PERCENT: f32 = 99.0;
22
23pub const DEFAULT_TEMPERATURE_MC: i32 = 380;
24
25#[derive(Clone, Debug, PartialEq)]
26pub struct ControlSetBatteryStatusRequest {
27    pub status: fidl_fuchsia_hardware_power_battery_common::Status,
28}
29
30impl fidl::Persistable for ControlSetBatteryStatusRequest {}
31
32#[derive(Clone, Debug, PartialEq)]
33pub struct ControlSetSourceStatusRequest {
34    pub status: fidl_fuchsia_hardware_power_source_common::Status,
35}
36
37impl fidl::Persistable for ControlSetSourceStatusRequest {}
38
39pub mod control_ordinals {
40    pub const SET_BATTERY_STATUS: u64 = 0x4c2c27ba4c60ea21;
41    pub const SET_SOURCE_STATUS: u64 = 0x3d3137802b73710f;
42}
43
44mod internal {
45    use super::*;
46
47    impl fidl::encoding::ValueTypeMarker for ControlSetBatteryStatusRequest {
48        type Borrowed<'a> = &'a Self;
49        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
50            value
51        }
52    }
53
54    unsafe impl fidl::encoding::TypeMarker for ControlSetBatteryStatusRequest {
55        type Owned = Self;
56
57        #[inline(always)]
58        fn inline_align(_context: fidl::encoding::Context) -> usize {
59            8
60        }
61
62        #[inline(always)]
63        fn inline_size(_context: fidl::encoding::Context) -> usize {
64            16
65        }
66    }
67
68    unsafe impl<D: fidl::encoding::ResourceDialect>
69        fidl::encoding::Encode<ControlSetBatteryStatusRequest, D>
70        for &ControlSetBatteryStatusRequest
71    {
72        #[inline]
73        unsafe fn encode(
74            self,
75            encoder: &mut fidl::encoding::Encoder<'_, D>,
76            offset: usize,
77            _depth: fidl::encoding::Depth,
78        ) -> fidl::Result<()> {
79            encoder.debug_check_bounds::<ControlSetBatteryStatusRequest>(offset);
80            // Delegate to tuple encoding.
81            fidl::encoding::Encode::<ControlSetBatteryStatusRequest, D>::encode(
82                (
83                    <fidl_fuchsia_hardware_power_battery_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
84                ),
85                encoder, offset, _depth
86            )
87        }
88    }
89    unsafe impl<
90        D: fidl::encoding::ResourceDialect,
91        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_power_battery_common::Status, D>,
92    > fidl::encoding::Encode<ControlSetBatteryStatusRequest, D> for (T0,)
93    {
94        #[inline]
95        unsafe fn encode(
96            self,
97            encoder: &mut fidl::encoding::Encoder<'_, D>,
98            offset: usize,
99            depth: fidl::encoding::Depth,
100        ) -> fidl::Result<()> {
101            encoder.debug_check_bounds::<ControlSetBatteryStatusRequest>(offset);
102            // Zero out padding regions. There's no need to apply masks
103            // because the unmasked parts will be overwritten by fields.
104            // Write the fields.
105            self.0.encode(encoder, offset + 0, depth)?;
106            Ok(())
107        }
108    }
109
110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
111        for ControlSetBatteryStatusRequest
112    {
113        #[inline(always)]
114        fn new_empty() -> Self {
115            Self { status: fidl::new_empty!(fidl_fuchsia_hardware_power_battery_common::Status, D) }
116        }
117
118        #[inline]
119        unsafe fn decode(
120            &mut self,
121            decoder: &mut fidl::encoding::Decoder<'_, D>,
122            offset: usize,
123            _depth: fidl::encoding::Depth,
124        ) -> fidl::Result<()> {
125            decoder.debug_check_bounds::<Self>(offset);
126            // Verify that padding bytes are zero.
127            fidl::decode!(
128                fidl_fuchsia_hardware_power_battery_common::Status,
129                D,
130                &mut self.status,
131                decoder,
132                offset + 0,
133                _depth
134            )?;
135            Ok(())
136        }
137    }
138
139    impl fidl::encoding::ValueTypeMarker for ControlSetSourceStatusRequest {
140        type Borrowed<'a> = &'a Self;
141        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
142            value
143        }
144    }
145
146    unsafe impl fidl::encoding::TypeMarker for ControlSetSourceStatusRequest {
147        type Owned = Self;
148
149        #[inline(always)]
150        fn inline_align(_context: fidl::encoding::Context) -> usize {
151            8
152        }
153
154        #[inline(always)]
155        fn inline_size(_context: fidl::encoding::Context) -> usize {
156            16
157        }
158    }
159
160    unsafe impl<D: fidl::encoding::ResourceDialect>
161        fidl::encoding::Encode<ControlSetSourceStatusRequest, D>
162        for &ControlSetSourceStatusRequest
163    {
164        #[inline]
165        unsafe fn encode(
166            self,
167            encoder: &mut fidl::encoding::Encoder<'_, D>,
168            offset: usize,
169            _depth: fidl::encoding::Depth,
170        ) -> fidl::Result<()> {
171            encoder.debug_check_bounds::<ControlSetSourceStatusRequest>(offset);
172            // Delegate to tuple encoding.
173            fidl::encoding::Encode::<ControlSetSourceStatusRequest, D>::encode(
174                (
175                    <fidl_fuchsia_hardware_power_source_common::Status as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
176                ),
177                encoder, offset, _depth
178            )
179        }
180    }
181    unsafe impl<
182        D: fidl::encoding::ResourceDialect,
183        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_power_source_common::Status, D>,
184    > fidl::encoding::Encode<ControlSetSourceStatusRequest, D> for (T0,)
185    {
186        #[inline]
187        unsafe fn encode(
188            self,
189            encoder: &mut fidl::encoding::Encoder<'_, D>,
190            offset: usize,
191            depth: fidl::encoding::Depth,
192        ) -> fidl::Result<()> {
193            encoder.debug_check_bounds::<ControlSetSourceStatusRequest>(offset);
194            // Zero out padding regions. There's no need to apply masks
195            // because the unmasked parts will be overwritten by fields.
196            // Write the fields.
197            self.0.encode(encoder, offset + 0, depth)?;
198            Ok(())
199        }
200    }
201
202    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
203        for ControlSetSourceStatusRequest
204    {
205        #[inline(always)]
206        fn new_empty() -> Self {
207            Self { status: fidl::new_empty!(fidl_fuchsia_hardware_power_source_common::Status, D) }
208        }
209
210        #[inline]
211        unsafe fn decode(
212            &mut self,
213            decoder: &mut fidl::encoding::Decoder<'_, D>,
214            offset: usize,
215            _depth: fidl::encoding::Depth,
216        ) -> fidl::Result<()> {
217            decoder.debug_check_bounds::<Self>(offset);
218            // Verify that padding bytes are zero.
219            fidl::decode!(
220                fidl_fuchsia_hardware_power_source_common::Status,
221                D,
222                &mut self.status,
223                decoder,
224                offset + 0,
225                _depth
226            )?;
227            Ok(())
228        }
229    }
230}