Struct ecu_diagnostics::channel::CanFrame
source · pub struct CanFrame { /* private fields */ }
Expand description
CAN Frame
Implementations§
source§impl CanFrame
impl CanFrame
sourcepub fn new(id: u32, data: &[u8], is_ext: bool) -> Self
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.
sourcepub fn is_extended(&self) -> bool
pub fn is_extended(&self) -> bool
Returns true if the CAN Frame uses Extended (29bit) addressing
Trait Implementations§
source§impl From<&CanFrame> for PASSTHRU_MSG
impl From<&CanFrame> for PASSTHRU_MSG
source§impl From<&PASSTHRU_MSG> for CanFrame
impl From<&PASSTHRU_MSG> for CanFrame
source§fn from(msg: &PASSTHRU_MSG) -> CanFrame
fn from(msg: &PASSTHRU_MSG) -> CanFrame
Converts to this type from the input type.
source§impl From<CanDataFrame> for CanFrame
impl From<CanDataFrame> for CanFrame
source§fn from(value: CanDataFrame) -> Self
fn from(value: CanDataFrame) -> Self
Converts to this type from the input type.
source§impl Into<CanDataFrame> for CanFrame
impl Into<CanDataFrame> for CanFrame
source§fn into(self) -> CanDataFrame
fn into(self) -> CanDataFrame
Converts this type into the (usually inferred) input type.
source§impl Ord for CanFrame
impl Ord for CanFrame
source§impl PacketChannel<CanFrame> for PassthruCanChannel
impl PacketChannel<CanFrame> for PassthruCanChannel
source§fn open(&mut self) -> ChannelResult<()>
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<()>
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<()>
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>>
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<()>
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<()>
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
impl PacketChannel<CanFrame> for PtCombiChannel
source§fn open(&mut self) -> ChannelResult<()>
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<()>
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<()>
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>>
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<()>
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<()>
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
impl PacketChannel<CanFrame> for SocketCanCanChannel
source§fn open(&mut self) -> ChannelResult<()>
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<()>
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<()>
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>>
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<()>
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<()>
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
impl PartialEq for CanFrame
source§impl PartialOrd for CanFrame
impl PartialOrd for CanFrame
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moreimpl Copy for CanFrame
impl Eq for CanFrame
impl Send for CanFrame
impl StructuralPartialEq for CanFrame
impl Sync for CanFrame
Auto Trait Implementations§
impl Freeze for CanFrame
impl RefUnwindSafe for CanFrame
impl Unpin for CanFrame
impl UnwindSafe for CanFrame
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