The application layer provides services directly for the application process and also makes requests to the board layer and the components layer.
File name |
Description |
app_main.c |
The entry to applications. |
app_dps.c |
The declaration of data points (DPs) and implementation of feature functions. |
app_dps.h |
The declaration of some feature functions. |
app_dps_write_to_storage
Function |
app_dps_write_to_storage |
Feature description |
Used to store DP status. |
Parameter |
None |
Return value |
None |
Note |
Store the current status of DPs. |
app_dps_read_from_storage
Function |
app_dps_read_from_storage |
Feature description |
Used to read the last state of a device from the nonvolatile memory. |
Parameter |
None |
Return value |
None |
Note |
Read the last state of a device. |
app_light_init
Function |
app_light_init |
Feature description |
Used to initialize a device. |
Parameter |
None |
Return value |
None |
Note |
Read the last state of a device from its nonvolatile memory and perform initial configuration to implement memory retention after power off. |
app_light_reset_run
Function |
app_light_reset_run |
Feature description |
Used to reset a device. |
Parameter |
None |
Return value |
None |
Note |
Power on and off three times to reset a device. |
app_dps_upload
Function |
app_dps_upload |
Feature description |
Used to report DP status data to the cloud. |
Parameter |
unsigned char dpid : The DP ID. unsigned char dpty : The data type of a DP.
unsigned char dplen : The length of DP data.
unsigned char *dpvalue : The DP data. |
Return value |
1 |
Note |
Call this function to report DP data. |
app_dps_download
Function |
app_dps_download |
Feature description |
Used to receive DP control commands from the cloud. |
Parameter |
unsigned char dpid : The DP ID. unsigned char dpty : The data type of a DP.
unsigned char dplen : The length of DP data.
unsigned char *dpvalue : The DP data. |
Return value |
None |
Note |
The function call is encapsulated in the SDK. After the Beacon device receives commands from the cloud, the SDK will proactively call this function. In this function, the device can execute commands and then return the changed DP status. |
app_light_run
Function |
app_light_run |
Feature description |
The main event loop. |
Parameter |
None |
Return value |
None |
Note |
This function is used to indicate pairing states, periodically store the DP status, run timer countdown, and reset a device. |