Add a draft protobuf format for diagnostic requests.
[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; }
8
9     optional Type type = 1;
10     optional RawMessage raw_message = 2;
11     optional TranslatedMessage translated_message = 3;
12     optional DiagnosticResponse diagnostic_response = 4;
13 }
14
15 message RawMessage {
16     optional int32 bus = 1;
17     optional uint32 message_id = 2;
18     optional bytes data = 3;
19 }
20
21 message ControlCommand {
22     enum Type { VERSION = 1; DEVICE_ID = 2; DIAGNOSTIC = 3; }
23
24     optional Type type = 1;
25     optional DiagnosticRequest diagnostic_request = 2;
26 }
27
28 message DiagnosticRequest {
29     optional int32 bus = 1;
30     optional uint32 message_id = 2;
31     optional uint32 mode = 3;
32     optional uint32 pid = 4;
33     // TODO we are capping this at 8 bytes for now - need to change when we
34     // support multi-frame responses
35     optional bytes payload = 5;
36     optional bool parse_payload = 6;
37     optional double factor = 7;
38     optional double offset = 8;
39     optional double frequency = 9;
40 }
41
42 message DiagnosticResponse {
43     optional int32 bus = 1;
44     optional uint32 message_id = 2;
45     optional uint32 mode = 3;
46     optional uint32 pid = 4;
47     optional bool success = 5;
48     optional uint32 negative_response_code = 6;
49     // TODO we are capping this at 8 bytes for now - need to change when we
50     // support multi-frame responses
51     optional bytes payload = 7;
52     optional double value = 8;
53 }
54
55 message TranslatedMessage {
56     enum Type { STRING = 1; NUM = 2; BOOL = 3;
57         EVENTED_STRING = 4; EVENTED_NUM = 5; EVENTED_BOOL = 6;}
58
59     optional Type type = 1;
60     optional string name = 2;
61
62     optional string string_value = 3;
63     optional double numeric_value = 4;
64     optional bool boolean_value = 5;
65
66     optional string string_event = 6;
67     optional double numeric_event = 7;
68     optional bool boolean_event = 8;
69 }
70
71 // TODO we should also consider having an enum type, having each specific
72 // message defined as a protobuf