VehicleProvider

public protocol VehicleProvider

Responsible for control, access and notification of the vehicle state.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Snapshot of the current vehicle state. It is expected to be called from any queue.

    Declaration

    Swift

    var vehicleSnapshot: Vehicle { get }
  • Registers vehicle update observer for all vehicle parameter updates. It is expected to be called on the main queue.

    Throws

    Throws:VehicleError.alreadyRegisteredObserver upon adding the same observer more than once.

    Declaration

    Swift

    func addObserver(_ observer: some VehicleUpdateObserver) throws

    Parameters

    observer

    The observer to be registered.

  • Registers vehicle update observer for specific vehicle parameter updates. It is expected to be called on the main queue.

    Throws

    Throws:VehicleError.alreadyRegisteredObserver upon adding the same observer more than once.

    Declaration

    Swift

    func addObserver(_ observer: some VehicleUpdateObserver, for options: [VehicleUpdateOption]) throws

    Parameters

    observer

    The observer to be registered.

    options

    Specify which parameter changes should trigger observer notifications.

  • Removes previously registered observer.

    Important

    Observer-related requests should be called on the main queue. Failure to do so may result in erratic behavior.

    Declaration

    Swift

    func removeObserver(_ observer: some VehicleUpdateObserver)

    Parameters

    observer

    The registered observer.