Appearance
Data Interaction API
Data Interaction API Overview
Function | Description |
---|---|
Ql_iotCmdBusPassTransSend() | Sends transparent transmission data to Developer Center. |
Ql_iotCmdBusPassTransSend_ex() | Sends transparent transmission data to Developer Center according to PkgID. |
Ql_iotCmdBusPhymodelReport() | Sends TSL data to Developer Center. |
Ql_iotCmdBusPhymodelReport_ex() | Sends TSL data to Developer Center according to PkgID. |
Ql_iotCmdBusPhymodelAck() | Replies to TSL data request from Developer Center. |
Ql_iotCmdSysStatusReport() | Reports device status. |
Ql_iotSysGetDevStatus() | Gets device status. |
Ql_iotCmdSysDevInfoReport() | Reports specified device information. |
Ql_iotSysGetDevInfo() | Gets specified device information. |
API Description
Ql_iotCmdBusPassTransSend
This function sends transparent transmission data to Developer Center. (It is recommended to call Ql_iotCmdBusPassTransSend_ex() to send transparent transmission data. Uplink data ID will be returned after successful sending.)
Prototype
c
qbool Ql_iotCmdBusPassTransSend(quint16_t mode, quint8_t *payload, quint32_t len)
Parameter
- Input
quint16_t
mode
: Data sending mode.0
: QoS = 0, at most once.1
: QoS = 1, at least once.2
: QoS = 2, exactly only once.
quint8_t *
payload
: Data to be sent.quint32_t
len
: Length of the data to be sent. Unit: byte.
Return Value
True
: Successful executionFalse
: Failed execution
NOTE
- This function is supported in SDK version 2.3.3 and above.
Example
c
qbool ret = Ql_iotCmdBusPassTransSend(0,(unsigned char *)"123abc",6);
Ql_iotCmdBusPassTransSend_ex
This function sends transparent transmission data to Developer Center according to PkgID. The uplink data ID will be returned after successful sending.
Prototype
c
qint32_t Ql_iotCmdBusPassTransSend_ex(quint16_t mode, quint8_t *payload, quint32_t len)
Parameter
- Input
- quint16_t
mode
: Data sending mode.0
: QoS = 0, at most once.1
: QoS = 1, at least once.2
: QoS = 2, exactly only once.
- quint8_t *
payload
: Data to be sent. - quint32_t
len
: Length of the data to be sent. Unit: byte.
- quint16_t
Return Value
-1
: Failed execution1–65535
: Uplink data ID
NOTE
- This function is supported in SDK version 2.10.0 and above.
Example
c
qbool ret = Ql_iotCmdBusPassTransSend_ex(0,(unsigned char *)"123abc",6);
Ql_iotCmdBusPhymodelReport
This command sends TSL data to Developer Center. (It is recommended to call Ql_iotCmdBusPhymodelReport_ex() to send TSL data. Uplink data ID will be returned after successful sending.)
Prototype
c
qbool Ql_iotCmdBusPhymodelReport(quint16_t mode, const void *ttlvHead)
Parameter
- Input
quint16_t
mode
: Data sending mode.0
: QoS = 0, at most once.1
: QoS = 1, at least once.2
: QoS = 2, exactly only once.
const void *
ttlvHead
: TTLV data head to be sent.
Return Value
True
: Successful executionFalse
: Failed execution
NOTE
- This function is supported in SDK version 2.3.3 and above.
Example
c
void *ttlvHead = NULL;
Ql_iotTtlvIdAddInt(&ttlvHead, 1, 100);
Ql_iotCmdBusPhymodelReport(1, ttlvHead);
Ql_iotTtlvFree(&ttlvHead); //Release pointer.
Ql_iotCmdBusPhymodelReport_ex
This function sends TSL data to Developer Center according to PkgID. The uplink data ID will be returned after successful sending.
Prototype
c
qint32_t Ql_iotCmdBusPhymodelReport_ex(quint16_t mode, const void *ttlvHead)
Parameter
- Input
- quint16_t
mode
: Data sending mode.0
: QoS = 0, at most once.1
: QoS = 1, at least once.2
: QoS = 2, exactly only once.
- const void *
ttlvHead
: TTLV data head to be sent.
- quint16_t
Return Value
-1
: Failed execution1–65535
: Uplink data ID
NOTE
This function is supported in SDK version 2.3.3 and above.
Call Ql_iotTtlvFree() to release the pointer after using the return value.
Example
c
void *ttlvHead = NULL;
Ql_iotTtlvIdAddInt(&ttlvHead, 1, 100);
Ql_iotCmdBusPhymodelReport_ex(1, ttlvHead);
Ql_iotTtlvFree(&ttlvHead); //Release the pointer.
Ql_iotCmdBusPhymodelAck
This function replies to the TSL data request from Developer Center.
Prototype
c
qbool Ql_iotCmdBusPhymodelAck(quint16_t mode, quint16_t pkgId, const void *ttlvHead)
Parameter
- Input
quint16_t
mode
: Data sending mode.0
: QoS = 0, at most once.1
: QoS = 1, at least once.2
: QoS = 2, exactly only once.
quint16_t
pkgId
: Request package ID issued by Developer Center.const void *
ttlvHead
: TTLV data head to be sent.
Return Value
True
: Successful executionFalse
: Failed execution
NOTE
This function is supported in SDK version 2.3.3 and above.
Call Ql_iotTtlvFree() to release the pointer after using the return value.
Example
c
quint16_t pkgId ;
void *ttlvHead = NULL;
Ql_iotTtlvIdAddInt(&ttlvHead, 1, 100);
qbool ret = Ql_iotCmdBusPhymodelAck(0,pkgId,ttlvHead);
Ql_iotTtlvFree(&ttlvHead); //Release the pointer.
Ql_iotCmdSysStatusReport
This function reports device status.
Prototype
c
qbool Ql_iotCmdSysStatusReport(quint16_t ids[], quint32_t size)
Parameter
- Input
- quint16_t
ids[]
: Device status ID list. See Device Status ID Description for details. - quint32_t
size
: Number of device status ID .
- quint16_t
Return Value
True
: Successful executionFalse
: Failed execution
NOTE
- This function is supported in SDK version 2.3.3 and above.
Example
c
quint16_t statusIds[] = {
QIOT_DPID_STATUS_BATTERY,
QIOT_DPID_STATUS_VOLTAGE,
QIOT_DPID_STATUS_SIGNAL,
QIOT_DPID_STATUS_FLASHFREE
};
qbool ret = Ql_iotCmdSysStatusReport(statusIds, sizeof(statusIds) / sizeof(statusIds[0]));
Ql_iotSysGetDevStatus
This function gets device status.
Prototype
c
void *Ql_iotSysGetDevStatus(quint16_t ids[], quint32_t size)
Parameter
- Input
- quint16_t
ids
: Device status ID list. See Device Status ID Description for details. - quint32_t
size
: Device status ID number.
- quint16_t
Return Value
TTLV data table. A node is a device status.
NOTE
This function is supported in SDK version 2.8.1 and above.
Call Ql_iotTtlvFree() to release the pointer after getting the device status.
Example
c
quint16_t ids[QIOT_DPID_STATUS_MAX];
quint32_t i = 0;
void *ttlvHead = Ql_iotSysGetDevStatus(ids, i / 2);
Ql_iotCmdSysDevInfoReport
This function reports the specified device information.
Prototype
c
qbool Ql_iotCmdSysDevInfoReport(quint16_t ids[], quint32_t size)
Parameter
- Input
- quint16_t
ids[]
: Device information ID list. See Device Information ID Description for details. - quint32_t
size
: Number of device information ID.
- quint16_t
Return Value
True
: Successful executionFalse
: Failed execution
NOTE
- This function is supported in SDK version 2.3.3 and above.
Example
c
quint16_t infoIds[] = {QIOT_DPID_INFO_MODEL_TYPE,
QIOT_DPID_INFO_MODEL_VER,
QIOT_DPID_INFO_MCU_VER,
QIOT_DPID_INFO_CELLID,
QIOT_DPID_INFO_ICCID,
QIOT_DPID_INFO_MCC,
QIOT_DPID_INFO_MNC,
QIOT_DPID_INFO_LAC,
QIOT_DPID_INFO_PHONE_NUM,
QIOT_DPID_INFO_SIM_NUM,
QIOT_DPID_INFO_SDK_VER,
QIOT_DPID_INFO_LOC_SUPLIST,
QIOT_DPIO_INFO_DP_VER,
QIOT_DPIO_INFO_CP_VER};
Ql_iotCmdSysDevInfoReport(infoIds, sizeof(infoIds) / sizeof(infoIds[0]));
Ql_iotSysGetDevInfo
This function gets the specified device information.
Prototype
c
void *Ql_iotSysGetDevInfo(quint16_t ids[], quint32_t size)
Parameter
- Input
- quint16_t
ids
: Device information ID list. See Device Information ID Description for details. - quint32_t
size
: Device information ID number.
- quint16_t
Return Value
TTLV data table. A node is device information.
NOTE
This function is supported in SDK version 2.8.1 and above.
Call Ql_iotTtlvFree() to release the pointer after getting the device information.
Example
c
quint16_t ids[QIOT_DPID_INFO_MAX];
quint32_t i;
void *ttlvHead = Ql_iotSysGetDevInfo(ids, i / 2);
Enumeration
Device Status ID
Enumeration Definition
cenum { QIOT_DPID_STATUS_BATTERY = 1, /* Battery power */ QIOT_DPID_STATUS_VOLTAGE = 2, /* Voltage */ QIOT_DPID_STATUS_SIGNAL = 3, /* RSSI */ QIOT_DPID_STATUS_FLASHFREE = 4, /* Available space */ QIOT_DPID_STATUS_RSRP = 5, /* RSRP */ QIOT_DPID_STATUS_RSRQ = 6, /* LTE RSRQ */ QIOT_DPID_STATUS_SNR = 7, /* SNR */ QIOT_DPID_STATUS_MAX, };
Member
Member Description QIOT_DPID_STATUS_BATTERY Battery power (percentage) QIOT_DPID_STATUS_VOLTAGE Voltage (V) QIOT_DPID_STATUS_SIGNAL RSSI QIOT_DPID_STATUS_FLASHFREE Available space (byte) QIOT_DPID_STATUS_RSRP RSRP QIOT_DPID_STATUS_RSRQ LTE RSRQ QIOT_DPID_STATUS_SNR SNR
Device Information ID
Enumeration Definition
cenum { QIOT_DPID_INFO_MODEL_TYPE = 1, /* Module model */ QIOT_DPID_INFO_MODEL_VER = 2, /* Module firmware version */ QIOT_DPID_INFO_MCU_VER = 3, /* MCU version */ QIOT_DPID_INFO_CELLID = 4, /* Cell ID */ QIOT_DPID_INFO_ICCID = 5, /* ICCID */ QIOT_DPID_INFO_MCC = 6, /* MCC */ QIOT_DPID_INFO_MNC = 7, /* MNC */ QIOT_DPID_INFO_LAC = 8, /* LAC */ QIOT_DPID_INFO_PHONE_NUM = 9, /* Phone number */ QIOT_DPID_INFO_SIM_NUM = 10, /* IMSI */ QIOT_DPID_INFO_SDK_VER = 11, /* QuecThing SDK version number*/ QIOT_DPID_INFO_MAX, };
Member
Member Description QIOT_DPID_INFO_MODEL_TYPE Module model QIOT_DPID_INFO_MODEL_VER Module firmware version QIOT_DPID_INFO_MCU_VER MCU version QIOT_DPID_INFO_CELLID Cell ID QIOT_DPID_INFO_ICCID ICCID QIOT_DPID_INFO_MCC MCC QIOT_DPID_INFO_MNC MNC QIOT_DPID_INFO_LAC LAC QIOT_DPID_INFO_PHONE_NUM Phone number IOT_DPID_INFO_SIM_NUM IMSI QIOT_DPID_INFO_SDK_VER QuecThing SDK version number