Skip to content

Example of Transparent Transmission Data Interaction

Introduction

Transparent transmission data can be used in practical scenarios where there is no need for Developer Center to parse the data. Once the device has successfully connected to Developer center, call Qth_cmdSendTrans() to enable interaction between the device and Developer Center, allowing for transparent transmission of any type of data. This section outlines how to send and receive transparent transmission data in QuecOpen solution.

FunctionDescription
Qth_cmdSendTrans()Sends transparent transmission data to Developer Center.

Note: SeeDevice Connection API for details.

Procedure

Operations on Developer Center

1. Log in to Developer Center

Log in to Developer Center. If you don't have an account, click Register Now to register.

2. Create a Product

For details about product creation, see Create a Product.

Transparent Transmission Data Interaction

If the module has registered Qth_sendCb_f() when it sends transparent transmission data, the callback function of data sending result will be called to notify the device of the transparent transmission data sending result. The device can determine which data is sent according to the PkgID in Qth_sendCb_f().

Example 1 (Send transparent transmission data without callback function registered)

The device calls Qth_cmdSendTrans() to send transparent transmission data. For example, the device can call this function to send a 12-byte string "ABCabc123456" with QoS set to 1.

Sample code:

c
Qth_cmdSendTrans(1,(unsigned char *)"ABCabc123456",12,NULL,NULL);

Example 2 (Send transparent transmission data with callback function registered)

The device calls Qth_cmdSendTrans() to send transparent transmission data. For example, the device can call this function to send a 12-byte string "ABCabc123456" with QoS set to 1 and register the callback function of receiving data sending result.

Sample code:

c
void sendCb(quint16_t pkgId, qbool result)
{
    Quos_logPrintf(APPS_OPEN, LL_DBG, "recv send event, pkgId:%u, result:%d\r\n", pkgId, result);
}
    
...
quint16_t pkgId = 0;
Qth_cmdSendTrans(1,(unsigned char *)"ABCabc123456",12,&pkgId, sendCb);
Quos_logPrintf(APPS_OPEN, LL_DBG, "pkgId:%u\r\n", pkgId);

Example 3 (Read transparent transmission data issued by Developer Center)

1. Developer Center issues transparent transmission data

Open the "Device Details" page, click "Device Debug" to send or receive transparent transmission data.

img

2. Device receives the transparent transmission data issued by Developer Center

After receiving the data, the device will pass the event in the event callback function Qth_transRecvCb_f(). Then you can respond to and handle the event.

c
void transRecvCb(quint8_t *value, quint32_t valLen)
{
    Quos_logHexDump(APPS_OPEN, LL_DBG, "recv trans data", value, valLen);
}