Package-level declarations

This package contains the VehicleElectricEngineService interface which provides access to state information coming from the electric vehicle (EV) or hybrid vehicle properties.

Electric engine service

The electric engine service is an IVI service. It is responsible for providing access to state information coming from electric vehicle (EV) or hybrid vehicle properties. The Android vehicle hardware abstraction layer (VHAL) is used to determine the state of the provided properties.

Using the electric engine service API

To use the electric engine service, add a dependency to the VehicleElectricEngineService to your gradle file:

dependencies {
implementation("com.tomtom.ivi.platform:platform_vehiclefunctions_api_service_vehicleelectricengine")
}

To get access to the VehicleElectricEngineService API, you need to first get a VehicleElectricEngineServiceApi instance by calling the companion function VehicleElectricEngineService.createApi(...).

val vehicleElectricEngineService =
VehicleElectricEngineService.createApi(lifecycleOwner, iviServiceProvider)

Once you have the VehicleElectricEngineServiceApi instance, you can use it to interact with the service API, and observe the properties provided by the service.

val isEvBatteryChargeLevelWhAvailable =
vehicleElectricEngineService.evBatteryChargeLevelWh.map { vehicleProperty ->
when {
vehicleProperty == null -> false // Property is not supported.
vehicleProperty.value == null -> false // Property is supported but not available.
else -> true // Property is supported and available.
}
}

Note: The service may not be ready when a client calls the service API. Check the service availability by observing the serviceAvailable property:

vehicleElectricEngineService.serviceAvailable.observe(lifecycleOwner) {
if (it) {
// Service is available.
} else {
// Service is not available.
}
}

Types

Link copied to clipboard

A service interface that provides access to state information, coming through the VHAL as properties of electric (EV) or hybrid vehicles.