DriveMotionEnrollmentClient
The EnrollmentClient provide 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.
DriveMotion provides EnrollmentClient.
Get EnrollmentClient
1 2 3 4 5 | |
1 2 3 4 5 | |
Use EnrollmentClient
EnrollmentClient provides the the authorization flow result by Vehicle Identification Number (VIN)
Note
The client since SDK Version 2.12.0
Get launch auth flow result
Get Request Builder
1 | |
1 | |
Build Request
LaunchAuthFlowRequest needs to set a 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 10 11 12 | |
1 2 3 4 5 6 7 8 9 | |
Get Recommended Peripherals (since 2.18.0)
This API retrieves currently connected and past paired peripherals (Bluetooth devices). Since 3.18.0, you can optionally set a vehicle asset on the request to merge the latest cloud Bluetooth recommendation (setup confidence, ranked devices) with the local list. Ordering is cloud first; on duplicate addresses the cloud copy wins. If the cloud call fails, the SDK returns local-only results (same as before).
Usage
Use getRecommendedPeripheralsRequest(), then optional withAsset(assetId, assetContext) (same semantics as link / replace: CAR = VIN, GLOBAL = channel client id), then build() and execute.
Kotlin example — local-only (unchanged)
1 2 3 4 5 6 7 8 9 10 11 | |
Kotlin example — cloud merge and setup confidence (since 3.18.0)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Response
The API returns a list of Bluetooth peripherals in peripherals, an optional hot peripheralsFlow, and when cloud merge is used and data is available, optional linkedPeripheral and tripStatistics as above.
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 LinkVehicleToPeripheralRequest API.
Kotlin 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 (
Peripheral): 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 ReplaceVehiclePeripheralRequest API.
Kotlin 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 (
Peripheral): The old peripheral device to be replaced. - newPeripheral (
Peripheral): 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 MigratePeripheralsRequest API.
Kotlin Example Usage
1 2 3 4 5 6 7 8 9 10 11 | |
Response
The API confirms whether the migration of the existing mapping relationship is successful.
Get MYM by peripheral name (since 3.16.0)
Queries the cloud for vehicle make, year, and model (MYM) entries associated with one or more Bluetooth peripheral names (for example Uconnect or SYNC). This supports enrollment flows that only know the peripheral name.
Usage
Use getMymByPeripheralRequest() on EnrollmentClient.
Kotlin example
1 2 3 4 5 6 7 8 9 10 11 12 | |
Response
The response contains a map from peripheral name to a list of MYM records for that name.