Attempt to print entire payload and fail.
authorChristopher Peplin <chris.peplin@rhubarbtech.com>
Thu, 2 Jan 2014 23:31:52 +0000 (18:31 -0500)
committerChristopher Peplin <chris.peplin@rhubarbtech.com>
Thu, 2 Jan 2014 23:31:52 +0000 (18:31 -0500)
deps/bitfield-c
src/isotp/isotp.c
tests/common.c

index 4af52c4..31caa9c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4af52c415f1668fbd168da74d0aca903c592463f
+Subproject commit 31caa9c77dbfc438a104fbcab6db5165528c0f89
index 67c644f..6522f7a 100644 (file)
@@ -21,15 +21,17 @@ IsoTpShims isotp_init_shims(LogShim log, SendCanMessageShim send_can_message,
 
 void isotp_message_to_string(const IsoTpMessage* message, char* destination,
         size_t destination_length) {
-    char payload_string[message->size * 2 + 1];
-    memset(payload_string, 0, sizeof(payload_string));
-    for(int i = 0; i < message->size; i++) {
-        // TODO, bah this isn't working because snprintf hits the NULL char that
-        // it wrote the last time and stops cold
-        /* snprintf(&payload_string[i * 2], 2, "%02x", message->payload[i]); */
-    }
-    snprintf(destination, destination_length, "ID: 0x%02x, Payload: 0x%s",
-            message->arbitration_id, payload_string);
+    // TODO why is this still not printing the entire payload?
+    snprintf(destination, destination_length, "ID: 0x%02x, Payload: 0x%02x%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]);
 }
 
 IsoTpMessage isotp_receive_can_frame(IsoTpShims* shims, IsoTpHandle* handle,
index 882c266..5995df7 100644 (file)
@@ -76,9 +76,7 @@ void message_sent(const IsoTpMessage* message, const bool success) {
 
 void can_frame_sent(const uint16_t arbitration_id, const uint8_t* payload,
         const uint8_t size) {
-    debug("Sent CAN Frame:");
-    // TODO add something like this to canutil
-    /* log_can_message(arbitration_id, payload, size); */
+    debug("Sent CAN Frame with arb ID 0x%x and %d bytes", arbitration_id, size);
 }
 
 void setup() {