Move action field to ControlCommand in binary format.
[apps/agl-service-can-low-level.git] / openxc.proto
1 package openxc;
2
3 option java_package = "com.openxc";
4 option java_outer_classname = "BinaryMessages";
5
6 message VehicleMessage {
7     enum Type { RAW = 1; TRANSLATED = 2; DIAGNOSTIC = 3; CONTROL_COMMAND = 4;
8             COMMAND_RESPONSE = 5; }
9
10     optional Type type = 1;
11     optional RawMessage raw_message = 2;
12     optional TranslatedMessage translated_message = 3;
13     optional DiagnosticResponse diagnostic_response = 4;
14     optional ControlCommand control_command = 5;
15     optional CommandResponse command_response = 6;
16 }
17
18 message RawMessage {
19     optional int32 bus = 1;
20     optional uint32 message_id = 2;
21     optional bytes data = 3;
22 }
23
24 message ControlCommand {
25     enum Type { VERSION = 1; DEVICE_ID = 2; DIAGNOSTIC = 3; }
26     enum Action { ADD = 1; CANCEL = 2; }
27
28     optional Type type = 1;
29     optional DiagnosticRequest diagnostic_request = 2;
30     optional Action action = 3;
31 }
32
33 message CommandResponse {
34     optional ControlCommand.Type type = 1;
35     optional string message = 2;
36     optional bool status = 3;
37 }
38
39 message DiagnosticRequest {
40     enum DecodedType { NONE = 1; OBD2 = 2; }
41
42     optional int32 bus = 1;
43     optional uint32 message_id = 2;
44     optional uint32 mode = 3;
45     optional uint32 pid = 4;
46     // TODO we are capping this at 8 bytes for now - need to change when we
47     // support multi-frame responses
48     optional bytes payload = 5;
49     optional bool multiple_responses = 6;
50     optional double frequency = 7;
51     optional string name = 8;
52     optional DecodedType decoded_type = 9;
53 }
54
55 message DiagnosticResponse {
56     optional int32 bus = 1;
57     optional uint32 message_id = 2;
58     optional uint32 mode = 3;
59     optional uint32 pid = 4;
60     optional bool success = 5;
61     optional uint32 negative_response_code = 6;
62     // TODO we are capping this at 8 bytes for now - need to change when we
63     // support multi-frame responses
64     optional bytes payload = 7;
65     optional double value = 8;
66 }
67
68 message DynamicField {
69     enum Type { STRING = 1; NUM = 2; BOOL = 3; }
70
71     optional Type type = 1;
72     optional string string_value = 2;
73     optional double numeric_value = 3;
74     optional bool boolean_value = 4;
75 }
76
77 message TranslatedMessage {
78     enum Type { STRING = 1; NUM = 2; BOOL = 3;
79         EVENTED_STRING = 4; EVENTED_NUM = 5; EVENTED_BOOL = 6;}
80
81     optional Type type = 1;
82     optional string name = 2;
83     optional DynamicField value = 3;
84     optional DynamicField event = 4;
85 }
86
87 // TODO we should also consider having an enum type, having each specific
88 // message defined as a protobuf