C
Qt IVI Android Vehicle Properties Module
The Qt IVI Android vehicle properties module is a submodule of Qt for Android Automotive. This submodule is an extension of the similar Qt IVI Vehicle Functions Module.
It provides a C++ and QML wrapper for Android Automotive Vehicle Properties as a Qt IVI plugin. The solution is based on templates used by the Qt IVI Generator for code generation. The interface is defined by a QFace
configuration file which covers the Android Automotive Vehicle Properties.
How it Works
The module encapsulates the Qt for Android Automotive JNI back end (Qt IVI Android Extensions). This module facilitates access to Android vehicle properties. It provides a dedicated Qt Quick plugin to enable access using the QML language.
The set of available vehicle properties, which are grouped into feature components, is defined by the QFace
configuration file together with YAML annotations file (YAML Annotations). These two files reflect the Android vehicle properties defined in AOSP sources (VHAL v2.0) and defines the property IDs mappings as well as zoning configuration. That is why modification of this interface needs to be reflected in the mentioned files and followed by rebuilding this module from source code.
Module Structure
The module consists of following components:
- The QML plugin: responsible for interfacing between the Qt Quick application and the Qt IVI Vehicle Properties module.
- The Vehicle Properties Module: a Qt plugin that encapsulates the features defined by the interface configuration (QFace format). It also contains the JNI back end interface. This is a specialized implementation that interacts with the back end service (the one that directly accesses the Android car API).
Vehicle properties are grouped into the following components:
Component name | Property name | Vehicle Property Id // QIviHvac |
---|---|---|
QIviHvac | powerOn | HVAC_POWER_ON |
acOn | HVAC_AC_ON | |
maxAcOn | HVAC_MAX_AC_ON | |
dualOn | HVAC_DUAL_ON | |
autoOn | HVAC_AUTO_ON | |
temperatureCurrent | HVAC_TEMPERATURE_CURRENT | |
temperatureSet | HVAC_TEMPERATURE_SET | |
fanDirection | HVAC_FAN_DIRECTION | |
actualFanSpeed | HVAC_ACTUAL_FAN_SPEED_RPM | |
fanSpeed | HVAC_FAN_SPEED | |
defroster | HVAC_DEFROSTER | |
recircOn | HVAC_RECIRC_ON | |
autoRecircOn | HVAC_AUTO_RECIRC_ON | |
seatVentilation | HVAC_SEAT_VENTILATION | |
maxDefrostOn | HVAC_MAX_DEFROST_ON | |
seatTemperature | HVAC_SEAT_TEMPERATURE | |
sideMirrorHeat | HVAC_SIDE_MIRROR_HEAT | |
steeringWheelHeat | HVAC_STEERING_WHEEL_HEAT | |
temperatureDisplayUnits | HVAC_TEMPERATURE_DISPLAY_UNITS // QIviWindowControl | |
QIviWindowControl | windowPos | WINDOW_POS |
windowMove | WINDOW_MOVE | |
windowLock | WINDOW_LOCK // QIviCarInfo | |
QIviCarInfo | infoModelYear | INFO_MODEL_YEAR |
infoFuelCapacity | INFO_FUEL_CAPACITY | |
infoEvBatteryCapacity | INFO_EV_BATTERY_CAPACITY | |
infoFuelDoorLocation | INFO_FUEL_DOOR_LOCATION | |
infoEvPortLocation | INFO_EV_PORT_LOCATION | |
infoDriverSeat | INFO_DRIVER_SEAT // QIviMirrorControl | |
QIviMirrorControl | mirrorZPos | MIRROR_Z_POS |
mirrorZMove | MIRROR_Z_MOVE | |
mirrorYPos | MIRROR_Y_POS | |
mirrorYMove | MIRROR_Y_MOVE | |
mirrorLock | MIRROR_LOCK | |
mirrorFold | MIRROR_FOLD // QIviSeatControl | |
QIviSeatControl | seatMemorySelect | SEAT_MEMORY_SELECT |
seatMemorySet | SEAT_MEMORY_SET | |
seatBeltBuckled | SEAT_BELT_BUCKLED | |
seatBeltHeightPos | SEAT_BELT_HEIGHT_POS | |
seatBeltHeightMove | SEAT_BELT_HEIGHT_MOVE | |
seatForeAftPos | SEAT_FORE_AFT_POS | |
seatForeAftMove | SEAT_FORE_AFT_MOVE | |
seatBackrestAngle1Pos | SEAT_BACKREST_ANGLE_1_POS | |
seatBackrestAngle1Move | SEAT_BACKREST_ANGLE_1_MOVE | |
seatBackrestAngle2Pos | SEAT_BACKREST_ANGLE_2_POS | |
seatBackrestAngle2Move | SEAT_BACKREST_ANGLE_2_MOVE | |
seatHeightPos | SEAT_HEIGHT_POS | |
seatHeightMove | SEAT_HEIGHT_MOVE | |
seatDepthPos | SEAT_DEPTH_POS | |
seatDepthMove | SEAT_DEPTH_MOVE | |
seatTiltPos | SEAT_TILT_POS | |
seatTiltMove | SEAT_TILT_MOVE | |
seatLumbarForeAftPos | SEAT_LUMBAR_FORE_AFT_POS | |
seatLumbarForeAftMove | SEAT_LUMBAR_FORE_AFT_MOVE | |
seatLumbarSideSupportPos | SEAT_LUMBAR_SIDE_SUPPORT_POS | |
seatLumbarSideSupportMove | SEAT_LUMBAR_SIDE_SUPPORT_MOVE | |
seatHeadrestHeightPos | SEAT_HEADREST_HEIGHT_POS | |
seatHeadrestHeightMove | SEAT_HEADREST_HEIGHT_MOVE | |
seatHeadrestAnglePos | SEAT_HEADREST_ANGLE_POS | |
seatHeadrestAngleMove | SEAT_HEADREST_ANGLE_MOVE | |
seatHeadrestForeAftPos | SEAT_HEADREST_FORE_AFT_POS | |
seatHeadrestForeAftMove | SEAT_HEADREST_FORE_AFT_MOVE | |
seatOccupancy | SEAT_OCCUPANCY // QIviTireControl | |
QIviTireControl | tirePressure | TIRE_PRESSURE |
tirePressureDisplayUnits | TIRE_PRESSURE_DISPLAY_UNITS // QIviLightsControl | |
QIviLightsControl | headlightsState | HEADLIGHTS_STATE |
highbeamLightsState | HIGH_BEAM_LIGHTS_STATE | |
fogLightsState | FOG_LIGHTS_STATE | |
hazardLightsState | HAZARD_LIGHTS_STATE | |
headlightsSwitch | HEADLIGHTS_SWITCH | |
highbeamLightsSwitch | HIGH_BEAM_LIGHTS_SWITCH | |
fogLightsSwitch | FOG_LIGHTS_SWITCH | |
hazardLightsSwitch | HAZARD_LIGHTS_SWITCH | |
cabinLightsState | CABIN_LIGHTS_STATE | |
cabinLightsSwitch | CABIN_LIGHTS_SWITCH | |
readingLightsState | READING_LIGHTS_STATE | |
readingLightsSwitch | READING_LIGHTS_SWITCH | |
nightMode | NIGHT_MODE // QIviFuelControl | |
QIviFuelControl | fuelLevel | FUEL_LEVEL |
fuelDoorOpen | FUEL_DOOR_OPEN | |
fuelLevelLow | FUEL_LEVEL_LOW | |
fuelVolumeDisplayUnits | FUEL_VOLUME_DISPLAY_UNITS | |
fuelConsumptionUnitsDistanceOverVolume | FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME | |
rangeRemaining | RANGE_REMAINING | |
evBatteryLevel | EV_BATTERY_LEVEL | |
evChargePortOpen | EV_CHARGE_PORT_OPEN | |
evChargePortConnected | EV_CHARGE_PORT_CONNECTED | |
evBatteryInstantaneousChargeRate | EV_BATTERY_INSTANTANEOUS_CHARGE_RATE | |
evBatteryDisplayUnits | EV_BATTERY_DISPLAY_UNITS // QIviDoorControl | |
QIviDoorControl | doorPos | DOOR_POS |
doorMove | DOOR_MOVE | |
doorLock | DOOR_LOCK // QIviDriveInfo | |
QIviDriveInfo | perfOdometer | PERF_ODOMETER |
perfVehicleSpeed | PERF_VEHICLE_SPEED | |
perfVehicleSpeedDisplay | PERF_VEHICLE_SPEED_DISPLAY | |
perfSteeringAngle | PERF_STEERING_ANGLE | |
gearSelection | GEAR_SELECTION | |
currentGear | CURRENT_GEAR | |
parkingBrakeAutoApply | PARKING_BRAKE_AUTO_APPLY | |
parkingBrakeOn | PARKING_BRAKE_ON | |
turnSignalState | TURN_SIGNAL_STATE | |
ignitionState | IGNITION_STATE | |
absActive | ABS_ACTIVE | |
tractionControlActive | TRACTION_CONTROL_ACTIVE | |
distanceDisplayUnits | DISTANCE_DISPLAY_UNITS | |
vehicleSpeedDisplayUnits | VEHICLE_SPEED_DISPLAY_UNITS | |
envOutsideTemperature | ENV_OUTSIDE_TEMPERATURE // QIviEngineInfo | |
QIviEngineInfo | engineCoolantTemp | ENGINE_COOLANT_TEMP |
engineOilLevel | ENGINE_OIL_LEVEL | |
engineOilTemp | ENGINE_OIL_TEMP | |
engineRpm | ENGINE_RPM // QIviHWControl | |
QIviHWControl | apPowerBootupReason | AP_POWER_BOOTUP_REASON |
displayBrightness | DISPLAY_BRIGHTNESS |
How to use it
The module can be used by directly interacting with C++ code, or by using the QML plugin. To use the plugin at the C++ code level, follow the steps described in Qt IVI Vehicle Functions Module. The use of the QML plugin is presented in source code of the Qt for Android Automotive vehicle properties example. Integrate this module by following these steps:
- Add the dependencies of the Qt IVI Android Vehicle Properties module to your qmake project file (
*.pro
):QT += iviandroidvehicleproperties ivicore androidextras
- Add the paths to additional dependency libs for android runtime environment:
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
- In the AndroidManifest.xml file add the proper permissions for accessing the VHAL properties (e.g. for HVAC it would be
CONTROL_CAR_CLIMATE
)<uses-permission android:name="android.car.permission.CONTROL_CAR_CLIMATE"/>
- In the QML file add the import statement of this plugin
import QtIvi.Android.VehicleProperties 1.0
- Define an instance of the desired component (e.g. HVAC)
HVAC { id: climateControl }
- The interaction with the vehicle properties is like any typical Qt property
onClicked: { climateControl.setHvacAcOn(!climateControl.hvacAcOn) } text: climateControl.hvacAcOn ? "AC ON" : "AC OFF"
- If the vehicle has an interface with zones, then the interaction with the properties needs to point to a certain zone (see Zoned HVAC Control).
Known issues and limitations
- Currently to deploy an application using this module, additional actions are needed to meet the dependencies:
- Enable AndroidX in gradle.properties file by adding android.useAndroidX=true
- Add android.car.jar package to the APK
For more information, see Deploying an Application on Android.
- The Android build needs to be aligned with the vehicle interface definition used by this module, and a proper
android.car.jar
package needs to be delivered together with the APK like in the Qt for Android Automotive Vehicle Properties example. - The current version of this module uses the JNI back end for accessing the Android Car Service. To use the Qt Remote Objects back end, the module would need adjustments to the source code.
- Property
fuelDoorOpen
is read-only on Android 10, but it can be written from Android 11 onward.
See also Qt for Android and Qt IVI.
Available under certain Qt licenses.
Find out more.