Add a command to change message format while running.
[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 {
26         VERSION = 1;
27         DEVICE_ID = 2;
28         DIAGNOSTIC = 3;
29         PASSTHROUGH = 4;
30         ACCEPTANCE_FILTER_BYPASS = 5;
31         MESSAGE_FORMAT = 6;
32     }
33
34     optional Type type = 1;
35     optional DiagnosticControlCommand diagnostic_request = 2;
36     optional PassthroughModeControlCommand passthrough_mode_request = 3;
37     optional AcceptanceFilterBypassCommand acceptance_filter_bypass_command = 4;
38     optional MessageFormatCommand message_format_command = 5;
39 }
40
41 message DiagnosticControlCommand {
42     enum Action { ADD = 1; CANCEL = 2; }
43
44     optional DiagnosticRequest request = 1;
45     optional Action action = 2;
46 }
47
48 message PassthroughModeControlCommand {
49     optional int32 bus = 1;
50     optional bool enabled = 2;
51 }
52
53 message AcceptanceFilterBypassCommand {
54     optional int32 bus = 1;
55     optional bool bypass = 2;
56 }
57
58 message MessageFormatCommand {
59     enum MessageFormat {
60         JSON = 1;
61         BINARY = 2;
62     }
63
64     optional int32 bus = 1;
65     optional MessageFormat format = 2;
66 }
67
68 message CommandResponse {
69     optional ControlCommand.Type type = 1;
70     optional string message = 2;
71     optional bool status = 3;
72 }
73
74 message DiagnosticRequest {
75     enum DecodedType { NONE = 1; OBD2 = 2; }
76
77     optional int32 bus = 1;
78     optional uint32 message_id = 2;
79     optional uint32 mode = 3;
80     optional uint32 pid = 4;
81     // TODO we are capping this at 8 bytes for now - need to change when we
82     // support multi-frame responses
83     optional bytes payload = 5;
84     optional bool multiple_responses = 6;
85     optional double frequency = 7;
86     optional string name = 8;
87     optional DecodedType decoded_type = 9;
88 }
89
90 message DiagnosticResponse {
91     optional int32 bus = 1;
92     optional uint32 message_id = 2;
93     optional uint32 mode = 3;
94     optional uint32 pid = 4;
95     optional bool success = 5;
96     optional uint32 negative_response_code = 6;
97     // TODO we are capping this at 8 bytes for now - need to change when we
98     // support multi-frame responses
99     optional bytes payload = 7;
100     optional double value = 8;
101 }
102
103 message DynamicField {
104     enum Type { STRING = 1; NUM = 2; BOOL = 3; }
105
106     optional Type type = 1;
107     optional string string_value = 2;
108     optional double numeric_value = 3;
109     optional bool boolean_value = 4;
110 }
111
112 message TranslatedMessage {
113     enum Type { STRING = 1; NUM = 2; BOOL = 3;
114         EVENTED_STRING = 4; EVENTED_NUM = 5; EVENTED_BOOL = 6;}
115
116     optional Type type = 1;
117     optional string name = 2;
118     optional DynamicField value = 3;
119     optional DynamicField event = 4;
120 }
121
122 // TODO we should also consider having an enum type, having each specific
123 // message defined as a protobuf