Merge branch 'next'
[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 { CAN = 1; SIMPLE = 2; DIAGNOSTIC = 3; CONTROL_COMMAND = 4;
8             COMMAND_RESPONSE = 5; }
9
10     optional Type type = 1;
11     optional CanMessage can_message = 2;
12     optional SimpleMessage simple_message = 3;
13     optional DiagnosticResponse diagnostic_response = 4;
14     optional ControlCommand control_command = 5;
15     optional CommandResponse command_response = 6;
16 }
17
18 message CanMessage {
19     enum FrameFormat {
20         STANDARD = 1;
21         EXTENDED = 2;
22     }
23     optional int32 bus = 1;
24     optional uint32 id = 2;
25     optional bytes data = 3;
26     optional FrameFormat frame_format = 4;
27 }
28
29 message ControlCommand {
30     enum Type {
31         VERSION = 1;
32         DEVICE_ID = 2;
33         DIAGNOSTIC = 3;
34         PASSTHROUGH = 4;
35         ACCEPTANCE_FILTER_BYPASS = 5;
36         PAYLOAD_FORMAT = 6;
37         PREDEFINED_OBD2_REQUESTS = 7;
38     }
39
40     optional Type type = 1;
41     optional DiagnosticControlCommand diagnostic_request = 2;
42     optional PassthroughModeControlCommand passthrough_mode_request = 3;
43     optional AcceptanceFilterBypassCommand acceptance_filter_bypass_command = 4;
44     optional PayloadFormatCommand payload_format_command = 5;
45     optional PredefinedObd2RequestsCommand predefined_obd2_requests_command = 6;
46 }
47
48 message DiagnosticControlCommand {
49     enum Action { ADD = 1; CANCEL = 2; }
50
51     optional DiagnosticRequest request = 1;
52     optional Action action = 2;
53 }
54
55 message PassthroughModeControlCommand {
56     optional int32 bus = 1;
57     optional bool enabled = 2;
58 }
59
60 message AcceptanceFilterBypassCommand {
61     optional int32 bus = 1;
62     optional bool bypass = 2;
63 }
64
65 message PayloadFormatCommand {
66     enum PayloadFormat {
67         JSON = 1;
68         PROTOBUF = 2;
69     }
70
71     optional PayloadFormat format = 1;
72 }
73
74 message PredefinedObd2RequestsCommand {
75     optional bool enabled = 1;
76 }
77
78 message CommandResponse {
79     optional ControlCommand.Type type = 1;
80     optional string message = 2;
81     optional bool status = 3;
82 }
83
84 message DiagnosticRequest {
85     enum DecodedType { NONE = 1; OBD2 = 2; }
86
87     optional int32 bus = 1;
88     optional uint32 message_id = 2;
89     optional uint32 mode = 3;
90     optional uint32 pid = 4;
91     // TODO we are capping this at 8 bytes for now - need to change when we
92     // support multi-frame responses
93     optional bytes payload = 5;
94     optional bool multiple_responses = 6;
95     optional double frequency = 7;
96     optional string name = 8;
97     optional DecodedType decoded_type = 9;
98 }
99
100 message DiagnosticResponse {
101     optional int32 bus = 1;
102     optional uint32 message_id = 2;
103     optional uint32 mode = 3;
104     optional uint32 pid = 4;
105     optional bool success = 5;
106     optional uint32 negative_response_code = 6;
107     // TODO we are capping this at 8 bytes for now - need to change when we
108     // support multi-frame responses
109     optional bytes payload = 7;
110     optional double value = 8;
111 }
112
113 message DynamicField {
114     enum Type { STRING = 1; NUM = 2; BOOL = 3; }
115
116     optional Type type = 1;
117     optional string string_value = 2;
118     optional double numeric_value = 3;
119     optional bool boolean_value = 4;
120 }
121
122 message SimpleMessage {
123     optional string name = 1;
124     optional DynamicField value = 2;
125     optional DynamicField event = 3;
126 }