Skip to content

Rust implementation of automotive protocols, including OBD-II, ISO-TP, J1939, and UDS

License

Notifications You must be signed in to change notification settings

shishir-dey/libautomotive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. Ensure you have Rust and Cargo installed (https://rustup.rs/)
  2. Clone the repository:
    git clone https://github.com/shishir-dey/libautomotive.git
    cd libautomotive
  3. Build the library:
    cargo build
  4. For release build:
    cargo build --release

Testing

Run the test suite:

cargo test

For verbose test output:

cargo test -- --nocapture

Example Usage

use libautomotive::application::{uds, obdii};
use libautomotive::transport::isobus_diagnostic;

// UDS example
let uds_config = uds::Config::default();
let uds_interface = uds::Interface::new(uds_config);

// OBD-II example
let obd_config = obdii::Config::default();
let obd_interface = obdii::Interface::new(obd_config);

// ISOBUS Diagnostic example
let mut isobus_diag = isobus_diagnostic::ISOBUSDiagnosticProtocol::new();
let dtc = isobus_diagnostic::DiagnosticTroubleCode::new(100, 1); // SPN: 100, FMI: 1
isobus_diag.add_dtc(dtc);

License

MIT

Credits and Acknowledgments

This library draws inspiration from and acknowledges the following open-source projects: