From a2bbcd26bd6890eb04ca8760c9831d32cdffc1b1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 9 Sep 2021 18:06:03 -0700 Subject: [PATCH] Migrate proto_message_converter to AIDL vhal. Migrate proto_message_converter to AIDL vhal. This would be used in grpc vehicleClient/vehiclServer. This CL also creates the required proto files. Test: unit tests. Bug: 199337732 Change-Id: Iac69a8c1578d4aba374ee0d9716da8b6b18ccace --- .../default_config/include/DefaultConfig.h | 1092 ++++++++--------- .../default_config/test/DefaultConfigTest.cpp | 4 +- .../utils/proto_message_converter/Android.bp | 50 + .../include/ProtoMessageConverter.h | 56 + .../src/ProtoMessageConverter.cpp | 146 +++ .../test/proto_message_converter_test.cpp | 103 ++ automotive/vehicle/aidl/impl/proto/Android.bp | 91 ++ .../automotive/vehicle/DumpResult.proto | 28 + .../automotive/vehicle/StatusCode.proto | 41 + .../vehicle/VehicleAreaConfig.proto | 39 + .../vehicle/VehiclePropConfig.proto | 53 + .../automotive/vehicle/VehiclePropValue.proto | 54 + .../vehicle/VehiclePropValueRequest.proto | 26 + .../vehicle/VehiclePropertyAccess.proto | 27 + .../vehicle/VehiclePropertyChangeMode.proto | 40 + .../vehicle/VehiclePropertyStatus.proto | 37 + .../vehicle/aidl/impl/utils/common/Android.bp | 4 +- 17 files changed, 1296 insertions(+), 595 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp create mode 100644 automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h create mode 100644 automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp create mode 100644 automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp create mode 100644 automotive/vehicle/aidl/impl/proto/Android.bp create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 411075d93e..ebcb77a02c 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -22,6 +22,7 @@ #include #include +#include namespace android { namespace hardware { @@ -35,6 +36,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::FuelType; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; @@ -52,116 +54,107 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; -} // namespace defaultconfig_impl - struct ConfigDeclaration { - defaultconfig_impl::VehiclePropConfig config; + VehiclePropConfig config; // This value will be used as an initial value for the property. If this field is specified for // property that supports multiple areas then it will be used for all areas unless particular // area is overridden in initialAreaValue field. - ::aidl::android::hardware::automotive::vehicle::RawPropValues initialValue; + RawPropValues initialValue; // Use initialAreaValues if it is necessary to specify different values per each area. - std::map - initialAreaValues; + std::map initialAreaValues; }; -const ConfigDeclaration kVehicleProperties[]{ +const std::vector kVehicleProperties = { {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_FUEL_CAPACITY), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.floatValues = {15000.0f}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_FUEL_TYPE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_FUEL_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, - .initialValue = {.int32Values = {toInt( - defaultconfig_impl::FuelType::FUEL_TYPE_UNLEADED)}}}, + .initialValue = {.int32Values = {toInt(FuelType::FUEL_TYPE_UNLEADED)}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::INFO_EV_BATTERY_CAPACITY), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.floatValues = {150000.0f}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_EV_CONNECTOR_TYPE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, - .initialValue = {.int32Values = {toInt( - defaultconfig_impl::EvConnectorType::IEC_TYPE_1_AC)}}}, + .initialValue = {.int32Values = {toInt(EvConnectorType::IEC_TYPE_1_AC)}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::INFO_FUEL_DOOR_LOCATION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_EV_PORT_LOCATION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MAKE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_MAKE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.stringValue = "Toy Vehicle"}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MODEL), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_MODEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.stringValue = "Speedy Model"}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_MODEL_YEAR), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_MODEL_YEAR), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.int32Values = {2020}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::INFO_EXTERIOR_DIMENSIONS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_EXTERIOR_DIMENSIONS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_VEHICLE_SPEED), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, @@ -169,68 +162,61 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = - {toInt(defaultconfig_impl::VehicleUnit::METER_PER_SEC), - toInt(defaultconfig_impl::VehicleUnit::MILES_PER_HOUR), - toInt(defaultconfig_impl::VehicleUnit::KILOMETERS_PER_HOUR)}, + .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::METER_PER_SEC), + toInt(VehicleUnit::MILES_PER_HOUR), + toInt(VehicleUnit::KILOMETERS_PER_HOUR)}, }, - .initialValue = {.int32Values = {toInt( - defaultconfig_impl::VehicleUnit::KILOMETERS_PER_HOUR)}}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::SEAT_OCCUPANCY), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = - {defaultconfig_impl::VehicleAreaConfig{.areaId = (SEAT_1_LEFT)}, - defaultconfig_impl::VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}}, + .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)}, + VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}}, }, - .initialAreaValues = - {{SEAT_1_LEFT, - {.int32Values = {toInt(defaultconfig_impl::VehicleSeatOccupancyState::VACANT)}}}, - {SEAT_1_RIGHT, - {.int32Values = {toInt( - defaultconfig_impl::VehicleSeatOccupancyState::VACANT)}}}}}, + .initialAreaValues = {{SEAT_1_LEFT, + {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}, + {SEAT_1_RIGHT, + {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::INFO_DRIVER_SEAT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, // this was a zoned property on an old vhal, but it is meant to be global - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = (0)}}, + .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, }, .initialValue = {.int32Values = {SEAT_1_LEFT}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_ODOMETER), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::PERF_ODOMETER), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, .initialValue = {.floatValues = {0.0f}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::PERF_STEERING_ANGLE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, .initialValue = {.floatValues = {0.0f}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::PERF_REAR_STEERING_ANGLE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, @@ -238,10 +224,9 @@ const ConfigDeclaration kVehicleProperties[]{ { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_RPM), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::ENGINE_RPM), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, @@ -250,9 +235,9 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_LEVEL), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::FUEL_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 100.0f, }, @@ -260,17 +245,17 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_DOOR_OPEN), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::EV_BATTERY_LEVEL), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 100.0f, }, @@ -278,27 +263,25 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::EV_CHARGE_PORT_OPEN), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::EV_CHARGE_PORT_CONNECTED), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - EV_BATTERY_INSTANTANEOUS_CHARGE_RATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, }, @@ -306,9 +289,9 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::RANGE_REMAINING), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::RANGE_REMAINING), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 2.0f, }, @@ -316,25 +299,25 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::TIRE_PRESSURE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + .prop = toInt(VehicleProperty::TIRE_PRESSURE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .areaConfigs = {VehicleAreaConfig{ .areaId = WHEEL_FRONT_LEFT, .minFloatValue = 193.0f, .maxFloatValue = 300.0f, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = WHEEL_FRONT_RIGHT, .minFloatValue = 193.0f, .maxFloatValue = 300.0f, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = WHEEL_REAR_LEFT, .minFloatValue = 193.0f, .maxFloatValue = 300.0f, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = WHEEL_REAR_RIGHT, .minFloatValue = 193.0f, .maxFloatValue = 300.0f, @@ -346,10 +329,9 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, + .prop = toInt(VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, }, .initialAreaValues = {{WHEEL_FRONT_LEFT, {.floatValues = {137.0f}}}, {WHEEL_FRONT_RIGHT, {.floatValues = {137.0f}}}, @@ -358,78 +340,73 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(defaultconfig_impl::VehicleUnit::KILOPASCAL), - toInt(defaultconfig_impl::VehicleUnit::PSI), - toInt(defaultconfig_impl::VehicleUnit::BAR)}, + .prop = toInt(VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::KILOPASCAL), toInt(VehicleUnit::PSI), + toInt(VehicleUnit::BAR)}, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::PSI)}}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::PSI)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::CURRENT_GEAR), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK), - toInt(defaultconfig_impl::VehicleGear::GEAR_NEUTRAL), - toInt(defaultconfig_impl::VehicleGear::GEAR_REVERSE), - toInt(defaultconfig_impl::VehicleGear::GEAR_1), - toInt(defaultconfig_impl::VehicleGear::GEAR_2), - toInt(defaultconfig_impl::VehicleGear::GEAR_3), - toInt(defaultconfig_impl::VehicleGear::GEAR_4), - toInt(defaultconfig_impl::VehicleGear::GEAR_5)}, + .prop = toInt(VehicleProperty::CURRENT_GEAR), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleGear::GEAR_PARK), + toInt(VehicleGear::GEAR_NEUTRAL), + toInt(VehicleGear::GEAR_REVERSE), + toInt(VehicleGear::GEAR_1), toInt(VehicleGear::GEAR_2), + toInt(VehicleGear::GEAR_3), toInt(VehicleGear::GEAR_4), + toInt(VehicleGear::GEAR_5)}, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK)}}}, + .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::PARKING_BRAKE_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::PARKING_BRAKE_ON), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {1}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::PARKING_BRAKE_AUTO_APPLY), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::PARKING_BRAKE_AUTO_APPLY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {1}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::FUEL_LEVEL_LOW), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HW_KEY_INPUT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HW_KEY_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0, 0, 0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HW_ROTARY_INPUT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HW_ROTARY_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0, 0, 0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HW_CUSTOM_INPUT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HW_CUSTOM_INPUT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0, 0, 3, 0, 0, 0, 0, 0}, }, .initialValue = @@ -437,106 +414,98 @@ const ConfigDeclaration kVehicleProperties[]{ .int32Values = {0, 0, 0}, }}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_POWER_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}, // TODO(bryaneyler): Ideally, this is generated dynamically from // kHvacPowerProperties. - .configArray = - {toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_SPEED), - toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION)}}, + .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED), + toInt(VehicleProperty::HVAC_FAN_DIRECTION)}}, .initialValue = {.int32Values = {1}}}, { - .config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_DEFROSTER), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = - {defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - FRONT_WINDSHIELD)}, - defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - REAR_WINDSHIELD)}}}, + {VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, + VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, .initialValue = {.int32Values = {0}} // Will be used for all areas. }, { - .config = {.prop = toInt( - defaultconfig_impl::VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .config = {.prop = toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = - {defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - FRONT_WINDSHIELD)}, - defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - REAR_WINDSHIELD)}}}, + {VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, + VehicleAreaConfig{ + .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, .initialValue = {.int32Values = {0}} // Will be used for all areas. }, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_MAX_DEFROST_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_RECIRC_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {1}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AUTO_RECIRC_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AC_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {1}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_MAX_AC_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_AUTO_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {1}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_DUAL_ON), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_SPEED), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}}, .initialValue = {.int32Values = {3}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {toInt( - defaultconfig_impl::VehicleHvacFanDirection::FACE)}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, + .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}}, - {.config = {.prop = toInt( - defaultconfig_impl::VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::STATIC, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_ALL}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR, FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR, FAN_DIRECTION_DEFROST, @@ -544,15 +513,15 @@ const ConfigDeclaration kVehicleProperties[]{ FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST, FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | FAN_DIRECTION_FACE}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_SEAT_VENTILATION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ .areaId = SEAT_1_LEFT, .minInt32Value = 0, .maxInt32Value = 3, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = SEAT_1_RIGHT, .minInt32Value = 0, .maxInt32Value = 3, @@ -560,38 +529,38 @@ const ConfigDeclaration kVehicleProperties[]{ .initialValue = {.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level. - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_STEERING_WHEEL_HEAT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}}, .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_SEAT_TEMPERATURE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{ .areaId = SEAT_1_LEFT, .minInt32Value = -2, .maxInt32Value = 2, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = SEAT_1_RIGHT, .minInt32Value = -2, .maxInt32Value = 2, }}}, .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::HVAC_TEMPERATURE_SET), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {160, 280, 5, 605, 825, 10}, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ + .areaConfigs = {VehicleAreaConfig{ .areaId = HVAC_LEFT, .minFloatValue = 16, .maxFloatValue = 32, }, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{ .areaId = HVAC_RIGHT, .minFloatValue = 16, .maxFloatValue = 32, @@ -601,99 +570,90 @@ const ConfigDeclaration kVehicleProperties[]{ {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - HVAC_TEMPERATURE_VALUE_SUGGESTION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.floatValues = {66.2f, (float)defaultconfig_impl::VehicleUnit::FAHRENHEIT, - 19.0f, 66.5f}}}, + .initialValue = {.floatValues = {66.2f, (float)VehicleUnit::FAHRENHEIT, 19.0f, 66.5f}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::ENV_OUTSIDE_TEMPERATURE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, + .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE), + .access = VehiclePropertyAccess::READ, // TODO(bryaneyler): Support ON_CHANGE as well. - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 1.0f, .maxSampleRate = 2.0f, }, .initialValue = {.floatValues = {25.0f}}}, - {.config = {.prop = toInt( - defaultconfig_impl::VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(defaultconfig_impl::VehicleUnit::FAHRENHEIT), - toInt(defaultconfig_impl::VehicleUnit::CELSIUS)}}, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::FAHRENHEIT)}}}, + {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleUnit::FAHRENHEIT), toInt(VehicleUnit::CELSIUS)}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::FAHRENHEIT)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::DISTANCE_DISPLAY_UNITS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = (0)}}, - .configArray = {toInt(defaultconfig_impl::VehicleUnit::KILOMETER), - toInt(defaultconfig_impl::VehicleUnit::MILE)}, + .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, + .configArray = {toInt(VehicleUnit::KILOMETER), toInt(VehicleUnit::MILE)}, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleUnit::MILE)}}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::MILE)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::NIGHT_MODE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::NIGHT_MODE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::GEAR_SELECTION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK), - toInt(defaultconfig_impl::VehicleGear::GEAR_NEUTRAL), - toInt(defaultconfig_impl::VehicleGear::GEAR_REVERSE), - toInt(defaultconfig_impl::VehicleGear::GEAR_DRIVE), - toInt(defaultconfig_impl::VehicleGear::GEAR_1), - toInt(defaultconfig_impl::VehicleGear::GEAR_2), - toInt(defaultconfig_impl::VehicleGear::GEAR_3), - toInt(defaultconfig_impl::VehicleGear::GEAR_4), - toInt(defaultconfig_impl::VehicleGear::GEAR_5)}, + .prop = toInt(VehicleProperty::GEAR_SELECTION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {toInt(VehicleGear::GEAR_PARK), + toInt(VehicleGear::GEAR_NEUTRAL), + toInt(VehicleGear::GEAR_REVERSE), + toInt(VehicleGear::GEAR_DRIVE), toInt(VehicleGear::GEAR_1), + toInt(VehicleGear::GEAR_2), toInt(VehicleGear::GEAR_3), + toInt(VehicleGear::GEAR_4), toInt(VehicleGear::GEAR_5)}, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleGear::GEAR_PARK)}}}, + .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::TURN_SIGNAL_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::TURN_SIGNAL_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleTurnSignal::NONE)}}}, + .initialValue = {.int32Values = {toInt(VehicleTurnSignal::NONE)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::IGNITION_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::IGNITION_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleIgnitionState::ON)}}}, + .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_OIL_LEVEL), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleOilLevel::NORMAL)}}}, + .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::ENGINE_OIL_TEMP), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds .maxSampleRate = 10, // 10 Hz, every 100 ms }, @@ -701,8 +661,8 @@ const ConfigDeclaration kVehicleProperties[]{ { .config = {.prop = kMixedTypePropertyForTest, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}}, .initialValue = { @@ -712,70 +672,69 @@ const ConfigDeclaration kVehicleProperties[]{ }, }, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DOOR_LOCK), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_LEFT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_LEFT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, + {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, + VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, + VehicleAreaConfig{.areaId = DOOR_2_LEFT}, + VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, {DOOR_1_RIGHT, {.int32Values = {1}}}, {DOOR_2_LEFT, {.int32Values = {1}}}, {DOOR_2_RIGHT, {.int32Values = {1}}}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DOOR_POS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + {.config = {.prop = toInt(VehicleProperty::DOOR_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = - {defaultconfig_impl::VehicleAreaConfig{ + {VehicleAreaConfig{ .areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 1}, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{.areaId = DOOR_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 1}, + VehicleAreaConfig{ .areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 1}, - defaultconfig_impl::VehicleAreaConfig{ + VehicleAreaConfig{.areaId = DOOR_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 1}, + VehicleAreaConfig{ .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::WINDOW_LOCK), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{ - .areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT}}}, + {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | + WINDOW_2_RIGHT}}}, .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT, {.int32Values = {0}}}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::WINDOW_POS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_1_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_2_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - defaultconfig_impl::VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - defaultconfig_impl::VehicleAreaConfig{ - .areaId = WINDOW_ROOF_TOP_1, - .minInt32Value = -10, - .maxInt32Value = 10}}}, + {.config = {.prop = toInt(VehicleProperty::WINDOW_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_2_LEFT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, + .minInt32Value = 0, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1, + .minInt32Value = -10, + .maxInt32Value = 10}}}, .initialValue = {.int32Values = {0}}}, {.config = { .prop = WHEEL_TICK, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::CONTINUOUS, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000}, .minSampleRate = 1.0f, .maxSampleRate = 10.0f, @@ -783,371 +742,324 @@ const ConfigDeclaration kVehicleProperties[]{ .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}}, {.config = {.prop = ABS_ACTIVE, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, .initialValue = {.int32Values = {0}}}, {.config = {.prop = TRACTION_CONTROL_ACTIVE, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::AP_POWER_STATE_REQ), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {3}}, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::VehicleApPowerStateReq::ON), - 0}}}, + .initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::AP_POWER_STATE_REPORT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = - {.int32Values = - {toInt(defaultconfig_impl::VehicleApPowerStateReport::WAIT_FOR_VHAL), - 0}}}, + {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, + .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty::DISPLAY_BRIGHTNESS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.minInt32Value = 0, - .maxInt32Value = 100}}}, + {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}}, .initialValue = {.int32Values = {100}}}, { .config = {.prop = OBD2_LIVE_FRAME, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0}}, }, { .config = {.prop = OBD2_FREEZE_FRAME, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0}}, }, { .config = {.prop = OBD2_FREEZE_FRAME_INFO, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, }, { .config = {.prop = OBD2_FREEZE_FRAME_CLEAR, - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {1}}, }, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HEADLIGHTS_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HEADLIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HIGH_BEAM_LIGHTS_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::FOG_LIGHTS_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::FOG_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HAZARD_LIGHTS_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HEADLIGHTS_SWITCH), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, {.config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::FOG_LIGHTS_SWITCH), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::FOG_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::HAZARD_LIGHTS_SWITCH), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::EVS_SERVICE_REQUEST), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, - .initialValue = {.int32Values = {toInt(defaultconfig_impl::EvsServiceType::REARVIEW), - toInt(defaultconfig_impl::EvsServiceState::OFF)}}}, + .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW), + toInt(EvsServiceState::OFF)}}}, {.config = {.prop = VEHICLE_MAP_SERVICE, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}}, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}}, // Example Vendor Extension properties for testing {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_LEFT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_LEFT}, - defaultconfig_impl::VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, + VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, + VehicleAreaConfig{.areaId = DOOR_2_LEFT}, + VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, {DOOR_1_RIGHT, {.int32Values = {1}}}, {DOOR_2_LEFT, {.int32Values = {0}}}, {DOOR_2_RIGHT, {.int32Values = {0}}}}}, {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_LEFT, - .minFloatValue = -10, - .maxFloatValue = 10}, - defaultconfig_impl::VehicleAreaConfig{.areaId = HVAC_RIGHT, - .minFloatValue = -10, - .maxFloatValue = 10}}}, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT, + .minFloatValue = -10, + .maxFloatValue = 10}, + VehicleAreaConfig{.areaId = HVAC_RIGHT, + .minFloatValue = -10, + .maxFloatValue = 10}}}, .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}}, {HVAC_RIGHT, {.floatValues = {2}}}}}, {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .areaConfigs = - {defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - FRONT_WINDSHIELD), - .minInt32Value = -100, - .maxInt32Value = 100}, - defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt(defaultconfig_impl::VehicleAreaWindow:: - REAR_WINDSHIELD), - .minInt32Value = -100, - .maxInt32Value = 100}, - defaultconfig_impl::VehicleAreaConfig{ - .areaId = toInt( - defaultconfig_impl::VehicleAreaWindow::ROOF_TOP_1), - .minInt32Value = -100, - .maxInt32Value = 100}}}, - .initialAreaValues = {{toInt(defaultconfig_impl::VehicleAreaWindow::FRONT_WINDSHIELD), - {.int32Values = {1}}}, - {toInt(defaultconfig_impl::VehicleAreaWindow::REAR_WINDSHIELD), - {.int32Values = {0}}}, - {toInt(defaultconfig_impl::VehicleAreaWindow::ROOF_TOP_1), - {.int32Values = {-1}}}}}, + {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD), + .minInt32Value = -100, + .maxInt32Value = 100}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD), + .minInt32Value = -100, + .maxInt32Value = 100}, + VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::ROOF_TOP_1), + .minInt32Value = -100, + .maxInt32Value = 100}}}, + .initialAreaValues = {{toInt(VehicleAreaWindow::FRONT_WINDSHIELD), {.int32Values = {1}}}, + {toInt(VehicleAreaWindow::REAR_WINDSHIELD), {.int32Values = {0}}}, + {toInt(VehicleAreaWindow::ROOF_TOP_1), {.int32Values = {-1}}}}}, {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, .initialValue = {.stringValue = "Vendor String Property"}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty:: - ELECTRONIC_TOLL_COLLECTION_CARD_TYPE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, .initialValue = {.int32Values = {0}}}, - {.config = {.prop = toInt(defaultconfig_impl::VehicleProperty:: - ELECTRONIC_TOLL_COLLECTION_CARD_STATUS), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE}, + {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, .initialValue = {.int32Values = {0}}}, {.config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - SUPPORT_CUSTOMIZE_VENDOR_PERMISSION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, - .configArray = - {kMixedTypePropertyForTest, - toInt(defaultconfig_impl:: - VehicleVendorPermission:: - PERMISSION_GET_VENDOR_CATEGORY_INFO), - toInt(defaultconfig_impl:: - VehicleVendorPermission:: - PERMISSION_SET_VENDOR_CATEGORY_INFO), - VENDOR_EXTENSION_INT_PROPERTY, - toInt(defaultconfig_impl:: - VehicleVendorPermission:: - PERMISSION_GET_VENDOR_CATEGORY_SEAT), - toInt(defaultconfig_impl:: - VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE), - VENDOR_EXTENSION_FLOAT_PROPERTY, - toInt(defaultconfig_impl:: - VehicleVendorPermission::PERMISSION_DEFAULT), - toInt(defaultconfig_impl:: - VehicleVendorPermission::PERMISSION_DEFAULT)}, + .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {kMixedTypePropertyForTest, + toInt(VehicleVendorPermission:: + PERMISSION_GET_VENDOR_CATEGORY_INFO), + toInt(VehicleVendorPermission:: + PERMISSION_SET_VENDOR_CATEGORY_INFO), + VENDOR_EXTENSION_INT_PROPERTY, + toInt(VehicleVendorPermission:: + PERMISSION_GET_VENDOR_CATEGORY_SEAT), + toInt(VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE), + VENDOR_EXTENSION_FLOAT_PROPERTY, + toInt(VehicleVendorPermission::PERMISSION_DEFAULT), + toInt(VehicleVendorPermission::PERMISSION_DEFAULT)}, }, .initialValue = {.int32Values = {1}}}, { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::INITIAL_USER_INFO), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::SWITCH_USER), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::SWITCH_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::CREATE_USER), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CREATE_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::REMOVE_USER), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::REMOVE_USER), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - USER_IDENTIFICATION_ASSOCIATION), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::POWER_POLICY_REQ), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::POWER_POLICY_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - POWER_POLICY_GROUP_REQ), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::CURRENT_POWER_POLICY), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::EPOCH_TIME), - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::EPOCH_TIME), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::WATCHDOG_ALIVE), - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::WATCHDOG_ALIVE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - WATCHDOG_TERMINATED_PROCESS), - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::WATCHDOG_TERMINATED_PROCESS), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty::VHAL_HEARTBEAT), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::CLUSTER_SWITCH_UI), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0 /* ClusterHome */, -1 /* ClusterNone */}}, }, { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::CLUSTER_DISPLAY_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */}}, @@ -1155,41 +1067,34 @@ const ConfigDeclaration kVehicleProperties[]{ { .config = { - .prop = toInt( - defaultconfig_impl::VehicleProperty::CLUSTER_REPORT_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - CLUSTER_REQUEST_DISPLAY), - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { - .prop = toInt(defaultconfig_impl::VehicleProperty:: - CLUSTER_NAVIGATION_STATE), - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .prop = toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE), + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { .prop = PLACEHOLDER_PROPERTY_INT, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0}}, }, @@ -1197,9 +1102,8 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = PLACEHOLDER_PROPERTY_FLOAT, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.floatValues = {0.0f}}, }, @@ -1207,9 +1111,8 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = PLACEHOLDER_PROPERTY_BOOLEAN, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0 /* false */}}, }, @@ -1217,9 +1120,8 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = PLACEHOLDER_PROPERTY_STRING, - .access = defaultconfig_impl::VehiclePropertyAccess::READ_WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.stringValue = {"Test"}}, }, @@ -1229,27 +1131,24 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = VENDOR_CLUSTER_SWITCH_UI, - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { .prop = VENDOR_CLUSTER_DISPLAY_STATE, - .access = defaultconfig_impl::VehiclePropertyAccess::WRITE, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, { .config = { .prop = VENDOR_CLUSTER_REPORT_STATE, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, }, .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, @@ -1260,9 +1159,8 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = VENDOR_CLUSTER_REQUEST_DISPLAY, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, .initialValue = {.int32Values = {0 /* ClusterHome */}}, }, @@ -1270,14 +1168,26 @@ const ConfigDeclaration kVehicleProperties[]{ .config = { .prop = VENDOR_CLUSTER_NAVIGATION_STATE, - .access = defaultconfig_impl::VehiclePropertyAccess::READ, - .changeMode = - defaultconfig_impl::VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, #endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING }; +} // namespace defaultconfig_impl + +// public namespace +namespace defaultconfig { + +typedef defaultconfig_impl::ConfigDeclaration ConfigDeclaration; + +inline constexpr const std::vector& getDefaultConfigs() { + return defaultconfig_impl::kVehicleProperties; +} + +} // namespace defaultconfig + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp index 6385ac1472..baaae75108 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -22,17 +22,19 @@ namespace android { namespace hardware { namespace automotive { namespace vehicle { +namespace defaultconfig { namespace test { TEST(DefaultConfigTest, loadDefaultConfigs) { - for (ConfigDeclaration config : kVehicleProperties) { + for (ConfigDeclaration config : getDefaultConfigs()) { ASSERT_NE(0, config.config.prop); } } } // namespace test +} // namespace defaultconfig } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp new file mode 100644 index 0000000000..2b0b11f2d2 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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. + */ + +cc_library { + name: "VehicleHalProtoMessageConverter", + srcs: [ + "src/*.cpp", + ], + vendor: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + shared_libs: ["libprotobuf-cpp-full"], + static_libs: [ + "VehicleHalProtos", + "VehicleHalUtils", + ], + defaults: ["VehicleHalDefaults"], + export_static_lib_headers: ["VehicleHalUtils"], +} + +cc_test { + name: "VehicleHalProtoMessageConverterTest", + srcs: [ + "test/*.cpp", + ], + vendor: true, + defaults: ["VehicleHalDefaults"], + shared_libs: ["libprotobuf-cpp-full"], + static_libs: [ + "VehicleHalProtoMessageConverter", + "VehicleHalProtos", + "VehicleHalUtils", + "libgtest", + ], + header_libs: ["VehicleHalDefaultConfig"], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h new file mode 100644 index 0000000000..1c26fe868b --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/include/ProtoMessageConverter.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ +#define android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +// Convert AIDL VehiclePropConfig to Protobuf VehiclePropConfig. +void aidlToProto( + const ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig& inAidlConfig, + ::android::hardware::automotive::vehicle::proto::VehiclePropConfig* outProtoConfig); +// Convert Protobuf VehiclePropConfig to AIDL VehiclePropConfig. +void protoToAidl( + const ::android::hardware::automotive::vehicle::proto::VehiclePropConfig& inProtoConfig, + ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig* outAidlConfig); +// Convert AIDL VehiclePropValue to Protobuf VehiclePropValue. +void aidlToProto(const ::aidl::android::hardware::automotive::vehicle::VehiclePropValue& inAidlVal, + ::android::hardware::automotive::vehicle::proto::VehiclePropValue* outProtoVal); +// Convert Protobuf VehiclePropValue to AIDL VehiclePropValue. +void protoToAidl( + const ::android::hardware::automotive::vehicle::proto::VehiclePropValue& inProtoVal, + ::aidl::android::hardware::automotive::vehicle::VehiclePropValue* outAidlVal); + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_grpc_utils_proto_message_converter_include_ProtoMessageConverter_H_ diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp new file mode 100644 index 0000000000..6cbc7e523e --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/src/ProtoMessageConverter.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2021 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. + */ + +#define LOG_TAG "ProtoMsgConverter" + +#include "ProtoMessageConverter.h" + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; +namespace proto = ::android::hardware::automotive::vehicle::proto; + +// Copy the vector PROTO_VECNAME of protobuf class PROTO_VALUE to +// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME, every element of PROTO_VECNAME is casted by CAST. +#define CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \ + VHAL_TYPE_VECNAME, CAST) \ + do { \ + (VHAL_TYPE_VALUE)->VHAL_TYPE_VECNAME.resize(PROTO_VALUE.PROTO_VECNAME##_size()); \ + size_t idx = 0; \ + for (auto& value : PROTO_VALUE.PROTO_VECNAME()) { \ + VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME[idx++] = CAST(value); \ + } \ + } while (0) + +// Copying the vector PROTO_VECNAME of protobuf class PROTO_VALUE to +// VHAL_TYPE_VALUE->VHAL_TYPE_VECNAME. +#define COPY_PROTOBUF_VEC_TO_VHAL_TYPE(PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, \ + VHAL_TYPE_VECNAME) \ + CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE( \ + PROTO_VALUE, PROTO_VECNAME, VHAL_TYPE_VALUE, VHAL_TYPE_VECNAME, /*NO CAST*/) + +void aidlToProto(const aidl_vehicle::VehiclePropConfig& in, proto::VehiclePropConfig* out) { + out->set_prop(in.prop); + out->set_access(static_cast(toInt(in.access))); + out->set_change_mode(static_cast(toInt(in.changeMode))); + out->set_config_string(in.configString.c_str(), in.configString.size()); + out->set_min_sample_rate(in.minSampleRate); + out->set_max_sample_rate(in.maxSampleRate); + + for (auto& configElement : in.configArray) { + out->add_config_array(configElement); + } + + out->clear_area_configs(); + for (auto& areaConfig : in.areaConfigs) { + auto* protoACfg = out->add_area_configs(); + protoACfg->set_area_id(areaConfig.areaId); + protoACfg->set_min_int64_value(areaConfig.minInt64Value); + protoACfg->set_max_int64_value(areaConfig.maxInt64Value); + protoACfg->set_min_float_value(areaConfig.minFloatValue); + protoACfg->set_max_float_value(areaConfig.maxFloatValue); + protoACfg->set_min_int32_value(areaConfig.minInt32Value); + protoACfg->set_max_int32_value(areaConfig.maxInt32Value); + } +} + +void protoToAidl(const proto::VehiclePropConfig& in, aidl_vehicle::VehiclePropConfig* out) { + out->prop = in.prop(); + out->access = static_cast(in.access()); + out->changeMode = static_cast(in.change_mode()); + out->configString = in.config_string(); + out->minSampleRate = in.min_sample_rate(); + out->maxSampleRate = in.max_sample_rate(); + + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, config_array, out, configArray); + + auto cast_to_acfg = [](const proto::VehicleAreaConfig& protoAcfg) { + return aidl_vehicle::VehicleAreaConfig{ + .areaId = protoAcfg.area_id(), + .minInt32Value = protoAcfg.min_int32_value(), + .maxInt32Value = protoAcfg.max_int32_value(), + .minInt64Value = protoAcfg.min_int64_value(), + .maxInt64Value = protoAcfg.max_int64_value(), + .minFloatValue = protoAcfg.min_float_value(), + .maxFloatValue = protoAcfg.max_float_value(), + }; + }; + CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, area_configs, out, areaConfigs, cast_to_acfg); +} + +void aidlToProto(const aidl_vehicle::VehiclePropValue& in, proto::VehiclePropValue* out) { + out->set_prop(in.prop); + out->set_timestamp(in.timestamp); + out->set_status(static_cast(in.status)); + out->set_area_id(in.areaId); + out->set_string_value(in.value.stringValue); + out->set_byte_values(in.value.byteValues.data(), in.value.byteValues.size()); + + for (auto& int32Value : in.value.int32Values) { + out->add_int32_values(int32Value); + } + + for (auto& int64Value : in.value.int64Values) { + out->add_int64_values(int64Value); + } + + for (auto& floatValue : in.value.floatValues) { + out->add_float_values(floatValue); + } +} + +void protoToAidl(const proto::VehiclePropValue& in, aidl_vehicle::VehiclePropValue* out) { + out->prop = in.prop(); + out->timestamp = in.timestamp(); + out->status = static_cast(in.status()); + out->areaId = in.area_id(); + out->value.stringValue = in.string_value(); + for (const char& byte : in.byte_values()) { + out->value.byteValues.push_back(byte); + } + + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int32_values, out, value.int32Values); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, int64_values, out, value.int64Values); + COPY_PROTOBUF_VEC_TO_VHAL_TYPE(in, float_values, out, value.floatValues); +} + +#undef COPY_PROTOBUF_VEC_TO_VHAL_TYPE +#undef CAST_COPY_PROTOBUF_VEC_TO_VHAL_TYPE + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp new file mode 100644 index 0000000000..d5f23739cb --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2021 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace proto_msg_converter { + +namespace { + +namespace proto = ::android::hardware::automotive::vehicle::proto; +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; + +std::vector prepareTestConfigs() { + std::vector configs; + for (auto& property : defaultconfig::getDefaultConfigs()) { + configs.push_back(property.config); + } + return configs; +} + +std::vector prepareTestValues() { + std::vector values; + long timestamp = 1; + for (auto& property : defaultconfig::getDefaultConfigs()) { + values.push_back({ + .timestamp = timestamp, + .areaId = 123, + .prop = property.config.prop, + .value = property.initialValue, + .status = aidl_vehicle::VehiclePropertyStatus::ERROR, + }); + } + return values; +} + +class PropConfigConversionTest : public testing::TestWithParam {}; + +class PropValueConversionTest : public testing::TestWithParam {}; + +} // namespace + +TEST_P(PropConfigConversionTest, testConversion) { + proto::VehiclePropConfig protoCfg; + aidl_vehicle::VehiclePropConfig aidlCfg; + + aidlToProto(GetParam(), &protoCfg); + protoToAidl(protoCfg, &aidlCfg); + + EXPECT_EQ(aidlCfg, GetParam()); +} + +TEST_P(PropValueConversionTest, testConversion) { + proto::VehiclePropValue protoVal; + aidl_vehicle::VehiclePropValue aidlVal; + + aidlToProto(GetParam(), &protoVal); + protoToAidl(protoVal, &aidlVal); + + EXPECT_EQ(aidlVal, GetParam()); +} + +INSTANTIATE_TEST_SUITE_P(DefaultConfigs, PropConfigConversionTest, + ::testing::ValuesIn(prepareTestConfigs()), + [](const ::testing::TestParamInfo& info) { + return ::fmt::format("property_{:d}", info.param.prop); + }); + +INSTANTIATE_TEST_SUITE_P(TestValues, PropValueConversionTest, + ::testing::ValuesIn(prepareTestValues()), + [](const ::testing::TestParamInfo& info) { + return ::fmt::format("property_{:d}", info.param.prop); + }); + +} // namespace proto_msg_converter +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp new file mode 100644 index 0000000000..80966df19a --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/Android.bp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2021 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. + */ + +filegroup { + name: "VehicleHalProtoFiles", + srcs: ["**/*.proto"], + visibility: ["//hardware/interfaces/automotive/vehicle:__subpackages__"], +} + +genrule { + name: "VehicleProtoStub_h", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + ":VehicleHalProtoFiles", + ], + out: [ + "android/hardware/automotive/vehicle/DumpResult.pb.h", + "android/hardware/automotive/vehicle/StatusCode.pb.h", + "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h", + "android/hardware/automotive/vehicle/VehiclePropConfig.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.h", + "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.h", + "android/hardware/automotive/vehicle/VehiclePropValue.pb.h", + "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.h", + ], +} + +genrule { + name: "VehicleProtoStub_cc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + ":VehicleHalProtoFiles", + ], + out: [ + "android/hardware/automotive/vehicle/DumpResult.pb.cc", + "android/hardware/automotive/vehicle/StatusCode.pb.cc", + "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropConfig.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyAccess.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropertyStatus.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropValue.pb.cc", + "android/hardware/automotive/vehicle/VehiclePropValueRequest.pb.cc", + ], +} + +cc_library_static { + name: "VehicleHalProtos", + vendor: true, + host_supported: true, + include_dirs: [ + "external/protobuf/src", + ], + generated_headers: [ + "VehicleProtoStub_h", + ], + export_generated_headers: [ + "VehicleProtoStub_h", + ], + generated_sources: [ + "VehicleProtoStub_cc", + ], + shared_libs: [ + "libgrpc++_unsecure", + ], + cflags: [ + "-Wno-unused-parameter", + ], +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto new file mode 100644 index 0000000000..25bb7d4f77 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpResult.proto @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +message DumpResult { + /* If callerShouldDumpState is true, caller would print the information in buffer and + * continue to dump its state, otherwise would just dump the buffer and skip its own + * dumping logic. */ + bool caller_should_dump_state = 1; + /* The dumped information for the caller to print. */ + string buffer = 2; +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto new file mode 100644 index 0000000000..97cb0f88b2 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with StatusCode.aidl. */ +enum StatusCode { + OK = 0; + + /* Try again. */ + TRY_AGAIN = 1; + + /* Invalid argument provided. */ + INVALID_ARG = 2; + + /* This code must be returned when device that associated with the vehicle + * property is not available. For example, when client tries to set HVAC + * temperature when the whole HVAC unit is turned OFF. */ + NOT_AVAILABLE = 3; + + /* Access denied */ + ACCESS_DENIED = 4; + + /* Something unexpected has happened in Vehicle HAL */ + INTERNAL_ERROR = 5; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto new file mode 100644 index 0000000000..b5b7e8070a --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehicleAreaConfig.proto @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehicleAreaConfig.aidl. */ +message VehicleAreaConfig { + /* Area id is ignored for VehiclePropertyGroup:GLOBAL properties. */ + int32 area_id = 1; + + /* If the property has @data_enum, leave the range to zero. + * + * Range will be ignored in the following cases: + * - The VehiclePropertyType is not INT32, INT64 or FLOAT. + * - Both of min value and max value are zero. */ + int32 min_int32_value = 2; + int32 max_int32_value = 3; + + int64 min_int64_value = 4; + int64 max_int64_value = 5; + + float min_float_value = 6; + float max_float_value = 7; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto new file mode 100644 index 0000000000..e230d15d06 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropConfig.proto @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehicleAreaConfig.proto"; +import "android/hardware/automotive/vehicle/VehiclePropertyAccess.proto"; +import "android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto"; + +/* Must be in sync with VehiclePropConfig.aidl. */ +message VehiclePropConfig { + /* Property identifier */ + int32 prop = 1; + + /* Defines if the property is read or write or both. */ + VehiclePropertyAccess access = 2; + + /* Defines the change mode of the property. */ + VehiclePropertyChangeMode change_mode = 3; + + /* Contains per-area configuration. */ + repeated VehicleAreaConfig area_configs = 4; + + /* Contains additional configuration parameters */ + repeated int32 config_array = 5; + + /* Some properties may require additional information passed over this + * string. Most properties do not need to set this. */ + bytes config_string = 6; + + /* Min sample rate in Hz. + * Must be defined for VehiclePropertyChangeMode::CONTINUOUS */ + float min_sample_rate = 7; + + /* Must be defined for VehiclePropertyChangeMode::CONTINUOUS + * Max sample rate in Hz. */ + float max_sample_rate = 8; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto new file mode 100644 index 0000000000..80c73cbb77 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehiclePropertyStatus.proto"; + +/* Must be in sync with VehiclePropValue.aidl. */ +message VehiclePropValue { + /* Time is elapsed nanoseconds since boot */ + int64 timestamp = 1; + + /* Area type(s) for non-global property it must be one of the value from + * VehicleArea* enums or 0 for global properties. */ + int32 area_id = 2; + + /* Property identifier */ + int32 prop = 3; + + /* Status of the property */ + VehiclePropertyStatus status = 4; + + /* This is used for properties of types VehiclePropertyType#INT + * and VehiclePropertyType#INT_VEC */ + repeated int32 int32_values = 5; + + /* This is used for properties of types VehiclePropertyType#FLOAT + * and VehiclePropertyType#FLOAT_VEC */ + repeated float float_values = 6; + + /* This is used for properties of type VehiclePropertyType#INT64 */ + repeated int64 int64_values = 7; + + /* This is used for properties of type VehiclePropertyType#BYTES */ + bytes byte_values = 8; + + /* This is used for properties of type VehiclePropertyType#STRING */ + string string_value = 9; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto new file mode 100644 index 0000000000..b16daa8bd3 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; + +message VehiclePropValueRequest { + int32 request_id = 1; + VehiclePropValue value = 2; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto new file mode 100644 index 0000000000..55840f07d4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyAccess.proto @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyAccess.aidl. */ +enum VehiclePropertyAccess { + NONE = 0; + READ = 1; + WRITE = 2; + READ_WRITE = 3; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto new file mode 100644 index 0000000000..c681e3b4c3 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.proto @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyChangeMode.aidl. */ +enum VehiclePropertyChangeMode { + /* Property of this type must never be changed. Subscription is not supported + * for these properties. */ + STATIC = 0; + + /* Properties of this type must report when there is a change. + * IVehicle#get call must return the current value. + * Set operation for this property is assumed to be asynchronous. When the + * property is read (using IVehicle#get) after IVehicle#set, it may still + * return old value until underlying H/W backing this property has actually + * changed the state. Once state is changed, the property must dispatch + * changed value as event. */ + ON_CHANGE = 1; + + /* Properties of this type change continuously and require a fixed rate of + * sampling to retrieve the data. Implementers may choose to send extra + * notifications on significant value changes. */ + CONTINUOUS = 2; +}; diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto new file mode 100644 index 0000000000..a44c8f03e6 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropertyStatus.proto @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +/* Must be in sync with VehiclePropertyStatus.aidl. */ +enum VehiclePropertyStatus { + /* Property is available and behaving normally */ + AVAILABLE = 0; + /* A property in this state is not available for reading and writing. This + * is a transient state that depends on the availability of the underlying + * implementation (e.g. hardware or driver). It MUST NOT be used to + * represent features that this vehicle is always incapable of. A get() of + * a property in this state MAY return an undefined value, but MUST + * correctly describe its status as UNAVAILABLE A set() of a property in + * this state MAY return NOT_AVAILABLE. The HAL implementation MUST ignore + * the value of the status field when writing a property value coming from + * Android. */ + UNAVAILABLE = 1; + /* There is an error with this property. */ + ERROR = 2; +}; diff --git a/automotive/vehicle/aidl/impl/utils/common/Android.bp b/automotive/vehicle/aidl/impl/utils/common/Android.bp index 001280f857..ace505d88c 100644 --- a/automotive/vehicle/aidl/impl/utils/common/Android.bp +++ b/automotive/vehicle/aidl/impl/utils/common/Android.bp @@ -20,9 +20,7 @@ package { cc_library { name: "VehicleHalUtils", - srcs: [ - "src/*.cpp", - ], + srcs: ["src/*.cpp"], vendor: true, local_include_dirs: ["include"], export_include_dirs: ["include"],