add publish api

develop
Tuan PM 2014-12-31 13:01:08 +07:00
rodzic 8526fd2203
commit 1acaecfe3c
2 zmienionych plików z 16 dodań i 3 usunięć

Wyświetl plik

@ -71,6 +71,18 @@ void user_init(void)
INFO("\r\nSystem started ...\r\n");
}
```
**Publish message**
```c
void MQTT_Publish( MQTT_Client *client,
const char* topic,
const char* data,
int data_length,
int qos,
int retain);
```
**Default configuration**
See: *user_config.h* and *config.c*
**Create SSL Self sign**

Wyświetl plik

@ -377,9 +377,10 @@ mqtt_tcpclient_recon_cb(void *arg, sint8 errType)
void ICACHE_FLASH_ATTR
MQTT_Publish(MQTT_Client *client, const char* topic, const char* data, int data_length, int qos, int retain)
{
INFO("MQTT: sending publish...\r\n");
client->mqtt_state.outbound_message = mqtt_msg_publish(&client->mqtt_state.mqtt_connection,
if(client->connState != MQTT_DATA)
return;
INFO("MQTT: sending publish...\r\n");
client->mqtt_state.outbound_message = mqtt_msg_publish(&client->mqtt_state.mqtt_connection,
topic, data, data_length,
qos, retain,
&client->mqtt_state.pending_msg_id);