Skip to content

Gateway Sub-device Commands

Gateway Sub-device Command Overview

AT CommandDescription
AT+QIOTSUBCONNConnect sub-device to gateway
AT+QIOTSUBDISCONNDisconnect/De-register sub-device from gateway
AT+QIOTSUBSENDSend transparent transmission data of the sub-device to Developer Center
AT+QIOTSUBRDRead transparent transmission data issued by Developer Center
AT+QIOTSUBTSLTDSend TSL data of the sub-device to Developer Center
AT+QIOTSUBTSLRDRead TSL data issued by Developer Center
AT+QIOTSUBHTBSend heartbeat packet
AT+QIOTSUBDEVINFOReport Sub-device Informationpacket
AT+QIOTSUBOTAREQRequest Sub-device OTA Upgrade Plan packet
AT+QIOTSUBOTAUPDATEConfigure Sub-device OTA Upgrade Operations packet
AT+QIOTSUBOTARDRead Sub-device OTA Firmware Data packet
AT+QIOTSUBLOCReport Sub-device Location Data packet

AT Command Introduction

AT+QIOTSUBCONN (Connect sub-device to gateway)

  • Description: This command connects the sub-device to the gateway.
  • Maximum Response Time: 300 ms.

Test Command

  • Issue

    c
    AT+QIOTSUBCONN=?
  • Response

    Return the parameter range supported to be configured.

    c
    +QIOTSUBCONN: <sessionType>,<lifetime>,<subPK>,<sub PS>,<subDK>[,<subDS>]
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBCONN=<sessionType>,<lifetime>,<subPK>,<subPS>,<subDK>[,<subDS>]
  • Response

    If the setting is successful:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <sessionType>: Integer type. Encryption method of data interaction of the sub-device.
  • <lifetime>: Integer type. The lifetime of the sub-device. Range: 60–65534. Unit: second.
  • <subPK> : String type. ProductKey generated when a product is created on Developer Center.
  • <subPS>: String type. ProductSecret generated when a product is created on Developer Center.
  • <subDK> : String type. Unique identifier of the sub-device.
  • <subDS>: String type. The device secret issued by Developer Center when the device authenticates to Developer Center.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (Connect sub-device to gateway.)

c
[TX]AT+QIOTSUBCONN=0,60,"pxxxxm","RGtwxxxxxxxxSUls","123456"

[RX]OK

AT+QIOTSUBDISCONN (Disconnect/De-register sub-device from gateway)

  • Description: This command disconnects/De-register sub-device from the gateway.
  • Maximum Response Time: 300 ms.

Test Command

  • Issue

    c
    AT+QIOTSUBDISCONN=?
  • Response

    Return the parameter range supported to be configured.

    c
    +QIOTSUBDISCONN: <subPK>,<subDK>[,<subPS>,<subDS>]
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBDISCONN=<subPK>,<subDK>[,<subPS>,<subDS>]
  • Response

    If the setting is successful:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subDK>: String type. Unique identifier of the sub-device.
  • <subPK> : String type. ProductKey generated when a product is created on Developer Center.
  • <subDS>: String type. The device secret issued by Developer Center when the device authenticates to Developer Center.
  • <subPS>: String type. ProductSecret generated when a product is created on Developer Center.

NOTE

  • This command is supported in SDK versions 2.9.2 and above.

Example

Example 1 (Disconnect sub-device from gateway.)

c
[TX]AT+QIOTSUBDISCONN="p1126m","123456"

[RX]OK

Example 2 (De-register sub-device from gateway.)

c
[TX]AT+QIOTSUBDISCONN="p1126m","RGtwxxxxxxxxSUls","123456","1213xxxxxxxx345"

[RX]OK

Note: Once the sub-device deregisters from the gateway, the old subDS is invalid. The sub-device needs to be certificated again and a new subDS will be returned.


AT+QIOTSUBSEND (Send transparent transmission data of the sub-device to Developer Center)

  • Description: This command sends transparent transmission data of the sub-device to Developer Center.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBSEND=?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBSEND: <subPK>,<subDK>,(range of supported <length>s),<data>
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBSEND=<subPK>,<subDK>,<length>[,<data>]
  • Response

    If the optional parameter is omitted and the sub-device has connected to Developer Center:

    c
    >

    After > is returned, input the data with the length equal to <length>.

    • If that Package ID is required when a sub-device reports a message to Developer Center is configured:
    c
    +QIOTSUBSEND:<subPK>,<subDK>,<txid>
    
    OK
    • Otherwise:
    c
    OK

    If the optional parameter is specified and the sub-device has connected to Developer Center:

    • If that Package ID is required when a sub-device reports a message to Developer Center is configured:

      c
      +QIOTSUBSEND:<subPK>,<subDK>,<txid>
      
      OK
    • Otherwise:

      c
      OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK> : String type. ProductKey generated when a product is created on Developer Center.
  • <subDK> : String type. Unique identifier of the sub-device.
  • <length>: Integer type. Data length to be sent. Unit: Byte.
    • If <data> is specified in the Write Command, the length range depends on the actual return value of the Test Command.
    • If <data> is not specified in the Write Command, the length range depends on the module performance.
  • <data> : The data to be sent.
    • If <data> is specified in the Write Command, the data to be sent can be of string type.
    • If <data> is not specified in the Write Command, the data to be sent can be of any byte stream type.
  • <txid>: Integer type. Range: 1–65535.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (Send transparent transmission data of the sub-device to Developer Center) The sub-device sends transparent transmission data of "123456ABC" to Developer Center:

c
[TX]AT+QIOTSUBSEND="p1126m","123456",9,"123456ABC"

[RX]OK

[RX]+QIOTSUBEVT: "p1126m","123456",4,10200

AT+QIOTSUBRD (Read transparent transmission data issued by Developer Center)

  • Description: This command reads the transparent transmission data issued by Developer Center to the sub-device.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately. The configurations are saved automatically.

Test Command

  • Issue

    c
    AT+QIOTSUBRD=?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBRD: <subPK>,<subDK>,(range of supported <req_length>s)
    
    OK

Read Command

  • Issue

    c
    AT+QIOTSUBRD?

Response

  • Return the supported range of legal parameters.

    c
    +QIOTSUBRD: <subPK>,<subDK>,<remain_pieces> 
    +QIOTSUBRD: <subPK>,<subDK>,<remain_pieces> 
    ...
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBRD=<subPK>,<subDK> [,<req_length>]
  • Response

    If the optional parameter is omitted, it indicates querying the current cache transparent transmission data length of the sub-device.

    c
    +QIOTSUBRD: <subPK>,<subDK>,<remain_pieces>
    
    OK

    If the optional parameter is specified, it indicates reading the current sub-device cache data.

    c
    +QIOTSUBRD: <subPK>,<subDK>,<cur_len>,<remain_len>,< remain_pieces><CR><LF>
    <data>
    
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subDK>: String type. Unique identifier of the sub-device.
  • <subPK> : String type. ProductKey generated when a product is created on Developer Center.
  • <req_length>: Integer type. Length of data to be read. Length range is subject to the value returned by the Test Command.
  • <cur_len>: Integer type. Length of data actually read.
  • <data> : Byte stream type. Data actually read.
  • <remain_len>: Integer type. Length of unread data remaining in the current data packet. Unit: bytes.
  • <remain_pieces> : Integer type. The number of the remaining data packages.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (The sub-device reads the transparent transmission data in buffer mode.)

i. Developer Center issues transparent transmission data. ii. The sub-device receives the transparent transmission data and prints the callback event to the serial port.

c
[RX]+QIOTSUBEVT: "p1126C","123456",5,10200

iii. After the sends the Read Command AT+QIOTSUBRD="p1126C","12345678",512 actively, the transparent transmission data actually queried is "123456ABC".

c
[TX]AT+QIOTSUBRD="p1126C","123456",512

[RX]+QIOTSUBRD: "p1126C","123456",9,0,2
[RX]123456ABC

OK

Example 2 (The sub-device reads the transparent transmission data in unbuffered mode.)

i. Developer Center issues transparent transmission data.
ii. The sub-device receives the transparent transmission data and prints the callback event and the transparent transmission data to the serial port.

c
[RX]+QIOTSUBEVT: "p1126C","123456",5,10200,9
123456ABC

AT+QIOTSUBTSLTD (Send TSL data of the sub-device to Developer Center)

  • Description: This command sends TSL data of the sub-device to Developer Center. If <pkgID> is specified in Write Command, this command responds to Developer Center request. if <pkgID> is omitted in Write Command, this command sends data to Developer Center. If the data is sent out, +QIOTSUBEVT: <subPK>,<subDK>,4,10210 will be reported to indicate that TSL data is sent out successfully.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBTSLTD=?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBTSLTD:<subPK>,<subDK>,<length>,(range of supported <pkgID>s)
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBTSLTD=<subPK>,<subDK>,<length>[,<pkgID>]
  • Response

    c
    >

    After > is returned, input the byte stream data with the length equal to <length>.

    • If the optional parameter is specified, this command responds to Developer Center request.
    c
    OK

    If the optional parameter is omitted, this command sends data to Developer Center.

    • If that Package ID is required when a sub-device reports a message to Developer Center is configured:

      c
      +QIOTSUBTSLTD:<subPK>,<subDK>,<txid>
      
      OK
    • Otherwise:

      c
      OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created on Developer Center.
  • <subDK>: String type. Unique identifier of the sub-device.
  • <length>: Integer type. Length of the data to be sent. Length range depends on the performance of the specific module model.
  • <pkgID> : Integer type. Request Package ID. Range: 1–65534. This parameter is required only when the device responds to the Developer Center request.
  • <txid>: Integer type. Uplink message ID. Range: 1–65535.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (Send TSL data)

The TSL data to be sent is shown below. ID: 1. Data type: Bool. Value: true. ID: 2. Data type: int. Value: 30.

c
[TX]AT+QIOTSUBTSLTD="p1126m","123456",17
[RX]> 
[TX]{"1":true,"2":30}
[RX]OK

[RX]+QIOTSUBEVT: "p1126m","123456",4,10210

AT+QIOTSUBTSLRD (Read TSL data issued by Developer Center)

  • Description: This command reads TSL data issued by Developer Center.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBTSLRD=?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBTSLRD:<subPK>,<subDK>,(range of supported <req_length>s)
    
    OK

Read Command

  • Issue

    c
    AT+QIOTSUBTSLRD?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBTSLRD:<subPK>,<subDK>,<remain_pieces> 
    +QIOTSUBTSLRD:<subPK>,<subDK>,<remain_pieces>
    ...
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBTSLRD=<subPK>,<subD K>[,<req_length>]
  • Response

    If the optional parameter is omitted, query the TSL data length cached by the current sub-device:

    c
    +QIOTSUBTSLRD: <subPK>,<subDK>,<remain_pieces>
    
    OK

    If the optional parameter is specified, read the TSL data cached by the current sub-device:

    c
    +QIOTSUBTSLRD: <subPK>,<subDK>,<cur_len>,<remain_l en>,<remain_pieces><CR><LF>
    <data>
    
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subDK>: String type. Unique identifier of the sub-device.
  • <subPK>: String type. ProductKey generated when a product is created on Developer Center.
  • <req_length>: Integer type. Length of data to be read. Length range is subject to the value returned by the Test Command.
  • <cur_len>: Integer type. Integer type. Length of data actually read.
  • <data>: Byte stream type. TSL Data actually read.
  • <remain_len>: Integer type. Length of unread data remaining in the current data packet. Unit: bytes.
  • <remain_pieces>: Integer type. The number of the remaining data packages.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (The sub-device reads TSL data in buffer mode.)

i. Developer Center issues TSL data.
ii. The module receives the issued command and prints the callback event and data to the MCU

c
[RX]+QIOTSUBEVT: "p1126C","123456",5,10200

iii. After the module receives TSL data, it actively prints the callback event +QIOTSUBEVT: “p1126m”,“123123123”,5,10210,10 and the TSL data issued by Developer Center to the MCU.

c
[TX]AT+QIOTSUBTSLRD="p1126m","123456",512

[RX]+QIOTSUBEVT: "p1126m","123456",5,10210,10
{"1":true}

[RX]OK

Example 2 (The sub-device prints TSL data in unbuffered mode.)

i. Developer Center issues TSL data.
ii. After the sub-device receives TSL data, it actively prints the callback event and data to the serial port.

c
[RX]+QIOTSUBEVT: "p1126m","123456",5,10210,10
[RX]{"1":true}

AT+QIOTSUBHTB (Send heartbeat packet)

  • Description: This command sends heartbeat packets to refresh the last interaction time between the sub-device and the gateway.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBHTB=?
  • Response

    Return the supported range of legal parameters.

    c
    +QIOTSUBHTB:<subPK>,<subDK>
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBHTB=<subPK>,<subDK>
  • Response

    If the setting is successful:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created on Developer Center.
  • <subDK>: String type. Unique identifier of the sub-device.

NOTE

  • This command is supported in SDK versions 2.9.0 and above.

Example

Example 1 (The sub-device sends the heartbeat packet)

c
[TX]AT+QIOTSUBHTB="p1126m","12345678"

[RX]OK

AT+QIOTSUBDEVINFO (Report Sub-device Information)

  • Description: This command reports the sub-device information.
  • Maximum Response Time: 300 ms.

Test Command

  • Issue

    c
    AT+QIOTSUBDEVINFO=?
  • Response

    Return the supported parameter ranges.

    c
    +QIOTSUBDEVINFO: <subPK>,<subDK>,<subVer>
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBDEVINFO=<subPK>,<subDK>,<subVer>
  • Response

    If the command is executed successfully:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created.
  • <subDK>: String type. The unique ID of a sub-device.
  • <subVer>: String type. Sub-device version.

NOTE

  • This command is supported in SDK versions 2.19.0 and above.

Example

Example 1 (The sub-device reports the version number)

c
[TX]AT+QIOTSUBDEVINFO="p1126m","12345678","1_0_0"

[RX]OK

AT+QIOTSUBOTAREQ (Request Sub-device OTA Upgrade Plan)

  • Description: This command requests a sub-device OTA upgrade plan.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBOTAREQ=?
  • Response

    Return the supported parameter ranges.

    c
    +QIOTSUBOTAREQ: <subPK>,<subDK>,<subVer>,<info>
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBOTAREQ=<subPK>,<subDK>,<subVer>,<info>
  • Response

    If the command is executed successfully:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created.
  • <subDK>: String type. The unique ID of a sub-device.
  • <subVer>: String type. Sub-device version.
  • <info>: Integer type. Sub-device communication mode. Range: 0–3.
    • 0– Neither SHA256 information nor an outgoing URL is required
    • 1–SHA256 information is required, but no outgoing URL is required
    • 2– No SHA256 information is required, but an outgoing URL is required.
    • 3– Both SHA256 information and an outgoing URL are required

NOTE

  • This command is supported in SDK versions 2.19.0 and above.

Example

Example 1 (The sub-device reports the version number)

c
[TX]AT+QIOTSUBOTAREQ="p1126m","12345678","1_0_0",0

[RX]OK

AT+QIOTSUBOTAUPDATE (Configure Sub-device OTA Upgrade Operations)

  • Description: This command configures the sub-device OTA upgrade operations.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBOTAUPDATE=?
  • Response

    Return the supported parameter ranges.

    c
    +QIOTSUBOTAUPDATE: <subPK>,<subDK>,<subVer>,<action>
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBOTAUPDATE=<subPK>,<subDK>,<subVer>,<action>
  • Response

    If the command is executed successfully:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created.
  • <subDK>: String type. The unique ID of a sub-device.
  • <subVer>: String type. Sub-device version.
  • <action>: Integer type. Sub-device OTA upgrade operations.
    • 0– Refuse the upgrade
    • 1– Confirm the upgrade
    • 3– Report the status of "Upgrading"
    • 4– Report the status of "Upgraded"
    • 5– Report the status of "Upgrade Failed"

NOTE

  • This command is supported in SDK versions 2.19.0 and above.

Example

Example 1 (The sub-device reports the version number)

c
[TX]AT+QIOTSUBOTAUPDATE="p1126m","12345678","1_0_0",1

[RX]OK

AT+QIOTSUBOTARD (Read Sub-device OTA Firmware Data)

  • Description: The command downloads the sub-device firmware data according to the URL issued by the platform and transfers the data to the user.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBOTARD=?
  • Response

    Return the supported parameter ranges.

    c
    +QIOTSUBOTARD: <subPK>,<subDK>,<startAddr>,<dataLen>
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBOTARD=<subPK>,<subDK>,<startAddr>,<dataLen>
  • Response

    If the command is executed successfully:

    c
    +QIOTSUBOTARD: <subPK>,<subDK>,<startAddr>,<dataLen>,<data>
    
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created.
  • <subDK>: String type. The unique ID of a sub-device.
  • <startAddr>: Integer type. The start address of downloading the firmware.
  • <dataLen>: Integer type. Size of the firmware data in single download. Range: 1–<max_datalen>. Unit: byte.
    • <max_dataLen>: Integer type. The memory size available for the firmware download in the module. Unit: byte.
  • <data>: Byte stream type. Firmware data.

NOTE

  • This command is supported in SDK versions 2.19.0 and above.

Example

Example 1 (The sub-device reports the version number)

c
[TX]AT+QIOTSUBOTARD="p1126m","12345678",0,5

[RX]+QIOTSUBOTARD: "p1126m","12345678",0,5,HELLO

[RX]OK

AT+QIOTSUBLOC (Report Sub-device Location Data)

  • Description: This command reports the sub-device location data.
  • Maximum Response Time: 300 ms.
  • Characteristics: The command takes effect immediately.

Test Command

  • Issue

    c
    AT+QIOTSUBLOC=?
  • Response

    Return the supported parameter ranges.

    c
    +QIOTSUBLOC: <subPK>,<subDK>,<NMEA>[,<NMEA>,...]
    
    OK

Write Command

  • Issue

    c
    AT+QIOTSUBLOC=<subPK>,<subDK>,<NMEA>
  • Response

    If the command is executed successfully:

    c
    OK

    If there is any error:

    c
    ERROR

Parameter

  • <subPK>: String type. ProductKey generated when a product is created.
  • <subDK>: String type. The unique ID of a sub-device.
  • <NMEA>: String type. Location data.

NOTE

  • This command is supported in SDK versions 2.19.0 and above.

Example

Example 1 (The sub-device reports the version number)

c
[TX]AT+QIOTSUBLOC="p1126m","12345678","$GPGGA,042523.0,3413.610533,N,10854.063257,E,1,05,2.6,438.5,M,-28.0,M,,*78"

[RX]+QIOTSUBEVT: 4,10220

[RX]OK