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::CONTINUOUS,
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                  {
351                          .prop = toInt(VehicleProperty::TIRE_PRESSURE),
352                          .access = VehiclePropertyAccess::READ,
353                          .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
354                          .areaConfigs = {VehicleAreaConfig{
355                                                  .areaId = WHEEL_FRONT_LEFT,
356                                                  .minFloatValue = 100.0f,
357                                                  .maxFloatValue = 300.0f,
358                                          },
359                                          VehicleAreaConfig{
360                                                  .areaId = WHEEL_FRONT_RIGHT,
361                                                  .minFloatValue = 100.0f,
362                                                  .maxFloatValue = 300.0f,
363                                          },
364                                          VehicleAreaConfig{
365                                                  .areaId = WHEEL_REAR_LEFT,
366                                                  .minFloatValue = 100.0f,
367                                                  .maxFloatValue = 300.0f,
368                                          },
369                                          VehicleAreaConfig{
370                                                  .areaId = WHEEL_REAR_RIGHT,
371                                                  .minFloatValue = 100.0f,
372                                                  .maxFloatValue = 300.0f,
373                                          }},
374                          .minSampleRate = 1.0f,
375                          .maxSampleRate = 2.0f,
376                  },
377          .initialValue = {.floatValues = {200}}},  // units in kPa
378 
379         {.config =
380                  {
381                          .prop = toInt(VehicleProperty::CURRENT_GEAR),
382                          .access = VehiclePropertyAccess::READ,
383                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
384                  },
385          .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
386 
387         {.config =
388                  {
389                          .prop = toInt(VehicleProperty::PARKING_BRAKE_ON),
390                          .access = VehiclePropertyAccess::READ,
391                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
392                  },
393          .initialValue = {.int32Values = {1}}},
394 
395         {.config =
396                  {
397                          .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW),
398                          .access = VehiclePropertyAccess::READ,
399                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
400                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
401                  },
402          .initialValue = {.int32Values = {0}}},
403 
404         {.config =
405                  {
406                          .prop = toInt(VehicleProperty::HW_KEY_INPUT),
407                          .access = VehiclePropertyAccess::READ,
408                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
409                  },
410          .initialValue = {.int32Values = {0, 0, 0}}},
411 
412         {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON),
413                     .access = VehiclePropertyAccess::READ_WRITE,
414                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
415                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}},
416                     // TODO(bryaneyler): Ideally, this is generated dynamically from
417                     // kHvacPowerProperties.
418                     .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED),
419                                     toInt(VehicleProperty::HVAC_FAN_DIRECTION)}},
420          .initialValue = {.int32Values = {1}}},
421 
422         {
423                 .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER),
424                            .access = VehiclePropertyAccess::READ_WRITE,
425                            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
426                            .areaConfigs =
427                                    {VehicleAreaConfig{
428                                             .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)},
429                                     VehicleAreaConfig{
430                                             .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}},
431                 .initialValue = {.int32Values = {0}}  // Will be used for all areas.
432         },
433 
434         {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON),
435                     .access = VehiclePropertyAccess::READ_WRITE,
436                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
437                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
438          .initialValue = {.int32Values = {0}}},
439 
440         {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
441                     .access = VehiclePropertyAccess::READ_WRITE,
442                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
443                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
444          .initialValue = {.int32Values = {1}}},
445 
446         {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON),
447                     .access = VehiclePropertyAccess::READ_WRITE,
448                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
449                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
450          .initialValue = {.int32Values = {0}}},
451 
452         {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON),
453                     .access = VehiclePropertyAccess::READ_WRITE,
454                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
455                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
456          .initialValue = {.int32Values = {1}}},
457 
458         {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON),
459                     .access = VehiclePropertyAccess::READ_WRITE,
460                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
461                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
462          .initialValue = {.int32Values = {0}}},
463 
464         {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON),
465                     .access = VehiclePropertyAccess::READ_WRITE,
466                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
467                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
468          .initialValue = {.int32Values = {1}}},
469 
470         {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON),
471                     .access = VehiclePropertyAccess::READ_WRITE,
472                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
473                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
474          .initialValue = {.int32Values = {0}}},
475 
476         {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
477                     .access = VehiclePropertyAccess::READ_WRITE,
478                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
479                     .areaConfigs = {VehicleAreaConfig{
480                             .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}},
481          .initialValue = {.int32Values = {3}}},
482 
483         {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
484                     .access = VehiclePropertyAccess::READ_WRITE,
485                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
486                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
487          .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}},
488 
489         {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE),
490                     .access = VehiclePropertyAccess::READ,
491                     .changeMode = VehiclePropertyChangeMode::STATIC,
492                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
493          .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR,
494                                           FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR}}},
495 
496         {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION),
497                     .access = VehiclePropertyAccess::READ_WRITE,
498                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
499                     .areaConfigs = {VehicleAreaConfig{
500                                             .areaId = SEAT_1_LEFT,
501                                             .minInt32Value = 0,
502                                             .maxInt32Value = 3,
503                                     },
504                                     VehicleAreaConfig{
505                                             .areaId = SEAT_1_RIGHT,
506                                             .minInt32Value = 0,
507                                             .maxInt32Value = 3,
508                                     }}},
509          .initialValue =
510                  {.int32Values = {0}}},  // 0 is off and +ve values indicate ventilation level.
511 
512         {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT),
513                     .access = VehiclePropertyAccess::READ_WRITE,
514                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
515                     .areaConfigs = {VehicleAreaConfig{
516                             .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}},
517          .initialValue = {.int32Values = {0}}},  // +ve values for heating and -ve for cooling
518 
519         {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE),
520                     .access = VehiclePropertyAccess::READ_WRITE,
521                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
522                     .areaConfigs = {VehicleAreaConfig{
523                                             .areaId = SEAT_1_LEFT,
524                                             .minInt32Value = -2,
525                                             .maxInt32Value = 2,
526                                     },
527                                     VehicleAreaConfig{
528                                             .areaId = SEAT_1_RIGHT,
529                                             .minInt32Value = -2,
530                                             .maxInt32Value = 2,
531                                     }}},
532          .initialValue = {.int32Values = {0}}},  // +ve values for heating and -ve for cooling
533 
534         {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
535                     .access = VehiclePropertyAccess::READ_WRITE,
536                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
537                     .areaConfigs = {VehicleAreaConfig{
538                                             .areaId = HVAC_LEFT,
539                                             .minFloatValue = 16,
540                                             .maxFloatValue = 32,
541                                     },
542                                     VehicleAreaConfig{
543                                             .areaId = HVAC_RIGHT,
544                                             .minFloatValue = 16,
545                                             .maxFloatValue = 32,
546                                     }}},
547          .initialAreaValues = {{HVAC_LEFT, {.floatValues = {16}}},
548                                {HVAC_RIGHT, {.floatValues = {20}}}}},
549 
550         {.config =
551                  {
552                          .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
553                          .access = VehiclePropertyAccess::READ,
554                          // TODO(bryaneyler): Support ON_CHANGE as well.
555                          .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
556                          .minSampleRate = 1.0f,
557                          .maxSampleRate = 2.0f,
558                  },
559          .initialValue = {.floatValues = {25.0f}}},
560 
561         {.config =
562                  {
563                          .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS),
564                          .access = VehiclePropertyAccess::READ_WRITE,
565                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
566                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
567                          .configArray = {(int)VehicleUnit::FAHRENHEIT, (int)VehicleUnit::CELSIUS},
568                  },
569          .initialValue = {.int32Values = {(int)VehicleUnit::FAHRENHEIT}}},
570 
571         {.config =
572                  {
573                          .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS),
574                          .access = VehiclePropertyAccess::READ_WRITE,
575                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
576                          .configArray = {(int)VehicleUnit::KILOMETER, (int)VehicleUnit::MILE},
577                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}
578                  },
579          .initialValue = {.int32Values = {(int)VehicleUnit::MILE}}},
580 
581         {.config =
582                  {
583                          .prop = toInt(VehicleProperty::NIGHT_MODE),
584                          .access = VehiclePropertyAccess::READ,
585                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
586                  },
587          .initialValue = {.int32Values = {0}}},
588 
589         {.config =
590                  {
591                          .prop = toInt(VehicleProperty::GEAR_SELECTION),
592                          .access = VehiclePropertyAccess::READ,
593                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
594                  },
595          .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
596 
597         {.config =
598                  {
599                          .prop = toInt(VehicleProperty::IGNITION_STATE),
600                          .access = VehiclePropertyAccess::READ,
601                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
602                  },
603          .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}},
604 
605         {.config =
606                  {
607                          .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL),
608                          .access = VehiclePropertyAccess::READ,
609                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
610                  },
611          .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}},
612 
613         {.config =
614                  {
615                          .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP),
616                          .access = VehiclePropertyAccess::READ,
617                          .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
618                          .minSampleRate = 0.1,  // 0.1 Hz, every 10 seconds
619                          .maxSampleRate = 10,   // 10 Hz, every 100 ms
620                  },
621          .initialValue = {.floatValues = {101.0f}}},
622 
623         {
624                 .config =
625                         {
626                                 .prop = kGenerateFakeDataControllingProperty,
627                                 .access = VehiclePropertyAccess::WRITE,
628                                 .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
629                         },
630         },
631 
632         {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK),
633                     .access = VehiclePropertyAccess::READ_WRITE,
634                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
635                     .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
636                                     VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
637                                     VehicleAreaConfig{.areaId = DOOR_2_LEFT},
638                                     VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
639          .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
640                                {DOOR_1_RIGHT, {.int32Values = {1}}},
641                                {DOOR_2_LEFT, {.int32Values = {1}}},
642                                {DOOR_2_RIGHT, {.int32Values = {1}}}}},
643 
644         {.config = {.prop = toInt(VehicleProperty::DOOR_POS),
645                     .access = VehiclePropertyAccess::READ_WRITE,
646                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
647                     .areaConfigs =
648                             {VehicleAreaConfig{
649                                      .areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
650                              VehicleAreaConfig{.areaId = DOOR_1_RIGHT,
651                                                .minInt32Value = 0,
652                                                .maxInt32Value = 1},
653                              VehicleAreaConfig{
654                                      .areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
655                              VehicleAreaConfig{.areaId = DOOR_2_RIGHT,
656                                                .minInt32Value = 0,
657                                                .maxInt32Value = 1},
658                              VehicleAreaConfig{
659                                      .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}},
660          .initialValue = {.int32Values = {0}}},
661 
662         {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK),
663                     .access = VehiclePropertyAccess::READ_WRITE,
664                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
665                     .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT |
666                                                                 WINDOW_2_RIGHT}}},
667          .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT,
668                                 {.int32Values = {0}}}}},
669 
670         {.config = {.prop = toInt(VehicleProperty::WINDOW_POS),
671                     .access = VehiclePropertyAccess::READ_WRITE,
672                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
673                     .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT,
674                                                       .minInt32Value = 0,
675                                                       .maxInt32Value = 10},
676                                     VehicleAreaConfig{.areaId = WINDOW_1_RIGHT,
677                                                       .minInt32Value = 0,
678                                                       .maxInt32Value = 10},
679                                     VehicleAreaConfig{.areaId = WINDOW_2_LEFT,
680                                                       .minInt32Value = 0,
681                                                       .maxInt32Value = 10},
682                                     VehicleAreaConfig{.areaId = WINDOW_2_RIGHT,
683                                                       .minInt32Value = 0,
684                                                       .maxInt32Value = 10},
685                                     VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1,
686                                                       .minInt32Value = -10,
687                                                       .maxInt32Value = 10}}},
688          .initialValue = {.int32Values = {0}}},
689 
690         {.config =
691                  {
692                          .prop = WHEEL_TICK,
693                          .access = VehiclePropertyAccess::READ,
694                          .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
695                          .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
696                          .minSampleRate = 1.0f,
697                          .maxSampleRate = 10.0f,
698                  },
699          .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}},
700 
701         {.config = {.prop = ABS_ACTIVE,
702                     .access = VehiclePropertyAccess::READ,
703                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
704          .initialValue = {.int32Values = {0}}},
705 
706         {.config = {.prop = TRACTION_CONTROL_ACTIVE,
707                     .access = VehiclePropertyAccess::READ,
708                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
709          .initialValue = {.int32Values = {0}}},
710 
711         {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
712                     .access = VehiclePropertyAccess::READ,
713                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
714                     .configArray = {3}},
715          .initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}}},
716 
717         {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
718                     .access = VehiclePropertyAccess::READ_WRITE,
719                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
720          .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}},
721 
722         {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
723                     .access = VehiclePropertyAccess::READ_WRITE,
724                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
725                     .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}},
726          .initialValue = {.int32Values = {100}}},
727 
728         {
729                 .config = {.prop = OBD2_LIVE_FRAME,
730                            .access = VehiclePropertyAccess::READ,
731                            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
732                            .configArray = {0, 0}},
733         },
734 
735         {
736                 .config = {.prop = OBD2_FREEZE_FRAME,
737                            .access = VehiclePropertyAccess::READ,
738                            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
739                            .configArray = {0, 0}},
740         },
741 
742         {
743                 .config = {.prop = OBD2_FREEZE_FRAME_INFO,
744                            .access = VehiclePropertyAccess::READ,
745                            .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
746         },
747 
748         {
749                 .config = {.prop = OBD2_FREEZE_FRAME_CLEAR,
750                            .access = VehiclePropertyAccess::WRITE,
751                            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
752                            .configArray = {1}},
753         },
754 
755         {.config =
756                  {
757                          .prop = toInt(VehicleProperty::HEADLIGHTS_STATE),
758                          .access = VehiclePropertyAccess::READ,
759                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
760                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
761                  },
762          .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
763 
764         {.config =
765                  {
766                          .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE),
767                          .access = VehiclePropertyAccess::READ,
768                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
769                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
770                  },
771          .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
772 
773         {.config =
774                  {
775                          .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE),
776                          .access = VehiclePropertyAccess::READ,
777                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
778                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
779                  },
780          .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
781 
782         {.config =
783                  {
784                          .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE),
785                          .access = VehiclePropertyAccess::READ,
786                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
787                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
788                  },
789          .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
790 
791         {.config =
792                  {
793                          .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH),
794                          .access = VehiclePropertyAccess::READ_WRITE,
795                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
796                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
797                  },
798          .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
799 
800         {.config =
801                  {
802                          .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH),
803                          .access = VehiclePropertyAccess::READ_WRITE,
804                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
805                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
806                  },
807          .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
808 
809         {.config =
810                  {
811                          .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH),
812                          .access = VehiclePropertyAccess::READ_WRITE,
813                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
814                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
815                  },
816          .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
817 
818         {.config =
819                  {
820                          .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH),
821                          .access = VehiclePropertyAccess::READ_WRITE,
822                          .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
823                          .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
824                  },
825          .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
826 
827         {.config = {.prop = VEHICLE_MAP_SERVICE,
828                     .access = VehiclePropertyAccess::READ_WRITE,
829                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE}},
830 
831         // Example Vendor Extension properties for testing
832         {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY,
833                     .access = VehiclePropertyAccess::READ_WRITE,
834                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
835                     .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
836                                     VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
837                                     VehicleAreaConfig{.areaId = DOOR_2_LEFT},
838                                     VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
839          .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
840                                {DOOR_1_RIGHT, {.int32Values = {1}}},
841                                {DOOR_2_LEFT, {.int32Values = {0}}},
842                                {DOOR_2_RIGHT, {.int32Values = {0}}}}},
843 
844         {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY,
845                     .access = VehiclePropertyAccess::READ_WRITE,
846                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
847                     .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT,
848                                                       .minFloatValue = -10,
849                                                       .maxFloatValue = 10},
850                                     VehicleAreaConfig{.areaId = HVAC_RIGHT,
851                                                       .minFloatValue = -10,
852                                                       .maxFloatValue = 10}}},
853          .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}},
854                                {HVAC_RIGHT, {.floatValues = {2}}}}},
855 
856         {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY,
857                     .access = VehiclePropertyAccess::READ_WRITE,
858                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
859                     .areaConfigs =
860                             {VehicleAreaConfig{.areaId = (int)VehicleAreaWindow::FRONT_WINDSHIELD,
861                                                .minInt32Value = -100,
862                                                .maxInt32Value = 100},
863                              VehicleAreaConfig{.areaId = (int)VehicleAreaWindow::REAR_WINDSHIELD,
864                                                .minInt32Value = -100,
865                                                .maxInt32Value = 100},
866                              VehicleAreaConfig{.areaId = (int)VehicleAreaWindow::ROOF_TOP_1,
867                                                .minInt32Value = -100,
868                                                .maxInt32Value = 100}}},
869          .initialAreaValues = {{(int)VehicleAreaWindow::FRONT_WINDSHIELD, {.int32Values = {1}}},
870                                {(int)VehicleAreaWindow::REAR_WINDSHIELD, {.int32Values = {0}}},
871                                {(int)VehicleAreaWindow::ROOF_TOP_1, {.int32Values = {-1}}}}},
872 
873         {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY,
874                     .access = VehiclePropertyAccess::READ_WRITE,
875                     .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
876          .initialValue = {.stringValue = "Vendor String Property"}},
877 };
878 
879 }  // impl
880 
881 }  // namespace V2_0
882 }  // namespace vehicle
883 }  // namespace automotive
884 }  // namespace hardware
885 }  // namespace android
886 
887 #endif // android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_
888