Expand description
§UDS Client for Rust (uds-client-rs)
This crate provides a Unified Diagnostic Services (UDS) client for communication with automotive ECUs (Electronic Control Units). It supports sending and receiving UDS messages over CAN using SocketCAN (Linux) and USB CAN adapters (Windows).
§Features
- Support for UDS over CAN (ISO 14229).
- Asynchronous API using
tokio. - Works with both Linux (
socketcan) and Windows (UsbCanSocket).
§Running an Example
To get started, you can run the provided example to test communication with an ECU.
-
Choose the correct CAN interface:
- Linux: Use a
canXinterface (e.g.,can0,vcan0). - Windows: Uses a supported USB-CAN adapter (Peak CAN).
- Linux: Use a
-
Run the example:
cd examples/uds_client_ui
cargo run --release§Usage
Add uds-client-rs to your Cargo.toml:
[dependencies]
uds-client-rs = "0.1"Example usage:
use uds_client_rs::UdsClient;
#[tokio::main]
async fn main() {
let mut client = UdsClient::new("can0", 0x784);
if let Err(e) = client.uds_reset_118().await {
eprintln!("Failed to request session: {:?}", e);
}
}§License
This project is licensed under the MIT License.
Structs§
- PciByte
- Response
Slot - The response slot for each UDS request
- UdsClient
- UdsConsecutive
Frame - UdsFirst
Frame - UdsFlow
Control Frame - UdsSingle
Frame - UdsSocket
- UdsSocket
Rx - UdsSocket
Tx
Enums§
- Diag
Error - Diagnostic server error
- Frame
Error - PciType
- The definition for PCI byte of each frame
- Real
Time Type - Reset ECU subcommand
- Response
- UdsFrame