SDK User Guide

Last Updated on : 2024-06-21 03:48:18download

Overview

The all-in-one SDK of the Bluetooth anti-lost device supports all the functions of the Tuya Bluetooth anti-lost device. Customers can make appropriate tailoring or optimization based on the all-in-one version of the SDK to achieve personalized anti-lost device products for access to the Tuya Cloud Platform.

Software architecture

SDK User Guide

App: the application layer, including DP parsing and service logic.

app_port: the isolation layer used to isolate service logic and driver layer.

tuya_ble_sdk: Tuya general pairing protocol.

Original chip SDK: the original underlying layer and driver layer.

component: commonly used third-party components.

app

app_lock

  • lock_common: unclassified.
  • lock_hard: simulated hardware through serial ports, used by beginners or debugging.
  • lock_dp_parser: DP parsing. The data is transferred from the mobile phone to the device.
  • lock_dp_report: DP reporting. The data is transferred from the device to the mobile phone.
  • lock_timer: timer.
  • lock_music: ringtone.
  • lock_test: production test of the whole machine, not used yet.

app_common: unclassified.

  • app_common: unclassified.
  • app_flash: local storage management.
  • app_active_report: active reporting function (anti-lost device is not used) and ibeacon function realization.
  • app_test: authorized production test.
  • app_port: shown as follows.

app_port

Underlying interface encapsulation. It provides uniform names and management for all interfaces that might be used by the app layer. In this way, the application layer becomes an independent module and can be migrated conveniently.

tuya_ble_sdk_demo

  • tuya_ble_app_demo: initialization and event handling of tuya_ble_sdk, the header file is the common parameter configuration.
  • tuya_ble_app_ota: Tuya OTA function.
  • tuya_ble_app_product_test: unused, implemented in the app_test file.
  • tuya_ble_app_uart_modual_handler: not used

tuya_ble_sdk

Tuya low power Bluetooth general network configuration SDK. It implements the network configuration procedure and basic communication protocol between a low-power Bluetooth device and a mobile phone app.
For details, see tuya_ble_sdk.

component

cpt_… The first group, third-party components.

Original chip SDK

suble

super Bluetooth Low Energy, driver package related to Bluetooth and common peripherals

  • bk_common: unclassified.
  • suble_scan_adv: scan and broadcast.
  • suble_: Bluetooth Low Energy parameter.
  • suble_svc: service and characteristic value.
  • suble_gpio: gpio.
  • suble_uart: serial port.
  • suble_flash: flash.
  • suble_timer: timer.
  • suble_key: key.
  • suble_battery: battery level.
  • suble_util: commonly used tool API.
  • suble_test: R&D testing.

System, config, ip, driver, profile, app, lib

Original documents.

Key point

Flash partition table

SDK User Guide

Replace PID

SDK User Guide

As shown in the figure above, you can configure common parameters.

  • Replace PID.
  • Change the default authorization information (device id, auth key, mac).
  • Firmware identifier.
  • Set the firmware version number.
  • Modify Bluetooth broadcast interval.
  • Bluetooth connection interval.

Configure ringtones

SDK User Guide