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