Store raw CAN payload in bytes instead of uint64_t.
authorChristopher Peplin <chris.peplin@rhubarbtech.com>
Fri, 17 Jan 2014 21:38:23 +0000 (16:38 -0500)
committerChristopher Peplin <chris.peplin@rhubarbtech.com>
Fri, 17 Jan 2014 21:38:23 +0000 (16:38 -0500)
gen/cpp/openxc.pb
gen/cpp/openxc.pb.c
gen/cpp/openxc.pb.h
gen/java/com/openxc/BinaryMessages.java
gen/python/openxc_pb2.py
openxc.options
openxc.proto

index 9d6271d..b4fd2f6 100644 (file)
@@ -17,7 +17,7 @@ RawMessage\12
 \ 3bus\18\ 1 \ 1(\ 5\12\12
 
 message_id\18\ 2 \ 1(\r\12\f
-\ 4data\18\ 3 \ 1(\ 4"\91\ 1
+\ 4data\18\ 3 \ 1(\f"\91\ 1
 \11DiagnosticMessage\12\v
 \ 3bus\18\ 1 \ 1(\ 5\12\12
 
index 3c3958f..84c87c7 100644 (file)
@@ -1,5 +1,5 @@
 /* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.2.5 at Fri Jan 17 14:40:08 2014. */
+/* Generated by nanopb-0.2.5 at Fri Jan 17 16:33:23 2014. */
 
 #include "openxc.pb.h"
 
@@ -16,7 +16,7 @@ const pb_field_t openxc_VehicleMessage_fields[5] = {
 const pb_field_t openxc_RawMessage_fields[4] = {
     PB_FIELD2(  1, INT32   , OPTIONAL, STATIC  , FIRST, openxc_RawMessage, bus, bus, 0),
     PB_FIELD2(  2, UINT32  , OPTIONAL, STATIC  , OTHER, openxc_RawMessage, message_id, bus, 0),
-    PB_FIELD2(  3, UINT64  , OPTIONAL, STATIC  , OTHER, openxc_RawMessage, data, message_id, 0),
+    PB_FIELD2(  3, BYTES   , OPTIONAL, STATIC  , OTHER, openxc_RawMessage, data, message_id, 0),
     PB_LAST_FIELD
 };
 
index 95276b4..879dbb8 100644 (file)
@@ -1,5 +1,5 @@
 /* Automatically generated nanopb header */
-/* Generated by nanopb-0.2.5 at Fri Jan 17 14:40:08 2014. */
+/* Generated by nanopb-0.2.5 at Fri Jan 17 16:33:23 2014. */
 
 #ifndef _PB_OPENXC_PB_H_
 #define _PB_OPENXC_PB_H_
@@ -48,13 +48,18 @@ typedef struct _openxc_DiagnosticMessage {
     openxc_DiagnosticMessage_payload_t payload;
 } openxc_DiagnosticMessage;
 
+typedef struct {
+    size_t size;
+    uint8_t bytes[8];
+} openxc_RawMessage_data_t;
+
 typedef struct _openxc_RawMessage {
     bool has_bus;
     int32_t bus;
     bool has_message_id;
     uint32_t message_id;
     bool has_data;
-    uint64_t data;
+    openxc_RawMessage_data_t data;
 } openxc_RawMessage;
 
 typedef struct _openxc_TranslatedMessage {
@@ -120,8 +125,8 @@ extern const pb_field_t openxc_DiagnosticMessage_fields[8];
 extern const pb_field_t openxc_TranslatedMessage_fields[9];
 
 /* Maximum encoded size of messages (where known) */
-#define openxc_VehicleMessage_size               422
-#define openxc_RawMessage_size                   28
+#define openxc_VehicleMessage_size               421
+#define openxc_RawMessage_size                   27
 #define openxc_DiagnosticMessage_size            47
 #define openxc_TranslatedMessage_size            334
 
index 495925b..2962fb6 100644 (file)
@@ -1103,15 +1103,15 @@ public final class BinaryMessages {
      */
     int getMessageId();
 
-    // optional uint64 data = 3;
+    // optional bytes data = 3;
     /**
-     * <code>optional uint64 data = 3;</code>
+     * <code>optional bytes data = 3;</code>
      */
     boolean hasData();
     /**
-     * <code>optional uint64 data = 3;</code>
+     * <code>optional bytes data = 3;</code>
      */
-    long getData();
+    com.google.protobuf.ByteString getData();
   }
   /**
    * Protobuf type {@code openxc.RawMessage}
@@ -1174,9 +1174,9 @@ public final class BinaryMessages {
               messageId_ = input.readUInt32();
               break;
             }
-            case 24: {
+            case 26: {
               bitField0_ |= 0x00000004;
-              data_ = input.readUInt64();
+              data_ = input.readBytes();
               break;
             }
           }
@@ -1251,26 +1251,26 @@ public final class BinaryMessages {
       return messageId_;
     }
 
-    // optional uint64 data = 3;
+    // optional bytes data = 3;
     public static final int DATA_FIELD_NUMBER = 3;
-    private long data_;
+    private com.google.protobuf.ByteString data_;
     /**
-     * <code>optional uint64 data = 3;</code>
+     * <code>optional bytes data = 3;</code>
      */
     public boolean hasData() {
       return ((bitField0_ & 0x00000004) == 0x00000004);
     }
     /**
-     * <code>optional uint64 data = 3;</code>
+     * <code>optional bytes data = 3;</code>
      */
-    public long getData() {
+    public com.google.protobuf.ByteString getData() {
       return data_;
     }
 
     private void initFields() {
       bus_ = 0;
       messageId_ = 0;
-      data_ = 0L;
+      data_ = com.google.protobuf.ByteString.EMPTY;
     }
     private byte memoizedIsInitialized = -1;
     public final boolean isInitialized() {
@@ -1291,7 +1291,7 @@ public final class BinaryMessages {
         output.writeUInt32(2, messageId_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeUInt64(3, data_);
+        output.writeBytes(3, data_);
       }
       getUnknownFields().writeTo(output);
     }
@@ -1312,7 +1312,7 @@ public final class BinaryMessages {
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeUInt64Size(3, data_);
+          .computeBytesSize(3, data_);
       }
       size += getUnknownFields().getSerializedSize();
       memoizedSerializedSize = size;
@@ -1434,7 +1434,7 @@ public final class BinaryMessages {
         bitField0_ = (bitField0_ & ~0x00000001);
         messageId_ = 0;
         bitField0_ = (bitField0_ & ~0x00000002);
-        data_ = 0L;
+        data_ = com.google.protobuf.ByteString.EMPTY;
         bitField0_ = (bitField0_ & ~0x00000004);
         return this;
       }
@@ -1594,35 +1594,38 @@ public final class BinaryMessages {
         return this;
       }
 
-      // optional uint64 data = 3;
-      private long data_ ;
+      // optional bytes data = 3;
+      private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
       /**
-       * <code>optional uint64 data = 3;</code>
+       * <code>optional bytes data = 3;</code>
        */
       public boolean hasData() {
         return ((bitField0_ & 0x00000004) == 0x00000004);
       }
       /**
-       * <code>optional uint64 data = 3;</code>
+       * <code>optional bytes data = 3;</code>
        */
-      public long getData() {
+      public com.google.protobuf.ByteString getData() {
         return data_;
       }
       /**
-       * <code>optional uint64 data = 3;</code>
+       * <code>optional bytes data = 3;</code>
        */
-      public Builder setData(long value) {
-        bitField0_ |= 0x00000004;
+      public Builder setData(com.google.protobuf.ByteString value) {
+        if (value == null) {
+    throw new NullPointerException();
+  }
+  bitField0_ |= 0x00000004;
         data_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional uint64 data = 3;</code>
+       * <code>optional bytes data = 3;</code>
        */
       public Builder clearData() {
         bitField0_ = (bitField0_ & ~0x00000004);
-        data_ = 0L;
+        data_ = getDefaultInstance().getData();
         onChanged();
         return this;
       }
@@ -3915,7 +3918,7 @@ public final class BinaryMessages {
       "ge\030\004 \001(\0132\031.openxc.DiagnosticMessage\"/\n\004T" +
       "ype\022\007\n\003RAW\020\001\022\016\n\nTRANSLATED\020\002\022\016\n\nDIAGNOST" +
       "IC\020\003\";\n\nRawMessage\022\013\n\003bus\030\001 \001(\005\022\022\n\nmessa" +
-      "ge_id\030\002 \001(\r\022\014\n\004data\030\003 \001(\004\"\221\001\n\021Diagnostic" +
+      "ge_id\030\002 \001(\r\022\014\n\004data\030\003 \001(\014\"\221\001\n\021Diagnostic" +
       "Message\022\013\n\003bus\030\001 \001(\005\022\022\n\nmessage_id\030\002 \001(\r",
       "\022\014\n\004mode\030\003 \001(\r\022\013\n\003pid\030\004 \001(\r\022\017\n\007success\030\005" +
       " \001(\010\022\036\n\026negative_response_code\030\006 \001(\r\022\017\n\007" +
index 56d1539..182d5f2 100644 (file)
@@ -13,7 +13,7 @@ from google.protobuf import descriptor_pb2
 DESCRIPTOR = _descriptor.FileDescriptor(
   name='openxc.proto',
   package='openxc',
-  serialized_pb='\n\x0copenxc.proto\x12\x06openxc\"\x83\x02\n\x0eVehicleMessage\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.VehicleMessage.Type\x12\'\n\x0braw_message\x18\x02 \x01(\x0b\x32\x12.openxc.RawMessage\x12\x35\n\x12translated_message\x18\x03 \x01(\x0b\x32\x19.openxc.TranslatedMessage\x12\x35\n\x12\x64iagnostic_message\x18\x04 \x01(\x0b\x32\x19.openxc.DiagnosticMessage\"/\n\x04Type\x12\x07\n\x03RAW\x10\x01\x12\x0e\n\nTRANSLATED\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\";\n\nRawMessage\x12\x0b\n\x03\x62us\x18\x01 \x01(\x05\x12\x12\n\nmessage_id\x18\x02 \x01(\r\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x04\"\x91\x01\n\x11\x44iagnosticMessage\x12\x0b\n\x03\x62us\x18\x01 \x01(\x05\x12\x12\n\nmessage_id\x18\x02 \x01(\r\x12\x0c\n\x04mode\x18\x03 \x01(\r\x12\x0b\n\x03pid\x18\x04 \x01(\r\x12\x0f\n\x07success\x18\x05 \x01(\x08\x12\x1e\n\x16negative_response_code\x18\x06 \x01(\r\x12\x0f\n\x07payload\x18\x07 \x01(\x0c\"\xb5\x02\n\x11TranslatedMessage\x12,\n\x04type\x18\x01 \x01(\x0e\x32\x1e.openxc.TranslatedMessage.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x14\n\x0cstring_value\x18\x03 \x01(\t\x12\x15\n\rnumeric_value\x18\x04 \x01(\x01\x12\x15\n\rboolean_value\x18\x05 \x01(\x08\x12\x14\n\x0cstring_event\x18\x06 \x01(\t\x12\x15\n\rnumeric_event\x18\x07 \x01(\x01\x12\x15\n\rboolean_event\x18\x08 \x01(\x08\"\\\n\x04Type\x12\n\n\x06STRING\x10\x01\x12\x07\n\x03NUM\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\x12\x12\n\x0e\x45VENTED_STRING\x10\x04\x12\x0f\n\x0b\x45VENTED_NUM\x10\x05\x12\x10\n\x0c\x45VENTED_BOOL\x10\x06\x42\x1c\n\ncom.openxcB\x0e\x42inaryMessages')
+  serialized_pb='\n\x0copenxc.proto\x12\x06openxc\"\x83\x02\n\x0eVehicleMessage\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.VehicleMessage.Type\x12\'\n\x0braw_message\x18\x02 \x01(\x0b\x32\x12.openxc.RawMessage\x12\x35\n\x12translated_message\x18\x03 \x01(\x0b\x32\x19.openxc.TranslatedMessage\x12\x35\n\x12\x64iagnostic_message\x18\x04 \x01(\x0b\x32\x19.openxc.DiagnosticMessage\"/\n\x04Type\x12\x07\n\x03RAW\x10\x01\x12\x0e\n\nTRANSLATED\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\";\n\nRawMessage\x12\x0b\n\x03\x62us\x18\x01 \x01(\x05\x12\x12\n\nmessage_id\x18\x02 \x01(\r\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x91\x01\n\x11\x44iagnosticMessage\x12\x0b\n\x03\x62us\x18\x01 \x01(\x05\x12\x12\n\nmessage_id\x18\x02 \x01(\r\x12\x0c\n\x04mode\x18\x03 \x01(\r\x12\x0b\n\x03pid\x18\x04 \x01(\r\x12\x0f\n\x07success\x18\x05 \x01(\x08\x12\x1e\n\x16negative_response_code\x18\x06 \x01(\r\x12\x0f\n\x07payload\x18\x07 \x01(\x0c\"\xb5\x02\n\x11TranslatedMessage\x12,\n\x04type\x18\x01 \x01(\x0e\x32\x1e.openxc.TranslatedMessage.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x14\n\x0cstring_value\x18\x03 \x01(\t\x12\x15\n\rnumeric_value\x18\x04 \x01(\x01\x12\x15\n\rboolean_value\x18\x05 \x01(\x08\x12\x14\n\x0cstring_event\x18\x06 \x01(\t\x12\x15\n\rnumeric_event\x18\x07 \x01(\x01\x12\x15\n\rboolean_event\x18\x08 \x01(\x08\"\\\n\x04Type\x12\n\n\x06STRING\x10\x01\x12\x07\n\x03NUM\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\x12\x12\n\x0e\x45VENTED_STRING\x10\x04\x12\x0f\n\x0b\x45VENTED_NUM\x10\x05\x12\x10\n\x0c\x45VENTED_BOOL\x10\x06\x42\x1c\n\ncom.openxcB\x0e\x42inaryMessages')
 
 
 
@@ -153,8 +153,8 @@ _RAWMESSAGE = _descriptor.Descriptor(
       options=None),
     _descriptor.FieldDescriptor(
       name='data', full_name='openxc.RawMessage.data', index=2,
-      number=3, type=4, cpp_type=4, label=1,
-      has_default_value=False, default_value=0,
+      number=3, type=12, cpp_type=9, label=1,
+      has_default_value=False, default_value="",
       message_type=None, enum_type=None, containing_type=None,
       is_extension=False, extension_scope=None,
       options=None),
index 75caaba..c1e4e01 100644 (file)
@@ -2,3 +2,4 @@ openxc.TranslatedMessage.name max_size:100
 openxc.TranslatedMessage.string_value max_size:100
 openxc.TranslatedMessage.string_event max_size:100
 openxc.DiagnosticMessage.payload max_size:8
+openxc.RawMessage.data max_size:8
index cc135a6..a825e1c 100644 (file)
@@ -15,7 +15,7 @@ message VehicleMessage {
 message RawMessage {
     optional int32 bus = 1;
     optional uint32 message_id = 2;
-    optional uint64 data = 3;
+    optional bytes data = 3;
 }
 
 message DiagnosticMessage {