Multi frame (#6)
[apps/low-level-can-service.git] / src / uds / uds_types.h
index 68d6b6f..66bf743 100644 (file)
@@ -9,9 +9,10 @@
 extern "C" {
 #endif
 
-// TODO This isn't true for multi frame messages - we may need to dynamically
-// allocate this in the future
-#define MAX_UDS_PAYLOAD_LENGTH 7
+// TODO This still doesn't have enough space for the largest possible 
+// multiframe response. May need to dynamically allocate in the future.
+#define MAX_UDS_RESPONSE_PAYLOAD_LENGTH 255
+#define MAX_UDS_REQUEST_PAYLOAD_LENGTH 7
 #define MAX_RESPONDING_ECU_COUNT 8
 #define VIN_LENGTH 17
 
@@ -54,7 +55,7 @@ typedef struct {
     bool has_pid;
     uint16_t pid;
     uint8_t pid_length;
-    uint8_t payload[MAX_UDS_PAYLOAD_LENGTH];
+    uint8_t payload[MAX_UDS_REQUEST_PAYLOAD_LENGTH];
     uint8_t payload_length;
     bool no_frame_padding;
     DiagnosticRequestType type;
@@ -92,6 +93,8 @@ typedef enum {
  *      field isn't valid if 'completed' isn't true. If this is 'false', check
  *      the negative_response_code field for the reason.
  * arbitration_id - The arbitration ID the response was received on.
+ * multi_frame - True if this response (whether completed or not) required
+ *      multi-frame CAN support. Can be used for updating time-out functions.
  * mode - The OBD-II mode for the original request.
  * has_pid - If this is a response to a PID request, this will be true and the
  *      'pid' field will be valid.
@@ -106,12 +109,13 @@ typedef enum {
 typedef struct {
     bool completed;
     bool success;
+    bool multi_frame;
     uint32_t arbitration_id;
     uint8_t mode;
     bool has_pid;
     uint16_t pid;
     DiagnosticNegativeResponseCode negative_response_code;
-    uint8_t payload[MAX_UDS_PAYLOAD_LENGTH];
+    uint8_t payload[MAX_UDS_RESPONSE_PAYLOAD_LENGTH];
     uint8_t payload_length;
 } DiagnosticResponse;