Trait uavcan::transfer::TransferInterface[][src]

pub trait TransferInterface {
    type Frame: TransferFrame;
    fn transmit(&self, frame: &Self::Frame) -> Result<(), IOError>;
fn receive(&self) -> Option<Self::Frame>; }

TransferInterface is an interface to a hardware unit which can communicate over a CAN like transfer protocol

It's associated with a TransferFrame and must be able to receive and transmit this type of frames. The interface must also do ordering of incoming frames after priority defined by the transfer frame ID to avoid priority inversion, while making sure that transfer frames with the same ID is transmitted in the same order as they was added in the transmit buffer.

Receiving frames must be returned in the same order they were received by the interface.

Associated Types

The TransferFrame associated with this interface.

Required Methods

Put a TransferFrame in the transfer buffer (or transmit it on the bus) or return Err(IOError::BufferExhausted) if buffer is full.

To avoid priority inversion the new frame needs to be prioritized inside the interface as it would on the bus. When reprioritizing the TransferInterface must for equal ID frames respect the order they were attempted transmitted in.

Receive a frame, removing to from the receive buffer. if there are no frames in the receive buffer this function will return None

Implementors