Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 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 | |
| 17 | #ifndef ANDROID_VEHICLE_INTERFACE_H |
| 18 | #define ANDROID_VEHICLE_INTERFACE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/cdefs.h> |
| 22 | #include <sys/types.h> |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 23 | #include <math.h> |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 24 | #include <errno.h> |
| 25 | |
| 26 | #include <hardware/hardware.h> |
| 27 | #include <cutils/native_handle.h> |
| 28 | |
| 29 | __BEGIN_DECLS |
| 30 | |
| 31 | /*****************************************************************************/ |
| 32 | |
| 33 | #define VEHICLE_HEADER_VERSION 1 |
| 34 | #define VEHICLE_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0) |
| 35 | #define VEHICLE_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, VEHICLE_HEADER_VERSION) |
| 36 | |
| 37 | /** |
| 38 | * Vehicle HAL to provide interfaces to various Car related sensors. The HAL is |
| 39 | * designed in a property, value maping where each property has a value which |
| 40 | * can be "get", "set" and "(un)subscribed" to. Subscribing will require the |
| 41 | * user of this HAL to provide parameters such as sampling rate. |
| 42 | */ |
| 43 | |
| 44 | |
| 45 | /* |
| 46 | * The id of this module |
| 47 | */ |
| 48 | #define VEHICLE_HARDWARE_MODULE_ID "vehicle" |
| 49 | |
| 50 | /** |
| 51 | * Name of the vehicle device to open |
| 52 | */ |
| 53 | #define VEHICLE_HARDWARE_DEVICE "vehicle_hw_device" |
| 54 | |
| 55 | /** |
| 56 | * Each vehicle property is defined with various annotations to specify the type of information. |
| 57 | * Annotations will be used by scripts to run some type check or generate some boiler-plate codes. |
| 58 | * Also the annotations are the specification for each property, and each HAL implementation should |
| 59 | * follow what is specified as annotations. |
| 60 | * Here is the list of annotations with explanation on what it does: |
| 61 | * @value_type: Type of data for this property. One of the value from vehicle_value_type should be |
| 62 | * set here. |
| 63 | * @change_mode: How this property changes. Value set is from vehicle_prop_change_mode. Some |
| 64 | * properties can allow either on change or continuous mode and it is up to HAL |
| 65 | * implementation to choose which mode to use. |
| 66 | * @access: Define how this property can be accessed. read only, write only or R/W from |
| 67 | * vehicle_prop_access |
| 68 | * @data_member: Name of member from vehicle_value union to access this data. |
| 69 | * @data_enum: enum type that should be used for the data. |
| 70 | * @unit: Unit of data. Should be from vehicle_unit_type. |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 71 | * @config_flags: Usage of config_flags in vehicle_prop_config |
| 72 | * @config_array: Usage of config_array in vehicle_prop_config. When this is specified, |
| 73 | * @config_flags will not be used. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 74 | * @config_string: Explains the usage of config_string in vehicle_prop_config. Property with |
| 75 | * this annotation is expected to have additional information in config_string |
| 76 | * for that property to work. |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 77 | * @zone_type type of zoned used. defined for zoned property |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 78 | * @range_start, @range_end : define range of specific property values. |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 79 | * @allow_out_of_range_value : This property allows out of range value to deliver additional |
| 80 | * information. Check VEHICLE_*_OUT_OF_RANGE_* for applicable values. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 81 | */ |
| 82 | //===== Vehicle Information ==== |
| 83 | |
| 84 | /** |
| 85 | * Invalid property value used for argument where invalid property gives different result. |
| 86 | * @range_start |
| 87 | */ |
| 88 | #define VEHICLE_PROPERTY_INVALID (0x0) |
| 89 | |
| 90 | /** |
| 91 | * VIN of vehicle |
| 92 | * @value_type VEHICLE_VALUE_TYPE_STRING |
| 93 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 94 | * @access VEHICLE_PROP_ACCESS_READ |
| 95 | * @data_member info_vin |
| 96 | */ |
| 97 | #define VEHICLE_PROPERTY_INFO_VIN (0x00000100) |
| 98 | |
| 99 | /** |
| 100 | * Maker name of vehicle |
| 101 | * @value_type VEHICLE_VALUE_TYPE_STRING |
| 102 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 103 | * @access VEHICLE_PROP_ACCESS_READ |
| 104 | * @data_member info_make |
| 105 | */ |
| 106 | #define VEHICLE_PROPERTY_INFO_MAKE (0x00000101) |
| 107 | |
| 108 | /** |
| 109 | * Model of vehicle |
| 110 | * @value_type VEHICLE_VALUE_TYPE_STRING |
| 111 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 112 | * @access VEHICLE_PROP_ACCESS_READ |
| 113 | * @data_member info_model |
| 114 | */ |
| 115 | #define VEHICLE_PROPERTY_INFO_MODEL (0x00000102) |
| 116 | |
| 117 | /** |
| 118 | * Model year of vehicle. |
| 119 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 120 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 121 | * @access VEHICLE_PROP_ACCESS_READ |
| 122 | * @data_member info_model_year |
| 123 | * @unit VEHICLE_UNIT_TYPE_YEAR |
| 124 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 125 | #define VEHICLE_PROPERTY_INFO_MODEL_YEAR (0x00000103) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Fuel capacity of the vehicle |
| 129 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 130 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 131 | * @access VEHICLE_PROP_ACCESS_READ |
| 132 | * @data_member info_fuel_capacity |
| 133 | * @unit VEHICLE_UNIT_TYPE_VEHICLE_UNIT_TYPE_MILLILITER |
| 134 | */ |
| 135 | #define VEHICLE_PROPERTY_INFO_FUEL_CAPACITY (0x00000104) |
| 136 | |
| 137 | |
| 138 | //==== Vehicle Performance Sensors ==== |
| 139 | |
| 140 | /** |
| 141 | * Current odometer value of the vehicle |
| 142 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 143 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 144 | * @access VEHICLE_PROP_ACCESS_READ |
| 145 | * @data_member odometer |
| 146 | * @unit VEHICLE_UNIT_TYPE_KILOMETER |
| 147 | */ |
| 148 | #define VEHICLE_PROPERTY_PERF_ODOMETER (0x00000204) |
| 149 | |
| 150 | /** |
| 151 | * Speed of the vehicle |
| 152 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 153 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 154 | * @access VEHICLE_PROP_ACCESS_READ |
| 155 | * @data_member vehicle_speed |
| 156 | * @unit VEHICLE_UNIT_TYPE_METER_PER_SEC |
| 157 | */ |
| 158 | #define VEHICLE_PROPERTY_PERF_VEHICLE_SPEED (0x00000207) |
| 159 | |
| 160 | |
| 161 | //==== Engine Sensors ==== |
| 162 | |
| 163 | /** |
| 164 | * Temperature of engine coolant |
| 165 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 166 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 167 | * @access VEHICLE_PROP_ACCESS_READ |
| 168 | * @data_member engine_coolant_temperature |
| 169 | * @unit VEHICLE_UNIT_TYPE_CELCIUS |
| 170 | */ |
| 171 | #define VEHICLE_PROPERTY_ENGINE_COOLANT_TEMP (0x00000301) |
| 172 | |
| 173 | /** |
| 174 | * Temperature of engine oil |
| 175 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 176 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 177 | * @access VEHICLE_PROP_ACCESS_READ |
| 178 | * @data_member engine_oil_temperature |
| 179 | * @unit VEHICLE_UNIT_TYPE_CELCIUS |
| 180 | */ |
| 181 | #define VEHICLE_PROPERTY_ENGINE_OIL_TEMP (0x00000304) |
| 182 | /** |
| 183 | * Engine rpm |
| 184 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 185 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 186 | * @access VEHICLE_PROP_ACCESS_READ |
| 187 | * @data_member engine_rpm |
| 188 | * @unit VEHICLE_UNIT_TYPE_RPM |
| 189 | */ |
| 190 | #define VEHICLE_PROPERTY_ENGINE_RPM (0x00000305) |
| 191 | |
| 192 | //==== Event Sensors ==== |
| 193 | |
| 194 | /** |
| 195 | * Currently selected gear |
| 196 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 197 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 198 | * @access VEHICLE_PROP_ACCESS_READ |
| 199 | * @data_member gear_selection |
| 200 | * @data_enum vehicle_gear |
| 201 | */ |
| 202 | #define VEHICLE_PROPERTY_GEAR_SELECTION (0x00000400) |
| 203 | |
| 204 | /** |
| 205 | * Current gear. In non-manual case, selected gear does not necessarily match the current gear |
| 206 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 207 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 208 | * @access VEHICLE_PROP_ACCESS_READ |
| 209 | * @data_member gear_current_gear |
| 210 | * @data_enum vehicle_gear |
| 211 | */ |
| 212 | #define VEHICLE_PROPERTY_CURRENT_GEAR (0x00000401) |
| 213 | |
| 214 | /** |
| 215 | * Parking brake state. |
| 216 | * @value_type VEHICLE_VALUE_TYPE_BOOLEAN |
| 217 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 218 | * @access VEHICLE_PROP_ACCESS_READ |
| 219 | * @data_member parking_brake |
| 220 | * @data_enum vehicle_boolean |
| 221 | */ |
| 222 | #define VEHICLE_PROPERTY_PARKING_BRAKE_ON (0x00000402) |
| 223 | |
| 224 | /** |
| 225 | * Driving status policy. |
| 226 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 227 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 228 | * @access VEHICLE_PROP_ACCESS_READ |
| 229 | * @data_member driving_status |
| 230 | * @data_enum vehicle_driving_status |
| 231 | */ |
| 232 | #define VEHICLE_PROPERTY_DRIVING_STATUS (0x00000404) |
| 233 | |
| 234 | /** |
| 235 | * Warning for fuel low level. |
| 236 | * @value_type VEHICLE_VALUE_TYPE_BOOLEAN |
| 237 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 238 | * @access VEHICLE_PROP_ACCESS_READ |
| 239 | * @data_member is_fuel_level_low |
| 240 | * @data_enum vehicle_boolean |
| 241 | */ |
| 242 | #define VEHICLE_PROPERTY_FUEL_LEVEL_LOW (0x00000405) |
| 243 | |
| 244 | /** |
| 245 | * Night mode or not. |
| 246 | * @value_type VEHICLE_VALUE_TYPE_BOOLEAN |
| 247 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 248 | * @access VEHICLE_PROP_ACCESS_READ |
| 249 | * @data_member night_mode |
| 250 | * @data_enum vehicle_boolean |
| 251 | */ |
| 252 | #define VEHICLE_PROPERTY_NIGHT_MODE (0x00000407) |
| 253 | |
| 254 | |
| 255 | |
| 256 | //==== HVAC Properties ==== |
| 257 | |
| 258 | /** |
| 259 | * Fan speed setting |
| 260 | * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32 |
| 261 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 262 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 263 | * @data_member hvac.fan_speed |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 264 | * @zone_type VEHICLE_ZONE |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 265 | * @data_enum TODO |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 266 | * @allow_out_of_range_value : OFF |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 267 | */ |
| 268 | #define VEHICLE_PROPERTY_HVAC_FAN_SPEED (0x00000500) |
| 269 | |
| 270 | /** |
| 271 | * Fan direction setting |
| 272 | * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32 |
| 273 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 274 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 275 | * @data_member hvac.fan_direction |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 276 | * @zone_type VEHICLE_ZONE |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 277 | * @data_enum TODO |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 278 | * @allow_out_of_range_value : OFF |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 279 | */ |
| 280 | #define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION (0x00000501) |
| 281 | |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 282 | /* |
| 283 | * Bit flags for fan direction |
| 284 | */ |
Steve Paik | 159349e | 2016-02-09 18:45:58 -0800 | [diff] [blame] | 285 | enum vehicle_hvac_fan_direction { |
| 286 | VEHICLE_HVAC_FAN_DIRECTION_FACE = 0x1, |
| 287 | VEHICLE_HVAC_FAN_DIRECTION_FLOOR = 0x2, |
| 288 | VEHICLE_HVAC_FAN_DIRECTION_FACE_AND_FLOOR = 0x3, |
| 289 | VEHICLE_HVAC_FAN_DIRECTION_DEFROST = 0x4, |
| 290 | VEHICLE_HVAC_FAN_DIRECTION_DEFROST_AND_FLOOR = 0x5 |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 291 | }; |
| 292 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 293 | /** |
| 294 | * HVAC current temperature. |
| 295 | * @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT |
| 296 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 297 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 298 | * @zone_type VEHICLE_ZONE |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 299 | * @data_member hvac.temperature_current |
| 300 | */ |
| 301 | #define VEHICLE_PROPERTY_HVAC_TEMPERATURE_CURRENT (0x00000502) |
| 302 | |
| 303 | /** |
| 304 | * HVAC, target temperature set. |
| 305 | * @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT |
| 306 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 307 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 308 | * @zone_type VEHICLE_ZONE |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 309 | * @data_member hvac.temperature_set |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 310 | * @allow_out_of_range_value : MIN / MAX / OFF |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 311 | */ |
| 312 | #define VEHICLE_PROPERTY_HVAC_TEMPERATURE_SET (0x00000503) |
| 313 | |
| 314 | /** |
| 315 | * On/off defrost |
| 316 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
| 317 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 318 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 319 | * @zone_type VEHICLE_WINDOW |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 320 | * @data_member hvac.defrost_on |
| 321 | */ |
| 322 | #define VEHICLE_PROPERTY_HVAC_DEFROSTER (0x00000504) |
| 323 | |
| 324 | /** |
| 325 | * On/off AC |
| 326 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
| 327 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 328 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 329 | * @config_flags Supported zones |
Keun-young Park | 14f0900 | 2016-01-22 16:29:22 -0800 | [diff] [blame] | 330 | * @zone_type VEHICLE_ZONE |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 331 | * @data_member hvac.ac_on |
| 332 | */ |
| 333 | #define VEHICLE_PROPERTY_HVAC_AC_ON (0x00000505) |
| 334 | |
| 335 | /** |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 336 | * On/off max AC |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 337 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 338 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 339 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 340 | * @zone_type VEHICLE_ZONE |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 341 | * @data_member hvac.max_ac_on |
| 342 | */ |
| 343 | #define VEHICLE_PROPERTY_HVAC_MAX_AC_ON (0x00000506) |
| 344 | |
| 345 | /** |
| 346 | * On/off max defrost |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 347 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 348 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 349 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 350 | * @zone_type VEHICLE_ZONE |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 351 | * @data_member hvac.max_defrost_on |
| 352 | */ |
| 353 | #define VEHICLE_PROPERTY_HVAC_MAX_DEFROST_ON (0x00000507) |
| 354 | |
| 355 | /** |
| 356 | * On/off re-circulation |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 357 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 358 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 359 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 360 | * @zone_type VEHICLE_ZONE |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 361 | * @data_member hvac.max_recirc_on |
| 362 | */ |
| 363 | #define VEHICLE_PROPERTY_HVAC_RECIRC_ON (0x00000508) |
| 364 | |
| 365 | /** |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 366 | * On/off dual. This will be defined per each row. |
| 367 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 368 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 369 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 370 | * @zone_type VEHICLE_ZONE |
Steve Paik | d2ba70f | 2015-12-10 14:58:27 -0800 | [diff] [blame] | 371 | * @data_member hvac.dual_on |
| 372 | */ |
| 373 | #define VEHICLE_PROPERTY_HVAC_DUAL_ON (0x00000509) |
| 374 | |
| 375 | /** |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 376 | * On/off automatic mode |
| 377 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
| 378 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 379 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 380 | * @zone_type VEHICLE_ZONE |
| 381 | */ |
| 382 | #define VEHICLE_PROPERTY_HVAC_AUTO_ON (0x0000050A) |
| 383 | |
| 384 | /** |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 385 | * Represents power state for HVAC. Some HVAC properties will require matching power to be turned on |
| 386 | * to get out of OFF state. For non-zoned HVAC properties, VEHICLE_ALL_ZONE corresponds to |
| 387 | * global power state. |
| 388 | * |
| 389 | * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN |
| 390 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 391 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 392 | * @config_string list of HVAC properties whose power is controlled by this property. Format is |
| 393 | * hexa-decimal number (0x...) separated by comma like "0x500,0x503". All zones |
| 394 | * defined in these affected properties should be available in the property. |
| 395 | * @zone_type VEHICLE_ZONE |
| 396 | * @data_member hvac.power_on |
| 397 | */ |
| 398 | #define VEHICLE_PROPERTY_HVAC_POWER_ON (0x00000510) |
| 399 | |
| 400 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 401 | * Outside temperature |
| 402 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 403 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 404 | * @access VEHICLE_PROP_ACCESS_READ |
| 405 | * @data_member outside_temperature |
| 406 | * @unit VEHICLE_UNIT_TYPE_CELCIUS |
| 407 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 408 | #define VEHICLE_PROPERTY_ENV_OUTSIDE_TEMPERATURE (0x00000703) |
Keun-young Park | cb35450 | 2016-02-08 18:15:55 -0800 | [diff] [blame] | 409 | |
| 410 | |
| 411 | /** |
| 412 | * Cabin temperature |
| 413 | * @value_type VEHICLE_VALUE_TYPE_FLOAT |
| 414 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS |
| 415 | * @access VEHICLE_PROP_ACCESS_READ |
| 416 | * @data_member cabin_temperature |
| 417 | * @unit VEHICLE_UNIT_TYPE_CELCIUS |
| 418 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 419 | #define VEHICLE_PROPERTY_ENV_CABIN_TEMPERATURE (0x00000704) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 420 | |
| 421 | |
| 422 | /* |
| 423 | * Radio features. |
| 424 | */ |
| 425 | /** |
| 426 | * Radio presets stored on the Car radio module. The data type used is int32 |
| 427 | * array with the following fields: |
| 428 | * <ul> |
| 429 | * <li> int32_array[0]: Preset number </li> |
| 430 | * <li> int32_array[1]: Band type (see #RADIO_BAND_FM in |
| 431 | * system/core/include/system/radio.h). |
| 432 | * <li> int32_array[2]: Channel number </li> |
| 433 | * <li> int32_array[3]: Sub channel number </li> |
| 434 | * </ul> |
| 435 | * |
| 436 | * NOTE: When getting a current preset config ONLY set preset number (i.e. |
| 437 | * int32_array[0]). For setting a preset other fields are required. |
| 438 | * |
| 439 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4 |
| 440 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 441 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 442 | * @config_flags Number of presets supported |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 443 | * @data_member int32_array |
| 444 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 445 | #define VEHICLE_PROPERTY_RADIO_PRESET (0x0000801) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 446 | |
| 447 | /** |
| 448 | * Constants relevant to radio. |
| 449 | */ |
| 450 | enum vehicle_radio_consts { |
| 451 | /** Minimum value for the radio preset */ |
| 452 | VEHICLE_RADIO_PRESET_MIN_VALUE = 1, |
| 453 | }; |
| 454 | |
| 455 | /** |
| 456 | * Represents audio focus state of Android side. Note that car's audio module will own audio |
| 457 | * focus and grant audio focus to Android side when requested by Android side. The focus has both |
| 458 | * per stream characteristics and global characteristics. |
| 459 | * |
| 460 | * Focus request (get of this property) will take the following form in int32_vec4: |
Keun-young Park | 08c255e | 2015-12-09 13:47:30 -0800 | [diff] [blame] | 461 | * int32_array[0]: vehicle_audio_focus_request type |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 462 | * int32_array[1]: bit flags of streams requested by this focus request. There can be up to |
| 463 | * 32 streams. |
| 464 | * int32_array[2]: External focus state flags. For request, only flag like |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 465 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG or |
| 466 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be used. |
| 467 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG is for case like radio where android |
| 468 | * side app still needs to hold focus but playback is done outside Android. |
| 469 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG is for muting media channel |
| 470 | * including radio. VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be set even |
| 471 | * if android side releases focus (request type REQUEST_RELEASE). In that case, |
| 472 | * audio module should maintain mute state until user's explicit action to |
| 473 | * play some media. |
Keun-young Park | 637fb20 | 2016-03-29 09:52:41 -0700 | [diff] [blame] | 474 | * int32_array[3]: Currently active audio contexts. Use combination of flags from |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 475 | * vehicle_audio_context_flag. |
| 476 | * This can be used as a hint to adjust audio policy or other policy decision. |
| 477 | * Note that there can be multiple context active at the same time. And android |
| 478 | * can send the same focus request type gain due to change in audio contexts. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 479 | * Note that each focus request can request multiple streams that is expected to be used for |
| 480 | * the current request. But focus request itself is global behavior as GAIN or GAIN_TRANSIENT |
| 481 | * expects all sounds played by car's audio module to stop. Note that stream already allocated to |
| 482 | * android before this focus request should not be affected by focus request. |
| 483 | * |
| 484 | * Focus response (set and subscription callback for this property) will take the following form: |
Keun-young Park | 08c255e | 2015-12-09 13:47:30 -0800 | [diff] [blame] | 485 | * int32_array[0]: vehicle_audio_focus_state type |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 486 | * int32_array[1]: bit flags of streams allowed. |
| 487 | * int32_array[2]: External focus state: bit flags of currently active audio focus in car |
| 488 | * side (outside Android). Active audio focus does not necessarily mean currently |
| 489 | * playing, but represents the state of having focus or waiting for focus |
| 490 | * (pause state). |
| 491 | * One or combination of flags from vehicle_audio_ext_focus_flag. |
| 492 | * 0 means no active audio focus holder outside Android. |
| 493 | * The state will have following values for each vehicle_audio_focus_state_type: |
| 494 | * GAIN: 0 or VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY when radio is active in |
| 495 | * Android side. |
| 496 | * GAIN_TRANSIENT: 0. Can be VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT or |
| 497 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT if android side has requested |
| 498 | * GAIN_TRANSIENT_MAY_DUCK and car side is ducking. |
| 499 | * LOSS: 0 when no focus is audio is active in car side. |
| 500 | * VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT when car side is playing something |
| 501 | * permanent. |
| 502 | * LOSS_TRANSIENT: always should be VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 503 | * int32_array[3]: should be zero. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 504 | * |
Keun-young Park | 254dbce | 2016-03-28 09:37:04 -0700 | [diff] [blame] | 505 | * A focus response should be sent per each focus request even if there is no change in |
| 506 | * focus state. This can happen in case like focus request only involving context change |
| 507 | * where android side still needs matching focus response to confirm that audio module |
| 508 | * has made necessary changes. |
| 509 | * |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 510 | * If car does not support VEHICLE_PROPERTY_AUDIO_FOCUS, focus is assumed to be granted always. |
| 511 | * |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 512 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4 |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 513 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 514 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 515 | * @data_member int32_array |
| 516 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 517 | #define VEHICLE_PROPERTY_AUDIO_FOCUS (0x00000900) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 518 | |
| 519 | enum vehicle_audio_focus_request { |
| 520 | VEHICLE_AUDIO_FOCUS_REQUEST_GAIN = 0x1, |
| 521 | VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT = 0x2, |
| 522 | VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_MAY_DUCK = 0x3, |
Keun-young Park | cb35450 | 2016-02-08 18:15:55 -0800 | [diff] [blame] | 523 | /** |
| 524 | * This is for the case where android side plays sound like UI feedback |
| 525 | * and car side does not need to duck existing playback as long as |
| 526 | * requested stream is available. |
| 527 | */ |
| 528 | VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_NO_DUCK = 0x4, |
| 529 | VEHICLE_AUDIO_FOCUS_REQUEST_RELEASE = 0x5, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 530 | }; |
| 531 | |
| 532 | enum vehicle_audio_focus_state { |
| 533 | /** |
| 534 | * Android side has permanent focus and can play allowed streams. |
| 535 | */ |
| 536 | VEHICLE_AUDIO_FOCUS_STATE_GAIN = 0x1, |
| 537 | /** |
| 538 | * Android side has transient focus and can play allowed streams. |
| 539 | */ |
| 540 | VEHICLE_AUDIO_FOCUS_STATE_GAIN_TRANSIENT = 0x2, |
| 541 | /** |
| 542 | * Car audio module is playing guidance kind of sound outside Android. Android side can |
| 543 | * still play through allowed streams with ducking. |
| 544 | */ |
| 545 | VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_CAN_DUCK = 0x3, |
| 546 | /** |
| 547 | * Car audio module is playing transient sound outside Android. Android side should stop |
| 548 | * playing any sounds. |
| 549 | */ |
| 550 | VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT = 0x4, |
| 551 | /** |
| 552 | * Android side has lost focus and cannot play any sound. |
| 553 | */ |
| 554 | VEHICLE_AUDIO_FOCUS_STATE_LOSS = 0x5, |
| 555 | /** |
| 556 | * car audio module is playing safety critical sound, and Android side cannot request focus |
| 557 | * until the current state is finished. car audio module should restore it to the previous |
| 558 | * state when it can allow Android to play. |
| 559 | */ |
| 560 | VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_EXLCUSIVE = 0x6, |
| 561 | }; |
| 562 | |
| 563 | /** |
| 564 | * Flags to represent multiple streams by combining these. |
| 565 | */ |
| 566 | enum vehicle_audio_stream_flag { |
| 567 | VEHICLE_AUDIO_STREAM_STREAM0_FLAG = (0x1<<0), |
| 568 | VEHICLE_AUDIO_STREAM_STREAM1_FLAG = (0x1<<1), |
| 569 | VEHICLE_AUDIO_STREAM_STREAM2_FLAG = (0x1<<2), |
| 570 | }; |
| 571 | |
| 572 | /** |
| 573 | * Represents stream number (always 0 to N -1 where N is max number of streams). |
| 574 | * Can be used for audio related property expecting one stream. |
| 575 | */ |
| 576 | enum vehicle_audio_stream { |
| 577 | VEHICLE_AUDIO_STREAM0 = 0, |
| 578 | VEHICLE_AUDIO_STREAM1 = 1, |
| 579 | }; |
| 580 | |
| 581 | /** |
| 582 | * Flag to represent external focus state (outside Android). |
| 583 | */ |
| 584 | enum vehicle_audio_ext_focus_flag { |
| 585 | /** |
| 586 | * No external focus holder. |
| 587 | */ |
| 588 | VEHICLE_AUDIO_EXT_FOCUS_NONE_FLAG = 0x0, |
| 589 | /** |
| 590 | * Car side (outside Android) has component holding GAIN kind of focus state. |
| 591 | */ |
| 592 | VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT_FLAG = 0x1, |
| 593 | /** |
| 594 | * Car side (outside Android) has component holding GAIN_TRANSIENT kind of focus state. |
| 595 | */ |
| 596 | VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT_FLAG = 0x2, |
| 597 | /** |
| 598 | * Car side is expected to play something while focus is held by Android side. One example |
| 599 | * can be radio attached in car side. But Android's radio app still should have focus, |
| 600 | * and Android side should be in GAIN state, but media stream will not be allocated to Android |
| 601 | * side and car side can play radio any time while this flag is active. |
| 602 | */ |
| 603 | VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG = 0x4, |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 604 | /** |
| 605 | * Car side should mute any media including radio. This can be used with any focus request |
| 606 | * including GAIN* and RELEASE. |
| 607 | */ |
| 608 | VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG = 0x8, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 609 | }; |
| 610 | |
| 611 | /** |
| 612 | * Index in int32_array for VEHICLE_PROPERTY_AUDIO_FOCUS property. |
| 613 | */ |
| 614 | enum vehicle_audio_focus_index { |
| 615 | VEHICLE_AUDIO_FOCUS_INDEX_FOCUS = 0, |
| 616 | VEHICLE_AUDIO_FOCUS_INDEX_STREAMS = 1, |
| 617 | VEHICLE_AUDIO_FOCUS_INDEX_EXTERNAL_FOCUS_STATE = 2, |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 618 | VEHICLE_AUDIO_FOCUS_INDEX_AUDIO_CONTEXTS = 3, |
| 619 | }; |
| 620 | |
| 621 | /** |
| 622 | * Flags to tell the current audio context. |
| 623 | */ |
| 624 | enum vehicle_audio_context_flag { |
| 625 | /** Music playback is currently active. */ |
| 626 | VEHICLE_AUDIO_CONTEXT_MUSIC_FLAG = 0x1, |
| 627 | /** Navigation is currently running. */ |
| 628 | VEHICLE_AUDIO_CONTEXT_NAVIGATION_FLAG = 0x2, |
| 629 | /** Voice command session is currently running. */ |
| 630 | VEHICLE_AUDIO_CONTEXT_VOICE_COMMAND_FLAG = 0x4, |
| 631 | /** Voice call is currently active. */ |
| 632 | VEHICLE_AUDIO_CONTEXT_CALL_FLAG = 0x8, |
| 633 | /** Alarm is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY. */ |
| 634 | VEHICLE_AUDIO_CONTEXT_ALARM_FLAG = 0x10, |
| 635 | /** |
| 636 | * Notification sound is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY. |
| 637 | */ |
| 638 | VEHICLE_AUDIO_CONTEXT_NOTIFICATION_FLAG = 0x20, |
| 639 | /** |
| 640 | * Context unknown. Only used for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY to represent default |
| 641 | * stream for unknown contents. |
| 642 | */ |
| 643 | VEHICLE_AUDIO_CONTEXT_UNKNOWN_FLAG = 0x40, |
| 644 | /** Safety alert / warning is played. */ |
| 645 | VEHICLE_AUDIO_CONTEXT_SAFETY_ALERT_FLAG = 0x80, |
| 646 | /** CD / DVD kind of audio is played */ |
Keun-young Park | 9f376f5 | 2016-03-03 17:47:18 -0800 | [diff] [blame] | 647 | VEHICLE_AUDIO_CONTEXT_CD_ROM_FLAG = 0x100, |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 648 | /** Aux audio input is played */ |
Keun-young Park | 9f376f5 | 2016-03-03 17:47:18 -0800 | [diff] [blame] | 649 | VEHICLE_AUDIO_CONTEXT_AUX_AUDIO_FLAG = 0x200, |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 650 | /** system sound like UI feedback */ |
Keun-young Park | 9f376f5 | 2016-03-03 17:47:18 -0800 | [diff] [blame] | 651 | VEHICLE_AUDIO_CONTEXT_SYSTEM_SOUND_FLAG = 0x400, |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 652 | /** Radio is played */ |
Keun-young Park | 9f376f5 | 2016-03-03 17:47:18 -0800 | [diff] [blame] | 653 | VEHICLE_AUDIO_CONTEXT_RADIO_FLAG = 0x800, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 654 | }; |
| 655 | |
| 656 | /** |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 657 | * Property to control audio volume of each audio context. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 658 | * |
Keun-young Park | 12a3c01 | 2016-03-23 17:58:29 -0700 | [diff] [blame] | 659 | * vehicle_prop_config_t |
| 660 | * config_array[0] : bit flags of all supported audio contexts. If this is 0, |
| 661 | * audio volume is controlled per physical stream |
| 662 | * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to |
| 663 | * represent audio module's capability. |
| 664 | * |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 665 | * Data type looks like: |
Keun-young Park | 12a3c01 | 2016-03-23 17:58:29 -0700 | [diff] [blame] | 666 | * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical |
| 667 | stream is supported (config_array[0] == 0), this will represent physical |
| 668 | stream number. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 669 | * int32_array[1] : volume level, valid range is 0 to int32_max_value defined in config. |
| 670 | * 0 will be mute state. int32_min_value in config should be always 0. |
| 671 | * int32_array[2] : One of vehicle_audio_volume_state. |
| 672 | * |
| 673 | * This property requires per stream based get. HAL implementation should check stream number |
| 674 | * in get call to return the right volume. |
| 675 | * |
| 676 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC3 |
| 677 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 678 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 679 | * @config_flags all audio contexts supported. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 680 | * @data_member int32_array |
| 681 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 682 | #define VEHICLE_PROPERTY_AUDIO_VOLUME (0x00000901) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 683 | |
Keun-young Park | 12a3c01 | 2016-03-23 17:58:29 -0700 | [diff] [blame] | 684 | |
| 685 | /** |
| 686 | * flags to represent capability of audio volume property. |
| 687 | * used in config_array[1] of vehicle_prop_config_t. |
| 688 | */ |
| 689 | enum vehicle_audio_volume_capability_flag { |
| 690 | /** |
| 691 | * External audio module or vehicle hal has persistent storage |
| 692 | * to keep the volume level. This should be set only when per context |
| 693 | * volume level is supproted. When this is set, audio volume level per |
| 694 | * each context will be retrieved from the property when systen starts up. |
| 695 | * And external audio module is also expected to adjust volume automatically |
| 696 | * whenever there is an audio context change. |
| 697 | * When this flag is not set, android side will assume that there is no |
| 698 | * persistent storage and stored value in android side will be used to |
| 699 | * initialize the volume level. And android side will set volume level |
| 700 | * of each physical streams whenever there is an audio context change. |
| 701 | */ |
| 702 | VEHICLE_AUDIO_VOLUME_CAPABILITY_PERSISTENT_STORAGE = 0x1, |
| 703 | }; |
| 704 | |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 705 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 706 | /** |
| 707 | * enum to represent audio volume state. |
| 708 | */ |
| 709 | enum vehicle_audio_volume_state { |
| 710 | VEHICLE_AUDIO_VOLUME_STATE_OK = 0, |
| 711 | /** |
| 712 | * Audio volume has reached volume limit set in VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT |
| 713 | * and user's request to increase volume further is not allowed. |
| 714 | */ |
| 715 | VEHICLE_AUDIO_VOLUME_STATE_LIMIT_REACHED = 1, |
| 716 | }; |
| 717 | |
| 718 | /** |
| 719 | * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME property. |
| 720 | */ |
| 721 | enum vehicle_audio_volume_index { |
| 722 | VEHICLE_AUDIO_VOLUME_INDEX_STREAM = 0, |
| 723 | VEHICLE_AUDIO_VOLUME_INDEX_VOLUME = 1, |
| 724 | VEHICLE_AUDIO_VOLUME_INDEX_STATE = 2, |
| 725 | }; |
| 726 | |
| 727 | /** |
| 728 | * Property for handling volume limit set by user. This limits maximum volume that can be set |
Keun-young Park | 12a3c01 | 2016-03-23 17:58:29 -0700 | [diff] [blame] | 729 | * per each context or physical stream. |
| 730 | * |
| 731 | * vehicle_prop_config_t |
| 732 | * config_array[0] : bit flags of all supported audio contexts. If this is 0, |
| 733 | * audio volume is controlled per physical stream |
| 734 | * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to |
| 735 | * represent audio module's capability. |
| 736 | * |
| 737 | * Data type looks like: |
| 738 | * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical |
| 739 | * stream is supported (config_array[0] == 0), this will represent physical |
| 740 | * stream number. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 741 | * int32_array[1] : maximum volume set to the stream. If there is no restriction, this value |
| 742 | * will be bigger than VEHICLE_PROPERTY_AUDIO_VOLUME's max value. |
| 743 | * |
| 744 | * If car does not support this feature, this property should not be populated by HAL. |
| 745 | * This property requires per stream based get. HAL implementation should check stream number |
| 746 | * in get call to return the right volume. |
| 747 | * |
| 748 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2 |
| 749 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 750 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 751 | * @config_flags all audio contexts supported. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 752 | * @data_member int32_array |
| 753 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 754 | #define VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT (0x00000902) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 755 | |
| 756 | /** |
| 757 | * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT property. |
| 758 | */ |
| 759 | enum vehicle_audio_volume_limit_index { |
| 760 | VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_STREAM = 0, |
| 761 | VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_MAX_VOLUME = 1, |
| 762 | }; |
| 763 | |
| 764 | /** |
| 765 | * Property to share audio routing policy of android side. This property is set at the beginning |
| 766 | * to pass audio policy in android side down to vehicle HAL and car audio module. |
| 767 | * This can be used as a hint to adjust audio policy or other policy decision. |
| 768 | * |
| 769 | * int32_array[0] : audio stream where the audio for the application context will be routed |
| 770 | * by default. Note that this is the default setting from system, but each app |
| 771 | * may still use different audio stream for whatever reason. |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 772 | * int32_array[1] : All audio contexts that will be sent through the physical stream. Flag |
| 773 | * is defined in vehicle_audio_context_flag. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 774 | |
| 775 | * Setting of this property will be done for all available physical streams based on audio H/W |
| 776 | * variant information acquired from VEHICLE_PROPERTY_AUDIO_HW_VARIANT property. |
| 777 | * |
| 778 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2 |
| 779 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 780 | * @access VEHICLE_PROP_ACCESS_WRITE |
| 781 | * @data_member int32_array |
| 782 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 783 | #define VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY (0x00000903) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 784 | |
| 785 | /** |
| 786 | * Index in int32_array for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY property. |
| 787 | */ |
| 788 | enum vehicle_audio_routing_policy_index { |
| 789 | VEHICLE_AUDIO_ROUTING_POLICY_INDEX_STREAM = 0, |
| 790 | VEHICLE_AUDIO_ROUTING_POLICY_INDEX_CONTEXTS = 1, |
| 791 | }; |
| 792 | |
| 793 | /** |
| 794 | * Property to return audio H/W variant type used in this car. This allows android side to |
| 795 | * support different audio policy based on H/W variant used. Note that other components like |
| 796 | * CarService may need overlay update to support additional variants. If this property does not |
| 797 | * exist, default audio policy will be used. |
| 798 | * |
| 799 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 800 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 801 | * @access VEHICLE_PROP_ACCESS_READ |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 802 | * @config_flags Additional info on audio H/W. Should use vehicle_audio_hw_variant_config_flag for |
| 803 | * this. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 804 | * @data_member int32_value |
| 805 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 806 | #define VEHICLE_PROPERTY_AUDIO_HW_VARIANT (0x00000904) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 807 | |
| 808 | /** |
| 809 | * Flag to be used in vehicle_prop_config.config_flags for VEHICLE_PROPERTY_AUDIO_HW_VARIANT. |
| 810 | */ |
| 811 | enum vehicle_audio_hw_variant_config_flag { |
| 812 | /** |
Keun-young Park | 637fb20 | 2016-03-29 09:52:41 -0700 | [diff] [blame] | 813 | * Flag to tell that radio is internal to android and radio should |
| 814 | * be treated like other android stream like media. |
| 815 | * When this flag is not set or AUDIO_HW_VARIANT does not exist, |
| 816 | * radio is treated as external module. This brins some delta in audio focus |
| 817 | * handling as well. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 818 | */ |
Keun-young Park | 637fb20 | 2016-03-29 09:52:41 -0700 | [diff] [blame] | 819 | VEHICLE_AUDIO_HW_VARIANT_FLAG_INTERNAL_RADIO_FLAG = 0x1, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 820 | }; |
| 821 | |
Keun-young Park | cb8c887 | 2016-01-08 09:41:19 -0800 | [diff] [blame] | 822 | |
| 823 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 824 | * Property to control power state of application processor. |
| 825 | * |
| 826 | * It is assumed that AP's power state is controller by separate power controller. |
| 827 | * |
| 828 | * For configuration information, vehicle_prop_config.config_flags can have bit flag combining |
| 829 | * values in vehicle_ap_power_state_config_type. |
| 830 | * |
| 831 | * For get / notification, data type looks like this: |
| 832 | * int32_array[0] : vehicle_ap_power_state_type |
| 833 | * int32_array[1] : additional parameter relevant for each state. should be 0 if not used. |
| 834 | * For set, data type looks like this: |
| 835 | * int32_array[0] : vehicle_ap_power_state_set_type |
| 836 | * int32_array[1] : additional parameter relevant for each request. should be 0 if not used. |
| 837 | * |
| 838 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2 |
| 839 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 840 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 841 | * @config_flags Additional info on power state. Should use vehicle_ap_power_state_config_flag. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 842 | * @data_member int32_array |
| 843 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 844 | #define VEHICLE_PROPERTY_AP_POWER_STATE (0x00000A00) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 845 | |
| 846 | enum vehicle_ap_power_state_config_flag { |
| 847 | /** |
| 848 | * AP can enter deep sleep state. If not set, AP will always shutdown from |
| 849 | * VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE power state. |
| 850 | */ |
| 851 | VEHICLE_AP_POWER_STATE_CONFIG_ENABLE_DEEP_SLEEP_FLAG = 0x1, |
| 852 | |
| 853 | /** |
| 854 | * The power controller can power on AP from off state after timeout specified in |
| 855 | * VEHICLE_AP_POWER_SET_SHUTDOWN_READY message. |
| 856 | */ |
| 857 | VEHICLE_AP_POWER_STATE_CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2, |
| 858 | }; |
| 859 | |
| 860 | enum vehicle_ap_power_state { |
| 861 | /** vehicle HAL will never publish this state to AP */ |
| 862 | VEHICLE_AP_POWER_STATE_OFF = 0, |
| 863 | /** vehicle HAL will never publish this state to AP */ |
| 864 | VEHICLE_AP_POWER_STATE_DEEP_SLEEP = 1, |
| 865 | /** AP is on but display should be off. */ |
| 866 | VEHICLE_AP_POWER_STATE_ON_DISP_OFF = 2, |
| 867 | /** AP is on with display on. This state allows full user interaction. */ |
| 868 | VEHICLE_AP_POWER_STATE_ON_FULL = 3, |
| 869 | /** |
| 870 | * The power controller has requested AP to shutdown. AP can either enter sleep state or start |
| 871 | * full shutdown. AP can also request postponing shutdown by sending |
| 872 | * VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE message. The power controller should change power |
| 873 | * state to this state to shutdown system. |
| 874 | * |
| 875 | * int32_array[1] : one of enum_vehicle_ap_power_state_shutdown_param_type |
| 876 | */ |
| 877 | VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE = 4, |
| 878 | }; |
| 879 | |
| 880 | enum vehicle_ap_power_state_shutdown_param { |
| 881 | /** AP should shutdown immediately. Postponing is not allowed. */ |
| 882 | VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_IMMEDIATELY = 1, |
| 883 | /** AP can enter deep sleep instead of shutting down completely. */ |
| 884 | VEHICLE_AP_POWER_SHUTDOWN_PARAM_CAN_SLEEP = 2, |
| 885 | /** AP can only shutdown with postponing allowed. */ |
| 886 | VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_ONLY = 3, |
| 887 | }; |
| 888 | |
| 889 | enum vehicle_ap_power_set_state { |
| 890 | /** |
| 891 | * AP has finished boot up, and can start shutdown if requested by power controller. |
| 892 | */ |
| 893 | VEHICLE_AP_POWER_SET_BOOT_COMPLETE = 0x1, |
| 894 | /** |
| 895 | * AP is entering deep sleep state. How this state is implemented may vary depending on |
| 896 | * each H/W, but AP's power should be kept in this state. |
| 897 | */ |
| 898 | VEHICLE_AP_POWER_SET_DEEP_SLEEP_ENTRY = 0x2, |
| 899 | /** |
| 900 | * AP is exiting from deep sleep state, and is in VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE state. |
| 901 | * The power controller may change state to other ON states based on the current state. |
| 902 | */ |
| 903 | VEHICLE_AP_POWER_SET_DEEP_SLEEP_EXIT = 0x3, |
| 904 | /** |
| 905 | * int32_array[1]: Time to postpone shutdown in ms. Maximum value can be 5000 ms. |
| 906 | * If AP needs more time, it will send another POSTPONE message before |
| 907 | * the previous one expires. |
| 908 | */ |
| 909 | VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE = 0x4, |
| 910 | /** |
| 911 | * AP is starting shutting down. When system completes shutdown, everything will stop in AP |
| 912 | * as kernel will stop all other contexts. It is responsibility of vehicle HAL or lower level |
| 913 | * to synchronize that state with external power controller. As an example, some kind of ping |
| 914 | * with timeout in power controller can be a solution. |
| 915 | * |
| 916 | * int32_array[1]: Time to turn on AP in secs. Power controller may turn on AP after specified |
| 917 | * time so that AP can run tasks like update. If it is set to 0, there is no |
| 918 | * wake up, and power controller may not necessarily support wake-up. |
| 919 | * If power controller turns on AP due to timer, it should start with |
| 920 | * VEHICLE_AP_POWER_STATE_ON_DISP_OFF state, and after receiving |
| 921 | * VEHICLE_AP_POWER_SET_BOOT_COMPLETE, it shall do state transition to |
| 922 | * VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE. |
| 923 | */ |
| 924 | VEHICLE_AP_POWER_SET_SHUTDOWN_START = 0x5, |
| 925 | /** |
| 926 | * User has requested to turn off headunit's display, which is detected in android side. |
| 927 | * The power controller may change the power state to VEHICLE_AP_POWER_STATE_ON_DISP_OFF. |
| 928 | */ |
| 929 | VEHICLE_AP_POWER_SET_DISPLAY_OFF = 0x6, |
| 930 | /** |
| 931 | * User has requested to turn on headunit's display, most probably from power key input which |
| 932 | * is attached to headunit. The power controller may change the power state to |
| 933 | * VEHICLE_AP_POWER_STATE_ON_FULL. |
| 934 | */ |
| 935 | VEHICLE_AP_POWER_SET_DISPLAY_ON = 0x7, |
| 936 | }; |
| 937 | |
| 938 | /** |
| 939 | * Property to represent brightness of the display. Some cars have single control for |
| 940 | * the brightness of all displays and this property is to share change in that control. |
| 941 | * |
| 942 | * If this is writable, android side can set this value when user changes display brightness |
| 943 | * from Settings. If this is read only, user may still change display brightness from Settings, |
| 944 | * but that will not be reflected to other displays. |
| 945 | * |
| 946 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 947 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 948 | * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_READ_WRITE |
| 949 | * @data_member int32 |
| 950 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 951 | #define VEHICLE_PROPERTY_DISPLAY_BRIGHTNESS (0x00000A01) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 952 | |
| 953 | |
| 954 | /** |
| 955 | * Index in int32_array for VEHICLE_PROPERTY_AP_POWER_STATE property. |
| 956 | */ |
| 957 | enum vehicle_ap_power_state_index { |
| 958 | VEHICLE_AP_POWER_STATE_INDEX_STATE = 0, |
| 959 | VEHICLE_AP_POWER_STATE_INDEX_ADDITIONAL = 1, |
| 960 | }; |
| 961 | |
| 962 | /** |
| 963 | * Property to report bootup reason for the current power on. This is a static property that will |
| 964 | * not change for the whole duration until power off. For example, even if user presses power on |
| 965 | * button after automatic power on with door unlock, bootup reason should stay with |
| 966 | * VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK. |
| 967 | * |
| 968 | * int32_value should be vehicle_ap_power_bootup_reason. |
| 969 | * |
| 970 | * @value_type VEHICLE_VALUE_TYPE_INT32 |
| 971 | * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC |
| 972 | * @access VEHICLE_PROP_ACCESS_READ |
| 973 | * @data_member int32_value |
| 974 | */ |
| 975 | #define VEHICLE_PROPERTY_AP_POWER_BOOTUP_REASON (0x00000A02) |
| 976 | |
| 977 | /** |
| 978 | * Enum to represent bootup reason. |
| 979 | */ |
| 980 | enum vehicle_ap_power_bootup_reason { |
| 981 | /** |
| 982 | * Power on due to user's pressing of power key or rotating of ignition switch. |
| 983 | */ |
| 984 | VEHICLE_AP_POWER_BOOTUP_REASON_USER_POWER_ON = 0, |
| 985 | /** |
| 986 | * Automatic power on triggered by door unlock or any other kind of automatic user detection. |
| 987 | */ |
| 988 | VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK = 1, |
| 989 | /** |
| 990 | * Automatic power on triggered by timer. This only happens when AP has asked wake-up after |
| 991 | * certain time through time specified in VEHICLE_AP_POWER_SET_SHUTDOWN_START. |
| 992 | */ |
| 993 | VEHICLE_AP_POWER_BOOTUP_REASON_TIMER = 2, |
| 994 | }; |
| 995 | |
Keun-young Park | cb35450 | 2016-02-08 18:15:55 -0800 | [diff] [blame] | 996 | |
| 997 | /** |
| 998 | * Property to feed H/W input events to android |
| 999 | * |
| 1000 | * int32_array[0] : action defined by vehicle_hw_key_input_action |
| 1001 | * int32_array[1] : key code, should use standard android key code |
| 1002 | * int32_array[2] : target display defined in vehicle_display. Events not tied |
| 1003 | * to specific display should be sent to DISPLAY_MAIN. |
| 1004 | * int32_array[3] : reserved for now. should be zero |
| 1005 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4 |
| 1006 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1007 | * @access VEHICLE_PROP_ACCESS_READ |
| 1008 | * @config_flags |
| 1009 | * @data_member int32_array |
| 1010 | */ |
| 1011 | #define VEHICLE_PROPERTY_HW_KEY_INPUT (0x00000A10) |
| 1012 | |
| 1013 | enum vehicle_hw_key_input_action { |
| 1014 | /** Key down */ |
| 1015 | VEHICLE_HW_KEY_INPUT_ACTION_DOWN = 0, |
| 1016 | /** Key up */ |
| 1017 | VEHICLE_HW_KEY_INPUT_ACTION_UP = 1, |
| 1018 | }; |
| 1019 | |
| 1020 | enum vehicle_display { |
| 1021 | /** center console */ |
| 1022 | VEHICLE_DISPLAY_MAIN = 0, |
| 1023 | VEHICLE_DISPLAY_INSTRUMENT_CLUSTER = 1, |
| 1024 | }; |
| 1025 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1026 | /** |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1027 | * Property to define instrument cluster information. |
| 1028 | * For CLUSTER_TYPE_EXTERNAL_DISPLAY: |
| 1029 | * READ: |
| 1030 | * int32_array[0] : The current screen mode index. Screen mode is defined |
| 1031 | * as a configuration in car service and represents which |
| 1032 | * area of screen is renderable. |
| 1033 | * int32_array[1] : Android can render to instrument cluster (=1) or not(=0). When this is 0, |
| 1034 | * instrument cluster may be rendering some information in the area |
| 1035 | * allocated for android and android side rendering is invisible. * |
| 1036 | * int32_array[2..3] : should be zero |
| 1037 | * WRITE from android: |
| 1038 | * int32_array[0] : Preferred mode for android side. Depending on the app rendering to instrument |
| 1039 | * cluster, preferred mode can change. Instrument cluster still needs to send |
| 1040 | * event with new mode to trigger actual mode change. |
| 1041 | * int32_array[1] : The current app context relevant for instrument cluster. Use the same flag |
| 1042 | * with vehicle_audio_context_flag but this context represents active apps, not |
| 1043 | * active audio. Instrument cluster side may change mode depending on the |
| 1044 | * currently active contexts. |
| 1045 | * int32_array[2..3] : should be zero |
| 1046 | * When system boots up, Android side will write {0, 0, 0, 0} when it is ready to render to |
| 1047 | * instrument cluster. Before this message, rendering from android should not be visible in the |
| 1048 | * cluster. |
| 1049 | * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4 |
| 1050 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1051 | * @access VEHICLE_PROP_ACCESS_READ_WRITE |
| 1052 | * @config_array 0:vehicle_instument_cluster_type 1:hw type |
| 1053 | * @data_member int32_array |
| 1054 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1055 | #define VEHICLE_PROPERTY_INSTRUMENT_CLUSTER_INFO (0x00000A20) |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1056 | |
| 1057 | /** |
| 1058 | * Represents instrument cluster type available in system |
| 1059 | */ |
| 1060 | enum vehicle_instument_cluster_type { |
| 1061 | /** Android has no access to instument cluster */ |
| 1062 | VEHICLE_INSTRUMENT_CLUSTER_TYPE_NONE = 0, |
| 1063 | /** |
| 1064 | * Instrument cluster can communicate through vehicle hal with additional |
| 1065 | * properties to exchange meta-data |
| 1066 | */ |
| 1067 | VEHICLE_INSTRUMENT_CLUSTER_TYPE_HAL_INTERFACE = 1, |
| 1068 | /** |
| 1069 | * Instrument cluster is external display where android can render contents |
| 1070 | */ |
| 1071 | VEHICLE_INSTRUMENT_CLUSTER_TYPE_EXTERNAL_DISPLAY = 2, |
| 1072 | }; |
| 1073 | |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1074 | |
| 1075 | /** |
| 1076 | * Seat temperature |
| 1077 | * |
| 1078 | * Negative values indicate cooling. |
| 1079 | * 0 indicates off. |
| 1080 | * Positive values indicate heating. |
| 1081 | * |
| 1082 | * Some vehicles may have multiple levels of heating and cooling. The min/max |
| 1083 | * range defines the allowable range and number of steps in each direction. |
| 1084 | * |
| 1085 | * @value_type VEHICLE_VALUE_TYPE_ZONED_INT |
| 1086 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1087 | * @access VEHICLE_PROP_ACCESS_WRITE |
| 1088 | * @zone_type VEHICLE_SEAT |
| 1089 | */ |
| 1090 | #define VEHICLE_PROPERTY_SEAT_TEMPERATURE (0x00000B00) |
| 1091 | |
| 1092 | /** |
| 1093 | * Seat memory |
| 1094 | * |
| 1095 | * This parameter selects the memory preset to use to select the seat position. |
| 1096 | * The minValue is always 0, and the maxValue determines the number of seat |
| 1097 | * positions available. |
| 1098 | * |
| 1099 | * For instance, if the driver's seat has 3 memory presets, the maxValue will be 3. |
| 1100 | * When the user wants to select a preset, the desired preset number (1, 2, or 3) |
| 1101 | * is set. |
| 1102 | * |
| 1103 | * @value_type VEHICLE_VALUE_TYPE_ZONED_INT |
| 1104 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1105 | * @access VEHICLE_PROP_ACCESS_WRITE |
| 1106 | * @zone_type VEHICLE_SEAT |
| 1107 | */ |
| 1108 | #define VEHICLE_PROPERTY_SEAT_MEMORY_SELECT (0x00000B01) |
| 1109 | |
| 1110 | /** |
| 1111 | * Seat memory set |
| 1112 | * |
| 1113 | * This setting allows the user to save the current seat position settings into |
| 1114 | * the selected preset slot. The maxValue for each seat position shall match |
| 1115 | * the maxValue for VEHICLE_PROPERTY_SEAT_MEMORY_SELECT. |
| 1116 | * |
| 1117 | * @value_type VEHICLE_VALUE_TYPE_ZONED_INT |
| 1118 | * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1119 | * @access VEHICLE_PROP_ACCESS_WRITE |
| 1120 | * @zone_type VEHICLE_SEAT |
| 1121 | */ |
| 1122 | #define VEHICLE_PROPERTY_SEAT_MEMORY_SET (0x00000B02) |
| 1123 | |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1124 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1125 | * H/W specific, non-standard property can be added as necessary. Such property should use |
| 1126 | * property number in range of [VEHICLE_PROPERTY_CUSTOM_START, VEHICLE_PROPERTY_CUSTOM_END]. |
| 1127 | * Definition of property in this range is completely up to each HAL implementation. |
| 1128 | * For such property, it is recommended to fill vehicle_prop_config.config_string with some |
| 1129 | * additional information to help debugging. For example, company XYZ's custom extension may |
| 1130 | * include config_string of "com.XYZ.some_further_details". |
| 1131 | * @range_start |
| 1132 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1133 | #define VEHICLE_PROPERTY_CUSTOM_START (0x70000000) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1134 | /** @range_end */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1135 | #define VEHICLE_PROPERTY_CUSTOM_END (0x73ffffff) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1136 | |
| 1137 | /** |
| 1138 | * Property range allocated for system's internal usage like testing. HAL should never declare |
| 1139 | * property in this range. |
| 1140 | * @range_start |
| 1141 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1142 | #define VEHICLE_PROPERTY_INTERNAL_START (0x74000000) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1143 | /** |
| 1144 | * @range_end |
| 1145 | */ |
Steve Paik | cc9e292 | 2016-04-21 11:40:17 -0700 | [diff] [blame^] | 1146 | #define VEHICLE_PROPERTY_INTERNAL_END (0x74ffffff) |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1147 | |
| 1148 | /** |
| 1149 | * Value types for various properties. |
| 1150 | */ |
| 1151 | enum vehicle_value_type { |
| 1152 | VEHICLE_VALUE_TYPE_SHOUD_NOT_USE = 0x00, // value_type should never set to 0. |
| 1153 | VEHICLE_VALUE_TYPE_STRING = 0x01, |
| 1154 | VEHICLE_VALUE_TYPE_BYTES = 0x02, |
| 1155 | VEHICLE_VALUE_TYPE_BOOLEAN = 0x03, |
Keun-young Park | 73d7f22 | 2016-01-14 11:02:38 -0800 | [diff] [blame] | 1156 | VEHICLE_VALUE_TYPE_ZONED_BOOLEAN = 0x04, |
| 1157 | VEHICLE_VALUE_TYPE_INT64 = 0x05, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1158 | VEHICLE_VALUE_TYPE_FLOAT = 0x10, |
| 1159 | VEHICLE_VALUE_TYPE_FLOAT_VEC2 = 0x11, |
| 1160 | VEHICLE_VALUE_TYPE_FLOAT_VEC3 = 0x12, |
| 1161 | VEHICLE_VALUE_TYPE_FLOAT_VEC4 = 0x13, |
| 1162 | VEHICLE_VALUE_TYPE_INT32 = 0x20, |
| 1163 | VEHICLE_VALUE_TYPE_INT32_VEC2 = 0x21, |
| 1164 | VEHICLE_VALUE_TYPE_INT32_VEC3 = 0x22, |
| 1165 | VEHICLE_VALUE_TYPE_INT32_VEC4 = 0x23, |
Keun-young Park | 73d7f22 | 2016-01-14 11:02:38 -0800 | [diff] [blame] | 1166 | VEHICLE_VALUE_TYPE_ZONED_FLOAT = 0x30, |
| 1167 | VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC2 = 0x31, |
| 1168 | VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC3 = 0x32, |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1169 | VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC4 = 0x33, |
Keun-young Park | 73d7f22 | 2016-01-14 11:02:38 -0800 | [diff] [blame] | 1170 | VEHICLE_VALUE_TYPE_ZONED_INT32 = 0x40, |
| 1171 | VEHICLE_VALUE_TYPE_ZONED_INT32_VEC2 = 0x41, |
| 1172 | VEHICLE_VALUE_TYPE_ZONED_INT32_VEC3 = 0x42, |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1173 | VEHICLE_VALUE_TYPE_ZONED_INT32_VEC4 = 0x43, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1174 | }; |
| 1175 | |
| 1176 | /** |
| 1177 | * Units used for int or float type with no attached enum types. |
| 1178 | */ |
| 1179 | enum vehicle_unit_type { |
| 1180 | VEHICLE_UNIT_TYPE_SHOULD_NOT_USE = 0x00000000, |
| 1181 | // speed related items |
| 1182 | VEHICLE_UNIT_TYPE_METER_PER_SEC = 0x00000001, |
| 1183 | VEHICLE_UNIT_TYPE_RPM = 0x00000002, |
| 1184 | VEHICLE_UNIT_TYPE_HZ = 0x00000003, |
| 1185 | // kind of ratio |
| 1186 | VEHICLE_UNIT_TYPE_PERCENTILE = 0x00000010, |
| 1187 | // length |
| 1188 | VEHICLE_UNIT_TYPE_MILLIMETER = 0x00000020, |
| 1189 | VEHICLE_UNIT_TYPE_METER = 0x00000021, |
| 1190 | VEHICLE_UNIT_TYPE_KILOMETER = 0x00000023, |
| 1191 | // temperature |
| 1192 | VEHICLE_UNIT_TYPE_CELCIUS = 0x00000030, |
| 1193 | // volume |
| 1194 | VEHICLE_UNIT_TYPE_MILLILITER = 0x00000040, |
| 1195 | // time |
| 1196 | VEHICLE_UNIT_TYPE_NANO_SECS = 0x00000050, |
| 1197 | VEHICLE_UNOT_TYPE_SECS = 0x00000053, |
| 1198 | VEHICLE_UNIT_TYPE_YEAR = 0x00000059, |
| 1199 | }; |
| 1200 | |
| 1201 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1202 | * This describes how value of property can change. |
| 1203 | */ |
| 1204 | enum vehicle_prop_change_mode { |
| 1205 | /** |
| 1206 | * Property of this type will *never* change. This property will not support subscription, but |
| 1207 | * will support get |
| 1208 | */ |
| 1209 | VEHICLE_PROP_CHANGE_MODE_STATIC = 0x00, |
| 1210 | /** |
| 1211 | * Property of this type will be reported when there is a change. get should return the |
| 1212 | * current value. |
| 1213 | */ |
| 1214 | VEHICLE_PROP_CHANGE_MODE_ON_CHANGE = 0x01, |
| 1215 | /** |
| 1216 | * Property of this type change continuously and requires fixed rate of sampling to retrieve |
| 1217 | * the data. |
| 1218 | */ |
| 1219 | VEHICLE_PROP_CHANGE_MODE_CONTINUOUS = 0x02, |
| 1220 | }; |
| 1221 | |
| 1222 | /** |
| 1223 | * Property config defines the capabilities of it. User of the API |
| 1224 | * should first get the property config to understand the output from get() |
| 1225 | * commands and also to ensure that set() or events commands are in sync with |
| 1226 | * the expected output. |
| 1227 | */ |
| 1228 | enum vehicle_prop_access { |
| 1229 | VEHICLE_PROP_ACCESS_READ = 0x01, |
| 1230 | VEHICLE_PROP_ACCESS_WRITE = 0x02, |
| 1231 | VEHICLE_PROP_ACCESS_READ_WRITE = 0x03 |
| 1232 | }; |
| 1233 | |
| 1234 | /** |
| 1235 | * These permissions define how the OEMs want to distribute their information and security they |
| 1236 | * want to apply. On top of these restrictions, android will have additional |
| 1237 | * 'app-level' permissions that the apps will need to ask the user before the apps have the |
| 1238 | * information. |
| 1239 | * This information should be kept in vehicle_prop_config.permission_model. |
| 1240 | */ |
| 1241 | enum vehicle_permission_model { |
| 1242 | /** |
| 1243 | * No special restriction, but each property can still require specific android app-level |
| 1244 | * permission. |
| 1245 | */ |
| 1246 | VEHICLE_PERMISSION_NO_RESTRICTION = 0, |
| 1247 | /** Signature only. Only APKs signed with OEM keys are allowed. */ |
| 1248 | VEHICLE_PERMISSION_OEM_ONLY = 0x1, |
| 1249 | /** System only. APKs built-in to system can access the property. */ |
| 1250 | VEHICLE_PERMISSION_SYSTEM_APP_ONLY = 0x2, |
| 1251 | /** Equivalent to “system|signature” */ |
| 1252 | VEHICLE_PERMISSION_OEM_OR_SYSTEM_APP = 0x3 |
| 1253 | }; |
| 1254 | |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1255 | |
| 1256 | /** |
| 1257 | * Special values for INT32/FLOAT (including ZONED types) |
| 1258 | * These values represent special state, which is outside MIN/MAX range but can happen. |
| 1259 | * For example, HVAC temperature may use out of range min / max to represent that |
| 1260 | * it is working in full power although target temperature has separate min / max. |
| 1261 | * OUT_OF_RANGE_OFF can represent a state where the property is powered off. |
| 1262 | * Usually such property will have separate property to control power. |
| 1263 | */ |
| 1264 | |
| 1265 | #define VEHICLE_INT_OUT_OF_RANGE_MAX (INT32_MAX) |
| 1266 | #define VEHICLE_INT_OUT_OF_RANGE_MIN (INT32_MIN) |
| 1267 | #define VEHICLE_INT_OUT_OF_RANGE_OFF (INT32_MIN + 1) |
| 1268 | |
| 1269 | #define VEHICLE_FLOAT_OUT_OF_RANGE_MAX (INFINITY) |
| 1270 | #define VEHICLE_FLOAT_OUT_OF_RANGE_MIN (-INFINITY) |
Keun-young Park | f1ccec1 | 2016-04-22 13:19:53 -0700 | [diff] [blame] | 1271 | #define VEHICLE_FLOAT_OUT_OF_RANGE_OFF (NAN) |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1272 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1273 | /** |
| 1274 | * Car states. |
| 1275 | * |
| 1276 | * The driving states determine what features of the UI will be accessible. |
| 1277 | */ |
| 1278 | enum vehicle_driving_status { |
| 1279 | VEHICLE_DRIVING_STATUS_UNRESTRICTED = 0x00, |
| 1280 | VEHICLE_DRIVING_STATUS_NO_VIDEO = 0x01, |
| 1281 | VEHICLE_DRIVING_STATUS_NO_KEYBOARD_INPUT = 0x02, |
| 1282 | VEHICLE_DRIVING_STATUS_NO_VOICE_INPUT = 0x04, |
| 1283 | VEHICLE_DRIVING_STATUS_NO_CONFIG = 0x08, |
| 1284 | VEHICLE_DRIVING_STATUS_LIMIT_MESSAGE_LEN = 0x10 |
| 1285 | }; |
| 1286 | |
| 1287 | /** |
| 1288 | * Various gears which can be selected by user and chosen in system. |
| 1289 | */ |
| 1290 | enum vehicle_gear { |
| 1291 | // Gear selections present in both automatic and manual cars. |
| 1292 | VEHICLE_GEAR_NEUTRAL = 0x0001, |
| 1293 | VEHICLE_GEAR_REVERSE = 0x0002, |
| 1294 | |
| 1295 | // Gear selections (mostly) present only in automatic cars. |
Keun-young Park | 77761e2 | 2016-03-08 15:02:44 -0800 | [diff] [blame] | 1296 | VEHICLE_GEAR_PARK = 0x0004, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1297 | VEHICLE_GEAR_DRIVE = 0x0008, |
Keun-young Park | 77761e2 | 2016-03-08 15:02:44 -0800 | [diff] [blame] | 1298 | VEHICLE_GEAR_LOW = 0x0010, |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1299 | |
| 1300 | // Other possible gear selections (maybe present in manual or automatic |
| 1301 | // cars). |
| 1302 | VEHICLE_GEAR_1 = 0x0010, |
| 1303 | VEHICLE_GEAR_2 = 0x0020, |
| 1304 | VEHICLE_GEAR_3 = 0x0040, |
| 1305 | VEHICLE_GEAR_4 = 0x0080, |
| 1306 | VEHICLE_GEAR_5 = 0x0100, |
| 1307 | VEHICLE_GEAR_6 = 0x0200, |
| 1308 | VEHICLE_GEAR_7 = 0x0400, |
| 1309 | VEHICLE_GEAR_8 = 0x0800, |
| 1310 | VEHICLE_GEAR_9 = 0x1000 |
| 1311 | }; |
| 1312 | |
| 1313 | |
| 1314 | /** |
| 1315 | * Various zones in the car. |
| 1316 | * |
| 1317 | * Zones are used for Air Conditioning purposes and divide the car into physical |
| 1318 | * area zones. |
| 1319 | */ |
| 1320 | enum vehicle_zone { |
| 1321 | VEHICLE_ZONE_ROW_1_LEFT = 0x00000001, |
| 1322 | VEHICLE_ZONE_ROW_1_CENTER = 0x00000002, |
| 1323 | VEHICLE_ZONE_ROW_1_RIGHT = 0x00000004, |
| 1324 | VEHICLE_ZONE_ROW_1_ALL = 0x00000008, |
| 1325 | VEHICLE_ZONE_ROW_2_LEFT = 0x00000010, |
| 1326 | VEHICLE_ZONE_ROW_2_CENTER = 0x00000020, |
| 1327 | VEHICLE_ZONE_ROW_2_RIGHT = 0x00000040, |
| 1328 | VEHICLE_ZONE_ROW_2_ALL = 0x00000080, |
| 1329 | VEHICLE_ZONE_ROW_3_LEFT = 0x00000100, |
| 1330 | VEHICLE_ZONE_ROW_3_CENTER = 0x00000200, |
| 1331 | VEHICLE_ZONE_ROW_3_RIGHT = 0x00000400, |
| 1332 | VEHICLE_ZONE_ROW_3_ALL = 0x00000800, |
| 1333 | VEHICLE_ZONE_ROW_4_LEFT = 0x00001000, |
| 1334 | VEHICLE_ZONE_ROW_4_CENTER = 0x00002000, |
| 1335 | VEHICLE_ZONE_ROW_4_RIGHT = 0x00004000, |
| 1336 | VEHICLE_ZONE_ROW_4_ALL = 0x00008000, |
| 1337 | VEHICLE_ZONE_ALL = 0x80000000, |
| 1338 | }; |
| 1339 | |
| 1340 | /** |
| 1341 | * Various Seats in the car. |
| 1342 | */ |
| 1343 | enum vehicle_seat { |
Keun-young Park | a384f83 | 2016-02-11 16:50:42 -0800 | [diff] [blame] | 1344 | VEHICLE_SEAT_DRIVER_LHD = 0x0001, |
| 1345 | VEHICLE_SEAT_DRIVER_RHD = 0x0002, |
| 1346 | VEHICLE_SEAT_ROW_1_PASSENGER_LEFT = 0x0010, |
| 1347 | VEHICLE_SEAT_ROW_1_PASSENGER_CENTER = 0x0020, |
| 1348 | VEHICLE_SEAT_ROW_1_PASSENGER_RIGHT = 0x0040, |
| 1349 | VEHICLE_SEAT_ROW_2_PASSENGER_LEFT = 0x0100, |
| 1350 | VEHICLE_SEAT_ROW_2_PASSENGER_CENTER = 0x0200, |
| 1351 | VEHICLE_SEAT_ROW_2_PASSENGER_RIGHT = 0x0400, |
| 1352 | VEHICLE_SEAT_ROW_3_PASSENGER_LEFT = 0x1000, |
| 1353 | VEHICLE_SEAT_ROW_3_PASSENGER_CENTER = 0x2000, |
| 1354 | VEHICLE_SEAT_ROW_3_PASSENGER_RIGHT = 0x4000 |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1355 | }; |
| 1356 | |
| 1357 | /** |
| 1358 | * Various windshields/windows in the car. |
| 1359 | */ |
| 1360 | enum vehicle_window { |
| 1361 | VEHICLE_WINDOW_FRONT_WINDSHIELD = 0x0001, |
| 1362 | VEHICLE_WINDOW_REAR_WINDSHIELD = 0x0002, |
| 1363 | VEHICLE_WINDOW_ROOF_TOP = 0x0004, |
| 1364 | VEHICLE_WINDOW_ROW_1_LEFT = 0x0010, |
| 1365 | VEHICLE_WINDOW_ROW_1_RIGHT = 0x0020, |
| 1366 | VEHICLE_WINDOW_ROW_2_LEFT = 0x0100, |
| 1367 | VEHICLE_WINDOW_ROW_2_RIGHT = 0x0200, |
| 1368 | VEHICLE_WINDOW_ROW_3_LEFT = 0x1000, |
| 1369 | VEHICLE_WINDOW_ROW_3_RIGHT = 0x2000, |
| 1370 | }; |
| 1371 | |
Keun-young Park | cb35450 | 2016-02-08 18:15:55 -0800 | [diff] [blame] | 1372 | enum vehicle_door { |
| 1373 | VEHICLE_DOOR_ROW_1_LEFT = 0x00000001, |
| 1374 | VEHICLE_DOOR_ROW_1_RIGHT = 0x00000004, |
| 1375 | VEHICLE_DOOR_ROW_2_LEFT = 0x00000010, |
| 1376 | VEHICLE_DOOR_ROW_2_RIGHT = 0x00000040, |
| 1377 | VEHICLE_DOOR_ROW_3_LEFT = 0x00000100, |
| 1378 | VEHICLE_DOOR_ROW_3_RIGHT = 0x00000400, |
| 1379 | VEHICLE_DOOR_HOOD = 0x10000000, |
| 1380 | VEHICLE_DOOR_REAR = 0x20000000, |
| 1381 | }; |
| 1382 | |
| 1383 | enum vehicle_mirror { |
| 1384 | VEHICLE_MIRROR_DRIVER_LEFT = 0x00000001, |
| 1385 | VEHICLE_MIRROR_DRIVER_RIGHT = 0x00000002, |
| 1386 | VEHICLE_MIRROR_DRIVER_CENTER = 0x00000004, |
| 1387 | }; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1388 | enum vehicle_turn_signal { |
| 1389 | VEHICLE_SIGNAL_NONE = 0x00, |
| 1390 | VEHICLE_SIGNAL_RIGHT = 0x01, |
| 1391 | VEHICLE_SIGNAL_LEFT = 0x02, |
| 1392 | VEHICLE_SIGNAL_EMERGENCY = 0x04 |
| 1393 | }; |
| 1394 | |
| 1395 | /* |
| 1396 | * Boolean type. |
| 1397 | */ |
| 1398 | enum vehicle_boolean { |
| 1399 | VEHICLE_FALSE = 0x00, |
| 1400 | VEHICLE_TRUE = 0x01 |
| 1401 | }; |
| 1402 | |
| 1403 | typedef int32_t vehicle_boolean_t; |
| 1404 | |
| 1405 | /** |
| 1406 | * Vehicle string. |
| 1407 | * |
| 1408 | * Defines a UTF8 encoded sequence of bytes that should be used for string |
| 1409 | * representation throughout. |
| 1410 | */ |
| 1411 | typedef struct vehicle_str { |
| 1412 | uint8_t* data; |
| 1413 | int32_t len; |
| 1414 | } vehicle_str_t; |
| 1415 | |
| 1416 | /** |
| 1417 | * Vehicle byte array. |
| 1418 | * This is for passing generic raw data. |
| 1419 | */ |
| 1420 | typedef vehicle_str_t vehicle_bytes_t; |
| 1421 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1422 | typedef struct vehicle_prop_config { |
| 1423 | int32_t prop; |
| 1424 | |
| 1425 | /** |
| 1426 | * Defines if the property is read or write. Value should be one of |
| 1427 | * enum vehicle_prop_access. |
| 1428 | */ |
| 1429 | int32_t access; |
| 1430 | |
| 1431 | /** |
| 1432 | * Defines if the property is continuous or on-change. Value should be one |
| 1433 | * of enum vehicle_prop_change_mode. |
| 1434 | */ |
| 1435 | int32_t change_mode; |
| 1436 | |
| 1437 | /** |
| 1438 | * Type of data used for this property. This type is fixed per each property. |
| 1439 | * Check vehicle_value_type for allowed value. |
| 1440 | */ |
| 1441 | int32_t value_type; |
| 1442 | |
| 1443 | /** |
| 1444 | * Define necessary permission model to access the data. |
| 1445 | */ |
| 1446 | int32_t permission_model; |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1447 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1448 | /** |
| 1449 | * Some of the properties may have associated zones (such as hvac), in these |
| 1450 | * cases the config should contain an ORed value for the associated zone. |
| 1451 | */ |
| 1452 | union { |
| 1453 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1454 | * The value is derived by ORing one or more of enum vehicle_zone members. |
| 1455 | */ |
| 1456 | int32_t vehicle_zone_flags; |
| 1457 | /** The value is derived by ORing one or more of enum vehicle_seat members. */ |
| 1458 | int32_t vehicle_seat_flags; |
| 1459 | /** The value is derived by ORing one or more of enum vehicle_window members. */ |
| 1460 | int32_t vehicle_window_flags; |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1461 | }; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1462 | |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1463 | /** |
| 1464 | * Property specific configuration information. Usage of this will be defined per each property. |
| 1465 | */ |
| 1466 | union { |
| 1467 | /** |
| 1468 | * For generic configuration information |
| 1469 | */ |
| 1470 | int32_t config_flags; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1471 | /** The number of presets that are stored by the radio module. Pass 0 if |
| 1472 | * there are no presets available. The range of presets is defined to be |
| 1473 | * from 1 (see VEHICLE_RADIO_PRESET_MIN_VALUE) to vehicle_radio_num_presets. |
| 1474 | */ |
| 1475 | int32_t vehicle_radio_num_presets; |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 1476 | int32_t config_array[4]; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1477 | }; |
| 1478 | |
| 1479 | /** |
| 1480 | * Some properties may require additional information passed over this string. Most properties |
| 1481 | * do not need to set this and in that case, config_string.data should be NULL and |
| 1482 | * config_string.len should be 0. |
| 1483 | */ |
| 1484 | vehicle_str_t config_string; |
| 1485 | |
| 1486 | /** |
| 1487 | * Specify minimum allowed value for the property. This is necessary for property which does |
| 1488 | * not have specified enum. |
| 1489 | */ |
| 1490 | union { |
| 1491 | float float_min_value; |
| 1492 | int32_t int32_min_value; |
| 1493 | int64_t int64_min_value; |
| 1494 | }; |
| 1495 | |
| 1496 | /** |
| 1497 | * Specify maximum allowed value for the property. This is necessary for property which does |
| 1498 | * not have specified enum. |
| 1499 | */ |
| 1500 | union { |
| 1501 | float float_max_value; |
| 1502 | int32_t int32_max_value; |
| 1503 | int64_t int64_max_value; |
| 1504 | }; |
| 1505 | |
| 1506 | /** |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1507 | * Array of min values for zoned properties. Zoned property can specify min / max value in two |
| 1508 | * different ways: |
| 1509 | * 1. All zones having the same min / max value: *_min/max_value should be set and this |
| 1510 | * array should be set to NULL. |
| 1511 | * 2. All zones having separate min / max value: *_min/max_values array should be populated |
| 1512 | * and its length should be the same as number of active zones specified by *_zone_flags. |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1513 | * |
| 1514 | * Should be NULL if each zone does not have separate max values. |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1515 | */ |
| 1516 | union { |
| 1517 | float* float_min_values; |
| 1518 | int32_t* int32_min_values; |
| 1519 | int64_t* int64_min_values; |
| 1520 | }; |
| 1521 | |
| 1522 | /** |
| 1523 | * Array of max values for zoned properties. See above for its usage. |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1524 | * Should be NULL if each zone does not have separate max values. |
| 1525 | * If not NULL, length of array should match that of min_values. |
Keun-young Park | fe599a8 | 2016-02-12 14:26:57 -0800 | [diff] [blame] | 1526 | */ |
| 1527 | union { |
| 1528 | float* float_max_values; |
| 1529 | int32_t* int32_max_values; |
| 1530 | int64_t* int64_max_values; |
| 1531 | }; |
| 1532 | |
| 1533 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1534 | * Min sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1535 | */ |
| 1536 | float min_sample_rate; |
| 1537 | /** |
| 1538 | * Max sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE |
| 1539 | */ |
| 1540 | float max_sample_rate; |
| 1541 | /** |
| 1542 | * Place holder for putting HAL implementation specific data. Usage is wholly up to HAL |
| 1543 | * implementation. |
| 1544 | */ |
| 1545 | void* hal_data; |
| 1546 | } vehicle_prop_config_t; |
| 1547 | |
| 1548 | /** |
| 1549 | * HVAC property fields. |
| 1550 | * |
| 1551 | * Defines various HVAC properties which are packed into vehicle_hvac_t (see |
| 1552 | * below). We define these properties outside in global scope so that HAL |
| 1553 | * implementation and HAL users (JNI) can typecast vehicle_hvac correctly. |
| 1554 | */ |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1555 | typedef struct vehicle_hvac { |
| 1556 | /** |
| 1557 | * Define one structure for each possible HVAC property. |
| 1558 | * NOTES: |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1559 | * a) Fan speed is a number from (0 - 6) where 6 is the highest speed. (TODO define enum) |
| 1560 | * b) Temperature is a floating point Celcius scale. |
| 1561 | * c) Direction is defined in enum vehicle_fan_direction. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1562 | * |
| 1563 | * The HAL should create #entries number of vehicle_hvac_properties and |
| 1564 | * assign it to "properties" variable below. |
| 1565 | */ |
| 1566 | union { |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1567 | int32_t fan_speed; |
| 1568 | int32_t fan_direction; |
| 1569 | vehicle_boolean_t ac_on; |
| 1570 | vehicle_boolean_t max_ac_on; |
| 1571 | vehicle_boolean_t max_defrost_on; |
| 1572 | vehicle_boolean_t recirc_on; |
| 1573 | vehicle_boolean_t dual_on; |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1574 | vehicle_boolean_t power_on; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1575 | |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1576 | float temperature_current; |
| 1577 | float temperature_set; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1578 | |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1579 | vehicle_boolean_t defrost_on; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1580 | }; |
| 1581 | } vehicle_hvac_t; |
| 1582 | |
| 1583 | /* |
| 1584 | * Defines how the values for various properties are represented. |
| 1585 | * |
| 1586 | * There are two ways to populate and access the fields: |
| 1587 | * a) Using the individual fields. Use this mechanism (see |
| 1588 | * info_manufacture_date, fuel_capacity fields etc). |
| 1589 | * b) Using the union accessors (see uint32_value, float_value etc). |
| 1590 | * |
| 1591 | * To add a new field make sure that it does not exceed the total union size |
| 1592 | * (defined in int_array) and it is one of the vehicle_value_type. Then add the |
| 1593 | * field name with its unit to union. If the field type is not yet defined (as |
| 1594 | * of this draft, we don't use int64_t) then add that type to vehicle_value_type |
| 1595 | * and have an accessor (so for int64_t it will be int64_t int64_value). |
| 1596 | */ |
| 1597 | typedef union vehicle_value { |
| 1598 | /** Define the max size of this structure. */ |
| 1599 | int32_t int32_array[4]; |
| 1600 | float float_array[4]; |
| 1601 | |
| 1602 | // Easy accessors for union members (HAL implementation SHOULD NOT USE these |
| 1603 | // fields while populating, use the property specific fields below instead). |
| 1604 | int32_t int32_value; |
| 1605 | int64_t int64_value; |
| 1606 | float float_value; |
| 1607 | vehicle_str_t str_value; |
| 1608 | vehicle_bytes_t bytes_value; |
| 1609 | vehicle_boolean_t boolean_value; |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1610 | |
| 1611 | // Vehicle Information. |
| 1612 | vehicle_str_t info_vin; |
| 1613 | vehicle_str_t info_make; |
| 1614 | vehicle_str_t info_model; |
| 1615 | int32_t info_model_year; |
| 1616 | |
| 1617 | // Represented in milliliters. |
| 1618 | float info_fuel_capacity; |
| 1619 | |
| 1620 | float vehicle_speed; |
| 1621 | float odometer; |
| 1622 | |
| 1623 | // Engine sensors. |
| 1624 | |
| 1625 | // Represented in milliliters. |
| 1626 | //float engine_coolant_level; |
| 1627 | // Represented in celcius. |
| 1628 | float engine_coolant_temperature; |
| 1629 | // Represented in a percentage value. |
| 1630 | //float engine_oil_level; |
| 1631 | // Represented in celcius. |
| 1632 | float engine_oil_temperature; |
| 1633 | float engine_rpm; |
| 1634 | |
| 1635 | // Event sensors. |
| 1636 | // Value should be one of enum vehicle_gear_selection. |
| 1637 | int32_t gear_selection; |
| 1638 | // Value should be one of enum vehicle_gear. |
| 1639 | int32_t gear_current_gear; |
| 1640 | // Value should be one of enum vehicle_boolean. |
| 1641 | int32_t parking_brake; |
| 1642 | // If cruise_set_speed > 0 then cruise is ON otherwise cruise is OFF. |
| 1643 | // Unit: meters / second (m/s). |
| 1644 | //int32_t cruise_set_speed; |
| 1645 | // Value should be one of enum vehicle_boolean. |
| 1646 | int32_t is_fuel_level_low; |
| 1647 | // Value should be one of enum vehicle_driving_status. |
| 1648 | int32_t driving_status; |
| 1649 | int32_t night_mode; |
| 1650 | // Value should be one of emum vehicle_turn_signal. |
| 1651 | int32_t turn_signals; |
| 1652 | // Value should be one of enum vehicle_boolean. |
| 1653 | //int32_t engine_on; |
| 1654 | |
| 1655 | // HVAC properties. |
| 1656 | vehicle_hvac_t hvac; |
| 1657 | |
| 1658 | float outside_temperature; |
Keun-young Park | cb35450 | 2016-02-08 18:15:55 -0800 | [diff] [blame] | 1659 | float cabin_temperature; |
| 1660 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1661 | } vehicle_value_t; |
| 1662 | |
| 1663 | /* |
| 1664 | * Encapsulates the property name and the associated value. It |
| 1665 | * is used across various API calls to set values, get values or to register for |
| 1666 | * events. |
| 1667 | */ |
| 1668 | typedef struct vehicle_prop_value { |
| 1669 | /* property identifier */ |
| 1670 | int32_t prop; |
| 1671 | |
| 1672 | /* value type of property for quick conversion from union to appropriate |
| 1673 | * value. The value must be one of enum vehicle_value_type. |
| 1674 | */ |
| 1675 | int32_t value_type; |
| 1676 | |
| 1677 | /** time is elapsed nanoseconds since boot */ |
| 1678 | int64_t timestamp; |
| 1679 | |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1680 | /** |
| 1681 | * Zone information for zoned property. For non-zoned property, this should be ignored. |
| 1682 | */ |
| 1683 | union { |
| 1684 | int32_t zone; |
| 1685 | int32_t seat; |
| 1686 | int32_t window; |
| 1687 | }; |
| 1688 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1689 | vehicle_value_t value; |
| 1690 | } vehicle_prop_value_t; |
| 1691 | |
| 1692 | /* |
| 1693 | * Event callback happens whenever a variable that the API user has subscribed |
| 1694 | * to needs to be reported. This may be based purely on threshold and frequency |
| 1695 | * (a regular subscription, see subscribe call's arguments) or when the set() |
| 1696 | * command is executed and the actual change needs to be reported. |
| 1697 | * |
| 1698 | * event_data is OWNED by the HAL and should be copied before the callback |
| 1699 | * finishes. |
| 1700 | */ |
| 1701 | typedef int (*vehicle_event_callback_fn)(const vehicle_prop_value_t *event_data); |
| 1702 | |
| 1703 | |
| 1704 | /** |
| 1705 | * Represent the operation where the current error has happened. |
| 1706 | */ |
| 1707 | enum vehicle_property_operation { |
| 1708 | /** Generic error to this property which is not tied to any operation. */ |
| 1709 | VEHICLE_OPERATION_GENERIC = 0, |
| 1710 | /** Error happened while handling property set. */ |
| 1711 | VEHICLE_OPERATION_SET = 1, |
| 1712 | /** Error happened while handling property get. */ |
| 1713 | VEHICLE_OPERATION_GET = 2, |
| 1714 | /** Error happened while handling property subscription. */ |
| 1715 | VEHICLE_OPERATION_SUBSCRIBE = 3, |
| 1716 | }; |
| 1717 | |
| 1718 | /* |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1719 | * Suggests that an error condition has occurred. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1720 | * |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1721 | * @param error_code Error code. error_code should be standard error code with |
| 1722 | * negative value like -EINVAL. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1723 | * @parm property Note a property where error has happened. If this is generic error, property |
| 1724 | * should be VEHICLE_PROPERTY_INVALID. |
| 1725 | * @param operation Represent the operation where the error has happened. Should be one of |
| 1726 | * vehicle_property_operation. |
| 1727 | */ |
| 1728 | typedef int (*vehicle_error_callback_fn)(int32_t error_code, int32_t property, int32_t operation); |
| 1729 | |
| 1730 | /************************************************************************************/ |
| 1731 | |
| 1732 | /* |
| 1733 | * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM |
| 1734 | * and the fields of this data structure must begin with hw_module_t |
| 1735 | * followed by module specific information. |
| 1736 | */ |
| 1737 | typedef struct vehicle_module { |
| 1738 | struct hw_module_t common; |
| 1739 | } vehicle_module_t; |
| 1740 | |
| 1741 | |
| 1742 | typedef struct vehicle_hw_device { |
| 1743 | struct hw_device_t common; |
| 1744 | |
| 1745 | /** |
| 1746 | * After calling open on device the user should register callbacks for event and error |
| 1747 | * functions. |
| 1748 | */ |
| 1749 | int (*init)(struct vehicle_hw_device* device, |
| 1750 | vehicle_event_callback_fn event_fn, vehicle_error_callback_fn err_fn); |
| 1751 | /** |
| 1752 | * Before calling close the user should destroy the registered callback |
| 1753 | * functions. |
| 1754 | * In case the unsubscribe() call is not called on all properties before |
| 1755 | * release() then release() will unsubscribe the properties itself. |
| 1756 | */ |
| 1757 | int (*release)(struct vehicle_hw_device* device); |
| 1758 | |
| 1759 | /** |
| 1760 | * Enumerate all available properties. The list is returned in "list". |
| 1761 | * @param num_properties number of properties contained in the retuned array. |
| 1762 | * @return array of property configs supported by this car. Note that returned data is const |
| 1763 | * and caller cannot modify it. HAL implementation should keep this memory until HAL |
| 1764 | * is released to avoid copying this again. |
| 1765 | */ |
| 1766 | vehicle_prop_config_t const *(*list_properties)(struct vehicle_hw_device* device, |
| 1767 | int* num_properties); |
| 1768 | |
| 1769 | /** |
| 1770 | * Get a vehicle property value immediately. data should be allocated |
| 1771 | * properly. |
| 1772 | * The caller of the API OWNS the data field. |
Keun-young Park | 08c255e | 2015-12-09 13:47:30 -0800 | [diff] [blame] | 1773 | * Caller will set data->prop, data->value_type, and optionally zone value for zoned property. |
| 1774 | * But HAL implementation needs to fill all entries properly when returning. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1775 | * For pointer type, HAL implementation should allocate necessary memory and caller is |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1776 | * responsible for calling release_memory_from_get, which allows HAL to release allocated |
| 1777 | * memory. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1778 | * For VEHICLE_PROP_CHANGE_MODE_STATIC type of property, get should return the same value |
| 1779 | * always. |
| 1780 | * For VEHICLE_PROP_CHANGE_MODE_ON_CHANGE type of property, it should return the latest value. |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1781 | * If there is no data available yet, which can happen during initial stage, this call should |
| 1782 | * return immediately with error code of -EAGAIN. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1783 | */ |
| 1784 | int (*get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data); |
| 1785 | |
| 1786 | /** |
Keun-young Park | ab68e37 | 2016-03-10 16:28:42 -0800 | [diff] [blame] | 1787 | * Release memory allocated to data in previous get call. get call for byte or string involves |
| 1788 | * allocating necessary memory from vehicle hal. |
| 1789 | * To be safe, memory allocated by vehicle hal should be released by vehicle hal and vehicle |
| 1790 | * network service will call this when data from vehicle hal is no longer necessary. |
| 1791 | * vehicle hal implementation should only release member of vehicle_prop_value_t like |
| 1792 | * data->str_value.data or data->bytes_value.data but not data itself as data itself is |
| 1793 | * allocated from vehicle network service. Once memory is freed, corresponding pointer should |
| 1794 | * be set to NULL bu vehicle hal. |
| 1795 | */ |
| 1796 | void (*release_memory_from_get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data); |
| 1797 | |
| 1798 | /** |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1799 | * Set a vehicle property value. data should be allocated properly and not |
| 1800 | * NULL. |
| 1801 | * The caller of the API OWNS the data field. |
| 1802 | * timestamp of data will be ignored for set operation. |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1803 | * Setting some properties require having initial state available. Depending on the vehicle hal, |
| 1804 | * such initial data may not be available for short time after init. In such case, set call |
| 1805 | * can return -EAGAIN like get call. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1806 | */ |
| 1807 | int (*set)(struct vehicle_hw_device* device, const vehicle_prop_value_t *data); |
| 1808 | |
| 1809 | /** |
| 1810 | * Subscribe to events. |
| 1811 | * Depending on output of list_properties if the property is: |
| 1812 | * a) on-change: sample_rate should be set to 0. |
| 1813 | * b) supports frequency: sample_rate should be set from min_sample_rate to |
| 1814 | * max_sample_rate. |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1815 | * For on-change type of properties, vehicle network service will make another get call to check |
| 1816 | * the initial state. Due to this, vehicle hal implementation does not need to send initial |
| 1817 | * state for on-change type of properties. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1818 | * @param device |
| 1819 | * @param prop |
| 1820 | * @param sample_rate |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 1821 | * @param zones All subscribed zones for zoned property. can be ignored for non-zoned property. |
| 1822 | * 0 means all zones supported instead of no zone. |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1823 | */ |
Keun-young Park | bf877a7 | 2015-12-21 14:16:05 -0800 | [diff] [blame] | 1824 | int (*subscribe)(struct vehicle_hw_device* device, int32_t prop, float sample_rate, |
| 1825 | int32_t zones); |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1826 | |
| 1827 | /** Cancel subscription on a property. */ |
| 1828 | int (*unsubscribe)(struct vehicle_hw_device* device, int32_t prop); |
Keun-young Park | 418c7e8 | 2016-04-06 10:44:20 -0700 | [diff] [blame] | 1829 | |
| 1830 | /** |
| 1831 | * Print out debugging state for the vehicle hal. This will be called by |
| 1832 | * the vehicle network service and will be included into the service' dump. |
| 1833 | * |
| 1834 | * The passed-in file descriptor can be used to write debugging text using |
| 1835 | * dprintf() or write(). The text should be in ASCII encoding only. |
| 1836 | * |
| 1837 | * Performance requirements: |
| 1838 | * |
| 1839 | * This must be a non-blocking call. The HAL should return from this call |
| 1840 | * in 1ms, must return from this call in 10ms. This call must avoid |
| 1841 | * deadlocks, as it may be called at any point of operation. |
| 1842 | * Any synchronization primitives used (such as mutex locks or semaphores) |
| 1843 | * should be acquired with a timeout. |
| 1844 | */ |
| 1845 | int (*dump)(struct vehicle_hw_device* device, int fd); |
| 1846 | |
Sanket Agarwal | fb63668 | 2015-08-11 14:34:29 -0700 | [diff] [blame] | 1847 | } vehicle_hw_device_t; |
| 1848 | |
| 1849 | __END_DECLS |
| 1850 | |
| 1851 | #endif // ANDROID_VEHICLE_INTERFACE_H |