|
| 1 | +# VHAL Exporter |
| 2 | + |
| 3 | +The VHAL exporter maps the VSS tree to Android VHAL properties by creating or modifying given map file and generating |
| 4 | +needed Java and AIDL sources. |
| 5 | + |
| 6 | +The Android VHAL property ID is composed of 4 parts (0xGATTDDDD): |
| 7 | + |
| 8 | +- [Group](https://cs.android.com/android/platform/superproject/main/+/main:hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl): 1 nibble |
| 9 | +- [Area](https://cs.android.com/android/platform/superproject/main/+/main:hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl): 1 nibble |
| 10 | +- [Type](https://cs.android.com/android/platform/superproject/main/+/main:hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl): 1 byte |
| 11 | +- iDentifier: 2 bytes - as sequence (max 65535) |
| 12 | + |
| 13 | +This mapper can create all group of properties defined in |
| 14 | +[VehiclePropertyGroup](https://cs.android.com/android/platform/superproject/main/+/main:hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl) |
| 15 | +and one additional we call VSS to demonstrate the possibility of a VSS specific scope (group). |
| 16 | + |
| 17 | +## Property Change Mode |
| 18 | + |
| 19 | +Each VHAL property has one of the following change modes: |
| 20 | + |
| 21 | +STATIC |
| 22 | +: used to VSS node types ATTRIBUTE and ACTUATOR. |
| 23 | + |
| 24 | +ON_CHANGE |
| 25 | +: used for VSS node type SENSOR. |
| 26 | + |
| 27 | +CONTINUOUS |
| 28 | +: used for VSS node type SENSOR if the path of that VSS node is present in JSON file provided by `--continuous-change-mode`. |
| 29 | + |
| 30 | +### Continuous Change Mode List Example |
| 31 | + |
| 32 | +`vss_continuous.json`: |
| 33 | +```json |
| 34 | +[ |
| 35 | + "Vehicle.Speed", |
| 36 | + "Vehicle.TraveledDistance", |
| 37 | + "Vehicle.Powertrain.Range", |
| 38 | + "Vehicle.Powertrain.CombustionEngine.Speed", |
| 39 | + "Vehicle.OBD.EngineSpeed", |
| 40 | + "Vehicle.Powertrain.ElectricMotor.Speed", |
| 41 | + "Vehicle.Powertrain.CombustionEngine.EOT", |
| 42 | + "Vehicle.Powertrain.CombustionEngine.EngineOil.Temperature", |
| 43 | + "Vehicle.Powertrain.TractionBattery.StateOfCharge.CurrentEnergy", |
| 44 | + "Vehicle.Powertrain.FuelSystem.AbsoluteLevel", |
| 45 | + "Vehicle.Chassis.Axle.Row1.SteeringAngle", |
| 46 | + "Vehicle.Chassis.Axle.Row2.SteeringAngle", |
| 47 | + "Vehicle.Exterior.AirTemperature", |
| 48 | + "Vehicle.Powertrain.CombustionEngine.ECT", |
| 49 | + "Vehicle.Powertrain.CombustionEngine.EngineCoolant.Temperature", |
| 50 | + "Vehicle.Powertrain.ElectricMotor.CoolantTemperature", |
| 51 | + "Vehicle.Powertrain.ElectricMotor.EngineCoolant.Temperature", |
| 52 | + "Vehicle.Powertrain.TractionBattery.StateOfCharge.Current", |
| 53 | + "Vehicle.Powertrain.TractionBattery.StateOfCharge.Displayed", |
| 54 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeCurrent.DC", |
| 55 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeCurrent.Phase1", |
| 56 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeCurrent.Phase2", |
| 57 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeCurrent.Phase3", |
| 58 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeVoltage.DC", |
| 59 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeVoltage.Phase1", |
| 60 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeVoltage.Phase2", |
| 61 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeVoltage.Phase3", |
| 62 | + "Vehicle.Powertrain.TractionBattery.Charging.ChargeRate", |
| 63 | + "Vehicle.Powertrain.TractionBattery.Charging.TimeToComplete", |
| 64 | + "Vehicle.Powertrain.TractionBattery.Temperature.Average", |
| 65 | + "Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure", |
| 66 | + "Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure", |
| 67 | + "Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure", |
| 68 | + "Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure" |
| 69 | +] |
| 70 | +``` |
| 71 | + |
| 72 | +## Examples |
| 73 | + |
| 74 | +To generate SYSTEM properties use the following command. With SYSTEM properties we need to make sure not to conflict |
| 75 | +with existing ones in the platform, therefore the use of `--min-property-id` is needed when generating the map file |
| 76 | +for the first time: |
| 77 | + |
| 78 | +```bash |
| 79 | +vspec export jsonvhal \ |
| 80 | + --vspec /path/to/vehicle_signal_specification/spec/VehicleSignalSpecification.vspec \ |
| 81 | + --min-property-id 32768 \ |
| 82 | + --vhal-map vss_to_android_property_map.json \ |
| 83 | + --continuous-change-mode vss_continuous.json \ |
| 84 | + --output-dir /path/to/output |
| 85 | +``` |
| 86 | + |
| 87 | +To only update SYSTEM properties, i.e. ignore all newly added VSS nodes to the spec add `--no-extend-new` argument: |
| 88 | + |
| 89 | +```bash |
| 90 | +vspec export jsonvhal \ |
| 91 | + --vspec /path/to/vehicle_signal_specification/spec/VehicleSignalSpecification.vspec \ |
| 92 | + --vhal-map vss_to_android_property_map.json \ |
| 93 | + --continuous-change-mode vss_continuous.json \ |
| 94 | + --output-dir /path/to/output \ |
| 95 | + --no-extend-new |
| 96 | +``` |
| 97 | + |
| 98 | +To generate VENDOR properties use the argument `--property-group 2`: |
| 99 | + |
| 100 | +```bash |
| 101 | +vspec export jsonvhal \ |
| 102 | + --vspec /path/to/vehicle_signal_specification/spec/VehicleSignalSpecification.vspec \ |
| 103 | + --property-group 2 \ |
| 104 | + --vhal-map vss_to_android_property_map.json \ |
| 105 | + --continuous-change-mode vss_continuous.json \ |
| 106 | + --output-dir /path/to/output |
| 107 | +``` |
| 108 | + |
| 109 | +To generate VHAL properties in custom VSS group use the argument `--property-group 4`: |
| 110 | + |
| 111 | +```bash |
| 112 | +vspec export jsonvhal \ |
| 113 | + --vspec /path/to/vehicle_signal_specification/spec/VehicleSignalSpecification.vspec \ |
| 114 | + --property-group 4 \ |
| 115 | + --vhal-map vss_to_android_property_map.json \ |
| 116 | + --continuous-list-change-mode vss_continuous.json \ |
| 117 | + --output-dir /path/to/output/ |
| 118 | +``` |
0 commit comments