Last Updated on : 2024-06-26 10:07:27download
TuyaLink is an open solution that enables smart devices, including proprietary network modules and smart devices, to connect to Tuya’s cloud services.
TuyaLink lowers the bar for IoT development by integrating with Tuya’s IoT Core technologies, including things data model, rule engines, data parsing, device management, operations and monitoring, alert management, OTA firmware updates, and application development.
TuyaLink allows you to quickly integrate with the Tuya ecosystem and achieve interconnectivity between devices across different domains. A range of development resources for PaaS, SaaS, and apps helps you implement IoT projects with improved cost efficiency and reduced lead time.
For more information, see TuyaLink.
Each TuyaLink-based device is created with a QR code on the Tuya Developer Platform. To bind a TuyaLink-based device with the app, users scan the QR code of the device first. The system parses the URL of the QR code and returns a universally unique identifier (UUID) of the device. Then, the UUID is used in the API request to bind the device.
//IThingDeviceActivator.java
void deviceQrCodeParse(String url, IThingDataCallback<QrScanBean> callback);
Parameters
Parameter | Description |
---|---|
url | The URL obtained after the device QR code is scanned. |
IThingDataCallback | The UUID returned in the result.actionData . |
Example
// The URL obtained after the device QR code is scanned.
ThingHomeSdk.getActivatorInstance().deviceQrCodeParse("url", new IThingDataCallback<QrScanBean>() {
@Override
public void onSuccess(QrScanBean result) {
if(result != null){
// Get uuid from result.actionData. This parameter will be used as the request parameter in the subsequent pairing process.
}
}
@Override
public void onError(String errorCode, String errorMessage) {
// errorCode:QR_PROTOCOL_NOT_RECOGNIZED protocol is unknown.
}
});
//IThingDeviceActivator.java
void bindThingLinkDeviceWithQRCode(long homeId, String uuid, IThingDevActivatorListener listener);
Parameters
Parameter | Description |
---|---|
homeId | The home ID. |
uuid | The UUID that is returned after a device QR code is scanned and parsed. |
IThingDevActivatorListener | The listener for the binding result. |
Example
ThingHomeSdk.getActivatorInstance().bindThingLinkDeviceWithQRCode(homeId, mUuid, new IThingDevActivatorListener() {
@Override
public void onError(String errorCode, String errorMsg) {
Log.d(TAG,"errorMsg = " + errorMsg + " / errorCode = " + errorCode);
}
@Override
public void onActiveSuccess(DeviceBean devResp) {
Log.d(TAG,"onActiveSuccess --->>" );
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback