Loading automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +1 −1 Original line number Diff line number Diff line Loading @@ -1089,7 +1089,7 @@ "data_enum": "TrailerState" }, { "name": "Vehicle’s curb weight", "name": "VEHICLE_CURB_WEIGHT", "value": 289410886 }, { Loading automotive/vehicle/aidl/generated_lib/java/UnitsForVehicleProperty.java 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * DO NOT EDIT MANUALLY!!! * * Generated by tools/generate_annotation_enums.py. */ // clang-format off package android.hardware.automotive.vehicle; import java.util.Map; public final class UnitsForVehicleProperty { public static final Map<Integer, Integer> values = Map.ofEntries( Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehicleUnit.YEAR), Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehicleUnit.MILLILITER), Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehicleUnit.MILLIMETER), Map.entry(VehicleProperty.PERF_ODOMETER, VehicleUnit.KILOMETER), Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehicleUnit.DEGREES), Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehicleUnit.DEGREES), Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.ENGINE_RPM, VehicleUnit.RPM), Map.entry(VehicleProperty.FUEL_LEVEL, VehicleUnit.MILLILITER), Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehicleUnit.MILLIWATTS), Map.entry(VehicleProperty.RANGE_REMAINING, VehicleUnit.METER), Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.TIRE_PRESSURE, VehicleUnit.KILOPASCAL), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehicleUnit.KILOPASCAL), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehicleUnit.AMPERE), Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehicleUnit.SECS), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehicleUnit.MILLIMETER) ); } automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +38 −40 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:YEAR * @unit VehicleUnit.YEAR * @version 2 */ INFO_MODEL_YEAR = 0x0103 + 0x10000000 + 0x01000000 Loading @@ -89,7 +89,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER * @unit VehicleUnit.MILLILITER * @version 2 */ INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000 Loading Loading @@ -124,7 +124,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ INFO_EV_BATTERY_CAPACITY = 0x0106 + 0x10000000 + 0x01000000 Loading Loading @@ -184,7 +184,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER * @unit VehicleUnit.MILLIMETER * @version 2 */ INFO_EXTERIOR_DIMENSIONS = 0x010B + 0x10000000 + 0x01000000 Loading @@ -210,7 +210,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOMETER * @unit VehicleUnit.KILOMETER * @version 2 */ PERF_ODOMETER = 0x0204 + 0x10000000 + 0x01000000 Loading @@ -226,7 +226,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ PERF_VEHICLE_SPEED = 0x0207 + 0x10000000 + 0x01000000 Loading @@ -239,7 +239,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ PERF_VEHICLE_SPEED_DISPLAY = 0x0208 + 0x10000000 + 0x01000000 Loading @@ -251,7 +251,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES * @unit VehicleUnit.DEGREES * @version 2 */ PERF_STEERING_ANGLE = 0x0209 + 0x10000000 + 0x01000000 Loading @@ -263,7 +263,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES * @unit VehicleUnit.DEGREES * @version 2 */ PERF_REAR_STEERING_ANGLE = 0x0210 + 0x10000000 + 0x01000000 Loading @@ -273,7 +273,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENGINE_COOLANT_TEMP = 0x0301 + 0x10000000 + 0x01000000 Loading @@ -293,7 +293,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENGINE_OIL_TEMP = 0x0304 + 0x10000000 + 0x01000000 Loading @@ -303,7 +303,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:RPM * @unit VehicleUnit.RPM * @version 2 */ ENGINE_RPM = 0x0305 + 0x10000000 + 0x01000000 Loading Loading @@ -356,7 +356,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER * @unit VehicleUnit.MILLILITER * @version 2 */ FUEL_LEVEL = 0x0307 + 0x10000000 + 0x01000000 Loading @@ -383,7 +383,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 Loading @@ -398,7 +398,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ EV_CURRENT_BATTERY_CAPACITY = Loading Loading @@ -433,7 +433,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MW * @unit VehicleUnit.MILLIWATTS * @version 2 */ EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 0x030C + 0x10000000 + 0x01000000 Loading @@ -452,7 +452,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER * @unit VehicleUnit.METER * @version 2 */ RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000 Loading @@ -466,7 +466,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 3 */ EV_BATTERY_AVERAGE_TEMPERATURE = Loading Loading @@ -494,7 +494,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL * @unit VehicleUnit.KILOPASCAL * @version 2 */ TIRE_PRESSURE = 0x0309 + 0x10000000 + 0x07000000 Loading @@ -510,7 +510,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL * @unit VehicleUnit.KILOPASCAL * @version 2 */ CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000 Loading Loading @@ -862,7 +862,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000 Loading Loading @@ -894,7 +894,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000 Loading Loading @@ -1130,7 +1130,7 @@ enum VehicleProperty { * configArray[1] = FAHRENHEIT * * This parameter MAY be used for displaying any HVAC temperature in the system. * Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT * Values must be one of VehicleUnit.CELSIUS or VehicleUnit.FAHRENHEIT * Note that internally, all temperatures are represented in floating point Celsius. * * If updating HVAC_TEMPERATURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS Loading Loading @@ -1287,7 +1287,7 @@ enum VehicleProperty { * * floatValues[0] = the requested value that an application wants to set a temperature to. * floatValues[1] = the unit for floatValues[0]. It should be one of * {VehicleUnit:CELSIUS, VehicleUnit:FAHRENHEIT}. * {VehicleUnit.CELSIUS, VehicleUnit.FAHRENHEIT}. * floatValues[2] = the value OEMs suggested in CELSIUS. This value is not included * in the request. * floatValues[3] = the value OEMs suggested in FAHRENHEIT. This value is not included Loading @@ -1300,18 +1300,18 @@ enum VehicleProperty { * For example, when a user uses the voice assistant to set HVAC temperature to 66.2 in * Fahrenheit. * First, an application will set this property with the value * [66.2, (float)VehicleUnit:FAHRENHEIT,0,0]. * [66.2, (float)VehicleUnit.FAHRENHEIT,0,0]. * If OEMs suggest to set 19.0 in Celsius or 66.5 in Fahrenheit for user's request, then VHAL * must generate a callback with property value * [66.2, (float)VehicleUnit:FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the * [66.2, (float)VehicleUnit.FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the * callback, it will inform the user and set HVAC temperature to the suggested value. * * Another example, an application receives 21 Celsius as the current temperature value by * querying HVC_TEMPERATURE_SET. But the application wants to know what value is displayed on * the car's UI in Fahrenheit. * For this, the application sets the property to [21, (float)VehicleUnit:CELSIUS, 0, 0]. If * For this, the application sets the property to [21, (float)VehicleUnit.CELSIUS, 0, 0]. If * the suggested value by the OEM for 21 Celsius is 70 Fahrenheit, then VHAL must generate a * callback with property value [21, (float)VehicleUnit:CELSIUS, 21.0, 70.0]. * callback with property value [21, (float)VehicleUnit.CELSIUS, 21.0, 70.0]. * In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE Loading Loading @@ -1504,7 +1504,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ EXTERNAL_CAR_TIME = 0x0608 + 0x10000000 // VehiclePropertyGroup:SYSTEM Loading Loading @@ -1534,7 +1534,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ ANDROID_EPOCH_TIME = 0x0606 + 0x10000000 + 0x01000000 Loading @@ -1559,7 +1559,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENV_OUTSIDE_TEMPERATURE = 0x0703 + 0x10000000 + 0x01000000 Loading Loading @@ -3212,7 +3212,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ WINDSHIELD_WIPERS_PERIOD = Loading Loading @@ -4789,7 +4789,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:AMPERE * @unit VehicleUnit.AMPERE * @version 2 */ EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000 Loading Loading @@ -4854,7 +4854,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:SECS * @unit VehicleUnit.SECS * @version 2 */ EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000 Loading Loading @@ -4888,7 +4888,7 @@ enum VehicleProperty { + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** * Vehicle’s curb weight * Vehicle’s curb weight in kilograms. * * Returns the vehicle's curb weight in kilograms. Curb weight is * the total weight of the vehicle with standard equipment and all Loading @@ -4905,10 +4905,8 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOGRAM * @version 2 */ VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 Loading Loading @@ -5567,7 +5565,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ CRUISE_CONTROL_TARGET_SPEED = Loading Loading @@ -5599,7 +5597,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = Loading Loading @@ -5630,7 +5628,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER * @unit VehicleUnit.MILLIMETER * @version 2 */ ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = Loading automotive/vehicle/tools/generate_annotation_enums.py +25 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ Need ANDROID_BUILD_TOP environmental variable to be set. This script will update ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java under generated_lib/java. ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java UnitsForVehicleProperty.java under generated_lib/java. Usage: $ python generate_annotation_enums.py Loading @@ -42,6 +43,8 @@ ACCESS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_ 'AccessForVehicleProperty.java') ENUM_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + 'EnumForVehicleProperty.java') UNITS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + 'UnitsForVehicleProperty.java') VERSION_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + 'VersionForVehicleProperty.h') SCRIPT_PATH = 'hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py' Loading Loading @@ -175,6 +178,15 @@ public final class EnumForVehicleProperty { public static final Map<Integer, List<Class<?>>> values = Map.ofEntries( """ UNITS_JAVA_HEADER = """package android.hardware.automotive.vehicle; import java.util.Map; public final class UnitsForVehicleProperty { public static final Map<Integer, Integer> values = Map.ofEntries( """ class PropertyConfig: """Represents one VHAL property definition in VehicleProperty.aidl.""" Loading Loading @@ -316,6 +328,12 @@ class FileParser: continue; if not cpp: annotation = "List.of(" + ', '.join([class_name + ".class" for class_name in config.enum_types]) + ")" elif field == 'unit_type': if not config.unit_type: continue if not cpp: annotation = config.unit_type elif field == 'version': if cpp: annotation = config.version Loading Loading @@ -499,6 +517,12 @@ def main(): enum_types.setJavaFooter(JAVA_FOOTER) generated_files.append(enum_types) unit_type = GeneratedFile('unit_type') unit_type.setJavaFilePath(os.path.join(android_top, UNITS_JAVA_FILE_PATH)) unit_type.setJavaHeader(UNITS_JAVA_HEADER) unit_type.setJavaFooter(JAVA_FOOTER) generated_files.append(unit_type) version = GeneratedFile('version') version.setCppFilePath(os.path.join(android_top, VERSION_CPP_FILE_PATH)) version.setCppHeader(VERSION_CPP_HEADER) Loading Loading
automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json +1 −1 Original line number Diff line number Diff line Loading @@ -1089,7 +1089,7 @@ "data_enum": "TrailerState" }, { "name": "Vehicle’s curb weight", "name": "VEHICLE_CURB_WEIGHT", "value": 289410886 }, { Loading
automotive/vehicle/aidl/generated_lib/java/UnitsForVehicleProperty.java 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * DO NOT EDIT MANUALLY!!! * * Generated by tools/generate_annotation_enums.py. */ // clang-format off package android.hardware.automotive.vehicle; import java.util.Map; public final class UnitsForVehicleProperty { public static final Map<Integer, Integer> values = Map.ofEntries( Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehicleUnit.YEAR), Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehicleUnit.MILLILITER), Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehicleUnit.MILLIMETER), Map.entry(VehicleProperty.PERF_ODOMETER, VehicleUnit.KILOMETER), Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehicleUnit.DEGREES), Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehicleUnit.DEGREES), Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.ENGINE_RPM, VehicleUnit.RPM), Map.entry(VehicleProperty.FUEL_LEVEL, VehicleUnit.MILLILITER), Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehicleUnit.WATT_HOUR), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehicleUnit.MILLIWATTS), Map.entry(VehicleProperty.RANGE_REMAINING, VehicleUnit.METER), Map.entry(VehicleProperty.EV_BATTERY_AVERAGE_TEMPERATURE, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.TIRE_PRESSURE, VehicleUnit.KILOPASCAL), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehicleUnit.KILOPASCAL), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehicleUnit.CELSIUS), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehicleUnit.AMPERE), Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehicleUnit.SECS), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehicleUnit.METER_PER_SEC), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehicleUnit.MILLI_SECS), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehicleUnit.MILLIMETER) ); }
automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +38 −40 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:YEAR * @unit VehicleUnit.YEAR * @version 2 */ INFO_MODEL_YEAR = 0x0103 + 0x10000000 + 0x01000000 Loading @@ -89,7 +89,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER * @unit VehicleUnit.MILLILITER * @version 2 */ INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000 Loading Loading @@ -124,7 +124,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ INFO_EV_BATTERY_CAPACITY = 0x0106 + 0x10000000 + 0x01000000 Loading Loading @@ -184,7 +184,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER * @unit VehicleUnit.MILLIMETER * @version 2 */ INFO_EXTERIOR_DIMENSIONS = 0x010B + 0x10000000 + 0x01000000 Loading @@ -210,7 +210,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOMETER * @unit VehicleUnit.KILOMETER * @version 2 */ PERF_ODOMETER = 0x0204 + 0x10000000 + 0x01000000 Loading @@ -226,7 +226,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ PERF_VEHICLE_SPEED = 0x0207 + 0x10000000 + 0x01000000 Loading @@ -239,7 +239,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ PERF_VEHICLE_SPEED_DISPLAY = 0x0208 + 0x10000000 + 0x01000000 Loading @@ -251,7 +251,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES * @unit VehicleUnit.DEGREES * @version 2 */ PERF_STEERING_ANGLE = 0x0209 + 0x10000000 + 0x01000000 Loading @@ -263,7 +263,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES * @unit VehicleUnit.DEGREES * @version 2 */ PERF_REAR_STEERING_ANGLE = 0x0210 + 0x10000000 + 0x01000000 Loading @@ -273,7 +273,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENGINE_COOLANT_TEMP = 0x0301 + 0x10000000 + 0x01000000 Loading @@ -293,7 +293,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENGINE_OIL_TEMP = 0x0304 + 0x10000000 + 0x01000000 Loading @@ -303,7 +303,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:RPM * @unit VehicleUnit.RPM * @version 2 */ ENGINE_RPM = 0x0305 + 0x10000000 + 0x01000000 Loading Loading @@ -356,7 +356,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER * @unit VehicleUnit.MILLILITER * @version 2 */ FUEL_LEVEL = 0x0307 + 0x10000000 + 0x01000000 Loading @@ -383,7 +383,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 Loading @@ -398,7 +398,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH * @unit VehicleUnit.WATT_HOUR * @version 2 */ EV_CURRENT_BATTERY_CAPACITY = Loading Loading @@ -433,7 +433,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MW * @unit VehicleUnit.MILLIWATTS * @version 2 */ EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 0x030C + 0x10000000 + 0x01000000 Loading @@ -452,7 +452,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER * @unit VehicleUnit.METER * @version 2 */ RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000 Loading @@ -466,7 +466,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 3 */ EV_BATTERY_AVERAGE_TEMPERATURE = Loading Loading @@ -494,7 +494,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL * @unit VehicleUnit.KILOPASCAL * @version 2 */ TIRE_PRESSURE = 0x0309 + 0x10000000 + 0x07000000 Loading @@ -510,7 +510,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL * @unit VehicleUnit.KILOPASCAL * @version 2 */ CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000 Loading Loading @@ -862,7 +862,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000 Loading Loading @@ -894,7 +894,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000 Loading Loading @@ -1130,7 +1130,7 @@ enum VehicleProperty { * configArray[1] = FAHRENHEIT * * This parameter MAY be used for displaying any HVAC temperature in the system. * Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT * Values must be one of VehicleUnit.CELSIUS or VehicleUnit.FAHRENHEIT * Note that internally, all temperatures are represented in floating point Celsius. * * If updating HVAC_TEMPERATURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS Loading Loading @@ -1287,7 +1287,7 @@ enum VehicleProperty { * * floatValues[0] = the requested value that an application wants to set a temperature to. * floatValues[1] = the unit for floatValues[0]. It should be one of * {VehicleUnit:CELSIUS, VehicleUnit:FAHRENHEIT}. * {VehicleUnit.CELSIUS, VehicleUnit.FAHRENHEIT}. * floatValues[2] = the value OEMs suggested in CELSIUS. This value is not included * in the request. * floatValues[3] = the value OEMs suggested in FAHRENHEIT. This value is not included Loading @@ -1300,18 +1300,18 @@ enum VehicleProperty { * For example, when a user uses the voice assistant to set HVAC temperature to 66.2 in * Fahrenheit. * First, an application will set this property with the value * [66.2, (float)VehicleUnit:FAHRENHEIT,0,0]. * [66.2, (float)VehicleUnit.FAHRENHEIT,0,0]. * If OEMs suggest to set 19.0 in Celsius or 66.5 in Fahrenheit for user's request, then VHAL * must generate a callback with property value * [66.2, (float)VehicleUnit:FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the * [66.2, (float)VehicleUnit.FAHRENHEIT, 19.0, 66.5]. After the voice assistant gets the * callback, it will inform the user and set HVAC temperature to the suggested value. * * Another example, an application receives 21 Celsius as the current temperature value by * querying HVC_TEMPERATURE_SET. But the application wants to know what value is displayed on * the car's UI in Fahrenheit. * For this, the application sets the property to [21, (float)VehicleUnit:CELSIUS, 0, 0]. If * For this, the application sets the property to [21, (float)VehicleUnit.CELSIUS, 0, 0]. If * the suggested value by the OEM for 21 Celsius is 70 Fahrenheit, then VHAL must generate a * callback with property value [21, (float)VehicleUnit:CELSIUS, 21.0, 70.0]. * callback with property value [21, (float)VehicleUnit.CELSIUS, 21.0, 70.0]. * In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE Loading Loading @@ -1504,7 +1504,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ EXTERNAL_CAR_TIME = 0x0608 + 0x10000000 // VehiclePropertyGroup:SYSTEM Loading Loading @@ -1534,7 +1534,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ ANDROID_EPOCH_TIME = 0x0606 + 0x10000000 + 0x01000000 Loading @@ -1559,7 +1559,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS * @unit VehicleUnit.CELSIUS * @version 2 */ ENV_OUTSIDE_TEMPERATURE = 0x0703 + 0x10000000 + 0x01000000 Loading Loading @@ -3212,7 +3212,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ WINDSHIELD_WIPERS_PERIOD = Loading Loading @@ -4789,7 +4789,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:AMPERE * @unit VehicleUnit.AMPERE * @version 2 */ EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000 Loading Loading @@ -4854,7 +4854,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:SECS * @unit VehicleUnit.SECS * @version 2 */ EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000 Loading Loading @@ -4888,7 +4888,7 @@ enum VehicleProperty { + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** * Vehicle’s curb weight * Vehicle’s curb weight in kilograms. * * Returns the vehicle's curb weight in kilograms. Curb weight is * the total weight of the vehicle with standard equipment and all Loading @@ -4905,10 +4905,8 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOGRAM * @version 2 */ VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 Loading Loading @@ -5567,7 +5565,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC * @unit VehicleUnit.METER_PER_SEC * @version 2 */ CRUISE_CONTROL_TARGET_SPEED = Loading Loading @@ -5599,7 +5597,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS * @unit VehicleUnit.MILLI_SECS * @version 2 */ ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = Loading Loading @@ -5630,7 +5628,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER * @unit VehicleUnit.MILLIMETER * @version 2 */ ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = Loading
automotive/vehicle/tools/generate_annotation_enums.py +25 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ Need ANDROID_BUILD_TOP environmental variable to be set. This script will update ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java under generated_lib/java. ChangeModeForVehicleProperty.java, AccessForVehicleProperty.java, EnumForVehicleProperty.java UnitsForVehicleProperty.java under generated_lib/java. Usage: $ python generate_annotation_enums.py Loading @@ -42,6 +43,8 @@ ACCESS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_ 'AccessForVehicleProperty.java') ENUM_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + 'EnumForVehicleProperty.java') UNITS_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' + 'UnitsForVehicleProperty.java') VERSION_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' + 'VersionForVehicleProperty.h') SCRIPT_PATH = 'hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py' Loading Loading @@ -175,6 +178,15 @@ public final class EnumForVehicleProperty { public static final Map<Integer, List<Class<?>>> values = Map.ofEntries( """ UNITS_JAVA_HEADER = """package android.hardware.automotive.vehicle; import java.util.Map; public final class UnitsForVehicleProperty { public static final Map<Integer, Integer> values = Map.ofEntries( """ class PropertyConfig: """Represents one VHAL property definition in VehicleProperty.aidl.""" Loading Loading @@ -316,6 +328,12 @@ class FileParser: continue; if not cpp: annotation = "List.of(" + ', '.join([class_name + ".class" for class_name in config.enum_types]) + ")" elif field == 'unit_type': if not config.unit_type: continue if not cpp: annotation = config.unit_type elif field == 'version': if cpp: annotation = config.version Loading Loading @@ -499,6 +517,12 @@ def main(): enum_types.setJavaFooter(JAVA_FOOTER) generated_files.append(enum_types) unit_type = GeneratedFile('unit_type') unit_type.setJavaFilePath(os.path.join(android_top, UNITS_JAVA_FILE_PATH)) unit_type.setJavaHeader(UNITS_JAVA_HEADER) unit_type.setJavaFooter(JAVA_FOOTER) generated_files.append(unit_type) version = GeneratedFile('version') version.setCppFilePath(os.path.join(android_top, VERSION_CPP_FILE_PATH)) version.setCppHeader(VERSION_CPP_HEADER) Loading