Skip to content

Drive motion config delegate

TNDriveMotionConfigDelegate is a protocol for users to receive trip changes through delegate methods.

Implement TNDriveMotionConfigDelegate protocol in a class

For how to configure the implementation class of TNDriveMotionConfigDelegate, please refer to Initialize the SDK. And no matter whether TNDriveDetectionMode is .auto or .manual, the application can provide dynamic configurations through this protocol.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
    class DriveMotionConfigDelegate: TNDriveMotionConfigDelegate {

        // provide time range to DriveMotion SDK for reprocessing past unmatched trips
        func getReprocessTripTimeRange() -> TelenavDriveMotionAPI.TNTimeRange? {

        }

        // the safety score version is provided by client,  for Novo Mobile, the version is from Insurance service in the future,  currently,  it can be hardcoded as the latest safey score version: "V1.0.5". 
        func getSafetyScoreVersion() -> String {

        }

    }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
    @interface DriveMotionConfigDelegate () <TNDriveMotionConfigDelegate>

    ...

    @implementation

    ...

    // provide time range to DriveMotion SDK for reprocessing past unmatched trips
    - (TelenavDriveMotionAPI.TNTimeRange *)getReprocessTripTimeRange:() {

    }

    // the safety score version is provided by client,  for Novo Mobile, the version is from Insurance service in the future,  currently,  it can be hardcoded as the latest safey score version: "V1.0.5". 
    - (NSString *)getSafetyScoreVersion {
       return @"scoreVersion"; 
    }