Skip to content

Commit 0a52e6d

Browse files
Deomid Ryabkovdimonomid
authored andcommitted
Add mqtt.max_qos, use in AWS GG
This way max qos is persisted and applied correctly even after GG bootstrap. PUBLISHED_FROM=52fa78f53872260fb4e600e17cc21576e31a989b
1 parent 504a0b0 commit 0a52e6d

File tree

6 files changed

+4
-0
lines changed

6 files changed

+4
-0
lines changed

lib/cc3200/libmqtt.a

636 Bytes
Binary file not shown.

lib/cc3220/libmqtt.a

636 Bytes
Binary file not shown.

lib/esp32/libmqtt.a

692 Bytes
Binary file not shown.

lib/esp8266/libmqtt.a

484 Bytes
Binary file not shown.

mos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ config_schema:
2626
- ["mqtt.keep_alive", "i", 60, {title: "Keep alive interval"}]
2727
- ["mqtt.will_topic", "s", "", {title: "Will topic"}]
2828
- ["mqtt.will_message", "s", "", {title: "Will message"}]
29+
- ["mqtt.max_qos", "i", 2, {title: "Limit QoS of outgoing messages to at most this"}]
2930
- ["debug.stdout_topic", "s", "", {title: "MQTT topic to publish STDOUT to"}]
3031
- ["debug.stderr_topic", "s", "", {title: "MQTT topic to publish STDERR to"}]
3132
cdefs:

src/mgos_mqtt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ SLIST_HEAD(global_handlers, global_handler) s_global_handlers;
5757
static void mqtt_global_reconnect(void);
5858

5959
void mgos_mqtt_set_max_qos(int qos) {
60+
if (s_max_qos == qos) return;
6061
LOG(LL_INFO, ("Setting max MQTT QOS to %d", qos));
6162
s_max_qos = qos;
6263
}
@@ -283,6 +284,8 @@ bool mgos_mqtt_init(void) {
283284
}
284285
mgos_net_add_event_handler(mgos_mqtt_net_ev, NULL);
285286

287+
mgos_mqtt_set_max_qos(mgos_sys_config_get_mqtt_max_qos());
288+
286289
mgos_hook_register(MGOS_HOOK_DEBUG_WRITE, s_debug_write_hook, NULL);
287290

288291
return true;

0 commit comments

Comments
 (0)