1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto3";
18
19package com.example.android.vdmdemo.common;
20
21option java_outer_classname = "RemoteEventProto";
22option java_package = "com.example.android.vdmdemo.common";
23
24// Next ID: 19
25message RemoteEvent {
26  int32 display_id = 1;
27
28  oneof event {
29    DeviceCapabilities device_capabilities = 2;
30    StartStreaming start_streaming = 3;
31    StopStreaming stop_streaming = 4;
32    DisplayCapabilities display_capabilities = 5;
33    DisplayRotation display_rotation = 6;
34    EncodedFrame display_frame = 7;
35    SensorConfiguration sensor_configuration = 8;
36    RemoteInputEvent input_event = 9;
37    RemoteSensorEvent sensor_event = 10;
38    StartAudio start_audio = 11;
39    AudioFrame audio_frame = 12;
40    StopAudio stop_audio = 13;
41    RemoteHomeEvent home_event = 14;
42    DisplayChangeEvent display_change_event = 15;
43    KeyboardVisibilityEvent keyboard_visibility_event = 16;
44    StartAudioInput start_audio_input = 17;
45    StopAudioInput stop_audio_input = 18;
46    StartCameraStream start_camera_stream = 19;
47    StopCameraStream stop_camera_stream = 20;
48    CameraFrame camera_frame = 21;
49  }
50}
51
52message DeviceCapabilities {
53  string device_name = 1;
54  repeated SensorCapabilities sensor_capabilities = 2;
55  repeated CameraCapabilities camera_capabilities = 5;
56  bool supports_audio_input = 3;
57  bool supports_audio_output = 4;
58}
59
60message DisplayRotation {
61  int32 rotation_degrees = 1;
62}
63
64message SensorCapabilities {
65  int32 type = 1;
66  string name = 2;
67  string vendor = 3;
68  float max_range = 4;
69  float resolution = 5;
70  float power = 6;
71  int32 min_delay_us = 7;
72  int32 max_delay_us = 8;
73}
74
75message CameraCapabilities {
76  string camera_id = 1;
77  int32 width = 2;
78  int32 height = 3;
79  int32 fps = 4;
80  int32 lens_facing = 5;
81  int32 sensor_orientation = 6;
82}
83
84message StartCameraStream {
85  string camera_id = 1;
86}
87
88message StopCameraStream {
89  string camera_id = 2;
90}
91
92message CameraFrame {
93  string camera_id = 1;
94  EncodedFrame camera_frame = 2;
95}
96
97message StartStreaming {
98  bool home_enabled = 1;
99}
100
101message StopStreaming {
102  bool pause = 1;
103}
104
105message DisplayCapabilities {
106  int32 viewport_width = 1;
107  int32 viewport_height = 2;
108  int32 density_dpi = 3;
109}
110
111message EncodedFrame {
112  bytes frame_data = 1;
113  int32 frame_index = 2;
114  int32 flags = 3;
115  int64 presentation_time_us = 4;
116}
117
118enum InputDeviceType {
119  DEVICE_TYPE_NONE = 0;
120  DEVICE_TYPE_MOUSE = 1;
121  DEVICE_TYPE_DPAD = 2;
122  DEVICE_TYPE_NAVIGATION_TOUCHPAD = 3;
123  DEVICE_TYPE_TOUCHSCREEN = 4;
124  DEVICE_TYPE_KEYBOARD = 5;
125}
126
127message RemoteInputEvent {
128  int64 timestamp_ms = 1;
129
130  InputDeviceType device_type = 2;
131
132  oneof event {
133    RemoteMotionEvent mouse_relative_event = 3;
134    RemoteKeyEvent mouse_button_event = 4;
135    RemoteMotionEvent mouse_scroll_event = 5;
136
137    RemoteKeyEvent key_event = 6;
138
139    RemoteMotionEvent touch_event = 7;
140  }
141}
142
143message RemoteMotionEvent {
144  int32 pointer_id = 1;
145  int32 action = 2;
146  float x = 3;
147  float y = 4;
148  float pressure = 5;
149}
150
151message RemoteKeyEvent {
152  int32 action = 1;
153  int32 key_code = 2;
154}
155
156message SensorConfiguration {
157  int32 sensor_type = 1;
158  bool enabled = 2;
159  int32 sampling_period_us = 3;
160  int32 batch_reporting_latency_us = 4;
161}
162
163message RemoteSensorEvent {
164  int32 sensor_type = 1;
165  repeated float values = 2;
166}
167
168message StartAudio {}
169
170message StopAudio {}
171
172message StartAudioInput {
173  int32 sample_rate = 1;
174  int32 channel_mask = 2;
175  int32 encoding = 3;
176}
177
178message StopAudioInput {}
179
180message AudioFrame {
181  bytes data = 1;
182}
183
184message RemoteHomeEvent {}
185
186message DisplayChangeEvent {
187  string title = 1;
188  bool focused = 2;
189}
190
191message KeyboardVisibilityEvent {
192  bool visible = 1;
193}
194