fidl_fuchsia_sensors/
fidl_fuchsia_sensors.rs

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