blob: 6f1f89fccae77ccf110470de03e8215165fd4aaa [file] [log] [blame]
Sanket Agarwalfb636682015-08-11 14:34:29 -07001/*
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 Park418c7e82016-04-06 10:44:20 -070023#include <math.h>
Sanket Agarwalfb636682015-08-11 14:34:29 -070024#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 Parkbf877a72015-12-21 14:16:05 -080071 * @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 Agarwalfb636682015-08-11 14:34:29 -070074 * @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 Park14f09002016-01-22 16:29:22 -080077 * @zone_type type of zoned used. defined for zoned property
Sanket Agarwalfb636682015-08-11 14:34:29 -070078 * @range_start, @range_end : define range of specific property values.
Keun-young Park418c7e82016-04-06 10:44:20 -070079 * @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 Agarwalfb636682015-08-11 14:34:29 -070081 */
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 Paikcc9e2922016-04-21 11:40:17 -0700125#define VEHICLE_PROPERTY_INFO_MODEL_YEAR (0x00000103)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700126
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
Steve Paike588bae2016-06-29 17:06:16 -0700256//==== HVAC Properties ====
Sanket Agarwalfb636682015-08-11 14:34:29 -0700257
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 Park14f09002016-01-22 16:29:22 -0800264 * @zone_type VEHICLE_ZONE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700265 * @data_enum TODO
Keun-young Park418c7e82016-04-06 10:44:20 -0700266 * @allow_out_of_range_value : OFF
Sanket Agarwalfb636682015-08-11 14:34:29 -0700267 */
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 Park14f09002016-01-22 16:29:22 -0800276 * @zone_type VEHICLE_ZONE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700277 * @data_enum TODO
Keun-young Park418c7e82016-04-06 10:44:20 -0700278 * @allow_out_of_range_value : OFF
Sanket Agarwalfb636682015-08-11 14:34:29 -0700279 */
280#define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION (0x00000501)
281
Steve Paikd2ba70f2015-12-10 14:58:27 -0800282/*
283 * Bit flags for fan direction
284 */
Steve Paik159349e2016-02-09 18:45:58 -0800285enum 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 Paikd2ba70f2015-12-10 14:58:27 -0800291};
292
Sanket Agarwalfb636682015-08-11 14:34:29 -0700293/**
294 * HVAC current temperature.
295 * @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT
Keun-young Parkda3cb912016-05-12 11:21:04 -0700296 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700297 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Park14f09002016-01-22 16:29:22 -0800298 * @zone_type VEHICLE_ZONE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700299 * @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
Keun-young Parkda3cb912016-05-12 11:21:04 -0700306 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700307 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Park14f09002016-01-22 16:29:22 -0800308 * @zone_type VEHICLE_ZONE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700309 * @data_member hvac.temperature_set
Keun-young Park418c7e82016-04-06 10:44:20 -0700310 * @allow_out_of_range_value : MIN / MAX / OFF
Sanket Agarwalfb636682015-08-11 14:34:29 -0700311 */
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 Park418c7e82016-04-06 10:44:20 -0700319 * @zone_type VEHICLE_WINDOW
Sanket Agarwalfb636682015-08-11 14:34:29 -0700320 * @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 Parkbf877a72015-12-21 14:16:05 -0800329 * @config_flags Supported zones
Keun-young Park14f09002016-01-22 16:29:22 -0800330 * @zone_type VEHICLE_ZONE
Sanket Agarwalfb636682015-08-11 14:34:29 -0700331 * @data_member hvac.ac_on
332 */
333#define VEHICLE_PROPERTY_HVAC_AC_ON (0x00000505)
334
335/**
Steve Paikd2ba70f2015-12-10 14:58:27 -0800336 * On/off max AC
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700337 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
Steve Paikd2ba70f2015-12-10 14:58:27 -0800338 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
339 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700340 * @zone_type VEHICLE_ZONE
Steve Paikd2ba70f2015-12-10 14:58:27 -0800341 * @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 Parkf1ccec12016-04-22 13:19:53 -0700347 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
Steve Paikd2ba70f2015-12-10 14:58:27 -0800348 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
349 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700350 * @zone_type VEHICLE_ZONE
Steve Paikd2ba70f2015-12-10 14:58:27 -0800351 * @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 Parkf1ccec12016-04-22 13:19:53 -0700357 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
Steve Paikd2ba70f2015-12-10 14:58:27 -0800358 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
359 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700360 * @zone_type VEHICLE_ZONE
Steve Paikd2ba70f2015-12-10 14:58:27 -0800361 * @data_member hvac.max_recirc_on
362 */
363#define VEHICLE_PROPERTY_HVAC_RECIRC_ON (0x00000508)
364
365/**
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700366 * On/off dual. This will be defined per each row.
367 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
Steve Paikd2ba70f2015-12-10 14:58:27 -0800368 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
369 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkf1ccec12016-04-22 13:19:53 -0700370 * @zone_type VEHICLE_ZONE
Steve Paikd2ba70f2015-12-10 14:58:27 -0800371 * @data_member hvac.dual_on
372 */
373#define VEHICLE_PROPERTY_HVAC_DUAL_ON (0x00000509)
374
375/**
Steve Paikcc9e2922016-04-21 11:40:17 -0700376 * 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
Steve Paik670e7ab2016-04-29 16:32:02 -0700381 * @data_member hvac.auto_on
Steve Paikcc9e2922016-04-21 11:40:17 -0700382 */
383#define VEHICLE_PROPERTY_HVAC_AUTO_ON (0x0000050A)
384
385/**
Steve Paike588bae2016-06-29 17:06:16 -0700386 * Seat temperature
387 *
388 * Negative values indicate cooling.
389 * 0 indicates off.
390 * Positive values indicate heating.
391 *
392 * Some vehicles may have multiple levels of heating and cooling. The min/max
393 * range defines the allowable range and number of steps in each direction.
394 *
395 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
396 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
397 * @access VEHICLE_PROP_ACCESS_WRITE
398 * @zone_type VEHICLE_SEAT
399 * @data_member int32_value
400 */
401#define VEHICLE_PROPERTY_HVAC_SEAT_TEMPERATURE (0x0000050B)
402
403/**
Keun-young Park418c7e82016-04-06 10:44:20 -0700404 * Represents power state for HVAC. Some HVAC properties will require matching power to be turned on
405 * to get out of OFF state. For non-zoned HVAC properties, VEHICLE_ALL_ZONE corresponds to
406 * global power state.
407 *
408 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
409 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
410 * @access VEHICLE_PROP_ACCESS_READ_WRITE
411 * @config_string list of HVAC properties whose power is controlled by this property. Format is
412 * hexa-decimal number (0x...) separated by comma like "0x500,0x503". All zones
413 * defined in these affected properties should be available in the property.
414 * @zone_type VEHICLE_ZONE
415 * @data_member hvac.power_on
416 */
417#define VEHICLE_PROPERTY_HVAC_POWER_ON (0x00000510)
418
419/**
Sanket Agarwalfb636682015-08-11 14:34:29 -0700420 * Outside temperature
421 * @value_type VEHICLE_VALUE_TYPE_FLOAT
422 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
423 * @access VEHICLE_PROP_ACCESS_READ
424 * @data_member outside_temperature
425 * @unit VEHICLE_UNIT_TYPE_CELCIUS
426 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700427#define VEHICLE_PROPERTY_ENV_OUTSIDE_TEMPERATURE (0x00000703)
Keun-young Parkcb354502016-02-08 18:15:55 -0800428
429
430/**
431 * Cabin temperature
432 * @value_type VEHICLE_VALUE_TYPE_FLOAT
433 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
434 * @access VEHICLE_PROP_ACCESS_READ
435 * @data_member cabin_temperature
436 * @unit VEHICLE_UNIT_TYPE_CELCIUS
437 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700438#define VEHICLE_PROPERTY_ENV_CABIN_TEMPERATURE (0x00000704)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700439
440
441/*
442 * Radio features.
443 */
444/**
445 * Radio presets stored on the Car radio module. The data type used is int32
446 * array with the following fields:
447 * <ul>
448 * <li> int32_array[0]: Preset number </li>
449 * <li> int32_array[1]: Band type (see #RADIO_BAND_FM in
450 * system/core/include/system/radio.h).
451 * <li> int32_array[2]: Channel number </li>
452 * <li> int32_array[3]: Sub channel number </li>
453 * </ul>
454 *
455 * NOTE: When getting a current preset config ONLY set preset number (i.e.
456 * int32_array[0]). For setting a preset other fields are required.
457 *
458 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
459 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
460 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkbf877a72015-12-21 14:16:05 -0800461 * @config_flags Number of presets supported
Sanket Agarwalfb636682015-08-11 14:34:29 -0700462 * @data_member int32_array
463 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700464#define VEHICLE_PROPERTY_RADIO_PRESET (0x0000801)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700465
466/**
467 * Constants relevant to radio.
468 */
469enum vehicle_radio_consts {
470 /** Minimum value for the radio preset */
471 VEHICLE_RADIO_PRESET_MIN_VALUE = 1,
472};
473
474/**
475 * Represents audio focus state of Android side. Note that car's audio module will own audio
476 * focus and grant audio focus to Android side when requested by Android side. The focus has both
477 * per stream characteristics and global characteristics.
478 *
479 * Focus request (get of this property) will take the following form in int32_vec4:
Keun-young Park08c255e2015-12-09 13:47:30 -0800480 * int32_array[0]: vehicle_audio_focus_request type
Sanket Agarwalfb636682015-08-11 14:34:29 -0700481 * int32_array[1]: bit flags of streams requested by this focus request. There can be up to
482 * 32 streams.
483 * int32_array[2]: External focus state flags. For request, only flag like
Keun-young Park418c7e82016-04-06 10:44:20 -0700484 * VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG or
485 * VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be used.
486 * VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG is for case like radio where android
487 * side app still needs to hold focus but playback is done outside Android.
488 * VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG is for muting media channel
489 * including radio. VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be set even
490 * if android side releases focus (request type REQUEST_RELEASE). In that case,
491 * audio module should maintain mute state until user's explicit action to
492 * play some media.
Keun-young Park637fb202016-03-29 09:52:41 -0700493 * int32_array[3]: Currently active audio contexts. Use combination of flags from
Keun-young Parkfe599a82016-02-12 14:26:57 -0800494 * vehicle_audio_context_flag.
495 * This can be used as a hint to adjust audio policy or other policy decision.
496 * Note that there can be multiple context active at the same time. And android
497 * can send the same focus request type gain due to change in audio contexts.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700498 * Note that each focus request can request multiple streams that is expected to be used for
499 * the current request. But focus request itself is global behavior as GAIN or GAIN_TRANSIENT
500 * expects all sounds played by car's audio module to stop. Note that stream already allocated to
501 * android before this focus request should not be affected by focus request.
502 *
503 * Focus response (set and subscription callback for this property) will take the following form:
Keun-young Park08c255e2015-12-09 13:47:30 -0800504 * int32_array[0]: vehicle_audio_focus_state type
Sanket Agarwalfb636682015-08-11 14:34:29 -0700505 * int32_array[1]: bit flags of streams allowed.
506 * int32_array[2]: External focus state: bit flags of currently active audio focus in car
507 * side (outside Android). Active audio focus does not necessarily mean currently
508 * playing, but represents the state of having focus or waiting for focus
509 * (pause state).
510 * One or combination of flags from vehicle_audio_ext_focus_flag.
511 * 0 means no active audio focus holder outside Android.
512 * The state will have following values for each vehicle_audio_focus_state_type:
513 * GAIN: 0 or VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY when radio is active in
514 * Android side.
515 * GAIN_TRANSIENT: 0. Can be VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT or
516 * VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT if android side has requested
517 * GAIN_TRANSIENT_MAY_DUCK and car side is ducking.
518 * LOSS: 0 when no focus is audio is active in car side.
519 * VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT when car side is playing something
520 * permanent.
521 * LOSS_TRANSIENT: always should be VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT
Keun-young Parkda3cb912016-05-12 11:21:04 -0700522 * int32_array[3]: context requested by android side when responding to focus request.
523 * When car side is taking focus away, this should be zero.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700524 *
Keun-young Park254dbce2016-03-28 09:37:04 -0700525 * A focus response should be sent per each focus request even if there is no change in
526 * focus state. This can happen in case like focus request only involving context change
527 * where android side still needs matching focus response to confirm that audio module
528 * has made necessary changes.
529 *
Sanket Agarwalfb636682015-08-11 14:34:29 -0700530 * If car does not support VEHICLE_PROPERTY_AUDIO_FOCUS, focus is assumed to be granted always.
531 *
Keun-young Parkfe599a82016-02-12 14:26:57 -0800532 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
Sanket Agarwalfb636682015-08-11 14:34:29 -0700533 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
534 * @access VEHICLE_PROP_ACCESS_READ_WRITE
535 * @data_member int32_array
536 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700537#define VEHICLE_PROPERTY_AUDIO_FOCUS (0x00000900)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700538
539enum vehicle_audio_focus_request {
540 VEHICLE_AUDIO_FOCUS_REQUEST_GAIN = 0x1,
541 VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT = 0x2,
542 VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_MAY_DUCK = 0x3,
Keun-young Parkcb354502016-02-08 18:15:55 -0800543 /**
544 * This is for the case where android side plays sound like UI feedback
545 * and car side does not need to duck existing playback as long as
546 * requested stream is available.
547 */
548 VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_NO_DUCK = 0x4,
549 VEHICLE_AUDIO_FOCUS_REQUEST_RELEASE = 0x5,
Sanket Agarwalfb636682015-08-11 14:34:29 -0700550};
551
552enum vehicle_audio_focus_state {
553 /**
554 * Android side has permanent focus and can play allowed streams.
555 */
556 VEHICLE_AUDIO_FOCUS_STATE_GAIN = 0x1,
557 /**
558 * Android side has transient focus and can play allowed streams.
559 */
560 VEHICLE_AUDIO_FOCUS_STATE_GAIN_TRANSIENT = 0x2,
561 /**
562 * Car audio module is playing guidance kind of sound outside Android. Android side can
563 * still play through allowed streams with ducking.
564 */
565 VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_CAN_DUCK = 0x3,
566 /**
567 * Car audio module is playing transient sound outside Android. Android side should stop
568 * playing any sounds.
569 */
570 VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT = 0x4,
571 /**
572 * Android side has lost focus and cannot play any sound.
573 */
574 VEHICLE_AUDIO_FOCUS_STATE_LOSS = 0x5,
575 /**
576 * car audio module is playing safety critical sound, and Android side cannot request focus
577 * until the current state is finished. car audio module should restore it to the previous
578 * state when it can allow Android to play.
579 */
580 VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_EXLCUSIVE = 0x6,
581};
582
583/**
584 * Flags to represent multiple streams by combining these.
585 */
586enum vehicle_audio_stream_flag {
587 VEHICLE_AUDIO_STREAM_STREAM0_FLAG = (0x1<<0),
588 VEHICLE_AUDIO_STREAM_STREAM1_FLAG = (0x1<<1),
589 VEHICLE_AUDIO_STREAM_STREAM2_FLAG = (0x1<<2),
590};
591
592/**
593 * Represents stream number (always 0 to N -1 where N is max number of streams).
594 * Can be used for audio related property expecting one stream.
595 */
596enum vehicle_audio_stream {
597 VEHICLE_AUDIO_STREAM0 = 0,
598 VEHICLE_AUDIO_STREAM1 = 1,
599};
600
601/**
602 * Flag to represent external focus state (outside Android).
603 */
604enum vehicle_audio_ext_focus_flag {
605 /**
606 * No external focus holder.
607 */
608 VEHICLE_AUDIO_EXT_FOCUS_NONE_FLAG = 0x0,
609 /**
610 * Car side (outside Android) has component holding GAIN kind of focus state.
611 */
612 VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT_FLAG = 0x1,
613 /**
614 * Car side (outside Android) has component holding GAIN_TRANSIENT kind of focus state.
615 */
616 VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT_FLAG = 0x2,
617 /**
618 * Car side is expected to play something while focus is held by Android side. One example
619 * can be radio attached in car side. But Android's radio app still should have focus,
620 * and Android side should be in GAIN state, but media stream will not be allocated to Android
621 * side and car side can play radio any time while this flag is active.
622 */
623 VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG = 0x4,
Keun-young Park418c7e82016-04-06 10:44:20 -0700624 /**
625 * Car side should mute any media including radio. This can be used with any focus request
626 * including GAIN* and RELEASE.
627 */
628 VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG = 0x8,
Sanket Agarwalfb636682015-08-11 14:34:29 -0700629};
630
631/**
632 * Index in int32_array for VEHICLE_PROPERTY_AUDIO_FOCUS property.
633 */
634enum vehicle_audio_focus_index {
635 VEHICLE_AUDIO_FOCUS_INDEX_FOCUS = 0,
636 VEHICLE_AUDIO_FOCUS_INDEX_STREAMS = 1,
637 VEHICLE_AUDIO_FOCUS_INDEX_EXTERNAL_FOCUS_STATE = 2,
Keun-young Parkfe599a82016-02-12 14:26:57 -0800638 VEHICLE_AUDIO_FOCUS_INDEX_AUDIO_CONTEXTS = 3,
639};
640
641/**
642 * Flags to tell the current audio context.
643 */
644enum vehicle_audio_context_flag {
645 /** Music playback is currently active. */
646 VEHICLE_AUDIO_CONTEXT_MUSIC_FLAG = 0x1,
647 /** Navigation is currently running. */
648 VEHICLE_AUDIO_CONTEXT_NAVIGATION_FLAG = 0x2,
649 /** Voice command session is currently running. */
650 VEHICLE_AUDIO_CONTEXT_VOICE_COMMAND_FLAG = 0x4,
651 /** Voice call is currently active. */
652 VEHICLE_AUDIO_CONTEXT_CALL_FLAG = 0x8,
653 /** Alarm is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY. */
654 VEHICLE_AUDIO_CONTEXT_ALARM_FLAG = 0x10,
655 /**
656 * Notification sound is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY.
657 */
658 VEHICLE_AUDIO_CONTEXT_NOTIFICATION_FLAG = 0x20,
659 /**
660 * Context unknown. Only used for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY to represent default
661 * stream for unknown contents.
662 */
663 VEHICLE_AUDIO_CONTEXT_UNKNOWN_FLAG = 0x40,
664 /** Safety alert / warning is played. */
665 VEHICLE_AUDIO_CONTEXT_SAFETY_ALERT_FLAG = 0x80,
666 /** CD / DVD kind of audio is played */
Keun-young Park9f376f52016-03-03 17:47:18 -0800667 VEHICLE_AUDIO_CONTEXT_CD_ROM_FLAG = 0x100,
Keun-young Parkfe599a82016-02-12 14:26:57 -0800668 /** Aux audio input is played */
Keun-young Park9f376f52016-03-03 17:47:18 -0800669 VEHICLE_AUDIO_CONTEXT_AUX_AUDIO_FLAG = 0x200,
Keun-young Parkfe599a82016-02-12 14:26:57 -0800670 /** system sound like UI feedback */
Keun-young Park9f376f52016-03-03 17:47:18 -0800671 VEHICLE_AUDIO_CONTEXT_SYSTEM_SOUND_FLAG = 0x400,
Keun-young Parkfe599a82016-02-12 14:26:57 -0800672 /** Radio is played */
Keun-young Park9f376f52016-03-03 17:47:18 -0800673 VEHICLE_AUDIO_CONTEXT_RADIO_FLAG = 0x800,
Keun-young Park726122a2016-06-28 12:54:47 -0700674 /** Ext source is played. This is for tagging generic ext sources. */
675 VEHICLE_AUDIO_CONTEXT_EXT_SOURCE_FLAG = 0x1000,
Sanket Agarwalfb636682015-08-11 14:34:29 -0700676};
677
678/**
Keun-young Parkbf877a72015-12-21 14:16:05 -0800679 * Property to control audio volume of each audio context.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700680 *
Keun-young Park12a3c012016-03-23 17:58:29 -0700681 * vehicle_prop_config_t
682 * config_array[0] : bit flags of all supported audio contexts. If this is 0,
683 * audio volume is controlled per physical stream
684 * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
685 * represent audio module's capability.
686 *
Sanket Agarwalfb636682015-08-11 14:34:29 -0700687 * Data type looks like:
Keun-young Park12a3c012016-03-23 17:58:29 -0700688 * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
689 stream is supported (config_array[0] == 0), this will represent physical
690 stream number.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700691 * int32_array[1] : volume level, valid range is 0 to int32_max_value defined in config.
692 * 0 will be mute state. int32_min_value in config should be always 0.
693 * int32_array[2] : One of vehicle_audio_volume_state.
694 *
695 * This property requires per stream based get. HAL implementation should check stream number
696 * in get call to return the right volume.
697 *
698 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC3
699 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
700 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkbf877a72015-12-21 14:16:05 -0800701 * @config_flags all audio contexts supported.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700702 * @data_member int32_array
703 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700704#define VEHICLE_PROPERTY_AUDIO_VOLUME (0x00000901)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700705
Keun-young Park12a3c012016-03-23 17:58:29 -0700706
707/**
708 * flags to represent capability of audio volume property.
709 * used in config_array[1] of vehicle_prop_config_t.
710 */
711enum vehicle_audio_volume_capability_flag {
712 /**
713 * External audio module or vehicle hal has persistent storage
714 * to keep the volume level. This should be set only when per context
715 * volume level is supproted. When this is set, audio volume level per
716 * each context will be retrieved from the property when systen starts up.
717 * And external audio module is also expected to adjust volume automatically
718 * whenever there is an audio context change.
719 * When this flag is not set, android side will assume that there is no
720 * persistent storage and stored value in android side will be used to
721 * initialize the volume level. And android side will set volume level
722 * of each physical streams whenever there is an audio context change.
723 */
724 VEHICLE_AUDIO_VOLUME_CAPABILITY_PERSISTENT_STORAGE = 0x1,
Keun-young Parke086bd72016-05-24 09:41:54 -0700725 /**
726 * When this flag is set, the H/W can support only single master volume for all streams.
727 * There is no way to set volume level differently per each stream or context.
728 */
729 VEHICLE_AUDIO_VOLUME_CAPABILITY_MASTER_VOLUME_ONLY = 0x2,
Keun-young Park12a3c012016-03-23 17:58:29 -0700730};
731
Steve Paikcc9e2922016-04-21 11:40:17 -0700732
Sanket Agarwalfb636682015-08-11 14:34:29 -0700733/**
734 * enum to represent audio volume state.
735 */
736enum vehicle_audio_volume_state {
737 VEHICLE_AUDIO_VOLUME_STATE_OK = 0,
738 /**
739 * Audio volume has reached volume limit set in VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT
740 * and user's request to increase volume further is not allowed.
741 */
742 VEHICLE_AUDIO_VOLUME_STATE_LIMIT_REACHED = 1,
743};
744
745/**
746 * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME property.
747 */
748enum vehicle_audio_volume_index {
749 VEHICLE_AUDIO_VOLUME_INDEX_STREAM = 0,
750 VEHICLE_AUDIO_VOLUME_INDEX_VOLUME = 1,
751 VEHICLE_AUDIO_VOLUME_INDEX_STATE = 2,
752};
753
754/**
755 * Property for handling volume limit set by user. This limits maximum volume that can be set
Keun-young Park12a3c012016-03-23 17:58:29 -0700756 * per each context or physical stream.
757 *
758 * vehicle_prop_config_t
759 * config_array[0] : bit flags of all supported audio contexts. If this is 0,
760 * audio volume is controlled per physical stream
761 * config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
762 * represent audio module's capability.
763 *
764 * Data type looks like:
765 * int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
766 * stream is supported (config_array[0] == 0), this will represent physical
767 * stream number.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700768 * int32_array[1] : maximum volume set to the stream. If there is no restriction, this value
769 * will be bigger than VEHICLE_PROPERTY_AUDIO_VOLUME's max value.
770 *
771 * If car does not support this feature, this property should not be populated by HAL.
772 * This property requires per stream based get. HAL implementation should check stream number
773 * in get call to return the right volume.
774 *
775 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
776 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
777 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkbf877a72015-12-21 14:16:05 -0800778 * @config_flags all audio contexts supported.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700779 * @data_member int32_array
780 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700781#define VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT (0x00000902)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700782
783/**
784 * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT property.
785 */
786enum vehicle_audio_volume_limit_index {
787 VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_STREAM = 0,
788 VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_MAX_VOLUME = 1,
789};
790
791/**
792 * Property to share audio routing policy of android side. This property is set at the beginning
793 * to pass audio policy in android side down to vehicle HAL and car audio module.
794 * This can be used as a hint to adjust audio policy or other policy decision.
795 *
796 * int32_array[0] : audio stream where the audio for the application context will be routed
797 * by default. Note that this is the default setting from system, but each app
798 * may still use different audio stream for whatever reason.
Keun-young Parkbf877a72015-12-21 14:16:05 -0800799 * int32_array[1] : All audio contexts that will be sent through the physical stream. Flag
800 * is defined in vehicle_audio_context_flag.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700801
802 * Setting of this property will be done for all available physical streams based on audio H/W
803 * variant information acquired from VEHICLE_PROPERTY_AUDIO_HW_VARIANT property.
804 *
805 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
806 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
807 * @access VEHICLE_PROP_ACCESS_WRITE
808 * @data_member int32_array
809 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700810#define VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY (0x00000903)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700811
812/**
813 * Index in int32_array for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY property.
814 */
815enum vehicle_audio_routing_policy_index {
816 VEHICLE_AUDIO_ROUTING_POLICY_INDEX_STREAM = 0,
817 VEHICLE_AUDIO_ROUTING_POLICY_INDEX_CONTEXTS = 1,
818};
819
820/**
821* Property to return audio H/W variant type used in this car. This allows android side to
822* support different audio policy based on H/W variant used. Note that other components like
823* CarService may need overlay update to support additional variants. If this property does not
824* exist, default audio policy will be used.
825*
826* @value_type VEHICLE_VALUE_TYPE_INT32
827* @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
828* @access VEHICLE_PROP_ACCESS_READ
Keun-young Parkbf877a72015-12-21 14:16:05 -0800829* @config_flags Additional info on audio H/W. Should use vehicle_audio_hw_variant_config_flag for
830* this.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700831* @data_member int32_value
832*/
Steve Paikcc9e2922016-04-21 11:40:17 -0700833#define VEHICLE_PROPERTY_AUDIO_HW_VARIANT (0x00000904)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700834
835/**
836 * Flag to be used in vehicle_prop_config.config_flags for VEHICLE_PROPERTY_AUDIO_HW_VARIANT.
837 */
838enum vehicle_audio_hw_variant_config_flag {
839 /**
Keun-young Park637fb202016-03-29 09:52:41 -0700840 * Flag to tell that radio is internal to android and radio should
841 * be treated like other android stream like media.
842 * When this flag is not set or AUDIO_HW_VARIANT does not exist,
843 * radio is treated as external module. This brins some delta in audio focus
844 * handling as well.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700845 */
Keun-young Park637fb202016-03-29 09:52:41 -0700846 VEHICLE_AUDIO_HW_VARIANT_FLAG_INTERNAL_RADIO_FLAG = 0x1,
Sanket Agarwalfb636682015-08-11 14:34:29 -0700847};
848
Keun-young Park726122a2016-06-28 12:54:47 -0700849/** audio routing for AM/FM. This should be also be the value when there is only one
850 radio module in the system. */
851#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM "RADIO_AM_FM"
852/** Should be added only when there is a separate radio module with HD capability. */
853#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM_HD "RADIO_AM_FM_HD"
854/** For digial audio broadcasting type of radio */
855#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_DAB "RADIO_DAB"
856/** For satellite type of radio */
857#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_SATELLITE "RADIO_SATELLITE"
858/** For CD or DVD */
859#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_CD_DVD "CD_DVD"
860/** For 1st auxiliary input */
861#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN0 "AUX_IN0"
862/** For 2nd auxiliary input */
863#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN1 "AUX_IN1"
864/** For navigation guidance from outside android */
865#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_NAV_GUIDANCE "EXT_NAV_GUIDANCE"
866/** For voice command from outside android */
867#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_COMMAND "EXT_VOICE_COMMAND"
868/** For voice call from outside android */
869#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_CALL "EXT_VOICE_CALL"
870/** For safety alert from outside android */
871#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_SAFETY_ALERT "EXT_SAFETY_ALERT"
872
873/**
874* Property to pass hint on external audio routing. When android side request focus
875* with VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG flag, this property will be set
876* before setting AUDIO_FOCUS property as a hint for external audio source routing.
877* Note that setting this property alone should not trigger any change.
878* Audio routing should be changed only when AUDIO_FOCUS property is set. Note that
879* this property allows passing custom value as long as it is defined in config_string.
880* This allows supporting non-standard routing options through this property.
881* It is recommended to use separate name space for custom property to prevent conflict in future
882* android releases.
883* Enabling each external routing option is done by enabling each bit flag for the routing.
884* This property can support up to 128 external routings.
885* To give full flexibility, there is no standard definition for each bit flag and
886* assigning each big flag to specific routing type is decided by config_string.
887* config_string has format of each entry separated by ','
888* and each entry has format of bitFlagPositon:typeString[:physicalStreamNumber].
889* bitFlagPosition: represents which big flag will be set to enable this routing. 0 means
890* LSB in int32_array[0]. 31 will be MSB in int32_array[0]. 127 will MSB in int32_array[3].
891* typeString: string representation of external routing. Some types are already defined
892* in VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_* and use them first before adding something
893* custom. Applications will find each routing using this string.
894* physicalStreamNumber: This part is optional and represents physical stream to android
895* which will be disabled when this routing is enabled. If not specified, this routing
896* should not affect physical streams to android.
897* As an example, let's assume a system with two physical streams, 0 for media and 1 for
898* nav guidance. And let's assume external routing option of am fm radio, external navigation
899* guidance, satellite radio, and one custom. Let's assume that radio and satellite replaces
900* physical stream 0 and external navigation replaces physical stream 1. And bit flag will be
901* assigned in the order listed above. This configuration will look like this in config_string:
902* "0:RADIO_AM_FM:0,1:EXT_NAV_GUIDANCE:1,2:RADIO_SATELLITE:0,3:com.test.SOMETHING_CUSTOM"
903* When android requests RADIO_AM_FM, int32_array[0] will be set to 0x1.
904* When android requests RADIO_SATELLITE + EXT_NAV_GUIDANCE, int32_array[0] will be set to 0x2|0x4.
905*
906* @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
907* @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
908* @access VEHICLE_PROP_ACCESS_WRITE|VEHICLE_PROP_ACCESS_READ_WRITE
909* @config_string List of all avaiable external source in the system.
910* @data_member int32_array
911*/
912#define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_HINT (0x00000905)
Keun-young Parkcb8c8872016-01-08 09:41:19 -0800913
914/**
Sanket Agarwalfb636682015-08-11 14:34:29 -0700915 * Property to control power state of application processor.
916 *
917 * It is assumed that AP's power state is controller by separate power controller.
918 *
919 * For configuration information, vehicle_prop_config.config_flags can have bit flag combining
920 * values in vehicle_ap_power_state_config_type.
921 *
922 * For get / notification, data type looks like this:
923 * int32_array[0] : vehicle_ap_power_state_type
924 * int32_array[1] : additional parameter relevant for each state. should be 0 if not used.
925 * For set, data type looks like this:
926 * int32_array[0] : vehicle_ap_power_state_set_type
927 * int32_array[1] : additional parameter relevant for each request. should be 0 if not used.
928 *
929 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
930 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
931 * @access VEHICLE_PROP_ACCESS_READ_WRITE
Keun-young Parkbf877a72015-12-21 14:16:05 -0800932 * @config_flags Additional info on power state. Should use vehicle_ap_power_state_config_flag.
Sanket Agarwalfb636682015-08-11 14:34:29 -0700933 * @data_member int32_array
934 */
Steve Paikcc9e2922016-04-21 11:40:17 -0700935#define VEHICLE_PROPERTY_AP_POWER_STATE (0x00000A00)
Sanket Agarwalfb636682015-08-11 14:34:29 -0700936
937enum vehicle_ap_power_state_config_flag {
938 /**
939 * AP can enter deep sleep state. If not set, AP will always shutdown from
940 * VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE power state.
941 */
942 VEHICLE_AP_POWER_STATE_CONFIG_ENABLE_DEEP_SLEEP_FLAG = 0x1,
943
944 /**
945 * The power controller can power on AP from off state after timeout specified in
946 * VEHICLE_AP_POWER_SET_SHUTDOWN_READY message.
947 */
948 VEHICLE_AP_POWER_STATE_CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2,
949};
950
951enum vehicle_ap_power_state {
952 /** vehicle HAL will never publish this state to AP */
953 VEHICLE_AP_POWER_STATE_OFF = 0,
954 /** vehicle HAL will never publish this state to AP */
955 VEHICLE_AP_POWER_STATE_DEEP_SLEEP = 1,
956 /** AP is on but display should be off. */
957 VEHICLE_AP_POWER_STATE_ON_DISP_OFF = 2,
958 /** AP is on with display on. This state allows full user interaction. */
959 VEHICLE_AP_POWER_STATE_ON_FULL = 3,
960 /**
961 * The power controller has requested AP to shutdown. AP can either enter sleep state or start
962 * full shutdown. AP can also request postponing shutdown by sending
963 * VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE message. The power controller should change power
964 * state to this state to shutdown system.
965 *
966 * int32_array[1] : one of enum_vehicle_ap_power_state_shutdown_param_type
967 */
968 VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE = 4,
969};
970
971enum vehicle_ap_power_state_shutdown_param {
972 /** AP should shutdown immediately. Postponing is not allowed. */
973 VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_IMMEDIATELY = 1,
974 /** AP can enter deep sleep instead of shutting down completely. */
975 VEHICLE_AP_POWER_SHUTDOWN_PARAM_CAN_SLEEP = 2,
976 /** AP can only shutdown with postponing allowed. */
977 VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_ONLY = 3,
978};
979
980enum vehicle_ap_power_set_state {
981 /**
982 * AP has finished boot up, and can start shutdown if requested by power controller.
983 */
984 VEHICLE_AP_POWER_SET_BOOT_COMPLETE = 0x1,
985 /**
986 * AP is entering deep sleep state. How this state is implemented may vary depending on
987 * each H/W, but AP's power should be kept in this state.
988 */
989 VEHICLE_AP_POWER_SET_DEEP_SLEEP_ENTRY = 0x2,
990 /**
991 * AP is exiting from deep sleep state, and is in VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE state.
992 * The power controller may change state to other ON states based on the current state.
993 */
994 VEHICLE_AP_POWER_SET_DEEP_SLEEP_EXIT = 0x3,
995 /**
996 * int32_array[1]: Time to postpone shutdown in ms. Maximum value can be 5000 ms.
997 * If AP needs more time, it will send another POSTPONE message before
998 * the previous one expires.
999 */
1000 VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE = 0x4,
1001 /**
1002 * AP is starting shutting down. When system completes shutdown, everything will stop in AP
1003 * as kernel will stop all other contexts. It is responsibility of vehicle HAL or lower level
1004 * to synchronize that state with external power controller. As an example, some kind of ping
1005 * with timeout in power controller can be a solution.
1006 *
1007 * int32_array[1]: Time to turn on AP in secs. Power controller may turn on AP after specified
1008 * time so that AP can run tasks like update. If it is set to 0, there is no
1009 * wake up, and power controller may not necessarily support wake-up.
1010 * If power controller turns on AP due to timer, it should start with
1011 * VEHICLE_AP_POWER_STATE_ON_DISP_OFF state, and after receiving
1012 * VEHICLE_AP_POWER_SET_BOOT_COMPLETE, it shall do state transition to
1013 * VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE.
1014 */
1015 VEHICLE_AP_POWER_SET_SHUTDOWN_START = 0x5,
1016 /**
1017 * User has requested to turn off headunit's display, which is detected in android side.
1018 * The power controller may change the power state to VEHICLE_AP_POWER_STATE_ON_DISP_OFF.
1019 */
1020 VEHICLE_AP_POWER_SET_DISPLAY_OFF = 0x6,
1021 /**
1022 * User has requested to turn on headunit's display, most probably from power key input which
1023 * is attached to headunit. The power controller may change the power state to
1024 * VEHICLE_AP_POWER_STATE_ON_FULL.
1025 */
1026 VEHICLE_AP_POWER_SET_DISPLAY_ON = 0x7,
1027};
1028
1029/**
1030 * Property to represent brightness of the display. Some cars have single control for
1031 * the brightness of all displays and this property is to share change in that control.
1032 *
1033 * If this is writable, android side can set this value when user changes display brightness
1034 * from Settings. If this is read only, user may still change display brightness from Settings,
1035 * but that will not be reflected to other displays.
1036 *
1037 * @value_type VEHICLE_VALUE_TYPE_INT32
1038 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1039 * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_READ_WRITE
1040 * @data_member int32
1041 */
Steve Paikcc9e2922016-04-21 11:40:17 -07001042#define VEHICLE_PROPERTY_DISPLAY_BRIGHTNESS (0x00000A01)
Sanket Agarwalfb636682015-08-11 14:34:29 -07001043
1044
1045/**
1046 * Index in int32_array for VEHICLE_PROPERTY_AP_POWER_STATE property.
1047 */
1048enum vehicle_ap_power_state_index {
1049 VEHICLE_AP_POWER_STATE_INDEX_STATE = 0,
1050 VEHICLE_AP_POWER_STATE_INDEX_ADDITIONAL = 1,
1051};
1052
1053/**
1054* Property to report bootup reason for the current power on. This is a static property that will
1055* not change for the whole duration until power off. For example, even if user presses power on
1056* button after automatic power on with door unlock, bootup reason should stay with
1057* VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK.
1058*
1059* int32_value should be vehicle_ap_power_bootup_reason.
1060*
1061* @value_type VEHICLE_VALUE_TYPE_INT32
1062* @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
1063* @access VEHICLE_PROP_ACCESS_READ
1064* @data_member int32_value
1065*/
1066#define VEHICLE_PROPERTY_AP_POWER_BOOTUP_REASON (0x00000A02)
1067
1068/**
1069 * Enum to represent bootup reason.
1070 */
1071enum vehicle_ap_power_bootup_reason {
1072 /**
1073 * Power on due to user's pressing of power key or rotating of ignition switch.
1074 */
1075 VEHICLE_AP_POWER_BOOTUP_REASON_USER_POWER_ON = 0,
1076 /**
1077 * Automatic power on triggered by door unlock or any other kind of automatic user detection.
1078 */
1079 VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK = 1,
1080 /**
1081 * Automatic power on triggered by timer. This only happens when AP has asked wake-up after
1082 * certain time through time specified in VEHICLE_AP_POWER_SET_SHUTDOWN_START.
1083 */
1084 VEHICLE_AP_POWER_BOOTUP_REASON_TIMER = 2,
1085};
1086
Keun-young Parkcb354502016-02-08 18:15:55 -08001087
1088/**
1089 * Property to feed H/W input events to android
1090 *
1091 * int32_array[0] : action defined by vehicle_hw_key_input_action
1092 * int32_array[1] : key code, should use standard android key code
1093 * int32_array[2] : target display defined in vehicle_display. Events not tied
1094 * to specific display should be sent to DISPLAY_MAIN.
1095 * int32_array[3] : reserved for now. should be zero
1096 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
1097 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1098 * @access VEHICLE_PROP_ACCESS_READ
1099 * @config_flags
1100 * @data_member int32_array
1101 */
1102#define VEHICLE_PROPERTY_HW_KEY_INPUT (0x00000A10)
1103
1104enum vehicle_hw_key_input_action {
1105 /** Key down */
1106 VEHICLE_HW_KEY_INPUT_ACTION_DOWN = 0,
1107 /** Key up */
1108 VEHICLE_HW_KEY_INPUT_ACTION_UP = 1,
1109};
1110
1111enum vehicle_display {
1112 /** center console */
1113 VEHICLE_DISPLAY_MAIN = 0,
1114 VEHICLE_DISPLAY_INSTRUMENT_CLUSTER = 1,
1115};
1116
Sanket Agarwalfb636682015-08-11 14:34:29 -07001117/**
Keun-young Parkfe599a82016-02-12 14:26:57 -08001118 * Property to define instrument cluster information.
1119 * For CLUSTER_TYPE_EXTERNAL_DISPLAY:
1120 * READ:
1121 * int32_array[0] : The current screen mode index. Screen mode is defined
1122 * as a configuration in car service and represents which
1123 * area of screen is renderable.
1124 * int32_array[1] : Android can render to instrument cluster (=1) or not(=0). When this is 0,
1125 * instrument cluster may be rendering some information in the area
1126 * allocated for android and android side rendering is invisible. *
1127 * int32_array[2..3] : should be zero
1128 * WRITE from android:
1129 * int32_array[0] : Preferred mode for android side. Depending on the app rendering to instrument
1130 * cluster, preferred mode can change. Instrument cluster still needs to send
1131 * event with new mode to trigger actual mode change.
1132 * int32_array[1] : The current app context relevant for instrument cluster. Use the same flag
1133 * with vehicle_audio_context_flag but this context represents active apps, not
1134 * active audio. Instrument cluster side may change mode depending on the
1135 * currently active contexts.
1136 * int32_array[2..3] : should be zero
1137 * When system boots up, Android side will write {0, 0, 0, 0} when it is ready to render to
1138 * instrument cluster. Before this message, rendering from android should not be visible in the
1139 * cluster.
1140 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
1141 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1142 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1143 * @config_array 0:vehicle_instument_cluster_type 1:hw type
1144 * @data_member int32_array
1145 */
Steve Paikcc9e2922016-04-21 11:40:17 -07001146#define VEHICLE_PROPERTY_INSTRUMENT_CLUSTER_INFO (0x00000A20)
Keun-young Parkfe599a82016-02-12 14:26:57 -08001147
1148/**
1149 * Represents instrument cluster type available in system
1150 */
1151enum vehicle_instument_cluster_type {
1152 /** Android has no access to instument cluster */
1153 VEHICLE_INSTRUMENT_CLUSTER_TYPE_NONE = 0,
1154 /**
1155 * Instrument cluster can communicate through vehicle hal with additional
1156 * properties to exchange meta-data
1157 */
1158 VEHICLE_INSTRUMENT_CLUSTER_TYPE_HAL_INTERFACE = 1,
1159 /**
1160 * Instrument cluster is external display where android can render contents
1161 */
1162 VEHICLE_INSTRUMENT_CLUSTER_TYPE_EXTERNAL_DISPLAY = 2,
1163};
1164
Steve Paikd432fc02016-05-11 16:25:33 -07001165/**
1166 * Current date and time, encoded as Unix time.
1167 * This value denotes the number of seconds that have elapsed since 1/1/1970.
1168 *
1169 * @value_type VEHICLE_VALUE_TYPE_INT64
Keun-young Parkda3cb912016-05-12 11:21:04 -07001170 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
Steve Paikd432fc02016-05-11 16:25:33 -07001171 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1172 * @data_member int64_value
1173 * @unit VEHICLE_UNIT_TYPE_SECS
1174 */
1175#define VEHICLE_PROPERTY_UNIX_TIME (0x00000A30)
1176
1177/**
1178 * Current time only.
1179 * Some vehicles may not keep track of date. This property only affects the current time, in
1180 * seconds during the day. Thus, the max value for this parameter is 86,400 (24 * 60 * 60)
1181 *
1182 * @value_type VEHICLE_VALUE_TYPE_INT32
Keun-young Parkda3cb912016-05-12 11:21:04 -07001183 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
Steve Paikd432fc02016-05-11 16:25:33 -07001184 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1185 * @data_member int32_value
1186 * @unit VEHICLE_UNIT_TYPE_SECS
1187 */
1188#define VEHICLE_PROPERTY_CURRENT_TIME_IN_SECONDS (0x00000A31)
Steve Paikcc9e2922016-04-21 11:40:17 -07001189
Steve Paike588bae2016-06-29 17:06:16 -07001190
1191//==== Car Cabin Properties ====
Steve Paikcc9e2922016-04-21 11:40:17 -07001192/**
Steve Paike588bae2016-06-29 17:06:16 -07001193 * Most Car Cabin properties have both a MOVE and POSITION parameter associated with them.
Steve Paikcc9e2922016-04-21 11:40:17 -07001194 *
Steve Paike588bae2016-06-29 17:06:16 -07001195 * The MOVE parameter will start moving the device in the indicated direction. The magnitude
1196 * indicates the relative speed. For instance, setting the WINDOW_MOVE parameter to +1 will roll
1197 * the window up. Setting it to +2 (if available) will roll it up faster.
Steve Paikcc9e2922016-04-21 11:40:17 -07001198 *
Steve Paike588bae2016-06-29 17:06:16 -07001199 * The POSITION parameter will move the device to the desired position. For instance, if the
1200 * WINDOW_POS has a range of 0-100, then setting this parameter to 50 will open the window halfway.
1201 * Depending upon the initial position, the window may move up or down to the 50% value.
Steve Paikcc9e2922016-04-21 11:40:17 -07001202 *
Steve Paike588bae2016-06-29 17:06:16 -07001203 * OEMs may choose to implement one or both of the MOVE/POSITION parameters depending upon the
1204 * capability of the hardware.
1205 */
1206
1207// Doors
1208/**
1209 * Door position
1210 *
1211 * This is an integer in case a door may be set to a particular position. Max
1212 * value indicates fully open, min value (0) indicates fully closed.
1213 *
1214 * Some vehicles (minivans) can open the door electronically. Hence, the ability
1215 * to write this property.
1216 *
1217 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
Steve Paikcc9e2922016-04-21 11:40:17 -07001218 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
Steve Paike588bae2016-06-29 17:06:16 -07001219 * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
1220 * @zone_type VEHICLE_DOOR
Steve Paikd432fc02016-05-11 16:25:33 -07001221 * @data_member int32_value
Steve Paikcc9e2922016-04-21 11:40:17 -07001222 */
Steve Paike588bae2016-06-29 17:06:16 -07001223#define VEHICLE_PROPERTY_DOOR_POS (0x00000B00)
Steve Paikcc9e2922016-04-21 11:40:17 -07001224
1225/**
Steve Paike588bae2016-06-29 17:06:16 -07001226 * Door move
1227 *
1228 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1229 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1230 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1231 * @zone_type VEHICLE_DOOR
1232 * @data_member int32_value
1233 */
1234#define VEHICLE_PROPERTY_DOOR_MOVE (0x00000B01)
1235
1236
1237/**
1238 * Door lock
1239 *
1240 * 'true' indicates door is locked
1241 *
1242 * @value_type VEHICE_VALUE_TYPE_ZONED_BOOLEAN
1243 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1244 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1245 * @zone_type VEHICLE_DOOR
1246 * @data_member boolean_value
1247 */
1248#define VEHICLE_PROPERTY_DOOR_LOCK (0x00000B02)
1249
1250// Mirrors
1251/**
1252 * Mirror Z Position
1253 *
1254 * Positive value indicates tilt upwards, negative value is downwards
1255 *
1256 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1257 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1258 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1259 * @zone_type VEHICLE_MIRROR
1260 * @data_member int32_value
1261 */
1262#define VEHICLE_PROPERTY_MIRROR_Z_POS (0x00000B40)
1263
1264/**
1265 * Mirror Z Move
1266 *
1267 * Positive value indicates tilt upwards, negative value is downwards
1268 *
1269 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1270 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1271 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1272 * @zone_type VEHICLE_MIRROR
1273 * @data_member int32_value
1274 */
1275#define VEHICLE_PROPERTY_MIRROR_Z_MOVE (0x00000B41)
1276
1277/**
1278 * Mirror Y Position
1279 *
1280 * Positive value indicate tilt right, negative value is left
1281 *
1282 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1283 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1284 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1285 * @zone_type VEHICLE_MIRROR
1286 * @data_member int32_value
1287 */
1288#define VEHICLE_PROPERTY_MIRROR_Y_POS (0x00000B42)
1289
1290/**
1291 * Mirror Y Move
1292 *
1293 * Positive value indicate tilt right, negative value is left
1294 *
1295 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1296 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1297 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1298 * @zone_type VEHICLE_MIRROR
1299 * @data_member int32_value
1300 */
1301#define VEHICLE_PROPERTY_MIRROR_Y_MOVE (0x00000B43)
1302
1303/**
1304 * Mirror Lock
1305 *
1306 * True indicates mirror positions are locked and not changeable
1307 *
1308 * @value_type VEHICE_VALUE_TYPE_BOOLEAN
1309 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1310 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1311 * @data_member boolean_value
1312 */
1313#define VEHICLE_PROPERTY_MIRROR_LOCK (0x00000B44)
1314
1315/**
1316 * Mirror Heat
1317 *
1318 * Increase values denote higher heating levels.
1319 *
1320 * @value_type VEHICE_VALUE_TYPE_INT32
1321 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1322 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1323 * @data_member int32_value
1324 */
1325#define VEHICLE_PROPERTY_MIRROR_HEAT (0x00000B45)
1326
1327/**
1328 * Mirror Fold
1329 *
1330 * True indicates mirrors are folded
1331 *
1332 * @value_type VEHICE_VALUE_TYPE_BOOLEAN
1333 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1334 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1335 * @data_member boolean_value
1336 */
1337#define VEHICLE_PROPERTY_MIRROR_FOLD (0x00000B46)
1338
1339// Seats
1340/**
1341 * Seat memory select
Steve Paikcc9e2922016-04-21 11:40:17 -07001342 *
1343 * This parameter selects the memory preset to use to select the seat position.
1344 * The minValue is always 0, and the maxValue determines the number of seat
1345 * positions available.
1346 *
1347 * For instance, if the driver's seat has 3 memory presets, the maxValue will be 3.
1348 * When the user wants to select a preset, the desired preset number (1, 2, or 3)
1349 * is set.
1350 *
Keun-young Park7cb258e2016-04-25 18:37:28 -07001351 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
Steve Paikcc9e2922016-04-21 11:40:17 -07001352 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1353 * @access VEHICLE_PROP_ACCESS_WRITE
1354 * @zone_type VEHICLE_SEAT
Steve Paikd432fc02016-05-11 16:25:33 -07001355 * @data_member int32_value
Steve Paikcc9e2922016-04-21 11:40:17 -07001356 */
Steve Paike588bae2016-06-29 17:06:16 -07001357#define VEHICLE_PROPERTY_SEAT_MEMORY_SELECT (0x00000B80)
Steve Paikcc9e2922016-04-21 11:40:17 -07001358
1359/**
1360 * Seat memory set
1361 *
1362 * This setting allows the user to save the current seat position settings into
1363 * the selected preset slot. The maxValue for each seat position shall match
1364 * the maxValue for VEHICLE_PROPERTY_SEAT_MEMORY_SELECT.
1365 *
Keun-young Park7cb258e2016-04-25 18:37:28 -07001366 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
Steve Paikcc9e2922016-04-21 11:40:17 -07001367 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1368 * @access VEHICLE_PROP_ACCESS_WRITE
1369 * @zone_type VEHICLE_SEAT
Steve Paikd432fc02016-05-11 16:25:33 -07001370 * @data_member int32_value
Steve Paikcc9e2922016-04-21 11:40:17 -07001371 */
Steve Paike588bae2016-06-29 17:06:16 -07001372#define VEHICLE_PROPERTY_SEAT_MEMORY_SET (0x00000B81)
1373
1374/**
1375 * Seatbelt buckled
1376 *
1377 * True indicates belt is buckled.
1378 *
1379 * Write access indicates automatic seat buckling capabilities. There are no known cars at this
1380 * time, but you never know...
1381 *
1382 * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
1383 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1384 * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
1385 * @zone_type VEHICLE_SEAT
1386 * @data_member boolean_value
1387 */
1388#define VEHICLE_PROPERTY_SEAT_BELT_BUCKLED (0x00000B82)
1389
1390/**
1391 * Seatbelt height position
1392 *
1393 * Adjusts the shoulder belt anchor point.
1394 * Max value indicates highest position
1395 * Min value indicates lowest position
1396 *
1397 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1398 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1399 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1400 * @zone_type VEHICLE_SEAT
1401 * @data_member int32_value
1402 */
1403#define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_POS (0x00000B83)
1404
1405/**
1406 * Seatbelt height move
1407 *
1408 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1409 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1410 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1411 * @zone_type VEHICLE_SEAT
1412 * @data_member int32_value
1413 */
1414#define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_MOVE (0x00000B84)
1415
1416/**
1417 * Seat fore/aft position
1418 *
1419 * Sets the seat position forward (closer to steering wheel) and backwards.
1420 * Max value indicates closest to wheel, min value indicates most rearward
1421 * position.
1422 *
1423 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1424 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1425 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1426 * @zone_type VEHICLE_SEAT
1427 * @data_member int32_value
1428 */
1429#define VEHICLE_PROPERTY_SEAT_FORE_AFT_POS (0x00000B85)
1430
1431/**
1432 * Seat fore/aft move
1433 *
1434 * Moves the seat position forward and aft.
1435 *
1436 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1437 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1438 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1439 * @zone_type VEHICLE_SEAT
1440 * @data_member int32_value
1441 */
1442#define VEHICLE_PROPERTY_SEAT_FORE_AFT_MOVE (0x00000B86)
1443
1444/**
1445 * Seat backrest angle 1 position
1446 *
1447 * Backrest angle 1 is the actuator closest to the bottom of the seat.
1448 * Max value indicates angling forward towards the steering wheel.
1449 * Min value indicates full recline.
1450 *
1451 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1452 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1453 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1454 * @zone_type VEHICLE_SEAT
1455 * @data_member int32_value
1456 */
1457#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_POS (0x00000B87)
1458
1459/**
1460 * Seat backrest angle 1 move
1461 *
1462 * Moves the backrest forward or recline.
1463 *
1464 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1465 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1466 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1467 * @zone_type VEHICLE_SEAT
1468 * @data_member int32_value
1469 */
1470#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_MOVE (0x00000B88)
1471
1472/**
1473 * Seat backrest angle 2 position
1474 *
1475 * Backrest angle 2 is the next actuator up from the bottom of the seat.
1476 * Max value indicates angling forward towards the steering wheel.
1477 * Min value indicates full recline.
1478 *
1479 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1480 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1481 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1482 * @zone_type VEHICLE_SEAT
1483 * @data_member int32_value
1484 */
1485#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_POS (0x00000B89)
1486
1487/**
1488 * Seat backrest angle 2 move
1489 *
1490 * Moves the backrest forward or recline.
1491 *
1492 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1493 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1494 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1495 * @zone_type VEHICLE_SEAT
1496 * @data_member int32_value
1497 */
1498#define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_MOVE (0x00000B8A)
1499
1500/**
1501 * Seat height position
1502 *
1503 * Sets the seat height.
1504 * Max value indicates highest position.
1505 * Min value indicates lowest position.
1506 *
1507 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1508 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1509 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1510 * @zone_type VEHICLE_SEAT
1511 * @data_member int32_value
1512 */
1513#define VEHICLE_PROPERTY_SEAT_HEIGHT_POS (0x00000B8B)
1514
1515/**
1516 * Seat height move
1517 *
1518 * Moves the seat height.
1519 *
1520 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1521 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1522 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1523 * @zone_type VEHICLE_SEAT
1524 * @data_member int32_value
1525 */
1526#define VEHICLE_PROPERTY_SEAT_HEIGHT_MOVE (0x00000B8C)
1527
1528/**
1529 * Seat depth position
1530 *
1531 * Sets the seat depth, distance from back rest to front edge of seat.
1532 * Max value indicates longest depth position.
1533 * Min value indicates shortest position.
1534 *
1535 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1536 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1537 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1538 * @zone_type VEHICLE_SEAT
1539 * @data_member int32_value
1540 */
1541#define VEHICLE_PROPERTY_SEAT_DEPTH_POS (0x00000B8D)
1542
1543/**
1544 * Seat depth move
1545 *
1546 * Adjusts the seat depth.
1547 *
1548 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1549 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1550 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1551 * @zone_type VEHICLE_SEAT
1552 * @data_member int32_value
1553 */
1554#define VEHICLE_PROPERTY_SEAT_DEPTH_MOVE (0x00000B8E)
1555
1556/**
1557 * Seat tilt position
1558 *
1559 * Sets the seat tilt.
1560 * Max value indicates front edge of seat higher than back edge.
1561 * Min value indicates front edge of seat lower than back edge.
1562 *
1563 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1564 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1565 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1566 * @zone_type VEHICLE_SEAT
1567 * @data_member int32_value
1568 */
1569#define VEHICLE_PROPERTY_SEAT_TILT_POS (0x00000B8F)
1570
1571/**
1572 * Seat tilt move
1573 *
1574 * Tilts the seat.
1575 *
1576 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1577 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1578 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1579 * @zone_type VEHICLE_SEAT
1580 * @data_member int32_value
1581 */
1582#define VEHICLE_PROPERTY_SEAT_TILT_MOVE (0x00000B90)
1583
1584/**
1585 * Lumber fore/aft position
1586 *
1587 * Pushes the lumbar support forward and backwards
1588 * Max value indicates most forward position.
1589 * Min value indicates most rearward position.
1590 *
1591 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1592 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1593 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1594 * @zone_type VEHICLE_SEAT
1595 * @data_member int32_value
1596 */
1597#define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_POS (0x00000B91)
1598
1599/**
1600 * Lumbar fore/aft move
1601 *
1602 * Adjusts the lumbar support.
1603 *
1604 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1605 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1606 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1607 * @zone_type VEHICLE_SEAT
1608 * @data_member int32_value
1609 */
1610#define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_MOVE (0x00000B92)
1611
1612/**
1613 * Lumbar side support position
1614 *
1615 * Sets the amount of lateral lumbar support.
1616 * Max value indicates widest lumbar setting (i.e. least support)
1617 * Min value indicates thinnest lumbar setting.
1618 *
1619 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1620 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1621 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1622 * @zone_type VEHICLE_SEAT
1623 * @data_member int32_value
1624 */
1625#define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_POS (0x00000B93)
1626
1627/**
1628 * Lumbar side support move
1629 *
1630 * Adjusts the amount of lateral lumbar support.
1631 *
1632 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1633 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1634 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1635 * @zone_type VEHICLE_SEAT
1636 * @data_member int32_value
1637 */
1638#define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_MOVE (0x00000B94)
1639
1640/**
1641 * Headrest height position
1642 *
1643 * Sets the headrest height.
1644 * Max value indicates tallest setting.
1645 * Min value indicates shortest setting.
1646 *
1647 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1648 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1649 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1650 * @zone_type VEHICLE_SEAT
1651 * @data_member int32_value
1652 */
1653#define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_POS (0x00000B95)
1654
1655/**
1656 * Headrest heigh move
1657 *
1658 * Moves the headrest up and down.
1659 *
1660 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1661 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1662 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1663 * @zone_type VEHICLE_SEAT
1664 * @data_member int32_value
1665 */
1666#define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_MOVE (0x00000B96)
1667
1668/**
1669 * Headrest angle position
1670 *
1671 * Sets the angle of the headrest.
1672 * Max value indicates most upright angle.
1673 * Min value indicates shallowest headrest angle.
1674 *
1675 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1676 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1677 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1678 * @zone_type VEHICLE_SEAT
1679 * @data_member int32_value
1680 */
1681#define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_POS (0x00000B97)
1682
1683/**
1684 * Headrest angle move
1685 *
1686 * Adjusts the angle of the headrest
1687 *
1688 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1689 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1690 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1691 * @zone_type VEHICLE_SEAT
1692 * @data_member int32_value
1693 */
1694#define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_MOVE (0x00000B98)
1695
1696/**
1697 *
1698 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1699 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1700 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1701 * @zone_type VEHICLE_SEAT
1702 * @data_member int32_value
1703 */
1704#define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_POS (0x00000B99)
1705
1706/**
1707 *
1708 * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
1709 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1710 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1711 * @zone_type VEHICLE_SEAT
1712 * @data_member int32_value
1713 */
1714#define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_MOVE (0x00000B9A)
1715
1716
1717// Windows
1718/**
1719 * Window Position
1720 *
1721 * Max = window up / closed
1722 * Min = window down / open
1723 *
1724 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1725 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1726 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1727 * @data_member int32_value
1728 */
1729#define VEHICLE_PROPERTY_WINDOW_POS (0x00000BC0)
1730
1731/**
1732 * Window Move
1733 *
1734 * Max = window up / closed
1735 * Min = window down / open
1736 * Magnitude denotes relative speed. I.e. +2 is faster than +1 in raising the window.
1737 *
1738 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1739 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1740 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1741 * @data_member int32_value
1742 */
1743#define VEHICLE_PROPERTY_WINDOW_MOVE (0x00000BC1)
1744
1745/**
1746 * Window Vent Position
1747 *
1748 * This feature is used to control the vent feature on a sunroof.
1749 *
1750 * Max = vent open
1751 * Min = vent closed
1752 *
1753 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1754 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1755 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1756 * @data_member int32_value
1757 */
1758#define VEHICLE_PROPERTY_WINDOW_VENT_POS (0x00000BC2)
1759
1760/**
1761 * Window Vent Move
1762 *
1763 * This feature is used to control the vent feature on a sunroof.
1764 *
1765 * Max = vent open
1766 * Min = vent closed
1767 *
1768 * @value_type VEHICE_VALUE_TYPE_ZONED_INT32
1769 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1770 * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
1771 * @data_member int32_value
1772 */
1773#define VEHICLE_PROPERTY_WINDOW_VENT_MOVE (0x00000BC3)
1774
1775/**
1776 * Window Lock
1777 *
1778 * True indicates windows are locked and can't be moved.
1779 *
1780 * @value_type VEHICE_VALUE_TYPE_BOOLEAN
1781 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
1782 * @access VEHICLE_PROP_ACCESS_READ_WRITE
1783 * @data_member boolean_value
1784 */
1785#define VEHICLE_PROPERTY_WINDOW_LOCK (0x00000BC4)
1786
1787
Steve Paikcc9e2922016-04-21 11:40:17 -07001788
Keun-young Parkfe599a82016-02-12 14:26:57 -08001789/**
Sanket Agarwalfb636682015-08-11 14:34:29 -07001790 * H/W specific, non-standard property can be added as necessary. Such property should use
1791 * property number in range of [VEHICLE_PROPERTY_CUSTOM_START, VEHICLE_PROPERTY_CUSTOM_END].
1792 * Definition of property in this range is completely up to each HAL implementation.
1793 * For such property, it is recommended to fill vehicle_prop_config.config_string with some
1794 * additional information to help debugging. For example, company XYZ's custom extension may
1795 * include config_string of "com.XYZ.some_further_details".
1796 * @range_start
1797 */
Steve Paikcc9e2922016-04-21 11:40:17 -07001798#define VEHICLE_PROPERTY_CUSTOM_START (0x70000000)
Sanket Agarwalfb636682015-08-11 14:34:29 -07001799/** @range_end */
Steve Paikcc9e2922016-04-21 11:40:17 -07001800#define VEHICLE_PROPERTY_CUSTOM_END (0x73ffffff)
Sanket Agarwalfb636682015-08-11 14:34:29 -07001801
1802/**
1803 * Property range allocated for system's internal usage like testing. HAL should never declare
1804 * property in this range.
1805 * @range_start
1806 */
Steve Paikcc9e2922016-04-21 11:40:17 -07001807#define VEHICLE_PROPERTY_INTERNAL_START (0x74000000)
Sanket Agarwalfb636682015-08-11 14:34:29 -07001808/**
1809 * @range_end
1810 */
Steve Paikcc9e2922016-04-21 11:40:17 -07001811#define VEHICLE_PROPERTY_INTERNAL_END (0x74ffffff)
Sanket Agarwalfb636682015-08-11 14:34:29 -07001812
1813/**
1814 * Value types for various properties.
1815 */
1816enum vehicle_value_type {
1817 VEHICLE_VALUE_TYPE_SHOUD_NOT_USE = 0x00, // value_type should never set to 0.
1818 VEHICLE_VALUE_TYPE_STRING = 0x01,
1819 VEHICLE_VALUE_TYPE_BYTES = 0x02,
1820 VEHICLE_VALUE_TYPE_BOOLEAN = 0x03,
Keun-young Park73d7f222016-01-14 11:02:38 -08001821 VEHICLE_VALUE_TYPE_ZONED_BOOLEAN = 0x04,
1822 VEHICLE_VALUE_TYPE_INT64 = 0x05,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001823 VEHICLE_VALUE_TYPE_FLOAT = 0x10,
1824 VEHICLE_VALUE_TYPE_FLOAT_VEC2 = 0x11,
1825 VEHICLE_VALUE_TYPE_FLOAT_VEC3 = 0x12,
1826 VEHICLE_VALUE_TYPE_FLOAT_VEC4 = 0x13,
1827 VEHICLE_VALUE_TYPE_INT32 = 0x20,
1828 VEHICLE_VALUE_TYPE_INT32_VEC2 = 0x21,
1829 VEHICLE_VALUE_TYPE_INT32_VEC3 = 0x22,
1830 VEHICLE_VALUE_TYPE_INT32_VEC4 = 0x23,
Keun-young Park73d7f222016-01-14 11:02:38 -08001831 VEHICLE_VALUE_TYPE_ZONED_FLOAT = 0x30,
1832 VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC2 = 0x31,
1833 VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC3 = 0x32,
Keun-young Parkab68e372016-03-10 16:28:42 -08001834 VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC4 = 0x33,
Keun-young Park73d7f222016-01-14 11:02:38 -08001835 VEHICLE_VALUE_TYPE_ZONED_INT32 = 0x40,
1836 VEHICLE_VALUE_TYPE_ZONED_INT32_VEC2 = 0x41,
1837 VEHICLE_VALUE_TYPE_ZONED_INT32_VEC3 = 0x42,
Keun-young Parkab68e372016-03-10 16:28:42 -08001838 VEHICLE_VALUE_TYPE_ZONED_INT32_VEC4 = 0x43,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001839};
1840
1841/**
1842 * Units used for int or float type with no attached enum types.
1843 */
1844enum vehicle_unit_type {
1845 VEHICLE_UNIT_TYPE_SHOULD_NOT_USE = 0x00000000,
1846 // speed related items
1847 VEHICLE_UNIT_TYPE_METER_PER_SEC = 0x00000001,
1848 VEHICLE_UNIT_TYPE_RPM = 0x00000002,
1849 VEHICLE_UNIT_TYPE_HZ = 0x00000003,
1850 // kind of ratio
1851 VEHICLE_UNIT_TYPE_PERCENTILE = 0x00000010,
1852 // length
1853 VEHICLE_UNIT_TYPE_MILLIMETER = 0x00000020,
1854 VEHICLE_UNIT_TYPE_METER = 0x00000021,
1855 VEHICLE_UNIT_TYPE_KILOMETER = 0x00000023,
1856 // temperature
1857 VEHICLE_UNIT_TYPE_CELCIUS = 0x00000030,
1858 // volume
1859 VEHICLE_UNIT_TYPE_MILLILITER = 0x00000040,
1860 // time
1861 VEHICLE_UNIT_TYPE_NANO_SECS = 0x00000050,
Steve Paikd432fc02016-05-11 16:25:33 -07001862 VEHICLE_UNIT_TYPE_SECS = 0x00000053,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001863 VEHICLE_UNIT_TYPE_YEAR = 0x00000059,
1864};
1865
1866/**
Sanket Agarwalfb636682015-08-11 14:34:29 -07001867 * This describes how value of property can change.
1868 */
1869enum vehicle_prop_change_mode {
1870 /**
1871 * Property of this type will *never* change. This property will not support subscription, but
1872 * will support get
1873 */
1874 VEHICLE_PROP_CHANGE_MODE_STATIC = 0x00,
1875 /**
Keun-young Parkda3cb912016-05-12 11:21:04 -07001876 * Property of this type will be reported when there is a change.
1877 * get call should return the current value.
1878 * Set operation for this property is assumed to be asynchronous. When the property is read
Keun-young Parke086bd72016-05-24 09:41:54 -07001879 * (get) after set, it may still return old value until underlying H/W backing this property
Keun-young Parkda3cb912016-05-12 11:21:04 -07001880 * has actually changed the state. Once state is changed, the property will dispatch changed
1881 * value as event.
Sanket Agarwalfb636682015-08-11 14:34:29 -07001882 */
1883 VEHICLE_PROP_CHANGE_MODE_ON_CHANGE = 0x01,
1884 /**
1885 * Property of this type change continuously and requires fixed rate of sampling to retrieve
1886 * the data.
1887 */
1888 VEHICLE_PROP_CHANGE_MODE_CONTINUOUS = 0x02,
Steve Paikd432fc02016-05-11 16:25:33 -07001889 /**
1890 * Property of this type may be polled to get the current value.
1891 */
1892 VEHICLE_PROP_CHANGE_MODE_POLL = 0x03,
Keun-young Parkda3cb912016-05-12 11:21:04 -07001893 /**
1894 * This is for property where change event should be sent only when the value is
1895 * set from external component. Normal value change will not trigger event.
1896 * For example, clock property can send change event only when it is set, outside android,
1897 * for case like user setting time or time getting update. There is no need to send it
1898 * per every value change.
1899 */
1900 VEHICLE_PROP_CHANGE_MODE_ON_SET = 0x04,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001901};
1902
1903/**
1904 * Property config defines the capabilities of it. User of the API
1905 * should first get the property config to understand the output from get()
1906 * commands and also to ensure that set() or events commands are in sync with
1907 * the expected output.
1908 */
1909enum vehicle_prop_access {
1910 VEHICLE_PROP_ACCESS_READ = 0x01,
1911 VEHICLE_PROP_ACCESS_WRITE = 0x02,
1912 VEHICLE_PROP_ACCESS_READ_WRITE = 0x03
1913};
1914
1915/**
1916 * These permissions define how the OEMs want to distribute their information and security they
1917 * want to apply. On top of these restrictions, android will have additional
1918 * 'app-level' permissions that the apps will need to ask the user before the apps have the
1919 * information.
1920 * This information should be kept in vehicle_prop_config.permission_model.
1921 */
1922enum vehicle_permission_model {
1923 /**
1924 * No special restriction, but each property can still require specific android app-level
1925 * permission.
1926 */
1927 VEHICLE_PERMISSION_NO_RESTRICTION = 0,
1928 /** Signature only. Only APKs signed with OEM keys are allowed. */
1929 VEHICLE_PERMISSION_OEM_ONLY = 0x1,
1930 /** System only. APKs built-in to system can access the property. */
1931 VEHICLE_PERMISSION_SYSTEM_APP_ONLY = 0x2,
1932 /** Equivalent to “system|signature” */
1933 VEHICLE_PERMISSION_OEM_OR_SYSTEM_APP = 0x3
1934};
1935
Keun-young Park418c7e82016-04-06 10:44:20 -07001936
1937/**
1938 * Special values for INT32/FLOAT (including ZONED types)
1939 * These values represent special state, which is outside MIN/MAX range but can happen.
1940 * For example, HVAC temperature may use out of range min / max to represent that
1941 * it is working in full power although target temperature has separate min / max.
1942 * OUT_OF_RANGE_OFF can represent a state where the property is powered off.
1943 * Usually such property will have separate property to control power.
1944 */
1945
1946#define VEHICLE_INT_OUT_OF_RANGE_MAX (INT32_MAX)
1947#define VEHICLE_INT_OUT_OF_RANGE_MIN (INT32_MIN)
1948#define VEHICLE_INT_OUT_OF_RANGE_OFF (INT32_MIN + 1)
1949
1950#define VEHICLE_FLOAT_OUT_OF_RANGE_MAX (INFINITY)
1951#define VEHICLE_FLOAT_OUT_OF_RANGE_MIN (-INFINITY)
Keun-young Parkf1ccec12016-04-22 13:19:53 -07001952#define VEHICLE_FLOAT_OUT_OF_RANGE_OFF (NAN)
Keun-young Park418c7e82016-04-06 10:44:20 -07001953
Sanket Agarwalfb636682015-08-11 14:34:29 -07001954/**
1955 * Car states.
1956 *
1957 * The driving states determine what features of the UI will be accessible.
1958 */
1959enum vehicle_driving_status {
1960 VEHICLE_DRIVING_STATUS_UNRESTRICTED = 0x00,
1961 VEHICLE_DRIVING_STATUS_NO_VIDEO = 0x01,
1962 VEHICLE_DRIVING_STATUS_NO_KEYBOARD_INPUT = 0x02,
1963 VEHICLE_DRIVING_STATUS_NO_VOICE_INPUT = 0x04,
1964 VEHICLE_DRIVING_STATUS_NO_CONFIG = 0x08,
1965 VEHICLE_DRIVING_STATUS_LIMIT_MESSAGE_LEN = 0x10
1966};
1967
1968/**
1969 * Various gears which can be selected by user and chosen in system.
1970 */
1971enum vehicle_gear {
1972 // Gear selections present in both automatic and manual cars.
1973 VEHICLE_GEAR_NEUTRAL = 0x0001,
1974 VEHICLE_GEAR_REVERSE = 0x0002,
1975
1976 // Gear selections (mostly) present only in automatic cars.
Keun-young Park77761e22016-03-08 15:02:44 -08001977 VEHICLE_GEAR_PARK = 0x0004,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001978 VEHICLE_GEAR_DRIVE = 0x0008,
Keun-young Park77761e22016-03-08 15:02:44 -08001979 VEHICLE_GEAR_LOW = 0x0010,
Sanket Agarwalfb636682015-08-11 14:34:29 -07001980
1981 // Other possible gear selections (maybe present in manual or automatic
1982 // cars).
1983 VEHICLE_GEAR_1 = 0x0010,
1984 VEHICLE_GEAR_2 = 0x0020,
1985 VEHICLE_GEAR_3 = 0x0040,
1986 VEHICLE_GEAR_4 = 0x0080,
1987 VEHICLE_GEAR_5 = 0x0100,
1988 VEHICLE_GEAR_6 = 0x0200,
1989 VEHICLE_GEAR_7 = 0x0400,
1990 VEHICLE_GEAR_8 = 0x0800,
1991 VEHICLE_GEAR_9 = 0x1000
1992};
1993
1994
1995/**
1996 * Various zones in the car.
1997 *
1998 * Zones are used for Air Conditioning purposes and divide the car into physical
1999 * area zones.
2000 */
2001enum vehicle_zone {
2002 VEHICLE_ZONE_ROW_1_LEFT = 0x00000001,
2003 VEHICLE_ZONE_ROW_1_CENTER = 0x00000002,
2004 VEHICLE_ZONE_ROW_1_RIGHT = 0x00000004,
2005 VEHICLE_ZONE_ROW_1_ALL = 0x00000008,
2006 VEHICLE_ZONE_ROW_2_LEFT = 0x00000010,
2007 VEHICLE_ZONE_ROW_2_CENTER = 0x00000020,
2008 VEHICLE_ZONE_ROW_2_RIGHT = 0x00000040,
2009 VEHICLE_ZONE_ROW_2_ALL = 0x00000080,
2010 VEHICLE_ZONE_ROW_3_LEFT = 0x00000100,
2011 VEHICLE_ZONE_ROW_3_CENTER = 0x00000200,
2012 VEHICLE_ZONE_ROW_3_RIGHT = 0x00000400,
2013 VEHICLE_ZONE_ROW_3_ALL = 0x00000800,
2014 VEHICLE_ZONE_ROW_4_LEFT = 0x00001000,
2015 VEHICLE_ZONE_ROW_4_CENTER = 0x00002000,
2016 VEHICLE_ZONE_ROW_4_RIGHT = 0x00004000,
2017 VEHICLE_ZONE_ROW_4_ALL = 0x00008000,
2018 VEHICLE_ZONE_ALL = 0x80000000,
2019};
2020
2021/**
2022 * Various Seats in the car.
2023 */
2024enum vehicle_seat {
Keun-young Parka384f832016-02-11 16:50:42 -08002025 VEHICLE_SEAT_DRIVER_LHD = 0x0001,
2026 VEHICLE_SEAT_DRIVER_RHD = 0x0002,
2027 VEHICLE_SEAT_ROW_1_PASSENGER_LEFT = 0x0010,
2028 VEHICLE_SEAT_ROW_1_PASSENGER_CENTER = 0x0020,
2029 VEHICLE_SEAT_ROW_1_PASSENGER_RIGHT = 0x0040,
2030 VEHICLE_SEAT_ROW_2_PASSENGER_LEFT = 0x0100,
2031 VEHICLE_SEAT_ROW_2_PASSENGER_CENTER = 0x0200,
2032 VEHICLE_SEAT_ROW_2_PASSENGER_RIGHT = 0x0400,
2033 VEHICLE_SEAT_ROW_3_PASSENGER_LEFT = 0x1000,
2034 VEHICLE_SEAT_ROW_3_PASSENGER_CENTER = 0x2000,
2035 VEHICLE_SEAT_ROW_3_PASSENGER_RIGHT = 0x4000
Sanket Agarwalfb636682015-08-11 14:34:29 -07002036};
2037
2038/**
2039 * Various windshields/windows in the car.
2040 */
2041enum vehicle_window {
2042 VEHICLE_WINDOW_FRONT_WINDSHIELD = 0x0001,
2043 VEHICLE_WINDOW_REAR_WINDSHIELD = 0x0002,
2044 VEHICLE_WINDOW_ROOF_TOP = 0x0004,
2045 VEHICLE_WINDOW_ROW_1_LEFT = 0x0010,
2046 VEHICLE_WINDOW_ROW_1_RIGHT = 0x0020,
2047 VEHICLE_WINDOW_ROW_2_LEFT = 0x0100,
2048 VEHICLE_WINDOW_ROW_2_RIGHT = 0x0200,
2049 VEHICLE_WINDOW_ROW_3_LEFT = 0x1000,
2050 VEHICLE_WINDOW_ROW_3_RIGHT = 0x2000,
2051};
2052
Keun-young Parkcb354502016-02-08 18:15:55 -08002053enum vehicle_door {
2054 VEHICLE_DOOR_ROW_1_LEFT = 0x00000001,
2055 VEHICLE_DOOR_ROW_1_RIGHT = 0x00000004,
2056 VEHICLE_DOOR_ROW_2_LEFT = 0x00000010,
2057 VEHICLE_DOOR_ROW_2_RIGHT = 0x00000040,
2058 VEHICLE_DOOR_ROW_3_LEFT = 0x00000100,
2059 VEHICLE_DOOR_ROW_3_RIGHT = 0x00000400,
2060 VEHICLE_DOOR_HOOD = 0x10000000,
2061 VEHICLE_DOOR_REAR = 0x20000000,
2062};
2063
2064enum vehicle_mirror {
2065 VEHICLE_MIRROR_DRIVER_LEFT = 0x00000001,
2066 VEHICLE_MIRROR_DRIVER_RIGHT = 0x00000002,
2067 VEHICLE_MIRROR_DRIVER_CENTER = 0x00000004,
2068};
Sanket Agarwalfb636682015-08-11 14:34:29 -07002069enum vehicle_turn_signal {
2070 VEHICLE_SIGNAL_NONE = 0x00,
2071 VEHICLE_SIGNAL_RIGHT = 0x01,
2072 VEHICLE_SIGNAL_LEFT = 0x02,
2073 VEHICLE_SIGNAL_EMERGENCY = 0x04
2074};
2075
2076/*
2077 * Boolean type.
2078 */
2079enum vehicle_boolean {
2080 VEHICLE_FALSE = 0x00,
2081 VEHICLE_TRUE = 0x01
2082};
2083
2084typedef int32_t vehicle_boolean_t;
2085
2086/**
2087 * Vehicle string.
2088 *
2089 * Defines a UTF8 encoded sequence of bytes that should be used for string
2090 * representation throughout.
2091 */
2092typedef struct vehicle_str {
2093 uint8_t* data;
2094 int32_t len;
2095} vehicle_str_t;
2096
2097/**
2098 * Vehicle byte array.
2099 * This is for passing generic raw data.
2100 */
2101typedef vehicle_str_t vehicle_bytes_t;
2102
Sanket Agarwalfb636682015-08-11 14:34:29 -07002103typedef struct vehicle_prop_config {
2104 int32_t prop;
2105
2106 /**
2107 * Defines if the property is read or write. Value should be one of
2108 * enum vehicle_prop_access.
2109 */
2110 int32_t access;
2111
2112 /**
2113 * Defines if the property is continuous or on-change. Value should be one
2114 * of enum vehicle_prop_change_mode.
2115 */
2116 int32_t change_mode;
2117
2118 /**
2119 * Type of data used for this property. This type is fixed per each property.
2120 * Check vehicle_value_type for allowed value.
2121 */
2122 int32_t value_type;
2123
2124 /**
2125 * Define necessary permission model to access the data.
2126 */
2127 int32_t permission_model;
Keun-young Parkab68e372016-03-10 16:28:42 -08002128
Sanket Agarwalfb636682015-08-11 14:34:29 -07002129 /**
2130 * Some of the properties may have associated zones (such as hvac), in these
2131 * cases the config should contain an ORed value for the associated zone.
2132 */
2133 union {
2134 /**
Sanket Agarwalfb636682015-08-11 14:34:29 -07002135 * The value is derived by ORing one or more of enum vehicle_zone members.
2136 */
2137 int32_t vehicle_zone_flags;
2138 /** The value is derived by ORing one or more of enum vehicle_seat members. */
2139 int32_t vehicle_seat_flags;
2140 /** The value is derived by ORing one or more of enum vehicle_window members. */
2141 int32_t vehicle_window_flags;
Keun-young Parkab68e372016-03-10 16:28:42 -08002142 };
Sanket Agarwalfb636682015-08-11 14:34:29 -07002143
Keun-young Parkab68e372016-03-10 16:28:42 -08002144 /**
2145 * Property specific configuration information. Usage of this will be defined per each property.
2146 */
2147 union {
2148 /**
2149 * For generic configuration information
2150 */
2151 int32_t config_flags;
Sanket Agarwalfb636682015-08-11 14:34:29 -07002152 /** The number of presets that are stored by the radio module. Pass 0 if
2153 * there are no presets available. The range of presets is defined to be
2154 * from 1 (see VEHICLE_RADIO_PRESET_MIN_VALUE) to vehicle_radio_num_presets.
2155 */
2156 int32_t vehicle_radio_num_presets;
Keun-young Parkbf877a72015-12-21 14:16:05 -08002157 int32_t config_array[4];
Sanket Agarwalfb636682015-08-11 14:34:29 -07002158 };
2159
2160 /**
2161 * Some properties may require additional information passed over this string. Most properties
2162 * do not need to set this and in that case, config_string.data should be NULL and
2163 * config_string.len should be 0.
2164 */
2165 vehicle_str_t config_string;
2166
2167 /**
2168 * Specify minimum allowed value for the property. This is necessary for property which does
2169 * not have specified enum.
2170 */
2171 union {
2172 float float_min_value;
2173 int32_t int32_min_value;
2174 int64_t int64_min_value;
2175 };
2176
2177 /**
2178 * Specify maximum allowed value for the property. This is necessary for property which does
2179 * not have specified enum.
2180 */
2181 union {
2182 float float_max_value;
2183 int32_t int32_max_value;
2184 int64_t int64_max_value;
2185 };
2186
2187 /**
Keun-young Parkfe599a82016-02-12 14:26:57 -08002188 * Array of min values for zoned properties. Zoned property can specify min / max value in two
2189 * different ways:
2190 * 1. All zones having the same min / max value: *_min/max_value should be set and this
2191 * array should be set to NULL.
2192 * 2. All zones having separate min / max value: *_min/max_values array should be populated
2193 * and its length should be the same as number of active zones specified by *_zone_flags.
Keun-young Parkab68e372016-03-10 16:28:42 -08002194 *
2195 * Should be NULL if each zone does not have separate max values.
Keun-young Parkfe599a82016-02-12 14:26:57 -08002196 */
2197 union {
2198 float* float_min_values;
2199 int32_t* int32_min_values;
2200 int64_t* int64_min_values;
2201 };
2202
2203 /**
2204 * Array of max values for zoned properties. See above for its usage.
Keun-young Parkab68e372016-03-10 16:28:42 -08002205 * Should be NULL if each zone does not have separate max values.
2206 * If not NULL, length of array should match that of min_values.
Keun-young Parkfe599a82016-02-12 14:26:57 -08002207 */
2208 union {
2209 float* float_max_values;
2210 int32_t* int32_max_values;
2211 int64_t* int64_max_values;
2212 };
2213
2214 /**
Sanket Agarwalfb636682015-08-11 14:34:29 -07002215 * Min sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
2216 */
2217 float min_sample_rate;
2218 /**
2219 * Max sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
2220 */
2221 float max_sample_rate;
2222 /**
2223 * Place holder for putting HAL implementation specific data. Usage is wholly up to HAL
2224 * implementation.
2225 */
2226 void* hal_data;
2227} vehicle_prop_config_t;
2228
2229/**
2230 * HVAC property fields.
2231 *
2232 * Defines various HVAC properties which are packed into vehicle_hvac_t (see
2233 * below). We define these properties outside in global scope so that HAL
2234 * implementation and HAL users (JNI) can typecast vehicle_hvac correctly.
2235 */
Sanket Agarwalfb636682015-08-11 14:34:29 -07002236typedef struct vehicle_hvac {
2237 /**
2238 * Define one structure for each possible HVAC property.
2239 * NOTES:
Keun-young Parkab68e372016-03-10 16:28:42 -08002240 * a) Fan speed is a number from (0 - 6) where 6 is the highest speed. (TODO define enum)
2241 * b) Temperature is a floating point Celcius scale.
2242 * c) Direction is defined in enum vehicle_fan_direction.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002243 *
2244 * The HAL should create #entries number of vehicle_hvac_properties and
2245 * assign it to "properties" variable below.
2246 */
2247 union {
Keun-young Parkab68e372016-03-10 16:28:42 -08002248 int32_t fan_speed;
2249 int32_t fan_direction;
2250 vehicle_boolean_t ac_on;
2251 vehicle_boolean_t max_ac_on;
2252 vehicle_boolean_t max_defrost_on;
2253 vehicle_boolean_t recirc_on;
2254 vehicle_boolean_t dual_on;
Steve Paik670e7ab2016-04-29 16:32:02 -07002255 vehicle_boolean_t auto_on;
Keun-young Park418c7e82016-04-06 10:44:20 -07002256 vehicle_boolean_t power_on;
Sanket Agarwalfb636682015-08-11 14:34:29 -07002257
Keun-young Parkab68e372016-03-10 16:28:42 -08002258 float temperature_current;
2259 float temperature_set;
Sanket Agarwalfb636682015-08-11 14:34:29 -07002260
Keun-young Parkab68e372016-03-10 16:28:42 -08002261 vehicle_boolean_t defrost_on;
Sanket Agarwalfb636682015-08-11 14:34:29 -07002262 };
2263} vehicle_hvac_t;
2264
2265/*
2266 * Defines how the values for various properties are represented.
2267 *
2268 * There are two ways to populate and access the fields:
2269 * a) Using the individual fields. Use this mechanism (see
2270 * info_manufacture_date, fuel_capacity fields etc).
2271 * b) Using the union accessors (see uint32_value, float_value etc).
2272 *
2273 * To add a new field make sure that it does not exceed the total union size
2274 * (defined in int_array) and it is one of the vehicle_value_type. Then add the
2275 * field name with its unit to union. If the field type is not yet defined (as
2276 * of this draft, we don't use int64_t) then add that type to vehicle_value_type
2277 * and have an accessor (so for int64_t it will be int64_t int64_value).
2278 */
2279typedef union vehicle_value {
2280 /** Define the max size of this structure. */
2281 int32_t int32_array[4];
2282 float float_array[4];
2283
2284 // Easy accessors for union members (HAL implementation SHOULD NOT USE these
2285 // fields while populating, use the property specific fields below instead).
2286 int32_t int32_value;
2287 int64_t int64_value;
2288 float float_value;
2289 vehicle_str_t str_value;
2290 vehicle_bytes_t bytes_value;
2291 vehicle_boolean_t boolean_value;
Sanket Agarwalfb636682015-08-11 14:34:29 -07002292
2293 // Vehicle Information.
2294 vehicle_str_t info_vin;
2295 vehicle_str_t info_make;
2296 vehicle_str_t info_model;
2297 int32_t info_model_year;
2298
2299 // Represented in milliliters.
2300 float info_fuel_capacity;
2301
2302 float vehicle_speed;
2303 float odometer;
2304
2305 // Engine sensors.
2306
2307 // Represented in milliliters.
2308 //float engine_coolant_level;
2309 // Represented in celcius.
2310 float engine_coolant_temperature;
2311 // Represented in a percentage value.
2312 //float engine_oil_level;
2313 // Represented in celcius.
2314 float engine_oil_temperature;
2315 float engine_rpm;
2316
2317 // Event sensors.
2318 // Value should be one of enum vehicle_gear_selection.
2319 int32_t gear_selection;
2320 // Value should be one of enum vehicle_gear.
2321 int32_t gear_current_gear;
2322 // Value should be one of enum vehicle_boolean.
2323 int32_t parking_brake;
2324 // If cruise_set_speed > 0 then cruise is ON otherwise cruise is OFF.
2325 // Unit: meters / second (m/s).
2326 //int32_t cruise_set_speed;
2327 // Value should be one of enum vehicle_boolean.
2328 int32_t is_fuel_level_low;
2329 // Value should be one of enum vehicle_driving_status.
2330 int32_t driving_status;
2331 int32_t night_mode;
2332 // Value should be one of emum vehicle_turn_signal.
2333 int32_t turn_signals;
2334 // Value should be one of enum vehicle_boolean.
2335 //int32_t engine_on;
2336
2337 // HVAC properties.
2338 vehicle_hvac_t hvac;
2339
2340 float outside_temperature;
Keun-young Parkcb354502016-02-08 18:15:55 -08002341 float cabin_temperature;
2342
Sanket Agarwalfb636682015-08-11 14:34:29 -07002343} vehicle_value_t;
2344
2345/*
2346 * Encapsulates the property name and the associated value. It
2347 * is used across various API calls to set values, get values or to register for
2348 * events.
2349 */
2350typedef struct vehicle_prop_value {
2351 /* property identifier */
2352 int32_t prop;
2353
2354 /* value type of property for quick conversion from union to appropriate
2355 * value. The value must be one of enum vehicle_value_type.
2356 */
2357 int32_t value_type;
2358
2359 /** time is elapsed nanoseconds since boot */
2360 int64_t timestamp;
2361
Keun-young Parkab68e372016-03-10 16:28:42 -08002362 /**
2363 * Zone information for zoned property. For non-zoned property, this should be ignored.
2364 */
2365 union {
2366 int32_t zone;
2367 int32_t seat;
2368 int32_t window;
2369 };
2370
Sanket Agarwalfb636682015-08-11 14:34:29 -07002371 vehicle_value_t value;
2372} vehicle_prop_value_t;
2373
2374/*
2375 * Event callback happens whenever a variable that the API user has subscribed
2376 * to needs to be reported. This may be based purely on threshold and frequency
2377 * (a regular subscription, see subscribe call's arguments) or when the set()
2378 * command is executed and the actual change needs to be reported.
2379 *
2380 * event_data is OWNED by the HAL and should be copied before the callback
2381 * finishes.
2382 */
2383typedef int (*vehicle_event_callback_fn)(const vehicle_prop_value_t *event_data);
2384
2385
2386/**
2387 * Represent the operation where the current error has happened.
2388 */
2389enum vehicle_property_operation {
2390 /** Generic error to this property which is not tied to any operation. */
2391 VEHICLE_OPERATION_GENERIC = 0,
2392 /** Error happened while handling property set. */
2393 VEHICLE_OPERATION_SET = 1,
2394 /** Error happened while handling property get. */
2395 VEHICLE_OPERATION_GET = 2,
2396 /** Error happened while handling property subscription. */
2397 VEHICLE_OPERATION_SUBSCRIBE = 3,
2398};
2399
2400/*
Keun-young Parkab68e372016-03-10 16:28:42 -08002401 * Suggests that an error condition has occurred.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002402 *
Keun-young Parkab68e372016-03-10 16:28:42 -08002403 * @param error_code Error code. error_code should be standard error code with
2404 * negative value like -EINVAL.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002405 * @parm property Note a property where error has happened. If this is generic error, property
2406 * should be VEHICLE_PROPERTY_INVALID.
2407 * @param operation Represent the operation where the error has happened. Should be one of
2408 * vehicle_property_operation.
2409 */
2410typedef int (*vehicle_error_callback_fn)(int32_t error_code, int32_t property, int32_t operation);
2411
2412/************************************************************************************/
2413
2414/*
2415 * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
2416 * and the fields of this data structure must begin with hw_module_t
2417 * followed by module specific information.
2418 */
2419typedef struct vehicle_module {
2420 struct hw_module_t common;
2421} vehicle_module_t;
2422
2423
2424typedef struct vehicle_hw_device {
2425 struct hw_device_t common;
2426
2427 /**
2428 * After calling open on device the user should register callbacks for event and error
2429 * functions.
2430 */
2431 int (*init)(struct vehicle_hw_device* device,
2432 vehicle_event_callback_fn event_fn, vehicle_error_callback_fn err_fn);
2433 /**
2434 * Before calling close the user should destroy the registered callback
2435 * functions.
2436 * In case the unsubscribe() call is not called on all properties before
2437 * release() then release() will unsubscribe the properties itself.
2438 */
2439 int (*release)(struct vehicle_hw_device* device);
2440
2441 /**
2442 * Enumerate all available properties. The list is returned in "list".
2443 * @param num_properties number of properties contained in the retuned array.
2444 * @return array of property configs supported by this car. Note that returned data is const
2445 * and caller cannot modify it. HAL implementation should keep this memory until HAL
2446 * is released to avoid copying this again.
2447 */
2448 vehicle_prop_config_t const *(*list_properties)(struct vehicle_hw_device* device,
2449 int* num_properties);
2450
2451 /**
2452 * Get a vehicle property value immediately. data should be allocated
2453 * properly.
2454 * The caller of the API OWNS the data field.
Keun-young Park08c255e2015-12-09 13:47:30 -08002455 * Caller will set data->prop, data->value_type, and optionally zone value for zoned property.
2456 * But HAL implementation needs to fill all entries properly when returning.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002457 * For pointer type, HAL implementation should allocate necessary memory and caller is
Keun-young Parkab68e372016-03-10 16:28:42 -08002458 * responsible for calling release_memory_from_get, which allows HAL to release allocated
2459 * memory.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002460 * For VEHICLE_PROP_CHANGE_MODE_STATIC type of property, get should return the same value
2461 * always.
2462 * For VEHICLE_PROP_CHANGE_MODE_ON_CHANGE type of property, it should return the latest value.
Keun-young Parkab68e372016-03-10 16:28:42 -08002463 * If there is no data available yet, which can happen during initial stage, this call should
2464 * return immediately with error code of -EAGAIN.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002465 */
2466 int (*get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data);
2467
2468 /**
Keun-young Parkab68e372016-03-10 16:28:42 -08002469 * Release memory allocated to data in previous get call. get call for byte or string involves
2470 * allocating necessary memory from vehicle hal.
2471 * To be safe, memory allocated by vehicle hal should be released by vehicle hal and vehicle
2472 * network service will call this when data from vehicle hal is no longer necessary.
2473 * vehicle hal implementation should only release member of vehicle_prop_value_t like
2474 * data->str_value.data or data->bytes_value.data but not data itself as data itself is
2475 * allocated from vehicle network service. Once memory is freed, corresponding pointer should
2476 * be set to NULL bu vehicle hal.
2477 */
2478 void (*release_memory_from_get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data);
2479
2480 /**
Sanket Agarwalfb636682015-08-11 14:34:29 -07002481 * Set a vehicle property value. data should be allocated properly and not
2482 * NULL.
2483 * The caller of the API OWNS the data field.
2484 * timestamp of data will be ignored for set operation.
Keun-young Park418c7e82016-04-06 10:44:20 -07002485 * Setting some properties require having initial state available. Depending on the vehicle hal,
2486 * such initial data may not be available for short time after init. In such case, set call
2487 * can return -EAGAIN like get call.
Keun-young Parkf7097582016-04-25 18:10:45 -07002488 * For a property with separate power control, set can fail if the property is not powered on.
2489 * In such case, hal should return -ESHUTDOWN error.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002490 */
2491 int (*set)(struct vehicle_hw_device* device, const vehicle_prop_value_t *data);
2492
2493 /**
2494 * Subscribe to events.
2495 * Depending on output of list_properties if the property is:
2496 * a) on-change: sample_rate should be set to 0.
2497 * b) supports frequency: sample_rate should be set from min_sample_rate to
2498 * max_sample_rate.
Keun-young Park418c7e82016-04-06 10:44:20 -07002499 * For on-change type of properties, vehicle network service will make another get call to check
2500 * the initial state. Due to this, vehicle hal implementation does not need to send initial
2501 * state for on-change type of properties.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002502 * @param device
2503 * @param prop
2504 * @param sample_rate
Keun-young Parkbf877a72015-12-21 14:16:05 -08002505 * @param zones All subscribed zones for zoned property. can be ignored for non-zoned property.
2506 * 0 means all zones supported instead of no zone.
Sanket Agarwalfb636682015-08-11 14:34:29 -07002507 */
Keun-young Parkbf877a72015-12-21 14:16:05 -08002508 int (*subscribe)(struct vehicle_hw_device* device, int32_t prop, float sample_rate,
2509 int32_t zones);
Sanket Agarwalfb636682015-08-11 14:34:29 -07002510
2511 /** Cancel subscription on a property. */
2512 int (*unsubscribe)(struct vehicle_hw_device* device, int32_t prop);
Keun-young Park418c7e82016-04-06 10:44:20 -07002513
2514 /**
2515 * Print out debugging state for the vehicle hal. This will be called by
2516 * the vehicle network service and will be included into the service' dump.
2517 *
2518 * The passed-in file descriptor can be used to write debugging text using
2519 * dprintf() or write(). The text should be in ASCII encoding only.
2520 *
2521 * Performance requirements:
2522 *
2523 * This must be a non-blocking call. The HAL should return from this call
2524 * in 1ms, must return from this call in 10ms. This call must avoid
2525 * deadlocks, as it may be called at any point of operation.
2526 * Any synchronization primitives used (such as mutex locks or semaphores)
2527 * should be acquired with a timeout.
2528 */
2529 int (*dump)(struct vehicle_hw_device* device, int fd);
2530
Sanket Agarwalfb636682015-08-11 14:34:29 -07002531} vehicle_hw_device_t;
2532
2533__END_DECLS
2534
2535#endif // ANDROID_VEHICLE_INTERFACE_H