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 _};
10pub use fidl_fuchsia_sensors__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ManagerConfigureSensorRatesRequest {
16 pub id: i32,
17 pub sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ManagerConfigureSensorRatesRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct ManagerMarker;
27
28impl fidl::endpoints::ProtocolMarker for ManagerMarker {
29 type Proxy = ManagerProxy;
30 type RequestStream = ManagerRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = ManagerSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "fuchsia.sensors.Manager";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
37pub type ManagerConfigurePlaybackResult = Result<(), ConfigurePlaybackError>;
38pub type ManagerConfigureSensorRatesResult = Result<(), ConfigureSensorRateError>;
39pub type ManagerActivateResult = Result<(), ActivateSensorError>;
40pub type ManagerDeactivateResult = Result<(), DeactivateSensorError>;
41
42pub trait ManagerProxyInterface: Send + Sync {
43 type ConfigurePlaybackResponseFut: std::future::Future<Output = Result<ManagerConfigurePlaybackResult, fidl::Error>>
44 + Send;
45 fn r#configure_playback(
46 &self,
47 source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
48 ) -> Self::ConfigurePlaybackResponseFut;
49 type GetSensorsListResponseFut: std::future::Future<
50 Output = Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error>,
51 > + Send;
52 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut;
53 type ConfigureSensorRatesResponseFut: std::future::Future<Output = Result<ManagerConfigureSensorRatesResult, fidl::Error>>
54 + Send;
55 fn r#configure_sensor_rates(
56 &self,
57 id: i32,
58 sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
59 ) -> Self::ConfigureSensorRatesResponseFut;
60 type ActivateResponseFut: std::future::Future<Output = Result<ManagerActivateResult, fidl::Error>>
61 + Send;
62 fn r#activate(&self, id: i32) -> Self::ActivateResponseFut;
63 type DeactivateResponseFut: std::future::Future<Output = Result<ManagerDeactivateResult, fidl::Error>>
64 + Send;
65 fn r#deactivate(&self, id: i32) -> Self::DeactivateResponseFut;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct ManagerSynchronousProxy {
70 client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
75 type Proxy = ManagerProxy;
76 type Protocol = ManagerMarker;
77
78 fn from_channel(inner: fidl::Channel) -> Self {
79 Self::new(inner)
80 }
81
82 fn into_channel(self) -> fidl::Channel {
83 self.client.into_channel()
84 }
85
86 fn as_channel(&self) -> &fidl::Channel {
87 self.client.as_channel()
88 }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl ManagerSynchronousProxy {
93 pub fn new(channel: fidl::Channel) -> Self {
94 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96 }
97
98 pub fn into_channel(self) -> fidl::Channel {
99 self.client.into_channel()
100 }
101
102 pub fn wait_for_event(
105 &self,
106 deadline: zx::MonotonicInstant,
107 ) -> Result<ManagerEvent, fidl::Error> {
108 ManagerEvent::decode(self.client.wait_for_event(deadline)?)
109 }
110
111 pub fn r#configure_playback(
115 &self,
116 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
117 ___deadline: zx::MonotonicInstant,
118 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
119 let _response =
120 self.client
121 .send_query::<ManagerConfigurePlaybackRequest, fidl::encoding::FlexibleResultType<
122 fidl::encoding::EmptyStruct,
123 ConfigurePlaybackError,
124 >>(
125 (source_config,),
126 0x2aec5d56edab43fa,
127 fidl::encoding::DynamicFlags::FLEXIBLE,
128 ___deadline,
129 )?
130 .into_result::<ManagerMarker>("configure_playback")?;
131 Ok(_response.map(|x| x))
132 }
133
134 pub fn r#get_sensors_list(
136 &self,
137 ___deadline: zx::MonotonicInstant,
138 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
139 let _response = self.client.send_query::<
140 fidl::encoding::EmptyPayload,
141 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
142 >(
143 (),
144 0x48cf103cfbec3a4a,
145 fidl::encoding::DynamicFlags::FLEXIBLE,
146 ___deadline,
147 )?
148 .into_result::<ManagerMarker>("get_sensors_list")?;
149 Ok(_response.sensors)
150 }
151
152 pub fn r#configure_sensor_rates(
154 &self,
155 mut id: i32,
156 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
157 ___deadline: zx::MonotonicInstant,
158 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
159 let _response = self
160 .client
161 .send_query::<ManagerConfigureSensorRatesRequest, fidl::encoding::FlexibleResultType<
162 fidl::encoding::EmptyStruct,
163 ConfigureSensorRateError,
164 >>(
165 (id, sensor_rate_config),
166 0x28046f7f3f340652,
167 fidl::encoding::DynamicFlags::FLEXIBLE,
168 ___deadline,
169 )?
170 .into_result::<ManagerMarker>("configure_sensor_rates")?;
171 Ok(_response.map(|x| x))
172 }
173
174 pub fn r#activate(
176 &self,
177 mut id: i32,
178 ___deadline: zx::MonotonicInstant,
179 ) -> Result<ManagerActivateResult, fidl::Error> {
180 let _response =
181 self.client
182 .send_query::<ManagerActivateRequest, fidl::encoding::FlexibleResultType<
183 fidl::encoding::EmptyStruct,
184 ActivateSensorError,
185 >>(
186 (id,), 0x5678f117cae5ba42, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
187 )?
188 .into_result::<ManagerMarker>("activate")?;
189 Ok(_response.map(|x| x))
190 }
191
192 pub fn r#deactivate(
194 &self,
195 mut id: i32,
196 ___deadline: zx::MonotonicInstant,
197 ) -> Result<ManagerDeactivateResult, fidl::Error> {
198 let _response =
199 self.client
200 .send_query::<ManagerDeactivateRequest, fidl::encoding::FlexibleResultType<
201 fidl::encoding::EmptyStruct,
202 DeactivateSensorError,
203 >>(
204 (id,), 0x7fafbca62982c87, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
205 )?
206 .into_result::<ManagerMarker>("deactivate")?;
207 Ok(_response.map(|x| x))
208 }
209}
210
211#[cfg(target_os = "fuchsia")]
212impl From<ManagerSynchronousProxy> for zx::Handle {
213 fn from(value: ManagerSynchronousProxy) -> Self {
214 value.into_channel().into()
215 }
216}
217
218#[cfg(target_os = "fuchsia")]
219impl From<fidl::Channel> for ManagerSynchronousProxy {
220 fn from(value: fidl::Channel) -> Self {
221 Self::new(value)
222 }
223}
224
225#[cfg(target_os = "fuchsia")]
226impl fidl::endpoints::FromClient for ManagerSynchronousProxy {
227 type Protocol = ManagerMarker;
228
229 fn from_client(value: fidl::endpoints::ClientEnd<ManagerMarker>) -> Self {
230 Self::new(value.into_channel())
231 }
232}
233
234#[derive(Debug, Clone)]
235pub struct ManagerProxy {
236 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
237}
238
239impl fidl::endpoints::Proxy for ManagerProxy {
240 type Protocol = ManagerMarker;
241
242 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
243 Self::new(inner)
244 }
245
246 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
247 self.client.into_channel().map_err(|client| Self { client })
248 }
249
250 fn as_channel(&self) -> &::fidl::AsyncChannel {
251 self.client.as_channel()
252 }
253}
254
255impl ManagerProxy {
256 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
258 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
259 Self { client: fidl::client::Client::new(channel, protocol_name) }
260 }
261
262 pub fn take_event_stream(&self) -> ManagerEventStream {
268 ManagerEventStream { event_receiver: self.client.take_event_receiver() }
269 }
270
271 pub fn r#configure_playback(
275 &self,
276 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
277 ) -> fidl::client::QueryResponseFut<
278 ManagerConfigurePlaybackResult,
279 fidl::encoding::DefaultFuchsiaResourceDialect,
280 > {
281 ManagerProxyInterface::r#configure_playback(self, source_config)
282 }
283
284 pub fn r#get_sensors_list(
286 &self,
287 ) -> fidl::client::QueryResponseFut<
288 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
289 fidl::encoding::DefaultFuchsiaResourceDialect,
290 > {
291 ManagerProxyInterface::r#get_sensors_list(self)
292 }
293
294 pub fn r#configure_sensor_rates(
296 &self,
297 mut id: i32,
298 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
299 ) -> fidl::client::QueryResponseFut<
300 ManagerConfigureSensorRatesResult,
301 fidl::encoding::DefaultFuchsiaResourceDialect,
302 > {
303 ManagerProxyInterface::r#configure_sensor_rates(self, id, sensor_rate_config)
304 }
305
306 pub fn r#activate(
308 &self,
309 mut id: i32,
310 ) -> fidl::client::QueryResponseFut<
311 ManagerActivateResult,
312 fidl::encoding::DefaultFuchsiaResourceDialect,
313 > {
314 ManagerProxyInterface::r#activate(self, id)
315 }
316
317 pub fn r#deactivate(
319 &self,
320 mut id: i32,
321 ) -> fidl::client::QueryResponseFut<
322 ManagerDeactivateResult,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 > {
325 ManagerProxyInterface::r#deactivate(self, id)
326 }
327}
328
329impl ManagerProxyInterface for ManagerProxy {
330 type ConfigurePlaybackResponseFut = fidl::client::QueryResponseFut<
331 ManagerConfigurePlaybackResult,
332 fidl::encoding::DefaultFuchsiaResourceDialect,
333 >;
334 fn r#configure_playback(
335 &self,
336 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
337 ) -> Self::ConfigurePlaybackResponseFut {
338 fn _decode(
339 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
340 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
341 let _response = fidl::client::decode_transaction_body::<
342 fidl::encoding::FlexibleResultType<
343 fidl::encoding::EmptyStruct,
344 ConfigurePlaybackError,
345 >,
346 fidl::encoding::DefaultFuchsiaResourceDialect,
347 0x2aec5d56edab43fa,
348 >(_buf?)?
349 .into_result::<ManagerMarker>("configure_playback")?;
350 Ok(_response.map(|x| x))
351 }
352 self.client.send_query_and_decode::<
353 ManagerConfigurePlaybackRequest,
354 ManagerConfigurePlaybackResult,
355 >(
356 (source_config,),
357 0x2aec5d56edab43fa,
358 fidl::encoding::DynamicFlags::FLEXIBLE,
359 _decode,
360 )
361 }
362
363 type GetSensorsListResponseFut = fidl::client::QueryResponseFut<
364 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
365 fidl::encoding::DefaultFuchsiaResourceDialect,
366 >;
367 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut {
368 fn _decode(
369 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
370 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
371 let _response = fidl::client::decode_transaction_body::<
372 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
373 fidl::encoding::DefaultFuchsiaResourceDialect,
374 0x48cf103cfbec3a4a,
375 >(_buf?)?
376 .into_result::<ManagerMarker>("get_sensors_list")?;
377 Ok(_response.sensors)
378 }
379 self.client.send_query_and_decode::<
380 fidl::encoding::EmptyPayload,
381 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
382 >(
383 (),
384 0x48cf103cfbec3a4a,
385 fidl::encoding::DynamicFlags::FLEXIBLE,
386 _decode,
387 )
388 }
389
390 type ConfigureSensorRatesResponseFut = fidl::client::QueryResponseFut<
391 ManagerConfigureSensorRatesResult,
392 fidl::encoding::DefaultFuchsiaResourceDialect,
393 >;
394 fn r#configure_sensor_rates(
395 &self,
396 mut id: i32,
397 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
398 ) -> Self::ConfigureSensorRatesResponseFut {
399 fn _decode(
400 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
401 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
402 let _response = fidl::client::decode_transaction_body::<
403 fidl::encoding::FlexibleResultType<
404 fidl::encoding::EmptyStruct,
405 ConfigureSensorRateError,
406 >,
407 fidl::encoding::DefaultFuchsiaResourceDialect,
408 0x28046f7f3f340652,
409 >(_buf?)?
410 .into_result::<ManagerMarker>("configure_sensor_rates")?;
411 Ok(_response.map(|x| x))
412 }
413 self.client.send_query_and_decode::<
414 ManagerConfigureSensorRatesRequest,
415 ManagerConfigureSensorRatesResult,
416 >(
417 (id, sensor_rate_config,),
418 0x28046f7f3f340652,
419 fidl::encoding::DynamicFlags::FLEXIBLE,
420 _decode,
421 )
422 }
423
424 type ActivateResponseFut = fidl::client::QueryResponseFut<
425 ManagerActivateResult,
426 fidl::encoding::DefaultFuchsiaResourceDialect,
427 >;
428 fn r#activate(&self, mut id: i32) -> Self::ActivateResponseFut {
429 fn _decode(
430 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
431 ) -> Result<ManagerActivateResult, fidl::Error> {
432 let _response = fidl::client::decode_transaction_body::<
433 fidl::encoding::FlexibleResultType<
434 fidl::encoding::EmptyStruct,
435 ActivateSensorError,
436 >,
437 fidl::encoding::DefaultFuchsiaResourceDialect,
438 0x5678f117cae5ba42,
439 >(_buf?)?
440 .into_result::<ManagerMarker>("activate")?;
441 Ok(_response.map(|x| x))
442 }
443 self.client.send_query_and_decode::<ManagerActivateRequest, ManagerActivateResult>(
444 (id,),
445 0x5678f117cae5ba42,
446 fidl::encoding::DynamicFlags::FLEXIBLE,
447 _decode,
448 )
449 }
450
451 type DeactivateResponseFut = fidl::client::QueryResponseFut<
452 ManagerDeactivateResult,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 >;
455 fn r#deactivate(&self, mut id: i32) -> Self::DeactivateResponseFut {
456 fn _decode(
457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
458 ) -> Result<ManagerDeactivateResult, fidl::Error> {
459 let _response = fidl::client::decode_transaction_body::<
460 fidl::encoding::FlexibleResultType<
461 fidl::encoding::EmptyStruct,
462 DeactivateSensorError,
463 >,
464 fidl::encoding::DefaultFuchsiaResourceDialect,
465 0x7fafbca62982c87,
466 >(_buf?)?
467 .into_result::<ManagerMarker>("deactivate")?;
468 Ok(_response.map(|x| x))
469 }
470 self.client.send_query_and_decode::<ManagerDeactivateRequest, ManagerDeactivateResult>(
471 (id,),
472 0x7fafbca62982c87,
473 fidl::encoding::DynamicFlags::FLEXIBLE,
474 _decode,
475 )
476 }
477}
478
479pub struct ManagerEventStream {
480 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
481}
482
483impl std::marker::Unpin for ManagerEventStream {}
484
485impl futures::stream::FusedStream for ManagerEventStream {
486 fn is_terminated(&self) -> bool {
487 self.event_receiver.is_terminated()
488 }
489}
490
491impl futures::Stream for ManagerEventStream {
492 type Item = Result<ManagerEvent, fidl::Error>;
493
494 fn poll_next(
495 mut self: std::pin::Pin<&mut Self>,
496 cx: &mut std::task::Context<'_>,
497 ) -> std::task::Poll<Option<Self::Item>> {
498 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
499 &mut self.event_receiver,
500 cx
501 )?) {
502 Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
503 None => std::task::Poll::Ready(None),
504 }
505 }
506}
507
508#[derive(Debug)]
509pub enum ManagerEvent {
510 OnSensorEvent {
511 event: fidl_fuchsia_sensors_types::SensorEvent,
512 },
513 #[non_exhaustive]
514 _UnknownEvent {
515 ordinal: u64,
517 },
518}
519
520impl ManagerEvent {
521 #[allow(irrefutable_let_patterns)]
522 pub fn into_on_sensor_event(self) -> Option<fidl_fuchsia_sensors_types::SensorEvent> {
523 if let ManagerEvent::OnSensorEvent { event } = self { Some((event)) } else { None }
524 }
525
526 fn decode(
528 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
529 ) -> Result<ManagerEvent, fidl::Error> {
530 let (bytes, _handles) = buf.split_mut();
531 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
532 debug_assert_eq!(tx_header.tx_id, 0);
533 match tx_header.ordinal {
534 0x6ceb07e11d43e9b => {
535 let mut out = fidl::new_empty!(
536 ManagerOnSensorEventRequest,
537 fidl::encoding::DefaultFuchsiaResourceDialect
538 );
539 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerOnSensorEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
540 Ok((ManagerEvent::OnSensorEvent { event: out.event }))
541 }
542 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
543 Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
544 }
545 _ => Err(fidl::Error::UnknownOrdinal {
546 ordinal: tx_header.ordinal,
547 protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
548 }),
549 }
550 }
551}
552
553pub struct ManagerRequestStream {
555 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
556 is_terminated: bool,
557}
558
559impl std::marker::Unpin for ManagerRequestStream {}
560
561impl futures::stream::FusedStream for ManagerRequestStream {
562 fn is_terminated(&self) -> bool {
563 self.is_terminated
564 }
565}
566
567impl fidl::endpoints::RequestStream for ManagerRequestStream {
568 type Protocol = ManagerMarker;
569 type ControlHandle = ManagerControlHandle;
570
571 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
572 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
573 }
574
575 fn control_handle(&self) -> Self::ControlHandle {
576 ManagerControlHandle { inner: self.inner.clone() }
577 }
578
579 fn into_inner(
580 self,
581 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
582 {
583 (self.inner, self.is_terminated)
584 }
585
586 fn from_inner(
587 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
588 is_terminated: bool,
589 ) -> Self {
590 Self { inner, is_terminated }
591 }
592}
593
594impl futures::Stream for ManagerRequestStream {
595 type Item = Result<ManagerRequest, fidl::Error>;
596
597 fn poll_next(
598 mut self: std::pin::Pin<&mut Self>,
599 cx: &mut std::task::Context<'_>,
600 ) -> std::task::Poll<Option<Self::Item>> {
601 let this = &mut *self;
602 if this.inner.check_shutdown(cx) {
603 this.is_terminated = true;
604 return std::task::Poll::Ready(None);
605 }
606 if this.is_terminated {
607 panic!("polled ManagerRequestStream after completion");
608 }
609 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
610 |bytes, handles| {
611 match this.inner.channel().read_etc(cx, bytes, handles) {
612 std::task::Poll::Ready(Ok(())) => {}
613 std::task::Poll::Pending => return std::task::Poll::Pending,
614 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
615 this.is_terminated = true;
616 return std::task::Poll::Ready(None);
617 }
618 std::task::Poll::Ready(Err(e)) => {
619 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
620 e.into(),
621 ))));
622 }
623 }
624
625 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
627
628 std::task::Poll::Ready(Some(match header.ordinal {
629 0x2aec5d56edab43fa => {
630 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
631 let mut req = fidl::new_empty!(
632 ManagerConfigurePlaybackRequest,
633 fidl::encoding::DefaultFuchsiaResourceDialect
634 );
635 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigurePlaybackRequest>(&header, _body_bytes, handles, &mut req)?;
636 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
637 Ok(ManagerRequest::ConfigurePlayback {
638 source_config: req.source_config,
639
640 responder: ManagerConfigurePlaybackResponder {
641 control_handle: std::mem::ManuallyDrop::new(control_handle),
642 tx_id: header.tx_id,
643 },
644 })
645 }
646 0x48cf103cfbec3a4a => {
647 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
648 let mut req = fidl::new_empty!(
649 fidl::encoding::EmptyPayload,
650 fidl::encoding::DefaultFuchsiaResourceDialect
651 );
652 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
653 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
654 Ok(ManagerRequest::GetSensorsList {
655 responder: ManagerGetSensorsListResponder {
656 control_handle: std::mem::ManuallyDrop::new(control_handle),
657 tx_id: header.tx_id,
658 },
659 })
660 }
661 0x28046f7f3f340652 => {
662 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
663 let mut req = fidl::new_empty!(
664 ManagerConfigureSensorRatesRequest,
665 fidl::encoding::DefaultFuchsiaResourceDialect
666 );
667 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigureSensorRatesRequest>(&header, _body_bytes, handles, &mut req)?;
668 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
669 Ok(ManagerRequest::ConfigureSensorRates {
670 id: req.id,
671 sensor_rate_config: req.sensor_rate_config,
672
673 responder: ManagerConfigureSensorRatesResponder {
674 control_handle: std::mem::ManuallyDrop::new(control_handle),
675 tx_id: header.tx_id,
676 },
677 })
678 }
679 0x5678f117cae5ba42 => {
680 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
681 let mut req = fidl::new_empty!(
682 ManagerActivateRequest,
683 fidl::encoding::DefaultFuchsiaResourceDialect
684 );
685 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
686 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
687 Ok(ManagerRequest::Activate {
688 id: req.id,
689
690 responder: ManagerActivateResponder {
691 control_handle: std::mem::ManuallyDrop::new(control_handle),
692 tx_id: header.tx_id,
693 },
694 })
695 }
696 0x7fafbca62982c87 => {
697 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
698 let mut req = fidl::new_empty!(
699 ManagerDeactivateRequest,
700 fidl::encoding::DefaultFuchsiaResourceDialect
701 );
702 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerDeactivateRequest>(&header, _body_bytes, handles, &mut req)?;
703 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
704 Ok(ManagerRequest::Deactivate {
705 id: req.id,
706
707 responder: ManagerDeactivateResponder {
708 control_handle: std::mem::ManuallyDrop::new(control_handle),
709 tx_id: header.tx_id,
710 },
711 })
712 }
713 _ if header.tx_id == 0
714 && header
715 .dynamic_flags()
716 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
717 {
718 Ok(ManagerRequest::_UnknownMethod {
719 ordinal: header.ordinal,
720 control_handle: ManagerControlHandle { inner: this.inner.clone() },
721 method_type: fidl::MethodType::OneWay,
722 })
723 }
724 _ if header
725 .dynamic_flags()
726 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
727 {
728 this.inner.send_framework_err(
729 fidl::encoding::FrameworkErr::UnknownMethod,
730 header.tx_id,
731 header.ordinal,
732 header.dynamic_flags(),
733 (bytes, handles),
734 )?;
735 Ok(ManagerRequest::_UnknownMethod {
736 ordinal: header.ordinal,
737 control_handle: ManagerControlHandle { inner: this.inner.clone() },
738 method_type: fidl::MethodType::TwoWay,
739 })
740 }
741 _ => Err(fidl::Error::UnknownOrdinal {
742 ordinal: header.ordinal,
743 protocol_name:
744 <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
745 }),
746 }))
747 },
748 )
749 }
750}
751
752#[derive(Debug)]
753pub enum ManagerRequest {
754 ConfigurePlayback {
758 source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
759 responder: ManagerConfigurePlaybackResponder,
760 },
761 GetSensorsList { responder: ManagerGetSensorsListResponder },
763 ConfigureSensorRates {
765 id: i32,
766 sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
767 responder: ManagerConfigureSensorRatesResponder,
768 },
769 Activate { id: i32, responder: ManagerActivateResponder },
771 Deactivate { id: i32, responder: ManagerDeactivateResponder },
773 #[non_exhaustive]
775 _UnknownMethod {
776 ordinal: u64,
778 control_handle: ManagerControlHandle,
779 method_type: fidl::MethodType,
780 },
781}
782
783impl ManagerRequest {
784 #[allow(irrefutable_let_patterns)]
785 pub fn into_configure_playback(
786 self,
787 ) -> Option<(
788 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
789 ManagerConfigurePlaybackResponder,
790 )> {
791 if let ManagerRequest::ConfigurePlayback { source_config, responder } = self {
792 Some((source_config, responder))
793 } else {
794 None
795 }
796 }
797
798 #[allow(irrefutable_let_patterns)]
799 pub fn into_get_sensors_list(self) -> Option<(ManagerGetSensorsListResponder)> {
800 if let ManagerRequest::GetSensorsList { responder } = self {
801 Some((responder))
802 } else {
803 None
804 }
805 }
806
807 #[allow(irrefutable_let_patterns)]
808 pub fn into_configure_sensor_rates(
809 self,
810 ) -> Option<(
811 i32,
812 fidl_fuchsia_sensors_types::SensorRateConfig,
813 ManagerConfigureSensorRatesResponder,
814 )> {
815 if let ManagerRequest::ConfigureSensorRates { id, sensor_rate_config, responder } = self {
816 Some((id, sensor_rate_config, responder))
817 } else {
818 None
819 }
820 }
821
822 #[allow(irrefutable_let_patterns)]
823 pub fn into_activate(self) -> Option<(i32, ManagerActivateResponder)> {
824 if let ManagerRequest::Activate { id, responder } = self {
825 Some((id, responder))
826 } else {
827 None
828 }
829 }
830
831 #[allow(irrefutable_let_patterns)]
832 pub fn into_deactivate(self) -> Option<(i32, ManagerDeactivateResponder)> {
833 if let ManagerRequest::Deactivate { id, responder } = self {
834 Some((id, responder))
835 } else {
836 None
837 }
838 }
839
840 pub fn method_name(&self) -> &'static str {
842 match *self {
843 ManagerRequest::ConfigurePlayback { .. } => "configure_playback",
844 ManagerRequest::GetSensorsList { .. } => "get_sensors_list",
845 ManagerRequest::ConfigureSensorRates { .. } => "configure_sensor_rates",
846 ManagerRequest::Activate { .. } => "activate",
847 ManagerRequest::Deactivate { .. } => "deactivate",
848 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
849 "unknown one-way method"
850 }
851 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
852 "unknown two-way method"
853 }
854 }
855 }
856}
857
858#[derive(Debug, Clone)]
859pub struct ManagerControlHandle {
860 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
861}
862
863impl fidl::endpoints::ControlHandle for ManagerControlHandle {
864 fn shutdown(&self) {
865 self.inner.shutdown()
866 }
867 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
868 self.inner.shutdown_with_epitaph(status)
869 }
870
871 fn is_closed(&self) -> bool {
872 self.inner.channel().is_closed()
873 }
874 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
875 self.inner.channel().on_closed()
876 }
877
878 #[cfg(target_os = "fuchsia")]
879 fn signal_peer(
880 &self,
881 clear_mask: zx::Signals,
882 set_mask: zx::Signals,
883 ) -> Result<(), zx_status::Status> {
884 use fidl::Peered;
885 self.inner.channel().signal_peer(clear_mask, set_mask)
886 }
887}
888
889impl ManagerControlHandle {
890 pub fn send_on_sensor_event(
891 &self,
892 mut event: &fidl_fuchsia_sensors_types::SensorEvent,
893 ) -> Result<(), fidl::Error> {
894 self.inner.send::<ManagerOnSensorEventRequest>(
895 (event,),
896 0,
897 0x6ceb07e11d43e9b,
898 fidl::encoding::DynamicFlags::FLEXIBLE,
899 )
900 }
901}
902
903#[must_use = "FIDL methods require a response to be sent"]
904#[derive(Debug)]
905pub struct ManagerConfigurePlaybackResponder {
906 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
907 tx_id: u32,
908}
909
910impl std::ops::Drop for ManagerConfigurePlaybackResponder {
914 fn drop(&mut self) {
915 self.control_handle.shutdown();
916 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
918 }
919}
920
921impl fidl::endpoints::Responder for ManagerConfigurePlaybackResponder {
922 type ControlHandle = ManagerControlHandle;
923
924 fn control_handle(&self) -> &ManagerControlHandle {
925 &self.control_handle
926 }
927
928 fn drop_without_shutdown(mut self) {
929 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
931 std::mem::forget(self);
933 }
934}
935
936impl ManagerConfigurePlaybackResponder {
937 pub fn send(self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
941 let _result = self.send_raw(result);
942 if _result.is_err() {
943 self.control_handle.shutdown();
944 }
945 self.drop_without_shutdown();
946 _result
947 }
948
949 pub fn send_no_shutdown_on_err(
951 self,
952 mut result: Result<(), ConfigurePlaybackError>,
953 ) -> Result<(), fidl::Error> {
954 let _result = self.send_raw(result);
955 self.drop_without_shutdown();
956 _result
957 }
958
959 fn send_raw(&self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
960 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
961 fidl::encoding::EmptyStruct,
962 ConfigurePlaybackError,
963 >>(
964 fidl::encoding::FlexibleResult::new(result),
965 self.tx_id,
966 0x2aec5d56edab43fa,
967 fidl::encoding::DynamicFlags::FLEXIBLE,
968 )
969 }
970}
971
972#[must_use = "FIDL methods require a response to be sent"]
973#[derive(Debug)]
974pub struct ManagerGetSensorsListResponder {
975 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
976 tx_id: u32,
977}
978
979impl std::ops::Drop for ManagerGetSensorsListResponder {
983 fn drop(&mut self) {
984 self.control_handle.shutdown();
985 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
987 }
988}
989
990impl fidl::endpoints::Responder for ManagerGetSensorsListResponder {
991 type ControlHandle = ManagerControlHandle;
992
993 fn control_handle(&self) -> &ManagerControlHandle {
994 &self.control_handle
995 }
996
997 fn drop_without_shutdown(mut self) {
998 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1000 std::mem::forget(self);
1002 }
1003}
1004
1005impl ManagerGetSensorsListResponder {
1006 pub fn send(
1010 self,
1011 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1012 ) -> Result<(), fidl::Error> {
1013 let _result = self.send_raw(sensors);
1014 if _result.is_err() {
1015 self.control_handle.shutdown();
1016 }
1017 self.drop_without_shutdown();
1018 _result
1019 }
1020
1021 pub fn send_no_shutdown_on_err(
1023 self,
1024 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1025 ) -> Result<(), fidl::Error> {
1026 let _result = self.send_raw(sensors);
1027 self.drop_without_shutdown();
1028 _result
1029 }
1030
1031 fn send_raw(
1032 &self,
1033 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1034 ) -> Result<(), fidl::Error> {
1035 self.control_handle
1036 .inner
1037 .send::<fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>>(
1038 fidl::encoding::Flexible::new((sensors,)),
1039 self.tx_id,
1040 0x48cf103cfbec3a4a,
1041 fidl::encoding::DynamicFlags::FLEXIBLE,
1042 )
1043 }
1044}
1045
1046#[must_use = "FIDL methods require a response to be sent"]
1047#[derive(Debug)]
1048pub struct ManagerConfigureSensorRatesResponder {
1049 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1050 tx_id: u32,
1051}
1052
1053impl std::ops::Drop for ManagerConfigureSensorRatesResponder {
1057 fn drop(&mut self) {
1058 self.control_handle.shutdown();
1059 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1061 }
1062}
1063
1064impl fidl::endpoints::Responder for ManagerConfigureSensorRatesResponder {
1065 type ControlHandle = ManagerControlHandle;
1066
1067 fn control_handle(&self) -> &ManagerControlHandle {
1068 &self.control_handle
1069 }
1070
1071 fn drop_without_shutdown(mut self) {
1072 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1074 std::mem::forget(self);
1076 }
1077}
1078
1079impl ManagerConfigureSensorRatesResponder {
1080 pub fn send(self, mut result: Result<(), ConfigureSensorRateError>) -> Result<(), fidl::Error> {
1084 let _result = self.send_raw(result);
1085 if _result.is_err() {
1086 self.control_handle.shutdown();
1087 }
1088 self.drop_without_shutdown();
1089 _result
1090 }
1091
1092 pub fn send_no_shutdown_on_err(
1094 self,
1095 mut result: Result<(), ConfigureSensorRateError>,
1096 ) -> Result<(), fidl::Error> {
1097 let _result = self.send_raw(result);
1098 self.drop_without_shutdown();
1099 _result
1100 }
1101
1102 fn send_raw(
1103 &self,
1104 mut result: Result<(), ConfigureSensorRateError>,
1105 ) -> Result<(), fidl::Error> {
1106 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1107 fidl::encoding::EmptyStruct,
1108 ConfigureSensorRateError,
1109 >>(
1110 fidl::encoding::FlexibleResult::new(result),
1111 self.tx_id,
1112 0x28046f7f3f340652,
1113 fidl::encoding::DynamicFlags::FLEXIBLE,
1114 )
1115 }
1116}
1117
1118#[must_use = "FIDL methods require a response to be sent"]
1119#[derive(Debug)]
1120pub struct ManagerActivateResponder {
1121 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1122 tx_id: u32,
1123}
1124
1125impl std::ops::Drop for ManagerActivateResponder {
1129 fn drop(&mut self) {
1130 self.control_handle.shutdown();
1131 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1133 }
1134}
1135
1136impl fidl::endpoints::Responder for ManagerActivateResponder {
1137 type ControlHandle = ManagerControlHandle;
1138
1139 fn control_handle(&self) -> &ManagerControlHandle {
1140 &self.control_handle
1141 }
1142
1143 fn drop_without_shutdown(mut self) {
1144 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1146 std::mem::forget(self);
1148 }
1149}
1150
1151impl ManagerActivateResponder {
1152 pub fn send(self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1156 let _result = self.send_raw(result);
1157 if _result.is_err() {
1158 self.control_handle.shutdown();
1159 }
1160 self.drop_without_shutdown();
1161 _result
1162 }
1163
1164 pub fn send_no_shutdown_on_err(
1166 self,
1167 mut result: Result<(), ActivateSensorError>,
1168 ) -> Result<(), fidl::Error> {
1169 let _result = self.send_raw(result);
1170 self.drop_without_shutdown();
1171 _result
1172 }
1173
1174 fn send_raw(&self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1175 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1176 fidl::encoding::EmptyStruct,
1177 ActivateSensorError,
1178 >>(
1179 fidl::encoding::FlexibleResult::new(result),
1180 self.tx_id,
1181 0x5678f117cae5ba42,
1182 fidl::encoding::DynamicFlags::FLEXIBLE,
1183 )
1184 }
1185}
1186
1187#[must_use = "FIDL methods require a response to be sent"]
1188#[derive(Debug)]
1189pub struct ManagerDeactivateResponder {
1190 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1191 tx_id: u32,
1192}
1193
1194impl std::ops::Drop for ManagerDeactivateResponder {
1198 fn drop(&mut self) {
1199 self.control_handle.shutdown();
1200 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202 }
1203}
1204
1205impl fidl::endpoints::Responder for ManagerDeactivateResponder {
1206 type ControlHandle = ManagerControlHandle;
1207
1208 fn control_handle(&self) -> &ManagerControlHandle {
1209 &self.control_handle
1210 }
1211
1212 fn drop_without_shutdown(mut self) {
1213 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1215 std::mem::forget(self);
1217 }
1218}
1219
1220impl ManagerDeactivateResponder {
1221 pub fn send(self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1225 let _result = self.send_raw(result);
1226 if _result.is_err() {
1227 self.control_handle.shutdown();
1228 }
1229 self.drop_without_shutdown();
1230 _result
1231 }
1232
1233 pub fn send_no_shutdown_on_err(
1235 self,
1236 mut result: Result<(), DeactivateSensorError>,
1237 ) -> Result<(), fidl::Error> {
1238 let _result = self.send_raw(result);
1239 self.drop_without_shutdown();
1240 _result
1241 }
1242
1243 fn send_raw(&self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1244 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1245 fidl::encoding::EmptyStruct,
1246 DeactivateSensorError,
1247 >>(
1248 fidl::encoding::FlexibleResult::new(result),
1249 self.tx_id,
1250 0x7fafbca62982c87,
1251 fidl::encoding::DynamicFlags::FLEXIBLE,
1252 )
1253 }
1254}
1255
1256mod internal {
1257 use super::*;
1258
1259 impl fidl::encoding::ResourceTypeMarker for ManagerConfigureSensorRatesRequest {
1260 type Borrowed<'a> = &'a mut Self;
1261 fn take_or_borrow<'a>(
1262 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1263 ) -> Self::Borrowed<'a> {
1264 value
1265 }
1266 }
1267
1268 unsafe impl fidl::encoding::TypeMarker for ManagerConfigureSensorRatesRequest {
1269 type Owned = Self;
1270
1271 #[inline(always)]
1272 fn inline_align(_context: fidl::encoding::Context) -> usize {
1273 8
1274 }
1275
1276 #[inline(always)]
1277 fn inline_size(_context: fidl::encoding::Context) -> usize {
1278 24
1279 }
1280 }
1281
1282 unsafe impl
1283 fidl::encoding::Encode<
1284 ManagerConfigureSensorRatesRequest,
1285 fidl::encoding::DefaultFuchsiaResourceDialect,
1286 > for &mut ManagerConfigureSensorRatesRequest
1287 {
1288 #[inline]
1289 unsafe fn encode(
1290 self,
1291 encoder: &mut fidl::encoding::Encoder<
1292 '_,
1293 fidl::encoding::DefaultFuchsiaResourceDialect,
1294 >,
1295 offset: usize,
1296 _depth: fidl::encoding::Depth,
1297 ) -> fidl::Result<()> {
1298 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1299 fidl::encoding::Encode::<ManagerConfigureSensorRatesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1301 (
1302 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1303 <fidl_fuchsia_sensors_types::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
1304 ),
1305 encoder, offset, _depth
1306 )
1307 }
1308 }
1309 unsafe impl<
1310 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1311 T1: fidl::encoding::Encode<
1312 fidl_fuchsia_sensors_types::SensorRateConfig,
1313 fidl::encoding::DefaultFuchsiaResourceDialect,
1314 >,
1315 >
1316 fidl::encoding::Encode<
1317 ManagerConfigureSensorRatesRequest,
1318 fidl::encoding::DefaultFuchsiaResourceDialect,
1319 > for (T0, T1)
1320 {
1321 #[inline]
1322 unsafe fn encode(
1323 self,
1324 encoder: &mut fidl::encoding::Encoder<
1325 '_,
1326 fidl::encoding::DefaultFuchsiaResourceDialect,
1327 >,
1328 offset: usize,
1329 depth: fidl::encoding::Depth,
1330 ) -> fidl::Result<()> {
1331 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1332 unsafe {
1335 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1336 (ptr as *mut u64).write_unaligned(0);
1337 }
1338 self.0.encode(encoder, offset + 0, depth)?;
1340 self.1.encode(encoder, offset + 8, depth)?;
1341 Ok(())
1342 }
1343 }
1344
1345 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1346 for ManagerConfigureSensorRatesRequest
1347 {
1348 #[inline(always)]
1349 fn new_empty() -> Self {
1350 Self {
1351 id: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1352 sensor_rate_config: fidl::new_empty!(
1353 fidl_fuchsia_sensors_types::SensorRateConfig,
1354 fidl::encoding::DefaultFuchsiaResourceDialect
1355 ),
1356 }
1357 }
1358
1359 #[inline]
1360 unsafe fn decode(
1361 &mut self,
1362 decoder: &mut fidl::encoding::Decoder<
1363 '_,
1364 fidl::encoding::DefaultFuchsiaResourceDialect,
1365 >,
1366 offset: usize,
1367 _depth: fidl::encoding::Depth,
1368 ) -> fidl::Result<()> {
1369 decoder.debug_check_bounds::<Self>(offset);
1370 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1372 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1373 let mask = 0xffffffff00000000u64;
1374 let maskedval = padval & mask;
1375 if maskedval != 0 {
1376 return Err(fidl::Error::NonZeroPadding {
1377 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1378 });
1379 }
1380 fidl::decode!(
1381 i32,
1382 fidl::encoding::DefaultFuchsiaResourceDialect,
1383 &mut self.id,
1384 decoder,
1385 offset + 0,
1386 _depth
1387 )?;
1388 fidl::decode!(
1389 fidl_fuchsia_sensors_types::SensorRateConfig,
1390 fidl::encoding::DefaultFuchsiaResourceDialect,
1391 &mut self.sensor_rate_config,
1392 decoder,
1393 offset + 8,
1394 _depth
1395 )?;
1396 Ok(())
1397 }
1398 }
1399}