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

source

pub fn new(dev: PassthruDevice) -> HardwareResult<Self>

Creates a new combi channel using a given passthru device

Trait Implementations§

source§

impl CanChannel for PtCombiChannel

source§

fn set_can_cfg(&mut self, baud: u32, use_extended: bool) -> ChannelResult<()>

Sets the CAN network configuration
source§

impl Drop for PtCombiChannel

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl IsoTPChannel for PtCombiChannel

source§

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

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 PayloadChannel for PtCombiChannel

source§

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<()>

Closes and destroys the channel
source§

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>>

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<()>

Attempts to write bytes to the channel. Read more
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§

fn read_write_bytes( &mut self, addr: u32, ext_id: Option<u8>, buffer: &[u8], write_timeout_ms: u32, read_timeout_ms: u32 ) -> ChannelResult<Vec<u8>>

Attempts to write bytes to the channel, then listen for the channels response Read more
source§

impl Send for PtCombiChannel

source§

impl Sync for PtCombiChannel

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, 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.