Skip to content

DataConnectorClient

DriveMotion provides TNDataConnector related functions. To use these functions, you must first obtain an instance of TNDataConnectorClient.

Get TNDataConnectorClient

1
2
3
4
5
6
7
8
    do {
        try TNDriveMotionService.initializeDataConnector(withSdkOptions: #sdkOptions#)
        if let client = try TNDriveMotionService.getDataConnectorClient() {
            client.send(withEvent: event)
        }
    } catch {
        // handle error
    }
1
2
3
4
5
6
7
8
    NSError *error;
    [TNDriveMotionService initializeDataConnectorWithSdkOptions:#sdkOptions# error:nil];
    TNDataConnectorClient *client = [TNDriveMotionService getDataConnectorClientWithError:&error];
    [client sendWithEvent:event];

    if (error) {
        // handle error
    }

Set Default Speed Offset (Since 2.0 and using for replace setDefaultSpeedLimit)

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.

1
    TNDriveMotionService.getDataSourceClient().setDefaultSpeedLimit(limit: Double);
1
    [[TNDriveMotionService getDataSourceClient] setSpeedLimitOffset:#double#];

Support Feed External GPS API (Since 2.10.0)

Now new SDK support a new data source API, sendLocation(_ location: CLLocation?), Initialize sdk with drive motion setting isUseExternalGPS = true when use this API.

1
    TNDriveMotionService.getDataSourceClient().sendLocation(#CLLocation#);
1
    [[TNDriveMotionService getDataSourceClient] sendLocation:#CLLocation#];