diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-03 15:09:10 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-03 15:09:10 -0500 |
commit | 3fe62dd9870c59e600eb6f51603a49325372979e (patch) | |
tree | 396d170a406d355ef7f180b3fdd648839c27b9a0 /src | |
parent | 183ee8ad424f06850af903668314d7e9cda9a3e0 (diff) |
Test receiving a negative response.
Diffstat (limited to 'src')
-rw-r--r-- | src/obd2/obd2.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/obd2/obd2.c b/src/obd2/obd2.c index 627128c3..05be8342 100644 --- a/src/obd2/obd2.c +++ b/src/obd2/obd2.c @@ -143,6 +143,7 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims, IsoTpMessage message = isotp_continue_receive(&handle->isotp_shims, &handle->isotp_receive_handle, arbitration_id, data, size); + // TODO this could be cleaned and DRY'd up a bit if(message.completed) { if(message.size > 0) { response.mode = message.payload[0]; @@ -158,6 +159,7 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims, if(message.size > NEGATIVE_RESPONSE_NRC_INDEX) { response.negative_response_code = message.payload[NEGATIVE_RESPONSE_NRC_INDEX]; } + response.success = false; } else { if(response.mode == handle->request.mode + MODE_RESPONSE_OFFSET) { @@ -189,9 +191,9 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims, } response.completed = true; - // TODO what does it mean for the handle to be successful, vs. the - // request to be successful? if we get a NRC, is that a successful - // request? + // TODO clarify what it means for a handle to be successful (we made + // a good request+response) vs a request itself being successfuly + // (the other node didn't return a negative response). handle->success = true; handle->completed = true; |