1 /* 2 * Copyright (C) 2016 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_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_ 18 #define android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_ 19 20 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h> 21 #include <vhal_v2_0/VehicleUtils.h> 22 23 namespace android { 24 namespace hardware { 25 namespace automotive { 26 namespace vehicle { 27 namespace V2_0 { 28 29 namespace impl { 30 // 31 // Some handy constants to avoid conversions from enum to int. 32 constexpr int ABS_ACTIVE = (int)VehicleProperty::ABS_ACTIVE; 33 constexpr int AP_POWER_STATE_REQ = (int)VehicleProperty::AP_POWER_STATE_REQ; 34 constexpr int AP_POWER_STATE_REPORT = (int)VehicleProperty::AP_POWER_STATE_REPORT; 35 constexpr int DOOR_1_LEFT = (int)VehicleAreaDoor::ROW_1_LEFT; 36 constexpr int DOOR_1_RIGHT = (int)VehicleAreaDoor::ROW_1_RIGHT; 37 constexpr int DOOR_2_LEFT = (int)VehicleAreaDoor::ROW_2_LEFT; 38 constexpr int DOOR_2_RIGHT = (int)VehicleAreaDoor::ROW_2_RIGHT; 39 constexpr int DOOR_REAR = (int)VehicleAreaDoor::REAR; 40 constexpr int WINDOW_1_LEFT = (int)VehicleAreaWindow::ROW_1_LEFT; 41 constexpr int WINDOW_1_RIGHT = (int)VehicleAreaWindow::ROW_1_RIGHT; 42 constexpr int WINDOW_2_LEFT = (int)VehicleAreaWindow::ROW_2_LEFT; 43 constexpr int WINDOW_2_RIGHT = (int)VehicleAreaWindow::ROW_2_RIGHT; 44 constexpr int WINDOW_ROOF_TOP_1 = (int)VehicleAreaWindow::ROOF_TOP_1; 45 constexpr int FAN_DIRECTION_FACE = (int)VehicleHvacFanDirection::FACE; 46 constexpr int FAN_DIRECTION_FLOOR = (int)VehicleHvacFanDirection::FLOOR; 47 constexpr int OBD2_LIVE_FRAME = (int)VehicleProperty::OBD2_LIVE_FRAME; 48 constexpr int OBD2_FREEZE_FRAME = (int)VehicleProperty::OBD2_FREEZE_FRAME; 49 constexpr int OBD2_FREEZE_FRAME_INFO = (int)VehicleProperty::OBD2_FREEZE_FRAME_INFO; 50 constexpr int OBD2_FREEZE_FRAME_CLEAR = (int)VehicleProperty::OBD2_FREEZE_FRAME_CLEAR; 51 constexpr int TRACTION_CONTROL_ACTIVE = (int)VehicleProperty::TRACTION_CONTROL_ACTIVE; 52 constexpr int VEHICLE_MAP_SERVICE = (int)VehicleProperty::VEHICLE_MAP_SERVICE; 53 constexpr int WHEEL_TICK = (int)VehicleProperty::WHEEL_TICK; 54 constexpr int ALL_WHEELS = 55 (int)(VehicleAreaWheel::LEFT_FRONT | VehicleAreaWheel::RIGHT_FRONT | 56 VehicleAreaWheel::LEFT_REAR | VehicleAreaWheel::RIGHT_REAR); 57 constexpr int SEAT_1_LEFT = (int)(VehicleAreaSeat::ROW_1_LEFT); 58 constexpr int SEAT_1_RIGHT = (int)(VehicleAreaSeat::ROW_1_RIGHT); 59 constexpr int HVAC_LEFT = (int)(VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_2_LEFT | 60 VehicleAreaSeat::ROW_2_CENTER); 61 constexpr int HVAC_RIGHT = (int)(VehicleAreaSeat::ROW_1_RIGHT | VehicleAreaSeat::ROW_2_RIGHT); 62 constexpr int HVAC_ALL = HVAC_LEFT | HVAC_RIGHT; 63 constexpr int VENDOR_EXTENSION_BOOLEAN_PROPERTY = 64 (int)(0x101 | VehiclePropertyGroup::VENDOR | VehiclePropertyType::BOOLEAN | VehicleArea::DOOR); 65 constexpr int VENDOR_EXTENSION_FLOAT_PROPERTY = 66 (int)(0x102 | VehiclePropertyGroup::VENDOR | VehiclePropertyType::FLOAT | VehicleArea::SEAT); 67 constexpr int VENDOR_EXTENSION_INT_PROPERTY = 68 (int)(0x103 | VehiclePropertyGroup::VENDOR | VehiclePropertyType::INT32 | VehicleArea::WINDOW); 69 constexpr int VENDOR_EXTENSION_STRING_PROPERTY = 70 (int)(0x104 | VehiclePropertyGroup::VENDOR | VehiclePropertyType::STRING | VehicleArea::GLOBAL); 71 constexpr int FUEL_DOOR_REAR_LEFT = (int)PortLocationType::REAR_LEFT; 72 constexpr int CHARGE_PORT_FRONT_LEFT = (int)PortLocationType::FRONT_LEFT; 73 constexpr int LIGHT_STATE_ON = (int)VehicleLightState::ON; 74 constexpr int LIGHT_SWITCH_AUTO = (int)VehicleLightSwitch::AUTOMATIC; 75 constexpr int WHEEL_FRONT_LEFT = (int)VehicleAreaWheel::LEFT_FRONT; 76 constexpr int WHEEL_FRONT_RIGHT = (int)VehicleAreaWheel::RIGHT_FRONT; 77 constexpr int WHEEL_REAR_LEFT = (int)VehicleAreaWheel::LEFT_REAR; 78 constexpr int WHEEL_REAR_RIGHT = (int)VehicleAreaWheel::RIGHT_REAR; 79 80 /** 81 * This property is used for test purpose to generate fake events. Here is the test package that 82 * is referencing this property definition: packages/services/Car/tests/vehiclehal_test 83 */ 84 const int32_t kGenerateFakeDataControllingProperty = 85 0x0666 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::MIXED; 86 87 /** 88 * FakeDataCommand enum defines the supported command type for kGenerateFakeDataControllingProperty. 89 * All those commands can be send independently with each other. And each will override the one sent 90 * previously. 91 * 92 * The controlling property has the following format: 93 * 94 * int32Values[0] - command enum defined in FakeDataCommand 95 * 96 * The format of the arguments is defined for each command type as below: 97 */ 98 enum class FakeDataCommand : int32_t { 99 /** 100 * Starts linear fake data generation. Caller must provide additional data: 101 * int32Values[1] - vehicle property to which command applies 102 * int64Values[0] - periodic interval in nanoseconds 103 * floatValues[0] - initial value 104 * floatValues[1] - dispersion defines the min/max value relative to initial value, where 105 * max = initial_value + dispersion, min = initial_value - dispersion. 106 * Dispersion should be non-negative, otherwise the behavior is undefined. 107 * floatValues[2] - increment, with every timer tick the value will be incremented by this 108 * amount. When reaching to max value, the current value will be set to 109 * min. It should be non-negative, otherwise the behavior is undefined. 110 */ 111 StartLinear = 0, 112 113 /** Stops linear fake data generation that was triggered by StartLinear commands. 114 * int32Values[1] - vehicle property to which command applies. VHAL will stop the 115 * corresponding linear generation for that property. 116 */ 117 StopLinear = 1, 118 119 /** 120 * Starts JSON-based fake data generation. It iterates through JSON-encoded VHAL events from a 121 * file and inject them to VHAL. The iteration can be repeated multiple times or infinitely. 122 * Caller must provide additional data: 123 * int32Values[1] - number of iterations. If it is not provided or -1. The iteration will be 124 * repeated infinite times. 125 * stringValue - path to the fake values JSON file 126 */ 127 StartJson = 2, 128 129 /** 130 * Stops JSON-based fake data generation. As multiple JSON-based generation can happen at the 131 * same time. Caller must provide the path of fake value JSON file to stop the corresponding 132 * generation: 133 * stringValue - path to the fake values JSON file 134 */ 135 StopJson = 3, 136 137 /** 138 * Injects key press event (HAL incorporates UP/DOWN acction and triggers 2 HAL events for every 139 * key-press). We set the enum with high number to leave space for future start/stop commands. 140 * Caller must provide the following data: 141 * int32Values[2] - Android key code 142 * int32Values[3] - target display (0 - for main display, 1 - for instrument cluster, see 143 * VehicleDisplay) 144 */ 145 KeyPress = 100, 146 }; 147 148 const int32_t kHvacPowerProperties[] = { 149 toInt(VehicleProperty::HVAC_FAN_SPEED), 150 toInt(VehicleProperty::HVAC_FAN_DIRECTION), 151 }; 152 153 struct ConfigDeclaration { 154 VehiclePropConfig config; 155 156 /* This value will be used as an initial value for the property. If this field is specified for 157 * property that supports multiple areas then it will be used for all areas unless particular 158 * area is overridden in initialAreaValue field. */ 159 VehiclePropValue::RawValue initialValue; 160 /* Use initialAreaValues if it is necessary to specify different values per each area. */ 161 std::map<int32_t, VehiclePropValue::RawValue> initialAreaValues; 162 }; 163 164 const ConfigDeclaration kVehicleProperties[]{ 165 {.config = 166 { 167 .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), 168 .access = VehiclePropertyAccess::READ, 169 .changeMode = VehiclePropertyChangeMode::STATIC, 170 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 171 }, 172 .initialValue = {.floatValues = {15000.0f}}}, 173 174 {.config = 175 { 176 .prop = toInt(VehicleProperty::INFO_FUEL_TYPE), 177 .access = VehiclePropertyAccess::READ, 178 .changeMode = VehiclePropertyChangeMode::STATIC, 179 }, 180 .initialValue = {.int32Values = {1}}}, 181 182 {.config = 183 { 184 .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY), 185 .access = VehiclePropertyAccess::READ, 186 .changeMode = VehiclePropertyChangeMode::STATIC, 187 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 188 }, 189 .initialValue = {.floatValues = {150000.0f}}}, 190 191 {.config = 192 { 193 .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE), 194 .access = VehiclePropertyAccess::READ, 195 .changeMode = VehiclePropertyChangeMode::STATIC, 196 }, 197 .initialValue = {.int32Values = {1}}}, 198 199 {.config = 200 { 201 .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT), 202 .access = VehiclePropertyAccess::READ, 203 .changeMode = VehiclePropertyChangeMode::STATIC, 204 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 205 }, 206 .initialValue = {.int32Values = {SEAT_1_LEFT}}}, 207 208 {.config = 209 { 210 .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION), 211 .access = VehiclePropertyAccess::READ, 212 .changeMode = VehiclePropertyChangeMode::STATIC, 213 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 214 }, 215 .initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}}, 216 217 {.config = 218 { 219 .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION), 220 .access = VehiclePropertyAccess::READ, 221 .changeMode = VehiclePropertyChangeMode::STATIC, 222 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 223 }, 224 .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}}, 225 226 {.config = 227 { 228 .prop = toInt(VehicleProperty::INFO_MAKE), 229 .access = VehiclePropertyAccess::READ, 230 .changeMode = VehiclePropertyChangeMode::STATIC, 231 }, 232 .initialValue = {.stringValue = "Toy Vehicle"}}, 233 {.config = 234 { 235 .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED), 236 .access = VehiclePropertyAccess::READ, 237 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 238 .minSampleRate = 1.0f, 239 .maxSampleRate = 10.0f, 240 }, 241 .initialValue = {.floatValues = {0.0f}}}, 242 243 {.config = 244 { 245 .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), 246 .access = VehiclePropertyAccess::READ_WRITE, 247 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 248 .configArray = {(int)VehicleUnit::METER_PER_SEC, 249 (int)VehicleUnit::MILES_PER_HOUR, 250 (int)VehicleUnit::KILOMETERS_PER_HOUR}, 251 }, 252 .initialValue = {.int32Values = {(int)VehicleUnit::KILOMETERS_PER_HOUR}}}, 253 254 {.config = 255 { 256 .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT), 257 .access = VehiclePropertyAccess::READ, 258 .changeMode = VehiclePropertyChangeMode::STATIC, 259 // this was a zoned property on an old vhal, but it is meant to be global 260 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 261 }, 262 .initialValue = {.int32Values = {SEAT_1_LEFT}}}, 263 264 {.config = 265 { 266 .prop = toInt(VehicleProperty::PERF_ODOMETER), 267 .access = VehiclePropertyAccess::READ, 268 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 269 }, 270 .initialValue = {.floatValues = {0.0f}}}, 271 272 { 273 .config = 274 { 275 .prop = toInt(VehicleProperty::ENGINE_RPM), 276 .access = VehiclePropertyAccess::READ, 277 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 278 .minSampleRate = 1.0f, 279 .maxSampleRate = 10.0f, 280 }, 281 .initialValue = {.floatValues = {0.0f}}, 282 }, 283 284 {.config = 285 { 286 .prop = toInt(VehicleProperty::FUEL_LEVEL), 287 .access = VehiclePropertyAccess::READ, 288 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 289 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 290 }, 291 .initialValue = {.floatValues = {15000.0f}}}, 292 293 {.config = 294 { 295 .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN), 296 .access = VehiclePropertyAccess::READ_WRITE, 297 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 298 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 299 }, 300 .initialValue = {.int32Values = {0}}}, 301 302 {.config = 303 { 304 .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL), 305 .access = VehiclePropertyAccess::READ, 306 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 307 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 308 }, 309 .initialValue = {.floatValues = {150000.0f}}}, 310 311 {.config = 312 { 313 .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN), 314 .access = VehiclePropertyAccess::READ_WRITE, 315 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 316 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 317 }, 318 .initialValue = {.int32Values = {0}}}, 319 320 {.config = 321 { 322 .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED), 323 .access = VehiclePropertyAccess::READ, 324 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 325 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 326 }, 327 .initialValue = {.int32Values = {0}}}, 328 329 {.config = 330 { 331 .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE), 332 .access = VehiclePropertyAccess::READ, 333 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 334 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 335 }, 336 .initialValue = {.floatValues = {0.0f}}}, 337 338 {.config = 339 { 340 .prop = toInt(VehicleProperty::RANGE_REMAINING), 341 .access = VehiclePropertyAccess::READ, 342 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 343 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 344 .minSampleRate = 1.0f, 345 .maxSampleRate = 2.0f, 346 }, 347 .initialValue = {.floatValues = {100.0f}}}, // units in meters 348 349 {.config = 350 {.prop = toInt(VehicleProperty::TIRE_PRESSURE), 351 .access = VehiclePropertyAccess::READ, 352 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 353 .minSampleRate = 1.0f, 354 .maxSampleRate = 2.0f, 355 .areaConfigs = 356 {VehicleAreaConfig{ 357 .areaId = WHEEL_FRONT_LEFT, .minFloatValue = 100.0f, .maxFloatValue = 300.0f, 358 }, 359 VehicleAreaConfig{ 360 .areaId = WHEEL_FRONT_RIGHT, .minFloatValue = 100.0f, .maxFloatValue = 300.0f, 361 }, 362 VehicleAreaConfig{ 363 .areaId = WHEEL_REAR_LEFT, .minFloatValue = 100.0f, .maxFloatValue = 300.0f, 364 }, 365 VehicleAreaConfig{ 366 .areaId = WHEEL_REAR_RIGHT, .minFloatValue = 100.0f, .maxFloatValue = 300.0f, 367 }}}, 368 .initialValue = {.floatValues = {200}}}, // units in kPa 369 370 {.config = 371 { 372 .prop = toInt(VehicleProperty::CURRENT_GEAR), 373 .access = VehiclePropertyAccess::READ, 374 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 375 }, 376 .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, 377 378 {.config = 379 { 380 .prop = toInt(VehicleProperty::PARKING_BRAKE_ON), 381 .access = VehiclePropertyAccess::READ, 382 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 383 }, 384 .initialValue = {.int32Values = {1}}}, 385 386 {.config = 387 { 388 .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW), 389 .access = VehiclePropertyAccess::READ, 390 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 391 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 392 }, 393 .initialValue = {.int32Values = {0}}}, 394 395 {.config = 396 { 397 .prop = toInt(VehicleProperty::HW_KEY_INPUT), 398 .access = VehiclePropertyAccess::READ, 399 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 400 }, 401 .initialValue = {.int32Values = {0, 0, 0}}}, 402 403 {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON), 404 .access = VehiclePropertyAccess::READ_WRITE, 405 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 406 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}, 407 // TODO(bryaneyler): Ideally, this is generated dynamically from 408 // kHvacPowerProperties. 409 .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED), 410 toInt(VehicleProperty::HVAC_FAN_DIRECTION)}}, 411 .initialValue = {.int32Values = {1}}}, 412 413 { 414 .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER), 415 .access = VehiclePropertyAccess::READ_WRITE, 416 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 417 .areaConfigs = 418 {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, 419 VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, 420 .initialValue = {.int32Values = {0}} // Will be used for all areas. 421 }, 422 423 {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), 424 .access = VehiclePropertyAccess::READ_WRITE, 425 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 426 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 427 .initialValue = {.int32Values = {0}}}, 428 429 {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON), 430 .access = VehiclePropertyAccess::READ_WRITE, 431 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 432 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 433 .initialValue = {.int32Values = {1}}}, 434 435 {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), 436 .access = VehiclePropertyAccess::READ_WRITE, 437 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 438 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 439 .initialValue = {.int32Values = {0}}}, 440 441 {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON), 442 .access = VehiclePropertyAccess::READ_WRITE, 443 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 444 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 445 .initialValue = {.int32Values = {1}}}, 446 447 {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON), 448 .access = VehiclePropertyAccess::READ_WRITE, 449 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 450 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 451 .initialValue = {.int32Values = {0}}}, 452 453 {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON), 454 .access = VehiclePropertyAccess::READ_WRITE, 455 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 456 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 457 .initialValue = {.int32Values = {1}}}, 458 459 {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON), 460 .access = VehiclePropertyAccess::READ_WRITE, 461 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 462 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 463 .initialValue = {.int32Values = {0}}}, 464 465 {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), 466 .access = VehiclePropertyAccess::READ_WRITE, 467 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 468 .areaConfigs = {VehicleAreaConfig{ 469 .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}}, 470 .initialValue = {.int32Values = {3}}}, 471 472 {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION), 473 .access = VehiclePropertyAccess::READ_WRITE, 474 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 475 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 476 .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}}, 477 478 {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE), 479 .access = VehiclePropertyAccess::READ, 480 .changeMode = VehiclePropertyChangeMode::STATIC, 481 .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, 482 .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR, 483 FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR}}}, 484 485 {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION), 486 .access = VehiclePropertyAccess::READ_WRITE, 487 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 488 .areaConfigs = {VehicleAreaConfig{ 489 .areaId = SEAT_1_LEFT, .minInt32Value = 0, .maxInt32Value = 3, 490 }, 491 VehicleAreaConfig{ 492 .areaId = SEAT_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 3, 493 }}}, 494 .initialValue = {.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level. 495 496 {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT), 497 .access = VehiclePropertyAccess::READ_WRITE, 498 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 499 .areaConfigs = {VehicleAreaConfig{ 500 .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}}, 501 .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling 502 503 {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE), 504 .access = VehiclePropertyAccess::READ_WRITE, 505 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 506 .areaConfigs = {VehicleAreaConfig{ 507 .areaId = SEAT_1_LEFT, .minInt32Value = -2, .maxInt32Value = 2, 508 }, 509 VehicleAreaConfig{ 510 .areaId = SEAT_1_RIGHT, .minInt32Value = -2, .maxInt32Value = 2, 511 }}}, 512 .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling 513 514 {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), 515 .access = VehiclePropertyAccess::READ_WRITE, 516 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 517 .areaConfigs = {VehicleAreaConfig{ 518 .areaId = HVAC_LEFT, 519 .minFloatValue = 16, 520 .maxFloatValue = 32, 521 }, 522 VehicleAreaConfig{ 523 .areaId = HVAC_RIGHT, 524 .minFloatValue = 16, 525 .maxFloatValue = 32, 526 }}}, 527 .initialAreaValues = {{HVAC_LEFT, {.floatValues = {16}}}, 528 {HVAC_RIGHT, {.floatValues = {20}}}}}, 529 530 {.config = 531 { 532 .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE), 533 .access = VehiclePropertyAccess::READ, 534 // TODO(bryaneyler): Support ON_CHANGE as well. 535 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 536 .minSampleRate = 1.0f, 537 .maxSampleRate = 2.0f, 538 }, 539 .initialValue = {.floatValues = {25.0f}}}, 540 541 {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS), 542 .access = VehiclePropertyAccess::READ_WRITE, 543 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 544 .configArray = {(int)VehicleUnit::FAHRENHEIT, (int)VehicleUnit::CELSIUS}, 545 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}}, 546 .initialValue = {.int32Values = {(int)VehicleUnit::FAHRENHEIT}}}, 547 548 {.config = 549 { 550 .prop = toInt(VehicleProperty::NIGHT_MODE), 551 .access = VehiclePropertyAccess::READ, 552 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 553 }, 554 .initialValue = {.int32Values = {0}}}, 555 556 {.config = 557 { 558 .prop = toInt(VehicleProperty::GEAR_SELECTION), 559 .access = VehiclePropertyAccess::READ, 560 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 561 }, 562 .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, 563 564 {.config = 565 { 566 .prop = toInt(VehicleProperty::IGNITION_STATE), 567 .access = VehiclePropertyAccess::READ, 568 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 569 }, 570 .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}}, 571 572 {.config = 573 { 574 .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), 575 .access = VehiclePropertyAccess::READ, 576 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 577 }, 578 .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}}, 579 580 {.config = 581 { 582 .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP), 583 .access = VehiclePropertyAccess::READ, 584 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 585 .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds 586 .maxSampleRate = 10, // 10 Hz, every 100 ms 587 }, 588 .initialValue = {.floatValues = {101.0f}}}, 589 590 { 591 .config = 592 { 593 .prop = kGenerateFakeDataControllingProperty, 594 .access = VehiclePropertyAccess::WRITE, 595 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 596 }, 597 }, 598 599 {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK), 600 .access = VehiclePropertyAccess::READ_WRITE, 601 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 602 .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, 603 VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, 604 VehicleAreaConfig{.areaId = DOOR_2_LEFT}, 605 VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, 606 .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, 607 {DOOR_1_RIGHT, {.int32Values = {1}}}, 608 {DOOR_2_LEFT, {.int32Values = {1}}}, 609 {DOOR_2_RIGHT, {.int32Values = {1}}}}}, 610 611 {.config = 612 { 613 .prop = toInt(VehicleProperty::DOOR_POS), 614 .access = VehiclePropertyAccess::READ_WRITE, 615 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 616 .areaConfigs = 617 {VehicleAreaConfig{.areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, 618 VehicleAreaConfig{.areaId = DOOR_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 1}, 619 VehicleAreaConfig{.areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, 620 VehicleAreaConfig{.areaId = DOOR_2_RIGHT, .minInt32Value = 0, .maxInt32Value = 1}, 621 VehicleAreaConfig{.areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}}, 622 .initialValue = {.int32Values = {0}}}, 623 624 {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK), 625 .access = VehiclePropertyAccess::READ_WRITE, 626 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 627 .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | 628 WINDOW_2_RIGHT}}}, 629 .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT, 630 {.int32Values = {0}}}}}, 631 632 {.config = 633 {.prop = toInt(VehicleProperty::WINDOW_POS), 634 .access = 635 VehiclePropertyAccess::READ_WRITE, 636 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 637 .areaConfigs = 638 {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, .minInt32Value = 0, .maxInt32Value = 10}, 639 VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 10}, 640 VehicleAreaConfig{.areaId = WINDOW_2_LEFT, .minInt32Value = 0, .maxInt32Value = 10}, 641 VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, .minInt32Value = 0, .maxInt32Value = 10}, 642 VehicleAreaConfig{ 643 .areaId = WINDOW_ROOF_TOP_1, .minInt32Value = -10, .maxInt32Value = 10}}}, 644 .initialValue = {.int32Values = {0}}}, 645 646 {.config = 647 { 648 .prop = WHEEL_TICK, 649 .access = VehiclePropertyAccess::READ, 650 .changeMode = VehiclePropertyChangeMode::CONTINUOUS, 651 .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000}, 652 .minSampleRate = 1.0f, 653 .maxSampleRate = 10.0f, 654 }, 655 .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}}, 656 657 {.config = {.prop = ABS_ACTIVE, 658 .access = VehiclePropertyAccess::READ, 659 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 660 .initialValue = {.int32Values = {0}}}, 661 662 {.config = {.prop = TRACTION_CONTROL_ACTIVE, 663 .access = VehiclePropertyAccess::READ, 664 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 665 .initialValue = {.int32Values = {0}}}, 666 667 {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), 668 .access = VehiclePropertyAccess::READ, 669 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 670 .configArray = {3}}, 671 .initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}}}, 672 673 {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), 674 .access = VehiclePropertyAccess::WRITE, 675 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 676 .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}}, 677 678 {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS), 679 .access = VehiclePropertyAccess::READ_WRITE, 680 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 681 .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}}, 682 .initialValue = {.int32Values = {100}}}, 683 684 { 685 .config = {.prop = OBD2_LIVE_FRAME, 686 .access = VehiclePropertyAccess::READ, 687 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 688 .configArray = {0, 0}}, 689 }, 690 691 { 692 .config = {.prop = OBD2_FREEZE_FRAME, 693 .access = VehiclePropertyAccess::READ, 694 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 695 .configArray = {0, 0}}, 696 }, 697 698 { 699 .config = {.prop = OBD2_FREEZE_FRAME_INFO, 700 .access = VehiclePropertyAccess::READ, 701 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 702 }, 703 704 { 705 .config = {.prop = OBD2_FREEZE_FRAME_CLEAR, 706 .access = VehiclePropertyAccess::WRITE, 707 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 708 .configArray = {1}}, 709 }, 710 711 {.config = 712 { 713 .prop = toInt(VehicleProperty::HEADLIGHTS_STATE), 714 .access = VehiclePropertyAccess::READ, 715 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 716 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 717 }, 718 .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, 719 720 {.config = 721 { 722 .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE), 723 .access = VehiclePropertyAccess::READ, 724 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 725 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 726 }, 727 .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, 728 729 {.config = 730 { 731 .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE), 732 .access = VehiclePropertyAccess::READ, 733 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 734 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 735 }, 736 .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, 737 738 {.config = 739 { 740 .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE), 741 .access = VehiclePropertyAccess::READ, 742 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 743 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 744 }, 745 .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, 746 747 {.config = 748 { 749 .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH), 750 .access = VehiclePropertyAccess::READ_WRITE, 751 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 752 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 753 }, 754 .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, 755 756 {.config = 757 { 758 .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH), 759 .access = VehiclePropertyAccess::READ_WRITE, 760 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 761 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 762 }, 763 .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, 764 765 {.config = 766 { 767 .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH), 768 .access = VehiclePropertyAccess::READ_WRITE, 769 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 770 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 771 }, 772 .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, 773 774 {.config = 775 { 776 .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH), 777 .access = VehiclePropertyAccess::READ_WRITE, 778 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 779 .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, 780 }, 781 .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, 782 783 {.config = {.prop = VEHICLE_MAP_SERVICE, 784 .access = VehiclePropertyAccess::READ_WRITE, 785 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}}, 786 787 // Example Vendor Extension properties for testing 788 {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY, 789 .access = VehiclePropertyAccess::READ_WRITE, 790 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 791 .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, 792 VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, 793 VehicleAreaConfig{.areaId = DOOR_2_LEFT}, 794 VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, 795 .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, 796 {DOOR_1_RIGHT, {.int32Values = {1}}}, 797 {DOOR_2_LEFT, {.int32Values = {0}}}, 798 {DOOR_2_RIGHT, {.int32Values = {0}}}}}, 799 800 {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY, 801 .access = VehiclePropertyAccess::READ_WRITE, 802 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 803 .areaConfigs = {VehicleAreaConfig{ 804 .areaId = HVAC_LEFT, .minFloatValue = -10, .maxFloatValue = 10}, 805 VehicleAreaConfig{.areaId = HVAC_RIGHT, 806 .minFloatValue = -10, 807 .maxFloatValue = 10}}}, 808 .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}}, {HVAC_RIGHT, {.floatValues = {2}}}}}, 809 810 {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY, 811 .access = VehiclePropertyAccess::READ_WRITE, 812 .changeMode = VehiclePropertyChangeMode::ON_CHANGE, 813 .areaConfigs = {VehicleAreaConfig{ 814 .areaId = (int)VehicleAreaWindow::FRONT_WINDSHIELD, 815 .minInt32Value = -100, 816 .maxInt32Value = 100}, 817 VehicleAreaConfig{.areaId = (int)VehicleAreaWindow::REAR_WINDSHIELD, 818 .minInt32Value = -100, 819 .maxInt32Value = 100}, 820 VehicleAreaConfig{.areaId = (int)VehicleAreaWindow::ROOF_TOP_1, 821 .minInt32Value = -100, 822 .maxInt32Value = 100}}}, 823 .initialAreaValues = {{(int)VehicleAreaWindow::FRONT_WINDSHIELD, {.int32Values = {1}}}, 824 {(int)VehicleAreaWindow::REAR_WINDSHIELD, {.int32Values = {0}}}, 825 {(int)VehicleAreaWindow::ROOF_TOP_1, {.int32Values = {-1}}}}}, 826 827 {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY, 828 .access = VehiclePropertyAccess::READ_WRITE, 829 .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, 830 .initialValue = {.stringValue = "Vendor String Property"}}, 831 }; 832 833 } // impl 834 835 } // namespace V2_0 836 } // namespace vehicle 837 } // namespace automotive 838 } // namespace hardware 839 } // namespace android 840 841 #endif // android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_ 842