summaryrefslogtreecommitdiffstats
path: root/src/uds/extras.h
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-20 15:22:27 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-20 15:22:27 -0500
commit46fb0eb96e8efd285c2a0cccf699862ed21717ed (patch)
tree2107aa0fa9a382c006f73d5cdcdd18b586d4d229 /src/uds/extras.h
parent6ebad2aac3ba2f0d7ff5e37c5db4e5b9549247e2 (diff)
Rename from simply obd2 to more general UDS (unified diagnostics).
Fixed #1.
Diffstat (limited to 'src/uds/extras.h')
-rw-r--r--src/uds/extras.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/uds/extras.h b/src/uds/extras.h
new file mode 100644
index 00000000..c59c7bad
--- /dev/null
+++ b/src/uds/extras.h
@@ -0,0 +1,73 @@
+#ifndef __EXTRAS_H__
+#define __EXTRAS_H__
+
+#include <uds/uds_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// TODO everything in here is unused for the moment!
+
+typedef enum {
+ POWERTRAIN = 0x0,
+ CHASSIS = 0x1,
+ BODY = 0x2,
+ NETWORK = 0x3
+} DiagnosticTroubleCodeGroup;
+
+typedef struct {
+ DiagnosticTroubleCodeGroup group;
+ uint8_t group_num;
+ uint8_t code;
+} DiagnosticTroubleCode;
+
+
+/* Private: TODO unused for now
+ */
+typedef enum {
+ DTC_EMISSIONS,
+ DTC_DRIVE_CYCLE,
+ DTC_PERMANENT
+} DiagnosticTroubleCodeType;
+
+
+// TODO should we enumerate every OBD-II PID? need conversion formulas, too
+typedef struct {
+ uint16_t pid;
+ uint8_t bytes_returned;
+ float min_value;
+ float max_value;
+} DiagnosticParameter;
+
+typedef void (*DiagnosticMilStatusReceived)(bool malfunction_indicator_status);
+typedef void (*DiagnosticVinReceived)(uint8_t vin[]);
+typedef void (*DiagnosticTroubleCodesReceived)(
+ DiagnosticMode mode, DiagnosticTroubleCode* codes);
+typedef void (*DiagnosticPidEnumerationReceived)(
+ const DiagnosticResponse* response, uint16_t* pids);
+
+DiagnosticRequestHandle diagnostic_request_malfunction_indicator_status(
+ DiagnosticShims* shims,
+ DiagnosticMilStatusReceived callback);
+
+DiagnosticRequestHandle diagnostic_request_vin(DiagnosticShims* shims,
+ DiagnosticVinReceived callback);
+
+DiagnosticRequestHandle diagnostic_request_dtc(DiagnosticShims* shims,
+ DiagnosticTroubleCodeType dtc_type,
+ DiagnosticTroubleCodesReceived callback);
+
+bool diagnostic_clear_dtc(DiagnosticShims* shims);
+
+DiagnosticRequestHandle diagnostic_enumerate_pids(DiagnosticShims* shims,
+ DiagnosticRequest* request, DiagnosticPidEnumerationReceived callback);
+
+// TODO
+float diagnostic_decode_OBD2_pid(DiagnosticResponse* response);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __EXTRAS_H__