diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-06 18:22:06 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2014-01-06 18:24:17 -0500 |
commit | b2705b3ec209311506af2034e021285daf3c9649 (patch) | |
tree | 507eb4e6d0c004ef17842beb7f4ae5460e444ef3 /src/obd2/obd2.c | |
parent | 00fa0aa3e59d49d72c961f893e524fc20563aa67 (diff) |
Mark request handle and response completed even if an error ocurred.
Add extra logging and a few notes.
Diffstat (limited to 'src/obd2/obd2.c')
-rw-r--r-- | src/obd2/obd2.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/obd2/obd2.c b/src/obd2/obd2.c index 3dad886a..c780fd8c 100644 --- a/src/obd2/obd2.c +++ b/src/obd2/obd2.c @@ -147,6 +147,8 @@ static bool handle_positive_response(DiagnosticRequestHandle* handle, } else { response->pid = message->payload[PID_BYTE_INDEX]; } + // TODO we're not currently throwing an error or anything if the PID + // doesn't match - it may be OK to leave that up to the user. } uint8_t payload_index = 1 + handle->request.pid_length; @@ -197,13 +199,23 @@ DiagnosticResponse diagnostic_receive_can_frame(DiagnosticShims* shims, response.mode - MODE_RESPONSE_OFFSET, handle->request.mode); } + } else { + shims->log("Received an empty response on arb ID 0x%x", + response.arbitration_id); } + // TODO For now even if we got an empty repsonse or something for + // the wrong mode, we're marking this as completed - I'm not sure + // those other cases could or will ever happen in practice. + // Alternatively, we could re-init handle->isotp_receive_handle if + // the current one completed without a valid response to this + // diagnostic request. + response.completed = true; + handle->completed = true; if(handle->completed && handle->callback != NULL) { handle->callback(&response); } } - } else { shims->log("Mode %d request to arb ID 0x%x is already completed", handle->request.mode, handle->request.arbitration_id); |