@@ -259,6 +259,17 @@ int MqttClient::endMessage()
259259 return 1 ;
260260}
261261
262+ /* *
263+ * @brief Pubish a MQTT messages to the broker.
264+ *
265+ * @param topic The topic to publish to.
266+ * @param payload The payload to publish.
267+ * @param retain Publish the MQTT message with the retain flag. Default false.
268+ * @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
269+ * @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
270+ * @return 0 - Failed to send message.
271+ * 1 - Successfully send message.
272+ */
262273int MqttClient::publish (const char * topic, const char * payload, bool retain, uint8_t qos, bool dup) {
263274 int ret = beginMessage (topic, strlen_P (payload), retain, qos, dup);
264275 if (!ret) {
@@ -269,14 +280,47 @@ int MqttClient::publish(const char* topic, const char* payload, bool retain, uin
269280 return ret;
270281}
271282
283+ /* *
284+ * @brief Pubish a MQTT messages to the broker.
285+ *
286+ * @param topic The topic to publish to.
287+ * @param payload The payload to publish.
288+ * @param retain Publish the MQTT message with the retain flag. Default false.
289+ * @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
290+ * @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
291+ * @return 0 - Failed to send message.
292+ * 1 - Successfully send message.
293+ */
272294int MqttClient::publish (const String& topic, const char * payload, bool retain, uint8_t qos, bool dup) {
273295 return publish (topic.c_str (), payload, retain, qos, dup);
274296}
275297
298+ /* *
299+ * @brief Pubish a MQTT messages to the broker.
300+ *
301+ * @param topic The topic to publish to.
302+ * @param payload The payload to publish.
303+ * @param retain Publish the MQTT message with the retain flag. Default false.
304+ * @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
305+ * @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
306+ * @return 0 - Failed to send message.
307+ * 1 - Successfully send message.
308+ */
276309int MqttClient::publish (const char * topic, String& payload, bool retain, uint8_t qos, bool dup) {
277310 return publish (topic, payload.c_str (), retain, qos, dup);
278311}
279312
313+ /* *
314+ * @brief Pubish a MQTT messages to the broker.
315+ *
316+ * @param topic The topic to publish to.
317+ * @param payload The payload to publish.
318+ * @param retain Publish the MQTT message with the retain flag. Default false.
319+ * @param qos The Quality of Service of the MQTT message. [0 .. 2]. Default 0.
320+ * @param dup Set or reset the duplicate flag of MQTT message. Default false (reset).
321+ * @return 0 - Failed to send message.
322+ * 1 - Successfully send message.
323+ */
280324int MqttClient::publish (const String& topic, String& payload, bool retain, uint8_t qos, bool dup) {
281325 return publish (topic.c_str (), payload.c_str (), retain, qos, dup);
282326}
0 commit comments