mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #15656 from haukepetersen/fix_asymcute_pubmsgidqos0
net/asymcute: fix MsgId when publishing with QOS0
This commit is contained in:
commit
6fb0153877
@ -30,6 +30,7 @@
|
||||
* - Gateway discovery process not implemented
|
||||
* - Last will feature not implemented
|
||||
* - No support for QoS level 2
|
||||
* - No support for QoS level -1
|
||||
* - No support for wildcard characters in topic names when subscribing
|
||||
* - Actual granted QoS level on subscription is ignored
|
||||
*
|
||||
|
||||
@ -50,6 +50,7 @@ enum {
|
||||
MQTTSN_QOS_MASK = 0x60, /**< QoS level mask */
|
||||
MQTTSN_QOS_2 = 0x40, /**< QoS level 2 */
|
||||
MQTTSN_QOS_1 = 0x20, /**< QoS level 1 */
|
||||
MQTTSN_QOS_NEG1 = 0x60, /**< QoS level -1 (negative 1) */
|
||||
MQTTSN_QOS_0 = 0x00, /**< QoS level 0 */
|
||||
MQTTSN_RETAIN = 0x10, /**< retain flag */
|
||||
MQTTSN_WILL = 0x08, /**< will flag, used during CONNECT */
|
||||
|
||||
@ -879,8 +879,14 @@ int asymcute_publish(asymcute_con_t *con, asymcute_req_t *req,
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* get message id */
|
||||
req->msg_id = _msg_id_next(con);
|
||||
/* set MsgId only for QoS 1 and 2, else it must be set to 0 */
|
||||
if (((flags & MQTTSN_QOS_MASK) == MQTTSN_QOS_1) ||
|
||||
((flags & MQTTSN_QOS_MASK) == MQTTSN_QOS_2)) {
|
||||
req->msg_id = _msg_id_next(con);
|
||||
}
|
||||
else {
|
||||
req->msg_id = 0;
|
||||
}
|
||||
|
||||
/* assemble message */
|
||||
size_t pos = _len_set(req->data, data_len + 6);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user