Package com.tomtom.ivi.platform.vehiclefunctions.api.service.vehiclespecification

The VehicleSpecificationService interface provides information about the vehicle's specifications, containing physical vehicle properties.

Vehicle specification service

The vehicle specification service is an IVI service. It is responsible for information about the vehicle's specifications, containing physical vehicle properties. The Android vehicle hardware abstraction layer (VHAL) is used to determine the state of the provided properties.

Using the vehicle specification service API

To use the vehicle specification service, add a dependency to the VehicleSpecificationService to your gradle file:

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

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

val vehicleSpecificationService =
VehicleSpecificationService.createApi(lifecycleOwner, iviServiceProvider)

Once you have the VehicleSpecificationServiceApi instance, you can use it to interact with the service API, and observe any property provided by the service.

val weight =
vehicleSpecificationService.weightKg.map { vehicleProperty ->
when {
vehicleProperty == null -> false // Property is not supported
vehicleProperty.value == null -> false // Property is supported but not available
else -> vehicleProperty.value // 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:

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

Types

Link copied to clipboard
interface VehicleSpecificationService

A service interface that provides information about the vehicle's specifications, containing physical vehicle properties.