Skip to content

Commit

Permalink
added documentation to publish functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hmueller01 committed Nov 17, 2024
1 parent 4125152 commit 9af832b
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/MqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,17 @@ int MqttClient::endMessage()
return 1;
}

/**
* @brief Pubish a MQTT messages to the broker.

Check failure on line 263 in src/MqttClient.cpp

View workflow job for this annotation

GitHub Actions / spellcheck

Pubish ==> Publish
*
* @param topic The topic to publish to.
* @param payload The payload to publish.
* @param retain Publish the MQTT message with the retain flag. Default false.
* @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
* @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
* @return 0 - Failed to send message.
* 1 - Successfully send message.
*/
int MqttClient::publish(const char* topic, const char* payload, bool retain, uint8_t qos, bool dup) {
int ret = beginMessage(topic, strlen_P(payload), retain, qos, dup);
if (!ret) {
Expand All @@ -269,14 +280,47 @@ int MqttClient::publish(const char* topic, const char* payload, bool retain, uin
return ret;
}

/**
* @brief Pubish a MQTT messages to the broker.

Check failure on line 284 in src/MqttClient.cpp

View workflow job for this annotation

GitHub Actions / spellcheck

Pubish ==> Publish
*
* @param topic The topic to publish to.
* @param payload The payload to publish.
* @param retain Publish the MQTT message with the retain flag. Default false.
* @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
* @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
* @return 0 - Failed to send message.
* 1 - Successfully send message.
*/
int MqttClient::publish(const String& topic, const char* payload, bool retain, uint8_t qos, bool dup) {
return publish(topic.c_str(), payload, retain, qos, dup);
}

/**
* @brief Pubish a MQTT messages to the broker.

Check failure on line 299 in src/MqttClient.cpp

View workflow job for this annotation

GitHub Actions / spellcheck

Pubish ==> Publish
*
* @param topic The topic to publish to.
* @param payload The payload to publish.
* @param retain Publish the MQTT message with the retain flag. Default false.
* @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
* @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
* @return 0 - Failed to send message.
* 1 - Successfully send message.
*/
int MqttClient::publish(const char* topic, String& payload, bool retain, uint8_t qos, bool dup) {
return publish(topic, payload.c_str(), retain, qos, dup);
}

/**
* @brief Pubish a MQTT messages to the broker.

Check failure on line 314 in src/MqttClient.cpp

View workflow job for this annotation

GitHub Actions / spellcheck

Pubish ==> Publish
*
* @param topic The topic to publish to.
* @param payload The payload to publish.
* @param retain Publish the MQTT message with the retain flag. Default false.
* @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
* @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
* @return 0 - Failed to send message.
* 1 - Successfully send message.
*/
int MqttClient::publish(const String& topic, String& payload, bool retain, uint8_t qos, bool dup) {
return publish(topic.c_str(), payload.c_str(), retain, qos, dup);
}
Expand Down

0 comments on commit 9af832b

Please sign in to comment.