mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
Add header license
This commit is contained in:
19
README.md
19
README.md
@ -1,3 +1,12 @@
|
||||
[](https://travis-ci.org/tuanpmt/espmqtt)
|
||||
[](http://hits.dwyl.io/tuanpmt/espmqtt)
|
||||

|
||||
[](https://twitter.com/tuanpmt)
|
||||
|
||||

|
||||
[](https://www.paypal.me/tuanpm)
|
||||
|
||||
|
||||
# ESP32 MQTT Library
|
||||
|
||||
## Features
|
||||
@ -15,6 +24,15 @@ Clone this component to [ESP-IDF](https://github.com/espressif/esp-idf) project
|
||||
git submodule add https://github.com/tuanpmt/espmqtt.git components/espmqtt
|
||||
```
|
||||
|
||||
Or run a sample (make sure you have `IDF_PATH` env):
|
||||
|
||||
```
|
||||
git clonehttps://github.com/tuanpmt/espmqtt.git
|
||||
cd espmqtt/examples/mqtt_tcp
|
||||
make menuconfig
|
||||
make flash monitor
|
||||
```
|
||||
|
||||
## Documentation
|
||||
### URI
|
||||
|
||||
@ -128,4 +146,5 @@ esp_mqtt_client_start(client);
|
||||
|
||||
## License
|
||||
|
||||
[@tuanpmt](https://twitter.com/tuanpmt)
|
||||
Apache License
|
||||
|
@ -115,7 +115,7 @@ static void wifi_init(void)
|
||||
static void mqtt_app_start(void)
|
||||
{
|
||||
const esp_mqtt_client_config_t mqtt_cfg = {
|
||||
.uri = "ws://iot.eclipse.org:80/mqtt",
|
||||
.uri = "ws://iot.eclipse.org:80/ws",
|
||||
.event_handle = mqtt_event_handler,
|
||||
// .user_context = (void *)your_context
|
||||
};
|
||||
|
@ -1,3 +1,9 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
|
||||
#ifndef _MQTT_CLIENT_H_
|
||||
#define _MQTT_CLIENT_H_
|
||||
|
||||
@ -7,10 +13,8 @@
|
||||
|
||||
#include "mqtt_config.h"
|
||||
|
||||
|
||||
typedef struct esp_mqtt_client* esp_mqtt_client_handle_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
MQTT_EVENT_ERROR = 0,
|
||||
MQTT_EVENT_CONNECTED,
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _MQTT_CONFIG_H_
|
||||
#define _MQTT_CONFIG_H_
|
||||
#define MQTT_PROTOCOL_311 1
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _MQTT_OUTOBX_H_
|
||||
#define _MQTT_OUTOBX_H_
|
||||
#include "platform.h"
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _PLATFORM_H__
|
||||
#define _PLATFORM_H__
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _ESP_PLATFORM_H__
|
||||
#define _ESP_PLATFORM_H__
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _TRANSPORT_H_
|
||||
#define _TRANSPORT_H_
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _TRANSPORT_SSL_H_
|
||||
#define _TRANSPORT_SSL_H_
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
#ifndef _TRANSPORT_TCP_H_
|
||||
#define _TRANSPORT_TCP_H_
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions defined in
|
||||
* file 'LICENSE', which is part of this source code package.
|
||||
* Tuan PM <tuanpm at live dot com>
|
||||
*/
|
||||
|
||||
#ifndef _TRANSPORT_WS_H_
|
||||
#define _TRANSPORT_WS_H_
|
||||
|
||||
|
@ -191,7 +191,7 @@ static int ws_read(transport_handle_t t, char *buffer, int len, int timeout_ms)
|
||||
buffer[i] = (data_ptr[i] ^ mask_key[i % 4]);
|
||||
}
|
||||
} else {
|
||||
memcpy(buffer, data_ptr, payload_len);
|
||||
memmove(buffer, data_ptr, payload_len);
|
||||
}
|
||||
return payload_len;
|
||||
}
|
||||
|
@ -437,11 +437,16 @@ static void deliver_publish(esp_mqtt_client_handle_t client, uint8_t *message, i
|
||||
mqtt_data_length = length;
|
||||
mqtt_data = mqtt_get_publish_data(message, &mqtt_data_length);
|
||||
|
||||
if (total_mqtt_len == 0) {
|
||||
if(total_mqtt_len == 0){
|
||||
mqtt_topic_length = length;
|
||||
mqtt_topic = mqtt_get_publish_topic(message, &mqtt_topic_length);
|
||||
mqtt_data_length = length;
|
||||
mqtt_data = mqtt_get_publish_data(message, &mqtt_data_length);
|
||||
total_mqtt_len = client->mqtt_state.message_length - client->mqtt_state.message_length_read + mqtt_data_length;
|
||||
mqtt_len = mqtt_data_length;
|
||||
} else {
|
||||
mqtt_len = len_read;
|
||||
mqtt_data = (const char*)client->mqtt_state.in_buffer;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, "Get data len= %d, topic len=%d", mqtt_data_length, mqtt_topic_length);
|
||||
|
Reference in New Issue
Block a user