libautomotive
A comprehensive Rust library for automotive protocol implementations, following the OSI layer model for clear separation of concerns. The library provides support for various automotive protocols including CAN, CAN-FD, ISO-TP, J1939, ISOBUS, UDS, and OBD-II.
Features
- Complete automotive protocol stack implementation
- Modular and extensible design following OSI layers
- High-performance implementations
- Strong type safety and error handling
- Easy-to-use abstractions
Supported Protocols
- Physical Layer: CAN and CAN-FD implementations
- Data Link Layer: Raw CAN frame handling
- Network Layer: J1939 and ISOBUS protocol implementations
- Transport Layer: ISO-TP (ISO 15765-2) implementation
- Application Layer:
- UDS (ISO 14229) implementation
- OBD-II implementation
- ISOBUS Diagnostic Protocol (DM1, DM2, DM3, DM11, DM13, DM22)
Building
- Ensure you have Rust and Cargo installed (https://rustup.rs/)
- Clone the repository:
- Build the library:
- For release build:
Testing
Run the test suite:
For verbose test output:
Example Usage
use ;
use isobus_diagnostic;
// UDS example
let uds_config = default;
let uds_interface = new;
// OBD-II example
let obd_config = default;
let obd_interface = new;
// ISOBUS Diagnostic example
let mut isobus_diag = new;
let dtc = new; // SPN: 100, FMI: 1
isobus_diag.add_dtc;
License
MIT
Credits and Acknowledgments
This library draws inspiration from and acknowledges the following open-source projects:
- esp32-isotp-ble-bridge - ESP32-IDF based BLE<->ISO-TP bridge
- Open-SAE-J1939 - Open source SAE J1939 implementation
- uds-c - Unified Diagnostic Services (UDS) C library
- obdii - OBD-II diagnostic protocol implementation
- canis-can-sdk - CAN protocol stack implementation
- AgIsoStack++ - Open-source C++ ISOBUS library
- open-LIN-c - Implementation of Local Interconnect Network in C
- doip-library - Diagnostic over IP (DoIP) protocol implementation