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!(fidl_fuchsia_power_battery_common::ChargeSource, D),
647 }
648 }
649
650 #[inline]
651 unsafe fn decode(
652 &mut self,
653 decoder: &mut fidl::encoding::Decoder<'_, D>,
654 offset: usize,
655 _depth: fidl::encoding::Depth,
656 ) -> fidl::Result<()> {
657 decoder.debug_check_bounds::<Self>(offset);
658 fidl::decode!(
660 fidl_fuchsia_power_battery_common::ChargeSource,
661 D,
662 &mut self.charge_source,
663 decoder,
664 offset + 0,
665 _depth
666 )?;
667 Ok(())
668 }
669 }
670
671 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
672 type Borrowed<'a> = &'a Self;
673 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
674 value
675 }
676 }
677
678 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetChargeStatusRequest {
679 type Owned = Self;
680
681 #[inline(always)]
682 fn inline_align(_context: fidl::encoding::Context) -> usize {
683 4
684 }
685
686 #[inline(always)]
687 fn inline_size(_context: fidl::encoding::Context) -> usize {
688 4
689 }
690 }
691
692 unsafe impl<D: fidl::encoding::ResourceDialect>
693 fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D>
694 for &BatterySimulatorControllerSetChargeStatusRequest
695 {
696 #[inline]
697 unsafe fn encode(
698 self,
699 encoder: &mut fidl::encoding::Encoder<'_, D>,
700 offset: usize,
701 _depth: fidl::encoding::Depth,
702 ) -> fidl::Result<()> {
703 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
704 fidl::encoding::Encode::<BatterySimulatorControllerSetChargeStatusRequest, D>::encode(
706 (
707 <fidl_fuchsia_power_battery_common::ChargeStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.charge_status),
708 ),
709 encoder, offset, _depth
710 )
711 }
712 }
713 unsafe impl<
714 D: fidl::encoding::ResourceDialect,
715 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery_common::ChargeStatus, D>,
716 > fidl::encoding::Encode<BatterySimulatorControllerSetChargeStatusRequest, D> for (T0,)
717 {
718 #[inline]
719 unsafe fn encode(
720 self,
721 encoder: &mut fidl::encoding::Encoder<'_, D>,
722 offset: usize,
723 depth: fidl::encoding::Depth,
724 ) -> fidl::Result<()> {
725 encoder.debug_check_bounds::<BatterySimulatorControllerSetChargeStatusRequest>(offset);
726 self.0.encode(encoder, offset + 0, depth)?;
730 Ok(())
731 }
732 }
733
734 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
735 for BatterySimulatorControllerSetChargeStatusRequest
736 {
737 #[inline(always)]
738 fn new_empty() -> Self {
739 Self {
740 charge_status: fidl::new_empty!(fidl_fuchsia_power_battery_common::ChargeStatus, D),
741 }
742 }
743
744 #[inline]
745 unsafe fn decode(
746 &mut self,
747 decoder: &mut fidl::encoding::Decoder<'_, D>,
748 offset: usize,
749 _depth: fidl::encoding::Depth,
750 ) -> fidl::Result<()> {
751 decoder.debug_check_bounds::<Self>(offset);
752 fidl::decode!(
754 fidl_fuchsia_power_battery_common::ChargeStatus,
755 D,
756 &mut self.charge_status,
757 decoder,
758 offset + 0,
759 _depth
760 )?;
761 Ok(())
762 }
763 }
764
765 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
766 type Borrowed<'a> = &'a Self;
767 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
768 value
769 }
770 }
771
772 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetLevelStatusRequest {
773 type Owned = Self;
774
775 #[inline(always)]
776 fn inline_align(_context: fidl::encoding::Context) -> usize {
777 4
778 }
779
780 #[inline(always)]
781 fn inline_size(_context: fidl::encoding::Context) -> usize {
782 4
783 }
784 }
785
786 unsafe impl<D: fidl::encoding::ResourceDialect>
787 fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D>
788 for &BatterySimulatorControllerSetLevelStatusRequest
789 {
790 #[inline]
791 unsafe fn encode(
792 self,
793 encoder: &mut fidl::encoding::Encoder<'_, D>,
794 offset: usize,
795 _depth: fidl::encoding::Depth,
796 ) -> fidl::Result<()> {
797 encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
798 fidl::encoding::Encode::<BatterySimulatorControllerSetLevelStatusRequest, D>::encode(
800 (
801 <fidl_fuchsia_power_battery_common::LevelStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.level_status),
802 ),
803 encoder, offset, _depth
804 )
805 }
806 }
807 unsafe impl<
808 D: fidl::encoding::ResourceDialect,
809 T0: fidl::encoding::Encode<fidl_fuchsia_power_battery_common::LevelStatus, D>,
810 > fidl::encoding::Encode<BatterySimulatorControllerSetLevelStatusRequest, D> for (T0,)
811 {
812 #[inline]
813 unsafe fn encode(
814 self,
815 encoder: &mut fidl::encoding::Encoder<'_, D>,
816 offset: usize,
817 depth: fidl::encoding::Depth,
818 ) -> fidl::Result<()> {
819 encoder.debug_check_bounds::<BatterySimulatorControllerSetLevelStatusRequest>(offset);
820 self.0.encode(encoder, offset + 0, depth)?;
824 Ok(())
825 }
826 }
827
828 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
829 for BatterySimulatorControllerSetLevelStatusRequest
830 {
831 #[inline(always)]
832 fn new_empty() -> Self {
833 Self {
834 level_status: fidl::new_empty!(fidl_fuchsia_power_battery_common::LevelStatus, D),
835 }
836 }
837
838 #[inline]
839 unsafe fn decode(
840 &mut self,
841 decoder: &mut fidl::encoding::Decoder<'_, D>,
842 offset: usize,
843 _depth: fidl::encoding::Depth,
844 ) -> fidl::Result<()> {
845 decoder.debug_check_bounds::<Self>(offset);
846 fidl::decode!(
848 fidl_fuchsia_power_battery_common::LevelStatus,
849 D,
850 &mut self.level_status,
851 decoder,
852 offset + 0,
853 _depth
854 )?;
855 Ok(())
856 }
857 }
858
859 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
860 type Borrowed<'a> = &'a Self;
861 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
862 value
863 }
864 }
865
866 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetPresentVoltageMvRequest {
867 type Owned = Self;
868
869 #[inline(always)]
870 fn inline_align(_context: fidl::encoding::Context) -> usize {
871 4
872 }
873
874 #[inline(always)]
875 fn inline_size(_context: fidl::encoding::Context) -> usize {
876 4
877 }
878 #[inline(always)]
879 fn encode_is_copy() -> bool {
880 true
881 }
882
883 #[inline(always)]
884 fn decode_is_copy() -> bool {
885 true
886 }
887 }
888
889 unsafe impl<D: fidl::encoding::ResourceDialect>
890 fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D>
891 for &BatterySimulatorControllerSetPresentVoltageMvRequest
892 {
893 #[inline]
894 unsafe fn encode(
895 self,
896 encoder: &mut fidl::encoding::Encoder<'_, D>,
897 offset: usize,
898 _depth: fidl::encoding::Depth,
899 ) -> fidl::Result<()> {
900 encoder
901 .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
902 unsafe {
903 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
905 (buf_ptr as *mut BatterySimulatorControllerSetPresentVoltageMvRequest)
906 .write_unaligned(
907 (self as *const BatterySimulatorControllerSetPresentVoltageMvRequest)
908 .read(),
909 );
910 }
913 Ok(())
914 }
915 }
916 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
917 fidl::encoding::Encode<BatterySimulatorControllerSetPresentVoltageMvRequest, D> for (T0,)
918 {
919 #[inline]
920 unsafe fn encode(
921 self,
922 encoder: &mut fidl::encoding::Encoder<'_, D>,
923 offset: usize,
924 depth: fidl::encoding::Depth,
925 ) -> fidl::Result<()> {
926 encoder
927 .debug_check_bounds::<BatterySimulatorControllerSetPresentVoltageMvRequest>(offset);
928 self.0.encode(encoder, offset + 0, depth)?;
932 Ok(())
933 }
934 }
935
936 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
937 for BatterySimulatorControllerSetPresentVoltageMvRequest
938 {
939 #[inline(always)]
940 fn new_empty() -> Self {
941 Self { voltage: fidl::new_empty!(u32, D) }
942 }
943
944 #[inline]
945 unsafe fn decode(
946 &mut self,
947 decoder: &mut fidl::encoding::Decoder<'_, D>,
948 offset: usize,
949 _depth: fidl::encoding::Depth,
950 ) -> fidl::Result<()> {
951 decoder.debug_check_bounds::<Self>(offset);
952 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
953 unsafe {
956 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
957 }
958 Ok(())
959 }
960 }
961
962 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetRemainingChargeUahRequest {
963 type Borrowed<'a> = &'a Self;
964 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
965 value
966 }
967 }
968
969 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetRemainingChargeUahRequest {
970 type Owned = Self;
971
972 #[inline(always)]
973 fn inline_align(_context: fidl::encoding::Context) -> usize {
974 4
975 }
976
977 #[inline(always)]
978 fn inline_size(_context: fidl::encoding::Context) -> usize {
979 4
980 }
981 #[inline(always)]
982 fn encode_is_copy() -> bool {
983 true
984 }
985
986 #[inline(always)]
987 fn decode_is_copy() -> bool {
988 true
989 }
990 }
991
992 unsafe impl<D: fidl::encoding::ResourceDialect>
993 fidl::encoding::Encode<BatterySimulatorControllerSetRemainingChargeUahRequest, D>
994 for &BatterySimulatorControllerSetRemainingChargeUahRequest
995 {
996 #[inline]
997 unsafe fn encode(
998 self,
999 encoder: &mut fidl::encoding::Encoder<'_, D>,
1000 offset: usize,
1001 _depth: fidl::encoding::Depth,
1002 ) -> fidl::Result<()> {
1003 encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingChargeUahRequest>(
1004 offset,
1005 );
1006 unsafe {
1007 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1009 (buf_ptr as *mut BatterySimulatorControllerSetRemainingChargeUahRequest)
1010 .write_unaligned(
1011 (self as *const BatterySimulatorControllerSetRemainingChargeUahRequest)
1012 .read(),
1013 );
1014 }
1017 Ok(())
1018 }
1019 }
1020 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1021 fidl::encoding::Encode<BatterySimulatorControllerSetRemainingChargeUahRequest, D> for (T0,)
1022 {
1023 #[inline]
1024 unsafe fn encode(
1025 self,
1026 encoder: &mut fidl::encoding::Encoder<'_, D>,
1027 offset: usize,
1028 depth: fidl::encoding::Depth,
1029 ) -> fidl::Result<()> {
1030 encoder.debug_check_bounds::<BatterySimulatorControllerSetRemainingChargeUahRequest>(
1031 offset,
1032 );
1033 self.0.encode(encoder, offset + 0, depth)?;
1037 Ok(())
1038 }
1039 }
1040
1041 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1042 for BatterySimulatorControllerSetRemainingChargeUahRequest
1043 {
1044 #[inline(always)]
1045 fn new_empty() -> Self {
1046 Self { charge: fidl::new_empty!(u32, D) }
1047 }
1048
1049 #[inline]
1050 unsafe fn decode(
1051 &mut self,
1052 decoder: &mut fidl::encoding::Decoder<'_, D>,
1053 offset: usize,
1054 _depth: fidl::encoding::Depth,
1055 ) -> fidl::Result<()> {
1056 decoder.debug_check_bounds::<Self>(offset);
1057 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1058 unsafe {
1061 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1062 }
1063 Ok(())
1064 }
1065 }
1066
1067 impl fidl::encoding::ValueTypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
1068 type Borrowed<'a> = &'a Self;
1069 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1070 value
1071 }
1072 }
1073
1074 unsafe impl fidl::encoding::TypeMarker for BatterySimulatorControllerSetTimeRemainingRequest {
1075 type Owned = Self;
1076
1077 #[inline(always)]
1078 fn inline_align(_context: fidl::encoding::Context) -> usize {
1079 8
1080 }
1081
1082 #[inline(always)]
1083 fn inline_size(_context: fidl::encoding::Context) -> usize {
1084 8
1085 }
1086 #[inline(always)]
1087 fn encode_is_copy() -> bool {
1088 true
1089 }
1090
1091 #[inline(always)]
1092 fn decode_is_copy() -> bool {
1093 true
1094 }
1095 }
1096
1097 unsafe impl<D: fidl::encoding::ResourceDialect>
1098 fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D>
1099 for &BatterySimulatorControllerSetTimeRemainingRequest
1100 {
1101 #[inline]
1102 unsafe fn encode(
1103 self,
1104 encoder: &mut fidl::encoding::Encoder<'_, D>,
1105 offset: usize,
1106 _depth: fidl::encoding::Depth,
1107 ) -> fidl::Result<()> {
1108 encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
1109 unsafe {
1110 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1112 (buf_ptr as *mut BatterySimulatorControllerSetTimeRemainingRequest)
1113 .write_unaligned(
1114 (self as *const BatterySimulatorControllerSetTimeRemainingRequest).read(),
1115 );
1116 }
1119 Ok(())
1120 }
1121 }
1122 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1123 fidl::encoding::Encode<BatterySimulatorControllerSetTimeRemainingRequest, D> for (T0,)
1124 {
1125 #[inline]
1126 unsafe fn encode(
1127 self,
1128 encoder: &mut fidl::encoding::Encoder<'_, D>,
1129 offset: usize,
1130 depth: fidl::encoding::Depth,
1131 ) -> fidl::Result<()> {
1132 encoder.debug_check_bounds::<BatterySimulatorControllerSetTimeRemainingRequest>(offset);
1133 self.0.encode(encoder, offset + 0, depth)?;
1137 Ok(())
1138 }
1139 }
1140
1141 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1142 for BatterySimulatorControllerSetTimeRemainingRequest
1143 {
1144 #[inline(always)]
1145 fn new_empty() -> Self {
1146 Self { duration: fidl::new_empty!(i64, D) }
1147 }
1148
1149 #[inline]
1150 unsafe fn decode(
1151 &mut self,
1152 decoder: &mut fidl::encoding::Decoder<'_, D>,
1153 offset: usize,
1154 _depth: fidl::encoding::Depth,
1155 ) -> fidl::Result<()> {
1156 decoder.debug_check_bounds::<Self>(offset);
1157 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1158 unsafe {
1161 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1162 }
1163 Ok(())
1164 }
1165 }
1166}