Class WarnerEngine
- All Implemented Interfaces:
ElectronicHorizonListener
Provides the core functionality for generating and managing navigation warnings.
WarnerEngine processes Electronic Horizon data and determines when various types
of warnings should be issued. It is used with ElectronicHorizonListener,
which supply the road topology and positional updates required for warning evaluation.
The engine monitors enabled warning types and notifies registered listeners when new warnings become available.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
Constructor Summary
ConstructorsConstructorDescriptionWarnerEngine(SDKNativeEngine sdkEngine, WallClock wallClock, List<WarningType> enabledWarnings) Creates a new instance of this class.WarnerEngine(SDKNativeEngine sdkEngine, List<WarningType> enabledWarnings) Creates a new instance of this class.WarnerEngine(List<WarningType> enabledWarnings) Creates a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomWarningProvider(CustomWarningProvider customWarningProvider, SegmentDataLoaderOptions segmentDataLoaderOptions) Registers a custom warning provider.voidaddEnabledWarnings(List<WarningType> warningTypes) Adds the given warning types to the set of warnings monitored by the engine.voidaddWarningListener(WarningListener warningListener) Registers a listener that will receive warning notifications.voidUnregisters all custom warning providers.voidMarks all currently active warnings as passed (DistanceType.PASSED), notifies all registeredWarningListenerinstances on the main thread, and then clears these warnings from their corresponding registries by invoking the appropriateWarningsRegistry.clear<Type>methods.getCustomWarningNotificationDistances(int customWarningType) Returns the warning notification distances for the specified custom warning type.Returns the current list of enabled warning types.Gets the currently configuredTimingProfile.getWarningNotificationDistances(WarningType warningType) Returns the warning notification distances for the requested warning type.Gets the currently configuredWarningOptions.Returns the centralized access point for retrieving full metadata of any supported warning category (e.g., safety cameras, truck restrictions, etc.).voidonElectronicHorizonUpdated(ElectronicHorizonErrorCode errorCode, ElectronicHorizonUpdate update) Called whenever the electronic horizon subsystem produces: a new update, an error,voidremoveCustomWarningProvider(CustomWarningProvider customWarningProvider) Unregisters a custom warning provider.voidremoveEnabledWarnings(List<WarningType> warningTypes) Removes the given warning types from the set of warnings monitored by the engine.voidremoveWarningListener(WarningListener warningListener) Unregisters a previously added warning listener.voidsetCustomWarningNotificationDistances(int customWarningType, WarningNotificationDistances warningNotificationDistances) Sets the warning notification distances for the specified custom warning type.voidsetEnabledWarnings(List<WarningType> warningTypes) Replaces the current set of enabled warning types with the provided list.voidsetTimingProfile(TimingProfile value) Sets theTimingProfileof the current position.voidsetWarningNotificationDistances(WarningType warningType, WarningNotificationDistances warningNotificationDistances) Sets the warning notification distances for the specified warning type.voidsetWarningOptions(WarningOptions value) Sets theWarningOptionsand updates the configuration for all the warners.
-
Constructor Details
-
WarnerEngine
Creates a new instance of this class.
- Parameters:
enabledWarnings-The list of warning types that should be monitored and processed by the engine. Only warnings of these types will be generated.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
WarnerEngine
public WarnerEngine(@NonNull SDKNativeEngine sdkEngine, @NonNull List<WarningType> enabledWarnings) throws InstantiationErrorException Creates a new instance of this class.
- Parameters:
sdkEngine-A
SDKEngineinstance.enabledWarnings-The list of warning types that should be monitored and processed by the engine. Only warnings of these types will be generated.
- Throws:
InstantiationErrorException-Indicates what went wrong when the instantiation was attempted.
-
-
Method Details
-
addEnabledWarnings
Adds the given warning types to the set of warnings monitored by the engine.
After this call, the engine will begin generating warnings for all types included in
warningTypes, in addition to those that are already enabled.- Parameters:
warningTypes-Warning types to be added to the engine's active monitoring set.
-
removeEnabledWarnings
Removes the given warning types from the set of warnings monitored by the engine.
After this call, the engine will stop generating warnings for all types included in
warningTypes, while other enabled types remain unaffected.- Parameters:
warningTypes-Warning types to be removed from the engine's active monitoring set.
-
setEnabledWarnings
Replaces the current set of enabled warning types with the provided list.
After this call, the engine will monitor and generate warnings only for types included in
warningTypes.- Parameters:
warningTypes-The complete new set of warning types the engine should track.
-
getEnabledWarnings
Returns the current list of enabled warning types. If the WarnerEngine was retrieved from the
Navigator, it will also contain all the warnings enabled for which listeners are set.- Returns:
The currect list instance.
-
addWarningListener
Registers a listener that will receive warning notifications.
- Parameters:
warningListener-The listener instance that should be notified when new warnings are generated.
-
removeWarningListener
Unregisters a previously added warning listener.
- Parameters:
warningListener-The listener instance that should no longer receive warning notifications.
-
getWarningsRegistry
Returns the centralized access point for retrieving full metadata of any supported warning category (e.g., safety cameras, truck restrictions, etc.).
WarningsRegistryclass exposes getter methods, each returning the detailed warning object for the given identifier. Use this getter to look up complete warning information by its id, as provided throughWarningListener.onWarning.- Returns:
The centralized
WarningsRegistryinstance.
-
getCustomWarningNotificationDistances
@NonNull public WarningNotificationDistances getCustomWarningNotificationDistances(int customWarningType) Returns the warning notification distances for the specified custom warning type.
Unlike
getWarningNotificationDistances(com.here.sdk.navigation.WarningType), which operates on aWarningType, this method targets a specific custom warning category identified bycustomWarningType, as defined inCustomWarning.customWarningTypeandWarning.customWarningType.- Parameters:
customWarningType-The identifier of the custom warning type for which the notification distances are requested.
- Returns:
The warning notification distances configured for the given
customWarningType. If no distances have been explicitly set for this type, a defaultWarningNotificationDistancesvalue is returned.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
finalizeGivenWarnings
public void finalizeGivenWarnings()Marks all currently active warnings as passed (
DistanceType.PASSED), notifies all registeredWarningListenerinstances on the main thread, and then clears these warnings from their corresponding registries by invoking the appropriateWarningsRegistry.clear<Type>methods.This method triggers notifications only for enabled warners. Warning processing may occur asynchronously unless synchronous mode is enabled.
Note: Although each warning type can also be cleared manually via the respective
WarningsRegistry.clear<Type>()methods,finalizeGivenWarnings()provides a unified way to flush all active warnings after they have been reported as passed. If this method is not invoked, warnings will continue to accumulate in the registry according to the configured warning-generation options. -
addCustomWarningProvider
public void addCustomWarningProvider(@NonNull CustomWarningProvider customWarningProvider, @NonNull SegmentDataLoaderOptions segmentDataLoaderOptions) Registers a custom warning provider.
The registered provider participates in warning evaluation and is invoked to generate custom warnings based on the current vehicle position.
- Parameters:
customWarningProvider-A provider responsible for generating custom warnings.
segmentDataLoaderOptions-Specifies which data should be loaded by the
SegmentDataLoader.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
removeCustomWarningProvider
Unregisters a custom warning provider.
After removal, the provider will no longer participate in warning evaluation and will not generate custom warnings.
- Parameters:
customWarningProvider-The provider to be removed.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
clearCustomWarningProviders
public void clearCustomWarningProviders()Unregisters all custom warning providers.
After this call, no custom warning providers will participate in warning evaluation until new providers are registered.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
getWarningOptions
Gets the currently configured
WarningOptions.Provides configuration parameters for all the warners.
- Returns:
Options that define warning behavior for all the warners.
-
setWarningOptions
Sets the
WarningOptionsand updates the configuration for all the warners.Provides configuration parameters for all the warners.
- Parameters:
value-Options that define warning behavior for all the warners.
-
getTimingProfile
Gets the currently configured
TimingProfile.Configures the base notification thresholds used for delivering navigation warnings. The effective thresholds depend on the selected
TimingProfileand may adjust automatically according to the current speed limit:- For
TimingProfile.FAST_SPEED, thresholds apply when the current speed limit is above 100 km/h (62 mph). - For
TimingProfile.REGULAR_SPEED, thresholds apply when the current speed limit is above 60 km/h (37 mph). - For
TimingProfile.SLOW_SPEED, thresholds apply when the current speed limit is 60 km/h (37 mph) or below.
Note: Custom threshold values can be set, but these timing-profile rules will still apply.
- Returns:
The timing profile that defines when navigation warnings should be triggered.
- For
-
onElectronicHorizonUpdated
public void onElectronicHorizonUpdated(@Nullable ElectronicHorizonErrorCode errorCode, @Nullable ElectronicHorizonUpdate update) Called whenever the electronic horizon subsystem produces:
- a new update,
- an error,
The client must inspect
error_codeto determine whether the call represents an error or a valid update.- Specified by:
onElectronicHorizonUpdatedin interfaceElectronicHorizonListener- Parameters:
errorCode-The error associated with the horizon computation.
nullmeans no error.update-The update describing the current electronic horizon state. May be
nullif an update could not be produced.Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-