AT Commands Manual For FC41D&FCM100D&FCM740D&FLMx40D Series Modules
Introduction
This document outlines Wi-Fi, BLE, TCP/UDP, SSL, MQTT, HTTP(S) and GPIO-related AT commands supported by Quectel FC41D, FCM100D, FCM740D and FLMx40D modules.
Applicable Modules
Applicable Modules:
| Module Family | Module |
|---|---|
| FC41D | |
| FCM100D | |
| FCM740D | |
| FLMx40D | FLM040D |
| FLM140D | |
| FLM240D | |
| FLM340D |
Definitions
<CR> Carriage return character.
<LF> Line feed character.
<...> Parameter name. Angle brackets do not appear on the command line.
[...] Optional parameter of a command or an optional part of TA information response. Square brackets do not appear on the command line. When an optional parameter is not given in a command, the new value equals its previous value or the default settings, unless otherwise specified.
Underline Default setting of a parameter.
AT Command Syntax
All command lines must start with AT or at and end with <CR>. Information responses and result codes always start and end with a carriage return character and a line feed character: <CR><LF><response><CR><LF>. In tables presenting commands and responses throughout this document, only the commands and responses are presented, and <CR> and <LF> are deliberately omitted.
AT commands implemented by the module fall into two categories syntactically: "Basic" and "Extended", as listed below:
- Basic
Basic command format is AT<x><n>, or AT&<x><n>, where <x> is the command, and <n> is/are the argument(s) of the command. For example, ATE<n> tells the DCE (Data Circuit-terminating Equipment) whether received characters should be echoed back to the DTE (Data Terminal Equipment) according to the value of <n>. <n> is optional and a default will be used if it is omitted.
- Extended
Extended commands can be executed in several modes, as shown in the following table:
Types of AT Commands:
| Command Type | Syntax | Description |
|---|---|---|
| Test Command | AT+<cmd>=? |
Test the existence of the corresponding command and return information about the type, value, or list of its parameter. |
| Read Command | AT+<cmd>? |
Check the current parameter value of the corresponding command. |
| Write Command | AT+<cmd>=<p1>[,<p2>[,<p3>[...]]] |
Set user-definable parameter value. |
| Execution Command | AT+<cmd> |
Return a specific information parameter or perform a specific action. |
Multiple commands can be placed on a single line using a semi-colon (;) between commands. In such cases, only the first command should have AT prefix. Commands can be in upper or lower case.
Spaces should be ignored when you enter AT commands, except in the following cases:
Within quoted strings, where spaces are preserved;
Within an unquoted string or numeric parameter;
Within an IP address;
Within the AT command name up to and including a =, ? or =?.
On input, at least a carriage return is required. A newline character is ignored so it is permissible to use carriage return/line feed pairs on the input.
If no command is entered after the AT token, OK will be returned. If an invalid command is entered, ERROR will be returned.
Optional parameters, unless explicitly stated, need to be provided up to the last parameter being entered.
AT Command Responses
When the AT command processor has finished processing a line, it will output OK, ERROR or +CME ERROR: <err> to indicate that it is ready to accept a new command. Solicited information responses are sent before the final OK, ERROR or +CME ERROR: <err>.
Responses will be in the format of:
<CR><LF>+CMD1:<parameters><CR><LF>
<CR><LF>OK<CR><LF>
Or
<CR><LF><parameters><CR><LF>
<CR><LF>OK<CR><LF>
Declaration of AT Command Examples
The AT command examples in this document are provided to help you learn about the use of the AT commands introduced herein. The examples, however, should not be taken as Quectel's recommendations or suggestions about how to design a program flow or what status to set the module into. Sometimes multiple examples may be provided for one AT command. However, this does not mean that there is a correlation among these examples, or that they should be executed in a given sequence. The URLs, domain names, IP addresses, usernames/accounts, and passwords (if any) in the AT command examples are provided for illustrative and explanatory purposes only, and they should be modified to reflect your actual usage and specific needs.
AT Commands Description
Description of Wi-Fi-Related AT Commands
AT+QRST
This command restarts the module.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QRST |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QVERSION
This command gets firmware version of the module.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QVERSION |
+QVERSION: <version>OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<version> |
String type without double quotation marks. Firmware version number. |
AT+QECHO
This command enables or disables echo function.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QECHO=<enable> |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable echo function. 0 Disable 1 Enable |
AT+QURCCFG
This command enables or disables URC reports.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QURCCFG=<enable> |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable URC report. 0 Disable 1 Enable |
AT+QPING
This command pings the external IP.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QPING=<IP> |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<IP> |
String type. External IP address. |
AT+QGETIP
This command gets the module IP information.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QGETIP=<mode> |
+QGETIP: ip:<IP>,gate:<gate>,mask:<mask>,dns:<DNS>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<mode> |
String type without double quotation marks. Wi-Fi working mode. station STA Mode ap AP Mode |
<IP> |
String type without double quotation marks. Module IP address. |
<gate> |
String type without double quotation marks. Module gateway. |
<mask> |
String type without double quotation marks. Module subnet mask. |
<DNS> |
String type without double quotation marks. Module DNS address. |
AT+QSETBAND
This command configures the serial port baud rate.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSETBAND=<baud_rate>[,<save>] |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately.
Parameter:
| Parameter | Description |
|---|---|
<baud_rate> |
Integer type. Serial port baud rate. Range: 2400--2000000. Unit: bps. |
<save> |
Integer type. If it is omitted, the serial port baud rate will be saved. 0 Do not save 1 Save |
AT+QWLANOTA
This command starts firmware OTA upgrade.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QWLANOTA=<URL>[,<port>] |
OKor ERROR |
Maximum Response Time: 120 s
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<URL> |
String type without double quotation marks. Address where firmware package is stored on the server. |
<port> |
Integer type. Port number. The default value is 80. |
AT+QLOWPOWER
This command configures the module to enter low power mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QLOWPOWER |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: After the module enters low power mode, the Wi-Fi/BLE connection will be disconnected, and the device will continue executing code once it is awakened.
AT+QDEEPSLEEP
This command configures the module to enter deep sleep mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QDEEPSLEEP |
OKor ERROR |
| Maximum Response Time | 300 ms | |
Characteristics: The module will be rebooted after it is awakened.
AT+QWLMAC
This command gets module MAC address.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QWLMAC |
+QWLMAC: <MAC>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<MAC> |
MAC address of the module. Hexadecimal numbers separated by colons. Default value: c8:47:8c:42:00:48. |
AT+QAIRKISS
This command enables or disables AirKiss function.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QAIRKISS=<enable> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable AirKiss function. 0 Disable 1 Enable |
AT+QSTAST
This command queries STA mode state.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QSTAST |
+QSTAST: <state>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<state> |
String type without double quotation marks. STA mode state. STATION_DOWN Disabled STATION_UP Enabled |
AT+QSTADHCP
This command enables or disables DHCP service in STA mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSTADHCP=\<enable> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable DHCP service in STA mode. 0 Disable 1 Enable |
AT+QSTADHCPDEF
This command enables or disables DHCP service in STA mode and saves the configuration.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSTADHCPDEF=\<enable> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is saved automatically.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable DHCP service in STA mode and save the configuration. 0 Disable 1 Enable |
AT+QSTASTATIC
This command configures the static IP of STA mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSTASTATIC=\<IP>,\<mask>,\<gate>,\<DNS> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<IP> |
String type without double quotation marks. Static IP address of STA mode. |
<mask> |
String type without double quotation marks. Module subnet mask. |
<gate> |
String type without double quotation marks. Module gateway. |
<DNS> |
String type without double quotation marks. Module DNS address. |
AT+QSTASTOP
This command disables STA mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QSTASTOP |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QSOFTAP
This command enables AP mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSOFTAP=<SSID>[,<key>] |
OKOr ERROR |
| Maximum Response Time | 3300 ms (encrypted hotspot enabled)/300 |
| | ms (passwordless hotspot enabled) |
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<SSID> |
String type without double quotation marks. AP name. Range: 1--32. Unit: byte. |
<key> |
String type without double quotation marks. AP security key. Range: 8--63. Unit: byte. If it is omitted, the passwordless hotspot will be enabled. |
AT+QAPSTATE
This command queries AP mode state.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QAPSTATE |
+QAPSTATE: <state>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<state> |
String type without double quotation marks. AP mode state. SOFTAP_DOWN Disabled SOFTAP_UP Enabled |
AT+QAPGETLIST
This command queries the information of the STA that is connected to the module AP. A maximum of 2 STAs can be connected.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QAPGETLIST |
[<num>: mac:<mac>, ip:<ip>] [...] OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<num> |
Integer type. STA serial number. |
<mac> |
String type without double quotes. MAC address of STA. |
<ip> |
String type without double quotes. IP address of STA. |
AT+QAPSTATIC
This command configures static IP of AP mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QAPSTATIC=<IP>,<mask>,<gate>,<DNS> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<IP> |
String type without double quotation mark. Static IP address of AP mode. |
<mask> |
String type without double quotation mark. Module subnet mask. |
<gate> |
String type without double quotation mark. Module gateway. |
<DNS> |
String type without double quotation mark. Module DNS address. |
AT+QSOFTAPSTOP
This command disables AP mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QSOFTAPSTOP |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QSTAAPINFO
This command connects an AP hotspot to enable STA mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSTAAPINFO=<SSID>[,<pwd>] |
OK+QSTASTAT: "WLAN_CONNECTED" +QSTASTAT: "GOT_IP" or ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<SSID> |
String type without double quotation marks. Name of AP hotspot to be connected. Range: 1--32. Unit: byte. If the value of this parameter contains special characters such as ",", ";", "=", or "\", these characters need to be escaped. |
<pwd> |
String type without double quotation marks. Security key of AP hotspot to be connected. Range: 8--64. Unit: byte. If it is omitted, the passwordless hotspot will be connected. If the value of this parameter contains special characters such as ",", ";", "=", or "\", these characters need to be escaped. |
AT+QSTAAPINFODEF
This command connects a hotspot to enable STA mode and saves the connected hotspot information.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSTAAPINFODEF=<SSID>[,<pwd>] |
OKor ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are saved automatically.
Parameter:
| Parameter | Description |
|---|---|
<SSID> |
String type without double quotation marks. Name of AP hotspot to be connected. Range: 1--32. Unit: byte. |
<pwd> |
String type without double quotation marks. Security key of AP hotspot to be connected. Range: 8--64. Unit: byte. If it is omitted, the passwordless hotspot will be connected. |
AT+QGETWIFISTATE
This command queries the connected hotspot when the module is in STA mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QGETWIFISTATE |
+QGETWIFISTATE: ssid=<SSID>,bssid=<BSSID>,rssi=<RSSI>,channel=<channel>,cipher_type=<cipher_type>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<SSID> |
String type. Name of connected Wi-Fi hotspot. |
<BSSID> |
String type without double quotation marks. MAC address of Wi-Fi network card. |
<RSSI> |
Integer type. Wi-Fi signal strength. |
<channel> |
Integer type. Channel used by module to connect and communicate with Wi-Fi hotspot. |
<cipher_type> |
String type without double quotation marks. Encryption type. |
AT+QWSCAN
This command queries the scanned hotspot information.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QWSCAN |
+QWSCAN: <SSID>,<PSK_type>,<RSSI>,<BSSID>,<channel> [...] OKIf there is any error: ERROR |
Maximum Response Time: 3 s
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<SSID> |
String type. Name of scanned Wi-Fi hotspot. |
<PSK_type> |
String type without double quotation marks. Encryption type. |
<RSSI> |
Integer type. Wi-Fi signal strength. |
<BSSID> |
String type without double quotation marks. MAC address of Wi-Fi network card. |
<channel> |
Integer type. Channel used by module to connect and communicate with Wi-Fi hotspot. |
AT+QWEBCFG
This function enables or disables configuring Wi-Fi via Web.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QWEBCFG=<enable> |
OKOr ERROR |
| Maximum Response Time | 300 ms | |
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable configuring Wi-Fi via Web. 0 Disable 1 Enable |
AT+QAPCFG
This command configures the maximum number of AP to be connected. Set it before enabling the AP.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QAPCFG=? |
+QAPCFG: "linknum",( list ofsupported <max_link_num>s)OK |
| Write Command | AT+QAPCFG="linknum"[,<max_link_num>] |
If the optional parameter is omitted, query the current setting.+QAPCFG: "linknum",<max_link_num>OKIf the optional parameter is specified, configure the maximum number of AP to be connected. OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<max_link_num> |
Integer type. The maximum number of AP to be connected. Range: 1--2. |
Description of BLE-Related AT Commands
AT+QBLEINIT
This command initializes BLE service.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEINIT=<role>[,<auto_adv>] |
OKOr ERROR |
| Read Command | AT+QBLEINIT? |
+QBLEINIT: <role>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<role> |
Integer type. Initialize BLE service. 0 Uninitialized 1 Module is operating as a central device for initializing BLE. 2 Module is operating as a peripheral device for initializing BLE. Peripheral devices turn on broadcast automatically by default after the BLE connection is disconnected. If you do not need this feature, you can send AT+QBLEINIT=2,0 during BLE initialization to turn it off. 3 Module is operating as a peripheral device for configuring Wi-Fi via BLE. |
<auto_adv> |
Integer type. When module is operating as a peripheral device, whether the advertising starts automatically after the BLE connection is disconnected. 0 Not start 1 Start |
AT+QBLEDEINIT
This command de-initializes the BLE service.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QBLEDEINIT |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QBLEURC
This command enables or disables the URC prompt for receiving data.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEURC=<enable> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<enable> |
Integer type. Enable or disable the URC prompt for receiving data. 0 Disable 1 Enable. After the URC prompt is enabled, when the module receives data from the peer, it will first output the URC +QBLERECV prompt before the data is output at the serial port. 2 Enable. After the URC prompt is enabled, when the module receives data from the peer, it will first output the URC +QBLERECV prompt before the data is output at the serial port. When the module operates as a peripheral device, it will report the peer information by outputting the URC +QBLEPEERRINFO prompt upon successful connection. |
AT+QBLEADDR
This command queries the BLE device address.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLEADDR? |
+QBLEADDR:\<BLE_addr>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<BLE_addr> |
String type without double quotation marks. BLE device address. A 48-bit address is represented in a string of hexadecimal numbers, such as 58:D3:91:01:02:03. |
AT+QBLENAME
This command sets a BLE name.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLENAME? |
+QBLENAME:<BLE_name>OKIf there is any error: ERROR |
| Write Command | AT+QBLENAME=<BLE_name> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<BLE_name> |
String type without double quotation marks. BLE name. Maximum length: 25 bytes. |
AT+QBLEADVPARAM
This command configures BLE advertising parameters when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEQADVPARAM=<adv_int_min>,<adv_int_max> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<adv_int_min> |
Integer type. Minimum advertising interval for undirected advertising and low duty cycle directed advertising. Range: 0x0020--0x4000 (Time range: 20 ms--10.24 s). Default value: 0x0800 (1.28 s). Unit: timeslot (1 timeslot = 0.625 ms). |
<adv_int_max> |
Integer type. Maximum advertising interval for undirected advertising and low duty cycle directed advertising. Range: 0x0020--0x4000 (Time range: 20 ms--10.24 s). Default value: 0x0800 (1.28 s). Unit: timeslot (1 timeslot = 0.625 ms). |
NOTE
To configure advertising parameters, AT+QBLEADVPARAM should be executed before initiating advertising with AT+QBLEADVSTART.
AT+QBLEADVDATA

| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEADVDATA=<adv_data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<adv_data> |
String type without double quotation marks. Advertising data (AD). It consists of three fields (i.e., multiple AD Structures). The composition conforms to the message format shown above and the content must be a hexadecimal string. Length Length of AD structure. The length includes AD type and AD data but not the length of the field which is 1 byte long. The maximum length is 0x1e, i.e., the maximum length of a data field is 30 bytes. AD Type Advertising data type, such as TX Power Level (0x0A), Local Name (0x09), Le Role (0x1C) and Service UUIDs (0x16). After the peer scans the advertisement, the meaning of the advertising data can be determined from the AD Type. AD Data Advertising data in big-endian byte order. |
NOTE
For details of AD types, see Core Specification 5.2 (https://www.bluetooth.com/specifications/specs/core-specification/).
AT+QBLESRDATA
This command sets BLE scan response data when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLESRDATA=<sr_data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<sr_data> |
String type without double quotation marks. Advertising data (AD). It consists of three fields (i.e., multiple AD Structures), which is similar to <adv_data>.Length Length of AD structure. The length includes AD type and AD data but not the length of the field which is 1 byte long. The maximum length is 0x1e, i.e., the maximum length of a data field is 30 bytes. AD Type Advertising data type, such as TX Power Level (0x0A), Local Name (0x09), Le Role (0x1C) and Service UUIDs (0x16). After the peer scans the advertisement, the meaning of the advertising data can be determined from the AD Type. AD Data Advertising data in big-endian byte order. |
AT+QBLEGATTSSRV
This command establishes a BLE service when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLEGATTSSRV? |
[+QBLEGATTSSRV:<srv_index>,<srv_UUID>]OK |
| Write Command | AT+QBLEGATTSSRV=<srv_UUID> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<srv_index> |
Integer type. The service index. |
<srv_UUID> |
String type without double quotation marks. BLE service UUID. Length: 2 bytes or 16 bytes. |
NOTE
Only one BLE service is established at a time with this command.
AT+QBLEGATTSCHAR
This command sets BLE characteristic UUID when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLEGATTSCHAR? |
+QBLEGATTSCHAR:"char",<srv_index>,<char_index>,<char_UUID>,<att_cfg>OKIf there is any error: ERROR |
| Write Command | AT+QBLEGATTSCHAR=<char_UUID>[,<att_cfg>] |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<srv_index> |
Integer type. The service index. |
<char_index> |
Integer type. The characteristic index. |
<char_UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<att_cfg> |
Integer type. Hexadecimal data. Attribute configuration of characteristic UUID. Range: 1--FF. bit7--bit0 represent the control of different attributes, which are shown below. You can configure the corresponding bit to 0, which indicates that the attribute is disabled, and 1 indicates that the attribute is enabled. For example, FF indicates enabling to configure the attributes controlled by bit7--bit0. bit7--bit5 Reserved bit4 Read bit3 Indicate bit2 Notify bit1 Write no response bit0 Write |
AT+QBLEADVSTART
This command starts BLE advertising when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLEADVSTART? |
+QBLEADVSTART: <adv_state>OKIf there is any error: OK |
| Execution Command | AT+QBLEADVSTART |
OKOr ERROR |
Maximum Response Time: 1000 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<adv_state> |
Integer type. BLE advertising status. 1. Stopped 1 Started |
AT+QBLEADVSTOP
This command stops BLE advertising when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QBLEADVSTOP |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QBLEGATTSNTFY
This command sends GATT data by notification when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTSNTFY=<UUID>[,<hex_length>],<data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<hex_length> |
Integer type. The length of hexadecimal data. The module will convert <data> to hexadecimal format before sending data when this optional parameter is specified. For example, if <data> is 123456, the module will convert it to 0x123456 and send it. |
<data> |
String type without double quotation marks. GATT data. |
AT+QBLEGATTSIND
This command sends GATT data by indication when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTSIND=<UUID>[,<hex_length>],<data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<hex_length> |
Integer type. The length of hexadecimal data. The module will convert <data> to hexadecimal format before sending data when this optional parameter is specified. For example, if <data> is 123456, the module will convert it to 0x123456 and send it. |
<data> |
String type without double quotation marks. GATT data. |
AT+QBLEGATTSCFGREAD
This command configures BLE characteristic value with read attribute when the module is operating as a peripheral device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTSCFGREAD=<UUID>[,<hex_length>],<data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<hex_length> |
Integer type. The length of hexadecimal data. Range: 1--128. Unit: byte. The module will convert <data> to hexadecimal format before sending data when this optional parameter is specified. For example, if <data> is 123456, the module will convert it to 0x123456 and send it. |
<data> |
String type without double quotation marks. GATT data. |
AT+QBLESCAN
This command starts or stops BLE scan when the module is operating as a central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLESCAN=<scan>[,<timeout>] |
If <scan> is 0:OKIf <scan> is 1:OK+QBLESCAN: <name>,<address_type>,<address>If <scan> is 2 or 3:OK+QBLESCAN:<name>,<address_type>,<address>,<adv_data>If there is any error: ERROR |
Maximum Response Time: 1000 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<scan> |
Integer type. Start or stop BLE scan. 0 Stop 1 Start BLE scan but do not output advertising data or scan response data. 2 Start BLE scan and output advertising data and scan response data. It is not required to manually stop BLE scan in this mode. 3 Start BLE scan and output advertising data and scan response data. Only connectable advertising is scanned in this mode. |
<timeout> |
Integer type. Scan duration. Range: 100--10000. Unit: ms. It must be set when <scan> is 2 or 3. |
<name> |
String type without double quotation marks. BLE device name. |
<address_type> |
Integer type. BLE device address type. 0 Public address 1 Random address |
<address> |
String type without double quotation marks. BLE device address. Length: 12 bytes. |
<adv_data> |
String type without double quotation marks. The scanned BLE advertising data and scan response data. |
AT+QBLESCANPARAM
This command sets BLE scan parameters when the module is operating as a central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLESCANPARAM=<scan_interval>,<scan_window> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<scan_interval> |
Integer type. LE scan interval. Range: 0x0012--0x1000 (Time range: 11.25 ms to 2.56 s). Default value: 0x0064. Unit: timeslot (1 timeslot = 0.625 ms). |
<scan_window> |
Integer type. LE scan duration. <scan_window> shall be less than or equal to <scan_interval>. Range: 0x0011--0x1000 (Time range: 10.625 ms-- 2.56 s). Default value: 0x001E. Unit: timeslot (1 timeslot = 0.625 ms). |
AT+QBLECONN
This command connects a peripheral when the module is the central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLECONN=<addr_type>,<peer_addr> |
OKOr ERROR |
Maximum Response Time: 3000 ms
Characteristics: The command takes effect immediately. The configurations are not saved. The connection timeout is 18 seconds.
Parameter:
| Parameter | Description |
|---|---|
<addr_type> |
Integer type. Peripheral device address type. 0 Public address 1 Random address |
<peer_addr> |
String type without double quotation marks. Peripheral device address. |
AT+QBLECONNPARAM
This command configures connection parameters when the module is the central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLECONNPARAM=<con_interval>,<timeout>,<latency> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<con_interval> |
Integer type. Connection interval. Range: 0x0006--0x0C80 (Time range: 7.5 ms to 4 s). Default value: 30. Unit: 1.25 ms. |
<timeout> |
Integer type. BLE Link supervision timeout. Range: 0x000A to 0x0C80 (Time range: 100 ms to 32 s). Default value: 500. Unit: 10 ms. |
<latency> |
Integer type. Slave latency for the connection in a certain number of connection events. Range: 0--499 (0x0000 to 0x01F3). Default value: 0. |
AT+QBLECFGMTU
This command queries the maximum transmission unit for BLE when the module is the central device.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QBLECFGMTU? |
+QBLECFGMTU: <MTU_value>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<MTU_value> |
Integer type. Maximum transmission unit value. Range: 23--512. Unit: byte. |
NOTE
The MTU will be automatically updated when the BLE is connected.
AT+QBLEGATTCNTFCFG
This command enables or disables notification when the module is operating as central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTNTFCFG=<UUID>,<enable> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<enable> |
Integer type. Enable or disable notification. 0 Disable 1 Enable |
AT+QBLEGATTCWR
This command sends GATT data when the module is operating as central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTCWR=<UUID>[,<hex_length>],<data> |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<hex_length> |
Integer type. The length of hexadecimal data. The module converts <data> to hexadecimal format before sending data when this optional parameter is specified. For example, if <data> is 123456, the module converts the data to 0x123456 and then sends it. |
<data> |
String type without double quotation marks. GATT data. |
AT+QBLEGATTCRD
This command reads GATT data when the module is the central device.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLEGATTCRD=<UUID> |
OK<data>Or ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configuration is not saved.
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type without double quotation marks. Characteristic UUID. Length: 2 bytes or 16 bytes. |
<data> |
String type without double quotation marks. Read GATT data. |
AT+QBLEDISCONN
This command disconnects a BLE connection.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QBLEDISCONN |
OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
AT+QBLESTAT
This command queries the state of BLE device.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QBLESTAT |
+QBLESTAT: <BLE_state>OKIf there is any error: ERROR |
Maximum Response Time: 600 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<BLE_state> |
String type without double quotation marks. Current state of BLE device. NOINIT Uninitialized INIT Initialized ADVERTISING Advertising NOADVERTISING Not advertising CONNECTED Connected DISCONNECTED Disconnected |
AT+QBLETRANMODE
This command specifies the characteristic UUID and enables the module to enter transparent transmission mode.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLETRANMODE=<UUID>[,<state>] |
OKOr ERROR |
Maximum Response Time: 500 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<UUID> |
String type. Characteristic UUID. Length: 4 bytes or 32 bytes. |
<state> |
Integer type. This parameter only takes effect when the module is operating as a peripheral device. 0 When the module is operating as a peripheral device and enters transparent transmission mode for the first time. When the BLE connection is disconnected, the module exits transparent transmission mode. And the module will not automatically enter transparent transmission mode by default when it is connected to any device subsequently. 1 When the module is operating as a peripheral device and enters transparent transmission mode for the first time. When the BLE connection is disconnected, the module exits transparent transmission mode. And the module will automatically enter transparent transmission mode by default when it is connected to any device subsequently. |
NOTE
1.When the module is operating as a central device, after establishing the BLE connection and completing the discovering of peer device service, execute the command to set the module to transparent transmission mode. After disconnecting the BLE connection, the module exits transparent transmission mode automatically. You can only send data in transparent transmission mode by "Write no response".
2. When the module is operating as a peripheral device, after enabling advertising or establishing the BLE connection, execute the command to set the module to transparent transmission mode. You can only send data in transparent transmission mode by Notify.
3. +++ (see +++) can be executed to make the module exit transparent transmission mode, after which the module will not enter transparent transmission mode by default when it is connected to any device subsequently whether the module is operating as a peripheral device or a central device.
AT+QBLESEND
This command sends data via BLE characteristic UUID.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QBLESEND=<conn_idx>,<uuid>,<att_cfg>,<data_len> |
>After > is returned, enter the data to be sent.When the data content reaches the specified length: Sent successfully: OKSending failed: ERROR |
Maximum Response Time: 500 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<conn_idx> |
Integer type. The target device index that the module automatically assigns when a BLE connection is established. This parameter can only be set to 0. |
<uuid> |
String type. Characteristic UUID. Length: 4 bytes or 32 bytes. |
<att_cfg> |
Integer type. Hexadecimal data. Attribute configuration of characteristic UUID. Range: 1--FF. bit7--bit0 represent the control of different attributes, which are shown below. You can configure the corresponding bit to 0, which indicates that the attribute is disabled, and 1 indicates that the attribute is enabled. For example, FF indicates enabling to configure the attributes controlled by bit7--bit0. bit7--bit4 Reserved bit3 Indicate bit2 Notify bit1 Write no response bit0 Write |
<data_len> |
Integer type. Data length. Maximum value: <MTU_value> - 3. Unit: byte. For more information about <MTU_value>, see AT+QBLECFGMTU. |
Description of TCP/UDP Related AT commands
AT+QICFG
This command configures optional parameters for TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QICFG=? |
+QICFG: "transpktsize",(list of supported <transpktsize>s)+QICFG: "transwaittm",(list of supported <transwaittm>s)+QICFG: "accept/mode",(list of supported <accept_mode>s)+QICFG: "tcp/tw_cycle"(list of supported <tcp_tw_cycle>s)+QICFG: "datatype",(list of supported <data_type>s)+QICFG: "tcp/retransmit",(list of supported <rto_val>s),(list of supported <retry_cnt>s)+QICFG: "udp/broadcast",(list of supported <udp/broadcast>)+QICFG: "tcplistener/raw",(list of supported <tcplistener/raw>s)OK |
| Write Command | AT+QICFG="transpktsize"[,<transpktsize>] |
If the optional parameter is omitted, query the current setting:+QICFG: "transpktsize",<transpktsize>OKIf the optional parameter is specified, configure sub-package length of data to be sent in transparent transmission mode: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="transwaittm"[,<transwaittm>] |
If the optional parameter is omitted, query the current setting:+QICFG: "transwaittm",<transwaittm>OKIf the optional parameter is specified, configure user data reception waiting time of serial port in transparent transmission mode: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="accept/mode"[,<accept_mode>] |
If the optional parameter is omitted, query the current setting:+QICFG: "accept/mode",<accept_mode>OKIf the optional parameter is specified, configure acceptance mode of "TCP Incoming": OKIf there is any error: ERROR |
| Write Command | AT+QICFG="tcp/tw_cycle"[,<tcp_tw_cycle>] |
If the parameter is omitted, query the current setting:+QICFG: "tcp/tw_cycle",<tcp_tw_cycle>OKIf the parameter is specified, configure the release method of port occupied by "TCP" connection: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="datatype"[,<data_type>] |
If the optional parameter is omitted, query the current setting:+QICFG: "datatype",<data_type>OKIf the optional parameter is specified, configure type of data to be sent: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="tcp/retransmit",<rto_val>,<retry_cnt> |
If the optional parameter is omitted, query the current setting:+QICFG: "tcp/retransmit",<rto_val>,<retry_cnt>OKIf the optional parameter is specified, configure TCP data retransmission interval and count: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="udp/broadcast"[,<udp/broadcast>] |
If the optional parameter is omitted, query the current setting:+QICFG: "udp/broadcast",<udp/broadcast>OKIf the optional parameter is specified, turn on/off UDP broadcast: OKIf there is any error: ERROR |
| Write Command | AT+QICFG="tcplistener/raw"[,<tcplistener/raw>] |
If the optional parameter is omitted, query the current setting:+QICFG: "tcplistener/raw",<tcplistener/raw>OKIf the optional parameter is specified, turn on/off transparent transmission of the TCP server: OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<transpktsize> |
Integer type. Sub-package length of data to be sent. Range: 1--1460. Default value: 1024. Unit: byte. |
<transwaittm> |
Integer type. Data reception waiting time if the received data is less then <transpktsize> in transparent transmission mode. If <transwaittm> is 0, the data is sent as soon as it is received. Range: 0--20. Default value: 2. Unit: 100 ms. |
<accept_mode> |
Integer type. Acceptance mode of TCP incoming connection. 0 Accept automatically 1 Accept manually with AT+QIACCEPT |
<tcp_tw_cycle> |
Integer type. Release method of port occupied by "TCP" connection. 0 Release immediately 1 Release delay |
<data_type> |
Integer type. Type of data to be sent. 0 Non-hex string 1 Hex string 2 Hex data |
<rto_val> |
Integer type. TCP data retransmission interval. Range: 1--10. Unit: second. Default value: 3. |
<retry_cnt> |
Integer type. TCP data retransmission count. Range: 3--20. Default value: 10. |
<udp/broadcast> |
Integer type. Turn on/off UDP broadcast. 0 Turn off 1 Turn on |
<tcplistener/raw> |
Integer type. Turn on/off transparent transmission of the TCP server. 0 Turn off 1 Turn on |
AT+QIOPEN
This command opens a TCP/UDP socket service. The maximum response time for establishing a TCP connection as a client is determined by the timeout of the TCP three-way handshake. The timeout of the TCP three-way handshake supported by the module is 120 seconds. When <service_type> is "UDP "/"TCP LISTENER"/"UDP SERVICE", the response timeout is about 300 milliseconds.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QIOPEN=? |
+QIOPEN: (list of supported <socketID>s),(list of supported <service_type>s),"ip/dns",(list of supported <remote_port>s),(list of supported <local_port>s),(list of supported <access_mode>s),(list of supported <local_IP>s)OK |
| Write Command | AT+QIOPEN=<socketID>,<service_type>,<remoteIP/domain_name>,<remote_port>,<local_port>,<access_mode>[,<local_IP>] |
If <access_mode> is 2:CONNECTOr ERRORIf <access_mode> is not 2:OK+QIOPEN: <socketID>,<err>Or ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<service_type> |
String type. Socket service type. "TCP" Start a TCP connection as a client "UDP" Start a UDP connection as a client "TCP LISTENER" Start a TCP server to listen for incoming TCP connections "UDP SERVICE" Start a UDP service |
<remoteIP> |
String type. IP address of the remote server. It is valid only when <service_type> is "TCP"/"UDP". |
<domain_name> |
String type. Remote server domain name. It is valid only when <service_type> is "TCP"/"UDP". |
<remote_port> |
Integer type. Remote server port. It is valid only when <service_type> is "TCP"/"UDP". Range: 1--65535. |
<local_port> |
Integer type. Local port. When <service_type> is "TCP LISTENER"/"UDP SERVICE", local port must be specified. Range: 1--65535. When <service_type> is "TCP"/"UDP", this parameter can be set to 0, indicating the usage of a random port. Range: 0--65535. |
<access_mode> |
Integer type. Data access mode of serial port. 0 Buffer access mode. Socket sends and receives data with AT commands. 1 Direct push Mode. Socket sends data in AT command and receives data in URC format. 2 Transparent transmission mode. Serial port is exclusively used for sending/receiving data directly to/from the Internet. |
<local_ip> |
Integer type. Specify the IP address of AP or STA. 0 Use IP address of STA 1 Use IP address of AP |
<err> |
Integer type. Result code. See Summary of Result Codes for details. |
NOTE
When <service_type> is "TCP LISTENER"/"UDP SERVICE", <access_mode> cannot be set to 2.
AT+QISTATE
This command queries the state of TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QISTATE=<socketID> |
+QISTATE: <socketID>,<service_type>,<remote_addr>,<remote_port>,<local_port>,<state>OK |
| Read Command | AT+QISTATE? |
Return the state of all existing connections:[+QISTATE: <socketID>,<service_type>,<remote_addr>,<remote_port>,<local_port>,<state>][...]OK |
| Execution Command | AT+QISTATE |
Return the state of all existing connections:[+QISTATE: <socketID>,<service_type>,<remote_addr>,<remote_port>,<local_port>,<state>][...]OK |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<service_type> |
String type. Socket service type. "TCP" Start a TCP connection as a client "UDP" Start a UDP connection as a client "TCP LISTENER" Start a TCP server to listen for incoming TCP connections "UDP SERVICE" Start a UDP service "TCP INCOMING" Start a TCP connection accepted by the TCP server |
<remote_addr> |
String type. IP address of the remote server. It is valid only when <service_type> is "TCP"/"UDP"/"TCP INCOMING". |
<remote_port> |
Integer type. Remote server port. It is valid only when <service_type> is "TCP"/"UDP"/"TCP INCOMING". |
<local_port> |
Integer type. Local port. |
<state> |
Integer type. Socket service state. 0 "Initial" client connection is not established 1 "Opening" client is connecting or server is trying to listen 2 "Connected" client connection is established 3 "Listening" server is listening 4 "Closing" client connection is closing |
AT+QISEND
This command sends data through TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QISEND=? |
+QISEND: (list of supported <socketID>s),(list of supported <send_len>s),"data"[,"remote_ip",(list of supported <remote_port>s)]OK |
| Write Command | AT+QISEND=<socketID>,0 |
When <send_len> is 0, query the sent data:+QISEND: <total_send_size>,<acked_size>,<unacked_size>OKIf there is any error: ERROR |
| Write Command | AT+QISEND=<socketID>,<send_len>,<data>,<remote_ip>,<remote_port> |
When <service_type> is "UDP SERVICE":+QISEND: <actual_send_len>OKIf there is any error: ERROR |
| Write Command | AT+QISEND=<socketID>,<send_len>,<data> |
When <service_type> is "TCP"/"UDP"/"TCP INCOMING":+QISEND: <actual_send_len>OKIf there is any error: ERROR |
| Write Command | AT+QISEND=<socketID>,<send_len>,<remote_ip>,<remote_port> |
When set AT+QICFG="datatype",2:>After receiving the > character, enter hex data of <send_len> length within 30 seconds. If timeout occurs, an error will be reported and the operation will exit. If the data length exceeds <send_len>, the excess data will be truncated.OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<send_len> |
Integer type. Length of data to be sent. Range: 0--1460. Unit: byte. |
<data> |
String type. Data to be sent. If the value of this parameter contains special characters such as ",", ";", "=", or "\", these characters need to be escaped. |
<remote_ip> |
String type. Destination address of data to be sent. It is valid only when <service_type> is "UDP SERVICE". |
<remote_port> |
Integer type. Destination port of data to be sent. It is valid only when <service_type> is "UDP SERVICE". Range: 1--65535. |
<actual_send_len> |
Integer type. Actual length of data written to socket. Unit: byte. |
<total_send_size> |
Integer type. Total length of data written to socket. Unit: byte. |
<acked_size> |
Integer type. Length of acknowledged data. Unit: byte. |
<unacked_size> |
Integer type. Length of unacknowledged data. Unit: byte. |
AT+QIRD
This command reads the data received from TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QIRD=? |
+QIRD: (list of supported <socketID>s),(list of supported <read_len>s)OK |
| Write Command | AT+QIRD=<socketID>,0 |
When <read_len> is 0, query the received data:+QIRD: <total_recv_size>,<read_size>,<unread_size>OKIf there is any error: ERROR |
| Write Command | AT+QIRD=<socketID>,<read_len> |
When <service_type> is "UDP SERVICE":+QIRD: <actual_read_len>,<remote_addr>,<remote_port><data>OKIf there is any error: ERROR |
| Write Command | AT+QIRD=<socketID>,<read_len> |
When <service_type> is "TCP"/"UDP"/"TCP INCOMING":+QISEND: <actual_read_len><data>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<read_len> |
Integer type. Length of data to be read. Range: 0--1500. Unit: byte. |
<total_recv_size> |
Integer type. Total length of data received by socket. Unit: byte. |
<read_size> |
Integer type. Length of read data. Unit: byte. |
<unread_size> |
Integer type. Length of unread data. Unit: byte. |
<actual_read_len> |
Integer type. Length of actually read data. Unit: byte. |
<remote_addr> |
String type. Source address of received data. It is valid only when <service_type> is "UDP SERVICE". |
<remote_port> |
Integer type. Source port of received data. It is valid only when <service_type> is "UDP SERVICE". |
<data> |
String type without double quotation marks. Actually read data. Unit: byte. |
AT+QIACCEPT
This command accepts or rejects remote incoming connection request from TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QIACCEPT=? |
+QIACCEPT: (list of supported <listener_socketID>s),(list of supported <accept>s),(list of supported <incoming_socketID>s)OK |
| Write Command | AT+QIACCEPT=<listener_socketID>,<accept>[,<incoming_socketID>] |
Accept/Reject incoming connection request:[+QIACCEPT: <incoming_socketID>,<remote_addr>,<remote_port>]OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<listener_socketID> |
Integer type. Socket ID of TCP server. Range: 0--11. |
<accept> |
Integer type. Accept or reject remote incoming connection request of TCP/UDP socket service. 0 Reject 1 Accept |
<incoming_socketID> |
Integer type. Socket ID for incoming connection. It is valid only when <accept> is 1. Range: 0--11. |
<remote_addr> |
String type. Source address of incoming connection. |
<remote_port> |
Integer type. Source port of incoming connection. |
AT+QISWTMD
This command switches data access mode.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QISWTMD=? |
+QISWTMD: (list of supported <socketID>s),(list of supported <access_mode>s)OK |
| Write Command | AT+QISWTMD=<socketID>,<access_mode> |
OKOr CONNECTOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<access_mode> |
Integer type. Data access mode of serial port. 0 Buffer access mode. Socket sends and receives data with AT commands. 1 Direct push mode. Socket sends data in AT command and receives data in URC format. 2 Transparent transmission mode. Serial port is exclusively used for sending/receiving data directly to/from the Internet. |
AT+QICLOSE
This command closes TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QICLOSE=? |
+QICLOSE: (list of supported <socketID>s),(list of supported <close_timeout>s)OK |
| Write Command | AT+QICLOSE=<socketID>[,<close_timeout>] |
OK+QIURC: "closed",<socketID>If there is any error: ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<close_timeout> |
Integer type. Timeout for closing TCP/UDP socket service. Range: 1--60. Default value: 2. Unit: second. |
AT+QIGETERROR
This command queries result code related to TCP/UDP socket service.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | AT+QIGETERROR |
+QIGETERROR: <err>,<description>OK |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<err> |
Integer type. Result code. See Summary of Result Codes for details. |
<description> |
String type. Result code description. |
ATO
This command enables the module to enter transparent transmission mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | ATO |
CONNECTOr NO CARRIER |
Maximum Response Time: 300 ms
Characteristic: None
NOTE
If the socket connection has not been established before, ATO returns NO CARRIER.
+++
This command enables the module to exit transparent transmission mode.
| Command Type | Syntax | Response |
|---|---|---|
| Execution Command | +++ |
OK |
Maximum Response Time: 300 ms
Characteristics: None
NOTE
- After exiting transparent transmission mode with +++, if the socket connection is active, the connection enters transparent transmission mode again with ATO.
- Do not input a carriage return or line feed after this AT command when you use it.
Description of SSL-Related AT Commands
AT+QSSLCFG
This command configures SSL context parameters.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLCFG=? |
+QSSLCFG: "version",(list of supported <SSL_ctxID>s),(list of supported <SSL_version>s)+QSSLCFG: "verify",(list of supported <SSL_ctxID>s),(list of supported <verify_level>s)+QSSLCFG: "ciphersuite",(list of supported <SSL_ctxID>s),<cs_id>+QSSLCFG: "negotiatetimeout",(list of supported <SSL_ctxID>s),(list of supported <negotiate_time>s)+QSSLCFG: "sni",(list of supported <SSL_ctxID>s), (list of supported <SNI_value>s)OK |
| Write Command | AT+QSSLCFG="version",<SSL_ctxID>[,<SSL_version>] |
Configure SSL version If the optional parameter is omitted, query the current setting: +QSSLCFG: "version",<SSL_ctxID>,<SSL_version>OKIf the optional parameter is specified, configure the SSL version: OKIf there is any error: ERROR |
| Write Command | AT+QSSLCFG="verify",<SSL_ctxID>[,<verify_level>] |
Configure SSL verification level If the optional parameter is omitted, query the current setting: +QSSLCFG: "verify",<SSL_ctxID>,<verify_level>OKIf the optional parameter is specified, configure the SSL verification level: OKIf there is any error: ERROR |
| Write Command | AT+QSSLCFG="ciphersuite",<SSL_ctxID>[[,<cs_id>[,<cs_id>[,...]]] |
Configure SSL cipher suite If the optional parameters are omitted, query the current setting: +QSSLCFG: "ciphersuite",<SSL_ctxID>[,<cs_id>[,<cs_id>[,...]]]OKIf any of the optional parameters is specified, configure the SSL cipher suite: OKIf there is any error: ERROR |
| Write Command | AT+QSSLCFG="negotiatetimeout",<SSL_ctxID>[,<negotiate_time>] |
Configure SSL negotiation timeout If the optional parameter is omitted, query the current setting: +QSSLCFG: "negotiatetimeout",<SSL_ctxID>,<negotiate_time>OKIf the optional parameter is specified, configure SSL negotiation timeout: OKIf there is any error: ERROR |
| Write Command | AT+QSSLCFG="sni",<SSL_ctxID>[,<SNI_value>] |
Enable or disable TLS server name indication If the optional parameter is omitted, query the current setting: +QSSLCFG: "sni",<SSL_ctxID>,<SNI_value>OKIf the optional parameter is specified, enable or disable TLS server name indication: OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<SSL_ctxID> |
Integer type. SSL context ID. Range: 0--5. |
<SSL_version> |
Integer type. SSL version. 0 SSL3.0 1 TLS1.0 2 TLS1.1 3 TLS1.2 4 All |
<verify_level> |
Integer type. SSL verification level. 0 No verification 1 One-way verification (Client verifies server legality) 2 Two-way verifications (Client and server verify each other's legality) |
<cs_id> |
Hex integer type. Start with 0x. 0xFFFF supports all cipher suites. 0x0004 TLS_RSA_WITH_RC4_128_MD5 0x0005 TLS_RSA_WITH_RC4_128_SHA 0x002F TLS_RSA_WITH_AES_128_CBC_SHA 0x0035 TLS_RSA_WITH_AES_256_CBC_SHA 0x003C TLS_RSA_WITH_AES_128_CBC_SHA256 0x003D TLS_RSA_WITH_AES_256_CBC_SHA256 0xc027 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xc02F TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 |
<negotiate_time> |
Integer type. Negotiation timeout. Range: 60--300. Default value: 120. Unit: second. |
<SNI_value> |
Integer type. Enable/disable TLS server name indication. 0 Disable 1 Enable |
AT+QSSLCERT
This command uploads/downloads/deletes the SSL certificate.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLCERT=? |
+QSSLCERT: (list of supported <cert_type>s),(list of supported <operation_mode>s)OK |
| Read Command | AT+QSSLCERT? |
[+QSSLCERT: <cert_type>,<exist_flag>,<checksum>][...]OK |
| Write Command | AT+QSSLCERT=<cert_type>,<operation_mode>,<length> |
Upload SSL certificateCONNECTAfter CONNECT is returned, input file data. The inputted data will be written into flash automatically. When the data length reaches <length>, the module exits data mode.OKIf there is any error: ERROR |
| Write Command | AT+QSSLCERT=<cert_type>,<operation_mode> |
Download SSL certificate+QSSLCERT: <cert_type>,<length>Output file data OKIf there is any error: ERROR |
| Write Command | AT+QSSLCERT=<cert_type>,<operation_mode> |
Delete SSL certificateOKOr ERROR |
Maximum Response Time: Determined by the speed at which users input data.
Characteristics: The command takes effect immediately. The configurations are saved automatically.
Parameter:
| Parameter | Description |
|---|---|
<cert_type> |
String type. Certificate type. "CA" CA certificate "User Cert" Client certificate "User Key" Client key document |
<operation_mode> |
Integer type. Operating mode. 0 Delete SSL certificate 1 Download SSL certificate 2 Upload SSL certificate |
<length> |
Integer type. Length of certificate content. |
<exist_flag> |
Integer type. Whether a certificate exists or not. 0 Does not exist 1 Exist |
<checksum> |
Hexadecimal integer. Checksum. The data is accumulated byte by byte, and the portion exceeding 2 bytes is truncated. |
AT+QSSLOPEN
This command opens an SSL client and establishes an SSL connection. Establishing an SSL connection includes a TCP three-way handshake and an SSL handshake. Hence the timeout is the sum of TCP three-way handshake timeout (120 seconds) and <negotiate_time>.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLOPEN=? |
+QSSLOPEN: (list of supported <SSL_ctxID>s),(list of supported <socketID>s),"ip/dns",(list of supported <remote_port>s),(list of supported <local_port>s),(list of supported <access_mode>s)OK |
| Write Command | AT+QSSLOPEN=<SSL_ctxID>,<socketID>,<remoteIP/domain_name>,<remote_port>[,<local_port>,<access_mode>] |
If <access_mode> is 2:CONNECTOr ERRORIf <access_mode> is not 2:OK+QSSLOPEN: <socketID>,<err>Or ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<SSL_ctxID> |
Integer type. SSL context ID. Range: 0--5. |
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<remoteIP> |
String type. IP address of remote server. |
<domain_name> |
String type. Domain name of remote server. |
<remote_port> |
Integer type. Port of remote server. It is valid only when <service_type> is "TCP" /"UDP". Range: 1--65535. |
<local_port> |
Integer type. Local port. Range: 1--65535. |
<access_mode> |
Integer type. Data access mode of serial port. 0 Buffer access mode. Socket sends and receives data with AT commands. 1 Direct push mode. Socket sends data in AT command and receives data in URC format. 2 Transparent transmission mode. Serial port is exclusively used for sending/receiving data directly to/from the Internet. |
<err> |
Integer type. Result code. See Summary of Result Codes for details. |
AT+QSSLSEND
This command sends data via SSL client.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLSEND=? |
+QSSLSEND: (list of supported <socketID>s),(list of supported <send_len>s)OK |
| Write Command | AT+QSSLSEND=<socketID>,<send_len>,<data> |
+QSSLSEND: <actual_send_len>OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<send_len> |
Integer type. Length of data to be sent. Range: 1--1460. Unit: byte. |
<data> |
String type. Data to be sent. |
<actual_send_len> |
Integer type. Actual length of data written to socket. Unit: byte. |
AT+QSSLRECV
This command reads data received by SSL client.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLRECV=? | +QSSLRECV: (list of supported <socketID>s),(list of supported <read_len>s) OK |
| Write Command | AT+QSSLRECV=<socketID>,<read_len> | +QSSLRECV: <actual_read_len> <data> OK If error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<read_len> |
Integer type. Length of data to be read. Unit type. |
<actual_read_len> |
Integer type. Length of actually read data. Unit: byte. |
<data> |
String type without double quotation marks. Actually read data. |
AT+QSSLSTATE
This command queries SSL client state.
| Command Type | Syntax | Response |
|---|---|---|
| Write Command | AT+QSSLSTATE=<socketID> |
+QSSLSTATE: <socketID>,"SSL CLIENT",<remote_addr>,<remote_port>,<local_port>,<state>OKIf there is any error: ERROR |
| Read Command | AT+QSSLSTATE? |
Return the state of all existing connections:[+QSSLSTATE: <socketID>,"SSL CLIENT",<remote_addr>,<remote_port>,<local_port>,<state>][...]If there is any error: ERROR |
| Execution Command | AT+QSSLSTATE |
Return the state of all existing connections:[+QSSLSTATE: <socketID>,"SSL CLIENT",<remote_addr>,<remote_port>,<local_port>,<state>][...]OK |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<remote_addr> |
String type. IP address of remote server. |
<remote_port> |
Integer type. Port of remote server. |
<local_port> |
Integer type. Local port. |
<state> |
Integer type. Socket service state. 0 "Initial" Client connection is not established. 1 "Opening" Client is connecting or server is trying to listen. 2 "Connected" Client connection is established. 3 "Listening" Server is listening. 4 "Closing" Client connection is closing. |
AT+QSSLCLOSE
This command closes SSL client.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QSSLCLOSE=? |
+QSSLCLOSE: (list of supported <socketID>s),(list of supported <close_timeout>s)OK |
| Write Command | AT+QSSLCLOSE=<socketID>[,<close_timeout>] |
OK+QSSLURC: "closed",<socketID>If there is any error: ERROR ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<close_timeout> |
Integer type. Timeout for closing SSL client. Range: 1--60. Default value: 10. Unit: second. |
Description of MQTT-Related AT Commands
AT+QMTCFG
This command configures the optional parameters of MQTT client.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTCFG=? |
+QMTCFG: "version",(list of supported <clientID>s),(list of supported <vsn>s)+QMTCFG: "datatype",(list of supported <clientID>s),(list of supported <data_type>s)+QMTCFG: "ssl",(list of supported <clientID>s),(list of supported <SSL_enable>s),(list of supported <SSL_ctxID>s)+QMTCFG: "keepalive",(list of supported <clientID>s),(list of supported <kalive_tm>s)+QMTCFG: "session",(list of supported <clientID>s),(list of supported <clean_session>s)+QMTCFG: "timeout",(list of supported <clientID>s),(list of supported <delivery_tm>s),(list of supported <delivery_cnt>s),(list of supported <timeout_report>s)+QMTCFG: "will",(list of supported <clientID>s),(list of supported <will_flag>s),(list of supported <will_QoS>s),(list of supported <will_retain>s),"willtopic","willmessage"+QMTCFG: "recv/mode",(list of supported <clientID>s),(list of supported <recvmode>s)OK |
| Write Command | AT+QMTCFG="version",<clientID>[,<vsn>] |
Configure MQTT protocol version If the optional parameter is omitted, query the current setting: +QMTCFG: "version",<clientID>,<vsn>OKIf the optional parameter is specified, configure the MQTT protocol version: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="datatype",<clientID>[,<data_type>] |
Configure type of data to be sent If the optional parameter is omitted, query the current setting: +QMTCFG: "datatype",<clientID>,<data_type>OKIf the optional parameter is specified, configure the type of the data to be sent: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="ssl",<clientID>[,<SSL_enable>[,<SSL_ctxID>]] |
Enable or disable SSL connection If the optional parameters are omitted, query the current setting: +QMTCFG: "ssl",<clientID>,<SSL_enable>[,<SSL_ctxID>]OKIf any of the optional parameter is specified, enable or disable SSL connection: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="keepalive",<clientID>[,<kalive_tm>] |
Configure keep-alive time of MQTT protocol If the optional parameter is omitted, query the current setting: +QMTCFG: "keepalive",<clientID>,<kalive_tm>OKIf the optional parameter is specified, configure keepalive time of MQTT protocol: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="session",<clientID>[,<clean_session>] |
Configure session type of MQTT protocol If the optional parameter is omitted, query the current setting: +QMTCFG: "session",<clientID>,<clean_session>OKIf the optional parameter is specified, configure session type of MQTT protocol: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="timeout",<clientID>[,<delivery_tm>,<delivery_cnt>,<timeout_report>] |
Configure response waiting timeout If the optional parameters are omitted, query the current configuration: +QMTCFG: "timeout",<clientID>,<delivery_tm>,<delivery_cnt>,<timeout_report>OKIf the optional parameters are specified, configure response waiting timeout: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="will",<clientID>[,<will_flag>,<will_QoS>,<will_retain>,<will_topic>,<will_message>] |
Configure Will information of MQTT protocol If the optional parameters are omitted, query the current setting: +QMTCFG: "will",<clientID>,<will_flag>,<willQoS>,<will_retain>,<will_topic>,<will_message>OKIf the optional parameters are specified, configure Will information of MQTT protocol: OKIf there is any error: ERROR |
| Write Command | AT+QMTCFG="recv/mode",<clientID>[,<recvmode>] |
Configure how to read messages for MQTT client If the optional parameter is omitted, query the current configuration: +QMTCFG: "recv/mode",<clientID>,<recvmode>OKIf the optional parameter is specified, configure how to read messages for MQTT client: OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are not saved.
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<vsn> |
Integer type. MQTT protocol version. 3 MQTT protocol V3 4 MQTT protocol V4 |
<data_type> |
Integer type. Type of data to be sent. 0 Non-hex string 1 Hex string |
<SSL_enable> |
Integer type. Enable or disable SSL. 0 Disable. Use Raw TCP connection for MQTT 1 Enable. Use SSL TCP secure connection for MQTT |
<SSL_ctxID> |
Integer type. SSL context ID. Range: 0--5. |
<kalive_tm> |
Integer type. Keepalive time. Maximum idle time allowed for no data interaction between the MQTT client and server. PingReq and PingResp messages are used to keep the connection between the MQTT client and the server alive. Range: 1--3600. Default value: 120. Unit: second. |
<clean_session> |
Integer type. Value of the field corresponding to session type in MQTT CONNECT messages. 0 Connection is considered persistent. After the client disconnects, any subscribed topics and information with QoS set to 1 or 2 are saved until the client reconnects to the server. 1 After the client disconnects, all subscribed topics will be removed. |
<delivery_tm> |
Integer type. Maximum time that MQTT client waits for a response from the server after sending an MQTT message. Range: 1--60. Default value: 5. Unit: second. |
<delivery_cnt> |
Integer type. Maximum retransmission counts of MQTT message. Range: 1--10. Default value: 3. |
<timeout_report> |
Integer type. Whether to report a URC when MQTT message is retransmitted. 0 Do not report 1 Report (See AT+QMTSUB, AT+QMTPUB and AT+QMTUNS for details.) |
<will_flag> |
Integer type. Value of the field corresponding to the will_flag in MQTT CONNECT messages. 0 Ignore the configurations of will_QoS, will_retain, will_topic and will_message. 1 Send the configurations of will_QoS, will_retain, will_topic and will_message to server in MQTT CONNECT message. |
<will_QoS> |
Integer type. Quality of service corresponding to will_message. 0 At most once 1 At least once 2 Exactly once |
<will_retain> |
Integer type. Whether the server permanently saves the published will_message after the MQTT client is disconnected unexpectedly. 0 Do not save 1 Save |
<will_topic> |
String type. Will topic name. |
<will_message> |
String type. Message published to the Will topic after the client is disconnected unexpectedly. |
<recvmode> |
Integer type. Message receiving mode published by the server. 0 Direct push mode 1 Buffer mode (Reading with AT+QMTRECV) |
NOTE
Before connecting a client to MQTT server, you need to configure the optional parameters of MQTT client.
AT+QMTOPEN
This command opens a session between MQTT client and server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTOPEN=? |
+QMTOPEN: (list of supported <clientID>s),"hostname",(list of supported <port>s)OK |
| Read Command | AT+QMTOPEN? |
Returns server information of all existing connections:[+QMTOPEN: <clientID>,<hostname>,<port>][...]OK |
| Write Command | AT+QMTOPEN=<clientID>,<hostname>,<port> |
OK+QMTOPEN: <clientID>,<result>If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<hostname> |
String type. MQTT server address. |
<port> |
Integer type. MQTT server port. Range: 1--65535. |
<result> |
Integer type. Command execution results. -1 Failed to connect socket 0 MQTT session was opened successfully 1 Wrong parameter 2 <clientID> is occupied3 Failed to activate PDP 4 Failed to parse domain name 5 Socket connection was closed abnormally. |
AT+QMTCLOSE
This command closes a session between MQTT client and server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTCLOSE=? |
+QMTCLOSE: (list of supported <clientID>s)OK |
| Write Command | AT+QMTCLOSE=<clientID> |
OK+QMTCLOSE: <clientID>,<result>If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<result> |
Integer type. Command execution results. -1 Failed execution 0 Successful execution |
AT+QMTCONN
This command connects a client to MQTT server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTCONN=? |
+QMTCONN: (list of supported <clientID>s),"client_identity","username","password"OK |
| Read Command | AT+QMTCONN? |
Return the state of all existing connections:[+QMTCONN: <clientID>,<state>][...]OK |
| Write Command | AT+QMTCONN=<clientID>,<client_identity>,<username>,<password> |
OK+QMTCONN: <clientID>,<result>[,<response_code>]or ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<client_identity> |
String type. MQTT client identity. |
<username> |
String type. Client username. |
<password> |
String type. Password corresponding to client username. |
<state> |
Integer type. MQTT connection state. 1 MQTT is initialized 2 MQTT is connecting 3 MQTT is connected 4 MQTT is disconnecting |
<result> |
Integer type. Command execution result. 0 CONNECT message was sent successfully and CONNECTACK message was received. 1 CONNECT message was sent successfully but CONNECTACK message was not received within the specified response time 2 Failed to send CONNECT message |
<response_code> |
Integer type. Response code in CONNECTACK message. 0 Connection Accepted 1 Connection Rejected: Unacceptable Protocol Version 2 Connection Rejected: Identifier Rejected 3 Connection Rejected: Server Unavailable 4 Connection Rejected: Wrong Username or Password 5 Connection Rejected: Unauthorized |
AT+QMTDISC
This command disconnects a client from MQTT server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTDISC=? |
+QMTDISC: (list of supported <clientID>s)OK |
| Write Command | AT+QMTDISC=<clientID> |
OK+QMTDISC: <clientID>,<result>If there is any error: ERROR ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<result> |
Integer type. Command execution result. -1 Failed Execution. 0 Successful execution. |
AT+QMTSUB
This command subscribes to topic(s) published by the MQTT server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTSUB=? |
+QMTSUB: (list of supported <clientID>s),(list of supported <msgID>s),"topic",(list of supported <qos>s)OK |
| Write Command | AT+QMTSUB=<clientID>,<msgID>,<topic1>,<qos1>[,<topic2>,<qos2>[...]] |
OK+QMTSUB: <clientID>,<msgID>,<result>[,<value>]If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client number. Range: 0--5. |
<msgID> |
Integer type. SUBSCRIBE message identifier. Range: 1--65535. |
<qos> |
Integer type. Quality of service for <topic>.0 At most once 1 At least once 2 Exactly once |
<topic> |
String type. Topic to be subscribed to. |
<result> |
Integer type. Command execution result. 0 SUBSCRIBE message was sent successfully and SUBACK message was received. 1 SUBSCRIBE message was sent successfully but SUBACK message was not received within the specified response time. Retransmission was executed. 2 Failed to send SUBSCRIBE message. |
<value> |
Integer type. When <result> is 0, it is a vector of granted QoS levels of SUBACK message.When <result> is 1, it indicates the number of SUBSCRIBE message retransmission.When <result> is 2, it is not presented. |
NOTE
The command currently supports subscribing up to 5 topics at a time.
AT+QMTUNS
This command unsubscribes from topic(s) published by MQTT server. The client sends an UNSUBSCRIBE message to the server to unsubscribe from named topics.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTUNS=? |
+QMTUNS: (list of supported <clientID>s),(list of supported <msgID>s),"topic"OK |
| Write Command | AT+QMTUNS=<clientID>,<msgID>,<topic1>[,<topic2>[...]] |
OK+QMTUNS: <clientID>,<msgID>,<result>If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<msgID> |
Integer type. UNSUBSCRIBE message identifier. Range: 1--65535. |
<topic> |
String type. Topic to unsubscribe from. |
<result> |
Integer type. Command execution result. 0 UNSUBSCRIBE message was sent successfully and UNSUBACK message was received. 1 UNSUBSCRIBE message was sent successfully but UNSUBACK message was not received within the specified response time. Retransmission was executed. 2 Failed to send UNSUBSCRIBE message. |
NOTE
The command currently supports unsubscribing up to 5 topics at a time.
AT+QMTPUB
This command publishes messages via MQTT server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTPUB=? |
+QMTPUB: (list of supported <clientID>s),(list of supported <msgID>s),(list of supported <QoS>s),(list of supported <retain>s),"topic",(list of supported <payload_length>s),"payload"OK |
| Write Command | AT+QMTPUB=<clientID>,<msgID>,<QoS>,<retain>,<topic>,<payload_length>,<payload> |
OK+QMTPUB: <clientID>,<msgID>,<result>[,<value>]If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<msgID> |
Integer type. PUBLISH message identifier. Range: 0--65535. When QoS is 0, <msgID> must be 0.When QoS is greater than 0, <msgID> must be greater than 0. |
<QoS> |
Integer type. Quality of service for publishing messages. 0 At most once 1 At least once 2 Exactly once |
<retain> |
Integer type. After MQTT client is unexpectedly disconnected, whether the published message is to be saved on the server forever or not. 0 Eliminate without saving permanently 1 Save permanently |
<topic> |
String type. Topic message to be published. |
<payload_length> |
Integer type. Length of message to be published. Range: 1--1500. Unit: byte. |
<payload> |
Hexadecimal string type. Message to be published. |
<result> |
Integer type. Command execution result. 0 PUBLISH message was sent successfully and ACK message was received. 1 PUBLISH message was sent successfully but ACK message was not received within delivery time. Retransmission was executed. 2 Failed to send PUBLISH message |
<value> |
Integer type. When <result> is 1, it indicates the number of PUBLISH message retransmission.When <result> is 0 or 2, it is not presented. |
AT+QMTPUBRAW
This command publishes Hex data via MQTT server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTPUBRAW=? |
+QMTPUBRAW: (list of supported <clientID>s),(list of supported <msgID>s),(list of supported <QoS>s),(list of supported <retain>s),"topic",(list of supported <payload_length>s)OK |
| Write Command | AT+QMTPUBRAW=<clientID>,<msgID>,<QoS>,<retain>,<topic>,<payload_length> |
>After receiving the > character, you should enter <payload> within 10 seconds. If timeout occurs, an error will be reported and the operation will exit.OK+QMTPUB: <clientID>,<msgID>,<result>[,<value>]If there is any error: ERROR |
Maximum Response Time: 10000 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<msgID> |
Integer type. PUBLISH message identifier. Range: 0--65535. When QoS is 0, <msgID> must be 0.When QoS is greater than 0, <msgID> must be greater than 0. |
<QoS> |
Integer type. Quality of service for publishing messages. 0 At most once 1 At least once 2 Exactly once |
<retain> |
Integer type. After MQTT client is unexpectedly disconnected, whether the published message is to be saved on the server forever or not. 0 Eliminate without saving permanently 1 Save permanently |
<topic> |
String type. Topic. |
<payload_length> |
Integer type. Length of message to be published. Range: 1--1500. Unit: byte. |
<payload> |
Hexadecimal type. Message to be published. |
<result> |
Integer type. Command execution result. 0 PUBLISH message was sent successfully and ACK message was received. 1 PUBLISH message was sent successfully but ACK message was not received within delivery time. Retransmission was executed. 2 Failed to send PUBLISH message |
<value> |
Integer type. When <result> is 1, it indicates the number of PUBLISH message retransmission.When <result> is 0 or 2, it is not presented. |
AT+QMTRECV
This command reads messages published by MQTT Server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QMTRECV=? |
OK |
| Read Command | AT+QMTRECV? |
[+QMTRECV: <clientID>,<store_stauts4>,<store_stauts3>,<store_stauts2>,<store_stauts1>,<store_stauts0>][...]OK |
| Write Command | AT+QMTRECV=<clientID>[,<storeID>] |
If the optional parameter is omitted, read all buffered messages of the specified client:[+QMTRECV: <clientID>,<msgID>,<topic>,<payload_len>],<payload>[...]OKIf the optional parameter is specified, read the messages specified by <storeID> of the specified client:+QMTRECV: <clientID>,<msgID>,<topic>,<payload_len>,<payload>OK |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<storeID> |
Integer type. ID of messages stored in buffer. Range: 0--4. |
<store_status4> |
Integer type. Indicates whether a message stored in buffer corresponds to storeID4. 0 No message in buffer 1 One or more messages are stored in buffer |
<store_status3> |
Integer type. Indicates whether a message stored in buffer corresponds to storeID3. 0 No message in buffer 1 One or more messages are stored in the buffer |
<store_status2> |
Integer type. Indicates whether a message stored in buffer corresponds to storeID2. 0 No message in buffer 1 One or more messages are stored in buffer |
<store_status1> |
Integer type. Indicates whether a message stored in buffer corresponds to storeID1. 0 No message in buffer 1 One or more messages are stored in buffer |
<store_status0> |
Integer type. Indicates whether a message stored in buffer corresponds to storeID0. 0 No message in buffer 1 One or more messages stored in buffer |
<msgID> |
Integer type. PUBLISH message identifier. Range: 0--65535. When QoS is 0, <msgID> must be 0.When QoS is greater than 0, <msgID> must be greater than 0. |
<topic> |
String type. Topic received from MQTT server. |
<payload_len> |
Integer type. Length of received message. |
<payload> |
String type. Received message. |
Description of HTTP(S)-Related AT Commands
HTTP requests include establishing an HTTP(S) session and interactions with HTTP(S) body; hence the maximum response time is determined by the time it takes to establish an HTTP(S) session and interactions of HTTP body. Maximum timeout of the TCP three-way handshake supported by the module is 120 seconds. Maximum timeout of SSL handshake is determined by <negotiate_time> (Default value: 120 seconds). After sending the HTTP request, the response time is <wait_response_time> (Default value: 60 seconds).
AT+QHTTPCFG
This command configures the parameters for HTTP(S) client.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QHTTPCFG=? |
+QHTTPCFG: "url",<url_string>+QHTTPCFG: "header",<hname>,<hvalue>+QHTTPCFG: "auth",<username>,<password>+QHTTPCFG: "response/output",(list of supported <output_mode>s)+QHTTPCFG: "response/header",(list of supported <save_header>s)+QHTTPCFG: "response/interval",(list of supported <interval>s)+QHTTPCFG: "sslctxid",(list of supported <SSL_ctxID>s)OK |
| Write Command | AT+QHTTPCFG="url"[,<url_string>] |
If <url_string> is omitted:+QHTTPCFG: "url",<url_string>OKIf <url_string> is specified: OKIf there is any error: ERROR |
| Write Command | AT+QHTTPCFG="header"[,<hname>[,<hvalue>]] |
If optional parameters omitted:[+QHTTPCFG: "header",<hname>,<hvalue>][...]OKIf <hname> specified and <hvalue> omitted:OKIf all optional parameters specified: OKIf error: ERROR |
| Write Command | AT+QHTTPCFG="auth"[,<username>,<password>] |
If optional parameters omitted:+QHTTPCFG: "auth",<username>,<password>OKIf parameters specified: OKIf error: ERROR |
| Write Command | AT+QHTTPCFG="response/output"[,<output_mode>] |
Configure response data output mode If the optional parameter is omitted, query the current setting: +QHTTPCFG: "response/output",<output_mode>OKIf the optional parameter is specified, configure the output mode of response data: OKIf there is any error: ERROR |
| Write Command | AT+QHTTPCFG="response/header"[,<save_header>] |
Configure whether to save response header If the optional parameter is omitted, query the current setting: +QHTTPCFG: "response/header",<save_header>OKIf the optional parameter is specified, configure whether to save response header: OKIf there is any error: ERROR |
| Write Command | AT+QHTTPCFG="response/interval"[,<interval>] |
Configure the output interval for HTTP data to be reported in URC mode If the optional parameter is omitted, query the current setting: +QHTTPCFG: "response/interval",<interval>OKIf the optional parameter is specified, configure the output interval for HTTP data to be reported in URC mode: OKIf there is any error: ERROR |
| Write Command | AT+QHTTPCFG="sslctxid"[,<SSL_ctxID>] |
Configure SSL context ID for HTTP(S) session If the optional parameter is omitted, query the current configuration: +QHTTPCFG: "sslctxid",<SSL_ctxID>OKIf the optional parameter is specified, configure SSL context ID for HTTP(S) session: OKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: The command takes effect immediately. The configurations are saved automatically.
Parameter:
| Parameter | Description |
|---|---|
<url_string> |
String type. URL to be accessed. Empty string is returned if the parameter is not configured. |
<hname> |
String type. HTTP(S) Header name. Empty string is returned if the parameter is not configured. |
<hvale> |
String type. HTTP(S) Header value. Empty string is returned if the parameter is not configured. |
<username> |
String type. Username of HTTP(S) basic authentication. Empty string is returned if the parameter is not configured. |
<password> |
String type. User's password of HTTP(S) basic authentication. Empty string is returned if the parameter is not configured. |
<output_mode> |
Integer type. Response data output mode. 0 Read response data with AT+QHTTPREAD 1 Response data directly in URC format (See +QHTTPURC: "recv" for details.) |
<save_header> |
Integer type. Whether to save response header. 0 Do not save 1 Save |
<interval> |
Integer type. Output intervals of HTTP message. Range: 0--4. Unit: second. |
<SSL_ctxID> |
Integer type. SSL context ID. Range: 0--5. |
AT+QHTTPGET
This command sends GET request to HTTP(S) server. If the GET request is sent successfully, the result of GET request is reported to MCU with +QHTTPGET: <result>[,<status_code>[,<content_length>]].
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QHTTPGET=? |
+QHTTPGET: (list of supported <wait_response_time>s)OK |
| Execution Command | AT+QHTTPGET[=<wait_response_time>] |
OK+QHTTPGET: <result>[,<status_code>[,<content_length>]]If there is any error: ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<wait_response_time> |
Integer type. Server response waiting time after the GET request is sent. Range: 10--65535. Default value: 10. Unit: second. |
<result> |
Integer type. Result of GET request sending. See Summary of Result Codes for details. 0 Success Other value Failure |
<status_code> |
Integer type. HTTP(S) status code. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of GET request body. |
AT+QHTTPPOST
This command sends a POST request to HTTP(S) server. If the POST request is sent successfully, the result of POST request is reported to MCU with +QHTTPPOST: <result>[,<status_code>[,<content_length>]].
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QHTTPPOST=? |
+QHTTPPOST: (list of supported <body_length>s),(list of supported <body_wait_interval>s),(list of supported <wait_response_time>s)[,<name>[,<file_name>[,<content_type>]]]OK |
| Write Command | AT+QHTTPPOST=<body_length>[,<body_wait_interval>[,<wait_response_time>]] |
Non Form-data POSTCONNECTInput body. When the length of inputted data reaches <body_length>, the module exits data mode.OK+QHTTPPOST: <result>[,<status_code>[,<content_length>]]If there is any error: ERROR |
| Write Command | AT+QHTTPPOST=<body_length>,<body_wait_interval>,<wait_response_time>,<name>[,<file_name>[,<content_type>]] |
Form-data POSTCONNECTInput body. When the length of inputted data reaches <body_length>, the module exits data mode.OK+QHTTPPOST: <result>[,<status_code>[,<content_length>]]If there is any error: ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<body_length> |
Integer type. Length of POST data. Range: 1--102400. Unit: byte. |
<body_wait_interval> |
Integer type. Maximum waiting time for inputting body in data mode. Range: 1--65535. Default value: 60. Unit: second. |
<wait_response_time> |
Integer type. Server response waiting time after the POST request is sent. Range: 10--65535. Default value: 10. Unit: second. |
<name> |
String type. Form-data name. |
<file_name> |
String type. Name of file stored on HTTP(S) server after data is uploaded. |
<content_type> |
String type. File content type. |
<result> |
Integer type. Result of POST request sending. See Summary of Result Codes for details. 0 Success Other values Failure |
<status_code> |
Integer type. HTTP(S) status mode. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of POST request body. |
AT+QHTTPPUT
This command sends a PUT request to HTTP(S) server. If the PUT request is sent successfully, the result of PUT request is reported to MCU with +QHTTPPUT: <result>[,<status_code>[,<content_length>]].
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QHTTPPUT=? |
+QHTTPPUT: (list of supported <body_length>s),(list of supported <body_wait_interval>s),(list of supported <wait_response_time>s)OK |
| Write Command | AT+QHTTPPUT=<body_length>[,<body_wait_interval>[,<wait_response_time>]] |
CONNECTInput body. When the length of inputted data reaches <body_length>, the module exits data mode.OK+QHTTPPUT: <result>[,<status_code>[,<content_length>]]If there is any error: ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<body_length> |
Integer type. Length of PUT data. Range: 1--102400. Unit: byte. |
<body_wait_interval> |
Integer type. Maximum waiting time for inputting body in data mode. Range: 1--65535. Default value: 60. Unit: second. |
<wait_response_time> |
Integer type. Server response waiting time after the PUT request is sent. Range: 10--65535. Default value: 10. Unit: second. |
<result> |
Integer type. Result of PUT request sending. See Summary of Result Codes for details. 0 Success Other value Failure |
<status_code> |
Integer type. HTTP(S) status mode. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of PUT request body. |
AT+QHTTPREAD
This command reads the response data of HTTP(S) request. If the request is successful and the server responds, the output mode of response data is configured with AT+QHTTPCFG="response/output",0.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QHTTPREAD=? |
+QHTTPREAD: (list of supported <wait_response_interval>s)OK |
| Write/Execution Command | AT+QHTTPREAD[=<wait_response_interval>] |
CONNECT<data>OK+QHTTPREAD: <result>If there is any error: ERROR |
Maximum Response Time: None
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<wait_response_interval> |
Integer type. Maximum time module serial port waits for server response. Range: 60--65535. Default value: 60. Unit: second. |
<result> |
Integer type. Result of response data reading. 0 Success Other values Failure |
<data> |
String type without double quotation marks. Read data. |
Description of DNS-Related AT Commands
AT+QIDNSGIP
This command gets IP address via domain name. Before querying DNS, the host should connect to Wi-Fi. The command execution results are reported via the following URCs.
If the command is executed successfully (<err>=0), the following URCs will be reported:
+QIURC: "dnsgip",<err>,<IP_count>,<DNS_ttl> +QIURC: "dnsgip",<hostIPaddr> [+QIURC: "dnsgip",<hostIPaddr>] [...]If the command fails to be executed (<err>=-1), the following URC will be reported:
+QIURC: "dnsgip",<err>
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QIDNSGIP=? |
+QIDNSGIP: <hostname>OK |
| Write Command | AT+QIDNSGIP=<hostname> |
OKOr ERROR |
Maximum Response Time: 60 s, determined by the network.
Characteristic: None
Parameter:
| Parameter | Description |
|---|---|
<hostname> |
String type. Domain name. |
<err> |
Error codes. 0 Successful execution -1 Failed execution |
<IP_count> |
Integer type. Number of IP addresses corresponding to the domain name. |
<DNS_ttl> |
Integer type. TTS (Time to Live) value of the DNS. Unit: second. |
<hostIPaddr> |
String type. IP address. |
Description of NTP-Related AT Commands
AT+QNTP
This command synchronizes the local time (UTC+8) through NTP server.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QNTP=? |
+QNTP: <server>,(list of supported <port>s)OK |
| Write Command | AT+QNTP[=<server>[,<port>]] |
If the local time is synchronized through NTP server successfully:OK+QNTP: <err>,<time>If there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<server> |
String type with double quotation marks. IP address or domain name of the NTP server. Maximum length: 50 bytes. If this parameter is omitted, synchronize the local time through the default NTP server directly. Default address: "ntp.aliyun.com". If this parameter is specified, set the domain name or IP address of the NTP server. |
<port> |
Integer type. Port number of the NTP server. Range: 1--65535. Default value: 123. If this parameter is omitted, the time is synchronized through the default port 123. If this parameter is specified, the time is synchronized through the configured port. |
<time> |
String type. Local time (UTC+8) which is synchronized through the NTP server. Format: "YYYY/MM/DD,hh:mm:ss", in which characters indicate year (YYYY), month (MM), day (DD), hour (hh), minutes (mm) and seconds (ss). |
<err> |
Error codes. See Summary of Result Codes for details. |
AT+QTIME
This command gets Unix timestamp through NTP server.
| Command Type | Syntax | Response |
|---|---|---|
| Read Command | AT+QTIME? |
+QTIME: <time>OKOr Timeout: +QTIME: timeoutOKIf there is any error: ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<time> |
Integer type. The obtained Unix timestamp. The number of seconds calculated since January 1, 1970, 00:00:00 (UTC). |
NOTE
- The module must connect to the network before this command is executed.
- This command can be executed only once every 3 seconds.
Description of GPIO-Related AT Command
AT+QGPIOCFG
This command configures GPIO.
| Command Type | Syntax | Response |
|---|---|---|
| Test Command | AT+QGPIOCFG=? |
+QGPIOCFG: <mode>,<pin>,<dir>,<pull>,<drv>/<val>OKIf there is any error: ERROR |
| Write Command | AT+QGPIOCFG=1,<pin>,<dir>,<pull>,<drv> |
When <mode>=1:OKOr ERROR |
| Write Command | AT+QGPIOCFG=2,<pin> |
When <mode>=2:+QGPIOCFG: <val>OKIf there is any error: ERROR |
| Write Command | AT+QGPIOCFG=3,<pin>,<val> |
When <mode>=3:OKOr ERROR |
Maximum Response Time: 300 ms
Characteristics: None
Parameter:
| Parameter | Description |
|---|---|
<mode> |
Integer type. Command mode. 1 Configure GPIO 2 Query GPIO level status 3 Set GPIO level |
<pin> |
Integer type. Pin number of the module. |
<dir> |
Integer type. Pin input/output direction. 0 Input 1 Output |
<pull> |
Integer type. Pin pull selection (Only valid when the GPIO pin is an input signal). 0 No operation 1 Pull down 2 Keep open 3 Pull up |
<drv> |
Integer type. GPIO drive current. 0 5 mA 1 10 mA 2 15 mA 3 20 mA |
<val> |
Integer type. GPIO level. 0 Low level 1 High level |
Description of URCs
Wi-Fi-Related URCs
+QSTASTAT
| URC | Description |
|---|---|
+QSTASTAT:<event> |
This URC indicates STA state changes. |
Parameter:
| Parameter | Description |
|---|---|
<event> |
Integer type without double quotation marks. Event reported when STA state changes. WLAN DISCONNECTED Disconnected WLAN_CONNECTED Connected GOT_IP Got IP SCAN_NO_AP Scanned no AP AP_CONNECT Connected to AP (AP mode) AP_DISCONNECT Disconnected from AP (AP mode) |
BLE-Related URCs
+QBLESTAT
| URC | Description |
|---|---|
+QBLESTAT:<event> |
This URC indicates BLE state changes. |
Parameter:
| Parameter | Description |
|---|---|
<event> |
String type without double quotation marks. Event reported when BLE state changes. NOINIT Uninitialized event INIT Initialized event ADVERTISING Advertising event NOADVERTISING No advertising event CONNECTED Connected event DISCONNECTED Disconnected event |
+QBLEMTU
| URC | Description |
|---|---|
+QBLEMTU:<MTU_value> |
This URC indicates MTU changes of BLE. |
Parameter:
| Parameter | Description |
|---|---|
<MTU_value> |
Integer type. Maximum transmission unit value. Range: 23--512. Unit: byte. |
+QBLEINFO
When the BLE connects other devices successfully as the central device, the URC is reported to display the handle and characteristic UUID of the connected BLE device.
| URC | Description |
|---|---|
+QBLEMTU: <handle> <UUID> |
The URC indicates the handle and characteristic UUID of the connected BLE device. |
Parameter:
| Parameter | Description |
|---|---|
<handle> |
Integer type. Handle of connected BLE device. Range: 0--255. |
<UUID> |
Integer type. Characteristic UUID of connected BLE device. Length: 2 bytes or 16 bytes. |
+QBLERECV
| URC | Description |
|---|---|
+QBLERECV:<peer_role>,<UUID>,<Length>\r\n\<data>\r\n |
This URC indicates that the module has received data. |
Parameter:
| Parameter | Description |
|---|---|
<peer_role> |
Integer type. Role of the peer which is connected to the module. 0 The peer is operating as a central device 1 The peer is operating as a peripheral device |
<UUID> |
Integer type. Characteristic UUID. Range: 0000--ffff. |
<Length> |
Integer type. Length of received data. Unit: byte. |
<data> |
String type without double quotation marks. The received data. |
+QBLEPEERINFO
This URC is reported when the BLE connects other devices successfully as the peripheral device and receives a message from the peer device.
| URC | Description |
|---|---|
+QBLEPEERRINFO:<conn_idx>,<peer_role>,<BLE_addr> |
This URC indicates the BLE connects other devices successfully as the peripheral device. |
Parameter:
| Parameter | Description |
|---|---|
<conn_idx> |
Integer type. The target device index that the module automatically assigns when a BLE connection is established. Default value: 0. |
<peer_role> |
Integer type. The role of the peer device in the BLE connection. 0 Central device 1 Peripheral device |
<BLE_addr> |
String type. The address of the peer BLE device. A 48-bit address represented as a hexadecimal string (e.g., 58D391010203). |
TCP/UDP-Related URCs
+QIOPEN
After opening a socket service with AT+QIOPEN, the URC is reported to indicate the result of socket service opening.
| URC | Description |
|---|---|
+QIOPEN: <socketID>,<err> |
The URC indicates the result of opening a TCP/UDP socket service. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<err> |
Integer type. Result code. See Summary of Result Codes for details. |
+QIURC: "recv"
The URC is reported after TCP/UDP socket service receives data.
| URC | Description |
|---|---|
+QIURC: "recv",<socketID> |
The URC indicates incoming data in buffer access mode. When there is data in the module's receiving buffer, the module will not proactively report a new URC until all the data in the buffer has been read via AT+QIRD. |
+QIURC: "recv",<socketID>,<data_len><CR><LF><data> |
The URC indicates incoming data in direct push mode when <service_type> is not "UDP SERVICE". |
+QIURC: "recv",<socketID>,<data_len>,<remote_addr>,<remote_port><CR><LF><data> |
The URC indicates incoming data in direct push mode when <service_type> is "UDP SERVICE". |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<data_len> |
Integer type. Data length. Range: 1--1500. Unit: byte. |
<remote_addr> |
String type. Source address of data. |
<remote_port> |
Integer type. Source port of data. |
<data> |
String type without double quotation marks. Received data. |
+QIURC: "accept"
If the acceptance mode of incoming connection is set to manual with AT+QICFG="accept/mode", the URC is reported as an incoming connection is received.
| URC | Description |
|---|---|
+QIURC: "accept",<socketID> |
The URC indicates that an incoming connection is received if the acceptance mode of incoming connection is set to manual. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
+QIURC: "closed"
When TCP/UDP socket service is closed, the URC will be reported, and the state of socket service will be "closing".
| URC | Description |
|---|---|
+QIURC: "closed",<socketID> |
The URC indicates that TCP/UDP socket service is closed. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
+QIURC: "incoming"
If the acceptance mode of incoming connection is set to automatic with AT+QICFG="accept/mode", the URC is reported as an incoming connection is received.
| URC | Description |
|---|---|
+QIURC: "incoming",<incoming_socketID>,<listener_socketID><remote_addr>,<remote_port> |
The URC indicates that an incoming connection is received If the acceptance mode of incoming connection is set to automatic. |
Parameter:
| Parameter | Description |
|---|---|
<incoming_socketID> |
Integer type. Incoming socket ID. Range: 0--11. |
<listener_socketID> |
Integer type. Listening socket ID. Range: 0--11. |
<remote_addr> |
String type. Source address of incoming connection. |
<remote_port> |
Integer type. Source port of incoming connection. |
+QIURC: "incoming full"
If the incoming connection reaches the limit, or no socket system resources can be allocated, then the module will report the URC as +QIURC: "incoming full" for the new incoming connection request.
| URC | Description |
|---|---|
+QIURC: "incoming full" |
The URC indicates that the incoming connection is full. |
NO CARRIER
| URC | Description |
|---|---|
NO CARRIER |
The URC indicates an abnormal disconnection in transparent transmission mode. |
SSL Related URCs
+QSSLOPEN
After opening an SSL client with AT+QSSLOPEN, the URC is reported to indicate the result of SSL client opening.
| URC | Description |
|---|---|
+QSSLOPEN: <socketID>,<err> |
The URC indicates the result of SSL client opening. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<err> |
Integer type. Result code. See Summary of Result Codes for details. |
+QSSLURC: "recv"
The URC is reported when the SSL client receives data.
| URC | Description |
|---|---|
+QSSLURC: "recv",<socketID> |
The URC indicates incoming data in buffer access mode. |
+QSSLURC: "recv",<socketID>,<data_len><CR><LF><data> |
The URC indicates incoming data in direct push mode. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
<data_len> |
Integer type. Length of received data. Range: 1--1500. Unit: byte. |
<data> |
String type without double quotation marks. Received data. |
+QSSLURC: "closed"
When the SSL client is closed, the URC will be reported, and the state of SSL client will be "Closing".
| URC | Description |
|---|---|
+QSSLURC: "closed",<socketID> |
The URC indicates that the SSL client is closed. |
Parameter:
| Parameter | Description |
|---|---|
<socketID> |
Integer type. Socket ID. Range: 0--11. |
MQTT Related URCs
+QMTRECV
The URC is reported when MQTT client receives new messages.
| URC | Description |
|---|---|
+QMTRECV: <clientID>,<storeID> |
The URC is reported when the client receives messages in buffer mode (<recvmode>=1). |
+QMTRECV: <clientID>,<msgID>,<topic>,<payload_len>,<payload> |
The URC is reported when the client receives messages in direct push mode (<recvmode>=0). |
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<storeID> |
Integer type. ID of messages stored in buffer. Range: 0--4. |
<msgID> |
Integer type. PUBLISH message identifier. Range: 0--65535. |
<topic> |
String type. Topic received from server. |
<payload_len> |
Integer type. Length of received message. |
<payload> |
String type. Received message. |
+QMTSTAT
The URC is reported when MQTT client is disconnected abnormally.
| URC | Description |
|---|---|
+QMTSTAT: <clientID>,<stat> |
The URC indicates that the MQTT client is disconnected abnormally. |
Parameter:
| Parameter | Description |
|---|---|
<clientID> |
Integer type. MQTT client identifier. Range: 0--5. |
<stat> |
Integer type. Reason for abnormal disconnection of a MQTT session. 1 MQTT session is closed passively. 2 MQTT session is closed due to PingReq message timeout. 3 MQTT session is closed due to Connect message timeout. 4 MQTT session is closed due to a prompt of connection failure in ConnACK. |
HTTP(S) Related URCs
+QHTTPGET
After sending a GET request with AT+QHTTPGET, the URC is reported to indicate the result of GET request sending.
| URC | Description |
|---|---|
+QHTTPGET: <result>[,<status_code>[,<content_length>]] |
The URC is reported to indicate the sending result of GET request. |
Parameter:
| Parameter | Description |
|---|---|
<result> |
Integer type. Result of GET request sending. See Summary of Result Codes for details. 0 Success Other value Failure |
<status_code> |
Integer type. HTTP(S) status code. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of GET request body. |
+QHTTPPOST
After sending a POST request with AT+QHTTPPOST, the URC is reported to indicate the result of POST request sending.
| URC | Description |
|---|---|
+QHTTPPOST: <result>[,<status_code>[,<content_length>]] |
The URC is reported to indicate the result of POST request sending. |
Parameter:
| Parameter | Description |
|---|---|
<result> |
Integer type. Result of POST request sending. See Summary of Result Codes for details. 0 Success Other value Failure |
<status_code> |
Integer type. HTTP(S) status code. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of POST request body. |
+QHTTPPUT
After sending a PUT request with AT+QHTTPPUT, the URC is reported to indicate the result of PUT request sending.
| URC | Description |
|---|---|
+QHTTPPUT: <result>[,<status_code>[,<content_length>]] |
The URC is reported to indicate the result of PUT request sending. |
Parameter:
| Parameter | Description |
|---|---|
<result> |
Integer type. Result of PUT request sending. See Summary of Result Codes for details. 0 Success Other value Failure |
<status_code> |
Integer type. HTTP(S) status code. See Summary of Result Codes for details. |
<content_length> |
Integer type. Length of PUT request body. |
+QHTTPREAD
After reading the response data with AT+QHTTPREAD, the URC is reported to indicate the reading result.
| URC | Description |
|---|---|
+QHTTPREAD: <result> |
The URC is reported to indicate the result of the response data reading. |
Parameter:
| Parameter | Description |
|---|---|
<result> |
Integer type. Result of response data reading. 0 Success Other value Failure |
+QHTTPURC: "recv"
The URC is reported when the HTTP(s) client receives response data.
| URC | Description |
|---|---|
+QHTTPURC: "recv",<length><CR><LF><data> |
The URC indicates incoming response data. |
Parameter:
| Parameter | Description |
|---|---|
<length> |
Integer type. Length of received data. |
<data> |
String type without double quotation marks. Response data. |
DNS Related URCs
+QIURC: "dnsgip"
| URC | Description |
|---|---|
+QIURC: "dnsgip",<err>[,<IP_count>,<DNS_ttl>] |
The URC is reported to indicate the result of getting IP address by domain name. |
+QIURC: "dnsgip",<hostIPaddr> |
When the IP address is successfully obtained by domain name, the obtained IP address is reported. |
Parameter:
| Parameter | Description |
|---|---|
<err> |
Error codes. 0 Successful execution -1 Failed execution |
<IP_count> |
Integer type. Number of IP addresses corresponding to the domain name. |
<DNS_ttl> |
Integer type. TTS (Time to Live) value of the DNS. Unit: second. |
<hostIPaddr> |
String type. IP address. |
Examples
This chapter takes the FC41D module as an example to introduce the AT command usage examples related to each function.
Wi-Fi Function
AT+QSTAAPINFO=testssid,123456789 //Set the module to STA mode and connect to the AP hotspot.
OK
+QSTASTAT:WLAN_CONNECTED //Connect to the network successfully.
+QSTASTAT:GOT_IP
AT+QSOFTAP=testap,12345678 //Enable AP mode.
OK
BLE Function
Peripheral Role
The LE device, which accepts the request to establish an active physical connection, is a peripheral device. When the connection is established, the peripheral device operates as a slave in the link layer.
Set Module to a Peripheral Device
AT+QBLEINIT=2 //Set the module as a peripheral device for initializing BLE.
OK
AT+QBLENAME=QuecFC41D //Set BLE name.
OK
AT+QBLEADDR? //Query and obtain BLE device address.
+QBLEADDR:c8:47:8c:42:00:49
OK
AT+QBLEGATTSSRV=fff1 //Establish a BLE service and set the service UUID to fff1.
OK
AT+QBLEGATTSCHAR=fff2 //Set GATT characteristic UUID to fff2.
OK
AT+QBLEGATTSCHAR=fff3 //Set GATT characteristic UUID to fff3.
OK
AT+QBLEADVPARAM=150,150 //Set BLE advertising parameters.
OK
AT+QBLEADVSTART //Start BLE advertising.
OK
nRF Connect
First, open nRF Connect application. Next, click "SCAN" to scan peripherals and choose "QuecFC41D" in the scanning results. Then click "CONNECT":

After the module is connected successfully, "CONNECTED" is displayed in the interface, and the added UUID is displayed in "CLIENT":

Send Data to Module
Select an editable characteristic, and click the up arrow:

Input the data to be sent in TEXT format. Then click "SEND":

Once the data is sent successfully, QCOM tool receives the data:
from phone
Send Data to nRF Connect
Enable the notification function of UUID 0xFFF3 and use QCOM tool to send data. Example:
AT+QBLEGATTSNTFY=fff3,from fc41d OKThe received data is displayed in nRF Connect UUID 0xFFF3:

Central Role
The LE device, which initiates the request to establish an active physical connection, is a central device. Once the connection is established the central device operates as a master in the link layer.
Set Module as Central Device
AT+QBLEINIT=1 //Set the module as the central device for initializing BLE.
OK
AT+QBLESCAN=1 //Start BLE scan.
OK
+QBLESCAN:HTV33,1,90d4c4c51a65
AT+QBLESCAN=0 //Stop BLE scan.
OK
AT+QBLECONN=1,90d4c4c51a65 //Connect a peripheral device.
OK
+QBLESTAT:CONNECTED
+QBLEMTU:\<512>
+QBLEINFO: 3 2a05
+QBLEINFO: 22 2a00
+QBLEINFO: 24 2a01
+QBLEINFO: 26 2aa6
+QBLEINFO: 42 fff2
Configure nRF Connect
Configure Service
Start nRF Connect application. Then click "Configure GATT server".

Add a device configuration named "FC14D". Set service UUID to 0xFFF1 and characteristic UUID to 0xFFF2.

Configure Advertising
Select "ADVERTISER" and click the plus sign in the lower right corner.

Input "FC41D" in "Display name" and tick "Connectable" in "Options". Then click "OK".

Advertising starts after the configuration is completed. You can set the advertisement duration manually.

Send Data to Module
Select an editable characteristic, and click the up arrow:

Input the data to be sent in TEXT format. Then click "SEND":

After the data is sent successfully, QCOM tool receives the data:
from phone
Send Data to nRF Connect
Enable the notification function of UUID 0xFFF2 and use QCOM tool to send data. Example:
AT+QBLEGATTCWR=fff2,from fc41dr OKThe received data is displayed in nRF Connect UUID 0xFFF2:

Configure Wi-Fi via BLE
Preparation
Prepare two modules, module A and module B. Configure module A as a peripheral device and module B as the central device, and then connect module A to module B.
Configure Module A as a Peripheral for Configuring Wi-Fi
AT+QBLENAME=Quec_FC41D //**Set BLE name.
OK
AT+QBLEINIT=3 //Set the module as a peripheral device for configuring Wi-Fi through BLE.
OK
Configure Module B as the Central Device
Open the QCOM tool, select "COM Port" and click "Open Port". Then reset FC41D.
AT+QBLEINIT=1 //Set the module as the central device for initializing BLE.
OK
AT+QBLESCAN=1 //Start BLE Scan.
OK
+QBLESCAN:Quec_FC41D,0,bcd10cf0fb80
AT+QBLESCAN=0 //Stop BLE Scan.
OK
AT+QBLECONN=0,bcd10cf0fb80 //Connect a peripheral device.
OK
Configure Wi-Fi via BLE
The module B sends an AT command through AT+QBLEGATTCWR=<UUID>,<data> to configure Wi-Fi. <data> is a Wi-Fi-related AT commands. If there are multiple parameters in the configured AT commands, you need to add "\**" before ",". For example, AT+QBLEGATTCWR=<UUID>,AT+QSTAAPINFO=<SSID>\,<pwd>**.
AT+QBLECFGMTU=512 //Update MTU.
OK
+QBLEMTU:\<512>
AT+QBLEGATTCWR=ff01,AT+QWSCAN //Send **AT+QWSCAN** via BLE.
OK
+QWSCAN:"Quectel-Customer-2.4G",WPA2_MIXED_PSK,32,f0:9b:b8:32:94:b0 ,9
+QWSCAN:"Quectel-HF-2.4G",UNKNOWN,32,f0:9b:b8:32:94:b2 ,9
+QWSCAN:"Quectel-HF",UNKNOWN,32,f0:9b:b8:32:94:b3 ,9
+QWSCAN:"ST_ShortRange",WPA2_AES_PSK,29,e0:d4:62:13:93:30 ,6
+QWSCAN:"hellowr",WPA2_AES_PSK,26,90:bd:e6:e3:66:9e ,6
+QWSCAN:"Quectel-HF",UNKNOWN,21,f0:9b:b8:33:18:b3 ,13
+QWSCAN:"Quectel-HF-2.4G",UNKNOWN,23,f0:9b:b8:33:21:f2 ,1
OK
AT+QBLEGATTCWR=ff01,AT+QSTAAPINFO=Quectel-SH\,******* //Connect to AP hotspot via BLE.
OK
AT+QSTAAPINFO=Quectel-SH,\*\*\*\*\*\*\*
OK
+QSTASTAT:WLAN_CONNECTED
+QSTASTAT:GOT_IP
TCP/UDP Function
Transparent Transmission Mode
The following example shows how to open or close a TCP/UDP client in transparent transmission mode.
AT+QIOPEN=0,"TCP","192.0.2.2",8252,2020,2 //Open a TCP client.
CONNECT
//Input data
+++ //Exit transparent transmission mode.
OK
ATO //Enter transparent transmission mode again.
CONNECT
//Input data
+++ //Exit transparent transmission mode.
OK
AT+QICLOSE=0 //Close the TCP client.
OK
+QIURC: "closed",0
The following example shows how the TCP/UDP client in transparent transmission mode behaves if disconnected abnormally.
AT+QIOPEN=0,"TCP","192.0.2.2",8252,2020,2 //Open a TCP client.
CONNECT
//Input data
NO CARRIER //Disconnected abnormally.
Non-transparent Transmission Mode
The following example shows how to read TCP/UDP data with AT commands.
AT+QIOPEN=0,"TCP","192.0.2.2",8252,2020,0 //Open a TCP client and receive data with AT command.
OK
+QIOPEN: 0,0
AT+QISEND=0,10,"1234567890"
+QISEND: 10
OK
+QIURC: "recv",0 //Receive new data.
AT+QIRD=0,10 //Read new data.
+QIRD: 10
0123456789
OK
AT+QICLOSE=0 //Close the TCP client.
OK
+QIURC: "closed",0
AT+QIOPEN=1,"UDP SERVICE","192.0.2.2",8252,2020,0 //Open a UDP client and receive data with AT command.
OK
+QIOPEN: 1,0
AT+QISEND=1,10,"1234567890","192.0.2.2",8252
+QISEND: 10
OK
+QIURC: "recv",1 //Receive new data.
AT+QIRD=1,10 //Read new data.
+QIRD: 10,"192.0.2.2",8252
0123456789
OK
AT+QICLOSE=1 //Close the UDP service.
OK
+QIURC: "closed",1
The following example shows how to report new data with URC.
AT+QIOPEN=0,"TCP","192.0.2.2",8252,2020,1 //Open a TCP client and receive data in URC format.
OK
+QIOPEN: 0,0
AT+QISEND=0,10,"1234567890"
+QISEND: 10
OK
+QIURC: "recv",0,10 //Receive new data.
0123456789
AT+QICLOSE=0 //Close the TCP client.
OK
+QIURC: "closed",0
AT+QIOPEN=1,"UDP SERVICE","192.0.2.2",8252,2020,1 //Open a UDP client and receive data in URC format.
OK
+QIOPEN: 1,0
AT+QISEND=1,10,"1234567890","192.0.2.2",8252
+QISEND: 10
OK
+QIURC: "recv",1,10, "192.0.2.2",8252 //Receive new data.
0123456789
AT+QICLOSE=1 //Close the UDP service.
OK
+QIURC: "closed",1
SSL Function
The following is an example of sending and receiving data through URC reporting during one-way verification.
AT+QSSLCFG="verify",1,1 //Set one-way verification.
OK
AT+QSSLCFG="verify",1 // Check whether the setting is successful.
+QSSLCFG: "verify",1,1
OK
AT+QSSLCERT="CA",2,1657 //Upload SSL certificate.
CONNECT
-----BEGIN CERTIFICATE-----
MIIE5TCCA02gAwIBAgIJAP5uWtPRe+IxMA0GCSqGSIb3DQEBCwUAMIGHMQswCQYD
VQQGEwJDTjELMAkGA1UECAwCQUgxCzAJBgNVBAcMAkhGMRwwGgYDVQQKDBNEZWZh
dWx0IENvbXBhbnkgTHRkMRgwFgYDVQQDDA8yMjAuMTgwLjIzOS4yMTIxJjAkBgkq
hkiG9w0BCQEWF2VkZGllLnpoYW5nQHF1ZWN0ZWwuY29tMCAXDTIxMDEyNzAzMzk0
M1oYDzIxMjEwMTAzMDMzOTQzWjCBhzELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAkFI
MQswCQYDVQQHDAJIRjEcMBoGA1UECgwTRGVmYXVsdCBDb21wYW55IEx0ZDEYMBYG
A1UEAwwPMjIwLjE4MC4yMzkuMjEyMSYwJAYJKoZIhvcNAQkBFhdlZGRpZS56aGFu
Z0BxdWVjdGVsLmNvbTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBANf3
w0ep+Sv4qDjhafwc3wiaGdzwAXOsRgfGgBEGYL5MuPbpzjERo21yHae6Tx19DIUt
g6hgW5N/bvDqXLbEMChy9b8aNl62+Y6O35Tya2hoz4XXQkrPkRXvlP2eonjPMfQB
Yu4wtAfNKPa10MJF8qjFI7WWBpcQMpoQvt/SekoD6IyxgRu8ApjtmJicvvWu3BqW
W93MZqLhSFf57pKLQEhgskpl/gb+rLiUwObMTRM948J04NoYBx1jwMZLNEFs6os6
91J8B5oHlgQAsgcXjoXORxncgt2d/fZyr9NjVevc/GIkcbfVAAWohFCQmjpgLESW
iTPaRlLyeLLjTb+WrSOKosinVH+1R8ozfBnkzO+tf9lpBzdP9QCDYzNQeU4Xp0wJ
8Neo5tA4tioDEZjkbsHL+bVvssqOwfupR9b03Z2ZLfgEzs3TwYbPB7ULJQrdqe9x
QtpaFSsDeyKJ6CR8yEHz5d0lypPeRLCjZGb49Yo3FKhMdzP+ZMT+Ku001cr4GwID
AQABo1AwTjAdBgNVHQ4EFgQU4FfBsWrgpoGtvuF+3XN9kbUx0yUwHwYDVR0jBBgw
FoAU4FfBsWrgpoGtvuF+3XN9kbUx0yUwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B
AQsFAAOCAYEAqfVX0LhhxYZ/KsC9jhWYHgmYggVcsTa7AtZsNKW79TLmz98iWdfM
wpi44rwbn1Xek5pDH/rimaJuwxcX8Q4cFHqeQJStRkcuU6CgyurVBpjGWRv5qt3W
nJc/z92x3TPzW1VJv5rXj4pzX9N4hlAHGGzFBm+VMAexS006/dksGa9uEKE/2A0+
9W/V9YbcjhejdENiRAvJB4J0QsOrNUjsH5bPEa3CxdXbKOQzGjJtS7f0BH38Fmyi
C+Cui8U0c+BwRGY3HXL7ANhCe0vdUbUGCG2L6byRvf1TIkuGpi0RxtQfEF3sTDH5
jAot50rJhbckQyLH0xkIOQ9qmU/gbt/wgoZ9AzUVIyh0RsyWo19BGz2DpsuYNBXD
4jqL4NMqsyGRq5YUTrJlIi9PVUp176Ec79xSffvUbitiq9fMmxuhsRbkP4piM1TE
D5oXKPme86RvR1/foRqAdbJg5RPYdah3LdOlAE2HePVy6b0xQ5dcCHaqHmR2SVlY
m7TQs6tfvfhy
-----END CERTIFICATE-----
OK //Finished.
AT+QSSLOPEN=1,1,"192.0.2.0",12000 //Set up an SSL connection.
OK
+QSSLOPEN: 1,0
AT+QSSLSTATE //Query the state of all SSL connections.
+QSSLSTATE: 1,"SSL CLIENT","192.0.2.0",12000,6601,2
OK
AT+QISWTMD=1,1 //Switch the data access mode to direct push mode.
OK
AT+QSSLSEND=1,6,"123456" //Send data.
+QSSLSEND: 6
OK
+QSSLURC: "recv",1,6 //The URC indicates incoming data.
123456
AT+QSSLCERT="CA",0 //Delete SSL certificate.
OK
AT+QSSLCLOSE=1,1 //Close SSL connection.
OK
+QSSLURC: "closed",1
MQTT Function
AT+QMTCFG="version",1,4 //Configure MQTT protocol version to V4.
OK
AT+QMTOPEN=1,"192.0.2.0",8306 //Open an MQTT session for MQTT server.
OK
+QMTOPEN: 1,0
AT+QMTCONN=1,"client1","test","test" //Connect a client to MQTT server.
OK
+QMTCONN: 1,0,0
AT+QMTSUB=1,1,"quectel",1 //Subscribe to topic named \"quectel\".
OK
+QMTSUB: 1,1,0,1
//Direct push mode
AT+QMTPUB=1,1,1,0,"quectel",3,"123" //Publish a message with the topic \"quectel\".
OK
+QMTPUB: 1,1,0
+QMTRECV: 1,1,"quectel",3,"123" //Receive a message with the topic \"quectel\".
//Send a hex message.
AT+QMTPUBRAW=1,1,1,0,"quectel",6
>
d0 01 02 03 f4 f5 //Send a hex message after receiving >.
OK
+QMTPUB: 1,1,0
+QMTRECV: 1,1,"quectel",6,"d0 01 02 03 f4 f5" //Receive a hex message with the topic \"quectel\".
//Buffer mode
AT+QMTCFG="recv/mode",1,1
OK
AT+QMTPUB=1,1,1,0,"quectel",4,"3132" //Publish a message with the topic \"quectel\".
OK
+QMTPUB: 1,1,0
+QMTRECV: 1,0
AT+QMTRECV=1,0
+QMTRECV: 1,1,"quectel",4,"3132"
OK
AT+QMTPUBRAW=1,1,1,0,"quectel",6
>
d0 01 02 03 f4 f5 //Send a hex message after receiving >.
OK
+QMTPUB: 1,1,0
+QMTRECV: 1,1
AT+QMTRECV=1,1
+QMTRECV: 1,2,"quectel",6,"d0 01 02 03 f4 f5"
OK
AT+QMTUNS=1,1,"quectel" //Unsubscribe from topic named \"quectel\".
OK
+QMTUNS: 1,1,0
AT+QMTDISC=1 //Disconnect the client from the MQTT server.
OK
+QMTDISC: 1,0
HTTP(S) Function
//Example of sending HTTP(S) GET request.
//Step 1: Configure URL
AT+QHTTPCFG="url","http://www.example.com"
OK
//Step 2: Send GET request
AT+QHTTPGET=120 //Open a web.
OK
+QHTTPGET: 0,200
//Step 3: Read the response data
AT+QHTTPREAD=60 //Read the response data.
CONNECT
<html>
<head>
<script>
location.replace(location.href.replace("https://","http://"));
</script>
</head>
<body>
<noscript>\<meta http-equiv="refresh"
content="0;url=http://www.example.com/">
......................
OK
+QHTTPREAD: 0
//Example of sending HTTP(S) POST request.
//Step 1: Configure URL
AT+QHTTPCFG="url","http://example/study_log/"
OK
//Step 2: Send POST request
AT+QHTTPPOST=1024,120,120,"file","test.txt","text/plain" //Upload Form-data POST file.
CONNECT
//Input body. When the length of inputted data reaches \<body_length>, the module exits data mode.
OK
+QHTTPPOST: 0,200,1538
//Step 3: Read the response data
AT+QHTTPREAD=60 //Read the response data.
CONNECT
<html>
<head>
......................
OK
+QHTTPREAD: 0
//Example of sending HTTP(S) PUT request.
//Step 1: Configure URL
AT+QHTTPCFG="url","http://example/test.txt"
OK
//Step 2: Send PUT request
AT+QHTTPPUT=1024,120,120 //Upload file in PUT mode.
CONNECT
//Input body. When the length of inputted data reaches \<body_length>, the module exits data mode.
OK
+QHTTPPUT: 0,200,1538
//Step 3: Read the response data
AT+QHTTPREAD=60 //Read the response data.
CONNECT
<html>
<head>
......................
OK
+QHTTPREAD: 0
//Customized Header Example
//Customizing the parameter header: Range: bytes=x-x, to run the function of breakpoint download
AT+QHTTPCFG="header","Range","bytes=0-511"
OK
AT+QHTTPCFG="url","http://example.txt"
OK
AT+QHTTPGET=60
OK
+QHTTPGET: 0,200,512
AT+QHTTPREAD=60 //Read the response data.
CONNECT
//Data
OK
+QHTTPREAD: 0
GPIO Function
AT+QGPI0CFG=?
+QGPIOCFG:<mode>,<pin>,<dir>,<pul>,<drv>/<val>
OK
AT+QGPI0CFG=1,22,1,0,3 //Configure pin 22 to output with a drive current of 20 mA.
OK
AT+QGPIOCFG=2,22 //Query the level status of pin 22.
+QGPIOCFG: 0
OK
AT+QGPI0CFG=3,22.1 //Pull up pin 22.
OK
Summary of Result Codes
TCP/UDP/SSL Result Codes:
| Result Code | Description |
|---|---|
| 0 | Operation success |
| 550 | Invalid parameter |
| 551 | Unknown error |
| 552 | Memory not enough |
| 553 | Socket ID has been used |
| 554 | Socket ID not exist |
| 555 | Socket allocate failed |
| 556 | Operation not allowed |
| 557 | Operation not supported |
| 558 | No network |
| 559 | No certificate |
| 560 | Operation busy |
| 561 | Operation timeout |
| 562 | Socket write failed |
| 563 | Socket read failed |
HTTP(S) Result Codes:
| Result Code | Description |
|---|---|
| 0 | Operation success |
| 1 | Invalid parameter |
| 2 | Unknown error |
| 3 | Memory not enough |
| 4 | Socket failure |
| 5 | Operation not supported |
| 6 | Operation not allowed |
| 7 | No network |
| 8 | Lack of SSL Cert |
| 9 | Response timeout |
| 10 | Body wait timeout |
HTTP(S) Status Codes:
| Status Code | Description |
|---|---|
| 200 | OK |
| 204 | No Content |
| 301 | Moved Permanently |
| 302 | Found |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
| 502 | Bad Gateway |
| 504 | Gateway Timeout |
Appendix References
Terms and Abbreviations:
| Abbreviation | Description |
|---|---|
| ACK | Acknowledgement |
| AP | Access Point |
| BLE | Bluetooth Low Energy |
| BSSID | Basic Service Set Identifier |
| DHCP | Dynamic Host Configuration Protocol |
| DNS | Domain Name Server |
| GATT | Generic Attribute Profile |
| GPIO | General Purpose Input/Output |
| MAC | Medium Access Control |
| MQTT | Message Queuing Telemetry Transport |
| MTU | Maximum Transmission Unit |
| HTTP | Hyper Text Transfer Protocol |
| HTTPS | Hypertext Transfer Protocol Secure |
| ID | Mostly refers to Identifier in terms of software |
| IP | Internet Protocol |
| NTP | Network Time Protocol |
| OTA | Over-the-Air Techology |
| PSK | Pre-Shared Key |
| QoS | Quality of Service |
| SNI | Server Name Indication |
| STA | Station |
| SSID | Service Set Identifier |
| SSL | Secure Sockets Layer |
| TA | Terminal Adapter |
| TCP | Transmission Control Protocol |
| TLS | Transport Layer Security |
| TTL | Time To Live |
| UDP | User Datagram Protocol |
| URC | Unsolicited Result Code |
| UTC | Coordinated Universal Time |
| UUID | Universally Unique Identifier |