#![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;
pub const MAX_PICONET_SIZE: u64 = 8;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum PeerError {
UnknownFailure = 1,
ProtocolError = 2,
}
impl PeerError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::UnknownFailure),
2 => Some(Self::ProtocolError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerManagerConnectedPeersResponse {
pub peer_ids: Vec<fidl_fuchsia_bluetooth::PeerId>,
}
impl fidl::Persistable for PeerManagerConnectedPeersResponse {}
#[derive(Debug, PartialEq)]
pub struct PeerManagerGetPeerRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PeerManagerGetPeerRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerManagerOnPeerConnectedRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
}
impl fidl::Persistable for PeerManagerOnPeerConnectedRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerControllerMarker;
impl fidl::endpoints::ProtocolMarker for PeerControllerMarker {
type Proxy = PeerControllerProxy;
type RequestStream = PeerControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) PeerController";
}
pub type PeerControllerSetConfigurationResult = Result<(), PeerError>;
pub type PeerControllerGetConfigurationResult = Result<(), PeerError>;
pub type PeerControllerSuspendStreamResult = Result<(), PeerError>;
pub type PeerControllerSuspendAndReconfigureResult = Result<(), PeerError>;
pub type PeerControllerEstablishStreamResult = Result<(), PeerError>;
pub type PeerControllerReleaseStreamResult = Result<(), PeerError>;
pub type PeerControllerAbortStreamResult = Result<(), PeerError>;
pub type PeerControllerStartStreamResult = Result<(), PeerError>;
pub type PeerControllerReconfigureStreamResult = Result<(), PeerError>;
pub type PeerControllerGetCapabilitiesResult = Result<(), PeerError>;
pub type PeerControllerGetAllCapabilitiesResult = Result<(), PeerError>;
pub trait PeerControllerProxyInterface: Send + Sync {
type SetConfigurationResponseFut: std::future::Future<Output = Result<PeerControllerSetConfigurationResult, fidl::Error>>
+ Send;
fn r#set_configuration(&self) -> Self::SetConfigurationResponseFut;
type GetConfigurationResponseFut: std::future::Future<Output = Result<PeerControllerGetConfigurationResult, fidl::Error>>
+ Send;
fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
type SuspendStreamResponseFut: std::future::Future<Output = Result<PeerControllerSuspendStreamResult, fidl::Error>>
+ Send;
fn r#suspend_stream(&self) -> Self::SuspendStreamResponseFut;
type SuspendAndReconfigureResponseFut: std::future::Future<Output = Result<PeerControllerSuspendAndReconfigureResult, fidl::Error>>
+ Send;
fn r#suspend_and_reconfigure(&self) -> Self::SuspendAndReconfigureResponseFut;
type EstablishStreamResponseFut: std::future::Future<Output = Result<PeerControllerEstablishStreamResult, fidl::Error>>
+ Send;
fn r#establish_stream(&self) -> Self::EstablishStreamResponseFut;
type ReleaseStreamResponseFut: std::future::Future<Output = Result<PeerControllerReleaseStreamResult, fidl::Error>>
+ Send;
fn r#release_stream(&self) -> Self::ReleaseStreamResponseFut;
type AbortStreamResponseFut: std::future::Future<Output = Result<PeerControllerAbortStreamResult, fidl::Error>>
+ Send;
fn r#abort_stream(&self) -> Self::AbortStreamResponseFut;
type StartStreamResponseFut: std::future::Future<Output = Result<PeerControllerStartStreamResult, fidl::Error>>
+ Send;
fn r#start_stream(&self) -> Self::StartStreamResponseFut;
type ReconfigureStreamResponseFut: std::future::Future<Output = Result<PeerControllerReconfigureStreamResult, fidl::Error>>
+ Send;
fn r#reconfigure_stream(&self) -> Self::ReconfigureStreamResponseFut;
type GetCapabilitiesResponseFut: std::future::Future<Output = Result<PeerControllerGetCapabilitiesResult, fidl::Error>>
+ Send;
fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
type GetAllCapabilitiesResponseFut: std::future::Future<Output = Result<PeerControllerGetAllCapabilitiesResult, fidl::Error>>
+ Send;
fn r#get_all_capabilities(&self) -> Self::GetAllCapabilitiesResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerControllerSynchronousProxy {
type Proxy = PeerControllerProxy;
type Protocol = PeerControllerMarker;
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 PeerControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerControllerMarker 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<PeerControllerEvent, fidl::Error> {
PeerControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_configuration(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerSetConfigurationResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x35f45144acf701ae,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_configuration(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerGetConfigurationResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x507eb0483e8d50d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#suspend_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerSuspendStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x43465c9341d472eb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#suspend_and_reconfigure(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerSuspendAndReconfigureResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x7ce8e3b693e20fe3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#establish_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerEstablishStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x438e16ccd91eb5e5,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#release_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerReleaseStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x4884104b373151c6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#abort_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerAbortStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0xf85b067ed144997,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#start_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerStartStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0xd0ead9aec2ebf77,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#reconfigure_stream(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerReconfigureStreamResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x559404d6a9629c60,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_capabilities(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerGetCapabilitiesResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x16884c07e6d969a7,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_all_capabilities(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<PeerControllerGetAllCapabilitiesResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
>(
(),
0x1e2c5b438e288cea,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PeerControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerControllerProxy {
type Protocol = PeerControllerMarker;
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 PeerControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerControllerEventStream {
PeerControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_configuration(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerSetConfigurationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#set_configuration(self)
}
pub fn r#get_configuration(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerGetConfigurationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#get_configuration(self)
}
pub fn r#suspend_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerSuspendStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#suspend_stream(self)
}
pub fn r#suspend_and_reconfigure(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerSuspendAndReconfigureResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#suspend_and_reconfigure(self)
}
pub fn r#establish_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerEstablishStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#establish_stream(self)
}
pub fn r#release_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerReleaseStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#release_stream(self)
}
pub fn r#abort_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerAbortStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#abort_stream(self)
}
pub fn r#start_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerStartStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#start_stream(self)
}
pub fn r#reconfigure_stream(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerReconfigureStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#reconfigure_stream(self)
}
pub fn r#get_capabilities(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerGetCapabilitiesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#get_capabilities(self)
}
pub fn r#get_all_capabilities(
&self,
) -> fidl::client::QueryResponseFut<
PeerControllerGetAllCapabilitiesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerControllerProxyInterface::r#get_all_capabilities(self)
}
}
impl PeerControllerProxyInterface for PeerControllerProxy {
type SetConfigurationResponseFut = fidl::client::QueryResponseFut<
PeerControllerSetConfigurationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_configuration(&self) -> Self::SetConfigurationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerSetConfigurationResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35f45144acf701ae,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerSetConfigurationResult,
>(
(),
0x35f45144acf701ae,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetConfigurationResponseFut = fidl::client::QueryResponseFut<
PeerControllerGetConfigurationResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerGetConfigurationResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x507eb0483e8d50d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerGetConfigurationResult,
>(
(),
0x507eb0483e8d50d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SuspendStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerSuspendStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#suspend_stream(&self) -> Self::SuspendStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerSuspendStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x43465c9341d472eb,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerSuspendStreamResult,
>(
(),
0x43465c9341d472eb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SuspendAndReconfigureResponseFut = fidl::client::QueryResponseFut<
PeerControllerSuspendAndReconfigureResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#suspend_and_reconfigure(&self) -> Self::SuspendAndReconfigureResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerSuspendAndReconfigureResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7ce8e3b693e20fe3,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerSuspendAndReconfigureResult,
>(
(),
0x7ce8e3b693e20fe3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type EstablishStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerEstablishStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#establish_stream(&self) -> Self::EstablishStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerEstablishStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x438e16ccd91eb5e5,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerEstablishStreamResult,
>(
(),
0x438e16ccd91eb5e5,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReleaseStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerReleaseStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#release_stream(&self) -> Self::ReleaseStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerReleaseStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4884104b373151c6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerReleaseStreamResult,
>(
(),
0x4884104b373151c6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AbortStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerAbortStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#abort_stream(&self) -> Self::AbortStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerAbortStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xf85b067ed144997,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, PeerControllerAbortStreamResult>(
(),
0xf85b067ed144997,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type StartStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerStartStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#start_stream(&self) -> Self::StartStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerStartStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xd0ead9aec2ebf77,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, PeerControllerStartStreamResult>(
(),
0xd0ead9aec2ebf77,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReconfigureStreamResponseFut = fidl::client::QueryResponseFut<
PeerControllerReconfigureStreamResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reconfigure_stream(&self) -> Self::ReconfigureStreamResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerReconfigureStreamResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x559404d6a9629c60,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerReconfigureStreamResult,
>(
(),
0x559404d6a9629c60,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetCapabilitiesResponseFut = fidl::client::QueryResponseFut<
PeerControllerGetCapabilitiesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerGetCapabilitiesResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x16884c07e6d969a7,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerGetCapabilitiesResult,
>(
(),
0x16884c07e6d969a7,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetAllCapabilitiesResponseFut = fidl::client::QueryResponseFut<
PeerControllerGetAllCapabilitiesResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_all_capabilities(&self) -> Self::GetAllCapabilitiesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerControllerGetAllCapabilitiesResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1e2c5b438e288cea,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
PeerControllerGetAllCapabilitiesResult,
>(
(),
0x1e2c5b438e288cea,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PeerControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerControllerEventStream {}
impl futures::stream::FusedStream for PeerControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerControllerEventStream {
type Item = Result<PeerControllerEvent, 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(PeerControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerControllerEvent {}
impl PeerControllerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerControllerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerControllerRequestStream {}
impl futures::stream::FusedStream for PeerControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerControllerRequestStream {
type Protocol = PeerControllerMarker;
type ControlHandle = PeerControllerControlHandle;
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 {
PeerControllerControlHandle { 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 PeerControllerRequestStream {
type Item = Result<PeerControllerRequest, 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 PeerControllerRequestStream 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 {
0x35f45144acf701ae => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::SetConfiguration {
responder: PeerControllerSetConfigurationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x507eb0483e8d50d => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::GetConfiguration {
responder: PeerControllerGetConfigurationResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x43465c9341d472eb => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::SuspendStream {
responder: PeerControllerSuspendStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7ce8e3b693e20fe3 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::SuspendAndReconfigure {
responder: PeerControllerSuspendAndReconfigureResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x438e16ccd91eb5e5 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::EstablishStream {
responder: PeerControllerEstablishStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4884104b373151c6 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::ReleaseStream {
responder: PeerControllerReleaseStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xf85b067ed144997 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::AbortStream {
responder: PeerControllerAbortStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xd0ead9aec2ebf77 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::StartStream {
responder: PeerControllerStartStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x559404d6a9629c60 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::ReconfigureStream {
responder: PeerControllerReconfigureStreamResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x16884c07e6d969a7 => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::GetCapabilities {
responder: PeerControllerGetCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1e2c5b438e288cea => {
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 =
PeerControllerControlHandle { inner: this.inner.clone() };
Ok(PeerControllerRequest::GetAllCapabilities {
responder: PeerControllerGetAllCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerControllerRequest {
SetConfiguration { responder: PeerControllerSetConfigurationResponder },
GetConfiguration { responder: PeerControllerGetConfigurationResponder },
SuspendStream { responder: PeerControllerSuspendStreamResponder },
SuspendAndReconfigure { responder: PeerControllerSuspendAndReconfigureResponder },
EstablishStream { responder: PeerControllerEstablishStreamResponder },
ReleaseStream { responder: PeerControllerReleaseStreamResponder },
AbortStream { responder: PeerControllerAbortStreamResponder },
StartStream { responder: PeerControllerStartStreamResponder },
ReconfigureStream { responder: PeerControllerReconfigureStreamResponder },
GetCapabilities { responder: PeerControllerGetCapabilitiesResponder },
GetAllCapabilities { responder: PeerControllerGetAllCapabilitiesResponder },
}
impl PeerControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_configuration(self) -> Option<(PeerControllerSetConfigurationResponder)> {
if let PeerControllerRequest::SetConfiguration { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_configuration(self) -> Option<(PeerControllerGetConfigurationResponder)> {
if let PeerControllerRequest::GetConfiguration { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_suspend_stream(self) -> Option<(PeerControllerSuspendStreamResponder)> {
if let PeerControllerRequest::SuspendStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_suspend_and_reconfigure(
self,
) -> Option<(PeerControllerSuspendAndReconfigureResponder)> {
if let PeerControllerRequest::SuspendAndReconfigure { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_establish_stream(self) -> Option<(PeerControllerEstablishStreamResponder)> {
if let PeerControllerRequest::EstablishStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_release_stream(self) -> Option<(PeerControllerReleaseStreamResponder)> {
if let PeerControllerRequest::ReleaseStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_abort_stream(self) -> Option<(PeerControllerAbortStreamResponder)> {
if let PeerControllerRequest::AbortStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_stream(self) -> Option<(PeerControllerStartStreamResponder)> {
if let PeerControllerRequest::StartStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reconfigure_stream(self) -> Option<(PeerControllerReconfigureStreamResponder)> {
if let PeerControllerRequest::ReconfigureStream { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_capabilities(self) -> Option<(PeerControllerGetCapabilitiesResponder)> {
if let PeerControllerRequest::GetCapabilities { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_all_capabilities(self) -> Option<(PeerControllerGetAllCapabilitiesResponder)> {
if let PeerControllerRequest::GetAllCapabilities { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerControllerRequest::SetConfiguration { .. } => "set_configuration",
PeerControllerRequest::GetConfiguration { .. } => "get_configuration",
PeerControllerRequest::SuspendStream { .. } => "suspend_stream",
PeerControllerRequest::SuspendAndReconfigure { .. } => "suspend_and_reconfigure",
PeerControllerRequest::EstablishStream { .. } => "establish_stream",
PeerControllerRequest::ReleaseStream { .. } => "release_stream",
PeerControllerRequest::AbortStream { .. } => "abort_stream",
PeerControllerRequest::StartStream { .. } => "start_stream",
PeerControllerRequest::ReconfigureStream { .. } => "reconfigure_stream",
PeerControllerRequest::GetCapabilities { .. } => "get_capabilities",
PeerControllerRequest::GetAllCapabilities { .. } => "get_all_capabilities",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerControllerControlHandle {
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 PeerControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerSetConfigurationResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerSetConfigurationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerSetConfigurationResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerSetConfigurationResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x35f45144acf701ae,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerGetConfigurationResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerGetConfigurationResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerGetConfigurationResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerGetConfigurationResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x507eb0483e8d50d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerSuspendStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerSuspendStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerSuspendStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerSuspendStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x43465c9341d472eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerSuspendAndReconfigureResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerSuspendAndReconfigureResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerSuspendAndReconfigureResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerSuspendAndReconfigureResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x7ce8e3b693e20fe3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerEstablishStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerEstablishStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerEstablishStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerEstablishStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x438e16ccd91eb5e5,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerReleaseStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerReleaseStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerReleaseStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerReleaseStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x4884104b373151c6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerAbortStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerAbortStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerAbortStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerAbortStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0xf85b067ed144997,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerStartStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerStartStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerStartStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerStartStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0xd0ead9aec2ebf77,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerReconfigureStreamResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerReconfigureStreamResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerReconfigureStreamResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerReconfigureStreamResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x559404d6a9629c60,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerGetCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerGetCapabilitiesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerGetCapabilitiesResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerGetCapabilitiesResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x16884c07e6d969a7,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerControllerGetAllCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop<PeerControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerControllerGetAllCapabilitiesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerControllerGetAllCapabilitiesResponder {
type ControlHandle = PeerControllerControlHandle;
fn control_handle(&self) -> &PeerControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerControllerGetAllCapabilitiesResponder {
pub fn send(self, mut result: Result<(), PeerError>) -> 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<(), PeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), PeerError>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PeerError>>(
result,
self.tx_id,
0x1e2c5b438e288cea,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerManagerMarker;
impl fidl::endpoints::ProtocolMarker for PeerManagerMarker {
type Proxy = PeerManagerProxy;
type RequestStream = PeerManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.avdtp.test.PeerManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for PeerManagerMarker {}
pub trait PeerManagerProxyInterface: Send + Sync {
fn r#get_peer(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
) -> Result<(), fidl::Error>;
type ConnectedPeersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error>>
+ Send;
fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerManagerSynchronousProxy {
type Proxy = PeerManagerProxy;
type Protocol = PeerManagerMarker;
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 PeerManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerManagerMarker 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<PeerManagerEvent, fidl::Error> {
PeerManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PeerManagerGetPeerRequest>(
(peer_id, handle),
0x2a506872f2b04086,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#connected_peers(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, PeerManagerConnectedPeersResponse>(
(),
0x1deaca0295d5f8d6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.peer_ids)
}
}
#[derive(Debug, Clone)]
pub struct PeerManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerManagerProxy {
type Protocol = PeerManagerMarker;
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 PeerManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerManagerEventStream {
PeerManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
) -> Result<(), fidl::Error> {
PeerManagerProxyInterface::r#get_peer(self, peer_id, handle)
}
pub fn r#connected_peers(
&self,
) -> fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_bluetooth::PeerId>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerManagerProxyInterface::r#connected_peers(self)
}
}
impl PeerManagerProxyInterface for PeerManagerProxy {
fn r#get_peer(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<PeerManagerGetPeerRequest>(
(peer_id, handle),
0x2a506872f2b04086,
fidl::encoding::DynamicFlags::empty(),
)
}
type ConnectedPeersResponseFut = fidl::client::QueryResponseFut<
Vec<fidl_fuchsia_bluetooth::PeerId>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connected_peers(&self) -> Self::ConnectedPeersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<fidl_fuchsia_bluetooth::PeerId>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
PeerManagerConnectedPeersResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1deaca0295d5f8d6,
>(_buf?)?;
Ok(_response.peer_ids)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
Vec<fidl_fuchsia_bluetooth::PeerId>,
>(
(),
0x1deaca0295d5f8d6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct PeerManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerManagerEventStream {}
impl futures::stream::FusedStream for PeerManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerManagerEventStream {
type Item = Result<PeerManagerEvent, 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(PeerManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerManagerEvent {
OnPeerConnected { peer_id: fidl_fuchsia_bluetooth::PeerId },
}
impl PeerManagerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_peer_connected(self) -> Option<fidl_fuchsia_bluetooth::PeerId> {
if let PeerManagerEvent::OnPeerConnected { peer_id } = self {
Some((peer_id))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerManagerEvent, 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 {
0x154e6b9e519774d1 => {
let mut out = fidl::new_empty!(
PeerManagerOnPeerConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerOnPeerConnectedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((PeerManagerEvent::OnPeerConnected { peer_id: out.peer_id }))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerManagerRequestStream {}
impl futures::stream::FusedStream for PeerManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerManagerRequestStream {
type Protocol = PeerManagerMarker;
type ControlHandle = PeerManagerControlHandle;
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 {
PeerManagerControlHandle { 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 PeerManagerRequestStream {
type Item = Result<PeerManagerRequest, 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 PeerManagerRequestStream 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 {
0x2a506872f2b04086 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PeerManagerGetPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerManagerGetPeerRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerManagerControlHandle { inner: this.inner.clone() };
Ok(PeerManagerRequest::GetPeer {
peer_id: req.peer_id,
handle: req.handle,
control_handle,
})
}
0x1deaca0295d5f8d6 => {
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 = PeerManagerControlHandle { inner: this.inner.clone() };
Ok(PeerManagerRequest::ConnectedPeers {
responder: PeerManagerConnectedPeersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<PeerManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerManagerRequest {
GetPeer {
peer_id: fidl_fuchsia_bluetooth::PeerId,
handle: fidl::endpoints::ServerEnd<PeerControllerMarker>,
control_handle: PeerManagerControlHandle,
},
ConnectedPeers { responder: PeerManagerConnectedPeersResponder },
}
impl PeerManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_peer(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
fidl::endpoints::ServerEnd<PeerControllerMarker>,
PeerManagerControlHandle,
)> {
if let PeerManagerRequest::GetPeer { peer_id, handle, control_handle } = self {
Some((peer_id, handle, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connected_peers(self) -> Option<(PeerManagerConnectedPeersResponder)> {
if let PeerManagerRequest::ConnectedPeers { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerManagerRequest::GetPeer { .. } => "get_peer",
PeerManagerRequest::ConnectedPeers { .. } => "connected_peers",
}
}
}
#[derive(Debug, Clone)]
pub struct PeerManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerManagerControlHandle {
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 PeerManagerControlHandle {
pub fn send_on_peer_connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
) -> Result<(), fidl::Error> {
self.inner.send::<PeerManagerOnPeerConnectedRequest>(
(peer_id,),
0,
0x154e6b9e519774d1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerManagerConnectedPeersResponder {
control_handle: std::mem::ManuallyDrop<PeerManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerManagerConnectedPeersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerManagerConnectedPeersResponder {
type ControlHandle = PeerManagerControlHandle;
fn control_handle(&self) -> &PeerManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerManagerConnectedPeersResponder {
pub fn send(self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
let _result = self.send_raw(peer_ids);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(peer_ids);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut peer_ids: &[fidl_fuchsia_bluetooth::PeerId]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<PeerManagerConnectedPeersResponse>(
(peer_ids,),
self.tx_id,
0x1deaca0295d5f8d6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for PeerError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for PeerError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PeerError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PeerError {
#[inline(always)]
fn new_empty() -> Self {
Self::UnknownFailure
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerManagerConnectedPeersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerManagerConnectedPeersResponse {
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<PeerManagerConnectedPeersResponse, D>
for &PeerManagerConnectedPeersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerManagerConnectedPeersResponse>(offset);
fidl::encoding::Encode::<PeerManagerConnectedPeersResponse, D>::encode(
(
<fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_ids),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, D>,
> fidl::encoding::Encode<PeerManagerConnectedPeersResponse, 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::<PeerManagerConnectedPeersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerManagerConnectedPeersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_ids: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, 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::Vector<fidl_fuchsia_bluetooth::PeerId, 8>, D, &mut self.peer_ids, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for PeerManagerGetPeerRequest {
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 PeerManagerGetPeerRequest {
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<
PeerManagerGetPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut PeerManagerGetPeerRequest
{
#[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::<PeerManagerGetPeerRequest>(offset);
fidl::encoding::Encode::<PeerManagerGetPeerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.handle),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
PeerManagerGetPeerRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerManagerGetPeerRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerManagerGetPeerRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
handle: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.handle,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerManagerOnPeerConnectedRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerManagerOnPeerConnectedRequest {
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<PeerManagerOnPeerConnectedRequest, D>
for &PeerManagerOnPeerConnectedRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerManagerOnPeerConnectedRequest>(offset);
fidl::encoding::Encode::<PeerManagerOnPeerConnectedRequest, D>::encode(
(<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.peer_id,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
> fidl::encoding::Encode<PeerManagerOnPeerConnectedRequest, 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::<PeerManagerOnPeerConnectedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerManagerOnPeerConnectedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { peer_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.peer_id,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
}