Update IDF to a0468b2 (#2108)

* Update IDF to a0468b2

* add missing ld file

* Fix PIO builds and change coex policy
This commit is contained in:
Me No Dev
2018-11-26 23:22:11 +01:00
committed by GitHub
parent c3ec91f968
commit 04963009ee
988 changed files with 114643 additions and 65141 deletions

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _TRANSPORT_H_
#define _TRANSPORT_H_
#ifndef _ESP_TRANSPORT_H_
#define _ESP_TRANSPORT_H_
#include <esp_err.h>
@ -22,26 +22,27 @@ extern "C" {
#endif
typedef struct transport_list_t* transport_list_handle_t;
typedef struct transport_item_t* transport_handle_t;
typedef struct esp_transport_list_t* esp_transport_list_handle_t;
typedef struct esp_transport_item_t* esp_transport_handle_t;
typedef int (*connect_func)(transport_handle_t t, const char *host, int port, int timeout_ms);
typedef int (*io_func)(transport_handle_t t, const char *buffer, int len, int timeout_ms);
typedef int (*io_read_func)(transport_handle_t t, char *buffer, int len, int timeout_ms);
typedef int (*trans_func)(transport_handle_t t);
typedef int (*poll_func)(transport_handle_t t, int timeout_ms);
typedef transport_handle_t (*payload_transfer_func)(transport_handle_t);
typedef int (*connect_func)(esp_transport_handle_t t, const char *host, int port, int timeout_ms);
typedef int (*io_func)(esp_transport_handle_t t, const char *buffer, int len, int timeout_ms);
typedef int (*io_read_func)(esp_transport_handle_t t, char *buffer, int len, int timeout_ms);
typedef int (*trans_func)(esp_transport_handle_t t);
typedef int (*poll_func)(esp_transport_handle_t t, int timeout_ms);
typedef int (*connect_async_func)(esp_transport_handle_t t, const char *host, int port, int timeout_ms);
typedef esp_transport_handle_t (*payload_transfer_func)(esp_transport_handle_t);
/**
* @brief Create transport list
*
* @return A handle can hold all transports
*/
transport_list_handle_t transport_list_init();
esp_transport_list_handle_t esp_transport_list_init();
/**
* @brief Cleanup and free all transports, include itself,
* this function will invoke transport_destroy of every transport have added this the list
* this function will invoke esp_transport_destroy of every transport have added this the list
*
* @param[in] list The list
*
@ -49,7 +50,7 @@ transport_list_handle_t transport_list_init();
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t transport_list_destroy(transport_list_handle_t list);
esp_err_t esp_transport_list_destroy(esp_transport_list_handle_t list);
/**
* @brief Add a transport to the list, and define a scheme to indentify this transport in the list
@ -61,11 +62,11 @@ esp_err_t transport_list_destroy(transport_list_handle_t list);
* @return
* - ESP_OK
*/
esp_err_t transport_list_add(transport_list_handle_t list, transport_handle_t t, const char *scheme);
esp_err_t esp_transport_list_add(esp_transport_list_handle_t list, esp_transport_handle_t t, const char *scheme);
/**
* @brief This function will remove all transport from the list,
* invoke transport_destroy of every transport have added this the list
* invoke esp_transport_destroy of every transport have added this the list
*
* @param[in] list The list
*
@ -73,24 +74,24 @@ esp_err_t transport_list_add(transport_list_handle_t list, transport_handle_t t,
* - ESP_OK
* - ESP_ERR_INVALID_ARG
*/
esp_err_t transport_list_clean(transport_list_handle_t list);
esp_err_t esp_transport_list_clean(esp_transport_list_handle_t list);
/**
* @brief Get the transport by scheme, which has been defined when calling function `transport_list_add`
* @brief Get the transport by scheme, which has been defined when calling function `esp_transport_list_add`
*
* @param[in] list The list
* @param[in] tag The tag
*
* @return The transport handle
*/
transport_handle_t transport_list_get_transport(transport_list_handle_t list, const char *scheme);
esp_transport_handle_t esp_transport_list_get_transport(esp_transport_list_handle_t list, const char *scheme);
/**
* @brief Initialize a transport handle object
*
* @return The transport handle
*/
transport_handle_t transport_init();
esp_transport_handle_t esp_transport_init();
/**
* @brief Cleanup and free memory the transport
@ -101,7 +102,7 @@ transport_handle_t transport_init();
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t transport_destroy(transport_handle_t t);
esp_err_t esp_transport_destroy(esp_transport_handle_t t);
/**
* @brief Get default port number used by this transport
@ -110,7 +111,7 @@ esp_err_t transport_destroy(transport_handle_t t);
*
* @return the port number
*/
int transport_get_default_port(transport_handle_t t);
int esp_transport_get_default_port(esp_transport_handle_t t);
/**
* @brief Set default port number that can be used by this transport
@ -122,7 +123,7 @@ int transport_get_default_port(transport_handle_t t);
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t transport_set_default_port(transport_handle_t t, int port);
esp_err_t esp_transport_set_default_port(esp_transport_handle_t t, int port);
/**
* @brief Transport connection function, to make a connection to server
@ -136,7 +137,21 @@ esp_err_t transport_set_default_port(transport_handle_t t, int port);
* - socket for will use by this transport
* - (-1) if there are any errors, should check errno
*/
int transport_connect(transport_handle_t t, const char *host, int port, int timeout_ms);
int esp_transport_connect(esp_transport_handle_t t, const char *host, int port, int timeout_ms);
/**
* @brief Non-blocking transport connection function, to make a connection to server
*
* @param t The transport handle
* @param[in] host Hostname
* @param[in] port Port
* @param[in] timeout_ms The timeout milliseconds
*
* @return
* - socket for will use by this transport
* - (-1) if there are any errors, should check errno
*/
int esp_transport_connect_async(esp_transport_handle_t t, const char *host, int port, int timeout_ms);
/**
* @brief Transport read function
@ -150,7 +165,7 @@ int transport_connect(transport_handle_t t, const char *host, int port, int time
* - Number of bytes was read
* - (-1) if there are any errors, should check errno
*/
int transport_read(transport_handle_t t, char *buffer, int len, int timeout_ms);
int esp_transport_read(esp_transport_handle_t t, char *buffer, int len, int timeout_ms);
/**
* @brief Poll the transport until readable or timeout
@ -163,7 +178,7 @@ int transport_read(transport_handle_t t, char *buffer, int len, int timeout_ms);
* - (-1) If there are any errors, should check errno
* - other The transport can read
*/
int transport_poll_read(transport_handle_t t, int timeout_ms);
int esp_transport_poll_read(esp_transport_handle_t t, int timeout_ms);
/**
* @brief Transport write function
@ -177,7 +192,7 @@ int transport_poll_read(transport_handle_t t, int timeout_ms);
* - Number of bytes was written
* - (-1) if there are any errors, should check errno
*/
int transport_write(transport_handle_t t, const char *buffer, int len, int timeout_ms);
int esp_transport_write(esp_transport_handle_t t, const char *buffer, int len, int timeout_ms);
/**
* @brief Poll the transport until writeable or timeout
@ -190,7 +205,7 @@ int transport_write(transport_handle_t t, const char *buffer, int len, int timeo
* - (-1) If there are any errors, should check errno
* - other The transport can write
*/
int transport_poll_write(transport_handle_t t, int timeout_ms);
int esp_transport_poll_write(esp_transport_handle_t t, int timeout_ms);
/**
* @brief Transport close
@ -201,7 +216,7 @@ int transport_poll_write(transport_handle_t t, int timeout_ms);
* - 0 if ok
* - (-1) if there are any errors, should check errno
*/
int transport_close(transport_handle_t t);
int esp_transport_close(esp_transport_handle_t t);
/**
* @brief Get user data context of this transport
@ -210,7 +225,7 @@ int transport_close(transport_handle_t t);
*
* @return The user data context
*/
void *transport_get_context_data(transport_handle_t t);
void *esp_transport_get_context_data(esp_transport_handle_t t);
/**
* @brief Get transport handle of underlying protocol
@ -221,7 +236,7 @@ void *transport_get_context_data(transport_handle_t t);
*
* @return Payload transport handle
*/
transport_handle_t transport_get_payload_transport_handle(transport_handle_t t);
esp_transport_handle_t esp_transport_get_payload_transport_handle(esp_transport_handle_t t);
/**
* @brief Set the user context data for this transport
@ -232,7 +247,7 @@ transport_handle_t transport_get_payload_transport_handle(transport_handle_t t);
* @return
* - ESP_OK
*/
esp_err_t transport_set_context_data(transport_handle_t t, void *data);
esp_err_t esp_transport_set_context_data(esp_transport_handle_t t, void *data);
/**
* @brief Set transport functions for the transport handle
@ -245,21 +260,45 @@ esp_err_t transport_set_context_data(transport_handle_t t, void *data);
* @param[in] _poll_read The poll read function pointer
* @param[in] _poll_write The poll write function pointer
* @param[in] _destroy The destroy function pointer
* @param[in] _parrent_transport The parrent transfer getter pointer
*
* @return
* - ESP_OK
*/
esp_err_t transport_set_func(transport_handle_t t,
esp_err_t esp_transport_set_func(esp_transport_handle_t t,
connect_func _connect,
io_read_func _read,
io_func _write,
trans_func _close,
poll_func _poll_read,
poll_func _poll_write,
trans_func _destroy,
payload_transfer_func _parrent_transport);
trans_func _destroy);
/**
* @brief Set transport functions for the transport handle
*
* @param[in] t The transport handle
* @param[in] _connect_async_func The connect_async function pointer
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_transport_set_async_connect_func(esp_transport_handle_t t, connect_async_func _connect_async_func);
/**
* @brief Set parent transport function to the handle
*
* @param[in] t The transport handle
* @param[in] _parent_transport The underlying transport getter pointer
*
* @return
* - ESP_OK
* - ESP_FAIL
*/
esp_err_t esp_transport_set_parent_transport_func(esp_transport_handle_t t, payload_transfer_func _parent_transport);
#ifdef __cplusplus
}
#endif
#endif
#endif /* _ESP_TRANSPORT_ */

View File

@ -0,0 +1,69 @@
// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _ESP_TRANSPORT_SSL_H_
#define _ESP_TRANSPORT_SSL_H_
#include "esp_transport.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create new SSL transport, the transport handle must be release esp_transport_destroy callback
*
* @return the allocated esp_transport_handle_t, or NULL if the handle can not be allocated
*/
esp_transport_handle_t esp_transport_ssl_init();
/**
* @brief Set SSL certificate data (as PEM format).
* Note that, this function stores the pointer to data, rather than making a copy.
* So this data must remain valid until after the connection is cleaned up
*
* @param t ssl transport
* @param[in] data The pem data
* @param[in] len The length
*/
void esp_transport_ssl_set_cert_data(esp_transport_handle_t t, const char *data, int len);
/**
* @brief Set SSL client certificate data for mutual authentication (as PEM format).
* Note that, this function stores the pointer to data, rather than making a copy.
* So this data must remain valid until after the connection is cleaned up
*
* @param t ssl transport
* @param[in] data The pem data
* @param[in] len The length
*/
void esp_transport_ssl_set_client_cert_data(esp_transport_handle_t t, const char *data, int len);
/**
* @brief Set SSL client key data for mutual authentication (as PEM format).
* Note that, this function stores the pointer to data, rather than making a copy.
* So this data must remain valid until after the connection is cleaned up
*
* @param t ssl transport
* @param[in] data The pem data
* @param[in] len The length
*/
void esp_transport_ssl_set_client_key_data(esp_transport_handle_t t, const char *data, int len);
#ifdef __cplusplus
}
#endif
#endif /* _ESP_TRANSPORT_SSL_H_ */

View File

@ -12,25 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _TRANSPORT_TCP_H_
#define _TRANSPORT_TCP_H_
#ifndef _ESP_TRANSPORT_TCP_H_
#define _ESP_TRANSPORT_TCP_H_
#include "transport.h"
#include "esp_transport.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create TCP transport, the transport handle must be release transport_destroy callback
* @brief Create TCP transport, the transport handle must be release esp_transport_destroy callback
*
* @return the allocated transport_handle_t, or NULL if the handle can not be allocated
* @return the allocated esp_transport_handle_t, or NULL if the handle can not be allocated
*/
transport_handle_t transport_tcp_init();
esp_transport_handle_t esp_transport_tcp_init();
#ifdef __cplusplus
}
#endif
#endif
#endif /* _ESP_TRANSPORT_TCP_H_ */

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _TRANSPORT_UTILS_H_
#define _TRANSPORT_UTILS_H_
#ifndef _ESP_TRANSPORT_UTILS_H_
#define _ESP_TRANSPORT_UTILS_H_
#include <sys/time.h>
#ifdef __cplusplus
@ -26,10 +26,10 @@ extern "C" {
* @param[in] timeout_ms The timeout milliseconds
* @param[out] tv Timeval struct
*/
void transport_utils_ms_to_timeval(int timeout_ms, struct timeval *tv);
void esp_transport_utils_ms_to_timeval(int timeout_ms, struct timeval *tv);
#define TRANSPORT_MEM_CHECK(TAG, a, action) if (!(a)) { \
#define ESP_TRANSPORT_MEM_CHECK(TAG, a, action) if (!(a)) { \
ESP_LOGE(TAG,"%s:%d (%s): %s", __FILE__, __LINE__, __FUNCTION__, "Memory exhausted"); \
action; \
}
@ -37,4 +37,4 @@ void transport_utils_ms_to_timeval(int timeout_ms, struct timeval *tv);
#ifdef __cplusplus
}
#endif
#endif /* _TRANSPORT_UTILS_H_ */
#endif /* _ESP_TRANSPORT_UTILS_H_ */

View File

@ -0,0 +1,34 @@
/*
* 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_TRANSPORT_WS_H_
#define _ESP_TRANSPORT_WS_H_
#include "esp_transport.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create web socket transport
*
* @return
* - transport
* - NULL
*/
esp_transport_handle_t esp_transport_ws_init(esp_transport_handle_t parent_handle);
void esp_transport_ws_set_path(esp_transport_handle_t t, const char *path);
#ifdef __cplusplus
}
#endif
#endif /* _ESP_TRANSPORT_WS_H_ */

View File

@ -1,48 +0,0 @@
// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _TRANSPORT_SSL_H_
#define _TRANSPORT_SSL_H_
#include "transport.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create new SSL transport, the transport handle must be release transport_destroy callback
*
* @return the allocated transport_handle_t, or NULL if the handle can not be allocated
*/
transport_handle_t transport_ssl_init();
/**
* @brief Set SSL certificate data (as PEM format).
* Note that, this function stores the pointer to data, rather than making a copy.
* So we need to make sure to keep the data lifetime before cleanup the connection
*
* @param t ssl transport
* @param[in] data The pem data
* @param[in] len The length
*/
void transport_ssl_set_cert_data(transport_handle_t t, const char *data, int len);
#ifdef __cplusplus
}
#endif
#endif