pub struct CanFrame { /* private fields */ }
Expand description

CAN Frame

Implementations§

source§

impl CanFrame

source

pub fn new(id: u32, data: &[u8], is_ext: bool) -> Self

Creates a new CAN Frame given data and an ID.

§Parameters
  • id - The CAN ID of the packet
  • data - The data of the CAN packet
  • is_ext - Indication if the CAN packet shall use extended addressing

NOTE: If id is greater than 0x7FF, extended addressing (29bit) will be enabled regardless of is_ext.

Also, data will be limited to 8 bytes.

source

pub fn is_extended(&self) -> bool

Returns true if the CAN Frame uses Extended (29bit) addressing

Trait Implementations§

source§

impl Clone for CanFrame

source§

fn clone(&self) -> CanFrame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CanFrame

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&CanFrame> for PASSTHRU_MSG

source§

fn from(frame: &CanFrame) -> Self

Converts to this type from the input type.
source§

impl From<&PASSTHRU_MSG> for CanFrame

source§

fn from(msg: &PASSTHRU_MSG) -> CanFrame

Converts to this type from the input type.
source§

impl From<CanDataFrame> for CanFrame

source§

fn from(value: CanDataFrame) -> Self

Converts to this type from the input type.
source§

impl Into<CanDataFrame> for CanFrame

source§

fn into(self) -> CanDataFrame

Converts this type into the (usually inferred) input type.
source§

impl Ord for CanFrame

source§

fn cmp(&self, other: &CanFrame) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl Packet for CanFrame

source§

fn get_address(&self) -> u32

Returns the address of the packet
source§

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

Returns the data of the packet
source§

fn set_address(&mut self, address: u32)

Sets the address of the packet
source§

fn set_data(&mut self, data: &[u8])

Sets the data of the packet
source§

impl PacketChannel<CanFrame> for PassthruCanChannel

source§

fn open(&mut self) -> ChannelResult<()>

Opens the channel, from this point forward, the network filter will be applied to be fully open so data has to be polled rapidly to avoid a driver’s internal buffer from filling up rapidly
source§

fn close(&mut self) -> ChannelResult<()>

Closes the channel. Once closed, no more traffic can be polled or written to the channel.
source§

fn write_packets( &mut self, packets: Vec<CanFrame>, timeout_ms: u32 ) -> ChannelResult<()>

Writes a list of packets to the raw interface
source§

fn read_packets( &mut self, max: usize, timeout_ms: u32 ) -> ChannelResult<Vec<CanFrame>>

Reads a list of packets from the raw interface
source§

fn clear_rx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Rx buffer. This means all pending messages to be read should be wiped from the devices queue, such that PayloadChannel::read_bytes does not read them
source§

fn clear_tx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Tx buffer. This means all messages that are queued to be sent to the ECU should be wiped.
source§

impl PacketChannel<CanFrame> for PtCombiChannel

source§

fn open(&mut self) -> ChannelResult<()>

Opens the channel, from this point forward, the network filter will be applied to be fully open so data has to be polled rapidly to avoid a driver’s internal buffer from filling up rapidly
source§

fn close(&mut self) -> ChannelResult<()>

Closes the channel. Once closed, no more traffic can be polled or written to the channel.
source§

fn write_packets( &mut self, packets: Vec<CanFrame>, timeout_ms: u32 ) -> ChannelResult<()>

Writes a list of packets to the raw interface
source§

fn read_packets( &mut self, max: usize, timeout_ms: u32 ) -> ChannelResult<Vec<CanFrame>>

Reads a list of packets from the raw interface
source§

fn clear_rx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Rx buffer. This means all pending messages to be read should be wiped from the devices queue, such that PayloadChannel::read_bytes does not read them
source§

fn clear_tx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Tx buffer. This means all messages that are queued to be sent to the ECU should be wiped.
source§

impl PacketChannel<CanFrame> for SocketCanCanChannel

source§

fn open(&mut self) -> ChannelResult<()>

Opens the channel, from this point forward, the network filter will be applied to be fully open so data has to be polled rapidly to avoid a driver’s internal buffer from filling up rapidly
source§

fn close(&mut self) -> ChannelResult<()>

Closes the channel. Once closed, no more traffic can be polled or written to the channel.
source§

fn write_packets( &mut self, packets: Vec<CanFrame>, timeout_ms: u32 ) -> ChannelResult<()>

Writes a list of packets to the raw interface
source§

fn read_packets( &mut self, max: usize, timeout_ms: u32 ) -> ChannelResult<Vec<CanFrame>>

Reads a list of packets from the raw interface
source§

fn clear_rx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Rx buffer. This means all pending messages to be read should be wiped from the devices queue, such that PayloadChannel::read_bytes does not read them
source§

fn clear_tx_buffer(&mut self) -> ChannelResult<()>

Tells the channel to clear its Tx buffer. This means all messages that are queued to be sent to the ECU should be wiped.
source§

impl PartialEq for CanFrame

source§

fn eq(&self, other: &CanFrame) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for CanFrame

source§

fn partial_cmp(&self, other: &CanFrame) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for CanFrame

source§

impl Eq for CanFrame

source§

impl Send for CanFrame

source§

impl StructuralPartialEq for CanFrame

source§

impl Sync for CanFrame

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.