From 6642105e16f6b52e51f08c376fbc349634588193 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Sat, 15 Mar 2014 12:54:35 -0400 Subject: [PATCH 1/1] Add 'name' and 'multiple_responses' fields to diag requests. --- README.md | 17 +- gen/cpp/openxc.pb | 15 +- gen/cpp/openxc.pb.c | 12 +- gen/cpp/openxc.pb.h | 22 +- gen/java/com/openxc/BinaryMessages.java | 401 +++++++++++++++++++++++++------- gen/python/openxc_pb2.py | 48 ++-- openxc.options | 1 + openxc.proto | 8 +- 8 files changed, 403 insertions(+), 121 deletions(-) diff --git a/README.md b/README.md index 2be7c10c..dcfee281 100644 --- a/README.md +++ b/README.md @@ -57,9 +57,11 @@ with this command format: "pid": 5, "payload": "0x1234", "parse_payload": true, + "multiple_response": false, "factor": 1.0, "offset": 0, - "frequency": 1 + "frequency": 1, + "name": "my_pid" } } } @@ -83,6 +85,14 @@ with this command format: the response. The 'payload' field will be omitted in responses with a 'value'. +**multiple_response** - (optional, false by default) if true, request will stay + active for a full 100ms, even after receiving a diagnostic response message. + This is useful for requests to the functional broadcast arbitration ID + (`0x7df`) when you need to get responses from multiple modules. It's possible + to set this to `true` for non-broadcast requests, but in practice you won't + see any additional responses after the first and it will just take up memory + in the VI for longer. + **factor** - (optional, 1.0 by default) if `parse_payload` is true, the value in the payload will be multiplied by this factor before returning. The `factor` is applied before the `offset`. @@ -94,6 +104,11 @@ with this command format: **frequency** - (optional, defaults to 0) The frequency in Hz to send this request. To send a single request, set this to 0 or leave it out. +**name** - (optional, defaults to nothing) A human readable, string name for + this request. If provided, the response will have a `name` field (much like a + normal translated message) in place of the request details (i.e. the bus, + id, mode and pid). TODO elaborate on this. + The `bus+id+mode+pid` key is unique, so if you send a create request with that key twice, it'll overwrite the existing one (i.e. it will change the frequency, the only other parameter). To cancel a recurring request, send this command with diff --git a/gen/cpp/openxc.pb b/gen/cpp/openxc.pb index 929e6a2c..54ddb8be 100644 --- a/gen/cpp/openxc.pb +++ b/gen/cpp/openxc.pb @@ -1,5 +1,5 @@ -ð +š openxc.protoopenxc"” VehicleMessage) type (2.openxc.VehicleMessage.Type' @@ -32,7 +32,7 @@ message_id (  DIAGNOSTIC"M CommandResponse) type (2.openxc.ControlCommand.Type -message ( "ª +message ( "Ô DiagnosticRequest bus ( @@ -40,10 +40,13 @@ message_id (  mode (  pid (  payload (  - parse_payload ( -factor ( -offset ( - frequency ("¡ + parse_payload ( +multiple_responses ( +factor ( +offset ( + frequency + ( +name ( "¡ DiagnosticResponse bus ( diff --git a/gen/cpp/openxc.pb.c b/gen/cpp/openxc.pb.c index b4cace32..25ed2bbf 100644 --- a/gen/cpp/openxc.pb.c +++ b/gen/cpp/openxc.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.2.5 at Thu Mar 6 16:21:37 2014. */ +/* Generated by nanopb-0.2.5 at Sat Mar 15 12:44:03 2014. */ #include "openxc.pb.h" @@ -34,16 +34,18 @@ const pb_field_t openxc_CommandResponse_fields[3] = { PB_LAST_FIELD }; -const pb_field_t openxc_DiagnosticRequest_fields[10] = { +const pb_field_t openxc_DiagnosticRequest_fields[12] = { PB_FIELD2( 1, INT32 , OPTIONAL, STATIC , FIRST, openxc_DiagnosticRequest, bus, bus, 0), PB_FIELD2( 2, UINT32 , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, message_id, bus, 0), PB_FIELD2( 3, UINT32 , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, mode, message_id, 0), PB_FIELD2( 4, UINT32 , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, pid, mode, 0), PB_FIELD2( 5, BYTES , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, payload, pid, 0), PB_FIELD2( 6, BOOL , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, parse_payload, payload, 0), - PB_FIELD2( 7, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, factor, parse_payload, 0), - PB_FIELD2( 8, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, offset, factor, 0), - PB_FIELD2( 9, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, frequency, offset, 0), + PB_FIELD2( 7, BOOL , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, multiple_responses, parse_payload, 0), + PB_FIELD2( 8, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, factor, multiple_responses, 0), + PB_FIELD2( 9, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, offset, factor, 0), + PB_FIELD2( 10, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, frequency, offset, 0), + PB_FIELD2( 11, STRING , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, name, frequency, 0), PB_LAST_FIELD }; diff --git a/gen/cpp/openxc.pb.h b/gen/cpp/openxc.pb.h index 5db13577..267f785c 100644 --- a/gen/cpp/openxc.pb.h +++ b/gen/cpp/openxc.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.2.5 at Thu Mar 6 16:21:37 2014. */ +/* Generated by nanopb-0.2.5 at Sat Mar 15 12:44:03 2014. */ #ifndef _PB_OPENXC_PB_H_ #define _PB_OPENXC_PB_H_ @@ -65,12 +65,16 @@ typedef struct _openxc_DiagnosticRequest { openxc_DiagnosticRequest_payload_t payload; bool has_parse_payload; bool parse_payload; + bool has_multiple_responses; + bool multiple_responses; bool has_factor; double factor; bool has_offset; double offset; bool has_frequency; double frequency; + bool has_name; + char name[10]; } openxc_DiagnosticRequest; typedef struct { @@ -166,9 +170,11 @@ typedef struct _openxc_VehicleMessage { #define openxc_DiagnosticRequest_pid_tag 4 #define openxc_DiagnosticRequest_payload_tag 5 #define openxc_DiagnosticRequest_parse_payload_tag 6 -#define openxc_DiagnosticRequest_factor_tag 7 -#define openxc_DiagnosticRequest_offset_tag 8 -#define openxc_DiagnosticRequest_frequency_tag 9 +#define openxc_DiagnosticRequest_multiple_responses_tag 7 +#define openxc_DiagnosticRequest_factor_tag 8 +#define openxc_DiagnosticRequest_offset_tag 9 +#define openxc_DiagnosticRequest_frequency_tag 10 +#define openxc_DiagnosticRequest_name_tag 11 #define openxc_DiagnosticResponse_bus_tag 1 #define openxc_DiagnosticResponse_message_id_tag 2 #define openxc_DiagnosticResponse_mode_tag 3 @@ -202,17 +208,17 @@ extern const pb_field_t openxc_VehicleMessage_fields[7]; extern const pb_field_t openxc_RawMessage_fields[4]; extern const pb_field_t openxc_ControlCommand_fields[3]; extern const pb_field_t openxc_CommandResponse_fields[3]; -extern const pb_field_t openxc_DiagnosticRequest_fields[10]; +extern const pb_field_t openxc_DiagnosticRequest_fields[12]; extern const pb_field_t openxc_DiagnosticResponse_fields[9]; extern const pb_field_t openxc_DynamicField_fields[5]; extern const pb_field_t openxc_TranslatedMessage_fields[5]; /* Maximum encoded size of messages (where known) */ -#define openxc_VehicleMessage_size 664 +#define openxc_VehicleMessage_size 678 #define openxc_RawMessage_size 27 -#define openxc_ControlCommand_size 76 +#define openxc_ControlCommand_size 90 #define openxc_CommandResponse_size 137 -#define openxc_DiagnosticRequest_size 68 +#define openxc_DiagnosticRequest_size 82 #define openxc_DiagnosticResponse_size 56 #define openxc_DynamicField_size 119 #define openxc_TranslatedMessage_size 350 diff --git a/gen/java/com/openxc/BinaryMessages.java b/gen/java/com/openxc/BinaryMessages.java index 922b8c5e..00f1fe09 100644 --- a/gen/java/com/openxc/BinaryMessages.java +++ b/gen/java/com/openxc/BinaryMessages.java @@ -3365,35 +3365,60 @@ public final class BinaryMessages { */ boolean getParsePayload(); - // optional double factor = 7; + // optional bool multiple_responses = 7; /** - * optional double factor = 7; + * optional bool multiple_responses = 7; + */ + boolean hasMultipleResponses(); + /** + * optional bool multiple_responses = 7; + */ + boolean getMultipleResponses(); + + // optional double factor = 8; + /** + * optional double factor = 8; */ boolean hasFactor(); /** - * optional double factor = 7; + * optional double factor = 8; */ double getFactor(); - // optional double offset = 8; + // optional double offset = 9; /** - * optional double offset = 8; + * optional double offset = 9; */ boolean hasOffset(); /** - * optional double offset = 8; + * optional double offset = 9; */ double getOffset(); - // optional double frequency = 9; + // optional double frequency = 10; /** - * optional double frequency = 9; + * optional double frequency = 10; */ boolean hasFrequency(); /** - * optional double frequency = 9; + * optional double frequency = 10; */ double getFrequency(); + + // optional string name = 11; + /** + * optional string name = 11; + */ + boolean hasName(); + /** + * optional string name = 11; + */ + java.lang.String getName(); + /** + * optional string name = 11; + */ + com.google.protobuf.ByteString + getNameBytes(); } /** * Protobuf type {@code openxc.DiagnosticRequest} @@ -3476,21 +3501,31 @@ public final class BinaryMessages { parsePayload_ = input.readBool(); break; } - case 57: { + case 56: { bitField0_ |= 0x00000040; - factor_ = input.readDouble(); + multipleResponses_ = input.readBool(); break; } case 65: { bitField0_ |= 0x00000080; - offset_ = input.readDouble(); + factor_ = input.readDouble(); break; } case 73: { bitField0_ |= 0x00000100; + offset_ = input.readDouble(); + break; + } + case 81: { + bitField0_ |= 0x00000200; frequency_ = input.readDouble(); break; } + case 90: { + bitField0_ |= 0x00000400; + name_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -3637,54 +3672,113 @@ public final class BinaryMessages { return parsePayload_; } - // optional double factor = 7; - public static final int FACTOR_FIELD_NUMBER = 7; + // optional bool multiple_responses = 7; + public static final int MULTIPLE_RESPONSES_FIELD_NUMBER = 7; + private boolean multipleResponses_; + /** + * optional bool multiple_responses = 7; + */ + public boolean hasMultipleResponses() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional bool multiple_responses = 7; + */ + public boolean getMultipleResponses() { + return multipleResponses_; + } + + // optional double factor = 8; + public static final int FACTOR_FIELD_NUMBER = 8; private double factor_; /** - * optional double factor = 7; + * optional double factor = 8; */ public boolean hasFactor() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000080) == 0x00000080); } /** - * optional double factor = 7; + * optional double factor = 8; */ public double getFactor() { return factor_; } - // optional double offset = 8; - public static final int OFFSET_FIELD_NUMBER = 8; + // optional double offset = 9; + public static final int OFFSET_FIELD_NUMBER = 9; private double offset_; /** - * optional double offset = 8; + * optional double offset = 9; */ public boolean hasOffset() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000100) == 0x00000100); } /** - * optional double offset = 8; + * optional double offset = 9; */ public double getOffset() { return offset_; } - // optional double frequency = 9; - public static final int FREQUENCY_FIELD_NUMBER = 9; + // optional double frequency = 10; + public static final int FREQUENCY_FIELD_NUMBER = 10; private double frequency_; /** - * optional double frequency = 9; + * optional double frequency = 10; */ public boolean hasFrequency() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000200) == 0x00000200); } /** - * optional double frequency = 9; + * optional double frequency = 10; */ public double getFrequency() { return frequency_; } + // optional string name = 11; + public static final int NAME_FIELD_NUMBER = 11; + private java.lang.Object name_; + /** + * optional string name = 11; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000400) == 0x00000400); + } + /** + * optional string name = 11; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + name_ = s; + } + return s; + } + } + /** + * optional string name = 11; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { bus_ = 0; messageId_ = 0; @@ -3692,9 +3786,11 @@ public final class BinaryMessages { pid_ = 0; payload_ = com.google.protobuf.ByteString.EMPTY; parsePayload_ = false; + multipleResponses_ = false; factor_ = 0D; offset_ = 0D; frequency_ = 0D; + name_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -3727,13 +3823,19 @@ public final class BinaryMessages { output.writeBool(6, parsePayload_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeDouble(7, factor_); + output.writeBool(7, multipleResponses_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeDouble(8, offset_); + output.writeDouble(8, factor_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { - output.writeDouble(9, frequency_); + output.writeDouble(9, offset_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + output.writeDouble(10, frequency_); + } + if (((bitField0_ & 0x00000400) == 0x00000400)) { + output.writeBytes(11, getNameBytes()); } getUnknownFields().writeTo(output); } @@ -3770,15 +3872,23 @@ public final class BinaryMessages { } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(7, factor_); + .computeBoolSize(7, multipleResponses_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(8, offset_); + .computeDoubleSize(8, factor_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream - .computeDoubleSize(9, frequency_); + .computeDoubleSize(9, offset_); + } + if (((bitField0_ & 0x00000200) == 0x00000200)) { + size += com.google.protobuf.CodedOutputStream + .computeDoubleSize(10, frequency_); + } + if (((bitField0_ & 0x00000400) == 0x00000400)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(11, getNameBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -3908,12 +4018,16 @@ public final class BinaryMessages { bitField0_ = (bitField0_ & ~0x00000010); parsePayload_ = false; bitField0_ = (bitField0_ & ~0x00000020); - factor_ = 0D; + multipleResponses_ = false; bitField0_ = (bitField0_ & ~0x00000040); - offset_ = 0D; + factor_ = 0D; bitField0_ = (bitField0_ & ~0x00000080); - frequency_ = 0D; + offset_ = 0D; bitField0_ = (bitField0_ & ~0x00000100); + frequency_ = 0D; + bitField0_ = (bitField0_ & ~0x00000200); + name_ = ""; + bitField0_ = (bitField0_ & ~0x00000400); return this; } @@ -3969,15 +4083,23 @@ public final class BinaryMessages { if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } - result.factor_ = factor_; + result.multipleResponses_ = multipleResponses_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } - result.offset_ = offset_; + result.factor_ = factor_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } + result.offset_ = offset_; + if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + to_bitField0_ |= 0x00000200; + } result.frequency_ = frequency_; + if (((from_bitField0_ & 0x00000400) == 0x00000400)) { + to_bitField0_ |= 0x00000400; + } + result.name_ = name_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -4012,6 +4134,9 @@ public final class BinaryMessages { if (other.hasParsePayload()) { setParsePayload(other.getParsePayload()); } + if (other.hasMultipleResponses()) { + setMultipleResponses(other.getMultipleResponses()); + } if (other.hasFactor()) { setFactor(other.getFactor()); } @@ -4021,6 +4146,11 @@ public final class BinaryMessages { if (other.hasFrequency()) { setFrequency(other.getFrequency()); } + if (other.hasName()) { + bitField0_ |= 0x00000400; + name_ = other.name_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -4269,105 +4399,212 @@ public final class BinaryMessages { return this; } - // optional double factor = 7; + // optional bool multiple_responses = 7; + private boolean multipleResponses_ ; + /** + * optional bool multiple_responses = 7; + */ + public boolean hasMultipleResponses() { + return ((bitField0_ & 0x00000040) == 0x00000040); + } + /** + * optional bool multiple_responses = 7; + */ + public boolean getMultipleResponses() { + return multipleResponses_; + } + /** + * optional bool multiple_responses = 7; + */ + public Builder setMultipleResponses(boolean value) { + bitField0_ |= 0x00000040; + multipleResponses_ = value; + onChanged(); + return this; + } + /** + * optional bool multiple_responses = 7; + */ + public Builder clearMultipleResponses() { + bitField0_ = (bitField0_ & ~0x00000040); + multipleResponses_ = false; + onChanged(); + return this; + } + + // optional double factor = 8; private double factor_ ; /** - * optional double factor = 7; + * optional double factor = 8; */ public boolean hasFactor() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000080) == 0x00000080); } /** - * optional double factor = 7; + * optional double factor = 8; */ public double getFactor() { return factor_; } /** - * optional double factor = 7; + * optional double factor = 8; */ public Builder setFactor(double value) { - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000080; factor_ = value; onChanged(); return this; } /** - * optional double factor = 7; + * optional double factor = 8; */ public Builder clearFactor() { - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000080); factor_ = 0D; onChanged(); return this; } - // optional double offset = 8; + // optional double offset = 9; private double offset_ ; /** - * optional double offset = 8; + * optional double offset = 9; */ public boolean hasOffset() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000100) == 0x00000100); } /** - * optional double offset = 8; + * optional double offset = 9; */ public double getOffset() { return offset_; } /** - * optional double offset = 8; + * optional double offset = 9; */ public Builder setOffset(double value) { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; offset_ = value; onChanged(); return this; } /** - * optional double offset = 8; + * optional double offset = 9; */ public Builder clearOffset() { - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000100); offset_ = 0D; onChanged(); return this; } - // optional double frequency = 9; + // optional double frequency = 10; private double frequency_ ; /** - * optional double frequency = 9; + * optional double frequency = 10; */ public boolean hasFrequency() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000200) == 0x00000200); } /** - * optional double frequency = 9; + * optional double frequency = 10; */ public double getFrequency() { return frequency_; } /** - * optional double frequency = 9; + * optional double frequency = 10; */ public Builder setFrequency(double value) { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; frequency_ = value; onChanged(); return this; } /** - * optional double frequency = 9; + * optional double frequency = 10; */ public Builder clearFrequency() { - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000200); frequency_ = 0D; onChanged(); return this; } + // optional string name = 11; + private java.lang.Object name_ = ""; + /** + * optional string name = 11; + */ + public boolean hasName() { + return ((bitField0_ & 0x00000400) == 0x00000400); + } + /** + * optional string name = 11; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string name = 11; + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string name = 11; + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000400; + name_ = value; + onChanged(); + return this; + } + /** + * optional string name = 11; + */ + public Builder clearName() { + bitField0_ = (bitField0_ & ~0x00000400); + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * optional string name = 11; + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000400; + name_ = value; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:openxc.DiagnosticRequest) } @@ -7329,26 +7566,28 @@ public final class BinaryMessages { "Request\"2\n\004Type\022\013\n\007VERSION\020\001\022\r\n\tDEVICE_I" + "D\020\002\022\016\n\nDIAGNOSTIC\020\003\"M\n\017CommandResponse\022)" + "\n\004type\030\001 \001(\0162\033.openxc.ControlCommand.Typ" + - "e\022\017\n\007message\030\002 \001(\t\"\252\001\n\021DiagnosticRequest" + + "e\022\017\n\007message\030\002 \001(\t\"\324\001\n\021DiagnosticRequest" + "\022\013\n\003bus\030\001 \001(\005\022\022\n\nmessage_id\030\002 \001(\r\022\014\n\004mod", "e\030\003 \001(\r\022\013\n\003pid\030\004 \001(\r\022\017\n\007payload\030\005 \001(\014\022\025\n" + - "\rparse_payload\030\006 \001(\010\022\016\n\006factor\030\007 \001(\001\022\016\n\006" + - "offset\030\010 \001(\001\022\021\n\tfrequency\030\t \001(\001\"\241\001\n\022Diag" + - "nosticResponse\022\013\n\003bus\030\001 \001(\005\022\022\n\nmessage_i" + - "d\030\002 \001(\r\022\014\n\004mode\030\003 \001(\r\022\013\n\003pid\030\004 \001(\r\022\017\n\007su" + - "ccess\030\005 \001(\010\022\036\n\026negative_response_code\030\006 " + - "\001(\r\022\017\n\007payload\030\007 \001(\014\022\r\n\005value\030\010 \001(\001\"\242\001\n\014" + - "DynamicField\022\'\n\004type\030\001 \001(\0162\031.openxc.Dyna" + - "micField.Type\022\024\n\014string_value\030\002 \001(\t\022\025\n\rn" + - "umeric_value\030\003 \001(\001\022\025\n\rboolean_value\030\004 \001(", - "\010\"%\n\004Type\022\n\n\006STRING\020\001\022\007\n\003NUM\020\002\022\010\n\004BOOL\020\003" + - "\"\367\001\n\021TranslatedMessage\022,\n\004type\030\001 \001(\0162\036.o" + - "penxc.TranslatedMessage.Type\022\014\n\004name\030\002 \001" + - "(\t\022#\n\005value\030\003 \001(\0132\024.openxc.DynamicField\022" + - "#\n\005event\030\004 \001(\0132\024.openxc.DynamicField\"\\\n\004" + - "Type\022\n\n\006STRING\020\001\022\007\n\003NUM\020\002\022\010\n\004BOOL\020\003\022\022\n\016E" + - "VENTED_STRING\020\004\022\017\n\013EVENTED_NUM\020\005\022\020\n\014EVEN" + - "TED_BOOL\020\006B\034\n\ncom.openxcB\016BinaryMessages" + "\rparse_payload\030\006 \001(\010\022\032\n\022multiple_respons" + + "es\030\007 \001(\010\022\016\n\006factor\030\010 \001(\001\022\016\n\006offset\030\t \001(\001" + + "\022\021\n\tfrequency\030\n \001(\001\022\014\n\004name\030\013 \001(\t\"\241\001\n\022Di" + + "agnosticResponse\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\007" + + "success\030\005 \001(\010\022\036\n\026negative_response_code\030" + + "\006 \001(\r\022\017\n\007payload\030\007 \001(\014\022\r\n\005value\030\010 \001(\001\"\242\001" + + "\n\014DynamicField\022\'\n\004type\030\001 \001(\0162\031.openxc.Dy" + + "namicField.Type\022\024\n\014string_value\030\002 \001(\t\022\025\n", + "\rnumeric_value\030\003 \001(\001\022\025\n\rboolean_value\030\004 " + + "\001(\010\"%\n\004Type\022\n\n\006STRING\020\001\022\007\n\003NUM\020\002\022\010\n\004BOOL" + + "\020\003\"\367\001\n\021TranslatedMessage\022,\n\004type\030\001 \001(\0162\036" + + ".openxc.TranslatedMessage.Type\022\014\n\004name\030\002" + + " \001(\t\022#\n\005value\030\003 \001(\0132\024.openxc.DynamicFiel" + + "d\022#\n\005event\030\004 \001(\0132\024.openxc.DynamicField\"\\" + + "\n\004Type\022\n\n\006STRING\020\001\022\007\n\003NUM\020\002\022\010\n\004BOOL\020\003\022\022\n" + + "\016EVENTED_STRING\020\004\022\017\n\013EVENTED_NUM\020\005\022\020\n\014EV" + + "ENTED_BOOL\020\006B\034\n\ncom.openxcB\016BinaryMessag" + + "es" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -7384,7 +7623,7 @@ public final class BinaryMessages { internal_static_openxc_DiagnosticRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_openxc_DiagnosticRequest_descriptor, - new java.lang.String[] { "Bus", "MessageId", "Mode", "Pid", "Payload", "ParsePayload", "Factor", "Offset", "Frequency", }); + new java.lang.String[] { "Bus", "MessageId", "Mode", "Pid", "Payload", "ParsePayload", "MultipleResponses", "Factor", "Offset", "Frequency", "Name", }); internal_static_openxc_DiagnosticResponse_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_openxc_DiagnosticResponse_fieldAccessorTable = new diff --git a/gen/python/openxc_pb2.py b/gen/python/openxc_pb2.py index 15efe4a5..7432b21e 100644 --- a/gen/python/openxc_pb2.py +++ b/gen/python/openxc_pb2.py @@ -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\"\x94\x03\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\x37\n\x13\x64iagnostic_response\x18\x04 \x01(\x0b\x32\x1a.openxc.DiagnosticResponse\x12/\n\x0f\x63ontrol_command\x18\x05 \x01(\x0b\x32\x16.openxc.ControlCommand\x12\x31\n\x10\x63ommand_response\x18\x06 \x01(\x0b\x32\x17.openxc.CommandResponse\"Z\n\x04Type\x12\x07\n\x03RAW\x10\x01\x12\x0e\n\nTRANSLATED\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\x12\x13\n\x0f\x43ONTROL_COMMAND\x10\x04\x12\x14\n\x10\x43OMMAND_RESPONSE\x10\x05\";\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\"\xa6\x01\n\x0e\x43ontrolCommand\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.ControlCommand.Type\x12\x35\n\x12\x64iagnostic_request\x18\x02 \x01(\x0b\x32\x19.openxc.DiagnosticRequest\"2\n\x04Type\x12\x0b\n\x07VERSION\x10\x01\x12\r\n\tDEVICE_ID\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\"M\n\x0f\x43ommandResponse\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.ControlCommand.Type\x12\x0f\n\x07message\x18\x02 \x01(\t\"\xaa\x01\n\x11\x44iagnosticRequest\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\x07payload\x18\x05 \x01(\x0c\x12\x15\n\rparse_payload\x18\x06 \x01(\x08\x12\x0e\n\x06\x66\x61\x63tor\x18\x07 \x01(\x01\x12\x0e\n\x06offset\x18\x08 \x01(\x01\x12\x11\n\tfrequency\x18\t \x01(\x01\"\xa1\x01\n\x12\x44iagnosticResponse\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\x12\r\n\x05value\x18\x08 \x01(\x01\"\xa2\x01\n\x0c\x44ynamicField\x12\'\n\x04type\x18\x01 \x01(\x0e\x32\x19.openxc.DynamicField.Type\x12\x14\n\x0cstring_value\x18\x02 \x01(\t\x12\x15\n\rnumeric_value\x18\x03 \x01(\x01\x12\x15\n\rboolean_value\x18\x04 \x01(\x08\"%\n\x04Type\x12\n\n\x06STRING\x10\x01\x12\x07\n\x03NUM\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\"\xf7\x01\n\x11TranslatedMessage\x12,\n\x04type\x18\x01 \x01(\x0e\x32\x1e.openxc.TranslatedMessage.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12#\n\x05value\x18\x03 \x01(\x0b\x32\x14.openxc.DynamicField\x12#\n\x05\x65vent\x18\x04 \x01(\x0b\x32\x14.openxc.DynamicField\"\\\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\"\x94\x03\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\x37\n\x13\x64iagnostic_response\x18\x04 \x01(\x0b\x32\x1a.openxc.DiagnosticResponse\x12/\n\x0f\x63ontrol_command\x18\x05 \x01(\x0b\x32\x16.openxc.ControlCommand\x12\x31\n\x10\x63ommand_response\x18\x06 \x01(\x0b\x32\x17.openxc.CommandResponse\"Z\n\x04Type\x12\x07\n\x03RAW\x10\x01\x12\x0e\n\nTRANSLATED\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\x12\x13\n\x0f\x43ONTROL_COMMAND\x10\x04\x12\x14\n\x10\x43OMMAND_RESPONSE\x10\x05\";\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\"\xa6\x01\n\x0e\x43ontrolCommand\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.ControlCommand.Type\x12\x35\n\x12\x64iagnostic_request\x18\x02 \x01(\x0b\x32\x19.openxc.DiagnosticRequest\"2\n\x04Type\x12\x0b\n\x07VERSION\x10\x01\x12\r\n\tDEVICE_ID\x10\x02\x12\x0e\n\nDIAGNOSTIC\x10\x03\"M\n\x0f\x43ommandResponse\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.openxc.ControlCommand.Type\x12\x0f\n\x07message\x18\x02 \x01(\t\"\xd4\x01\n\x11\x44iagnosticRequest\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\x07payload\x18\x05 \x01(\x0c\x12\x15\n\rparse_payload\x18\x06 \x01(\x08\x12\x1a\n\x12multiple_responses\x18\x07 \x01(\x08\x12\x0e\n\x06\x66\x61\x63tor\x18\x08 \x01(\x01\x12\x0e\n\x06offset\x18\t \x01(\x01\x12\x11\n\tfrequency\x18\n \x01(\x01\x12\x0c\n\x04name\x18\x0b \x01(\t\"\xa1\x01\n\x12\x44iagnosticResponse\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\x12\r\n\x05value\x18\x08 \x01(\x01\"\xa2\x01\n\x0c\x44ynamicField\x12\'\n\x04type\x18\x01 \x01(\x0e\x32\x19.openxc.DynamicField.Type\x12\x14\n\x0cstring_value\x18\x02 \x01(\t\x12\x15\n\rnumeric_value\x18\x03 \x01(\x01\x12\x15\n\rboolean_value\x18\x04 \x01(\x08\"%\n\x04Type\x12\n\n\x06STRING\x10\x01\x12\x07\n\x03NUM\x10\x02\x12\x08\n\x04\x42OOL\x10\x03\"\xf7\x01\n\x11TranslatedMessage\x12,\n\x04type\x18\x01 \x01(\x0e\x32\x1e.openxc.TranslatedMessage.Type\x12\x0c\n\x04name\x18\x02 \x01(\t\x12#\n\x05value\x18\x03 \x01(\x0b\x32\x14.openxc.DynamicField\x12#\n\x05\x65vent\x18\x04 \x01(\x0b\x32\x14.openxc.DynamicField\"\\\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') @@ -96,8 +96,8 @@ _DYNAMICFIELD_TYPE = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=1203, - serialized_end=1240, + serialized_start=1245, + serialized_end=1282, ) _TRANSLATEDMESSAGE_TYPE = _descriptor.EnumDescriptor( @@ -133,8 +133,8 @@ _TRANSLATEDMESSAGE_TYPE = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=1398, - serialized_end=1490, + serialized_start=1440, + serialized_end=1532, ) @@ -365,26 +365,40 @@ _DIAGNOSTICREQUEST = _descriptor.Descriptor( is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='factor', full_name='openxc.DiagnosticRequest.factor', index=6, - number=7, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=0, + name='multiple_responses', full_name='openxc.DiagnosticRequest.multiple_responses', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='offset', full_name='openxc.DiagnosticRequest.offset', index=7, + name='factor', full_name='openxc.DiagnosticRequest.factor', index=7, number=8, type=1, cpp_type=5, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='frequency', full_name='openxc.DiagnosticRequest.frequency', index=8, + name='offset', full_name='openxc.DiagnosticRequest.offset', index=8, number=9, type=1, cpp_type=5, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='frequency', full_name='openxc.DiagnosticRequest.frequency', index=9, + number=10, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='openxc.DiagnosticRequest.name', index=10, + number=11, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=unicode("", "utf-8"), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -395,7 +409,7 @@ _DIAGNOSTICREQUEST = _descriptor.Descriptor( is_extendable=False, extension_ranges=[], serialized_start=741, - serialized_end=911, + serialized_end=953, ) @@ -471,8 +485,8 @@ _DIAGNOSTICRESPONSE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=914, - serialized_end=1075, + serialized_start=956, + serialized_end=1117, ) @@ -521,8 +535,8 @@ _DYNAMICFIELD = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=1078, - serialized_end=1240, + serialized_start=1120, + serialized_end=1282, ) @@ -571,8 +585,8 @@ _TRANSLATEDMESSAGE = _descriptor.Descriptor( options=None, is_extendable=False, extension_ranges=[], - serialized_start=1243, - serialized_end=1490, + serialized_start=1285, + serialized_end=1532, ) _VEHICLEMESSAGE.fields_by_name['type'].enum_type = _VEHICLEMESSAGE_TYPE diff --git a/openxc.options b/openxc.options index fb9be627..80d0f9b0 100644 --- a/openxc.options +++ b/openxc.options @@ -2,5 +2,6 @@ openxc.TranslatedMessage.name max_size:100 openxc.DynamicField.string_value max_size:100 openxc.CommandResponse.message max_size:128 openxc.DiagnosticResponse.payload max_size:8 +openxc.DiagnosticRequest.name max_size:10 openxc.DiagnosticRequest.payload max_size:8 openxc.RawMessage.data max_size:8 diff --git a/openxc.proto b/openxc.proto index b7a1b22d..2deaf3bc 100644 --- a/openxc.proto +++ b/openxc.proto @@ -42,9 +42,11 @@ message DiagnosticRequest { // support multi-frame responses optional bytes payload = 5; optional bool parse_payload = 6; - optional double factor = 7; - optional double offset = 8; - optional double frequency = 9; + optional bool multiple_responses = 7; + optional double factor = 8; + optional double offset = 9; + optional double frequency = 10; + optional string name = 11; } message DiagnosticResponse { -- 2.16.6