DefaultVehicleProvider
public class DefaultVehicleProvider : VehicleProvider
Provider that exposes a getter for the vehicle snapshot and a subscription mechanism for vehicle snapshot changes.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes default vehicle provider.
Declaration
Swift
public init()
-
Snapshot of the current vehicle state.
Declaration
Swift
public var vehicleSnapshot: Vehicle { get }
-
Registers vehicle update observer for all vehicle parameter updates.
Throws
Throws:VehicleError.alreadyRegisteredObserver
upon adding the same observer more than once.Declaration
Swift
public func registerVehicleUpdateObserver(_ observer: AnyVehicleUpdateObserver) throws
Parameters
observer
The observer to be registered.
-
Registers vehicle update observer for specific vehicle parameter updates.
Throws
Throws:VehicleError.alreadyRegisteredObserver
upon adding the same observer more than once.Declaration
Swift
public func registerVehicleUpdateObserver( _ observer: AnyVehicleUpdateObserver, options: [VehicleUpdateOption] ) throws
Parameters
observer
The observer to be registered.
parameters
Specify which parameters should trigger observer notifications.
-
Removes previously registered observer.
Declaration
Swift
public func unregisterVehicleUpdateObserver(_ observer: AnyVehicleUpdateObserver)
Parameters
observer
The registered observer.
-
Updates the vehicle state.
Throws
VehicleError.invalidVehicleParameter
If vehicleparameters
are not valid for the current vehicle type.Declaration
Swift
public func updateVehicleState(with parameters: [VehicleParameter]) throws
Parameters
parameters
The vehicle parameters update.
-
Set vehicle parameters, compliant with vehicle type.
Throws
VehicleError.invalidVehicleParameter
IfvehicleParameters
are not valid for givenvehicleType
.VehicleError.unsupportedModelID
when model ID is given for a non-motorized vehicle.
Declaration
Swift
public func setVehicle( vehicleType: VehicleType, vehicleModelID: VehicleModelID? = nil, vehicleParameters: [VehicleParameter] ) throws
Parameters
vehicleType
The vehicle type.
vehicleModelID
Specifies the Model ID of the vehicle as obtained from the TomTom Vehicle Database. It allows calculating an EV route without specifying the vehicle’s consumption and charging parameters. Only applicable if the
vehicleType
is aMotorized
type. In case that the string is blank (empty or only whitespace) it is considered as not specified.vehicleParameters
The vehicle parameters.