-
Notifications
You must be signed in to change notification settings - Fork 6
/
svmp.proto
304 lines (253 loc) · 8.24 KB
/
svmp.proto
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
// svmp.proto
// Client to Proxy Server protocol
// Copyright (c) 2012-2013, The MITRE Corporation, All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package svmp;
option optimize_for = LITE_RUNTIME;
option java_package = "org.mitre.svmp.protocol";
option java_outer_classname = "SVMPProtocol";
// Client to server message wrapper
message Request
{
required RequestType type = 1;
enum RequestType {
USERAUTH = 0;
VIDEO_PARAMS = 1;
TOUCHEVENT = 2;
SENSOREVENT = 3;
LOCATION = 4;
INTENT = 5;
SCREENINFO = 6;
VIDEO_START = 7;
VIDEO_STOP = 8;
}
optional Authentication authentication = 2;
optional VideoRequest videoRequest = 3;
optional TouchEvent touch = 4;
optional SensorEvent sensor = 5;
optional LocationRequest locationRequest = 6;
optional Intent intent = 7;
}
// Server to client message wrapper
message Response
{
enum ResponseType {
ERROR = 0; // 'message' should contain a useful error string
AUTHOK = 1;
VMREADY = 2; // 'message' should contain any extra info needed to contact the VM
SCREENINFO = 3; // touch screen coordinate scaling info
VIDSTREAMINFO = 4; // IP/Port info for video stream
INTENT = 5; // intent data in 'proxy'
NOTIFICATION = 6; // notification data in 'proxy'
LOCATION = 7; // location request
}
required ResponseType type = 1;
optional string message = 2;
optional Intent intent = 4;
optional Notification notification = 5;
optional LocationResponse locationResponse = 6;
optional ScreenInfo screen_info = 16;
optional VideoStreamInfo video_info = 17; // placeholder for future use
}
//=====================================================================
// Cross platform intent & notification IPC
//=====================================================================
enum IntentAction
{
ACTION_VIEW = 1;
ACTION_DIAL = 2;
}
// C<->S
message Intent {
//Corresponds to Intent 'action' parameter, but limited to supported actions
required IntentAction action = 1;
//Encode all bundle extras as strings, and decode them later into specific data types
repeated Tuple extras = 2;
//Correspond to optional Intent parameters
optional string data = 3;
repeated int32 flags = 4;
repeated string categories = 5;
//For approximating a Java Map structure (Map<String,String>)
message Tuple {
required string key = 1;
required string value = 2;
}
}
// C<->S
message Notification {
//All of the following correspond directly to fields in Android's Notification object,
//with the exception of the icon fields which directly include image data rather than references
required string contentTitle = 1;
required string contentText = 2;
required bytes smallIcon = 3;
optional bytes largeIcon = 4;
// TODO: add additional optional notification fields as necessary
}
//=====================================================================
// Touch screen
//=====================================================================
// C->S
message TouchEvent {
required int32 action = 1;
repeated PointerCoords items = 2;
message PointerCoords {
required int32 id = 1;
required float x = 2;
required float y = 3;
}
}
// S->C
message ScreenInfo {
required int32 x = 1;
required int32 y = 2;
}
//=====================================================================
// Sensors
//=====================================================================
// Synced with android.hardware.Sensor
enum SensorType {
ACCELEROMETER = 1;
MAGNETIC_FIELD = 2;
ORIENTATION = 3;
GYROSCOPE = 4;
LIGHT = 5;
PRESSURE = 6;
TEMPERATURE = 7;
PROXIMITY = 8;
GRAVITY = 9;
LINEAR_ACCELERATION = 10;
ROTATION_VECTOR = 11;
RELATIVE_HUMIDITY = 12;
AMBIENT_TEMPERATURE = 13;
}
// C->S: Sensor update event
message SensorEvent {
required SensorType type = 1;
required int32 accuracy = 2;
required int64 timestamp = 3;
repeated float values = 4;
}
// S->C: Sensor subscribe request, or update existing subscription
message SensorSubscribe {
required SensorType type = 1;
optional int32 frequency = 2; // update frequency in Hz
}
// S->C: Unsubscribe from sensor update feed
message SensorUnsubscribe {
required SensorType type = 1;
}
//=====================================================================
// Location
//=====================================================================
// C->S: Location provider information
message LocationProviderInfo {
required string provider = 1;
required bool requiresNetwork = 2;
required bool requiresSatellite = 3;
required bool requiresCell = 4;
required bool hasMonetaryCost = 5;
required bool supportsAltitude = 6;
required bool supportsSpeed = 7;
required bool supportsBearing = 8;
required int32 powerRequirement = 9;
required int32 accuracy = 10;
}
// C->S: Location provider status update
message LocationProviderStatus {
required string provider = 1;
required int32 status = 2;
//Encode all bundle extras as strings, and decode them later into specific data types
repeated Tuple extras = 3;
//For approximating a Java Map structure (Map<String,String>)
message Tuple {
required string key = 1;
required string value = 2;
}
}
// C->S: Location provider enabled update
message LocationProviderEnabled {
required string provider = 1;
required bool enabled = 2;
}
// C->S: Location update event
message LocationUpdate {
required double latitude = 1;
required double longitude = 2;
required int64 time = 3;
optional string provider = 4;
optional float accuracy = 5;
optional double altitude = 6;
optional float bearing = 7;
optional float speed = 8;
}
// C->S: Wrapper for LocationProviderInfo, LocationProviderStatus,
// LocationProviderEnabled, and LocationProviderUpdate messages
message LocationRequest {
required LocationRequestType type = 1;
enum LocationRequestType {
PROVIDERINFO = 1;
PROVIDERSTATUS = 2;
PROVIDERENABLED = 3;
LOCATIONUPDATE = 4;
}
optional LocationProviderInfo providerInfo = 2;
optional LocationProviderStatus providerStatus = 3;
optional LocationProviderEnabled providerEnabled = 4;
optional LocationUpdate update = 5;
}
// S->C: Location update request (one-time or long-term)
message LocationSubscribe {
required LocationSubscribeType type = 1;
enum LocationSubscribeType {
SINGLE_UPDATE = 1;
MULTIPLE_UPDATES = 2;
}
required string provider = 2;
optional int64 minTime = 3;
optional float minDistance = 4;
}
// S->C: Unsubscribe from long-term location updates
message LocationUnsubscribe {
required string provider = 1;
}
// S->C: Wrapper for LocationSubscribe and LocationUnsubscribe messages
message LocationResponse {
required LocationResponseType type = 1;
enum LocationResponseType {
SUBSCRIBE = 1;
UNSUBSCRIBE = 2;
}
optional LocationSubscribe subscribe = 2;
optional LocationUnsubscribe unsubscribe = 3;
}
//=====================================================================
// Other
//=====================================================================
message Authentication {
required string un = 1;
required string pw = 2;
}
// C->S
message VideoRequest {
required string ip = 1;
required int32 port = 2;
optional int32 bitrate = 3;
// give the client a chance to request a video stream with particular parameters
// e.g., resolution, bitrate, FEC, etc.
// TODO
}
// S->C
message VideoStreamInfo {
// ip, port, path, the SDP contents directly, etc.
// what parameters are not constants and can't be hard coded?
// TODO
// Currently the rtsp url is bundled in the Response.message string field in the VMREADY response
}