allow setting of cusom length lwt msg
This commit is contained in:
1 parent
dd6969098d
commit
f0f3e11f6b
2 files changed
+5
-1
No files matched your search
@@ -67,6 +67,7 @@ typedef struct {
|
||||
char lwt_msg[MQTT_MAX_LWT_MSG];
|
||||
int lwt_qos;
|
||||
int lwt_retain;
|
||||
int lwt_msg_len;
|
||||
int disable_clean_session;
|
||||
int keepalive;
|
||||
bool disable_auto_reconnect;
|
||||
|
||||
+4
-1
@@ -127,7 +127,10 @@ static esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_
|
||||
|
||||
if (config->lwt_msg[0]) {
|
||||
client->connect_info.will_message = strdup(config->lwt_msg);
|
||||
client->connect_info.will_length = strlen(config->lwt_msg);
|
||||
if (config->lwt_msg_len > 0)
|
||||
client->connect_info.will_length = config->lwt_msg_len;
|
||||
else
|
||||
client->connect_info.will_length = strlen(config->lwt_msg);
|
||||
}
|
||||
|
||||
client->connect_info.will_qos = config->lwt_qos;
|
||||
|
||||
Reference in new issue
Block a user