f54c0906c8b91168bebdb6ce0637c52ee37f0c29
[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         PAYLOAD_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 PayloadFormatCommand payload_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 PayloadFormatCommand {
59     enum PayloadFormat {
60         JSON = 1;
61         PROTOBUF = 2;
62     }
63
64     optional PayloadFormat format = 1;
65 }
66
67 message CommandResponse {
68     optional ControlCommand.Type type = 1;
69     optional string message = 2;
70     optional bool status = 3;
71 }
72
73 message DiagnosticRequest {
74     enum DecodedType { NONE = 1; OBD2 = 2; }
75
76     optional int32 bus = 1;
77     optional uint32 message_id = 2;
78     optional uint32 mode = 3;
79     optional uint32 pid = 4;
80     // TODO we are capping this at 8 bytes for now - need to change when we
81     // support multi-frame responses
82     optional bytes payload = 5;
83     optional bool multiple_responses = 6;
84     optional double frequency = 7;
85     optional string name = 8;
86     optional DecodedType decoded_type = 9;
87 }
88
89 message DiagnosticResponse {
90     optional int32 bus = 1;
91     optional uint32 message_id = 2;
92     optional uint32 mode = 3;
93     optional uint32 pid = 4;
94     optional bool success = 5;
95     optional uint32 negative_response_code = 6;
96     // TODO we are capping this at 8 bytes for now - need to change when we
97     // support multi-frame responses
98     optional bytes payload = 7;
99     optional double value = 8;
100 }
101
102 message DynamicField {
103     enum Type { STRING = 1; NUM = 2; BOOL = 3; }
104
105     optional Type type = 1;
106     optional string string_value = 2;
107     optional double numeric_value = 3;
108     optional bool boolean_value = 4;
109 }
110
111 message TranslatedMessage {
112     enum Type { STRING = 1; NUM = 2; BOOL = 3;
113         EVENTED_STRING = 4; EVENTED_NUM = 5; EVENTED_BOOL = 6;}
114
115     optional Type type = 1;
116     optional string name = 2;
117     optional DynamicField value = 3;
118     optional DynamicField event = 4;
119 }
120
121 // TODO we should also consider having an enum type, having each specific
122 // message defined as a protobuf