From cf4d4348421c7a2e8887fae39c7e9ab21a70666c Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Thu, 6 Mar 2014 00:23:55 -0500 Subject: Add a function to check if a request is completely sent. --- src/uds/uds.c | 4 ++++ src/uds/uds.h | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/uds/uds.c b/src/uds/uds.c index 31205f4b..1157949c 100644 --- a/src/uds/uds.c +++ b/src/uds/uds.c @@ -92,6 +92,10 @@ static void send_diagnostic_request(DiagnosticShims* shims, } } +bool diagnostic_request_sent(DiagnosticRequestHandle* handle) { + return handle->isotp_send_handle.completed; +} + void start_diagnostic_request(DiagnosticShims* shims, DiagnosticRequestHandle* handle) { handle->success = false; diff --git a/src/uds/uds.h b/src/uds/uds.h index 1546320e..43058342 100644 --- a/src/uds/uds.h +++ b/src/uds/uds.h @@ -151,6 +151,13 @@ float diagnostic_decode_obd2_pid(const DiagnosticResponse* response); bool diagnostic_request_equals(const DiagnosticRequest* ours, const DiagnosticRequest* theirs); +/* Public: Returns true if the request has been completely sent - if false, make + * sure you called start_diagnostic_request once to start it, and then pass + * incoming CAN messages to it with diagnostic_receive_can_frame(...) so it can + * continue the ISO-TP transfer. + */ +bool diagnostic_request_sent(DiagnosticRequestHandle* handle); + #ifdef __cplusplus } #endif -- cgit 1.2.3-korg