LogoLogo
ProductsUse casesDocsSupport
  • Introducing DriveKit
  • DriveKit Guides
  • Get started with drivekit
    • Trip recording lifecycle
    • iOS
      • 🚀Quick start
      • Advanced configurations
      • References
      • iOS DriveKit Demo App
    • Android
      • 🚀Quick start
      • Advanced configurations
      • References
      • Android DriveKit Demo App
      • Android 15 Migration guide
      • Android 14 Migration guide
      • Troubleshooting
  • Trip analysis
    • Introduction
    • iOS
      • Permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (iOS)
    • Android
      • Runtime permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
      • Android
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
    • REST services
      • Trip
      • References
    • Trip Simulator
      • iOS
      • Android
  • PERMISSIONS UTILS
    • Introduction
    • User interface
      • iOS
        • Get started
        • Main configurations
      • Android
        • Get started
        • Main configurations
  • COMMON UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
    • References
  • DRIVER DATA
    • Introduction
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
      • Android
        • Get Started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
  • Driver Data Timeline UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • Vehicle
    • Introduction
    • iOS
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (iOS)
    • Android
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Main configurations
        • Advanced configurations
      • Android
        • Get started
        • Main configurations
        • Advanced configurations
  • DRIVER ACHIEVEMENT
    • Introduction
    • iOS
      • Get started
    • Android
      • Get Started
    • User interface
      • iOS
      • Android
  • CHALLENGE
    • Introduction
    • Important challenge rules
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
      • Android
        • Get started
  • GROUP
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • React Native
    • Get started
    • Integration
  • Flutter
    • Get started
    • Integration
  • Push services
    • Introduction
    • Push Trip Data
    • Push Deleted trip
    • Push Crash Data
    • Push Diagnosis Data
  • ADMIN SERVICES
    • Beacon
      • Add
      • Replace
      • Delete
      • Configuration
    • Challenges
      • List of challenges
      • Challenge details
      • Registered users
      • Challenge ranking
      • Users' progress
      • Definitions
    • Customer
      • Activity timeline
    • Driver
      • Timeline
      • Synthesis
      • Identity
      • Status
      • Add or update a metadata
      • Vehicles
      • Profile
      • Application diagnoses
    • Drivers
      • Account
      • Statistics
      • Ranking
      • Expired accounts
    • Group
      • Timeline
      • Synthesis
    • Trips
      • Add or update a metadata
      • Delete a metadata
    • Vehicle
      • Create
      • Characteristics
      • Configuration
      • Statistics
      • Update mileage
      • Tire and brake wear update
      • References
  • Crashes
    • Annotate a crash
    • Revoke crash location URL
  • ENTERPRISE SERVICES
    • Introduction
    • Teams
      • Create a team
      • List of teams
      • Enable or disable a team
    • Hyper-admins
      • Create a hyper-admin
      • List of hyper-admins
      • Delete a hyper-admin
    • Monitoring
      • Get a push trip data report
      • Get a push crash data report
      • Request to retry failed trips
      • Request to retry failed crashes
      • Get the status of a task
  • Release notes
    • Changelog
      • iOS
      • Android
      • UI iOS
      • UI Android
Powered by GitBook
On this page
  • Create a custom vehicle
  • Synchronize vehicle list
  • Retrieve local vehicle list
  • Replace a vehicle
  • Replace a car
  • Delete a vehicle
  • Rename a vehicle
  • Change the detection mode of a vehicle

Was this helpful?

Export as PDF
  1. Vehicle
  2. iOS

Vehicle management

DriveKit Vehicle component manages cars and trucks vehicles.

Methods presented in this part are available in the DriveKitVehicle class

Create a custom vehicle

It is possible to create a custom vehicle from your own data. Create your vehicle using the method:

func createCustomVehicle(
    characteristics: DKVehicleCharacteristics,
    name: String? = nil,
    id: String,
    completionHandler: @escaping (DKVehicleManagerStatus, DKVehicle?) -> Void
)

Each vehicle will have a unique identifier and this unique ID will be added into the trip synchronization response.

This method have the following parameters:

Name
Type
Description

characteristics

Characteristics of the vehicle you want to create. Model is detailed in the References part.

name

String

The name of the vehicle you want to create

id

String

The unique identifier of the vehicle you want to create

Check the DKVehicleManagerStatus value to ensure your vehicle is correctly created:

Value
Description

success

Vehicle is successfully created and saved in the local database.

invalidCharacteristics

Vehicle is not created and not saved in the local database because provided characteristics are not valid.

vehicleIdAlreadyUsed

Vehicle is not created and not saved in the local database because the provided vehicleId already exists.

onlyOneGpsVehicleAllowed

This value is not returned for this service.

error

Vehicle is not created and not saved in the local database because there was an unexpected error.

e.g: User not logged to DriveKit

Synchronize vehicle list

You can retrieve the user’s vehicle list from the DriveQuant servers by calling the following method:

func getVehiclesOrderByNameAsc(
    type: DKVehicleSynchronizationType = .defaultSync, 
    completionHandler: @escaping (DKVehicleSyncStatus, [DKVehicle]) -> Void
) 

This method have the following parameter:

Name
Type
Description

type

DKVehicleSynchronizationType

Can be defaultSync or cache.

- defaultSync will synchronize the vehicles by calling the DriveQuant servers

- cache will retrieve the vehicles already synchronized in the local database.

Retrieve local vehicle list

You can retrieve the list of vehicles stored in the DriveKit local database by calling the previous method but with the type parameter to .cache.

Replace a vehicle

Instead of deleting and then creating a new vehicle, you can use only one method to replace an existing vehicle.

A previously paired beacon to that vehicle is automatically paired to the new vehicle.

Replace a car

func replaceWithCarVehicle(
        oldVehicleId: String,
        characteristics: DKCarVehicleCharacteristics,
        name: String? = nil,
        liteConfig: Bool = false,
        completionHandler: @escaping (DKVehicleReplaceStatus, DKVehicle?) -> Void
)

This method have the following parameters:

Name
Type
Description

oldVehicleId

String

The unique identifier of the car you want to replace

characteristics

Characteristics of the car you want to create

name

String

The name of the car

liteConfig

Boolean

Advanced configuration. Leave this parameter as false.

Replace a truck

func replaceWithTruckVehicle(
        oldVehicleId: String,
        characteristics: DKTruckVehicleCharacteristics,
        name: String? = nil,
        completionHandler: @escaping (DKVehicleReplaceStatus, DKVehicle?) -> Void
)

This method have the following parameters:

Name
Type
Description

oldVehicleId

String

The unique identifier of the truck you want to replace

characteristics

Characteristics of the truck you want to create

name

String

The name of the truck

Delete a vehicle

When you delete a vehicle, a previously paired beacon or Bluetooth device to that vehicle is automatically unpaired and released from the vehicle. By this way, you can immediately pair the beacon or the Bluetooth device to another vehicle.

To delete a vehicle, you have to call the following method:

func deleteVehicle(
    vehicleId: String,
    completionHandler: @escaping (DKVehicleManagerStatus) -> Void
)

This method have the following parameter:

Name
Type
Description

vehicleId

String

The identifier of the vehicle that you want to delete.

Check the DKVehicleManagerStatus value to ensure your vehicle is successfully deleted:

Value
Description

success

Vehicle is successfully deleted and changes are saved in the local database.

unknownVehicle

The specified vehicle could not be deleted because the vehicle id is not a vehicle or belongs to another user account.

invalidCharacteristics

This value is not returned for this service.

vehicleIdAlreadyUsed

This value is not returned for this service.

onlyOneGpsVehicleAllowed

This value is not returned for this service.

error

Vehicle is not deleted and changes are not saved in the local database because there was an unexpected error.

e.g: No network

Rename a vehicle

To rename a vehicle, you have to call the following method:

func renameVehicle(
    name: String,
    vehicleId: String,
    completionHandler: @escaping (DKVehicleManagerStatus) -> Void
) 

This method have the following parameters:

Name
Type
Description

name

String

The new name for the vehicle

vehicleId

String

The identifier of the vehicle that you want to rename

Check the DKVehicleManagerStatus value to ensure your vehicle is successfully deleted:

Value
Description

success

Vehicle is successfully renamed and changes are saved in the local database.

unknownVehicle

The specified vehicle could not be renamed because the vehicle id is not valid.

invalidCharacteristics

This value is not returned for this service.

vehicleIdAlreadyUsed

This value is not returned for this service.

onlyOneGpsVehicleAllowed

This value is not returned for this service.

error

Vehicle is not renamed and changes are not saved in the local database because there was an unexpected error.

e.g: No network

Change the detection mode of a vehicle

When you have a vehicle, it is necessary to set its DetectionMode type. The following function is used to select the DetectionMode of a vehicle:

func updateDetectionMode(
    vehicleId: String,
    detectionMode: DKDetectionMode,
    forceGPSVehicleUpdate: Bool = false,
    completionHandler: @escaping (DKDetectionModeStatus) -> Void
)

This method have the following parameters:

Name
Type
Description

vehicleId

String

The vehicle which you want to update the DetectionMode

detectionMode

The detection mode you want for the vehicle

forceGPSVehicleUpdate

Boolean

Optional parameter to force the GPS detection mode for a new vehicle if there is already a vehicle with this mode.

The default setting is false. In this case, the response of this service request will be gpsModeAlreadyExists and the new vehicle will not be configured in GPS mode. If this setting is true, the vehicle will inherit the GPS trigger mode and the existing vehicle that had this mode will be switched to the .disabled mode.

Information: If a driver has more than one vehicle, only one can be configured in GPS mode. If you choose a GPS trigger mode for a vehicle while there is already another vehicle with this trigger mode, then you must specify the appropriate action with the forceGPSVehicleUpdate parameter to true. The other vehicle will have its detection mode updated to .disabled.

PreviousGet startedNextBeacon management

Last updated 1 year ago

Was this helpful?

model is described in the References part.

and models are described in the References part.

and models are described in the References part.

and models are described in the References part.

model is described in the References part.

DKVehicle
DKVehicleSyncStatus
DKVehicle
DKVehicleReplaceStatus
DKVehicle
DKVehicleReplaceStatus
DKVehicle
DKDetectionModeStatus
DKVehicleCharacteristics
DKCarVehicleCharacteristics
DKTruckVehicleCharacteristics
DKDetectionMode