#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ActivateSensorError {
DriverUnavailable,
InvalidSensorId,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ActivateSensorErrorUnknown {
() => {
_
};
}
impl ActivateSensorError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DriverUnavailable),
2 => Some(Self::InvalidSensorId),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::DriverUnavailable,
2 => Self::InvalidSensorId,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::DriverUnavailable => 1,
Self::InvalidSensorId => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ConfigurePlaybackError {
PlaybackUnavailable,
InvalidConfigType,
ConfigMissingFields,
DuplicateSensorInfo,
NoEventsForSensor,
EventFromUnknownSensor,
EventSensorTypeMismatch,
EventPayloadTypeMismatch,
FileOpenFailed,
FileParseError,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ConfigurePlaybackErrorUnknown {
() => {
_
};
}
impl ConfigurePlaybackError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::PlaybackUnavailable),
2 => Some(Self::InvalidConfigType),
3 => Some(Self::ConfigMissingFields),
4 => Some(Self::DuplicateSensorInfo),
5 => Some(Self::NoEventsForSensor),
6 => Some(Self::EventFromUnknownSensor),
7 => Some(Self::EventSensorTypeMismatch),
8 => Some(Self::EventPayloadTypeMismatch),
9 => Some(Self::FileOpenFailed),
10 => Some(Self::FileParseError),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::PlaybackUnavailable,
2 => Self::InvalidConfigType,
3 => Self::ConfigMissingFields,
4 => Self::DuplicateSensorInfo,
5 => Self::NoEventsForSensor,
6 => Self::EventFromUnknownSensor,
7 => Self::EventSensorTypeMismatch,
8 => Self::EventPayloadTypeMismatch,
9 => Self::FileOpenFailed,
10 => Self::FileParseError,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::PlaybackUnavailable => 1,
Self::InvalidConfigType => 2,
Self::ConfigMissingFields => 3,
Self::DuplicateSensorInfo => 4,
Self::NoEventsForSensor => 5,
Self::EventFromUnknownSensor => 6,
Self::EventSensorTypeMismatch => 7,
Self::EventPayloadTypeMismatch => 8,
Self::FileOpenFailed => 9,
Self::FileParseError => 10,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ConfigureSensorRateError {
DriverUnavailable,
InvalidSensorId,
InvalidConfig,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! ConfigureSensorRateErrorUnknown {
() => {
_
};
}
impl ConfigureSensorRateError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DriverUnavailable),
2 => Some(Self::InvalidSensorId),
3 => Some(Self::InvalidConfig),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::DriverUnavailable,
2 => Self::InvalidSensorId,
3 => Self::InvalidConfig,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::DriverUnavailable => 1,
Self::InvalidSensorId => 2,
Self::InvalidConfig => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum DeactivateSensorError {
DriverUnavailable,
InvalidSensorId,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! DeactivateSensorErrorUnknown {
() => {
_
};
}
impl DeactivateSensorError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DriverUnavailable),
2 => Some(Self::InvalidSensorId),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::DriverUnavailable,
2 => Self::InvalidSensorId,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::DriverUnavailable => 1,
Self::InvalidSensorId => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ManagerActivateRequest {
pub id: i32,
}
impl fidl::Persistable for ManagerActivateRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ManagerConfigurePlaybackRequest {
pub source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
}
impl fidl::Persistable for ManagerConfigurePlaybackRequest {}
#[derive(Debug, PartialEq)]
pub struct ManagerConfigureSensorRatesRequest {
pub id: i32,
pub sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagerConfigureSensorRatesRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ManagerDeactivateRequest {
pub id: i32,
}
impl fidl::Persistable for ManagerDeactivateRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ManagerOnSensorEventRequest {
pub event: fidl_fuchsia_sensors_types::SensorEvent,
}
impl fidl::Persistable for ManagerOnSensorEventRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct ManagerGetSensorsListResponse {
pub sensors: Vec<fidl_fuchsia_sensors_types::SensorInfo>,
}
impl fidl::Persistable for ManagerGetSensorsListResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ManagerMarker;
impl fidl::endpoints::ProtocolMarker for ManagerMarker {
type Proxy = ManagerProxy;
type RequestStream = ManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.sensors.Manager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
pub type ManagerConfigurePlaybackResult = Result<(), ConfigurePlaybackError>;
pub type ManagerConfigureSensorRatesResult = Result<(), ConfigureSensorRateError>;
pub type ManagerActivateResult = Result<(), ActivateSensorError>;
pub type ManagerDeactivateResult = Result<(), DeactivateSensorError>;
pub trait ManagerProxyInterface: Send + Sync {
type ConfigurePlaybackResponseFut: std::future::Future<Output = Result<ManagerConfigurePlaybackResult, fidl::Error>>
+ Send;
fn r#configure_playback(
&self,
source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
) -> Self::ConfigurePlaybackResponseFut;
type GetSensorsListResponseFut: std::future::Future<
Output = Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error>,
> + Send;
fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut;
type ConfigureSensorRatesResponseFut: std::future::Future<Output = Result<ManagerConfigureSensorRatesResult, fidl::Error>>
+ Send;
fn r#configure_sensor_rates(
&self,
id: i32,
sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
) -> Self::ConfigureSensorRatesResponseFut;
type ActivateResponseFut: std::future::Future<Output = Result<ManagerActivateResult, fidl::Error>>
+ Send;
fn r#activate(&self, id: i32) -> Self::ActivateResponseFut;
type DeactivateResponseFut: std::future::Future<Output = Result<ManagerDeactivateResult, fidl::Error>>
+ Send;
fn r#deactivate(&self, id: i32) -> Self::DeactivateResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
type Proxy = ManagerProxy;
type Protocol = ManagerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl ManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ManagerEvent, fidl::Error> {
ManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#configure_playback(
&self,
mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
___deadline: zx::MonotonicInstant,
) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
let _response =
self.client
.send_query::<ManagerConfigurePlaybackRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigurePlaybackError,
>>(
(source_config,),
0x2aec5d56edab43fa,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ManagerMarker>("configure_playback")?;
Ok(_response.map(|x| x))
}
pub fn r#get_sensors_list(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
>(
(),
0x48cf103cfbec3a4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ManagerMarker>("get_sensors_list")?;
Ok(_response.sensors)
}
pub fn r#configure_sensor_rates(
&self,
mut id: i32,
mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
___deadline: zx::MonotonicInstant,
) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
let _response = self
.client
.send_query::<ManagerConfigureSensorRatesRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigureSensorRateError,
>>(
(id, sensor_rate_config),
0x28046f7f3f340652,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ManagerMarker>("configure_sensor_rates")?;
Ok(_response.map(|x| x))
}
pub fn r#activate(
&self,
mut id: i32,
___deadline: zx::MonotonicInstant,
) -> Result<ManagerActivateResult, fidl::Error> {
let _response =
self.client
.send_query::<ManagerActivateRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ActivateSensorError,
>>(
(id,), 0x5678f117cae5ba42, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<ManagerMarker>("activate")?;
Ok(_response.map(|x| x))
}
pub fn r#deactivate(
&self,
mut id: i32,
___deadline: zx::MonotonicInstant,
) -> Result<ManagerDeactivateResult, fidl::Error> {
let _response =
self.client
.send_query::<ManagerDeactivateRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
DeactivateSensorError,
>>(
(id,), 0x7fafbca62982c87, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<ManagerMarker>("deactivate")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ManagerProxy {
type Protocol = ManagerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl ManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ManagerEventStream {
ManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#configure_playback(
&self,
mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
) -> fidl::client::QueryResponseFut<
ManagerConfigurePlaybackResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagerProxyInterface::r#configure_playback(self, source_config)
}
pub fn r#get_sensors_list(
&self,
) -> fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_sensors_types::SensorInfo>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagerProxyInterface::r#get_sensors_list(self)
}
pub fn r#configure_sensor_rates(
&self,
mut id: i32,
mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
) -> fidl::client::QueryResponseFut<
ManagerConfigureSensorRatesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagerProxyInterface::r#configure_sensor_rates(self, id, sensor_rate_config)
}
pub fn r#activate(
&self,
mut id: i32,
) -> fidl::client::QueryResponseFut<
ManagerActivateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagerProxyInterface::r#activate(self, id)
}
pub fn r#deactivate(
&self,
mut id: i32,
) -> fidl::client::QueryResponseFut<
ManagerDeactivateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ManagerProxyInterface::r#deactivate(self, id)
}
}
impl ManagerProxyInterface for ManagerProxy {
type ConfigurePlaybackResponseFut = fidl::client::QueryResponseFut<
ManagerConfigurePlaybackResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#configure_playback(
&self,
mut source_config: &fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
) -> Self::ConfigurePlaybackResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagerConfigurePlaybackResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigurePlaybackError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2aec5d56edab43fa,
>(_buf?)?
.into_result::<ManagerMarker>("configure_playback")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ManagerConfigurePlaybackRequest,
ManagerConfigurePlaybackResult,
>(
(source_config,),
0x2aec5d56edab43fa,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type GetSensorsListResponseFut = fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_sensors_types::SensorInfo>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_sensors_list(&self) -> Self::GetSensorsListResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<fidl_fuchsia_sensors_types::SensorInfo>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x48cf103cfbec3a4a,
>(_buf?)?
.into_result::<ManagerMarker>("get_sensors_list")?;
Ok(_response.sensors)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
Vec<fidl_fuchsia_sensors_types::SensorInfo>,
>(
(),
0x48cf103cfbec3a4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ConfigureSensorRatesResponseFut = fidl::client::QueryResponseFut<
ManagerConfigureSensorRatesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#configure_sensor_rates(
&self,
mut id: i32,
mut sensor_rate_config: &fidl_fuchsia_sensors_types::SensorRateConfig,
) -> Self::ConfigureSensorRatesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagerConfigureSensorRatesResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigureSensorRateError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x28046f7f3f340652,
>(_buf?)?
.into_result::<ManagerMarker>("configure_sensor_rates")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ManagerConfigureSensorRatesRequest,
ManagerConfigureSensorRatesResult,
>(
(id, sensor_rate_config,),
0x28046f7f3f340652,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ActivateResponseFut = fidl::client::QueryResponseFut<
ManagerActivateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#activate(&self, mut id: i32) -> Self::ActivateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagerActivateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ActivateSensorError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5678f117cae5ba42,
>(_buf?)?
.into_result::<ManagerMarker>("activate")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ManagerActivateRequest, ManagerActivateResult>(
(id,),
0x5678f117cae5ba42,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type DeactivateResponseFut = fidl::client::QueryResponseFut<
ManagerDeactivateResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#deactivate(&self, mut id: i32) -> Self::DeactivateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ManagerDeactivateResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
DeactivateSensorError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7fafbca62982c87,
>(_buf?)?
.into_result::<ManagerMarker>("deactivate")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ManagerDeactivateRequest, ManagerDeactivateResult>(
(id,),
0x7fafbca62982c87,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ManagerEventStream {}
impl futures::stream::FusedStream for ManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ManagerEventStream {
type Item = Result<ManagerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ManagerEvent {
OnSensorEvent {
event: fidl_fuchsia_sensors_types::SensorEvent,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ManagerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_sensor_event(self) -> Option<fidl_fuchsia_sensors_types::SensorEvent> {
if let ManagerEvent::OnSensorEvent { event } = self {
Some((event))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
0x6ceb07e11d43e9b => {
let mut out = fidl::new_empty!(
ManagerOnSensorEventRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerOnSensorEventRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ManagerEvent::OnSensorEvent { event: out.event }))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ManagerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ManagerRequestStream {}
impl futures::stream::FusedStream for ManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ManagerRequestStream {
type Protocol = ManagerMarker;
type ControlHandle = ManagerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
ManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ManagerRequestStream {
type Item = Result<ManagerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled ManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2aec5d56edab43fa => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ManagerConfigurePlaybackRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigurePlaybackRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagerControlHandle { inner: this.inner.clone() };
Ok(ManagerRequest::ConfigurePlayback {
source_config: req.source_config,
responder: ManagerConfigurePlaybackResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x48cf103cfbec3a4a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagerControlHandle { inner: this.inner.clone() };
Ok(ManagerRequest::GetSensorsList {
responder: ManagerGetSensorsListResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x28046f7f3f340652 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ManagerConfigureSensorRatesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConfigureSensorRatesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagerControlHandle { inner: this.inner.clone() };
Ok(ManagerRequest::ConfigureSensorRates {
id: req.id,
sensor_rate_config: req.sensor_rate_config,
responder: ManagerConfigureSensorRatesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5678f117cae5ba42 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ManagerActivateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerActivateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagerControlHandle { inner: this.inner.clone() };
Ok(ManagerRequest::Activate {
id: req.id,
responder: ManagerActivateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7fafbca62982c87 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ManagerDeactivateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerDeactivateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ManagerControlHandle { inner: this.inner.clone() };
Ok(ManagerRequest::Deactivate {
id: req.id,
responder: ManagerDeactivateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ManagerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ManagerControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(ManagerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ManagerControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ManagerRequest {
ConfigurePlayback {
source_config: fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
responder: ManagerConfigurePlaybackResponder,
},
GetSensorsList { responder: ManagerGetSensorsListResponder },
ConfigureSensorRates {
id: i32,
sensor_rate_config: fidl_fuchsia_sensors_types::SensorRateConfig,
responder: ManagerConfigureSensorRatesResponder,
},
Activate { id: i32, responder: ManagerActivateResponder },
Deactivate { id: i32, responder: ManagerDeactivateResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ManagerControlHandle,
method_type: fidl::MethodType,
},
}
impl ManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_configure_playback(
self,
) -> Option<(
fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
ManagerConfigurePlaybackResponder,
)> {
if let ManagerRequest::ConfigurePlayback { source_config, responder } = self {
Some((source_config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_sensors_list(self) -> Option<(ManagerGetSensorsListResponder)> {
if let ManagerRequest::GetSensorsList { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_configure_sensor_rates(
self,
) -> Option<(
i32,
fidl_fuchsia_sensors_types::SensorRateConfig,
ManagerConfigureSensorRatesResponder,
)> {
if let ManagerRequest::ConfigureSensorRates { id, sensor_rate_config, responder } = self {
Some((id, sensor_rate_config, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_activate(self) -> Option<(i32, ManagerActivateResponder)> {
if let ManagerRequest::Activate { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_deactivate(self) -> Option<(i32, ManagerDeactivateResponder)> {
if let ManagerRequest::Deactivate { id, responder } = self {
Some((id, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ManagerRequest::ConfigurePlayback { .. } => "configure_playback",
ManagerRequest::GetSensorsList { .. } => "get_sensors_list",
ManagerRequest::ConfigureSensorRates { .. } => "configure_sensor_rates",
ManagerRequest::Activate { .. } => "activate",
ManagerRequest::Deactivate { .. } => "deactivate",
ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ManagerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ManagerControlHandle {
pub fn send_on_sensor_event(
&self,
mut event: &fidl_fuchsia_sensors_types::SensorEvent,
) -> Result<(), fidl::Error> {
self.inner.send::<ManagerOnSensorEventRequest>(
(event,),
0,
0x6ceb07e11d43e9b,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagerConfigurePlaybackResponder {
control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagerConfigurePlaybackResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagerConfigurePlaybackResponder {
type ControlHandle = ManagerControlHandle;
fn control_handle(&self) -> &ManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagerConfigurePlaybackResponder {
pub fn send(self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), ConfigurePlaybackError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ConfigurePlaybackError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigurePlaybackError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2aec5d56edab43fa,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagerGetSensorsListResponder {
control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagerGetSensorsListResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagerGetSensorsListResponder {
type ControlHandle = ManagerControlHandle;
fn control_handle(&self) -> &ManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagerGetSensorsListResponder {
pub fn send(
self,
mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(sensors);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(sensors);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut sensors: &[fidl_fuchsia_sensors_types::SensorInfo],
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<ManagerGetSensorsListResponse>>(
fidl::encoding::Flexible::new((sensors,)),
self.tx_id,
0x48cf103cfbec3a4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagerConfigureSensorRatesResponder {
control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagerConfigureSensorRatesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagerConfigureSensorRatesResponder {
type ControlHandle = ManagerControlHandle;
fn control_handle(&self) -> &ManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagerConfigureSensorRatesResponder {
pub fn send(self, mut result: Result<(), ConfigureSensorRateError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), ConfigureSensorRateError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), ConfigureSensorRateError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ConfigureSensorRateError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x28046f7f3f340652,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagerActivateResponder {
control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagerActivateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagerActivateResponder {
type ControlHandle = ManagerControlHandle;
fn control_handle(&self) -> &ManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagerActivateResponder {
pub fn send(self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), ActivateSensorError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), ActivateSensorError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
ActivateSensorError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5678f117cae5ba42,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ManagerDeactivateResponder {
control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ManagerDeactivateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ManagerDeactivateResponder {
type ControlHandle = ManagerControlHandle;
fn control_handle(&self) -> &ManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ManagerDeactivateResponder {
pub fn send(self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<(), DeactivateSensorError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), DeactivateSensorError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
DeactivateSensorError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x7fafbca62982c87,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ActivateSensorError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ActivateSensorError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ActivateSensorError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ActivateSensorError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConfigurePlaybackError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ConfigurePlaybackError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ConfigurePlaybackError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ConfigurePlaybackError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ConfigureSensorRateError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ConfigureSensorRateError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ConfigureSensorRateError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ConfigureSensorRateError
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DeactivateSensorError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for DeactivateSensorError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for DeactivateSensorError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeactivateSensorError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagerActivateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerActivateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagerActivateRequest, D> for &ManagerActivateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ManagerActivateRequest)
.write_unaligned((self as *const ManagerActivateRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<ManagerActivateRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerActivateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagerActivateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagerConfigurePlaybackRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerConfigurePlaybackRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D>
for &ManagerConfigurePlaybackRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
fidl::encoding::Encode::<ManagerConfigurePlaybackRequest, D>::encode(
(
<fidl_fuchsia_hardware_sensors::PlaybackSourceConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.source_config),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_hardware_sensors::PlaybackSourceConfig, D>,
> fidl::encoding::Encode<ManagerConfigurePlaybackRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerConfigurePlaybackRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagerConfigurePlaybackRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
source_config: fidl::new_empty!(
fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_hardware_sensors::PlaybackSourceConfig,
D,
&mut self.source_config,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ManagerConfigureSensorRatesRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerConfigureSensorRatesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
ManagerConfigureSensorRatesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ManagerConfigureSensorRatesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
fidl::encoding::Encode::<ManagerConfigureSensorRatesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl_fuchsia_sensors_types::SensorRateConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor_rate_config),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl_fuchsia_sensors_types::SensorRateConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ManagerConfigureSensorRatesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerConfigureSensorRatesRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ManagerConfigureSensorRatesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
sensor_rate_config: fidl::new_empty!(
fidl_fuchsia_sensors_types::SensorRateConfig,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
i32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_sensors_types::SensorRateConfig,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.sensor_rate_config,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagerDeactivateRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerDeactivateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagerDeactivateRequest, D> for &ManagerDeactivateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ManagerDeactivateRequest)
.write_unaligned((self as *const ManagerDeactivateRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
fidl::encoding::Encode<ManagerDeactivateRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerDeactivateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagerDeactivateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(i32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagerOnSensorEventRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerOnSensorEventRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for &ManagerOnSensorEventRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
fidl::encoding::Encode::<ManagerOnSensorEventRequest, D>::encode(
(
<fidl_fuchsia_sensors_types::SensorEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_sensors_types::SensorEvent, D>,
> fidl::encoding::Encode<ManagerOnSensorEventRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerOnSensorEventRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagerOnSensorEventRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { event: fidl::new_empty!(fidl_fuchsia_sensors_types::SensorEvent, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_sensors_types::SensorEvent,
D,
&mut self.event,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ManagerGetSensorsListResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ManagerGetSensorsListResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ManagerGetSensorsListResponse, D>
for &ManagerGetSensorsListResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
fidl::encoding::Encode::<ManagerGetSensorsListResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensors),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
D,
>,
> fidl::encoding::Encode<ManagerGetSensorsListResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ManagerGetSensorsListResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ManagerGetSensorsListResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
sensors: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_sensors_types::SensorInfo>,
D,
&mut self.sensors,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}