Appearance
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 Ql_iotCmdBusPassTransSend() and Ql_iotCmdBusPassTransSend_ex() 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.
Related API
Function | Description |
---|---|
Ql_iotCmdBusPassTransSend() | Sends transparent transmission data to Developer Center. |
Ql_iotCmdBusPassTransSend_ex() | Sends transparent transmission data to Developer Center (only valid in SDK versions 2.10.0 and above). |
Note: See Data Interaction API for details.
Procedure
Operation 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
In transparent transmission mode, if QoS = 1 or 2, the device will call the event callback function Ql_iotEventCB() and report event +QIOTEVT: 4,10200 upon successful data transmission; If QoS = 0, the device will not call the event callback function Ql_iotEventCB() or report any event after a successful data transmission.
Example 1 (Send transparent transmission data)
The device calls Ql_iotCmdBusPassTransSend() 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
Ql_iotCmdBusPassTransSend(1,(unsigned char *)"ABCabc123456",12);
Example 2 (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.
2. Device receives the transparent transmission data issued by Developer Center
After receiving the data, the device will automatically call the event callback function Ql_iotEventCB. You can respond to and handle the event based on the specific conditions at hand.
c
void FUNCTION_ATTR_ROM Ql_iotEventCB(quint32_t event, qint32_t errcode, const void *value, quint32_t valLen)
{
switch (event)
{
/* Received downlink event */
case QIOT_ATEVENT_TYPE_RECV:
/* Receive the transparent transmission data issued by Developer Center */
if(10200 == errcode)
{
printf("pass data:%.*s\r\n",valLen,(char *)value);
/*Code*/
}
default: break;
}
}