1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Clone, Debug, PartialEq)]
12pub struct BatterySimulatorControllerGetBatteryInfoResponse {
13 pub info: fidl_fuchsia_power_battery__common::BatteryInfo,
14}
15
16impl fidl::Persistable for BatterySimulatorControllerGetBatteryInfoResponse {}
17
18#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
19pub struct BatterySimulatorControllerIsSimulatingResponse {
20 pub simulation_state: bool,
21}
22
23impl fidl::Persistable for BatterySimulatorControllerIsSimulatingResponse {}
24
25#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
26pub struct BatterySimulatorControllerSetBatteryPercentageRequest {
27 pub percent: f32,
28}
29
30impl fidl::Persistable for BatterySimulatorControllerSetBatteryPercentageRequest {}
31
32#[derive(Clone, Debug, PartialEq)]
33pub struct BatterySimulatorControllerSetBatterySpecRequest {
34 pub spec: fidl_fuchsia_power_battery__common::BatterySpec,
35}
36
37impl fidl::Persistable for BatterySimulatorControllerSetBatterySpecRequest {}
38
39#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct BatterySimulatorControllerSetBatteryStatusRequest {
41 pub battery_status: fidl_fuchsia_power_battery__common::BatteryStatus,
42}
43
44impl fidl::Persistable for BatterySimulatorControllerSetBatteryStatusRequest {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct BatterySimulatorControllerSetChargeSourceRequest {
48 pub charge_source: fidl_fuchsia_power_battery__common::ChargeSource,
49}
50
51impl fidl::Persistable for BatterySimulatorControllerSetChargeSourceRequest {}
52
53#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct BatterySimulatorControllerSetChargeStatusRequest {
55 pub charge_status: fidl_fuchsia_power_battery__common::ChargeStatus,
56}
57
58impl fidl::Persistable for BatterySimulatorControllerSetChargeStatusRequest {}
59
60#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct BatterySimulatorControllerSetLevelStatusRequest {
62 pub level_status: fidl_fuchsia_power_battery__common::LevelStatus,
63}
64
65impl fidl::Persistable for BatterySimulatorControllerSetLevelStatusRequest {}
66
67#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
68#[repr(C)]
69pub struct BatterySimulatorControllerSetPresentVoltageMvRequest {
70 pub voltage: u32,
71}
72
73impl fidl::Persistable for BatterySimulatorControllerSetPresentVoltageMvRequest {}
74
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct BatterySimulatorControllerSetRemainingChargeUahRequest {
78 pub charge: u32,
79}
80
81impl fidl::Persistable for BatterySimulatorControllerSetRemainingChargeUahRequest {}
82
83#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84#[repr(C)]
85pub struct BatterySimulatorControllerSetTimeRemainingRequest {
86 pub duration: i64,
87}
88
89impl fidl::Persistable for BatterySimulatorControllerSetTimeRemainingRequest {}
90
91pub mod battery_simulator_ordinals {
92 pub const GET_BATTERY_INFO: u64 = 0x4a20d3731366aaf8;
93 pub const SET_BATTERY_STATUS: u64 = 0x2343eb65038c8b34;
94 pub const SET_CHARGE_STATUS: u64 = 0x79b2bf1a387acd85;
95 pub const SET_CHARGE_SOURCE: u64 = 0xb40433f42c33527;
96 pub const SET_BATTERY_PERCENTAGE: u64 = 0x64a9d96eb7a45a9f;
97 pub const SET_LEVEL_STATUS: u64 = 0x577fc3314f7a48a4;
98 pub const SET_TIME_REMAINING: u64 = 0x7427251c9d2a794e;
99 pub const DISCONNECT_REAL_BATTERY: u64 = 0x75588eae6b9b67e3;
100 pub const IS_SIMULATING: u64 = 0x4bf85cfe3476975d;
101 pub const RECONNECT_REAL_BATTERY: u64 = 0x18306690352d9dfa;
102 pub const SET_PRESENT_VOLTAGE_MV: u64 = 0x5462c9e9f947b8ce;
103 pub const SET_REMAINING_CHARGE_UAH: u64 = 0x54aa3c318fac5c33;
104 pub const SET_BATTERY_SPEC: u64 = 0x7324672546976583;
105}
106
107pub mod battery_simulator_controller_ordinals {
108 pub const GET_BATTERY_INFO: u64 = 0x4a20d3731366aaf8;
109 pub const SET_BATTERY_STATUS: u64 = 0x2343eb65038c8b34;
110 pub const SET_CHARGE_STATUS: u64 = 0x79b2bf1a387acd85;
111 pub const SET_CHARGE_SOURCE: u64 = 0xb40433f42c33527;
112 pub const SET_BATTERY_PERCENTAGE: u64 = 0x64a9d96eb7a45a9f;
113 pub const SET_LEVEL_STATUS: u64 = 0x577fc3314f7a48a4;
114 pub const SET_TIME_REMAINING: u64 = 0x7427251c9d2a794e;
115 pub const DISCONNECT_REAL_BATTERY: u64 = 0x75588eae6b9b67e3;
116 pub const IS_SIMULATING: u64 = 0x4bf85cfe3476975d;
117 pub const RECONNECT_REAL_BATTERY: u64 = 0x18306690352d9dfa;
118 pub const SET_PRESENT_VOLTAGE_MV: u64 = 0x5462c9e9f947b8ce;
119 pub const SET_REMAINING_CHARGE_UAH: u64 = 0x54aa3c318fac5c33;
120 pub const SET_BATTERY_SPEC: u64 = 0x7324672546976583;
121}
122
123mod internal {
124 use super::*;
125
126 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerGetBatteryInfoResponse {
127 type Borrowed<'a> = &'a Self;
128 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
129 value
130 }
131 }
132
133 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerGetBatteryInfoResponse {
134 type Owned = Self;
135
136 #[inline(always)]
137 fn inline_align(_context: fidl::encoding::Context) -> usize {
138 8
139 }
140
141 #[inline(always)]
142 fn inline_size(_context: fidl::encoding::Context) -> usize {
143 16
144 }
145 }
146
147 unsafe impl<D: fidl::encoding::ResourceDialect>
148 fidl::encoding::Encode<BatterySimulatorControllerGetBatteryInfoResponse, D>
149 for &BatterySimulatorControllerGetBatteryInfoResponse
150 {
151 #[inline]
152 unsafe fn encode(
153 self,
154 encoder: &mut fidl::encoding::Encoder<'_, D>,
155 offset: usize,
156 _depth: fidl::encoding::Depth,
157 ) -> fidl::Result<()> {
158 encoder.debug_check_bounds::<BatterySimulatorControllerGetBatteryInfoResponse>(offset);
159 fidl::encoding::Encode::<BatterySimulatorControllerGetBatteryInfoResponse, D>::encode(
161 (
162 <fidl_fuchsia_power_battery__common::BatteryInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
163 ),
164 encoder, offset, _depth
165 )
166 }
167 }
168 unsafe impl<
169 D: fidl::encoding::ResourceDialect,
170 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::BatteryInfo, D>,
171 > fidl::encoding::Encode<BatterySimulatorControllerGetBatteryInfoResponse, D> for (T0,)
172 {
173 #[inline]
174 unsafe fn encode(
175 self,
176 encoder: &mut fidl::encoding::Encoder<'_, D>,
177 offset: usize,
178 depth: fidl::encoding::Depth,
179 ) -> fidl::Result<()> {
180 encoder.debug_check_bounds::<BatterySimulatorControllerGetBatteryInfoResponse>(offset);
181 self.0.encode(encoder, offset + 0, depth)?;
185 Ok(())
186 }
187 }
188
189 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
190 for BatterySimulatorControllerGetBatteryInfoResponse
191 {
192 #[inline(always)]
193 fn new_empty() -> Self {
194 Self { info: fidl::new_empty!(fidl_fuchsia_power_battery__common::BatteryInfo, D) }
195 }
196
197 #[inline]
198 unsafe fn decode(
199 &mut self,
200 decoder: &mut fidl::encoding::Decoder<'_, D>,
201 offset: usize,
202 _depth: fidl::encoding::Depth,
203 ) -> fidl::Result<()> {
204 decoder.debug_check_bounds::<Self>(offset);
205 fidl::decode!(
207 fidl_fuchsia_power_battery__common::BatteryInfo,
208 D,
209 &mut self.info,
210 decoder,
211 offset + 0,
212 _depth
213 )?;
214 Ok(())
215 }
216 }
217
218 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerIsSimulatingResponse {
219 type Borrowed<'a> = &'a Self;
220 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
221 value
222 }
223 }
224
225 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerIsSimulatingResponse {
226 type Owned = Self;
227
228 #[inline(always)]
229 fn inline_align(_context: fidl::encoding::Context) -> usize {
230 1
231 }
232
233 #[inline(always)]
234 fn inline_size(_context: fidl::encoding::Context) -> usize {
235 1
236 }
237 }
238
239 unsafe impl<D: fidl::encoding::ResourceDialect>
240 fidl::encoding::Encode<BatterySimulatorControllerIsSimulatingResponse, D>
241 for &BatterySimulatorControllerIsSimulatingResponse
242 {
243 #[inline]
244 unsafe fn encode(
245 self,
246 encoder: &mut fidl::encoding::Encoder<'_, D>,
247 offset: usize,
248 _depth: fidl::encoding::Depth,
249 ) -> fidl::Result<()> {
250 encoder.debug_check_bounds::<BatterySimulatorControllerIsSimulatingResponse>(offset);
251 fidl::encoding::Encode::<BatterySimulatorControllerIsSimulatingResponse, D>::encode(
253 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.simulation_state),),
254 encoder,
255 offset,
256 _depth,
257 )
258 }
259 }
260 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
261 fidl::encoding::Encode<BatterySimulatorControllerIsSimulatingResponse, D> for (T0,)
262 {
263 #[inline]
264 unsafe fn encode(
265 self,
266 encoder: &mut fidl::encoding::Encoder<'_, D>,
267 offset: usize,
268 depth: fidl::encoding::Depth,
269 ) -> fidl::Result<()> {
270 encoder.debug_check_bounds::<BatterySimulatorControllerIsSimulatingResponse>(offset);
271 self.0.encode(encoder, offset + 0, depth)?;
275 Ok(())
276 }
277 }
278
279 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
280 for BatterySimulatorControllerIsSimulatingResponse
281 {
282 #[inline(always)]
283 fn new_empty() -> Self {
284 Self { simulation_state: fidl::new_empty!(bool, D) }
285 }
286
287 #[inline]
288 unsafe fn decode(
289 &mut self,
290 decoder: &mut fidl::encoding::Decoder<'_, D>,
291 offset: usize,
292 _depth: fidl::encoding::Depth,
293 ) -> fidl::Result<()> {
294 decoder.debug_check_bounds::<Self>(offset);
295 fidl::decode!(bool, D, &mut self.simulation_state, decoder, offset + 0, _depth)?;
297 Ok(())
298 }
299 }
300
301 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatteryPercentageRequest {
302 type Borrowed<'a> = &'a Self;
303 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
304 value
305 }
306 }
307
308 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatteryPercentageRequest {
309 type Owned = Self;
310
311 #[inline(always)]
312 fn inline_align(_context: fidl::encoding::Context) -> usize {
313 4
314 }
315
316 #[inline(always)]
317 fn inline_size(_context: fidl::encoding::Context) -> usize {
318 4
319 }
320 }
321
322 unsafe impl<D: fidl::encoding::ResourceDialect>
323 fidl::encoding::Encode<BatterySimulatorControllerSetBatteryPercentageRequest, D>
324 for &BatterySimulatorControllerSetBatteryPercentageRequest
325 {
326 #[inline]
327 unsafe fn encode(
328 self,
329 encoder: &mut fidl::encoding::Encoder<'_, D>,
330 offset: usize,
331 _depth: fidl::encoding::Depth,
332 ) -> fidl::Result<()> {
333 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryPercentageRequest>(
334 offset,
335 );
336 fidl::encoding::Encode::<BatterySimulatorControllerSetBatteryPercentageRequest, D>::encode(
338 (
339 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.percent),
340 ),
341 encoder, offset, _depth
342 )
343 }
344 }
345 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
346 fidl::encoding::Encode<BatterySimulatorControllerSetBatteryPercentageRequest, D> for (T0,)
347 {
348 #[inline]
349 unsafe fn encode(
350 self,
351 encoder: &mut fidl::encoding::Encoder<'_, D>,
352 offset: usize,
353 depth: fidl::encoding::Depth,
354 ) -> fidl::Result<()> {
355 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryPercentageRequest>(
356 offset,
357 );
358 self.0.encode(encoder, offset + 0, depth)?;
362 Ok(())
363 }
364 }
365
366 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
367 for BatterySimulatorControllerSetBatteryPercentageRequest
368 {
369 #[inline(always)]
370 fn new_empty() -> Self {
371 Self { percent: fidl::new_empty!(f32, D) }
372 }
373
374 #[inline]
375 unsafe fn decode(
376 &mut self,
377 decoder: &mut fidl::encoding::Decoder<'_, D>,
378 offset: usize,
379 _depth: fidl::encoding::Depth,
380 ) -> fidl::Result<()> {
381 decoder.debug_check_bounds::<Self>(offset);
382 fidl::decode!(f32, D, &mut self.percent, decoder, offset + 0, _depth)?;
384 Ok(())
385 }
386 }
387
388 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatterySpecRequest {
389 type Borrowed<'a> = &'a Self;
390 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
391 value
392 }
393 }
394
395 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatterySpecRequest {
396 type Owned = Self;
397
398 #[inline(always)]
399 fn inline_align(_context: fidl::encoding::Context) -> usize {
400 8
401 }
402
403 #[inline(always)]
404 fn inline_size(_context: fidl::encoding::Context) -> usize {
405 16
406 }
407 }
408
409 unsafe impl<D: fidl::encoding::ResourceDialect>
410 fidl::encoding::Encode<BatterySimulatorControllerSetBatterySpecRequest, D>
411 for &BatterySimulatorControllerSetBatterySpecRequest
412 {
413 #[inline]
414 unsafe fn encode(
415 self,
416 encoder: &mut fidl::encoding::Encoder<'_, D>,
417 offset: usize,
418 _depth: fidl::encoding::Depth,
419 ) -> fidl::Result<()> {
420 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatterySpecRequest>(offset);
421 fidl::encoding::Encode::<BatterySimulatorControllerSetBatterySpecRequest, D>::encode(
423 (
424 <fidl_fuchsia_power_battery__common::BatterySpec as fidl::encoding::ValueTypeMarker>::borrow(&self.spec),
425 ),
426 encoder, offset, _depth
427 )
428 }
429 }
430 unsafe impl<
431 D: fidl::encoding::ResourceDialect,
432 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::BatterySpec, D>,
433 > fidl::encoding::Encode<BatterySimulatorControllerSetBatterySpecRequest, D> for (T0,)
434 {
435 #[inline]
436 unsafe fn encode(
437 self,
438 encoder: &mut fidl::encoding::Encoder<'_, D>,
439 offset: usize,
440 depth: fidl::encoding::Depth,
441 ) -> fidl::Result<()> {
442 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatterySpecRequest>(offset);
443 self.0.encode(encoder, offset + 0, depth)?;
447 Ok(())
448 }
449 }
450
451 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
452 for BatterySimulatorControllerSetBatterySpecRequest
453 {
454 #[inline(always)]
455 fn new_empty() -> Self {
456 Self { spec: fidl::new_empty!(fidl_fuchsia_power_battery__common::BatterySpec, D) }
457 }
458
459 #[inline]
460 unsafe fn decode(
461 &mut self,
462 decoder: &mut fidl::encoding::Decoder<'_, D>,
463 offset: usize,
464 _depth: fidl::encoding::Depth,
465 ) -> fidl::Result<()> {
466 decoder.debug_check_bounds::<Self>(offset);
467 fidl::decode!(
469 fidl_fuchsia_power_battery__common::BatterySpec,
470 D,
471 &mut self.spec,
472 decoder,
473 offset + 0,
474 _depth
475 )?;
476 Ok(())
477 }
478 }
479
480 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetBatteryStatusRequest {
481 type Borrowed<'a> = &'a Self;
482 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
483 value
484 }
485 }
486
487 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetBatteryStatusRequest {
488 type Owned = Self;
489
490 #[inline(always)]
491 fn inline_align(_context: fidl::encoding::Context) -> usize {
492 4
493 }
494
495 #[inline(always)]
496 fn inline_size(_context: fidl::encoding::Context) -> usize {
497 4
498 }
499 }
500
501 unsafe impl<D: fidl::encoding::ResourceDialect>
502 fidl::encoding::Encode<BatterySimulatorControllerSetBatteryStatusRequest, D>
503 for &BatterySimulatorControllerSetBatteryStatusRequest
504 {
505 #[inline]
506 unsafe fn encode(
507 self,
508 encoder: &mut fidl::encoding::Encoder<'_, D>,
509 offset: usize,
510 _depth: fidl::encoding::Depth,
511 ) -> fidl::Result<()> {
512 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryStatusRequest>(offset);
513 fidl::encoding::Encode::<BatterySimulatorControllerSetBatteryStatusRequest, D>::encode(
515 (
516 <fidl_fuchsia_power_battery__common::BatteryStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.battery_status),
517 ),
518 encoder, offset, _depth
519 )
520 }
521 }
522 unsafe impl<
523 D: fidl::encoding::ResourceDialect,
524 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::BatteryStatus, D>,
525 > fidl::encoding::Encode<BatterySimulatorControllerSetBatteryStatusRequest, D> for (T0,)
526 {
527 #[inline]
528 unsafe fn encode(
529 self,
530 encoder: &mut fidl::encoding::Encoder<'_, D>,
531 offset: usize,
532 depth: fidl::encoding::Depth,
533 ) -> fidl::Result<()> {
534 encoder.debug_check_bounds::<BatterySimulatorControllerSetBatteryStatusRequest>(offset);
535 self.0.encode(encoder, offset + 0, depth)?;
539 Ok(())
540 }
541 }
542
543 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
544 for BatterySimulatorControllerSetBatteryStatusRequest
545 {
546 #[inline(always)]
547 fn new_empty() -> Self {
548 Self {
549 battery_status: fidl::new_empty!(
550 fidl_fuchsia_power_battery__common::BatteryStatus,
551 D
552 ),
553 }
554 }
555
556 #[inline]
557 unsafe fn decode(
558 &mut self,
559 decoder: &mut fidl::encoding::Decoder<'_, D>,
560 offset: usize,
561 _depth: fidl::encoding::Depth,
562 ) -> fidl::Result<()> {
563 decoder.debug_check_bounds::<Self>(offset);
564 fidl::decode!(
566 fidl_fuchsia_power_battery__common::BatteryStatus,
567 D,
568 &mut self.battery_status,
569 decoder,
570 offset + 0,
571 _depth
572 )?;
573 Ok(())
574 }
575 }
576
577 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetChargeSourceRequest {
578 type Borrowed<'a> = &'a Self;
579 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
580 value
581 }
582 }
583
584 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetChargeSourceRequest {
585 type Owned = Self;
586
587 #[inline(always)]
588 fn inline_align(_context: fidl::encoding::Context) -> usize {
589 4
590 }
591
592 #[inline(always)]
593 fn inline_size(_context: fidl::encoding::Context) -> usize {
594 4
595 }
596 }
597
598 unsafe impl<D: fidl::encoding::ResourceDialect>
599 fidl::encoding::Encode<BatterySimulatorControllerSetChargeSourceRequest, D>
600 for &BatterySimulatorControllerSetChargeSourceRequest
601 {
602 #[inline]
603 unsafe fn encode(
604 self,
605 encoder: &mut fidl::encoding::Encoder<'_, D>,
606 offset: usize,
607 _depth: fidl::encoding::Depth,
608 ) -> fidl::Result<()> {
609 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeSourceRequest>(offset);
610 fidl::encoding::Encode::<BatterySimulatorControllerSetChargeSourceRequest, D>::encode(
612 (
613 <fidl_fuchsia_power_battery__common::ChargeSource as fidl::encoding::ValueTypeMarker>::borrow(&self.charge_source),
614 ),
615 encoder, offset, _depth
616 )
617 }
618 }
619 unsafe impl<
620 D: fidl::encoding::ResourceDialect,
621 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::ChargeSource, D>,
622 > fidl::encoding::Encode<BatterySimulatorControllerSetChargeSourceRequest, D> for (T0,)
623 {
624 #[inline]
625 unsafe fn encode(
626 self,
627 encoder: &mut fidl::encoding::Encoder<'_, D>,
628 offset: usize,
629 depth: fidl::encoding::Depth,
630 ) -> fidl::Result<()> {
631 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeSourceRequest>(offset);
632 self.0.encode(encoder, offset + 0, depth)?;
636 Ok(())
637 }
638 }
639
640 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
641 for BatterySimulatorControllerSetChargeSourceRequest
642 {
643 #[inline(always)]
644 fn new_empty() -> Self {
645 Self {
646 charge_source: fidl::new_empty!(
647 fidl_fuchsia_power_battery__common::ChargeSource,
648 D
649 ),
650 }
651 }
652
653 #[inline]
654 unsafe fn decode(
655 &mut self,
656 decoder: &mut fidl::encoding::Decoder<'_, D>,
657 offset: usize,
658 _depth: fidl::encoding::Depth,
659 ) -> fidl::Result<()> {
660 decoder.debug_check_bounds::<Self>(offset);
661 fidl::decode!(
663 fidl_fuchsia_power_battery__common::ChargeSource,
664 D,
665 &mut self.charge_source,
666 decoder,
667 offset + 0,
668 _depth
669 )?;
670 Ok(())
671 }
672 }
673
674 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
675 type Borrowed<'a> = &'a Self;
676 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
677 value
678 }
679 }
680
681 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
682 type Owned = Self;
683
684 #[inline(always)]
685 fn inline_align(_context: fidl::encoding::Context) -> usize {
686 4
687 }
688
689 #[inline(always)]
690 fn inline_size(_context: fidl::encoding::Context) -> usize {
691 4
692 }
693 }
694
695 unsafe impl<D: fidl::encoding::ResourceDialect>
696 fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D>
697 for &BatterySimulatorControllerSetChargeStatusRequest
698 {
699 #[inline]
700 unsafe fn encode(
701 self,
702 encoder: &mut fidl::encoding::Encoder<'_, D>,
703 offset: usize,
704 _depth: fidl::encoding::Depth,
705 ) -> fidl::Result<()> {
706 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
707 fidl::encoding::Encode::<BatterySimulatorControllerSetChargeStatusRequest, D>::encode(
709 (
710 <fidl_fuchsia_power_battery__common::ChargeStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.charge_status),
711 ),
712 encoder, offset, _depth
713 )
714 }
715 }
716 unsafe impl<
717 D: fidl::encoding::ResourceDialect,
718 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::ChargeStatus, D>,
719 > fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D> for (T0,)
720 {
721 #[inline]
722 unsafe fn encode(
723 self,
724 encoder: &mut fidl::encoding::Encoder<'_, D>,
725 offset: usize,
726 depth: fidl::encoding::Depth,
727 ) -> fidl::Result<()> {
728 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
729 self.0.encode(encoder, offset + 0, depth)?;
733 Ok(())
734 }
735 }
736
737 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
738 for BatterySimulatorControllerSetChargeStatusRequest
739 {
740 #[inline(always)]
741 fn new_empty() -> Self {
742 Self {
743 charge_status: fidl::new_empty!(
744 fidl_fuchsia_power_battery__common::ChargeStatus,
745 D
746 ),
747 }
748 }
749
750 #[inline]
751 unsafe fn decode(
752 &mut self,
753 decoder: &mut fidl::encoding::Decoder<'_, D>,
754 offset: usize,
755 _depth: fidl::encoding::Depth,
756 ) -> fidl::Result<()> {
757 decoder.debug_check_bounds::<Self>(offset);
758 fidl::decode!(
760 fidl_fuchsia_power_battery__common::ChargeStatus,
761 D,
762 &mut self.charge_status,
763 decoder,
764 offset + 0,
765 _depth
766 )?;
767 Ok(())
768 }
769 }
770
771 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
772 type Borrowed<'a> = &'a Self;
773 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
774 value
775 }
776 }
777
778 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
779 type Owned = Self;
780
781 #[inline(always)]
782 fn inline_align(_context: fidl::encoding::Context) -> usize {
783 4
784 }
785
786 #[inline(always)]
787 fn inline_size(_context: fidl::encoding::Context) -> usize {
788 4
789 }
790 }
791
792 unsafe impl<D: fidl::encoding::ResourceDialect>
793 fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D>
794 for &BatterySimulatorControllerSetLevelStatusRequest
795 {
796 #[inline]
797 unsafe fn encode(
798 self,
799 encoder: &mut fidl::encoding::Encoder<'_, D>,
800 offset: usize,
801 _depth: fidl::encoding::Depth,
802 ) -> fidl::Result<()> {
803 encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
804 fidl::encoding::Encode::<BatterySimulatorControllerSetLevelStatusRequest, D>::encode(
806 (
807 <fidl_fuchsia_power_battery__common::LevelStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.level_status),
808 ),
809 encoder, offset, _depth
810 )
811 }
812 }
813 unsafe impl<
814 D: fidl::encoding::ResourceDialect,
815 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery__common::LevelStatus, D>,
816 > fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D> for (T0,)
817 {
818 #[inline]
819 unsafe fn encode(
820 self,
821 encoder: &mut fidl::encoding::Encoder<'_, D>,
822 offset: usize,
823 depth: fidl::encoding::Depth,
824 ) -> fidl::Result<()> {
825 encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
826 self.0.encode(encoder, offset + 0, depth)?;
830 Ok(())
831 }
832 }
833
834 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
835 for BatterySimulatorControllerSetLevelStatusRequest
836 {
837 #[inline(always)]
838 fn new_empty() -> Self {
839 Self {
840 level_status: fidl::new_empty!(fidl_fuchsia_power_battery__common::LevelStatus, D),
841 }
842 }
843
844 #[inline]
845 unsafe fn decode(
846 &mut self,
847 decoder: &mut fidl::encoding::Decoder<'_, D>,
848 offset: usize,
849 _depth: fidl::encoding::Depth,
850 ) -> fidl::Result<()> {
851 decoder.debug_check_bounds::<Self>(offset);
852 fidl::decode!(
854 fidl_fuchsia_power_battery__common::LevelStatus,
855 D,
856 &mut self.level_status,
857 decoder,
858 offset + 0,
859 _depth
860 )?;
861 Ok(())
862 }
863 }
864
865 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
866 type Borrowed<'a> = &'a Self;
867 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
868 value
869 }
870 }
871
872 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
873 type Owned = Self;
874
875 #[inline(always)]
876 fn inline_align(_context: fidl::encoding::Context) -> usize {
877 4
878 }
879
880 #[inline(always)]
881 fn inline_size(_context: fidl::encoding::Context) -> usize {
882 4
883 }
884 #[inline(always)]
885 fn encode_is_copy() -> bool {
886 true
887 }
888
889 #[inline(always)]
890 fn decode_is_copy() -> bool {
891 true
892 }
893 }
894
895 unsafe impl<D: fidl::encoding::ResourceDialect>
896 fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D>
897 for &BatterySimulatorControllerSetPresentVoltageMvRequest
898 {
899 #[inline]
900 unsafe fn encode(
901 self,
902 encoder: &mut fidl::encoding::Encoder<'_, D>,
903 offset: usize,
904 _depth: fidl::encoding::Depth,
905 ) -> fidl::Result<()> {
906 encoder
907 .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
908 unsafe {
909 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
911 (buf_ptr as *mut BatterySimulatorControllerSetPresentVoltageMvRequest)
912 .write_unaligned(
913 (self as *const BatterySimulatorControllerSetPresentVoltageMvRequest)
914 .read(),
915 );
916 }
919 Ok(())
920 }
921 }
922 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
923 fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D> for (T0,)
924 {
925 #[inline]
926 unsafe fn encode(
927 self,
928 encoder: &mut fidl::encoding::Encoder<'_, D>,
929 offset: usize,
930 depth: fidl::encoding::Depth,
931 ) -> fidl::Result<()> {
932 encoder
933 .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
934 self.0.encode(encoder, offset + 0, depth)?;
938 Ok(())
939 }
940 }
941
942 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
943 for BatterySimulatorControllerSetPresentVoltageMvRequest
944 {
945 #[inline(always)]
946 fn new_empty() -> Self {
947 Self { voltage: fidl::new_empty!(u32, D) }
948 }
949
950 #[inline]
951 unsafe fn decode(
952 &mut self,
953 decoder: &mut fidl::encoding::Decoder<'_, D>,
954 offset: usize,
955 _depth: fidl::encoding::Depth,
956 ) -> fidl::Result<()> {
957 decoder.debug_check_bounds::<Self>(offset);
958 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
959 unsafe {
962 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
963 }
964 Ok(())
965 }
966 }
967
968 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetRemainingChargeUahRequest {
969 type Borrowed<'a> = &'a Self;
970 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
971 value
972 }
973 }
974
975 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetRemainingChargeUahRequest {
976 type Owned = Self;
977
978 #[inline(always)]
979 fn inline_align(_context: fidl::encoding::Context) -> usize {
980 4
981 }
982
983 #[inline(always)]
984 fn inline_size(_context: fidl::encoding::Context) -> usize {
985 4
986 }
987 #[inline(always)]
988 fn encode_is_copy() -> bool {
989 true
990 }
991
992 #[inline(always)]
993 fn decode_is_copy() -> bool {
994 true
995 }
996 }
997
998 unsafe impl<D: fidl::encoding::ResourceDialect>
999 fidl::encoding::Encode<BatterySimulatorControllerSetRemainingChargeUahRequest, D>
1000 for &BatterySimulatorControllerSetRemainingChargeUahRequest
1001 {
1002 #[inline]
1003 unsafe fn encode(
1004 self,
1005 encoder: &mut fidl::encoding::Encoder<'_, D>,
1006 offset: usize,
1007 _depth: fidl::encoding::Depth,
1008 ) -> fidl::Result<()> {
1009 encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingChargeUahRequest>(
1010 offset,
1011 );
1012 unsafe {
1013 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1015 (buf_ptr as *mut BatterySimulatorControllerSetRemainingChargeUahRequest)
1016 .write_unaligned(
1017 (self as *const BatterySimulatorControllerSetRemainingChargeUahRequest)
1018 .read(),
1019 );
1020 }
1023 Ok(())
1024 }
1025 }
1026 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1027 fidl::encoding::Encode<BatterySimulatorControllerSetRemainingChargeUahRequest, D> for (T0,)
1028 {
1029 #[inline]
1030 unsafe fn encode(
1031 self,
1032 encoder: &mut fidl::encoding::Encoder<'_, D>,
1033 offset: usize,
1034 depth: fidl::encoding::Depth,
1035 ) -> fidl::Result<()> {
1036 encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingChargeUahRequest>(
1037 offset,
1038 );
1039 self.0.encode(encoder, offset + 0, depth)?;
1043 Ok(())
1044 }
1045 }
1046
1047 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1048 for BatterySimulatorControllerSetRemainingChargeUahRequest
1049 {
1050 #[inline(always)]
1051 fn new_empty() -> Self {
1052 Self { charge: fidl::new_empty!(u32, D) }
1053 }
1054
1055 #[inline]
1056 unsafe fn decode(
1057 &mut self,
1058 decoder: &mut fidl::encoding::Decoder<'_, D>,
1059 offset: usize,
1060 _depth: fidl::encoding::Depth,
1061 ) -> fidl::Result<()> {
1062 decoder.debug_check_bounds::<Self>(offset);
1063 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1064 unsafe {
1067 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1068 }
1069 Ok(())
1070 }
1071 }
1072
1073 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
1074 type Borrowed<'a> = &'a Self;
1075 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1076 value
1077 }
1078 }
1079
1080 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
1081 type Owned = Self;
1082
1083 #[inline(always)]
1084 fn inline_align(_context: fidl::encoding::Context) -> usize {
1085 8
1086 }
1087
1088 #[inline(always)]
1089 fn inline_size(_context: fidl::encoding::Context) -> usize {
1090 8
1091 }
1092 #[inline(always)]
1093 fn encode_is_copy() -> bool {
1094 true
1095 }
1096
1097 #[inline(always)]
1098 fn decode_is_copy() -> bool {
1099 true
1100 }
1101 }
1102
1103 unsafe impl<D: fidl::encoding::ResourceDialect>
1104 fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D>
1105 for &BatterySimulatorControllerSetTimeRemainingRequest
1106 {
1107 #[inline]
1108 unsafe fn encode(
1109 self,
1110 encoder: &mut fidl::encoding::Encoder<'_, D>,
1111 offset: usize,
1112 _depth: fidl::encoding::Depth,
1113 ) -> fidl::Result<()> {
1114 encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
1115 unsafe {
1116 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1118 (buf_ptr as *mut BatterySimulatorControllerSetTimeRemainingRequest)
1119 .write_unaligned(
1120 (self as *const BatterySimulatorControllerSetTimeRemainingRequest).read(),
1121 );
1122 }
1125 Ok(())
1126 }
1127 }
1128 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1129 fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D> for (T0,)
1130 {
1131 #[inline]
1132 unsafe fn encode(
1133 self,
1134 encoder: &mut fidl::encoding::Encoder<'_, D>,
1135 offset: usize,
1136 depth: fidl::encoding::Depth,
1137 ) -> fidl::Result<()> {
1138 encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
1139 self.0.encode(encoder, offset + 0, depth)?;
1143 Ok(())
1144 }
1145 }
1146
1147 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1148 for BatterySimulatorControllerSetTimeRemainingRequest
1149 {
1150 #[inline(always)]
1151 fn new_empty() -> Self {
1152 Self { duration: fidl::new_empty!(i64, D) }
1153 }
1154
1155 #[inline]
1156 unsafe fn decode(
1157 &mut self,
1158 decoder: &mut fidl::encoding::Decoder<'_, D>,
1159 offset: usize,
1160 _depth: fidl::encoding::Depth,
1161 ) -> fidl::Result<()> {
1162 decoder.debug_check_bounds::<Self>(offset);
1163 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1164 unsafe {
1167 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1168 }
1169 Ok(())
1170 }
1171 }
1172}