• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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_aidl_impl_utils_common_include_PropertyUtils_H_
18 #define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_PropertyUtils_H_
19 
20 #include <VehicleHalTypes.h>
21 #include <VehicleUtils.h>
22 
23 namespace android {
24 namespace hardware {
25 namespace automotive {
26 namespace vehicle {
27 
28 namespace propertyutils_impl {
29 
30 // These names are not part of the API since we only expose ints.
31 using ::aidl::android::hardware::automotive::vehicle::EvStoppingMode;
32 using ::aidl::android::hardware::automotive::vehicle::PortLocationType;
33 using ::aidl::android::hardware::automotive::vehicle::VehicleArea;
34 using ::aidl::android::hardware::automotive::vehicle::VehicleAreaDoor;
35 using ::aidl::android::hardware::automotive::vehicle::VehicleAreaSeat;
36 using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWheel;
37 using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow;
38 using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection;
39 using ::aidl::android::hardware::automotive::vehicle::VehicleLightState;
40 using ::aidl::android::hardware::automotive::vehicle::VehicleLightSwitch;
41 using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
42 using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
43 using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
44 
45 }  // namespace propertyutils_impl
46 
47 // Some handy constants to avoid conversions from enum to int.
48 constexpr int ABS_ACTIVE = toInt(propertyutils_impl::VehicleProperty::ABS_ACTIVE);
49 constexpr int AP_POWER_STATE_REQ = toInt(propertyutils_impl::VehicleProperty::AP_POWER_STATE_REQ);
50 constexpr int AP_POWER_STATE_REPORT =
51         toInt(propertyutils_impl::VehicleProperty::AP_POWER_STATE_REPORT);
52 constexpr int DOOR_1_LEFT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_1_LEFT);
53 constexpr int DOOR_1_RIGHT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_1_RIGHT);
54 constexpr int DOOR_2_LEFT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_2_LEFT);
55 constexpr int DOOR_2_RIGHT = toInt(propertyutils_impl::VehicleAreaDoor::ROW_2_RIGHT);
56 constexpr int DOOR_REAR = toInt(propertyutils_impl::VehicleAreaDoor::REAR);
57 constexpr int WINDOW_1_LEFT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_1_LEFT);
58 constexpr int WINDOW_1_RIGHT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_1_RIGHT);
59 constexpr int WINDOW_2_LEFT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_2_LEFT);
60 constexpr int WINDOW_2_RIGHT = toInt(propertyutils_impl::VehicleAreaWindow::ROW_2_RIGHT);
61 constexpr int WINDOW_ROOF_TOP_1 = toInt(propertyutils_impl::VehicleAreaWindow::ROOF_TOP_1);
62 constexpr int FAN_DIRECTION_FACE = toInt(propertyutils_impl::VehicleHvacFanDirection::FACE);
63 constexpr int FAN_DIRECTION_FLOOR = toInt(propertyutils_impl::VehicleHvacFanDirection::FLOOR);
64 constexpr int FAN_DIRECTION_DEFROST = toInt(propertyutils_impl::VehicleHvacFanDirection::DEFROST);
65 constexpr int OBD2_LIVE_FRAME = toInt(propertyutils_impl::VehicleProperty::OBD2_LIVE_FRAME);
66 constexpr int OBD2_FREEZE_FRAME = toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME);
67 constexpr int OBD2_FREEZE_FRAME_INFO =
68         toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME_INFO);
69 constexpr int OBD2_FREEZE_FRAME_CLEAR =
70         toInt(propertyutils_impl::VehicleProperty::OBD2_FREEZE_FRAME_CLEAR);
71 constexpr int TRACTION_CONTROL_ACTIVE =
72         toInt(propertyutils_impl::VehicleProperty::TRACTION_CONTROL_ACTIVE);
73 constexpr int VEHICLE_MAP_SERVICE = toInt(propertyutils_impl::VehicleProperty::VEHICLE_MAP_SERVICE);
74 constexpr int WHEEL_TICK = toInt(propertyutils_impl::VehicleProperty::WHEEL_TICK);
75 constexpr int SEAT_1_LEFT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_1_LEFT);
76 constexpr int SEAT_1_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_1_RIGHT);
77 constexpr int SEAT_2_LEFT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_LEFT);
78 constexpr int SEAT_2_RIGHT = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_RIGHT);
79 constexpr int SEAT_2_CENTER = toInt(propertyutils_impl::VehicleAreaSeat::ROW_2_CENTER);
80 constexpr int FUEL_DOOR_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT);
81 constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT);
82 constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT);
83 constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON);
84 constexpr int LIGHT_STATE_OFF = toInt(propertyutils_impl::VehicleLightState::OFF);
85 constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF);
86 constexpr int LIGHT_SWITCH_ON = toInt(propertyutils_impl::VehicleLightSwitch::ON);
87 constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC);
88 constexpr int EV_STOPPING_MODE_CREEP = toInt(propertyutils_impl::EvStoppingMode::CREEP);
89 constexpr int EV_STOPPING_MODE_ROLL = toInt(propertyutils_impl::EvStoppingMode::ROLL);
90 constexpr int EV_STOPPING_MODE_HOLD = toInt(propertyutils_impl::EvStoppingMode::HOLD);
91 constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT);
92 constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT);
93 constexpr int WHEEL_REAR_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_REAR);
94 constexpr int WHEEL_REAR_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_REAR);
95 constexpr int ALL_WHEELS =
96         WHEEL_FRONT_LEFT | WHEEL_FRONT_RIGHT | WHEEL_REAR_LEFT | WHEEL_REAR_RIGHT;
97 constexpr int HVAC_LEFT = SEAT_1_LEFT | SEAT_2_LEFT | SEAT_2_CENTER;
98 constexpr int HVAC_RIGHT = SEAT_1_RIGHT | SEAT_2_RIGHT;
99 constexpr int HVAC_ALL = HVAC_LEFT | HVAC_RIGHT;
100 constexpr int HVAC_FRONT_ROW = SEAT_1_LEFT | SEAT_1_RIGHT;
101 constexpr int HVAC_REAR_ROW = SEAT_2_LEFT | SEAT_2_CENTER | SEAT_2_RIGHT;
102 
103 }  // namespace vehicle
104 }  // namespace automotive
105 }  // namespace hardware
106 }  // namespace android
107 
108 #endif  // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_PropertyUtils_H_
109