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#[derive(Debug, Clone)]
226pub struct ManagerProxy {
227 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
228}
229
230impl fidl::endpoints::Proxy for ManagerProxy {
231 type Protocol = ManagerMarker;
232
233 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
234 Self::new(inner)
235 }
236
237 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
238 self.client.into_channel().map_err(|client| Self { client })
239 }
240
241 fn as_channel(&self) -> &::fidl::AsyncChannel {
242 self.client.as_channel()
243 }
244}
245
246impl ManagerProxy {
247 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
249 let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
250 Self { client: fidl::client::Client::new(channel, protocol_name) }
251 }
252
253 pub fn take_event_stream(&self) -> ManagerEventStream {
259 ManagerEventStream { event_receiver: self.client.take_event_receiver() }
260 }
261
262 pub fn r#configure_playback(
266 &self,
267 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
268 ) -> fidl::client::QueryResponseFut<
269 ManagerConfigurePlaybackResult,
270 fidl::encoding::DefaultFuchsiaResourceDialect,
271 > {
272 ManagerProxyInterface::r#configure_playback(self, source_config)
273 }
274
275 pub fn r#get_sensors_list(
277 &self,
278 ) -> fidl::client::QueryResponseFut<
279 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
280 fidl::encoding::DefaultFuchsiaResourceDialect,
281 > {
282 ManagerProxyInterface::r#get_sensors_list(self)
283 }
284
285 pub fn r#configure_sensor_rates(
287 &self,
288 mut id: i32,
289 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
290 ) -> fidl::client::QueryResponseFut<
291 ManagerConfigureSensorRatesResult,
292 fidl::encoding::DefaultFuchsiaResourceDialect,
293 > {
294 ManagerProxyInterface::r#configure_sensor_rates(self, id, sensor_rate_config)
295 }
296
297 pub fn r#activate(
299 &self,
300 mut id: i32,
301 ) -> fidl::client::QueryResponseFut<
302 ManagerActivateResult,
303 fidl::encoding::DefaultFuchsiaResourceDialect,
304 > {
305 ManagerProxyInterface::r#activate(self, id)
306 }
307
308 pub fn r#deactivate(
310 &self,
311 mut id: i32,
312 ) -> fidl::client::QueryResponseFut<
313 ManagerDeactivateResult,
314 fidl::encoding::DefaultFuchsiaResourceDialect,
315 > {
316 ManagerProxyInterface::r#deactivate(self, id)
317 }
318}
319
320impl ManagerProxyInterface for ManagerProxy {
321 type ConfigurePlaybackResponseFut = fidl::client::QueryResponseFut<
322 ManagerConfigurePlaybackResult,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 >;
325 fn r#configure_playback(
326 &self,
327 mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
328 ) -> Self::ConfigurePlaybackResponseFut {
329 fn _decode(
330 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
331 ) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
332 let _response = fidl::client::decode_transaction_body::<
333 fidl::encoding::FlexibleResultType<
334 fidl::encoding::EmptyStruct,
335 ConfigurePlaybackError,
336 >,
337 fidl::encoding::DefaultFuchsiaResourceDialect,
338 0x2aec5d56edab43fa,
339 >(_buf?)?
340 .into_result::<ManagerMarker>("configure_playback")?;
341 Ok(_response.map(|x| x))
342 }
343 self.client.send_query_and_decode::<
344 ManagerConfigurePlaybackRequest,
345 ManagerConfigurePlaybackResult,
346 >(
347 (source_config,),
348 0x2aec5d56edab43fa,
349 fidl::encoding::DynamicFlags::FLEXIBLE,
350 _decode,
351 )
352 }
353
354 type GetSensorsListResponseFut = fidl::client::QueryResponseFut<
355 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
356 fidl::encoding::DefaultFuchsiaResourceDialect,
357 >;
358 fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut {
359 fn _decode(
360 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
361 ) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
362 let _response = fidl::client::decode_transaction_body::<
363 fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
364 fidl::encoding::DefaultFuchsiaResourceDialect,
365 0x48cf103cfbec3a4a,
366 >(_buf?)?
367 .into_result::<ManagerMarker>("get_sensors_list")?;
368 Ok(_response.sensors)
369 }
370 self.client.send_query_and_decode::<
371 fidl::encoding::EmptyPayload,
372 Vec<fidl_fuchsia_sensors_types::SensorInfo>,
373 >(
374 (),
375 0x48cf103cfbec3a4a,
376 fidl::encoding::DynamicFlags::FLEXIBLE,
377 _decode,
378 )
379 }
380
381 type ConfigureSensorRatesResponseFut = fidl::client::QueryResponseFut<
382 ManagerConfigureSensorRatesResult,
383 fidl::encoding::DefaultFuchsiaResourceDialect,
384 >;
385 fn r#configure_sensor_rates(
386 &self,
387 mut id: i32,
388 mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
389 ) -> Self::ConfigureSensorRatesResponseFut {
390 fn _decode(
391 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
392 ) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
393 let _response = fidl::client::decode_transaction_body::<
394 fidl::encoding::FlexibleResultType<
395 fidl::encoding::EmptyStruct,
396 ConfigureSensorRateError,
397 >,
398 fidl::encoding::DefaultFuchsiaResourceDialect,
399 0x28046f7f3f340652,
400 >(_buf?)?
401 .into_result::<ManagerMarker>("configure_sensor_rates")?;
402 Ok(_response.map(|x| x))
403 }
404 self.client.send_query_and_decode::<
405 ManagerConfigureSensorRatesRequest,
406 ManagerConfigureSensorRatesResult,
407 >(
408 (id, sensor_rate_config,),
409 0x28046f7f3f340652,
410 fidl::encoding::DynamicFlags::FLEXIBLE,
411 _decode,
412 )
413 }
414
415 type ActivateResponseFut = fidl::client::QueryResponseFut<
416 ManagerActivateResult,
417 fidl::encoding::DefaultFuchsiaResourceDialect,
418 >;
419 fn r#activate(&self, mut id: i32) -> Self::ActivateResponseFut {
420 fn _decode(
421 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
422 ) -> Result<ManagerActivateResult, fidl::Error> {
423 let _response = fidl::client::decode_transaction_body::<
424 fidl::encoding::FlexibleResultType<
425 fidl::encoding::EmptyStruct,
426 ActivateSensorError,
427 >,
428 fidl::encoding::DefaultFuchsiaResourceDialect,
429 0x5678f117cae5ba42,
430 >(_buf?)?
431 .into_result::<ManagerMarker>("activate")?;
432 Ok(_response.map(|x| x))
433 }
434 self.client.send_query_and_decode::<ManagerActivateRequest, ManagerActivateResult>(
435 (id,),
436 0x5678f117cae5ba42,
437 fidl::encoding::DynamicFlags::FLEXIBLE,
438 _decode,
439 )
440 }
441
442 type DeactivateResponseFut = fidl::client::QueryResponseFut<
443 ManagerDeactivateResult,
444 fidl::encoding::DefaultFuchsiaResourceDialect,
445 >;
446 fn r#deactivate(&self, mut id: i32) -> Self::DeactivateResponseFut {
447 fn _decode(
448 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
449 ) -> Result<ManagerDeactivateResult, fidl::Error> {
450 let _response = fidl::client::decode_transaction_body::<
451 fidl::encoding::FlexibleResultType<
452 fidl::encoding::EmptyStruct,
453 DeactivateSensorError,
454 >,
455 fidl::encoding::DefaultFuchsiaResourceDialect,
456 0x7fafbca62982c87,
457 >(_buf?)?
458 .into_result::<ManagerMarker>("deactivate")?;
459 Ok(_response.map(|x| x))
460 }
461 self.client.send_query_and_decode::<ManagerDeactivateRequest, ManagerDeactivateResult>(
462 (id,),
463 0x7fafbca62982c87,
464 fidl::encoding::DynamicFlags::FLEXIBLE,
465 _decode,
466 )
467 }
468}
469
470pub struct ManagerEventStream {
471 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
472}
473
474impl std::marker::Unpin for ManagerEventStream {}
475
476impl futures::stream::FusedStream for ManagerEventStream {
477 fn is_terminated(&self) -> bool {
478 self.event_receiver.is_terminated()
479 }
480}
481
482impl futures::Stream for ManagerEventStream {
483 type Item = Result<ManagerEvent, fidl::Error>;
484
485 fn poll_next(
486 mut self: std::pin::Pin<&mut Self>,
487 cx: &mut std::task::Context<'_>,
488 ) -> std::task::Poll<Option<Self::Item>> {
489 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
490 &mut self.event_receiver,
491 cx
492 )?) {
493 Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
494 None => std::task::Poll::Ready(None),
495 }
496 }
497}
498
499#[derive(Debug)]
500pub enum ManagerEvent {
501 OnSensorEvent {
502 event: fidl_fuchsia_sensors_types::SensorEvent,
503 },
504 #[non_exhaustive]
505 _UnknownEvent {
506 ordinal: u64,
508 },
509}
510
511impl ManagerEvent {
512 #[allow(irrefutable_let_patterns)]
513 pub fn into_on_sensor_event(self) -> Option<fidl_fuchsia_sensors_types::SensorEvent> {
514 if let ManagerEvent::OnSensorEvent { event } = self {
515 Some((event))
516 } else {
517 None
518 }
519 }
520
521 fn decode(
523 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
524 ) -> Result<ManagerEvent, fidl::Error> {
525 let (bytes, _handles) = buf.split_mut();
526 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
527 debug_assert_eq!(tx_header.tx_id, 0);
528 match tx_header.ordinal {
529 0x6ceb07e11d43e9b => {
530 let mut out = fidl::new_empty!(
531 ManagerOnSensorEventRequest,
532 fidl::encoding::DefaultFuchsiaResourceDialect
533 );
534 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerOnSensorEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
535 Ok((ManagerEvent::OnSensorEvent { event: out.event }))
536 }
537 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
538 Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
539 }
540 _ => Err(fidl::Error::UnknownOrdinal {
541 ordinal: tx_header.ordinal,
542 protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
543 }),
544 }
545 }
546}
547
548pub struct ManagerRequestStream {
550 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
551 is_terminated: bool,
552}
553
554impl std::marker::Unpin for ManagerRequestStream {}
555
556impl futures::stream::FusedStream for ManagerRequestStream {
557 fn is_terminated(&self) -> bool {
558 self.is_terminated
559 }
560}
561
562impl fidl::endpoints::RequestStream for ManagerRequestStream {
563 type Protocol = ManagerMarker;
564 type ControlHandle = ManagerControlHandle;
565
566 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
567 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
568 }
569
570 fn control_handle(&self) -> Self::ControlHandle {
571 ManagerControlHandle { inner: self.inner.clone() }
572 }
573
574 fn into_inner(
575 self,
576 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
577 {
578 (self.inner, self.is_terminated)
579 }
580
581 fn from_inner(
582 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
583 is_terminated: bool,
584 ) -> Self {
585 Self { inner, is_terminated }
586 }
587}
588
589impl futures::Stream for ManagerRequestStream {
590 type Item = Result<ManagerRequest, fidl::Error>;
591
592 fn poll_next(
593 mut self: std::pin::Pin<&mut Self>,
594 cx: &mut std::task::Context<'_>,
595 ) -> std::task::Poll<Option<Self::Item>> {
596 let this = &mut *self;
597 if this.inner.check_shutdown(cx) {
598 this.is_terminated = true;
599 return std::task::Poll::Ready(None);
600 }
601 if this.is_terminated {
602 panic!("polled ManagerRequestStream after completion");
603 }
604 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
605 |bytes, handles| {
606 match this.inner.channel().read_etc(cx, bytes, handles) {
607 std::task::Poll::Ready(Ok(())) => {}
608 std::task::Poll::Pending => return std::task::Poll::Pending,
609 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
610 this.is_terminated = true;
611 return std::task::Poll::Ready(None);
612 }
613 std::task::Poll::Ready(Err(e)) => {
614 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
615 e.into(),
616 ))))
617 }
618 }
619
620 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
622
623 std::task::Poll::Ready(Some(match header.ordinal {
624 0x2aec5d56edab43fa => {
625 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
626 let mut req = fidl::new_empty!(
627 ManagerConfigurePlaybackRequest,
628 fidl::encoding::DefaultFuchsiaResourceDialect
629 );
630 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigurePlaybackRequest>(&header, _body_bytes, handles, &mut req)?;
631 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
632 Ok(ManagerRequest::ConfigurePlayback {
633 source_config: req.source_config,
634
635 responder: ManagerConfigurePlaybackResponder {
636 control_handle: std::mem::ManuallyDrop::new(control_handle),
637 tx_id: header.tx_id,
638 },
639 })
640 }
641 0x48cf103cfbec3a4a => {
642 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
643 let mut req = fidl::new_empty!(
644 fidl::encoding::EmptyPayload,
645 fidl::encoding::DefaultFuchsiaResourceDialect
646 );
647 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
648 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
649 Ok(ManagerRequest::GetSensorsList {
650 responder: ManagerGetSensorsListResponder {
651 control_handle: std::mem::ManuallyDrop::new(control_handle),
652 tx_id: header.tx_id,
653 },
654 })
655 }
656 0x28046f7f3f340652 => {
657 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
658 let mut req = fidl::new_empty!(
659 ManagerConfigureSensorRatesRequest,
660 fidl::encoding::DefaultFuchsiaResourceDialect
661 );
662 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigureSensorRatesRequest>(&header, _body_bytes, handles, &mut req)?;
663 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
664 Ok(ManagerRequest::ConfigureSensorRates {
665 id: req.id,
666 sensor_rate_config: req.sensor_rate_config,
667
668 responder: ManagerConfigureSensorRatesResponder {
669 control_handle: std::mem::ManuallyDrop::new(control_handle),
670 tx_id: header.tx_id,
671 },
672 })
673 }
674 0x5678f117cae5ba42 => {
675 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
676 let mut req = fidl::new_empty!(
677 ManagerActivateRequest,
678 fidl::encoding::DefaultFuchsiaResourceDialect
679 );
680 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
681 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
682 Ok(ManagerRequest::Activate {
683 id: req.id,
684
685 responder: ManagerActivateResponder {
686 control_handle: std::mem::ManuallyDrop::new(control_handle),
687 tx_id: header.tx_id,
688 },
689 })
690 }
691 0x7fafbca62982c87 => {
692 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
693 let mut req = fidl::new_empty!(
694 ManagerDeactivateRequest,
695 fidl::encoding::DefaultFuchsiaResourceDialect
696 );
697 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerDeactivateRequest>(&header, _body_bytes, handles, &mut req)?;
698 let control_handle = ManagerControlHandle { inner: this.inner.clone() };
699 Ok(ManagerRequest::Deactivate {
700 id: req.id,
701
702 responder: ManagerDeactivateResponder {
703 control_handle: std::mem::ManuallyDrop::new(control_handle),
704 tx_id: header.tx_id,
705 },
706 })
707 }
708 _ if header.tx_id == 0
709 && header
710 .dynamic_flags()
711 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
712 {
713 Ok(ManagerRequest::_UnknownMethod {
714 ordinal: header.ordinal,
715 control_handle: ManagerControlHandle { inner: this.inner.clone() },
716 method_type: fidl::MethodType::OneWay,
717 })
718 }
719 _ if header
720 .dynamic_flags()
721 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
722 {
723 this.inner.send_framework_err(
724 fidl::encoding::FrameworkErr::UnknownMethod,
725 header.tx_id,
726 header.ordinal,
727 header.dynamic_flags(),
728 (bytes, handles),
729 )?;
730 Ok(ManagerRequest::_UnknownMethod {
731 ordinal: header.ordinal,
732 control_handle: ManagerControlHandle { inner: this.inner.clone() },
733 method_type: fidl::MethodType::TwoWay,
734 })
735 }
736 _ => Err(fidl::Error::UnknownOrdinal {
737 ordinal: header.ordinal,
738 protocol_name:
739 <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
740 }),
741 }))
742 },
743 )
744 }
745}
746
747#[derive(Debug)]
748pub enum ManagerRequest {
749 ConfigurePlayback {
753 source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
754 responder: ManagerConfigurePlaybackResponder,
755 },
756 GetSensorsList { responder: ManagerGetSensorsListResponder },
758 ConfigureSensorRates {
760 id: i32,
761 sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
762 responder: ManagerConfigureSensorRatesResponder,
763 },
764 Activate { id: i32, responder: ManagerActivateResponder },
766 Deactivate { id: i32, responder: ManagerDeactivateResponder },
768 #[non_exhaustive]
770 _UnknownMethod {
771 ordinal: u64,
773 control_handle: ManagerControlHandle,
774 method_type: fidl::MethodType,
775 },
776}
777
778impl ManagerRequest {
779 #[allow(irrefutable_let_patterns)]
780 pub fn into_configure_playback(
781 self,
782 ) -> Option<(
783 fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
784 ManagerConfigurePlaybackResponder,
785 )> {
786 if let ManagerRequest::ConfigurePlayback { source_config, responder } = self {
787 Some((source_config, responder))
788 } else {
789 None
790 }
791 }
792
793 #[allow(irrefutable_let_patterns)]
794 pub fn into_get_sensors_list(self) -> Option<(ManagerGetSensorsListResponder)> {
795 if let ManagerRequest::GetSensorsList { responder } = self {
796 Some((responder))
797 } else {
798 None
799 }
800 }
801
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_configure_sensor_rates(
804 self,
805 ) -> Option<(
806 i32,
807 fidl_fuchsia_sensors_types::SensorRateConfig,
808 ManagerConfigureSensorRatesResponder,
809 )> {
810 if let ManagerRequest::ConfigureSensorRates { id, sensor_rate_config, responder } = self {
811 Some((id, sensor_rate_config, responder))
812 } else {
813 None
814 }
815 }
816
817 #[allow(irrefutable_let_patterns)]
818 pub fn into_activate(self) -> Option<(i32, ManagerActivateResponder)> {
819 if let ManagerRequest::Activate { id, responder } = self {
820 Some((id, responder))
821 } else {
822 None
823 }
824 }
825
826 #[allow(irrefutable_let_patterns)]
827 pub fn into_deactivate(self) -> Option<(i32, ManagerDeactivateResponder)> {
828 if let ManagerRequest::Deactivate { id, responder } = self {
829 Some((id, responder))
830 } else {
831 None
832 }
833 }
834
835 pub fn method_name(&self) -> &'static str {
837 match *self {
838 ManagerRequest::ConfigurePlayback { .. } => "configure_playback",
839 ManagerRequest::GetSensorsList { .. } => "get_sensors_list",
840 ManagerRequest::ConfigureSensorRates { .. } => "configure_sensor_rates",
841 ManagerRequest::Activate { .. } => "activate",
842 ManagerRequest::Deactivate { .. } => "deactivate",
843 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
844 "unknown one-way method"
845 }
846 ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
847 "unknown two-way method"
848 }
849 }
850 }
851}
852
853#[derive(Debug, Clone)]
854pub struct ManagerControlHandle {
855 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
856}
857
858impl fidl::endpoints::ControlHandle for ManagerControlHandle {
859 fn shutdown(&self) {
860 self.inner.shutdown()
861 }
862 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
863 self.inner.shutdown_with_epitaph(status)
864 }
865
866 fn is_closed(&self) -> bool {
867 self.inner.channel().is_closed()
868 }
869 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
870 self.inner.channel().on_closed()
871 }
872
873 #[cfg(target_os = "fuchsia")]
874 fn signal_peer(
875 &self,
876 clear_mask: zx::Signals,
877 set_mask: zx::Signals,
878 ) -> Result<(), zx_status::Status> {
879 use fidl::Peered;
880 self.inner.channel().signal_peer(clear_mask, set_mask)
881 }
882}
883
884impl ManagerControlHandle {
885 pub fn send_on_sensor_event(
886 &self,
887 mut event: &fidl_fuchsia_sensors_types::SensorEvent,
888 ) -> Result<(), fidl::Error> {
889 self.inner.send::<ManagerOnSensorEventRequest>(
890 (event,),
891 0,
892 0x6ceb07e11d43e9b,
893 fidl::encoding::DynamicFlags::FLEXIBLE,
894 )
895 }
896}
897
898#[must_use = "FIDL methods require a response to be sent"]
899#[derive(Debug)]
900pub struct ManagerConfigurePlaybackResponder {
901 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
902 tx_id: u32,
903}
904
905impl std::ops::Drop for ManagerConfigurePlaybackResponder {
909 fn drop(&mut self) {
910 self.control_handle.shutdown();
911 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
913 }
914}
915
916impl fidl::endpoints::Responder for ManagerConfigurePlaybackResponder {
917 type ControlHandle = ManagerControlHandle;
918
919 fn control_handle(&self) -> &ManagerControlHandle {
920 &self.control_handle
921 }
922
923 fn drop_without_shutdown(mut self) {
924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
926 std::mem::forget(self);
928 }
929}
930
931impl ManagerConfigurePlaybackResponder {
932 pub fn send(self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
936 let _result = self.send_raw(result);
937 if _result.is_err() {
938 self.control_handle.shutdown();
939 }
940 self.drop_without_shutdown();
941 _result
942 }
943
944 pub fn send_no_shutdown_on_err(
946 self,
947 mut result: Result<(), ConfigurePlaybackError>,
948 ) -> Result<(), fidl::Error> {
949 let _result = self.send_raw(result);
950 self.drop_without_shutdown();
951 _result
952 }
953
954 fn send_raw(&self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
955 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
956 fidl::encoding::EmptyStruct,
957 ConfigurePlaybackError,
958 >>(
959 fidl::encoding::FlexibleResult::new(result),
960 self.tx_id,
961 0x2aec5d56edab43fa,
962 fidl::encoding::DynamicFlags::FLEXIBLE,
963 )
964 }
965}
966
967#[must_use = "FIDL methods require a response to be sent"]
968#[derive(Debug)]
969pub struct ManagerGetSensorsListResponder {
970 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
971 tx_id: u32,
972}
973
974impl std::ops::Drop for ManagerGetSensorsListResponder {
978 fn drop(&mut self) {
979 self.control_handle.shutdown();
980 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
982 }
983}
984
985impl fidl::endpoints::Responder for ManagerGetSensorsListResponder {
986 type ControlHandle = ManagerControlHandle;
987
988 fn control_handle(&self) -> &ManagerControlHandle {
989 &self.control_handle
990 }
991
992 fn drop_without_shutdown(mut self) {
993 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
995 std::mem::forget(self);
997 }
998}
999
1000impl ManagerGetSensorsListResponder {
1001 pub fn send(
1005 self,
1006 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1007 ) -> Result<(), fidl::Error> {
1008 let _result = self.send_raw(sensors);
1009 if _result.is_err() {
1010 self.control_handle.shutdown();
1011 }
1012 self.drop_without_shutdown();
1013 _result
1014 }
1015
1016 pub fn send_no_shutdown_on_err(
1018 self,
1019 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1020 ) -> Result<(), fidl::Error> {
1021 let _result = self.send_raw(sensors);
1022 self.drop_without_shutdown();
1023 _result
1024 }
1025
1026 fn send_raw(
1027 &self,
1028 mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
1029 ) -> Result<(), fidl::Error> {
1030 self.control_handle
1031 .inner
1032 .send::<fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>>(
1033 fidl::encoding::Flexible::new((sensors,)),
1034 self.tx_id,
1035 0x48cf103cfbec3a4a,
1036 fidl::encoding::DynamicFlags::FLEXIBLE,
1037 )
1038 }
1039}
1040
1041#[must_use = "FIDL methods require a response to be sent"]
1042#[derive(Debug)]
1043pub struct ManagerConfigureSensorRatesResponder {
1044 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1045 tx_id: u32,
1046}
1047
1048impl std::ops::Drop for ManagerConfigureSensorRatesResponder {
1052 fn drop(&mut self) {
1053 self.control_handle.shutdown();
1054 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1056 }
1057}
1058
1059impl fidl::endpoints::Responder for ManagerConfigureSensorRatesResponder {
1060 type ControlHandle = ManagerControlHandle;
1061
1062 fn control_handle(&self) -> &ManagerControlHandle {
1063 &self.control_handle
1064 }
1065
1066 fn drop_without_shutdown(mut self) {
1067 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1069 std::mem::forget(self);
1071 }
1072}
1073
1074impl ManagerConfigureSensorRatesResponder {
1075 pub fn send(self, mut result: Result<(), ConfigureSensorRateError>) -> Result<(), fidl::Error> {
1079 let _result = self.send_raw(result);
1080 if _result.is_err() {
1081 self.control_handle.shutdown();
1082 }
1083 self.drop_without_shutdown();
1084 _result
1085 }
1086
1087 pub fn send_no_shutdown_on_err(
1089 self,
1090 mut result: Result<(), ConfigureSensorRateError>,
1091 ) -> Result<(), fidl::Error> {
1092 let _result = self.send_raw(result);
1093 self.drop_without_shutdown();
1094 _result
1095 }
1096
1097 fn send_raw(
1098 &self,
1099 mut result: Result<(), ConfigureSensorRateError>,
1100 ) -> Result<(), fidl::Error> {
1101 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1102 fidl::encoding::EmptyStruct,
1103 ConfigureSensorRateError,
1104 >>(
1105 fidl::encoding::FlexibleResult::new(result),
1106 self.tx_id,
1107 0x28046f7f3f340652,
1108 fidl::encoding::DynamicFlags::FLEXIBLE,
1109 )
1110 }
1111}
1112
1113#[must_use = "FIDL methods require a response to be sent"]
1114#[derive(Debug)]
1115pub struct ManagerActivateResponder {
1116 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1117 tx_id: u32,
1118}
1119
1120impl std::ops::Drop for ManagerActivateResponder {
1124 fn drop(&mut self) {
1125 self.control_handle.shutdown();
1126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128 }
1129}
1130
1131impl fidl::endpoints::Responder for ManagerActivateResponder {
1132 type ControlHandle = ManagerControlHandle;
1133
1134 fn control_handle(&self) -> &ManagerControlHandle {
1135 &self.control_handle
1136 }
1137
1138 fn drop_without_shutdown(mut self) {
1139 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1141 std::mem::forget(self);
1143 }
1144}
1145
1146impl ManagerActivateResponder {
1147 pub fn send(self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1151 let _result = self.send_raw(result);
1152 if _result.is_err() {
1153 self.control_handle.shutdown();
1154 }
1155 self.drop_without_shutdown();
1156 _result
1157 }
1158
1159 pub fn send_no_shutdown_on_err(
1161 self,
1162 mut result: Result<(), ActivateSensorError>,
1163 ) -> Result<(), fidl::Error> {
1164 let _result = self.send_raw(result);
1165 self.drop_without_shutdown();
1166 _result
1167 }
1168
1169 fn send_raw(&self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
1170 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1171 fidl::encoding::EmptyStruct,
1172 ActivateSensorError,
1173 >>(
1174 fidl::encoding::FlexibleResult::new(result),
1175 self.tx_id,
1176 0x5678f117cae5ba42,
1177 fidl::encoding::DynamicFlags::FLEXIBLE,
1178 )
1179 }
1180}
1181
1182#[must_use = "FIDL methods require a response to be sent"]
1183#[derive(Debug)]
1184pub struct ManagerDeactivateResponder {
1185 control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
1186 tx_id: u32,
1187}
1188
1189impl std::ops::Drop for ManagerDeactivateResponder {
1193 fn drop(&mut self) {
1194 self.control_handle.shutdown();
1195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1197 }
1198}
1199
1200impl fidl::endpoints::Responder for ManagerDeactivateResponder {
1201 type ControlHandle = ManagerControlHandle;
1202
1203 fn control_handle(&self) -> &ManagerControlHandle {
1204 &self.control_handle
1205 }
1206
1207 fn drop_without_shutdown(mut self) {
1208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1210 std::mem::forget(self);
1212 }
1213}
1214
1215impl ManagerDeactivateResponder {
1216 pub fn send(self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1220 let _result = self.send_raw(result);
1221 if _result.is_err() {
1222 self.control_handle.shutdown();
1223 }
1224 self.drop_without_shutdown();
1225 _result
1226 }
1227
1228 pub fn send_no_shutdown_on_err(
1230 self,
1231 mut result: Result<(), DeactivateSensorError>,
1232 ) -> Result<(), fidl::Error> {
1233 let _result = self.send_raw(result);
1234 self.drop_without_shutdown();
1235 _result
1236 }
1237
1238 fn send_raw(&self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
1239 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1240 fidl::encoding::EmptyStruct,
1241 DeactivateSensorError,
1242 >>(
1243 fidl::encoding::FlexibleResult::new(result),
1244 self.tx_id,
1245 0x7fafbca62982c87,
1246 fidl::encoding::DynamicFlags::FLEXIBLE,
1247 )
1248 }
1249}
1250
1251mod internal {
1252 use super::*;
1253
1254 impl fidl::encoding::ResourceTypeMarker for ManagerConfigureSensorRatesRequest {
1255 type Borrowed<'a> = &'a mut Self;
1256 fn take_or_borrow<'a>(
1257 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1258 ) -> Self::Borrowed<'a> {
1259 value
1260 }
1261 }
1262
1263 unsafe impl fidl::encoding::TypeMarker for ManagerConfigureSensorRatesRequest {
1264 type Owned = Self;
1265
1266 #[inline(always)]
1267 fn inline_align(_context: fidl::encoding::Context) -> usize {
1268 8
1269 }
1270
1271 #[inline(always)]
1272 fn inline_size(_context: fidl::encoding::Context) -> usize {
1273 24
1274 }
1275 }
1276
1277 unsafe impl
1278 fidl::encoding::Encode<
1279 ManagerConfigureSensorRatesRequest,
1280 fidl::encoding::DefaultFuchsiaResourceDialect,
1281 > for &mut ManagerConfigureSensorRatesRequest
1282 {
1283 #[inline]
1284 unsafe fn encode(
1285 self,
1286 encoder: &mut fidl::encoding::Encoder<
1287 '_,
1288 fidl::encoding::DefaultFuchsiaResourceDialect,
1289 >,
1290 offset: usize,
1291 _depth: fidl::encoding::Depth,
1292 ) -> fidl::Result<()> {
1293 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1294 fidl::encoding::Encode::<ManagerConfigureSensorRatesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1296 (
1297 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1298 <fidl_fuchsia_sensors_types::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
1299 ),
1300 encoder, offset, _depth
1301 )
1302 }
1303 }
1304 unsafe impl<
1305 T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
1306 T1: fidl::encoding::Encode<
1307 fidl_fuchsia_sensors_types::SensorRateConfig,
1308 fidl::encoding::DefaultFuchsiaResourceDialect,
1309 >,
1310 >
1311 fidl::encoding::Encode<
1312 ManagerConfigureSensorRatesRequest,
1313 fidl::encoding::DefaultFuchsiaResourceDialect,
1314 > for (T0, T1)
1315 {
1316 #[inline]
1317 unsafe fn encode(
1318 self,
1319 encoder: &mut fidl::encoding::Encoder<
1320 '_,
1321 fidl::encoding::DefaultFuchsiaResourceDialect,
1322 >,
1323 offset: usize,
1324 depth: fidl::encoding::Depth,
1325 ) -> fidl::Result<()> {
1326 encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
1327 unsafe {
1330 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1331 (ptr as *mut u64).write_unaligned(0);
1332 }
1333 self.0.encode(encoder, offset + 0, depth)?;
1335 self.1.encode(encoder, offset + 8, depth)?;
1336 Ok(())
1337 }
1338 }
1339
1340 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1341 for ManagerConfigureSensorRatesRequest
1342 {
1343 #[inline(always)]
1344 fn new_empty() -> Self {
1345 Self {
1346 id: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
1347 sensor_rate_config: fidl::new_empty!(
1348 fidl_fuchsia_sensors_types::SensorRateConfig,
1349 fidl::encoding::DefaultFuchsiaResourceDialect
1350 ),
1351 }
1352 }
1353
1354 #[inline]
1355 unsafe fn decode(
1356 &mut self,
1357 decoder: &mut fidl::encoding::Decoder<
1358 '_,
1359 fidl::encoding::DefaultFuchsiaResourceDialect,
1360 >,
1361 offset: usize,
1362 _depth: fidl::encoding::Depth,
1363 ) -> fidl::Result<()> {
1364 decoder.debug_check_bounds::<Self>(offset);
1365 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1367 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1368 let mask = 0xffffffff00000000u64;
1369 let maskedval = padval & mask;
1370 if maskedval != 0 {
1371 return Err(fidl::Error::NonZeroPadding {
1372 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1373 });
1374 }
1375 fidl::decode!(
1376 i32,
1377 fidl::encoding::DefaultFuchsiaResourceDialect,
1378 &mut self.id,
1379 decoder,
1380 offset + 0,
1381 _depth
1382 )?;
1383 fidl::decode!(
1384 fidl_fuchsia_sensors_types::SensorRateConfig,
1385 fidl::encoding::DefaultFuchsiaResourceDialect,
1386 &mut self.sensor_rate_config,
1387 decoder,
1388 offset + 8,
1389 _depth
1390 )?;
1391 Ok(())
1392 }
1393 }
1394}