Last Updated on : 2024-11-20 08:51:41download
Most electric vehicles on the market support Bluetooth connection, allowing users to unlock their devices by tapping on the mobile app. The HID solution based on Tuya Bluetooth SDK enables automatic unlocking over Bluetooth as users’ mobile app is approaching the device. This provides hands-free operation without taking out the phone.
The HID solution allows users to enable or disable automatic unlocking and specify the distance for activation, which is distinguished by the Bluetooth signal strength.
After a Bluetooth device is paired, it can achieve one-to-one unlocking based on automatic Bluetooth reconnection and the received signal strength indicator (RSSI).
This solution adopts the Bluetooth Low Energy (LE) HID and Security Manager (SM) protocols, as shown below.
Operation | Common Bluetooth LE devices | HID-based Bluetooth LE devices |
---|---|---|
Connect and bind | Not supports the binding state. Bluetooth is connected or disconnected as users open or close the mobile app. |
|
Unbind |
|
|
The following lists the reasons why a disconnected Bluetooth device cannot be unbound.
This section describes how to implement the HID feature on the device and the mobile app.
Initialize Generic Access Profile (GAP) and disable pairing. Enable automatic unlocking in the mobile app. The device sends a pairing and binding request to the mobile app.
The device implements the HID and Bluetooth LE services.
After the Bluetooth device reconnects to the mobile app, it reads the RSSI data every 200 ms and determines whether to unlock the device based on the obtained RSSI values.
Multiple devices can be managed. Up to three devices can be shared currently.
Locally polling for connection is supported. The device is not allowed to erase pairing information without commands from the cloud.
Android and iOS devices can receive the pairing request from Bluetooth devices in a flexible manner.
Only the device can initiate a pairing request and the data exchanges are encrypted, ensuring a secure Bluetooth pairing.
After receiving a pairing request, Android and iOS devices will first determine if the initiator is already in the paired device list. If it does, the mobile phone will read the new advertising packet through a specific characteristic value. If the initiator is not on the list, it will be paired.
The following block diagram shows the reconnection mechanism.
The following diagram shows how the Bluetooth device interacts with the mobile app.
The automatic unlocking can only be enabled by using Tuya’s mobile app. Any third-party apps or channels do not have access. If automatic unlocking is enabled for an unpaired device, only this device can initiate a pairing request.
The unique Identity Resolving Key (IRK) is written to a specified location on the device. As the mobile phone approaches the device, the IRK information will be verified. After users enable automatic locking or unlocking, IRK check will be activated.
Download the HID demo and get started with your development.
In a nutshell, the mobile app connects to a Bluetooth device. The locking or unlocking action is triggered based on the distance between the phone and the device.
Automatic Bluetooth reconnection and RSSI-based distance determination together achieve automatic unlocking.
The device can initiate a pairing request only after its IRK information is verified.
Besides, the unlocking distance is within 10 meters, making the target device reachable and controllable.
Automatic locking is disabled by default. It can be enabled separately.
Besides, automatic locking and unlocking states are associated to avoid the unlocked state.
After any misoperations occur, the device can only be controlled by encrypted commands.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback