#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const ACL_PACKET_MAX: u64 = 65539;
pub const BT_VENDOR_MAX_COMMAND_BUFFER_LEN: u16 = 16;
pub const COMMAND_MAX: u64 = 258;
pub const EVENT_MAX: u64 = 257;
pub const ISO_PACKET_MAX: u64 = 16387;
pub const MAX_LEGACY_ADVERTISING_DATA_LENGTH: u8 = 31;
pub const MAX_LOCAL_NAME_LENGTH: u8 = 248;
pub const MAX_NAME_LENGTH: u32 = 32;
pub const MAX_PEER_SERVICES: u8 = 32;
pub const SCO_PACKET_MAX: u64 = 258;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ConnectionState {
Connected,
Disconnected,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! ConnectionStateUnknown {
() => {
_
};
}
impl ConnectionState {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Connected),
2 => Some(Self::Disconnected),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Connected,
2 => Self::Disconnected,
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::Connected => 1,
Self::Disconnected => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum EmulatorError {
Failed,
HciAlreadyPublished,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! EmulatorErrorUnknown {
() => {
_
};
}
impl EmulatorError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Failed),
2 => Some(Self::HciAlreadyPublished),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Failed,
2 => Self::HciAlreadyPublished,
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::Failed => 1,
Self::HciAlreadyPublished => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum EmulatorPeerError {
AddressRepeated,
ParametersInvalid,
NotFound,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! EmulatorPeerErrorUnknown {
() => {
_
};
}
impl EmulatorPeerError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::AddressRepeated),
2 => Some(Self::ParametersInvalid),
3 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::AddressRepeated,
2 => Self::ParametersInvalid,
3 => Self::NotFound,
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::AddressRepeated => 1,
Self::ParametersInvalid => 2,
Self::NotFound => 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 HciConfig {
DualMode,
LeOnly,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! HciConfigUnknown {
() => {
_
};
}
impl HciConfig {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::DualMode),
2 => Some(Self::LeOnly),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::DualMode,
2 => Self::LeOnly,
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::DualMode => 1,
Self::LeOnly => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum HciError {
Success,
UnknownCommand,
UnknownConnectionId,
HardwareFailure,
PageTimeout,
AuthenticationFailure,
PinOrKeyMissing,
MemoryCapacityExceeded,
ConnectionTimeout,
ConnectionLimitExceeded,
SynchronousConnectionLimitExceeded,
ConnectionAlreadyExists,
CommandDisallowed,
ConnectionRejectedLimitedResources,
ConnectionRejectedSecurity,
ConnectionRejectedBadBdAddr,
ConnectionAcceptTimeoutExceeded,
UnsupportedFeatureOrParameter,
InvalidHcicommandParameters,
RemoteUserTerminatedConnection,
RemoteDeviceTerminatedConnectionLowResources,
RemoteDeviceTerminatedConnectionPowerOff,
ConnectionTerminatedByLocalHost,
RepeatedAttempts,
PairingNotAllowed,
UnknownLmpPdu,
UnsupportedRemoteFeature,
ScoOffsetRejected,
ScoIntervalRejected,
ScoAirModeRejected,
InvalidLmpOrLlParameters,
UnspecifiedError,
UnsupportedLmpOrLlParameterValue,
RoleChangeNotAllowed,
LmpOrLlResponseTimeout,
LmpErrorTransactionCollision,
LmpPduNotAllowed,
EncryptionModeNotAcceptable,
LinkKeyCannotBeChanged,
RequestedQosNotSupported,
InstantPassed,
PairingWithUnitKeyNotSupported,
DifferentTransactionCollision,
Reserved0,
QosUnacceptableParameter,
QosRejected,
ChannelClassificationNotSupported,
InsufficientSecurity,
ParameterOutOfMandatoryRange,
Reserved1,
RoleSwitchPending,
Reserved2,
ReservedSlotViolation,
RoleSwitchFailed,
ExtendedInquiryResponseTooLarge,
SecureSimplePairingNotSupportedByHost,
HostBusyPairing,
ConnectionRejectedNoSuitableChannelFound,
ControllerBusy,
UnacceptableConnectionParameters,
DirectedAdvertisingTimeout,
ConnectionTerminatedMicFailure,
ConnectionFailedToBeEstablished,
MacConnectionFailed,
CoarseClockAdjustmentRejected,
Type0SubmapNotDefined,
UnknownAdvertisingIdentifier,
LimitReached,
OperationCancelledByHost,
PacketTooLong,
TooLate,
TooEarly,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! HciErrorUnknown {
() => {
_
};
}
impl HciError {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Success),
1 => Some(Self::UnknownCommand),
2 => Some(Self::UnknownConnectionId),
3 => Some(Self::HardwareFailure),
4 => Some(Self::PageTimeout),
5 => Some(Self::AuthenticationFailure),
6 => Some(Self::PinOrKeyMissing),
7 => Some(Self::MemoryCapacityExceeded),
8 => Some(Self::ConnectionTimeout),
9 => Some(Self::ConnectionLimitExceeded),
10 => Some(Self::SynchronousConnectionLimitExceeded),
11 => Some(Self::ConnectionAlreadyExists),
12 => Some(Self::CommandDisallowed),
13 => Some(Self::ConnectionRejectedLimitedResources),
14 => Some(Self::ConnectionRejectedSecurity),
15 => Some(Self::ConnectionRejectedBadBdAddr),
16 => Some(Self::ConnectionAcceptTimeoutExceeded),
17 => Some(Self::UnsupportedFeatureOrParameter),
18 => Some(Self::InvalidHcicommandParameters),
19 => Some(Self::RemoteUserTerminatedConnection),
20 => Some(Self::RemoteDeviceTerminatedConnectionLowResources),
21 => Some(Self::RemoteDeviceTerminatedConnectionPowerOff),
22 => Some(Self::ConnectionTerminatedByLocalHost),
23 => Some(Self::RepeatedAttempts),
24 => Some(Self::PairingNotAllowed),
25 => Some(Self::UnknownLmpPdu),
26 => Some(Self::UnsupportedRemoteFeature),
27 => Some(Self::ScoOffsetRejected),
28 => Some(Self::ScoIntervalRejected),
29 => Some(Self::ScoAirModeRejected),
30 => Some(Self::InvalidLmpOrLlParameters),
31 => Some(Self::UnspecifiedError),
32 => Some(Self::UnsupportedLmpOrLlParameterValue),
33 => Some(Self::RoleChangeNotAllowed),
34 => Some(Self::LmpOrLlResponseTimeout),
35 => Some(Self::LmpErrorTransactionCollision),
36 => Some(Self::LmpPduNotAllowed),
37 => Some(Self::EncryptionModeNotAcceptable),
38 => Some(Self::LinkKeyCannotBeChanged),
39 => Some(Self::RequestedQosNotSupported),
40 => Some(Self::InstantPassed),
41 => Some(Self::PairingWithUnitKeyNotSupported),
42 => Some(Self::DifferentTransactionCollision),
43 => Some(Self::Reserved0),
44 => Some(Self::QosUnacceptableParameter),
45 => Some(Self::QosRejected),
46 => Some(Self::ChannelClassificationNotSupported),
47 => Some(Self::InsufficientSecurity),
48 => Some(Self::ParameterOutOfMandatoryRange),
49 => Some(Self::Reserved1),
50 => Some(Self::RoleSwitchPending),
51 => Some(Self::Reserved2),
52 => Some(Self::ReservedSlotViolation),
53 => Some(Self::RoleSwitchFailed),
54 => Some(Self::ExtendedInquiryResponseTooLarge),
55 => Some(Self::SecureSimplePairingNotSupportedByHost),
56 => Some(Self::HostBusyPairing),
57 => Some(Self::ConnectionRejectedNoSuitableChannelFound),
58 => Some(Self::ControllerBusy),
59 => Some(Self::UnacceptableConnectionParameters),
60 => Some(Self::DirectedAdvertisingTimeout),
61 => Some(Self::ConnectionTerminatedMicFailure),
62 => Some(Self::ConnectionFailedToBeEstablished),
63 => Some(Self::MacConnectionFailed),
64 => Some(Self::CoarseClockAdjustmentRejected),
65 => Some(Self::Type0SubmapNotDefined),
66 => Some(Self::UnknownAdvertisingIdentifier),
67 => Some(Self::LimitReached),
68 => Some(Self::OperationCancelledByHost),
69 => Some(Self::PacketTooLong),
70 => Some(Self::TooLate),
71 => Some(Self::TooEarly),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Success,
1 => Self::UnknownCommand,
2 => Self::UnknownConnectionId,
3 => Self::HardwareFailure,
4 => Self::PageTimeout,
5 => Self::AuthenticationFailure,
6 => Self::PinOrKeyMissing,
7 => Self::MemoryCapacityExceeded,
8 => Self::ConnectionTimeout,
9 => Self::ConnectionLimitExceeded,
10 => Self::SynchronousConnectionLimitExceeded,
11 => Self::ConnectionAlreadyExists,
12 => Self::CommandDisallowed,
13 => Self::ConnectionRejectedLimitedResources,
14 => Self::ConnectionRejectedSecurity,
15 => Self::ConnectionRejectedBadBdAddr,
16 => Self::ConnectionAcceptTimeoutExceeded,
17 => Self::UnsupportedFeatureOrParameter,
18 => Self::InvalidHcicommandParameters,
19 => Self::RemoteUserTerminatedConnection,
20 => Self::RemoteDeviceTerminatedConnectionLowResources,
21 => Self::RemoteDeviceTerminatedConnectionPowerOff,
22 => Self::ConnectionTerminatedByLocalHost,
23 => Self::RepeatedAttempts,
24 => Self::PairingNotAllowed,
25 => Self::UnknownLmpPdu,
26 => Self::UnsupportedRemoteFeature,
27 => Self::ScoOffsetRejected,
28 => Self::ScoIntervalRejected,
29 => Self::ScoAirModeRejected,
30 => Self::InvalidLmpOrLlParameters,
31 => Self::UnspecifiedError,
32 => Self::UnsupportedLmpOrLlParameterValue,
33 => Self::RoleChangeNotAllowed,
34 => Self::LmpOrLlResponseTimeout,
35 => Self::LmpErrorTransactionCollision,
36 => Self::LmpPduNotAllowed,
37 => Self::EncryptionModeNotAcceptable,
38 => Self::LinkKeyCannotBeChanged,
39 => Self::RequestedQosNotSupported,
40 => Self::InstantPassed,
41 => Self::PairingWithUnitKeyNotSupported,
42 => Self::DifferentTransactionCollision,
43 => Self::Reserved0,
44 => Self::QosUnacceptableParameter,
45 => Self::QosRejected,
46 => Self::ChannelClassificationNotSupported,
47 => Self::InsufficientSecurity,
48 => Self::ParameterOutOfMandatoryRange,
49 => Self::Reserved1,
50 => Self::RoleSwitchPending,
51 => Self::Reserved2,
52 => Self::ReservedSlotViolation,
53 => Self::RoleSwitchFailed,
54 => Self::ExtendedInquiryResponseTooLarge,
55 => Self::SecureSimplePairingNotSupportedByHost,
56 => Self::HostBusyPairing,
57 => Self::ConnectionRejectedNoSuitableChannelFound,
58 => Self::ControllerBusy,
59 => Self::UnacceptableConnectionParameters,
60 => Self::DirectedAdvertisingTimeout,
61 => Self::ConnectionTerminatedMicFailure,
62 => Self::ConnectionFailedToBeEstablished,
63 => Self::MacConnectionFailed,
64 => Self::CoarseClockAdjustmentRejected,
65 => Self::Type0SubmapNotDefined,
66 => Self::UnknownAdvertisingIdentifier,
67 => Self::LimitReached,
68 => Self::OperationCancelledByHost,
69 => Self::PacketTooLong,
70 => Self::TooLate,
71 => Self::TooEarly,
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::Success => 0,
Self::UnknownCommand => 1,
Self::UnknownConnectionId => 2,
Self::HardwareFailure => 3,
Self::PageTimeout => 4,
Self::AuthenticationFailure => 5,
Self::PinOrKeyMissing => 6,
Self::MemoryCapacityExceeded => 7,
Self::ConnectionTimeout => 8,
Self::ConnectionLimitExceeded => 9,
Self::SynchronousConnectionLimitExceeded => 10,
Self::ConnectionAlreadyExists => 11,
Self::CommandDisallowed => 12,
Self::ConnectionRejectedLimitedResources => 13,
Self::ConnectionRejectedSecurity => 14,
Self::ConnectionRejectedBadBdAddr => 15,
Self::ConnectionAcceptTimeoutExceeded => 16,
Self::UnsupportedFeatureOrParameter => 17,
Self::InvalidHcicommandParameters => 18,
Self::RemoteUserTerminatedConnection => 19,
Self::RemoteDeviceTerminatedConnectionLowResources => 20,
Self::RemoteDeviceTerminatedConnectionPowerOff => 21,
Self::ConnectionTerminatedByLocalHost => 22,
Self::RepeatedAttempts => 23,
Self::PairingNotAllowed => 24,
Self::UnknownLmpPdu => 25,
Self::UnsupportedRemoteFeature => 26,
Self::ScoOffsetRejected => 27,
Self::ScoIntervalRejected => 28,
Self::ScoAirModeRejected => 29,
Self::InvalidLmpOrLlParameters => 30,
Self::UnspecifiedError => 31,
Self::UnsupportedLmpOrLlParameterValue => 32,
Self::RoleChangeNotAllowed => 33,
Self::LmpOrLlResponseTimeout => 34,
Self::LmpErrorTransactionCollision => 35,
Self::LmpPduNotAllowed => 36,
Self::EncryptionModeNotAcceptable => 37,
Self::LinkKeyCannotBeChanged => 38,
Self::RequestedQosNotSupported => 39,
Self::InstantPassed => 40,
Self::PairingWithUnitKeyNotSupported => 41,
Self::DifferentTransactionCollision => 42,
Self::Reserved0 => 43,
Self::QosUnacceptableParameter => 44,
Self::QosRejected => 45,
Self::ChannelClassificationNotSupported => 46,
Self::InsufficientSecurity => 47,
Self::ParameterOutOfMandatoryRange => 48,
Self::Reserved1 => 49,
Self::RoleSwitchPending => 50,
Self::Reserved2 => 51,
Self::ReservedSlotViolation => 52,
Self::RoleSwitchFailed => 53,
Self::ExtendedInquiryResponseTooLarge => 54,
Self::SecureSimplePairingNotSupportedByHost => 55,
Self::HostBusyPairing => 56,
Self::ConnectionRejectedNoSuitableChannelFound => 57,
Self::ControllerBusy => 58,
Self::UnacceptableConnectionParameters => 59,
Self::DirectedAdvertisingTimeout => 60,
Self::ConnectionTerminatedMicFailure => 61,
Self::ConnectionFailedToBeEstablished => 62,
Self::MacConnectionFailed => 63,
Self::CoarseClockAdjustmentRejected => 64,
Self::Type0SubmapNotDefined => 65,
Self::UnknownAdvertisingIdentifier => 66,
Self::LimitReached => 67,
Self::OperationCancelledByHost => 68,
Self::PacketTooLong => 69,
Self::TooLate => 70,
Self::TooEarly => 71,
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 LegacyAdvertisingType {
AdvInd = 0,
AdvDirectInd = 1,
AdvScanInd = 2,
AdvNonconnInd = 3,
ScanRsp = 4,
}
impl LegacyAdvertisingType {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::AdvInd),
1 => Some(Self::AdvDirectInd),
2 => Some(Self::AdvScanInd),
3 => Some(Self::AdvNonconnInd),
4 => Some(Self::ScanRsp),
_ => 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)]
#[repr(u32)]
pub enum PacketDirection {
HostToController = 1,
ControllerToHost = 2,
}
impl PacketDirection {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::HostToController),
2 => Some(Self::ControllerToHost),
_ => 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 ScoCodingFormat {
Cvsd,
Msbc,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoCodingFormatUnknown {
() => {
_
};
}
impl ScoCodingFormat {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Cvsd),
2 => Some(Self::Msbc),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Cvsd,
2 => Self::Msbc,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Cvsd => 1,
Self::Msbc => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ScoEncoding {
Bits8,
Bits16,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoEncodingUnknown {
() => {
_
};
}
impl ScoEncoding {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Bits8),
2 => Some(Self::Bits16),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Bits8,
2 => Self::Bits16,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Bits8 => 1,
Self::Bits16 => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ScoSampleRate {
Khz8,
Khz16,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! ScoSampleRateUnknown {
() => {
_
};
}
impl ScoSampleRate {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Khz8),
2 => Some(Self::Khz16),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Khz8,
2 => Self::Khz16,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Khz8 => 1,
Self::Khz16 => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum VendorAclDirection {
Source,
Sink,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! VendorAclDirectionUnknown {
() => {
_
};
}
impl VendorAclDirection {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Source),
2 => Some(Self::Sink),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Source,
2 => Self::Sink,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Source => 1,
Self::Sink => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum VendorAclPriority {
Normal,
High,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! VendorAclPriorityUnknown {
() => {
_
};
}
impl VendorAclPriority {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Normal),
2 => Some(Self::High),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Normal,
2 => Self::High,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Normal => 1,
Self::High => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct EmulatorWatchLeScanStatesResponse {
pub states: Vec<LeScanState>,
}
impl fidl::Persistable for EmulatorWatchLeScanStatesResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct EmulatorWatchLegacyAdvertisingStatesResponse {
pub states: Vec<LegacyAdvertisingState>,
}
impl fidl::Persistable for EmulatorWatchLegacyAdvertisingStatesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciConfigureScoRequest {
pub coding_format: ScoCodingFormat,
pub encoding: ScoEncoding,
pub sample_rate: ScoSampleRate,
}
impl fidl::Persistable for HciConfigureScoRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenAclDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenAclDataChannelRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenCommandChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenCommandChannelRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenIsoDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenIsoDataChannelRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenScoDataChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenScoDataChannelRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HciOpenSnoopChannelRequest {
pub channel: fidl::Channel,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenSnoopChannelRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerAssignConnectionStatusRequest {
pub status: HciError,
}
impl fidl::Persistable for PeerAssignConnectionStatusRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerEmulateLeConnectionCompleteRequest {
pub role: fidl_fuchsia_bluetooth::ConnectionRole,
}
impl fidl::Persistable for PeerEmulateLeConnectionCompleteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct PeerSetServiceDefinitionsRequest {
pub service_definitions: Vec<fidl_fuchsia_bluetooth_bredr::ServiceDefinition>,
}
impl fidl::Persistable for PeerSetServiceDefinitionsRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PeerWatchConnectionStatesResponse {
pub states: Vec<ConnectionState>,
}
impl fidl::Persistable for PeerWatchConnectionStatesResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ScoPacket {
pub packet: Vec<u8>,
}
impl fidl::Persistable for ScoPacket {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct SnoopAcknowledgePacketsRequest {
pub sequence: u64,
}
impl fidl::Persistable for SnoopAcknowledgePacketsRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorEncodeCommandResponse {
pub encoded: Vec<u8>,
}
impl fidl::Persistable for VendorEncodeCommandResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorOpenHciTransportResponse {
pub channel: fidl::endpoints::ClientEnd<HciTransportMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VendorOpenHciTransportResponse
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorOpenHciResponse {
pub channel: fidl::endpoints::ClientEnd<HciMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VendorOpenHciResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VendorOpenSnoopResponse {
pub channel: fidl::endpoints::ClientEnd<SnoopMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VendorOpenSnoopResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct VirtualControllerCreateEmulatorResponse {
pub name: Option<String>,
}
impl fidl::Persistable for VirtualControllerCreateEmulatorResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AclBufferSettings {
pub data_packet_length: Option<u16>,
pub total_num_data_packets: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AclBufferSettings {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AdvertisingData {
pub data: Option<Vec<u8>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AdvertisingData {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct AndroidVendorSupport {
pub major_version: Option<u8>,
pub minor_version: Option<u8>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for AndroidVendorSupport {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ControllerParameters {
pub local_name: Option<String>,
pub device_class: Option<fidl_fuchsia_bluetooth::DeviceClass>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ControllerParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct EmulatorSettings {
pub address: Option<fidl_fuchsia_bluetooth::Address>,
pub hci_config: Option<HciConfig>,
pub extended_advertising: Option<bool>,
pub acl_buffer_settings: Option<AclBufferSettings>,
pub le_acl_buffer_settings: Option<AclBufferSettings>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for EmulatorSettings {}
#[derive(Debug, Default, PartialEq)]
pub struct HciTransportConfigureScoRequest {
pub coding_format: Option<ScoCodingFormat>,
pub encoding: Option<ScoEncoding>,
pub sample_rate: Option<ScoSampleRate>,
pub connection: Option<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for HciTransportConfigureScoRequest
{
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LeScanState {
pub enabled: Option<bool>,
pub active: Option<bool>,
pub interval: Option<u16>,
pub window: Option<u16>,
pub filter_duplicates: Option<bool>,
pub address_type: Option<fidl_fuchsia_bluetooth::AddressType>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LeScanState {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct LegacyAdvertisingState {
pub enabled: Option<bool>,
pub type_: Option<LegacyAdvertisingType>,
pub address_type: Option<fidl_fuchsia_bluetooth::AddressType>,
pub interval_min: Option<u16>,
pub interval_max: Option<u16>,
pub advertising_data: Option<AdvertisingData>,
pub scan_response: Option<AdvertisingData>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for LegacyAdvertisingState {}
#[derive(Debug, Default, PartialEq)]
pub struct PeerParameters {
pub address: Option<fidl_fuchsia_bluetooth::Address>,
pub connectable: Option<bool>,
pub channel: Option<fidl::endpoints::ServerEnd<PeerMarker>>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PeerParameters {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct PeerSetLeAdvertisementRequest {
pub le_address: Option<fidl_fuchsia_bluetooth::Address>,
pub advertisement: Option<AdvertisingData>,
pub scan_response: Option<AdvertisingData>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for PeerSetLeAdvertisementRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SnoopOnDroppedPacketsRequest {
pub sent: Option<u32>,
pub received: Option<u32>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SnoopOnDroppedPacketsRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SnoopOnObservePacketRequest {
pub sequence: Option<u64>,
pub direction: Option<PacketDirection>,
pub packet: Option<SnoopPacket>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for SnoopOnObservePacketRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VendorFeatures {
pub acl_priority_command: Option<bool>,
pub android_vendor_extensions: Option<AndroidVendorSupport>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for VendorFeatures {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct VendorSetAclPriorityParams {
pub connection_handle: Option<u16>,
pub priority: Option<VendorAclPriority>,
pub direction: Option<VendorAclDirection>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for VendorSetAclPriorityParams {}
#[derive(Debug, Default, PartialEq)]
pub struct VirtualControllerCreateLoopbackDeviceRequest {
pub uart_channel: Option<fidl::Channel>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtualControllerCreateLoopbackDeviceRequest
{
}
#[derive(Clone, Debug)]
pub enum ReceivedPacket {
Event(Vec<u8>),
Acl(Vec<u8>),
Iso(Vec<u8>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! ReceivedPacketUnknown {
() => {
_
};
}
impl PartialEq for ReceivedPacket {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Event(x), Self::Event(y)) => *x == *y,
(Self::Acl(x), Self::Acl(y)) => *x == *y,
(Self::Iso(x), Self::Iso(y)) => *x == *y,
_ => false,
}
}
}
impl ReceivedPacket {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Event(_) => 1,
Self::Acl(_) => 2,
Self::Iso(_) => 3,
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 ReceivedPacket {}
#[derive(Clone, Debug)]
pub enum SentPacket {
Command(Vec<u8>),
Acl(Vec<u8>),
Iso(Vec<u8>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! SentPacketUnknown {
() => {
_
};
}
impl PartialEq for SentPacket {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Command(x), Self::Command(y)) => *x == *y,
(Self::Acl(x), Self::Acl(y)) => *x == *y,
(Self::Iso(x), Self::Iso(y)) => *x == *y,
_ => false,
}
}
}
impl SentPacket {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Command(_) => 1,
Self::Acl(_) => 2,
Self::Iso(_) => 3,
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 SentPacket {}
#[derive(Clone, Debug)]
pub enum SnoopPacket {
Event(Vec<u8>),
Command(Vec<u8>),
Acl(Vec<u8>),
Sco(Vec<u8>),
Iso(Vec<u8>),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! SnoopPacketUnknown {
() => {
_
};
}
impl PartialEq for SnoopPacket {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Event(x), Self::Event(y)) => *x == *y,
(Self::Command(x), Self::Command(y)) => *x == *y,
(Self::Acl(x), Self::Acl(y)) => *x == *y,
(Self::Sco(x), Self::Sco(y)) => *x == *y,
(Self::Iso(x), Self::Iso(y)) => *x == *y,
_ => false,
}
}
}
impl SnoopPacket {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Event(_) => 1,
Self::Command(_) => 2,
Self::Acl(_) => 3,
Self::Sco(_) => 4,
Self::Iso(_) => 5,
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 SnoopPacket {}
#[derive(Clone, Debug)]
pub enum VendorCommand {
SetAclPriority(VendorSetAclPriorityParams),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! VendorCommandUnknown {
() => {
_
};
}
impl PartialEq for VendorCommand {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::SetAclPriority(x), Self::SetAclPriority(y)) => *x == *y,
_ => false,
}
}
}
impl VendorCommand {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::SetAclPriority(_) => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Persistable for VendorCommand {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct EmulatorMarker;
impl fidl::endpoints::ProtocolMarker for EmulatorMarker {
type Proxy = EmulatorProxy;
type RequestStream = EmulatorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = EmulatorSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.bluetooth.Emulator";
}
impl fidl::endpoints::DiscoverableProtocolMarker for EmulatorMarker {}
pub type EmulatorPublishResult = Result<(), EmulatorError>;
pub type EmulatorAddLowEnergyPeerResult = Result<(), EmulatorPeerError>;
pub type EmulatorAddBredrPeerResult = Result<(), EmulatorPeerError>;
pub trait EmulatorProxyInterface: Send + Sync {
type PublishResponseFut: std::future::Future<Output = Result<EmulatorPublishResult, fidl::Error>>
+ Send;
fn r#publish(&self, payload: &EmulatorSettings) -> Self::PublishResponseFut;
type AddLowEnergyPeerResponseFut: std::future::Future<Output = Result<EmulatorAddLowEnergyPeerResult, fidl::Error>>
+ Send;
fn r#add_low_energy_peer(&self, payload: PeerParameters) -> Self::AddLowEnergyPeerResponseFut;
type AddBredrPeerResponseFut: std::future::Future<Output = Result<EmulatorAddBredrPeerResult, fidl::Error>>
+ Send;
fn r#add_bredr_peer(&self, payload: PeerParameters) -> Self::AddBredrPeerResponseFut;
type WatchControllerParametersResponseFut: std::future::Future<Output = Result<ControllerParameters, fidl::Error>>
+ Send;
fn r#watch_controller_parameters(&self) -> Self::WatchControllerParametersResponseFut;
type WatchLeScanStatesResponseFut: std::future::Future<Output = Result<Vec<LeScanState>, fidl::Error>>
+ Send;
fn r#watch_le_scan_states(&self) -> Self::WatchLeScanStatesResponseFut;
type WatchLegacyAdvertisingStatesResponseFut: std::future::Future<Output = Result<Vec<LegacyAdvertisingState>, fidl::Error>>
+ Send;
fn r#watch_legacy_advertising_states(&self) -> Self::WatchLegacyAdvertisingStatesResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct EmulatorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for EmulatorSynchronousProxy {
type Proxy = EmulatorProxy;
type Protocol = EmulatorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl EmulatorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<EmulatorEvent, fidl::Error> {
EmulatorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#publish(
&self,
mut payload: &EmulatorSettings,
___deadline: zx::MonotonicInstant,
) -> Result<EmulatorPublishResult, fidl::Error> {
let _response = self.client.send_query::<
EmulatorSettings,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorError>,
>(
payload,
0x5b8aeb2ece853c39,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("publish")?;
Ok(_response.map(|x| x))
}
pub fn r#add_low_energy_peer(
&self,
mut payload: PeerParameters,
___deadline: zx::MonotonicInstant,
) -> Result<EmulatorAddLowEnergyPeerResult, fidl::Error> {
let _response = self.client.send_query::<
PeerParameters,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
>(
&mut payload,
0x4e1fb7adbebc6946,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("add_low_energy_peer")?;
Ok(_response.map(|x| x))
}
pub fn r#add_bredr_peer(
&self,
mut payload: PeerParameters,
___deadline: zx::MonotonicInstant,
) -> Result<EmulatorAddBredrPeerResult, fidl::Error> {
let _response = self.client.send_query::<
PeerParameters,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
>(
&mut payload,
0x6d15989a0373e07,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("add_bredr_peer")?;
Ok(_response.map(|x| x))
}
pub fn r#watch_controller_parameters(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ControllerParameters, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<ControllerParameters>,
>(
(),
0x6ed7a918b5800270,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("watch_controller_parameters")?;
Ok(_response)
}
pub fn r#watch_le_scan_states(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<LeScanState>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>,
>(
(),
0x10e6c845831f3b4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("watch_le_scan_states")?;
Ok(_response.states)
}
pub fn r#watch_legacy_advertising_states(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<LegacyAdvertisingState>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<EmulatorWatchLegacyAdvertisingStatesResponse>,
>(
(),
0x7067acbe275d0219,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<EmulatorMarker>("watch_legacy_advertising_states")?;
Ok(_response.states)
}
}
#[derive(Debug, Clone)]
pub struct EmulatorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for EmulatorProxy {
type Protocol = EmulatorMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl EmulatorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> EmulatorEventStream {
EmulatorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#publish(
&self,
mut payload: &EmulatorSettings,
) -> fidl::client::QueryResponseFut<
EmulatorPublishResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#publish(self, payload)
}
pub fn r#add_low_energy_peer(
&self,
mut payload: PeerParameters,
) -> fidl::client::QueryResponseFut<
EmulatorAddLowEnergyPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#add_low_energy_peer(self, payload)
}
pub fn r#add_bredr_peer(
&self,
mut payload: PeerParameters,
) -> fidl::client::QueryResponseFut<
EmulatorAddBredrPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#add_bredr_peer(self, payload)
}
pub fn r#watch_controller_parameters(
&self,
) -> fidl::client::QueryResponseFut<
ControllerParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#watch_controller_parameters(self)
}
pub fn r#watch_le_scan_states(
&self,
) -> fidl::client::QueryResponseFut<
Vec<LeScanState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#watch_le_scan_states(self)
}
pub fn r#watch_legacy_advertising_states(
&self,
) -> fidl::client::QueryResponseFut<
Vec<LegacyAdvertisingState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
EmulatorProxyInterface::r#watch_legacy_advertising_states(self)
}
}
impl EmulatorProxyInterface for EmulatorProxy {
type PublishResponseFut = fidl::client::QueryResponseFut<
EmulatorPublishResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#publish(&self, mut payload: &EmulatorSettings) -> Self::PublishResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EmulatorPublishResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5b8aeb2ece853c39,
>(_buf?)?
.into_result::<EmulatorMarker>("publish")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<EmulatorSettings, EmulatorPublishResult>(
payload,
0x5b8aeb2ece853c39,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type AddLowEnergyPeerResponseFut = fidl::client::QueryResponseFut<
EmulatorAddLowEnergyPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_low_energy_peer(
&self,
mut payload: PeerParameters,
) -> Self::AddLowEnergyPeerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EmulatorAddLowEnergyPeerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4e1fb7adbebc6946,
>(_buf?)?
.into_result::<EmulatorMarker>("add_low_energy_peer")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<PeerParameters, EmulatorAddLowEnergyPeerResult>(
&mut payload,
0x4e1fb7adbebc6946,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type AddBredrPeerResponseFut = fidl::client::QueryResponseFut<
EmulatorAddBredrPeerResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_bredr_peer(&self, mut payload: PeerParameters) -> Self::AddBredrPeerResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<EmulatorAddBredrPeerResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6d15989a0373e07,
>(_buf?)?
.into_result::<EmulatorMarker>("add_bredr_peer")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<PeerParameters, EmulatorAddBredrPeerResult>(
&mut payload,
0x6d15989a0373e07,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WatchControllerParametersResponseFut = fidl::client::QueryResponseFut<
ControllerParameters,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_controller_parameters(&self) -> Self::WatchControllerParametersResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ControllerParameters, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<ControllerParameters>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6ed7a918b5800270,
>(_buf?)?
.into_result::<EmulatorMarker>("watch_controller_parameters")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerParameters>(
(),
0x6ed7a918b5800270,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WatchLeScanStatesResponseFut = fidl::client::QueryResponseFut<
Vec<LeScanState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_le_scan_states(&self) -> Self::WatchLeScanStatesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<LeScanState>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x10e6c845831f3b4a,
>(_buf?)?
.into_result::<EmulatorMarker>("watch_le_scan_states")?;
Ok(_response.states)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LeScanState>>(
(),
0x10e6c845831f3b4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type WatchLegacyAdvertisingStatesResponseFut = fidl::client::QueryResponseFut<
Vec<LegacyAdvertisingState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_legacy_advertising_states(&self) -> Self::WatchLegacyAdvertisingStatesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<LegacyAdvertisingState>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<EmulatorWatchLegacyAdvertisingStatesResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7067acbe275d0219,
>(_buf?)?
.into_result::<EmulatorMarker>("watch_legacy_advertising_states")?;
Ok(_response.states)
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<LegacyAdvertisingState>>(
(),
0x7067acbe275d0219,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct EmulatorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for EmulatorEventStream {}
impl futures::stream::FusedStream for EmulatorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for EmulatorEventStream {
type Item = Result<EmulatorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(EmulatorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum EmulatorEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl EmulatorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<EmulatorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(EmulatorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct EmulatorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for EmulatorRequestStream {}
impl futures::stream::FusedStream for EmulatorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for EmulatorRequestStream {
type Protocol = EmulatorMarker;
type ControlHandle = EmulatorControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
EmulatorControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 EmulatorRequestStream {
type Item = Result<EmulatorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled EmulatorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x5b8aeb2ece853c39 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
EmulatorSettings,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EmulatorSettings>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::Publish {
payload: req,
responder: EmulatorPublishResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e1fb7adbebc6946 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerParameters,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerParameters>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::AddLowEnergyPeer {
payload: req,
responder: EmulatorAddLowEnergyPeerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6d15989a0373e07 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerParameters,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerParameters>(&header, _body_bytes, handles, &mut req)?;
let control_handle = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::AddBredrPeer {
payload: req,
responder: EmulatorAddBredrPeerResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6ed7a918b5800270 => {
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 = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::WatchControllerParameters {
responder: EmulatorWatchControllerParametersResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x10e6c845831f3b4a => {
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 = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::WatchLeScanStates {
responder: EmulatorWatchLeScanStatesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7067acbe275d0219 => {
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 = EmulatorControlHandle { inner: this.inner.clone() };
Ok(EmulatorRequest::WatchLegacyAdvertisingStates {
responder: EmulatorWatchLegacyAdvertisingStatesResponder {
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(EmulatorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EmulatorControlHandle { 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(EmulatorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: EmulatorControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<EmulatorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum EmulatorRequest {
Publish { payload: EmulatorSettings, responder: EmulatorPublishResponder },
AddLowEnergyPeer { payload: PeerParameters, responder: EmulatorAddLowEnergyPeerResponder },
AddBredrPeer { payload: PeerParameters, responder: EmulatorAddBredrPeerResponder },
WatchControllerParameters { responder: EmulatorWatchControllerParametersResponder },
WatchLeScanStates { responder: EmulatorWatchLeScanStatesResponder },
WatchLegacyAdvertisingStates { responder: EmulatorWatchLegacyAdvertisingStatesResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: EmulatorControlHandle,
method_type: fidl::MethodType,
},
}
impl EmulatorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_publish(self) -> Option<(EmulatorSettings, EmulatorPublishResponder)> {
if let EmulatorRequest::Publish { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_low_energy_peer(
self,
) -> Option<(PeerParameters, EmulatorAddLowEnergyPeerResponder)> {
if let EmulatorRequest::AddLowEnergyPeer { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_bredr_peer(self) -> Option<(PeerParameters, EmulatorAddBredrPeerResponder)> {
if let EmulatorRequest::AddBredrPeer { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_controller_parameters(
self,
) -> Option<(EmulatorWatchControllerParametersResponder)> {
if let EmulatorRequest::WatchControllerParameters { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_le_scan_states(self) -> Option<(EmulatorWatchLeScanStatesResponder)> {
if let EmulatorRequest::WatchLeScanStates { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_legacy_advertising_states(
self,
) -> Option<(EmulatorWatchLegacyAdvertisingStatesResponder)> {
if let EmulatorRequest::WatchLegacyAdvertisingStates { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
EmulatorRequest::Publish { .. } => "publish",
EmulatorRequest::AddLowEnergyPeer { .. } => "add_low_energy_peer",
EmulatorRequest::AddBredrPeer { .. } => "add_bredr_peer",
EmulatorRequest::WatchControllerParameters { .. } => "watch_controller_parameters",
EmulatorRequest::WatchLeScanStates { .. } => "watch_le_scan_states",
EmulatorRequest::WatchLegacyAdvertisingStates { .. } => {
"watch_legacy_advertising_states"
}
EmulatorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
EmulatorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct EmulatorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for EmulatorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 EmulatorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorPublishResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorPublishResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorPublishResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorPublishResponder {
pub fn send(self, mut result: Result<(), EmulatorError>) -> 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<(), EmulatorError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), EmulatorError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
EmulatorError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5b8aeb2ece853c39,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorAddLowEnergyPeerResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorAddLowEnergyPeerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorAddLowEnergyPeerResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorAddLowEnergyPeerResponder {
pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> 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<(), EmulatorPeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
EmulatorPeerError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x4e1fb7adbebc6946,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorAddBredrPeerResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorAddBredrPeerResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorAddBredrPeerResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorAddBredrPeerResponder {
pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> 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<(), EmulatorPeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
EmulatorPeerError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x6d15989a0373e07,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorWatchControllerParametersResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorWatchControllerParametersResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorWatchControllerParametersResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorWatchControllerParametersResponder {
pub fn send(self, mut payload: &ControllerParameters) -> 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: &ControllerParameters,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &ControllerParameters) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<ControllerParameters>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x6ed7a918b5800270,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorWatchLeScanStatesResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorWatchLeScanStatesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorWatchLeScanStatesResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorWatchLeScanStatesResponder {
pub fn send(self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut states: &[LeScanState]) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<EmulatorWatchLeScanStatesResponse>>(
fidl::encoding::Flexible::new((states,)),
self.tx_id,
0x10e6c845831f3b4a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct EmulatorWatchLegacyAdvertisingStatesResponder {
control_handle: std::mem::ManuallyDrop<EmulatorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for EmulatorWatchLegacyAdvertisingStatesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for EmulatorWatchLegacyAdvertisingStatesResponder {
type ControlHandle = EmulatorControlHandle;
fn control_handle(&self) -> &EmulatorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl EmulatorWatchLegacyAdvertisingStatesResponder {
pub fn send(self, mut states: &[LegacyAdvertisingState]) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut states: &[LegacyAdvertisingState],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut states: &[LegacyAdvertisingState]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<
EmulatorWatchLegacyAdvertisingStatesResponse,
>>(
fidl::encoding::Flexible::new((states,)),
self.tx_id,
0x7067acbe275d0219,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HciMarker;
impl fidl::endpoints::ProtocolMarker for HciMarker {
type Proxy = HciProxy;
type RequestStream = HciRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HciSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Hci";
}
pub type HciOpenCommandChannelResult = Result<(), i32>;
pub type HciOpenAclDataChannelResult = Result<(), i32>;
pub type HciOpenScoDataChannelResult = Result<(), i32>;
pub type HciConfigureScoResult = Result<(), i32>;
pub type HciResetScoResult = Result<(), i32>;
pub type HciOpenIsoDataChannelResult = Result<(), i32>;
pub type HciOpenSnoopChannelResult = Result<(), i32>;
pub trait HciProxyInterface: Send + Sync {
type OpenCommandChannelResponseFut: std::future::Future<Output = Result<HciOpenCommandChannelResult, fidl::Error>>
+ Send;
fn r#open_command_channel(&self, channel: fidl::Channel)
-> Self::OpenCommandChannelResponseFut;
type OpenAclDataChannelResponseFut: std::future::Future<Output = Result<HciOpenAclDataChannelResult, fidl::Error>>
+ Send;
fn r#open_acl_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenAclDataChannelResponseFut;
type OpenScoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenScoDataChannelResult, fidl::Error>>
+ Send;
fn r#open_sco_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenScoDataChannelResponseFut;
type ConfigureScoResponseFut: std::future::Future<Output = Result<HciConfigureScoResult, fidl::Error>>
+ Send;
fn r#configure_sco(
&self,
coding_format: ScoCodingFormat,
encoding: ScoEncoding,
sample_rate: ScoSampleRate,
) -> Self::ConfigureScoResponseFut;
type ResetScoResponseFut: std::future::Future<Output = Result<HciResetScoResult, fidl::Error>>
+ Send;
fn r#reset_sco(&self) -> Self::ResetScoResponseFut;
type OpenIsoDataChannelResponseFut: std::future::Future<Output = Result<HciOpenIsoDataChannelResult, fidl::Error>>
+ Send;
fn r#open_iso_data_channel(
&self,
channel: fidl::Channel,
) -> Self::OpenIsoDataChannelResponseFut;
type OpenSnoopChannelResponseFut: std::future::Future<Output = Result<HciOpenSnoopChannelResult, fidl::Error>>
+ Send;
fn r#open_snoop_channel(&self, channel: fidl::Channel) -> Self::OpenSnoopChannelResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HciSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HciSynchronousProxy {
type Proxy = HciProxy;
type Protocol = HciMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl HciSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<HciEvent, fidl::Error> {
HciEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<HciOpenCommandChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenCommandChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_command_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenAclDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_acl_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenScoDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_sco_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
___deadline: zx::MonotonicInstant,
) -> Result<HciConfigureScoResult, fidl::Error> {
let _response = self.client.send_query::<
HciConfigureScoRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(coding_format, encoding, sample_rate,),
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("configure_sco")?;
Ok(_response.map(|x| x))
}
pub fn r#reset_sco(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<HciResetScoResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("reset_sco")?;
Ok(_response.map(|x| x))
}
pub fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenIsoDataChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_iso_data_channel")?;
Ok(_response.map(|x| x))
}
pub fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
___deadline: zx::MonotonicInstant,
) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
let _response = self.client.send_query::<
HciOpenSnoopChannelRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
>(
(channel,),
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciMarker>("open_snoop_channel")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct HciProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HciProxy {
type Protocol = HciMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl HciProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HciEventStream {
HciEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<
HciOpenCommandChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#open_command_channel(self, channel)
}
pub fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<
HciOpenAclDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#open_acl_data_channel(self, channel)
}
pub fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<
HciOpenScoDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#open_sco_data_channel(self, channel)
}
pub fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
) -> fidl::client::QueryResponseFut<
HciConfigureScoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#configure_sco(self, coding_format, encoding, sample_rate)
}
pub fn r#reset_sco(
&self,
) -> fidl::client::QueryResponseFut<
HciResetScoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#reset_sco(self)
}
pub fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<
HciOpenIsoDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#open_iso_data_channel(self, channel)
}
pub fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
) -> fidl::client::QueryResponseFut<
HciOpenSnoopChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
HciProxyInterface::r#open_snoop_channel(self, channel)
}
}
impl HciProxyInterface for HciProxy {
type OpenCommandChannelResponseFut = fidl::client::QueryResponseFut<
HciOpenCommandChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_command_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenCommandChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenCommandChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2510b52ea3a51ce0,
>(_buf?)?
.into_result::<HciMarker>("open_command_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenCommandChannelRequest, HciOpenCommandChannelResult>(
(channel,),
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenAclDataChannelResponseFut = fidl::client::QueryResponseFut<
HciOpenAclDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_acl_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenAclDataChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenAclDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x210c3dd69156385a,
>(_buf?)?
.into_result::<HciMarker>("open_acl_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenAclDataChannelRequest, HciOpenAclDataChannelResult>(
(channel,),
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenScoDataChannelResponseFut = fidl::client::QueryResponseFut<
HciOpenScoDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_sco_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenScoDataChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenScoDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5bcb0bf2cbf35bdf,
>(_buf?)?
.into_result::<HciMarker>("open_sco_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenScoDataChannelRequest, HciOpenScoDataChannelResult>(
(channel,),
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ConfigureScoResponseFut = fidl::client::QueryResponseFut<
HciConfigureScoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#configure_sco(
&self,
mut coding_format: ScoCodingFormat,
mut encoding: ScoEncoding,
mut sample_rate: ScoSampleRate,
) -> Self::ConfigureScoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciConfigureScoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x499ec7edfd65fad7,
>(_buf?)?
.into_result::<HciMarker>("configure_sco")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HciConfigureScoRequest, HciConfigureScoResult>(
(coding_format, encoding, sample_rate),
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type ResetScoResponseFut = fidl::client::QueryResponseFut<
HciResetScoResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reset_sco(&self) -> Self::ResetScoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciResetScoResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6ee56dcb2ce23fcb,
>(_buf?)?
.into_result::<HciMarker>("reset_sco")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HciResetScoResult>(
(),
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenIsoDataChannelResponseFut = fidl::client::QueryResponseFut<
HciOpenIsoDataChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_iso_data_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenIsoDataChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenIsoDataChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x9adfa1d466cefd4,
>(_buf?)?
.into_result::<HciMarker>("open_iso_data_channel")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<HciOpenIsoDataChannelRequest, HciOpenIsoDataChannelResult>(
(channel,),
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenSnoopChannelResponseFut = fidl::client::QueryResponseFut<
HciOpenSnoopChannelResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_snoop_channel(
&self,
mut channel: fidl::Channel,
) -> Self::OpenSnoopChannelResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HciOpenSnoopChannelResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xd31c6d5cbc4e136,
>(_buf?)?
.into_result::<HciMarker>("open_snoop_channel")?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<HciOpenSnoopChannelRequest, HciOpenSnoopChannelResult>(
(channel,),
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct HciEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HciEventStream {}
impl futures::stream::FusedStream for HciEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HciEventStream {
type Item = Result<HciEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(HciEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HciEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl HciEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HciEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(HciEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HciRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HciRequestStream {}
impl futures::stream::FusedStream for HciRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HciRequestStream {
type Protocol = HciMarker;
type ControlHandle = HciControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
HciControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 HciRequestStream {
type Item = Result<HciRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled HciRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x2510b52ea3a51ce0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciOpenCommandChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenCommandChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenCommandChannel {
channel: req.channel,
responder: HciOpenCommandChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x210c3dd69156385a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciOpenAclDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenAclDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenAclDataChannel {
channel: req.channel,
responder: HciOpenAclDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5bcb0bf2cbf35bdf => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciOpenScoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenScoDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenScoDataChannel {
channel: req.channel,
responder: HciOpenScoDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x499ec7edfd65fad7 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciConfigureScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciConfigureScoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::ConfigureSco {
coding_format: req.coding_format,
encoding: req.encoding,
sample_rate: req.sample_rate,
responder: HciConfigureScoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6ee56dcb2ce23fcb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::ResetSco {
responder: HciResetScoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x9adfa1d466cefd4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciOpenIsoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenIsoDataChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenIsoDataChannel {
channel: req.channel,
responder: HciOpenIsoDataChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xd31c6d5cbc4e136 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
HciOpenSnoopChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciOpenSnoopChannelRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = HciControlHandle { inner: this.inner.clone() };
Ok(HciRequest::OpenSnoopChannel {
channel: req.channel,
responder: HciOpenSnoopChannelResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(HciRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(HciRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <HciMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HciRequest {
OpenCommandChannel { channel: fidl::Channel, responder: HciOpenCommandChannelResponder },
OpenAclDataChannel { channel: fidl::Channel, responder: HciOpenAclDataChannelResponder },
OpenScoDataChannel { channel: fidl::Channel, responder: HciOpenScoDataChannelResponder },
ConfigureSco {
coding_format: ScoCodingFormat,
encoding: ScoEncoding,
sample_rate: ScoSampleRate,
responder: HciConfigureScoResponder,
},
ResetSco { responder: HciResetScoResponder },
OpenIsoDataChannel { channel: fidl::Channel, responder: HciOpenIsoDataChannelResponder },
OpenSnoopChannel { channel: fidl::Channel, responder: HciOpenSnoopChannelResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: HciControlHandle,
method_type: fidl::MethodType,
},
}
impl HciRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_open_command_channel(
self,
) -> Option<(fidl::Channel, HciOpenCommandChannelResponder)> {
if let HciRequest::OpenCommandChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_acl_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenAclDataChannelResponder)> {
if let HciRequest::OpenAclDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_sco_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenScoDataChannelResponder)> {
if let HciRequest::OpenScoDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_configure_sco(
self,
) -> Option<(ScoCodingFormat, ScoEncoding, ScoSampleRate, HciConfigureScoResponder)> {
if let HciRequest::ConfigureSco { coding_format, encoding, sample_rate, responder } = self {
Some((coding_format, encoding, sample_rate, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_sco(self) -> Option<(HciResetScoResponder)> {
if let HciRequest::ResetSco { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_iso_data_channel(
self,
) -> Option<(fidl::Channel, HciOpenIsoDataChannelResponder)> {
if let HciRequest::OpenIsoDataChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_snoop_channel(self) -> Option<(fidl::Channel, HciOpenSnoopChannelResponder)> {
if let HciRequest::OpenSnoopChannel { channel, responder } = self {
Some((channel, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HciRequest::OpenCommandChannel { .. } => "open_command_channel",
HciRequest::OpenAclDataChannel { .. } => "open_acl_data_channel",
HciRequest::OpenScoDataChannel { .. } => "open_sco_data_channel",
HciRequest::ConfigureSco { .. } => "configure_sco",
HciRequest::ResetSco { .. } => "reset_sco",
HciRequest::OpenIsoDataChannel { .. } => "open_iso_data_channel",
HciRequest::OpenSnoopChannel { .. } => "open_snoop_channel",
HciRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
HciRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct HciControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HciControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 HciControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenCommandChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenCommandChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenCommandChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenCommandChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x2510b52ea3a51ce0,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenAclDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenAclDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenAclDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenAclDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x210c3dd69156385a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenScoDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenScoDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenScoDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenScoDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x5bcb0bf2cbf35bdf,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciConfigureScoResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciConfigureScoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciConfigureScoResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciConfigureScoResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x499ec7edfd65fad7,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciResetScoResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciResetScoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciResetScoResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciResetScoResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x6ee56dcb2ce23fcb,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenIsoDataChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenIsoDataChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenIsoDataChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenIsoDataChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x9adfa1d466cefd4,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciOpenSnoopChannelResponder {
control_handle: std::mem::ManuallyDrop<HciControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciOpenSnoopChannelResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciOpenSnoopChannelResponder {
type ControlHandle = HciControlHandle;
fn control_handle(&self) -> &HciControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciOpenSnoopChannelResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
i32,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0xd31c6d5cbc4e136,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HciTransportMarker;
impl fidl::endpoints::ProtocolMarker for HciTransportMarker {
type Proxy = HciTransportProxy;
type RequestStream = HciTransportRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = HciTransportSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) HciTransport";
}
pub trait HciTransportProxyInterface: Send + Sync {
type Send_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_(&self, payload: &SentPacket) -> Self::Send_ResponseFut;
fn r#ack_receive(&self) -> Result<(), fidl::Error>;
fn r#configure_sco(&self, payload: HciTransportConfigureScoRequest) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct HciTransportSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for HciTransportSynchronousProxy {
type Proxy = HciTransportProxy;
type Protocol = HciTransportMarker;
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 HciTransportSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <HciTransportMarker 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<HciTransportEvent, fidl::Error> {
HciTransportEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#send_(
&self,
mut payload: &SentPacket,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<SentPacket, fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
payload,
0x4793b5e66fd79e0b,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<HciTransportMarker>("send_")?;
Ok(_response)
}
pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x25de8c1f760f0c89,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#configure_sco(
&self,
mut payload: HciTransportConfigureScoRequest,
) -> Result<(), fidl::Error> {
self.client.send::<HciTransportConfigureScoRequest>(
&mut payload,
0x4298072d0498b612,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct HciTransportProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for HciTransportProxy {
type Protocol = HciTransportMarker;
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 HciTransportProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> HciTransportEventStream {
HciTransportEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#send_(
&self,
mut payload: &SentPacket,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
HciTransportProxyInterface::r#send_(self, payload)
}
pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
HciTransportProxyInterface::r#ack_receive(self)
}
pub fn r#configure_sco(
&self,
mut payload: HciTransportConfigureScoRequest,
) -> Result<(), fidl::Error> {
HciTransportProxyInterface::r#configure_sco(self, payload)
}
}
impl HciTransportProxyInterface for HciTransportProxy {
type Send_ResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_(&self, mut payload: &SentPacket) -> Self::Send_ResponseFut {
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,
0x4793b5e66fd79e0b,
>(_buf?)?
.into_result::<HciTransportMarker>("send_")?;
Ok(_response)
}
self.client.send_query_and_decode::<SentPacket, ()>(
payload,
0x4793b5e66fd79e0b,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#ack_receive(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x25de8c1f760f0c89,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#configure_sco(
&self,
mut payload: HciTransportConfigureScoRequest,
) -> Result<(), fidl::Error> {
self.client.send::<HciTransportConfigureScoRequest>(
&mut payload,
0x4298072d0498b612,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct HciTransportEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for HciTransportEventStream {}
impl futures::stream::FusedStream for HciTransportEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for HciTransportEventStream {
type Item = Result<HciTransportEvent, 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(HciTransportEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum HciTransportEvent {
OnReceive {
payload: ReceivedPacket,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl HciTransportEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_receive(self) -> Option<ReceivedPacket> {
if let HciTransportEvent::OnReceive { payload } = self {
Some((payload))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<HciTransportEvent, 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 {
0xcb102e573e5049c => {
let mut out =
fidl::new_empty!(ReceivedPacket, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ReceivedPacket>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((HciTransportEvent::OnReceive { payload: out }))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(HciTransportEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct HciTransportRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for HciTransportRequestStream {}
impl futures::stream::FusedStream for HciTransportRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for HciTransportRequestStream {
type Protocol = HciTransportMarker;
type ControlHandle = HciTransportControlHandle;
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 {
HciTransportControlHandle { 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 HciTransportRequestStream {
type Item = Result<HciTransportRequest, 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 HciTransportRequestStream 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 {
0x4793b5e66fd79e0b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
SentPacket,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SentPacket>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HciTransportControlHandle { inner: this.inner.clone() };
Ok(HciTransportRequest::Send_ {
payload: req,
responder: HciTransportSend_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x25de8c1f760f0c89 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HciTransportControlHandle { inner: this.inner.clone() };
Ok(HciTransportRequest::AckReceive { control_handle })
}
0x4298072d0498b612 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
HciTransportConfigureScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HciTransportConfigureScoRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
HciTransportControlHandle { inner: this.inner.clone() };
Ok(HciTransportRequest::ConfigureSco { payload: req, control_handle })
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(HciTransportRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciTransportControlHandle { 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(HciTransportRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: HciTransportControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<HciTransportMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum HciTransportRequest {
Send_ {
payload: SentPacket,
responder: HciTransportSend_Responder,
},
AckReceive {
control_handle: HciTransportControlHandle,
},
ConfigureSco {
payload: HciTransportConfigureScoRequest,
control_handle: HciTransportControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: HciTransportControlHandle,
method_type: fidl::MethodType,
},
}
impl HciTransportRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_send_(self) -> Option<(SentPacket, HciTransportSend_Responder)> {
if let HciTransportRequest::Send_ { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ack_receive(self) -> Option<(HciTransportControlHandle)> {
if let HciTransportRequest::AckReceive { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_configure_sco(
self,
) -> Option<(HciTransportConfigureScoRequest, HciTransportControlHandle)> {
if let HciTransportRequest::ConfigureSco { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
HciTransportRequest::Send_ { .. } => "send_",
HciTransportRequest::AckReceive { .. } => "ack_receive",
HciTransportRequest::ConfigureSco { .. } => "configure_sco",
HciTransportRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay, ..
} => "unknown one-way method",
HciTransportRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay, ..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct HciTransportControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for HciTransportControlHandle {
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 HciTransportControlHandle {
pub fn send_on_receive(&self, mut payload: &ReceivedPacket) -> Result<(), fidl::Error> {
self.inner.send::<ReceivedPacket>(
payload,
0,
0xcb102e573e5049c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct HciTransportSend_Responder {
control_handle: std::mem::ManuallyDrop<HciTransportControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for HciTransportSend_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for HciTransportSend_Responder {
type ControlHandle = HciTransportControlHandle;
fn control_handle(&self) -> &HciTransportControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl HciTransportSend_Responder {
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,
0x4793b5e66fd79e0b,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct PeerMarker;
impl fidl::endpoints::ProtocolMarker for PeerMarker {
type Proxy = PeerProxy;
type RequestStream = PeerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = PeerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Peer";
}
pub type PeerSetLeAdvertisementResult = Result<(), EmulatorPeerError>;
pub trait PeerProxyInterface: Send + Sync {
type AssignConnectionStatusResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#assign_connection_status(
&self,
status: HciError,
) -> Self::AssignConnectionStatusResponseFut;
fn r#emulate_le_connection_complete(
&self,
role: fidl_fuchsia_bluetooth::ConnectionRole,
) -> Result<(), fidl::Error>;
fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error>;
type WatchConnectionStatesResponseFut: std::future::Future<Output = Result<Vec<ConnectionState>, fidl::Error>>
+ Send;
fn r#watch_connection_states(&self) -> Self::WatchConnectionStatesResponseFut;
type SetDeviceClassResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#set_device_class(&self, value: u32) -> Self::SetDeviceClassResponseFut;
type SetServiceDefinitionsResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
+ Send;
fn r#set_service_definitions(
&self,
service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
) -> Self::SetServiceDefinitionsResponseFut;
type SetLeAdvertisementResponseFut: std::future::Future<Output = Result<PeerSetLeAdvertisementResult, fidl::Error>>
+ Send;
fn r#set_le_advertisement(
&self,
payload: &PeerSetLeAdvertisementRequest,
) -> Self::SetLeAdvertisementResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct PeerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for PeerSynchronousProxy {
type Proxy = PeerProxy;
type Protocol = PeerMarker;
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 PeerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <PeerMarker 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<PeerEvent, fidl::Error> {
PeerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#assign_connection_status(
&self,
mut status: HciError,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
PeerAssignConnectionStatusRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(status,),
0x52810c5ba7a2555c,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerMarker>("assign_connection_status")?;
Ok(_response)
}
pub fn r#emulate_le_connection_complete(
&self,
mut role: fidl_fuchsia_bluetooth::ConnectionRole,
) -> Result<(), fidl::Error> {
self.client.send::<PeerEmulateLeConnectionCompleteRequest>(
(role,),
0x3dfba319b8d2fc2a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4d3955084d85a15c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#watch_connection_states(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<ConnectionState>, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>,
>(
(),
0x5a5190211980c70f,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerMarker>("watch_connection_states")?;
Ok(_response.states)
}
pub fn r#set_device_class(
&self,
mut value: u32,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
fidl_fuchsia_bluetooth::DeviceClass,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(value,),
0x3e52fa234758e1ea,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerMarker>("set_device_class")?;
Ok(_response)
}
pub fn r#set_service_definitions(
&self,
mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self.client.send_query::<
PeerSetServiceDefinitionsRequest,
fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
>(
(service_definitions,),
0x58ce9f22fce272df,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerMarker>("set_service_definitions")?;
Ok(_response)
}
pub fn r#set_le_advertisement(
&self,
mut payload: &PeerSetLeAdvertisementRequest,
___deadline: zx::MonotonicInstant,
) -> Result<PeerSetLeAdvertisementResult, fidl::Error> {
let _response = self.client.send_query::<
PeerSetLeAdvertisementRequest,
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
>(
payload,
0x481b9aea1b39cfb4,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<PeerMarker>("set_le_advertisement")?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct PeerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for PeerProxy {
type Protocol = PeerMarker;
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 PeerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> PeerEventStream {
PeerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#assign_connection_status(
&self,
mut status: HciError,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PeerProxyInterface::r#assign_connection_status(self, status)
}
pub fn r#emulate_le_connection_complete(
&self,
mut role: fidl_fuchsia_bluetooth::ConnectionRole,
) -> Result<(), fidl::Error> {
PeerProxyInterface::r#emulate_le_connection_complete(self, role)
}
pub fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
PeerProxyInterface::r#emulate_disconnection_complete(self)
}
pub fn r#watch_connection_states(
&self,
) -> fidl::client::QueryResponseFut<
Vec<ConnectionState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerProxyInterface::r#watch_connection_states(self)
}
pub fn r#set_device_class(
&self,
mut value: u32,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PeerProxyInterface::r#set_device_class(self, value)
}
pub fn r#set_service_definitions(
&self,
mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
PeerProxyInterface::r#set_service_definitions(self, service_definitions)
}
pub fn r#set_le_advertisement(
&self,
mut payload: &PeerSetLeAdvertisementRequest,
) -> fidl::client::QueryResponseFut<
PeerSetLeAdvertisementResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
PeerProxyInterface::r#set_le_advertisement(self, payload)
}
}
impl PeerProxyInterface for PeerProxy {
type AssignConnectionStatusResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#assign_connection_status(
&self,
mut status: HciError,
) -> Self::AssignConnectionStatusResponseFut {
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,
0x52810c5ba7a2555c,
>(_buf?)?
.into_result::<PeerMarker>("assign_connection_status")?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerAssignConnectionStatusRequest, ()>(
(status,),
0x52810c5ba7a2555c,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#emulate_le_connection_complete(
&self,
mut role: fidl_fuchsia_bluetooth::ConnectionRole,
) -> Result<(), fidl::Error> {
self.client.send::<PeerEmulateLeConnectionCompleteRequest>(
(role,),
0x3dfba319b8d2fc2a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#emulate_disconnection_complete(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x4d3955084d85a15c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
type WatchConnectionStatesResponseFut = fidl::client::QueryResponseFut<
Vec<ConnectionState>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_connection_states(&self) -> Self::WatchConnectionStatesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<ConnectionState>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5a5190211980c70f,
>(_buf?)?
.into_result::<PeerMarker>("watch_connection_states")?;
Ok(_response.states)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ConnectionState>>(
(),
0x5a5190211980c70f,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetDeviceClassResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_device_class(&self, mut value: u32) -> Self::SetDeviceClassResponseFut {
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,
0x3e52fa234758e1ea,
>(_buf?)?
.into_result::<PeerMarker>("set_device_class")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl_fuchsia_bluetooth::DeviceClass, ()>(
(value,),
0x3e52fa234758e1ea,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetServiceDefinitionsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_service_definitions(
&self,
mut service_definitions: &[fidl_fuchsia_bluetooth_bredr::ServiceDefinition],
) -> Self::SetServiceDefinitionsResponseFut {
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,
0x58ce9f22fce272df,
>(_buf?)?
.into_result::<PeerMarker>("set_service_definitions")?;
Ok(_response)
}
self.client.send_query_and_decode::<PeerSetServiceDefinitionsRequest, ()>(
(service_definitions,),
0x58ce9f22fce272df,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type SetLeAdvertisementResponseFut = fidl::client::QueryResponseFut<
PeerSetLeAdvertisementResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_le_advertisement(
&self,
mut payload: &PeerSetLeAdvertisementRequest,
) -> Self::SetLeAdvertisementResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<PeerSetLeAdvertisementResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, EmulatorPeerError>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x481b9aea1b39cfb4,
>(_buf?)?
.into_result::<PeerMarker>("set_le_advertisement")?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<PeerSetLeAdvertisementRequest, PeerSetLeAdvertisementResult>(
payload,
0x481b9aea1b39cfb4,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct PeerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for PeerEventStream {}
impl futures::stream::FusedStream for PeerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for PeerEventStream {
type Item = Result<PeerEvent, 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(PeerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum PeerEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl PeerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<PeerEvent, 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(PeerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct PeerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for PeerRequestStream {}
impl futures::stream::FusedStream for PeerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for PeerRequestStream {
type Protocol = PeerMarker;
type ControlHandle = PeerControlHandle;
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 {
PeerControlHandle { 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 PeerRequestStream {
type Item = Result<PeerRequest, 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 PeerRequestStream 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 {
0x52810c5ba7a2555c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerAssignConnectionStatusRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerAssignConnectionStatusRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::AssignConnectionStatus {
status: req.status,
responder: PeerAssignConnectionStatusResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3dfba319b8d2fc2a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
PeerEmulateLeConnectionCompleteRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerEmulateLeConnectionCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::EmulateLeConnectionComplete {
role: req.role,
control_handle,
})
}
0x4d3955084d85a15c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::EmulateDisconnectionComplete { control_handle })
}
0x5a5190211980c70f => {
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 = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::WatchConnectionStates {
responder: PeerWatchConnectionStatesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3e52fa234758e1ea => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl_fuchsia_bluetooth::DeviceClass,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_bluetooth::DeviceClass>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::SetDeviceClass {
value: req.value,
responder: PeerSetDeviceClassResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x58ce9f22fce272df => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerSetServiceDefinitionsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSetServiceDefinitionsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::SetServiceDefinitions {
service_definitions: req.service_definitions,
responder: PeerSetServiceDefinitionsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x481b9aea1b39cfb4 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
PeerSetLeAdvertisementRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PeerSetLeAdvertisementRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = PeerControlHandle { inner: this.inner.clone() };
Ok(PeerRequest::SetLeAdvertisement {
payload: req,
responder: PeerSetLeAdvertisementResponder {
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(PeerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PeerControlHandle { 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(PeerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: PeerControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <PeerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum PeerRequest {
AssignConnectionStatus { status: HciError, responder: PeerAssignConnectionStatusResponder },
EmulateLeConnectionComplete {
role: fidl_fuchsia_bluetooth::ConnectionRole,
control_handle: PeerControlHandle,
},
EmulateDisconnectionComplete { control_handle: PeerControlHandle },
WatchConnectionStates { responder: PeerWatchConnectionStatesResponder },
SetDeviceClass { value: u32, responder: PeerSetDeviceClassResponder },
SetServiceDefinitions {
service_definitions: Vec<fidl_fuchsia_bluetooth_bredr::ServiceDefinition>,
responder: PeerSetServiceDefinitionsResponder,
},
SetLeAdvertisement {
payload: PeerSetLeAdvertisementRequest,
responder: PeerSetLeAdvertisementResponder,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: PeerControlHandle,
method_type: fidl::MethodType,
},
}
impl PeerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_assign_connection_status(
self,
) -> Option<(HciError, PeerAssignConnectionStatusResponder)> {
if let PeerRequest::AssignConnectionStatus { status, responder } = self {
Some((status, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_emulate_le_connection_complete(
self,
) -> Option<(fidl_fuchsia_bluetooth::ConnectionRole, PeerControlHandle)> {
if let PeerRequest::EmulateLeConnectionComplete { role, control_handle } = self {
Some((role, control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_emulate_disconnection_complete(self) -> Option<(PeerControlHandle)> {
if let PeerRequest::EmulateDisconnectionComplete { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_connection_states(self) -> Option<(PeerWatchConnectionStatesResponder)> {
if let PeerRequest::WatchConnectionStates { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_device_class(self) -> Option<(u32, PeerSetDeviceClassResponder)> {
if let PeerRequest::SetDeviceClass { value, responder } = self {
Some((value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_service_definitions(
self,
) -> Option<(
Vec<fidl_fuchsia_bluetooth_bredr::ServiceDefinition>,
PeerSetServiceDefinitionsResponder,
)> {
if let PeerRequest::SetServiceDefinitions { service_definitions, responder } = self {
Some((service_definitions, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_le_advertisement(
self,
) -> Option<(PeerSetLeAdvertisementRequest, PeerSetLeAdvertisementResponder)> {
if let PeerRequest::SetLeAdvertisement { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
PeerRequest::AssignConnectionStatus { .. } => "assign_connection_status",
PeerRequest::EmulateLeConnectionComplete { .. } => "emulate_le_connection_complete",
PeerRequest::EmulateDisconnectionComplete { .. } => "emulate_disconnection_complete",
PeerRequest::WatchConnectionStates { .. } => "watch_connection_states",
PeerRequest::SetDeviceClass { .. } => "set_device_class",
PeerRequest::SetServiceDefinitions { .. } => "set_service_definitions",
PeerRequest::SetLeAdvertisement { .. } => "set_le_advertisement",
PeerRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
PeerRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct PeerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for PeerControlHandle {
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 PeerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerAssignConnectionStatusResponder {
control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerAssignConnectionStatusResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerAssignConnectionStatusResponder {
type ControlHandle = PeerControlHandle;
fn control_handle(&self) -> &PeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerAssignConnectionStatusResponder {
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,
0x52810c5ba7a2555c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerWatchConnectionStatesResponder {
control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerWatchConnectionStatesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerWatchConnectionStatesResponder {
type ControlHandle = PeerControlHandle;
fn control_handle(&self) -> &PeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerWatchConnectionStatesResponder {
pub fn send(self, mut states: &[ConnectionState]) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut states: &[ConnectionState],
) -> Result<(), fidl::Error> {
let _result = self.send_raw(states);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut states: &[ConnectionState]) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleType<PeerWatchConnectionStatesResponse>>(
fidl::encoding::Flexible::new((states,)),
self.tx_id,
0x5a5190211980c70f,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerSetDeviceClassResponder {
control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerSetDeviceClassResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerSetDeviceClassResponder {
type ControlHandle = PeerControlHandle;
fn control_handle(&self) -> &PeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerSetDeviceClassResponder {
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,
0x3e52fa234758e1ea,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerSetServiceDefinitionsResponder {
control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerSetServiceDefinitionsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerSetServiceDefinitionsResponder {
type ControlHandle = PeerControlHandle;
fn control_handle(&self) -> &PeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerSetServiceDefinitionsResponder {
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,
0x58ce9f22fce272df,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct PeerSetLeAdvertisementResponder {
control_handle: std::mem::ManuallyDrop<PeerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for PeerSetLeAdvertisementResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for PeerSetLeAdvertisementResponder {
type ControlHandle = PeerControlHandle;
fn control_handle(&self) -> &PeerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl PeerSetLeAdvertisementResponder {
pub fn send(self, mut result: Result<(), EmulatorPeerError>) -> 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<(), EmulatorPeerError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), EmulatorPeerError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
fidl::encoding::EmptyStruct,
EmulatorPeerError,
>>(
fidl::encoding::FlexibleResult::new(result),
self.tx_id,
0x481b9aea1b39cfb4,
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 Send_ResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#send_(&self, packet: &[u8]) -> Self::Send_ResponseFut;
fn r#ack_receive(&self) -> Result<(), fidl::Error>;
fn r#stop(&self) -> Result<(), fidl::Error>;
}
#[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#send_(
&self,
mut packet: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response = self
.client
.send_query::<ScoPacket, fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
(packet,),
0x6e0c000ccd50adec,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<ScoConnectionMarker>("send_")?;
Ok(_response)
}
pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7e6af45151224a6a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5df8b0ab265b449d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[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#send_(
&self,
mut packet: &[u8],
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
ScoConnectionProxyInterface::r#send_(self, packet)
}
pub fn r#ack_receive(&self) -> Result<(), fidl::Error> {
ScoConnectionProxyInterface::r#ack_receive(self)
}
pub fn r#stop(&self) -> Result<(), fidl::Error> {
ScoConnectionProxyInterface::r#stop(self)
}
}
impl ScoConnectionProxyInterface for ScoConnectionProxy {
type Send_ResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#send_(&self, mut packet: &[u8]) -> Self::Send_ResponseFut {
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,
0x6e0c000ccd50adec,
>(_buf?)?
.into_result::<ScoConnectionMarker>("send_")?;
Ok(_response)
}
self.client.send_query_and_decode::<ScoPacket, ()>(
(packet,),
0x6e0c000ccd50adec,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#ack_receive(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x7e6af45151224a6a,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
fn r#stop(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x5df8b0ab265b449d,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
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 {
OnReceive {
packet: Vec<u8>,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl ScoConnectionEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_receive(self) -> Option<Vec<u8>> {
if let ScoConnectionEvent::OnReceive { packet } = self {
Some((packet))
} 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 {
0x4d4e96f6f7d1aa12 => {
let mut out =
fidl::new_empty!(ScoPacket, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoPacket>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((ScoConnectionEvent::OnReceive { packet: out.packet }))
}
_ 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 {
0x6e0c000ccd50adec => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ScoPacket,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ScoPacket>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Send_ {
packet: req.packet,
responder: ScoConnectionSend_Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7e6af45151224a6a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::AckReceive { control_handle })
}
0x5df8b0ab265b449d => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
ScoConnectionControlHandle { inner: this.inner.clone() };
Ok(ScoConnectionRequest::Stop { control_handle })
}
_ 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 {
Send_ {
packet: Vec<u8>,
responder: ScoConnectionSend_Responder,
},
AckReceive {
control_handle: ScoConnectionControlHandle,
},
Stop {
control_handle: ScoConnectionControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: ScoConnectionControlHandle,
method_type: fidl::MethodType,
},
}
impl ScoConnectionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_send_(self) -> Option<(Vec<u8>, ScoConnectionSend_Responder)> {
if let ScoConnectionRequest::Send_ { packet, responder } = self {
Some((packet, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ack_receive(self) -> Option<(ScoConnectionControlHandle)> {
if let ScoConnectionRequest::AckReceive { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_stop(self) -> Option<(ScoConnectionControlHandle)> {
if let ScoConnectionRequest::Stop { control_handle } = self {
Some((control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ScoConnectionRequest::Send_ { .. } => "send_",
ScoConnectionRequest::AckReceive { .. } => "ack_receive",
ScoConnectionRequest::Stop { .. } => "stop",
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_receive(&self, mut packet: &[u8]) -> Result<(), fidl::Error> {
self.inner.send::<ScoPacket>(
(packet,),
0,
0x4d4e96f6f7d1aa12,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ScoConnectionSend_Responder {
control_handle: std::mem::ManuallyDrop<ScoConnectionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ScoConnectionSend_Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ScoConnectionSend_Responder {
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 ScoConnectionSend_Responder {
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,
0x6e0c000ccd50adec,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct SnoopMarker;
impl fidl::endpoints::ProtocolMarker for SnoopMarker {
type Proxy = SnoopProxy;
type RequestStream = SnoopRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = SnoopSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Snoop";
}
pub trait SnoopProxyInterface: Send + Sync {
fn r#acknowledge_packets(&self, sequence: u64) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct SnoopSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for SnoopSynchronousProxy {
type Proxy = SnoopProxy;
type Protocol = SnoopMarker;
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 SnoopSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <SnoopMarker 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<SnoopEvent, fidl::Error> {
SnoopEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
self.client.send::<SnoopAcknowledgePacketsRequest>(
(sequence,),
0x3336b5082c111286,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct SnoopProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for SnoopProxy {
type Protocol = SnoopMarker;
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 SnoopProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> SnoopEventStream {
SnoopEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
SnoopProxyInterface::r#acknowledge_packets(self, sequence)
}
}
impl SnoopProxyInterface for SnoopProxy {
fn r#acknowledge_packets(&self, mut sequence: u64) -> Result<(), fidl::Error> {
self.client.send::<SnoopAcknowledgePacketsRequest>(
(sequence,),
0x3336b5082c111286,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct SnoopEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for SnoopEventStream {}
impl futures::stream::FusedStream for SnoopEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for SnoopEventStream {
type Item = Result<SnoopEvent, 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(SnoopEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum SnoopEvent {
OnObservePacket {
payload: SnoopOnObservePacketRequest,
},
OnDroppedPackets {
payload: SnoopOnDroppedPacketsRequest,
},
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl SnoopEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_observe_packet(self) -> Option<SnoopOnObservePacketRequest> {
if let SnoopEvent::OnObservePacket { payload } = self {
Some((payload))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_on_dropped_packets(self) -> Option<SnoopOnDroppedPacketsRequest> {
if let SnoopEvent::OnDroppedPackets { payload } = self {
Some((payload))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<SnoopEvent, 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 {
0x34d9f4c9c6bc10ca => {
let mut out = fidl::new_empty!(
SnoopOnObservePacketRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopOnObservePacketRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((SnoopEvent::OnObservePacket { payload: out }))
}
0x102a8d21278578b9 => {
let mut out = fidl::new_empty!(
SnoopOnDroppedPacketsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopOnDroppedPacketsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((SnoopEvent::OnDroppedPackets { payload: out }))
}
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(SnoopEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct SnoopRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for SnoopRequestStream {}
impl futures::stream::FusedStream for SnoopRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for SnoopRequestStream {
type Protocol = SnoopMarker;
type ControlHandle = SnoopControlHandle;
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 {
SnoopControlHandle { 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 SnoopRequestStream {
type Item = Result<SnoopRequest, 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 SnoopRequestStream 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 {
0x3336b5082c111286 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
SnoopAcknowledgePacketsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SnoopAcknowledgePacketsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = SnoopControlHandle { inner: this.inner.clone() };
Ok(SnoopRequest::AcknowledgePackets {
sequence: req.sequence,
control_handle,
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(SnoopRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SnoopControlHandle { 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(SnoopRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: SnoopControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <SnoopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum SnoopRequest {
AcknowledgePackets { sequence: u64, control_handle: SnoopControlHandle },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: SnoopControlHandle,
method_type: fidl::MethodType,
},
}
impl SnoopRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_acknowledge_packets(self) -> Option<(u64, SnoopControlHandle)> {
if let SnoopRequest::AcknowledgePackets { sequence, control_handle } = self {
Some((sequence, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
SnoopRequest::AcknowledgePackets { .. } => "acknowledge_packets",
SnoopRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
SnoopRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct SnoopControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for SnoopControlHandle {
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 SnoopControlHandle {
pub fn send_on_observe_packet(
&self,
mut payload: &SnoopOnObservePacketRequest,
) -> Result<(), fidl::Error> {
self.inner.send::<SnoopOnObservePacketRequest>(
payload,
0,
0x34d9f4c9c6bc10ca,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
pub fn send_on_dropped_packets(
&self,
mut payload: &SnoopOnDroppedPacketsRequest,
) -> Result<(), fidl::Error> {
self.inner.send::<SnoopOnDroppedPacketsRequest>(
payload,
0,
0x102a8d21278578b9,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VendorMarker;
impl fidl::endpoints::ProtocolMarker for VendorMarker {
type Proxy = VendorProxy;
type RequestStream = VendorRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VendorSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Vendor";
}
pub type VendorEncodeCommandResult = Result<Vec<u8>, i32>;
pub type VendorOpenHciResult = Result<fidl::endpoints::ClientEnd<HciMarker>, i32>;
pub type VendorOpenHciTransportResult = Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>;
pub type VendorOpenSnoopResult = Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>;
pub trait VendorProxyInterface: Send + Sync {
type GetFeaturesResponseFut: std::future::Future<Output = Result<VendorFeatures, fidl::Error>>
+ Send;
fn r#get_features(&self) -> Self::GetFeaturesResponseFut;
type EncodeCommandResponseFut: std::future::Future<Output = Result<VendorEncodeCommandResult, fidl::Error>>
+ Send;
fn r#encode_command(&self, payload: &VendorCommand) -> Self::EncodeCommandResponseFut;
type OpenHciResponseFut: std::future::Future<Output = Result<VendorOpenHciResult, fidl::Error>>
+ Send;
fn r#open_hci(&self) -> Self::OpenHciResponseFut;
type OpenHciTransportResponseFut: std::future::Future<Output = Result<VendorOpenHciTransportResult, fidl::Error>>
+ Send;
fn r#open_hci_transport(&self) -> Self::OpenHciTransportResponseFut;
type OpenSnoopResponseFut: std::future::Future<Output = Result<VendorOpenSnoopResult, fidl::Error>>
+ Send;
fn r#open_snoop(&self) -> Self::OpenSnoopResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VendorSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VendorSynchronousProxy {
type Proxy = VendorProxy;
type Protocol = VendorMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl VendorSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<VendorEvent, fidl::Error> {
VendorEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_features(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<VendorFeatures, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleType<VendorFeatures>,
>(
(),
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("get_features")?;
Ok(_response)
}
pub fn r#encode_command(
&self,
mut payload: &VendorCommand,
___deadline: zx::MonotonicInstant,
) -> Result<VendorEncodeCommandResult, fidl::Error> {
let _response = self.client.send_query::<
VendorCommand,
fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
>(
payload,
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("encode_command")?;
Ok(_response.map(|x| x.encoded))
}
pub fn r#open_hci(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<VendorOpenHciResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
>(
(),
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("open_hci")?;
Ok(_response.map(|x| x.channel))
}
pub fn r#open_hci_transport(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<VendorOpenHciTransportResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<VendorOpenHciTransportResponse, i32>,
>(
(),
0x1f785b656fb00834,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("open_hci_transport")?;
Ok(_response.map(|x| x.channel))
}
pub fn r#open_snoop(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<VendorOpenSnoopResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>,
>(
(),
0xafeca0e3c789043,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VendorMarker>("open_snoop")?;
Ok(_response.map(|x| x.channel))
}
}
#[derive(Debug, Clone)]
pub struct VendorProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VendorProxy {
type Protocol = VendorMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl VendorProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VendorEventStream {
VendorEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_features(
&self,
) -> fidl::client::QueryResponseFut<VendorFeatures, fidl::encoding::DefaultFuchsiaResourceDialect>
{
VendorProxyInterface::r#get_features(self)
}
pub fn r#encode_command(
&self,
mut payload: &VendorCommand,
) -> fidl::client::QueryResponseFut<
VendorEncodeCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VendorProxyInterface::r#encode_command(self, payload)
}
pub fn r#open_hci(
&self,
) -> fidl::client::QueryResponseFut<
VendorOpenHciResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VendorProxyInterface::r#open_hci(self)
}
pub fn r#open_hci_transport(
&self,
) -> fidl::client::QueryResponseFut<
VendorOpenHciTransportResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VendorProxyInterface::r#open_hci_transport(self)
}
pub fn r#open_snoop(
&self,
) -> fidl::client::QueryResponseFut<
VendorOpenSnoopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VendorProxyInterface::r#open_snoop(self)
}
}
impl VendorProxyInterface for VendorProxy {
type GetFeaturesResponseFut = fidl::client::QueryResponseFut<
VendorFeatures,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_features(&self) -> Self::GetFeaturesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VendorFeatures, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleType<VendorFeatures>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x102e70164c1dc911,
>(_buf?)?
.into_result::<VendorMarker>("get_features")?;
Ok(_response)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorFeatures>(
(),
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type EncodeCommandResponseFut = fidl::client::QueryResponseFut<
VendorEncodeCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#encode_command(&self, mut payload: &VendorCommand) -> Self::EncodeCommandResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VendorEncodeCommandResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorEncodeCommandResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x75430542c197cbe8,
>(_buf?)?
.into_result::<VendorMarker>("encode_command")?;
Ok(_response.map(|x| x.encoded))
}
self.client.send_query_and_decode::<VendorCommand, VendorEncodeCommandResult>(
payload,
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenHciResponseFut = fidl::client::QueryResponseFut<
VendorOpenHciResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_hci(&self) -> Self::OpenHciResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VendorOpenHciResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x7f05862f7ef92ec8,
>(_buf?)?
.into_result::<VendorMarker>("open_hci")?;
Ok(_response.map(|x| x.channel))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenHciResult>(
(),
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenHciTransportResponseFut = fidl::client::QueryResponseFut<
VendorOpenHciTransportResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_hci_transport(&self) -> Self::OpenHciTransportResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VendorOpenHciTransportResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorOpenHciTransportResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x1f785b656fb00834,
>(_buf?)?
.into_result::<VendorMarker>("open_hci_transport")?;
Ok(_response.map(|x| x.channel))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenHciTransportResult>(
(),
0x1f785b656fb00834,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
type OpenSnoopResponseFut = fidl::client::QueryResponseFut<
VendorOpenSnoopResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#open_snoop(&self) -> Self::OpenSnoopResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VendorOpenSnoopResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xafeca0e3c789043,
>(_buf?)?
.into_result::<VendorMarker>("open_snoop")?;
Ok(_response.map(|x| x.channel))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, VendorOpenSnoopResult>(
(),
0xafeca0e3c789043,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
}
pub struct VendorEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VendorEventStream {}
impl futures::stream::FusedStream for VendorEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VendorEventStream {
type Item = Result<VendorEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(VendorEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VendorEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl VendorEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VendorEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(VendorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VendorRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VendorRequestStream {}
impl futures::stream::FusedStream for VendorRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VendorRequestStream {
type Protocol = VendorMarker;
type ControlHandle = VendorControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
VendorControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 VendorRequestStream {
type Item = Result<VendorRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled VendorRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x102e70164c1dc911 => {
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 = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::GetFeatures {
responder: VendorGetFeaturesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x75430542c197cbe8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
VendorCommand,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VendorCommand>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::EncodeCommand {
payload: req,
responder: VendorEncodeCommandResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7f05862f7ef92ec8 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::OpenHci {
responder: VendorOpenHciResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x1f785b656fb00834 => {
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 = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::OpenHciTransport {
responder: VendorOpenHciTransportResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xafeca0e3c789043 => {
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 = VendorControlHandle { inner: this.inner.clone() };
Ok(VendorRequest::OpenSnoop {
responder: VendorOpenSnoopResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(VendorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VendorControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::OneWay,
})
}
_ if header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
this.inner.send_framework_err(
fidl::encoding::FrameworkErr::UnknownMethod,
header.tx_id,
header.ordinal,
header.dynamic_flags(),
(bytes, handles),
)?;
Ok(VendorRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VendorControlHandle { inner: this.inner.clone() },
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VendorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VendorRequest {
GetFeatures { responder: VendorGetFeaturesResponder },
EncodeCommand { payload: VendorCommand, responder: VendorEncodeCommandResponder },
OpenHci { responder: VendorOpenHciResponder },
OpenHciTransport { responder: VendorOpenHciTransportResponder },
OpenSnoop { responder: VendorOpenSnoopResponder },
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: VendorControlHandle,
method_type: fidl::MethodType,
},
}
impl VendorRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_features(self) -> Option<(VendorGetFeaturesResponder)> {
if let VendorRequest::GetFeatures { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_encode_command(self) -> Option<(VendorCommand, VendorEncodeCommandResponder)> {
if let VendorRequest::EncodeCommand { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_hci(self) -> Option<(VendorOpenHciResponder)> {
if let VendorRequest::OpenHci { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_hci_transport(self) -> Option<(VendorOpenHciTransportResponder)> {
if let VendorRequest::OpenHciTransport { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_open_snoop(self) -> Option<(VendorOpenSnoopResponder)> {
if let VendorRequest::OpenSnoop { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VendorRequest::GetFeatures { .. } => "get_features",
VendorRequest::EncodeCommand { .. } => "encode_command",
VendorRequest::OpenHci { .. } => "open_hci",
VendorRequest::OpenHciTransport { .. } => "open_hci_transport",
VendorRequest::OpenSnoop { .. } => "open_snoop",
VendorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
"unknown one-way method"
}
VendorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
"unknown two-way method"
}
}
}
}
#[derive(Debug, Clone)]
pub struct VendorControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VendorControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 VendorControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorGetFeaturesResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorGetFeaturesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorGetFeaturesResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorGetFeaturesResponder {
pub fn send(self, mut payload: &VendorFeatures) -> 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: &VendorFeatures) -> Result<(), fidl::Error> {
let _result = self.send_raw(payload);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut payload: &VendorFeatures) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleType<VendorFeatures>>(
fidl::encoding::Flexible::new(payload),
self.tx_id,
0x102e70164c1dc911,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorEncodeCommandResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorEncodeCommandResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorEncodeCommandResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorEncodeCommandResponder {
pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
VendorEncodeCommandResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.map(|encoded| (encoded,))),
self.tx_id,
0x75430542c197cbe8,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorOpenHciResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorOpenHciResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorOpenHciResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorOpenHciResponder {
pub fn send(
self,
mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl::endpoints::ClientEnd<HciMarker>, i32>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleResultType<VendorOpenHciResponse, i32>>(
fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
self.tx_id,
0x7f05862f7ef92ec8,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorOpenHciTransportResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorOpenHciTransportResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorOpenHciTransportResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorOpenHciTransportResponder {
pub fn send(
self,
mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl::endpoints::ClientEnd<HciTransportMarker>, i32>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
VendorOpenHciTransportResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
self.tx_id,
0x1f785b656fb00834,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VendorOpenSnoopResponder {
control_handle: std::mem::ManuallyDrop<VendorControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VendorOpenSnoopResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VendorOpenSnoopResponder {
type ControlHandle = VendorControlHandle;
fn control_handle(&self) -> &VendorControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VendorOpenSnoopResponder {
pub fn send(
self,
mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl::endpoints::ClientEnd<SnoopMarker>, i32>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::FlexibleResultType<VendorOpenSnoopResponse, i32>>(
fidl::encoding::FlexibleResult::new(result.map(|channel| (channel,))),
self.tx_id,
0xafeca0e3c789043,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct VirtualControllerMarker;
impl fidl::endpoints::ProtocolMarker for VirtualControllerMarker {
type Proxy = VirtualControllerProxy;
type RequestStream = VirtualControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = VirtualControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) VirtualController";
}
pub type VirtualControllerCreateEmulatorResult = Result<Option<String>, i32>;
pub trait VirtualControllerProxyInterface: Send + Sync {
type CreateEmulatorResponseFut: std::future::Future<Output = Result<VirtualControllerCreateEmulatorResult, fidl::Error>>
+ Send;
fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut;
fn r#create_loopback_device(
&self,
payload: VirtualControllerCreateLoopbackDeviceRequest,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct VirtualControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for VirtualControllerSynchronousProxy {
type Proxy = VirtualControllerProxy;
type Protocol = VirtualControllerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl VirtualControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<VirtualControllerEvent, fidl::Error> {
VirtualControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#create_emulator(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::FlexibleResultType<VirtualControllerCreateEmulatorResponse, i32>,
>(
(),
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::FLEXIBLE,
___deadline,
)?
.into_result::<VirtualControllerMarker>("create_emulator")?;
Ok(_response.map(|x| x.name))
}
pub fn r#create_loopback_device(
&self,
mut payload: VirtualControllerCreateLoopbackDeviceRequest,
) -> Result<(), fidl::Error> {
self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
&mut payload,
0x7525af8edecb6c0c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Clone)]
pub struct VirtualControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for VirtualControllerProxy {
type Protocol = VirtualControllerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl VirtualControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> VirtualControllerEventStream {
VirtualControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#create_emulator(
&self,
) -> fidl::client::QueryResponseFut<
VirtualControllerCreateEmulatorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
VirtualControllerProxyInterface::r#create_emulator(self)
}
pub fn r#create_loopback_device(
&self,
mut payload: VirtualControllerCreateLoopbackDeviceRequest,
) -> Result<(), fidl::Error> {
VirtualControllerProxyInterface::r#create_loopback_device(self, payload)
}
}
impl VirtualControllerProxyInterface for VirtualControllerProxy {
type CreateEmulatorResponseFut = fidl::client::QueryResponseFut<
VirtualControllerCreateEmulatorResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#create_emulator(&self) -> Self::CreateEmulatorResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<VirtualControllerCreateEmulatorResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::FlexibleResultType<VirtualControllerCreateEmulatorResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x130273fc0a35cedb,
>(_buf?)?
.into_result::<VirtualControllerMarker>("create_emulator")?;
Ok(_response.map(|x| x.name))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
VirtualControllerCreateEmulatorResult,
>(
(),
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::FLEXIBLE,
_decode,
)
}
fn r#create_loopback_device(
&self,
mut payload: VirtualControllerCreateLoopbackDeviceRequest,
) -> Result<(), fidl::Error> {
self.client.send::<VirtualControllerCreateLoopbackDeviceRequest>(
&mut payload,
0x7525af8edecb6c0c,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
pub struct VirtualControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for VirtualControllerEventStream {}
impl futures::stream::FusedStream for VirtualControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for VirtualControllerEventStream {
type Item = Result<VirtualControllerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(VirtualControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum VirtualControllerEvent {
#[non_exhaustive]
_UnknownEvent {
ordinal: u64,
},
}
impl VirtualControllerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<VirtualControllerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
Ok(VirtualControllerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct VirtualControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for VirtualControllerRequestStream {}
impl futures::stream::FusedStream for VirtualControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for VirtualControllerRequestStream {
type Protocol = VirtualControllerMarker;
type ControlHandle = VirtualControllerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
VirtualControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<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 VirtualControllerRequestStream {
type Item = Result<VirtualControllerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled VirtualControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, 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 {
0x130273fc0a35cedb => {
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 =
VirtualControllerControlHandle { inner: this.inner.clone() };
Ok(VirtualControllerRequest::CreateEmulator {
responder: VirtualControllerCreateEmulatorResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7525af8edecb6c0c => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
VirtualControllerCreateLoopbackDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<VirtualControllerCreateLoopbackDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle =
VirtualControllerControlHandle { inner: this.inner.clone() };
Ok(VirtualControllerRequest::CreateLoopbackDevice {
payload: req,
control_handle,
})
}
_ if header.tx_id == 0
&& header
.dynamic_flags()
.contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
{
Ok(VirtualControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VirtualControllerControlHandle {
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(VirtualControllerRequest::_UnknownMethod {
ordinal: header.ordinal,
control_handle: VirtualControllerControlHandle {
inner: this.inner.clone(),
},
method_type: fidl::MethodType::TwoWay,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<VirtualControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum VirtualControllerRequest {
CreateEmulator { responder: VirtualControllerCreateEmulatorResponder },
CreateLoopbackDevice {
payload: VirtualControllerCreateLoopbackDeviceRequest,
control_handle: VirtualControllerControlHandle,
},
#[non_exhaustive]
_UnknownMethod {
ordinal: u64,
control_handle: VirtualControllerControlHandle,
method_type: fidl::MethodType,
},
}
impl VirtualControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_create_emulator(self) -> Option<(VirtualControllerCreateEmulatorResponder)> {
if let VirtualControllerRequest::CreateEmulator { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_create_loopback_device(
self,
) -> Option<(VirtualControllerCreateLoopbackDeviceRequest, VirtualControllerControlHandle)>
{
if let VirtualControllerRequest::CreateLoopbackDevice { payload, control_handle } = self {
Some((payload, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
VirtualControllerRequest::CreateEmulator { .. } => "create_emulator",
VirtualControllerRequest::CreateLoopbackDevice { .. } => "create_loopback_device",
VirtualControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::OneWay,
..
} => "unknown one-way method",
VirtualControllerRequest::_UnknownMethod {
method_type: fidl::MethodType::TwoWay,
..
} => "unknown two-way method",
}
}
}
#[derive(Debug, Clone)]
pub struct VirtualControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for VirtualControllerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[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 VirtualControllerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct VirtualControllerCreateEmulatorResponder {
control_handle: std::mem::ManuallyDrop<VirtualControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for VirtualControllerCreateEmulatorResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for VirtualControllerCreateEmulatorResponder {
type ControlHandle = VirtualControllerControlHandle;
fn control_handle(&self) -> &VirtualControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl VirtualControllerCreateEmulatorResponder {
pub fn send(self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<Option<&str>, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Option<&str>, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
VirtualControllerCreateEmulatorResponse,
i32,
>>(
fidl::encoding::FlexibleResult::new(result.map(|name| (name,))),
self.tx_id,
0x130273fc0a35cedb,
fidl::encoding::DynamicFlags::FLEXIBLE,
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct HciServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for HciServiceMarker {
type Proxy = HciServiceProxy;
type Request = HciServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.hardware.bluetooth.HciService";
}
#[cfg(target_os = "fuchsia")]
pub enum HciServiceRequest {
Hci(HciRequestStream),
HciTransport(HciTransportRequestStream),
Snoop(SnoopRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for HciServiceRequest {
type Service = HciServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"hci" => Self::Hci(<HciRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
)),
"hci_transport" => Self::HciTransport(
<HciTransportRequestStream as fidl::endpoints::RequestStream>::from_channel(
_channel,
),
),
"snoop" => Self::Snoop(
<SnoopRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
_ => panic!("no such member protocol name for service HciService"),
}
}
fn member_names() -> &'static [&'static str] {
&["hci", "hci_transport", "snoop"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct HciServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for HciServiceProxy {
type Service = HciServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl HciServiceProxy {
pub fn connect_to_hci(&self) -> Result<HciProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<HciMarker>();
self.connect_channel_to_hci(server_end)?;
Ok(proxy)
}
pub fn connect_to_hci_sync(&self) -> Result<HciSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HciMarker>();
self.connect_channel_to_hci(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_hci(
&self,
server_end: fidl::endpoints::ServerEnd<HciMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("hci", server_end.into_channel())
}
pub fn connect_to_hci_transport(&self) -> Result<HciTransportProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<HciTransportMarker>();
self.connect_channel_to_hci_transport(server_end)?;
Ok(proxy)
}
pub fn connect_to_hci_transport_sync(
&self,
) -> Result<HciTransportSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HciTransportMarker>();
self.connect_channel_to_hci_transport(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_hci_transport(
&self,
server_end: fidl::endpoints::ServerEnd<HciTransportMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("hci_transport", server_end.into_channel())
}
pub fn connect_to_snoop(&self) -> Result<SnoopProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<SnoopMarker>();
self.connect_channel_to_snoop(server_end)?;
Ok(proxy)
}
pub fn connect_to_snoop_sync(&self) -> Result<SnoopSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<SnoopMarker>();
self.connect_channel_to_snoop(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_snoop(
&self,
server_end: fidl::endpoints::ServerEnd<SnoopMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("snoop", server_end.into_channel())
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for ConnectionState {
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 ConnectionState {
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 ConnectionState
{
#[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 ConnectionState {
#[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 EmulatorError {
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 EmulatorError {
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 EmulatorError {
#[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 EmulatorError {
#[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 EmulatorPeerError {
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 EmulatorPeerError {
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 EmulatorPeerError
{
#[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 EmulatorPeerError {
#[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 HciConfig {
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 HciConfig {
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 HciConfig {
#[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 HciConfig {
#[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 HciError {
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 HciError {
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 HciError {
#[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 HciError {
#[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 LegacyAdvertisingType {
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 LegacyAdvertisingType {
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 LegacyAdvertisingType
{
#[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 LegacyAdvertisingType {
#[inline(always)]
fn new_empty() -> Self {
Self::AdvInd
}
#[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 PacketDirection {
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 PacketDirection {
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 PacketDirection
{
#[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 PacketDirection {
#[inline(always)]
fn new_empty() -> Self {
Self::HostToController
}
#[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 ScoCodingFormat {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoCodingFormat {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ScoCodingFormat
{
#[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 ScoCodingFormat {
#[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 ScoEncoding {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoEncoding {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ScoEncoding {
#[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 ScoEncoding {
#[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 ScoSampleRate {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ScoSampleRate {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ScoSampleRate {
#[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 ScoSampleRate {
#[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 VendorAclDirection {
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 VendorAclDirection {
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 VendorAclDirection
{
#[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 VendorAclDirection {
#[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 VendorAclPriority {
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 VendorAclPriority {
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 VendorAclPriority
{
#[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 VendorAclPriority {
#[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(())
}
}
impl fidl::encoding::ValueTypeMarker for EmulatorWatchLeScanStatesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EmulatorWatchLeScanStatesResponse {
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<EmulatorWatchLeScanStatesResponse, D>
for &EmulatorWatchLeScanStatesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EmulatorWatchLeScanStatesResponse>(offset);
fidl::encoding::Encode::<EmulatorWatchLeScanStatesResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<LeScanState> as fidl::encoding::ValueTypeMarker>::borrow(&self.states),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LeScanState>, D>,
> fidl::encoding::Encode<EmulatorWatchLeScanStatesResponse, 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::<EmulatorWatchLeScanStatesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EmulatorWatchLeScanStatesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { states: fidl::new_empty!(fidl::encoding::UnboundedVector<LeScanState>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<LeScanState>,
D,
&mut self.states,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for EmulatorWatchLegacyAdvertisingStatesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EmulatorWatchLegacyAdvertisingStatesResponse {
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<EmulatorWatchLegacyAdvertisingStatesResponse, D>
for &EmulatorWatchLegacyAdvertisingStatesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EmulatorWatchLegacyAdvertisingStatesResponse>(offset);
fidl::encoding::Encode::<EmulatorWatchLegacyAdvertisingStatesResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<LegacyAdvertisingState> as fidl::encoding::ValueTypeMarker>::borrow(&self.states),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LegacyAdvertisingState>, D>,
> fidl::encoding::Encode<EmulatorWatchLegacyAdvertisingStatesResponse, 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::<EmulatorWatchLegacyAdvertisingStatesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for EmulatorWatchLegacyAdvertisingStatesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
states: fidl::new_empty!(
fidl::encoding::UnboundedVector<LegacyAdvertisingState>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<LegacyAdvertisingState>,
D,
&mut self.states,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HciConfigureScoRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciConfigureScoRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
3
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<HciConfigureScoRequest, D> for &HciConfigureScoRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciConfigureScoRequest>(offset);
fidl::encoding::Encode::<HciConfigureScoRequest, D>::encode(
(
<ScoCodingFormat as fidl::encoding::ValueTypeMarker>::borrow(
&self.coding_format,
),
<ScoEncoding as fidl::encoding::ValueTypeMarker>::borrow(&self.encoding),
<ScoSampleRate as fidl::encoding::ValueTypeMarker>::borrow(&self.sample_rate),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ScoCodingFormat, D>,
T1: fidl::encoding::Encode<ScoEncoding, D>,
T2: fidl::encoding::Encode<ScoSampleRate, D>,
> fidl::encoding::Encode<HciConfigureScoRequest, 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::<HciConfigureScoRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for HciConfigureScoRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
coding_format: fidl::new_empty!(ScoCodingFormat, D),
encoding: fidl::new_empty!(ScoEncoding, D),
sample_rate: fidl::new_empty!(ScoSampleRate, 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!(
ScoCodingFormat,
D,
&mut self.coding_format,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(ScoEncoding, D, &mut self.encoding, decoder, offset + 1, _depth)?;
fidl::decode!(ScoSampleRate, D, &mut self.sample_rate, decoder, offset + 2, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenAclDataChannelRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenAclDataChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HciOpenAclDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciOpenAclDataChannelRequest
{
#[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::<HciOpenAclDataChannelRequest>(offset);
fidl::encoding::Encode::<
HciOpenAclDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HciOpenAclDataChannelRequest,
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::<HciOpenAclDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenAclDataChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenCommandChannelRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenCommandChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HciOpenCommandChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciOpenCommandChannelRequest
{
#[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::<HciOpenCommandChannelRequest>(offset);
fidl::encoding::Encode::<
HciOpenCommandChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HciOpenCommandChannelRequest,
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::<HciOpenCommandChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenCommandChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenIsoDataChannelRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenIsoDataChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HciOpenIsoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciOpenIsoDataChannelRequest
{
#[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::<HciOpenIsoDataChannelRequest>(offset);
fidl::encoding::Encode::<
HciOpenIsoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HciOpenIsoDataChannelRequest,
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::<HciOpenIsoDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenIsoDataChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenScoDataChannelRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenScoDataChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HciOpenScoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciOpenScoDataChannelRequest
{
#[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::<HciOpenScoDataChannelRequest>(offset);
fidl::encoding::Encode::<
HciOpenScoDataChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HciOpenScoDataChannelRequest,
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::<HciOpenScoDataChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenScoDataChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for HciOpenSnoopChannelRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HciOpenSnoopChannelRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
HciOpenSnoopChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciOpenSnoopChannelRequest
{
#[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::<HciOpenSnoopChannelRequest>(offset);
fidl::encoding::Encode::<
HciOpenSnoopChannelRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.channel
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
HciOpenSnoopChannelRequest,
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::<HciOpenSnoopChannelRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciOpenSnoopChannelRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.channel, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerAssignConnectionStatusRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerAssignConnectionStatusRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<PeerAssignConnectionStatusRequest, D>
for &PeerAssignConnectionStatusRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerAssignConnectionStatusRequest>(offset);
fidl::encoding::Encode::<PeerAssignConnectionStatusRequest, D>::encode(
(<HciError as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HciError, D>>
fidl::encoding::Encode<PeerAssignConnectionStatusRequest, 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::<PeerAssignConnectionStatusRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerAssignConnectionStatusRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { status: fidl::new_empty!(HciError, 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!(HciError, D, &mut self.status, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerEmulateLeConnectionCompleteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerEmulateLeConnectionCompleteRequest {
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<PeerEmulateLeConnectionCompleteRequest, D>
for &PeerEmulateLeConnectionCompleteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerEmulateLeConnectionCompleteRequest>(offset);
fidl::encoding::Encode::<PeerEmulateLeConnectionCompleteRequest, D>::encode(
(
<fidl_fuchsia_bluetooth::ConnectionRole as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_bluetooth::ConnectionRole, D>,
> fidl::encoding::Encode<PeerEmulateLeConnectionCompleteRequest, 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::<PeerEmulateLeConnectionCompleteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerEmulateLeConnectionCompleteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { role: fidl::new_empty!(fidl_fuchsia_bluetooth::ConnectionRole, 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::ConnectionRole,
D,
&mut self.role,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerSetServiceDefinitionsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerSetServiceDefinitionsRequest {
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<PeerSetServiceDefinitionsRequest, D>
for &PeerSetServiceDefinitionsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerSetServiceDefinitionsRequest>(offset);
fidl::encoding::Encode::<PeerSetServiceDefinitionsRequest, D>::encode(
(
<fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ServiceDefinition, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.service_definitions),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<
fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ServiceDefinition, 32>,
D,
>,
> fidl::encoding::Encode<PeerSetServiceDefinitionsRequest, 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::<PeerSetServiceDefinitionsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerSetServiceDefinitionsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
service_definitions: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ServiceDefinition, 32>, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_bluetooth_bredr::ServiceDefinition, 32>, D, &mut self.service_definitions, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PeerWatchConnectionStatesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerWatchConnectionStatesResponse {
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<PeerWatchConnectionStatesResponse, D>
for &PeerWatchConnectionStatesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerWatchConnectionStatesResponse>(offset);
fidl::encoding::Encode::<PeerWatchConnectionStatesResponse, D>::encode(
(
<fidl::encoding::UnboundedVector<ConnectionState> as fidl::encoding::ValueTypeMarker>::borrow(&self.states),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<ConnectionState>, D>,
> fidl::encoding::Encode<PeerWatchConnectionStatesResponse, 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::<PeerWatchConnectionStatesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for PeerWatchConnectionStatesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { states: fidl::new_empty!(fidl::encoding::UnboundedVector<ConnectionState>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<ConnectionState>,
D,
&mut self.states,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ScoPacket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ScoPacket {
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<ScoPacket, D>
for &ScoPacket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ScoPacket>(offset);
fidl::encoding::Encode::<ScoPacket, D>::encode(
(<fidl::encoding::Vector<u8, 258> as fidl::encoding::ValueTypeMarker>::borrow(
&self.packet,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 258>, D>,
> fidl::encoding::Encode<ScoPacket, 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::<ScoPacket>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ScoPacket {
#[inline(always)]
fn new_empty() -> Self {
Self { packet: fidl::new_empty!(fidl::encoding::Vector<u8, 258>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 258>, D, &mut self.packet, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SnoopAcknowledgePacketsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SnoopAcknowledgePacketsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<SnoopAcknowledgePacketsRequest, D>
for &SnoopAcknowledgePacketsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnoopAcknowledgePacketsRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut SnoopAcknowledgePacketsRequest)
.write_unaligned((self as *const SnoopAcknowledgePacketsRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
fidl::encoding::Encode<SnoopAcknowledgePacketsRequest, 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::<SnoopAcknowledgePacketsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for SnoopAcknowledgePacketsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { sequence: fidl::new_empty!(u64, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VendorEncodeCommandResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorEncodeCommandResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<VendorEncodeCommandResponse, D> for &VendorEncodeCommandResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorEncodeCommandResponse>(offset);
fidl::encoding::Encode::<VendorEncodeCommandResponse, D>::encode(
(<fidl::encoding::Vector<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(
&self.encoded,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 16>, D>,
> fidl::encoding::Encode<VendorEncodeCommandResponse, 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::<VendorEncodeCommandResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VendorEncodeCommandResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { encoded: fidl::new_empty!(fidl::encoding::Vector<u8, 16>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 16>, D, &mut self.encoded, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VendorOpenHciTransportResponse {
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 VendorOpenHciTransportResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
VendorOpenHciTransportResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VendorOpenHciTransportResponse
{
#[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::<VendorOpenHciTransportResponse>(offset);
fidl::encoding::Encode::<VendorOpenHciTransportResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VendorOpenHciTransportResponse,
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::<VendorOpenHciTransportResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VendorOpenHciTransportResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciTransportMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VendorOpenHciResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorOpenHciResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<VendorOpenHciResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut VendorOpenHciResponse
{
#[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::<VendorOpenHciResponse>(offset);
fidl::encoding::Encode::<VendorOpenHciResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<VendorOpenHciResponse, 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::<VendorOpenHciResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VendorOpenHciResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<HciMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for VendorOpenSnoopResponse {
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 VendorOpenSnoopResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
VendorOpenSnoopResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VendorOpenSnoopResponse
{
#[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::<VendorOpenSnoopResponse>(offset);
fidl::encoding::Encode::<VendorOpenSnoopResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.channel),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
VendorOpenSnoopResponse,
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::<VendorOpenSnoopResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VendorOpenSnoopResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
channel: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SnoopMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.channel,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VirtualControllerCreateEmulatorResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtualControllerCreateEmulatorResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<VirtualControllerCreateEmulatorResponse, D>
for &VirtualControllerCreateEmulatorResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateEmulatorResponse>(offset);
fidl::encoding::Encode::<VirtualControllerCreateEmulatorResponse, D>::encode(
(
<fidl::encoding::Optional<fidl::encoding::BoundedString<32>> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<32>>, D>,
> fidl::encoding::Encode<VirtualControllerCreateEmulatorResponse, 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::<VirtualControllerCreateEmulatorResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for VirtualControllerCreateEmulatorResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Optional<fidl::encoding::BoundedString<32>>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl AclBufferSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.total_num_data_packets {
return 2;
}
if let Some(_) = self.data_packet_length {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AclBufferSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AclBufferSettings {
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<AclBufferSettings, D>
for &AclBufferSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AclBufferSettings>(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.data_packet_length
.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::<u8, D>(
self.total_num_data_packets
.as_ref()
.map(<u8 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 AclBufferSettings {
#[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.data_packet_length.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 =
<u8 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.total_num_data_packets.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(u8, 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 AdvertisingData {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.data {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AdvertisingData {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AdvertisingData {
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<AdvertisingData, D>
for &AdvertisingData
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AdvertisingData>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 31>, D>(
self.data.as_ref().map(
<fidl::encoding::Vector<u8, 31> 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 AdvertisingData {
#[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 =
<fidl::encoding::Vector<u8, 31> 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
.data
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 31>, D));
fidl::decode!(fidl::encoding::Vector<u8, 31>, 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 AndroidVendorSupport {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.minor_version {
return 2;
}
if let Some(_) = self.major_version {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for AndroidVendorSupport {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AndroidVendorSupport {
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<AndroidVendorSupport, D>
for &AndroidVendorSupport
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AndroidVendorSupport>(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::<u8, D>(
self.major_version.as_ref().map(<u8 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::<u8, D>(
self.minor_version.as_ref().map(<u8 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 AndroidVendorSupport {
#[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 =
<u8 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.major_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(u8, 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 =
<u8 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.minor_version.get_or_insert_with(|| fidl::new_empty!(u8, D));
fidl::decode!(u8, 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 ControllerParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.device_class {
return 2;
}
if let Some(_) = self.local_name {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for ControllerParameters {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ControllerParameters {
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<ControllerParameters, D>
for &ControllerParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ControllerParameters>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<248>, D>(
self.local_name.as_ref().map(
<fidl::encoding::BoundedString<248> 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::<fidl_fuchsia_bluetooth::DeviceClass, D>(
self.device_class.as_ref().map(<fidl_fuchsia_bluetooth::DeviceClass 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 ControllerParameters {
#[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 =
<fidl::encoding::BoundedString<248> 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
.local_name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<248>, D));
fidl::decode!(
fidl::encoding::BoundedString<248>,
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 = <fidl_fuchsia_bluetooth::DeviceClass 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.device_class.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::DeviceClass, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::DeviceClass,
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 EmulatorSettings {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.le_acl_buffer_settings {
return 5;
}
if let Some(_) = self.acl_buffer_settings {
return 4;
}
if let Some(_) = self.extended_advertising {
return 3;
}
if let Some(_) = self.hci_config {
return 2;
}
if let Some(_) = self.address {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for EmulatorSettings {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for EmulatorSettings {
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<EmulatorSettings, D>
for &EmulatorSettings
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<EmulatorSettings>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Address, D>(
self.address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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::<HciConfig, D>(
self.hci_config
.as_ref()
.map(<HciConfig as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.extended_advertising
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AclBufferSettings, D>(
self.acl_buffer_settings
.as_ref()
.map(<AclBufferSettings as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AclBufferSettings, D>(
self.le_acl_buffer_settings
.as_ref()
.map(<AclBufferSettings 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 EmulatorSettings {
#[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 =
<fidl_fuchsia_bluetooth::Address 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
.address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
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 =
<HciConfig 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.hci_config.get_or_insert_with(|| fidl::new_empty!(HciConfig, D));
fidl::decode!(HciConfig, 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 < 3 {
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 =
<bool 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.extended_advertising.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 < 4 {
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 =
<AclBufferSettings 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
.acl_buffer_settings
.get_or_insert_with(|| fidl::new_empty!(AclBufferSettings, D));
fidl::decode!(AclBufferSettings, 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 < 5 {
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 =
<AclBufferSettings 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
.le_acl_buffer_settings
.get_or_insert_with(|| fidl::new_empty!(AclBufferSettings, D));
fidl::decode!(AclBufferSettings, 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 HciTransportConfigureScoRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.connection {
return 4;
}
if let Some(_) = self.sample_rate {
return 3;
}
if let Some(_) = self.encoding {
return 2;
}
if let Some(_) = self.coding_format {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for HciTransportConfigureScoRequest {
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 HciTransportConfigureScoRequest {
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<
HciTransportConfigureScoRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut HciTransportConfigureScoRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HciTransportConfigureScoRequest>(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::<
ScoCodingFormat,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.coding_format
.as_ref()
.map(<ScoCodingFormat 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::<
ScoEncoding,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.encoding
.as_ref()
.map(<ScoEncoding as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
ScoSampleRate,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.sample_rate
.as_ref()
.map(<ScoSampleRate as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.connection.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for HciTransportConfigureScoRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<ScoCodingFormat 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.coding_format.get_or_insert_with(|| {
fidl::new_empty!(ScoCodingFormat, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ScoCodingFormat,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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 =
<ScoEncoding 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.encoding.get_or_insert_with(|| {
fidl::new_empty!(ScoEncoding, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ScoEncoding,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
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 =
<ScoSampleRate 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.sample_rate.get_or_insert_with(|| {
fidl::new_empty!(ScoSampleRate, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
ScoSampleRate,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 4 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<ScoConnectionMarker>,
> 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.connection.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScoConnectionMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl LeScanState {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.address_type {
return 6;
}
if let Some(_) = self.filter_duplicates {
return 5;
}
if let Some(_) = self.window {
return 4;
}
if let Some(_) = self.interval {
return 3;
}
if let Some(_) = self.active {
return 2;
}
if let Some(_) = self.enabled {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LeScanState {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LeScanState {
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<LeScanState, D>
for &LeScanState
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LeScanState>(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::<bool, D>(
self.enabled.as_ref().map(<bool 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::<bool, D>(
self.active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.interval.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.window.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<bool, D>(
self.filter_duplicates
.as_ref()
.map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::AddressType, D>(
self.address_type.as_ref().map(<fidl_fuchsia_bluetooth::AddressType 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 LeScanState {
#[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 =
<bool 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.enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 =
<bool 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.active.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 < 3 {
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.interval.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 < 4 {
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.window.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 < 5 {
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 =
<bool 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.filter_duplicates.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 < 6 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_bluetooth::AddressType 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.address_type.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::AddressType, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::AddressType,
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 LegacyAdvertisingState {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.scan_response {
return 7;
}
if let Some(_) = self.advertising_data {
return 6;
}
if let Some(_) = self.interval_max {
return 5;
}
if let Some(_) = self.interval_min {
return 4;
}
if let Some(_) = self.address_type {
return 3;
}
if let Some(_) = self.type_ {
return 2;
}
if let Some(_) = self.enabled {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for LegacyAdvertisingState {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LegacyAdvertisingState {
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<LegacyAdvertisingState, D> for &LegacyAdvertisingState
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LegacyAdvertisingState>(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::<bool, D>(
self.enabled.as_ref().map(<bool 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::<LegacyAdvertisingType, D>(
self.type_
.as_ref()
.map(<LegacyAdvertisingType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::AddressType, D>(
self.address_type.as_ref().map(<fidl_fuchsia_bluetooth::AddressType as fidl::encoding::ValueTypeMarker>::borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
if 4 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (4 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.interval_min.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 5 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (5 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<u16, D>(
self.interval_max.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 6 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (6 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
self.advertising_data
.as_ref()
.map(<AdvertisingData as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 7 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (7 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
self.scan_response
.as_ref()
.map(<AdvertisingData 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 LegacyAdvertisingState
{
#[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 =
<bool 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.enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 =
<LegacyAdvertisingType 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.type_.get_or_insert_with(|| fidl::new_empty!(LegacyAdvertisingType, D));
fidl::decode!(
LegacyAdvertisingType,
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 < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl_fuchsia_bluetooth::AddressType 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.address_type.get_or_insert_with(|| {
fidl::new_empty!(fidl_fuchsia_bluetooth::AddressType, D)
});
fidl::decode!(
fidl_fuchsia_bluetooth::AddressType,
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 < 4 {
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.interval_min.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 < 5 {
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.interval_max.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 < 6 {
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 =
<AdvertisingData 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
.advertising_data
.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
fidl::decode!(AdvertisingData, 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 < 7 {
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 =
<AdvertisingData 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.scan_response.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
fidl::decode!(AdvertisingData, 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 PeerParameters {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.channel {
return 3;
}
if let Some(_) = self.connectable {
return 2;
}
if let Some(_) = self.address {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for PeerParameters {
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 PeerParameters {
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<PeerParameters, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut PeerParameters
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerParameters>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl_fuchsia_bluetooth::Address,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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::<
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.connectable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
self.channel.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
encoder, offset + cur_offset, depth
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for PeerParameters
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl_fuchsia_bluetooth::Address 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.address.get_or_insert_with(|| {
fidl::new_empty!(
fidl_fuchsia_bluetooth::Address,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_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 =
<bool 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.connectable.get_or_insert_with(|| {
fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
});
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 3 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<PeerMarker>,
> 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.channel.get_or_insert_with(|| {
fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect
)
});
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PeerMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl PeerSetLeAdvertisementRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.scan_response {
return 3;
}
if let Some(_) = self.advertisement {
return 2;
}
if let Some(_) = self.le_address {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for PeerSetLeAdvertisementRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PeerSetLeAdvertisementRequest {
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<PeerSetLeAdvertisementRequest, D>
for &PeerSetLeAdvertisementRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PeerSetLeAdvertisementRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_bluetooth::Address, D>(
self.le_address.as_ref().map(
<fidl_fuchsia_bluetooth::Address 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::<AdvertisingData, D>(
self.advertisement
.as_ref()
.map(<AdvertisingData as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<AdvertisingData, D>(
self.scan_response
.as_ref()
.map(<AdvertisingData 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 PeerSetLeAdvertisementRequest
{
#[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 =
<fidl_fuchsia_bluetooth::Address 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
.le_address
.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_bluetooth::Address, D));
fidl::decode!(
fidl_fuchsia_bluetooth::Address,
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 =
<AdvertisingData 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.advertisement.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
fidl::decode!(AdvertisingData, 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 < 3 {
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 =
<AdvertisingData 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.scan_response.get_or_insert_with(|| fidl::new_empty!(AdvertisingData, D));
fidl::decode!(AdvertisingData, 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 SnoopOnDroppedPacketsRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.received {
return 2;
}
if let Some(_) = self.sent {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for SnoopOnDroppedPacketsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SnoopOnDroppedPacketsRequest {
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<SnoopOnDroppedPacketsRequest, D> for &SnoopOnDroppedPacketsRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnoopOnDroppedPacketsRequest>(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::<u32, D>(
self.sent.as_ref().map(<u32 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::<u32, D>(
self.received.as_ref().map(<u32 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 SnoopOnDroppedPacketsRequest
{
#[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 =
<u32 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.sent.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 =
<u32 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.received.get_or_insert_with(|| fidl::new_empty!(u32, D));
fidl::decode!(u32, 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 SnoopOnObservePacketRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.packet {
return 3;
}
if let Some(_) = self.direction {
return 2;
}
if let Some(_) = self.sequence {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for SnoopOnObservePacketRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SnoopOnObservePacketRequest {
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<SnoopOnObservePacketRequest, D> for &SnoopOnObservePacketRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnoopOnObservePacketRequest>(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::<u64, D>(
self.sequence.as_ref().map(<u64 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::<PacketDirection, D>(
self.direction
.as_ref()
.map(<PacketDirection as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<SnoopPacket, D>(
self.packet.as_ref().map(<SnoopPacket 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 SnoopOnObservePacketRequest
{
#[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 =
<u64 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.sequence.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, 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 =
<PacketDirection 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.direction.get_or_insert_with(|| fidl::new_empty!(PacketDirection, D));
fidl::decode!(PacketDirection, 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 < 3 {
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 =
<SnoopPacket 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.packet.get_or_insert_with(|| fidl::new_empty!(SnoopPacket, D));
fidl::decode!(SnoopPacket, 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 VendorFeatures {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.android_vendor_extensions {
return 2;
}
if let Some(_) = self.acl_priority_command {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for VendorFeatures {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorFeatures {
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<VendorFeatures, D>
for &VendorFeatures
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorFeatures>(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::<bool, D>(
self.acl_priority_command
.as_ref()
.map(<bool 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::<AndroidVendorSupport, D>(
self.android_vendor_extensions
.as_ref()
.map(<AndroidVendorSupport 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 VendorFeatures {
#[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 =
<bool 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.acl_priority_command.get_or_insert_with(|| fidl::new_empty!(bool, D));
fidl::decode!(bool, 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 =
<AndroidVendorSupport 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
.android_vendor_extensions
.get_or_insert_with(|| fidl::new_empty!(AndroidVendorSupport, D));
fidl::decode!(
AndroidVendorSupport,
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 VendorSetAclPriorityParams {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.direction {
return 3;
}
if let Some(_) = self.priority {
return 2;
}
if let Some(_) = self.connection_handle {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for VendorSetAclPriorityParams {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorSetAclPriorityParams {
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<VendorSetAclPriorityParams, D> for &VendorSetAclPriorityParams
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorSetAclPriorityParams>(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.connection_handle
.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::<VendorAclPriority, D>(
self.priority
.as_ref()
.map(<VendorAclPriority as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 3 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (3 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<VendorAclDirection, D>(
self.direction
.as_ref()
.map(<VendorAclDirection 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 VendorSetAclPriorityParams
{
#[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.connection_handle.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 =
<VendorAclPriority 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.priority.get_or_insert_with(|| fidl::new_empty!(VendorAclPriority, D));
fidl::decode!(VendorAclPriority, 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 < 3 {
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 =
<VendorAclDirection 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.direction.get_or_insert_with(|| fidl::new_empty!(VendorAclDirection, D));
fidl::decode!(VendorAclDirection, 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 VirtualControllerCreateLoopbackDeviceRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.uart_channel {
return 1;
}
0
}
}
impl fidl::encoding::ResourceTypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VirtualControllerCreateLoopbackDeviceRequest {
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<
VirtualControllerCreateLoopbackDeviceRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut VirtualControllerCreateLoopbackDeviceRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VirtualControllerCreateLoopbackDeviceRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<
fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
self.uart_channel.as_mut().map(
<fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for VirtualControllerCreateLoopbackDeviceRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size = <fidl::encoding::HandleType<
fidl::Channel,
{ fidl::ObjectType::CHANNEL.into_raw() },
2147483648,
> 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.uart_channel.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ReceivedPacket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ReceivedPacket {
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<ReceivedPacket, D>
for &ReceivedPacket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ReceivedPacket>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
ReceivedPacket::Event(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 257>,
D,
>(
<fidl::encoding::Vector<u8, 257> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ReceivedPacket::Acl(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 65539>,
D,
>(
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ReceivedPacket::Iso(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 16387>,
D,
>(
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
ReceivedPacket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReceivedPacket {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Vector<u8, 257> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => {
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
3 => {
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Event(_) = self {
} else {
*self = ReceivedPacket::Event(
fidl::new_empty!(fidl::encoding::Vector<u8, 257>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Event(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 257>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Acl(_) = self {
} else {
*self = ReceivedPacket::Acl(
fidl::new_empty!(fidl::encoding::Vector<u8, 65539>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Acl(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 65539>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Iso(_) = self {
} else {
*self = ReceivedPacket::Iso(
fidl::new_empty!(fidl::encoding::Vector<u8, 16387>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let ReceivedPacket::Iso(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 16387>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = ReceivedPacket::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SentPacket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SentPacket {
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<SentPacket, D>
for &SentPacket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SentPacket>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
SentPacket::Command(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 258>,
D,
>(
<fidl::encoding::Vector<u8, 258> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SentPacket::Acl(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 65539>,
D,
>(
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SentPacket::Iso(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 16387>,
D,
>(
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SentPacket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SentPacket {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Vector<u8, 258> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => {
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
3 => {
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let SentPacket::Command(_) = self {
} else {
*self = SentPacket::Command(
fidl::new_empty!(fidl::encoding::Vector<u8, 258>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SentPacket::Command(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 258>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let SentPacket::Acl(_) = self {
} else {
*self =
SentPacket::Acl(fidl::new_empty!(fidl::encoding::Vector<u8, 65539>, D));
}
#[allow(irrefutable_let_patterns)]
if let SentPacket::Acl(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 65539>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let SentPacket::Iso(_) = self {
} else {
*self =
SentPacket::Iso(fidl::new_empty!(fidl::encoding::Vector<u8, 16387>, D));
}
#[allow(irrefutable_let_patterns)]
if let SentPacket::Iso(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 16387>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = SentPacket::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for SnoopPacket {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for SnoopPacket {
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<SnoopPacket, D>
for &SnoopPacket
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<SnoopPacket>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
SnoopPacket::Event(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 257>,
D,
>(
<fidl::encoding::Vector<u8, 257> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SnoopPacket::Command(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 258>,
D,
>(
<fidl::encoding::Vector<u8, 258> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SnoopPacket::Acl(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 65539>,
D,
>(
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SnoopPacket::Sco(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 258>,
D,
>(
<fidl::encoding::Vector<u8, 258> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SnoopPacket::Iso(ref val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::Vector<u8, 16387>,
D,
>(
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::ValueTypeMarker>::borrow(
val,
),
encoder,
offset + 8,
_depth,
),
SnoopPacket::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SnoopPacket {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Vector<u8, 257> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
2 => <fidl::encoding::Vector<u8, 258> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
3 => {
<fidl::encoding::Vector<u8, 65539> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
4 => <fidl::encoding::Vector<u8, 258> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
5 => {
<fidl::encoding::Vector<u8, 16387> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
)
}
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Event(_) = self {
} else {
*self = SnoopPacket::Event(
fidl::new_empty!(fidl::encoding::Vector<u8, 257>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Event(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 257>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Command(_) = self {
} else {
*self = SnoopPacket::Command(
fidl::new_empty!(fidl::encoding::Vector<u8, 258>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Command(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 258>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
3 => {
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Acl(_) = self {
} else {
*self = SnoopPacket::Acl(
fidl::new_empty!(fidl::encoding::Vector<u8, 65539>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Acl(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 65539>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
4 => {
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Sco(_) = self {
} else {
*self =
SnoopPacket::Sco(fidl::new_empty!(fidl::encoding::Vector<u8, 258>, D));
}
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Sco(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 258>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
5 => {
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Iso(_) = self {
} else {
*self = SnoopPacket::Iso(
fidl::new_empty!(fidl::encoding::Vector<u8, 16387>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let SnoopPacket::Iso(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<u8, 16387>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = SnoopPacket::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for VendorCommand {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for VendorCommand {
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<VendorCommand, D>
for &VendorCommand
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<VendorCommand>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
VendorCommand::SetAclPriority(ref val) => fidl::encoding::encode_in_envelope::<
VendorSetAclPriorityParams,
D,
>(
<VendorSetAclPriorityParams as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
),
VendorCommand::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorCommand {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <VendorSetAclPriorityParams as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let VendorCommand::SetAclPriority(_) = self {
} else {
*self = VendorCommand::SetAclPriority(fidl::new_empty!(
VendorSetAclPriorityParams,
D
));
}
#[allow(irrefutable_let_patterns)]
if let VendorCommand::SetAclPriority(ref mut val) = self {
fidl::decode!(
VendorSetAclPriorityParams,
D,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = VendorCommand::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}