Appearance
Quick Access to Developer Center
Description
The primary function of a gateway is to enable communication between different devices that use different protocols. Sub-devices that do not have networking capabilities can connect to the IoT platform through the gateway. To achieve this, sub-devices must first be added to the gateway to establish a connection between the sub-device and the gateway. This section provides instructions on how to connect sub-devices to Developer Center through the gateway with AT commands.
Related AT Commands
AT Command | Description |
---|---|
AT+QIOTSUBCONN | Connect sub-device to gateway |
AT+QIOTSUBDISCONN | Disconnect sub-device from gateway |
AT+QIOTSUBSEND | Send transparent transmission data of the sub-device to Developer Center |
AT+QIOTSUBRD | Read transparent transmission data issued by Developer Center |
AT+QIOTSUBTSLTD | Send TSL data of the sub-device to Developer Center |
AT+QIOTSUBTSLRD | Read TSL data issued by Developer Center |
AT+QIOTSUBHTB | Send heartbeat packet |
Note: For details see AT Command Overview on Directly Connected Sub-device.
Procedures
1. Log in to Developer Center
Log in to Developer Center. If you don't have an account click Register Now to register.
- Create a Product.
2. Create Product
1) Create a Gateway Product
Creating a gateway product is similar to creating a cellular product. In the Device Type option, select Gateway.

2) Create a Sub-device Product

- Device Type:A directly connected device can directly access the network. A gateway device can help sub-devices to connect to Developer Center. A sub-device is a device that relies on the gateway to connect to the network.
- Specified Gateway:
- Disable: Sub-devices can access Developer Center through any gateway.
- Enable: Sub-devices can access Developer Center only through the specified gateway.
- Gateway Access Mode: Developer Center authorizes the gateway device.
- Access Network Only: App users have permission to control sub-devices only after sub-devices are bound to the gateway. This mode applies to the situation where the gateway is regarded as the network access and data forwarding channel.
- Enable Dynamical Gateway Switching: Sub-devices that have connected to Developer Center through a gateway can switch to another gateway to access Developer Center.
- Disable Dynamical Gateway Switching: Sub-devices that have connected to Developer Center through a gateway cannot switch to another gateway to access Developer Center.
- Product Integrated: App users have permission to control sub-devices after the gateway is bound. This mode applies to the situation where sub-devices are integrated into the gateway.
- Access Network Only: App users have permission to control sub-devices only after sub-devices are bound to the gateway. This mode applies to the situation where the gateway is regarded as the network access and data forwarding channel.
3. Configure Gateway Device
1) Configure Product Info (Required at the first connection)
When connecting to Developer Center for the first time, you must configure the product information through AT+QIOTCFG="productinfo"[,<pk>,<ps>] by downloading the product key into the device. After passing the device bootstrap/authentication, it will be automatically added to the specific product on Developer Center.
c
[TX]AT+QIOTCFG="productinfo","pxxxxt","cDVTxxxxxxxxWGVB"
[RX]AT+QIOTCFG="productinfo","pxxxxt","cDVTxxxxxxxxWGVB"
[RX]OK
2) Connect to Developer Center
The MCU can configure Developer Center connection mode through AT+QIOTREG=<reg_mode>. After sending the command, when the module responds with the following return values, it means the device has successfully connected to Developer Center.
c
[TX]AT+QIOTREG=1
[RX]AT+QIOTREG=1
[RX]OK
[RX]+QIOTEVT: 2,10200
[RX]+QIOTEVT: 3,10200
4. Sub-device Connects to Gateway
The capability of the gateway is to convert the communication protocols between different devices, allowing sub-devices that do not have networking capabilities to connect to the IoT platform through the gateway. To achieve this purpose, you need to add the sub-device to the gateway to establish the connection between the sub-device and the gateway. The gateway sub-device can connect to the gateway device through AT+QIOTSUBCONN.
c
[TX]AT+QIOTSUBCONN=0,60,"pxxxxm","RGtwxxxxxxxxxxSUls","123123123"
[RX]OK
Callback feedback of a successful connection event
After executing the gateway connection command, the device will be successfully connected to the gateway device upon the following response.
Callback of a successful device authentication event
c[RX]+QIOTSUBEVT: "pxxxxm","123123123",1,10200,"2c8e8a105e5c4c0fa3787deb7e96ede7"
Callback of a successful sub-device login event
c[RX]+QIOTSUBEVT: "pxxxxm","123123123",2,10200
5. Sub-device Sends Heartbeat Packets
To maintain the connection between the sub-device and the gateway, a heartbeat message is sent between them. The sub-device sends these packets periodically based on a sub-device keepalive time configured during connection to the gateway. To initiate the sending of these packets, the MCU must execute AT+QIOTSUBHTB.
c
[TX]AT+QIOTSUBHTB="pxxxxm","123123123"
[RX]OK
6. Sub-device TSL Data Interaction
For remote control of a smart device, a gateway must report the status of the device, receive and execute commands from the IoT platform. Therefore, data transmission is the core capability of the gateway. The smart LGB light sub-device will be used to illustrate TSL model interaction.
TSL Uplink Data
Send TSL data in JSON format
The table of sending TSL data is shown below.
ID | Type | Value |
---|---|---|
1 | Bool | true |
2 | Int | 30 |
Execute AT+QIOTSUBTSLTD="p1126m","123123123",17, After > is returned, MCU sends TSL data.
c
[TX]AT+QIOTSUBTSLTD="pxxxxm","123123123",17
[RX]>
[TX]{"1":true,"2":30}
[RX]OK
[RX]+QIOTSUBEVT: "pxxxxm","123123123",4,10210
TSL Downlink Data
Unbuffered Mode(Buffer mode is disabled by default unless otherwise configured.)
1) Developer Center Issues TSL Service
On the "Device Debug" page of Developer Center, first click Property Debug, and then select the TSL property to be issued, and last click Send Command in the lower left corner to issue the TSL property to the gateway sub-device.
2) The Module Receives TSL Data and Prints Callback Event and Data to MCU
After the module receives the TSL data, it will actively print the callback event +QIOTSUBEVT: "p1126m","123123123",5,10210,10 and the received TSL data {"1":true} to the MCU.
c[RX]+QIOTSUBEVT: "pxxxxm","123123123",5,10210,10 [RX]{"1":true}
Buffer Mode
1) Enable Downlink Data Buffer Mode The MCU can configure downlink data buffer mode through AT+QIOTCFG="buffer"[,<buffer_mode>].
c[TX]AT+QIOTCFG="buffer",1 [RX]AT+QIOTCFG="buffer",1 [RX]OK
2) Developer Center Issues TSL Service
On the Device Debug page of Developer Center, click "Property Debug" first, and then select the TSL property to be issued, and click "Send Command" in the lower left corner to issue the TSL property to the sub-device.
3) Module Receives the Command and Prints Callback Event to MCU
Callback event: +QIOTSUBEVT: "p1126m","123123123",5,10210
p1126m: ProductKey generated by the gateway sub-device when Developer Center creates a product.
123123123: DeviceKey of the gateway sub-device. It is a unique identifier.
5: Event type indicating that the downlink service event was received.
10210: Event code indicating that the TSL property event was received from Developer Center.
4) MCU Queries Data According to Callback Events
The TSL data queried with AT+QIOTSUBTSLRD is {"1":true}.
c[TX]AT+QIOTSUBTSLRD="pxxxxm","123123123",512 [RX]+QIOTSUBTSLRD: "pxxxxm","123123123",10,0,0 [RX]{"1":true} [RX]OK