Last Updated on : 2024-06-12 10:22:39download
Device Pairing UI BizBundle is used to implement pairing guidance and smart device activation. It applies to multiple common types of smart devices, such as Wi-Fi devices, Zigbee devices, Bluetooth devices, and devices that support QR code scanning like GPRS & NB-IoT devices. The UI BizBundle provides the service logic and UI encapsulation to guide pairing and activate smart devices over different protocols.
Wi-Fi smart devices can be paired and connected to cloud services in two modes: Wi-Fi Easy Connect (EZ) mode and access point (AP) or hotspot mode. IP cameras (IPCs) can be paired after QR code scanning.
Term | Description |
---|---|
Wi-Fi EZ mode | Also known as the EZ mode. This pairing mode is implemented through the following steps:
|
AP mode | Also known as the hotspot mode. A mobile phone acts as a station (STA) and connects to the hotspot of a smart device. Then, both devices are paired to establish a socket connection between them and exchange data through the specified ports. |
IPC pairing in QR code mode | An IPC scans the QR code on the app to get the pairing data. |
Zigbee gateways and sub-devices can be paired.
Term | Description |
---|---|
Zigbee gateway | The device that integrates the coordinator with Wi-Fi features on a Zigbee network. The gateway is responsible to formulate the Zigbee network and store data. |
Zigbee sub-device | A router or an end device on a Zigbee network. Each Zigbee sub-device is responsible to forward data, or respond to control commands. |
Tuya provides the following Bluetooth solutions.
Term | Description |
---|---|
Bluetooth Low Energy (LE) | A point-to-point connection is created between a Bluetooth or Bluetooth LE device and a mobile phone. |
Bluetooth mesh | Enable many-to-many (m:m) device communications over a mesh network released by Bluetooth Special Interest Group (SIG). This solution is also known as Bluetooth LE mesh. |
Tuya mesh | Tuya’s proprietary technology that enables Bluetooth devices to communicate over a mesh network. |
Combo devices | The devices that support Bluetooth and Wi-Fi combo can be paired over either Bluetooth or Wi-Fi. |
A smart device that supports this pairing mode is connected to Tuya’s cloud services immediately after power on. The app can be used to scan the QR code on the device to implement cloud-based device activation and binding. The QR code must comply with Tuya’s QR code rules. For more information, contact Tuya’s account manager.
Term | Description |
---|---|
GPRS devices | Smart devices that apply GPRS technologies to connect to the network and access cloud services. |
NB-IoT devices | Smart devices that apply NB-IoT technologies. |
If you want to use the Matter device pairing feature, see Prepare for Integration with Matter Device for initialization.
Tuya provides efficient pairing features on top of Tuya’s generic pairing technologies for smart devices.
Create a project.
Integrate Smart Life App SDK for Android into your project with Android Studio and add the framework of the UI BizBundle to your project.
Configure the build.gradle
file.
dependencies {
api enforcedPlatform("com.thingclips.smart:thingsmart-BizBundlesBom:${biz_bom_version}")
api "com.thingclips.smart:thingsmart-bizbundle-device_activator"
// To implement the QR code scanning feature, depend on the BizBundle for QR code scanning.
api "com.thingclips.smart:thingsmart-bizbundle-qrcode_mlkit"
api "com.thingclips.smart:thingsmart:${sdk_version}}"
}
Obfuscate the code.
#fastJson
-keep class com.alibaba.fastjson.**{*;}
-dontwarn com.alibaba.fastjson.**
#rx
-dontwarn rx.**
-keep class rx.** {*;}
-keep class io.reactivex.**{*;}
-dontwarn io.reactivex.**
-keep class rx.**{ *; }
-keep class rx.android.**{*;}
#fresco
-keep class com.facebook.drawee.backends.pipeline.Fresco
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.common.internal.DoNotStrip *;
}
#tuya
-keep class com.thingclips.**{*;}
-dontwarn com.thingclips.**
Configuration items | Field name | Description | Default value |
---|---|---|---|
Hotspot name settings | <string name="ap_mode_ssid">SmartLife</string> |
The prefix of a device hotspot for pairing. | SmartLife |
Support for Bluetooth devices | <bool name="is_need_ble_support">true</bool> |
Specifies whether Bluetooth devices can be paired. | true |
Support for Bluetooth mesh devices | <bool name="is_need_blemesh_support">true</bool> |
Specifies whether Bluetooth mesh devices can be paired. | true |
Support for QR code scanning | <bool name="is_scan_support">true</bool> |
Specifies whether the app can be used to scan the QR code on a device and start pairing. | true |
Whether the Wi-Fi EZ mode is supported by automatic discovery | <bool name="is_config_activator_ez">false</bool> |
Specifies whether smart devices that support the EZ mode can be automatically discovered. | false |
Create a JSON file named activator_auto_serach_capacity.json
in the assets
directory. Add the following code to this file.
{
//Specifies whether to support searching for sub-devices.
"searchTypeZigbee": false,
//Specifies whether to support searching for Wi-Fi EZ devices.
"searchTypeEZ": true,
//Specifies whether to support searching for Pegasus devices.
"searchTypePegasus": false,
//Specifies whether to support searching for Bluetooth devices.
"searchTypeBle": false,
//Specifies whether to support searching for wired devices.
"searchTypeWired": false,
//Specifies whether to support searching for Matter devices.
"searchTypeMatter": false
}
ThingDeviceActivatorManager.INSTANCE.startDeviceActiveAction(this);
ThingDeviceActivatorManager.INSTANCE.addListener(new IThingDeviceActiveListener() {
@Override
public void onDevicesAdd(List<String> list) {
}
@Override
public void onRoomDataUpdate() {
}
@Override
public void onOpenDevicePanel(String s) {
}
@Override
public void onExitConfigBiz() {
}
});
Request parameters
Parameter | Description |
---|---|
activity | The pairing activity. |
homeId | The home ID. For more information, see Home Information Management. |
Response parameters
Parameter | Description |
---|---|
devIds | The success callback. A list of paired device IDs is returned. |
updateRoomData | Indicates whether room device details are updated. |
onOpenDevicePanel | Indicates whether a certain panel can be opened. You can implement this feature as needed. |
onExitConfigBiz | Indicates whether to exit the pairing service if pairing is not performed. You can implement this feature as needed. |
ScanManager.INSTANCE.openScan(this);
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback