1. MQTT Err Code
0 | operation succeeded |
1 | failed |
2 | bad UTF-8 string |
3 | sock connect fail |
4 | sock create fail |
5 | sock close fail |
6 | message receive fail |
7 | network open fail |
8 | network close fail |
9 | network not opened |
10 | client index error |
11 | no connection |
12 | invalid parameter |
13 | not supported operation |
14 | client is busy |
15 | require connection fail |
16 | sock sending fail |
17 | timeout |
18 | topic is empty |
19 | client is used |
20 | client not acquired |
21 | client not released |
22 | length out of range |
23 | network is opened |
24 | packet fail |
25 | DNS error |
26 | socket is closed by server |
27 | connection refused: unaccepted protocol version |
28 | connection refused: identifier rejected |
29 | connection refused: server unavailable |
30 | connection refused: bad user name or password |
31 | connection refused: not authorized |
32 | handshake fail |
33 | not set certificate |
34 | open SSL session failed |
2. MQTT Unsolicited Result Code
+CMQTTCONNLOST: <client_index>,<cause> |
When client disconnect passively, URC “+CMQTTCONNLOST” will be reported, then user need to connect MQTT server again. |
+CMQTTPING: <client_index>,<err> |
When send ping (which keep-alive to the server) to server failed, the module will report this URC. If received this message, you should disconnect the connection and re-connect |
+CMQTTNONET |
When the network is become no network, the module will report this URC. If received this message, you should restart the MQTT service by AT+CMQTTSTART. |
+CMQTTRXSTART: <client_index>,<topic_total_len>, <payload_total_len>
+CMQTTRXTOPIC: <client_index>,<sub_topic_len> <sub_topic>
for long topic, split to multiple packets to report [<CR><LF>+CMQTTRXTOPIC: <client_index>,<sub_topic_len> <sub_topic>]
+CMQTTRXPAYLOAD: <client_index>, <sub_payload_len><sub_payload>
for long payload, split to multiple packets to report [+CMQTTRXPAYLOAD: <client_index>,<sub_payload_len> <sub_payload>]
+CMQTTRXEND: <client_index>
|
If a client subscribes to one or more topics, any message published to those topics are sent by the server to the client. The following URC is used for transmitting the message published from server to client.
1) +CMQTTRXSTART: <client_index>,<topic_total_len>,<payload_total_len> At the beginning of receiving published message, the module will report this to user, and indicate client index with <client_index>, the topic total length with <topic_total_len> and the payload total length with <payload_total_len>.
2) +CMQTTRXTOPIC: <client_index>,<sub_topic_len>\r\n<sub_topic> After the command “+CMQTTRXSTART” received, the module will report the second message to user, and indicate client index with <client_index>, the topic packet length with <sub_topic_len> and the topic content with <sub_topic> after “\r\n”. For long topic, it will be split to multiple packets to report and the command “+CMQTTRXTOPIC” will be send more than once with the rest of topic content. The sum of <sub_topic_len> is equal to <topic_total_len>.
3) +CMQTTRXPAYLOAD: <client_index>,<sub_payload_len>\r\n<sub_payload> After the command “+CMQTTRXTOPIC” received, the module will send third message to user, and indicate client index with <client_index>, the payload packet length with <sub_payload_len> and the payload content with <sub_payload> after “\r\n”. For long payload, the same as “+CMQTTRXTOPIC”. 4) +CMQTTRXEND: <client_index> At last, the module will send fourth message to user and indicate the topic and payload have been transmitted completely. |
<client_index> |
A numeric parameter that identifies a client. The range of permitted values is 0 to 1. |
<cause> |
The cause of disconnection. 1 – Socket is closed passively. 2 – Socket is reset. 3 – Network is closed. |
<topic_total_len> |
The length of message topic received from MQTT server. The range is from 1 to 1024 bytes. |
<payload_total_len> |
The length of message body received from MQTT server. The range is from 1 to 10240 bytes. |
<sub_topic_len> | The sub topic packet length, The sum of <sub_topic_len> is equal to <topic_total_len>. |
<sub_topic> | The sub topic content. |
<sub_payload_len> |
Max length is 1500. The sub message body packet length. The sum of <sub_payload_len> is equal to <payload_total_len>. |
<sub_payload> | The sub message body content. |
<err> | The result code, please refer to chapter 16.3.1 |