Last Updated on : 2024-03-01 08:05:55download
This topic describes how to get the license and write it to the device.
The license is an encryption certificate issued by Tuya to allow a device to connect to the Tuya IoT operating system. Each device must be assigned a unique license for authentication. A license grants permission for a single device to connect to and access the cloud.
You can request a free license or purchase one.
You can write the license to the device in two ways:
tuya_ws_db.h
tuya_iot_wifi_api.h
Get the license list.
Format Tuya’s key-value database.
Write the license to the device.
Typically, steps 2 and 3 only need to be executed once. Make sure to manage the entry point for writing the license properly to prevent it from being written each time the device is powered on.
Key-value database is initialized during product testing, and you do not need to handle it. However, if you do not use Tuya’s testing tool, you must manually initialize or format the key-value database.
/**
* @brief Tuya key-value database initialization in mf
*
* @return OPRT_OK on success. Others on error, please refer to tuya_error_code.h
*
* @note Users don't need to care about this function, it will be called during production test initialization.
*
*/
OPERATE_RET ws_db_init_mf(VOID);
/**
* Definition of Wi-Fi product info
*/
typedef struct {
CHAR_T *uuid; // strlen(uuid) ≤ 16, it must not be null
CHAR_T *auth_key; // strlen(auth_key) ≤ 32, it must not be null
CHAR_T *ap_ssid; // strlen(ap_ssid) ≤ 16, if ap_ssid is null, then the default ssid is Smartlife_xxxx
// The name of the access point (AP) emitted by the device during pairing in AP mode.
CHAR_T *ap_passwd; // strlen(ap_passwd) ≤ 16, default null
} WF_GW_PROD_INFO_S;
/**
* @brief tuya_iot_set_wf_gw_prod_info
*
* @param[in] wf_prod_info: device product info
*
* @return OPERATE_RET
*/
OPERATE_RET tuya_iot_set_wf_gw_prod_info(IN CONST WF_GW_PROD_INFO_S *wf_prod_info)
See the tuyaos_demo_quickstart
project described in Download and Debugging.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback