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

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(enabledWarnings: [WarningType]) throws

    Parameters

    enabledWarnings

    The 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

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(sdkEngine: SDKNativeEngine, enabledWarnings: [WarningType]) throws

    Parameters

    sdkEngine

    A SDKEngine instance.

    enabledWarnings

    The 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

    InstantiationError Indicates what went wrong when the instantiation was attempted.

    Declaration

    Swift

    public init(sdkEngine: SDKNativeEngine, wallClock: WallClock, enabledWarnings: [WarningType]) throws

    Parameters

    sdkEngine

    A SDKEngine instance.

    wallClock

    A WallClock instance.

    enabledWarnings

    The 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 TimingProfile and may adjust automatically according to the current speed limit:

    Note: Custom threshold values can be set, but these timing-profile rules will still apply.

    Declaration

    Swift

    public var timingProfile: TimingProfile { get set }
  • Called whenever the electronic horizon subsystem produces:

    • a new update,
    • an error,

    The client must inspect error_code to determine whether the call represents an error or a valid update.

    Declaration

    Swift

    public func onElectronicHorizonUpdated(errorCode: ElectronicHorizonErrorCode?, update: ElectronicHorizonUpdate?)

    Parameters

    errorCode

    The error associated with the horizon computation. nil means no error.

    update

    The update describing the current electronic horizon state. May be nil if 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

    warningTypes

    Warning 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

    warningTypes

    Warning 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

    warningTypes

    The 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

    warningListener

    The 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

    warningListener

    The 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.). WarningsRegistry class 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 through WarningListener.onWarning.

    Declaration

    Swift

    public func getWarningsRegistry() -> WarningsRegistry

    Return Value

    The centralized WarningsRegistry instance.

  • Returns the warning notification distances for the requested warning type.

    Note: WarningType.custom is not a valid value for this method. Use WarnerEngine.getCustomWarningNotificationDistances(...) to retrieve distances for a specific custom warning type.

    Declaration

    Swift

    public func getWarningNotificationDistances(warningType: WarningType) -> WarningNotificationDistances

    Parameters

    warningType

    The 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. If WarnerEngine.getWarningNotificationDistances(...).warningType is WarningType.custom, a default WarningNotificationDistances value is returned.

  • Sets the warning notification distances for the specified warning type.

    Note: WarningType.custom is not a valid value for this method. Use WarnerEngine.setCustomWarningNotificationDistances(...) to configure distances for a specific custom warning type.

    Declaration

    Swift

    public func setWarningNotificationDistances(warningType: WarningType, warningNotificationDistances: WarningNotificationDistances)

    Parameters

    warningType

    The warning type for which the warning notification distances will be set. Must not be WarningType.custom.

    warningNotificationDistances

    The 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 a WarningType, this method targets a specific custom warning category identified by WarnerEngine.getCustomWarningNotificationDistances(...).customWarningType, as defined in CustomWarning.customWarningType and Warning.customWarningType.

    Declaration

    Swift

    public func getCustomWarningNotificationDistances(customWarningType: Int32) -> WarningNotificationDistances

    Parameters

    customWarningType

    The 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 default WarningNotificationDistances value 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 a WarningType, this method allows configuring notification distances independently for each custom warning category identified by WarnerEngine.setCustomWarningNotificationDistances(...).customWarningType, as defined in CustomWarning.customWarningType and Warning.customWarningType.

    Declaration

    Swift

    public func setCustomWarningNotificationDistances(customWarningType: Int32, warningNotificationDistances: WarningNotificationDistances)

    Parameters

    customWarningType

    The identifier of the custom warning type for which the notification distances should be set.

    warningNotificationDistances

    The warning notification distances to be applied for the specified WarnerEngine.setCustomWarningNotificationDistances(...).customWarningType.

  • Marks all currently active warnings as passed (DistanceType.PASSED), notifies all registered WarningDelegate instances 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

    customWarningProvider

    A provider responsible for generating custom warnings.

    segmentDataLoaderOptions

    Specifies 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

    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.

  • 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()