User Manual

Table Of Contents
SARA-R4 series-AT commands manual
UBX-17003787 - R16
25MQTT
Page 307 of 401
Type Syntax Response Example
MQTT read message
Set AT+UMQTTC=6[,<one_message>] +UMQTTC: 6,<QoS>,<topic_msg_
length>,<topic_length>,<topic_
name>,<read_msg_length>,<read_
msg>
OK
AT+UMQTTC=6,1
+UMQTTC: 6,0,31,13,"sensor/heat/
#",18,"23 degrees Celsius"
OK
URC +UUMQTTC: 6,<num_unread_
msgs>,<memory_full>
+UUMQTTC: 6,3,0
Ping MQTT broker
Set AT+UMQTTC=8,<ping_ON_OFF> OK AT+UMQTTC=8,1
OK
Publish a binary message to a topic
Set AT+UMQTTC=9,<QoS>,<retain>,
<topic_name>,<pub_msg_length>
After the ">" prompt <pub_msg_
length> bytes of data are entered
><pub_bin_message>
OK
AT+UMQTTC=9,1,0,"u-blox/test",33
>AABB--> execute this \nand "this"
OK
URC +UUMQTTC: 9,<MQTT_result> +UUMQTTC: 9,1
Test AT+UMQTTC=? +UMQTT: (list of supported <op_
codes>s)
OK
+UMQTTC: (0-9)
OK
25.6.4Defined values
Parameter Type Description
<op_code> Number MQTT command request.
0: logs out/disconnects from MQTT server. The will message will not be sent
1: logs in/connects to MQTT server
2: publish a message to a specific topic to the MQTT message broker
3: publish a message from a file to a specific topic to the MQTT message broker
4: subscribe to a topic from the MQTT message broker
5: unsubscribe to a topic from the MQTT message broker. This should exactly
match the Topic Filter used during the Subscribe
6: read all unread messages received from MQTT message broker, at the terse/
verbose mode set at the time of message reception
7: sets the terse/verbose format for received messages (i.e. the amount of
information and headers with each received MQTT message)
8: ping the MQTT message broker
9: publish a message in binary mode. It is used for publishing any binary data
Allowed values:
SARA-R410M-63B / SARA-R410M-73B / SARA-R410M-83B - 0, 1, 2, 3, 4, 5, 6, 8
SARA-R410M-02B / SARA-R410M-52B / SARA-R412M / SARA-N4 - 0, 1, 2, 3, 4, 5, 6,
7, 8
<MQTT_result> Number Result of an MQTT command request:
0: fail; for more details, see the +UMQTTER AT command
1: success
<login_result> Number Result of an MQTT login request. Allowed values:
0: connection accepted
1: the server does not support the level of the MQTT protocol requested by the client
2: the client identifier is correct UTF-8 but not allowed by the server
3: the network connection has been made but the MQTT service is unavailable
4: the data in the user name or password is malformed
5: the client is not authorized to connect
6-255: reserved for future use
<QoS> Number Quality of service:
0 (default value): at most once delivery
1: at least once delivery
2: exactly once delivery