Crates.io | automotive_diag |
lib.rs | automotive_diag |
version | |
source | src |
created_at | 2023-04-15 19:54:29.184149+00 |
updated_at | 2025-02-11 06:58:24.359052+00 |
description | Unified Diagnostic Services/UDS (ISO-14229-1), KWP2000 (ISO-142330) and OBD-II (ISO-9141) definitions to communicate with the road vehicle ECUs in Rust. |
homepage | |
repository | https://github.com/nyurik/automotive_diag |
max_upload_size | |
id | 840137 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
Most features have been implemented and documented to handle the most common diagnostic commands and responses. If you find a missing command or response, please open an issue or better yet, a pull request.
All values are presented as Rust enum
, and can be converted to/from their underlying numeric values using
the T::from_repr(u8)
and u8::from(value)
. 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
}
}
}
make
.
Install it with cargo install just
.just
.just test
.git push
, it will run a few validations, including cargo fmt
, cargo clippy
, and cargo test
.
Use git push --no-verify
to skip these checks.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.
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.