Skip to content

Commit

Permalink
Add event enable/disable feature
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Silva <[email protected]>
  • Loading branch information
perigoso committed Jun 3, 2022
1 parent 14d3507 commit 3ba1546
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions include/mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
/**
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 3ba1546

Please sign in to comment.