uds_client/
lib.rs

1//! # UDS Client for Rust (`uds-client-rs`)
2//!
3//! This crate provides a Unified Diagnostic Services (UDS) client for communication with automotive ECUs (Electronic Control Units).
4//! It supports sending and receiving UDS messages over CAN using SocketCAN (Linux) and USB CAN adapters (Windows).
5//!
6//! ## Features
7//! - Support for UDS over CAN (ISO 14229).
8//! - Asynchronous API using `tokio`.
9//! - Works with both Linux (`socketcan`) and Windows (`UsbCanSocket`).
10//!
11//! ## Running an Example
12//!
13//! To get started, you can run the provided example to test communication with an ECU.
14//!
15//! 1. **Choose the correct CAN interface:**
16//!    - Linux: Use a `canX` interface (e.g., `can0`, `vcan0`).
17//!    - Windows: Uses a supported USB-CAN adapter (Peak CAN).
18//!
19//! 2. **Run the example:**
20//! ```sh
21//! cd examples/uds_client_ui
22//! cargo run --release
23//! ```
24//!
25//! ## Usage
26//!
27//! Add `uds-client-rs` to your `Cargo.toml`:
28//! ```toml
29//! [dependencies]
30//! uds-client-rs = "0.1"
31//! ```
32//!
33//! Example usage:
34//! ```rust
35//! use uds_client_rs::UdsClient;
36//!
37//! #[tokio::main]
38//! async fn main() {
39//!     let mut client = UdsClient::new("can0", 0x784);
40//!     if let Err(e) = client.uds_reset_118().await {
41//!         eprintln!("Failed to request session: {:?}", e);
42//!     }
43//! }
44//! ```
45//!
46//! ## License
47//! This project is licensed under the MIT License.
48
49mod socket_can;
50mod uds_client;
51
52pub use socket_can::*;
53pub use uds_client::*;