@@ -259,6 +259,17 @@ int MqttClient::endMessage()
259
259
return 1 ;
260
260
}
261
261
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
+ */
262
273
int MqttClient::publish (const char * topic, const char * payload, bool retain, uint8_t qos, bool dup) {
263
274
int ret = beginMessage (topic, strlen_P (payload), retain, qos, dup );
264
275
if (!ret) {
@@ -269,14 +280,47 @@ int MqttClient::publish(const char* topic, const char* payload, bool retain, uin
269
280
return ret;
270
281
}
271
282
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
+ */
272
294
int MqttClient::publish (const String& topic, const char * payload, bool retain, uint8_t qos, bool dup) {
273
295
return publish (topic.c_str (), payload, retain, qos, dup );
274
296
}
275
297
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
+ */
276
309
int MqttClient::publish (const char * topic, String& payload, bool retain, uint8_t qos, bool dup) {
277
310
return publish (topic, payload.c_str (), retain, qos, dup );
278
311
}
279
312
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
+ */
280
324
int MqttClient::publish (const String& topic, String& payload, bool retain, uint8_t qos, bool dup) {
281
325
return publish (topic.c_str (), payload.c_str (), retain, qos, dup );
282
326
}
0 commit comments