Application Layer

Last Updated on : 2022-11-24 09:20:09download

The basic IoT applications and product applications are encapsulated in the standard APIs of the application layer. This helps reduce your efforts to write protocols and logic on your own. Your required features can be implemented simply by making API calls and setting parameters, which can notably boost your development efficiency.

Basic applications

Applications Description
OTA Call the OTA function to empower your product with the OTA update feature.
Pairing Call the pairing function to enable various pairing modes such as Wi-Fi Easy Connect mode and access point (AP) mode.
Production test Call the production test function to implement the logic for firmware flashing and authorization and the final test.

Product applications

The following table lists the advanced features in the application layer.

Applications Description
Energy monitoring Electricity data of power, voltage, current, and usage can be collected and reported to the cloud and mobile app.
Schedules with randomness With this feature, users can set up random light schedules that emulate their presence at home while they are away, which helps to deter burglars.
Schedules Users can set up multiple schedules to turn on/off devices according to the pre-set start time and end time. Schedules can be repeated daily, weekly, or a specific day of the week. This feature is widely used in irrigators.
Inching switch An inching switch is used to turn on a device for a short time. It meets the demand for turning off a device automatically after a custom time duration each time it is turned on, regardless of how it is activated.
Child lock The child lock feature can disable the buttons on the control panel, which can prevent children from accidentally operating a device. The adult can turn off the child lock temporarily to operate the device and then turn it back on again.
Countdown Users can set a countdown timer to automatically turn the smart device on or off after a certain amount of time.

Application component download

Electrical component: components_lib.zip

How to use the component

Extract the zip file and get the components_lib file. Configure the file according to the following steps to call interfaces and implement required features.

  1. Add the feature lib to the SDK.

    Application Layer

  2. Edit and build the code and link with the library.

    Add the following command to the components.mk in the ty_iot_bk7231n_2.3.1/apps/bk7231n_dltj_1plug_demo.

    LIBFLAGS += -L $(TOP_DIR)/components_lib/lib/ -lapp_measure_chip -lapp_uf_db
    LIBFLAGS += -L $(TOP_DIR)/sdk/lib/ -ltuya_iot
    TY_INC_DIRS += $(shell find $(TOP_DIR)/components_lib/include -type d)
    

    Application Layer

  3. For more information about making API calls, see each API topic in this chapter.