EvBusyChargingStationNotificationProvider

class EvBusyChargingStationNotificationProvider(var options: EvBusyChargingStationNotificationOptions = EvBusyChargingStationNotificationOptions.Builder().build()) : DriverNotificationProvider

Provides notifications when an EV charging station on the primary route becomes busy and an alternative route exists.

This provider listens for route updates and analyzes the navigation routes to detect if the primary route's charging station is reported as busy. If so, and if there is at least one alternative route available, it generates an EvBusyChargingStationNotification containing the busy station's ID and a suggested alternative route.

The provider uses EvBusyChargingStationNotificationOptions for configuration.

Notifications are generated only when:

  • The primary route contains a busy EV charging station (as indicated by route notifications).

  • There is at least one alternative route available.

The provider continues to send notifications even if the user selects a worse route. Currently, filtering of this state should be handled by the application consuming this API.

Parameters

options

configuration options for the provider

See also

for the notification generated by this provider

for configuring the provider

Constructors

constructor(options: EvBusyChargingStationNotificationOptions = EvBusyChargingStationNotificationOptions.Builder().build())

Properties

Functions

Link copied to clipboard
open override fun onAttached(mapboxNavigation: MapboxNavigation)

This method updates the internal state flow with the provided MapboxNavigation instance, allowing the provider to start tracking notifications.

Link copied to clipboard
open override fun onDetached(mapboxNavigation: MapboxNavigation)

Detaches the MapboxNavigation instance from the provider. This method clears the internal state flow by setting it to null, stopping the provider from tracking notifications.

Link copied to clipboard
open override fun trackNotifications(): Flow<DriverNotification>

Returns a Flow of DriverNotifications related to busy EV charging stations. It filters for updates where the reason is RoutesExtra.ROUTES_UPDATE_REASON_ALTERNATIVE, then analyzes the primary route for busy EV charging stations. If a busy station is found and at least one alternative route exists, it emits an EvBusyChargingStationNotification containing the busy station's ID and a suggested alternative route.