Last Updated on : 2024-11-20 08:51:41download
See Port SDK.
In debugging, you can use the license list to authorize your module. For more information, see Initialize Tuya Bluetooth SDK.
static tuya_ble_device_param_t tuya_ble_device_param = {
.use_ext_license_key = 1, // Define this function as `1` for debugging purpose and the license information that the application passes in will be used. In the release version, define this function as `0` and the license information will be written by Tuya's production tool.
.device_id_len = 16, // If `use_ext_license_key` is `0`, the license is obtained from Tuya's production test tool. Passing in the license is not needed. Assign `0` to `device_id_len`.
.p_type = TUYA_BLE_PRODUCT_ID_TYPE_PID,
.product_id_len = 8,
.adv_local_name_len = 4,
.firmware_version = 0x00000201, // The firmware version is 2.1.
.hardware_version = 0x00000100, // The hardware version is 1.0.
.device_id = "tuyaf3752699xxxx" // The parameter in the license.
.auth_key = "4gBM3DK6SRmRn9LTLbyOUAz3bHMGxxxx" //// The parameter in the license.
.mac_addr_string = "DC234D12XXXX" //// The parameter in the license.
.product_id = "suq5jmo5" // Set it to the PID of the product created on the Tuya Developer Platform.
.adv_local_name = "demo" // The custom name of Bluetooth advertisement.
};
void tuya_ble_sdk_demo_init(void) // The initialization function, which must be called by the application.
{
if(device_param.use_ext_license_key==1)
{
device_param.device_id_len = 16; // Set `device_id_len` to 16 if you want to pass in the license information for debugging purpose. Otherwise, set it to `0`.
}
tuya_ble_sdk_init(&tuya_ble_device_param); // Tuya Bluetooth SDK initialization function. It must be called. Otherwise, the SDK cannot run.
TUYA_APP_LOG_HEXDUMP_INFO("auth key", tuya_ble_current_para.auth_settings.auth_key, AUTH_KEY_LEN); // Print the `auth_key`.
TUYA_APP_LOG_HEXDUMP_INFO("device id", tuya_ble_current_para.auth_settings.device_id, DEVICE_ID_LEN); // Print the `device_id`.
tuya_ble_callback_queue_register(tuya_ble_sdk_callback);// Registration callback.
}
In production, you need to write the license to the module by using the Authorization Software. For more information, see Bluetooth LE Series Authorization.
Purchase licenses and install Tuya’s host for production test.
Connect your device to the host through the UART port.
Run the host and write the license to the module.
The version and name of the firmware written to the module must be the same as that of the firmware you upload to the Tuya Developer Platform.
When you use Cloud Module Burning Authorization Platform to authorize modules, make sure to set both use_ext_license_key
and device_id_len
to 0
.
Yes. Currently, the module written with a custom MAC address can also work properly, but in the future, Tuya will use the MAC address it issued to manage the connected Bluetooth device.
h_id
in Tuya Bluetooth SDK?h_id
is used for device management in the SDK. You can leave it as is.
For more information, see Application Development.
Tuya Bluetooth SDK does not provide interval configuration. You should specify interval parameters for your application based on product features and performance.
For connection to iOS devices, there are certain rules and formulae that the parameters must follow. If the parameters do not comply with all of these rules, the parameter request may be rejected, or the stability and the performance of the connection may be compromised. Make sure the advertising intervals do not exceed one second. Otherwise, the Bluetooth device might not be discovered by iOS devices.
tuya_ble_sdk
. It implements the communication between Tuya smart devices and the Tuya Smart app and task scheduling, with a cross-platform feature.tuya-ble-sdk-demo-project-xxxx
(xxxx
refers to platforms). The platform SDKs are built on top of the baseline SDK, and have implemented functions such as OTA updates, power saving, and authorization, and provide a complete set of proven programs to test serial communication as well as common application routines for your reference.Tuya Bluetooth SDK does not affect the power consumption pattern of the Bluetooth chip. Make sure you have correctly port the SDK according to Port SDK and check the power consumption related code.
Factors that affect power consumption can be:
View the chip datasheet to find out what might cause power consumption to be high.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback