summaryrefslogtreecommitdiffstats
path: root/libs/openxc-message-format/openxc.proto
blob: db7164ffe0513f100a65f1d09035ab9e3217a201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package openxc;

option java_package = "com.openxc";
option java_outer_classname = "BinaryMessages";

message VehicleMessage {
    enum Type { CAN = 1; SIMPLE = 2; DIAGNOSTIC = 3; CONTROL_COMMAND = 4;
            COMMAND_RESPONSE = 5; }

    optional Type type = 1;
    optional CanMessage can_message = 2;
    optional SimpleMessage simple_message = 3;
    optional DiagnosticResponse diagnostic_response = 4;
    optional ControlCommand control_command = 5;
    optional CommandResponse command_response = 6;
    optional uint64 timestamp = 7;
}

message CanMessage {
    enum FrameFormat {
        STANDARD = 1;
        EXTENDED = 2;
    }
    optional int32 bus = 1;
    optional uint32 id = 2;
    optional bytes data = 3;
    optional FrameFormat frame_format = 4;
}

message ControlCommand {
    enum Type {
        VERSION = 1;
        DEVICE_ID = 2;
        DIAGNOSTIC = 3;
        PASSTHROUGH = 4;
        ACCEPTANCE_FILTER_BYPASS = 5;
        PAYLOAD_FORMAT = 6;
        PREDEFINED_OBD2_REQUESTS = 7;
        MODEM_CONFIGURATION = 8;
        RTC_CONFIGURATION = 9;
        SD_MOUNT_STATUS = 10;
        PLATFORM = 11;
    }

    optional Type type = 1;
    optional DiagnosticControlCommand diagnostic_request = 2;
    optional PassthroughModeControlCommand passthrough_mode_request = 3;
    optional AcceptanceFilterBypassCommand acceptance_filter_bypass_command = 4;
    optional PayloadFormatCommand payload_format_command = 5;
    optional PredefinedObd2RequestsCommand predefined_obd2_requests_command = 6;
    optional ModemConfigurationCommand modem_configuration_command = 7;
    optional RTCConfigurationCommand rtc_configuration_command = 8;
}

message DiagnosticControlCommand {
    enum Action { ADD = 1; CANCEL = 2; }

    optional DiagnosticRequest request = 1;
    optional Action action = 2;
}

message PassthroughModeControlCommand {
    optional int32 bus = 1;
    optional bool enabled = 2;
}

message AcceptanceFilterBypassCommand {
    optional int32 bus = 1;
    optional bool bypass = 2;
}

message PayloadFormatCommand {
    enum PayloadFormat {
        JSON = 1;
        PROTOBUF = 2;
    	MESSAGEPACK = 3;
    }

    optional PayloadFormat format = 1;
}

message PredefinedObd2RequestsCommand {
    optional bool enabled = 1;
}

message NetworkOperatorSettings {
	enum OperatorSelectMode {
		AUTOMATIC = 0;
		MANUAL = 1;
		DEREGISTER = 2;
		SET_ONLY = 3;
		MANUAL_AUTOMATIC = 4;
	}
	message NetworkDescriptor {
		enum NetworkType {
			GSM = 0;
			UTRAN = 2;
		}
		optional uint32 PLMN = 1;
		optional NetworkType networkType = 2;
	}
	optional bool allowDataRoaming = 1;
	optional OperatorSelectMode operatorSelectMode = 2;
	optional NetworkDescriptor networkDescriptor = 3;
}

message NetworkDataSettings {
	optional string APN = 1;
}

message ServerConnectSettings {
	optional string host = 1;
	optional uint32 port = 2;
}

message ModemConfigurationCommand {
	optional NetworkOperatorSettings networkOperatorSettings = 1;
	optional NetworkDataSettings networkDataSettings = 2;
	optional ServerConnectSettings serverConnectSettings = 3;
}

message RTCConfigurationCommand {
	optional uint32 unix_time = 1;
}

message CommandResponse {
    optional ControlCommand.Type type = 1;
    optional string message = 2;
    optional bool status = 3;
}

message DiagnosticRequest {
    enum DecodedType { NONE = 1; OBD2 = 2; }

    optional int32 bus = 1;
    optional uint32 message_id = 2;
    optional uint32 mode = 3;
    optional uint32 pid = 4;
    // TODO we are capping this at 8 bytes for now - need to change when we
    // support multi-frame responses
    optional bytes payload = 5;
    optional bool multiple_responses = 6;
    optional double frequency = 7;
    optional string name = 8;
    optional DecodedType decoded_type = 9;
}

message DiagnosticResponse {
    optional int32 bus = 1;
    optional uint32 message_id = 2;
    optional uint32 mode = 3;
    optional uint32 pid = 4;
    optional bool success = 5;
    optional uint32 negative_response_code = 6;
    // TODO we are capping this at 8 bytes for now - need to change when we
    // support multi-frame responses
    optional bytes payload = 7;
    optional double value = 8;
}

message DynamicField {
    enum Type { STRING = 1; NUM = 2; BOOL = 3; }

    optional Type type = 1;
    optional string string_value = 2;
    optional double numeric_value = 3;
    optional bool boolean_value = 4;
}

message SimpleMessage {
    optional string name = 1;
    optional DynamicField value = 2;
    optional DynamicField event = 3;
}