Skip to main content

Adapter

Trait Adapter 

Source
pub trait Adapter: Send {
    // Required methods
    fn initialize<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<AdapterInfo, Obd2Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn request<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        req: &'life1 ServiceRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Obd2Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn supported_pids<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<HashSet<Pid>, Obd2Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn battery_voltage<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<f64>, Obd2Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn info(&self) -> &AdapterInfo;
}
Expand description

Protocol interpreter for OBD-II communication.

Translates high-level diagnostic requests (read PID, read DTCs) into adapter-specific commands and parses the responses.

Required Methods§

Source

fn initialize<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<AdapterInfo, Obd2Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the adapter: reset, detect chipset, configure protocol. Returns information about the detected adapter hardware.

Source

fn request<'life0, 'life1, 'async_trait>( &'life0 mut self, req: &'life1 ServiceRequest, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Obd2Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a diagnostic service request and return the raw response data bytes. Response should NOT include the service ID echo or padding — just data.

Source

fn supported_pids<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<HashSet<Pid>, Obd2Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Query which standard PIDs are supported (Mode 01 PID 00/20/40/60 bitmaps).

Source

fn battery_voltage<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<f64>, Obd2Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read the adapter’s battery voltage measurement (if supported).

Source

fn info(&self) -> &AdapterInfo

Return adapter information detected during initialization.

Implementors§