blob: 0dafe8c4a6058b9a41703c4ebb040eebe5f947cb [file] [log] [blame]
Yu Shan6cd2fd72022-01-19 15:05:31 -08001/*
2 * Copyright (C) 2015 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 = "proto2";
18
19package vhal_proto;
20
21// CMD messages are from workstation --> VHAL
22// RESP messages are from VHAL --> workstation
23enum MsgType {
24 GET_CONFIG_CMD = 0;
25 GET_CONFIG_RESP = 1;
26 GET_CONFIG_ALL_CMD = 2;
27 GET_CONFIG_ALL_RESP = 3;
28 GET_PROPERTY_CMD = 4;
29 GET_PROPERTY_RESP = 5;
30 GET_PROPERTY_ALL_CMD = 6;
31 GET_PROPERTY_ALL_RESP = 7;
32 SET_PROPERTY_CMD = 8;
33 SET_PROPERTY_RESP = 9;
34 SET_PROPERTY_ASYNC = 10;
35 DEBUG_CMD = 11;
36 DEBUG_RESP = 12;
37}
38enum Status {
39 RESULT_OK = 0;
40 ERROR_UNKNOWN = 1;
41 ERROR_UNIMPLEMENTED_CMD = 2;
42 ERROR_INVALID_PROPERTY = 3;
43 ERROR_INVALID_AREA_ID = 4;
44 ERROR_PROPERTY_UNINITIALIZED = 5;
45 ERROR_WRITE_ONLY_PROPERTY = 6;
46 ERROR_MEMORY_ALLOC_FAILED = 7;
47 ERROR_INVALID_OPERATION = 8;
48}
49
50enum VehiclePropStatus {
51 AVAILABLE = 0;
52 UNAVAILABLE = 1;
53 ERROR = 2;
54}
55
56message VehicleAreaConfig {
57 required int32 area_id = 1;
58 optional sint32 min_int32_value = 2;
59 optional sint32 max_int32_value = 3;
60 optional sint64 min_int64_value = 4;
61 optional sint64 max_int64_value = 5;
62 optional float min_float_value = 6;
63 optional float max_float_value = 7;
64}
65
66message VehiclePropConfig {
67 required int32 prop = 1;
68 optional int32 access = 2;
69 optional int32 change_mode = 3;
70 optional int32 value_type = 4;
71 optional int32 supported_areas = 5; // Deprecated - DO NOT USE
72 repeated VehicleAreaConfig area_configs = 6;
73 optional int32 config_flags = 7;
74 repeated int32 config_array = 8;
75 optional string config_string = 9;
76 optional float min_sample_rate = 10;
77 optional float max_sample_rate = 11;
78};
79
80message VehiclePropValue {
81 // common data
82 required int32 prop = 1;
83 optional int32 value_type = 2;
84 optional int64 timestamp = 3; // required for valid data from HAL, skipped for set
85 optional VehiclePropStatus status = 10; // required for valid data from HAL, skipped for set
86
87 // values
88 optional int32 area_id = 4;
89 repeated sint32 int32_values = 5; // this also covers boolean value.
90 repeated sint64 int64_values = 6;
91 repeated float float_values = 7;
92 optional string string_value = 8;
93 optional bytes bytes_value = 9;
94};
95
96// This structure is used to notify what values to get from the Vehicle HAL
97message VehiclePropGet {
98 required int32 prop = 1;
99 optional int32 area_id = 2;
100};
101
102message EmulatorMessage {
103 required MsgType msg_type = 1;
104 optional Status status = 2; // Only for RESP messages
105 repeated VehiclePropGet prop = 3; // Provided for getConfig, getProperty commands
106 repeated VehiclePropConfig config = 4;
107 repeated VehiclePropValue value = 5;
108 repeated string debug_commands = 6; // Required for debug command
109 optional string debug_result = 7; // Required for debug RESP messages
110};