aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2014-08-04 22:04:57 -0400
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-08-04 23:16:02 -0400
commitaa4a2cd92afecf5ce6e3faba441d3b8758b5c372 (patch)
tree70fbde118b4abb5d589a934f68610471713f6780
parent570048644e960862858dfd984c34f55f6b63144f (diff)
Require an 'action' in diagnostic requests.
It wasn't very clean to try and infer a delete/create/update based on the value of the frequency field - this will require a little more code, but as they say in Python, explicit is better than implicit. Fixed https://github.com/openxc/openxc-message-format/issues/12
-rw-r--r--README.md118
-rw-r--r--gen/cpp/openxc.pb17
-rw-r--r--gen/cpp/openxc.pb.c5
-rw-r--r--gen/cpp/openxc.pb.h19
-rw-r--r--gen/java/com/openxc/BinaryMessages.java223
-rw-r--r--gen/python/openxc_pb2.py63
-rw-r--r--openxc.proto2
7 files changed, 372 insertions, 75 deletions
diff --git a/README.md b/README.md
index 3e169709..ca401363 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,8 @@ field. The value may be any valid JSON object or array. The client libraries
will do their best to parse this information into a generic format and pass it
to your application. For example:
- {"name": "steering_wheel_angle", "value": 45,
+ {"name": "steering_wheel_angle",
+ "value": 45,
"extras": {
"calibrated": false
}
@@ -79,10 +80,11 @@ The format for a raw CAN message:
#### Requests
-A request to add or update a diagnostic request is sent to a vehicle interface
-with this command format:
+A diagnostic request is created, update and deleted with a JSON object like this
+example:
{ "command": "diagnostic_request",
+ "action": "create",
"request": {
"bus": 1,
"id": 1234,
@@ -96,6 +98,83 @@ with this command format:
}
}
+* The `command` must be `diagnostic_request.`
+* The `action` must be included, and must be one of:
+ * `create` - create a new one-off or recurring diagnostic request.
+ * `update` - update an existing request.
+ * `delete` - delete an existing request.
+* The details of the request must be included in the `request` field, using
+ the sub-fields defined below.
+
+A diagnostic request's `bus`, `id`, `mode` and `pid` (or lack of a `pid`)
+combine to create a unique key to identify a request. These four fields will be
+referred to as the key of the diagnostic request. For example, to create a
+simple one-time diagnostic request:
+
+ { "command": "diagnostic_request",
+ "action": "create",
+ "request": {
+ "bus": 1,
+ "id": 1234,
+ "mode": 1,
+ "pid": 5
+ }
+ }
+ }
+
+Requests are completed after any responses are received (unless
+`multiple_responses` is set), or the request has timed out after a certain
+number of seconds. After a request is completed, you can re-`create` the same
+key to make another request.
+
+Requests with a `frequency` are added as *recurring* requests, e.g. to add the
+previous example as a recurring request at 1Hz:
+
+ { "command": "diagnostic_request",
+ "action": "create",
+ "request": {
+ "bus": 1,
+ "id": 1234,
+ "mode": 1,
+ "pid": 5,
+ "frequency": 1
+ }
+ }
+ }
+
+To cancel a recurring request, send a `cancel` action with the same key, e.g.:
+
+ { "command": "diagnostic_request",
+ "action": "delete",
+ "request": {
+ "bus": 1,
+ "id": 1234,
+ "mode": 1,
+ "pid": 5
+ }
+ }
+ }
+
+To update one of the fields of a recurring request, send an `update` action with
+the same key, plus the field to update. For example, to change the frequency of
+the example request to 2Hz:
+
+ { "command": "diagnostic_request",
+ "action": "update",
+ "request": {
+ "bus": 1,
+ "id": 1234,
+ "mode": 1,
+ "pid": 5,
+ "frequency": 2
+ }
+ }
+ }
+
+Simultaneous recurring requests for the same key at different rates (e.g. 1Hz
+*and* 2Hz) is not supported. However, non-recurring ("one-off") requests may
+exist in parallel with a recurring request for the same key.
+
**bus** - the numerical identifier of the CAN bus where this request should be
sent, most likely 1 or 2 (for a vehicle interface with 2 CAN controllers).
@@ -107,7 +186,7 @@ with this command format:
**pid** - (optional) the PID for the request, if applicable.
**payload** - (optional) up to 7 bytes of data for the request's payload
- represented as a hexidecimal number in a string. Many JSON parser cannot
+ represented as a hexadecimal number in a string. Many JSON parser cannot
handle 64-bit integers, which is why we are not using a numerical data type.
Each byte in the string *must* be represented with 2 characters, e.g. `0x1`
is `0x01` - the complete string must have an even number of characters.
@@ -125,9 +204,8 @@ with this command format:
see any additional responses after the first and it will just take up memory
in the VI for longer.
-**frequency** - (optional, defaults to 0) The frequency in Hz to send this
- request. To send a single non-recurring request, set this to 0 or leave it
- out.
+**frequency** - (optional) Make this request a recurring request, at a this
+ frequency in Hz. To send a single non-recurring request, leave this field out.
**decoded_type** - (optional, defaults to "obd2" if the request is a recognized
OBD-II mode 1 request, otherwise "none") If specified, the valid values are
@@ -135,29 +213,6 @@ OBD-II mode 1 request, otherwise "none") If specified, the valid values are
OBD-II specification and returned in the `value` field. Set this to `none` to
manually override the OBD-II decoding feature for a known PID.
-A diagnostic request's `bus`, `id`, `mode` and `pid` (or lack of a `pid`)
-combine to create a unique key to identify a recurring request. This means that
-you cannot simultaneosly have recurring requests at 2Hz and 5Hz for the same PID
-from the same ID.
-
-If you send a new `diagnostic_request` command with a `bus + id + mode + pid`
-key matching an existing recurring request, it will update it with whatever
-other parameters you've provided (e.g. it will change the frequency if you
-specify one).
-
-To cancel a recurring request, send a `diagnostic_request` command with the
-matching request information (i.e. the `bus`, `id`, `mode` and `pid`) but a
-frequency of 0.
-
-Non-recurring requests may have the same `bus+id+mode(+pid)` key as a recurring
-request, and they will co-exist without issue. As soon as a non-recurring
-request is either completed or times out, it is removed from the active list.
-
-If you're just requesting a PID, you can use this minimal field set for the
-`request` object:
-
- {"bus": 1, "id": 1234, "mode": 1, "pid": 5}
-
#### Responses
The response to a successful request:
@@ -211,6 +266,9 @@ The response to a simple PID request would look like this:
### Commands
+In addition to the `diagnostic_request` command described earlier, there are
+other possible values for the `command` field.
+
#### Version Query
The `version` command triggers the VI to inject a firmware version identifier
diff --git a/gen/cpp/openxc.pb b/gen/cpp/openxc.pb
index da312337..282e5818 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 (
@@ -43,10 +43,19 @@ message_id ( 
multiple_responses (
frequency (
name ( ;
- decoded_type (2%.openxc.DiagnosticRequest.DecodedType"!
+ decoded_type (2%.openxc.DiagnosticRequest.DecodedType0
+action
+ (2 .openxc.DiagnosticRequest.Action"!
DecodedType
NONE
-OBD2"¡
+OBD2",
+Action
+
+CREATE
+
+UPDATE
+
+DELETE"¡
DiagnosticResponse
bus (
diff --git a/gen/cpp/openxc.pb.c b/gen/cpp/openxc.pb.c
index e3be2570..24f4b3c6 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 Wed Mar 26 09:29:06 2014. */
+/* Generated by nanopb-0.2.5 at Mon Aug 4 23:15:59 2014. */
#include "openxc.pb.h"
@@ -34,7 +34,7 @@ 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[11] = {
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),
@@ -44,6 +44,7 @@ const pb_field_t openxc_DiagnosticRequest_fields[10] = {
PB_FIELD2( 7, DOUBLE , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, frequency, multiple_responses, 0),
PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, name, frequency, 0),
PB_FIELD2( 9, ENUM , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, decoded_type, name, 0),
+ PB_FIELD2( 10, ENUM , OPTIONAL, STATIC , OTHER, openxc_DiagnosticRequest, action, decoded_type, 0),
PB_LAST_FIELD
};
diff --git a/gen/cpp/openxc.pb.h b/gen/cpp/openxc.pb.h
index e70324f0..d0c7da49 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 Wed Mar 26 09:29:06 2014. */
+/* Generated by nanopb-0.2.5 at Mon Aug 4 23:15:59 2014. */
#ifndef _PB_OPENXC_PB_H_
#define _PB_OPENXC_PB_H_
@@ -29,6 +29,12 @@ typedef enum _openxc_DiagnosticRequest_DecodedType {
openxc_DiagnosticRequest_DecodedType_OBD2 = 2
} openxc_DiagnosticRequest_DecodedType;
+typedef enum _openxc_DiagnosticRequest_Action {
+ openxc_DiagnosticRequest_Action_CREATE = 1,
+ openxc_DiagnosticRequest_Action_UPDATE = 2,
+ openxc_DiagnosticRequest_Action_DELETE = 3
+} openxc_DiagnosticRequest_Action;
+
typedef enum _openxc_DynamicField_Type {
openxc_DynamicField_Type_STRING = 1,
openxc_DynamicField_Type_NUM = 2,
@@ -76,6 +82,8 @@ typedef struct _openxc_DiagnosticRequest {
char name[10];
bool has_decoded_type;
openxc_DiagnosticRequest_DecodedType decoded_type;
+ bool has_action;
+ openxc_DiagnosticRequest_Action action;
} openxc_DiagnosticRequest;
typedef struct {
@@ -174,6 +182,7 @@ typedef struct _openxc_VehicleMessage {
#define openxc_DiagnosticRequest_frequency_tag 7
#define openxc_DiagnosticRequest_name_tag 8
#define openxc_DiagnosticRequest_decoded_type_tag 9
+#define openxc_DiagnosticRequest_action_tag 10
#define openxc_DiagnosticResponse_bus_tag 1
#define openxc_DiagnosticResponse_message_id_tag 2
#define openxc_DiagnosticResponse_mode_tag 3
@@ -207,17 +216,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[11];
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 670
#define openxc_RawMessage_size 27
-#define openxc_ControlCommand_size 76
+#define openxc_ControlCommand_size 82
#define openxc_CommandResponse_size 137
-#define openxc_DiagnosticRequest_size 68
+#define openxc_DiagnosticRequest_size 74
#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 777acd03..dbec8701 100644
--- a/gen/java/com/openxc/BinaryMessages.java
+++ b/gen/java/com/openxc/BinaryMessages.java
@@ -3399,6 +3399,16 @@ public final class BinaryMessages {
* <code>optional .openxc.DiagnosticRequest.DecodedType decoded_type = 9;</code>
*/
com.openxc.BinaryMessages.DiagnosticRequest.DecodedType getDecodedType();
+
+ // optional .openxc.DiagnosticRequest.Action action = 10;
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ boolean hasAction();
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ com.openxc.BinaryMessages.DiagnosticRequest.Action getAction();
}
/**
* Protobuf type {@code openxc.DiagnosticRequest}
@@ -3502,6 +3512,17 @@ public final class BinaryMessages {
}
break;
}
+ case 80: {
+ int rawValue = input.readEnum();
+ com.openxc.BinaryMessages.DiagnosticRequest.Action value = com.openxc.BinaryMessages.DiagnosticRequest.Action.valueOf(rawValue);
+ if (value == null) {
+ unknownFields.mergeVarintField(10, rawValue);
+ } else {
+ bitField0_ |= 0x00000200;
+ action_ = value;
+ }
+ break;
+ }
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -3623,6 +3644,97 @@ public final class BinaryMessages {
// @@protoc_insertion_point(enum_scope:openxc.DiagnosticRequest.DecodedType)
}
+ /**
+ * Protobuf enum {@code openxc.DiagnosticRequest.Action}
+ */
+ public enum Action
+ implements com.google.protobuf.ProtocolMessageEnum {
+ /**
+ * <code>CREATE = 1;</code>
+ */
+ CREATE(0, 1),
+ /**
+ * <code>UPDATE = 2;</code>
+ */
+ UPDATE(1, 2),
+ /**
+ * <code>DELETE = 3;</code>
+ */
+ DELETE(2, 3),
+ ;
+
+ /**
+ * <code>CREATE = 1;</code>
+ */
+ public static final int CREATE_VALUE = 1;
+ /**
+ * <code>UPDATE = 2;</code>
+ */
+ public static final int UPDATE_VALUE = 2;
+ /**
+ * <code>DELETE = 3;</code>
+ */
+ public static final int DELETE_VALUE = 3;
+
+
+ public final int getNumber() { return value; }
+
+ public static Action valueOf(int value) {
+ switch (value) {
+ case 1: return CREATE;
+ case 2: return UPDATE;
+ case 3: return DELETE;
+ default: return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap<Action>
+ internalGetValueMap() {
+ return internalValueMap;
+ }
+ private static com.google.protobuf.Internal.EnumLiteMap<Action>
+ internalValueMap =
+ new com.google.protobuf.Internal.EnumLiteMap<Action>() {
+ public Action findValueByNumber(int number) {
+ return Action.valueOf(number);
+ }
+ };
+
+ public final com.google.protobuf.Descriptors.EnumValueDescriptor
+ getValueDescriptor() {
+ return getDescriptor().getValues().get(index);
+ }
+ public final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptorForType() {
+ return getDescriptor();
+ }
+ public static final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptor() {
+ return com.openxc.BinaryMessages.DiagnosticRequest.getDescriptor().getEnumTypes().get(1);
+ }
+
+ private static final Action[] VALUES = values();
+
+ public static Action valueOf(
+ com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+ if (desc.getType() != getDescriptor()) {
+ throw new java.lang.IllegalArgumentException(
+ "EnumValueDescriptor is not for this type.");
+ }
+ return VALUES[desc.getIndex()];
+ }
+
+ private final int index;
+ private final int value;
+
+ private Action(int index, int value) {
+ this.index = index;
+ this.value = value;
+ }
+
+ // @@protoc_insertion_point(enum_scope:openxc.DiagnosticRequest.Action)
+ }
+
private int bitField0_;
// optional int32 bus = 1;
public static final int BUS_FIELD_NUMBER = 1;
@@ -3805,6 +3917,22 @@ public final class BinaryMessages {
return decodedType_;
}
+ // optional .openxc.DiagnosticRequest.Action action = 10;
+ public static final int ACTION_FIELD_NUMBER = 10;
+ private com.openxc.BinaryMessages.DiagnosticRequest.Action action_;
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public boolean hasAction() {
+ return ((bitField0_ & 0x00000200) == 0x00000200);
+ }
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public com.openxc.BinaryMessages.DiagnosticRequest.Action getAction() {
+ return action_;
+ }
+
private void initFields() {
bus_ = 0;
messageId_ = 0;
@@ -3815,6 +3943,7 @@ public final class BinaryMessages {
frequency_ = 0D;
name_ = "";
decodedType_ = com.openxc.BinaryMessages.DiagnosticRequest.DecodedType.NONE;
+ action_ = com.openxc.BinaryMessages.DiagnosticRequest.Action.CREATE;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -3855,6 +3984,9 @@ public final class BinaryMessages {
if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeEnum(9, decodedType_.getNumber());
}
+ if (((bitField0_ & 0x00000200) == 0x00000200)) {
+ output.writeEnum(10, action_.getNumber());
+ }
getUnknownFields().writeTo(output);
}
@@ -3900,6 +4032,10 @@ public final class BinaryMessages {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(9, decodedType_.getNumber());
}
+ if (((bitField0_ & 0x00000200) == 0x00000200)) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeEnumSize(10, action_.getNumber());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -4034,6 +4170,8 @@ public final class BinaryMessages {
bitField0_ = (bitField0_ & ~0x00000080);
decodedType_ = com.openxc.BinaryMessages.DiagnosticRequest.DecodedType.NONE;
bitField0_ = (bitField0_ & ~0x00000100);
+ action_ = com.openxc.BinaryMessages.DiagnosticRequest.Action.CREATE;
+ bitField0_ = (bitField0_ & ~0x00000200);
return this;
}
@@ -4098,6 +4236,10 @@ public final class BinaryMessages {
to_bitField0_ |= 0x00000100;
}
result.decodedType_ = decodedType_;
+ if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
+ to_bitField0_ |= 0x00000200;
+ }
+ result.action_ = action_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -4143,6 +4285,9 @@ public final class BinaryMessages {
if (other.hasDecodedType()) {
setDecodedType(other.getDecodedType());
}
+ if (other.hasAction()) {
+ setAction(other.getAction());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -4534,6 +4679,42 @@ public final class BinaryMessages {
return this;
}
+ // optional .openxc.DiagnosticRequest.Action action = 10;
+ private com.openxc.BinaryMessages.DiagnosticRequest.Action action_ = com.openxc.BinaryMessages.DiagnosticRequest.Action.CREATE;
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public boolean hasAction() {
+ return ((bitField0_ & 0x00000200) == 0x00000200);
+ }
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public com.openxc.BinaryMessages.DiagnosticRequest.Action getAction() {
+ return action_;
+ }
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public Builder setAction(com.openxc.BinaryMessages.DiagnosticRequest.Action value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000200;
+ action_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * <code>optional .openxc.DiagnosticRequest.Action action = 10;</code>
+ */
+ public Builder clearAction() {
+ bitField0_ = (bitField0_ & ~0x00000200);
+ action_ = com.openxc.BinaryMessages.DiagnosticRequest.Action.CREATE;
+ onChanged();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:openxc.DiagnosticRequest)
}
@@ -7495,29 +7676,31 @@ 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\"\375\001\n\021DiagnosticRequest" +
+ "e\022\017\n\007message\030\002 \001(\t\"\335\002\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\032\n" +
"\022multiple_responses\030\006 \001(\010\022\021\n\tfrequency\030\007" +
" \001(\001\022\014\n\004name\030\010 \001(\t\022;\n\014decoded_type\030\t \001(\016" +
- "2%.openxc.DiagnosticRequest.DecodedType\"" +
- "!\n\013DecodedType\022\010\n\004NONE\020\001\022\010\n\004OBD2\020\002\"\241\001\n\022D" +
- "iagnosticResponse\022\013\n\003bus\030\001 \001(\005\022\022\n\nmessag" +
- "e_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\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.D",
- "ynamicField.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\004BOO" +
- "L\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.DynamicFie" +
- "ld\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\014E" +
- "VENTED_BOOL\020\006B\034\n\ncom.openxcB\016BinaryMessa",
- "ges"
+ "2%.openxc.DiagnosticRequest.DecodedType\022" +
+ "0\n\006action\030\n \001(\0162 .openxc.DiagnosticReque" +
+ "st.Action\"!\n\013DecodedType\022\010\n\004NONE\020\001\022\010\n\004OB" +
+ "D2\020\002\",\n\006Action\022\n\n\006CREATE\020\001\022\n\n\006UPDATE\020\002\022\n" +
+ "\n\006DELETE\020\003\"\241\001\n\022DiagnosticResponse\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\026negati",
+ "ve_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.DynamicField.Type\022\024\n\014stri" +
+ "ng_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\021TranslatedMessag" +
+ "e\022,\n\004type\030\001 \001(\0162\036.openxc.TranslatedMessa" +
+ "ge.Type\022\014\n\004name\030\002 \001(\t\022#\n\005value\030\003 \001(\0132\024.o" +
+ "penxc.DynamicField\022#\n\005event\030\004 \001(\0132\024.open" +
+ "xc.DynamicField\"\\\n\004Type\022\n\n\006STRING\020\001\022\007\n\003N",
+ "UM\020\002\022\010\n\004BOOL\020\003\022\022\n\016EVENTED_STRING\020\004\022\017\n\013EV" +
+ "ENTED_NUM\020\005\022\020\n\014EVENTED_BOOL\020\006B\034\n\ncom.ope" +
+ "nxcB\016BinaryMessages"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -7553,7 +7736,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", "MultipleResponses", "Frequency", "Name", "DecodedType", });
+ new java.lang.String[] { "Bus", "MessageId", "Mode", "Pid", "Payload", "MultipleResponses", "Frequency", "Name", "DecodedType", "Action", });
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 f8312303..cf6e0145 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\"\xfd\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\x1a\n\x12multiple_responses\x18\x06 \x01(\x08\x12\x11\n\tfrequency\x18\x07 \x01(\x01\x12\x0c\n\x04name\x18\x08 \x01(\t\x12;\n\x0c\x64\x65\x63oded_type\x18\t \x01(\x0e\x32%.openxc.DiagnosticRequest.DecodedType\"!\n\x0b\x44\x65\x63odedType\x12\x08\n\x04NONE\x10\x01\x12\x08\n\x04OBD2\x10\x02\"\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\"\xdd\x02\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\x1a\n\x12multiple_responses\x18\x06 \x01(\x08\x12\x11\n\tfrequency\x18\x07 \x01(\x01\x12\x0c\n\x04name\x18\x08 \x01(\t\x12;\n\x0c\x64\x65\x63oded_type\x18\t \x01(\x0e\x32%.openxc.DiagnosticRequest.DecodedType\x12\x30\n\x06\x61\x63tion\x18\n \x01(\x0e\x32 .openxc.DiagnosticRequest.Action\"!\n\x0b\x44\x65\x63odedType\x12\x08\n\x04NONE\x10\x01\x12\x08\n\x04OBD2\x10\x02\",\n\x06\x41\x63tion\x12\n\n\x06\x43REATE\x10\x01\x12\n\n\x06UPDATE\x10\x02\x12\n\n\x06\x44\x45LETE\x10\x03\"\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')
@@ -92,8 +92,33 @@ _DIAGNOSTICREQUEST_DECODEDTYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
- serialized_start=961,
- serialized_end=994,
+ serialized_start=1011,
+ serialized_end=1044,
+)
+
+_DIAGNOSTICREQUEST_ACTION = _descriptor.EnumDescriptor(
+ name='Action',
+ full_name='openxc.DiagnosticRequest.Action',
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name='CREATE', index=0, number=1,
+ options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='UPDATE', index=1, number=2,
+ options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='DELETE', index=2, number=3,
+ options=None,
+ type=None),
+ ],
+ containing_type=None,
+ options=None,
+ serialized_start=1046,
+ serialized_end=1090,
)
_DYNAMICFIELD_TYPE = _descriptor.EnumDescriptor(
@@ -117,8 +142,8 @@ _DYNAMICFIELD_TYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
- serialized_start=1286,
- serialized_end=1323,
+ serialized_start=1382,
+ serialized_end=1419,
)
_TRANSLATEDMESSAGE_TYPE = _descriptor.EnumDescriptor(
@@ -154,8 +179,8 @@ _TRANSLATEDMESSAGE_TYPE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
- serialized_start=1481,
- serialized_end=1573,
+ serialized_start=1577,
+ serialized_end=1669,
)
@@ -406,18 +431,26 @@ _DIAGNOSTICREQUEST = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
+ _descriptor.FieldDescriptor(
+ name='action', full_name='openxc.DiagnosticRequest.action', index=9,
+ number=10, type=14, cpp_type=8, label=1,
+ has_default_value=False, default_value=1,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_DIAGNOSTICREQUEST_DECODEDTYPE,
+ _DIAGNOSTICREQUEST_ACTION,
],
options=None,
is_extendable=False,
extension_ranges=[],
serialized_start=741,
- serialized_end=994,
+ serialized_end=1090,
)
@@ -493,8 +526,8 @@ _DIAGNOSTICRESPONSE = _descriptor.Descriptor(
options=None,
is_extendable=False,
extension_ranges=[],
- serialized_start=997,
- serialized_end=1158,
+ serialized_start=1093,
+ serialized_end=1254,
)
@@ -543,8 +576,8 @@ _DYNAMICFIELD = _descriptor.Descriptor(
options=None,
is_extendable=False,
extension_ranges=[],
- serialized_start=1161,
- serialized_end=1323,
+ serialized_start=1257,
+ serialized_end=1419,
)
@@ -593,8 +626,8 @@ _TRANSLATEDMESSAGE = _descriptor.Descriptor(
options=None,
is_extendable=False,
extension_ranges=[],
- serialized_start=1326,
- serialized_end=1573,
+ serialized_start=1422,
+ serialized_end=1669,
)
_VEHICLEMESSAGE.fields_by_name['type'].enum_type = _VEHICLEMESSAGE_TYPE
@@ -609,7 +642,9 @@ _CONTROLCOMMAND.fields_by_name['diagnostic_request'].message_type = _DIAGNOSTICR
_CONTROLCOMMAND_TYPE.containing_type = _CONTROLCOMMAND;
_COMMANDRESPONSE.fields_by_name['type'].enum_type = _CONTROLCOMMAND_TYPE
_DIAGNOSTICREQUEST.fields_by_name['decoded_type'].enum_type = _DIAGNOSTICREQUEST_DECODEDTYPE
+_DIAGNOSTICREQUEST.fields_by_name['action'].enum_type = _DIAGNOSTICREQUEST_ACTION
_DIAGNOSTICREQUEST_DECODEDTYPE.containing_type = _DIAGNOSTICREQUEST;
+_DIAGNOSTICREQUEST_ACTION.containing_type = _DIAGNOSTICREQUEST;
_DYNAMICFIELD.fields_by_name['type'].enum_type = _DYNAMICFIELD_TYPE
_DYNAMICFIELD_TYPE.containing_type = _DYNAMICFIELD;
_TRANSLATEDMESSAGE.fields_by_name['type'].enum_type = _TRANSLATEDMESSAGE_TYPE
diff --git a/openxc.proto b/openxc.proto
index 5b7e78b4..aa7f7344 100644
--- a/openxc.proto
+++ b/openxc.proto
@@ -35,6 +35,7 @@ message CommandResponse {
message DiagnosticRequest {
enum DecodedType { NONE = 1; OBD2 = 2; }
+ enum Action { CREATE = 1; UPDATE = 2; DELETE = 3; }
optional int32 bus = 1;
optional uint32 message_id = 2;
@@ -47,6 +48,7 @@ message DiagnosticRequest {
optional double frequency = 7;
optional string name = 8;
optional DecodedType decoded_type = 9;
+ optional Action action = 10;
}
message DiagnosticResponse {