Integrating EV charging station

Last edit: 2023.08.04

TomTom Digital Cockpit's platform contains an IVI service plugin that provides real time data on EV (electric vehicle) charging stations, which allows EV drivers to find suitable charging points near their location. To make use of this service, the car maker (OEM) needs to configure the built-in EV charging station service plugin and to implement the parts specific to their product. This guide explains how to do this.

Architectural overview

This component diagram describes the architecture of the EV charging station integration within TomTom Digital Cockpit:

EV charging station integration component diagram

The components prefixed with "CarMaker" are not provided as part of TomTom Digital Cockpit.

These are:

  • CarMakerProductConfigurationGradlePlugin: The EV charging station IVI service provided by TomTom Digital Cockpit's platform needs to be configured by the car maker (OEM). Values such as the API key to use and other parameters need to be specified.
  • CarMakerEvChargingFrontend: The car maker (OEM) needs to create a UI that allows its end-users to show the list of charging stations. TomTom provides APIs to aid this. For more information on how to create a UI frontend, see the Create a frontend plugin tutorial.

Integrating EV charging station into your product

To be able to use the EV charging station service in your TomTom Digital Cockpit product:

Each of these steps is now described in detail.

Apply the EV charging station plugins

Declare a reference to the EV charging station plugin library in the /build-logic/libraries.versions.toml file:

gradlePluginApiAppsuiteDefaultsEvChargingStation = { module = "com.tomtom.ivi.appsuite.gradle.evchargingstation:api_appsuitedefaults_evchargingstation", version.ref = "iviPlatform" }

Add a dependency to the EV charging station plugin library in the /buildSrc/build.gradle.kts file:

1dependencies {
2 ...
3 implementation(libraries.gradlePluginApiAppsuiteDefaultsEvChargingStation)
4 ...
5}

Apply the EV charging station plugins in your product's build.gradle.kts file:

1plugins {
2 ...
3 id("com.tomtom.ivi.appsuite.evchargingstation.defaults.evchargingstation")
4 id("com.tomtom.ivi.appsuite.evchargingstation.defaults.config")
5}

Explicitly include the EV charging station group (this is an opt-in group) in your product's iviInstances and services in the build.gradle.kts.

1ivi {
2 application {
3 enabled = true
4 iviInstances {
5 create(IviInstanceIdentifier.default) {
6 applyGroups {
7 ...
8 include(
9 IviAppsuite.evChargingStationGroup // explicit opt-in group.
10 )
11 ...
12 }
13 }
14 }
15 services {
16 applyGroups {
17 ...
18 include(
19 IviAppsuite.evChargingStationGroup // explicit opt-in group.
20 )
21 ...
22 }
23 }
24 }
25}

These plugins will add the EvChargingStationService of TomTom Digital Cockpit to your product and will provide a simple way to configure the EV charging station service.

Configure the EV charging station plugins

The built-in EV Charging station plugin, which is provided as part of the TomTom Digital Cockpit platform, requires some parameters to be specified for the plugin configuration. These parameters are used to set up the API key and base URL to use the plugin.

These parameters are configured as explained in:

Using Gradle properties

In this case you can configure the IDs in the local.properties file (which is not supposed to be added to an SCM) or configure the key in the gradle.properties file in your Gradle user home directory.

The available properties are shown in the following example:

For example:

evChargingStationApiKey=my-api-key
evChargingStationBaseUrl=my-base-url

Overriding the static configuration values in Android resources

You can override static configuration values in Android resources using the Configuration Framework.

1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<resources>
3 <!--The EV charging station API key.-->
4 <string name="evChargingStationApiKeyConfigKey">my-EvChargingStation-api-key</string>
5 <!--The EV charging station Base URL .-->
6 <string name="evChargingStationBaseUrlConfigKey">my-EvChargingStation-base-url</string>
7</resources>

If this mechanism is used to override static configuration values, then you must disable the build-time check that ensures values are defined for these keys (since they are now defined in code).

Disable the build-time check by setting the disableEvChargingStationPropertiesBuildTimeCheck property to true in the top-level gradle.properties file:

disableEvChargingStationPropertiesBuildTimeCheck=true

Or by not applying the com.tomtom.ivi.appsuite.evchargingstation.defaults.config Gradle plugin in the [build.gradle.kts] file.

Using a static configuration provider

It is also possible to configure a static configuration provider in the Android Application class that provides the key. For this you can use an EvChargingStationStaticConfigurationProvider instance. Static configurations are created with the configuration generator. See the API reference documentation at IviConfigurationGeneratorConfig.

The static configuration keys are:

Configuration key nameDescription
evChargingStationApiKeyConfigKeyThe EV charging station API key. This can be obtained from your TomTom representative.
evChargingStationBaseUrlConfigKeyThe Base URL. This can be obtained from your TomTom representative.

Disable the build-time check by setting the disableEvChargingStationPropertiesBuildTimeCheck property to true in the top-level gradle.properties file:

disableEvChargingStationPropertiesBuildTimeCheck = true

Another way to disable the build-time check is to not apply the com.tomtom.ivi.appsuite.evchargingstation.defaults.config Gradle plugin.

More information

For more information please reach out to your TomTom representative.