summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-02 15:28:52 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-02 15:28:52 -0500
commite3637d97ecaef1768d3f9ef40cb0204a0e668ff2 (patch)
treea1f2db1c34cfde48fe8533877015556ba7309c30 /src
parentfe20a273bb3979d9e806d828486633249d073ede (diff)
Only mark handle as completed when fully received.
Diffstat (limited to 'src')
-rw-r--r--src/isotp/isotp.c2
-rw-r--r--src/isotp/isotp.h5
-rw-r--r--src/isotp/receive.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/src/isotp/isotp.c b/src/isotp/isotp.c
index 9aa051bc..1605d435 100644
--- a/src/isotp/isotp.c
+++ b/src/isotp/isotp.c
@@ -76,6 +76,8 @@ IsoTpMessage isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
message.payload = payload;
message.size = payload_length;
message.completed = true;
+ handle->success = true;
+ handle->completed = true;
isotp_handle_single_frame(handle, &message);
break;
}
diff --git a/src/isotp/isotp.h b/src/isotp/isotp.h
index 103c402d..c0db0178 100644
--- a/src/isotp/isotp.h
+++ b/src/isotp/isotp.h
@@ -101,6 +101,11 @@ IsoTpMessage isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
const uint16_t arbitration_id, const uint8_t data[],
const uint8_t size);
+// TODO perhaps this makes more sense as 2 functions:
+// bool isotp_continue_send()
+// IsoTpMessage isotp_continue_receive()
+// but both with the same args
+
/* Public: Change the timeout for waiting on an ISO-TP response frame.
*
* If this function is not used, the conventional 100ms is used by default.
diff --git a/src/isotp/receive.c b/src/isotp/receive.c
index 1692f8d3..b07950c5 100644
--- a/src/isotp/receive.c
+++ b/src/isotp/receive.c
@@ -20,7 +20,7 @@ IsoTpHandle isotp_receive(IsoTpShims* shims,
IsoTpHandle handle = {
success: false,
- completed: true,
+ completed: false,
receive_handle: receive_handle,
type: ISOTP_HANDLE_RECEIVING
};