1/*
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}
36enum Status {
37    RESULT_OK                           = 0;
38    ERROR_UNKNOWN                       = 1;
39    ERROR_UNIMPLEMENTED_CMD             = 2;
40    ERROR_INVALID_PROPERTY              = 3;
41    ERROR_INVALID_AREA_ID               = 4;
42    ERROR_PROPERTY_UNINITIALIZED        = 5;
43    ERROR_WRITE_ONLY_PROPERTY           = 6;
44    ERROR_MEMORY_ALLOC_FAILED           = 7;
45    ERROR_INVALID_OPERATION             = 8;
46}
47
48enum VehiclePropStatus {
49    AVAILABLE                           = 0;
50    UNAVAILABLE                         = 1;
51    ERROR                               = 2;
52}
53
54message VehicleAreaConfig {
55    required int32  area_id             = 1;
56    optional sint32 min_int32_value     = 2;
57    optional sint32 max_int32_value     = 3;
58    optional sint64 min_int64_value     = 4;
59    optional sint64 max_int64_value     = 5;
60    optional float  min_float_value     = 6;
61    optional float  max_float_value     = 7;
62}
63
64message VehiclePropConfig {
65    required int32             prop                = 1;
66    optional int32             access              = 2;
67    optional int32             change_mode         = 3;
68    optional int32             value_type          = 4;
69    optional int32             supported_areas     = 5;     // Deprecated - DO NOT USE
70    repeated VehicleAreaConfig area_configs        = 6;
71    optional int32             config_flags        = 7;
72    repeated int32             config_array        = 8;
73    optional string            config_string       = 9;
74    optional float             min_sample_rate     = 10;
75    optional float             max_sample_rate     = 11;
76};
77
78message VehiclePropValue {
79    // common data
80    required int32  prop                = 1;
81    optional int32  value_type          = 2;
82    optional int64  timestamp           = 3;    // required for valid data from HAL, skipped for set
83    optional VehiclePropStatus  status  = 10;   // required for valid data from HAL, skipped for set
84
85    // values
86    optional int32  area_id             = 4;
87    repeated sint32 int32_values        = 5;    // this also covers boolean value.
88    repeated sint64 int64_values        = 6;
89    repeated float  float_values        = 7;
90    optional string string_value        = 8;
91    optional bytes  bytes_value         = 9;
92};
93
94// This structure is used to notify what values to get from the Vehicle HAL
95message VehiclePropGet {
96    required int32 prop                 = 1;
97    optional int32 area_id              = 2;
98};
99
100message EmulatorMessage {
101    required MsgType           msg_type = 1;
102    optional Status            status   = 2;    // Only for RESP messages
103    repeated VehiclePropGet    prop     = 3;    // Provided for getConfig, getProperty commands
104    repeated VehiclePropConfig config   = 4;
105    repeated VehiclePropValue  value    = 5;
106};
107