fidl_fuchsia_power_battery_test/
fidl_fuchsia_power_battery_test.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, PartialEq)]
14pub struct BatterySimulatorControllerGetBatteryInfoResponse {
15    pub info: fidl_fuchsia_power_battery::BatteryInfo,
16}
17
18impl fidl::Persistable for BatterySimulatorControllerGetBatteryInfoResponse {}
19
20#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
21pub struct BatterySimulatorControllerIsSimulatingResponse {
22    pub simulation_state: bool,
23}
24
25impl fidl::Persistable for BatterySimulatorControllerIsSimulatingResponse {}
26
27#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
28pub struct BatterySimulatorControllerSetBatteryPercentageRequest {
29    pub percent: f32,
30}
31
32impl fidl::Persistable for BatterySimulatorControllerSetBatteryPercentageRequest {}
33
34#[derive(Clone, Debug, PartialEq)]
35pub struct BatterySimulatorControllerSetBatterySpecRequest {
36    pub spec: fidl_fuchsia_power_battery::BatterySpec,
37}
38
39impl fidl::Persistable for BatterySimulatorControllerSetBatterySpecRequest {}
40
41#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
42pub struct BatterySimulatorControllerSetBatteryStatusRequest {
43    pub battery_status: fidl_fuchsia_power_battery::BatteryStatus,
44}
45
46impl fidl::Persistable for BatterySimulatorControllerSetBatteryStatusRequest {}
47
48#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49pub struct BatterySimulatorControllerSetChargeSourceRequest {
50    pub charge_source: fidl_fuchsia_power_battery::ChargeSource,
51}
52
53impl fidl::Persistable for BatterySimulatorControllerSetChargeSourceRequest {}
54
55#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct BatterySimulatorControllerSetChargeStatusRequest {
57    pub charge_status: fidl_fuchsia_power_battery::ChargeStatus,
58}
59
60impl fidl::Persistable for BatterySimulatorControllerSetChargeStatusRequest {}
61
62#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63pub struct BatterySimulatorControllerSetLevelStatusRequest {
64    pub level_status: fidl_fuchsia_power_battery::LevelStatus,
65}
66
67impl fidl::Persistable for BatterySimulatorControllerSetLevelStatusRequest {}
68
69#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70#[repr(C)]
71pub struct BatterySimulatorControllerSetPresentVoltageMvRequest {
72    pub voltage: u32,
73}
74
75impl fidl::Persistable for BatterySimulatorControllerSetPresentVoltageMvRequest {}
76
77#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78#[repr(C)]
79pub struct BatterySimulatorControllerSetRemainingCapacityUahRequest {
80    pub capacity: u32,
81}
82
83impl fidl::Persistable for BatterySimulatorControllerSetRemainingCapacityUahRequest {}
84
85#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
86#[repr(C)]
87pub struct BatterySimulatorControllerSetTimeRemainingRequest {
88    pub duration: i64,
89}
90
91impl fidl::Persistable for BatterySimulatorControllerSetTimeRemainingRequest {}
92
93#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
94pub struct BatterySimulatorMarker;
95
96impl fidl::endpoints::ProtocolMarker for BatterySimulatorMarker {
97    type Proxy = BatterySimulatorProxy;
98    type RequestStream = BatterySimulatorRequestStream;
99    #[cfg(target_os = "fuchsia")]
100    type SynchronousProxy = BatterySimulatorSynchronousProxy;
101
102    const DEBUG_NAME: &'static str = "fuchsia.power.battery.test.BatterySimulator";
103}
104impl fidl::endpoints::DiscoverableProtocolMarker for BatterySimulatorMarker {}
105
106pub trait BatterySimulatorProxyInterface: Send + Sync {
107    type GetBatteryInfoResponseFut: std::future::Future<Output = Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error>>
108        + Send;
109    fn r#get_battery_info(&self) -> Self::GetBatteryInfoResponseFut;
110    fn r#set_battery_status(
111        &self,
112        battery_status: fidl_fuchsia_power_battery::BatteryStatus,
113    ) -> Result<(), fidl::Error>;
114    fn r#set_charge_status(
115        &self,
116        charge_status: fidl_fuchsia_power_battery::ChargeStatus,
117    ) -> Result<(), fidl::Error>;
118    fn r#set_charge_source(
119        &self,
120        charge_source: fidl_fuchsia_power_battery::ChargeSource,
121    ) -> Result<(), fidl::Error>;
122    fn r#set_battery_percentage(&self, percent: f32) -> Result<(), fidl::Error>;
123    fn r#set_level_status(
124        &self,
125        level_status: fidl_fuchsia_power_battery::LevelStatus,
126    ) -> Result<(), fidl::Error>;
127    fn r#set_time_remaining(&self, duration: i64) -> Result<(), fidl::Error>;
128    fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error>;
129    type IsSimulatingResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
130    fn r#is_simulating(&self) -> Self::IsSimulatingResponseFut;
131    fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error>;
132    fn r#set_present_voltage_mv(&self, voltage: u32) -> Result<(), fidl::Error>;
133    fn r#set_remaining_capacity_uah(&self, capacity: u32) -> Result<(), fidl::Error>;
134    fn r#set_battery_spec(
135        &self,
136        spec: &fidl_fuchsia_power_battery::BatterySpec,
137    ) -> Result<(), fidl::Error>;
138}
139#[derive(Debug)]
140#[cfg(target_os = "fuchsia")]
141pub struct BatterySimulatorSynchronousProxy {
142    client: fidl::client::sync::Client,
143}
144
145#[cfg(target_os = "fuchsia")]
146impl fidl::endpoints::SynchronousProxy for BatterySimulatorSynchronousProxy {
147    type Proxy = BatterySimulatorProxy;
148    type Protocol = BatterySimulatorMarker;
149
150    fn from_channel(inner: fidl::Channel) -> Self {
151        Self::new(inner)
152    }
153
154    fn into_channel(self) -> fidl::Channel {
155        self.client.into_channel()
156    }
157
158    fn as_channel(&self) -> &fidl::Channel {
159        self.client.as_channel()
160    }
161}
162
163#[cfg(target_os = "fuchsia")]
164impl BatterySimulatorSynchronousProxy {
165    pub fn new(channel: fidl::Channel) -> Self {
166        let protocol_name = <BatterySimulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
167        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
168    }
169
170    pub fn into_channel(self) -> fidl::Channel {
171        self.client.into_channel()
172    }
173
174    /// Waits until an event arrives and returns it. It is safe for other
175    /// threads to make concurrent requests while waiting for an event.
176    pub fn wait_for_event(
177        &self,
178        deadline: zx::MonotonicInstant,
179    ) -> Result<BatterySimulatorEvent, fidl::Error> {
180        BatterySimulatorEvent::decode(self.client.wait_for_event(deadline)?)
181    }
182
183    /// Gets battery info. This should be called after
184    /// DisconnectRealBattery
185    pub fn r#get_battery_info(
186        &self,
187        ___deadline: zx::MonotonicInstant,
188    ) -> Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error> {
189        let _response = self.client.send_query::<
190            fidl::encoding::EmptyPayload,
191            BatterySimulatorControllerGetBatteryInfoResponse,
192        >(
193            (),
194            0x4a20d3731366aaf8,
195            fidl::encoding::DynamicFlags::empty(),
196            ___deadline,
197        )?;
198        Ok(_response.info)
199    }
200
201    /// Sets Battery Status. This should be called after
202    /// DisconnectRealBattery
203    pub fn r#set_battery_status(
204        &self,
205        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
206    ) -> Result<(), fidl::Error> {
207        self.client.send::<BatterySimulatorControllerSetBatteryStatusRequest>(
208            (battery_status,),
209            0x2343eb65038c8b34,
210            fidl::encoding::DynamicFlags::empty(),
211        )
212    }
213
214    /// Sets Charge Status. This should be called after
215    /// DisconnectRealBattery
216    pub fn r#set_charge_status(
217        &self,
218        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
219    ) -> Result<(), fidl::Error> {
220        self.client.send::<BatterySimulatorControllerSetChargeStatusRequest>(
221            (charge_status,),
222            0x79b2bf1a387acd85,
223            fidl::encoding::DynamicFlags::empty(),
224        )
225    }
226
227    /// Sets Charge Source. This should be called after
228    /// DisconnectRealBattery
229    pub fn r#set_charge_source(
230        &self,
231        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
232    ) -> Result<(), fidl::Error> {
233        self.client.send::<BatterySimulatorControllerSetChargeSourceRequest>(
234            (charge_source,),
235            0xb40433f42c33527,
236            fidl::encoding::DynamicFlags::empty(),
237        )
238    }
239
240    /// Sets Battery Percentage. This should be called after
241    /// DisconnectRealBattery
242    pub fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
243        self.client.send::<BatterySimulatorControllerSetBatteryPercentageRequest>(
244            (percent,),
245            0x64a9d96eb7a45a9f,
246            fidl::encoding::DynamicFlags::empty(),
247        )
248    }
249
250    /// Sets Level Status. This should be called after
251    /// DisconnectRealBattery
252    pub fn r#set_level_status(
253        &self,
254        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
255    ) -> Result<(), fidl::Error> {
256        self.client.send::<BatterySimulatorControllerSetLevelStatusRequest>(
257            (level_status,),
258            0x577fc3314f7a48a4,
259            fidl::encoding::DynamicFlags::empty(),
260        )
261    }
262
263    /// Sets Time Remaining to full charge / depletion
264    /// This should be called after DisconnectRealBattery
265    pub fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
266        self.client.send::<BatterySimulatorControllerSetTimeRemainingRequest>(
267            (duration,),
268            0x7427251c9d2a794e,
269            fidl::encoding::DynamicFlags::empty(),
270        )
271    }
272
273    /// Disconnect the real battery connection
274    pub fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
275        self.client.send::<fidl::encoding::EmptyPayload>(
276            (),
277            0x75588eae6b9b67e3,
278            fidl::encoding::DynamicFlags::empty(),
279        )
280    }
281
282    /// Gets Simulation State
283    pub fn r#is_simulating(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
284        let _response = self.client.send_query::<
285            fidl::encoding::EmptyPayload,
286            BatterySimulatorControllerIsSimulatingResponse,
287        >(
288            (),
289            0x4bf85cfe3476975d,
290            fidl::encoding::DynamicFlags::empty(),
291            ___deadline,
292        )?;
293        Ok(_response.simulation_state)
294    }
295
296    /// Reconnect to the real battery
297    /// This should be called after DisconnectRealBattery
298    pub fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
299        self.client.send::<fidl::encoding::EmptyPayload>(
300            (),
301            0x18306690352d9dfa,
302            fidl::encoding::DynamicFlags::empty(),
303        )
304    }
305
306    /// Sets Present Voltage in mV. This should be called after
307    /// DisconnectRealBattery
308    pub fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
309        self.client.send::<BatterySimulatorControllerSetPresentVoltageMvRequest>(
310            (voltage,),
311            0x5462c9e9f947b8ce,
312            fidl::encoding::DynamicFlags::empty(),
313        )
314    }
315
316    /// Sets Remaining Capacity Uah. This should be called after
317    /// DisconnectRealBattery
318    pub fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
319        self.client.send::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
320            (capacity,),
321            0x38054049fe8c26ab,
322            fidl::encoding::DynamicFlags::empty(),
323        )
324    }
325
326    /// Sets the BatterySpec
327    pub fn r#set_battery_spec(
328        &self,
329        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
330    ) -> Result<(), fidl::Error> {
331        self.client.send::<BatterySimulatorControllerSetBatterySpecRequest>(
332            (spec,),
333            0x7324672546976583,
334            fidl::encoding::DynamicFlags::empty(),
335        )
336    }
337}
338
339#[derive(Debug, Clone)]
340pub struct BatterySimulatorProxy {
341    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
342}
343
344impl fidl::endpoints::Proxy for BatterySimulatorProxy {
345    type Protocol = BatterySimulatorMarker;
346
347    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
348        Self::new(inner)
349    }
350
351    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
352        self.client.into_channel().map_err(|client| Self { client })
353    }
354
355    fn as_channel(&self) -> &::fidl::AsyncChannel {
356        self.client.as_channel()
357    }
358}
359
360impl BatterySimulatorProxy {
361    /// Create a new Proxy for fuchsia.power.battery.test/BatterySimulator.
362    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
363        let protocol_name = <BatterySimulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
364        Self { client: fidl::client::Client::new(channel, protocol_name) }
365    }
366
367    /// Get a Stream of events from the remote end of the protocol.
368    ///
369    /// # Panics
370    ///
371    /// Panics if the event stream was already taken.
372    pub fn take_event_stream(&self) -> BatterySimulatorEventStream {
373        BatterySimulatorEventStream { event_receiver: self.client.take_event_receiver() }
374    }
375
376    /// Gets battery info. This should be called after
377    /// DisconnectRealBattery
378    pub fn r#get_battery_info(
379        &self,
380    ) -> fidl::client::QueryResponseFut<
381        fidl_fuchsia_power_battery::BatteryInfo,
382        fidl::encoding::DefaultFuchsiaResourceDialect,
383    > {
384        BatterySimulatorProxyInterface::r#get_battery_info(self)
385    }
386
387    /// Sets Battery Status. This should be called after
388    /// DisconnectRealBattery
389    pub fn r#set_battery_status(
390        &self,
391        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
392    ) -> Result<(), fidl::Error> {
393        BatterySimulatorProxyInterface::r#set_battery_status(self, battery_status)
394    }
395
396    /// Sets Charge Status. This should be called after
397    /// DisconnectRealBattery
398    pub fn r#set_charge_status(
399        &self,
400        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
401    ) -> Result<(), fidl::Error> {
402        BatterySimulatorProxyInterface::r#set_charge_status(self, charge_status)
403    }
404
405    /// Sets Charge Source. This should be called after
406    /// DisconnectRealBattery
407    pub fn r#set_charge_source(
408        &self,
409        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
410    ) -> Result<(), fidl::Error> {
411        BatterySimulatorProxyInterface::r#set_charge_source(self, charge_source)
412    }
413
414    /// Sets Battery Percentage. This should be called after
415    /// DisconnectRealBattery
416    pub fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
417        BatterySimulatorProxyInterface::r#set_battery_percentage(self, percent)
418    }
419
420    /// Sets Level Status. This should be called after
421    /// DisconnectRealBattery
422    pub fn r#set_level_status(
423        &self,
424        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
425    ) -> Result<(), fidl::Error> {
426        BatterySimulatorProxyInterface::r#set_level_status(self, level_status)
427    }
428
429    /// Sets Time Remaining to full charge / depletion
430    /// This should be called after DisconnectRealBattery
431    pub fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
432        BatterySimulatorProxyInterface::r#set_time_remaining(self, duration)
433    }
434
435    /// Disconnect the real battery connection
436    pub fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
437        BatterySimulatorProxyInterface::r#disconnect_real_battery(self)
438    }
439
440    /// Gets Simulation State
441    pub fn r#is_simulating(
442        &self,
443    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
444        BatterySimulatorProxyInterface::r#is_simulating(self)
445    }
446
447    /// Reconnect to the real battery
448    /// This should be called after DisconnectRealBattery
449    pub fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
450        BatterySimulatorProxyInterface::r#reconnect_real_battery(self)
451    }
452
453    /// Sets Present Voltage in mV. This should be called after
454    /// DisconnectRealBattery
455    pub fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
456        BatterySimulatorProxyInterface::r#set_present_voltage_mv(self, voltage)
457    }
458
459    /// Sets Remaining Capacity Uah. This should be called after
460    /// DisconnectRealBattery
461    pub fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
462        BatterySimulatorProxyInterface::r#set_remaining_capacity_uah(self, capacity)
463    }
464
465    /// Sets the BatterySpec
466    pub fn r#set_battery_spec(
467        &self,
468        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
469    ) -> Result<(), fidl::Error> {
470        BatterySimulatorProxyInterface::r#set_battery_spec(self, spec)
471    }
472}
473
474impl BatterySimulatorProxyInterface for BatterySimulatorProxy {
475    type GetBatteryInfoResponseFut = fidl::client::QueryResponseFut<
476        fidl_fuchsia_power_battery::BatteryInfo,
477        fidl::encoding::DefaultFuchsiaResourceDialect,
478    >;
479    fn r#get_battery_info(&self) -> Self::GetBatteryInfoResponseFut {
480        fn _decode(
481            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
482        ) -> Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error> {
483            let _response = fidl::client::decode_transaction_body::<
484                BatterySimulatorControllerGetBatteryInfoResponse,
485                fidl::encoding::DefaultFuchsiaResourceDialect,
486                0x4a20d3731366aaf8,
487            >(_buf?)?;
488            Ok(_response.info)
489        }
490        self.client.send_query_and_decode::<
491            fidl::encoding::EmptyPayload,
492            fidl_fuchsia_power_battery::BatteryInfo,
493        >(
494            (),
495            0x4a20d3731366aaf8,
496            fidl::encoding::DynamicFlags::empty(),
497            _decode,
498        )
499    }
500
501    fn r#set_battery_status(
502        &self,
503        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
504    ) -> Result<(), fidl::Error> {
505        self.client.send::<BatterySimulatorControllerSetBatteryStatusRequest>(
506            (battery_status,),
507            0x2343eb65038c8b34,
508            fidl::encoding::DynamicFlags::empty(),
509        )
510    }
511
512    fn r#set_charge_status(
513        &self,
514        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
515    ) -> Result<(), fidl::Error> {
516        self.client.send::<BatterySimulatorControllerSetChargeStatusRequest>(
517            (charge_status,),
518            0x79b2bf1a387acd85,
519            fidl::encoding::DynamicFlags::empty(),
520        )
521    }
522
523    fn r#set_charge_source(
524        &self,
525        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
526    ) -> Result<(), fidl::Error> {
527        self.client.send::<BatterySimulatorControllerSetChargeSourceRequest>(
528            (charge_source,),
529            0xb40433f42c33527,
530            fidl::encoding::DynamicFlags::empty(),
531        )
532    }
533
534    fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
535        self.client.send::<BatterySimulatorControllerSetBatteryPercentageRequest>(
536            (percent,),
537            0x64a9d96eb7a45a9f,
538            fidl::encoding::DynamicFlags::empty(),
539        )
540    }
541
542    fn r#set_level_status(
543        &self,
544        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
545    ) -> Result<(), fidl::Error> {
546        self.client.send::<BatterySimulatorControllerSetLevelStatusRequest>(
547            (level_status,),
548            0x577fc3314f7a48a4,
549            fidl::encoding::DynamicFlags::empty(),
550        )
551    }
552
553    fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
554        self.client.send::<BatterySimulatorControllerSetTimeRemainingRequest>(
555            (duration,),
556            0x7427251c9d2a794e,
557            fidl::encoding::DynamicFlags::empty(),
558        )
559    }
560
561    fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
562        self.client.send::<fidl::encoding::EmptyPayload>(
563            (),
564            0x75588eae6b9b67e3,
565            fidl::encoding::DynamicFlags::empty(),
566        )
567    }
568
569    type IsSimulatingResponseFut =
570        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
571    fn r#is_simulating(&self) -> Self::IsSimulatingResponseFut {
572        fn _decode(
573            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
574        ) -> Result<bool, fidl::Error> {
575            let _response = fidl::client::decode_transaction_body::<
576                BatterySimulatorControllerIsSimulatingResponse,
577                fidl::encoding::DefaultFuchsiaResourceDialect,
578                0x4bf85cfe3476975d,
579            >(_buf?)?;
580            Ok(_response.simulation_state)
581        }
582        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
583            (),
584            0x4bf85cfe3476975d,
585            fidl::encoding::DynamicFlags::empty(),
586            _decode,
587        )
588    }
589
590    fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
591        self.client.send::<fidl::encoding::EmptyPayload>(
592            (),
593            0x18306690352d9dfa,
594            fidl::encoding::DynamicFlags::empty(),
595        )
596    }
597
598    fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
599        self.client.send::<BatterySimulatorControllerSetPresentVoltageMvRequest>(
600            (voltage,),
601            0x5462c9e9f947b8ce,
602            fidl::encoding::DynamicFlags::empty(),
603        )
604    }
605
606    fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
607        self.client.send::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
608            (capacity,),
609            0x38054049fe8c26ab,
610            fidl::encoding::DynamicFlags::empty(),
611        )
612    }
613
614    fn r#set_battery_spec(
615        &self,
616        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
617    ) -> Result<(), fidl::Error> {
618        self.client.send::<BatterySimulatorControllerSetBatterySpecRequest>(
619            (spec,),
620            0x7324672546976583,
621            fidl::encoding::DynamicFlags::empty(),
622        )
623    }
624}
625
626pub struct BatterySimulatorEventStream {
627    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
628}
629
630impl std::marker::Unpin for BatterySimulatorEventStream {}
631
632impl futures::stream::FusedStream for BatterySimulatorEventStream {
633    fn is_terminated(&self) -> bool {
634        self.event_receiver.is_terminated()
635    }
636}
637
638impl futures::Stream for BatterySimulatorEventStream {
639    type Item = Result<BatterySimulatorEvent, fidl::Error>;
640
641    fn poll_next(
642        mut self: std::pin::Pin<&mut Self>,
643        cx: &mut std::task::Context<'_>,
644    ) -> std::task::Poll<Option<Self::Item>> {
645        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
646            &mut self.event_receiver,
647            cx
648        )?) {
649            Some(buf) => std::task::Poll::Ready(Some(BatterySimulatorEvent::decode(buf))),
650            None => std::task::Poll::Ready(None),
651        }
652    }
653}
654
655#[derive(Debug)]
656pub enum BatterySimulatorEvent {}
657
658impl BatterySimulatorEvent {
659    /// Decodes a message buffer as a [`BatterySimulatorEvent`].
660    fn decode(
661        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
662    ) -> Result<BatterySimulatorEvent, fidl::Error> {
663        let (bytes, _handles) = buf.split_mut();
664        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
665        debug_assert_eq!(tx_header.tx_id, 0);
666        match tx_header.ordinal {
667            _ => Err(fidl::Error::UnknownOrdinal {
668                ordinal: tx_header.ordinal,
669                protocol_name:
670                    <BatterySimulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
671            }),
672        }
673    }
674}
675
676/// A Stream of incoming requests for fuchsia.power.battery.test/BatterySimulator.
677pub struct BatterySimulatorRequestStream {
678    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
679    is_terminated: bool,
680}
681
682impl std::marker::Unpin for BatterySimulatorRequestStream {}
683
684impl futures::stream::FusedStream for BatterySimulatorRequestStream {
685    fn is_terminated(&self) -> bool {
686        self.is_terminated
687    }
688}
689
690impl fidl::endpoints::RequestStream for BatterySimulatorRequestStream {
691    type Protocol = BatterySimulatorMarker;
692    type ControlHandle = BatterySimulatorControlHandle;
693
694    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
695        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
696    }
697
698    fn control_handle(&self) -> Self::ControlHandle {
699        BatterySimulatorControlHandle { inner: self.inner.clone() }
700    }
701
702    fn into_inner(
703        self,
704    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
705    {
706        (self.inner, self.is_terminated)
707    }
708
709    fn from_inner(
710        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
711        is_terminated: bool,
712    ) -> Self {
713        Self { inner, is_terminated }
714    }
715}
716
717impl futures::Stream for BatterySimulatorRequestStream {
718    type Item = Result<BatterySimulatorRequest, fidl::Error>;
719
720    fn poll_next(
721        mut self: std::pin::Pin<&mut Self>,
722        cx: &mut std::task::Context<'_>,
723    ) -> std::task::Poll<Option<Self::Item>> {
724        let this = &mut *self;
725        if this.inner.check_shutdown(cx) {
726            this.is_terminated = true;
727            return std::task::Poll::Ready(None);
728        }
729        if this.is_terminated {
730            panic!("polled BatterySimulatorRequestStream after completion");
731        }
732        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
733            |bytes, handles| {
734                match this.inner.channel().read_etc(cx, bytes, handles) {
735                    std::task::Poll::Ready(Ok(())) => {}
736                    std::task::Poll::Pending => return std::task::Poll::Pending,
737                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
738                        this.is_terminated = true;
739                        return std::task::Poll::Ready(None);
740                    }
741                    std::task::Poll::Ready(Err(e)) => {
742                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
743                            e.into(),
744                        ))))
745                    }
746                }
747
748                // A message has been received from the channel
749                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
750
751                std::task::Poll::Ready(Some(match header.ordinal {
752                    0x4a20d3731366aaf8 => {
753                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
754                        let mut req = fidl::new_empty!(
755                            fidl::encoding::EmptyPayload,
756                            fidl::encoding::DefaultFuchsiaResourceDialect
757                        );
758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
759                        let control_handle =
760                            BatterySimulatorControlHandle { inner: this.inner.clone() };
761                        Ok(BatterySimulatorRequest::GetBatteryInfo {
762                            responder: BatterySimulatorGetBatteryInfoResponder {
763                                control_handle: std::mem::ManuallyDrop::new(control_handle),
764                                tx_id: header.tx_id,
765                            },
766                        })
767                    }
768                    0x2343eb65038c8b34 => {
769                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
770                        let mut req = fidl::new_empty!(
771                            BatterySimulatorControllerSetBatteryStatusRequest,
772                            fidl::encoding::DefaultFuchsiaResourceDialect
773                        );
774                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatteryStatusRequest>(&header, _body_bytes, handles, &mut req)?;
775                        let control_handle =
776                            BatterySimulatorControlHandle { inner: this.inner.clone() };
777                        Ok(BatterySimulatorRequest::SetBatteryStatus {
778                            battery_status: req.battery_status,
779
780                            control_handle,
781                        })
782                    }
783                    0x79b2bf1a387acd85 => {
784                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
785                        let mut req = fidl::new_empty!(
786                            BatterySimulatorControllerSetChargeStatusRequest,
787                            fidl::encoding::DefaultFuchsiaResourceDialect
788                        );
789                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetChargeStatusRequest>(&header, _body_bytes, handles, &mut req)?;
790                        let control_handle =
791                            BatterySimulatorControlHandle { inner: this.inner.clone() };
792                        Ok(BatterySimulatorRequest::SetChargeStatus {
793                            charge_status: req.charge_status,
794
795                            control_handle,
796                        })
797                    }
798                    0xb40433f42c33527 => {
799                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
800                        let mut req = fidl::new_empty!(
801                            BatterySimulatorControllerSetChargeSourceRequest,
802                            fidl::encoding::DefaultFuchsiaResourceDialect
803                        );
804                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetChargeSourceRequest>(&header, _body_bytes, handles, &mut req)?;
805                        let control_handle =
806                            BatterySimulatorControlHandle { inner: this.inner.clone() };
807                        Ok(BatterySimulatorRequest::SetChargeSource {
808                            charge_source: req.charge_source,
809
810                            control_handle,
811                        })
812                    }
813                    0x64a9d96eb7a45a9f => {
814                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
815                        let mut req = fidl::new_empty!(
816                            BatterySimulatorControllerSetBatteryPercentageRequest,
817                            fidl::encoding::DefaultFuchsiaResourceDialect
818                        );
819                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatteryPercentageRequest>(&header, _body_bytes, handles, &mut req)?;
820                        let control_handle =
821                            BatterySimulatorControlHandle { inner: this.inner.clone() };
822                        Ok(BatterySimulatorRequest::SetBatteryPercentage {
823                            percent: req.percent,
824
825                            control_handle,
826                        })
827                    }
828                    0x577fc3314f7a48a4 => {
829                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
830                        let mut req = fidl::new_empty!(
831                            BatterySimulatorControllerSetLevelStatusRequest,
832                            fidl::encoding::DefaultFuchsiaResourceDialect
833                        );
834                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetLevelStatusRequest>(&header, _body_bytes, handles, &mut req)?;
835                        let control_handle =
836                            BatterySimulatorControlHandle { inner: this.inner.clone() };
837                        Ok(BatterySimulatorRequest::SetLevelStatus {
838                            level_status: req.level_status,
839
840                            control_handle,
841                        })
842                    }
843                    0x7427251c9d2a794e => {
844                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
845                        let mut req = fidl::new_empty!(
846                            BatterySimulatorControllerSetTimeRemainingRequest,
847                            fidl::encoding::DefaultFuchsiaResourceDialect
848                        );
849                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetTimeRemainingRequest>(&header, _body_bytes, handles, &mut req)?;
850                        let control_handle =
851                            BatterySimulatorControlHandle { inner: this.inner.clone() };
852                        Ok(BatterySimulatorRequest::SetTimeRemaining {
853                            duration: req.duration,
854
855                            control_handle,
856                        })
857                    }
858                    0x75588eae6b9b67e3 => {
859                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
860                        let mut req = fidl::new_empty!(
861                            fidl::encoding::EmptyPayload,
862                            fidl::encoding::DefaultFuchsiaResourceDialect
863                        );
864                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
865                        let control_handle =
866                            BatterySimulatorControlHandle { inner: this.inner.clone() };
867                        Ok(BatterySimulatorRequest::DisconnectRealBattery { control_handle })
868                    }
869                    0x4bf85cfe3476975d => {
870                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
871                        let mut req = fidl::new_empty!(
872                            fidl::encoding::EmptyPayload,
873                            fidl::encoding::DefaultFuchsiaResourceDialect
874                        );
875                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
876                        let control_handle =
877                            BatterySimulatorControlHandle { inner: this.inner.clone() };
878                        Ok(BatterySimulatorRequest::IsSimulating {
879                            responder: BatterySimulatorIsSimulatingResponder {
880                                control_handle: std::mem::ManuallyDrop::new(control_handle),
881                                tx_id: header.tx_id,
882                            },
883                        })
884                    }
885                    0x18306690352d9dfa => {
886                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
887                        let mut req = fidl::new_empty!(
888                            fidl::encoding::EmptyPayload,
889                            fidl::encoding::DefaultFuchsiaResourceDialect
890                        );
891                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
892                        let control_handle =
893                            BatterySimulatorControlHandle { inner: this.inner.clone() };
894                        Ok(BatterySimulatorRequest::ReconnectRealBattery { control_handle })
895                    }
896                    0x5462c9e9f947b8ce => {
897                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
898                        let mut req = fidl::new_empty!(
899                            BatterySimulatorControllerSetPresentVoltageMvRequest,
900                            fidl::encoding::DefaultFuchsiaResourceDialect
901                        );
902                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetPresentVoltageMvRequest>(&header, _body_bytes, handles, &mut req)?;
903                        let control_handle =
904                            BatterySimulatorControlHandle { inner: this.inner.clone() };
905                        Ok(BatterySimulatorRequest::SetPresentVoltageMv {
906                            voltage: req.voltage,
907
908                            control_handle,
909                        })
910                    }
911                    0x38054049fe8c26ab => {
912                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
913                        let mut req = fidl::new_empty!(
914                            BatterySimulatorControllerSetRemainingCapacityUahRequest,
915                            fidl::encoding::DefaultFuchsiaResourceDialect
916                        );
917                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(&header, _body_bytes, handles, &mut req)?;
918                        let control_handle =
919                            BatterySimulatorControlHandle { inner: this.inner.clone() };
920                        Ok(BatterySimulatorRequest::SetRemainingCapacityUah {
921                            capacity: req.capacity,
922
923                            control_handle,
924                        })
925                    }
926                    0x7324672546976583 => {
927                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
928                        let mut req = fidl::new_empty!(
929                            BatterySimulatorControllerSetBatterySpecRequest,
930                            fidl::encoding::DefaultFuchsiaResourceDialect
931                        );
932                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatterySpecRequest>(&header, _body_bytes, handles, &mut req)?;
933                        let control_handle =
934                            BatterySimulatorControlHandle { inner: this.inner.clone() };
935                        Ok(BatterySimulatorRequest::SetBatterySpec {
936                            spec: req.spec,
937
938                            control_handle,
939                        })
940                    }
941                    _ => Err(fidl::Error::UnknownOrdinal {
942                        ordinal: header.ordinal,
943                        protocol_name:
944                            <BatterySimulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
945                    }),
946                }))
947            },
948        )
949    }
950}
951
952/// Simulator interface for battery simulation
953#[derive(Debug)]
954pub enum BatterySimulatorRequest {
955    /// Gets battery info. This should be called after
956    /// DisconnectRealBattery
957    GetBatteryInfo { responder: BatterySimulatorGetBatteryInfoResponder },
958    /// Sets Battery Status. This should be called after
959    /// DisconnectRealBattery
960    SetBatteryStatus {
961        battery_status: fidl_fuchsia_power_battery::BatteryStatus,
962        control_handle: BatterySimulatorControlHandle,
963    },
964    /// Sets Charge Status. This should be called after
965    /// DisconnectRealBattery
966    SetChargeStatus {
967        charge_status: fidl_fuchsia_power_battery::ChargeStatus,
968        control_handle: BatterySimulatorControlHandle,
969    },
970    /// Sets Charge Source. This should be called after
971    /// DisconnectRealBattery
972    SetChargeSource {
973        charge_source: fidl_fuchsia_power_battery::ChargeSource,
974        control_handle: BatterySimulatorControlHandle,
975    },
976    /// Sets Battery Percentage. This should be called after
977    /// DisconnectRealBattery
978    SetBatteryPercentage { percent: f32, control_handle: BatterySimulatorControlHandle },
979    /// Sets Level Status. This should be called after
980    /// DisconnectRealBattery
981    SetLevelStatus {
982        level_status: fidl_fuchsia_power_battery::LevelStatus,
983        control_handle: BatterySimulatorControlHandle,
984    },
985    /// Sets Time Remaining to full charge / depletion
986    /// This should be called after DisconnectRealBattery
987    SetTimeRemaining { duration: i64, control_handle: BatterySimulatorControlHandle },
988    /// Disconnect the real battery connection
989    DisconnectRealBattery { control_handle: BatterySimulatorControlHandle },
990    /// Gets Simulation State
991    IsSimulating { responder: BatterySimulatorIsSimulatingResponder },
992    /// Reconnect to the real battery
993    /// This should be called after DisconnectRealBattery
994    ReconnectRealBattery { control_handle: BatterySimulatorControlHandle },
995    /// Sets Present Voltage in mV. This should be called after
996    /// DisconnectRealBattery
997    SetPresentVoltageMv { voltage: u32, control_handle: BatterySimulatorControlHandle },
998    /// Sets Remaining Capacity Uah. This should be called after
999    /// DisconnectRealBattery
1000    SetRemainingCapacityUah { capacity: u32, control_handle: BatterySimulatorControlHandle },
1001    /// Sets the BatterySpec
1002    SetBatterySpec {
1003        spec: fidl_fuchsia_power_battery::BatterySpec,
1004        control_handle: BatterySimulatorControlHandle,
1005    },
1006}
1007
1008impl BatterySimulatorRequest {
1009    #[allow(irrefutable_let_patterns)]
1010    pub fn into_get_battery_info(self) -> Option<(BatterySimulatorGetBatteryInfoResponder)> {
1011        if let BatterySimulatorRequest::GetBatteryInfo { responder } = self {
1012            Some((responder))
1013        } else {
1014            None
1015        }
1016    }
1017
1018    #[allow(irrefutable_let_patterns)]
1019    pub fn into_set_battery_status(
1020        self,
1021    ) -> Option<(fidl_fuchsia_power_battery::BatteryStatus, BatterySimulatorControlHandle)> {
1022        if let BatterySimulatorRequest::SetBatteryStatus { battery_status, control_handle } = self {
1023            Some((battery_status, control_handle))
1024        } else {
1025            None
1026        }
1027    }
1028
1029    #[allow(irrefutable_let_patterns)]
1030    pub fn into_set_charge_status(
1031        self,
1032    ) -> Option<(fidl_fuchsia_power_battery::ChargeStatus, BatterySimulatorControlHandle)> {
1033        if let BatterySimulatorRequest::SetChargeStatus { charge_status, control_handle } = self {
1034            Some((charge_status, control_handle))
1035        } else {
1036            None
1037        }
1038    }
1039
1040    #[allow(irrefutable_let_patterns)]
1041    pub fn into_set_charge_source(
1042        self,
1043    ) -> Option<(fidl_fuchsia_power_battery::ChargeSource, BatterySimulatorControlHandle)> {
1044        if let BatterySimulatorRequest::SetChargeSource { charge_source, control_handle } = self {
1045            Some((charge_source, control_handle))
1046        } else {
1047            None
1048        }
1049    }
1050
1051    #[allow(irrefutable_let_patterns)]
1052    pub fn into_set_battery_percentage(self) -> Option<(f32, BatterySimulatorControlHandle)> {
1053        if let BatterySimulatorRequest::SetBatteryPercentage { percent, control_handle } = self {
1054            Some((percent, control_handle))
1055        } else {
1056            None
1057        }
1058    }
1059
1060    #[allow(irrefutable_let_patterns)]
1061    pub fn into_set_level_status(
1062        self,
1063    ) -> Option<(fidl_fuchsia_power_battery::LevelStatus, BatterySimulatorControlHandle)> {
1064        if let BatterySimulatorRequest::SetLevelStatus { level_status, control_handle } = self {
1065            Some((level_status, control_handle))
1066        } else {
1067            None
1068        }
1069    }
1070
1071    #[allow(irrefutable_let_patterns)]
1072    pub fn into_set_time_remaining(self) -> Option<(i64, BatterySimulatorControlHandle)> {
1073        if let BatterySimulatorRequest::SetTimeRemaining { duration, control_handle } = self {
1074            Some((duration, control_handle))
1075        } else {
1076            None
1077        }
1078    }
1079
1080    #[allow(irrefutable_let_patterns)]
1081    pub fn into_disconnect_real_battery(self) -> Option<(BatterySimulatorControlHandle)> {
1082        if let BatterySimulatorRequest::DisconnectRealBattery { control_handle } = self {
1083            Some((control_handle))
1084        } else {
1085            None
1086        }
1087    }
1088
1089    #[allow(irrefutable_let_patterns)]
1090    pub fn into_is_simulating(self) -> Option<(BatterySimulatorIsSimulatingResponder)> {
1091        if let BatterySimulatorRequest::IsSimulating { responder } = self {
1092            Some((responder))
1093        } else {
1094            None
1095        }
1096    }
1097
1098    #[allow(irrefutable_let_patterns)]
1099    pub fn into_reconnect_real_battery(self) -> Option<(BatterySimulatorControlHandle)> {
1100        if let BatterySimulatorRequest::ReconnectRealBattery { control_handle } = self {
1101            Some((control_handle))
1102        } else {
1103            None
1104        }
1105    }
1106
1107    #[allow(irrefutable_let_patterns)]
1108    pub fn into_set_present_voltage_mv(self) -> Option<(u32, BatterySimulatorControlHandle)> {
1109        if let BatterySimulatorRequest::SetPresentVoltageMv { voltage, control_handle } = self {
1110            Some((voltage, control_handle))
1111        } else {
1112            None
1113        }
1114    }
1115
1116    #[allow(irrefutable_let_patterns)]
1117    pub fn into_set_remaining_capacity_uah(self) -> Option<(u32, BatterySimulatorControlHandle)> {
1118        if let BatterySimulatorRequest::SetRemainingCapacityUah { capacity, control_handle } = self
1119        {
1120            Some((capacity, control_handle))
1121        } else {
1122            None
1123        }
1124    }
1125
1126    #[allow(irrefutable_let_patterns)]
1127    pub fn into_set_battery_spec(
1128        self,
1129    ) -> Option<(fidl_fuchsia_power_battery::BatterySpec, BatterySimulatorControlHandle)> {
1130        if let BatterySimulatorRequest::SetBatterySpec { spec, control_handle } = self {
1131            Some((spec, control_handle))
1132        } else {
1133            None
1134        }
1135    }
1136
1137    /// Name of the method defined in FIDL
1138    pub fn method_name(&self) -> &'static str {
1139        match *self {
1140            BatterySimulatorRequest::GetBatteryInfo { .. } => "get_battery_info",
1141            BatterySimulatorRequest::SetBatteryStatus { .. } => "set_battery_status",
1142            BatterySimulatorRequest::SetChargeStatus { .. } => "set_charge_status",
1143            BatterySimulatorRequest::SetChargeSource { .. } => "set_charge_source",
1144            BatterySimulatorRequest::SetBatteryPercentage { .. } => "set_battery_percentage",
1145            BatterySimulatorRequest::SetLevelStatus { .. } => "set_level_status",
1146            BatterySimulatorRequest::SetTimeRemaining { .. } => "set_time_remaining",
1147            BatterySimulatorRequest::DisconnectRealBattery { .. } => "disconnect_real_battery",
1148            BatterySimulatorRequest::IsSimulating { .. } => "is_simulating",
1149            BatterySimulatorRequest::ReconnectRealBattery { .. } => "reconnect_real_battery",
1150            BatterySimulatorRequest::SetPresentVoltageMv { .. } => "set_present_voltage_mv",
1151            BatterySimulatorRequest::SetRemainingCapacityUah { .. } => "set_remaining_capacity_uah",
1152            BatterySimulatorRequest::SetBatterySpec { .. } => "set_battery_spec",
1153        }
1154    }
1155}
1156
1157#[derive(Debug, Clone)]
1158pub struct BatterySimulatorControlHandle {
1159    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1160}
1161
1162impl fidl::endpoints::ControlHandle for BatterySimulatorControlHandle {
1163    fn shutdown(&self) {
1164        self.inner.shutdown()
1165    }
1166    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1167        self.inner.shutdown_with_epitaph(status)
1168    }
1169
1170    fn is_closed(&self) -> bool {
1171        self.inner.channel().is_closed()
1172    }
1173    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1174        self.inner.channel().on_closed()
1175    }
1176
1177    #[cfg(target_os = "fuchsia")]
1178    fn signal_peer(
1179        &self,
1180        clear_mask: zx::Signals,
1181        set_mask: zx::Signals,
1182    ) -> Result<(), zx_status::Status> {
1183        use fidl::Peered;
1184        self.inner.channel().signal_peer(clear_mask, set_mask)
1185    }
1186}
1187
1188impl BatterySimulatorControlHandle {}
1189
1190#[must_use = "FIDL methods require a response to be sent"]
1191#[derive(Debug)]
1192pub struct BatterySimulatorGetBatteryInfoResponder {
1193    control_handle: std::mem::ManuallyDrop<BatterySimulatorControlHandle>,
1194    tx_id: u32,
1195}
1196
1197/// Set the the channel to be shutdown (see [`BatterySimulatorControlHandle::shutdown`])
1198/// if the responder is dropped without sending a response, so that the client
1199/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1200impl std::ops::Drop for BatterySimulatorGetBatteryInfoResponder {
1201    fn drop(&mut self) {
1202        self.control_handle.shutdown();
1203        // Safety: drops once, never accessed again
1204        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1205    }
1206}
1207
1208impl fidl::endpoints::Responder for BatterySimulatorGetBatteryInfoResponder {
1209    type ControlHandle = BatterySimulatorControlHandle;
1210
1211    fn control_handle(&self) -> &BatterySimulatorControlHandle {
1212        &self.control_handle
1213    }
1214
1215    fn drop_without_shutdown(mut self) {
1216        // Safety: drops once, never accessed again due to mem::forget
1217        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1218        // Prevent Drop from running (which would shut down the channel)
1219        std::mem::forget(self);
1220    }
1221}
1222
1223impl BatterySimulatorGetBatteryInfoResponder {
1224    /// Sends a response to the FIDL transaction.
1225    ///
1226    /// Sets the channel to shutdown if an error occurs.
1227    pub fn send(
1228        self,
1229        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
1230    ) -> Result<(), fidl::Error> {
1231        let _result = self.send_raw(info);
1232        if _result.is_err() {
1233            self.control_handle.shutdown();
1234        }
1235        self.drop_without_shutdown();
1236        _result
1237    }
1238
1239    /// Similar to "send" but does not shutdown the channel if an error occurs.
1240    pub fn send_no_shutdown_on_err(
1241        self,
1242        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
1243    ) -> Result<(), fidl::Error> {
1244        let _result = self.send_raw(info);
1245        self.drop_without_shutdown();
1246        _result
1247    }
1248
1249    fn send_raw(
1250        &self,
1251        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
1252    ) -> Result<(), fidl::Error> {
1253        self.control_handle.inner.send::<BatterySimulatorControllerGetBatteryInfoResponse>(
1254            (info,),
1255            self.tx_id,
1256            0x4a20d3731366aaf8,
1257            fidl::encoding::DynamicFlags::empty(),
1258        )
1259    }
1260}
1261
1262#[must_use = "FIDL methods require a response to be sent"]
1263#[derive(Debug)]
1264pub struct BatterySimulatorIsSimulatingResponder {
1265    control_handle: std::mem::ManuallyDrop<BatterySimulatorControlHandle>,
1266    tx_id: u32,
1267}
1268
1269/// Set the the channel to be shutdown (see [`BatterySimulatorControlHandle::shutdown`])
1270/// if the responder is dropped without sending a response, so that the client
1271/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1272impl std::ops::Drop for BatterySimulatorIsSimulatingResponder {
1273    fn drop(&mut self) {
1274        self.control_handle.shutdown();
1275        // Safety: drops once, never accessed again
1276        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1277    }
1278}
1279
1280impl fidl::endpoints::Responder for BatterySimulatorIsSimulatingResponder {
1281    type ControlHandle = BatterySimulatorControlHandle;
1282
1283    fn control_handle(&self) -> &BatterySimulatorControlHandle {
1284        &self.control_handle
1285    }
1286
1287    fn drop_without_shutdown(mut self) {
1288        // Safety: drops once, never accessed again due to mem::forget
1289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1290        // Prevent Drop from running (which would shut down the channel)
1291        std::mem::forget(self);
1292    }
1293}
1294
1295impl BatterySimulatorIsSimulatingResponder {
1296    /// Sends a response to the FIDL transaction.
1297    ///
1298    /// Sets the channel to shutdown if an error occurs.
1299    pub fn send(self, mut simulation_state: bool) -> Result<(), fidl::Error> {
1300        let _result = self.send_raw(simulation_state);
1301        if _result.is_err() {
1302            self.control_handle.shutdown();
1303        }
1304        self.drop_without_shutdown();
1305        _result
1306    }
1307
1308    /// Similar to "send" but does not shutdown the channel if an error occurs.
1309    pub fn send_no_shutdown_on_err(self, mut simulation_state: bool) -> Result<(), fidl::Error> {
1310        let _result = self.send_raw(simulation_state);
1311        self.drop_without_shutdown();
1312        _result
1313    }
1314
1315    fn send_raw(&self, mut simulation_state: bool) -> Result<(), fidl::Error> {
1316        self.control_handle.inner.send::<BatterySimulatorControllerIsSimulatingResponse>(
1317            (simulation_state,),
1318            self.tx_id,
1319            0x4bf85cfe3476975d,
1320            fidl::encoding::DynamicFlags::empty(),
1321        )
1322    }
1323}
1324
1325#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1326pub struct BatterySimulatorControllerMarker;
1327
1328impl fidl::endpoints::ProtocolMarker for BatterySimulatorControllerMarker {
1329    type Proxy = BatterySimulatorControllerProxy;
1330    type RequestStream = BatterySimulatorControllerRequestStream;
1331    #[cfg(target_os = "fuchsia")]
1332    type SynchronousProxy = BatterySimulatorControllerSynchronousProxy;
1333
1334    const DEBUG_NAME: &'static str = "(anonymous) BatterySimulatorController";
1335}
1336
1337pub trait BatterySimulatorControllerProxyInterface: Send + Sync {
1338    type GetBatteryInfoResponseFut: std::future::Future<Output = Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error>>
1339        + Send;
1340    fn r#get_battery_info(&self) -> Self::GetBatteryInfoResponseFut;
1341    fn r#set_battery_status(
1342        &self,
1343        battery_status: fidl_fuchsia_power_battery::BatteryStatus,
1344    ) -> Result<(), fidl::Error>;
1345    fn r#set_charge_status(
1346        &self,
1347        charge_status: fidl_fuchsia_power_battery::ChargeStatus,
1348    ) -> Result<(), fidl::Error>;
1349    fn r#set_charge_source(
1350        &self,
1351        charge_source: fidl_fuchsia_power_battery::ChargeSource,
1352    ) -> Result<(), fidl::Error>;
1353    fn r#set_battery_percentage(&self, percent: f32) -> Result<(), fidl::Error>;
1354    fn r#set_level_status(
1355        &self,
1356        level_status: fidl_fuchsia_power_battery::LevelStatus,
1357    ) -> Result<(), fidl::Error>;
1358    fn r#set_time_remaining(&self, duration: i64) -> Result<(), fidl::Error>;
1359    fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error>;
1360    type IsSimulatingResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
1361    fn r#is_simulating(&self) -> Self::IsSimulatingResponseFut;
1362    fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error>;
1363    fn r#set_present_voltage_mv(&self, voltage: u32) -> Result<(), fidl::Error>;
1364    fn r#set_remaining_capacity_uah(&self, capacity: u32) -> Result<(), fidl::Error>;
1365    fn r#set_battery_spec(
1366        &self,
1367        spec: &fidl_fuchsia_power_battery::BatterySpec,
1368    ) -> Result<(), fidl::Error>;
1369}
1370#[derive(Debug)]
1371#[cfg(target_os = "fuchsia")]
1372pub struct BatterySimulatorControllerSynchronousProxy {
1373    client: fidl::client::sync::Client,
1374}
1375
1376#[cfg(target_os = "fuchsia")]
1377impl fidl::endpoints::SynchronousProxy for BatterySimulatorControllerSynchronousProxy {
1378    type Proxy = BatterySimulatorControllerProxy;
1379    type Protocol = BatterySimulatorControllerMarker;
1380
1381    fn from_channel(inner: fidl::Channel) -> Self {
1382        Self::new(inner)
1383    }
1384
1385    fn into_channel(self) -> fidl::Channel {
1386        self.client.into_channel()
1387    }
1388
1389    fn as_channel(&self) -> &fidl::Channel {
1390        self.client.as_channel()
1391    }
1392}
1393
1394#[cfg(target_os = "fuchsia")]
1395impl BatterySimulatorControllerSynchronousProxy {
1396    pub fn new(channel: fidl::Channel) -> Self {
1397        let protocol_name =
1398            <BatterySimulatorControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1399        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1400    }
1401
1402    pub fn into_channel(self) -> fidl::Channel {
1403        self.client.into_channel()
1404    }
1405
1406    /// Waits until an event arrives and returns it. It is safe for other
1407    /// threads to make concurrent requests while waiting for an event.
1408    pub fn wait_for_event(
1409        &self,
1410        deadline: zx::MonotonicInstant,
1411    ) -> Result<BatterySimulatorControllerEvent, fidl::Error> {
1412        BatterySimulatorControllerEvent::decode(self.client.wait_for_event(deadline)?)
1413    }
1414
1415    /// Gets battery info. This should be called after
1416    /// DisconnectRealBattery
1417    pub fn r#get_battery_info(
1418        &self,
1419        ___deadline: zx::MonotonicInstant,
1420    ) -> Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error> {
1421        let _response = self.client.send_query::<
1422            fidl::encoding::EmptyPayload,
1423            BatterySimulatorControllerGetBatteryInfoResponse,
1424        >(
1425            (),
1426            0x4a20d3731366aaf8,
1427            fidl::encoding::DynamicFlags::empty(),
1428            ___deadline,
1429        )?;
1430        Ok(_response.info)
1431    }
1432
1433    /// Sets Battery Status. This should be called after
1434    /// DisconnectRealBattery
1435    pub fn r#set_battery_status(
1436        &self,
1437        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
1438    ) -> Result<(), fidl::Error> {
1439        self.client.send::<BatterySimulatorControllerSetBatteryStatusRequest>(
1440            (battery_status,),
1441            0x2343eb65038c8b34,
1442            fidl::encoding::DynamicFlags::empty(),
1443        )
1444    }
1445
1446    /// Sets Charge Status. This should be called after
1447    /// DisconnectRealBattery
1448    pub fn r#set_charge_status(
1449        &self,
1450        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
1451    ) -> Result<(), fidl::Error> {
1452        self.client.send::<BatterySimulatorControllerSetChargeStatusRequest>(
1453            (charge_status,),
1454            0x79b2bf1a387acd85,
1455            fidl::encoding::DynamicFlags::empty(),
1456        )
1457    }
1458
1459    /// Sets Charge Source. This should be called after
1460    /// DisconnectRealBattery
1461    pub fn r#set_charge_source(
1462        &self,
1463        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
1464    ) -> Result<(), fidl::Error> {
1465        self.client.send::<BatterySimulatorControllerSetChargeSourceRequest>(
1466            (charge_source,),
1467            0xb40433f42c33527,
1468            fidl::encoding::DynamicFlags::empty(),
1469        )
1470    }
1471
1472    /// Sets Battery Percentage. This should be called after
1473    /// DisconnectRealBattery
1474    pub fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
1475        self.client.send::<BatterySimulatorControllerSetBatteryPercentageRequest>(
1476            (percent,),
1477            0x64a9d96eb7a45a9f,
1478            fidl::encoding::DynamicFlags::empty(),
1479        )
1480    }
1481
1482    /// Sets Level Status. This should be called after
1483    /// DisconnectRealBattery
1484    pub fn r#set_level_status(
1485        &self,
1486        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
1487    ) -> Result<(), fidl::Error> {
1488        self.client.send::<BatterySimulatorControllerSetLevelStatusRequest>(
1489            (level_status,),
1490            0x577fc3314f7a48a4,
1491            fidl::encoding::DynamicFlags::empty(),
1492        )
1493    }
1494
1495    /// Sets Time Remaining to full charge / depletion
1496    /// This should be called after DisconnectRealBattery
1497    pub fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
1498        self.client.send::<BatterySimulatorControllerSetTimeRemainingRequest>(
1499            (duration,),
1500            0x7427251c9d2a794e,
1501            fidl::encoding::DynamicFlags::empty(),
1502        )
1503    }
1504
1505    /// Disconnect the real battery connection
1506    pub fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
1507        self.client.send::<fidl::encoding::EmptyPayload>(
1508            (),
1509            0x75588eae6b9b67e3,
1510            fidl::encoding::DynamicFlags::empty(),
1511        )
1512    }
1513
1514    /// Gets Simulation State
1515    pub fn r#is_simulating(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
1516        let _response = self.client.send_query::<
1517            fidl::encoding::EmptyPayload,
1518            BatterySimulatorControllerIsSimulatingResponse,
1519        >(
1520            (),
1521            0x4bf85cfe3476975d,
1522            fidl::encoding::DynamicFlags::empty(),
1523            ___deadline,
1524        )?;
1525        Ok(_response.simulation_state)
1526    }
1527
1528    /// Reconnect to the real battery
1529    /// This should be called after DisconnectRealBattery
1530    pub fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
1531        self.client.send::<fidl::encoding::EmptyPayload>(
1532            (),
1533            0x18306690352d9dfa,
1534            fidl::encoding::DynamicFlags::empty(),
1535        )
1536    }
1537
1538    /// Sets Present Voltage in mV. This should be called after
1539    /// DisconnectRealBattery
1540    pub fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
1541        self.client.send::<BatterySimulatorControllerSetPresentVoltageMvRequest>(
1542            (voltage,),
1543            0x5462c9e9f947b8ce,
1544            fidl::encoding::DynamicFlags::empty(),
1545        )
1546    }
1547
1548    /// Sets Remaining Capacity Uah. This should be called after
1549    /// DisconnectRealBattery
1550    pub fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
1551        self.client.send::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
1552            (capacity,),
1553            0x38054049fe8c26ab,
1554            fidl::encoding::DynamicFlags::empty(),
1555        )
1556    }
1557
1558    /// Sets the BatterySpec
1559    pub fn r#set_battery_spec(
1560        &self,
1561        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
1562    ) -> Result<(), fidl::Error> {
1563        self.client.send::<BatterySimulatorControllerSetBatterySpecRequest>(
1564            (spec,),
1565            0x7324672546976583,
1566            fidl::encoding::DynamicFlags::empty(),
1567        )
1568    }
1569}
1570
1571#[derive(Debug, Clone)]
1572pub struct BatterySimulatorControllerProxy {
1573    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1574}
1575
1576impl fidl::endpoints::Proxy for BatterySimulatorControllerProxy {
1577    type Protocol = BatterySimulatorControllerMarker;
1578
1579    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1580        Self::new(inner)
1581    }
1582
1583    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1584        self.client.into_channel().map_err(|client| Self { client })
1585    }
1586
1587    fn as_channel(&self) -> &::fidl::AsyncChannel {
1588        self.client.as_channel()
1589    }
1590}
1591
1592impl BatterySimulatorControllerProxy {
1593    /// Create a new Proxy for fuchsia.power.battery.test/BatterySimulatorController.
1594    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1595        let protocol_name =
1596            <BatterySimulatorControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1597        Self { client: fidl::client::Client::new(channel, protocol_name) }
1598    }
1599
1600    /// Get a Stream of events from the remote end of the protocol.
1601    ///
1602    /// # Panics
1603    ///
1604    /// Panics if the event stream was already taken.
1605    pub fn take_event_stream(&self) -> BatterySimulatorControllerEventStream {
1606        BatterySimulatorControllerEventStream { event_receiver: self.client.take_event_receiver() }
1607    }
1608
1609    /// Gets battery info. This should be called after
1610    /// DisconnectRealBattery
1611    pub fn r#get_battery_info(
1612        &self,
1613    ) -> fidl::client::QueryResponseFut<
1614        fidl_fuchsia_power_battery::BatteryInfo,
1615        fidl::encoding::DefaultFuchsiaResourceDialect,
1616    > {
1617        BatterySimulatorControllerProxyInterface::r#get_battery_info(self)
1618    }
1619
1620    /// Sets Battery Status. This should be called after
1621    /// DisconnectRealBattery
1622    pub fn r#set_battery_status(
1623        &self,
1624        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
1625    ) -> Result<(), fidl::Error> {
1626        BatterySimulatorControllerProxyInterface::r#set_battery_status(self, battery_status)
1627    }
1628
1629    /// Sets Charge Status. This should be called after
1630    /// DisconnectRealBattery
1631    pub fn r#set_charge_status(
1632        &self,
1633        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
1634    ) -> Result<(), fidl::Error> {
1635        BatterySimulatorControllerProxyInterface::r#set_charge_status(self, charge_status)
1636    }
1637
1638    /// Sets Charge Source. This should be called after
1639    /// DisconnectRealBattery
1640    pub fn r#set_charge_source(
1641        &self,
1642        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
1643    ) -> Result<(), fidl::Error> {
1644        BatterySimulatorControllerProxyInterface::r#set_charge_source(self, charge_source)
1645    }
1646
1647    /// Sets Battery Percentage. This should be called after
1648    /// DisconnectRealBattery
1649    pub fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
1650        BatterySimulatorControllerProxyInterface::r#set_battery_percentage(self, percent)
1651    }
1652
1653    /// Sets Level Status. This should be called after
1654    /// DisconnectRealBattery
1655    pub fn r#set_level_status(
1656        &self,
1657        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
1658    ) -> Result<(), fidl::Error> {
1659        BatterySimulatorControllerProxyInterface::r#set_level_status(self, level_status)
1660    }
1661
1662    /// Sets Time Remaining to full charge / depletion
1663    /// This should be called after DisconnectRealBattery
1664    pub fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
1665        BatterySimulatorControllerProxyInterface::r#set_time_remaining(self, duration)
1666    }
1667
1668    /// Disconnect the real battery connection
1669    pub fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
1670        BatterySimulatorControllerProxyInterface::r#disconnect_real_battery(self)
1671    }
1672
1673    /// Gets Simulation State
1674    pub fn r#is_simulating(
1675        &self,
1676    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1677        BatterySimulatorControllerProxyInterface::r#is_simulating(self)
1678    }
1679
1680    /// Reconnect to the real battery
1681    /// This should be called after DisconnectRealBattery
1682    pub fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
1683        BatterySimulatorControllerProxyInterface::r#reconnect_real_battery(self)
1684    }
1685
1686    /// Sets Present Voltage in mV. This should be called after
1687    /// DisconnectRealBattery
1688    pub fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
1689        BatterySimulatorControllerProxyInterface::r#set_present_voltage_mv(self, voltage)
1690    }
1691
1692    /// Sets Remaining Capacity Uah. This should be called after
1693    /// DisconnectRealBattery
1694    pub fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
1695        BatterySimulatorControllerProxyInterface::r#set_remaining_capacity_uah(self, capacity)
1696    }
1697
1698    /// Sets the BatterySpec
1699    pub fn r#set_battery_spec(
1700        &self,
1701        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
1702    ) -> Result<(), fidl::Error> {
1703        BatterySimulatorControllerProxyInterface::r#set_battery_spec(self, spec)
1704    }
1705}
1706
1707impl BatterySimulatorControllerProxyInterface for BatterySimulatorControllerProxy {
1708    type GetBatteryInfoResponseFut = fidl::client::QueryResponseFut<
1709        fidl_fuchsia_power_battery::BatteryInfo,
1710        fidl::encoding::DefaultFuchsiaResourceDialect,
1711    >;
1712    fn r#get_battery_info(&self) -> Self::GetBatteryInfoResponseFut {
1713        fn _decode(
1714            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1715        ) -> Result<fidl_fuchsia_power_battery::BatteryInfo, fidl::Error> {
1716            let _response = fidl::client::decode_transaction_body::<
1717                BatterySimulatorControllerGetBatteryInfoResponse,
1718                fidl::encoding::DefaultFuchsiaResourceDialect,
1719                0x4a20d3731366aaf8,
1720            >(_buf?)?;
1721            Ok(_response.info)
1722        }
1723        self.client.send_query_and_decode::<
1724            fidl::encoding::EmptyPayload,
1725            fidl_fuchsia_power_battery::BatteryInfo,
1726        >(
1727            (),
1728            0x4a20d3731366aaf8,
1729            fidl::encoding::DynamicFlags::empty(),
1730            _decode,
1731        )
1732    }
1733
1734    fn r#set_battery_status(
1735        &self,
1736        mut battery_status: fidl_fuchsia_power_battery::BatteryStatus,
1737    ) -> Result<(), fidl::Error> {
1738        self.client.send::<BatterySimulatorControllerSetBatteryStatusRequest>(
1739            (battery_status,),
1740            0x2343eb65038c8b34,
1741            fidl::encoding::DynamicFlags::empty(),
1742        )
1743    }
1744
1745    fn r#set_charge_status(
1746        &self,
1747        mut charge_status: fidl_fuchsia_power_battery::ChargeStatus,
1748    ) -> Result<(), fidl::Error> {
1749        self.client.send::<BatterySimulatorControllerSetChargeStatusRequest>(
1750            (charge_status,),
1751            0x79b2bf1a387acd85,
1752            fidl::encoding::DynamicFlags::empty(),
1753        )
1754    }
1755
1756    fn r#set_charge_source(
1757        &self,
1758        mut charge_source: fidl_fuchsia_power_battery::ChargeSource,
1759    ) -> Result<(), fidl::Error> {
1760        self.client.send::<BatterySimulatorControllerSetChargeSourceRequest>(
1761            (charge_source,),
1762            0xb40433f42c33527,
1763            fidl::encoding::DynamicFlags::empty(),
1764        )
1765    }
1766
1767    fn r#set_battery_percentage(&self, mut percent: f32) -> Result<(), fidl::Error> {
1768        self.client.send::<BatterySimulatorControllerSetBatteryPercentageRequest>(
1769            (percent,),
1770            0x64a9d96eb7a45a9f,
1771            fidl::encoding::DynamicFlags::empty(),
1772        )
1773    }
1774
1775    fn r#set_level_status(
1776        &self,
1777        mut level_status: fidl_fuchsia_power_battery::LevelStatus,
1778    ) -> Result<(), fidl::Error> {
1779        self.client.send::<BatterySimulatorControllerSetLevelStatusRequest>(
1780            (level_status,),
1781            0x577fc3314f7a48a4,
1782            fidl::encoding::DynamicFlags::empty(),
1783        )
1784    }
1785
1786    fn r#set_time_remaining(&self, mut duration: i64) -> Result<(), fidl::Error> {
1787        self.client.send::<BatterySimulatorControllerSetTimeRemainingRequest>(
1788            (duration,),
1789            0x7427251c9d2a794e,
1790            fidl::encoding::DynamicFlags::empty(),
1791        )
1792    }
1793
1794    fn r#disconnect_real_battery(&self) -> Result<(), fidl::Error> {
1795        self.client.send::<fidl::encoding::EmptyPayload>(
1796            (),
1797            0x75588eae6b9b67e3,
1798            fidl::encoding::DynamicFlags::empty(),
1799        )
1800    }
1801
1802    type IsSimulatingResponseFut =
1803        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1804    fn r#is_simulating(&self) -> Self::IsSimulatingResponseFut {
1805        fn _decode(
1806            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1807        ) -> Result<bool, fidl::Error> {
1808            let _response = fidl::client::decode_transaction_body::<
1809                BatterySimulatorControllerIsSimulatingResponse,
1810                fidl::encoding::DefaultFuchsiaResourceDialect,
1811                0x4bf85cfe3476975d,
1812            >(_buf?)?;
1813            Ok(_response.simulation_state)
1814        }
1815        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
1816            (),
1817            0x4bf85cfe3476975d,
1818            fidl::encoding::DynamicFlags::empty(),
1819            _decode,
1820        )
1821    }
1822
1823    fn r#reconnect_real_battery(&self) -> Result<(), fidl::Error> {
1824        self.client.send::<fidl::encoding::EmptyPayload>(
1825            (),
1826            0x18306690352d9dfa,
1827            fidl::encoding::DynamicFlags::empty(),
1828        )
1829    }
1830
1831    fn r#set_present_voltage_mv(&self, mut voltage: u32) -> Result<(), fidl::Error> {
1832        self.client.send::<BatterySimulatorControllerSetPresentVoltageMvRequest>(
1833            (voltage,),
1834            0x5462c9e9f947b8ce,
1835            fidl::encoding::DynamicFlags::empty(),
1836        )
1837    }
1838
1839    fn r#set_remaining_capacity_uah(&self, mut capacity: u32) -> Result<(), fidl::Error> {
1840        self.client.send::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
1841            (capacity,),
1842            0x38054049fe8c26ab,
1843            fidl::encoding::DynamicFlags::empty(),
1844        )
1845    }
1846
1847    fn r#set_battery_spec(
1848        &self,
1849        mut spec: &fidl_fuchsia_power_battery::BatterySpec,
1850    ) -> Result<(), fidl::Error> {
1851        self.client.send::<BatterySimulatorControllerSetBatterySpecRequest>(
1852            (spec,),
1853            0x7324672546976583,
1854            fidl::encoding::DynamicFlags::empty(),
1855        )
1856    }
1857}
1858
1859pub struct BatterySimulatorControllerEventStream {
1860    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1861}
1862
1863impl std::marker::Unpin for BatterySimulatorControllerEventStream {}
1864
1865impl futures::stream::FusedStream for BatterySimulatorControllerEventStream {
1866    fn is_terminated(&self) -> bool {
1867        self.event_receiver.is_terminated()
1868    }
1869}
1870
1871impl futures::Stream for BatterySimulatorControllerEventStream {
1872    type Item = Result<BatterySimulatorControllerEvent, fidl::Error>;
1873
1874    fn poll_next(
1875        mut self: std::pin::Pin<&mut Self>,
1876        cx: &mut std::task::Context<'_>,
1877    ) -> std::task::Poll<Option<Self::Item>> {
1878        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1879            &mut self.event_receiver,
1880            cx
1881        )?) {
1882            Some(buf) => std::task::Poll::Ready(Some(BatterySimulatorControllerEvent::decode(buf))),
1883            None => std::task::Poll::Ready(None),
1884        }
1885    }
1886}
1887
1888#[derive(Debug)]
1889pub enum BatterySimulatorControllerEvent {}
1890
1891impl BatterySimulatorControllerEvent {
1892    /// Decodes a message buffer as a [`BatterySimulatorControllerEvent`].
1893    fn decode(
1894        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1895    ) -> Result<BatterySimulatorControllerEvent, fidl::Error> {
1896        let (bytes, _handles) = buf.split_mut();
1897        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1898        debug_assert_eq!(tx_header.tx_id, 0);
1899        match tx_header.ordinal {
1900            _ => Err(fidl::Error::UnknownOrdinal {
1901                ordinal: tx_header.ordinal,
1902                protocol_name: <BatterySimulatorControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1903            })
1904        }
1905    }
1906}
1907
1908/// A Stream of incoming requests for fuchsia.power.battery.test/BatterySimulatorController.
1909pub struct BatterySimulatorControllerRequestStream {
1910    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1911    is_terminated: bool,
1912}
1913
1914impl std::marker::Unpin for BatterySimulatorControllerRequestStream {}
1915
1916impl futures::stream::FusedStream for BatterySimulatorControllerRequestStream {
1917    fn is_terminated(&self) -> bool {
1918        self.is_terminated
1919    }
1920}
1921
1922impl fidl::endpoints::RequestStream for BatterySimulatorControllerRequestStream {
1923    type Protocol = BatterySimulatorControllerMarker;
1924    type ControlHandle = BatterySimulatorControllerControlHandle;
1925
1926    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1927        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1928    }
1929
1930    fn control_handle(&self) -> Self::ControlHandle {
1931        BatterySimulatorControllerControlHandle { inner: self.inner.clone() }
1932    }
1933
1934    fn into_inner(
1935        self,
1936    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1937    {
1938        (self.inner, self.is_terminated)
1939    }
1940
1941    fn from_inner(
1942        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1943        is_terminated: bool,
1944    ) -> Self {
1945        Self { inner, is_terminated }
1946    }
1947}
1948
1949impl futures::Stream for BatterySimulatorControllerRequestStream {
1950    type Item = Result<BatterySimulatorControllerRequest, fidl::Error>;
1951
1952    fn poll_next(
1953        mut self: std::pin::Pin<&mut Self>,
1954        cx: &mut std::task::Context<'_>,
1955    ) -> std::task::Poll<Option<Self::Item>> {
1956        let this = &mut *self;
1957        if this.inner.check_shutdown(cx) {
1958            this.is_terminated = true;
1959            return std::task::Poll::Ready(None);
1960        }
1961        if this.is_terminated {
1962            panic!("polled BatterySimulatorControllerRequestStream after completion");
1963        }
1964        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1965            |bytes, handles| {
1966                match this.inner.channel().read_etc(cx, bytes, handles) {
1967                    std::task::Poll::Ready(Ok(())) => {}
1968                    std::task::Poll::Pending => return std::task::Poll::Pending,
1969                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1970                        this.is_terminated = true;
1971                        return std::task::Poll::Ready(None);
1972                    }
1973                    std::task::Poll::Ready(Err(e)) => {
1974                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1975                            e.into(),
1976                        ))))
1977                    }
1978                }
1979
1980                // A message has been received from the channel
1981                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1982
1983                std::task::Poll::Ready(Some(match header.ordinal {
1984                0x4a20d3731366aaf8 => {
1985                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1986                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1987                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1988                    let control_handle = BatterySimulatorControllerControlHandle {
1989                        inner: this.inner.clone(),
1990                    };
1991                    Ok(BatterySimulatorControllerRequest::GetBatteryInfo {
1992                        responder: BatterySimulatorControllerGetBatteryInfoResponder {
1993                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1994                            tx_id: header.tx_id,
1995                        },
1996                    })
1997                }
1998                0x2343eb65038c8b34 => {
1999                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2000                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetBatteryStatusRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2001                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatteryStatusRequest>(&header, _body_bytes, handles, &mut req)?;
2002                    let control_handle = BatterySimulatorControllerControlHandle {
2003                        inner: this.inner.clone(),
2004                    };
2005                    Ok(BatterySimulatorControllerRequest::SetBatteryStatus {battery_status: req.battery_status,
2006
2007                        control_handle,
2008                    })
2009                }
2010                0x79b2bf1a387acd85 => {
2011                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2012                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetChargeStatusRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2013                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetChargeStatusRequest>(&header, _body_bytes, handles, &mut req)?;
2014                    let control_handle = BatterySimulatorControllerControlHandle {
2015                        inner: this.inner.clone(),
2016                    };
2017                    Ok(BatterySimulatorControllerRequest::SetChargeStatus {charge_status: req.charge_status,
2018
2019                        control_handle,
2020                    })
2021                }
2022                0xb40433f42c33527 => {
2023                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2024                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetChargeSourceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2025                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetChargeSourceRequest>(&header, _body_bytes, handles, &mut req)?;
2026                    let control_handle = BatterySimulatorControllerControlHandle {
2027                        inner: this.inner.clone(),
2028                    };
2029                    Ok(BatterySimulatorControllerRequest::SetChargeSource {charge_source: req.charge_source,
2030
2031                        control_handle,
2032                    })
2033                }
2034                0x64a9d96eb7a45a9f => {
2035                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2036                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetBatteryPercentageRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2037                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatteryPercentageRequest>(&header, _body_bytes, handles, &mut req)?;
2038                    let control_handle = BatterySimulatorControllerControlHandle {
2039                        inner: this.inner.clone(),
2040                    };
2041                    Ok(BatterySimulatorControllerRequest::SetBatteryPercentage {percent: req.percent,
2042
2043                        control_handle,
2044                    })
2045                }
2046                0x577fc3314f7a48a4 => {
2047                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2048                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetLevelStatusRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2049                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetLevelStatusRequest>(&header, _body_bytes, handles, &mut req)?;
2050                    let control_handle = BatterySimulatorControllerControlHandle {
2051                        inner: this.inner.clone(),
2052                    };
2053                    Ok(BatterySimulatorControllerRequest::SetLevelStatus {level_status: req.level_status,
2054
2055                        control_handle,
2056                    })
2057                }
2058                0x7427251c9d2a794e => {
2059                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2060                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetTimeRemainingRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2061                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetTimeRemainingRequest>(&header, _body_bytes, handles, &mut req)?;
2062                    let control_handle = BatterySimulatorControllerControlHandle {
2063                        inner: this.inner.clone(),
2064                    };
2065                    Ok(BatterySimulatorControllerRequest::SetTimeRemaining {duration: req.duration,
2066
2067                        control_handle,
2068                    })
2069                }
2070                0x75588eae6b9b67e3 => {
2071                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2072                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2073                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2074                    let control_handle = BatterySimulatorControllerControlHandle {
2075                        inner: this.inner.clone(),
2076                    };
2077                    Ok(BatterySimulatorControllerRequest::DisconnectRealBattery {
2078                        control_handle,
2079                    })
2080                }
2081                0x4bf85cfe3476975d => {
2082                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2083                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2084                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2085                    let control_handle = BatterySimulatorControllerControlHandle {
2086                        inner: this.inner.clone(),
2087                    };
2088                    Ok(BatterySimulatorControllerRequest::IsSimulating {
2089                        responder: BatterySimulatorControllerIsSimulatingResponder {
2090                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2091                            tx_id: header.tx_id,
2092                        },
2093                    })
2094                }
2095                0x18306690352d9dfa => {
2096                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2097                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2098                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2099                    let control_handle = BatterySimulatorControllerControlHandle {
2100                        inner: this.inner.clone(),
2101                    };
2102                    Ok(BatterySimulatorControllerRequest::ReconnectRealBattery {
2103                        control_handle,
2104                    })
2105                }
2106                0x5462c9e9f947b8ce => {
2107                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2108                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetPresentVoltageMvRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2109                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetPresentVoltageMvRequest>(&header, _body_bytes, handles, &mut req)?;
2110                    let control_handle = BatterySimulatorControllerControlHandle {
2111                        inner: this.inner.clone(),
2112                    };
2113                    Ok(BatterySimulatorControllerRequest::SetPresentVoltageMv {voltage: req.voltage,
2114
2115                        control_handle,
2116                    })
2117                }
2118                0x38054049fe8c26ab => {
2119                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2120                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetRemainingCapacityUahRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2121                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(&header, _body_bytes, handles, &mut req)?;
2122                    let control_handle = BatterySimulatorControllerControlHandle {
2123                        inner: this.inner.clone(),
2124                    };
2125                    Ok(BatterySimulatorControllerRequest::SetRemainingCapacityUah {capacity: req.capacity,
2126
2127                        control_handle,
2128                    })
2129                }
2130                0x7324672546976583 => {
2131                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2132                    let mut req = fidl::new_empty!(BatterySimulatorControllerSetBatterySpecRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2133                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BatterySimulatorControllerSetBatterySpecRequest>(&header, _body_bytes, handles, &mut req)?;
2134                    let control_handle = BatterySimulatorControllerControlHandle {
2135                        inner: this.inner.clone(),
2136                    };
2137                    Ok(BatterySimulatorControllerRequest::SetBatterySpec {spec: req.spec,
2138
2139                        control_handle,
2140                    })
2141                }
2142                _ => Err(fidl::Error::UnknownOrdinal {
2143                    ordinal: header.ordinal,
2144                    protocol_name: <BatterySimulatorControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2145                }),
2146            }))
2147            },
2148        )
2149    }
2150}
2151
2152/// Controller interface to allow modification of battery state.
2153#[derive(Debug)]
2154pub enum BatterySimulatorControllerRequest {
2155    /// Gets battery info. This should be called after
2156    /// DisconnectRealBattery
2157    GetBatteryInfo { responder: BatterySimulatorControllerGetBatteryInfoResponder },
2158    /// Sets Battery Status. This should be called after
2159    /// DisconnectRealBattery
2160    SetBatteryStatus {
2161        battery_status: fidl_fuchsia_power_battery::BatteryStatus,
2162        control_handle: BatterySimulatorControllerControlHandle,
2163    },
2164    /// Sets Charge Status. This should be called after
2165    /// DisconnectRealBattery
2166    SetChargeStatus {
2167        charge_status: fidl_fuchsia_power_battery::ChargeStatus,
2168        control_handle: BatterySimulatorControllerControlHandle,
2169    },
2170    /// Sets Charge Source. This should be called after
2171    /// DisconnectRealBattery
2172    SetChargeSource {
2173        charge_source: fidl_fuchsia_power_battery::ChargeSource,
2174        control_handle: BatterySimulatorControllerControlHandle,
2175    },
2176    /// Sets Battery Percentage. This should be called after
2177    /// DisconnectRealBattery
2178    SetBatteryPercentage { percent: f32, control_handle: BatterySimulatorControllerControlHandle },
2179    /// Sets Level Status. This should be called after
2180    /// DisconnectRealBattery
2181    SetLevelStatus {
2182        level_status: fidl_fuchsia_power_battery::LevelStatus,
2183        control_handle: BatterySimulatorControllerControlHandle,
2184    },
2185    /// Sets Time Remaining to full charge / depletion
2186    /// This should be called after DisconnectRealBattery
2187    SetTimeRemaining { duration: i64, control_handle: BatterySimulatorControllerControlHandle },
2188    /// Disconnect the real battery connection
2189    DisconnectRealBattery { control_handle: BatterySimulatorControllerControlHandle },
2190    /// Gets Simulation State
2191    IsSimulating { responder: BatterySimulatorControllerIsSimulatingResponder },
2192    /// Reconnect to the real battery
2193    /// This should be called after DisconnectRealBattery
2194    ReconnectRealBattery { control_handle: BatterySimulatorControllerControlHandle },
2195    /// Sets Present Voltage in mV. This should be called after
2196    /// DisconnectRealBattery
2197    SetPresentVoltageMv { voltage: u32, control_handle: BatterySimulatorControllerControlHandle },
2198    /// Sets Remaining Capacity Uah. This should be called after
2199    /// DisconnectRealBattery
2200    SetRemainingCapacityUah {
2201        capacity: u32,
2202        control_handle: BatterySimulatorControllerControlHandle,
2203    },
2204    /// Sets the BatterySpec
2205    SetBatterySpec {
2206        spec: fidl_fuchsia_power_battery::BatterySpec,
2207        control_handle: BatterySimulatorControllerControlHandle,
2208    },
2209}
2210
2211impl BatterySimulatorControllerRequest {
2212    #[allow(irrefutable_let_patterns)]
2213    pub fn into_get_battery_info(
2214        self,
2215    ) -> Option<(BatterySimulatorControllerGetBatteryInfoResponder)> {
2216        if let BatterySimulatorControllerRequest::GetBatteryInfo { responder } = self {
2217            Some((responder))
2218        } else {
2219            None
2220        }
2221    }
2222
2223    #[allow(irrefutable_let_patterns)]
2224    pub fn into_set_battery_status(
2225        self,
2226    ) -> Option<(fidl_fuchsia_power_battery::BatteryStatus, BatterySimulatorControllerControlHandle)>
2227    {
2228        if let BatterySimulatorControllerRequest::SetBatteryStatus {
2229            battery_status,
2230            control_handle,
2231        } = self
2232        {
2233            Some((battery_status, control_handle))
2234        } else {
2235            None
2236        }
2237    }
2238
2239    #[allow(irrefutable_let_patterns)]
2240    pub fn into_set_charge_status(
2241        self,
2242    ) -> Option<(fidl_fuchsia_power_battery::ChargeStatus, BatterySimulatorControllerControlHandle)>
2243    {
2244        if let BatterySimulatorControllerRequest::SetChargeStatus {
2245            charge_status,
2246            control_handle,
2247        } = self
2248        {
2249            Some((charge_status, control_handle))
2250        } else {
2251            None
2252        }
2253    }
2254
2255    #[allow(irrefutable_let_patterns)]
2256    pub fn into_set_charge_source(
2257        self,
2258    ) -> Option<(fidl_fuchsia_power_battery::ChargeSource, BatterySimulatorControllerControlHandle)>
2259    {
2260        if let BatterySimulatorControllerRequest::SetChargeSource {
2261            charge_source,
2262            control_handle,
2263        } = self
2264        {
2265            Some((charge_source, control_handle))
2266        } else {
2267            None
2268        }
2269    }
2270
2271    #[allow(irrefutable_let_patterns)]
2272    pub fn into_set_battery_percentage(
2273        self,
2274    ) -> Option<(f32, BatterySimulatorControllerControlHandle)> {
2275        if let BatterySimulatorControllerRequest::SetBatteryPercentage { percent, control_handle } =
2276            self
2277        {
2278            Some((percent, control_handle))
2279        } else {
2280            None
2281        }
2282    }
2283
2284    #[allow(irrefutable_let_patterns)]
2285    pub fn into_set_level_status(
2286        self,
2287    ) -> Option<(fidl_fuchsia_power_battery::LevelStatus, BatterySimulatorControllerControlHandle)>
2288    {
2289        if let BatterySimulatorControllerRequest::SetLevelStatus { level_status, control_handle } =
2290            self
2291        {
2292            Some((level_status, control_handle))
2293        } else {
2294            None
2295        }
2296    }
2297
2298    #[allow(irrefutable_let_patterns)]
2299    pub fn into_set_time_remaining(self) -> Option<(i64, BatterySimulatorControllerControlHandle)> {
2300        if let BatterySimulatorControllerRequest::SetTimeRemaining { duration, control_handle } =
2301            self
2302        {
2303            Some((duration, control_handle))
2304        } else {
2305            None
2306        }
2307    }
2308
2309    #[allow(irrefutable_let_patterns)]
2310    pub fn into_disconnect_real_battery(self) -> Option<(BatterySimulatorControllerControlHandle)> {
2311        if let BatterySimulatorControllerRequest::DisconnectRealBattery { control_handle } = self {
2312            Some((control_handle))
2313        } else {
2314            None
2315        }
2316    }
2317
2318    #[allow(irrefutable_let_patterns)]
2319    pub fn into_is_simulating(self) -> Option<(BatterySimulatorControllerIsSimulatingResponder)> {
2320        if let BatterySimulatorControllerRequest::IsSimulating { responder } = self {
2321            Some((responder))
2322        } else {
2323            None
2324        }
2325    }
2326
2327    #[allow(irrefutable_let_patterns)]
2328    pub fn into_reconnect_real_battery(self) -> Option<(BatterySimulatorControllerControlHandle)> {
2329        if let BatterySimulatorControllerRequest::ReconnectRealBattery { control_handle } = self {
2330            Some((control_handle))
2331        } else {
2332            None
2333        }
2334    }
2335
2336    #[allow(irrefutable_let_patterns)]
2337    pub fn into_set_present_voltage_mv(
2338        self,
2339    ) -> Option<(u32, BatterySimulatorControllerControlHandle)> {
2340        if let BatterySimulatorControllerRequest::SetPresentVoltageMv { voltage, control_handle } =
2341            self
2342        {
2343            Some((voltage, control_handle))
2344        } else {
2345            None
2346        }
2347    }
2348
2349    #[allow(irrefutable_let_patterns)]
2350    pub fn into_set_remaining_capacity_uah(
2351        self,
2352    ) -> Option<(u32, BatterySimulatorControllerControlHandle)> {
2353        if let BatterySimulatorControllerRequest::SetRemainingCapacityUah {
2354            capacity,
2355            control_handle,
2356        } = self
2357        {
2358            Some((capacity, control_handle))
2359        } else {
2360            None
2361        }
2362    }
2363
2364    #[allow(irrefutable_let_patterns)]
2365    pub fn into_set_battery_spec(
2366        self,
2367    ) -> Option<(fidl_fuchsia_power_battery::BatterySpec, BatterySimulatorControllerControlHandle)>
2368    {
2369        if let BatterySimulatorControllerRequest::SetBatterySpec { spec, control_handle } = self {
2370            Some((spec, control_handle))
2371        } else {
2372            None
2373        }
2374    }
2375
2376    /// Name of the method defined in FIDL
2377    pub fn method_name(&self) -> &'static str {
2378        match *self {
2379            BatterySimulatorControllerRequest::GetBatteryInfo { .. } => "get_battery_info",
2380            BatterySimulatorControllerRequest::SetBatteryStatus { .. } => "set_battery_status",
2381            BatterySimulatorControllerRequest::SetChargeStatus { .. } => "set_charge_status",
2382            BatterySimulatorControllerRequest::SetChargeSource { .. } => "set_charge_source",
2383            BatterySimulatorControllerRequest::SetBatteryPercentage { .. } => {
2384                "set_battery_percentage"
2385            }
2386            BatterySimulatorControllerRequest::SetLevelStatus { .. } => "set_level_status",
2387            BatterySimulatorControllerRequest::SetTimeRemaining { .. } => "set_time_remaining",
2388            BatterySimulatorControllerRequest::DisconnectRealBattery { .. } => {
2389                "disconnect_real_battery"
2390            }
2391            BatterySimulatorControllerRequest::IsSimulating { .. } => "is_simulating",
2392            BatterySimulatorControllerRequest::ReconnectRealBattery { .. } => {
2393                "reconnect_real_battery"
2394            }
2395            BatterySimulatorControllerRequest::SetPresentVoltageMv { .. } => {
2396                "set_present_voltage_mv"
2397            }
2398            BatterySimulatorControllerRequest::SetRemainingCapacityUah { .. } => {
2399                "set_remaining_capacity_uah"
2400            }
2401            BatterySimulatorControllerRequest::SetBatterySpec { .. } => "set_battery_spec",
2402        }
2403    }
2404}
2405
2406#[derive(Debug, Clone)]
2407pub struct BatterySimulatorControllerControlHandle {
2408    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2409}
2410
2411impl fidl::endpoints::ControlHandle for BatterySimulatorControllerControlHandle {
2412    fn shutdown(&self) {
2413        self.inner.shutdown()
2414    }
2415    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2416        self.inner.shutdown_with_epitaph(status)
2417    }
2418
2419    fn is_closed(&self) -> bool {
2420        self.inner.channel().is_closed()
2421    }
2422    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2423        self.inner.channel().on_closed()
2424    }
2425
2426    #[cfg(target_os = "fuchsia")]
2427    fn signal_peer(
2428        &self,
2429        clear_mask: zx::Signals,
2430        set_mask: zx::Signals,
2431    ) -> Result<(), zx_status::Status> {
2432        use fidl::Peered;
2433        self.inner.channel().signal_peer(clear_mask, set_mask)
2434    }
2435}
2436
2437impl BatterySimulatorControllerControlHandle {}
2438
2439#[must_use = "FIDL methods require a response to be sent"]
2440#[derive(Debug)]
2441pub struct BatterySimulatorControllerGetBatteryInfoResponder {
2442    control_handle: std::mem::ManuallyDrop<BatterySimulatorControllerControlHandle>,
2443    tx_id: u32,
2444}
2445
2446/// Set the the channel to be shutdown (see [`BatterySimulatorControllerControlHandle::shutdown`])
2447/// if the responder is dropped without sending a response, so that the client
2448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2449impl std::ops::Drop for BatterySimulatorControllerGetBatteryInfoResponder {
2450    fn drop(&mut self) {
2451        self.control_handle.shutdown();
2452        // Safety: drops once, never accessed again
2453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2454    }
2455}
2456
2457impl fidl::endpoints::Responder for BatterySimulatorControllerGetBatteryInfoResponder {
2458    type ControlHandle = BatterySimulatorControllerControlHandle;
2459
2460    fn control_handle(&self) -> &BatterySimulatorControllerControlHandle {
2461        &self.control_handle
2462    }
2463
2464    fn drop_without_shutdown(mut self) {
2465        // Safety: drops once, never accessed again due to mem::forget
2466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2467        // Prevent Drop from running (which would shut down the channel)
2468        std::mem::forget(self);
2469    }
2470}
2471
2472impl BatterySimulatorControllerGetBatteryInfoResponder {
2473    /// Sends a response to the FIDL transaction.
2474    ///
2475    /// Sets the channel to shutdown if an error occurs.
2476    pub fn send(
2477        self,
2478        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
2479    ) -> Result<(), fidl::Error> {
2480        let _result = self.send_raw(info);
2481        if _result.is_err() {
2482            self.control_handle.shutdown();
2483        }
2484        self.drop_without_shutdown();
2485        _result
2486    }
2487
2488    /// Similar to "send" but does not shutdown the channel if an error occurs.
2489    pub fn send_no_shutdown_on_err(
2490        self,
2491        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
2492    ) -> Result<(), fidl::Error> {
2493        let _result = self.send_raw(info);
2494        self.drop_without_shutdown();
2495        _result
2496    }
2497
2498    fn send_raw(
2499        &self,
2500        mut info: &fidl_fuchsia_power_battery::BatteryInfo,
2501    ) -> Result<(), fidl::Error> {
2502        self.control_handle.inner.send::<BatterySimulatorControllerGetBatteryInfoResponse>(
2503            (info,),
2504            self.tx_id,
2505            0x4a20d3731366aaf8,
2506            fidl::encoding::DynamicFlags::empty(),
2507        )
2508    }
2509}
2510
2511#[must_use = "FIDL methods require a response to be sent"]
2512#[derive(Debug)]
2513pub struct BatterySimulatorControllerIsSimulatingResponder {
2514    control_handle: std::mem::ManuallyDrop<BatterySimulatorControllerControlHandle>,
2515    tx_id: u32,
2516}
2517
2518/// Set the the channel to be shutdown (see [`BatterySimulatorControllerControlHandle::shutdown`])
2519/// if the responder is dropped without sending a response, so that the client
2520/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2521impl std::ops::Drop for BatterySimulatorControllerIsSimulatingResponder {
2522    fn drop(&mut self) {
2523        self.control_handle.shutdown();
2524        // Safety: drops once, never accessed again
2525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2526    }
2527}
2528
2529impl fidl::endpoints::Responder for BatterySimulatorControllerIsSimulatingResponder {
2530    type ControlHandle = BatterySimulatorControllerControlHandle;
2531
2532    fn control_handle(&self) -> &BatterySimulatorControllerControlHandle {
2533        &self.control_handle
2534    }
2535
2536    fn drop_without_shutdown(mut self) {
2537        // Safety: drops once, never accessed again due to mem::forget
2538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2539        // Prevent Drop from running (which would shut down the channel)
2540        std::mem::forget(self);
2541    }
2542}
2543
2544impl BatterySimulatorControllerIsSimulatingResponder {
2545    /// Sends a response to the FIDL transaction.
2546    ///
2547    /// Sets the channel to shutdown if an error occurs.
2548    pub fn send(self, mut simulation_state: bool) -> Result<(), fidl::Error> {
2549        let _result = self.send_raw(simulation_state);
2550        if _result.is_err() {
2551            self.control_handle.shutdown();
2552        }
2553        self.drop_without_shutdown();
2554        _result
2555    }
2556
2557    /// Similar to "send" but does not shutdown the channel if an error occurs.
2558    pub fn send_no_shutdown_on_err(self, mut simulation_state: bool) -> Result<(), fidl::Error> {
2559        let _result = self.send_raw(simulation_state);
2560        self.drop_without_shutdown();
2561        _result
2562    }
2563
2564    fn send_raw(&self, mut simulation_state: bool) -> Result<(), fidl::Error> {
2565        self.control_handle.inner.send::<BatterySimulatorControllerIsSimulatingResponse>(
2566            (simulation_state,),
2567            self.tx_id,
2568            0x4bf85cfe3476975d,
2569            fidl::encoding::DynamicFlags::empty(),
2570        )
2571    }
2572}
2573
2574mod internal {
2575    use super::*;
2576
2577    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerGetBatteryInfoResponse {
2578        type Borrowed<'a> = &'a Self;
2579        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2580            value
2581        }
2582    }
2583
2584    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerGetBatteryInfoResponse {
2585        type Owned = Self;
2586
2587        #[inline(always)]
2588        fn inline_align(_context: fidl::encoding::Context) -> usize {
2589            8
2590        }
2591
2592        #[inline(always)]
2593        fn inline_size(_context: fidl::encoding::Context) -> usize {
2594            16
2595        }
2596    }
2597
2598    unsafe impl<D: fidl::encoding::ResourceDialect>
2599        fidl::encoding::Encode<BatterySimulatorControllerGetBatteryInfoResponse, D>
2600        for &BatterySimulatorControllerGetBatteryInfoResponse
2601    {
2602        #[inline]
2603        unsafe fn encode(
2604            self,
2605            encoder: &mut fidl::encoding::Encoder<'_, D>,
2606            offset: usize,
2607            _depth: fidl::encoding::Depth,
2608        ) -> fidl::Result<()> {
2609            encoder.debug_check_bounds::<BatterySimulatorControllerGetBatteryInfoResponse>(offset);
2610            // Delegate to tuple encoding.
2611            fidl::encoding::Encode::<BatterySimulatorControllerGetBatteryInfoResponse, D>::encode(
2612                (
2613                    <fidl_fuchsia_power_battery::BatteryInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
2614                ),
2615                encoder, offset, _depth
2616            )
2617        }
2618    }
2619    unsafe impl<
2620            D: fidl::encoding::ResourceDialect,
2621            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::BatteryInfo, D>,
2622        > fidl::encoding::Encode<BatterySimulatorControllerGetBatteryInfoResponse, D> for (T0,)
2623    {
2624        #[inline]
2625        unsafe fn encode(
2626            self,
2627            encoder: &mut fidl::encoding::Encoder<'_, D>,
2628            offset: usize,
2629            depth: fidl::encoding::Depth,
2630        ) -> fidl::Result<()> {
2631            encoder.debug_check_bounds::<BatterySimulatorControllerGetBatteryInfoResponse>(offset);
2632            // Zero out padding regions. There's no need to apply masks
2633            // because the unmasked parts will be overwritten by fields.
2634            // Write the fields.
2635            self.0.encode(encoder, offset + 0, depth)?;
2636            Ok(())
2637        }
2638    }
2639
2640    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2641        for BatterySimulatorControllerGetBatteryInfoResponse
2642    {
2643        #[inline(always)]
2644        fn new_empty() -> Self {
2645            Self { info: fidl::new_empty!(fidl_fuchsia_power_battery::BatteryInfo, D) }
2646        }
2647
2648        #[inline]
2649        unsafe fn decode(
2650            &mut self,
2651            decoder: &mut fidl::encoding::Decoder<'_, D>,
2652            offset: usize,
2653            _depth: fidl::encoding::Depth,
2654        ) -> fidl::Result<()> {
2655            decoder.debug_check_bounds::<Self>(offset);
2656            // Verify that padding bytes are zero.
2657            fidl::decode!(
2658                fidl_fuchsia_power_battery::BatteryInfo,
2659                D,
2660                &mut self.info,
2661                decoder,
2662                offset + 0,
2663                _depth
2664            )?;
2665            Ok(())
2666        }
2667    }
2668
2669    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerIsSimulatingResponse {
2670        type Borrowed<'a> = &'a Self;
2671        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2672            value
2673        }
2674    }
2675
2676    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerIsSimulatingResponse {
2677        type Owned = Self;
2678
2679        #[inline(always)]
2680        fn inline_align(_context: fidl::encoding::Context) -> usize {
2681            1
2682        }
2683
2684        #[inline(always)]
2685        fn inline_size(_context: fidl::encoding::Context) -> usize {
2686            1
2687        }
2688    }
2689
2690    unsafe impl<D: fidl::encoding::ResourceDialect>
2691        fidl::encoding::Encode<BatterySimulatorControllerIsSimulatingResponse, D>
2692        for &BatterySimulatorControllerIsSimulatingResponse
2693    {
2694        #[inline]
2695        unsafe fn encode(
2696            self,
2697            encoder: &mut fidl::encoding::Encoder<'_, D>,
2698            offset: usize,
2699            _depth: fidl::encoding::Depth,
2700        ) -> fidl::Result<()> {
2701            encoder.debug_check_bounds::<BatterySimulatorControllerIsSimulatingResponse>(offset);
2702            // Delegate to tuple encoding.
2703            fidl::encoding::Encode::<BatterySimulatorControllerIsSimulatingResponse, D>::encode(
2704                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.simulation_state),),
2705                encoder,
2706                offset,
2707                _depth,
2708            )
2709        }
2710    }
2711    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2712        fidl::encoding::Encode<BatterySimulatorControllerIsSimulatingResponse, D> for (T0,)
2713    {
2714        #[inline]
2715        unsafe fn encode(
2716            self,
2717            encoder: &mut fidl::encoding::Encoder<'_, D>,
2718            offset: usize,
2719            depth: fidl::encoding::Depth,
2720        ) -> fidl::Result<()> {
2721            encoder.debug_check_bounds::<BatterySimulatorControllerIsSimulatingResponse>(offset);
2722            // Zero out padding regions. There's no need to apply masks
2723            // because the unmasked parts will be overwritten by fields.
2724            // Write the fields.
2725            self.0.encode(encoder, offset + 0, depth)?;
2726            Ok(())
2727        }
2728    }
2729
2730    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2731        for BatterySimulatorControllerIsSimulatingResponse
2732    {
2733        #[inline(always)]
2734        fn new_empty() -> Self {
2735            Self { simulation_state: fidl::new_empty!(bool, D) }
2736        }
2737
2738        #[inline]
2739        unsafe fn decode(
2740            &mut self,
2741            decoder: &mut fidl::encoding::Decoder<'_, D>,
2742            offset: usize,
2743            _depth: fidl::encoding::Depth,
2744        ) -> fidl::Result<()> {
2745            decoder.debug_check_bounds::<Self>(offset);
2746            // Verify that padding bytes are zero.
2747            fidl::decode!(bool, D, &mut self.simulation_state, decoder, offset + 0, _depth)?;
2748            Ok(())
2749        }
2750    }
2751
2752    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatteryPercentageRequest {
2753        type Borrowed<'a> = &'a Self;
2754        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2755            value
2756        }
2757    }
2758
2759    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatteryPercentageRequest {
2760        type Owned = Self;
2761
2762        #[inline(always)]
2763        fn inline_align(_context: fidl::encoding::Context) -> usize {
2764            4
2765        }
2766
2767        #[inline(always)]
2768        fn inline_size(_context: fidl::encoding::Context) -> usize {
2769            4
2770        }
2771    }
2772
2773    unsafe impl<D: fidl::encoding::ResourceDialect>
2774        fidl::encoding::Encode<BatterySimulatorControllerSetBatteryPercentageRequest, D>
2775        for &BatterySimulatorControllerSetBatteryPercentageRequest
2776    {
2777        #[inline]
2778        unsafe fn encode(
2779            self,
2780            encoder: &mut fidl::encoding::Encoder<'_, D>,
2781            offset: usize,
2782            _depth: fidl::encoding::Depth,
2783        ) -> fidl::Result<()> {
2784            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryPercentageRequest>(
2785                offset,
2786            );
2787            // Delegate to tuple encoding.
2788            fidl::encoding::Encode::<BatterySimulatorControllerSetBatteryPercentageRequest, D>::encode(
2789                (
2790                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.percent),
2791                ),
2792                encoder, offset, _depth
2793            )
2794        }
2795    }
2796    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
2797        fidl::encoding::Encode<BatterySimulatorControllerSetBatteryPercentageRequest, D> for (T0,)
2798    {
2799        #[inline]
2800        unsafe fn encode(
2801            self,
2802            encoder: &mut fidl::encoding::Encoder<'_, D>,
2803            offset: usize,
2804            depth: fidl::encoding::Depth,
2805        ) -> fidl::Result<()> {
2806            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryPercentageRequest>(
2807                offset,
2808            );
2809            // Zero out padding regions. There's no need to apply masks
2810            // because the unmasked parts will be overwritten by fields.
2811            // Write the fields.
2812            self.0.encode(encoder, offset + 0, depth)?;
2813            Ok(())
2814        }
2815    }
2816
2817    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2818        for BatterySimulatorControllerSetBatteryPercentageRequest
2819    {
2820        #[inline(always)]
2821        fn new_empty() -> Self {
2822            Self { percent: fidl::new_empty!(f32, D) }
2823        }
2824
2825        #[inline]
2826        unsafe fn decode(
2827            &mut self,
2828            decoder: &mut fidl::encoding::Decoder<'_, D>,
2829            offset: usize,
2830            _depth: fidl::encoding::Depth,
2831        ) -> fidl::Result<()> {
2832            decoder.debug_check_bounds::<Self>(offset);
2833            // Verify that padding bytes are zero.
2834            fidl::decode!(f32, D, &mut self.percent, decoder, offset + 0, _depth)?;
2835            Ok(())
2836        }
2837    }
2838
2839    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatterySpecRequest {
2840        type Borrowed<'a> = &'a Self;
2841        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2842            value
2843        }
2844    }
2845
2846    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatterySpecRequest {
2847        type Owned = Self;
2848
2849        #[inline(always)]
2850        fn inline_align(_context: fidl::encoding::Context) -> usize {
2851            8
2852        }
2853
2854        #[inline(always)]
2855        fn inline_size(_context: fidl::encoding::Context) -> usize {
2856            16
2857        }
2858    }
2859
2860    unsafe impl<D: fidl::encoding::ResourceDialect>
2861        fidl::encoding::Encode<BatterySimulatorControllerSetBatterySpecRequest, D>
2862        for &BatterySimulatorControllerSetBatterySpecRequest
2863    {
2864        #[inline]
2865        unsafe fn encode(
2866            self,
2867            encoder: &mut fidl::encoding::Encoder<'_, D>,
2868            offset: usize,
2869            _depth: fidl::encoding::Depth,
2870        ) -> fidl::Result<()> {
2871            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatterySpecRequest>(offset);
2872            // Delegate to tuple encoding.
2873            fidl::encoding::Encode::<BatterySimulatorControllerSetBatterySpecRequest, D>::encode(
2874                (
2875                    <fidl_fuchsia_power_battery::BatterySpec as fidl::encoding::ValueTypeMarker>::borrow(&self.spec),
2876                ),
2877                encoder, offset, _depth
2878            )
2879        }
2880    }
2881    unsafe impl<
2882            D: fidl::encoding::ResourceDialect,
2883            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::BatterySpec, D>,
2884        > fidl::encoding::Encode<BatterySimulatorControllerSetBatterySpecRequest, D> for (T0,)
2885    {
2886        #[inline]
2887        unsafe fn encode(
2888            self,
2889            encoder: &mut fidl::encoding::Encoder<'_, D>,
2890            offset: usize,
2891            depth: fidl::encoding::Depth,
2892        ) -> fidl::Result<()> {
2893            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatterySpecRequest>(offset);
2894            // Zero out padding regions. There's no need to apply masks
2895            // because the unmasked parts will be overwritten by fields.
2896            // Write the fields.
2897            self.0.encode(encoder, offset + 0, depth)?;
2898            Ok(())
2899        }
2900    }
2901
2902    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2903        for BatterySimulatorControllerSetBatterySpecRequest
2904    {
2905        #[inline(always)]
2906        fn new_empty() -> Self {
2907            Self { spec: fidl::new_empty!(fidl_fuchsia_power_battery::BatterySpec, D) }
2908        }
2909
2910        #[inline]
2911        unsafe fn decode(
2912            &mut self,
2913            decoder: &mut fidl::encoding::Decoder<'_, D>,
2914            offset: usize,
2915            _depth: fidl::encoding::Depth,
2916        ) -> fidl::Result<()> {
2917            decoder.debug_check_bounds::<Self>(offset);
2918            // Verify that padding bytes are zero.
2919            fidl::decode!(
2920                fidl_fuchsia_power_battery::BatterySpec,
2921                D,
2922                &mut self.spec,
2923                decoder,
2924                offset + 0,
2925                _depth
2926            )?;
2927            Ok(())
2928        }
2929    }
2930
2931    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatteryStatusRequest {
2932        type Borrowed<'a> = &'a Self;
2933        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2934            value
2935        }
2936    }
2937
2938    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatteryStatusRequest {
2939        type Owned = Self;
2940
2941        #[inline(always)]
2942        fn inline_align(_context: fidl::encoding::Context) -> usize {
2943            4
2944        }
2945
2946        #[inline(always)]
2947        fn inline_size(_context: fidl::encoding::Context) -> usize {
2948            4
2949        }
2950    }
2951
2952    unsafe impl<D: fidl::encoding::ResourceDialect>
2953        fidl::encoding::Encode<BatterySimulatorControllerSetBatteryStatusRequest, D>
2954        for &BatterySimulatorControllerSetBatteryStatusRequest
2955    {
2956        #[inline]
2957        unsafe fn encode(
2958            self,
2959            encoder: &mut fidl::encoding::Encoder<'_, D>,
2960            offset: usize,
2961            _depth: fidl::encoding::Depth,
2962        ) -> fidl::Result<()> {
2963            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryStatusRequest>(offset);
2964            // Delegate to tuple encoding.
2965            fidl::encoding::Encode::<BatterySimulatorControllerSetBatteryStatusRequest, D>::encode(
2966                (
2967                    <fidl_fuchsia_power_battery::BatteryStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.battery_status),
2968                ),
2969                encoder, offset, _depth
2970            )
2971        }
2972    }
2973    unsafe impl<
2974            D: fidl::encoding::ResourceDialect,
2975            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::BatteryStatus, D>,
2976        > fidl::encoding::Encode<BatterySimulatorControllerSetBatteryStatusRequest, D> for (T0,)
2977    {
2978        #[inline]
2979        unsafe fn encode(
2980            self,
2981            encoder: &mut fidl::encoding::Encoder<'_, D>,
2982            offset: usize,
2983            depth: fidl::encoding::Depth,
2984        ) -> fidl::Result<()> {
2985            encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryStatusRequest>(offset);
2986            // Zero out padding regions. There's no need to apply masks
2987            // because the unmasked parts will be overwritten by fields.
2988            // Write the fields.
2989            self.0.encode(encoder, offset + 0, depth)?;
2990            Ok(())
2991        }
2992    }
2993
2994    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2995        for BatterySimulatorControllerSetBatteryStatusRequest
2996    {
2997        #[inline(always)]
2998        fn new_empty() -> Self {
2999            Self { battery_status: fidl::new_empty!(fidl_fuchsia_power_battery::BatteryStatus, D) }
3000        }
3001
3002        #[inline]
3003        unsafe fn decode(
3004            &mut self,
3005            decoder: &mut fidl::encoding::Decoder<'_, D>,
3006            offset: usize,
3007            _depth: fidl::encoding::Depth,
3008        ) -> fidl::Result<()> {
3009            decoder.debug_check_bounds::<Self>(offset);
3010            // Verify that padding bytes are zero.
3011            fidl::decode!(
3012                fidl_fuchsia_power_battery::BatteryStatus,
3013                D,
3014                &mut self.battery_status,
3015                decoder,
3016                offset + 0,
3017                _depth
3018            )?;
3019            Ok(())
3020        }
3021    }
3022
3023    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetChargeSourceRequest {
3024        type Borrowed<'a> = &'a Self;
3025        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3026            value
3027        }
3028    }
3029
3030    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetChargeSourceRequest {
3031        type Owned = Self;
3032
3033        #[inline(always)]
3034        fn inline_align(_context: fidl::encoding::Context) -> usize {
3035            4
3036        }
3037
3038        #[inline(always)]
3039        fn inline_size(_context: fidl::encoding::Context) -> usize {
3040            4
3041        }
3042    }
3043
3044    unsafe impl<D: fidl::encoding::ResourceDialect>
3045        fidl::encoding::Encode<BatterySimulatorControllerSetChargeSourceRequest, D>
3046        for &BatterySimulatorControllerSetChargeSourceRequest
3047    {
3048        #[inline]
3049        unsafe fn encode(
3050            self,
3051            encoder: &mut fidl::encoding::Encoder<'_, D>,
3052            offset: usize,
3053            _depth: fidl::encoding::Depth,
3054        ) -> fidl::Result<()> {
3055            encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeSourceRequest>(offset);
3056            // Delegate to tuple encoding.
3057            fidl::encoding::Encode::<BatterySimulatorControllerSetChargeSourceRequest, D>::encode(
3058                (
3059                    <fidl_fuchsia_power_battery::ChargeSource as fidl::encoding::ValueTypeMarker>::borrow(&self.charge_source),
3060                ),
3061                encoder, offset, _depth
3062            )
3063        }
3064    }
3065    unsafe impl<
3066            D: fidl::encoding::ResourceDialect,
3067            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::ChargeSource, D>,
3068        > fidl::encoding::Encode<BatterySimulatorControllerSetChargeSourceRequest, D> for (T0,)
3069    {
3070        #[inline]
3071        unsafe fn encode(
3072            self,
3073            encoder: &mut fidl::encoding::Encoder<'_, D>,
3074            offset: usize,
3075            depth: fidl::encoding::Depth,
3076        ) -> fidl::Result<()> {
3077            encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeSourceRequest>(offset);
3078            // Zero out padding regions. There's no need to apply masks
3079            // because the unmasked parts will be overwritten by fields.
3080            // Write the fields.
3081            self.0.encode(encoder, offset + 0, depth)?;
3082            Ok(())
3083        }
3084    }
3085
3086    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3087        for BatterySimulatorControllerSetChargeSourceRequest
3088    {
3089        #[inline(always)]
3090        fn new_empty() -> Self {
3091            Self { charge_source: fidl::new_empty!(fidl_fuchsia_power_battery::ChargeSource, D) }
3092        }
3093
3094        #[inline]
3095        unsafe fn decode(
3096            &mut self,
3097            decoder: &mut fidl::encoding::Decoder<'_, D>,
3098            offset: usize,
3099            _depth: fidl::encoding::Depth,
3100        ) -> fidl::Result<()> {
3101            decoder.debug_check_bounds::<Self>(offset);
3102            // Verify that padding bytes are zero.
3103            fidl::decode!(
3104                fidl_fuchsia_power_battery::ChargeSource,
3105                D,
3106                &mut self.charge_source,
3107                decoder,
3108                offset + 0,
3109                _depth
3110            )?;
3111            Ok(())
3112        }
3113    }
3114
3115    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
3116        type Borrowed<'a> = &'a Self;
3117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3118            value
3119        }
3120    }
3121
3122    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
3123        type Owned = Self;
3124
3125        #[inline(always)]
3126        fn inline_align(_context: fidl::encoding::Context) -> usize {
3127            4
3128        }
3129
3130        #[inline(always)]
3131        fn inline_size(_context: fidl::encoding::Context) -> usize {
3132            4
3133        }
3134    }
3135
3136    unsafe impl<D: fidl::encoding::ResourceDialect>
3137        fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D>
3138        for &BatterySimulatorControllerSetChargeStatusRequest
3139    {
3140        #[inline]
3141        unsafe fn encode(
3142            self,
3143            encoder: &mut fidl::encoding::Encoder<'_, D>,
3144            offset: usize,
3145            _depth: fidl::encoding::Depth,
3146        ) -> fidl::Result<()> {
3147            encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
3148            // Delegate to tuple encoding.
3149            fidl::encoding::Encode::<BatterySimulatorControllerSetChargeStatusRequest, D>::encode(
3150                (
3151                    <fidl_fuchsia_power_battery::ChargeStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.charge_status),
3152                ),
3153                encoder, offset, _depth
3154            )
3155        }
3156    }
3157    unsafe impl<
3158            D: fidl::encoding::ResourceDialect,
3159            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::ChargeStatus, D>,
3160        > fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D> for (T0,)
3161    {
3162        #[inline]
3163        unsafe fn encode(
3164            self,
3165            encoder: &mut fidl::encoding::Encoder<'_, D>,
3166            offset: usize,
3167            depth: fidl::encoding::Depth,
3168        ) -> fidl::Result<()> {
3169            encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
3170            // Zero out padding regions. There's no need to apply masks
3171            // because the unmasked parts will be overwritten by fields.
3172            // Write the fields.
3173            self.0.encode(encoder, offset + 0, depth)?;
3174            Ok(())
3175        }
3176    }
3177
3178    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3179        for BatterySimulatorControllerSetChargeStatusRequest
3180    {
3181        #[inline(always)]
3182        fn new_empty() -> Self {
3183            Self { charge_status: fidl::new_empty!(fidl_fuchsia_power_battery::ChargeStatus, D) }
3184        }
3185
3186        #[inline]
3187        unsafe fn decode(
3188            &mut self,
3189            decoder: &mut fidl::encoding::Decoder<'_, D>,
3190            offset: usize,
3191            _depth: fidl::encoding::Depth,
3192        ) -> fidl::Result<()> {
3193            decoder.debug_check_bounds::<Self>(offset);
3194            // Verify that padding bytes are zero.
3195            fidl::decode!(
3196                fidl_fuchsia_power_battery::ChargeStatus,
3197                D,
3198                &mut self.charge_status,
3199                decoder,
3200                offset + 0,
3201                _depth
3202            )?;
3203            Ok(())
3204        }
3205    }
3206
3207    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
3208        type Borrowed<'a> = &'a Self;
3209        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3210            value
3211        }
3212    }
3213
3214    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
3215        type Owned = Self;
3216
3217        #[inline(always)]
3218        fn inline_align(_context: fidl::encoding::Context) -> usize {
3219            4
3220        }
3221
3222        #[inline(always)]
3223        fn inline_size(_context: fidl::encoding::Context) -> usize {
3224            4
3225        }
3226    }
3227
3228    unsafe impl<D: fidl::encoding::ResourceDialect>
3229        fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D>
3230        for &BatterySimulatorControllerSetLevelStatusRequest
3231    {
3232        #[inline]
3233        unsafe fn encode(
3234            self,
3235            encoder: &mut fidl::encoding::Encoder<'_, D>,
3236            offset: usize,
3237            _depth: fidl::encoding::Depth,
3238        ) -> fidl::Result<()> {
3239            encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
3240            // Delegate to tuple encoding.
3241            fidl::encoding::Encode::<BatterySimulatorControllerSetLevelStatusRequest, D>::encode(
3242                (
3243                    <fidl_fuchsia_power_battery::LevelStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.level_status),
3244                ),
3245                encoder, offset, _depth
3246            )
3247        }
3248    }
3249    unsafe impl<
3250            D: fidl::encoding::ResourceDialect,
3251            T0: fidl::encoding::Encode<fidl_fuchsia_power_battery::LevelStatus, D>,
3252        > fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D> for (T0,)
3253    {
3254        #[inline]
3255        unsafe fn encode(
3256            self,
3257            encoder: &mut fidl::encoding::Encoder<'_, D>,
3258            offset: usize,
3259            depth: fidl::encoding::Depth,
3260        ) -> fidl::Result<()> {
3261            encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
3262            // Zero out padding regions. There's no need to apply masks
3263            // because the unmasked parts will be overwritten by fields.
3264            // Write the fields.
3265            self.0.encode(encoder, offset + 0, depth)?;
3266            Ok(())
3267        }
3268    }
3269
3270    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3271        for BatterySimulatorControllerSetLevelStatusRequest
3272    {
3273        #[inline(always)]
3274        fn new_empty() -> Self {
3275            Self { level_status: fidl::new_empty!(fidl_fuchsia_power_battery::LevelStatus, D) }
3276        }
3277
3278        #[inline]
3279        unsafe fn decode(
3280            &mut self,
3281            decoder: &mut fidl::encoding::Decoder<'_, D>,
3282            offset: usize,
3283            _depth: fidl::encoding::Depth,
3284        ) -> fidl::Result<()> {
3285            decoder.debug_check_bounds::<Self>(offset);
3286            // Verify that padding bytes are zero.
3287            fidl::decode!(
3288                fidl_fuchsia_power_battery::LevelStatus,
3289                D,
3290                &mut self.level_status,
3291                decoder,
3292                offset + 0,
3293                _depth
3294            )?;
3295            Ok(())
3296        }
3297    }
3298
3299    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
3300        type Borrowed<'a> = &'a Self;
3301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3302            value
3303        }
3304    }
3305
3306    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
3307        type Owned = Self;
3308
3309        #[inline(always)]
3310        fn inline_align(_context: fidl::encoding::Context) -> usize {
3311            4
3312        }
3313
3314        #[inline(always)]
3315        fn inline_size(_context: fidl::encoding::Context) -> usize {
3316            4
3317        }
3318        #[inline(always)]
3319        fn encode_is_copy() -> bool {
3320            true
3321        }
3322
3323        #[inline(always)]
3324        fn decode_is_copy() -> bool {
3325            true
3326        }
3327    }
3328
3329    unsafe impl<D: fidl::encoding::ResourceDialect>
3330        fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D>
3331        for &BatterySimulatorControllerSetPresentVoltageMvRequest
3332    {
3333        #[inline]
3334        unsafe fn encode(
3335            self,
3336            encoder: &mut fidl::encoding::Encoder<'_, D>,
3337            offset: usize,
3338            _depth: fidl::encoding::Depth,
3339        ) -> fidl::Result<()> {
3340            encoder
3341                .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
3342            unsafe {
3343                // Copy the object into the buffer.
3344                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3345                (buf_ptr as *mut BatterySimulatorControllerSetPresentVoltageMvRequest)
3346                    .write_unaligned(
3347                        (self as *const BatterySimulatorControllerSetPresentVoltageMvRequest)
3348                            .read(),
3349                    );
3350                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3351                // done second because the memcpy will write garbage to these bytes.
3352            }
3353            Ok(())
3354        }
3355    }
3356    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3357        fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D> for (T0,)
3358    {
3359        #[inline]
3360        unsafe fn encode(
3361            self,
3362            encoder: &mut fidl::encoding::Encoder<'_, D>,
3363            offset: usize,
3364            depth: fidl::encoding::Depth,
3365        ) -> fidl::Result<()> {
3366            encoder
3367                .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
3368            // Zero out padding regions. There's no need to apply masks
3369            // because the unmasked parts will be overwritten by fields.
3370            // Write the fields.
3371            self.0.encode(encoder, offset + 0, depth)?;
3372            Ok(())
3373        }
3374    }
3375
3376    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3377        for BatterySimulatorControllerSetPresentVoltageMvRequest
3378    {
3379        #[inline(always)]
3380        fn new_empty() -> Self {
3381            Self { voltage: fidl::new_empty!(u32, D) }
3382        }
3383
3384        #[inline]
3385        unsafe fn decode(
3386            &mut self,
3387            decoder: &mut fidl::encoding::Decoder<'_, D>,
3388            offset: usize,
3389            _depth: fidl::encoding::Depth,
3390        ) -> fidl::Result<()> {
3391            decoder.debug_check_bounds::<Self>(offset);
3392            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3393            // Verify that padding bytes are zero.
3394            // Copy from the buffer into the object.
3395            unsafe {
3396                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3397            }
3398            Ok(())
3399        }
3400    }
3401
3402    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetRemainingCapacityUahRequest {
3403        type Borrowed<'a> = &'a Self;
3404        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3405            value
3406        }
3407    }
3408
3409    unsafe impl fidl::encoding::TypeMarker
3410        for BatterySimulatorControllerSetRemainingCapacityUahRequest
3411    {
3412        type Owned = Self;
3413
3414        #[inline(always)]
3415        fn inline_align(_context: fidl::encoding::Context) -> usize {
3416            4
3417        }
3418
3419        #[inline(always)]
3420        fn inline_size(_context: fidl::encoding::Context) -> usize {
3421            4
3422        }
3423        #[inline(always)]
3424        fn encode_is_copy() -> bool {
3425            true
3426        }
3427
3428        #[inline(always)]
3429        fn decode_is_copy() -> bool {
3430            true
3431        }
3432    }
3433
3434    unsafe impl<D: fidl::encoding::ResourceDialect>
3435        fidl::encoding::Encode<BatterySimulatorControllerSetRemainingCapacityUahRequest, D>
3436        for &BatterySimulatorControllerSetRemainingCapacityUahRequest
3437    {
3438        #[inline]
3439        unsafe fn encode(
3440            self,
3441            encoder: &mut fidl::encoding::Encoder<'_, D>,
3442            offset: usize,
3443            _depth: fidl::encoding::Depth,
3444        ) -> fidl::Result<()> {
3445            encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
3446                offset,
3447            );
3448            unsafe {
3449                // Copy the object into the buffer.
3450                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3451                (buf_ptr as *mut BatterySimulatorControllerSetRemainingCapacityUahRequest)
3452                    .write_unaligned(
3453                        (self as *const BatterySimulatorControllerSetRemainingCapacityUahRequest)
3454                            .read(),
3455                    );
3456                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3457                // done second because the memcpy will write garbage to these bytes.
3458            }
3459            Ok(())
3460        }
3461    }
3462    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3463        fidl::encoding::Encode<BatterySimulatorControllerSetRemainingCapacityUahRequest, D>
3464        for (T0,)
3465    {
3466        #[inline]
3467        unsafe fn encode(
3468            self,
3469            encoder: &mut fidl::encoding::Encoder<'_, D>,
3470            offset: usize,
3471            depth: fidl::encoding::Depth,
3472        ) -> fidl::Result<()> {
3473            encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingCapacityUahRequest>(
3474                offset,
3475            );
3476            // Zero out padding regions. There's no need to apply masks
3477            // because the unmasked parts will be overwritten by fields.
3478            // Write the fields.
3479            self.0.encode(encoder, offset + 0, depth)?;
3480            Ok(())
3481        }
3482    }
3483
3484    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3485        for BatterySimulatorControllerSetRemainingCapacityUahRequest
3486    {
3487        #[inline(always)]
3488        fn new_empty() -> Self {
3489            Self { capacity: fidl::new_empty!(u32, D) }
3490        }
3491
3492        #[inline]
3493        unsafe fn decode(
3494            &mut self,
3495            decoder: &mut fidl::encoding::Decoder<'_, D>,
3496            offset: usize,
3497            _depth: fidl::encoding::Depth,
3498        ) -> fidl::Result<()> {
3499            decoder.debug_check_bounds::<Self>(offset);
3500            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3501            // Verify that padding bytes are zero.
3502            // Copy from the buffer into the object.
3503            unsafe {
3504                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3505            }
3506            Ok(())
3507        }
3508    }
3509
3510    impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
3511        type Borrowed<'a> = &'a Self;
3512        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3513            value
3514        }
3515    }
3516
3517    unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
3518        type Owned = Self;
3519
3520        #[inline(always)]
3521        fn inline_align(_context: fidl::encoding::Context) -> usize {
3522            8
3523        }
3524
3525        #[inline(always)]
3526        fn inline_size(_context: fidl::encoding::Context) -> usize {
3527            8
3528        }
3529        #[inline(always)]
3530        fn encode_is_copy() -> bool {
3531            true
3532        }
3533
3534        #[inline(always)]
3535        fn decode_is_copy() -> bool {
3536            true
3537        }
3538    }
3539
3540    unsafe impl<D: fidl::encoding::ResourceDialect>
3541        fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D>
3542        for &BatterySimulatorControllerSetTimeRemainingRequest
3543    {
3544        #[inline]
3545        unsafe fn encode(
3546            self,
3547            encoder: &mut fidl::encoding::Encoder<'_, D>,
3548            offset: usize,
3549            _depth: fidl::encoding::Depth,
3550        ) -> fidl::Result<()> {
3551            encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
3552            unsafe {
3553                // Copy the object into the buffer.
3554                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3555                (buf_ptr as *mut BatterySimulatorControllerSetTimeRemainingRequest)
3556                    .write_unaligned(
3557                        (self as *const BatterySimulatorControllerSetTimeRemainingRequest).read(),
3558                    );
3559                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3560                // done second because the memcpy will write garbage to these bytes.
3561            }
3562            Ok(())
3563        }
3564    }
3565    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
3566        fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D> for (T0,)
3567    {
3568        #[inline]
3569        unsafe fn encode(
3570            self,
3571            encoder: &mut fidl::encoding::Encoder<'_, D>,
3572            offset: usize,
3573            depth: fidl::encoding::Depth,
3574        ) -> fidl::Result<()> {
3575            encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
3576            // Zero out padding regions. There's no need to apply masks
3577            // because the unmasked parts will be overwritten by fields.
3578            // Write the fields.
3579            self.0.encode(encoder, offset + 0, depth)?;
3580            Ok(())
3581        }
3582    }
3583
3584    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3585        for BatterySimulatorControllerSetTimeRemainingRequest
3586    {
3587        #[inline(always)]
3588        fn new_empty() -> Self {
3589            Self { duration: fidl::new_empty!(i64, D) }
3590        }
3591
3592        #[inline]
3593        unsafe fn decode(
3594            &mut self,
3595            decoder: &mut fidl::encoding::Decoder<'_, D>,
3596            offset: usize,
3597            _depth: fidl::encoding::Depth,
3598        ) -> fidl::Result<()> {
3599            decoder.debug_check_bounds::<Self>(offset);
3600            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3601            // Verify that padding bytes are zero.
3602            // Copy from the buffer into the object.
3603            unsafe {
3604                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3605            }
3606            Ok(())
3607        }
3608    }
3609}