pub trait Hardware {
    fn create_iso_tp_channel(
        this: Arc<Mutex<Self>>
    ) -> HardwareResult<Box<dyn IsoTPChannel>>; fn create_can_channel(
        this: Arc<Mutex<Self>>
    ) -> HardwareResult<Box<dyn CanChannel>>; fn is_iso_tp_channel_open(&self) -> bool; fn is_can_channel_open(&self) -> bool; fn read_battery_voltage(&mut self) -> Option<f32>; fn read_ignition_voltage(&mut self) -> Option<f32>; fn get_info(&self) -> &HardwareInfo; }
Expand description

The hardware trait defines functions supported by all adapter types, as well as functions that can create abstracted communication channels that can be used in diagnostic servers

Required Methods

Creates an ISO-TP channel on the devices. This channel will live for as long as the hardware trait. Upon being dropped, the channel will automatically be closed, if it has been opened.

Creates a CAN Channel on the devices. This channel will live for as long as the hardware trait. Upon being dropped, the channel will automatically be closed, if it has been opened.

Returns true if the ISO-TP channel is current open and in use

Returns true if the CAN channel is currently open and in use

Tries to read battery voltage from Pin 16 of an OBD port (+12V). This is mainly used by diagnostic adapters, and is purely optional Should the adapter not support this feature, std::option::Option::None is returned

Tries to read battery voltage from the igntion pin on the OBD2 port. A reading would indicate ignition is on in the vehicle. This is mainly used by diagnostic adapters, and is purely optional Should the adapter not support this feature, std::option::Option::None is returned

Returns the information of the hardware

Implementors