ecu_uds/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod constant;
pub mod error;
pub mod utils;
pub mod service;
pub mod docan;

use isotp_rs::constant::{P2_ISO14229, P2_STAR_ISO14229};
use error::Error;

#[derive(Debug, Clone, Copy)]
pub struct P2Context {
    pub(crate) p2: u16,        // ms
    pub(crate) p2_offset: u16, // ms
    pub(crate) p2_star: u32,   // ms
}

impl Default for P2Context {
    fn default() -> Self {
        Self {
            p2: P2_ISO14229,
            p2_offset: 0,
            p2_star: P2_STAR_ISO14229,
        }
    }
}

pub type SecurityAlgo = fn(u8, Vec<u8>, Vec<u8>) -> Result<Vec<u8>, Error>;