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

This package contains the VehicleSurroundingsSensorsService interface which provides access to state information coming from the vehicle surroundings sensors.

Vehicle surroundings sensors service

The vehicle surroundings sensors service is an IVI service. It is responsible for providing access to state information coming from the vehicle surroundings sensors. The Android vehicle hardware abstraction layer (VHAL) is used to determine the state of the provided sensors.

Using vehicle surroundings sensors service API

To use the vehicle surroundings sensors service, add a dependency to the VehicleSurroundingsSensorsService to your gradle file:

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

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

val vehicleSurroundingsSensorsService =
VehicleSurroundingsSensorsService.createApi(lifecycleOwner, iviServiceProvider)

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

val isLeftSideVehicleApproachingSensorAvailable =
vehicleSurroundingsSensorsService.isLeftSideVehicleApproachingAvailable.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:

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

Types

Link copied to clipboard
interface VehicleSurroundingsSensorsService

The VehicleSurroundingsSensorsService interface provides access to state information coming from the vehicle sensors. Not all vehicles have all sensors onboard and the interface provides information about the supported states. Sensors cannot act and this service is therefore read-only.