#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
#[derive(Clone, Debug, PartialEq)]
pub struct BondingDelegateRestoreBondsRequest {
pub bonds: Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
}
impl fidl::Persistable for BondingDelegateRestoreBondsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct BondingDelegateRestoreBondsResponse {
pub errors: Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
}
impl fidl::Persistable for BondingDelegateRestoreBondsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostConnectRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for HostConnectRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostDisconnectRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for HostDisconnectRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostEnableBackgroundScanRequest {
pub enabled: bool,
}
impl fidl::Persistable for HostEnableBackgroundScanRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostEnablePrivacyRequest {
pub enabled: bool,
}
impl fidl::Persistable for HostEnablePrivacyRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostForgetRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for HostForgetRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostPairRequest {
pub id: fidl_fuchsia_bluetooth::PeerId,
pub options: fidl_fuchsia_bluetooth_sys::PairingOptions,
}
impl fidl::Persistable for HostPairRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetBondingDelegateRequest {
pub delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HostSetBondingDelegateRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetBrEdrSecurityModeRequest {
pub bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
}
impl fidl::Persistable for HostSetBrEdrSecurityModeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetConnectableRequest {
pub enabled: bool,
}
impl fidl::Persistable for HostSetConnectableRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostSetDeviceClassRequest {
pub device_class: fidl_fuchsia_bluetooth::DeviceClass,
}
impl fidl::Persistable for HostSetDeviceClassRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetDiscoverableRequest {
pub enabled: bool,
}
impl fidl::Persistable for HostSetDiscoverableRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetLeSecurityModeRequest {
pub le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
}
impl fidl::Persistable for HostSetLeSecurityModeRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetLocalNameRequest {
pub local_name: String,
}
impl fidl::Persistable for HostSetLocalNameRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetPairingDelegateRequest {
pub input: fidl_fuchsia_bluetooth_sys::InputCapability,
pub output: fidl_fuchsia_bluetooth_sys::OutputCapability,
pub delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HostSetPairingDelegateRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostSetPeerWatcherRequest {
pub peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HostSetPeerWatcherRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct HostWatchStateResponse {
pub info: fidl_fuchsia_bluetooth_sys::HostInfo,
}
impl fidl::Persistable for HostWatchStateResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ReceiverAddHostRequest {
pub request: fidl::endpoints::ClientEnd<HostMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ReceiverAddHostRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct HostStartDiscoveryRequest {
pub token: Option<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for HostStartDiscoveryRequest {}
#[derive(Clone, Debug)]
pub enum BondingDelegateWatchBondsResponse {
Updated(fidl_fuchsia_bluetooth_sys::BondingData),
Removed(fidl_fuchsia_bluetooth::PeerId),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! BondingDelegateWatchBondsResponseUnknown {
() => {
_
};
}
impl PartialEq for BondingDelegateWatchBondsResponse {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Updated(x), Self::Updated(y)) => *x == *y,
(Self::Removed(x), Self::Removed(y)) => *x == *y,
_ => false,
}
}
}
impl BondingDelegateWatchBondsResponse {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Updated(_) => 1,
Self::Removed(_) => 2,
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 BondingDelegateWatchBondsResponse {}
#[derive(Clone, Debug)]
pub enum PeerWatcherGetNextResponse {
Updated(Vec<fidl_fuchsia_bluetooth_sys::Peer>),
Removed(Vec<fidl_fuchsia_bluetooth::PeerId>),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! PeerWatcherGetNextResponseUnknown {
() => {
_
};
}
impl PartialEq for PeerWatcherGetNextResponse {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Updated(x), Self::Updated(y)) => *x == *y,
(Self::Removed(x), Self::Removed(y)) => *x == *y,
_ => false,
}
}
}
impl PeerWatcherGetNextResponse {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Updated(_) => 1,
Self::Removed(_) => 2,
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 PeerWatcherGetNextResponse {}
#[derive(Debug)]
pub enum ProtocolRequest {
Central(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>),
Peripheral(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>),
GattServer(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>),
Gatt2Server(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>),
Profile(fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>),
PrivilegedPeripheral(
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker>,
),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ProtocolRequestUnknown {
() => {
_
};
}
impl PartialEq for ProtocolRequest {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Central(x), Self::Central(y)) => *x == *y,
(Self::Peripheral(x), Self::Peripheral(y)) => *x == *y,
(Self::GattServer(x), Self::GattServer(y)) => *x == *y,
(Self::Gatt2Server(x), Self::Gatt2Server(y)) => *x == *y,
(Self::Profile(x), Self::Profile(y)) => *x == *y,
(Self::PrivilegedPeripheral(x), Self::PrivilegedPeripheral(y)) => *x == *y,
_ => false,
}
}
}
impl ProtocolRequest {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Central(_) => 1,
Self::Peripheral(_) => 2,
Self::GattServer(_) => 3,
Self::Gatt2Server(_) => 4,
Self::Profile(_) => 5,
Self::PrivilegedPeripheral(_) => 6,
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::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProtocolRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BondingDelegateMarker;
impl fidl::endpoints::ProtocolMarker for BondingDelegateMarker {
type Proxy = BondingDelegateProxy;
type RequestStream = BondingDelegateRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BondingDelegateSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) BondingDelegate";
}
pub trait BondingDelegateProxyInterface: Send + Sync {
type RestoreBondsResponseFut: std::future::Future<
Output = Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error>,
> + Send;
fn r#restore_bonds(
&self,
bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> Self::RestoreBondsResponseFut;
type WatchBondsResponseFut: std::future::Future<Output = Result<BondingDelegateWatchBondsResponse, fidl::Error>>
+ Send;
fn r#watch_bonds(&self) -> Self::WatchBondsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BondingDelegateSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BondingDelegateSynchronousProxy {
type Proxy = BondingDelegateProxy;
type Protocol = BondingDelegateMarker;
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 BondingDelegateSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<BondingDelegateEvent, fidl::Error> {
BondingDelegateEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#restore_bonds(
&self,
mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
___deadline: zx::MonotonicInstant,
) -> Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error> {
let _response = self.client.send_query::<
BondingDelegateRestoreBondsRequest,
fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>,
>(
(bonds,),
0x2f17e533f2475e96,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<BondingDelegateMarker>("restore_bonds")?;
Ok(_response.errors)
}
pub fn r#watch_bonds(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<BondingDelegateWatchBondsResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>,
>(
(),
0x48313cadc60cd07a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<BondingDelegateMarker>("watch_bonds")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct BondingDelegateProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for BondingDelegateProxy {
type Protocol = BondingDelegateMarker;
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 BondingDelegateProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BondingDelegateEventStream {
BondingDelegateEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#restore_bonds(
&self,
mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BondingDelegateProxyInterface::r#restore_bonds(self, bonds)
}
pub fn r#watch_bonds(
&self,
) -> fidl::client::QueryResponseFut<
BondingDelegateWatchBondsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BondingDelegateProxyInterface::r#watch_bonds(self)
}
}
impl BondingDelegateProxyInterface for BondingDelegateProxy {
type RestoreBondsResponseFut = fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#restore_bonds(
&self,
mut bonds: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> Self::RestoreBondsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<fidl_fuchsia_bluetooth_sys::BondingData>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2f17e533f2475e96,
>(_buf?)?
.into_result::<BondingDelegateMarker>("restore_bonds")?;
Ok(_response.errors)
}
self.client.send_query_and_decode::<
BondingDelegateRestoreBondsRequest,
Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
>(
(bonds,),
0x2f17e533f2475e96,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WatchBondsResponseFut = fidl::client::QueryResponseFut<
BondingDelegateWatchBondsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_bonds(&self) -> Self::WatchBondsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<BondingDelegateWatchBondsResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x48313cadc60cd07a,
>(_buf?)?
.into_result::<BondingDelegateMarker>("watch_bonds")?;
Ok(_response)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
BondingDelegateWatchBondsResponse,
>(
(),
0x48313cadc60cd07a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct BondingDelegateEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for BondingDelegateEventStream {}
impl futures::stream::FusedStream for BondingDelegateEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BondingDelegateEventStream {
type Item = Result<BondingDelegateEvent, 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(BondingDelegateEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BondingDelegateEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl BondingDelegateEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<BondingDelegateEvent, 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(BondingDelegateEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BondingDelegateRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for BondingDelegateRequestStream {}
impl futures::stream::FusedStream for BondingDelegateRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BondingDelegateRequestStream {
type Protocol = BondingDelegateMarker;
type ControlHandle = BondingDelegateControlHandle;
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 {
BondingDelegateControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BondingDelegateRequestStream {
type Item = Result<BondingDelegateRequest, 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 BondingDelegateRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2f17e533f2475e96 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
BondingDelegateRestoreBondsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BondingDelegateRestoreBondsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
BondingDelegateControlHandle { inner: this.inner.clone() };
Ok(BondingDelegateRequest::RestoreBonds {
bonds: req.bonds,
responder: BondingDelegateRestoreBondsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x48313cadc60cd07a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
BondingDelegateControlHandle { inner: this.inner.clone() };
Ok(BondingDelegateRequest::WatchBonds {
responder: BondingDelegateWatchBondsResponder {
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(BondingDelegateRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: BondingDelegateControlHandle {
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(BondingDelegateRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: BondingDelegateControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BondingDelegateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum BondingDelegateRequest {
RestoreBonds {
bonds: Vec<fidl_fuchsia_bluetooth_sys::BondingData>,
responder: BondingDelegateRestoreBondsResponder,
},
WatchBonds { responder: BondingDelegateWatchBondsResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: BondingDelegateControlHandle,
method_type: fidl::MethodType,
},
}
impl BondingDelegateRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_restore_bonds(
self,
) -> Option<(Vec<fidl_fuchsia_bluetooth_sys::BondingData>, BondingDelegateRestoreBondsResponder)>
{
if let BondingDelegateRequest::RestoreBonds { bonds, responder } = self {
Some((bonds, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_bonds(self) -> Option<(BondingDelegateWatchBondsResponder)> {
if let BondingDelegateRequest::WatchBonds { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BondingDelegateRequest::RestoreBonds { .. } => "restore_bonds",
BondingDelegateRequest::WatchBonds { .. } => "watch_bonds",
BondingDelegateRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
BondingDelegateRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct BondingDelegateControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for BondingDelegateControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl BondingDelegateControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BondingDelegateRestoreBondsResponder {
control_handle: std::mem::ManuallyDrop<BondingDelegateControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BondingDelegateRestoreBondsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BondingDelegateRestoreBondsResponder {
type ControlHandle = BondingDelegateControlHandle;
fn control_handle(&self) -> &BondingDelegateControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BondingDelegateRestoreBondsResponder {
pub fn send(
self,
mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(errors);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(errors);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut errors: &[fidl_fuchsia_bluetooth_sys::BondingData],
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<BondingDelegateRestoreBondsResponse>>(
fidl::encoding::Flexible::new((errors,)),
self.tx_id,
0x2f17e533f2475e96,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BondingDelegateWatchBondsResponder {
control_handle: std::mem::ManuallyDrop<BondingDelegateControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BondingDelegateWatchBondsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BondingDelegateWatchBondsResponder {
type ControlHandle = BondingDelegateControlHandle;
fn control_handle(&self) -> &BondingDelegateControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BondingDelegateWatchBondsResponder {
pub fn send(self, mut payload: &BondingDelegateWatchBondsResponse) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut payload: &BondingDelegateWatchBondsResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &BondingDelegateWatchBondsResponse) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<BondingDelegateWatchBondsResponse>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x48313cadc60cd07a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DiscoverySessionMarker;
impl fidl::endpoints::ProtocolMarker for DiscoverySessionMarker {
type Proxy = DiscoverySessionProxy;
type RequestStream = DiscoverySessionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DiscoverySessionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) DiscoverySession";
}
pub trait DiscoverySessionProxyInterface: Send + Sync {
fn r#stop(&self) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DiscoverySessionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DiscoverySessionSynchronousProxy {
type Proxy = DiscoverySessionProxy;
type Protocol = DiscoverySessionMarker;
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 DiscoverySessionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DiscoverySessionEvent, fidl::Error> {
DiscoverySessionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3cbbd11b42632198,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct DiscoverySessionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DiscoverySessionProxy {
type Protocol = DiscoverySessionMarker;
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 DiscoverySessionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DiscoverySessionEventStream {
DiscoverySessionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
DiscoverySessionProxyInterface::r#stop(self)
}
}
impl DiscoverySessionProxyInterface for DiscoverySessionProxy {
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x3cbbd11b42632198,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct DiscoverySessionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DiscoverySessionEventStream {}
impl futures::stream::FusedStream for DiscoverySessionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DiscoverySessionEventStream {
type Item = Result<DiscoverySessionEvent, 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(DiscoverySessionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DiscoverySessionEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl DiscoverySessionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DiscoverySessionEvent, 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(DiscoverySessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DiscoverySessionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DiscoverySessionRequestStream {}
impl futures::stream::FusedStream for DiscoverySessionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DiscoverySessionRequestStream {
type Protocol = DiscoverySessionMarker;
type ControlHandle = DiscoverySessionControlHandle;
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 {
DiscoverySessionControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DiscoverySessionRequestStream {
type Item = Result<DiscoverySessionRequest, 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 DiscoverySessionRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3cbbd11b42632198 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
DiscoverySessionControlHandle { inner: this.inner.clone() };
Ok(DiscoverySessionRequest::Stop { control_handle })
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(DiscoverySessionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DiscoverySessionControlHandle {
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(DiscoverySessionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: DiscoverySessionControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DiscoverySessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DiscoverySessionRequest {
Stop { control_handle: DiscoverySessionControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: DiscoverySessionControlHandle,
method_type: fidl::MethodType,
},
}
impl DiscoverySessionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(DiscoverySessionControlHandle)> {
if let DiscoverySessionRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DiscoverySessionRequest::Stop { .. } => "stop",
DiscoverySessionRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
DiscoverySessionRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct DiscoverySessionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DiscoverySessionControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DiscoverySessionControlHandle {}
#[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 type HostSetLocalNameResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostSetDeviceClassResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostSetConnectableResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostSetDiscoverableResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostConnectResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostDisconnectResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostPairResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub type HostForgetResult = Result<(), fidl_fuchsia_bluetooth_sys::Error>;
pub trait HostProxyInterface: Send + Sync {
fn r#request_protocol(&self, payload: ProtocolRequest) -> Result<(), fidl::Error>;
fn r#shutdown(&self) -> Result<(), fidl::Error>;
type WatchStateResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error>>
+ Send;
fn r#watch_state(&self) -> Self::WatchStateResponseFut;
fn r#set_local_data(
&self,
payload: &fidl_fuchsia_bluetooth_sys::HostData,
) -> Result<(), fidl::Error>;
fn r#set_peer_watcher(
&self,
peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
) -> Result<(), fidl::Error>;
type SetLocalNameResponseFut: std::future::Future<Output = Result<HostSetLocalNameResult, fidl::Error>>
+ Send;
fn r#set_local_name(&self, local_name: &str) -> Self::SetLocalNameResponseFut;
type SetDeviceClassResponseFut: std::future::Future<Output = Result<HostSetDeviceClassResult, fidl::Error>>
+ Send;
fn r#set_device_class(
&self,
device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Self::SetDeviceClassResponseFut;
fn r#start_discovery(&self, payload: HostStartDiscoveryRequest) -> Result<(), fidl::Error>;
type SetConnectableResponseFut: std::future::Future<Output = Result<HostSetConnectableResult, fidl::Error>>
+ Send;
fn r#set_connectable(&self, enabled: bool) -> Self::SetConnectableResponseFut;
type SetDiscoverableResponseFut: std::future::Future<Output = Result<HostSetDiscoverableResult, fidl::Error>>
+ Send;
fn r#set_discoverable(&self, enabled: bool) -> Self::SetDiscoverableResponseFut;
type ConnectResponseFut: std::future::Future<Output = Result<HostConnectResult, fidl::Error>>
+ Send;
fn r#connect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut;
type DisconnectResponseFut: std::future::Future<Output = Result<HostDisconnectResult, fidl::Error>>
+ Send;
fn r#disconnect(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut;
type PairResponseFut: std::future::Future<Output = Result<HostPairResult, fidl::Error>> + Send;
fn r#pair(
&self,
id: &fidl_fuchsia_bluetooth::PeerId,
options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
) -> Self::PairResponseFut;
type ForgetResponseFut: std::future::Future<Output = Result<HostForgetResult, fidl::Error>>
+ Send;
fn r#forget(&self, id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut;
fn r#enable_background_scan(&self, enabled: bool) -> Result<(), fidl::Error>;
fn r#enable_privacy(&self, enabled: bool) -> Result<(), fidl::Error>;
fn r#set_br_edr_security_mode(
&self,
bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
) -> Result<(), fidl::Error>;
fn r#set_le_security_mode(
&self,
le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
) -> Result<(), fidl::Error>;
fn r#set_pairing_delegate(
&self,
input: fidl_fuchsia_bluetooth_sys::InputCapability,
output: fidl_fuchsia_bluetooth_sys::OutputCapability,
delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
) -> Result<(), fidl::Error>;
fn r#set_bonding_delegate(
&self,
delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
) -> 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::MonotonicInstant) -> Result<HostEvent, fidl::Error> {
HostEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
self.client.send::<ProtocolRequest>(
&mut payload,
0x45cb5bf9834016b4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x18747459244591c9,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#watch_state(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<HostWatchStateResponse>,
>(
(),
0x19157554e2a3db52,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HostMarker>("watch_state")?;
Ok(_response.info)
}
pub fn r#set_local_data(
&self,
mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_bluetooth_sys::HostData>(
payload,
0x57b70f72bb0a9187,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_peer_watcher(
&self,
mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetPeerWatcherRequest>(
(peer_watcher,),
0x3dec6b3c99c0a437,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#set_local_name(
&self,
mut local_name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<HostSetLocalNameResult, fidl::Error> {
let _response = self
.client
.send_query::<HostSetLocalNameRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(local_name,),
0x85e98b56b98f123,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HostMarker>("set_local_name")?;
Ok(_response.map(|x| x))
}
pub fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
___deadline: zx::MonotonicInstant,
) -> Result<HostSetDeviceClassResult, fidl::Error> {
let _response = self
.client
.send_query::<HostSetDeviceClassRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(device_class,),
0x4caef8f835950de2,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HostMarker>("set_device_class")?;
Ok(_response.map(|x| x))
}
pub fn r#start_discovery(
&self,
mut payload: HostStartDiscoveryRequest,
) -> Result<(), fidl::Error> {
self.client.send::<HostStartDiscoveryRequest>(
&mut payload,
0x3f40a85341413e4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#set_connectable(
&self,
mut enabled: bool,
___deadline: zx::MonotonicInstant,
) -> Result<HostSetConnectableResult, fidl::Error> {
let _response = self
.client
.send_query::<HostSetConnectableRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(enabled,), 0x187a6a82e811fa92, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<HostMarker>("set_connectable")?;
Ok(_response.map(|x| x))
}
pub fn r#set_discoverable(
&self,
mut enabled: bool,
___deadline: zx::MonotonicInstant,
) -> Result<HostSetDiscoverableResult, fidl::Error> {
let _response = self
.client
.send_query::<HostSetDiscoverableRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(enabled,), 0x89f8c7da63e36de, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<HostMarker>("set_discoverable")?;
Ok(_response.map(|x| x))
}
pub fn r#connect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<HostConnectResult, fidl::Error> {
let _response = self
.client
.send_query::<HostConnectRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(id,), 0x5a56139c993e7240, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<HostMarker>("connect")?;
Ok(_response.map(|x| x))
}
pub fn r#disconnect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<HostDisconnectResult, fidl::Error> {
let _response = self
.client
.send_query::<HostDisconnectRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(id,), 0x33211717491121b1, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<HostMarker>("disconnect")?;
Ok(_response.map(|x| x))
}
pub fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
___deadline: zx::MonotonicInstant,
) -> Result<HostPairResult, fidl::Error> {
let _response = self
.client
.send_query::<HostPairRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(id, options),
0x2efaec6dc5d62ca2,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HostMarker>("pair")?;
Ok(_response.map(|x| x))
}
pub fn r#forget(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
___deadline: zx::MonotonicInstant,
) -> Result<HostForgetResult, fidl::Error> {
let _response = self
.client
.send_query::<HostForgetRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
(id,), 0x904f58dbdd4490a, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
)?
.into_result::<HostMarker>("forget")?;
Ok(_response.map(|x| x))
}
pub fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<HostEnableBackgroundScanRequest>(
(enabled,),
0x51f038a8cf498946,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<HostEnablePrivacyRequest>(
(enabled,),
0x370a76e1d2b5034b,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_br_edr_security_mode(
&self,
mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetBrEdrSecurityModeRequest>(
(bredr_security_mode,),
0x1d94d20717459281,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_le_security_mode(
&self,
mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetLeSecurityModeRequest>(
(le_security_mode,),
0x6ef0a424a336a81,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#set_pairing_delegate(
&self,
mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetPairingDelegateRequest>(
(input, output, delegate),
0x21a5bba5ffc9773e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#set_bonding_delegate(
&self,
mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetBondingDelegateRequest>(
(delegate,),
0x651d446a05b664d4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct HostProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
HostProxyInterface::r#request_protocol(self, payload)
}
pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
HostProxyInterface::r#shutdown(self)
}
pub fn r#watch_state(
&self,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth_sys::HostInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#watch_state(self)
}
pub fn r#set_local_data(
&self,
mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_local_data(self, payload)
}
pub fn r#set_peer_watcher(
&self,
mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_peer_watcher(self, peer_watcher)
}
pub fn r#set_local_name(
&self,
mut local_name: &str,
) -> fidl::client::QueryResponseFut<
HostSetLocalNameResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#set_local_name(self, local_name)
}
pub fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> fidl::client::QueryResponseFut<
HostSetDeviceClassResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#set_device_class(self, device_class)
}
pub fn r#start_discovery(
&self,
mut payload: HostStartDiscoveryRequest,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#start_discovery(self, payload)
}
pub fn r#set_connectable(
&self,
mut enabled: bool,
) -> fidl::client::QueryResponseFut<
HostSetConnectableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#set_connectable(self, enabled)
}
pub fn r#set_discoverable(
&self,
mut enabled: bool,
) -> fidl::client::QueryResponseFut<
HostSetDiscoverableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#set_discoverable(self, enabled)
}
pub fn r#connect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
HostConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#connect(self, id)
}
pub fn r#disconnect(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
HostDisconnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#disconnect(self, id)
}
pub fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
) -> fidl::client::QueryResponseFut<HostPairResult, fidl::encoding::DefaultFuchsiaResourceDialect>
{
HostProxyInterface::r#pair(self, id, options)
}
pub fn r#forget(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
) -> fidl::client::QueryResponseFut<
HostForgetResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HostProxyInterface::r#forget(self, id)
}
pub fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
HostProxyInterface::r#enable_background_scan(self, enabled)
}
pub fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
HostProxyInterface::r#enable_privacy(self, enabled)
}
pub fn r#set_br_edr_security_mode(
&self,
mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_br_edr_security_mode(self, bredr_security_mode)
}
pub fn r#set_le_security_mode(
&self,
mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_le_security_mode(self, le_security_mode)
}
pub fn r#set_pairing_delegate(
&self,
mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_pairing_delegate(self, input, output, delegate)
}
pub fn r#set_bonding_delegate(
&self,
mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
) -> Result<(), fidl::Error> {
HostProxyInterface::r#set_bonding_delegate(self, delegate)
}
}
impl HostProxyInterface for HostProxy {
fn r#request_protocol(&self, mut payload: ProtocolRequest) -> Result<(), fidl::Error> {
self.client.send::<ProtocolRequest>(
&mut payload,
0x45cb5bf9834016b4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#shutdown(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x18747459244591c9,
fidl::encoding::DynamicFlags::empty(),
)
}
type WatchStateResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth_sys::HostInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_state(&self) -> Self::WatchStateResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth_sys::HostInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<HostWatchStateResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x19157554e2a3db52,
>(_buf?)?
.into_result::<HostMarker>("watch_state")?;
Ok(_response.info)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
fidl_fuchsia_bluetooth_sys::HostInfo,
>(
(),
0x19157554e2a3db52,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#set_local_data(
&self,
mut payload: &fidl_fuchsia_bluetooth_sys::HostData,
) -> Result<(), fidl::Error> {
self.client.send::<fidl_fuchsia_bluetooth_sys::HostData>(
payload,
0x57b70f72bb0a9187,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_peer_watcher(
&self,
mut peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetPeerWatcherRequest>(
(peer_watcher,),
0x3dec6b3c99c0a437,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type SetLocalNameResponseFut = fidl::client::QueryResponseFut<
HostSetLocalNameResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_local_name(&self, mut local_name: &str) -> Self::SetLocalNameResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostSetLocalNameResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x85e98b56b98f123,
>(_buf?)?
.into_result::<HostMarker>("set_local_name")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostSetLocalNameRequest, HostSetLocalNameResult>(
(local_name,),
0x85e98b56b98f123,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetDeviceClassResponseFut = fidl::client::QueryResponseFut<
HostSetDeviceClassResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_device_class(
&self,
mut device_class: &fidl_fuchsia_bluetooth::DeviceClass,
) -> Self::SetDeviceClassResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostSetDeviceClassResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4caef8f835950de2,
>(_buf?)?
.into_result::<HostMarker>("set_device_class")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostSetDeviceClassRequest, HostSetDeviceClassResult>(
(device_class,),
0x4caef8f835950de2,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#start_discovery(&self, mut payload: HostStartDiscoveryRequest) -> Result<(), fidl::Error> {
self.client.send::<HostStartDiscoveryRequest>(
&mut payload,
0x3f40a85341413e4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type SetConnectableResponseFut = fidl::client::QueryResponseFut<
HostSetConnectableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_connectable(&self, mut enabled: bool) -> Self::SetConnectableResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostSetConnectableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x187a6a82e811fa92,
>(_buf?)?
.into_result::<HostMarker>("set_connectable")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostSetConnectableRequest, HostSetConnectableResult>(
(enabled,),
0x187a6a82e811fa92,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetDiscoverableResponseFut = fidl::client::QueryResponseFut<
HostSetDiscoverableResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_discoverable(&self, mut enabled: bool) -> Self::SetDiscoverableResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostSetDiscoverableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x89f8c7da63e36de,
>(_buf?)?
.into_result::<HostMarker>("set_discoverable")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostSetDiscoverableRequest, HostSetDiscoverableResult>(
(enabled,),
0x89f8c7da63e36de,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
HostConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5a56139c993e7240,
>(_buf?)?
.into_result::<HostMarker>("connect")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostConnectRequest, HostConnectResult>(
(id,),
0x5a56139c993e7240,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type DisconnectResponseFut = fidl::client::QueryResponseFut<
HostDisconnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#disconnect(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::DisconnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostDisconnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x33211717491121b1,
>(_buf?)?
.into_result::<HostMarker>("disconnect")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostDisconnectRequest, HostDisconnectResult>(
(id,),
0x33211717491121b1,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type PairResponseFut = fidl::client::QueryResponseFut<
HostPairResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#pair(
&self,
mut id: &fidl_fuchsia_bluetooth::PeerId,
mut options: &fidl_fuchsia_bluetooth_sys::PairingOptions,
) -> Self::PairResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostPairResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2efaec6dc5d62ca2,
>(_buf?)?
.into_result::<HostMarker>("pair")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostPairRequest, HostPairResult>(
(id, options),
0x2efaec6dc5d62ca2,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ForgetResponseFut = fidl::client::QueryResponseFut<
HostForgetResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#forget(&self, mut id: &fidl_fuchsia_bluetooth::PeerId) -> Self::ForgetResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostForgetResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x904f58dbdd4490a,
>(_buf?)?
.into_result::<HostMarker>("forget")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HostForgetRequest, HostForgetResult>(
(id,),
0x904f58dbdd4490a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#enable_background_scan(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<HostEnableBackgroundScanRequest>(
(enabled,),
0x51f038a8cf498946,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#enable_privacy(&self, mut enabled: bool) -> Result<(), fidl::Error> {
self.client.send::<HostEnablePrivacyRequest>(
(enabled,),
0x370a76e1d2b5034b,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_br_edr_security_mode(
&self,
mut bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetBrEdrSecurityModeRequest>(
(bredr_security_mode,),
0x1d94d20717459281,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_le_security_mode(
&self,
mut le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetLeSecurityModeRequest>(
(le_security_mode,),
0x6ef0a424a336a81,
fidl::encoding::DynamicFlags::empty(),
)
}
fn r#set_pairing_delegate(
&self,
mut input: fidl_fuchsia_bluetooth_sys::InputCapability,
mut output: fidl_fuchsia_bluetooth_sys::OutputCapability,
mut delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetPairingDelegateRequest>(
(input, output, delegate),
0x21a5bba5ffc9773e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#set_bonding_delegate(
&self,
mut delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<HostSetBondingDelegateRequest>(
(delegate,),
0x651d446a05b664d4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct HostEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
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 {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl HostEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::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 {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(HostEvent::_UnknownEvent { ordinal: 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<fidl::encoding::DefaultFuchsiaResourceDialect>>,
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<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for 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::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x45cb5bf9834016b4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProtocolRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::RequestProtocol { payload: req, control_handle })
}
0x18747459244591c9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Shutdown { control_handle })
}
0x19157554e2a3db52 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::WatchState {
responder: HostWatchStateResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x57b70f72bb0a9187 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl_fuchsia_bluetooth_sys::HostData,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_bluetooth_sys::HostData>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetLocalData { payload: req, control_handle })
}
0x3dec6b3c99c0a437 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostSetPeerWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetPeerWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetPeerWatcher {
peer_watcher: req.peer_watcher,
control_handle,
})
}
0x85e98b56b98f123 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostSetLocalNameRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetLocalNameRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetLocalName {
local_name: req.local_name,
responder: HostSetLocalNameResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4caef8f835950de2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostSetDeviceClassRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetDeviceClassRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetDeviceClass {
device_class: req.device_class,
responder: HostSetDeviceClassResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3f40a85341413e4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostStartDiscoveryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostStartDiscoveryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::StartDiscovery { payload: req, control_handle })
}
0x187a6a82e811fa92 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostSetConnectableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetConnectableRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetConnectable {
enabled: req.enabled,
responder: HostSetConnectableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x89f8c7da63e36de => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostSetDiscoverableRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetDiscoverableRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetDiscoverable {
enabled: req.enabled,
responder: HostSetDiscoverableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5a56139c993e7240 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Connect {
id: req.id,
responder: HostConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x33211717491121b1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostDisconnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Disconnect {
id: req.id,
responder: HostDisconnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2efaec6dc5d62ca2 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostPairRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostPairRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Pair {
id: req.id,
options: req.options,
responder: HostPairResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x904f58dbdd4490a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HostForgetRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostForgetRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::Forget {
id: req.id,
responder: HostForgetResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x51f038a8cf498946 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostEnableBackgroundScanRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostEnableBackgroundScanRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::EnableBackgroundScan {
enabled: req.enabled,
control_handle,
})
}
0x370a76e1d2b5034b => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostEnablePrivacyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostEnablePrivacyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::EnablePrivacy { enabled: req.enabled, control_handle })
}
0x1d94d20717459281 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostSetBrEdrSecurityModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetBrEdrSecurityModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetBrEdrSecurityMode {
bredr_security_mode: req.bredr_security_mode,
control_handle,
})
}
0x6ef0a424a336a81 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostSetLeSecurityModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetLeSecurityModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetLeSecurityMode {
le_security_mode: req.le_security_mode,
control_handle,
})
}
0x21a5bba5ffc9773e => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetPairingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetPairingDelegate {
input: req.input,
output: req.output,
delegate: req.delegate,
control_handle,
})
}
0x651d446a05b664d4 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HostSetBondingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostSetBondingDelegateRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HostControlHandle { inner: this.inner.clone() };
Ok(HostRequest::SetBondingDelegate {
delegate: req.delegate,
control_handle,
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(HostRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HostControlHandle { 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(HostRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HostControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HostRequest {
RequestProtocol { payload: ProtocolRequest, control_handle: HostControlHandle },
Shutdown { control_handle: HostControlHandle },
WatchState { responder: HostWatchStateResponder },
SetLocalData {
payload: fidl_fuchsia_bluetooth_sys::HostData,
control_handle: HostControlHandle,
},
SetPeerWatcher {
peer_watcher: fidl::endpoints::ServerEnd<PeerWatcherMarker>,
control_handle: HostControlHandle,
},
SetLocalName { local_name: String, responder: HostSetLocalNameResponder },
SetDeviceClass {
device_class: fidl_fuchsia_bluetooth::DeviceClass,
responder: HostSetDeviceClassResponder,
},
StartDiscovery { payload: HostStartDiscoveryRequest, control_handle: HostControlHandle },
SetConnectable { enabled: bool, responder: HostSetConnectableResponder },
SetDiscoverable { enabled: bool, responder: HostSetDiscoverableResponder },
Connect { id: fidl_fuchsia_bluetooth::PeerId, responder: HostConnectResponder },
Disconnect { id: fidl_fuchsia_bluetooth::PeerId, responder: HostDisconnectResponder },
Pair {
id: fidl_fuchsia_bluetooth::PeerId,
options: fidl_fuchsia_bluetooth_sys::PairingOptions,
responder: HostPairResponder,
},
Forget { id: fidl_fuchsia_bluetooth::PeerId, responder: HostForgetResponder },
EnableBackgroundScan { enabled: bool, control_handle: HostControlHandle },
EnablePrivacy { enabled: bool, control_handle: HostControlHandle },
SetBrEdrSecurityMode {
bredr_security_mode: fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
control_handle: HostControlHandle,
},
SetLeSecurityMode {
le_security_mode: fidl_fuchsia_bluetooth_sys::LeSecurityMode,
control_handle: HostControlHandle,
},
SetPairingDelegate {
input: fidl_fuchsia_bluetooth_sys::InputCapability,
output: fidl_fuchsia_bluetooth_sys::OutputCapability,
delegate: fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
control_handle: HostControlHandle,
},
SetBondingDelegate {
delegate: fidl::endpoints::ServerEnd<BondingDelegateMarker>,
control_handle: HostControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: HostControlHandle,
method_type: fidl::MethodType,
},
}
impl HostRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_request_protocol(self) -> Option<(ProtocolRequest, HostControlHandle)> {
if let HostRequest::RequestProtocol { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_shutdown(self) -> Option<(HostControlHandle)> {
if let HostRequest::Shutdown { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_state(self) -> Option<(HostWatchStateResponder)> {
if let HostRequest::WatchState { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_local_data(
self,
) -> Option<(fidl_fuchsia_bluetooth_sys::HostData, HostControlHandle)> {
if let HostRequest::SetLocalData { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_peer_watcher(
self,
) -> Option<(fidl::endpoints::ServerEnd<PeerWatcherMarker>, HostControlHandle)> {
if let HostRequest::SetPeerWatcher { peer_watcher, control_handle } = self {
Some((peer_watcher, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_local_name(self) -> Option<(String, HostSetLocalNameResponder)> {
if let HostRequest::SetLocalName { local_name, responder } = self {
Some((local_name, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_device_class(
self,
) -> Option<(fidl_fuchsia_bluetooth::DeviceClass, HostSetDeviceClassResponder)> {
if let HostRequest::SetDeviceClass { device_class, responder } = self {
Some((device_class, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_discovery(self) -> Option<(HostStartDiscoveryRequest, HostControlHandle)> {
if let HostRequest::StartDiscovery { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_connectable(self) -> Option<(bool, HostSetConnectableResponder)> {
if let HostRequest::SetConnectable { enabled, responder } = self {
Some((enabled, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_discoverable(self) -> Option<(bool, HostSetDiscoverableResponder)> {
if let HostRequest::SetDiscoverable { enabled, responder } = self {
Some((enabled, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostConnectResponder)> {
if let HostRequest::Connect { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_disconnect(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostDisconnectResponder)> {
if let HostRequest::Disconnect { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_pair(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
fidl_fuchsia_bluetooth_sys::PairingOptions,
HostPairResponder,
)> {
if let HostRequest::Pair { id, options, responder } = self {
Some((id, options, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_forget(self) -> Option<(fidl_fuchsia_bluetooth::PeerId, HostForgetResponder)> {
if let HostRequest::Forget { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_background_scan(self) -> Option<(bool, HostControlHandle)> {
if let HostRequest::EnableBackgroundScan { enabled, control_handle } = self {
Some((enabled, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_enable_privacy(self) -> Option<(bool, HostControlHandle)> {
if let HostRequest::EnablePrivacy { enabled, control_handle } = self {
Some((enabled, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_br_edr_security_mode(
self,
) -> Option<(fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode, HostControlHandle)> {
if let HostRequest::SetBrEdrSecurityMode { bredr_security_mode, control_handle } = self {
Some((bredr_security_mode, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_le_security_mode(
self,
) -> Option<(fidl_fuchsia_bluetooth_sys::LeSecurityMode, HostControlHandle)> {
if let HostRequest::SetLeSecurityMode { le_security_mode, control_handle } = self {
Some((le_security_mode, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_pairing_delegate(
self,
) -> Option<(
fidl_fuchsia_bluetooth_sys::InputCapability,
fidl_fuchsia_bluetooth_sys::OutputCapability,
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
HostControlHandle,
)> {
if let HostRequest::SetPairingDelegate { input, output, delegate, control_handle } = self {
Some((input, output, delegate, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_bonding_delegate(
self,
) -> Option<(fidl::endpoints::ServerEnd<BondingDelegateMarker>, HostControlHandle)> {
if let HostRequest::SetBondingDelegate { delegate, control_handle } = self {
Some((delegate, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HostRequest::RequestProtocol { .. } => "request_protocol",
HostRequest::Shutdown { .. } => "shutdown",
HostRequest::WatchState { .. } => "watch_state",
HostRequest::SetLocalData { .. } => "set_local_data",
HostRequest::SetPeerWatcher { .. } => "set_peer_watcher",
HostRequest::SetLocalName { .. } => "set_local_name",
HostRequest::SetDeviceClass { .. } => "set_device_class",
HostRequest::StartDiscovery { .. } => "start_discovery",
HostRequest::SetConnectable { .. } => "set_connectable",
HostRequest::SetDiscoverable { .. } => "set_discoverable",
HostRequest::Connect { .. } => "connect",
HostRequest::Disconnect { .. } => "disconnect",
HostRequest::Pair { .. } => "pair",
HostRequest::Forget { .. } => "forget",
HostRequest::EnableBackgroundScan { .. } => "enable_background_scan",
HostRequest::EnablePrivacy { .. } => "enable_privacy",
HostRequest::SetBrEdrSecurityMode { .. } => "set_br_edr_security_mode",
HostRequest::SetLeSecurityMode { .. } => "set_le_security_mode",
HostRequest::SetPairingDelegate { .. } => "set_pairing_delegate",
HostRequest::SetBondingDelegate { .. } => "set_bonding_delegate",
HostRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
HostRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct HostControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
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()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl HostControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostWatchStateResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostWatchStateResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostWatchStateResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostWatchStateResponder {
pub fn send(self, mut info: &fidl_fuchsia_bluetooth_sys::HostInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut info: &fidl_fuchsia_bluetooth_sys::HostInfo,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut info: &fidl_fuchsia_bluetooth_sys::HostInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<HostWatchStateResponse>>(
fidl::encoding::Flexible::new((info,)),
self.tx_id,
0x19157554e2a3db52,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostSetLocalNameResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostSetLocalNameResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostSetLocalNameResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostSetLocalNameResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x85e98b56b98f123,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostSetDeviceClassResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostSetDeviceClassResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostSetDeviceClassResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostSetDeviceClassResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x4caef8f835950de2,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostSetConnectableResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostSetConnectableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostSetConnectableResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostSetConnectableResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x187a6a82e811fa92,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostSetDiscoverableResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostSetDiscoverableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostSetDiscoverableResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostSetDiscoverableResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x89f8c7da63e36de,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostConnectResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostConnectResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostConnectResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5a56139c993e7240,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostDisconnectResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostDisconnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostDisconnectResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostDisconnectResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x33211717491121b1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostPairResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostPairResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostPairResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostPairResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2efaec6dc5d62ca2,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HostForgetResponder {
control_handle: std::mem::ManuallyDrop<HostControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HostForgetResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HostForgetResponder {
type ControlHandle = HostControlHandle;
fn control_handle(&self) -> &HostControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HostForgetResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> 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_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth_sys::Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth_sys::Error,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x904f58dbdd4490a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerWatcherMarker;
impl fidl::endpoints::ProtocolMarker for PeerWatcherMarker {
type Proxy = PeerWatcherProxy;
type RequestStream = PeerWatcherRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerWatcherSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PeerWatcher";
}
pub trait PeerWatcherProxyInterface: Send + Sync {
type GetNextResponseFut: std::future::Future<Output = Result<PeerWatcherGetNextResponse, fidl::Error>>
+ Send;
fn r#get_next(&self) -> Self::GetNextResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerWatcherSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerWatcherSynchronousProxy {
type Proxy = PeerWatcherProxy;
type Protocol = PeerWatcherMarker;
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 PeerWatcherSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<PeerWatcherEvent, fidl::Error> {
PeerWatcherEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_next(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerWatcherGetNextResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>,
>(
(),
0x31b4855de7565b77,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerWatcherMarker>("get_next")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct PeerWatcherProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerWatcherProxy {
type Protocol = PeerWatcherMarker;
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 PeerWatcherProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerWatcherEventStream {
PeerWatcherEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_next(
&self,
) -> fidl::client::QueryResponseFut<
PeerWatcherGetNextResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerWatcherProxyInterface::r#get_next(self)
}
}
impl PeerWatcherProxyInterface for PeerWatcherProxy {
type GetNextResponseFut = fidl::client::QueryResponseFut<
PeerWatcherGetNextResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_next(&self) -> Self::GetNextResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerWatcherGetNextResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x31b4855de7565b77,
>(_buf?)?
.into_result::<PeerWatcherMarker>("get_next")?;
Ok(_response)
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, PeerWatcherGetNextResponse>(
(),
0x31b4855de7565b77,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct PeerWatcherEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerWatcherEventStream {}
impl futures::stream::FusedStream for PeerWatcherEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerWatcherEventStream {
type Item = Result<PeerWatcherEvent, 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(PeerWatcherEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerWatcherEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl PeerWatcherEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerWatcherEvent, 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(PeerWatcherEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerWatcherRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerWatcherRequestStream {}
impl futures::stream::FusedStream for PeerWatcherRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerWatcherRequestStream {
type Protocol = PeerWatcherMarker;
type ControlHandle = PeerWatcherControlHandle;
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 {
PeerWatcherControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for PeerWatcherRequestStream {
type Item = Result<PeerWatcherRequest, 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 PeerWatcherRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x31b4855de7565b77 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerWatcherControlHandle { inner: this.inner.clone() };
Ok(PeerWatcherRequest::GetNext {
responder: PeerWatcherGetNextResponder {
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(PeerWatcherRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PeerWatcherControlHandle { 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(PeerWatcherRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PeerWatcherControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerWatcherRequest {
GetNext { responder: PeerWatcherGetNextResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: PeerWatcherControlHandle,
method_type: fidl::MethodType,
},
}
impl PeerWatcherRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_next(self) -> Option<(PeerWatcherGetNextResponder)> {
if let PeerWatcherRequest::GetNext { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerWatcherRequest::GetNext { .. } => "get_next",
PeerWatcherRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
PeerWatcherRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerWatcherControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerWatcherControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl PeerWatcherControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerWatcherGetNextResponder {
control_handle: std::mem::ManuallyDrop<PeerWatcherControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerWatcherGetNextResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerWatcherGetNextResponder {
type ControlHandle = PeerWatcherControlHandle;
fn control_handle(&self) -> &PeerWatcherControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerWatcherGetNextResponder {
pub fn send(self, mut payload: &PeerWatcherGetNextResponse) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut payload: &PeerWatcherGetNextResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &PeerWatcherGetNextResponse) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<PeerWatcherGetNextResponse>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x31b4855de7565b77,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ReceiverMarker;
impl fidl::endpoints::ProtocolMarker for ReceiverMarker {
type Proxy = ReceiverProxy;
type RequestStream = ReceiverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ReceiverSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.host.Receiver";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ReceiverMarker {}
pub trait ReceiverProxyInterface: Send + Sync {
fn r#add_host(
&self,
request: fidl::endpoints::ClientEnd<HostMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ReceiverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ReceiverSynchronousProxy {
type Proxy = ReceiverProxy;
type Protocol = ReceiverMarker;
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 ReceiverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<ReceiverEvent, fidl::Error> {
ReceiverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_host(
&self,
mut request: fidl::endpoints::ClientEnd<HostMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ReceiverAddHostRequest>(
(request,),
0x2089233075765e8c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ReceiverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ReceiverProxy {
type Protocol = ReceiverMarker;
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 ReceiverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ReceiverEventStream {
ReceiverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_host(
&self,
mut request: fidl::endpoints::ClientEnd<HostMarker>,
) -> Result<(), fidl::Error> {
ReceiverProxyInterface::r#add_host(self, request)
}
}
impl ReceiverProxyInterface for ReceiverProxy {
fn r#add_host(
&self,
mut request: fidl::endpoints::ClientEnd<HostMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<ReceiverAddHostRequest>(
(request,),
0x2089233075765e8c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ReceiverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ReceiverEventStream {}
impl futures::stream::FusedStream for ReceiverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ReceiverEventStream {
type Item = Result<ReceiverEvent, 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(ReceiverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ReceiverEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ReceiverEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ReceiverEvent, 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(ReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ReceiverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ReceiverRequestStream {}
impl futures::stream::FusedStream for ReceiverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ReceiverRequestStream {
type Protocol = ReceiverMarker;
type ControlHandle = ReceiverControlHandle;
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 {
ReceiverControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for ReceiverRequestStream {
type Item = Result<ReceiverRequest, 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 ReceiverRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2089233075765e8c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ReceiverAddHostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReceiverAddHostRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ReceiverControlHandle { inner: this.inner.clone() };
Ok(ReceiverRequest::AddHost { request: req.request, control_handle })
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ReceiverControlHandle { 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(ReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ReceiverControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ReceiverRequest {
AddHost {
request: fidl::endpoints::ClientEnd<HostMarker>,
control_handle: ReceiverControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ReceiverControlHandle,
method_type: fidl::MethodType,
},
}
impl ReceiverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_host(
self,
) -> Option<(fidl::endpoints::ClientEnd<HostMarker>, ReceiverControlHandle)> {
if let ReceiverRequest::AddHost { request, control_handle } = self {
Some((request, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ReceiverRequest::AddHost { .. } => "add_host",
ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ReceiverRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ReceiverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ReceiverControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl ReceiverControlHandle {}
mod internal {
use super::*;
impl fidl::encoding::ValueTypeMarker for BondingDelegateRestoreBondsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BondingDelegateRestoreBondsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BondingDelegateRestoreBondsRequest, D>
for &BondingDelegateRestoreBondsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingDelegateRestoreBondsRequest>(offset);
fidl::encoding::Encode::<BondingDelegateRestoreBondsRequest, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData> as fidl::encoding::ValueTypeMarker>::borrow(&self.bonds),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D,
>,
> fidl::encoding::Encode<BondingDelegateRestoreBondsRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingDelegateRestoreBondsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BondingDelegateRestoreBondsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
bonds: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D,
&mut self.bonds,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BondingDelegateRestoreBondsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BondingDelegateRestoreBondsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BondingDelegateRestoreBondsResponse, D>
for &BondingDelegateRestoreBondsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingDelegateRestoreBondsResponse>(offset);
fidl::encoding::Encode::<BondingDelegateRestoreBondsResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData> as fidl::encoding::ValueTypeMarker>::borrow(&self.errors),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D,
>,
> fidl::encoding::Encode<BondingDelegateRestoreBondsResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingDelegateRestoreBondsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BondingDelegateRestoreBondsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
errors: fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::BondingData>,
D,
&mut self.errors,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostConnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostConnectRequest, D>
for &HostConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostConnectRequest>(offset);
fidl::encoding::Encode::<HostConnectRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<HostConnectRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostConnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostDisconnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostDisconnectRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostDisconnectRequest, D>
for &HostDisconnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostDisconnectRequest>(offset);
fidl::encoding::Encode::<HostDisconnectRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<HostDisconnectRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostDisconnectRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostDisconnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostEnableBackgroundScanRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostEnableBackgroundScanRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostEnableBackgroundScanRequest, D>
for &HostEnableBackgroundScanRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostEnableBackgroundScanRequest>(offset);
fidl::encoding::Encode::<HostEnableBackgroundScanRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<HostEnableBackgroundScanRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostEnableBackgroundScanRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostEnableBackgroundScanRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostEnablePrivacyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostEnablePrivacyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostEnablePrivacyRequest, D> for &HostEnablePrivacyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostEnablePrivacyRequest>(offset);
fidl::encoding::Encode::<HostEnablePrivacyRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<HostEnablePrivacyRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostEnablePrivacyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostEnablePrivacyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostForgetRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostForgetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostForgetRequest, D>
for &HostForgetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostForgetRequest>(offset);
fidl::encoding::Encode::<HostForgetRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<HostForgetRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostForgetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostForgetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostPairRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostPairRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostPairRequest, D>
for &HostPairRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostPairRequest>(offset);
fidl::encoding::Encode::<HostPairRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<fidl_fuchsia_bluetooth_sys::PairingOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_bluetooth_sys::PairingOptions, D>,
> fidl::encoding::Encode<HostPairRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostPairRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostPairRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
options: fidl::new_empty!(fidl_fuchsia_bluetooth_sys::PairingOptions, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_bluetooth_sys::PairingOptions,
D,
&mut self.options,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostSetBondingDelegateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetBondingDelegateRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
HostSetBondingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostSetBondingDelegateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetBondingDelegateRequest>(offset);
fidl::encoding::Encode::<HostSetBondingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostSetBondingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetBondingDelegateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostSetBondingDelegateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BondingDelegateMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetBrEdrSecurityModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetBrEdrSecurityModeRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetBrEdrSecurityModeRequest, D>
for &HostSetBrEdrSecurityModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetBrEdrSecurityModeRequest>(offset);
fidl::encoding::Encode::<HostSetBrEdrSecurityModeRequest, D>::encode(
(
<fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode as fidl::encoding::ValueTypeMarker>::borrow(&self.bredr_security_mode),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode, D>,
> fidl::encoding::Encode<HostSetBrEdrSecurityModeRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetBrEdrSecurityModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetBrEdrSecurityModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
bredr_security_mode: fidl::new_empty!(
fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth_sys::BrEdrSecurityMode,
D,
&mut self.bredr_security_mode,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetConnectableRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetConnectableRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetConnectableRequest, D> for &HostSetConnectableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetConnectableRequest>(offset);
fidl::encoding::Encode::<HostSetConnectableRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<HostSetConnectableRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetConnectableRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetConnectableRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetDeviceClassRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetDeviceClassRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetDeviceClassRequest, D> for &HostSetDeviceClassRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetDeviceClassRequest>(offset);
fidl::encoding::Encode::<HostSetDeviceClassRequest, D>::encode(
(<fidl_fuchsia_bluetooth::DeviceClass as fidl::encoding::ValueTypeMarker>::borrow(
&self.device_class,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::DeviceClass, D>,
> fidl::encoding::Encode<HostSetDeviceClassRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetDeviceClassRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetDeviceClassRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { device_class: fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth::DeviceClass,
D,
&mut self.device_class,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetDiscoverableRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetDiscoverableRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetDiscoverableRequest, D> for &HostSetDiscoverableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetDiscoverableRequest>(offset);
fidl::encoding::Encode::<HostSetDiscoverableRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<HostSetDiscoverableRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetDiscoverableRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetDiscoverableRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetLeSecurityModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetLeSecurityModeRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetLeSecurityModeRequest, D> for &HostSetLeSecurityModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetLeSecurityModeRequest>(offset);
fidl::encoding::Encode::<HostSetLeSecurityModeRequest, D>::encode(
(
<fidl_fuchsia_bluetooth_sys::LeSecurityMode as fidl::encoding::ValueTypeMarker>::borrow(&self.le_security_mode),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_sys::LeSecurityMode, D>,
> fidl::encoding::Encode<HostSetLeSecurityModeRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetLeSecurityModeRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetLeSecurityModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
le_security_mode: fidl::new_empty!(fidl_fuchsia_bluetooth_sys::LeSecurityMode, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth_sys::LeSecurityMode,
D,
&mut self.le_security_mode,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostSetLocalNameRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetLocalNameRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostSetLocalNameRequest, D> for &HostSetLocalNameRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetLocalNameRequest>(offset);
fidl::encoding::Encode::<HostSetLocalNameRequest, D>::encode(
(<fidl::encoding::BoundedString<248> as fidl::encoding::ValueTypeMarker>::borrow(
&self.local_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<248>, D>,
> fidl::encoding::Encode<HostSetLocalNameRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetLocalNameRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostSetLocalNameRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { local_name: fidl::new_empty!(fidl::encoding::BoundedString<248>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<248>,
D,
&mut self.local_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostSetPairingDelegateRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetPairingDelegateRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl
fidl::encoding::Encode<
HostSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostSetPairingDelegateRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetPairingDelegateRequest>(offset);
fidl::encoding::Encode::<HostSetPairingDelegateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth_sys::InputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.input),
<fidl_fuchsia_bluetooth_sys::OutputCapability as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.delegate),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_bluetooth_sys::InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl_fuchsia_bluetooth_sys::OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostSetPairingDelegateRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetPairingDelegateRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostSetPairingDelegateRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
input: fidl::new_empty!(
fidl_fuchsia_bluetooth_sys::InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
output: fidl::new_empty!(
fidl_fuchsia_bluetooth_sys::OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect
),
delegate: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<
fidl_fuchsia_bluetooth_sys::PairingDelegateMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth_sys::InputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.input,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_bluetooth_sys::OutputCapability,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.output,
decoder,
offset + 4,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth_sys::PairingDelegateMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.delegate,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HostSetPeerWatcherRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostSetPeerWatcherRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
HostSetPeerWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostSetPeerWatcherRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetPeerWatcherRequest>(offset);
fidl::encoding::Encode::<HostSetPeerWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.peer_watcher),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HostSetPeerWatcherRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostSetPeerWatcherRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostSetPeerWatcherRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_watcher: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerWatcherMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer_watcher,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostWatchStateResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostWatchStateResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HostWatchStateResponse, D> for &HostWatchStateResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatchStateResponse>(offset);
fidl::encoding::Encode::<HostWatchStateResponse, D>::encode(
(
<fidl_fuchsia_bluetooth_sys::HostInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth_sys::HostInfo, D>,
> fidl::encoding::Encode<HostWatchStateResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostWatchStateResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HostWatchStateResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { info: fidl::new_empty!(fidl_fuchsia_bluetooth_sys::HostInfo, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_bluetooth_sys::HostInfo,
D,
&mut self.info,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ReceiverAddHostRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReceiverAddHostRequest {
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
}
}
unsafe impl
fidl::encoding::Encode<
ReceiverAddHostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ReceiverAddHostRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReceiverAddHostRequest>(offset);
fidl::encoding::Encode::<ReceiverAddHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ReceiverAddHostRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReceiverAddHostRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ReceiverAddHostRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
request: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HostMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl HostStartDiscoveryRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.token {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for HostStartDiscoveryRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostStartDiscoveryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
HostStartDiscoveryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HostStartDiscoveryRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostStartDiscoveryRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.token.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HostStartDiscoveryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverySessionMarker>,
> as fidl::encoding::TypeMarker>::inline_size(
decoder.context
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self.token.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<DiscoverySessionMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DiscoverySessionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
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);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BondingDelegateWatchBondsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BondingDelegateWatchBondsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BondingDelegateWatchBondsResponse, D>
for &BondingDelegateWatchBondsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BondingDelegateWatchBondsResponse>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
BondingDelegateWatchBondsResponse::Updated(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_bluetooth_sys::BondingData, D>(
<fidl_fuchsia_bluetooth_sys::BondingData as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
BondingDelegateWatchBondsResponse::Removed(ref val) => {
fidl::encoding::encode_in_envelope::<fidl_fuchsia_bluetooth::PeerId, D>(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
BondingDelegateWatchBondsResponse::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BondingDelegateWatchBondsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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 => <fidl_fuchsia_bluetooth_sys::BondingData as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl_fuchsia_bluetooth::PeerId 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 BondingDelegateWatchBondsResponse::Updated(_) = self {
} else {
*self = BondingDelegateWatchBondsResponse::Updated(fidl::new_empty!(
fidl_fuchsia_bluetooth_sys::BondingData,
D
));
}
#[allow(irrefutable_let_patterns)]
if let BondingDelegateWatchBondsResponse::Updated(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_bluetooth_sys::BondingData,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let BondingDelegateWatchBondsResponse::Removed(_) = self {
} else {
*self = BondingDelegateWatchBondsResponse::Removed(fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
D
));
}
#[allow(irrefutable_let_patterns)]
if let BondingDelegateWatchBondsResponse::Removed(ref mut val) = self {
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = BondingDelegateWatchBondsResponse::__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(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerWatcherGetNextResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerWatcherGetNextResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerWatcherGetNextResponse, D> for &PeerWatcherGetNextResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerWatcherGetNextResponse>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
PeerWatcherGetNextResponse::Updated(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::Peer>, D>(
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::Peer> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
PeerWatcherGetNextResponse::Removed(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>, D>(
<fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
PeerWatcherGetNextResponse::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerWatcherGetNextResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
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 => <fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::Peer> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId> 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 PeerWatcherGetNextResponse::Updated(_) = self {
} else {
*self = PeerWatcherGetNextResponse::Updated(fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::Peer>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let PeerWatcherGetNextResponse::Updated(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth_sys::Peer>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let PeerWatcherGetNextResponse::Removed(_) = self {
} else {
*self = PeerWatcherGetNextResponse::Removed(fidl::new_empty!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D
));
}
#[allow(irrefutable_let_patterns)]
if let PeerWatcherGetNextResponse::Removed(ref mut val) = self {
fidl::decode!(
fidl::encoding::UnboundedVector<fidl_fuchsia_bluetooth::PeerId>,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self =
PeerWatcherGetNextResponse::__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(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProtocolRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProtocolRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<ProtocolRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut ProtocolRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProtocolRequest>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ProtocolRequest::Central(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
ProtocolRequest::Peripheral(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
ProtocolRequest::GattServer(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
ProtocolRequest::Gatt2Server(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
ProtocolRequest::Profile(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
ProtocolRequest::PrivilegedPeripheral(ref mut val) => {
fidl::encoding::encode_in_envelope::<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
)
}
ProtocolRequest::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProtocolRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
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 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::CentralMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_le::PeripheralMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt::Server_Marker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_gatt2::Server_Marker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_bluetooth_bredr::ProfileMarker>,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6 => <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
>,
> 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 ProtocolRequest::Central(_) = self {
} else {
*self = ProtocolRequest::Central(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::CentralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Central(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::CentralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Peripheral(_) = self {
} else {
*self = ProtocolRequest::Peripheral(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PeripheralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Peripheral(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PeripheralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::GattServer(_) = self {
} else {
*self = ProtocolRequest::GattServer(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_gatt::Server_Marker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::GattServer(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_gatt::Server_Marker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Gatt2Server(_) = self {
} else {
*self = ProtocolRequest::Gatt2Server(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_gatt2::Server_Marker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Gatt2Server(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_gatt2::Server_Marker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Profile(_) = self {
} else {
*self = ProtocolRequest::Profile(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_bredr::ProfileMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::Profile(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_bredr::ProfileMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
6 => {
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::PrivilegedPeripheral(_) = self {
} else {
*self = ProtocolRequest::PrivilegedPeripheral(fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let ProtocolRequest::PrivilegedPeripheral(ref mut val) = self {
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_bluetooth_le::PrivilegedPeripheralMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ProtocolRequest::__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(())
}
}
}