Struct ecu_diagnostics::hardware::passthru::PtCombiChannel
source · pub struct PtCombiChannel { /* private fields */ }
Expand description
Passthru combination channel for software emulation of ISO-TP channel over CAN channel
§Why?
According to the J2534 API, a CAN and ISO-TP cannot be opened at the same time, as they both require physical access to the same hardware communication layer of the VCI.
To overcome this, we instead up open a dedicated CAN channel and run the ISO-TP communication via software. This allows for both CAN and ISO-TP to coexist at the same time.
§IMPORTANT NOTE
This mode is technically a violation of the J2534 API, whilst tested devices work fine with this some cheap ‘clone’ J2534 adapters may struggle with the high throughput CAN Channel that is requied for this to work.
Implementations§
source§impl PtCombiChannel
impl PtCombiChannel
sourcepub fn new(dev: PassthruDevice) -> HardwareResult<Self>
pub fn new(dev: PassthruDevice) -> HardwareResult<Self>
Creates a new combi channel using a given passthru device
Trait Implementations§
source§impl CanChannel for PtCombiChannel
impl CanChannel for PtCombiChannel
source§fn set_can_cfg(&mut self, baud: u32, use_extended: bool) -> ChannelResult<()>
fn set_can_cfg(&mut self, baud: u32, use_extended: bool) -> ChannelResult<()>
Sets the CAN network configuration
source§impl Drop for PtCombiChannel
impl Drop for PtCombiChannel
source§impl IsoTPChannel for PtCombiChannel
impl IsoTPChannel for PtCombiChannel
source§fn set_iso_tp_cfg(&mut self, cfg: IsoTPSettings) -> ChannelResult<()>
fn set_iso_tp_cfg(&mut self, cfg: IsoTPSettings) -> ChannelResult<()>
Sets the ISO-TP specific configuration for the Channel Read more
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 PayloadChannel for PtCombiChannel
impl PayloadChannel for PtCombiChannel
source§fn open(&mut self) -> ChannelResult<()>
fn open(&mut self) -> ChannelResult<()>
This function opens the interface.
It is ONLY called after set_ids and any other configuration function
source§fn close(&mut self) -> ChannelResult<()>
fn close(&mut self) -> ChannelResult<()>
Closes and destroys the channel
source§fn set_ids(&mut self, send: u32, recv: u32) -> ChannelResult<()>
fn set_ids(&mut self, send: u32, recv: u32) -> ChannelResult<()>
Configures the diagnostic channel with specific IDs for configuring the diagnostic server Read more
source§fn read_bytes(&mut self, timeout_ms: u32) -> ChannelResult<Vec<u8>>
fn read_bytes(&mut self, timeout_ms: u32) -> ChannelResult<Vec<u8>>
Attempts to read bytes from the channel. Read more
source§fn write_bytes(
&mut self,
addr: u32,
ext_id: Option<u8>,
buffer: &[u8],
timeout_ms: u32
) -> ChannelResult<()>
fn write_bytes( &mut self, addr: u32, ext_id: Option<u8>, buffer: &[u8], timeout_ms: u32 ) -> ChannelResult<()>
Attempts to write bytes to the channel. Read more
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.
impl Send for PtCombiChannel
impl Sync for PtCombiChannel
Auto Trait Implementations§
impl !Freeze for PtCombiChannel
impl !RefUnwindSafe for PtCombiChannel
impl Unpin for PtCombiChannel
impl !UnwindSafe for PtCombiChannel
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