-OBD-II Support Library in C
-=============================
+Unified Diagnostic Services (UDS) Support Library in C
+======================================================
-This is a platform agnostic C library that implements the standard On Board
-Diagnostics system for vehicles. It currently supports OBD-II running over CAN
-(ISO 15765-4), which uses the ISO-TP (ISO 15765-2) protocol underneath.
+This is a platform agnostic C library that implements the Unified Diagnostics
+Services protocol for automotive electronics. UDS is documented in ISO 14229 and
+is the underpinning for the more well-known On-board Diagnostics (OBD) standard.
+The library currently supports UDS running over CAN (ISO 15765-4), which uses
+the ISO-TP (ISO 15765-2) protocol for message framing.
This library doesn't assume anything about the source of your diagnostic message
requests or underlying interface to the CAN bus. It uses dependency injection to
// required, this must send a single CAN message with the given arbitration
// ID (i.e. the CAN message ID) and data. The size will never be more than 8
// bytes.
- void send_can(const uint16_t arbitration_id, const uint8_t* data,
+ bool send_can(const uint16_t arbitration_id, const uint8_t* data,
const uint8_t size) {
...
}
DiagnosticShims shims = diagnostic_init_shims(debug, send_can, set_timer);
-With your shims in hand, send a simple PID request to the stadnard broadcast
-address, `0x7df`:
+With your shims in hand, send a simple PID request to the standard broadcast
+address, `0x7df` (we use the constant `OBD2_FUNCTIONAL_BROADCAST_ID` here):
// Optional: This is your callback that will be called the response to your
// diagnostic request is received.
DiagnosticRequestHandle handle = diagnostic_request_pid(&shims,
DIAGNOSTIC_STANDARD_PID, // this is a standard PID request, not an extended or enhanced one
- 0x7df, // the request is going out to the broadcast arbitration ID
+ OBD2_FUNCTIONAL_BROADCAST_ID, // the request is going out to the broadcast arbitration ID
0x2, // we want PID 0x2
response_received_handler); // our callback (optional, use NULL if you don't have one)
lower level API you can use. Here's how to make a mode 3 request to get DTCs.
DiagnosticRequest request = {
- arbitration_id: 0x7df,
+ arbitration_id: OBD2_FUNCTIONAL_BROADCAST_ID,
mode: OBD2_MODE_EMISSIONS_DTC_REQUEST
};
DiagnosticRequestHandle handle = diagnostic_request(&SHIMS, &request, NULL);