Migration Guide 2.0
Migration SDK from old versions
This section will provide a detailed description of the API changes during the upgrade. We strongly recommend reading this documentation when upgrading the SDK version to understand the API differences and update your API calls accordingly based on the version disparities.
Migration to version 2.0.0
Implementation new DriveMotion Vehicle/Mobile SDK
DriveMotion SDK is separated into two modules for mobile and vehicle applications. See Using DriveMotion SDK 2.X to update SDK dependency.
Support Safety Vehicle Score V1.0
DriveMotion has added a new interface called AggregatedSafetyScoreRequest
which allows querying Safety Scores for a specified time range. This API has the following parameters:
startDate
which mark the start date of the requested time range.endDate
which mark the end date of the requested time range.- Optional
vin
set if need request the specified in-car device, default is null. - Optional
intervalType
which allows get daily or weekly interval safety scores, default is null. - Optional
intervalFilter
is used to customize the request if only need event or score in response, default isALL
.
In the trip
and BasicTrip
objects:
- Add new field
tripRating
to describes the trip rating in [1, 5] under current safety algorithm.
In the new added TripRating
object:
- Field
rating
to display trip safety rating in [1, 5] integer value.
In the DriveScore
object:
- Add new field
score
instead ofsafetyScore
to avoid misunderstanding on score type. - Mark
safetyScore
as deprecated and will be remove in some releases. - Add new field
scoreVersion
to indicate current score version. - Add new field
scoreType
to indicate the score is coaching score or safety score. - Add new field
scoreDetail
to show more detail info on score explanation.
In the new added ScoreDetail
object:
- Field
scoreStartDate
to show the start date base on settings. - Field
scoreEndDate
to show the end date base on request. - Field
scoreQualified
to indicate the qualified or not. - Field
scoreUnqualifiedReason
to show the detail reason for unqualified safety score. - Field
scoreQualifiedCriteria
to show the safety score minimum requirement.
Support Event Statistics For Individual Factors
To facilitate the use of Event statistical information for subsequent operations in applications, the EventStatistic
object has added the following fields:
- Add field
distance
to show the event distance in meters. - Add field
duration
to show the event duration in seconds.
Support Analytics Query Mode
To support query by user id or device id, the DriveMotionSettings
object has added the new enum parameter AnalyticsQueryMode
, default USER_BASED
mode:
- The
USER_BASED
mode, the analytics api query data by the user id. - The
DEVICE_BASED
mode, the analytics api query data by the device id.
Support Query Trips by VIN
To support trip information categorization requests for different in-car devices, the following Analytics APIs have all added an optional "withVIN" parameter in the request. You can use this parameter to query trip information for the corresponding device.
The supported APIs include:
- AggregatedScoreRequest
- GetCumulativeScoreRequest
- GetLatestTripDetailRequest
- GetTripsRequest
Support Set Speed Limit Threshold for All Road Types
DriveMotion SDK support setDefaultSpeedLimit(speedLimitInMPS)
in release 1.4 which can used to modify the default speed limit for speeding detect when can't get valid road info with speed limit value. In DriveMotion 2.0, this feature can be replaced by the newly provided setSpeedLimitOffset(isPersist, offests)
method for more precise and dynamic control.
- Param
isPresist
is used to marking this action is only take effect once within current session or keep it persist until next modify. - Param
offsets
accept a map with the key road type and value offset data in meter per seconds. If you set offset positive 10 m/s which means the speeding detector will use current road's speed limit plus 10 m/s to detect speeding. Conversely, negative values indicate lower speed limits.
Updating Time Ranges in Analytics APIs
In the prior version, when querying the analytics API using startDate
and endDate
, the system would automatically adjust the start date to 00:00:00 local time and the end date to 23:59:59 local time. However, to harmonize the query range with the analytics API that retrieves an aggregated safety score based on a custom time range defined by client, analytics APIs will no longer auto-adjust the time range in the request. External applications should make these adjustments before setting the request parameters.