WarnerEngine
public class WarnerEngine : ElectronicHorizonDelegate
extension WarnerEngine: NativeBase
extension WarnerEngine: Hashable
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 ElectronicHorizonDelegate,
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.
-
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(enabledWarnings: [WarningType]) throwsParameters
enabledWarningsThe list of warning types that should be monitored and processed by the engine. Only warnings of these types will be generated.
-
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(sdkEngine: SDKNativeEngine, enabledWarnings: [WarningType]) throwsParameters
sdkEngineA
SDKEngineinstance.enabledWarningsThe list of warning types that should be monitored and processed by the engine. Only warnings of these types will be generated.
-
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(sdkEngine: SDKNativeEngine, wallClock: WallClock, enabledWarnings: [WarningType]) throwsParameters
sdkEngineA
SDKEngineinstance.wallClockA
WallClockinstance.enabledWarningsThe list of warning types that should be monitored and processed by the engine. Only warnings of these types will be generated.
-
Options that define warning behavior for all the warners. Provides configuration parameters for all the warners.
Declaration
Swift
public var warningOptions: WarningOptions { get set } -
The timing profile that defines when navigation warnings should be triggered. 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.fastSpeed, thresholds apply when the current speed limit is above 100 km/h (62 mph). - For
TimingProfile.regularSpeed, thresholds apply when the current speed limit is above 60 km/h (37 mph). - For
TimingProfile.slowSpeed, 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.
Declaration
Swift
public var timingProfile: TimingProfile { get set } - For
-
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.Declaration
Swift
public func onElectronicHorizonUpdated(errorCode: ElectronicHorizonErrorCode?, update: ElectronicHorizonUpdate?)Parameters
errorCodeThe error associated with the horizon computation.
nilmeans no error.updateThe update describing the current electronic horizon state. May be
nilif an update could not be produced. -
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
WarnerEngine.addEnabledWarnings(...).warningTypes, in addition to those that are already enabled.Declaration
Swift
public func addEnabledWarnings(warningTypes: [WarningType])Parameters
warningTypesWarning types to be added to the engine’s active monitoring set.
-
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
WarnerEngine.removeEnabledWarnings(...).warningTypes, while other enabled types remain unaffected.Declaration
Swift
public func removeEnabledWarnings(warningTypes: [WarningType])Parameters
warningTypesWarning types to be removed from the engine’s active monitoring set.
-
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
WarnerEngine.setEnabledWarnings(...).warningTypes.Declaration
Swift
public func setEnabledWarnings(warningTypes: [WarningType])Parameters
warningTypesThe complete new set of warning types the engine should track.
-
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.Declaration
Swift
public func getEnabledWarnings() -> [WarningType]Return Value
The currect list instance.
-
Registers a listener that will receive warning notifications.
Declaration
Swift
public func addWarningDelegate(_ warningListener: WarningDelegate)Parameters
warningListenerThe listener instance that should be notified when new warnings are generated.
-
Unregisters a previously added warning listener.
Declaration
Swift
public func removeWarningDelegate(_ warningListener: WarningDelegate)Parameters
warningListenerThe listener instance that should no longer receive warning notifications.
-
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.Declaration
Swift
public func getWarningsRegistry() -> WarningsRegistryReturn Value
The centralized
WarningsRegistryinstance. -
Returns the warning notification distances for the requested warning type.
Note:
WarningType.customis not a valid value for this method. UseWarnerEngine.getCustomWarningNotificationDistances(...)to retrieve distances for a specific custom warning type.Declaration
Swift
public func getWarningNotificationDistances(warningType: WarningType) -> WarningNotificationDistancesParameters
warningTypeThe warning type for which the notification distances will be returned. Must not be
WarningType.custom.Return Value
The warning notification distances for the given
WarnerEngine.getWarningNotificationDistances(...).warningType. IfWarnerEngine.getWarningNotificationDistances(...).warningTypeisWarningType.custom, a defaultWarningNotificationDistancesvalue is returned. -
Sets the warning notification distances for the specified warning type.
Note:
WarningType.customis not a valid value for this method. UseWarnerEngine.setCustomWarningNotificationDistances(...)to configure distances for a specific custom warning type.Declaration
Swift
public func setWarningNotificationDistances(warningType: WarningType, warningNotificationDistances: WarningNotificationDistances)Parameters
warningTypeThe warning type for which the warning notification distances will be set. Must not be
WarningType.custom.warningNotificationDistancesThe warning notification distances to be set for the specified warning type.
-
Returns the warning notification distances for the specified custom warning type.
Unlike
WarnerEngine.getWarningNotificationDistances(...), which operates on aWarningType, this method targets a specific custom warning category identified byWarnerEngine.getCustomWarningNotificationDistances(...).customWarningType, as defined inCustomWarning.customWarningTypeandWarning.customWarningType.Declaration
Swift
public func getCustomWarningNotificationDistances(customWarningType: Int32) -> WarningNotificationDistancesParameters
customWarningTypeThe identifier of the custom warning type for which the notification distances are requested.
Return Value
The warning notification distances configured for the given
WarnerEngine.getCustomWarningNotificationDistances(...).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.
-
Sets the warning notification distances for the specified custom warning type.
Unlike
WarnerEngine.setWarningNotificationDistances(...), which applies settings to aWarningType, this method allows configuring notification distances independently for each custom warning category identified byWarnerEngine.setCustomWarningNotificationDistances(...).customWarningType, as defined inCustomWarning.customWarningTypeandWarning.customWarningType.Declaration
Swift
public func setCustomWarningNotificationDistances(customWarningType: Int32, warningNotificationDistances: WarningNotificationDistances)Parameters
customWarningTypeThe identifier of the custom warning type for which the notification distances should be set.
warningNotificationDistancesThe warning notification distances to be applied for the specified
WarnerEngine.setCustomWarningNotificationDistances(...).customWarningType. -
Marks all currently active warnings as passed (
DistanceType.PASSED), notifies all registeredWarningDelegateinstances 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.Declaration
Swift
public func finalizeGivenWarnings() -
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.
Declaration
Swift
public func addCustomWarningProvider(customWarningProvider: CustomWarningProvider, segmentDataLoaderOptions: SegmentDataLoaderOptions)Parameters
customWarningProviderA provider responsible for generating custom warnings.
segmentDataLoaderOptionsSpecifies which data should be loaded by the
SegmentDataLoader. -
Unregisters a custom warning provider.
After removal, the provider will no longer participate in warning evaluation and will not generate custom warnings.
Declaration
Swift
public func removeCustomWarningProvider(customWarningProvider: CustomWarningProvider)Parameters
customWarningProviderThe 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.
-
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.
Declaration
Swift
public func clearCustomWarningProviders()