Rewritten code works! See full log.

After much consternation, finally got the code generalized. For
some reason the ESP8266 absolutely cannot pass pointers between
functions. I'm not sure if this is because it's a timer function?
Either way, we have to memcpy the values, which makes things a
bit messier, but not too bad.

Now to start work on Publish...
This commit is contained in:
A.M. Rowsell 2018-08-16 19:11:47 -04:00
commit bcbcde455a
Signed by: amr
GPG key ID: 0B6E2D8375CF79A9
2 changed files with 130 additions and 84 deletions

6
mqtt.h
View file

@ -39,10 +39,14 @@ typedef struct {
uint32_t port;
uint32_t localPort;
uint8_t *client_id;
uint32_t client_id_len;
uint8_t *topic_name;
uint32_t topic_name_len;
uint8_t qos_level;
uint8_t *username;
uint32_t username_len;
uint8_t *password;
uint32_t password_len;
char valid_connection;
struct espconn *activeConnection;
} mqtt_session_t;
@ -54,4 +58,4 @@ LOCAL void ICACHE_FLASH_ATTR connected_callback(void *arg);
LOCAL void ICACHE_FLASH_ATTR data_recv_callback(void *arg, char *pdata, unsigned short len);
LOCAL void ICACHE_FLASH_ATTR data_sent_callback(void *arg);
LOCAL uint8_t ICACHE_FLASH_ATTR mqtt_send(mqtt_session_t *session, uint8_t *data, uint32_t len, mqtt_message_type msgType);
LOCAL uint8_t ICACHE_FLASH_ATTR mqtt_connect(mqtt_session_t *session);
LOCAL uint8_t ICACHE_FLASH_ATTR mqtt_connect(mqtt_session_t *session, uint8_t *username, uint8_t *password);