[][src]Trait n2k::hal::can::Frame

pub trait Frame: Sized {
    fn new_standard(id: u32, data: &[u8]) -> Result<Self, ()>;
fn new_extended(id: u32, data: &[u8]) -> Result<Self, ()>;
fn with_rtr(&mut self, dlc: usize) -> &mut Self;
fn is_extended(&self) -> bool;
fn is_remote_frame(&self) -> bool;
fn id(&self) -> u32;
fn dlc(&self) -> usize;
fn data(&self) -> &[u8]; fn is_standard(&self) -> bool { ... }
fn is_data_frame(&self) -> bool { ... } }

A CAN2.0 Frame

Required methods

fn new_standard(id: u32, data: &[u8]) -> Result<Self, ()>

Creates a new frame with a standard identifier (0..=0x7FF). Returns an error when the the identifier is not valid.

fn new_extended(id: u32, data: &[u8]) -> Result<Self, ()>

Creates a new frame with an extended identifier (0..=0x1FFF_FFFF). Returns an error when the the identifier is not valid.

fn with_rtr(&mut self, dlc: usize) -> &mut Self

Marks this frame as a remote frame (by setting the RTR bit).

fn is_extended(&self) -> bool

Returns true if this frame is a extended frame.

fn is_remote_frame(&self) -> bool

Returns true if this frame is a remote frame.

fn id(&self) -> u32

Returns the frame identifier.

fn dlc(&self) -> usize

Returns the data length code (DLC) which is in the range 0..8.

For data frames the DLC value always matches the length of the data. Remote frames do not carry any data, yet the DLC can be greater than 0.

fn data(&self) -> &[u8]

Returns the frame data (0..8 bytes in length).

Loading content...

Provided methods

fn is_standard(&self) -> bool

Returns true if this frame is a standard frame.

fn is_data_frame(&self) -> bool

Returns true if this frame is a data frame.

Loading content...

Implementors

Loading content...