diff options
Diffstat (limited to 'CAN-binder/libs/isotp-c/src/isotp/isotp.c')
-rw-r--r-- | CAN-binder/libs/isotp-c/src/isotp/isotp.c | 32 |
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 0000000..ce87f1b --- /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]); +} |