pub struct Frame {
pub role: Role,
pub dlci: DLCI,
pub data: FrameData,
pub poll_final: bool,
pub command_response: CommandResponse,
pub credits: Option<u8>,
}
Expand description
The highest-level unit of data that is passed around in RFCOMM.
Fields§
§role: Role
The role of the device associated with this frame.
dlci: DLCI
The DLCI associated with this frame.
data: FrameData
The data associated with this frame.
poll_final: bool
The P/F bit for this frame. See RFCOMM 5.2.1 which describes the usages of the P/F bit in RFCOMM.
command_response: CommandResponse
Whether this frame is a Command or Response frame.
credits: Option<u8>
The credits associated with this frame. Credits are only applicable to UIH frames when credit-based flow control is enabled. See RFCOMM 6.5.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn parse(
role: Role,
credit_based_flow: bool,
buf: &[u8],
) -> Result<Self, FrameParseError>
pub fn parse( role: Role, credit_based_flow: bool, buf: &[u8], ) -> Result<Self, FrameParseError>
Attempts to parse the provided buf
into a Frame.
role
is the current Role of the RFCOMM Session.
credit_based_flow
indicates whether credit-based flow control is turned on for this
Session.
pub fn make_sabm_command(role: Role, dlci: DLCI) -> Self
pub fn make_dm_response(role: Role, dlci: DLCI) -> Self
pub fn make_ua_response(role: Role, dlci: DLCI) -> Self
pub fn make_mux_command(role: Role, data: MuxCommand) -> Self
pub fn make_user_data_frame( role: Role, dlci: DLCI, user_data: UserData, credits: Option<u8>, ) -> Self
pub fn make_disc_command(role: Role, dlci: DLCI) -> Self
Trait Implementations§
Source§impl Encodable for Frame
impl Encodable for Frame
type Error = FrameParseError
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the number of bytes necessary to encode |self|.
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)