DriveMotionEnrollmentClient
DriveMotion provides TNEnrollmentClient. It provides the following APIs, such as: launch authentication flow (SmartCar), get recommended peripherals (BT list), link peripheral to vehicle, replace a vehicle's peripheral with a new peripheral, auto migrate existing peripherals for vechiles to a new phone.
Get TNEnrollmentClient
1 2 3 4 5 |
|
1 2 3 4 5 |
|
Use TNEnrollmentClient
TNEnrollmentClient provides the the authorization flow result by Vehicle Identification Number (VIN)
Note
The client since SDK Version 2.12.0
Launch Auth Flow By VIN
Get Request Builder
1 |
|
1 |
|
Build Request
TNLaunchAuthFlowRequest needs to pass VIN parameter.
1 2 |
|
1 2 |
|
Create a Call and execute it
Callback is a closure accepting response and error parameters.
1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 6 7 8 9 |
|
Get Recommended Peripherals (since 2.18.0)
This API retrieves currently connected or once connected peripherals (Bluetooth devices).
Usage
To fetch the recommended peripherals, use the TNGetRecommendedPeripheralsRequest
API.
Swift Example Usage
1 2 3 4 5 6 7 8 9 10 11 |
|
Swift Example Additional New Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Response
The API returns a list of Bluetooth peripherals.
Link Vehicle to Peripheral (since 2.18.0)
This API links a specific peripheral device to a vehicle.
Usage
To link a peripheral to a vehicle, use the TNLinkVehicleToPeripheralRequest
API.
Swift Example Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Parameters
- assetId (
String
): Vehicle's ID (value can be "VIN" or "Channel client id" based on type of assetContext). - assetContext (
Enum(car,global)
): Context for assetId, if is "car", assetId value should be VIN, otherwise assetId should be Channel client id. - peripheral (
TNPeripheral
): The peripheral device being linked to the vehicle.
Response
The API confirms whether a peripheral was successfully linked to a vehicle.
Replace Vehicle Peripheral (since 2.18.0)
This API replaces an old peripheral with a new one for a specific vehicle.
Usage
To replace a vehicle's peripheral, use the TNReplaceVehiclePeripheralRequest
API.
Swift Example Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Parameters
- assetId (
String
): Vehicle's ID (value can be "VIN" or "Channel client id" based on type of assetContext). - assetContext (
Enum(car,global)
): Context for assetId, if is "car", assetId value should be VIN, otherwise assetId should be Channel client id. - oldPeripheral (
TNPeripheral
): The old peripheral device to be replaced. - newPeripheral (
TNPeripheral
): The new peripheral device replacing the old one.
Response
The API confirms whether the peripheral replacement is successful.
Migrate Peripherals (since 2.19.0)
This API is to migrate the existing mapping relationship (peripheral, vehicle) to a new phone.
Usage
To migrate peripherals, use the TNMigratePeripheralsRequest
API.
Swift Example Usage
1 2 3 4 5 6 7 8 9 10 11 |
|
Parameters
- No
Response
The API confirms whether the migration of the existing mapping relationship is successful.