Skip to content

Core definitions of the Unified Diagnostic Services (UDS), KWP2000, and OBD-II specifications for road vehicles

Notifications You must be signed in to change notification settings

p-dial8891/automotive_diag

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

automotive_diag

GitHub crates.io version docs.rs docs CI build

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.

Usage

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.

use automotive_diag::ByteWrapper::{Extended, Standard};
use automotive_diag::uds::UdsCommand::{DiagnosticSessionControl, ECUReset};
use automotive_diag::uds::UdsCommandByte;

/// Handle a single command byte on the ECU side
fn handle_cmd_byte(cmd: u8) {
    match UdsCommandByte::from(cmd) {
        Standard(DiagnosticSessionControl) => {
            // handle_diag_session()
        },
        Standard(ECUReset) => {
            // handle_ecu_reset()
        },
        Extended(0x42) => {
            // handle_custom_cmd_42()
        },
        _ => {
            // handle all other commands
        }
    }
}

Credits

The code was forked from the amazing rnd-ash/ecu_diagnostics 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 auto_uds crate.

About

Core definitions of the Unified Diagnostic Services (UDS), KWP2000, and OBD-II specifications for road vehicles

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.3%
  • Shell 0.7%