Last Updated on : 2024-07-01 08:14:29download
Bluetooth is widely used for IoT-enabled vehicles, such as electric bicycles and automotive cars. For example, smart vehicles can be automatically unlocked over Bluetooth as users approach them. Travel SDK supports this efficient unlocking feature.
In the traditional unlocking process, users need to keep the vehicle connected to the app, open the panel, and then manually tap to unlock the device.
Bluetooth automatic unlocking simplifies the whole process. Users only need to enable this feature when they access it for the first time on the app. Then, whenever they take the mobile phone that runs the app and approach the target vehicle, the app automatically unlocks or disarms the vehicle.
Bluetooth LE_HID automatic unlocking is implemented based on the Bluetooth Low Energy (LE) human interface device (HID) protocol.
Bluetooth automatic unlocking is implemented based on pairing over Bluetooth Classic.
Example
IODInductiveUnlockManager inductiveUnlockManager = ThingODSDK.getODInductiveUnlockManagerInstance();
API description
void getInductiveUnlockType(String devId, IThingResultCallback<InductiveUnlockType> callback)
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
devId | String | Yes | - | The device ID. |
callback | IThingResultCallback<InductiveUnlockType> | Yes | - | The callback. |
Data model of InductiveUnlockType
Enum value | Description |
---|---|
Bluetooth LE_HID | Bluetooth LE_HID automatic unlocking |
Bluetooth | Bluetooth automatic unlocking |
NONE | Automatic unlocking not supported |
Example
ThingODSDK.getODInductiveUnlockManagerInstance()
.getInductiveUnlockType(deviceId, new IThingResultCallback<InductiveUnlockType>() {
@Override
public void onSuccess(InductiveUnlockType result) {
Log.d(TAG, "result:" + result);
}
@Override
public void onError(String errorCode, String errorMessage) {
Log.d(TAG, "errorCode:" + errorCode + " errorMessage:" + errorMessage);
}
});
API description
IODHidInductiveUnlock newHidInductiveUnlockInstance(String devId);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
devId | String | Yes | - | The device ID. |
Example
IODHidInductiveUnlock inductiveUnlock = ThingODSDK.getODInductiveUnlockManagerInstance()
.newHidInductiveUnlockInstance(devId);
API description
IODBtInductiveUnlock newBtInductiveUnlockInstance(String devId);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
devId | String | Yes | - | The device ID. |
Example
IODBtInductiveUnlock inductiveUnlock = ThingODSDK.getODInductiveUnlockManagerInstance()
.newBtInductiveUnlockInstance(devId);
API description
boolean isInductiveUnlockTurnOn();
Example
inductiveUnlock.isInductiveUnlockTurnOn();
API description
void turnOnInductiveUnlock(InductiveUnlockCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | InductiveUnlockCallback | Yes | - | The callback. |
Example
inductiveUnlock.turnOnInductiveUnlock(new InductiveUnlockCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
void turnOffInductiveUnlock(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
inductiveUnlock.turnOffInductiveUnlock(new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
HidBindStatus getHidBindStatus();
Data model of HidBindStatus
Enum value | Description |
---|---|
BIND | The HID device is bound. |
UNBIND | The HID device is not bound. |
API description
void recordFortifyDistance(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
inductiveUnlock.recordFortifyDistance(new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
void recordDisarmDistance(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
inductiveUnlock.recordDisarmDistance(new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
boolean isInductiveUnlockTurnOn();
Example
inductiveUnlock.isInductiveUnlockTurnOn();
API description
void turnOnInductiveUnlock(InductiveUnlockCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | InductiveUnlockCallback | Yes | - | The callback. |
Example
inductiveUnlock.turnOnInductiveUnlock(new InductiveUnlockCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
void turnOffInductiveUnlock(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
inductiveUnlock.turnOffInductiveUnlock(new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
void setInductiveUnlockDistance(int distance, IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
distance | int | Yes | - | The unlocking distance. Value range: 1 to 5. |
callback | IResultCallback | Yes | - | The callback. |
Example
inductiveUnlock.setInductiveUnlockDistance(1, new IResultCallback() {
@Override
public void onError(String code, String error) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
API description
Integer getInductiveUnlockDistance();
Return parameters
Type | Example | Description |
---|---|---|
Integer | 1 | The unlocking distance. A value of null indicates that automatic unlocking is not enabled. |
Example
Integer btInductiveUnlockDistance = inductiveUnlock.getInductiveUnlockDistance();
Supports device management respecting automatic unlocking.
Example
IODDevice mODDevice = ThingODSDK.newODDeviceInstance(devId);
Removes a device from the device list. When users remove a device that has automatic unlocking enabled, the system also makes attempts to remove the Bluetooth connection.
API description
void removeDevice(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
mODDevice.removeDevice(new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
After factory defaults are restored for the device, the device data is cleared and the device gets ready for pairing again. When users remove a device that has automatic unlocking enabled, the system also makes attempts to remove the Bluetooth connection.
API description
void resetFactory(IResultCallback callback);
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
callback | IResultCallback | Yes | - | The callback. |
Example
mODDevice.resetFactory(new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
Log.d(TAG, "onError: " + code + " " + error);
}
@Override
public void onSuccess() {
Log.d(TAG, "onSuccess");
}
});
Error code | Description |
---|---|
-6000 | The operation timed out. |
-6001 | The number of paired Bluetooth devices has exceeded the upper limit. |
-6002 | Device pairing is canceled. |
-6003 | The device has been paired over Bluetooth with another mobile phone. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback