diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-31 12:59:20 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-31 12:59:20 -0500 |
commit | 1d6ab7e3c86cfd018977cab89a0dd32762984d58 (patch) | |
tree | 0a1a538d42c34918ad75190b240096fb14e0b682 /src/obd2/obd2.h | |
parent | 84bc68873aa53e295853b461b6793b5019d1dacb (diff) |
Draft reworking of API.
Diffstat (limited to 'src/obd2/obd2.h')
-rw-r--r-- | src/obd2/obd2.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/obd2/obd2.h b/src/obd2/obd2.h index e4ffc7ab..8d7d6642 100644 --- a/src/obd2/obd2.h +++ b/src/obd2/obd2.h @@ -16,10 +16,15 @@ typedef struct { uint16_t arbitration_id; uint8_t mode; uint16_t pid; + uint8_t pid_length; uint8_t payload[MAX_OBD2_PAYLOAD_LENGTH]; uint8_t payload_length; } DiagnosticRequest; +// TODO I don't like this, it's hard coding isotp library stuff here +typedef bool (*SendIsoTpMessageShim)(IsoTpHandler* handler, + const uint8_t* payload, uint16_t payload_size); + // Thanks to // http://www.canbushack.com/blog/index.php?title=scanning-for-diagnostic-data&more=1&c=1&tb=1&pb=1 // for the list of NRCs @@ -116,6 +121,7 @@ typedef struct { // compare an incoming CAN message to see if it matches the service / PID! // TODO i'm not sure this type/callback in here is too useful - see the // comments in obd2.c:diagnostic_request + DiagnosticRequestType type; DiagnosticResponseReceived callback; DiagnosticMilStatusReceived mil_status_callback; @@ -129,7 +135,8 @@ typedef enum { } DiagnosticPidRequestType; typedef struct { - IsoTpShims isotp_shims; + SetTimerShim set_timer; + SendCanMessageShim send_can_message; LogShim log; } DiagnosticShims; @@ -161,6 +168,11 @@ bool diagnostic_clear_dtc(DiagnosticShims* shims); DiagnosticRequestHandle diagnostic_enumerate_pids(DiagnosticShims* shims, DiagnosticRequest* request, DiagnosticPidEnumerationReceived callback); +// TODO +// void diagnostic_receive_isotp_message(DiagnosticRequestHandle* handle, + // const IsoTpMessage* message); +void diagnostic_receive_isotp_message(const IsoTpMessage* message); + void diagnostic_receive_can_frame(DiagnosticRequestHandle* handle, const uint16_t arbitration_id, const uint8_t data[], const uint8_t size); |