requestEvChargingAvailability

Requests current availability information for a specific charging station, with the option to limit results to compatible charging spots based on connector types and power level.

The main parameter is the EvChargingAvailabilityId of a charging station, which can be obtained from a search result or through a POI details request.

Note: This operation is synchronous and should not be executed on the main thread. Execution on the main thread will block the application and might throw an exception if it involves a network call

Usage example:

// Initialize the EvChargingAvailabilityProvider
val evChargingAvailabilityProvider = EvChargingAvailabilityProviderImplementation(...)

// After obtaining the evChargingAvailabilityId from a search result or a POI details
request,
// create options for EV charging availability
val evChargingAvailabilityOptions = searchResult.searchResultId.evChargingAvailabilityId?.let { chargingAvailabilityId ->
EvChargingAvailabilityOptions(
availabilityId = chargingAvailabilityId,
connectors = setOf(
ConnectorType.Iec62196Type1Ccs,
ConnectorType.Iec62196Type3
),
minPower = Power.kilowatts(5),
maxPower = Power.kilowatts(15)
)
}

// Request EV charging availability
evChargingAvailabilityOptions?.let { options ->
val result = evChargingAvailabilityProvider.requestEvChargingAvailability(options)

if (result.isSuccess()) {
val response = result.value()
// Process the response.
Log.d(response.connectors.first().availability)
} else {
val failure = result.failure()
// Handle failure.
Log.d(failure.message)
}
}

Important: This is a Public Preview API that may experience changes or removal in the future.

Return

The Result containing an EvChargingAvailabilityResponse with availability information if the call succeeds, or a SearchFailure if it fails.

Parameters

options

Specifies the input and filters of the request, such as the charging station's ID.


Requests the current availability of a specific charging station, with the option to restrict results to compatible charging spots based on connector types and/or power level.

The main parameter is the EvChargingAvailabilityId of a charging station, which can be obtained from a search result or through a POI details request.

This is an asynchronous call, and the result will be returned through the provided callback.

Note: The callback is executed on the main thread.

Usage example:

// Initialize the EvChargingAvailabilityProvider
val evChargingAvailabilityProvider = EvChargingAvailabilityProviderImplementation(...)

// After obtaining the evChargingAvailabilityId from either a search result or a
// POI details request, create options for EV charging availability
val evChargingAvailabilityOptions = searchResult.searchResultId.evChargingAvailabilityId?.let { chargingAvailabilityId ->
EvChargingAvailabilityOptions(
availabilityId = chargingAvailabilityId,
connectors = setOf(
ConnectorType.Iec62196Type1Ccs,
ConnectorType.Iec62196Type3
),
minPower = Power.kilowatts(5),
maxPower = Power.kilowatts(15)
)
}

// Create the callback for EV charging availability
val callback = object : EvChargingAvailabilityCallback {
override fun onSuccess(response: EvChargingAvailabilityResponse) {
// Process the response.
Log.d(response.connectors.first().availability)
}

override fun onFailure(failure: SearchFailure) {
// Handle failure.
Log.d(failure.message)
}
}

// Request EV charging availability using the pre-created callback
evChargingAvailabilityOptions?.let { options ->
val cancellable = evChargingAvailabilityProvider.requestEvChargingAvailability(options, callback)

// You can cancel the operation if needed:
cancellable.cancel()
}

Important: This is a Public Preview API that may experience changes or removal in the future.

Return

A Cancellable object that stops the ongoing operation if needed if it hasn't been completed yet.

Parameters

options

Specifies the input and filters of the request, such as the charging station's ID.

callback

The EvChargingAvailabilityCallback invoked when the request has finished, either successfully or with an error. The callback is executed on the main thread.