#![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 type ChannelMode = fidl_fuchsia_bluetooth::ChannelMode;
pub type ChannelParameters = fidl_fuchsia_bluetooth::ChannelParameters;
pub type ProtocolDescriptorList = Vec<ProtocolDescriptor>;
pub type RfcommChannel = u8;
pub const ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LIST: u16 = 13;
pub const ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST: u16 = 9;
pub const ATTR_BROWSE_GROUP_LIST: u16 = 5;
pub const ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST: u16 = 6;
pub const ATTR_PROTOCOL_DESCRIPTOR_LIST: u16 = 4;
pub const ATTR_SERVICE_AVAILABILITY: u16 = 8;
pub const ATTR_SERVICE_CLASS_ID_LIST: u16 = 1;
pub const ATTR_SERVICE_ID: u16 = 3;
pub const ATTR_SERVICE_INFO_TIME_TO_LIVE: u16 = 7;
pub const ATTR_SERVICE_RECORD_HANDLE: u16 = 0;
pub const ATTR_SERVICE_RECORD_STATE: u16 = 2;
pub const MAX_ADDITIONAL_ATTRIBUTES: u16 = 65023;
pub const MAX_ATTRIBUTES: u16 = 512;
pub const MAX_INFORMATION_COUNT: u8 = 85;
pub const MAX_SEQUENCE_LENGTH: u8 = 255;
pub const MAX_SERVICES_PER_ADVERTISEMENT: u8 = 32;
pub const MAX_STRING_LENGTH: u16 = 1024;
pub const PSM_3_DSP: u16 = 33;
pub const PSM_ATT: u16 = 31;
pub const PSM_AVCTP: u16 = 23;
pub const PSM_AVCTP_BROWSE: u16 = 27;
pub const PSM_AVDTP: u16 = 25;
pub const PSM_BNEP: u16 = 15;
pub const PSM_DYNAMIC: u16 = 65535;
pub const PSM_HID_CONTROL: u16 = 17;
pub const PSM_HID_INTERRUPT: u16 = 19;
pub const PSM_LE_IPSP: u16 = 35;
pub const PSM_OTS: u16 = 37;
pub const PSM_RFCOMM: u16 = 3;
pub const PSM_SDP: u16 = 1;
pub const PSM_TCSBIN: u16 = 5;
pub const PSM_TCSBIN_CORDLESS: u16 = 7;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum A2dpDirectionPriority {
Normal = 1,
Source = 2,
Sink = 3,
}
impl A2dpDirectionPriority {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Normal),
2 => Some(Self::Source),
3 => Some(Self::Sink),
_ => 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(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AudioBitsPerSample {
Bps16,
Bps24,
Bps32,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioBitsPerSampleUnknown {
() => {
_
};
}
impl AudioBitsPerSample {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Bps16),
2 => Some(Self::Bps24),
3 => Some(Self::Bps32),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Bps16,
2 => Self::Bps24,
3 => Self::Bps32,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Bps16 => 1,
Self::Bps24 => 2,
Self::Bps32 => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AudioChannelMode {
Mono,
Stereo,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioChannelModeUnknown {
() => {
_
};
}
impl AudioChannelMode {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Mono),
1 => Some(Self::Stereo),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Mono,
1 => Self::Stereo,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Mono => 0,
Self::Stereo => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AudioSamplingFrequency {
Hz44100,
Hz48000,
Hz88200,
Hz96000,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! AudioSamplingFrequencyUnknown {
() => {
_
};
}
impl AudioSamplingFrequency {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Hz44100),
2 => Some(Self::Hz48000),
3 => Some(Self::Hz88200),
4 => Some(Self::Hz96000),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Hz44100,
2 => Self::Hz48000,
3 => Self::Hz88200,
4 => Self::Hz96000,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Hz44100 => 1,
Self::Hz48000 => 2,
Self::Hz88200 => 3,
Self::Hz96000 => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum DataPath {
Host = 1,
Offload = 2,
Test = 3,
}
impl DataPath {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Host),
2 => Some(Self::Offload),
3 => Some(Self::Test),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum HfpParameterSet {
T1,
T2,
S1,
S2,
S3,
S4,
D0,
D1,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! HfpParameterSetUnknown {
() => {
_
};
}
impl HfpParameterSet {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::T1),
2 => Some(Self::T2),
3 => Some(Self::S1),
4 => Some(Self::S2),
5 => Some(Self::S3),
6 => Some(Self::S4),
7 => Some(Self::D0),
8 => Some(Self::D1),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::T1,
2 => Self::T2,
3 => Self::S1,
4 => Self::S2,
5 => Self::S3,
6 => Self::S4,
7 => Self::D0,
8 => Self::D1,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::T1 => 1,
Self::T2 => 2,
Self::S1 => 3,
Self::S2 => 4,
Self::S3 => 5,
Self::S4 => 6,
Self::D0 => 7,
Self::D1 => 8,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ProtocolIdentifier {
Sdp,
Rfcomm,
Att,
Obex,
Bnep,
Hidp,
HardcopyControlChannel,
HardcopyDataChannel,
HardcopyNotification,
Avctp,
Avdtp,
McapControlChannel,
McapDataChannel,
L2Cap,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ProtocolIdentifierUnknown {
() => {
_
};
}
impl ProtocolIdentifier {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
1 => Some(Self::Sdp),
3 => Some(Self::Rfcomm),
7 => Some(Self::Att),
8 => Some(Self::Obex),
15 => Some(Self::Bnep),
17 => Some(Self::Hidp),
18 => Some(Self::HardcopyControlChannel),
20 => Some(Self::HardcopyDataChannel),
22 => Some(Self::HardcopyNotification),
23 => Some(Self::Avctp),
25 => Some(Self::Avdtp),
30 => Some(Self::McapControlChannel),
31 => Some(Self::McapDataChannel),
256 => Some(Self::L2Cap),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
1 => Self::Sdp,
3 => Self::Rfcomm,
7 => Self::Att,
8 => Self::Obex,
15 => Self::Bnep,
17 => Self::Hidp,
18 => Self::HardcopyControlChannel,
20 => Self::HardcopyDataChannel,
22 => Self::HardcopyNotification,
23 => Self::Avctp,
25 => Self::Avdtp,
30 => Self::McapControlChannel,
31 => Self::McapDataChannel,
256 => Self::L2Cap,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffff }
}
#[inline]
pub const fn into_primitive(self) -> u16 {
match self {
Self::Sdp => 1,
Self::Rfcomm => 3,
Self::Att => 7,
Self::Obex => 8,
Self::Bnep => 15,
Self::Hidp => 17,
Self::HardcopyControlChannel => 18,
Self::HardcopyDataChannel => 20,
Self::HardcopyNotification => 22,
Self::Avctp => 23,
Self::Avdtp => 25,
Self::McapControlChannel => 30,
Self::McapDataChannel => 31,
Self::L2Cap => 256,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u8)]
pub enum RxPacketStatus {
CorrectlyReceivedData = 0,
PossiblyInvalidData = 1,
NoDataReceived = 2,
DataPartiallyLost = 3,
}
impl RxPacketStatus {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::CorrectlyReceivedData),
1 => Some(Self::PossiblyInvalidData),
2 => Some(Self::NoDataReceived),
3 => Some(Self::DataPartiallyLost),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u8 {
self as u8
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ScoErrorCode {
Failure,
Cancelled,
InvalidArguments,
ParametersRejected,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! ScoErrorCodeUnknown {
() => {
_
};
}
impl ScoErrorCode {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Failure),
2 => Some(Self::Cancelled),
3 => Some(Self::InvalidArguments),
4 => Some(Self::ParametersRejected),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Failure,
2 => Self::Cancelled,
3 => Self::InvalidArguments,
4 => Self::ParametersRejected,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Failure => 1,
Self::Cancelled => 2,
Self::InvalidArguments => 3,
Self::ParametersRejected => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ServiceClassProfileIdentifier {
SerialPort,
DialupNetworking,
ObexObjectPush,
OpexFileTransfer,
Headset,
HeadsetAudioGateway,
HeadsetHs,
AudioSource,
AudioSink,
AdvancedAudioDistribution,
AvRemoteControlTarget,
AvRemoteControl,
AvRemoteControlController,
Panu,
Nap,
Gn,
Handsfree,
HandsfreeAudioGateway,
HumanInterfaceDevice,
SimAccess,
PhonebookPce,
PhonebookPse,
Phonebook,
MessageAccessServer,
MessageNotificationServer,
MessageAccessProfile,
MpsProfile,
MpsClass,
PnpInformation,
GenericNetworking,
GenericFileTransfer,
GenericAudio,
GenericTelephony,
VideoSource,
VideoSink,
VideoDistribution,
Hdp,
HdpSource,
HdpSink,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ServiceClassProfileIdentifierUnknown {
() => {
_
};
}
impl ServiceClassProfileIdentifier {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
4353 => Some(Self::SerialPort),
4355 => Some(Self::DialupNetworking),
4357 => Some(Self::ObexObjectPush),
4358 => Some(Self::OpexFileTransfer),
4360 => Some(Self::Headset),
4370 => Some(Self::HeadsetAudioGateway),
4401 => Some(Self::HeadsetHs),
4362 => Some(Self::AudioSource),
4363 => Some(Self::AudioSink),
4365 => Some(Self::AdvancedAudioDistribution),
4364 => Some(Self::AvRemoteControlTarget),
4366 => Some(Self::AvRemoteControl),
4367 => Some(Self::AvRemoteControlController),
4373 => Some(Self::Panu),
4374 => Some(Self::Nap),
4375 => Some(Self::Gn),
4382 => Some(Self::Handsfree),
4383 => Some(Self::HandsfreeAudioGateway),
4388 => Some(Self::HumanInterfaceDevice),
4397 => Some(Self::SimAccess),
4398 => Some(Self::PhonebookPce),
4399 => Some(Self::PhonebookPse),
4400 => Some(Self::Phonebook),
4402 => Some(Self::MessageAccessServer),
4403 => Some(Self::MessageNotificationServer),
4404 => Some(Self::MessageAccessProfile),
4410 => Some(Self::MpsProfile),
4411 => Some(Self::MpsClass),
4608 => Some(Self::PnpInformation),
4609 => Some(Self::GenericNetworking),
4610 => Some(Self::GenericFileTransfer),
4611 => Some(Self::GenericAudio),
4612 => Some(Self::GenericTelephony),
4867 => Some(Self::VideoSource),
4868 => Some(Self::VideoSink),
4869 => Some(Self::VideoDistribution),
5120 => Some(Self::Hdp),
5121 => Some(Self::HdpSource),
5122 => Some(Self::HdpSink),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
4353 => Self::SerialPort,
4355 => Self::DialupNetworking,
4357 => Self::ObexObjectPush,
4358 => Self::OpexFileTransfer,
4360 => Self::Headset,
4370 => Self::HeadsetAudioGateway,
4401 => Self::HeadsetHs,
4362 => Self::AudioSource,
4363 => Self::AudioSink,
4365 => Self::AdvancedAudioDistribution,
4364 => Self::AvRemoteControlTarget,
4366 => Self::AvRemoteControl,
4367 => Self::AvRemoteControlController,
4373 => Self::Panu,
4374 => Self::Nap,
4375 => Self::Gn,
4382 => Self::Handsfree,
4383 => Self::HandsfreeAudioGateway,
4388 => Self::HumanInterfaceDevice,
4397 => Self::SimAccess,
4398 => Self::PhonebookPce,
4399 => Self::PhonebookPse,
4400 => Self::Phonebook,
4402 => Self::MessageAccessServer,
4403 => Self::MessageNotificationServer,
4404 => Self::MessageAccessProfile,
4410 => Self::MpsProfile,
4411 => Self::MpsClass,
4608 => Self::PnpInformation,
4609 => Self::GenericNetworking,
4610 => Self::GenericFileTransfer,
4611 => Self::GenericAudio,
4612 => Self::GenericTelephony,
4867 => Self::VideoSource,
4868 => Self::VideoSink,
4869 => Self::VideoDistribution,
5120 => Self::Hdp,
5121 => Self::HdpSource,
5122 => Self::HdpSink,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffff }
}
#[inline]
pub const fn into_primitive(self) -> u16 {
match self {
Self::SerialPort => 4353,
Self::DialupNetworking => 4355,
Self::ObexObjectPush => 4357,
Self::OpexFileTransfer => 4358,
Self::Headset => 4360,
Self::HeadsetAudioGateway => 4370,
Self::HeadsetHs => 4401,
Self::AudioSource => 4362,
Self::AudioSink => 4363,
Self::AdvancedAudioDistribution => 4365,
Self::AvRemoteControlTarget => 4364,
Self::AvRemoteControl => 4366,
Self::AvRemoteControlController => 4367,
Self::Panu => 4373,
Self::Nap => 4374,
Self::Gn => 4375,
Self::Handsfree => 4382,
Self::HandsfreeAudioGateway => 4383,
Self::HumanInterfaceDevice => 4388,
Self::SimAccess => 4397,
Self::PhonebookPce => 4398,
Self::PhonebookPse => 4399,
Self::Phonebook => 4400,
Self::MessageAccessServer => 4402,
Self::MessageNotificationServer => 4403,
Self::MessageAccessProfile => 4404,
Self::MpsProfile => 4410,
Self::MpsClass => 4411,
Self::PnpInformation => 4608,
Self::GenericNetworking => 4609,
Self::GenericFileTransfer => 4610,
Self::GenericAudio => 4611,
Self::GenericTelephony => 4612,
Self::VideoSource => 4867,
Self::VideoSink => 4868,
Self::VideoDistribution => 4869,
Self::Hdp => 5120,
Self::HdpSource => 5121,
Self::HdpSink => 5122,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AudioDirectionExtSetPriorityRequest {
pub priority: A2dpDirectionPriority,
}
impl fidl::Persistable for AudioDirectionExtSetPriorityRequest {}
#[derive(Debug, PartialEq)]
pub struct AudioOffloadExtStartAudioOffloadRequest {
pub configuration: AudioOffloadConfiguration,
pub controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioOffloadExtStartAudioOffloadRequest
{
}
#[derive(Debug, PartialEq)]
pub struct ConnectionReceiverConnectedRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub channel: Channel,
pub protocol: Vec<ProtocolDescriptor>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for ConnectionReceiverConnectedRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersRequest {
pub request: fidl_fuchsia_bluetooth::ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct L2capParametersExtRequestParametersResponse {
pub new: fidl_fuchsia_bluetooth::ChannelParameters,
}
impl fidl::Persistable for L2capParametersExtRequestParametersResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct ProfileConnectRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub connection: ConnectParameters,
}
impl fidl::Persistable for ProfileConnectRequest {}
#[derive(Debug, PartialEq)]
pub struct ProfileConnectResponse {
pub channel: Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct SearchResultsServiceFoundRequest {
pub peer_id: fidl_fuchsia_bluetooth::PeerId,
pub protocol: Option<Vec<ProtocolDescriptor>>,
pub attributes: Vec<Attribute>,
}
impl fidl::Persistable for SearchResultsServiceFoundRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Attribute {
pub id: Option<u16>,
pub element: Option<DataElement>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Attribute {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioAacSupport {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioAacSupport {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioOffloadConfiguration {
pub codec: Option<AudioOffloadFeatures>,
pub max_latency: Option<u16>,
pub scms_t_enable: Option<bool>,
pub sampling_frequency: Option<AudioSamplingFrequency>,
pub bits_per_sample: Option<AudioBitsPerSample>,
pub channel_mode: Option<AudioChannelMode>,
pub encoded_bit_rate: Option<u32>,
pub encoder_settings: Option<AudioEncoderSettings>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioOffloadConfiguration {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioOffloadExtGetSupportedFeaturesResponse {
pub audio_offload_features: Option<Vec<AudioOffloadFeatures>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioOffloadExtGetSupportedFeaturesResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AudioSbcSupport {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AudioSbcSupport {}
#[derive(Debug, Default, PartialEq)]
pub struct Channel {
pub socket: Option<fidl::Socket>,
pub channel_mode: Option<fidl_fuchsia_bluetooth::ChannelMode>,
pub max_tx_sdu_size: Option<u16>,
pub ext_direction: Option<fidl::endpoints::ClientEnd<AudioDirectionExtMarker>>,
pub flush_timeout: Option<i64>,
pub ext_l2cap: Option<fidl::endpoints::ClientEnd<L2capParametersExtMarker>>,
pub ext_audio_offload: Option<fidl::endpoints::ClientEnd<AudioOffloadExtMarker>>,
pub connection: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_bluetooth::ChannelMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Channel {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Information {
pub language: Option<String>,
pub name: Option<String>,
pub description: Option<String>,
pub provider: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Information {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct L2capParameters {
pub psm: Option<u16>,
pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for L2capParameters {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileAdvertiseRequest {
pub services: Option<Vec<ServiceDefinition>>,
pub receiver: Option<fidl::endpoints::ClientEnd<ConnectionReceiverMarker>>,
pub parameters: Option<fidl_fuchsia_bluetooth::ChannelParameters>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileAdvertiseRequest {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileConnectScoRequest {
pub peer_id: Option<fidl_fuchsia_bluetooth::PeerId>,
pub initiator: Option<bool>,
pub params: Option<Vec<ScoConnectionParameters>>,
pub connection: Option<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileConnectScoRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProfileDescriptor {
pub profile_id: Option<ServiceClassProfileIdentifier>,
pub major_version: Option<u8>,
pub minor_version: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProfileDescriptor {}
#[derive(Debug, Default, PartialEq)]
pub struct ProfileSearchRequest {
pub service_uuid: Option<ServiceClassProfileIdentifier>,
pub attr_ids: Option<Vec<u16>>,
pub results: Option<fidl::endpoints::ClientEnd<SearchResultsMarker>>,
pub full_uuid: Option<fidl_fuchsia_bluetooth::Uuid>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProfileSearchRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProfileAdvertiseResponse {
pub services: Option<Vec<ServiceDefinition>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProfileAdvertiseResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProtocolDescriptor {
pub protocol: Option<ProtocolIdentifier>,
pub params: Option<Vec<DataElement>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProtocolDescriptor {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RfcommParameters {
pub channel: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RfcommParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionParameters {
pub parameter_set: Option<HfpParameterSet>,
pub air_coding_format: Option<fidl_fuchsia_bluetooth::AssignedCodingFormat>,
pub air_frame_size: Option<u16>,
pub io_bandwidth: Option<u32>,
pub io_coding_format: Option<fidl_fuchsia_bluetooth::AssignedCodingFormat>,
pub io_frame_size: Option<u16>,
pub io_pcm_data_format: Option<fidl_fuchsia_hardware_audio::SampleFormat>,
pub io_pcm_sample_payload_msb_position: Option<u8>,
pub path: Option<DataPath>,
pub max_tx_data_size: Option<u16>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionWriteRequest {
pub data: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionWriteRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ScoConnectionReadResponse {
pub status_flag: Option<RxPacketStatus>,
pub data: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ScoConnectionReadResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ServiceDefinition {
pub service_class_uuids: Option<Vec<fidl_fuchsia_bluetooth::Uuid>>,
pub protocol_descriptor_list: Option<Vec<ProtocolDescriptor>>,
pub additional_protocol_descriptor_lists: Option<Vec<Vec<ProtocolDescriptor>>>,
pub profile_descriptors: Option<Vec<ProfileDescriptor>>,
pub information: Option<Vec<Information>>,
pub additional_attributes: Option<Vec<Attribute>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ServiceDefinition {}
#[derive(Clone, Debug)]
pub enum AudioEncoderSettings {
Sbc(fidl_fuchsia_media::SbcEncoderSettings),
Aac(fidl_fuchsia_media::AacEncoderSettings),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AudioEncoderSettingsUnknown {
() => {
_
};
}
impl PartialEq for AudioEncoderSettings {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Aac(x), Self::Aac(y)) => *x == *y,
_ => false,
}
}
}
impl AudioEncoderSettings {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Sbc(_) => 1,
Self::Aac(_) => 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 AudioEncoderSettings {}
#[derive(Clone, Debug)]
pub enum AudioOffloadFeatures {
Sbc(AudioSbcSupport),
Aac(AudioAacSupport),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! AudioOffloadFeaturesUnknown {
() => {
_
};
}
impl PartialEq for AudioOffloadFeatures {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Sbc(x), Self::Sbc(y)) => *x == *y,
(Self::Aac(x), Self::Aac(y)) => *x == *y,
_ => false,
}
}
}
impl AudioOffloadFeatures {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Sbc(_) => 1,
Self::Aac(_) => 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 AudioOffloadFeatures {}
#[derive(Clone, Debug, PartialEq)]
pub enum ConnectParameters {
L2cap(L2capParameters),
Rfcomm(RfcommParameters),
}
impl ConnectParameters {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::L2cap(_) => 1,
Self::Rfcomm(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for ConnectParameters {}
#[derive(Clone, Debug)]
pub enum DataElement {
Int8(i8),
Int16(i16),
Int32(i32),
Int64(i64),
Uint8(u8),
Uint16(u16),
Uint32(u32),
Uint64(u64),
Str(Vec<u8>),
Url(String),
Uuid(fidl_fuchsia_bluetooth::Uuid),
B(bool),
Sequence(Vec<Option<Box<DataElement>>>),
Alternatives(Vec<Option<Box<DataElement>>>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! DataElementUnknown {
() => {
_
};
}
impl PartialEq for DataElement {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Int8(x), Self::Int8(y)) => *x == *y,
(Self::Int16(x), Self::Int16(y)) => *x == *y,
(Self::Int32(x), Self::Int32(y)) => *x == *y,
(Self::Int64(x), Self::Int64(y)) => *x == *y,
(Self::Uint8(x), Self::Uint8(y)) => *x == *y,
(Self::Uint16(x), Self::Uint16(y)) => *x == *y,
(Self::Uint32(x), Self::Uint32(y)) => *x == *y,
(Self::Uint64(x), Self::Uint64(y)) => *x == *y,
(Self::Str(x), Self::Str(y)) => *x == *y,
(Self::Url(x), Self::Url(y)) => *x == *y,
(Self::Uuid(x), Self::Uuid(y)) => *x == *y,
(Self::B(x), Self::B(y)) => *x == *y,
(Self::Sequence(x), Self::Sequence(y)) => *x == *y,
(Self::Alternatives(x), Self::Alternatives(y)) => *x == *y,
_ => false,
}
}
}
impl DataElement {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Int8(_) => 1,
Self::Int16(_) => 2,
Self::Int32(_) => 3,
Self::Int64(_) => 4,
Self::Uint8(_) => 5,
Self::Uint16(_) => 6,
Self::Uint32(_) => 7,
Self::Uint64(_) => 8,
Self::Str(_) => 9,
Self::Url(_) => 10,
Self::Uuid(_) => 11,
Self::B(_) => 12,
Self::Sequence(_) => 13,
Self::Alternatives(_) => 14,
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 DataElement {}
#[derive(Clone, Debug)]
pub enum ScoConnectionOnConnectionCompleteRequest {
ConnectedParams(ScoConnectionParameters),
Error(ScoErrorCode),
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u64 },
}
#[macro_export]
macro_rules! ScoConnectionOnConnectionCompleteRequestUnknown {
() => {
_
};
}
impl PartialEq for ScoConnectionOnConnectionCompleteRequest {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::ConnectedParams(x), Self::ConnectedParams(y)) => *x == *y,
(Self::Error(x), Self::Error(y)) => *x == *y,
_ => false,
}
}
}
impl ScoConnectionOnConnectionCompleteRequest {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::ConnectedParams(_) => 1,
Self::Error(_) => 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 ScoConnectionOnConnectionCompleteRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioDirectionExtMarker;
impl fidl::endpoints::ProtocolMarker for AudioDirectionExtMarker {
type Proxy = AudioDirectionExtProxy;
type RequestStream = AudioDirectionExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioDirectionExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioDirectionExt";
}
pub type AudioDirectionExtSetPriorityResult = Result<(), fidl_fuchsia_bluetooth::ErrorCode>;
pub trait AudioDirectionExtProxyInterface: Send + Sync {
type SetPriorityResponseFut: std::future::Future<Output = Result<AudioDirectionExtSetPriorityResult, fidl::Error>>
+ Send;
fn r#set_priority(&self, priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioDirectionExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioDirectionExtSynchronousProxy {
type Proxy = AudioDirectionExtProxy;
type Protocol = AudioDirectionExtMarker;
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 AudioDirectionExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioDirectionExtMarker 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<AudioDirectionExtEvent, fidl::Error> {
AudioDirectionExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_priority(
&self,
mut priority: A2dpDirectionPriority,
___deadline: zx::MonotonicInstant,
) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
let _response = self
.client
.send_query::<AudioDirectionExtSetPriorityRequest, fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
(priority,),
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioDirectionExtMarker>("set_priority")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct AudioDirectionExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioDirectionExtProxy {
type Protocol = AudioDirectionExtMarker;
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 AudioDirectionExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioDirectionExtEventStream {
AudioDirectionExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_priority(
&self,
mut priority: A2dpDirectionPriority,
) -> fidl::client::QueryResponseFut<
AudioDirectionExtSetPriorityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioDirectionExtProxyInterface::r#set_priority(self, priority)
}
}
impl AudioDirectionExtProxyInterface for AudioDirectionExtProxy {
type SetPriorityResponseFut = fidl::client::QueryResponseFut<
AudioDirectionExtSetPriorityResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_priority(&self, mut priority: A2dpDirectionPriority) -> Self::SetPriorityResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AudioDirectionExtSetPriorityResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x792713ef3b2bc38a,
>(_buf?)?
.into_result::<AudioDirectionExtMarker>("set_priority")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
AudioDirectionExtSetPriorityRequest,
AudioDirectionExtSetPriorityResult,
>(
(priority,),
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct AudioDirectionExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioDirectionExtEventStream {}
impl futures::stream::FusedStream for AudioDirectionExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioDirectionExtEventStream {
type Item = Result<AudioDirectionExtEvent, 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(AudioDirectionExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioDirectionExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioDirectionExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioDirectionExtEvent, 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(AudioDirectionExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioDirectionExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioDirectionExtRequestStream {}
impl futures::stream::FusedStream for AudioDirectionExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioDirectionExtRequestStream {
type Protocol = AudioDirectionExtMarker;
type ControlHandle = AudioDirectionExtControlHandle;
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 {
AudioDirectionExtControlHandle { 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 AudioDirectionExtRequestStream {
type Item = Result<AudioDirectionExtRequest, 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 AudioDirectionExtRequestStream 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 {
0x792713ef3b2bc38a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
AudioDirectionExtSetPriorityRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioDirectionExtSetPriorityRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioDirectionExtControlHandle { inner: this.inner.clone() };
Ok(AudioDirectionExtRequest::SetPriority {
priority: req.priority,
responder: AudioDirectionExtSetPriorityResponder {
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(AudioDirectionExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioDirectionExtControlHandle {
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(AudioDirectionExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioDirectionExtControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioDirectionExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioDirectionExtRequest {
SetPriority {
priority: A2dpDirectionPriority,
responder: AudioDirectionExtSetPriorityResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioDirectionExtControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioDirectionExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_priority(
self,
) -> Option<(A2dpDirectionPriority, AudioDirectionExtSetPriorityResponder)> {
if let AudioDirectionExtRequest::SetPriority { priority, responder } = self {
Some((priority, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioDirectionExtRequest::SetPriority { .. } => "set_priority",
AudioDirectionExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioDirectionExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioDirectionExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioDirectionExtControlHandle {
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 AudioDirectionExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioDirectionExtSetPriorityResponder {
control_handle: std::mem::ManuallyDrop<AudioDirectionExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioDirectionExtSetPriorityResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioDirectionExtSetPriorityResponder {
type ControlHandle = AudioDirectionExtControlHandle;
fn control_handle(&self) -> &AudioDirectionExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioDirectionExtSetPriorityResponder {
pub fn send(
self,
mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
) -> 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::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x792713ef3b2bc38a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioOffloadControllerMarker;
impl fidl::endpoints::ProtocolMarker for AudioOffloadControllerMarker {
type Proxy = AudioOffloadControllerProxy;
type RequestStream = AudioOffloadControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioOffloadControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadController";
}
pub trait AudioOffloadControllerProxyInterface: Send + Sync {
type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#stop(&self) -> Self::StopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioOffloadControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioOffloadControllerSynchronousProxy {
type Proxy = AudioOffloadControllerProxy;
type Protocol = AudioOffloadControllerMarker;
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 AudioOffloadControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AudioOffloadControllerMarker 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<AudioOffloadControllerEvent, fidl::Error> {
AudioOffloadControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(),
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioOffloadControllerMarker>("stop")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioOffloadControllerProxy {
type Protocol = AudioOffloadControllerMarker;
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 AudioOffloadControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioOffloadControllerEventStream {
AudioOffloadControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#stop(
&self,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
AudioOffloadControllerProxyInterface::r#stop(self)
}
}
impl AudioOffloadControllerProxyInterface for AudioOffloadControllerProxy {
type StopResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#stop(&self) -> Self::StopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x37845d5a47ce5e39,
>(_buf?)?
.into_result::<AudioOffloadControllerMarker>("stop")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
(),
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct AudioOffloadControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioOffloadControllerEventStream {}
impl futures::stream::FusedStream for AudioOffloadControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioOffloadControllerEventStream {
type Item = Result<AudioOffloadControllerEvent, 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(AudioOffloadControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioOffloadControllerEvent {
OnStarted {},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioOffloadControllerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_started(self) -> Option<()> {
if let AudioOffloadControllerEvent::OnStarted {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioOffloadControllerEvent, 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 {
0x7b624f210570fc30 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((AudioOffloadControllerEvent::OnStarted {}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(AudioOffloadControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioOffloadControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioOffloadControllerRequestStream {}
impl futures::stream::FusedStream for AudioOffloadControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioOffloadControllerRequestStream {
type Protocol = AudioOffloadControllerMarker;
type ControlHandle = AudioOffloadControllerControlHandle;
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 {
AudioOffloadControllerControlHandle { 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 AudioOffloadControllerRequestStream {
type Item = Result<AudioOffloadControllerRequest, 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 AudioOffloadControllerRequestStream 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 {
0x37845d5a47ce5e39 => {
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 = AudioOffloadControllerControlHandle {
inner: this.inner.clone(),
};
Ok(AudioOffloadControllerRequest::Stop {
responder: AudioOffloadControllerStopResponder {
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(AudioOffloadControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadControllerControlHandle { 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(AudioOffloadControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadControllerControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AudioOffloadControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioOffloadControllerRequest {
Stop { responder: AudioOffloadControllerStopResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioOffloadControllerControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioOffloadControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(AudioOffloadControllerStopResponder)> {
if let AudioOffloadControllerRequest::Stop { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioOffloadControllerRequest::Stop { .. } => "stop",
AudioOffloadControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioOffloadControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioOffloadControllerControlHandle {
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 AudioOffloadControllerControlHandle {
pub fn send_on_started(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x7b624f210570fc30,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioOffloadControllerStopResponder {
control_handle: std::mem::ManuallyDrop<AudioOffloadControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioOffloadControllerStopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioOffloadControllerStopResponder {
type ControlHandle = AudioOffloadControllerControlHandle;
fn control_handle(&self) -> &AudioOffloadControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioOffloadControllerStopResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
fidl::encoding::Flexible::new(()),
self.tx_id,
0x37845d5a47ce5e39,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AudioOffloadExtMarker;
impl fidl::endpoints::ProtocolMarker for AudioOffloadExtMarker {
type Proxy = AudioOffloadExtProxy;
type RequestStream = AudioOffloadExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AudioOffloadExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AudioOffloadExt";
}
pub trait AudioOffloadExtProxyInterface: Send + Sync {
type GetSupportedFeaturesResponseFut: std::future::Future<
Output = Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error>,
> + Send;
fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut;
fn r#start_audio_offload(
&self,
configuration: &AudioOffloadConfiguration,
controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AudioOffloadExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AudioOffloadExtSynchronousProxy {
type Proxy = AudioOffloadExtProxy;
type Protocol = AudioOffloadExtMarker;
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 AudioOffloadExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <AudioOffloadExtMarker 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<AudioOffloadExtEvent, fidl::Error> {
AudioOffloadExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_supported_features(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
>(
(),
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<AudioOffloadExtMarker>("get_supported_features")?;
Ok(_response)
}
pub fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
(configuration, controller),
0x2172ac626202c1c9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AudioOffloadExtProxy {
type Protocol = AudioOffloadExtMarker;
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 AudioOffloadExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AudioOffloadExtEventStream {
AudioOffloadExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_supported_features(
&self,
) -> fidl::client::QueryResponseFut<
AudioOffloadExtGetSupportedFeaturesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AudioOffloadExtProxyInterface::r#get_supported_features(self)
}
pub fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
AudioOffloadExtProxyInterface::r#start_audio_offload(self, configuration, controller)
}
}
impl AudioOffloadExtProxyInterface for AudioOffloadExtProxy {
type GetSupportedFeaturesResponseFut = fidl::client::QueryResponseFut<
AudioOffloadExtGetSupportedFeaturesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_supported_features(&self) -> Self::GetSupportedFeaturesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AudioOffloadExtGetSupportedFeaturesResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<AudioOffloadExtGetSupportedFeaturesResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x44ab0b88dde41f94,
>(_buf?)?
.into_result::<AudioOffloadExtMarker>("get_supported_features")?;
Ok(_response)
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AudioOffloadExtGetSupportedFeaturesResponse,
>(
(),
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#start_audio_offload(
&self,
mut configuration: &AudioOffloadConfiguration,
mut controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<AudioOffloadExtStartAudioOffloadRequest>(
(configuration, controller),
0x2172ac626202c1c9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct AudioOffloadExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AudioOffloadExtEventStream {}
impl futures::stream::FusedStream for AudioOffloadExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AudioOffloadExtEventStream {
type Item = Result<AudioOffloadExtEvent, 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(AudioOffloadExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AudioOffloadExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl AudioOffloadExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AudioOffloadExtEvent, 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(AudioOffloadExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AudioOffloadExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AudioOffloadExtRequestStream {}
impl futures::stream::FusedStream for AudioOffloadExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AudioOffloadExtRequestStream {
type Protocol = AudioOffloadExtMarker;
type ControlHandle = AudioOffloadExtControlHandle;
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 {
AudioOffloadExtControlHandle { 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 AudioOffloadExtRequestStream {
type Item = Result<AudioOffloadExtRequest, 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 AudioOffloadExtRequestStream 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 {
0x44ab0b88dde41f94 => {
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 =
AudioOffloadExtControlHandle { inner: this.inner.clone() };
Ok(AudioOffloadExtRequest::GetSupportedFeatures {
responder: AudioOffloadExtGetSupportedFeaturesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2172ac626202c1c9 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AudioOffloadExtStartAudioOffloadRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
AudioOffloadExtControlHandle { inner: this.inner.clone() };
Ok(AudioOffloadExtRequest::StartAudioOffload {
configuration: req.configuration,
controller: req.controller,
control_handle,
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(AudioOffloadExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadExtControlHandle {
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(AudioOffloadExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: AudioOffloadExtControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<AudioOffloadExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AudioOffloadExtRequest {
GetSupportedFeatures { responder: AudioOffloadExtGetSupportedFeaturesResponder },
StartAudioOffload {
configuration: AudioOffloadConfiguration,
controller: fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
control_handle: AudioOffloadExtControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: AudioOffloadExtControlHandle,
method_type: fidl::MethodType,
},
}
impl AudioOffloadExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_supported_features(
self,
) -> Option<(AudioOffloadExtGetSupportedFeaturesResponder)> {
if let AudioOffloadExtRequest::GetSupportedFeatures { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_start_audio_offload(
self,
) -> Option<(
AudioOffloadConfiguration,
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
AudioOffloadExtControlHandle,
)> {
if let AudioOffloadExtRequest::StartAudioOffload {
configuration,
controller,
control_handle,
} = self
{
Some((configuration, controller, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AudioOffloadExtRequest::GetSupportedFeatures { .. } => "get_supported_features",
AudioOffloadExtRequest::StartAudioOffload { .. } => "start_audio_offload",
AudioOffloadExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
AudioOffloadExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct AudioOffloadExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AudioOffloadExtControlHandle {
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 AudioOffloadExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AudioOffloadExtGetSupportedFeaturesResponder {
control_handle: std::mem::ManuallyDrop<AudioOffloadExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AudioOffloadExtGetSupportedFeaturesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AudioOffloadExtGetSupportedFeaturesResponder {
type ControlHandle = AudioOffloadExtControlHandle;
fn control_handle(&self) -> &AudioOffloadExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AudioOffloadExtGetSupportedFeaturesResponder {
pub fn send(
self,
mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> 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: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut payload: &AudioOffloadExtGetSupportedFeaturesResponse,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
AudioOffloadExtGetSupportedFeaturesResponse,
>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x44ab0b88dde41f94,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ConnectionReceiverMarker;
impl fidl::endpoints::ProtocolMarker for ConnectionReceiverMarker {
type Proxy = ConnectionReceiverProxy;
type RequestStream = ConnectionReceiverRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ConnectionReceiverSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ConnectionReceiver";
}
pub trait ConnectionReceiverProxyInterface: Send + Sync {
fn r#connected(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
channel: Channel,
protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ConnectionReceiverSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ConnectionReceiverSynchronousProxy {
type Proxy = ConnectionReceiverProxy;
type Protocol = ConnectionReceiverMarker;
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 ConnectionReceiverSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<ConnectionReceiverMarker 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<ConnectionReceiverEvent, fidl::Error> {
ConnectionReceiverEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
self.client.send::<ConnectionReceiverConnectedRequest>(
(peer_id, &mut channel, protocol),
0xa5251eebbccf928,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ConnectionReceiverProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ConnectionReceiverProxy {
type Protocol = ConnectionReceiverMarker;
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 ConnectionReceiverProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ConnectionReceiverEventStream {
ConnectionReceiverEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
ConnectionReceiverProxyInterface::r#connected(self, peer_id, channel, protocol)
}
}
impl ConnectionReceiverProxyInterface for ConnectionReceiverProxy {
fn r#connected(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut channel: Channel,
mut protocol: &[ProtocolDescriptor],
) -> Result<(), fidl::Error> {
self.client.send::<ConnectionReceiverConnectedRequest>(
(peer_id, &mut channel, protocol),
0xa5251eebbccf928,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ConnectionReceiverEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ConnectionReceiverEventStream {}
impl futures::stream::FusedStream for ConnectionReceiverEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ConnectionReceiverEventStream {
type Item = Result<ConnectionReceiverEvent, 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(ConnectionReceiverEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ConnectionReceiverEvent {
OnRevoke {},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ConnectionReceiverEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_revoke(self) -> Option<()> {
if let ConnectionReceiverEvent::OnRevoke {} = self {
Some(())
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ConnectionReceiverEvent, 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 {
0x9b35c093a0468d1 => {
let mut out = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ConnectionReceiverEvent::OnRevoke {}))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ConnectionReceiverEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ConnectionReceiverRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ConnectionReceiverRequestStream {}
impl futures::stream::FusedStream for ConnectionReceiverRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ConnectionReceiverRequestStream {
type Protocol = ConnectionReceiverMarker;
type ControlHandle = ConnectionReceiverControlHandle;
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 {
ConnectionReceiverControlHandle { 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 ConnectionReceiverRequestStream {
type Item = Result<ConnectionReceiverRequest, 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 ConnectionReceiverRequestStream 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 {
0xa5251eebbccf928 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectionReceiverConnectedRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ConnectionReceiverControlHandle {
inner: this.inner.clone(),
};
Ok(ConnectionReceiverRequest::Connected {peer_id: req.peer_id,
channel: req.channel,
protocol: req.protocol,
control_handle,
})
}
_ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ConnectionReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ConnectionReceiverControlHandle { 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(ConnectionReceiverRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ConnectionReceiverControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <ConnectionReceiverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ConnectionReceiverRequest {
Connected {
peer_id: fidl_fuchsia_bluetooth::PeerId,
channel: Channel,
protocol: Vec<ProtocolDescriptor>,
control_handle: ConnectionReceiverControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ConnectionReceiverControlHandle,
method_type: fidl::MethodType,
},
}
impl ConnectionReceiverRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_connected(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Channel,
Vec<ProtocolDescriptor>,
ConnectionReceiverControlHandle,
)> {
if let ConnectionReceiverRequest::Connected { peer_id, channel, protocol, control_handle } =
self
{
Some((peer_id, channel, protocol, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ConnectionReceiverRequest::Connected { .. } => "connected",
ConnectionReceiverRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
ConnectionReceiverRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ConnectionReceiverControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ConnectionReceiverControlHandle {
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 ConnectionReceiverControlHandle {
pub fn send_on_revoke(&self) -> Result<(), fidl::Error> {
self.inner.send::<fidl::encoding::EmptyPayload>(
(),
0,
0x9b35c093a0468d1,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct L2capParametersExtMarker;
impl fidl::endpoints::ProtocolMarker for L2capParametersExtMarker {
type Proxy = L2capParametersExtProxy;
type RequestStream = L2capParametersExtRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = L2capParametersExtSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) L2capParametersExt";
}
pub trait L2capParametersExtProxyInterface: Send + Sync {
type RequestParametersResponseFut: std::future::Future<Output = Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error>>
+ Send;
fn r#request_parameters(
&self,
request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Self::RequestParametersResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct L2capParametersExtSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for L2capParametersExtSynchronousProxy {
type Proxy = L2capParametersExtProxy;
type Protocol = L2capParametersExtMarker;
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 L2capParametersExtSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<L2capParametersExtMarker 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<L2capParametersExtEvent, fidl::Error> {
L2capParametersExtEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
___deadline: zx::MonotonicInstant,
) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
let _response = self.client.send_query::<
L2capParametersExtRequestParametersRequest,
fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
>(
(request,),
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<L2capParametersExtMarker>("request_parameters")?;
Ok(_response.new)
}
}
#[derive(Debug, Clone)]
pub struct L2capParametersExtProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for L2capParametersExtProxy {
type Protocol = L2capParametersExtMarker;
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 L2capParametersExtProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> L2capParametersExtEventStream {
L2capParametersExtEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
L2capParametersExtProxyInterface::r#request_parameters(self, request)
}
}
impl L2capParametersExtProxyInterface for L2capParametersExtProxy {
type RequestParametersResponseFut = fidl::client::QueryResponseFut<
fidl_fuchsia_bluetooth::ChannelParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#request_parameters(
&self,
mut request: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Self::RequestParametersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<fidl_fuchsia_bluetooth::ChannelParameters, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<L2capParametersExtRequestParametersResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1da4d8f268e2e918,
>(_buf?)?
.into_result::<L2capParametersExtMarker>("request_parameters")?;
Ok(_response.new)
}
self.client.send_query_and_decode::<
L2capParametersExtRequestParametersRequest,
fidl_fuchsia_bluetooth::ChannelParameters,
>(
(request,),
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct L2capParametersExtEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for L2capParametersExtEventStream {}
impl futures::stream::FusedStream for L2capParametersExtEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for L2capParametersExtEventStream {
type Item = Result<L2capParametersExtEvent, 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(L2capParametersExtEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum L2capParametersExtEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl L2capParametersExtEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<L2capParametersExtEvent, 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(L2capParametersExtEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct L2capParametersExtRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for L2capParametersExtRequestStream {}
impl futures::stream::FusedStream for L2capParametersExtRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for L2capParametersExtRequestStream {
type Protocol = L2capParametersExtMarker;
type ControlHandle = L2capParametersExtControlHandle;
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 {
L2capParametersExtControlHandle { 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 L2capParametersExtRequestStream {
type Item = Result<L2capParametersExtRequest, 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 L2capParametersExtRequestStream 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 {
0x1da4d8f268e2e918 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(L2capParametersExtRequestParametersRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<L2capParametersExtRequestParametersRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = L2capParametersExtControlHandle {
inner: this.inner.clone(),
};
Ok(L2capParametersExtRequest::RequestParameters {request: req.request,
responder: L2capParametersExtRequestParametersResponder {
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(L2capParametersExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: L2capParametersExtControlHandle { 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(L2capParametersExtRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: L2capParametersExtControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <L2capParametersExtMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum L2capParametersExtRequest {
RequestParameters {
request: fidl_fuchsia_bluetooth::ChannelParameters,
responder: L2capParametersExtRequestParametersResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: L2capParametersExtControlHandle,
method_type: fidl::MethodType,
},
}
impl L2capParametersExtRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_request_parameters(
self,
) -> Option<(
fidl_fuchsia_bluetooth::ChannelParameters,
L2capParametersExtRequestParametersResponder,
)> {
if let L2capParametersExtRequest::RequestParameters { request, responder } = self {
Some((request, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
L2capParametersExtRequest::RequestParameters { .. } => "request_parameters",
L2capParametersExtRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
L2capParametersExtRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct L2capParametersExtControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for L2capParametersExtControlHandle {
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 L2capParametersExtControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct L2capParametersExtRequestParametersResponder {
control_handle: std::mem::ManuallyDrop<L2capParametersExtControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for L2capParametersExtRequestParametersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for L2capParametersExtRequestParametersResponder {
type ControlHandle = L2capParametersExtControlHandle;
fn control_handle(&self) -> &L2capParametersExtControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl L2capParametersExtRequestParametersResponder {
pub fn send(
self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(new);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(new);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut new: &fidl_fuchsia_bluetooth::ChannelParameters,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
L2capParametersExtRequestParametersResponse,
>>(
fidl::encoding::Flexible::new((new,)),
self.tx_id,
0x1da4d8f268e2e918,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProfileMarker;
impl fidl::endpoints::ProtocolMarker for ProfileMarker {
type Proxy = ProfileProxy;
type RequestStream = ProfileRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProfileSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.bluetooth.bredr.Profile";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProfileMarker {}
pub type ProfileAdvertiseResult =
Result<ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>;
pub type ProfileConnectResult = Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>;
pub trait ProfileProxyInterface: Send + Sync {
type AdvertiseResponseFut: std::future::Future<Output = Result<ProfileAdvertiseResult, fidl::Error>>
+ Send;
fn r#advertise(&self, payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut;
fn r#search(&self, payload: ProfileSearchRequest) -> Result<(), fidl::Error>;
type ConnectResponseFut: std::future::Future<Output = Result<ProfileConnectResult, fidl::Error>>
+ Send;
fn r#connect(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
connection: &ConnectParameters,
) -> Self::ConnectResponseFut;
fn r#connect_sco(&self, payload: ProfileConnectScoRequest) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProfileSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProfileSynchronousProxy {
type Proxy = ProfileProxy;
type Protocol = ProfileMarker;
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 ProfileSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProfileMarker 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<ProfileEvent, fidl::Error> {
ProfileEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#advertise(
&self,
mut payload: ProfileAdvertiseRequest,
___deadline: zx::MonotonicInstant,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = self
.client
.send_query::<ProfileAdvertiseRequest, fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
&mut payload,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ProfileMarker>("advertise")?;
Ok(_response.map(|x| x))
}
pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileSearchRequest>(
&mut payload,
0x2c59d8580bc8ef0a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
___deadline: zx::MonotonicInstant,
) -> Result<ProfileConnectResult, fidl::Error> {
let _response = self
.client
.send_query::<ProfileConnectRequest, fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
(peer_id, connection),
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ProfileMarker>("connect")?;
Ok(_response.map(|x| x.channel))
}
pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileConnectScoRequest>(
&mut payload,
0x961976ddd116ee6,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct ProfileProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProfileProxy {
type Protocol = ProfileMarker;
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 ProfileProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProfileEventStream {
ProfileEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#advertise(
&self,
mut payload: ProfileAdvertiseRequest,
) -> fidl::client::QueryResponseFut<
ProfileAdvertiseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProxyInterface::r#advertise(self, payload)
}
pub fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
ProfileProxyInterface::r#search(self, payload)
}
pub fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
) -> fidl::client::QueryResponseFut<
ProfileConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProfileProxyInterface::r#connect(self, peer_id, connection)
}
pub fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
ProfileProxyInterface::r#connect_sco(self, payload)
}
}
impl ProfileProxyInterface for ProfileProxy {
type AdvertiseResponseFut = fidl::client::QueryResponseFut<
ProfileAdvertiseResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#advertise(&self, mut payload: ProfileAdvertiseRequest) -> Self::AdvertiseResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProfileAdvertiseResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x65e429c1f0205a0e,
>(_buf?)?
.into_result::<ProfileMarker>("advertise")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<ProfileAdvertiseRequest, ProfileAdvertiseResult>(
&mut payload,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#search(&self, mut payload: ProfileSearchRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileSearchRequest>(
&mut payload,
0x2c59d8580bc8ef0a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type ConnectResponseFut = fidl::client::QueryResponseFut<
ProfileConnectResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#connect(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut connection: &ConnectParameters,
) -> Self::ConnectResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProfileConnectResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xaaeefc898901fb3,
>(_buf?)?
.into_result::<ProfileMarker>("connect")?;
Ok(_response.map(|x| x.channel))
}
self.client.send_query_and_decode::<ProfileConnectRequest, ProfileConnectResult>(
(peer_id, connection),
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#connect_sco(&self, mut payload: ProfileConnectScoRequest) -> Result<(), fidl::Error> {
self.client.send::<ProfileConnectScoRequest>(
&mut payload,
0x961976ddd116ee6,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct ProfileEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProfileEventStream {}
impl futures::stream::FusedStream for ProfileEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProfileEventStream {
type Item = Result<ProfileEvent, 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(ProfileEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProfileEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ProfileEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProfileEvent, 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(ProfileEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProfileRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProfileRequestStream {}
impl futures::stream::FusedStream for ProfileRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProfileRequestStream {
type Protocol = ProfileMarker;
type ControlHandle = ProfileControlHandle;
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 {
ProfileControlHandle { 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 ProfileRequestStream {
type Item = Result<ProfileRequest, 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 ProfileRequestStream 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 {
0x65e429c1f0205a0e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileAdvertiseRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileAdvertiseRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Advertise {
payload: req,
responder: ProfileAdvertiseResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2c59d8580bc8ef0a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProfileSearchRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileSearchRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Search { payload: req, control_handle })
}
0xaaeefc898901fb3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProfileConnectRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::Connect {
peer_id: req.peer_id,
connection: req.connection,
responder: ProfileConnectResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x961976ddd116ee6 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
ProfileConnectScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProfileConnectScoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProfileControlHandle { inner: this.inner.clone() };
Ok(ProfileRequest::ConnectSco { payload: req, control_handle })
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(ProfileRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ProfileControlHandle { 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(ProfileRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ProfileControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProfileMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProfileRequest {
Advertise { payload: ProfileAdvertiseRequest, responder: ProfileAdvertiseResponder },
Search { payload: ProfileSearchRequest, control_handle: ProfileControlHandle },
Connect {
peer_id: fidl_fuchsia_bluetooth::PeerId,
connection: ConnectParameters,
responder: ProfileConnectResponder,
},
ConnectSco { payload: ProfileConnectScoRequest, control_handle: ProfileControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ProfileControlHandle,
method_type: fidl::MethodType,
},
}
impl ProfileRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_advertise(self) -> Option<(ProfileAdvertiseRequest, ProfileAdvertiseResponder)> {
if let ProfileRequest::Advertise { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_search(self) -> Option<(ProfileSearchRequest, ProfileControlHandle)> {
if let ProfileRequest::Search { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect(
self,
) -> Option<(fidl_fuchsia_bluetooth::PeerId, ConnectParameters, ProfileConnectResponder)> {
if let ProfileRequest::Connect { peer_id, connection, responder } = self {
Some((peer_id, connection, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_connect_sco(self) -> Option<(ProfileConnectScoRequest, ProfileControlHandle)> {
if let ProfileRequest::ConnectSco { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProfileRequest::Advertise { .. } => "advertise",
ProfileRequest::Search { .. } => "search",
ProfileRequest::Connect { .. } => "connect",
ProfileRequest::ConnectSco { .. } => "connect_sco",
ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
ProfileRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct ProfileControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProfileControlHandle {
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 ProfileControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileAdvertiseResponder {
control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileAdvertiseResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileAdvertiseResponder {
type ControlHandle = ProfileControlHandle;
fn control_handle(&self) -> &ProfileControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileAdvertiseResponder {
pub fn send(
self,
mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> 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<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&ProfileAdvertiseResponse, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ProfileAdvertiseResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x65e429c1f0205a0e,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProfileConnectResponder {
control_handle: std::mem::ManuallyDrop<ProfileControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProfileConnectResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProfileConnectResponder {
type ControlHandle = ProfileControlHandle;
fn control_handle(&self) -> &ProfileControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProfileConnectResponder {
pub fn send(
self,
mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> 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<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<Channel, fidl_fuchsia_bluetooth::ErrorCode>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
ProfileConnectResponse,
fidl_fuchsia_bluetooth::ErrorCode,
>>(
fidl::encoding::FlexibleResult::new(
result.as_mut().map_err(|e| *e).map(|channel| (channel,)),
),
self.tx_id,
0xaaeefc898901fb3,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ScoConnectionMarker;
impl fidl::endpoints::ProtocolMarker for ScoConnectionMarker {
type Proxy = ScoConnectionProxy;
type RequestStream = ScoConnectionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ScoConnectionSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) ScoConnection";
}
pub trait ScoConnectionProxyInterface: Send + Sync {
type ReadResponseFut: std::future::Future<Output = Result<ScoConnectionReadResponse, fidl::Error>>
+ Send;
fn r#read(&self) -> Self::ReadResponseFut;
type WriteResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#write(&self, payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ScoConnectionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ScoConnectionSynchronousProxy {
type Proxy = ScoConnectionProxy;
type Protocol = ScoConnectionMarker;
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 ScoConnectionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ScoConnectionMarker 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<ScoConnectionEvent, fidl::Error> {
ScoConnectionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#read(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ScoConnectionReadResponse, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ScoConnectionMarker>("read")?;
Ok(_response)
}
pub fn r#write(
&self,
mut payload: &ScoConnectionWriteRequest,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
ScoConnectionWriteRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
payload,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ScoConnectionMarker>("write")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ScoConnectionProxy {
type Protocol = ScoConnectionMarker;
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 ScoConnectionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ScoConnectionEventStream {
ScoConnectionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#read(
&self,
) -> fidl::client::QueryResponseFut<
ScoConnectionReadResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ScoConnectionProxyInterface::r#read(self)
}
pub fn r#write(
&self,
mut payload: &ScoConnectionWriteRequest,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ScoConnectionProxyInterface::r#write(self, payload)
}
}
impl ScoConnectionProxyInterface for ScoConnectionProxy {
type ReadResponseFut = fidl::client::QueryResponseFut<
ScoConnectionReadResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read(&self) -> Self::ReadResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ScoConnectionReadResponse, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ScoConnectionReadResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6fb29eb1e16ac616,
>(_buf?)?
.into_result::<ScoConnectionMarker>("read")?;
Ok(_response)
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, ScoConnectionReadResponse>(
(),
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WriteResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#write(&self, mut payload: &ScoConnectionWriteRequest) -> Self::WriteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x394e1b2ff7f4a5a9,
>(_buf?)?
.into_result::<ScoConnectionMarker>("write")?;
Ok(_response)
}
self.client.send_query_and_decode::<ScoConnectionWriteRequest, ()>(
payload,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct ScoConnectionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ScoConnectionEventStream {}
impl futures::stream::FusedStream for ScoConnectionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ScoConnectionEventStream {
type Item = Result<ScoConnectionEvent, 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(ScoConnectionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ScoConnectionEvent {
OnConnectionComplete {
payload: ScoConnectionOnConnectionCompleteRequest,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ScoConnectionEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_connection_complete(self) -> Option<ScoConnectionOnConnectionCompleteRequest> {
if let ScoConnectionEvent::OnConnectionComplete { payload } = self {
Some((payload))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ScoConnectionEvent, 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 {
0x193aa06408ba384d => {
let mut out = fidl::new_empty!(
ScoConnectionOnConnectionCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionOnConnectionCompleteRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ScoConnectionEvent::OnConnectionComplete { payload: out }))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(ScoConnectionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ScoConnectionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ScoConnectionRequestStream {}
impl futures::stream::FusedStream for ScoConnectionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ScoConnectionRequestStream {
type Protocol = ScoConnectionMarker;
type ControlHandle = ScoConnectionControlHandle;
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 {
ScoConnectionControlHandle { 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 ScoConnectionRequestStream {
type Item = Result<ScoConnectionRequest, 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 ScoConnectionRequestStream 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 {
0x6fb29eb1e16ac616 => {
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 =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Read {
responder: ScoConnectionReadResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x394e1b2ff7f4a5a9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ScoConnectionWriteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoConnectionWriteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Write {
payload: req,
responder: ScoConnectionWriteResponder {
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(ScoConnectionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ScoConnectionControlHandle {
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(ScoConnectionRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: ScoConnectionControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ScoConnectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ScoConnectionRequest {
Read { responder: ScoConnectionReadResponder },
Write { payload: ScoConnectionWriteRequest, responder: ScoConnectionWriteResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ScoConnectionControlHandle,
method_type: fidl::MethodType,
},
}
impl ScoConnectionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_read(self) -> Option<(ScoConnectionReadResponder)> {
if let ScoConnectionRequest::Read { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write(self) -> Option<(ScoConnectionWriteRequest, ScoConnectionWriteResponder)> {
if let ScoConnectionRequest::Write { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ScoConnectionRequest::Read { .. } => "read",
ScoConnectionRequest::Write { .. } => "write",
ScoConnectionRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
ScoConnectionRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct ScoConnectionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ScoConnectionControlHandle {
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 ScoConnectionControlHandle {
pub fn send_on_connection_complete(
&self,
mut payload: &ScoConnectionOnConnectionCompleteRequest,
) -> Result<(), fidl::Error> {
self.inner.send::<ScoConnectionOnConnectionCompleteRequest>(
payload,
0,
0x193aa06408ba384d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ScoConnectionReadResponder {
control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ScoConnectionReadResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ScoConnectionReadResponder {
type ControlHandle = ScoConnectionControlHandle;
fn control_handle(&self) -> &ScoConnectionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ScoConnectionReadResponder {
pub fn send(self, mut payload: &ScoConnectionReadResponse) -> 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: &ScoConnectionReadResponse,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &ScoConnectionReadResponse) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<ScoConnectionReadResponse>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x6fb29eb1e16ac616,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ScoConnectionWriteResponder {
control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ScoConnectionWriteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ScoConnectionWriteResponder {
type ControlHandle = ScoConnectionControlHandle;
fn control_handle(&self) -> &ScoConnectionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ScoConnectionWriteResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
fidl::encoding::Flexible::new(()),
self.tx_id,
0x394e1b2ff7f4a5a9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SearchResultsMarker;
impl fidl::endpoints::ProtocolMarker for SearchResultsMarker {
type Proxy = SearchResultsProxy;
type RequestStream = SearchResultsRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SearchResultsSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) SearchResults";
}
pub trait SearchResultsProxyInterface: Send + Sync {
type ServiceFoundResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#service_found(
&self,
peer_id: &fidl_fuchsia_bluetooth::PeerId,
protocol: Option<&[ProtocolDescriptor]>,
attributes: &[Attribute],
) -> Self::ServiceFoundResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SearchResultsSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SearchResultsSynchronousProxy {
type Proxy = SearchResultsProxy;
type Protocol = SearchResultsMarker;
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 SearchResultsSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SearchResultsMarker 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<SearchResultsEvent, fidl::Error> {
SearchResultsEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
SearchResultsServiceFoundRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(peer_id, protocol, attributes,),
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<SearchResultsMarker>("service_found")?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct SearchResultsProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SearchResultsProxy {
type Protocol = SearchResultsMarker;
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 SearchResultsProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SearchResultsEventStream {
SearchResultsEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
SearchResultsProxyInterface::r#service_found(self, peer_id, protocol, attributes)
}
}
impl SearchResultsProxyInterface for SearchResultsProxy {
type ServiceFoundResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#service_found(
&self,
mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
mut protocol: Option<&[ProtocolDescriptor]>,
mut attributes: &[Attribute],
) -> Self::ServiceFoundResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x526509a842ebd43c,
>(_buf?)?
.into_result::<SearchResultsMarker>("service_found")?;
Ok(_response)
}
self.client.send_query_and_decode::<SearchResultsServiceFoundRequest, ()>(
(peer_id, protocol, attributes),
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct SearchResultsEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SearchResultsEventStream {}
impl futures::stream::FusedStream for SearchResultsEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SearchResultsEventStream {
type Item = Result<SearchResultsEvent, 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(SearchResultsEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SearchResultsEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SearchResultsEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SearchResultsEvent, 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(SearchResultsEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SearchResultsRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SearchResultsRequestStream {}
impl futures::stream::FusedStream for SearchResultsRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SearchResultsRequestStream {
type Protocol = SearchResultsMarker;
type ControlHandle = SearchResultsControlHandle;
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 {
SearchResultsControlHandle { 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 SearchResultsRequestStream {
type Item = Result<SearchResultsRequest, 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 SearchResultsRequestStream 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 {
0x526509a842ebd43c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SearchResultsServiceFoundRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SearchResultsServiceFoundRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
SearchResultsControlHandle { inner: this.inner.clone() };
Ok(SearchResultsRequest::ServiceFound {
peer_id: req.peer_id,
protocol: req.protocol,
attributes: req.attributes,
responder: SearchResultsServiceFoundResponder {
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(SearchResultsRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SearchResultsControlHandle {
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(SearchResultsRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SearchResultsControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<SearchResultsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SearchResultsRequest {
ServiceFound {
peer_id: fidl_fuchsia_bluetooth::PeerId,
protocol: Option<Vec<ProtocolDescriptor>>,
attributes: Vec<Attribute>,
responder: SearchResultsServiceFoundResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SearchResultsControlHandle,
method_type: fidl::MethodType,
},
}
impl SearchResultsRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_service_found(
self,
) -> Option<(
fidl_fuchsia_bluetooth::PeerId,
Option<Vec<ProtocolDescriptor>>,
Vec<Attribute>,
SearchResultsServiceFoundResponder,
)> {
if let SearchResultsRequest::ServiceFound { peer_id, protocol, attributes, responder } =
self
{
Some((peer_id, protocol, attributes, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SearchResultsRequest::ServiceFound { .. } => "service_found",
SearchResultsRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
SearchResultsRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct SearchResultsControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SearchResultsControlHandle {
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 SearchResultsControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct SearchResultsServiceFoundResponder {
control_handle: std::mem::ManuallyDrop<SearchResultsControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for SearchResultsServiceFoundResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for SearchResultsServiceFoundResponder {
type ControlHandle = SearchResultsControlHandle;
fn control_handle(&self) -> &SearchResultsControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl SearchResultsServiceFoundResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
fidl::encoding::Flexible::new(()),
self.tx_id,
0x526509a842ebd43c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for A2dpDirectionPriority {
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 A2dpDirectionPriority {
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 A2dpDirectionPriority
{
#[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 A2dpDirectionPriority {
#[inline(always)]
fn new_empty() -> Self {
Self::Normal
}
#[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(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioBitsPerSample {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioBitsPerSample {
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 AudioBitsPerSample
{
#[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 AudioBitsPerSample {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioChannelMode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioChannelMode {
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 AudioChannelMode
{
#[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 AudioChannelMode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for AudioSamplingFrequency {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AudioSamplingFrequency {
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 AudioSamplingFrequency
{
#[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 AudioSamplingFrequency
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for DataPath {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for DataPath {
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 DataPath {
#[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 DataPath {
#[inline(always)]
fn new_empty() -> Self {
Self::Host
}
#[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::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HfpParameterSet {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for HfpParameterSet {
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 HfpParameterSet
{
#[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 HfpParameterSet {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ProtocolIdentifier {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u16>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u16>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ProtocolIdentifier {
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 ProtocolIdentifier
{
#[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 ProtocolIdentifier {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RxPacketStatus {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for RxPacketStatus {
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 RxPacketStatus {
#[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 RxPacketStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::CorrectlyReceivedData
}
#[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::<u8>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ScoErrorCode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoErrorCode {
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 ScoErrorCode {
#[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 ScoErrorCode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ServiceClassProfileIdentifier {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u16>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u16>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ServiceClassProfileIdentifier {
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 ServiceClassProfileIdentifier
{
#[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 ServiceClassProfileIdentifier
{
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AudioDirectionExtSetPriorityRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioDirectionExtSetPriorityRequest {
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<AudioDirectionExtSetPriorityRequest, D>
for &AudioDirectionExtSetPriorityRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioDirectionExtSetPriorityRequest>(offset);
fidl::encoding::Encode::<AudioDirectionExtSetPriorityRequest, D>::encode(
(<A2dpDirectionPriority as fidl::encoding::ValueTypeMarker>::borrow(
&self.priority,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<A2dpDirectionPriority, D>,
> fidl::encoding::Encode<AudioDirectionExtSetPriorityRequest, 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::<AudioDirectionExtSetPriorityRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AudioDirectionExtSetPriorityRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { priority: fidl::new_empty!(A2dpDirectionPriority, 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!(
A2dpDirectionPriority,
D,
&mut self.priority,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AudioOffloadExtStartAudioOffloadRequest {
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 AudioOffloadExtStartAudioOffloadRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AudioOffloadExtStartAudioOffloadRequest
{
#[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::<AudioOffloadExtStartAudioOffloadRequest>(offset);
fidl::encoding::Encode::<
AudioOffloadExtStartAudioOffloadRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<AudioOffloadConfiguration as fidl::encoding::ValueTypeMarker>::borrow(
&self.configuration,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.controller
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AudioOffloadExtStartAudioOffloadRequest,
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::<AudioOffloadExtStartAudioOffloadRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AudioOffloadExtStartAudioOffloadRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
configuration: fidl::new_empty!(
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect
),
controller: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>,
>,
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(16) };
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 + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
AudioOffloadConfiguration,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.configuration,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AudioOffloadControllerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.controller,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ConnectionReceiverConnectedRequest {
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 ConnectionReceiverConnectedRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
ConnectionReceiverConnectedRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ConnectionReceiverConnectedRequest
{
#[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::<ConnectionReceiverConnectedRequest>(offset);
fidl::encoding::Encode::<ConnectionReceiverConnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
<fidl::encoding::Vector<ProtocolDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<
fidl::encoding::Vector<ProtocolDescriptor, 255>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
ConnectionReceiverConnectedRequest,
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::<ConnectionReceiverConnectedRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ConnectionReceiverConnectedRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(
fidl_fuchsia_bluetooth::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect
),
channel: fidl::new_empty!(Channel, fidl::encoding::DefaultFuchsiaResourceDialect),
protocol: fidl::new_empty!(fidl::encoding::Vector<ProtocolDescriptor, 255>, 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::PeerId,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.peer_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
Channel,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<ProtocolDescriptor, 255>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.protocol, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for L2capParametersExtRequestParametersRequest {
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<L2capParametersExtRequestParametersRequest, D>
for &L2capParametersExtRequestParametersRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersRequest>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.request),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::ChannelParameters, D>,
> fidl::encoding::Encode<L2capParametersExtRequestParametersRequest, 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::<L2capParametersExtRequestParametersRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for L2capParametersExtRequestParametersRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { request: fidl::new_empty!(fidl_fuchsia_bluetooth::ChannelParameters, 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::ChannelParameters,
D,
&mut self.request,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for L2capParametersExtRequestParametersResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for L2capParametersExtRequestParametersResponse {
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<L2capParametersExtRequestParametersResponse, D>
for &L2capParametersExtRequestParametersResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<L2capParametersExtRequestParametersResponse>(offset);
fidl::encoding::Encode::<L2capParametersExtRequestParametersResponse, D>::encode(
(
<fidl_fuchsia_bluetooth::ChannelParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.new),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::ChannelParameters, D>,
> fidl::encoding::Encode<L2capParametersExtRequestParametersResponse, 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::<L2capParametersExtRequestParametersResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for L2capParametersExtRequestParametersResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { new: fidl::new_empty!(fidl_fuchsia_bluetooth::ChannelParameters, 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::ChannelParameters,
D,
&mut self.new,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProfileConnectRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProfileConnectRequest {
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<ProfileConnectRequest, D>
for &ProfileConnectRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProfileConnectRequest>(offset);
fidl::encoding::Encode::<ProfileConnectRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(
&self.peer_id,
),
<ConnectParameters as fidl::encoding::ValueTypeMarker>::borrow(
&self.connection,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<ConnectParameters, D>,
> fidl::encoding::Encode<ProfileConnectRequest, 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::<ProfileConnectRequest>(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 ProfileConnectRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
connection: fidl::new_empty!(ConnectParameters, 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
)?;
fidl::decode!(ConnectParameters, D, &mut self.connection, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for ProfileConnectResponse {
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 ProfileConnectResponse {
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<
ProfileConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut ProfileConnectResponse
{
#[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::<ProfileConnectResponse>(offset);
fidl::encoding::Encode::<
ProfileConnectResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<Channel as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Channel, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<
ProfileConnectResponse,
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::<ProfileConnectResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for ProfileConnectResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(Channel, 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!(
Channel,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SearchResultsServiceFoundRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SearchResultsServiceFoundRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SearchResultsServiceFoundRequest, D>
for &SearchResultsServiceFoundRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SearchResultsServiceFoundRequest>(offset);
fidl::encoding::Encode::<SearchResultsServiceFoundRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::PeerId as fidl::encoding::ValueTypeMarker>::borrow(&self.peer_id),
<fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>> as fidl::encoding::ValueTypeMarker>::borrow(&self.protocol),
<fidl::encoding::Vector<Attribute, 512> as fidl::encoding::ValueTypeMarker>::borrow(&self.attributes),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::PeerId, D>,
T1: fidl::encoding::Encode<
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D,
>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<Attribute, 512>, D>,
> fidl::encoding::Encode<SearchResultsServiceFoundRequest, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SearchResultsServiceFoundRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SearchResultsServiceFoundRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
peer_id: fidl::new_empty!(fidl_fuchsia_bluetooth::PeerId, D),
protocol: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D
),
attributes: fidl::new_empty!(fidl::encoding::Vector<Attribute, 512>, 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
)?;
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::Vector<ProtocolDescriptor, 255>>,
D,
&mut self.protocol,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(fidl::encoding::Vector<Attribute, 512>, D, &mut self.attributes, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl Attribute {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.element {
return 2;
}
if let Some(_) = self.id {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Attribute {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Attribute {
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<Attribute, D>
for &Attribute
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Attribute>(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::<u16, D>(
self.id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<DataElement, D>(
self.element.as_ref().map(<DataElement as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Attribute {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
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 =
<u16 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.id.get_or_insert_with(|| fidl::new_empty!(u16, D));
fidl::decode!(u16, D, 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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
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 =
<DataElement 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.element.get_or_insert_with(|| fidl::new_empty!(DataElement, D));
fidl::decode!(DataElement, D, 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 AudioAacSupport {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for AudioAacSupport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AudioAacSupport {
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<AudioAacSupport, D>
for &AudioAacSupport
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AudioAacSupport>(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;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioAacSupport {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
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);
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;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}