Appearance
Data Interaction API
API Overview
Function | Description |
---|---|
Qth.sendTrans() | Sends transparent transmission data to Developer Center. |
Qth.sendTsl() | Sends TSL data to Developer Center. |
Qth.ackTsl() | Replies to TSL data request from Developer Center. |
Qth.ackTslServer() | Replies to TSL service request from Developer Center. |
API Description
Qth.sendTrans
This function sends transparent transmission data to Developer Center.
Prototype
python
Qth.sendTrans(mode, value)
Parameter
Input Parameter
mode
: Data sending mode.Value Description 0 Each message is only sent once with no confirmation or resending required. Data loss or repetition may occur. 1 Each message is sent at least once until the device receives the reception confirmation from Developer Center. Data repetition may occur. value
: Transparent transmission data.
Output Parameter
- None
Return Value
True
: Successful executionFalse
: Failed execution
Example
python
Qth.sendTrans(1, "hello world")
Qth.sendTsl
This function sends TSL data to Developer Center.
Prototype
python
Qth.sendTsl(mode, value)
Parameter
Input Parameter
mode
: Data sending mode.Value Description 0 Each message is only sent once with no confirmation or resending required. Data loss or repetition may occur. 1 Each message is sent at least once until the device receives the reception confirmation from Developer Center. Data repetition may occur. value
: Dictionary type. TSL data.
Output Parameter
- None
Return Value
True
: Successful executionFalse
: Failed execution
Example
python
Qth.sendTsl(1, {1:10,2:'hello'})
Qth.ackTsl
This function replies to the TSL data request from Developer Center.
Prototype
python
Qth.ackTsl(mode, value, pkgId)
Parameter
Input Parameter
mode
: Data sending mode.Value Description 0 Each message is only sent once with no confirmation or resending required. Data loss or repetition may occur. 1 Each message is sent at least once until the device receives the reception confirmation from Developer Center. Data repetition may occur. value
: Dictionary type. TSL data.pkgId
: Integer type. Data packet ID.
Output Parameter
- None
Return Value
True
: Successful executionFalse
: Failed execution
Example
python
def App_cmdReadTslCb(ids, pkgId):
print('readTsl:', ids, pkgId)
value = {1:10,2:'hello'}
Qth.ackTsl(0, value, pkgId)
Qth.ackTslServer
This function replies to TSL service request from Developer Center.
Prototype
python
Qth.ackTslServer(mode, serverId, value, pkgId)
Parameter
Input Parameter
mode
: Data sending mode.Value Description 0 Each message is only sent once with no confirmation or resending required. Data loss or repetition may occur. 1 Each message is sent at least once until the device receives the reception confirmation from Developer Center. Data repetition may occur. serverId
: Integer type. TSL service ID.value
: Dictionary type. TSL data.pkgId
: Integer type. Data packet ID.
Output Parameter
- None
Return Value
True
: Successful executionFalse
: Failed execution
Example
python
def App_cmdRecvTslServerCb(serverId, value, pkgId):
print('recvTslServer:', serverId, value, pkgId)
Qth.ackTslServer(1, serverId, value, pkgId)