There is a need to store the mapping between the VSS and Android properties. The following needs to be considered:
As an example, it might look like
- Vehicle.Powertrain.FuelSystem.Level
aospId: VehicleProperty::FUEL_LEVEL
aospArea: VehicleArea::Global
translation:
-complex: „$INFO_FUEL_CAPACITY * _VAL_ / 100”
where complex translation is described with another language considered in different ticket
There is a need to store how to translate the signal from VSS to Android Property. The idea is to have some meta language that can use the references to the other signals and mathematical equations
As an example
- Vehicle.Powertrain.FuelSystem.Level
translation:
-complex: „$INFO_FUEL_CAPACITY * _VAL_ / 100”
By the above it means that: To translate the Vehicle.Powertrain.FuelSystem.Level
into VehicleProperty::FUEL_LEVEL
the result value is = VehicleProperty::INFO_FUEL_CAPACITY * / 100.
It means that this should be generated to something like:
conversionMap["Vehicle.Powertrain.FuelSystem.Level"] = std::bind(convertFuelLevel,
std::placeholders::_1, VehicleProperty::FUEL_LEVEL, toInt(VehicleArea::GLOBAL));
// ...
static VehiclePropValue convertFuelLevel(std::string value, VehicleProperty id, int32_t area) {
VehiclePropValue prop = initializeProp(id, area);
uint8_t valInt = std::stof(value);
float mililiters = GET_PROP(VehicleProperty::INFO_FUEL_CAPACITY) * valInt / 100;
prop.value.floatValues = std::vector<float> { mililiters };
return prop;
}
There is a need to provide a way to bind enumerations, whether by meta language (see ticket [How to describe the complex translations] ).
In Android: Subscribe for TIRE_PRESSURE for left-front wheel. In VSS is more flexible (the entities of TIRES can be more than 4)
For the AOSP Props that have multiple instances, another level of binding needs to be introduced.
By idea the VHAL implementation is using the map between the VSS and Android Properties to translation:
VehiclePropValue aospValue = conversionMap[vssId](vssValue);
Conversion map fragment:
conversionMap["Vehicle.Powertrain.FuelSystem.Level"] = std::bind(convertFuelLevel,
std::placeholders::_1, VehicleProperty::FUEL_LEVEL, toInt(VehicleArea::GLOBAL));
The map can be included as a header file during compilation from the deployment files described in other ticket.
There is a need for inverse to use "setProperty" from Android partition