@@ -259,6 +259,28 @@ int MqttClient::endMessage()
259
259
return 1 ;
260
260
}
261
261
262
+ int MqttClient::publish (const char * topic, const char * payload, bool retain, uint8_t qos, bool dup) {
263
+ int ret = beginMessage (topic, strlen_P (payload), retain, qos, dup );
264
+ if (!ret) {
265
+ return ret;
266
+ }
267
+ print (payload);
268
+ ret = endMessage ();
269
+ return ret;
270
+ }
271
+
272
+ int MqttClient::publish (const String& topic, const char * payload, bool retain, uint8_t qos, bool dup) {
273
+ publish (topic.c_str (), payload, retain, qos, dup );
274
+ }
275
+
276
+ int MqttClient::publish (const const char * topic, String& payload, bool retain, uint8_t qos, bool dup) {
277
+ publish (topic, payload.c_str (), retain, qos, dup );
278
+ }
279
+
280
+ int MqttClient::publish (const String& topic, String& payload, bool retain, uint8_t qos, bool dup){
281
+ publish (topic.c_str (), payload.c_str (), retain, qos, dup );
282
+ }
283
+
262
284
int MqttClient::beginWill (const char * topic, unsigned short size, bool retain, uint8_t qos)
263
285
{
264
286
int topicLength = strlen (topic);
0 commit comments