#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
pub const BT_VENDOR_MAX_COMMAND_BUFFER_LEN: u16 = 16;
pub const MAX_NAME_LENGTH: u32 = 32;
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct BtVendorFeatures: u32 {
const SET_ACL_PRIORITY_COMMAND = 1;
const ANDROID_VENDOR_EXTENSIONS = 2;
}
}
impl BtVendorFeatures {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u32) -> Self {
Self::from_bits_retain(bits)
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u32 {
self.bits() & !Self::all().bits()
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum BtVendorAclDirection {
Source,
Sink,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! BtVendorAclDirectionUnknown {
() => {
_
};
}
impl BtVendorAclDirection {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Source),
2 => Some(Self::Sink),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Source,
2 => Self::Sink,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Source => 1,
Self::Sink => 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 BtVendorAclPriority {
Normal,
High,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! BtVendorAclPriorityUnknown {
() => {
_
};
}
impl BtVendorAclPriority {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Normal),
2 => Some(Self::High),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Normal,
2 => Self::High,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Normal => 1,
Self::High => 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 ScoCodingFormat {
Cvsd,
Msbc,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoCodingFormatUnknown {
() => {
_
};
}
impl ScoCodingFormat {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Cvsd),
2 => Some(Self::Msbc),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Cvsd,
2 => Self::Msbc,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Cvsd => 1,
Self::Msbc => 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 ScoEncoding {
Bits8,
Bits16,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoEncodingUnknown {
() => {
_
};
}
impl ScoEncoding {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Bits8),
2 => Some(Self::Bits16),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Bits8,
2 => Self::Bits16,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Bits8 => 1,
Self::Bits16 => 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 ScoSampleRate {
Khz8,
Khz16,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoSampleRateUnknown {
() => {
_
};
}
impl ScoSampleRate {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Khz8),
2 => Some(Self::Khz16),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Khz8,
2 => Self::Khz16,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Khz8 => 1,
Self::Khz16 => 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)]
pub struct BtVendorSetAclPriorityParams {
pub connection_handle: u16,
pub priority: BtVendorAclPriority,
pub direction: BtVendorAclDirection,
}
impl fidl::Persistable for BtVendorSetAclPriorityParams {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct EmulatorOpenRequest {
pub channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
}
impl fidl::Standalone for EmulatorOpenRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciConfigureScoRequest {
pub coding_format: ScoCodingFormat,
pub encoding: ScoEncoding,
pub sample_rate: ScoSampleRate,
}
impl fidl::Persistable for HciConfigureScoRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenAclDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for HciOpenAclDataChannelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenCommandChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for HciOpenCommandChannelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenIsoDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for HciOpenIsoDataChannelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenScoDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for HciOpenScoDataChannelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenSnoopChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for HciOpenSnoopChannelRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostOpenRequest {
pub channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
}
impl fidl::Standalone for HostOpenRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct VendorEncodeCommandRequest {
pub command: BtVendorCommand,
}
impl fidl::Persistable for VendorEncodeCommandRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorEncodeCommandResponse {
pub encoded: Vec<u8>,
}
impl fidl::Persistable for VendorEncodeCommandResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorGetFeaturesResponse {
pub features: BtVendorFeatures,
}
impl fidl::Persistable for VendorGetFeaturesResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorOpenHciResponse {
pub channel: fidl::endpoints::ClientEnd<HciMarker>,
}
impl fidl::Standalone for VendorOpenHciResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtualControllerCreateLoopbackDeviceRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone for VirtualControllerCreateLoopbackDeviceRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtualControllerCreateEmulatorResponse {
pub name: Option<String>,
}
impl fidl::Persistable for VirtualControllerCreateEmulatorResponse {}
#[derive(Clone, Debug)]
pub enum BtVendorCommand {
SetAclPriority(BtVendorSetAclPriorityParams),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! BtVendorCommandUnknown {
() => {
_
};
}
impl PartialEq for BtVendorCommand {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::SetAclPriority(x), Self::SetAclPriority(y)) => *x == *y,
_ => false,
}
}
}
impl BtVendorCommand {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::SetAclPriority(_) => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for BtVendorCommand {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EmulatorMarker;
impl fidl::endpoints::ProtocolMarker for EmulatorMarker {
type Proxy = EmulatorProxy;
type RequestStream = EmulatorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EmulatorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Emulator";
}
pub trait EmulatorProxyInterface: Send + Sync {
fn r#open(
&self,
channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EmulatorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EmulatorSynchronousProxy {
type Proxy = EmulatorProxy;
type Protocol = EmulatorMarker;
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 EmulatorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EmulatorMarker 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::Time) -> Result<EmulatorEvent, fidl::Error> {
EmulatorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EmulatorOpenRequest>(
(channel,),
0x70abbfc03a23d1c0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct EmulatorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for EmulatorProxy {
type Protocol = EmulatorMarker;
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 EmulatorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EmulatorEventStream {
EmulatorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
) -> Result<(), fidl::Error> {
EmulatorProxyInterface::r#open(self, channel)
}
}
impl EmulatorProxyInterface for EmulatorProxy {
fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<EmulatorOpenRequest>(
(channel,),
0x70abbfc03a23d1c0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct EmulatorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for EmulatorEventStream {}
impl futures::stream::FusedStream for EmulatorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EmulatorEventStream {
type Item = Result<EmulatorEvent, 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(EmulatorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EmulatorEvent {}
impl EmulatorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<EmulatorEvent, 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EmulatorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for EmulatorRequestStream {}
impl futures::stream::FusedStream for EmulatorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EmulatorRequestStream {
type Protocol = EmulatorMarker;
type ControlHandle = EmulatorControlHandle;
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 {
EmulatorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for EmulatorRequestStream {
type Item = Result<EmulatorRequest, 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 EmulatorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x70abbfc03a23d1c0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(EmulatorOpenRequest);
fidl::encoding::Decoder::decode_into::<EmulatorOpenRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::Open { channel: req.channel, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum EmulatorRequest {
Open {
channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
control_handle: EmulatorControlHandle,
},
}
impl EmulatorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_open(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
EmulatorControlHandle,
)> {
if let EmulatorRequest::Open { channel, control_handle } = self {
Some((channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EmulatorRequest::Open { .. } => "open",
}
}
}
#[derive(Debug, Clone)]
pub struct EmulatorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for EmulatorControlHandle {
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()
}
}
impl EmulatorControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HciMarker;
impl fidl::endpoints::ProtocolMarker for HciMarker {
type Proxy = HciProxy;
type RequestStream = HciRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HciSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Hci";
}
pub type HciOpenCommandChannelResult = Result<(), i32>;
pub type HciOpenAclDataChannelResult = Result<(), i32>;
pub type HciOpenScoDataChannelResult = Result<(), i32>;
pub type HciConfigureScoResult = Result<(), i32>;
pub type HciResetScoResult = Result<(), i32>;
pub type HciOpenIsoDataChannelResult = Result<(), i32>;
pub type HciOpenSnoopChannelResult = Result<(), i32>;
pub trait HciProxyInterface: Send + Sync {
type OpenCommandChannelResponseFut: std::future::Future<Output = Result<HciOpenCommandChannelResult, fidl::Error>>
+ Send;
fn r#open_command_channel(&self, channel: fidl::Channel)
-> Self::OpenCommandChannelResponseFut;
type OpenAclDataChannelResponseFut: std::future::Future<Output = Result<HciOpenAclDataChannelResult, fidl::Error>>
+ Send;
fn r#open_acl_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenAclDataChannelResponseFut;
type OpenScoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenScoDataChannelResult, fidl::Error>>
+ Send;
fn r#open_sco_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenScoDataChannelResponseFut;
type ConfigureScoResponseFut: std::future::Future<Output = Result<HciConfigureScoResult, fidl::Error>>
+ Send;
fn r#configure_sco(
&self,
coding_format: ScoCodingFormat,
encoding: ScoEncoding,
sample_rate: ScoSampleRate,
) -> Self::ConfigureScoResponseFut;
type ResetScoResponseFut: std::future::Future<Output = Result<HciResetScoResult, fidl::Error>>
+ Send;
fn r#reset_sco(&self) -> Self::ResetScoResponseFut;
type OpenIsoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenIsoDataChannelResult, fidl::Error>>
+ Send;
fn r#open_iso_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenIsoDataChannelResponseFut;
type OpenSnoopChannelResponseFut: std::future::Future<Output = Result<HciOpenSnoopChannelResult, fidl::Error>>
+ Send;
fn r#open_snoop_channel(&self, channel: fidl::Channel) -> Self::OpenSnoopChannelResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HciSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HciSynchronousProxy {
type Proxy = HciProxy;
type Protocol = HciMarker;
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 HciSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HciMarker 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::Time) -> Result<HciEvent, fidl::Error> {
HciEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::Time,
) -> Result<HciOpenCommandChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenCommandChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_command_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::Time,
) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenAclDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_acl_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::Time,
) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenScoDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_sco_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
___deadline: zx::Time,
) -> Result<HciConfigureScoResult, fidl::Error> {
let _response = self.client.send_query::<
HciConfigureScoRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(coding_format, encoding, sample_rate,),
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("configure_sco")?;
Ok(_response.map(|x| x))
}
pub fn r#reset_sco(&self, ___deadline: zx::Time) -> Result<HciResetScoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("reset_sco")?;
Ok(_response.map(|x| x))
}
pub fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::Time,
) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenIsoDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_iso_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::Time,
) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenSnoopChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_snoop_channel")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct HciProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for HciProxy {
type Protocol = HciMarker;
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 HciProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HciEventStream {
HciEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<HciOpenCommandChannelResult> {
HciProxyInterface::r#open_command_channel(self, channel)
}
pub fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<HciOpenAclDataChannelResult> {
HciProxyInterface::r#open_acl_data_channel(self, channel)
}
pub fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<HciOpenScoDataChannelResult> {
HciProxyInterface::r#open_sco_data_channel(self, channel)
}
pub fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
) -> fidl::client::QueryResponseFut<HciConfigureScoResult> {
HciProxyInterface::r#configure_sco(self, coding_format, encoding, sample_rate)
}
pub fn r#reset_sco(&self) -> fidl::client::QueryResponseFut<HciResetScoResult> {
HciProxyInterface::r#reset_sco(self)
}
pub fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<HciOpenIsoDataChannelResult> {
HciProxyInterface::r#open_iso_data_channel(self, channel)
}
pub fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<HciOpenSnoopChannelResult> {
HciProxyInterface::r#open_snoop_channel(self, channel)
}
}
impl HciProxyInterface for HciProxy {
type OpenCommandChannelResponseFut =
fidl::client::QueryResponseFut<HciOpenCommandChannelResult>;
fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenCommandChannelResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenCommandChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x2510b52ea3a51ce0,
>(_buf?)?
.into_result::<HciMarker>("open_command_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenCommandChannelRequest, HciOpenCommandChannelResult>(
(channel,),
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenAclDataChannelResponseFut =
fidl::client::QueryResponseFut<HciOpenAclDataChannelResult>;
fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenAclDataChannelResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x210c3dd69156385a,
>(_buf?)?
.into_result::<HciMarker>("open_acl_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenAclDataChannelRequest, HciOpenAclDataChannelResult>(
(channel,),
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenScoDataChannelResponseFut =
fidl::client::QueryResponseFut<HciOpenScoDataChannelResult>;
fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenScoDataChannelResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x5bcb0bf2cbf35bdf,
>(_buf?)?
.into_result::<HciMarker>("open_sco_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenScoDataChannelRequest, HciOpenScoDataChannelResult>(
(channel,),
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ConfigureScoResponseFut = fidl::client::QueryResponseFut<HciConfigureScoResult>;
fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
) -> Self::ConfigureScoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciConfigureScoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x499ec7edfd65fad7,
>(_buf?)?
.into_result::<HciMarker>("configure_sco")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HciConfigureScoRequest, HciConfigureScoResult>(
(coding_format, encoding, sample_rate),
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ResetScoResponseFut = fidl::client::QueryResponseFut<HciResetScoResult>;
fn r#reset_sco(&self) -> Self::ResetScoResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciResetScoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x6ee56dcb2ce23fcb,
>(_buf?)?
.into_result::<HciMarker>("reset_sco")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HciResetScoResult>(
(),
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenIsoDataChannelResponseFut =
fidl::client::QueryResponseFut<HciOpenIsoDataChannelResult>;
fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenIsoDataChannelResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0x9adfa1d466cefd4,
>(_buf?)?
.into_result::<HciMarker>("open_iso_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenIsoDataChannelRequest, HciOpenIsoDataChannelResult>(
(channel,),
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenSnoopChannelResponseFut = fidl::client::QueryResponseFut<HciOpenSnoopChannelResult>;
fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenSnoopChannelResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
0xd31c6d5cbc4e136,
>(_buf?)?
.into_result::<HciMarker>("open_snoop_channel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HciOpenSnoopChannelRequest, HciOpenSnoopChannelResult>(
(channel,),
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct HciEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for HciEventStream {}
impl futures::stream::FusedStream for HciEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HciEventStream {
type Item = Result<HciEvent, 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(HciEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HciEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl HciEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<HciEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(HciEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HciRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for HciRequestStream {}
impl futures::stream::FusedStream for HciRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HciRequestStream {
type Protocol = HciMarker;
type ControlHandle = HciControlHandle;
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 {
HciControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HciRequestStream {
type Item = Result<HciRequest, 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 HciRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2510b52ea3a51ce0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciOpenCommandChannelRequest);
fidl::encoding::Decoder::decode_into::<HciOpenCommandChannelRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenCommandChannel {
channel: req.channel,
responder: HciOpenCommandChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x210c3dd69156385a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciOpenAclDataChannelRequest);
fidl::encoding::Decoder::decode_into::<HciOpenAclDataChannelRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenAclDataChannel {
channel: req.channel,
responder: HciOpenAclDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5bcb0bf2cbf35bdf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciOpenScoDataChannelRequest);
fidl::encoding::Decoder::decode_into::<HciOpenScoDataChannelRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenScoDataChannel {
channel: req.channel,
responder: HciOpenScoDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x499ec7edfd65fad7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciConfigureScoRequest);
fidl::encoding::Decoder::decode_into::<HciConfigureScoRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::ConfigureSco {
coding_format: req.coding_format,
encoding: req.encoding,
sample_rate: req.sample_rate,
responder: HciConfigureScoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6ee56dcb2ce23fcb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::ResetSco {
responder: HciResetScoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x9adfa1d466cefd4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciOpenIsoDataChannelRequest);
fidl::encoding::Decoder::decode_into::<HciOpenIsoDataChannelRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenIsoDataChannel {
channel: req.channel,
responder: HciOpenIsoDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xd31c6d5cbc4e136 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(HciOpenSnoopChannelRequest);
fidl::encoding::Decoder::decode_into::<HciOpenSnoopChannelRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenSnoopChannel {
channel: req.channel,
responder: HciOpenSnoopChannelResponder {
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(HciRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciControlHandle { 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(HciRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum HciRequest {
OpenCommandChannel { channel: fidl::Channel, responder: HciOpenCommandChannelResponder },
OpenAclDataChannel { channel: fidl::Channel, responder: HciOpenAclDataChannelResponder },
OpenScoDataChannel { channel: fidl::Channel, responder: HciOpenScoDataChannelResponder },
ConfigureSco {
coding_format: ScoCodingFormat,
encoding: ScoEncoding,
sample_rate: ScoSampleRate,
responder: HciConfigureScoResponder,
},
ResetSco { responder: HciResetScoResponder },
OpenIsoDataChannel { channel: fidl::Channel, responder: HciOpenIsoDataChannelResponder },
OpenSnoopChannel { channel: fidl::Channel, responder: HciOpenSnoopChannelResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: HciControlHandle,
method_type: fidl::MethodType,
},
}
impl HciRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_open_command_channel(
self,
) -> Option<(fidl::Channel, HciOpenCommandChannelResponder)> {
if let HciRequest::OpenCommandChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_acl_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenAclDataChannelResponder)> {
if let HciRequest::OpenAclDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_sco_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenScoDataChannelResponder)> {
if let HciRequest::OpenScoDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_configure_sco(
self,
) -> Option<(ScoCodingFormat, ScoEncoding, ScoSampleRate, HciConfigureScoResponder)> {
if let HciRequest::ConfigureSco { coding_format, encoding, sample_rate, responder } = self {
Some((coding_format, encoding, sample_rate, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_sco(self) -> Option<(HciResetScoResponder)> {
if let HciRequest::ResetSco { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_iso_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenIsoDataChannelResponder)> {
if let HciRequest::OpenIsoDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_snoop_channel(self) -> Option<(fidl::Channel, HciOpenSnoopChannelResponder)> {
if let HciRequest::OpenSnoopChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HciRequest::OpenCommandChannel { .. } => "open_command_channel",
HciRequest::OpenAclDataChannel { .. } => "open_acl_data_channel",
HciRequest::OpenScoDataChannel { .. } => "open_sco_data_channel",
HciRequest::ConfigureSco { .. } => "configure_sco",
HciRequest::ResetSco { .. } => "reset_sco",
HciRequest::OpenIsoDataChannel { .. } => "open_iso_data_channel",
HciRequest::OpenSnoopChannel { .. } => "open_snoop_channel",
HciRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
HciRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct HciControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for HciControlHandle {
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()
}
}
impl HciControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenCommandChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenCommandChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenCommandChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenCommandChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenAclDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenAclDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenAclDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenAclDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenScoDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenScoDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenScoDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenScoDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciConfigureScoResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciConfigureScoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciConfigureScoResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciConfigureScoResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciResetScoResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciResetScoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciResetScoResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciResetScoResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenIsoDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenIsoDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenIsoDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenIsoDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenSnoopChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenSnoopChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenSnoopChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenSnoopChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HostMarker;
impl fidl::endpoints::ProtocolMarker for HostMarker {
type Proxy = HostProxy;
type RequestStream = HostRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HostSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Host";
}
pub trait HostProxyInterface: Send + Sync {
fn r#open(
&self,
channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HostSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HostSynchronousProxy {
type Proxy = HostProxy;
type Protocol = HostMarker;
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 HostSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HostMarker 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::Time) -> Result<HostEvent, fidl::Error> {
HostEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostOpenRequest>(
(channel,),
0x2b3a80b39fa39d81,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct HostProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for HostProxy {
type Protocol = HostMarker;
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 HostProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HostEventStream {
HostEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#open(self, channel)
}
}
impl HostProxyInterface for HostProxy {
fn r#open(
&self,
mut channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostOpenRequest>(
(channel,),
0x2b3a80b39fa39d81,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct HostEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for HostEventStream {}
impl futures::stream::FusedStream for HostEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HostEventStream {
type Item = Result<HostEvent, 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(HostEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HostEvent {}
impl HostEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<HostEvent, 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HostRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for HostRequestStream {}
impl futures::stream::FusedStream for HostRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HostRequestStream {
type Protocol = HostMarker;
type ControlHandle = HostControlHandle;
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 {
HostControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for HostRequestStream {
type Item = Result<HostRequest, 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 HostRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2b3a80b39fa39d81 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(HostOpenRequest);
fidl::encoding::Decoder::decode_into::<HostOpenRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Open { channel: req.channel, control_handle })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum HostRequest {
Open {
channel: fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
control_handle: HostControlHandle,
},
}
impl HostRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_open(
self,
) -> Option<(
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
HostControlHandle,
)> {
if let HostRequest::Open { channel, control_handle } = self {
Some((channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostRequest::Open { .. } => "open",
}
}
}
#[derive(Debug, Clone)]
pub struct HostControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for HostControlHandle {
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()
}
}
impl HostControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VendorMarker;
impl fidl::endpoints::ProtocolMarker for VendorMarker {
type Proxy = VendorProxy;
type RequestStream = VendorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VendorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Vendor";
}
pub type VendorEncodeCommandResult = Result<Vec<u8>, i32>;
pub type VendorOpenHciResult = Result<fidl::endpoints::ClientEnd<HciMarker>, i32>;
pub trait VendorProxyInterface: Send + Sync {
type GetFeaturesResponseFut: std::future::Future<Output = Result<BtVendorFeatures, fidl::Error>>
+ Send;
fn r#get_features(&self) -> Self::GetFeaturesResponseFut;
type EncodeCommandResponseFut: std::future::Future<Output = Result<VendorEncodeCommandResult, fidl::Error>>
+ Send;
fn r#encode_command(&self, command: &BtVendorCommand) -> Self::EncodeCommandResponseFut;
type OpenHciResponseFut: std::future::Future<Output = Result<VendorOpenHciResult, fidl::Error>>
+ Send;
fn r#open_hci(&self) -> Self::OpenHciResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VendorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VendorSynchronousProxy {
type Proxy = VendorProxy;
type Protocol = VendorMarker;
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 VendorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VendorMarker 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::Time) -> Result<VendorEvent, fidl::Error> {
VendorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_features(&self, ___deadline: zx::Time) -> Result<BtVendorFeatures, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<VendorGetFeaturesResponse>,
>(
(),
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("get_features")?;
Ok(_response.features)
}
pub fn r#encode_command(
&self,
mut command: &BtVendorCommand,
___deadline: zx::Time,
) -> Result<VendorEncodeCommandResult, fidl::Error> {
let _response = self.client.send_query::<
VendorEncodeCommandRequest,
fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
>(
(command,),
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("encode_command")?;
Ok(_response.map(|x| x.encoded))
}
pub fn r#open_hci(&self, ___deadline: zx::Time) -> Result<VendorOpenHciResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
>(
(),
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("open_hci")?;
Ok(_response.map(|x| x.channel))
}
}
#[derive(Debug, Clone)]
pub struct VendorProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for VendorProxy {
type Protocol = VendorMarker;
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 VendorProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VendorEventStream {
VendorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_features(&self) -> fidl::client::QueryResponseFut<BtVendorFeatures> {
VendorProxyInterface::r#get_features(self)
}
pub fn r#encode_command(
&self,
mut command: &BtVendorCommand,
) -> fidl::client::QueryResponseFut<VendorEncodeCommandResult> {
VendorProxyInterface::r#encode_command(self, command)
}
pub fn r#open_hci(&self) -> fidl::client::QueryResponseFut<VendorOpenHciResult> {
VendorProxyInterface::r#open_hci(self)
}
}
impl VendorProxyInterface for VendorProxy {
type GetFeaturesResponseFut = fidl::client::QueryResponseFut<BtVendorFeatures>;
fn r#get_features(&self) -> Self::GetFeaturesResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BtVendorFeatures, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<VendorGetFeaturesResponse>,
0x102e70164c1dc911,
>(_buf?)?
.into_result::<VendorMarker>("get_features")?;
Ok(_response.features)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BtVendorFeatures>(
(),
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type EncodeCommandResponseFut = fidl::client::QueryResponseFut<VendorEncodeCommandResult>;
fn r#encode_command(&self, mut command: &BtVendorCommand) -> Self::EncodeCommandResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VendorEncodeCommandResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
0x75430542c197cbe8,
>(_buf?)?
.into_result::<VendorMarker>("encode_command")?;
Ok(_response.map(|x| x.encoded))
}
self.client.send_query_and_decode::<VendorEncodeCommandRequest, VendorEncodeCommandResult>(
(command,),
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenHciResponseFut = fidl::client::QueryResponseFut<VendorOpenHciResult>;
fn r#open_hci(&self) -> Self::OpenHciResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VendorOpenHciResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
0x7f05862f7ef92ec8,
>(_buf?)?
.into_result::<VendorMarker>("open_hci")?;
Ok(_response.map(|x| x.channel))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenHciResult>(
(),
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct VendorEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for VendorEventStream {}
impl futures::stream::FusedStream for VendorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VendorEventStream {
type Item = Result<VendorEvent, 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(VendorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VendorEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl VendorEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<VendorEvent, 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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(VendorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VendorRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for VendorRequestStream {}
impl futures::stream::FusedStream for VendorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VendorRequestStream {
type Protocol = VendorMarker;
type ControlHandle = VendorControlHandle;
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 {
VendorControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for VendorRequestStream {
type Item = Result<VendorRequest, 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 VendorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x102e70164c1dc911 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::GetFeatures {
responder: VendorGetFeaturesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75430542c197cbe8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(VendorEncodeCommandRequest);
fidl::encoding::Decoder::decode_into::<VendorEncodeCommandRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::EncodeCommand {
command: req.command,
responder: VendorEncodeCommandResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7f05862f7ef92ec8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::OpenHci {
responder: VendorOpenHciResponder {
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(VendorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VendorControlHandle { 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(VendorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VendorControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum VendorRequest {
GetFeatures { responder: VendorGetFeaturesResponder },
EncodeCommand { command: BtVendorCommand, responder: VendorEncodeCommandResponder },
OpenHci { responder: VendorOpenHciResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: VendorControlHandle,
method_type: fidl::MethodType,
},
}
impl VendorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_features(self) -> Option<(VendorGetFeaturesResponder)> {
if let VendorRequest::GetFeatures { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_encode_command(self) -> Option<(BtVendorCommand, VendorEncodeCommandResponder)> {
if let VendorRequest::EncodeCommand { command, responder } = self {
Some((command, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_hci(self) -> Option<(VendorOpenHciResponder)> {
if let VendorRequest::OpenHci { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VendorRequest::GetFeatures { .. } => "get_features",
VendorRequest::EncodeCommand { .. } => "encode_command",
VendorRequest::OpenHci { .. } => "open_hci",
VendorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
VendorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct VendorControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for VendorControlHandle {
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()
}
}
impl VendorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorGetFeaturesResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorGetFeaturesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorGetFeaturesResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorGetFeaturesResponder {
pub fn send(self, mut features: BtVendorFeatures) -> Result<(), fidl::Error> {
let _result = self.send_raw(features);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut features: BtVendorFeatures,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(features);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut features: BtVendorFeatures) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<VendorGetFeaturesResponse>>(
fidl::encoding::Flexible::new((features,)),
self.tx_id,
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorEncodeCommandResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorEncodeCommandResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorEncodeCommandResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorEncodeCommandResponder {
pub fn send(self, mut result: Result<&[u8], i32>) -> 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<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
VendorEncodeCommandResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.map(|encoded| (encoded,))),
self.tx_id,
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorOpenHciResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorOpenHciResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorOpenHciResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorOpenHciResponder {
pub fn send(
self,
mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> 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<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>>(
fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
self.tx_id,
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtualControllerMarker;
impl fidl::endpoints::ProtocolMarker for VirtualControllerMarker {
type Proxy = VirtualControllerProxy;
type RequestStream = VirtualControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtualControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) VirtualController";
}
pub type VirtualControllerCreateEmulatorResult = Result<Option<String>, i32>;
pub trait VirtualControllerProxyInterface: Send + Sync {
type CreateEmulatorResponseFut: std::future::Future<Output = Result<VirtualControllerCreateEmulatorResult, fidl::Error>>
+ Send;
fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut;
fn r#create_loopback_device(&self, channel: fidl::Channel) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtualControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtualControllerSynchronousProxy {
type Proxy = VirtualControllerProxy;
type Protocol = VirtualControllerMarker;
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 VirtualControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<VirtualControllerMarker 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::Time,
) -> Result<VirtualControllerEvent, fidl::Error> {
VirtualControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_emulator(
&self,
___deadline: zx::Time,
) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<VirtualControllerCreateEmulatorResponse, i32>,
>(
(),
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.name))
}
pub fn r#create_loopback_device(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
(channel,),
0x7525af8edecb6c0c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct VirtualControllerProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for VirtualControllerProxy {
type Protocol = VirtualControllerMarker;
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 VirtualControllerProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtualControllerEventStream {
VirtualControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_emulator(
&self,
) -> fidl::client::QueryResponseFut<VirtualControllerCreateEmulatorResult> {
VirtualControllerProxyInterface::r#create_emulator(self)
}
pub fn r#create_loopback_device(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
VirtualControllerProxyInterface::r#create_loopback_device(self, channel)
}
}
impl VirtualControllerProxyInterface for VirtualControllerProxy {
type CreateEmulatorResponseFut =
fidl::client::QueryResponseFut<VirtualControllerCreateEmulatorResult>;
fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<VirtualControllerCreateEmulatorResponse, i32>,
0x130273fc0a35cedb,
>(_buf?)?;
Ok(_response.map(|x| x.name))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
VirtualControllerCreateEmulatorResult,
>(
(),
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#create_loopback_device(&self, mut channel: fidl::Channel) -> Result<(), fidl::Error> {
self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
(channel,),
0x7525af8edecb6c0c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct VirtualControllerEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for VirtualControllerEventStream {}
impl futures::stream::FusedStream for VirtualControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtualControllerEventStream {
type Item = Result<VirtualControllerEvent, 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(VirtualControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtualControllerEvent {}
impl VirtualControllerEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<VirtualControllerEvent, 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 {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtualControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtualControllerRequestStream {}
impl futures::stream::FusedStream for VirtualControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtualControllerRequestStream {
type Protocol = VirtualControllerMarker;
type ControlHandle = VirtualControllerControlHandle;
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 {
VirtualControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for VirtualControllerRequestStream {
type Item = Result<VirtualControllerRequest, 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 VirtualControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x130273fc0a35cedb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
VirtualControllerControlHandle { inner: this.inner.clone() };
Ok(VirtualControllerRequest::CreateEmulator {
responder: VirtualControllerCreateEmulatorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7525af8edecb6c0c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(VirtualControllerCreateLoopbackDeviceRequest);
fidl::encoding::Decoder::decode_into::<
VirtualControllerCreateLoopbackDeviceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtualControllerControlHandle { inner: this.inner.clone() };
Ok(VirtualControllerRequest::CreateLoopbackDevice {
channel: req.channel,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum VirtualControllerRequest {
CreateEmulator { responder: VirtualControllerCreateEmulatorResponder },
CreateLoopbackDevice { channel: fidl::Channel, control_handle: VirtualControllerControlHandle },
}
impl VirtualControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_emulator(self) -> Option<(VirtualControllerCreateEmulatorResponder)> {
if let VirtualControllerRequest::CreateEmulator { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_loopback_device(
self,
) -> Option<(fidl::Channel, VirtualControllerControlHandle)> {
if let VirtualControllerRequest::CreateLoopbackDevice { channel, control_handle } = self {
Some((channel, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtualControllerRequest::CreateEmulator { .. } => "create_emulator",
VirtualControllerRequest::CreateLoopbackDevice { .. } => "create_loopback_device",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtualControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for VirtualControllerControlHandle {
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()
}
}
impl VirtualControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtualControllerCreateEmulatorResponder {
control_handle: std::mem::ManuallyDrop<VirtualControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtualControllerCreateEmulatorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtualControllerCreateEmulatorResponder {
type ControlHandle = VirtualControllerControlHandle;
fn control_handle(&self) -> &VirtualControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtualControllerCreateEmulatorResponder {
pub fn send(self, mut result: Result<Option<&str>, i32>) -> 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<Option<&str>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
VirtualControllerCreateEmulatorResponse,
i32,
>>(
result.map(|name| (name,)),
self.tx_id,
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HciServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for HciServiceMarker {
type Proxy = HciServiceProxy;
type Request = HciServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.hardware.bluetooth.HciService";
}
#[cfg(target_os = "fuchsia")]
pub enum HciServiceRequest {
Hci(HciRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for HciServiceRequest {
type Service = HciServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"hci" => Self::Hci(<HciRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
)),
_ => panic!("no such member protocol name for service HciService"),
}
}
fn member_names() -> &'static [&'static str] {
&["hci"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct HciServiceProxy(Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for HciServiceProxy {
type Service = HciServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl HciServiceProxy {
pub fn connect_to_hci(&self) -> Result<HciProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<HciMarker>()?;
self.connect_channel_to_hci(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_hci(
&self,
server_end: fidl::endpoints::ServerEnd<HciMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("hci", server_end.into_channel())
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for BtVendorFeatures {
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
}
}
impl fidl::encoding::ValueTypeMarker for BtVendorFeatures {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for BtVendorFeatures {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BtVendorFeatures {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BtVendorAclDirection {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for BtVendorAclDirection {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for BtVendorAclDirection {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BtVendorAclDirection {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BtVendorAclPriority {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for BtVendorAclPriority {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for BtVendorAclPriority {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BtVendorAclPriority {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoCodingFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoCodingFormat {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ScoCodingFormat {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoCodingFormat {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoEncoding {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoEncoding {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ScoEncoding {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoEncoding {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoSampleRate {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoSampleRate {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for ScoSampleRate {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ScoSampleRate {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BtVendorSetAclPriorityParams {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ValueTypeMarker for BtVendorSetAclPriorityParams {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BtVendorSetAclPriorityParams> for &BtVendorSetAclPriorityParams {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BtVendorSetAclPriorityParams>(offset);
fidl::encoding::Encode::<BtVendorSetAclPriorityParams>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.connection_handle),
<BtVendorAclPriority as fidl::encoding::ValueTypeMarker>::borrow(
&self.priority,
),
<BtVendorAclDirection as fidl::encoding::ValueTypeMarker>::borrow(
&self.direction,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u16>,
T1: fidl::encoding::Encode<BtVendorAclPriority>,
T2: fidl::encoding::Encode<BtVendorAclDirection>,
> fidl::encoding::Encode<BtVendorSetAclPriorityParams> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BtVendorSetAclPriorityParams>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 3, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BtVendorSetAclPriorityParams {
#[inline(always)]
fn new_empty() -> Self {
Self {
connection_handle: fidl::new_empty!(u16),
priority: fidl::new_empty!(BtVendorAclPriority),
direction: fidl::new_empty!(BtVendorAclDirection),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u16, &mut self.connection_handle, decoder, offset + 0, _depth)?;
fidl::decode!(BtVendorAclPriority, &mut self.priority, decoder, offset + 2, _depth)?;
fidl::decode!(BtVendorAclDirection, &mut self.direction, decoder, offset + 3, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for EmulatorOpenRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for EmulatorOpenRequest {
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::Encode<EmulatorOpenRequest> for &mut EmulatorOpenRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EmulatorOpenRequest>(offset);
fidl::encoding::Encode::<EmulatorOpenRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
>,
>,
> fidl::encoding::Encode<EmulatorOpenRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EmulatorOpenRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for EmulatorOpenRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_test::HciEmulatorMarker>,
>,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciConfigureScoRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
3
}
}
impl fidl::encoding::ValueTypeMarker for HciConfigureScoRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<HciConfigureScoRequest> for &HciConfigureScoRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciConfigureScoRequest>(offset);
fidl::encoding::Encode::<HciConfigureScoRequest>::encode(
(
<ScoCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(
&self.coding_format,
),
<ScoEncoding as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding),
<ScoSampleRate as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_rate),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<ScoCodingFormat>,
T1: fidl::encoding::Encode<ScoEncoding>,
T2: fidl::encoding::Encode<ScoSampleRate>,
> fidl::encoding::Encode<HciConfigureScoRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciConfigureScoRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciConfigureScoRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
coding_format: fidl::new_empty!(ScoCodingFormat),
encoding: fidl::new_empty!(ScoEncoding),
sample_rate: fidl::new_empty!(ScoSampleRate),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ScoCodingFormat, &mut self.coding_format, decoder, offset + 0, _depth)?;
fidl::decode!(ScoEncoding, &mut self.encoding, decoder, offset + 1, _depth)?;
fidl::decode!(ScoSampleRate, &mut self.sample_rate, decoder, offset + 2, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenAclDataChannelRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenAclDataChannelRequest {
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::Encode<HciOpenAclDataChannelRequest>
for &mut HciOpenAclDataChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenAclDataChannelRequest>(offset);
fidl::encoding::Encode::<HciOpenAclDataChannelRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HciOpenAclDataChannelRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenAclDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciOpenAclDataChannelRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenCommandChannelRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenCommandChannelRequest {
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::Encode<HciOpenCommandChannelRequest>
for &mut HciOpenCommandChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenCommandChannelRequest>(offset);
fidl::encoding::Encode::<HciOpenCommandChannelRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HciOpenCommandChannelRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenCommandChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciOpenCommandChannelRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenIsoDataChannelRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenIsoDataChannelRequest {
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::Encode<HciOpenIsoDataChannelRequest>
for &mut HciOpenIsoDataChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenIsoDataChannelRequest>(offset);
fidl::encoding::Encode::<HciOpenIsoDataChannelRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HciOpenIsoDataChannelRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenIsoDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciOpenIsoDataChannelRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenScoDataChannelRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenScoDataChannelRequest {
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::Encode<HciOpenScoDataChannelRequest>
for &mut HciOpenScoDataChannelRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenScoDataChannelRequest>(offset);
fidl::encoding::Encode::<HciOpenScoDataChannelRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HciOpenScoDataChannelRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenScoDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciOpenScoDataChannelRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenSnoopChannelRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenSnoopChannelRequest {
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::Encode<HciOpenSnoopChannelRequest> for &mut HciOpenSnoopChannelRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenSnoopChannelRequest>(offset);
fidl::encoding::Encode::<HciOpenSnoopChannelRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<HciOpenSnoopChannelRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciOpenSnoopChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HciOpenSnoopChannelRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HostOpenRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for HostOpenRequest {
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::Encode<HostOpenRequest> for &mut HostOpenRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostOpenRequest>(offset);
fidl::encoding::Encode::<HostOpenRequest>::encode(
(<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
>,
>,
> fidl::encoding::Encode<HostOpenRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostOpenRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for HostOpenRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_host::HostMarker>,
>,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VendorEncodeCommandRequest {
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
}
}
impl fidl::encoding::ValueTypeMarker for VendorEncodeCommandRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<VendorEncodeCommandRequest> for &VendorEncodeCommandRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorEncodeCommandRequest>(offset);
fidl::encoding::Encode::<VendorEncodeCommandRequest>::encode(
(<BtVendorCommand as fidl::encoding::ValueTypeMarker>::borrow(&self.command),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<BtVendorCommand>>
fidl::encoding::Encode<VendorEncodeCommandRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorEncodeCommandRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VendorEncodeCommandRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { command: fidl::new_empty!(BtVendorCommand) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(BtVendorCommand, &mut self.command, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VendorEncodeCommandResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for VendorEncodeCommandResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<VendorEncodeCommandResponse> for &VendorEncodeCommandResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorEncodeCommandResponse>(offset);
fidl::encoding::Encode::<VendorEncodeCommandResponse>::encode(
(<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(
&self.encoded,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 16>>>
fidl::encoding::Encode<VendorEncodeCommandResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorEncodeCommandResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VendorEncodeCommandResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { encoded: fidl::new_empty!(fidl::encoding::Vector<u8, 16>) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 16>, &mut self.encoded, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VendorGetFeaturesResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for VendorGetFeaturesResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<VendorGetFeaturesResponse> for &VendorGetFeaturesResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorGetFeaturesResponse>(offset);
fidl::encoding::Encode::<VendorGetFeaturesResponse>::encode(
(<BtVendorFeatures as fidl::encoding::ValueTypeMarker>::borrow(&self.features),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<BtVendorFeatures>>
fidl::encoding::Encode<VendorGetFeaturesResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorGetFeaturesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VendorGetFeaturesResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { features: fidl::new_empty!(BtVendorFeatures) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(BtVendorFeatures, &mut self.features, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VendorOpenHciResponse {
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
}
}
impl fidl::encoding::ResourceTypeMarker for VendorOpenHciResponse {
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::Encode<VendorOpenHciResponse> for &mut VendorOpenHciResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorOpenHciResponse>(offset);
fidl::encoding::Encode::<VendorOpenHciResponse>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>>,
> fidl::encoding::Encode<VendorOpenHciResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorOpenHciResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VendorOpenHciResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
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::Encode<VirtualControllerCreateLoopbackDeviceRequest>
for &mut VirtualControllerCreateLoopbackDeviceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateLoopbackDeviceRequest>(offset);
fidl::encoding::Encode::<VirtualControllerCreateLoopbackDeviceRequest>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<VirtualControllerCreateLoopbackDeviceRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateLoopbackDeviceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VirtualControllerCreateLoopbackDeviceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for VirtualControllerCreateEmulatorResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for VirtualControllerCreateEmulatorResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<VirtualControllerCreateEmulatorResponse>
for &VirtualControllerCreateEmulatorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateEmulatorResponse>(offset);
fidl::encoding::Encode::<VirtualControllerCreateEmulatorResponse>::encode(
(
<fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>>,
> fidl::encoding::Encode<VirtualControllerCreateEmulatorResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateEmulatorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for VirtualControllerCreateEmulatorResponse {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::Optional<fidl::encoding::BoundedString<32>>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BtVendorCommand {
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
}
}
impl fidl::encoding::ValueTypeMarker for BtVendorCommand {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BtVendorCommand> for &BtVendorCommand {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BtVendorCommand>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
BtVendorCommand::SetAclPriority(ref val) => fidl::encoding::encode_in_envelope::<
BtVendorSetAclPriorityParams,
>(
<BtVendorSetAclPriorityParams as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
BtVendorCommand::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self> for BtVendorCommand {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <BtVendorSetAclPriorityParams as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let BtVendorCommand::SetAclPriority(_) = self {
} else {
*self = BtVendorCommand::SetAclPriority(fidl::new_empty!(
BtVendorSetAclPriorityParams
));
}
#[allow(irrefutable_let_patterns)]
if let BtVendorCommand::SetAclPriority(ref mut val) = self {
fidl::decode!(
BtVendorSetAclPriorityParams,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = BtVendorCommand::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}