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