xref: /aosp_15_r20/development/samples/VirtualDeviceManager/common/proto/remote_event.proto (revision 90c8c64db3049935a07c6143d7fd006e26f8ecca)
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: 24
25message RemoteEvent {
26  int32 display_id = 1;
27
28  oneof event {
29    DeviceCapabilities device_capabilities = 2;
30    DeviceState device_state = 22;
31    StartStreaming start_streaming = 3;
32    StopStreaming stop_streaming = 4;
33    DisplayCapabilities display_capabilities = 5;
34    DisplayRotation display_rotation = 6;
35    BrightnessEvent brightness_event = 23;
36    EncodedFrame display_frame = 7;
37    SensorConfiguration sensor_configuration = 8;
38    RemoteInputEvent input_event = 9;
39    RemoteSensorEvent sensor_event = 10;
40    StartAudio start_audio = 11;
41    AudioFrame audio_frame = 12;
42    StopAudio stop_audio = 13;
43    RemoteHomeEvent home_event = 14;
44    DisplayChangeEvent display_change_event = 15;
45    KeyboardVisibilityEvent keyboard_visibility_event = 16;
46    StartAudioInput start_audio_input = 17;
47    StopAudioInput stop_audio_input = 18;
48    StartCameraStream start_camera_stream = 19;
49    StopCameraStream stop_camera_stream = 20;
50    CameraFrame camera_frame = 21;
51  }
52}
53
54message DeviceCapabilities {
55  string device_name = 1;
56  repeated SensorCapabilities sensor_capabilities = 2;
57  repeated CameraCapabilities camera_capabilities = 5;
58  bool supports_audio_input = 3;
59  bool supports_audio_output = 4;
60}
61
62message DeviceState {
63  bool power_on = 1;
64}
65
66message DisplayRotation {
67  int32 rotation_degrees = 1;
68}
69
70message SensorCapabilities {
71  int32 type = 1;
72  string name = 2;
73  string vendor = 3;
74  float max_range = 4;
75  float resolution = 5;
76  float power = 6;
77  int32 min_delay_us = 7;
78  int32 max_delay_us = 8;
79  bool is_wake_up_sensor = 9;
80  int32 reporting_mode = 10;
81}
82
83message CameraCapabilities {
84  string camera_id = 1;
85  int32 width = 2;
86  int32 height = 3;
87  int32 fps = 4;
88  int32 lens_facing = 5;
89  int32 sensor_orientation = 6;
90}
91
92message StartCameraStream {
93  string camera_id = 1;
94}
95
96message StopCameraStream {
97  string camera_id = 2;
98}
99
100message CameraFrame {
101  string camera_id = 1;
102  EncodedFrame camera_frame = 2;
103}
104
105message StartStreaming {
106  bool home_enabled = 1;
107  bool rotation_supported = 2;
108}
109
110message StopStreaming {
111  bool pause = 1;
112}
113
114message DisplayCapabilities {
115  int32 viewport_width = 1;
116  int32 viewport_height = 2;
117  int32 density_dpi = 3;
118}
119
120message BrightnessEvent {
121  float brightness = 1;
122}
123
124message EncodedFrame {
125  bytes frame_data = 1;
126  int32 frame_index = 2;
127  int32 flags = 3;
128  int64 presentation_time_us = 4;
129}
130
131enum InputDeviceType {
132  DEVICE_TYPE_NONE = 0;
133  DEVICE_TYPE_MOUSE = 1;
134  DEVICE_TYPE_DPAD = 2;
135  DEVICE_TYPE_NAVIGATION_TOUCHPAD = 3;
136  DEVICE_TYPE_TOUCHSCREEN = 4;
137  DEVICE_TYPE_KEYBOARD = 5;
138  DEVICE_TYPE_ROTARY_ENCODER = 6;
139}
140
141message RemoteInputEvent {
142  int64 timestamp_ms = 1;
143
144  InputDeviceType device_type = 2;
145
146  oneof event {
147    RemoteMotionEvent mouse_relative_event = 3;
148    RemoteKeyEvent mouse_button_event = 4;
149    RemoteMotionEvent mouse_scroll_event = 5;
150
151    RemoteKeyEvent key_event = 6;
152
153    RemoteMotionEvent touch_event = 7;
154  }
155}
156
157message RemoteMotionEvent {
158  int32 pointer_id = 1;
159  int32 action = 2;
160  float x = 3;
161  float y = 4;
162  float pressure = 5;
163}
164
165message RemoteKeyEvent {
166  int32 action = 1;
167  int32 key_code = 2;
168}
169
170message SensorConfiguration {
171  int32 sensor_type = 1;
172  bool enabled = 2;
173  int32 sampling_period_us = 3;
174  int32 batch_reporting_latency_us = 4;
175}
176
177message RemoteSensorEvent {
178  int32 sensor_type = 1;
179  repeated float values = 2;
180}
181
182message StartAudio {}
183
184message StopAudio {}
185
186message StartAudioInput {
187  int32 sample_rate = 1;
188  int32 channel_mask = 2;
189  int32 encoding = 3;
190}
191
192message StopAudioInput {}
193
194message AudioFrame {
195  bytes data = 1;
196}
197
198message RemoteHomeEvent {}
199
200message DisplayChangeEvent {
201  string title = 1;
202  bool focused = 2;
203}
204
205message KeyboardVisibilityEvent {
206  bool visible = 1;
207}
208