-#include <string.h>
-#include <sys/param.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "esp_log.h"
-#include "nvs_flash.h"
-#include "esp_event.h"
-#include "esp_netif.h"
-// #include "protocol_examples_common.h"
-// #include "protocol_examples_utils.h"
-#include "esp_tls.h"
-#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
-#include "esp_crt_bundle.h"
-#endif
-
-#if !CONFIG_IDF_TARGET_LINUX
-#include "freertos/FreeRTOS.h"
-#include "freertos/task.h"
-#include "esp_system.h"
-#endif
-
-#include "esp_http_client.h"
-
-/* Root cert for howsmyssl.com, taken from howsmyssl_com_root_cert.pem
-
- The PEM file was extracted from the output of this command:
- openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null
-
- The CA root cert is the last cert given in the chain of certs.
-
- To embed it in the app binary, the PEM file is named
- in the component.mk COMPONENT_EMBED_TXTFILES variable.
-*/
-// extern const char howsmyssl_com_root_cert_pem_start[] asm("_binary_howsmyssl_com_root_cert_pem_start");
-// extern const char howsmyssl_com_root_cert_pem_end[] asm("_binary_howsmyssl_com_root_cert_pem_end");
-
-// extern const char postman_root_cert_pem_start[] asm("_binary_postman_root_cert_pem_start");
-// extern const char postman_root_cert_pem_end[] asm("_binary_postman_root_cert_pem_end");
-
-#include "matrix.h"
-
-#define HTTP_CONNECTION_DATA_SIZE 1024*64
-#define AUTHORIZATION_HEADER_LEN 64
-
-struct MatrixHttpConnection {
- esp_http_client_handle_t client;
-
- const char * host;
- const char * accessToken;
-
- // char data[HTTP_CONNECTION_DATA_SIZE];
- char * data;
- int dataCap;
- int dataLen;
-};
-
-
-static const char *TAG = "HTTP_CLIENT";
-
-esp_err_t _http_event_handler(esp_http_client_event_t *evt)
-{
- vTaskDelay(10/portTICK_PERIOD_MS);
-
- MatrixHttpConnection * hc = (MatrixHttpConnection *)evt->user_data;
- switch(evt->event_id) {
- case HTTP_EVENT_ERROR:
- ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
- break;
- case HTTP_EVENT_ON_CONNECTED:
- ESP_LOGD(TAG, "HTTP_EVENT_ON_CONNECTED");
- break;
- case HTTP_EVENT_HEADER_SENT:
- ESP_LOGD(TAG, "HTTP_EVENT_HEADER_SENT");
- break;
- case HTTP_EVENT_ON_HEADER:
- ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
- break;
- case HTTP_EVENT_ON_DATA:
- ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
- /*
- * Check for chunked encoding is added as the URL for chunked encoding used in this example returns binary data.
- * However, event handler can also be used in case chunked encoding is used.
- */
- if (!esp_http_client_is_chunked_response(evt->client)) {
- ESP_LOGD(TAG, "Non-Chunked Encoding");
- }
- else {
- ESP_LOGD(TAG, "Chunked Encoding");
- }
-
- int copy_len = 0;
-
- // const int64_t buffer_len = esp_http_client_get_content_length(evt->client);
- // if (buffer_len < hc->dataCap) {
- // ESP_LOGE(TAG, "Output buffer too small: %" PRIu64 ", data_len: %d", buffer_len, evt->data_len);
- // return ESP_FAIL;
- // }
- copy_len = MIN(evt->data_len, (hc->dataCap - hc->dataLen));
- if (copy_len) {
- memcpy(hc->data + hc->dataLen, evt->data, copy_len);
- }
-
- hc->dataLen += copy_len;
-
- break;
- case HTTP_EVENT_ON_FINISH:
- ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
- break;
- case HTTP_EVENT_DISCONNECTED:
- ESP_LOGI(TAG, "HTTP_EVENT_DISCONNECTED");
- int mbedtls_err = 0;
- esp_err_t err = esp_tls_get_and_clear_last_error((esp_tls_error_handle_t)evt->data, &mbedtls_err, NULL);
- if (err != 0) {
- ESP_LOGI(TAG, "Last esp error code: 0x%x", err);
- ESP_LOGI(TAG, "Last mbedtls failure: 0x%x", mbedtls_err);
- }
- break;
- case HTTP_EVENT_REDIRECT:
- ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");
- // esp_http_client_set_header(evt->client, "From", "user@example.com");
- // esp_http_client_set_header(evt->client, "Accept", "text/html");
- // esp_http_client_set_redirection(evt->client);
- break;
- }
- return ESP_OK;
-}
-
-void
-MatrixHttpConnect(
- MatrixHttpConnection * hc)
-{
- esp_http_client_config_t config = {
- .url = hc->host,
- // .query = "esp",
- .event_handler = _http_event_handler,
- .user_data = hc,
- .disable_auto_redirect = true,
- .crt_bundle_attach = esp_crt_bundle_attach,
- };
-
- hc->client = esp_http_client_init(&config);
-
- esp_http_client_set_timeout_ms(hc->client, 10000);
-}
-
-void
-MatrixHttpDisconnect(
- MatrixHttpConnection * hc)
-{
- esp_http_client_cleanup(hc->client);
- hc->client = NULL;
-}
-
-bool
-MatrixHttpInit(
- MatrixHttpConnection ** hc,
- const char * host)
-{
- *hc = (MatrixHttpConnection *)calloc(1, sizeof(MatrixHttpConnection));
-
- (*hc)->host = host;
- (*hc)->dataLen = 0;
-
- MatrixHttpConnect(*hc);
-
- return true;
-}
-
-bool
-MatrixHttpDeinit(
- MatrixHttpConnection ** hc)
-{
- MatrixHttpDisconnect(*hc);
-
- free(*hc);
- *hc = NULL;
-
- return true;
-}
-
-bool
-MatrixHttpSetAccessToken(
- MatrixHttpConnection * hc,
- const char * accessToken)
-{
- hc->accessToken = accessToken;
-
- return true;
-}
-
-bool
-MatrixHttpGet(
- MatrixHttpConnection * hc,
- const char * url,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated)
-{
- static char authorizationHeader[AUTHORIZATION_HEADER_LEN];
- if (authenticated)
- snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,
- "Bearer %s", hc->accessToken);
- else
- authorizationHeader[0] = '\0';
-
- printf("GET %s%s\n", hc->host, url);
-
- hc->data = outResponseBuffer;
- hc->dataCap = outResponseCap;
- hc->dataLen = 0;
-
- static char hostAndUrl[MAX_URL_LEN];
- snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);
-
- esp_http_client_set_url(hc->client, hostAndUrl);
- esp_http_client_set_method(hc->client, HTTP_METHOD_GET);
- if (authenticated)
- esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);
- esp_err_t err = esp_http_client_perform(hc->client);
- if (err == ESP_OK) {
- ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %"PRIu64,
- esp_http_client_get_status_code(hc->client),
- esp_http_client_get_content_length(hc->client));
- } else {
- ESP_LOGE(TAG, "HTTP GET request failed: %s", esp_err_to_name(err));
- }
- // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);
-
- return true;
-}
-
-bool
-MatrixHttpPost(
- MatrixHttpConnection * hc,
- const char * url,
- const char * requestBuffer,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated)
-{
- static char authorizationHeader[AUTHORIZATION_HEADER_LEN];
- if (authenticated)
- snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,
- "Bearer %s", hc->accessToken);
- else
- authorizationHeader[0] = '\0';
-
- printf("POST %s%s\n%s\n", hc->host, url, requestBuffer);
-
- hc->data = outResponseBuffer;
- hc->dataCap = outResponseCap;
- hc->dataLen = 0;
-
- static char hostAndUrl[MAX_URL_LEN];
- snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);
-
- esp_http_client_set_url(hc->client, hostAndUrl);
- esp_http_client_set_method(hc->client, HTTP_METHOD_POST);
- if (authenticated)
- esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);
- esp_http_client_set_header(hc->client, "Content-Type", "application/json");
- esp_http_client_set_post_field(hc->client, requestBuffer, strlen(requestBuffer));
- esp_err_t err = esp_http_client_perform(hc->client);
- if (err == ESP_OK) {
- ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIu64,
- esp_http_client_get_status_code(hc->client),
- esp_http_client_get_content_length(hc->client));
- } else {
- ESP_LOGE(TAG, "HTTP POST request failed: %s", esp_err_to_name(err));
- }
- // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);
-
- return true;
-}
-
-bool
-MatrixHttpPut(
- MatrixHttpConnection * hc,
- const char * url,
- const char * requestBuffer,
- char * outResponseBuffer, int outResponseCap,
- bool authenticated)
-{
- static char authorizationHeader[AUTHORIZATION_HEADER_LEN];
- if (authenticated)
- snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,
- "Bearer %s", hc->accessToken);
- else
- authorizationHeader[0] = '\0';
-
- printf("PUT %s%s\n%s\n", hc->host, url, requestBuffer);
-
- hc->data = outResponseBuffer;
- hc->dataCap = outResponseCap;
- hc->dataLen = 0;
-
- static char hostAndUrl[MAX_URL_LEN];
- snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);
-
- esp_http_client_set_url(hc->client, hostAndUrl);
- esp_http_client_set_method(hc->client, HTTP_METHOD_PUT);
- if (authenticated)
- esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);
- esp_http_client_set_header(hc->client, "Content-Type", "application/json");
- esp_http_client_set_post_field(hc->client, requestBuffer, strlen(requestBuffer));
- esp_err_t err = esp_http_client_perform(hc->client);
- if (err == ESP_OK) {
- ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %"PRIu64,
- esp_http_client_get_status_code(hc->client),
- esp_http_client_get_content_length(hc->client));
- } else {
- ESP_LOGE(TAG, "HTTP PUT request failed: %s", esp_err_to_name(err));
- }
- // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);
-
- return true;
-}
+#include <string.h>\r
+#include <sys/param.h>\r
+#include <stdlib.h>\r
+#include <ctype.h>\r
+#include "esp_log.h"\r
+#include "nvs_flash.h"\r
+#include "esp_event.h"\r
+#include "esp_netif.h"\r
+// #include "protocol_examples_common.h"\r
+// #include "protocol_examples_utils.h"\r
+#include "esp_tls.h"\r
+#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE\r
+#include "esp_crt_bundle.h"\r
+#endif\r
+\r
+#if !CONFIG_IDF_TARGET_LINUX\r
+#include "freertos/FreeRTOS.h"\r
+#include "freertos/task.h"\r
+#include "esp_system.h"\r
+#endif\r
+\r
+#include "esp_http_client.h"\r
+\r
+/* Root cert for howsmyssl.com, taken from howsmyssl_com_root_cert.pem\r
+\r
+ The PEM file was extracted from the output of this command:\r
+ openssl s_client -showcerts -connect www.howsmyssl.com:443 </dev/null\r
+\r
+ The CA root cert is the last cert given in the chain of certs.\r
+\r
+ To embed it in the app binary, the PEM file is named\r
+ in the component.mk COMPONENT_EMBED_TXTFILES variable.\r
+*/\r
+// extern const char howsmyssl_com_root_cert_pem_start[] asm("_binary_howsmyssl_com_root_cert_pem_start");\r
+// extern const char howsmyssl_com_root_cert_pem_end[] asm("_binary_howsmyssl_com_root_cert_pem_end");\r
+\r
+// extern const char postman_root_cert_pem_start[] asm("_binary_postman_root_cert_pem_start");\r
+// extern const char postman_root_cert_pem_end[] asm("_binary_postman_root_cert_pem_end");\r
+\r
+#include "matrix.h"\r
+\r
+#define HTTP_CONNECTION_DATA_SIZE 1024*64\r
+#define AUTHORIZATION_HEADER_LEN 64\r
+\r
+struct MatrixHttpConnection {\r
+ esp_http_client_handle_t client;\r
+\r
+ const char * host;\r
+ const char * accessToken;\r
+\r
+ // char data[HTTP_CONNECTION_DATA_SIZE];\r
+ char * data;\r
+ int dataCap;\r
+ int dataLen;\r
+};\r
+\r
+\r
+static const char *TAG = "HTTP_CLIENT";\r
+\r
+esp_err_t _http_event_handler(esp_http_client_event_t *evt)\r
+{\r
+ vTaskDelay(10/portTICK_PERIOD_MS);\r
+\r
+ MatrixHttpConnection * hc = (MatrixHttpConnection *)evt->user_data;\r
+ switch(evt->event_id) {\r
+ case HTTP_EVENT_ERROR:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_ERROR");\r
+ break;\r
+ case HTTP_EVENT_ON_CONNECTED:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_ON_CONNECTED");\r
+ break;\r
+ case HTTP_EVENT_HEADER_SENT:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_HEADER_SENT");\r
+ break;\r
+ case HTTP_EVENT_ON_HEADER:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);\r
+ break;\r
+ case HTTP_EVENT_ON_DATA:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);\r
+ /*\r
+ * Check for chunked encoding is added as the URL for chunked encoding used in this example returns binary data.\r
+ * However, event handler can also be used in case chunked encoding is used.\r
+ */\r
+ if (!esp_http_client_is_chunked_response(evt->client)) {\r
+ ESP_LOGD(TAG, "Non-Chunked Encoding");\r
+ }\r
+ else {\r
+ ESP_LOGD(TAG, "Chunked Encoding");\r
+ }\r
+\r
+ int copy_len = 0;\r
+\r
+ // const int64_t buffer_len = esp_http_client_get_content_length(evt->client);\r
+ // if (buffer_len < hc->dataCap) {\r
+ // ESP_LOGE(TAG, "Output buffer too small: %" PRIu64 ", data_len: %d", buffer_len, evt->data_len);\r
+ // return ESP_FAIL;\r
+ // }\r
+ copy_len = MIN(evt->data_len, (hc->dataCap - hc->dataLen));\r
+ if (copy_len) {\r
+ memcpy(hc->data + hc->dataLen, evt->data, copy_len);\r
+ hc->data[hc->dataLen + copy_len] = '\0';\r
+ }\r
+\r
+ hc->dataLen += copy_len;\r
+\r
+ break;\r
+ case HTTP_EVENT_ON_FINISH:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");\r
+ break;\r
+ case HTTP_EVENT_DISCONNECTED:\r
+ ESP_LOGI(TAG, "HTTP_EVENT_DISCONNECTED");\r
+ int mbedtls_err = 0;\r
+ esp_err_t err = esp_tls_get_and_clear_last_error((esp_tls_error_handle_t)evt->data, &mbedtls_err, NULL);\r
+ if (err != 0) {\r
+ ESP_LOGI(TAG, "Last esp error code: 0x%x", err);\r
+ ESP_LOGI(TAG, "Last mbedtls failure: 0x%x", mbedtls_err);\r
+ }\r
+ break;\r
+ case HTTP_EVENT_REDIRECT:\r
+ ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");\r
+ // esp_http_client_set_header(evt->client, "From", "user@example.com");\r
+ // esp_http_client_set_header(evt->client, "Accept", "text/html");\r
+ // esp_http_client_set_redirection(evt->client);\r
+ break;\r
+ }\r
+ return ESP_OK;\r
+}\r
+\r
+void\r
+MatrixHttpConnect(\r
+ MatrixHttpConnection * hc)\r
+{\r
+ esp_http_client_config_t config = {\r
+ .url = hc->host,\r
+ // .query = "esp",\r
+ .event_handler = _http_event_handler,\r
+ .user_data = hc,\r
+ .disable_auto_redirect = true,\r
+ .crt_bundle_attach = esp_crt_bundle_attach,\r
+ };\r
+\r
+ hc->client = esp_http_client_init(&config);\r
+\r
+ esp_http_client_set_timeout_ms(hc->client, 20000);\r
+}\r
+\r
+void\r
+MatrixHttpDisconnect(\r
+ MatrixHttpConnection * hc)\r
+{\r
+ esp_http_client_cleanup(hc->client);\r
+ hc->client = NULL;\r
+}\r
+\r
+bool\r
+MatrixHttpInit(\r
+ MatrixHttpConnection ** hc,\r
+ const char * host)\r
+{\r
+ *hc = (MatrixHttpConnection *)calloc(1, sizeof(MatrixHttpConnection));\r
+ \r
+ (*hc)->host = host;\r
+\r
+ MatrixHttpConnect(*hc);\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+MatrixHttpDeinit(\r
+ MatrixHttpConnection ** hc)\r
+{\r
+ MatrixHttpDisconnect(*hc);\r
+\r
+ free(*hc);\r
+ *hc = NULL;\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+MatrixHttpSetAccessToken(\r
+ MatrixHttpConnection * hc,\r
+ const char * accessToken)\r
+{\r
+ hc->accessToken = accessToken;\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+MatrixHttpGet(\r
+ MatrixHttpConnection * hc,\r
+ const char * url,\r
+ char * outResponseBuffer, int outResponseCap,\r
+ bool authenticated)\r
+{\r
+ static char authorizationHeader[AUTHORIZATION_HEADER_LEN];\r
+ if (authenticated)\r
+ snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,\r
+ "Bearer %s", hc->accessToken);\r
+ else\r
+ authorizationHeader[0] = '\0';\r
+\r
+ hc->data = outResponseBuffer;\r
+ hc->dataCap = outResponseCap;\r
+ hc->dataLen = 0;\r
+\r
+ static char hostAndUrl[MAX_URL_LEN];\r
+ snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);\r
+ \r
+ esp_http_client_set_url(hc->client, hostAndUrl);\r
+ esp_http_client_set_method(hc->client, HTTP_METHOD_GET);\r
+ if (authenticated)\r
+ esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);\r
+ esp_err_t err = esp_http_client_perform(hc->client);\r
+ if (err == ESP_OK) {\r
+ ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %"PRIu64,\r
+ esp_http_client_get_status_code(hc->client),\r
+ esp_http_client_get_content_length(hc->client));\r
+ } else {\r
+ ESP_LOGE(TAG, "HTTP GET request failed: %s", esp_err_to_name(err));\r
+ }\r
+ // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+MatrixHttpPost(\r
+ MatrixHttpConnection * hc,\r
+ const char * url,\r
+ const char * requestBuffer,\r
+ char * outResponseBuffer, int outResponseCap,\r
+ bool authenticated)\r
+{\r
+ static char authorizationHeader[AUTHORIZATION_HEADER_LEN];\r
+ if (authenticated)\r
+ snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,\r
+ "Bearer %s", hc->accessToken);\r
+ else\r
+ authorizationHeader[0] = '\0';\r
+\r
+ hc->data = outResponseBuffer;\r
+ hc->dataCap = outResponseCap;\r
+ hc->dataLen = 0;\r
+\r
+ static char hostAndUrl[MAX_URL_LEN];\r
+ snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);\r
+ \r
+ esp_http_client_set_url(hc->client, hostAndUrl);\r
+ esp_http_client_set_method(hc->client, HTTP_METHOD_POST);\r
+ if (authenticated)\r
+ esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);\r
+ esp_http_client_set_header(hc->client, "Content-Type", "application/json");\r
+ esp_http_client_set_post_field(hc->client, requestBuffer, strlen(requestBuffer));\r
+ esp_err_t err = esp_http_client_perform(hc->client);\r
+ if (err == ESP_OK) {\r
+ ESP_LOGI(TAG, "HTTP POST Status = %d, content_length = %"PRIu64,\r
+ esp_http_client_get_status_code(hc->client),\r
+ esp_http_client_get_content_length(hc->client));\r
+ } else {\r
+ ESP_LOGE(TAG, "HTTP POST request failed: %s", esp_err_to_name(err));\r
+ }\r
+ // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);\r
+\r
+ return true;\r
+}\r
+\r
+bool\r
+MatrixHttpPut(\r
+ MatrixHttpConnection * hc,\r
+ const char * url,\r
+ const char * requestBuffer,\r
+ char * outResponseBuffer, int outResponseCap,\r
+ bool authenticated)\r
+{\r
+ static char authorizationHeader[AUTHORIZATION_HEADER_LEN];\r
+ if (authenticated)\r
+ snprintf(authorizationHeader, AUTHORIZATION_HEADER_LEN,\r
+ "Bearer %s", hc->accessToken);\r
+ else\r
+ authorizationHeader[0] = '\0';\r
+\r
+ hc->data = outResponseBuffer;\r
+ hc->dataCap = outResponseCap;\r
+ hc->dataLen = 0;\r
+\r
+ static char hostAndUrl[MAX_URL_LEN];\r
+ snprintf(hostAndUrl, MAX_URL_LEN, "%s%s", hc->host, url);\r
+ \r
+ esp_http_client_set_url(hc->client, hostAndUrl);\r
+ esp_http_client_set_method(hc->client, HTTP_METHOD_PUT);\r
+ if (authenticated)\r
+ esp_http_client_set_header(hc->client, "Authorization", authorizationHeader);\r
+ esp_http_client_set_header(hc->client, "Content-Type", "application/json");\r
+ esp_http_client_set_post_field(hc->client, requestBuffer, strlen(requestBuffer));\r
+ esp_err_t err = esp_http_client_perform(hc->client);\r
+ if (err == ESP_OK) {\r
+ ESP_LOGI(TAG, "HTTP PUT Status = %d, content_length = %"PRIu64,\r
+ esp_http_client_get_status_code(hc->client),\r
+ esp_http_client_get_content_length(hc->client));\r
+ } else {\r
+ ESP_LOGE(TAG, "HTTP PUT request failed: %s", esp_err_to_name(err));\r
+ }\r
+ // ESP_LOG_BUFFER_HEX(TAG, hc->data, hc->dataLen);\r
+\r
+ return true;\r
+}\r