1#![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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub enum ActivateSensorError {
16 DriverUnavailable,
18 InvalidSensorId,
20 #[doc(hidden)]
21 __SourceBreaking { unknown_ordinal: u32 },
22}
23
24#[macro_export]
26macro_rules! ActivateSensorErrorUnknown {
27 () => {
28 _
29 };
30}
31
32impl ActivateSensorError {
33 #[inline]
34 pub fn from_primitive(prim: u32) -> Option<Self> {
35 match prim {
36 1 => Some(Self::DriverUnavailable),
37 2 => Some(Self::InvalidSensorId),
38 _ => None,
39 }
40 }
41
42 #[inline]
43 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
44 match prim {
45 1 => Self::DriverUnavailable,
46 2 => Self::InvalidSensorId,
47 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
48 }
49 }
50
51 #[inline]
52 pub fn unknown() -> Self {
53 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
54 }
55
56 #[inline]
57 pub const fn into_primitive(self) -> u32 {
58 match self {
59 Self::DriverUnavailable => 1,
60 Self::InvalidSensorId => 2,
61 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
62 }
63 }
64
65 #[inline]
66 pub fn is_unknown(&self) -> bool {
67 match self {
68 Self::__SourceBreaking { unknown_ordinal: _ } => true,
69 _ => false,
70 }
71 }
72}
73
74#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
76pub enum ConfigurePlaybackError {
77 PlaybackUnavailable,
79 InvalidConfigType,
81 ConfigMissingFields,
83 DuplicateSensorInfo,
85 NoEventsForSensor,
87 EventFromUnknownSensor,
90 EventSensorTypeMismatch,
93 EventPayloadTypeMismatch,
96 FileOpenFailed,
98 FileParseError,
106 #[doc(hidden)]
107 __SourceBreaking { unknown_ordinal: u32 },
108}
109
110#[macro_export]
112macro_rules! ConfigurePlaybackErrorUnknown {
113 () => {
114 _
115 };
116}
117
118impl ConfigurePlaybackError {
119 #[inline]
120 pub fn from_primitive(prim: u32) -> Option<Self> {
121 match prim {
122 1 => Some(Self::PlaybackUnavailable),
123 2 => Some(Self::InvalidConfigType),
124 3 => Some(Self::ConfigMissingFields),
125 4 => Some(Self::DuplicateSensorInfo),
126 5 => Some(Self::NoEventsForSensor),
127 6 => Some(Self::EventFromUnknownSensor),
128 7 => Some(Self::EventSensorTypeMismatch),
129 8 => Some(Self::EventPayloadTypeMismatch),
130 9 => Some(Self::FileOpenFailed),
131 10 => Some(Self::FileParseError),
132 _ => None,
133 }
134 }
135
136 #[inline]
137 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
138 match prim {
139 1 => Self::PlaybackUnavailable,
140 2 => Self::InvalidConfigType,
141 3 => Self::ConfigMissingFields,
142 4 => Self::DuplicateSensorInfo,
143 5 => Self::NoEventsForSensor,
144 6 => Self::EventFromUnknownSensor,
145 7 => Self::EventSensorTypeMismatch,
146 8 => Self::EventPayloadTypeMismatch,
147 9 => Self::FileOpenFailed,
148 10 => Self::FileParseError,
149 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
150 }
151 }
152
153 #[inline]
154 pub fn unknown() -> Self {
155 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
156 }
157
158 #[inline]
159 pub const fn into_primitive(self) -> u32 {
160 match self {
161 Self::PlaybackUnavailable => 1,
162 Self::InvalidConfigType => 2,
163 Self::ConfigMissingFields => 3,
164 Self::DuplicateSensorInfo => 4,
165 Self::NoEventsForSensor => 5,
166 Self::EventFromUnknownSensor => 6,
167 Self::EventSensorTypeMismatch => 7,
168 Self::EventPayloadTypeMismatch => 8,
169 Self::FileOpenFailed => 9,
170 Self::FileParseError => 10,
171 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
172 }
173 }
174
175 #[inline]
176 pub fn is_unknown(&self) -> bool {
177 match self {
178 Self::__SourceBreaking { unknown_ordinal: _ } => true,
179 _ => false,
180 }
181 }
182}
183
184#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
186pub enum ConfigureSensorRateError {
187 DriverUnavailable,
189 InvalidSensorId,
191 InvalidConfig,
194 #[doc(hidden)]
195 __SourceBreaking { unknown_ordinal: u32 },
196}
197
198#[macro_export]
200macro_rules! ConfigureSensorRateErrorUnknown {
201 () => {
202 _
203 };
204}
205
206impl ConfigureSensorRateError {
207 #[inline]
208 pub fn from_primitive(prim: u32) -> Option<Self> {
209 match prim {
210 1 => Some(Self::DriverUnavailable),
211 2 => Some(Self::InvalidSensorId),
212 3 => Some(Self::InvalidConfig),
213 _ => None,
214 }
215 }
216
217 #[inline]
218 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
219 match prim {
220 1 => Self::DriverUnavailable,
221 2 => Self::InvalidSensorId,
222 3 => Self::InvalidConfig,
223 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
224 }
225 }
226
227 #[inline]
228 pub fn unknown() -> Self {
229 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
230 }
231
232 #[inline]
233 pub const fn into_primitive(self) -> u32 {
234 match self {
235 Self::DriverUnavailable => 1,
236 Self::InvalidSensorId => 2,
237 Self::InvalidConfig => 3,
238 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
239 }
240 }
241
242 #[inline]
243 pub fn is_unknown(&self) -> bool {
244 match self {
245 Self::__SourceBreaking { unknown_ordinal: _ } => true,
246 _ => false,
247 }
248 }
249}
250
251#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
253pub enum DeactivateSensorError {
254 DriverUnavailable,
256 InvalidSensorId,
258 #[doc(hidden)]
259 __SourceBreaking { unknown_ordinal: u32 },
260}
261
262#[macro_export]
264macro_rules! DeactivateSensorErrorUnknown {
265 () => {
266 _
267 };
268}
269
270impl DeactivateSensorError {
271 #[inline]
272 pub fn from_primitive(prim: u32) -> Option<Self> {
273 match prim {
274 1 => Some(Self::DriverUnavailable),
275 2 => Some(Self::InvalidSensorId),
276 _ => None,
277 }
278 }
279
280 #[inline]
281 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
282 match prim {
283 1 => Self::DriverUnavailable,
284 2 => Self::InvalidSensorId,
285 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
286 }
287 }
288
289 #[inline]
290 pub fn unknown() -> Self {
291 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
292 }
293
294 #[inline]
295 pub const fn into_primitive(self) -> u32 {
296 match self {
297 Self::DriverUnavailable => 1,
298 Self::InvalidSensorId => 2,
299 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
300 }
301 }
302
303 #[inline]
304 pub fn is_unknown(&self) -> bool {
305 match self {
306 Self::__SourceBreaking { unknown_ordinal: _ } => true,
307 _ => false,
308 }
309 }
310}
311
312#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
313#[repr(C)]
314pub struct ManagerActivateRequest {
315 pub id: i32,
316}
317
318impl fidl::Persistable for ManagerActivateRequest {}
319
320#[derive(Clone, Debug, PartialEq)]
321pub struct ManagerConfigurePlaybackRequest {
322 pub source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
323}
324
325impl fidl::Persistable for ManagerConfigurePlaybackRequest {}
326
327#[derive(Debug, PartialEq)]
328pub struct ManagerConfigureSensorRatesRequest {
329 pub id: i32,
330 pub sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
331}
332
333impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
334 for ManagerConfigureSensorRatesRequest
335{
336}
337
338#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
339#[repr(C)]
340pub struct ManagerDeactivateRequest {
341 pub id: i32,
342}
343
344impl fidl::Persistable for ManagerDeactivateRequest {}
345
346#[derive(Clone, Debug, PartialEq)]
347pub struct ManagerOnSensorEventRequest {
348 pub event: fidl_fuchsia_sensors_types::SensorEvent,
349}
350
351impl fidl::Persistable for ManagerOnSensorEventRequest {}
352
353#[derive(Clone, Debug, PartialEq)]
354pub struct ManagerGetSensorsListResponse {
355 pub sensors: Vec<fidl_fuchsia_sensors_types::SensorInfo>,
356}
357
358impl fidl::Persistable for ManagerGetSensorsListResponse {}
359
360#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
361pub struct ManagerMarker;
362
363impl fidl::endpoints::ProtocolMarker for ManagerMarker {
364 type Proxy = ManagerProxy;
365 type RequestStream = ManagerRequestStream;
366 #[cfg(target_os = "fuchsia")]
367 type SynchronousProxy = ManagerSynchronousProxy;
368
369 const DEBUG_NAME: &'static str = "fuchsia.sensors.Manager";
370}
371impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
372pub type ManagerConfigurePlaybackResult = Result<(), ConfigurePlaybackError>;
373pub type ManagerConfigureSensorRatesResult = Result<(), ConfigureSensorRateError>;
374pub type ManagerActivateResult = Result<(), ActivateSensorError>;
375pub type ManagerDeactivateResult = Result<(), DeactivateSensorError>;
376
377pub trait ManagerProxyInterface: Send + Sync {
378 type ConfigurePlaybackResponseFut: std::future::Future<Output = Result<ManagerConfigurePlaybackResult, fidl::Error>>
379 + Send;
380 fn r#configure_playback(
381 &self,
382 source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
383 ) -> Self::ConfigurePlaybackResponseFut;
384 type GetSensorsListResponseFut: std::future::Future<
385 Output = Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error>,
386 > + Send;
387 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut;
388 type ConfigureSensorRatesResponseFut: std::future::Future<Output = Result<ManagerConfigureSensorRatesResult, fidl::Error>>
389 + Send;
390 fn r#configure_sensor_rates(
391 &self,
392 id: i32,
393 sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
394 ) -> Self::ConfigureSensorRatesResponseFut;
395 type ActivateResponseFut: std::future::Future<Output = Result<ManagerActivateResult, fidl::Error>>
396 + Send;
397 fn r#activate(&self, id: i32) -> Self::ActivateResponseFut;
398 type DeactivateResponseFut: std::future::Future<Output = Result<ManagerDeactivateResult, fidl::Error>>
399 + Send;
400 fn r#deactivate(&self, id: i32) -> Self::DeactivateResponseFut;
401}
402#[derive(Debug)]
403#[cfg(target_os = "fuchsia")]
404pub struct ManagerSynchronousProxy {
405 client: fidl::client::sync::Client,
406}
407
408#[cfg(target_os = "fuchsia")]
409impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
410 type Proxy = ManagerProxy;
411 type Protocol = ManagerMarker;
412
413 fn from_channel(inner: fidl::Channel) -> Self {
414 Self::new(inner)
415 }
416
417 fn into_channel(self) -> fidl::Channel {
418 self.client.into_channel()
419 }
420
421 fn as_channel(&self) -> &fidl::Channel {
422 self.client.as_channel()
423 }
424}
425
426#[cfg(target_os = "fuchsia")]
427impl ManagerSynchronousProxy {
428 pub fn new(channel: fidl::Channel) -> Self {
429 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
430 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
431 }
432
433 pub fn into_channel(self) -> fidl::Channel {
434 self.client.into_channel()
435 }
436
437 pub fn wait_for_event(
440 &self,
441 deadline: zx::MonotonicInstant,
442 ) -> Result<ManagerEvent, fidl::Error> {
443 ManagerEvent::decode(self.client.wait_for_event(deadline)?)
444 }
445
446 pub fn r#configure_playback(
450 &self,
451 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
452 ___deadline: zx::MonotonicInstant,
453 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
454 let _response =
455 self.client
456 .send_query::<ManagerConfigurePlaybackRequest, fidl::encoding::FlexibleResultType<
457 fidl::encoding::EmptyStruct,
458 ConfigurePlaybackError,
459 >>(
460 (source_config,),
461 0x2aec5d56edab43fa,
462 fidl::encoding::DynamicFlags::FLEXIBLE,
463 ___deadline,
464 )?
465 .into_result::<ManagerMarker>("configure_playback")?;
466 Ok(_response.map(|x| x))
467 }
468
469 pub fn r#get_sensors_list(
471 &self,
472 ___deadline: zx::MonotonicInstant,
473 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
474 let _response = self.client.send_query::<
475 fidl::encoding::EmptyPayload,
476 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
477 >(
478 (),
479 0x48cf103cfbec3a4a,
480 fidl::encoding::DynamicFlags::FLEXIBLE,
481 ___deadline,
482 )?
483 .into_result::<ManagerMarker>("get_sensors_list")?;
484 Ok(_response.sensors)
485 }
486
487 pub fn r#configure_sensor_rates(
489 &self,
490 mut id: i32,
491 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
492 ___deadline: zx::MonotonicInstant,
493 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
494 let _response = self
495 .client
496 .send_query::<ManagerConfigureSensorRatesRequest, fidl::encoding::FlexibleResultType<
497 fidl::encoding::EmptyStruct,
498 ConfigureSensorRateError,
499 >>(
500 (id, sensor_rate_config),
501 0x28046f7f3f340652,
502 fidl::encoding::DynamicFlags::FLEXIBLE,
503 ___deadline,
504 )?
505 .into_result::<ManagerMarker>("configure_sensor_rates")?;
506 Ok(_response.map(|x| x))
507 }
508
509 pub fn r#activate(
511 &self,
512 mut id: i32,
513 ___deadline: zx::MonotonicInstant,
514 ) -> Result<ManagerActivateResult, fidl::Error> {
515 let _response =
516 self.client
517 .send_query::<ManagerActivateRequest, fidl::encoding::FlexibleResultType<
518 fidl::encoding::EmptyStruct,
519 ActivateSensorError,
520 >>(
521 (id,), 0x5678f117cae5ba42, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
522 )?
523 .into_result::<ManagerMarker>("activate")?;
524 Ok(_response.map(|x| x))
525 }
526
527 pub fn r#deactivate(
529 &self,
530 mut id: i32,
531 ___deadline: zx::MonotonicInstant,
532 ) -> Result<ManagerDeactivateResult, fidl::Error> {
533 let _response =
534 self.client
535 .send_query::<ManagerDeactivateRequest, fidl::encoding::FlexibleResultType<
536 fidl::encoding::EmptyStruct,
537 DeactivateSensorError,
538 >>(
539 (id,), 0x7fafbca62982c87, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
540 )?
541 .into_result::<ManagerMarker>("deactivate")?;
542 Ok(_response.map(|x| x))
543 }
544}
545
546#[derive(Debug, Clone)]
547pub struct ManagerProxy {
548 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
549}
550
551impl fidl::endpoints::Proxy for ManagerProxy {
552 type Protocol = ManagerMarker;
553
554 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
555 Self::new(inner)
556 }
557
558 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
559 self.client.into_channel().map_err(|client| Self { client })
560 }
561
562 fn as_channel(&self) -> &::fidl::AsyncChannel {
563 self.client.as_channel()
564 }
565}
566
567impl ManagerProxy {
568 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
570 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
571 Self { client: fidl::client::Client::new(channel, protocol_name) }
572 }
573
574 pub fn take_event_stream(&self) -> ManagerEventStream {
580 ManagerEventStream { event_receiver: self.client.take_event_receiver() }
581 }
582
583 pub fn r#configure_playback(
587 &self,
588 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
589 ) -> fidl::client::QueryResponseFut<
590 ManagerConfigurePlaybackResult,
591 fidl::encoding::DefaultFuchsiaResourceDialect,
592 > {
593 ManagerProxyInterface::r#configure_playback(self, source_config)
594 }
595
596 pub fn r#get_sensors_list(
598 &self,
599 ) -> fidl::client::QueryResponseFut<
600 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
601 fidl::encoding::DefaultFuchsiaResourceDialect,
602 > {
603 ManagerProxyInterface::r#get_sensors_list(self)
604 }
605
606 pub fn r#configure_sensor_rates(
608 &self,
609 mut id: i32,
610 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
611 ) -> fidl::client::QueryResponseFut<
612 ManagerConfigureSensorRatesResult,
613 fidl::encoding::DefaultFuchsiaResourceDialect,
614 > {
615 ManagerProxyInterface::r#configure_sensor_rates(self, id, sensor_rate_config)
616 }
617
618 pub fn r#activate(
620 &self,
621 mut id: i32,
622 ) -> fidl::client::QueryResponseFut<
623 ManagerActivateResult,
624 fidl::encoding::DefaultFuchsiaResourceDialect,
625 > {
626 ManagerProxyInterface::r#activate(self, id)
627 }
628
629 pub fn r#deactivate(
631 &self,
632 mut id: i32,
633 ) -> fidl::client::QueryResponseFut<
634 ManagerDeactivateResult,
635 fidl::encoding::DefaultFuchsiaResourceDialect,
636 > {
637 ManagerProxyInterface::r#deactivate(self, id)
638 }
639}
640
641impl ManagerProxyInterface for ManagerProxy {
642 type ConfigurePlaybackResponseFut = fidl::client::QueryResponseFut<
643 ManagerConfigurePlaybackResult,
644 fidl::encoding::DefaultFuchsiaResourceDialect,
645 >;
646 fn r#configure_playback(
647 &self,
648 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
649 ) -> Self::ConfigurePlaybackResponseFut {
650 fn _decode(
651 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
652 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
653 let _response = fidl::client::decode_transaction_body::<
654 fidl::encoding::FlexibleResultType<
655 fidl::encoding::EmptyStruct,
656 ConfigurePlaybackError,
657 >,
658 fidl::encoding::DefaultFuchsiaResourceDialect,
659 0x2aec5d56edab43fa,
660 >(_buf?)?
661 .into_result::<ManagerMarker>("configure_playback")?;
662 Ok(_response.map(|x| x))
663 }
664 self.client.send_query_and_decode::<
665 ManagerConfigurePlaybackRequest,
666 ManagerConfigurePlaybackResult,
667 >(
668 (source_config,),
669 0x2aec5d56edab43fa,
670 fidl::encoding::DynamicFlags::FLEXIBLE,
671 _decode,
672 )
673 }
674
675 type GetSensorsListResponseFut = fidl::client::QueryResponseFut<
676 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
677 fidl::encoding::DefaultFuchsiaResourceDialect,
678 >;
679 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut {
680 fn _decode(
681 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
682 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
683 let _response = fidl::client::decode_transaction_body::<
684 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
685 fidl::encoding::DefaultFuchsiaResourceDialect,
686 0x48cf103cfbec3a4a,
687 >(_buf?)?
688 .into_result::<ManagerMarker>("get_sensors_list")?;
689 Ok(_response.sensors)
690 }
691 self.client.send_query_and_decode::<
692 fidl::encoding::EmptyPayload,
693 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
694 >(
695 (),
696 0x48cf103cfbec3a4a,
697 fidl::encoding::DynamicFlags::FLEXIBLE,
698 _decode,
699 )
700 }
701
702 type ConfigureSensorRatesResponseFut = fidl::client::QueryResponseFut<
703 ManagerConfigureSensorRatesResult,
704 fidl::encoding::DefaultFuchsiaResourceDialect,
705 >;
706 fn r#configure_sensor_rates(
707 &self,
708 mut id: i32,
709 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
710 ) -> Self::ConfigureSensorRatesResponseFut {
711 fn _decode(
712 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
713 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
714 let _response = fidl::client::decode_transaction_body::<
715 fidl::encoding::FlexibleResultType<
716 fidl::encoding::EmptyStruct,
717 ConfigureSensorRateError,
718 >,
719 fidl::encoding::DefaultFuchsiaResourceDialect,
720 0x28046f7f3f340652,
721 >(_buf?)?
722 .into_result::<ManagerMarker>("configure_sensor_rates")?;
723 Ok(_response.map(|x| x))
724 }
725 self.client.send_query_and_decode::<
726 ManagerConfigureSensorRatesRequest,
727 ManagerConfigureSensorRatesResult,
728 >(
729 (id, sensor_rate_config,),
730 0x28046f7f3f340652,
731 fidl::encoding::DynamicFlags::FLEXIBLE,
732 _decode,
733 )
734 }
735
736 type ActivateResponseFut = fidl::client::QueryResponseFut<
737 ManagerActivateResult,
738 fidl::encoding::DefaultFuchsiaResourceDialect,
739 >;
740 fn r#activate(&self, mut id: i32) -> Self::ActivateResponseFut {
741 fn _decode(
742 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
743 ) -> Result<ManagerActivateResult, fidl::Error> {
744 let _response = fidl::client::decode_transaction_body::<
745 fidl::encoding::FlexibleResultType<
746 fidl::encoding::EmptyStruct,
747 ActivateSensorError,
748 >,
749 fidl::encoding::DefaultFuchsiaResourceDialect,
750 0x5678f117cae5ba42,
751 >(_buf?)?
752 .into_result::<ManagerMarker>("activate")?;
753 Ok(_response.map(|x| x))
754 }
755 self.client.send_query_and_decode::<ManagerActivateRequest, ManagerActivateResult>(
756 (id,),
757 0x5678f117cae5ba42,
758 fidl::encoding::DynamicFlags::FLEXIBLE,
759 _decode,
760 )
761 }
762
763 type DeactivateResponseFut = fidl::client::QueryResponseFut<
764 ManagerDeactivateResult,
765 fidl::encoding::DefaultFuchsiaResourceDialect,
766 >;
767 fn r#deactivate(&self, mut id: i32) -> Self::DeactivateResponseFut {
768 fn _decode(
769 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
770 ) -> Result<ManagerDeactivateResult, fidl::Error> {
771 let _response = fidl::client::decode_transaction_body::<
772 fidl::encoding::FlexibleResultType<
773 fidl::encoding::EmptyStruct,
774 DeactivateSensorError,
775 >,
776 fidl::encoding::DefaultFuchsiaResourceDialect,
777 0x7fafbca62982c87,
778 >(_buf?)?
779 .into_result::<ManagerMarker>("deactivate")?;
780 Ok(_response.map(|x| x))
781 }
782 self.client.send_query_and_decode::<ManagerDeactivateRequest, ManagerDeactivateResult>(
783 (id,),
784 0x7fafbca62982c87,
785 fidl::encoding::DynamicFlags::FLEXIBLE,
786 _decode,
787 )
788 }
789}
790
791pub struct ManagerEventStream {
792 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
793}
794
795impl std::marker::Unpin for ManagerEventStream {}
796
797impl futures::stream::FusedStream for ManagerEventStream {
798 fn is_terminated(&self) -> bool {
799 self.event_receiver.is_terminated()
800 }
801}
802
803impl futures::Stream for ManagerEventStream {
804 type Item = Result<ManagerEvent, fidl::Error>;
805
806 fn poll_next(
807 mut self: std::pin::Pin<&mut Self>,
808 cx: &mut std::task::Context<'_>,
809 ) -> std::task::Poll<Option<Self::Item>> {
810 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
811 &mut self.event_receiver,
812 cx
813 )?) {
814 Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
815 None => std::task::Poll::Ready(None),
816 }
817 }
818}
819
820#[derive(Debug)]
821pub enum ManagerEvent {
822 OnSensorEvent {
823 event: fidl_fuchsia_sensors_types::SensorEvent,
824 },
825 #[non_exhaustive]
826 _UnknownEvent {
827 ordinal: u64,
829 },
830}
831
832impl ManagerEvent {
833 #[allow(irrefutable_let_patterns)]
834 pub fn into_on_sensor_event(self) -> Option<fidl_fuchsia_sensors_types::SensorEvent> {
835 if let ManagerEvent::OnSensorEvent { event } = self {
836 Some((event))
837 } else {
838 None
839 }
840 }
841
842 fn decode(
844 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
845 ) -> Result<ManagerEvent, fidl::Error> {
846 let (bytes, _handles) = buf.split_mut();
847 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
848 debug_assert_eq!(tx_header.tx_id, 0);
849 match tx_header.ordinal {
850 0x6ceb07e11d43e9b => {
851 let mut out = fidl::new_empty!(
852 ManagerOnSensorEventRequest,
853 fidl::encoding::DefaultFuchsiaResourceDialect
854 );
855 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerOnSensorEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
856 Ok((ManagerEvent::OnSensorEvent { event: out.event }))
857 }
858 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
859 Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
860 }
861 _ => Err(fidl::Error::UnknownOrdinal {
862 ordinal: tx_header.ordinal,
863 protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
864 }),
865 }
866 }
867}
868
869pub struct ManagerRequestStream {
871 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
872 is_terminated: bool,
873}
874
875impl std::marker::Unpin for ManagerRequestStream {}
876
877impl futures::stream::FusedStream for ManagerRequestStream {
878 fn is_terminated(&self) -> bool {
879 self.is_terminated
880 }
881}
882
883impl fidl::endpoints::RequestStream for ManagerRequestStream {
884 type Protocol = ManagerMarker;
885 type ControlHandle = ManagerControlHandle;
886
887 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
888 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
889 }
890
891 fn control_handle(&self) -> Self::ControlHandle {
892 ManagerControlHandle { inner: self.inner.clone() }
893 }
894
895 fn into_inner(
896 self,
897 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
898 {
899 (self.inner, self.is_terminated)
900 }
901
902 fn from_inner(
903 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
904 is_terminated: bool,
905 ) -> Self {
906 Self { inner, is_terminated }
907 }
908}
909
910impl futures::Stream for ManagerRequestStream {
911 type Item = Result<ManagerRequest, fidl::Error>;
912
913 fn poll_next(
914 mut self: std::pin::Pin<&mut Self>,
915 cx: &mut std::task::Context<'_>,
916 ) -> std::task::Poll<Option<Self::Item>> {
917 let this = &mut *self;
918 if this.inner.check_shutdown(cx) {
919 this.is_terminated = true;
920 return std::task::Poll::Ready(None);
921 }
922 if this.is_terminated {
923 panic!("polled ManagerRequestStream after completion");
924 }
925 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
926 |bytes, handles| {
927 match this.inner.channel().read_etc(cx, bytes, handles) {
928 std::task::Poll::Ready(Ok(())) => {}
929 std::task::Poll::Pending => return std::task::Poll::Pending,
930 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
931 this.is_terminated = true;
932 return std::task::Poll::Ready(None);
933 }
934 std::task::Poll::Ready(Err(e)) => {
935 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
936 e.into(),
937 ))))
938 }
939 }
940
941 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
943
944 std::task::Poll::Ready(Some(match header.ordinal {
945 0x2aec5d56edab43fa => {
946 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
947 let mut req = fidl::new_empty!(
948 ManagerConfigurePlaybackRequest,
949 fidl::encoding::DefaultFuchsiaResourceDialect
950 );
951 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigurePlaybackRequest>(&header, _body_bytes, handles, &mut req)?;
952 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
953 Ok(ManagerRequest::ConfigurePlayback {
954 source_config: req.source_config,
955
956 responder: ManagerConfigurePlaybackResponder {
957 control_handle: std::mem::ManuallyDrop::new(control_handle),
958 tx_id: header.tx_id,
959 },
960 })
961 }
962 0x48cf103cfbec3a4a => {
963 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
964 let mut req = fidl::new_empty!(
965 fidl::encoding::EmptyPayload,
966 fidl::encoding::DefaultFuchsiaResourceDialect
967 );
968 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
969 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
970 Ok(ManagerRequest::GetSensorsList {
971 responder: ManagerGetSensorsListResponder {
972 control_handle: std::mem::ManuallyDrop::new(control_handle),
973 tx_id: header.tx_id,
974 },
975 })
976 }
977 0x28046f7f3f340652 => {
978 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
979 let mut req = fidl::new_empty!(
980 ManagerConfigureSensorRatesRequest,
981 fidl::encoding::DefaultFuchsiaResourceDialect
982 );
983 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigureSensorRatesRequest>(&header, _body_bytes, handles, &mut req)?;
984 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
985 Ok(ManagerRequest::ConfigureSensorRates {
986 id: req.id,
987 sensor_rate_config: req.sensor_rate_config,
988
989 responder: ManagerConfigureSensorRatesResponder {
990 control_handle: std::mem::ManuallyDrop::new(control_handle),
991 tx_id: header.tx_id,
992 },
993 })
994 }
995 0x5678f117cae5ba42 => {
996 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
997 let mut req = fidl::new_empty!(
998 ManagerActivateRequest,
999 fidl::encoding::DefaultFuchsiaResourceDialect
1000 );
1001 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
1002 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
1003 Ok(ManagerRequest::Activate {
1004 id: req.id,
1005
1006 responder: ManagerActivateResponder {
1007 control_handle: std::mem::ManuallyDrop::new(control_handle),
1008 tx_id: header.tx_id,
1009 },
1010 })
1011 }
1012 0x7fafbca62982c87 => {
1013 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1014 let mut req = fidl::new_empty!(
1015 ManagerDeactivateRequest,
1016 fidl::encoding::DefaultFuchsiaResourceDialect
1017 );
1018 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerDeactivateRequest>(&header, _body_bytes, handles, &mut req)?;
1019 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
1020 Ok(ManagerRequest::Deactivate {
1021 id: req.id,
1022
1023 responder: ManagerDeactivateResponder {
1024 control_handle: std::mem::ManuallyDrop::new(control_handle),
1025 tx_id: header.tx_id,
1026 },
1027 })
1028 }
1029 _ if header.tx_id == 0
1030 && header
1031 .dynamic_flags()
1032 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1033 {
1034 Ok(ManagerRequest::_UnknownMethod {
1035 ordinal: header.ordinal,
1036 control_handle: ManagerControlHandle { inner: this.inner.clone() },
1037 method_type: fidl::MethodType::OneWay,
1038 })
1039 }
1040 _ if header
1041 .dynamic_flags()
1042 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1043 {
1044 this.inner.send_framework_err(
1045 fidl::encoding::FrameworkErr::UnknownMethod,
1046 header.tx_id,
1047 header.ordinal,
1048 header.dynamic_flags(),
1049 (bytes, handles),
1050 )?;
1051 Ok(ManagerRequest::_UnknownMethod {
1052 ordinal: header.ordinal,
1053 control_handle: ManagerControlHandle { inner: this.inner.clone() },
1054 method_type: fidl::MethodType::TwoWay,
1055 })
1056 }
1057 _ => Err(fidl::Error::UnknownOrdinal {
1058 ordinal: header.ordinal,
1059 protocol_name:
1060 <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1061 }),
1062 }))
1063 },
1064 )
1065 }
1066}
1067
1068#[derive(Debug)]
1069pub enum ManagerRequest {
1070 ConfigurePlayback {
1074 source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
1075 responder: ManagerConfigurePlaybackResponder,
1076 },
1077 GetSensorsList { responder: ManagerGetSensorsListResponder },
1079 ConfigureSensorRates {
1081 id: i32,
1082 sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
1083 responder: ManagerConfigureSensorRatesResponder,
1084 },
1085 Activate { id: i32, responder: ManagerActivateResponder },
1087 Deactivate { id: i32, responder: ManagerDeactivateResponder },
1089 #[non_exhaustive]
1091 _UnknownMethod {
1092 ordinal: u64,
1094 control_handle: ManagerControlHandle,
1095 method_type: fidl::MethodType,
1096 },
1097}
1098
1099impl ManagerRequest {
1100 #[allow(irrefutable_let_patterns)]
1101 pub fn into_configure_playback(
1102 self,
1103 ) -> Option<(
1104 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
1105 ManagerConfigurePlaybackResponder,
1106 )> {
1107 if let ManagerRequest::ConfigurePlayback { source_config, responder } = self {
1108 Some((source_config, responder))
1109 } else {
1110 None
1111 }
1112 }
1113
1114 #[allow(irrefutable_let_patterns)]
1115 pub fn into_get_sensors_list(self) -> Option<(ManagerGetSensorsListResponder)> {
1116 if let ManagerRequest::GetSensorsList { responder } = self {
1117 Some((responder))
1118 } else {
1119 None
1120 }
1121 }
1122
1123 #[allow(irrefutable_let_patterns)]
1124 pub fn into_configure_sensor_rates(
1125 self,
1126 ) -> Option<(
1127 i32,
1128 fidl_fuchsia_sensors_types::SensorRateConfig,
1129 ManagerConfigureSensorRatesResponder,
1130 )> {
1131 if let ManagerRequest::ConfigureSensorRates { id, sensor_rate_config, responder } = self {
1132 Some((id, sensor_rate_config, responder))
1133 } else {
1134 None
1135 }
1136 }
1137
1138 #[allow(irrefutable_let_patterns)]
1139 pub fn into_activate(self) -> Option<(i32, ManagerActivateResponder)> {
1140 if let ManagerRequest::Activate { id, responder } = self {
1141 Some((id, responder))
1142 } else {
1143 None
1144 }
1145 }
1146
1147 #[allow(irrefutable_let_patterns)]
1148 pub fn into_deactivate(self) -> Option<(i32, ManagerDeactivateResponder)> {
1149 if let ManagerRequest::Deactivate { id, responder } = self {
1150 Some((id, responder))
1151 } else {
1152 None
1153 }
1154 }
1155
1156 pub fn method_name(&self) -> &'static str {
1158 match *self {
1159 ManagerRequest::ConfigurePlayback { .. } => "configure_playback",
1160 ManagerRequest::GetSensorsList { .. } => "get_sensors_list",
1161 ManagerRequest::ConfigureSensorRates { .. } => "configure_sensor_rates",
1162 ManagerRequest::Activate { .. } => "activate",
1163 ManagerRequest::Deactivate { .. } => "deactivate",
1164 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1165 "unknown one-way method"
1166 }
1167 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1168 "unknown two-way method"
1169 }
1170 }
1171 }
1172}
1173
1174#[derive(Debug, Clone)]
1175pub struct ManagerControlHandle {
1176 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1177}
1178
1179impl fidl::endpoints::ControlHandle for ManagerControlHandle {
1180 fn shutdown(&self) {
1181 self.inner.shutdown()
1182 }
1183 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1184 self.inner.shutdown_with_epitaph(status)
1185 }
1186
1187 fn is_closed(&self) -> bool {
1188 self.inner.channel().is_closed()
1189 }
1190 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1191 self.inner.channel().on_closed()
1192 }
1193
1194 #[cfg(target_os = "fuchsia")]
1195 fn signal_peer(
1196 &self,
1197 clear_mask: zx::Signals,
1198 set_mask: zx::Signals,
1199 ) -> Result<(), zx_status::Status> {
1200 use fidl::Peered;
1201 self.inner.channel().signal_peer(clear_mask, set_mask)
1202 }
1203}
1204
1205impl ManagerControlHandle {
1206 pub fn send_on_sensor_event(
1207 &self,
1208 mut event: &fidl_fuchsia_sensors_types::SensorEvent,
1209 ) -> Result<(), fidl::Error> {
1210 self.inner.send::<ManagerOnSensorEventRequest>(
1211 (event,),
1212 0,
1213 0x6ceb07e11d43e9b,
1214 fidl::encoding::DynamicFlags::FLEXIBLE,
1215 )
1216 }
1217}
1218
1219#[must_use = "FIDL methods require a response to be sent"]
1220#[derive(Debug)]
1221pub struct ManagerConfigurePlaybackResponder {
1222 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1223 tx_id: u32,
1224}
1225
1226impl std::ops::Drop for ManagerConfigurePlaybackResponder {
1230 fn drop(&mut self) {
1231 self.control_handle.shutdown();
1232 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1234 }
1235}
1236
1237impl fidl::endpoints::Responder for ManagerConfigurePlaybackResponder {
1238 type ControlHandle = ManagerControlHandle;
1239
1240 fn control_handle(&self) -> &ManagerControlHandle {
1241 &self.control_handle
1242 }
1243
1244 fn drop_without_shutdown(mut self) {
1245 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1247 std::mem::forget(self);
1249 }
1250}
1251
1252impl ManagerConfigurePlaybackResponder {
1253 pub fn send(self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
1257 let _result = self.send_raw(result);
1258 if _result.is_err() {
1259 self.control_handle.shutdown();
1260 }
1261 self.drop_without_shutdown();
1262 _result
1263 }
1264
1265 pub fn send_no_shutdown_on_err(
1267 self,
1268 mut result: Result<(), ConfigurePlaybackError>,
1269 ) -> Result<(), fidl::Error> {
1270 let _result = self.send_raw(result);
1271 self.drop_without_shutdown();
1272 _result
1273 }
1274
1275 fn send_raw(&self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
1276 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1277 fidl::encoding::EmptyStruct,
1278 ConfigurePlaybackError,
1279 >>(
1280 fidl::encoding::FlexibleResult::new(result),
1281 self.tx_id,
1282 0x2aec5d56edab43fa,
1283 fidl::encoding::DynamicFlags::FLEXIBLE,
1284 )
1285 }
1286}
1287
1288#[must_use = "FIDL methods require a response to be sent"]
1289#[derive(Debug)]
1290pub struct ManagerGetSensorsListResponder {
1291 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1292 tx_id: u32,
1293}
1294
1295impl std::ops::Drop for ManagerGetSensorsListResponder {
1299 fn drop(&mut self) {
1300 self.control_handle.shutdown();
1301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1303 }
1304}
1305
1306impl fidl::endpoints::Responder for ManagerGetSensorsListResponder {
1307 type ControlHandle = ManagerControlHandle;
1308
1309 fn control_handle(&self) -> &ManagerControlHandle {
1310 &self.control_handle
1311 }
1312
1313 fn drop_without_shutdown(mut self) {
1314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1316 std::mem::forget(self);
1318 }
1319}
1320
1321impl ManagerGetSensorsListResponder {
1322 pub fn send(
1326 self,
1327 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1328 ) -> Result<(), fidl::Error> {
1329 let _result = self.send_raw(sensors);
1330 if _result.is_err() {
1331 self.control_handle.shutdown();
1332 }
1333 self.drop_without_shutdown();
1334 _result
1335 }
1336
1337 pub fn send_no_shutdown_on_err(
1339 self,
1340 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1341 ) -> Result<(), fidl::Error> {
1342 let _result = self.send_raw(sensors);
1343 self.drop_without_shutdown();
1344 _result
1345 }
1346
1347 fn send_raw(
1348 &self,
1349 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1350 ) -> Result<(), fidl::Error> {
1351 self.control_handle
1352 .inner
1353 .send::<fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>>(
1354 fidl::encoding::Flexible::new((sensors,)),
1355 self.tx_id,
1356 0x48cf103cfbec3a4a,
1357 fidl::encoding::DynamicFlags::FLEXIBLE,
1358 )
1359 }
1360}
1361
1362#[must_use = "FIDL methods require a response to be sent"]
1363#[derive(Debug)]
1364pub struct ManagerConfigureSensorRatesResponder {
1365 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1366 tx_id: u32,
1367}
1368
1369impl std::ops::Drop for ManagerConfigureSensorRatesResponder {
1373 fn drop(&mut self) {
1374 self.control_handle.shutdown();
1375 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1377 }
1378}
1379
1380impl fidl::endpoints::Responder for ManagerConfigureSensorRatesResponder {
1381 type ControlHandle = ManagerControlHandle;
1382
1383 fn control_handle(&self) -> &ManagerControlHandle {
1384 &self.control_handle
1385 }
1386
1387 fn drop_without_shutdown(mut self) {
1388 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1390 std::mem::forget(self);
1392 }
1393}
1394
1395impl ManagerConfigureSensorRatesResponder {
1396 pub fn send(self, mut result: Result<(), ConfigureSensorRateError>) -> Result<(), fidl::Error> {
1400 let _result = self.send_raw(result);
1401 if _result.is_err() {
1402 self.control_handle.shutdown();
1403 }
1404 self.drop_without_shutdown();
1405 _result
1406 }
1407
1408 pub fn send_no_shutdown_on_err(
1410 self,
1411 mut result: Result<(), ConfigureSensorRateError>,
1412 ) -> Result<(), fidl::Error> {
1413 let _result = self.send_raw(result);
1414 self.drop_without_shutdown();
1415 _result
1416 }
1417
1418 fn send_raw(
1419 &self,
1420 mut result: Result<(), ConfigureSensorRateError>,
1421 ) -> Result<(), fidl::Error> {
1422 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1423 fidl::encoding::EmptyStruct,
1424 ConfigureSensorRateError,
1425 >>(
1426 fidl::encoding::FlexibleResult::new(result),
1427 self.tx_id,
1428 0x28046f7f3f340652,
1429 fidl::encoding::DynamicFlags::FLEXIBLE,
1430 )
1431 }
1432}
1433
1434#[must_use = "FIDL methods require a response to be sent"]
1435#[derive(Debug)]
1436pub struct ManagerActivateResponder {
1437 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1438 tx_id: u32,
1439}
1440
1441impl std::ops::Drop for ManagerActivateResponder {
1445 fn drop(&mut self) {
1446 self.control_handle.shutdown();
1447 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1449 }
1450}
1451
1452impl fidl::endpoints::Responder for ManagerActivateResponder {
1453 type ControlHandle = ManagerControlHandle;
1454
1455 fn control_handle(&self) -> &ManagerControlHandle {
1456 &self.control_handle
1457 }
1458
1459 fn drop_without_shutdown(mut self) {
1460 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1462 std::mem::forget(self);
1464 }
1465}
1466
1467impl ManagerActivateResponder {
1468 pub fn send(self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1472 let _result = self.send_raw(result);
1473 if _result.is_err() {
1474 self.control_handle.shutdown();
1475 }
1476 self.drop_without_shutdown();
1477 _result
1478 }
1479
1480 pub fn send_no_shutdown_on_err(
1482 self,
1483 mut result: Result<(), ActivateSensorError>,
1484 ) -> Result<(), fidl::Error> {
1485 let _result = self.send_raw(result);
1486 self.drop_without_shutdown();
1487 _result
1488 }
1489
1490 fn send_raw(&self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1491 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1492 fidl::encoding::EmptyStruct,
1493 ActivateSensorError,
1494 >>(
1495 fidl::encoding::FlexibleResult::new(result),
1496 self.tx_id,
1497 0x5678f117cae5ba42,
1498 fidl::encoding::DynamicFlags::FLEXIBLE,
1499 )
1500 }
1501}
1502
1503#[must_use = "FIDL methods require a response to be sent"]
1504#[derive(Debug)]
1505pub struct ManagerDeactivateResponder {
1506 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1507 tx_id: u32,
1508}
1509
1510impl std::ops::Drop for ManagerDeactivateResponder {
1514 fn drop(&mut self) {
1515 self.control_handle.shutdown();
1516 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1518 }
1519}
1520
1521impl fidl::endpoints::Responder for ManagerDeactivateResponder {
1522 type ControlHandle = ManagerControlHandle;
1523
1524 fn control_handle(&self) -> &ManagerControlHandle {
1525 &self.control_handle
1526 }
1527
1528 fn drop_without_shutdown(mut self) {
1529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1531 std::mem::forget(self);
1533 }
1534}
1535
1536impl ManagerDeactivateResponder {
1537 pub fn send(self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1541 let _result = self.send_raw(result);
1542 if _result.is_err() {
1543 self.control_handle.shutdown();
1544 }
1545 self.drop_without_shutdown();
1546 _result
1547 }
1548
1549 pub fn send_no_shutdown_on_err(
1551 self,
1552 mut result: Result<(), DeactivateSensorError>,
1553 ) -> Result<(), fidl::Error> {
1554 let _result = self.send_raw(result);
1555 self.drop_without_shutdown();
1556 _result
1557 }
1558
1559 fn send_raw(&self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1560 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1561 fidl::encoding::EmptyStruct,
1562 DeactivateSensorError,
1563 >>(
1564 fidl::encoding::FlexibleResult::new(result),
1565 self.tx_id,
1566 0x7fafbca62982c87,
1567 fidl::encoding::DynamicFlags::FLEXIBLE,
1568 )
1569 }
1570}
1571
1572mod internal {
1573 use super::*;
1574 unsafe impl fidl::encoding::TypeMarker for ActivateSensorError {
1575 type Owned = Self;
1576
1577 #[inline(always)]
1578 fn inline_align(_context: fidl::encoding::Context) -> usize {
1579 std::mem::align_of::<u32>()
1580 }
1581
1582 #[inline(always)]
1583 fn inline_size(_context: fidl::encoding::Context) -> usize {
1584 std::mem::size_of::<u32>()
1585 }
1586
1587 #[inline(always)]
1588 fn encode_is_copy() -> bool {
1589 false
1590 }
1591
1592 #[inline(always)]
1593 fn decode_is_copy() -> bool {
1594 false
1595 }
1596 }
1597
1598 impl fidl::encoding::ValueTypeMarker for ActivateSensorError {
1599 type Borrowed<'a> = Self;
1600 #[inline(always)]
1601 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1602 *value
1603 }
1604 }
1605
1606 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1607 for ActivateSensorError
1608 {
1609 #[inline]
1610 unsafe fn encode(
1611 self,
1612 encoder: &mut fidl::encoding::Encoder<'_, D>,
1613 offset: usize,
1614 _depth: fidl::encoding::Depth,
1615 ) -> fidl::Result<()> {
1616 encoder.debug_check_bounds::<Self>(offset);
1617 encoder.write_num(self.into_primitive(), offset);
1618 Ok(())
1619 }
1620 }
1621
1622 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActivateSensorError {
1623 #[inline(always)]
1624 fn new_empty() -> Self {
1625 Self::unknown()
1626 }
1627
1628 #[inline]
1629 unsafe fn decode(
1630 &mut self,
1631 decoder: &mut fidl::encoding::Decoder<'_, D>,
1632 offset: usize,
1633 _depth: fidl::encoding::Depth,
1634 ) -> fidl::Result<()> {
1635 decoder.debug_check_bounds::<Self>(offset);
1636 let prim = decoder.read_num::<u32>(offset);
1637
1638 *self = Self::from_primitive_allow_unknown(prim);
1639 Ok(())
1640 }
1641 }
1642 unsafe impl fidl::encoding::TypeMarker for ConfigurePlaybackError {
1643 type Owned = Self;
1644
1645 #[inline(always)]
1646 fn inline_align(_context: fidl::encoding::Context) -> usize {
1647 std::mem::align_of::<u32>()
1648 }
1649
1650 #[inline(always)]
1651 fn inline_size(_context: fidl::encoding::Context) -> usize {
1652 std::mem::size_of::<u32>()
1653 }
1654
1655 #[inline(always)]
1656 fn encode_is_copy() -> bool {
1657 false
1658 }
1659
1660 #[inline(always)]
1661 fn decode_is_copy() -> bool {
1662 false
1663 }
1664 }
1665
1666 impl fidl::encoding::ValueTypeMarker for ConfigurePlaybackError {
1667 type Borrowed<'a> = Self;
1668 #[inline(always)]
1669 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1670 *value
1671 }
1672 }
1673
1674 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1675 for ConfigurePlaybackError
1676 {
1677 #[inline]
1678 unsafe fn encode(
1679 self,
1680 encoder: &mut fidl::encoding::Encoder<'_, D>,
1681 offset: usize,
1682 _depth: fidl::encoding::Depth,
1683 ) -> fidl::Result<()> {
1684 encoder.debug_check_bounds::<Self>(offset);
1685 encoder.write_num(self.into_primitive(), offset);
1686 Ok(())
1687 }
1688 }
1689
1690 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1691 for ConfigurePlaybackError
1692 {
1693 #[inline(always)]
1694 fn new_empty() -> Self {
1695 Self::unknown()
1696 }
1697
1698 #[inline]
1699 unsafe fn decode(
1700 &mut self,
1701 decoder: &mut fidl::encoding::Decoder<'_, D>,
1702 offset: usize,
1703 _depth: fidl::encoding::Depth,
1704 ) -> fidl::Result<()> {
1705 decoder.debug_check_bounds::<Self>(offset);
1706 let prim = decoder.read_num::<u32>(offset);
1707
1708 *self = Self::from_primitive_allow_unknown(prim);
1709 Ok(())
1710 }
1711 }
1712 unsafe impl fidl::encoding::TypeMarker for ConfigureSensorRateError {
1713 type Owned = Self;
1714
1715 #[inline(always)]
1716 fn inline_align(_context: fidl::encoding::Context) -> usize {
1717 std::mem::align_of::<u32>()
1718 }
1719
1720 #[inline(always)]
1721 fn inline_size(_context: fidl::encoding::Context) -> usize {
1722 std::mem::size_of::<u32>()
1723 }
1724
1725 #[inline(always)]
1726 fn encode_is_copy() -> bool {
1727 false
1728 }
1729
1730 #[inline(always)]
1731 fn decode_is_copy() -> bool {
1732 false
1733 }
1734 }
1735
1736 impl fidl::encoding::ValueTypeMarker for ConfigureSensorRateError {
1737 type Borrowed<'a> = Self;
1738 #[inline(always)]
1739 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1740 *value
1741 }
1742 }
1743
1744 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1745 for ConfigureSensorRateError
1746 {
1747 #[inline]
1748 unsafe fn encode(
1749 self,
1750 encoder: &mut fidl::encoding::Encoder<'_, D>,
1751 offset: usize,
1752 _depth: fidl::encoding::Depth,
1753 ) -> fidl::Result<()> {
1754 encoder.debug_check_bounds::<Self>(offset);
1755 encoder.write_num(self.into_primitive(), offset);
1756 Ok(())
1757 }
1758 }
1759
1760 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1761 for ConfigureSensorRateError
1762 {
1763 #[inline(always)]
1764 fn new_empty() -> Self {
1765 Self::unknown()
1766 }
1767
1768 #[inline]
1769 unsafe fn decode(
1770 &mut self,
1771 decoder: &mut fidl::encoding::Decoder<'_, D>,
1772 offset: usize,
1773 _depth: fidl::encoding::Depth,
1774 ) -> fidl::Result<()> {
1775 decoder.debug_check_bounds::<Self>(offset);
1776 let prim = decoder.read_num::<u32>(offset);
1777
1778 *self = Self::from_primitive_allow_unknown(prim);
1779 Ok(())
1780 }
1781 }
1782 unsafe impl fidl::encoding::TypeMarker for DeactivateSensorError {
1783 type Owned = Self;
1784
1785 #[inline(always)]
1786 fn inline_align(_context: fidl::encoding::Context) -> usize {
1787 std::mem::align_of::<u32>()
1788 }
1789
1790 #[inline(always)]
1791 fn inline_size(_context: fidl::encoding::Context) -> usize {
1792 std::mem::size_of::<u32>()
1793 }
1794
1795 #[inline(always)]
1796 fn encode_is_copy() -> bool {
1797 false
1798 }
1799
1800 #[inline(always)]
1801 fn decode_is_copy() -> bool {
1802 false
1803 }
1804 }
1805
1806 impl fidl::encoding::ValueTypeMarker for DeactivateSensorError {
1807 type Borrowed<'a> = Self;
1808 #[inline(always)]
1809 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1810 *value
1811 }
1812 }
1813
1814 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1815 for DeactivateSensorError
1816 {
1817 #[inline]
1818 unsafe fn encode(
1819 self,
1820 encoder: &mut fidl::encoding::Encoder<'_, D>,
1821 offset: usize,
1822 _depth: fidl::encoding::Depth,
1823 ) -> fidl::Result<()> {
1824 encoder.debug_check_bounds::<Self>(offset);
1825 encoder.write_num(self.into_primitive(), offset);
1826 Ok(())
1827 }
1828 }
1829
1830 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeactivateSensorError {
1831 #[inline(always)]
1832 fn new_empty() -> Self {
1833 Self::unknown()
1834 }
1835
1836 #[inline]
1837 unsafe fn decode(
1838 &mut self,
1839 decoder: &mut fidl::encoding::Decoder<'_, D>,
1840 offset: usize,
1841 _depth: fidl::encoding::Depth,
1842 ) -> fidl::Result<()> {
1843 decoder.debug_check_bounds::<Self>(offset);
1844 let prim = decoder.read_num::<u32>(offset);
1845
1846 *self = Self::from_primitive_allow_unknown(prim);
1847 Ok(())
1848 }
1849 }
1850
1851 impl fidl::encoding::ValueTypeMarker for ManagerActivateRequest {
1852 type Borrowed<'a> = &'a Self;
1853 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1854 value
1855 }
1856 }
1857
1858 unsafe impl fidl::encoding::TypeMarker for ManagerActivateRequest {
1859 type Owned = Self;
1860
1861 #[inline(always)]
1862 fn inline_align(_context: fidl::encoding::Context) -> usize {
1863 4
1864 }
1865
1866 #[inline(always)]
1867 fn inline_size(_context: fidl::encoding::Context) -> usize {
1868 4
1869 }
1870 #[inline(always)]
1871 fn encode_is_copy() -> bool {
1872 true
1873 }
1874
1875 #[inline(always)]
1876 fn decode_is_copy() -> bool {
1877 true
1878 }
1879 }
1880
1881 unsafe impl<D: fidl::encoding::ResourceDialect>
1882 fidl::encoding::Encode<ManagerActivateRequest, D> for &ManagerActivateRequest
1883 {
1884 #[inline]
1885 unsafe fn encode(
1886 self,
1887 encoder: &mut fidl::encoding::Encoder<'_, D>,
1888 offset: usize,
1889 _depth: fidl::encoding::Depth,
1890 ) -> fidl::Result<()> {
1891 encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
1892 unsafe {
1893 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1895 (buf_ptr as *mut ManagerActivateRequest)
1896 .write_unaligned((self as *const ManagerActivateRequest).read());
1897 }
1900 Ok(())
1901 }
1902 }
1903 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1904 fidl::encoding::Encode<ManagerActivateRequest, D> for (T0,)
1905 {
1906 #[inline]
1907 unsafe fn encode(
1908 self,
1909 encoder: &mut fidl::encoding::Encoder<'_, D>,
1910 offset: usize,
1911 depth: fidl::encoding::Depth,
1912 ) -> fidl::Result<()> {
1913 encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
1914 self.0.encode(encoder, offset + 0, depth)?;
1918 Ok(())
1919 }
1920 }
1921
1922 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1923 for ManagerActivateRequest
1924 {
1925 #[inline(always)]
1926 fn new_empty() -> Self {
1927 Self { id: fidl::new_empty!(i32, D) }
1928 }
1929
1930 #[inline]
1931 unsafe fn decode(
1932 &mut self,
1933 decoder: &mut fidl::encoding::Decoder<'_, D>,
1934 offset: usize,
1935 _depth: fidl::encoding::Depth,
1936 ) -> fidl::Result<()> {
1937 decoder.debug_check_bounds::<Self>(offset);
1938 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1939 unsafe {
1942 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1943 }
1944 Ok(())
1945 }
1946 }
1947
1948 impl fidl::encoding::ValueTypeMarker for ManagerConfigurePlaybackRequest {
1949 type Borrowed<'a> = &'a Self;
1950 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1951 value
1952 }
1953 }
1954
1955 unsafe impl fidl::encoding::TypeMarker for ManagerConfigurePlaybackRequest {
1956 type Owned = Self;
1957
1958 #[inline(always)]
1959 fn inline_align(_context: fidl::encoding::Context) -> usize {
1960 8
1961 }
1962
1963 #[inline(always)]
1964 fn inline_size(_context: fidl::encoding::Context) -> usize {
1965 16
1966 }
1967 }
1968
1969 unsafe impl<D: fidl::encoding::ResourceDialect>
1970 fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D>
1971 for &ManagerConfigurePlaybackRequest
1972 {
1973 #[inline]
1974 unsafe fn encode(
1975 self,
1976 encoder: &mut fidl::encoding::Encoder<'_, D>,
1977 offset: usize,
1978 _depth: fidl::encoding::Depth,
1979 ) -> fidl::Result<()> {
1980 encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
1981 fidl::encoding::Encode::<ManagerConfigurePlaybackRequest, D>::encode(
1983 (
1984 <fidl_fuchsia_hardware_sensors::PlaybackSourceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.source_config),
1985 ),
1986 encoder, offset, _depth
1987 )
1988 }
1989 }
1990 unsafe impl<
1991 D: fidl::encoding::ResourceDialect,
1992 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_sensors::PlaybackSourceConfig, D>,
1993 > fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D> for (T0,)
1994 {
1995 #[inline]
1996 unsafe fn encode(
1997 self,
1998 encoder: &mut fidl::encoding::Encoder<'_, D>,
1999 offset: usize,
2000 depth: fidl::encoding::Depth,
2001 ) -> fidl::Result<()> {
2002 encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
2003 self.0.encode(encoder, offset + 0, depth)?;
2007 Ok(())
2008 }
2009 }
2010
2011 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2012 for ManagerConfigurePlaybackRequest
2013 {
2014 #[inline(always)]
2015 fn new_empty() -> Self {
2016 Self {
2017 source_config: fidl::new_empty!(
2018 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
2019 D
2020 ),
2021 }
2022 }
2023
2024 #[inline]
2025 unsafe fn decode(
2026 &mut self,
2027 decoder: &mut fidl::encoding::Decoder<'_, D>,
2028 offset: usize,
2029 _depth: fidl::encoding::Depth,
2030 ) -> fidl::Result<()> {
2031 decoder.debug_check_bounds::<Self>(offset);
2032 fidl::decode!(
2034 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
2035 D,
2036 &mut self.source_config,
2037 decoder,
2038 offset + 0,
2039 _depth
2040 )?;
2041 Ok(())
2042 }
2043 }
2044
2045 impl fidl::encoding::ResourceTypeMarker for ManagerConfigureSensorRatesRequest {
2046 type Borrowed<'a> = &'a mut Self;
2047 fn take_or_borrow<'a>(
2048 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2049 ) -> Self::Borrowed<'a> {
2050 value
2051 }
2052 }
2053
2054 unsafe impl fidl::encoding::TypeMarker for ManagerConfigureSensorRatesRequest {
2055 type Owned = Self;
2056
2057 #[inline(always)]
2058 fn inline_align(_context: fidl::encoding::Context) -> usize {
2059 8
2060 }
2061
2062 #[inline(always)]
2063 fn inline_size(_context: fidl::encoding::Context) -> usize {
2064 24
2065 }
2066 }
2067
2068 unsafe impl
2069 fidl::encoding::Encode<
2070 ManagerConfigureSensorRatesRequest,
2071 fidl::encoding::DefaultFuchsiaResourceDialect,
2072 > for &mut ManagerConfigureSensorRatesRequest
2073 {
2074 #[inline]
2075 unsafe fn encode(
2076 self,
2077 encoder: &mut fidl::encoding::Encoder<
2078 '_,
2079 fidl::encoding::DefaultFuchsiaResourceDialect,
2080 >,
2081 offset: usize,
2082 _depth: fidl::encoding::Depth,
2083 ) -> fidl::Result<()> {
2084 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
2085 fidl::encoding::Encode::<ManagerConfigureSensorRatesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2087 (
2088 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2089 <fidl_fuchsia_sensors_types::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
2090 ),
2091 encoder, offset, _depth
2092 )
2093 }
2094 }
2095 unsafe impl<
2096 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
2097 T1: fidl::encoding::Encode<
2098 fidl_fuchsia_sensors_types::SensorRateConfig,
2099 fidl::encoding::DefaultFuchsiaResourceDialect,
2100 >,
2101 >
2102 fidl::encoding::Encode<
2103 ManagerConfigureSensorRatesRequest,
2104 fidl::encoding::DefaultFuchsiaResourceDialect,
2105 > for (T0, T1)
2106 {
2107 #[inline]
2108 unsafe fn encode(
2109 self,
2110 encoder: &mut fidl::encoding::Encoder<
2111 '_,
2112 fidl::encoding::DefaultFuchsiaResourceDialect,
2113 >,
2114 offset: usize,
2115 depth: fidl::encoding::Depth,
2116 ) -> fidl::Result<()> {
2117 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
2118 unsafe {
2121 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2122 (ptr as *mut u64).write_unaligned(0);
2123 }
2124 self.0.encode(encoder, offset + 0, depth)?;
2126 self.1.encode(encoder, offset + 8, depth)?;
2127 Ok(())
2128 }
2129 }
2130
2131 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2132 for ManagerConfigureSensorRatesRequest
2133 {
2134 #[inline(always)]
2135 fn new_empty() -> Self {
2136 Self {
2137 id: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
2138 sensor_rate_config: fidl::new_empty!(
2139 fidl_fuchsia_sensors_types::SensorRateConfig,
2140 fidl::encoding::DefaultFuchsiaResourceDialect
2141 ),
2142 }
2143 }
2144
2145 #[inline]
2146 unsafe fn decode(
2147 &mut self,
2148 decoder: &mut fidl::encoding::Decoder<
2149 '_,
2150 fidl::encoding::DefaultFuchsiaResourceDialect,
2151 >,
2152 offset: usize,
2153 _depth: fidl::encoding::Depth,
2154 ) -> fidl::Result<()> {
2155 decoder.debug_check_bounds::<Self>(offset);
2156 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2158 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2159 let mask = 0xffffffff00000000u64;
2160 let maskedval = padval & mask;
2161 if maskedval != 0 {
2162 return Err(fidl::Error::NonZeroPadding {
2163 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2164 });
2165 }
2166 fidl::decode!(
2167 i32,
2168 fidl::encoding::DefaultFuchsiaResourceDialect,
2169 &mut self.id,
2170 decoder,
2171 offset + 0,
2172 _depth
2173 )?;
2174 fidl::decode!(
2175 fidl_fuchsia_sensors_types::SensorRateConfig,
2176 fidl::encoding::DefaultFuchsiaResourceDialect,
2177 &mut self.sensor_rate_config,
2178 decoder,
2179 offset + 8,
2180 _depth
2181 )?;
2182 Ok(())
2183 }
2184 }
2185
2186 impl fidl::encoding::ValueTypeMarker for ManagerDeactivateRequest {
2187 type Borrowed<'a> = &'a Self;
2188 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2189 value
2190 }
2191 }
2192
2193 unsafe impl fidl::encoding::TypeMarker for ManagerDeactivateRequest {
2194 type Owned = Self;
2195
2196 #[inline(always)]
2197 fn inline_align(_context: fidl::encoding::Context) -> usize {
2198 4
2199 }
2200
2201 #[inline(always)]
2202 fn inline_size(_context: fidl::encoding::Context) -> usize {
2203 4
2204 }
2205 #[inline(always)]
2206 fn encode_is_copy() -> bool {
2207 true
2208 }
2209
2210 #[inline(always)]
2211 fn decode_is_copy() -> bool {
2212 true
2213 }
2214 }
2215
2216 unsafe impl<D: fidl::encoding::ResourceDialect>
2217 fidl::encoding::Encode<ManagerDeactivateRequest, D> for &ManagerDeactivateRequest
2218 {
2219 #[inline]
2220 unsafe fn encode(
2221 self,
2222 encoder: &mut fidl::encoding::Encoder<'_, D>,
2223 offset: usize,
2224 _depth: fidl::encoding::Depth,
2225 ) -> fidl::Result<()> {
2226 encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
2227 unsafe {
2228 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2230 (buf_ptr as *mut ManagerDeactivateRequest)
2231 .write_unaligned((self as *const ManagerDeactivateRequest).read());
2232 }
2235 Ok(())
2236 }
2237 }
2238 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2239 fidl::encoding::Encode<ManagerDeactivateRequest, D> for (T0,)
2240 {
2241 #[inline]
2242 unsafe fn encode(
2243 self,
2244 encoder: &mut fidl::encoding::Encoder<'_, D>,
2245 offset: usize,
2246 depth: fidl::encoding::Depth,
2247 ) -> fidl::Result<()> {
2248 encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
2249 self.0.encode(encoder, offset + 0, depth)?;
2253 Ok(())
2254 }
2255 }
2256
2257 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2258 for ManagerDeactivateRequest
2259 {
2260 #[inline(always)]
2261 fn new_empty() -> Self {
2262 Self { id: fidl::new_empty!(i32, D) }
2263 }
2264
2265 #[inline]
2266 unsafe fn decode(
2267 &mut self,
2268 decoder: &mut fidl::encoding::Decoder<'_, D>,
2269 offset: usize,
2270 _depth: fidl::encoding::Depth,
2271 ) -> fidl::Result<()> {
2272 decoder.debug_check_bounds::<Self>(offset);
2273 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2274 unsafe {
2277 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2278 }
2279 Ok(())
2280 }
2281 }
2282
2283 impl fidl::encoding::ValueTypeMarker for ManagerOnSensorEventRequest {
2284 type Borrowed<'a> = &'a Self;
2285 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2286 value
2287 }
2288 }
2289
2290 unsafe impl fidl::encoding::TypeMarker for ManagerOnSensorEventRequest {
2291 type Owned = Self;
2292
2293 #[inline(always)]
2294 fn inline_align(_context: fidl::encoding::Context) -> usize {
2295 8
2296 }
2297
2298 #[inline(always)]
2299 fn inline_size(_context: fidl::encoding::Context) -> usize {
2300 40
2301 }
2302 }
2303
2304 unsafe impl<D: fidl::encoding::ResourceDialect>
2305 fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for &ManagerOnSensorEventRequest
2306 {
2307 #[inline]
2308 unsafe fn encode(
2309 self,
2310 encoder: &mut fidl::encoding::Encoder<'_, D>,
2311 offset: usize,
2312 _depth: fidl::encoding::Depth,
2313 ) -> fidl::Result<()> {
2314 encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
2315 fidl::encoding::Encode::<ManagerOnSensorEventRequest, D>::encode(
2317 (
2318 <fidl_fuchsia_sensors_types::SensorEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2319 ),
2320 encoder, offset, _depth
2321 )
2322 }
2323 }
2324 unsafe impl<
2325 D: fidl::encoding::ResourceDialect,
2326 T0: fidl::encoding::Encode<fidl_fuchsia_sensors_types::SensorEvent, D>,
2327 > fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for (T0,)
2328 {
2329 #[inline]
2330 unsafe fn encode(
2331 self,
2332 encoder: &mut fidl::encoding::Encoder<'_, D>,
2333 offset: usize,
2334 depth: fidl::encoding::Depth,
2335 ) -> fidl::Result<()> {
2336 encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
2337 self.0.encode(encoder, offset + 0, depth)?;
2341 Ok(())
2342 }
2343 }
2344
2345 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2346 for ManagerOnSensorEventRequest
2347 {
2348 #[inline(always)]
2349 fn new_empty() -> Self {
2350 Self { event: fidl::new_empty!(fidl_fuchsia_sensors_types::SensorEvent, D) }
2351 }
2352
2353 #[inline]
2354 unsafe fn decode(
2355 &mut self,
2356 decoder: &mut fidl::encoding::Decoder<'_, D>,
2357 offset: usize,
2358 _depth: fidl::encoding::Depth,
2359 ) -> fidl::Result<()> {
2360 decoder.debug_check_bounds::<Self>(offset);
2361 fidl::decode!(
2363 fidl_fuchsia_sensors_types::SensorEvent,
2364 D,
2365 &mut self.event,
2366 decoder,
2367 offset + 0,
2368 _depth
2369 )?;
2370 Ok(())
2371 }
2372 }
2373
2374 impl fidl::encoding::ValueTypeMarker for ManagerGetSensorsListResponse {
2375 type Borrowed<'a> = &'a Self;
2376 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2377 value
2378 }
2379 }
2380
2381 unsafe impl fidl::encoding::TypeMarker for ManagerGetSensorsListResponse {
2382 type Owned = Self;
2383
2384 #[inline(always)]
2385 fn inline_align(_context: fidl::encoding::Context) -> usize {
2386 8
2387 }
2388
2389 #[inline(always)]
2390 fn inline_size(_context: fidl::encoding::Context) -> usize {
2391 16
2392 }
2393 }
2394
2395 unsafe impl<D: fidl::encoding::ResourceDialect>
2396 fidl::encoding::Encode<ManagerGetSensorsListResponse, D>
2397 for &ManagerGetSensorsListResponse
2398 {
2399 #[inline]
2400 unsafe fn encode(
2401 self,
2402 encoder: &mut fidl::encoding::Encoder<'_, D>,
2403 offset: usize,
2404 _depth: fidl::encoding::Depth,
2405 ) -> fidl::Result<()> {
2406 encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
2407 fidl::encoding::Encode::<ManagerGetSensorsListResponse, D>::encode(
2409 (
2410 <fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensors),
2411 ),
2412 encoder, offset, _depth
2413 )
2414 }
2415 }
2416 unsafe impl<
2417 D: fidl::encoding::ResourceDialect,
2418 T0: fidl::encoding::Encode<
2419 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
2420 D,
2421 >,
2422 > fidl::encoding::Encode<ManagerGetSensorsListResponse, D> for (T0,)
2423 {
2424 #[inline]
2425 unsafe fn encode(
2426 self,
2427 encoder: &mut fidl::encoding::Encoder<'_, D>,
2428 offset: usize,
2429 depth: fidl::encoding::Depth,
2430 ) -> fidl::Result<()> {
2431 encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
2432 self.0.encode(encoder, offset + 0, depth)?;
2436 Ok(())
2437 }
2438 }
2439
2440 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2441 for ManagerGetSensorsListResponse
2442 {
2443 #[inline(always)]
2444 fn new_empty() -> Self {
2445 Self {
2446 sensors: fidl::new_empty!(
2447 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
2448 D
2449 ),
2450 }
2451 }
2452
2453 #[inline]
2454 unsafe fn decode(
2455 &mut self,
2456 decoder: &mut fidl::encoding::Decoder<'_, D>,
2457 offset: usize,
2458 _depth: fidl::encoding::Depth,
2459 ) -> fidl::Result<()> {
2460 decoder.debug_check_bounds::<Self>(offset);
2461 fidl::decode!(
2463 fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
2464 D,
2465 &mut self.sensors,
2466 decoder,
2467 offset + 0,
2468 _depth
2469 )?;
2470 Ok(())
2471 }
2472 }
2473}