Home | History | Annotate | Download | only in hardware
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ANDROID_VEHICLE_INTERFACE_H
     18 #define ANDROID_VEHICLE_INTERFACE_H
     19 
     20 #include <stdint.h>
     21 #include <sys/cdefs.h>
     22 #include <sys/types.h>
     23 #include <math.h>
     24 #include <errno.h>
     25 
     26 #include <hardware/hardware.h>
     27 #include <cutils/native_handle.h>
     28 
     29 __BEGIN_DECLS
     30 
     31 /*****************************************************************************/
     32 
     33 #define VEHICLE_HEADER_VERSION          1
     34 #define VEHICLE_MODULE_API_VERSION_1_0  HARDWARE_MODULE_API_VERSION(1, 0)
     35 #define VEHICLE_DEVICE_API_VERSION_1_0  HARDWARE_DEVICE_API_VERSION_2(1, 0, VEHICLE_HEADER_VERSION)
     36 
     37 /**
     38  * Vehicle HAL to provide interfaces to various Car related sensors. The HAL is
     39  * designed in a property, value maping where each property has a value which
     40  * can be "get", "set" and "(un)subscribed" to. Subscribing will require the
     41  * user of this HAL to provide parameters such as sampling rate.
     42  */
     43 
     44 
     45 /*
     46  * The id of this module
     47  */
     48 #define VEHICLE_HARDWARE_MODULE_ID  "vehicle"
     49 
     50 /**
     51  *  Name of the vehicle device to open
     52  */
     53 #define VEHICLE_HARDWARE_DEVICE     "vehicle_hw_device"
     54 
     55 /**
     56  * Each vehicle property is defined with various annotations to specify the type of information.
     57  * Annotations will be used by scripts to run some type check or generate some boiler-plate codes.
     58  * Also the annotations are the specification for each property, and each HAL implementation should
     59  * follow what is specified as annotations.
     60  * Here is the list of annotations with explanation on what it does:
     61  * @value_type: Type of data for this property. One of the value from vehicle_value_type should be
     62  *              set here.
     63  * @change_mode: How this property changes. Value set is from vehicle_prop_change_mode. Some
     64  *               properties can allow either on change or continuous mode and it is up to HAL
     65  *               implementation to choose which mode to use.
     66  * @access: Define how this property can be accessed. read only, write only or R/W from
     67  *          vehicle_prop_access
     68  * @data_member: Name of member from vehicle_value union to access this data.
     69  * @data_enum: enum type that should be used for the data.
     70  * @unit: Unit of data. Should be from vehicle_unit_type.
     71  * @config_flags: Usage of config_flags in vehicle_prop_config
     72  * @config_array: Usage of config_array in vehicle_prop_config. When this is specified,
     73  *                @config_flags will not be used.
     74  * @config_string: Explains the usage of config_string in vehicle_prop_config. Property with
     75  *                 this annotation is expected to have additional information in config_string
     76  *                 for that property to work.
     77  * @zone_type type of zoned used. defined for zoned property
     78  * @range_start, @range_end : define range of specific property values.
     79  * @allow_out_of_range_value : This property allows out of range value to deliver additional
     80  *                             information. Check VEHICLE_*_OUT_OF_RANGE_* for applicable values.
     81  */
     82 //===== Vehicle Information ====
     83 
     84 /**
     85  * Invalid property value used for argument where invalid property gives different result.
     86  */
     87 #define VEHICLE_PROPERTY_INVALID (0x0)
     88 
     89 /**
     90  * VIN of vehicle
     91  * @value_type VEHICLE_VALUE_TYPE_STRING
     92  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
     93  * @access VEHICLE_PROP_ACCESS_READ
     94  * @data_member info_vin
     95  */
     96 #define VEHICLE_PROPERTY_INFO_VIN                                   (0x00000100)
     97 
     98 /**
     99  * Maker name of vehicle
    100  * @value_type VEHICLE_VALUE_TYPE_STRING
    101  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    102  * @access VEHICLE_PROP_ACCESS_READ
    103  * @data_member info_make
    104  */
    105 #define VEHICLE_PROPERTY_INFO_MAKE                                  (0x00000101)
    106 
    107 /**
    108  * Model of vehicle
    109  * @value_type VEHICLE_VALUE_TYPE_STRING
    110  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    111  * @access VEHICLE_PROP_ACCESS_READ
    112  * @data_member info_model
    113  */
    114 #define VEHICLE_PROPERTY_INFO_MODEL                                 (0x00000102)
    115 
    116 /**
    117  * Model year of vehicle.
    118  * @value_type VEHICLE_VALUE_TYPE_INT32
    119  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    120  * @access VEHICLE_PROP_ACCESS_READ
    121  * @data_member info_model_year
    122  * @unit VEHICLE_UNIT_TYPE_YEAR
    123  */
    124 #define VEHICLE_PROPERTY_INFO_MODEL_YEAR                            (0x00000103)
    125 
    126 /**
    127  * Fuel capacity of the vehicle
    128  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    129  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    130  * @access VEHICLE_PROP_ACCESS_READ
    131  * @data_member info_fuel_capacity
    132  * @unit VEHICLE_UNIT_TYPE_VEHICLE_UNIT_TYPE_MILLILITER
    133  */
    134 #define VEHICLE_PROPERTY_INFO_FUEL_CAPACITY                         (0x00000104)
    135 
    136 
    137 //==== Vehicle Performance Sensors ====
    138 
    139 /**
    140  * Current odometer value of the vehicle
    141  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    142  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    143  * @access VEHICLE_PROP_ACCESS_READ
    144  * @data_member odometer
    145  * @unit VEHICLE_UNIT_TYPE_KILOMETER
    146  */
    147 #define VEHICLE_PROPERTY_PERF_ODOMETER                              (0x00000204)
    148 
    149 /**
    150  * Speed of the vehicle
    151  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    152  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    153  * @access VEHICLE_PROP_ACCESS_READ
    154  * @data_member vehicle_speed
    155  * @unit VEHICLE_UNIT_TYPE_METER_PER_SEC
    156  */
    157 #define VEHICLE_PROPERTY_PERF_VEHICLE_SPEED                         (0x00000207)
    158 
    159 
    160 //==== Engine Sensors ====
    161 
    162 /**
    163  * Temperature of engine coolant
    164  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    165  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    166  * @access VEHICLE_PROP_ACCESS_READ
    167  * @data_member engine_coolant_temperature
    168  * @unit VEHICLE_UNIT_TYPE_CELCIUS
    169  */
    170 #define VEHICLE_PROPERTY_ENGINE_COOLANT_TEMP                        (0x00000301)
    171 
    172 /**
    173  * Temperature of engine oil
    174  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    175  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    176  * @access VEHICLE_PROP_ACCESS_READ
    177  * @data_member engine_oil_temperature
    178  * @unit VEHICLE_UNIT_TYPE_CELCIUS
    179  */
    180 #define VEHICLE_PROPERTY_ENGINE_OIL_TEMP                            (0x00000304)
    181 /**
    182  * Engine rpm
    183  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    184  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    185  * @access VEHICLE_PROP_ACCESS_READ
    186  * @data_member engine_rpm
    187  * @unit VEHICLE_UNIT_TYPE_RPM
    188  */
    189 #define VEHICLE_PROPERTY_ENGINE_RPM                                 (0x00000305)
    190 
    191 //==== Event Sensors ====
    192 
    193 /**
    194  * Currently selected gear
    195  * @value_type VEHICLE_VALUE_TYPE_INT32
    196  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    197  * @access VEHICLE_PROP_ACCESS_READ
    198  * @data_member gear_selection
    199  * @data_enum vehicle_gear
    200  */
    201 #define VEHICLE_PROPERTY_GEAR_SELECTION                             (0x00000400)
    202 
    203 /**
    204  * Current gear. In non-manual case, selected gear does not necessarily match the current gear
    205  * @value_type VEHICLE_VALUE_TYPE_INT32
    206  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    207  * @access VEHICLE_PROP_ACCESS_READ
    208  * @data_member gear_current_gear
    209  * @data_enum vehicle_gear
    210  */
    211 #define VEHICLE_PROPERTY_CURRENT_GEAR                               (0x00000401)
    212 
    213 /**
    214  * Parking brake state.
    215  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
    216  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    217  * @access VEHICLE_PROP_ACCESS_READ
    218  * @data_member parking_brake
    219  * @data_enum vehicle_boolean
    220  */
    221 #define VEHICLE_PROPERTY_PARKING_BRAKE_ON                           (0x00000402)
    222 
    223 /**
    224  * Driving status policy.
    225  * @value_type VEHICLE_VALUE_TYPE_INT32
    226  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    227  * @access VEHICLE_PROP_ACCESS_READ
    228  * @data_member driving_status
    229  * @data_enum vehicle_driving_status
    230  */
    231 #define VEHICLE_PROPERTY_DRIVING_STATUS                             (0x00000404)
    232 
    233 /**
    234  * Warning for fuel low level.
    235  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
    236  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    237  * @access VEHICLE_PROP_ACCESS_READ
    238  * @data_member is_fuel_level_low
    239  * @data_enum vehicle_boolean
    240  */
    241 #define VEHICLE_PROPERTY_FUEL_LEVEL_LOW                             (0x00000405)
    242 
    243 /**
    244  * Night mode or not.
    245  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
    246  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    247  * @access VEHICLE_PROP_ACCESS_READ
    248  * @data_member night_mode
    249  * @data_enum vehicle_boolean
    250  */
    251 #define VEHICLE_PROPERTY_NIGHT_MODE                                 (0x00000407)
    252 
    253 
    254 
    255 //==== HVAC Properties ====
    256 
    257 /**
    258  * Fan speed setting
    259  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    260  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    261  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    262  * @data_member hvac.fan_speed
    263  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    264  * @allow_out_of_range_value : OFF
    265  */
    266 #define VEHICLE_PROPERTY_HVAC_FAN_SPEED                             (0x00000500)
    267 
    268 /**
    269  * Fan direction setting
    270  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    271  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    272  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    273  * @data_member hvac.fan_direction
    274  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    275  * @data_enum vehicle_hvac_fan_direction
    276  * @allow_out_of_range_value : OFF
    277  */
    278 #define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION                         (0x00000501)
    279 
    280 /*
    281  * Bit flags for fan direction
    282  */
    283 enum vehicle_hvac_fan_direction {
    284     VEHICLE_HVAC_FAN_DIRECTION_FACE                 = 0x1,
    285     VEHICLE_HVAC_FAN_DIRECTION_FLOOR                = 0x2,
    286     VEHICLE_HVAC_FAN_DIRECTION_FACE_AND_FLOOR       = 0x3,
    287     VEHICLE_HVAC_FAN_DIRECTION_DEFROST              = 0x4,
    288     VEHICLE_HVAC_FAN_DIRECTION_DEFROST_AND_FLOOR    = 0x5
    289 };
    290 
    291 /**
    292  * HVAC current temperature.
    293  * @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT
    294  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    295  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    296  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    297  * @data_member hvac.temperature_current
    298  */
    299 #define VEHICLE_PROPERTY_HVAC_TEMPERATURE_CURRENT                   (0x00000502)
    300 
    301 /**
    302  * HVAC, target temperature set.
    303  * @value_type VEHICLE_VALUE_TYPE_ZONED_FLOAT
    304  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    305  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    306  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    307  * @data_member hvac.temperature_set
    308  * @allow_out_of_range_value : MIN / MAX / OFF
    309  */
    310 #define VEHICLE_PROPERTY_HVAC_TEMPERATURE_SET                       (0x00000503)
    311 
    312 /**
    313  * On/off defrost
    314  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    315  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    316  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    317  * @zone_type VEHICLE_ZONE_TYPE_WINDOW
    318  * @data_member hvac.defrost_on
    319  */
    320 #define VEHICLE_PROPERTY_HVAC_DEFROSTER                             (0x00000504)
    321 
    322 /**
    323  * On/off AC
    324  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    325  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    326  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    327  * @config_flags Supported zones
    328  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    329  * @data_member hvac.ac_on
    330  */
    331 #define VEHICLE_PROPERTY_HVAC_AC_ON                                 (0x00000505)
    332 
    333 /**
    334  * On/off max AC
    335  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    336  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    337  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    338  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    339  * @data_member hvac.max_ac_on
    340  */
    341 #define VEHICLE_PROPERTY_HVAC_MAX_AC_ON                             (0x00000506)
    342 
    343 /**
    344  * On/off max defrost
    345  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    346  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    347  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    348  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    349  * @data_member hvac.max_defrost_on
    350  */
    351 #define VEHICLE_PROPERTY_HVAC_MAX_DEFROST_ON                        (0x00000507)
    352 
    353 /**
    354  * On/off re-circulation
    355  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    356  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    357  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    358  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    359  * @data_member hvac.max_recirc_on
    360  */
    361 #define VEHICLE_PROPERTY_HVAC_RECIRC_ON                             (0x00000508)
    362 
    363 /**
    364  * On/off dual. This will be defined per each row.
    365  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    366  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    367  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    368  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    369  * @data_member hvac.dual_on
    370  */
    371 #define VEHICLE_PROPERTY_HVAC_DUAL_ON                               (0x00000509)
    372 
    373 /**
    374  * On/off automatic mode
    375  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    376  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    377  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    378  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    379  * @data_member hvac.auto_on
    380  */
    381 #define VEHICLE_PROPERTY_HVAC_AUTO_ON                               (0x0000050A)
    382 
    383 /**
    384  * Seat temperature
    385  *
    386  * Negative values indicate cooling.
    387  * 0 indicates off.
    388  * Positive values indicate heating.
    389  *
    390  * Some vehicles may have multiple levels of heating and cooling. The min/max
    391  * range defines the allowable range and number of steps in each direction.
    392  *
    393  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    394  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    395  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    396  * @zone_type VEHICLE_ZONE_TYPE_SEAT
    397  * @data_member int32_value
    398  */
    399 #define VEHICLE_PROPERTY_HVAC_SEAT_TEMPERATURE                      (0x0000050B)
    400 
    401 /**
    402  * Side Mirror Heat
    403  *
    404  * Increase values denote higher heating levels for side mirrors.
    405  * 0 indicates heating is turned off.
    406  *
    407  * @value_type VEHICLE_VALUE_TYPE_INT32
    408  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    409  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    410  * @data_member int32_value
    411  */
    412 #define VEHICLE_PROPERTY_HVAC_SIDE_MIRROR_HEAT                      (0x0000050C)
    413 
    414 /**
    415  * Steering Wheel Temperature
    416  *
    417  * Sets the temperature for the steering wheel
    418  * Positive value indicates heating.
    419  * Negative value indicates cooling.
    420  * 0 indicates tempreature control is off.
    421  *
    422  * @value_type VEHICLE_VALUE_TYPE_INT32
    423  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    424  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    425  * @data_member int32_value
    426  */
    427 #define VEHICLE_PROPERTY_HVAC_STEERING_WHEEL_TEMP                   (0x0000050D)
    428 
    429 /**
    430  * Temperature units
    431  *
    432  * Indicates whether the temperature is in Celsius, Fahrenheit, or a different unit.
    433  * This parameter affects all HVAC temperatures in the system.
    434  *
    435  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    436  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    437  * @access VEHICLE_PROP_ACCESS_READ
    438  * @data_enum vehicle_unit_type
    439  * @data_member int32_value
    440  */
    441 #define VEHICLE_PROPERTY_HVAC_TEMPERATURE_UNITS                     (0x0000050E)
    442 
    443 /**
    444  * Actual fan speed
    445  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    446  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    447  * @access VEHICLE_PROP_ACCESS_READ
    448  * @data_member hvac.fan_speed
    449  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    450  * @allow_out_of_range_value : OFF
    451  */
    452 #define VEHICLE_PROPERTY_HVAC_ACTUAL_FAN_SPEED_RPM                  (0x0000050F)
    453 
    454 
    455 /**
    456  * Represents power state for HVAC. Some HVAC properties will require matching power to be turned on
    457  * to get out of OFF state. For non-zoned HVAC properties, VEHICLE_ALL_ZONE corresponds to
    458  * global power state.
    459  *
    460  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
    461  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    462  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    463  * @config_string list of HVAC properties whose power is controlled by this property. Format is
    464  *                hexa-decimal number (0x...) separated by comma like "0x500,0x503". All zones
    465  *                defined in these affected properties should be available in the property.
    466  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    467  * @data_member hvac.power_on
    468  */
    469 #define VEHICLE_PROPERTY_HVAC_POWER_ON                              (0x00000510)
    470 
    471 /**
    472  * Fan Positions Available
    473  *
    474  * This is a bit mask of fan positions available for the zone.  Each entry in
    475  * vehicle_hvac_fan_direction is selected by bit position.  For instance, if
    476  * only the FAN_DIRECTION_FACE (0x1) and FAN_DIRECTION_DEFROST (0x4) are available,
    477  * then this value shall be set to 0x12.
    478  *
    479  * 0x12 = (1 << 1) | (1 << 4)
    480  *
    481  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
    482  * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    483  * @access VEHICLE_PROP_ACCESS_READ
    484  * @data_member int32_value
    485  * @zone_type VEHICLE_ZONE_TYPE_ZONE
    486  * @allow_out_of_range_value : OFF
    487  */
    488 #define VEHICLE_PROPERTY_HVAC_FAN_DIRECTION_AVAILABLE               (0x00000511)
    489 
    490 /**
    491  * Outside temperature
    492  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    493  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    494  * @access VEHICLE_PROP_ACCESS_READ
    495  * @data_member outside_temperature
    496  * @unit VEHICLE_UNIT_TYPE_CELCIUS
    497  */
    498 #define VEHICLE_PROPERTY_ENV_OUTSIDE_TEMPERATURE                    (0x00000703)
    499 
    500 
    501 /**
    502  * Cabin temperature
    503  * @value_type VEHICLE_VALUE_TYPE_FLOAT
    504  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE|VEHICLE_PROP_CHANGE_MODE_CONTINUOUS
    505  * @access VEHICLE_PROP_ACCESS_READ
    506  * @data_member cabin_temperature
    507  * @unit VEHICLE_UNIT_TYPE_CELCIUS
    508  */
    509 #define VEHICLE_PROPERTY_ENV_CABIN_TEMPERATURE                      (0x00000704)
    510 
    511 
    512 /*
    513  * Radio features.
    514  */
    515 /**
    516  * Radio presets stored on the Car radio module. The data type used is int32
    517  * array with the following fields:
    518  * <ul>
    519  *    <li> int32_array[0]: Preset number </li>
    520  *    <li> int32_array[1]: Band type (see #RADIO_BAND_FM in
    521  *    system/core/include/system/radio.h).
    522  *    <li> int32_array[2]: Channel number </li>
    523  *    <li> int32_array[3]: Sub channel number </li>
    524  * </ul>
    525  *
    526  * NOTE: When getting a current preset config ONLY set preset number (i.e.
    527  * int32_array[0]). For setting a preset other fields are required.
    528  *
    529  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
    530  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    531  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    532  * @config_flags Number of presets supported
    533  * @data_member int32_array
    534  */
    535 #define VEHICLE_PROPERTY_RADIO_PRESET                               (0x00000801)
    536 
    537 /**
    538  * Constants relevant to radio.
    539  */
    540 enum vehicle_radio_consts {
    541     /** Minimum value for the radio preset */
    542     VEHICLE_RADIO_PRESET_MIN_VALUE = 1,
    543 };
    544 
    545 /**
    546  * Represents audio focus state of Android side. Note that car's audio module will own audio
    547  * focus and grant audio focus to Android side when requested by Android side. The focus has both
    548  * per stream characteristics and global characteristics.
    549  *
    550  * Focus request (get of this property) will take the following form in int32_vec4:
    551  *   int32_array[0]: vehicle_audio_focus_request type
    552  *   int32_array[1]: bit flags of streams requested by this focus request. There can be up to
    553  *                   32 streams.
    554  *   int32_array[2]: External focus state flags. For request, only flag like
    555  *                   VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG or
    556  *                   VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be used.
    557  *                   VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG is for case like radio where android
    558  *                   side app still needs to hold focus but playback is done outside Android.
    559  *                   VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG is for muting media channel
    560  *                   including radio. VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG can be set even
    561  *                   if android side releases focus (request type REQUEST_RELEASE). In that case,
    562  *                   audio module should maintain mute state until user's explicit action to
    563  *                   play some media.
    564  *   int32_array[3]: Currently active audio contexts. Use combination of flags from
    565  *                   vehicle_audio_context_flag.
    566  *                   This can be used as a hint to adjust audio policy or other policy decision.
    567  *                   Note that there can be multiple context active at the same time. And android
    568  *                   can send the same focus request type gain due to change in audio contexts.
    569  * Note that each focus request can request multiple streams that is expected to be used for
    570  * the current request. But focus request itself is global behavior as GAIN or GAIN_TRANSIENT
    571  * expects all sounds played by car's audio module to stop. Note that stream already allocated to
    572  * android before this focus request should not be affected by focus request.
    573  *
    574  * Focus response (set and subscription callback for this property) will take the following form:
    575  *   int32_array[0]: vehicle_audio_focus_state type
    576  *   int32_array[1]: bit flags of streams allowed.
    577  *   int32_array[2]: External focus state: bit flags of currently active audio focus in car
    578  *                   side (outside Android). Active audio focus does not necessarily mean currently
    579  *                   playing, but represents the state of having focus or waiting for focus
    580  *                   (pause state).
    581  *                   One or combination of flags from vehicle_audio_ext_focus_flag.
    582  *                   0 means no active audio focus holder outside Android.
    583  *                   The state will have following values for each vehicle_audio_focus_state_type:
    584  *                   GAIN: 0 or VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY when radio is active in
    585  *                       Android side.
    586  *                   GAIN_TRANSIENT: 0. Can be VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT or
    587  *                       VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT if android side has requested
    588  *                       GAIN_TRANSIENT_MAY_DUCK and car side is ducking.
    589  *                   LOSS: 0 when no focus is audio is active in car side.
    590  *                       VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT when car side is playing something
    591  *                       permanent.
    592  *                   LOSS_TRANSIENT: always should be VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT
    593  *   int32_array[3]: context requested by android side when responding to focus request.
    594  *                   When car side is taking focus away, this should be zero.
    595  *
    596  * A focus response should be sent per each focus request even if there is no change in
    597  * focus state. This can happen in case like focus request only involving context change
    598  * where android side still needs matching focus response to confirm that audio module
    599  * has made necessary changes.
    600  *
    601  * If car does not support VEHICLE_PROPERTY_AUDIO_FOCUS, focus is assumed to be granted always.
    602  *
    603  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
    604  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    605  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    606  * @data_member int32_array
    607  */
    608 #define VEHICLE_PROPERTY_AUDIO_FOCUS                                (0x00000900)
    609 
    610 enum vehicle_audio_focus_request {
    611     VEHICLE_AUDIO_FOCUS_REQUEST_GAIN = 0x1,
    612     VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT = 0x2,
    613     VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_MAY_DUCK = 0x3,
    614     /**
    615      * This is for the case where android side plays sound like UI feedback
    616      * and car side does not need to duck existing playback as long as
    617      * requested stream is available.
    618      */
    619     VEHICLE_AUDIO_FOCUS_REQUEST_GAIN_TRANSIENT_NO_DUCK  = 0x4,
    620     VEHICLE_AUDIO_FOCUS_REQUEST_RELEASE = 0x5,
    621 };
    622 
    623 enum vehicle_audio_focus_state {
    624     /**
    625      * Android side has permanent focus and can play allowed streams.
    626      */
    627     VEHICLE_AUDIO_FOCUS_STATE_GAIN = 0x1,
    628     /**
    629      * Android side has transient focus and can play allowed streams.
    630      */
    631     VEHICLE_AUDIO_FOCUS_STATE_GAIN_TRANSIENT = 0x2,
    632     /**
    633      * Car audio module is playing guidance kind of sound outside Android. Android side can
    634      * still play through allowed streams with ducking.
    635      */
    636     VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_CAN_DUCK = 0x3,
    637     /**
    638      * Car audio module is playing transient sound outside Android. Android side should stop
    639      * playing any sounds.
    640      */
    641     VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT = 0x4,
    642     /**
    643      * Android side has lost focus and cannot play any sound.
    644      */
    645     VEHICLE_AUDIO_FOCUS_STATE_LOSS = 0x5,
    646     /**
    647      * car audio module is playing safety critical sound, and Android side cannot request focus
    648      * until the current state is finished. car audio module should restore it to the previous
    649      * state when it can allow Android to play.
    650      */
    651     VEHICLE_AUDIO_FOCUS_STATE_LOSS_TRANSIENT_EXLCUSIVE = 0x6,
    652 };
    653 
    654 /**
    655  * Flags to represent multiple streams by combining these.
    656  */
    657 enum vehicle_audio_stream_flag {
    658     VEHICLE_AUDIO_STREAM_STREAM0_FLAG = (0x1<<0),
    659     VEHICLE_AUDIO_STREAM_STREAM1_FLAG = (0x1<<1),
    660     VEHICLE_AUDIO_STREAM_STREAM2_FLAG = (0x1<<2),
    661 };
    662 
    663 /**
    664  * Represents stream number (always 0 to N -1 where N is max number of streams).
    665  * Can be used for audio related property expecting one stream.
    666  */
    667 enum vehicle_audio_stream {
    668     VEHICLE_AUDIO_STREAM0 = 0,
    669     VEHICLE_AUDIO_STREAM1 = 1,
    670 };
    671 
    672 /**
    673  * Flag to represent external focus state (outside Android).
    674  */
    675 enum vehicle_audio_ext_focus_flag {
    676     /**
    677      * No external focus holder.
    678      */
    679     VEHICLE_AUDIO_EXT_FOCUS_NONE_FLAG = 0x0,
    680     /**
    681      * Car side (outside Android) has component holding GAIN kind of focus state.
    682      */
    683     VEHICLE_AUDIO_EXT_FOCUS_CAR_PERMANENT_FLAG = 0x1,
    684     /**
    685      * Car side (outside Android) has component holding GAIN_TRANSIENT kind of focus state.
    686      */
    687     VEHICLE_AUDIO_EXT_FOCUS_CAR_TRANSIENT_FLAG = 0x2,
    688     /**
    689      * Car side is expected to play something while focus is held by Android side. One example
    690      * can be radio attached in car side. But Android's radio app still should have focus,
    691      * and Android side should be in GAIN state, but media stream will not be allocated to Android
    692      * side and car side can play radio any time while this flag is active.
    693      */
    694     VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG = 0x4,
    695     /**
    696      * Car side should mute any media including radio. This can be used with any focus request
    697      * including GAIN* and RELEASE.
    698      */
    699     VEHICLE_AUDIO_EXT_FOCUS_CAR_MUTE_MEDIA_FLAG = 0x8,
    700 };
    701 
    702 /**
    703  * Index in int32_array for VEHICLE_PROPERTY_AUDIO_FOCUS property.
    704  */
    705 enum vehicle_audio_focus_index {
    706     VEHICLE_AUDIO_FOCUS_INDEX_FOCUS = 0,
    707     VEHICLE_AUDIO_FOCUS_INDEX_STREAMS = 1,
    708     VEHICLE_AUDIO_FOCUS_INDEX_EXTERNAL_FOCUS_STATE = 2,
    709     VEHICLE_AUDIO_FOCUS_INDEX_AUDIO_CONTEXTS = 3,
    710 };
    711 
    712 /**
    713  * Flags to tell the current audio context.
    714  */
    715 enum vehicle_audio_context_flag {
    716     /** Music playback is currently active. */
    717     VEHICLE_AUDIO_CONTEXT_MUSIC_FLAG                      = 0x1,
    718     /** Navigation is currently running. */
    719     VEHICLE_AUDIO_CONTEXT_NAVIGATION_FLAG                 = 0x2,
    720     /** Voice command session is currently running. */
    721     VEHICLE_AUDIO_CONTEXT_VOICE_COMMAND_FLAG              = 0x4,
    722     /** Voice call is currently active. */
    723     VEHICLE_AUDIO_CONTEXT_CALL_FLAG                       = 0x8,
    724     /** Alarm is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY. */
    725     VEHICLE_AUDIO_CONTEXT_ALARM_FLAG                      = 0x10,
    726     /**
    727      * Notification sound is active. This may be only used in VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY.
    728      */
    729     VEHICLE_AUDIO_CONTEXT_NOTIFICATION_FLAG               = 0x20,
    730     /**
    731      * Context unknown. Only used for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY to represent default
    732      * stream for unknown contents.
    733      */
    734     VEHICLE_AUDIO_CONTEXT_UNKNOWN_FLAG                    = 0x40,
    735     /** Safety alert / warning is played. */
    736     VEHICLE_AUDIO_CONTEXT_SAFETY_ALERT_FLAG               = 0x80,
    737     /** CD / DVD kind of audio is played */
    738     VEHICLE_AUDIO_CONTEXT_CD_ROM_FLAG                     = 0x100,
    739     /** Aux audio input is played */
    740     VEHICLE_AUDIO_CONTEXT_AUX_AUDIO_FLAG                  = 0x200,
    741     /** system sound like UI feedback */
    742     VEHICLE_AUDIO_CONTEXT_SYSTEM_SOUND_FLAG               = 0x400,
    743     /** Radio is played */
    744     VEHICLE_AUDIO_CONTEXT_RADIO_FLAG                      = 0x800,
    745     /** Ext source is played. This is for tagging generic ext sources. */
    746     VEHICLE_AUDIO_CONTEXT_EXT_SOURCE_FLAG                 = 0x1000,
    747 };
    748 
    749 /**
    750  * Property to control audio volume of each audio context.
    751  *
    752  * vehicle_prop_config_t
    753  *   config_array[0] : bit flags of all supported audio contexts. If this is 0,
    754  *                     audio volume is controlled per physical stream
    755  *   config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
    756  *                     represent audio module's capability.
    757  *
    758  * Data type looks like:
    759  *   int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
    760                       stream is supported (config_array[0] == 0), this will represent physical
    761                       stream number.
    762  *   int32_array[1] : volume level, valid range is 0 to int32_max_value defined in config.
    763  *                    0 will be mute state. int32_min_value in config should be always 0.
    764  *   int32_array[2] : One of vehicle_audio_volume_state.
    765  *
    766  * This property requires per stream based get. HAL implementation should check stream number
    767  * in get call to return the right volume.
    768  *
    769  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC3
    770  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    771  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    772  * @config_flags all audio contexts supported.
    773  * @data_member int32_array
    774  */
    775 #define VEHICLE_PROPERTY_AUDIO_VOLUME                               (0x00000901)
    776 
    777 
    778 /**
    779  * flags to represent capability of audio volume property.
    780  * used in config_array[1] of vehicle_prop_config_t.
    781  */
    782 enum vehicle_audio_volume_capability_flag {
    783     /**
    784      * External audio module or vehicle hal has persistent storage
    785      * to keep the volume level. This should be set only when per context
    786      * volume level is supproted. When this is set, audio volume level per
    787      * each context will be retrieved from the property when systen starts up.
    788      * And external audio module is also expected to adjust volume automatically
    789      * whenever there is an audio context change.
    790      * When this flag is not set, android side will assume that there is no
    791      * persistent storage and stored value in android side will be used to
    792      * initialize the volume level. And android side will set volume level
    793      * of each physical streams whenever there is an audio context change.
    794      */
    795     VEHICLE_AUDIO_VOLUME_CAPABILITY_PERSISTENT_STORAGE = 0x1,
    796     /**
    797      * When this flag is set, the H/W can support only single master volume for all streams.
    798      * There is no way to set volume level differently per each stream or context.
    799      */
    800     VEHICLE_AUDIO_VOLUME_CAPABILITY_MASTER_VOLUME_ONLY = 0x2,
    801 };
    802 
    803 
    804 /**
    805  * enum to represent audio volume state.
    806  */
    807 enum vehicle_audio_volume_state {
    808     VEHICLE_AUDIO_VOLUME_STATE_OK            = 0,
    809     /**
    810      * Audio volume has reached volume limit set in VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT
    811      * and user's request to increase volume further is not allowed.
    812      */
    813     VEHICLE_AUDIO_VOLUME_STATE_LIMIT_REACHED = 1,
    814 };
    815 
    816 /**
    817  * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME property.
    818  */
    819 enum vehicle_audio_volume_index {
    820     VEHICLE_AUDIO_VOLUME_INDEX_STREAM = 0,
    821     VEHICLE_AUDIO_VOLUME_INDEX_VOLUME = 1,
    822     VEHICLE_AUDIO_VOLUME_INDEX_STATE = 2,
    823 };
    824 
    825 /**
    826  * Property for handling volume limit set by user. This limits maximum volume that can be set
    827  * per each context or physical stream.
    828  *
    829  * vehicle_prop_config_t
    830  *   config_array[0] : bit flags of all supported audio contexts. If this is 0,
    831  *                     audio volume is controlled per physical stream
    832  *   config_array[1] : flags defined in vehicle_audio_volume_capability_flag to
    833  *                     represent audio module's capability.
    834  *
    835  * Data type looks like:
    836  *   int32_array[0] : stream context as defined in vehicle_audio_context_flag. If only physical
    837  *                    stream is supported (config_array[0] == 0), this will represent physical
    838  *                    stream number.
    839  *   int32_array[1] : maximum volume set to the stream. If there is no restriction, this value
    840  *                    will be  bigger than VEHICLE_PROPERTY_AUDIO_VOLUME's max value.
    841  *
    842  * If car does not support this feature, this property should not be populated by HAL.
    843  * This property requires per stream based get. HAL implementation should check stream number
    844  * in get call to return the right volume.
    845  *
    846  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
    847  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    848  * @access VEHICLE_PROP_ACCESS_READ_WRITE
    849  * @config_flags all audio contexts supported.
    850  * @data_member int32_array
    851  */
    852 #define VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT                         (0x00000902)
    853 
    854 /**
    855  * Index in int32_array for VEHICLE_PROPERTY_AUDIO_VOLUME_LIMIT property.
    856  */
    857 enum vehicle_audio_volume_limit_index {
    858     VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_STREAM = 0,
    859     VEHICLE_AUDIO_VOLUME_LIMIT_INDEX_MAX_VOLUME = 1,
    860 };
    861 
    862 /**
    863  * Property to share audio routing policy of android side. This property is set at the beginning
    864  * to pass audio policy in android side down to vehicle HAL and car audio module.
    865  * This can be used as a hint to adjust audio policy or other policy decision.
    866  *
    867  *   int32_array[0] : audio stream where the audio for the application context will be routed
    868  *                    by default. Note that this is the default setting from system, but each app
    869  *                    may still use different audio stream for whatever reason.
    870  *   int32_array[1] : All audio contexts that will be sent through the physical stream. Flag
    871  *                    is defined in vehicle_audio_context_flag.
    872 
    873  * Setting of this property will be done for all available physical streams based on audio H/W
    874  * variant information acquired from VEHICLE_PROPERTY_AUDIO_HW_VARIANT property.
    875  *
    876  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
    877  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    878  * @access VEHICLE_PROP_ACCESS_WRITE
    879  * @data_member int32_array
    880  */
    881 #define VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY                       (0x00000903)
    882 
    883 /**
    884  * Index in int32_array for VEHICLE_PROPERTY_AUDIO_ROUTING_POLICY property.
    885  */
    886 enum vehicle_audio_routing_policy_index {
    887     VEHICLE_AUDIO_ROUTING_POLICY_INDEX_STREAM = 0,
    888     VEHICLE_AUDIO_ROUTING_POLICY_INDEX_CONTEXTS = 1,
    889 };
    890 
    891 /**
    892 * Property to return audio H/W variant type used in this car. This allows android side to
    893 * support different audio policy based on H/W variant used. Note that other components like
    894 * CarService may need overlay update to support additional variants. If this property does not
    895 * exist, default audio policy will be used.
    896 *
    897 * @value_type VEHICLE_VALUE_TYPE_INT32
    898 * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
    899 * @access VEHICLE_PROP_ACCESS_READ
    900 * @config_flags Additional info on audio H/W. Should use vehicle_audio_hw_variant_config_flag for
    901 *               this.
    902 * @data_member int32_value
    903 */
    904 #define VEHICLE_PROPERTY_AUDIO_HW_VARIANT                           (0x00000904)
    905 
    906 /**
    907  * Flag to be used in vehicle_prop_config.config_flags for VEHICLE_PROPERTY_AUDIO_HW_VARIANT.
    908  */
    909 enum vehicle_audio_hw_variant_config_flag {
    910     /**
    911      * Flag to tell that radio is internal to android and radio should
    912      * be treated like other android stream like media.
    913      * When this flag is not set or AUDIO_HW_VARIANT does not exist,
    914      * radio is treated as external module. This brins some delta in audio focus
    915      * handling as well.
    916      */
    917     VEHICLE_AUDIO_HW_VARIANT_FLAG_INTERNAL_RADIO_FLAG = 0x1,
    918 };
    919 
    920 /** audio routing for AM/FM. This should be also be the value when there is only one
    921     radio module in the system. */
    922 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM "RADIO_AM_FM"
    923 /** Should be added only when there is a separate radio module with HD capability. */
    924 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_AM_FM_HD "RADIO_AM_FM_HD"
    925 /** For digial audio broadcasting type of radio */
    926 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_DAB "RADIO_DAB"
    927 /** For satellite type of radio */
    928 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_RADIO_SATELLITE "RADIO_SATELLITE"
    929 /** For CD or DVD */
    930 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_CD_DVD "CD_DVD"
    931 /** For 1st auxiliary input */
    932 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN0 "AUX_IN0"
    933 /** For 2nd auxiliary input */
    934 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_AUX_IN1 "AUX_IN1"
    935 /** For navigation guidance from outside android */
    936 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_NAV_GUIDANCE "EXT_NAV_GUIDANCE"
    937 /** For voice command from outside android */
    938 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_COMMAND "EXT_VOICE_COMMAND"
    939 /** For voice call from outside android */
    940 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_VOICE_CALL "EXT_VOICE_CALL"
    941 /** For safety alert from outside android */
    942 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_EXT_SAFETY_ALERT "EXT_SAFETY_ALERT"
    943 
    944 /**
    945 * Property to pass hint on external audio routing. When android side request focus
    946 * with VEHICLE_AUDIO_EXT_FOCUS_CAR_PLAY_ONLY_FLAG flag, this property will be set
    947 * before setting AUDIO_FOCUS property as a hint for external audio source routing.
    948 * Note that setting this property alone should not trigger any change.
    949 * Audio routing should be changed only when AUDIO_FOCUS property is set. Note that
    950 * this property allows passing custom value as long as it is defined in config_string.
    951 * This allows supporting non-standard routing options through this property.
    952 * It is recommended to use separate name space for custom property to prevent conflict in future
    953 * android releases.
    954 * Enabling each external routing option is done by enabling each bit flag for the routing.
    955 * This property can support up to 128 external routings.
    956 * To give full flexibility, there is no standard definition for each bit flag and
    957 * assigning each big flag to specific routing type is decided by config_string.
    958 * config_string has format of each entry separated by ','
    959 * and each entry has format of bitFlagPositon:typeString[:physicalStreamNumber].
    960 *  bitFlagPosition: represents which big flag will be set to enable this routing. 0 means
    961 *    LSB in int32_array[0]. 31 will be MSB in int32_array[0]. 127 will MSB in int32_array[3].
    962 *  typeString: string representation of external routing. Some types are already defined
    963 *    in VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_SOURCE_* and use them first before adding something
    964 *    custom. Applications will find each routing using this string.
    965 *  physicalStreamNumber: This part is optional and represents physical stream to android
    966 *    which will be disabled when this routing is enabled. If not specified, this routing
    967 *    should not affect physical streams to android.
    968 * As an example, let's assume a system with two physical streams, 0 for media and 1 for
    969 * nav guidance. And let's assume external routing option of am fm radio, external navigation
    970 * guidance, satellite radio, and one custom. Let's assume that radio and satellite replaces
    971 * physical stream 0 and external navigation replaces physical stream 1. And bit flag will be
    972 * assigned in the order listed above. This configuration will look like this in config_string:
    973 *  "0:RADIO_AM_FM:0,1:EXT_NAV_GUIDANCE:1,2:RADIO_SATELLITE:0,3:com.test.SOMETHING_CUSTOM"
    974 * When android requests RADIO_AM_FM, int32_array[0] will be set to 0x1.
    975 * When android requests RADIO_SATELLITE + EXT_NAV_GUIDANCE, int32_array[0] will be set to 0x2|0x4.
    976 *
    977 * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
    978 * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
    979 * @access VEHICLE_PROP_ACCESS_WRITE|VEHICLE_PROP_ACCESS_READ_WRITE
    980 * @config_string List of all avaiable external source in the system.
    981 * @data_member int32_array
    982 */
    983 #define VEHICLE_PROPERTY_AUDIO_EXT_ROUTING_HINT                     (0x00000905)
    984 
    985 /**
    986  * Property to control power state of application processor.
    987  *
    988  * It is assumed that AP's power state is controller by separate power controller.
    989  *
    990  * For configuration information, vehicle_prop_config.config_flags can have bit flag combining
    991  * values in vehicle_ap_power_state_config_type.
    992  *
    993  * For get / notification, data type looks like this:
    994  *   int32_array[0] : vehicle_ap_power_state_type
    995  *   int32_array[1] : additional parameter relevant for each state. should be 0 if not used.
    996  * For set, data type looks like this:
    997  *   int32_array[0] : vehicle_ap_power_state_set_type
    998  *   int32_array[1] : additional parameter relevant for each request. should be 0 if not used.
    999  *
   1000  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC2
   1001  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1002  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1003  * @config_flags Additional info on power state. Should use vehicle_ap_power_state_config_flag.
   1004  * @data_member int32_array
   1005  */
   1006 #define VEHICLE_PROPERTY_AP_POWER_STATE                             (0x00000A00)
   1007 
   1008 enum vehicle_ap_power_state_config_flag {
   1009     /**
   1010      * AP can enter deep sleep state. If not set, AP will always shutdown from
   1011      * VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE power state.
   1012      */
   1013     VEHICLE_AP_POWER_STATE_CONFIG_ENABLE_DEEP_SLEEP_FLAG = 0x1,
   1014 
   1015     /**
   1016      * The power controller can power on AP from off state after timeout specified in
   1017      * VEHICLE_AP_POWER_SET_SHUTDOWN_READY message.
   1018      */
   1019     VEHICLE_AP_POWER_STATE_CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2,
   1020 };
   1021 
   1022 enum vehicle_ap_power_state {
   1023     /** vehicle HAL will never publish this state to AP */
   1024     VEHICLE_AP_POWER_STATE_OFF = 0,
   1025     /** vehicle HAL will never publish this state to AP */
   1026     VEHICLE_AP_POWER_STATE_DEEP_SLEEP = 1,
   1027     /** AP is on but display should be off. */
   1028     VEHICLE_AP_POWER_STATE_ON_DISP_OFF = 2,
   1029     /** AP is on with display on. This state allows full user interaction. */
   1030     VEHICLE_AP_POWER_STATE_ON_FULL = 3,
   1031     /**
   1032      * The power controller has requested AP to shutdown. AP can either enter sleep state or start
   1033      * full shutdown. AP can also request postponing shutdown by sending
   1034      * VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE message. The power controller should change power
   1035      * state to this state to shutdown system.
   1036      *
   1037      * int32_array[1] : one of enum_vehicle_ap_power_state_shutdown_param_type
   1038      */
   1039     VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE = 4,
   1040 };
   1041 
   1042 enum vehicle_ap_power_state_shutdown_param {
   1043     /** AP should shutdown immediately. Postponing is not allowed. */
   1044     VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_IMMEDIATELY = 1,
   1045     /** AP can enter deep sleep instead of shutting down completely. */
   1046     VEHICLE_AP_POWER_SHUTDOWN_PARAM_CAN_SLEEP = 2,
   1047     /** AP can only shutdown with postponing allowed. */
   1048     VEHICLE_AP_POWER_SHUTDOWN_PARAM_SHUTDOWN_ONLY = 3,
   1049 };
   1050 
   1051 enum vehicle_ap_power_set_state {
   1052     /**
   1053      * AP has finished boot up, and can start shutdown if requested by power controller.
   1054      */
   1055     VEHICLE_AP_POWER_SET_BOOT_COMPLETE = 0x1,
   1056     /**
   1057      * AP is entering deep sleep state. How this state is implemented may vary depending on
   1058      * each H/W, but AP's power should be kept in this state.
   1059      */
   1060     VEHICLE_AP_POWER_SET_DEEP_SLEEP_ENTRY = 0x2,
   1061     /**
   1062      * AP is exiting from deep sleep state, and is in VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE state.
   1063      * The power controller may change state to other ON states based on the current state.
   1064      */
   1065     VEHICLE_AP_POWER_SET_DEEP_SLEEP_EXIT = 0x3,
   1066     /**
   1067      * int32_array[1]: Time to postpone shutdown in ms. Maximum value can be 5000 ms.
   1068      *                 If AP needs more time, it will send another POSTPONE message before
   1069      *                 the previous one expires.
   1070      */
   1071     VEHICLE_AP_POWER_SET_SHUTDOWN_POSTPONE = 0x4,
   1072     /**
   1073      * AP is starting shutting down. When system completes shutdown, everything will stop in AP
   1074      * as kernel will stop all other contexts. It is responsibility of vehicle HAL or lower level
   1075      * to synchronize that state with external power controller. As an example, some kind of ping
   1076      * with timeout in power controller can be a solution.
   1077      *
   1078      * int32_array[1]: Time to turn on AP in secs. Power controller may turn on AP after specified
   1079      *                 time so that AP can run tasks like update. If it is set to 0, there is no
   1080      *                 wake up, and power controller may not necessarily support wake-up.
   1081      *                 If power controller turns on AP due to timer, it should start with
   1082      *                 VEHICLE_AP_POWER_STATE_ON_DISP_OFF state, and after receiving
   1083      *                 VEHICLE_AP_POWER_SET_BOOT_COMPLETE, it shall do state transition to
   1084      *                 VEHICLE_AP_POWER_STATE_SHUTDOWN_PREPARE.
   1085      */
   1086     VEHICLE_AP_POWER_SET_SHUTDOWN_START = 0x5,
   1087     /**
   1088      * User has requested to turn off headunit's display, which is detected in android side.
   1089      * The power controller may change the power state to VEHICLE_AP_POWER_STATE_ON_DISP_OFF.
   1090      */
   1091     VEHICLE_AP_POWER_SET_DISPLAY_OFF = 0x6,
   1092     /**
   1093      * User has requested to turn on headunit's display, most probably from power key input which
   1094      * is attached to headunit. The power controller may change the power state to
   1095      * VEHICLE_AP_POWER_STATE_ON_FULL.
   1096      */
   1097     VEHICLE_AP_POWER_SET_DISPLAY_ON = 0x7,
   1098 };
   1099 
   1100 /**
   1101  * Property to represent brightness of the display. Some cars have single control for
   1102  * the brightness of all displays and this property is to share change in that control.
   1103  *
   1104  * If this is writable, android side can set this value when user changes display brightness
   1105  * from Settings. If this is read only, user may still change display brightness from Settings,
   1106  * but that will not be reflected to other displays.
   1107  *
   1108  * @value_type VEHICLE_VALUE_TYPE_INT32
   1109  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1110  * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_READ_WRITE
   1111  * @data_member int32
   1112  */
   1113 #define VEHICLE_PROPERTY_DISPLAY_BRIGHTNESS                         (0x00000A01)
   1114 
   1115 
   1116 /**
   1117  * Index in int32_array for VEHICLE_PROPERTY_AP_POWER_STATE property.
   1118  */
   1119 enum vehicle_ap_power_state_index {
   1120     VEHICLE_AP_POWER_STATE_INDEX_STATE = 0,
   1121     VEHICLE_AP_POWER_STATE_INDEX_ADDITIONAL = 1,
   1122 };
   1123 
   1124 /**
   1125 * Property to report bootup reason for the current power on. This is a static property that will
   1126 * not change for the whole duration until power off. For example, even if user presses power on
   1127 * button after automatic power on with door unlock, bootup reason should stay with
   1128 * VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK.
   1129 *
   1130 * int32_value should be vehicle_ap_power_bootup_reason.
   1131 *
   1132 * @value_type VEHICLE_VALUE_TYPE_INT32
   1133 * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
   1134 * @access VEHICLE_PROP_ACCESS_READ
   1135 * @data_member int32_value
   1136 */
   1137 #define VEHICLE_PROPERTY_AP_POWER_BOOTUP_REASON                     (0x00000A02)
   1138 
   1139 /**
   1140  * Enum to represent bootup reason.
   1141  */
   1142 enum vehicle_ap_power_bootup_reason {
   1143     /**
   1144      * Power on due to user's pressing of power key or rotating of ignition switch.
   1145      */
   1146     VEHICLE_AP_POWER_BOOTUP_REASON_USER_POWER_ON = 0,
   1147     /**
   1148      * Automatic power on triggered by door unlock or any other kind of automatic user detection.
   1149      */
   1150     VEHICLE_AP_POWER_BOOTUP_REASON_USER_UNLOCK   = 1,
   1151     /**
   1152      * Automatic power on triggered by timer. This only happens when AP has asked wake-up after
   1153      * certain time through time specified in VEHICLE_AP_POWER_SET_SHUTDOWN_START.
   1154      */
   1155     VEHICLE_AP_POWER_BOOTUP_REASON_TIMER         = 2,
   1156 };
   1157 
   1158 
   1159 /**
   1160  * Property to feed H/W input events to android
   1161  *
   1162  * int32_array[0] : action defined by vehicle_hw_key_input_action
   1163  * int32_array[1] : key code, should use standard android key code
   1164  * int32_array[2] : target display defined in vehicle_display. Events not tied
   1165  *                  to specific display should be sent to DISPLAY_MAIN.
   1166  * int32_array[3] : reserved for now. should be zero
   1167  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
   1168  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1169  * @access VEHICLE_PROP_ACCESS_READ
   1170  * @config_flags
   1171  * @data_member int32_array
   1172  */
   1173 #define VEHICLE_PROPERTY_HW_KEY_INPUT                               (0x00000A10)
   1174 
   1175 enum vehicle_hw_key_input_action {
   1176     /** Key down */
   1177     VEHICLE_HW_KEY_INPUT_ACTION_DOWN = 0,
   1178     /** Key up */
   1179     VEHICLE_HW_KEY_INPUT_ACTION_UP = 1,
   1180 };
   1181 
   1182 enum vehicle_display {
   1183     /** center console */
   1184     VEHICLE_DISPLAY_MAIN               = 0,
   1185     VEHICLE_DISPLAY_INSTRUMENT_CLUSTER = 1,
   1186 };
   1187 
   1188 /**
   1189  * Property to define instrument cluster information.
   1190  * For CLUSTER_TYPE_EXTERNAL_DISPLAY:
   1191  *  READ:
   1192  *   int32_array[0] : The current screen mode index. Screen mode is defined
   1193  *                     as a configuration in car service and represents which
   1194  *                     area of screen is renderable.
   1195  *   int32_array[1] : Android can render to instrument cluster (=1) or not(=0). When this is 0,
   1196  *                    instrument cluster may be rendering some information in the area
   1197  *                    allocated for android and android side rendering is invisible. *
   1198  *   int32_array[2..3] : should be zero
   1199  *  WRITE from android:
   1200  *   int32_array[0] : Preferred mode for android side. Depending on the app rendering to instrument
   1201  *                    cluster, preferred mode can change. Instrument cluster still needs to send
   1202  *                    event with new mode to trigger actual mode change.
   1203  *   int32_array[1] : The current app context relevant for instrument cluster. Use the same flag
   1204  *                    with vehicle_audio_context_flag but this context represents active apps, not
   1205  *                    active audio. Instrument cluster side may change mode depending on the
   1206  *                    currently active contexts.
   1207  *   int32_array[2..3] : should be zero
   1208  *  When system boots up, Android side will write {0, 0, 0, 0} when it is ready to render to
   1209  *  instrument cluster. Before this message, rendering from android should not be visible in the
   1210  *  cluster.
   1211  * @value_type VEHICLE_VALUE_TYPE_INT32_VEC4
   1212  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1213  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1214  * @config_array 0:vehicle_instument_cluster_type 1:hw type
   1215  * @data_member int32_array
   1216  */
   1217 #define VEHICLE_PROPERTY_INSTRUMENT_CLUSTER_INFO                    (0x00000A20)
   1218 
   1219 /**
   1220  * Represents instrument cluster type available in system
   1221  */
   1222 enum vehicle_instument_cluster_type {
   1223     /** Android has no access to instument cluster */
   1224     VEHICLE_INSTRUMENT_CLUSTER_TYPE_NONE = 0,
   1225     /**
   1226      * Instrument cluster can communicate through vehicle hal with additional
   1227      * properties to exchange meta-data
   1228      */
   1229     VEHICLE_INSTRUMENT_CLUSTER_TYPE_HAL_INTERFACE = 1,
   1230     /**
   1231      * Instrument cluster is external display where android can render contents
   1232      */
   1233     VEHICLE_INSTRUMENT_CLUSTER_TYPE_EXTERNAL_DISPLAY = 2,
   1234 };
   1235 
   1236 /**
   1237  * Current date and time, encoded as Unix time.
   1238  * This value denotes the number of seconds that have elapsed since 1/1/1970.
   1239  *
   1240  * @value_type VEHICLE_VALUE_TYPE_INT64
   1241  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
   1242  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1243  * @data_member int64_value
   1244  * @unit VEHICLE_UNIT_TYPE_SECS
   1245  */
   1246 #define VEHICLE_PROPERTY_UNIX_TIME                                  (0x00000A30)
   1247 
   1248 /**
   1249  * Current time only.
   1250  * Some vehicles may not keep track of date.  This property only affects the current time, in
   1251  * seconds during the day.  Thus, the max value for this parameter is 86,400 (24 * 60 * 60)
   1252  *
   1253  * @value_type VEHICLE_VALUE_TYPE_INT32
   1254  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_SET
   1255  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1256  * @data_member int32_value
   1257  * @unit VEHICLE_UNIT_TYPE_SECS
   1258  */
   1259 #define VEHICLE_PROPERTY_CURRENT_TIME_IN_SECONDS                    (0x00000A31)
   1260 
   1261 
   1262 //==== Car Cabin Properties ====
   1263 /**
   1264  * Most Car Cabin properties have both a MOVE and POSITION parameter associated with them.
   1265  *
   1266  * The MOVE parameter will start moving the device in the indicated direction.  The magnitude
   1267  * indicates the relative speed.  For instance, setting the WINDOW_MOVE parameter to +1 will roll
   1268  * the window up.  Setting it to +2 (if available) will roll it up faster.
   1269  *
   1270  * The POSITION parameter will move the device to the desired position.  For instance, if the
   1271  * WINDOW_POS has a range of 0-100, then setting this parameter to 50 will open the window halfway.
   1272  * Depending upon the initial position, the window may move up or down to the 50% value.
   1273  *
   1274  * OEMs may choose to implement one or both of the MOVE/POSITION parameters depending upon the
   1275  * capability of the hardware.
   1276  */
   1277 
   1278 // Doors
   1279 /**
   1280  * Door position
   1281  *
   1282  * This is an integer in case a door may be set to a particular position.  Max
   1283  * value indicates fully open, min value (0) indicates fully closed.
   1284  *
   1285  * Some vehicles (minivans) can open the door electronically.  Hence, the ability
   1286  * to write this property.
   1287  *
   1288  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1289  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1290  * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
   1291  * @zone_type VEHICLE_ZONE_TYPE_DOOR
   1292  * @data_member int32_value
   1293  */
   1294 #define VEHICLE_PROPERTY_DOOR_POS                                   (0x00000B00)
   1295 
   1296 /**
   1297  * Door move
   1298  *
   1299  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1300  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1301  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1302  * @zone_type VEHICLE_ZONE_TYPE_DOOR
   1303  * @data_member int32_value
   1304  */
   1305 #define VEHICLE_PROPERTY_DOOR_MOVE                                  (0x00000B01)
   1306 
   1307 
   1308 /**
   1309  * Door lock
   1310  *
   1311  * 'true' indicates door is locked
   1312  *
   1313  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
   1314  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1315  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1316  * @zone_type VEHICLE_ZONE_TYPE_DOOR
   1317  * @data_member boolean_value
   1318  */
   1319 #define VEHICLE_PROPERTY_DOOR_LOCK                                  (0x00000B02)
   1320 
   1321 // Mirrors
   1322 /**
   1323  * Mirror Z Position
   1324  *
   1325  * Positive value indicates tilt upwards, negative value is downwards
   1326  *
   1327  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1328  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1329  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1330  * @zone_type VEHICLE_ZONE_TYPE_MIRROR
   1331  * @data_member int32_value
   1332  */
   1333 #define VEHICLE_PROPERTY_MIRROR_Z_POS                               (0x00000B40)
   1334 
   1335 /**
   1336  * Mirror Z Move
   1337  *
   1338  * Positive value indicates tilt upwards, negative value is downwards
   1339  *
   1340  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1341  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1342  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1343  * @zone_type VEHICLE_ZONE_TYPE_MIRROR
   1344  * @data_member int32_value
   1345  */
   1346 #define VEHICLE_PROPERTY_MIRROR_Z_MOVE                              (0x00000B41)
   1347 
   1348 /**
   1349  * Mirror Y Position
   1350  *
   1351  * Positive value indicate tilt right, negative value is left
   1352  *
   1353  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1354  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1355  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1356  * @zone_type VEHICLE_ZONE_TYPE_MIRROR
   1357  * @data_member int32_value
   1358  */
   1359 #define VEHICLE_PROPERTY_MIRROR_Y_POS                               (0x00000B42)
   1360 
   1361 /**
   1362  * Mirror Y Move
   1363  *
   1364  * Positive value indicate tilt right, negative value is left
   1365  *
   1366  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1367  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1368  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1369  * @zone_type VEHICLE_ZONE_TYPE_MIRROR
   1370  * @data_member int32_value
   1371  */
   1372 #define VEHICLE_PROPERTY_MIRROR_Y_MOVE                              (0x00000B43)
   1373 
   1374 /**
   1375  * Mirror Lock
   1376  *
   1377  * True indicates mirror positions are locked and not changeable
   1378  *
   1379  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
   1380  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1381  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1382  * @data_member boolean_value
   1383  */
   1384 #define VEHICLE_PROPERTY_MIRROR_LOCK                                (0x00000B44)
   1385 
   1386 /**
   1387  * Mirror Fold
   1388  *
   1389  * True indicates mirrors are folded
   1390  *
   1391  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
   1392  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1393  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1394  * @data_member boolean_value
   1395  */
   1396 #define VEHICLE_PROPERTY_MIRROR_FOLD                                (0x00000B45)
   1397 
   1398 // Seats
   1399 /**
   1400  * Seat memory select
   1401  *
   1402  * This parameter selects the memory preset to use to select the seat position.
   1403  * The minValue is always 0, and the maxValue determines the number of seat
   1404  * positions available.
   1405  *
   1406  * For instance, if the driver's seat has 3 memory presets, the maxValue will be 3.
   1407  * When the user wants to select a preset, the desired preset number (1, 2, or 3)
   1408  * is set.
   1409  *
   1410  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1411  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1412  * @access VEHICLE_PROP_ACCESS_WRITE
   1413  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1414  * @data_member int32_value
   1415  */
   1416 #define VEHICLE_PROPERTY_SEAT_MEMORY_SELECT                         (0x00000B80)
   1417 
   1418 /**
   1419  * Seat memory set
   1420  *
   1421  * This setting allows the user to save the current seat position settings into
   1422  * the selected preset slot.  The maxValue for each seat position shall match
   1423  * the maxValue for VEHICLE_PROPERTY_SEAT_MEMORY_SELECT.
   1424  *
   1425  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1426  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1427  * @access VEHICLE_PROP_ACCESS_WRITE
   1428  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1429  * @data_member int32_value
   1430  */
   1431 #define VEHICLE_PROPERTY_SEAT_MEMORY_SET                            (0x00000B81)
   1432 
   1433 /**
   1434  * Seatbelt buckled
   1435  *
   1436  * True indicates belt is buckled.
   1437  *
   1438  * Write access indicates automatic seat buckling capabilities.  There are no known cars at this
   1439  * time, but you never know...
   1440  *
   1441  * @value_type VEHICLE_VALUE_TYPE_ZONED_BOOLEAN
   1442  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1443  * @access VEHICLE_PROP_ACCESS_READ|VEHICLE_PROP_ACCESS_WRITE
   1444  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1445  * @data_member boolean_value
   1446  */
   1447 #define VEHICLE_PROPERTY_SEAT_BELT_BUCKLED                          (0x00000B82)
   1448 
   1449 /**
   1450  * Seatbelt height position
   1451  *
   1452  * Adjusts the shoulder belt anchor point.
   1453  * Max value indicates highest position
   1454  * Min value indicates lowest position
   1455  *
   1456  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1457  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1458  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1459  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1460  * @data_member int32_value
   1461  */
   1462 #define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_POS                       (0x00000B83)
   1463 
   1464 /**
   1465  * Seatbelt height move
   1466  *
   1467  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1468  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1469  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1470  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1471  * @data_member int32_value
   1472  */
   1473 #define VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_MOVE                      (0x00000B84)
   1474 
   1475 /**
   1476  * Seat fore/aft position
   1477  *
   1478  * Sets the seat position forward (closer to steering wheel) and backwards.
   1479  * Max value indicates closest to wheel, min value indicates most rearward
   1480  * position.
   1481  *
   1482  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1483  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1484  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1485  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1486  * @data_member int32_value
   1487  */
   1488 #define VEHICLE_PROPERTY_SEAT_FORE_AFT_POS                          (0x00000B85)
   1489 
   1490 /**
   1491  * Seat fore/aft move
   1492  *
   1493  * Moves the seat position forward and aft.
   1494  *
   1495  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1496  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1497  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1498  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1499  * @data_member int32_value
   1500  */
   1501 #define VEHICLE_PROPERTY_SEAT_FORE_AFT_MOVE                         (0x00000B86)
   1502 
   1503 /**
   1504  * Seat backrest angle 1 position
   1505  *
   1506  * Backrest angle 1 is the actuator closest to the bottom of the seat.
   1507  * Max value indicates angling forward towards the steering wheel.
   1508  * Min value indicates full recline.
   1509  *
   1510  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1511  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1512  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1513  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1514  * @data_member int32_value
   1515  */
   1516 #define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_POS                  (0x00000B87)
   1517 
   1518 /**
   1519  * Seat backrest angle 1 move
   1520  *
   1521  * Moves the backrest forward or recline.
   1522  *
   1523  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1524  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1525  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1526  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1527  * @data_member int32_value
   1528  */
   1529 #define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_MOVE                 (0x00000B88)
   1530 
   1531 /**
   1532  * Seat backrest angle 2 position
   1533  *
   1534  * Backrest angle 2 is the next actuator up from the bottom of the seat.
   1535  * Max value indicates angling forward towards the steering wheel.
   1536  * Min value indicates full recline.
   1537  *
   1538  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1539  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1540  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1541  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1542  * @data_member int32_value
   1543  */
   1544 #define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_POS                  (0x00000B89)
   1545 
   1546 /**
   1547  * Seat backrest angle 2 move
   1548  *
   1549  * Moves the backrest forward or recline.
   1550  *
   1551  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1552  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1553  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1554  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1555  * @data_member int32_value
   1556  */
   1557 #define VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_MOVE                 (0x00000B8A)
   1558 
   1559 /**
   1560  * Seat height position
   1561  *
   1562  * Sets the seat height.
   1563  * Max value indicates highest position.
   1564  * Min value indicates lowest position.
   1565  *
   1566  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1567  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1568  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1569  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1570  * @data_member int32_value
   1571  */
   1572 #define VEHICLE_PROPERTY_SEAT_HEIGHT_POS                            (0x00000B8B)
   1573 
   1574 /**
   1575  * Seat height move
   1576  *
   1577  * Moves the seat height.
   1578  *
   1579  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1580  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1581  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1582  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1583  * @data_member int32_value
   1584  */
   1585 #define VEHICLE_PROPERTY_SEAT_HEIGHT_MOVE                           (0x00000B8C)
   1586 
   1587 /**
   1588  * Seat depth position
   1589  *
   1590  * Sets the seat depth, distance from back rest to front edge of seat.
   1591  * Max value indicates longest depth position.
   1592  * Min value indicates shortest position.
   1593  *
   1594  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1595  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1596  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1597  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1598  * @data_member int32_value
   1599  */
   1600 #define VEHICLE_PROPERTY_SEAT_DEPTH_POS                             (0x00000B8D)
   1601 
   1602 /**
   1603  * Seat depth move
   1604  *
   1605  * Adjusts the seat depth.
   1606  *
   1607  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1608  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1609  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1610  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1611  * @data_member int32_value
   1612  */
   1613 #define VEHICLE_PROPERTY_SEAT_DEPTH_MOVE                            (0x00000B8E)
   1614 
   1615 /**
   1616  * Seat tilt position
   1617  *
   1618  * Sets the seat tilt.
   1619  * Max value indicates front edge of seat higher than back edge.
   1620  * Min value indicates front edge of seat lower than back edge.
   1621  *
   1622  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1623  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1624  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1625  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1626  * @data_member int32_value
   1627  */
   1628 #define VEHICLE_PROPERTY_SEAT_TILT_POS                              (0x00000B8F)
   1629 
   1630 /**
   1631  * Seat tilt move
   1632  *
   1633  * Tilts the seat.
   1634  *
   1635  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1636  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1637  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1638  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1639  * @data_member int32_value
   1640  */
   1641 #define VEHICLE_PROPERTY_SEAT_TILT_MOVE                             (0x00000B90)
   1642 
   1643 /**
   1644  * Lumber fore/aft position
   1645  *
   1646  * Pushes the lumbar support forward and backwards
   1647  * Max value indicates most forward position.
   1648  * Min value indicates most rearward position.
   1649  *
   1650  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1651  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1652  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1653  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1654  * @data_member int32_value
   1655  */
   1656 #define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_POS                   (0x00000B91)
   1657 
   1658 /**
   1659  * Lumbar fore/aft move
   1660  *
   1661  * Adjusts the lumbar support.
   1662  *
   1663  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1664  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1665  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1666  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1667  * @data_member int32_value
   1668  */
   1669 #define VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_MOVE                  (0x00000B92)
   1670 
   1671 /**
   1672  * Lumbar side support position
   1673  *
   1674  * Sets the amount of lateral lumbar support.
   1675  * Max value indicates widest lumbar setting (i.e. least support)
   1676  * Min value indicates thinnest lumbar setting.
   1677  *
   1678  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1679  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1680  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1681  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1682  * @data_member int32_value
   1683  */
   1684 #define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_POS               (0x00000B93)
   1685 
   1686 /**
   1687  * Lumbar side support move
   1688  *
   1689  * Adjusts the amount of lateral lumbar support.
   1690  *
   1691  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1692  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1693  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1694  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1695  * @data_member int32_value
   1696  */
   1697 #define VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_MOVE              (0x00000B94)
   1698 
   1699 /**
   1700  * Headrest height position
   1701  *
   1702  * Sets the headrest height.
   1703  * Max value indicates tallest setting.
   1704  * Min value indicates shortest setting.
   1705  *
   1706  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1707  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1708  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1709  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1710  * @data_member int32_value
   1711  */
   1712 #define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_POS                   (0x00000B95)
   1713 
   1714 /**
   1715  * Headrest height move
   1716  *
   1717  * Moves the headrest up and down.
   1718  *
   1719  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1720  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1721  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1722  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1723  * @data_member int32_value
   1724  */
   1725 #define VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_MOVE                  (0x00000B96)
   1726 
   1727 /**
   1728  * Headrest angle position
   1729  *
   1730  * Sets the angle of the headrest.
   1731  * Max value indicates most upright angle.
   1732  * Min value indicates shallowest headrest angle.
   1733  *
   1734  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1735  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1736  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1737  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1738  * @data_member int32_value
   1739  */
   1740 #define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_POS                    (0x00000B97)
   1741 
   1742 /**
   1743  * Headrest angle move
   1744  *
   1745  * Adjusts the angle of the headrest
   1746  *
   1747  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1748  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1749  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1750  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1751  * @data_member int32_value
   1752  */
   1753 #define VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_MOVE                   (0x00000B98)
   1754 
   1755 /**
   1756  * Headrest fore/aft position
   1757  *
   1758  * Adjusts the headrest forwards and backwards.
   1759  * Max value indicates position closest to front of car.
   1760  * Min value indicates position closest to rear of car.
   1761  *
   1762  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1763  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1764  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1765  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1766  * @data_member int32_value
   1767  */
   1768 #define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_POS                 (0x00000B99)
   1769 
   1770 /**
   1771  * Headrest fore/aft move
   1772  *
   1773  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1774  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1775  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1776  * @zone_type VEHICLE_ZONE_TYPE_SEAT
   1777  * @data_member int32_value
   1778  */
   1779 #define VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_MOVE                (0x00000B9A)
   1780 
   1781 
   1782 // Windows
   1783 /**
   1784  * Window Position
   1785  *
   1786  * Max = window up / closed
   1787  * Min = window down / open
   1788  *
   1789  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1790  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1791  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1792  * @data_member int32_value
   1793  */
   1794 #define VEHICLE_PROPERTY_WINDOW_POS                                 (0x00000BC0)
   1795 
   1796 /**
   1797  * Window Move
   1798  *
   1799  * Max = window up / closed
   1800  * Min = window down / open
   1801  * Magnitude denotes relative speed.  I.e. +2 is faster than +1 in raising the window.
   1802  *
   1803  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1804  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1805  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1806  * @data_member int32_value
   1807  */
   1808 #define VEHICLE_PROPERTY_WINDOW_MOVE                                (0x00000BC1)
   1809 
   1810 /**
   1811  * Window Vent Position
   1812  *
   1813  * This feature is used to control the vent feature on a sunroof.
   1814  *
   1815  * Max = vent open
   1816  * Min = vent closed
   1817  *
   1818  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1819  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1820  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1821  * @data_member int32_value
   1822  */
   1823 #define VEHICLE_PROPERTY_WINDOW_VENT_POS                            (0x00000BC2)
   1824 
   1825 /**
   1826  * Window Vent Move
   1827  *
   1828  * This feature is used to control the vent feature on a sunroof.
   1829  *
   1830  * Max = vent open
   1831  * Min = vent closed
   1832  *
   1833  * @value_type VEHICLE_VALUE_TYPE_ZONED_INT32
   1834  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1835  * @access VEHICLE_PROP_ACCESS_READ_WRITE|VEHICLE_PROP_ACCESS_WRITE
   1836  * @data_member int32_value
   1837  */
   1838 #define VEHICLE_PROPERTY_WINDOW_VENT_MOVE                           (0x00000BC3)
   1839 
   1840 /**
   1841  * Window Lock
   1842  *
   1843  * True indicates windows are locked and can't be moved.
   1844  *
   1845  * @value_type VEHICLE_VALUE_TYPE_BOOLEAN
   1846  * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   1847  * @access VEHICLE_PROP_ACCESS_READ_WRITE
   1848  * @data_member boolean_value
   1849  */
   1850 #define VEHICLE_PROPERTY_WINDOW_LOCK                                (0x00000BC4)
   1851 
   1852 
   1853 
   1854 /**
   1855  *  H/W specific, non-standard property can be added as necessary. Such property should use
   1856  *  property number in range of [VEHICLE_PROPERTY_CUSTOM_START, VEHICLE_PROPERTY_CUSTOM_END].
   1857  *  Definition of property in this range is completely up to each HAL implementation.
   1858  *  For such property, it is recommended to fill vehicle_prop_config.config_string with some
   1859  *  additional information to help debugging. For example, company XYZ's custom extension may
   1860  *  include config_string of "com.XYZ.some_further_details".
   1861  *  @range_start
   1862  */
   1863 #define VEHICLE_PROPERTY_CUSTOM_START                               (0x70000000)
   1864 /** @range_end */
   1865 #define VEHICLE_PROPERTY_CUSTOM_END                                 (0x73ffffff)
   1866 
   1867 /**
   1868  * Property range allocated for system's internal usage like testing. HAL should never declare
   1869  * property in this range.
   1870  * @range_start
   1871  */
   1872 #define VEHICLE_PROPERTY_INTERNAL_START                             (0x74000000)
   1873 /**
   1874  * @range_end
   1875  */
   1876 #define VEHICLE_PROPERTY_INTERNAL_END                               (0x74ffffff)
   1877 
   1878 /**
   1879  * Value types for various properties.
   1880  */
   1881 enum vehicle_value_type {
   1882     VEHICLE_VALUE_TYPE_SHOUD_NOT_USE            = 0x00, // value_type should never set to 0.
   1883     VEHICLE_VALUE_TYPE_STRING                   = 0x01,
   1884     VEHICLE_VALUE_TYPE_BYTES                    = 0x02,
   1885     VEHICLE_VALUE_TYPE_BOOLEAN                  = 0x03,
   1886     VEHICLE_VALUE_TYPE_ZONED_BOOLEAN            = 0x04,
   1887     VEHICLE_VALUE_TYPE_INT64                    = 0x05,
   1888     VEHICLE_VALUE_TYPE_FLOAT                    = 0x10,
   1889     VEHICLE_VALUE_TYPE_FLOAT_VEC2               = 0x11,
   1890     VEHICLE_VALUE_TYPE_FLOAT_VEC3               = 0x12,
   1891     VEHICLE_VALUE_TYPE_FLOAT_VEC4               = 0x13,
   1892     VEHICLE_VALUE_TYPE_INT32                    = 0x20,
   1893     VEHICLE_VALUE_TYPE_INT32_VEC2               = 0x21,
   1894     VEHICLE_VALUE_TYPE_INT32_VEC3               = 0x22,
   1895     VEHICLE_VALUE_TYPE_INT32_VEC4               = 0x23,
   1896     VEHICLE_VALUE_TYPE_ZONED_FLOAT              = 0x30,
   1897     VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC2         = 0x31,
   1898     VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC3         = 0x32,
   1899     VEHICLE_VALUE_TYPE_ZONED_FLOAT_VEC4         = 0x33,
   1900     VEHICLE_VALUE_TYPE_ZONED_INT32              = 0x40,
   1901     VEHICLE_VALUE_TYPE_ZONED_INT32_VEC2         = 0x41,
   1902     VEHICLE_VALUE_TYPE_ZONED_INT32_VEC3         = 0x42,
   1903     VEHICLE_VALUE_TYPE_ZONED_INT32_VEC4         = 0x43,
   1904 };
   1905 
   1906 /**
   1907  * Units used for int or float type with no attached enum types.
   1908  */
   1909 enum vehicle_unit_type {
   1910     VEHICLE_UNIT_TYPE_SHOULD_NOT_USE        = 0x00000000,
   1911     // speed related items
   1912     VEHICLE_UNIT_TYPE_METER_PER_SEC         = 0x00000001,
   1913     VEHICLE_UNIT_TYPE_RPM                   = 0x00000002,
   1914     VEHICLE_UNIT_TYPE_HZ                    = 0x00000003,
   1915     // kind of ratio
   1916     VEHICLE_UNIT_TYPE_PERCENTILE            = 0x00000010,
   1917     // length
   1918     VEHICLE_UNIT_TYPE_MILLIMETER            = 0x00000020,
   1919     VEHICLE_UNIT_TYPE_METER                 = 0x00000021,
   1920     VEHICLE_UNIT_TYPE_KILOMETER             = 0x00000023,
   1921     // temperature
   1922     VEHICLE_UNIT_TYPE_CELSIUS               = 0x00000030,
   1923     VEHICLE_UNIT_TYPE_FAHRENHEIT            = 0x00000031,
   1924     VEHICLE_UNIT_TYPE_KELVIN                = 0x00000032,
   1925     // volume
   1926     VEHICLE_UNIT_TYPE_MILLILITER            = 0x00000040,
   1927     // time
   1928     VEHICLE_UNIT_TYPE_NANO_SECS             = 0x00000050,
   1929     VEHICLE_UNIT_TYPE_SECS                  = 0x00000053,
   1930     VEHICLE_UNIT_TYPE_YEAR                  = 0x00000059,
   1931 };
   1932 
   1933 /**
   1934  * This describes how value of property can change.
   1935  */
   1936 enum vehicle_prop_change_mode {
   1937     /**
   1938      * Property of this type will *never* change. This property will not support subscription, but
   1939      * will support get
   1940      */
   1941     VEHICLE_PROP_CHANGE_MODE_STATIC         = 0x00,
   1942     /**
   1943      * Property of this type will be reported when there is a change.
   1944      * get call should return the current value.
   1945      * Set operation for this property is assumed to be asynchronous. When the property is read
   1946      * (get) after set, it may still return old value until underlying H/W backing this property
   1947      * has actually changed the state. Once state is changed, the property will dispatch changed
   1948      * value as event.
   1949      */
   1950     VEHICLE_PROP_CHANGE_MODE_ON_CHANGE      = 0x01,
   1951     /**
   1952      * Property of this type change continuously and requires fixed rate of sampling to retrieve
   1953      * the data.
   1954      */
   1955     VEHICLE_PROP_CHANGE_MODE_CONTINUOUS     = 0x02,
   1956     /**
   1957      * Property of this type may be polled to get the current value.
   1958      */
   1959     VEHICLE_PROP_CHANGE_MODE_POLL           = 0x03,
   1960     /**
   1961      * This is for property where change event should be sent only when the value is
   1962      * set from external component. Normal value change will not trigger event.
   1963      * For example, clock property can send change event only when it is set, outside android,
   1964      * for case like user setting time or time getting update. There is no need to send it
   1965      * per every value change.
   1966      */
   1967     VEHICLE_PROP_CHANGE_MODE_ON_SET         = 0x04,
   1968 };
   1969 
   1970 /**
   1971  * Property config defines the capabilities of it. User of the API
   1972  * should first get the property config to understand the output from get()
   1973  * commands and also to ensure that set() or events commands are in sync with
   1974  * the expected output.
   1975  */
   1976 enum vehicle_prop_access {
   1977     VEHICLE_PROP_ACCESS_READ  = 0x01,
   1978     VEHICLE_PROP_ACCESS_WRITE = 0x02,
   1979     VEHICLE_PROP_ACCESS_READ_WRITE = 0x03
   1980 };
   1981 
   1982 /**
   1983  * These permissions define how the OEMs want to distribute their information and security they
   1984  * want to apply. On top of these restrictions, android will have additional
   1985  * 'app-level' permissions that the apps will need to ask the user before the apps have the
   1986  * information.
   1987  * This information should be kept in vehicle_prop_config.permission_model.
   1988  */
   1989 enum vehicle_permission_model {
   1990     /**
   1991      * No special restriction, but each property can still require specific android app-level
   1992      * permission.
   1993      */
   1994     VEHICLE_PERMISSION_NO_RESTRICTION = 0,
   1995     /** Signature only. Only APKs signed with OEM keys are allowed. */
   1996     VEHICLE_PERMISSION_OEM_ONLY = 0x1,
   1997     /** System only. APKs built-in to system  can access the property. */
   1998     VEHICLE_PERMISSION_SYSTEM_APP_ONLY = 0x2,
   1999     /** Equivalent to system|signature */
   2000     VEHICLE_PERMISSION_OEM_OR_SYSTEM_APP = 0x3
   2001 };
   2002 
   2003 
   2004 /**
   2005  *  Special values for INT32/FLOAT (including ZONED types)
   2006  *  These values represent special state, which is outside MIN/MAX range but can happen.
   2007  *  For example, HVAC temperature may use out of range min / max to represent that
   2008  *  it is working in full power although target temperature has separate min / max.
   2009  *  OUT_OF_RANGE_OFF can represent a state where the property is powered off.
   2010  *  Usually such property will have separate property to control power.
   2011  */
   2012 
   2013 #define VEHICLE_INT_OUT_OF_RANGE_MAX (INT32_MAX)
   2014 #define VEHICLE_INT_OUT_OF_RANGE_MIN (INT32_MIN)
   2015 #define VEHICLE_INT_OUT_OF_RANGE_OFF (INT32_MIN + 1)
   2016 
   2017 #define VEHICLE_FLOAT_OUT_OF_RANGE_MAX (INFINITY)
   2018 #define VEHICLE_FLOAT_OUT_OF_RANGE_MIN (-INFINITY)
   2019 #define VEHICLE_FLOAT_OUT_OF_RANGE_OFF (NAN)
   2020 
   2021 /**
   2022  * Car states.
   2023  *
   2024  * The driving states determine what features of the UI will be accessible.
   2025  */
   2026 enum vehicle_driving_status {
   2027     VEHICLE_DRIVING_STATUS_UNRESTRICTED      = 0x00,
   2028     VEHICLE_DRIVING_STATUS_NO_VIDEO          = 0x01,
   2029     VEHICLE_DRIVING_STATUS_NO_KEYBOARD_INPUT = 0x02,
   2030     VEHICLE_DRIVING_STATUS_NO_VOICE_INPUT    = 0x04,
   2031     VEHICLE_DRIVING_STATUS_NO_CONFIG         = 0x08,
   2032     VEHICLE_DRIVING_STATUS_LIMIT_MESSAGE_LEN = 0x10
   2033 };
   2034 
   2035 /**
   2036  * Various gears which can be selected by user and chosen in system.
   2037  */
   2038 enum vehicle_gear {
   2039     // Gear selections present in both automatic and manual cars.
   2040     VEHICLE_GEAR_NEUTRAL    = 0x0001,
   2041     VEHICLE_GEAR_REVERSE    = 0x0002,
   2042 
   2043     // Gear selections (mostly) present only in automatic cars.
   2044     VEHICLE_GEAR_PARK       = 0x0004,
   2045     VEHICLE_GEAR_DRIVE      = 0x0008,
   2046     VEHICLE_GEAR_LOW        = 0x0010,
   2047 
   2048     // Other possible gear selections (maybe present in manual or automatic
   2049     // cars).
   2050     VEHICLE_GEAR_1          = 0x0010,
   2051     VEHICLE_GEAR_2          = 0x0020,
   2052     VEHICLE_GEAR_3          = 0x0040,
   2053     VEHICLE_GEAR_4          = 0x0080,
   2054     VEHICLE_GEAR_5          = 0x0100,
   2055     VEHICLE_GEAR_6          = 0x0200,
   2056     VEHICLE_GEAR_7          = 0x0400,
   2057     VEHICLE_GEAR_8          = 0x0800,
   2058     VEHICLE_GEAR_9          = 0x1000
   2059 };
   2060 
   2061 
   2062 /**
   2063  * Various zones in the car.
   2064  *
   2065  * Zones are used for Air Conditioning purposes and divide the car into physical
   2066  * area zones.
   2067  */
   2068 enum vehicle_zone {
   2069     VEHICLE_ZONE_ROW_1_LEFT    = 0x00000001,
   2070     VEHICLE_ZONE_ROW_1_CENTER  = 0x00000002,
   2071     VEHICLE_ZONE_ROW_1_RIGHT   = 0x00000004,
   2072     VEHICLE_ZONE_ROW_1_ALL     = 0x00000008,
   2073     VEHICLE_ZONE_ROW_2_LEFT    = 0x00000010,
   2074     VEHICLE_ZONE_ROW_2_CENTER  = 0x00000020,
   2075     VEHICLE_ZONE_ROW_2_RIGHT   = 0x00000040,
   2076     VEHICLE_ZONE_ROW_2_ALL     = 0x00000080,
   2077     VEHICLE_ZONE_ROW_3_LEFT    = 0x00000100,
   2078     VEHICLE_ZONE_ROW_3_CENTER  = 0x00000200,
   2079     VEHICLE_ZONE_ROW_3_RIGHT   = 0x00000400,
   2080     VEHICLE_ZONE_ROW_3_ALL     = 0x00000800,
   2081     VEHICLE_ZONE_ROW_4_LEFT    = 0x00001000,
   2082     VEHICLE_ZONE_ROW_4_CENTER  = 0x00002000,
   2083     VEHICLE_ZONE_ROW_4_RIGHT   = 0x00004000,
   2084     VEHICLE_ZONE_ROW_4_ALL     = 0x00008000,
   2085     VEHICLE_ZONE_ALL           = 0x80000000,
   2086 };
   2087 
   2088 /**
   2089  * Various Seats in the car.
   2090  */
   2091 enum vehicle_seat {
   2092     VEHICLE_SEAT_ROW_1_LEFT   = 0x0001,
   2093     VEHICLE_SEAT_ROW_1_CENTER = 0x0002,
   2094     VEHICLE_SEAT_ROW_1_RIGHT  = 0x0004,
   2095     VEHICLE_SEAT_ROW_2_LEFT   = 0x0010,
   2096     VEHICLE_SEAT_ROW_2_CENTER = 0x0020,
   2097     VEHICLE_SEAT_ROW_2_RIGHT  = 0x0040,
   2098     VEHICLE_SEAT_ROW_3_LEFT   = 0x0100,
   2099     VEHICLE_SEAT_ROW_3_CENTER = 0x0200,
   2100     VEHICLE_SEAT_ROW_3_RIGHT  = 0x0400
   2101 };
   2102 
   2103 /**
   2104  * Various windshields/windows in the car.
   2105  */
   2106 enum vehicle_window {
   2107     VEHICLE_WINDOW_FRONT_WINDSHIELD = 0x0001,
   2108     VEHICLE_WINDOW_REAR_WINDSHIELD  = 0x0002,
   2109     VEHICLE_WINDOW_ROOF_TOP         = 0x0004,
   2110     VEHICLE_WINDOW_ROW_1_LEFT       = 0x0010,
   2111     VEHICLE_WINDOW_ROW_1_RIGHT      = 0x0020,
   2112     VEHICLE_WINDOW_ROW_2_LEFT       = 0x0100,
   2113     VEHICLE_WINDOW_ROW_2_RIGHT      = 0x0200,
   2114     VEHICLE_WINDOW_ROW_3_LEFT       = 0x1000,
   2115     VEHICLE_WINDOW_ROW_3_RIGHT      = 0x2000,
   2116 };
   2117 
   2118 enum vehicle_door {
   2119     VEHICLE_DOOR_ROW_1_LEFT    = 0x00000001,
   2120     VEHICLE_DOOR_ROW_1_RIGHT   = 0x00000004,
   2121     VEHICLE_DOOR_ROW_2_LEFT    = 0x00000010,
   2122     VEHICLE_DOOR_ROW_2_RIGHT   = 0x00000040,
   2123     VEHICLE_DOOR_ROW_3_LEFT    = 0x00000100,
   2124     VEHICLE_DOOR_ROW_3_RIGHT   = 0x00000400,
   2125     VEHICLE_DOOR_HOOD          = 0x10000000,
   2126     VEHICLE_DOOR_REAR          = 0x20000000,
   2127 };
   2128 
   2129 enum vehicle_mirror {
   2130     VEHICLE_MIRROR_DRIVER_LEFT   = 0x00000001,
   2131     VEHICLE_MIRROR_DRIVER_RIGHT  = 0x00000002,
   2132     VEHICLE_MIRROR_DRIVER_CENTER = 0x00000004,
   2133 };
   2134 
   2135 enum vehicle_turn_signal {
   2136     VEHICLE_SIGNAL_NONE         = 0x00,
   2137     VEHICLE_SIGNAL_RIGHT        = 0x01,
   2138     VEHICLE_SIGNAL_LEFT         = 0x02,
   2139     VEHICLE_SIGNAL_EMERGENCY    = 0x04
   2140 };
   2141 
   2142 enum vehicle_zone_type {
   2143     VEHICLE_ZONE_TYPE_NONE      = 0x00,
   2144     VEHICLE_ZONE_TYPE_ZONE    = 0x01,
   2145     VEHICLE_ZONE_TYPE_SEAT      = 0x02,
   2146     VEHICLE_ZONE_TYPE_DOOR      = 0x04,
   2147     VEHICLE_ZONE_TYPE_WINDOW    = 0x10,
   2148     VEHICLE_ZONE_TYPE_MIRROR    = 0x20,
   2149 };
   2150 
   2151 /*
   2152  * Boolean type.
   2153  */
   2154 enum vehicle_boolean {
   2155     VEHICLE_FALSE = 0x00,
   2156     VEHICLE_TRUE  = 0x01
   2157 };
   2158 
   2159 typedef int32_t vehicle_boolean_t;
   2160 
   2161 /**
   2162  * Vehicle string.
   2163  *
   2164  * Defines a UTF8 encoded sequence of bytes that should be used for string
   2165  * representation throughout.
   2166  */
   2167 typedef struct vehicle_str {
   2168     uint8_t* data;
   2169     int32_t len;
   2170 } vehicle_str_t;
   2171 
   2172 /**
   2173  * Vehicle byte array.
   2174  * This is for passing generic raw data.
   2175  */
   2176 typedef vehicle_str_t vehicle_bytes_t;
   2177 
   2178 typedef struct vehicle_prop_config {
   2179     int32_t prop;
   2180 
   2181     /**
   2182      * Defines if the property is read or write. Value should be one of
   2183      * enum vehicle_prop_access.
   2184      */
   2185     int32_t access;
   2186 
   2187     /**
   2188      * Defines if the property is continuous or on-change. Value should be one
   2189      * of enum vehicle_prop_change_mode.
   2190      */
   2191     int32_t change_mode;
   2192 
   2193     /**
   2194      * Type of data used for this property. This type is fixed per each property.
   2195      * Check vehicle_value_type for allowed value.
   2196      */
   2197     int32_t value_type;
   2198 
   2199     /**
   2200      * Define necessary permission model to access the data.
   2201      */
   2202     int32_t permission_model;
   2203 
   2204     /**
   2205      * Some of the properties may have associated zones (such as hvac), in these
   2206      * cases the config should contain an ORed value for the associated zone.
   2207      */
   2208     union {
   2209         /**
   2210          * The value is derived by ORing one or more of enum vehicle_zone members.
   2211          */
   2212         int32_t vehicle_zone_flags;
   2213         /** The value is derived by ORing one or more of enum vehicle_seat members. */
   2214         int32_t vehicle_seat_flags;
   2215         /** The value is derived by ORing one or more of enum vehicle_window members. */
   2216         int32_t vehicle_window_flags;
   2217     };
   2218 
   2219     /**
   2220      * Property specific configuration information. Usage of this will be defined per each property.
   2221      */
   2222     union {
   2223         /**
   2224          * For generic configuration information
   2225          */
   2226         int32_t config_flags;
   2227         /** The number of presets that are stored by the radio module. Pass 0 if
   2228          * there are no presets available. The range of presets is defined to be
   2229          * from 1 (see VEHICLE_RADIO_PRESET_MIN_VALUE) to vehicle_radio_num_presets.
   2230          */
   2231         int32_t vehicle_radio_num_presets;
   2232         int32_t config_array[4];
   2233     };
   2234 
   2235     /**
   2236      * Some properties may require additional information passed over this string. Most properties
   2237      * do not need to set this and in that case, config_string.data should be NULL and
   2238      * config_string.len should be 0.
   2239      */
   2240     vehicle_str_t config_string;
   2241 
   2242     /**
   2243      * Specify minimum allowed value for the property. This is necessary for property which does
   2244      * not have specified enum.
   2245      */
   2246     union {
   2247         float float_min_value;
   2248         int32_t int32_min_value;
   2249         int64_t int64_min_value;
   2250     };
   2251 
   2252     /**
   2253      * Specify maximum allowed value for the property. This is necessary for property which does
   2254      * not have specified enum.
   2255      */
   2256     union {
   2257         float float_max_value;
   2258         int32_t int32_max_value;
   2259         int64_t int64_max_value;
   2260     };
   2261 
   2262     /**
   2263      * Array of min values for zoned properties. Zoned property can specify min / max value in two
   2264      * different ways:
   2265      *   1. All zones having the same min / max value: *_min/max_value should be set and this
   2266      *      array should be set to NULL.
   2267      *   2. All zones having separate min / max value: *_min/max_values array should be populated
   2268      *      and its length should be the same as number of active zones specified by *_zone_flags.
   2269      *
   2270      * Should be NULL if each zone does not have separate max values.
   2271      */
   2272     union {
   2273         float* float_min_values;
   2274         int32_t* int32_min_values;
   2275         int64_t* int64_min_values;
   2276     };
   2277 
   2278     /**
   2279      * Array of max values for zoned properties. See above for its usage.
   2280      * Should be NULL if each zone does not have separate max values.
   2281      * If not NULL, length of array should match that of min_values.
   2282      */
   2283     union {
   2284         float* float_max_values;
   2285         int32_t* int32_max_values;
   2286         int64_t* int64_max_values;
   2287     };
   2288 
   2289     /**
   2290      * Min sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   2291      */
   2292     float min_sample_rate;
   2293     /**
   2294      * Max sample rate in Hz. Should be 0 for sensor type of VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
   2295      */
   2296     float max_sample_rate;
   2297     /**
   2298      * Place holder for putting HAL implementation specific data. Usage is wholly up to HAL
   2299      * implementation.
   2300      */
   2301     void* hal_data;
   2302 } vehicle_prop_config_t;
   2303 
   2304 /**
   2305  * HVAC property fields.
   2306  *
   2307  * Defines various HVAC properties which are packed into vehicle_hvac_t (see
   2308  * below). We define these properties outside in global scope so that HAL
   2309  * implementation and HAL users (JNI) can typecast vehicle_hvac correctly.
   2310  */
   2311 typedef struct vehicle_hvac {
   2312     /**
   2313      * Define one structure for each possible HVAC property.
   2314      * NOTES:
   2315      * a) Fan speed is a number from (0 - 6) where 6 is the highest speed. (TODO define enum)
   2316      * b) Temperature is a floating point Celcius scale.
   2317      * c) Direction is defined in enum vehicle_fan_direction.
   2318      *
   2319      * The HAL should create #entries number of vehicle_hvac_properties and
   2320      * assign it to "properties" variable below.
   2321      */
   2322     union {
   2323         int32_t fan_speed;
   2324         int32_t fan_direction;
   2325         vehicle_boolean_t ac_on;
   2326         vehicle_boolean_t max_ac_on;
   2327         vehicle_boolean_t max_defrost_on;
   2328         vehicle_boolean_t recirc_on;
   2329         vehicle_boolean_t dual_on;
   2330         vehicle_boolean_t auto_on;
   2331         vehicle_boolean_t power_on;
   2332 
   2333         float temperature_current;
   2334         float temperature_set;
   2335 
   2336         vehicle_boolean_t defrost_on;
   2337     };
   2338 } vehicle_hvac_t;
   2339 
   2340 /*
   2341  * Defines how the values for various properties are represented.
   2342  *
   2343  * There are two ways to populate and access the fields:
   2344  * a) Using the individual fields. Use this mechanism (see
   2345  * info_manufacture_date, fuel_capacity fields etc).
   2346  * b) Using the union accessors (see uint32_value, float_value etc).
   2347  *
   2348  * To add a new field make sure that it does not exceed the total union size
   2349  * (defined in int_array) and it is one of the vehicle_value_type. Then add the
   2350  * field name with its unit to union. If the field type is not yet defined (as
   2351  * of this draft, we don't use int64_t) then add that type to vehicle_value_type
   2352  * and have an accessor (so for int64_t it will be int64_t int64_value).
   2353  */
   2354 typedef union vehicle_value {
   2355     /** Define the max size of this structure. */
   2356     int32_t int32_array[4];
   2357     float float_array[4];
   2358 
   2359     // Easy accessors for union members (HAL implementation SHOULD NOT USE these
   2360     // fields while populating, use the property specific fields below instead).
   2361     int32_t int32_value;
   2362     int64_t int64_value;
   2363     float float_value;
   2364     vehicle_str_t str_value;
   2365     vehicle_bytes_t bytes_value;
   2366     vehicle_boolean_t boolean_value;
   2367 
   2368     // Vehicle Information.
   2369     vehicle_str_t info_vin;
   2370     vehicle_str_t info_make;
   2371     vehicle_str_t info_model;
   2372     int32_t info_model_year;
   2373 
   2374     // Represented in milliliters.
   2375     float info_fuel_capacity;
   2376 
   2377     float vehicle_speed;
   2378     float odometer;
   2379 
   2380     // Engine sensors.
   2381 
   2382     // Represented in milliliters.
   2383     //float engine_coolant_level;
   2384     // Represented in celcius.
   2385     float engine_coolant_temperature;
   2386     // Represented in a percentage value.
   2387     //float engine_oil_level;
   2388     // Represented in celcius.
   2389     float engine_oil_temperature;
   2390     float engine_rpm;
   2391 
   2392     // Event sensors.
   2393     // Value should be one of enum vehicle_gear_selection.
   2394     int32_t gear_selection;
   2395     // Value should be one of enum vehicle_gear.
   2396     int32_t gear_current_gear;
   2397     // Value should be one of enum vehicle_boolean.
   2398     int32_t parking_brake;
   2399     // If cruise_set_speed > 0 then cruise is ON otherwise cruise is OFF.
   2400     // Unit: meters / second (m/s).
   2401     //int32_t cruise_set_speed;
   2402     // Value should be one of enum vehicle_boolean.
   2403     int32_t is_fuel_level_low;
   2404     // Value should be one of enum vehicle_driving_status.
   2405     int32_t driving_status;
   2406     int32_t night_mode;
   2407     // Value should be one of emum vehicle_turn_signal.
   2408     int32_t turn_signals;
   2409     // Value should be one of enum vehicle_boolean.
   2410     //int32_t engine_on;
   2411 
   2412     // HVAC properties.
   2413     vehicle_hvac_t hvac;
   2414 
   2415     float outside_temperature;
   2416     float cabin_temperature;
   2417 
   2418 } vehicle_value_t;
   2419 
   2420 /*
   2421  * Encapsulates the property name and the associated value. It
   2422  * is used across various API calls to set values, get values or to register for
   2423  * events.
   2424  */
   2425 typedef struct vehicle_prop_value {
   2426     /* property identifier */
   2427     int32_t prop;
   2428 
   2429     /* value type of property for quick conversion from union to appropriate
   2430      * value. The value must be one of enum vehicle_value_type.
   2431      */
   2432     int32_t value_type;
   2433 
   2434     /** time is elapsed nanoseconds since boot */
   2435     int64_t timestamp;
   2436 
   2437     /**
   2438      * Zone information for zoned property. For non-zoned property, this should be ignored.
   2439      */
   2440     union {
   2441         int32_t zone;
   2442         int32_t seat;
   2443         int32_t window;
   2444     };
   2445 
   2446     vehicle_value_t value;
   2447 } vehicle_prop_value_t;
   2448 
   2449 /*
   2450  * Event callback happens whenever a variable that the API user has subscribed
   2451  * to needs to be reported. This may be based purely on threshold and frequency
   2452  * (a regular subscription, see subscribe call's arguments) or when the set()
   2453  * command is executed and the actual change needs to be reported.
   2454  *
   2455  * event_data is OWNED by the HAL and should be copied before the callback
   2456  * finishes.
   2457  */
   2458 typedef int (*vehicle_event_callback_fn)(const vehicle_prop_value_t *event_data);
   2459 
   2460 
   2461 /**
   2462  * Represent the operation where the current error has happened.
   2463  */
   2464 enum vehicle_property_operation {
   2465     /** Generic error to this property which is not tied to any operation. */
   2466     VEHICLE_OPERATION_GENERIC = 0,
   2467     /** Error happened while handling property set. */
   2468     VEHICLE_OPERATION_SET = 1,
   2469     /** Error happened while handling property get. */
   2470     VEHICLE_OPERATION_GET = 2,
   2471     /** Error happened while handling property subscription. */
   2472     VEHICLE_OPERATION_SUBSCRIBE = 3,
   2473 };
   2474 
   2475 /*
   2476  * Suggests that an error condition has occurred.
   2477  *
   2478  * @param error_code Error code. error_code should be standard error code with
   2479  *                negative value like -EINVAL.
   2480  * @parm property Note a property where error has happened. If this is generic error, property
   2481  *                should be VEHICLE_PROPERTY_INVALID.
   2482  * @param operation Represent the operation where the error has happened. Should be one of
   2483  *                  vehicle_property_operation.
   2484  */
   2485 typedef int (*vehicle_error_callback_fn)(int32_t error_code, int32_t property, int32_t operation);
   2486 
   2487 /************************************************************************************/
   2488 
   2489 /*
   2490  * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
   2491  * and the fields of this data structure must begin with hw_module_t
   2492  * followed by module specific information.
   2493  */
   2494 typedef struct vehicle_module {
   2495     struct hw_module_t common;
   2496 } vehicle_module_t;
   2497 
   2498 
   2499 typedef struct vehicle_hw_device {
   2500     struct hw_device_t common;
   2501 
   2502     /**
   2503      * After calling open on device the user should register callbacks for event and error
   2504      * functions.
   2505      */
   2506     int (*init)(struct vehicle_hw_device* device,
   2507                 vehicle_event_callback_fn event_fn, vehicle_error_callback_fn err_fn);
   2508     /**
   2509      * Before calling close the user should destroy the registered callback
   2510      * functions.
   2511      * In case the unsubscribe() call is not called on all properties before
   2512      * release() then release() will unsubscribe the properties itself.
   2513      */
   2514     int (*release)(struct vehicle_hw_device* device);
   2515 
   2516     /**
   2517      * Enumerate all available properties. The list is returned in "list".
   2518      * @param num_properties number of properties contained in the retuned array.
   2519      * @return array of property configs supported by this car. Note that returned data is const
   2520      *         and caller cannot modify it. HAL implementation should keep this memory until HAL
   2521      *         is released to avoid copying this again.
   2522      */
   2523     vehicle_prop_config_t const *(*list_properties)(struct vehicle_hw_device* device,
   2524             int* num_properties);
   2525 
   2526     /**
   2527      * Get a vehicle property value immediately. data should be allocated
   2528      * properly.
   2529      * The caller of the API OWNS the data field.
   2530      * Caller will set data->prop, data->value_type, and optionally zone value for zoned property.
   2531      * But HAL implementation needs to fill all entries properly when returning.
   2532      * For pointer type, HAL implementation should allocate necessary memory and caller is
   2533      * responsible for calling release_memory_from_get, which allows HAL to release allocated
   2534      * memory.
   2535      * For VEHICLE_PROP_CHANGE_MODE_STATIC type of property, get should return the same value
   2536      * always.
   2537      * For VEHICLE_PROP_CHANGE_MODE_ON_CHANGE type of property, it should return the latest value.
   2538      * If there is no data available yet, which can happen during initial stage, this call should
   2539      * return immediately with error code of -EAGAIN.
   2540      */
   2541     int (*get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data);
   2542 
   2543     /**
   2544      * Release memory allocated to data in previous get call. get call for byte or string involves
   2545      * allocating necessary memory from vehicle hal.
   2546      * To be safe, memory allocated by vehicle hal should be released by vehicle hal and vehicle
   2547      * network service will call this when data from vehicle hal is no longer necessary.
   2548      * vehicle hal implementation should only release member of vehicle_prop_value_t like
   2549      * data->str_value.data or data->bytes_value.data but not data itself as data itself is
   2550      * allocated from vehicle network service. Once memory is freed, corresponding pointer should
   2551      * be set to NULL bu vehicle hal.
   2552      */
   2553     void (*release_memory_from_get)(struct vehicle_hw_device* device, vehicle_prop_value_t *data);
   2554 
   2555     /**
   2556      * Set a vehicle property value.  data should be allocated properly and not
   2557      * NULL.
   2558      * The caller of the API OWNS the data field.
   2559      * timestamp of data will be ignored for set operation.
   2560      * Setting some properties require having initial state available. Depending on the vehicle hal,
   2561      * such initial data may not be available for short time after init. In such case, set call
   2562      * can return -EAGAIN like get call.
   2563      * For a property with separate power control, set can fail if the property is not powered on.
   2564      * In such case, hal should return -ESHUTDOWN error.
   2565      */
   2566     int (*set)(struct vehicle_hw_device* device, const vehicle_prop_value_t *data);
   2567 
   2568     /**
   2569      * Subscribe to events.
   2570      * Depending on output of list_properties if the property is:
   2571      * a) on-change: sample_rate should be set to 0.
   2572      * b) supports frequency: sample_rate should be set from min_sample_rate to
   2573      * max_sample_rate.
   2574      * For on-change type of properties, vehicle network service will make another get call to check
   2575      * the initial state. Due to this, vehicle hal implementation does not need to send initial
   2576      * state for on-change type of properties.
   2577      * @param device
   2578      * @param prop
   2579      * @param sample_rate
   2580      * @param zones All subscribed zones for zoned property. can be ignored for non-zoned property.
   2581      *              0 means all zones supported instead of no zone.
   2582      */
   2583     int (*subscribe)(struct vehicle_hw_device* device, int32_t prop, float sample_rate,
   2584             int32_t zones);
   2585 
   2586     /** Cancel subscription on a property. */
   2587     int (*unsubscribe)(struct vehicle_hw_device* device, int32_t prop);
   2588 
   2589     /**
   2590      * Print out debugging state for the vehicle hal. This will be called by
   2591      * the vehicle network service and will be included into the service' dump.
   2592      *
   2593      * The passed-in file descriptor can be used to write debugging text using
   2594      * dprintf() or write(). The text should be in ASCII encoding only.
   2595      *
   2596      * Performance requirements:
   2597      *
   2598      * This must be a non-blocking call. The HAL should return from this call
   2599      * in 1ms, must return from this call in 10ms. This call must avoid
   2600      * deadlocks, as it may be called at any point of operation.
   2601      * Any synchronization primitives used (such as mutex locks or semaphores)
   2602      * should be acquired with a timeout.
   2603      */
   2604     int (*dump)(struct vehicle_hw_device* device, int fd);
   2605 
   2606 } vehicle_hw_device_t;
   2607 
   2608 __END_DECLS
   2609 
   2610 #endif  // ANDROID_VEHICLE_INTERFACE_H
   2611