Unified Diagnostics Services (UDS) client over CAN bus
provides asynchronous UDS communication via socketcan.
All communication was designed to be used primarily with ISO 14229-1:2013 definition of UDS.
Example
For correct behaviour make sure to set-up a CAN interface first. You an you a virtual CAN interface for testing purposes, for example with the following command. To make setting-up a CAN interface easier install can-utils-rs package
Then use the following command:
Then select the interface type you want to use. Then make sure to match the name of the interface (can0 in the example) with the one you have set-up.
// To run the example make sure to set-up a CAN interface first!
use StandardId;
use ;
use ;
async
Notes for development
Communication architecture
Current communication architecture is strictly bounded request-response together. It would be much better to have these two interactions separated into queues and adding one producer for writes and one consumer for reads.
Without this functionality the services like ReadDataByPeriodicIdentifier cannot be implemented.
Hierarchy
module uds - top module containing UdsClient trough which all interaction is provided for the user services used by UdsClient are stored in separate modules - see for example read_data_by_identifier.rs, where structure of service module is described
module communication - basic communication framework. Purpose of this module is to provide send and receive functionality for UdsClient.
Services implementation
each service consists of three steps
compose function - serializing service method arguments and other needed
data to Vec<u8>
send and receive - passing composed vector as slice to the communication backend and returning raw response
parse function - parsing received raw response &[u8] and serializing it into UdsMessage
Notes
For the correct behaviour, you need to have Linux kernel with applied patch: https://lore.kernel.org/linux-can/20230818114345.142983-1-lukas.magel@posteo.net/#r
License
This project is licensed under the MIT License - see the LICENSE file for details.