This crate provides low-level no_std structs and enums of the Unified Diagnostic Services (ISO-14229-1), KWP2000 (ISO-142330) and OBD-II (ISO-9141) specifications for the road vehicles in Rust.
All values are presented as Rust enum
, and can be converted to/from their underlying numeric values using the From<T>
and TryFrom<u8>
traits. Most enums also have a corresponding ...Byte
enums as ByteWrapper<T>
to handle the non-standard Extended(u8)
values in addition to the defined Standand(T)
ones.
```rust use automotivediag::ByteWrapper::{Extended, Standard}; use automotivediag::uds::UdsCommand::{DiagnosticSessionControl, ECUReset}; use automotive_diag::uds::UdsCommandByte;
/// Handle a single command byte on the ECU side fn handlecmdbyte(cmd: u8) { match UdsCommandByte::from(cmd) { Standard(DiagnosticSessionControl) => { // handlediagsession() }, Standard(ECUReset) => { // handleecureset() }, Extended(0x42) => { // handlecustomcmd_42() }, _ => { // handle all other commands } } } ```
The code was forked from the amazing rnd-ash/ecudiagnostics project. The code was forked from the last MIT-versioned code before the MIT to GPL license migration. Initially, this code was developed as a deprecated autouds crate.