Get started
Last updated
Was this helpful?
Last updated
Was this helpful?
Before starting DriveKit Driver Data integration, make sure that you have .
If you use Driver Data without having initialized DriveKit, the SDK may not work properly in your application.
The Driver Data SDK is available on Cocoapods master repo.
To access framework in the repository, add the following lines to your Podfile:
Then, run pod install
.
If you have , an initialization phase is required to use the feature included in the Driver Data module. In the application's AppDelegate file, import DriveKitDriverData:
Then, to initialize Driver Data module in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate file.
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize local trips with DriveQuant backend to get new trips or modified trips, and then return the trip list via the completionHandler.
cache
: if this value is used, no synchronization will be performed and only trips previously synchronized will be returned via the completionHandler.
TripSyncStatus
in the completionHandler can have 4 values:
noError
: Synchronization has been successfully performed.
cacheDataOnly
: SynchronizationType has been set to cache
.
failedToSyncTripsCacheOnly
: Synchronization has failed, only trips previously synchronized are returned.
syncAlreadyInProgress
: A synchronization is in progress, only trips previously synchronized are returned until the synchronization is finished.
If train trips have been recorded by Trip Analysis SDK, they won't be returned by this method.
Example:
The itinId
parameter is the unique identifier for a trip.
When you call this method, you will get trip data and trip safety events. If safety events are not synchronized locally for the trip, a synchronization with DriveQuant backend will be performed and then, the trip will be returned with safety events synchronized.
Example:
To get road data of the trip (latitude, longitude), you have to call the following method:
If route
value in completionHandler is nil
, the synchronization has failed.
Example:
To delete a trip, you have to call the following method:
The itinId
parameter is the unique identifier for a trip.
Example:
When a trip is analyzed and the detected transportation mode is car, truck, or motorcycle, it is by default attributed to the driver. However, in some cases, the data may come from a passenger's smartphone.
In such cases, it is possible to indicate that the analyzed trip was recorded by an occupant of the vehicle who was not the driver. This section describes the method used to declare a trip as having been made as a passenger.
With this method, you can add a feature to your application that allows the user to declare that they were not the driver of the vehicle.
When a user declares that a trip was made as a passenger, it will not modify any scores related to the trip.
To declare a trip as a passenger with a comment, call the following code:
The method takes the following parameters:
itinId
String
Unique trip identifier
mode
DKDriverPassengerMode
Possible value: driver
or passenger
.
comment
String
The user can add a comment of up to 120 characters.
The method returns a UpdateDriverPassengerModeStatus
enum with the possible values:
success
The passenger status has been successfully updated and local trip data is also updated.
userNotConnected
The user is not yet connected to DriveKit.
invalidItineraryId
The itinerary identifier does not exist. Update is not taken into account and local trip data is not updated either.
invalidTransportationMode
The trip was made with alternative transport. Update is not taken into account and local trip data is not updated either.
commentTooLong
The comment exceeds 120 characters. Update is not taken into account and local trip data is not updated either.
failedToUpdateMode
An error has occurred, for example if the user has no network. Update is not taken into account and local trip data is not updated either.
To get driver synthesis data, you have to call the following method:
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize the driver synthesis data with DriveQuant backend and then return it via the completionHandler.
cache
: if this value is used, no synchronization will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
SynthesisSyncStatus
in the completionHandler can take 3 values:
cacheDataOnly
: SynchronizationType has been set to cache.
noError
: Synchronization has been successfully performed.
failedToSyncSynthesisCacheOnly
: Synchronization has failed, only data retrieved during the last synchronisation is returned.
Example:
periods
attribute contains periods you are interested in: .week
, .month
and/or .year
.
defaultSync
: if this value is used, the SDK will try to synchronize timelines with DriveQuant backend and then return them via the completionHandler.
cache
: if this value is used, no synchronization will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
cacheDataOnly
: SynchronizationType has been set to cache.
noError
: Synchronization has been successfully performed.
failedToSyncTimelineCacheOnly
: Synchronization has failed, only data retrieved during the last synchronisation are returned.
noTimelineYet
: Synchronization has been successfully performed and there is currently no timeline.
To get driver timelines, you have to call the following method:
TimelineSyncStatus
in the completionHandler
can take 4 values:
cacheDataOnly
: SynchronizationType
has been set to cache.
noError
: Synchronisation has been successfully performed.
failedToSyncTimelineCacheOnly
: Synchronisation has failed, only data retrieved during the last synchronisation are returned.
noTimelineYet
: Synchronisation has been successfully performed and there is currently no timeline.
Example:
To get driver profile, you have to call the following method:
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize the driver profile with DriveQuant backend and then return it via the completionHandler.
cache
: if this value is used, no synchronisation will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
DKDriverProfileStatus
in the completionHandler can take 4 values:
success
: Synchronization type has been successfully performed.
failedToSyncDriverProfileCacheOnly
: Synchronisation has failed, only data retrieved during the last synchronisation is returned.
noDriverProfileYet
: Synchronisation has been successfully performed and there is currently no driver profile for this user.
forbiddenAccess
: Your team doesn’t have access to this data.
To get , you have to call the following method:
The second argument in the completionHandler
is the list of objects.
To get a specific , you have to call the following method:
TripSyncStatus
can have the same value as and the value failedToSyncSafetyEvents
if the safety events synchronization failed.
The second argument in the completionHandler
is the requested object, if exists.
The second argument in the completionHandler
is a list of object, one per period requested.
The second argument in the completionHandler is the object requested.