mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-08-03 04:35:15 +02:00
Merge pull request #24 from StudioSophisti/master
Allow non-string lwt message
This commit is contained in:
@@ -67,6 +67,7 @@ typedef struct {
|
|||||||
char lwt_msg[MQTT_MAX_LWT_MSG];
|
char lwt_msg[MQTT_MAX_LWT_MSG];
|
||||||
int lwt_qos;
|
int lwt_qos;
|
||||||
int lwt_retain;
|
int lwt_retain;
|
||||||
|
int lwt_msg_len;
|
||||||
int disable_clean_session;
|
int disable_clean_session;
|
||||||
int keepalive;
|
int keepalive;
|
||||||
bool disable_auto_reconnect;
|
bool disable_auto_reconnect;
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
#define MQTT_MAX_HOST_LEN 64
|
#define MQTT_MAX_HOST_LEN 64
|
||||||
#define MQTT_MAX_CLIENT_LEN 32
|
#define MQTT_MAX_CLIENT_LEN 32
|
||||||
#define MQTT_MAX_USERNAME_LEN 32
|
#define MQTT_MAX_USERNAME_LEN 32
|
||||||
#define MQTT_MAX_PASSWORD_LEN 32
|
#define MQTT_MAX_PASSWORD_LEN 65
|
||||||
#define MQTT_MAX_LWT_TOPIC 32
|
#define MQTT_MAX_LWT_TOPIC 32
|
||||||
#define MQTT_MAX_LWT_MSG 32
|
#define MQTT_MAX_LWT_MSG 128
|
||||||
#define MQTT_TASK_PRIORITY 5
|
#define MQTT_TASK_PRIORITY 5
|
||||||
#define MQTT_TASK_STACK (6*1024)
|
#define MQTT_TASK_STACK (6*1024)
|
||||||
#define MQTT_KEEPALIVE_TICK (120)
|
#define MQTT_KEEPALIVE_TICK (120)
|
||||||
|
@@ -127,7 +127,12 @@ static esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_
|
|||||||
|
|
||||||
if (config->lwt_msg[0]) {
|
if (config->lwt_msg[0]) {
|
||||||
client->connect_info.will_message = strdup(config->lwt_msg);
|
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;
|
client->connect_info.will_qos = config->lwt_qos;
|
||||||
|
Reference in New Issue
Block a user