From 3ba1546a487daab5dd17b3fa88d98d88cf55883f Mon Sep 17 00:00:00 2001 From: Rafael Silva Date: Wed, 22 Dec 2021 15:28:33 +0000 Subject: [PATCH] Add event enable/disable feature Signed-off-by: Rafael Silva --- include/mqtt.h | 6 +++--- src/mqtt.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/mqtt.h b/include/mqtt.h index 87f09b6..5ff29bb 100644 --- a/include/mqtt.h +++ b/include/mqtt.h @@ -1100,7 +1100,7 @@ enum MQTTCallbackEvent { MQTT_EVENT_UNSUBSCRIBED = (1 << 7), // bit 7 MQTT_EVENT_PING = (1 << 8), // bit 8 MQTT_EVENT_PUBLISH_TIMEOUT = (1 << 9), // bit 9 - MQTT_EVENT_ERROR = (1 << 10), // bit 10s + MQTT_EVENT_ERROR = (1 << 10), // bit 10 }; //TODO: brief @@ -1547,7 +1547,7 @@ enum MQTTErrors mqtt_connect(struct mqtt_client *client, * @param event_flags * @return enum MQTTErrors */ -void mqtt_event_enable(uint16_t event_flags); +void mqtt_event_enable(struct mqtt_client *client, uint16_t event_flags); //TODO: docs /** @@ -1556,7 +1556,7 @@ void mqtt_event_enable(uint16_t event_flags); * @param event_flags * @return enum MQTTErrors */ -void mqtt_event_disable(uint16_t event_flags); +void mqtt_event_disable(struct mqtt_client *client, uint16_t event_flags); /** * @brief Publish an application message. diff --git a/src/mqtt.c b/src/mqtt.c index 0c1d887..868e176 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -283,11 +283,11 @@ enum MQTTErrors mqtt_connect(struct mqtt_client *client, return MQTT_OK; } -void mqtt_event_enable(uint16_t event_flags) { +void mqtt_event_enable(struct mqtt_client *client, uint16_t event_flags) { client->event_enable |= (event_flags & MQTT_EVENT_MASK); } -void mqtt_event_disable(uint16_t event_flags) { +void mqtt_event_disable(struct mqtt_client *client, uint16_t event_flags) { client->event_enable &= ~(event_flags & MQTT_EVENT_MASK); }