Skip to content

Migration Guide 2.0

Migration SDK from old versions

This section provides a comprehensive description of the API changes that occur during the upgrade. It is highly recommended to review this documentation when upgrading the SDK version in order to understand the differences in the API and make the necessary updates to your API calls according to the version disparities.

Migration to version 2.0.0

New SDK Requirements

  • iOS 13.0 or later

Support Safety Vehicle Score V1.0

DriveMotion has added a new interface called TNAggregatedSafetyScoreCall 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 is all.

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 of safetyScore 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 userBased mode:

  • The userBased mode, the analytics api query data by the user id.
  • The deviceBased 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:

  • TNAggregatedScoreRequest
  • TNGetCumulativeScoreRequest
  • TNGetLatestTripDetailRequest
  • TNGetTripsRequest

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.

TNDataSourceClient: setDefaultSpeedLimit(:)

DriveMotion SDK supports the functionality for external apps to set a default speed limit value in situations where road info is unavailable. When road info is UNKNOWN, this default value will be used as the speed limit for events and scoring. The unit of measurement is meters per second (m/s), and the SDK's built-in default value is 80 miles per hour (mph).

1
2
    dataSourceClient.setDefaultSpeedLimit(limit: #limit#)
    ...
1
2
    [dataSourceClient setDefaultSpeedLimitWithLimit: #limit#];
    ...