mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
transport: Add CONFI_WS_TRANSPORT for optimize the code size
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
if(NOT CONFIG_WS_TRANSPORT AND NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||||
|
message(STATUS "Websocket transport is disabled so the esp_websocket_client component will not be built")
|
||||||
|
# note: the component is still included in the build so it can become visible again in config
|
||||||
|
# without needing to re-run CMake. However no source or header files are built.
|
||||||
|
idf_component_register()
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "esp_websocket_client.c"
|
idf_component_register(SRCS "esp_websocket_client.c"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
REQUIRES lwip esp-tls tcp_transport nghttp
|
REQUIRES lwip esp-tls tcp_transport nghttp
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
ifdef CONFIG_WS_TRANSPORT
|
||||||
|
COMPONENT_SRCDIRS := .
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
|
endif
|
||||||
|
@@ -15,6 +15,7 @@ menu "ESP-MQTT Configurations"
|
|||||||
config MQTT_TRANSPORT_WEBSOCKET
|
config MQTT_TRANSPORT_WEBSOCKET
|
||||||
bool "Enable MQTT over Websocket"
|
bool "Enable MQTT over Websocket"
|
||||||
default y
|
default y
|
||||||
|
depends on WS_TRANSPORT
|
||||||
help
|
help
|
||||||
Enable MQTT transport over Websocket.
|
Enable MQTT transport over Websocket.
|
||||||
|
|
||||||
|
@@ -1,8 +1,15 @@
|
|||||||
idf_component_register(SRCS "transport.c"
|
set(srcs
|
||||||
"transport_ssl.c"
|
"transport.c"
|
||||||
"transport_tcp.c"
|
"transport_ssl.c"
|
||||||
"transport_ws.c"
|
"transport_tcp.c"
|
||||||
"transport_utils.c"
|
"transport_utils.c")
|
||||||
|
|
||||||
|
if(CONFIG_WS_TRANSPORT)
|
||||||
|
list(APPEND srcs
|
||||||
|
"transport_ws.c")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
PRIV_INCLUDE_DIRS "private_include"
|
PRIV_INCLUDE_DIRS "private_include"
|
||||||
REQUIRES lwip esp-tls)
|
REQUIRES lwip esp-tls)
|
||||||
|
@@ -1,9 +1,18 @@
|
|||||||
menu "TCP Transport"
|
menu "TCP Transport"
|
||||||
|
|
||||||
config WS_BUFFER_SIZE
|
menu "Websocket"
|
||||||
int "Websocket transport buffer size"
|
config WS_TRANSPORT
|
||||||
default 1024
|
bool "Enable Websocket Transport"
|
||||||
help
|
default y
|
||||||
Size of the buffer used for constructing the HTTP Upgrade request during connect
|
help
|
||||||
|
Enable support for creating websocket transport.
|
||||||
|
|
||||||
|
config WS_BUFFER_SIZE
|
||||||
|
int "Websocket transport buffer size"
|
||||||
|
default 1024
|
||||||
|
depends on WS_TRANSPORT
|
||||||
|
help
|
||||||
|
Size of the buffer used for constructing the HTTP Upgrade request during connect
|
||||||
|
endmenu
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -1,2 +1,6 @@
|
|||||||
COMPONENT_ADD_INCLUDEDIRS := include
|
COMPONENT_ADD_INCLUDEDIRS := include
|
||||||
COMPONENT_PRIV_INCLUDEDIRS := private_include
|
COMPONENT_PRIV_INCLUDEDIRS := private_include
|
||||||
|
|
||||||
|
ifndef CONFIG_WS_TRANSPORT
|
||||||
|
COMPONENT_OBJEXCLUDE := transport_ws.o
|
||||||
|
endif
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
// Copyright 2015-2021 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.
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@@ -1,3 +1,17 @@
|
|||||||
|
// Copyright 2015-2021 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.
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
Reference in New Issue
Block a user