Enable warnings when compiling and fix a few.
[apps/low-level-can-service.git] / src / isotp / send.c
index dfba1df..798fab8 100644 (file)
@@ -1,4 +1,6 @@
 #include <isotp/send.h>
+#include <bitfield/bitfield.h>
+#include <string.h>
 
 #define PCI_NIBBLE_INDEX 0
 #define PAYLOAD_LENGTH_NIBBLE_INDEX 1
@@ -69,3 +71,19 @@ IsoTpSendHandle isotp_send(IsoTpShims* shims, const uint16_t arbitration_id,
         return isotp_send_multi_frame(shims, &message, callback);
     }
 }
+
+bool isotp_continue_send(IsoTpShims* shims, IsoTpSendHandle* handle,
+        const uint16_t arbitration_id, const uint8_t data[],
+        const uint8_t size) {
+    // TODO this will need to be tested when we add multi-frame support,
+    // which is when it'll be necessary to pass in CAN messages to SENDING
+    // handles.
+    if(handle->receiving_arbitration_id != arbitration_id) {
+        if(shims->log != NULL) {
+            shims->log("The arb ID 0x%x doesn't match the expected tx continuation ID 0x%x",
+                    arbitration_id, handle->receiving_arbitration_id);
+        }
+        return false;
+    }
+    return false;
+}