Last Updated on : 2023-11-29 07:32:25download
This topic describes how offline unbinding works on Bluetooth sub-devices.
Offline unbinding is also known as abnormal unbinding or offline removing. The user triggers Remove or Remove and Clear Data on the app panel when the device is disconnected. On a successful operation, the device becomes unbound in the cloud, but remains in the bound state on the device side.
In this case, when this device is advertising, if any Tuya-based mobile app connects to it, the app will send the device a command to unbind. Note that the process of device handling offline unbinding will not be reflected on the mobile app.
typedef struct {
UINT8_T data;
} tuya_ble_anomaly_unbound_data_t;
data
: A reserved field having no meaning.
The user taps Remove or Remove and Clear Data on the app panel while the device is offline.
TUYA_BLE_CB_EVT_ANOMALY_UNBOUND
See the example code in tal_sdk_test.c
.
VOID_T tal_sdk_test_ble_protocol_callback(tuya_ble_cb_evt_param_t* event)
{
#if (TUYA_BLE_FEATURE_IOT_CHANNEL_ENABLE != 0) && (TUYA_BLE_FEATURE_SCENE_ENABLE != 0)
UINT8_T *rsp_buf = NULL;
UINT16_T rsp_buf_len = 0;
#endif
switch (event->evt) {
…………
case TUYA_BLE_CB_EVT_ANOMALY_UNBOUND: {
tal_sdk_test_unbind_mode_rsp(1);
} break;
…………
default: {
} break;
}
}
After the device has been paired, turn off Bluetooth on the phone.
Open the device panel on the app and tap the pencil icon in the top right corner.
Tap Remove Device.
Go back to the home page of the app. Tap + in the top right corner and then Add Device. The mobile phone will scan for Bluetooth devices and then trigger the offline unbinding process.
If you have any problems with host usage, see Logic Host User Guide.
If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback