Trait uavcan::transfer::TransferFrame[][src]

pub trait TransferFrame {
    const MAX_DATA_LENGTH: usize;

    fn new(id: TransferFrameID) -> Self;
fn id(&self) -> TransferFrameID;
fn data(&self) -> &[u8];
fn data_as_mut(&mut self) -> &mut [u8];
fn set_data_length(&mut self, length: usize); fn tail_byte(&self) -> TailByte { ... }
fn is_start_frame(&self) -> bool { ... }
fn is_end_frame(&self) -> bool { ... }
fn is_single_frame(&self) -> bool { ... }
fn full_id(&self) -> FullTransferID { ... } }

TransferFrame is a CAN like frame that can be sent over a network

For a frame to work it need to have a 28 bit ID, and a payload of at least 4 bytes. Guarantee that frames are delivered in order and correctness check is needed as well.

The uavcan protocol defines how this works with a CAN2.0B frame

Associated Constants

Maximum data length the transfer protocol supports.

Required Methods

Create a new TransferFrame with id: id, and length 0. Data length can be changed with set_data_length(&self). Data can be changed with data_as_mut(&mut self).

Returns the 28 bit ID of this TransferFrame.

When deciding which frame that will be transmitted, the ID is used to prioritze (lower ID means higher priority)

Returns a slice with the data in this TransferFrame

Length can be found by checking the length of this slice self.data().len()

Returns a mutable slice with the data in this TransferFrame use this method to set/change the data inside this TransferFrame

Set the data length of this TransferFrame

Panics

set_data_lengt(&mut self, length: usize) should panic if length > T::MAX_DATA_LENGTH

Provided Methods

Returns the tail byte of the TransferFrame assuming the current length

Panics

panics if self.data().len() == 0 as no tail_byte exists

Checks the tail byte if this frame is a start frame and return the result

Checks the tail byte if this frame is an end frame and return the result

Checks the tail byte if this is both a start frame and an end frame and return the result

Returns the full ID of the frame (both Frame ID and transfer ID)

Panics

panics if self.data().len() == 0 as no tail_byte exists

Implementations on Foreign Types

impl TransferFrame for ExtendedDataFrame
[src]

Implementors