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