summaryrefslogtreecommitdiffstats
path: root/src/isotp/isotp.c
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-31 16:29:07 -0500
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2013-12-31 16:29:07 -0500
commit03c3696d34a064e40c98bb5d53c9b68967353cea (patch)
treef546d19b16f0594d48a9a3c534794dc1d409a7e2 /src/isotp/isotp.c
parent6bbc83bd1daac73f9e0dcccb848154a3c3b972fa (diff)
Return completion status when receiving CAN frames.
Diffstat (limited to 'src/isotp/isotp.c')
-rw-r--r--src/isotp/isotp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/isotp/isotp.c b/src/isotp/isotp.c
index f5b20795..58243123 100644
--- a/src/isotp/isotp.c
+++ b/src/isotp/isotp.c
@@ -33,23 +33,26 @@ void isotp_message_to_string(const IsoTpMessage* message, char* destination,
message->arbitration_id, message->payload);
}
-void isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
+bool isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
const uint16_t arbitration_id, const uint8_t data[],
const uint8_t data_length) {
+ bool message_completed = false;
+
if(data_length < 1) {
- return;
+ return message_completed;
}
if(handle->type == ISOTP_HANDLE_RECEIVING) {
if(handle->receive_handle.arbitration_id != arbitration_id) {
- return;
+ return message_completed;
}
} else if(handle->type == ISOTP_HANDLE_SENDING) {
if(handle->send_handle.receiving_arbitration_id != arbitration_id) {
- return;
+ return message_completed;
}
} else {
shims->log("The ISO-TP handle is corrupt");
+ return message_completed;
}
IsoTpProtocolControlInformation pci = (IsoTpProtocolControlInformation)
@@ -73,11 +76,12 @@ void isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
size: payload_length
};
- isotp_handle_single_frame(handle, &message);
+ message_completed = isotp_handle_single_frame(handle, &message);
break;
}
default:
shims->log("Only single frame messages are supported");
break;
}
+ return message_completed;
}