aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/libs/isotp-c/src/isotp/isotp.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-02 17:51:18 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-02 17:51:18 +0200
commitf44a5b1549bc4c8a84d0dedf4a8b1e4220a34f42 (patch)
tree2368f764aa2f10bf9927096f5222dc4cab94a838 /CAN-binder/libs/isotp-c/src/isotp/isotp.c
parentd170c9faeae2cf29c19f3523714ecdf58be73bed (diff)
parentee24440b7c123ab1b0317e57be33e837a1cb51f1 (diff)
Add 'CAN-binder/libs/isotp-c/' from commit 'ee24440b7c123ab1b0317e57be33e837a1cb51f1'
git-subtree-dir: CAN-binder/libs/isotp-c git-subtree-mainline: d170c9faeae2cf29c19f3523714ecdf58be73bed git-subtree-split: ee24440b7c123ab1b0317e57be33e837a1cb51f1
Diffstat (limited to 'CAN-binder/libs/isotp-c/src/isotp/isotp.c')
-rw-r--r--CAN-binder/libs/isotp-c/src/isotp/isotp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/CAN-binder/libs/isotp-c/src/isotp/isotp.c b/CAN-binder/libs/isotp-c/src/isotp/isotp.c
new file mode 100644
index 00000000..ce87f1bd
--- /dev/null
+++ b/CAN-binder/libs/isotp-c/src/isotp/isotp.c
@@ -0,0 +1,32 @@
+#include <isotp/isotp.h>
+#include <bitfield/bitfield.h>
+#include <inttypes.h>
+
+/* void isotp_set_timeout(IsoTpHandler* handler, uint16_t timeout_ms) { */
+ /* handler->timeout_ms = timeout_ms; */
+/* } */
+
+IsoTpShims isotp_init_shims(LogShim log, SendCanMessageShim send_can_message,
+ SetTimerShim set_timer) {
+ IsoTpShims shims = {
+ log: log,
+ send_can_message: send_can_message,
+ set_timer: set_timer,
+ frame_padding: ISO_TP_DEFAULT_FRAME_PADDING_STATUS
+ };
+ return shims;
+}
+
+void isotp_message_to_string(const IsoTpMessage* message, char* destination,
+ size_t destination_length) {
+ snprintf(destination, destination_length, "ID: 0x%" SCNd32 ", Payload: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
+ message->arbitration_id,
+ message->payload[0],
+ message->payload[1],
+ message->payload[2],
+ message->payload[3],
+ message->payload[4],
+ message->payload[5],
+ message->payload[6],
+ message->payload[7]);
+}