daccea2d5c666693c50a9e6a84cbab29772f0ebf
[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 { VERSION = 1; DEVICE_ID = 2; DIAGNOSTIC = 3; }
26
27     optional Type type = 1;
28     optional DiagnosticRequest diagnostic_request = 2;
29 }
30
31 message CommandResponse {
32     optional ControlCommand.Type type = 1;
33     optional string message = 2;
34 }
35
36 message DiagnosticRequest {
37     optional int32 bus = 1;
38     optional uint32 message_id = 2;
39     optional uint32 mode = 3;
40     optional uint32 pid = 4;
41     // TODO we are capping this at 8 bytes for now - need to change when we
42     // support multi-frame responses
43     optional bytes payload = 5;
44     optional bool multiple_responses = 6;
45     optional double factor = 7;
46     optional double offset = 8;
47     optional double frequency = 9;
48     optional string name = 10;
49 }
50
51 message DiagnosticResponse {
52     optional int32 bus = 1;
53     optional uint32 message_id = 2;
54     optional uint32 mode = 3;
55     optional uint32 pid = 4;
56     optional bool success = 5;
57     optional uint32 negative_response_code = 6;
58     // TODO we are capping this at 8 bytes for now - need to change when we
59     // support multi-frame responses
60     optional bytes payload = 7;
61     optional double value = 8;
62 }
63
64 message DynamicField {
65     enum Type { STRING = 1; NUM = 2; BOOL = 3; }
66
67     optional Type type = 1;
68     optional string string_value = 2;
69     optional double numeric_value = 3;
70     optional bool boolean_value = 4;
71 }
72
73 message TranslatedMessage {
74     enum Type { STRING = 1; NUM = 2; BOOL = 3;
75         EVENTED_STRING = 4; EVENTED_NUM = 5; EVENTED_BOOL = 6;}
76
77     optional Type type = 1;
78     optional string name = 2;
79     optional DynamicField value = 3;
80     optional DynamicField event = 4;
81 }
82
83 // TODO we should also consider having an enum type, having each specific
84 // message defined as a protobuf