Appearance
Data Interaction
Note: The prerequisite for TSL data interaction is selecting TSL as the data format when a product is created.
Draw up TSL features according to the actual project requirements of the smart aromatherapy diffuser. The default TSL model is presented in the table below.
Feature ID | Feature Type | Feature Name | Data Format | Read/Write Type | Unit |
---|---|---|---|---|---|
1 | Property | The remaining content of essential oil | FLOAT | Read-Only | ML |
2 | Property | Frequency of regular reporting | INT | Read-Write | Second |
3 | Property | On/Off status | BOOL | Read-Only | True: On; False: Off; |
4 | Event | Alert to lack of essential oil | BOOL | -- | True: Alert; False: Alert canceled; |
5 | Property | mode | ENUM | Read-Write | 1: Working Mode 1; 2: Working Mode 2; 3: Working Mode 3; |
6 | Service | Set working mode | -- | Feature ID: 5 |
TSL Data Interaction
TSL is a data model established by Developer Center for physical devices, which is used to describe product features to facilitate data parsing. You can execute AT+QIOTMODELTD and AT+QIOTMODELRD to make the device interact with Developer Center, once the device successfully accesses Developer Center.
Note: See Data Interaction Command for details.
1. Uplink TSL Data
1) Replies to the TSL data request from Developer Center
Replies to the TSL data request from Developer Center
On the "Device Debug" tab of Device Details page, click "Read Data in Batches" to read TSL property value in batches.
Device replies to Developer Center
① Select the Package ID (PkgID) to be sent.
② Click "Send Reply Data" to reply to TSL data request from Developer Center.
Parse event callback
- +QIOTEVT: 5,10211,2,5,1,2,3
5: Event type indicating that the downlink data was received.
10211: Event code indicating that the device received the TSL property request from Developer Center.
2: Package ID (PkgID), which is only valid when the module receives and sends TSL data.
5,1,2,3: IDs of TSL properties to be read, which is 5, 1, 2 and 3 respectively.
- +QIOTEVT: 5,10211,2,5,1,2,3
2) Send TSL property data
The device sends the TSL properties The remaining content of essential oil, Frequency of regular reporting and On/Off status to Developer Center.
Device sends TSL property
① Select the TSL properties to be sent.
② Click "Send TSL Data" to send the TSL properties to Developer Center.Information display on Developer Center
If the device sent TSL data to Developer Center, you can click "Device Debug" tab on the Device Details page to view the Real-time Data and TSL data in JSON format. Developer Center will receive the information such as the remaining content of essential oil (189.5), frequency of regular reporting (30) and on/off status (true) reported by the device.
3) Send TSL alert event
Send Alert to lack of essential oil to Developer Center, whose event ID is 4 and the output parameter ID is 1.
Device sends TSL event
① Select the TSL event to be sent.
② Click "Send TSL Data" to send TSL events to Developer Center.Information display on Developer Center
You can view the event data records in the "Event Logs" section of "Device Details" page.
2. Downlink TSL Data
Developer Center issues TSL service
Open Device Debug > Service Calls on "Device Details" page to simulate the scenario of remotely issuing control commands. From "Device Service" menu, select Service Calls > Select Service , select Working Mode 2 in "Set Parameter", and finally click "Send Command"
Unbuffered Mode
When a device in Unbuffered Mode receives data from Developer Center, it will print the data on MCU. For example, After the service is delivered in the Developer Center, the following results will be displayed on QthTools-MCU Simulator.
Interaction Data Description
+QIOTEVT: 5,10210,13: Event notification sent to MCU by the device after receiving the TSL data request from Developer Center.
5: Event type indicating that the downlink data was received.
10210: Event code indicating the issued TSL data is received.
13: Length of the data received.{"6":{"5":2}}: TSL service data in JSON format received from Developer Center.
Buffer Mode
When the device receives TSL data, the device will print event notification +QIOTEVT: 5,10200 to MCU to indicate that the device has received the transparent transmission data issued by Developer Center. If you want to view the content, MCU must send AT+QIOTRD=<req_length>.
Click "Read TSL Data" to read the buffered TSL data.
Interaction Data Description
+QIOTEVT: 5,10210: Event notification sent to MCU by the device after receiving the TSL data request from Developer Center.
5: Event type indicating that the downlink data was received.
10210: Event code indicating the issued TSL data is received.+QIOTMODELRD: 13,0,0: Response to TSL data.
13: Length of the data received.
0: Remaining length of the current data packet.
0: Number of remaining data packets.{"6":{"5":2}}: TSL service data in JSON format received from Developer Center.