Embedded Wireless Framework
ewf_adapter_espressif_common.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_adapter_espressif_common__h__included__
10 #define __ewf_adapter_espressif_common__h__included__
11 
12 #include "ewf_adapter.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /************************************************************************/
24 /************************************************************************/
31 #define EWF_ADAPTER_ESPRESSIF_COMMON_TLS_BASIC_ENABLED (0)
32 #define EWF_ADAPTER_ESPRESSIF_COMMON_MQTT_BASIC_ENABLED (0)
33 
34 #if !defined(EWF_ADAPTER_ESPRESSIF_COMMON_TLS_ENABLED) && !defined(EWF_ADAPTER_ESPRESSIF_COMMON_TLS_BASIC_ENABLED)
35 #if 1
36 #define EWF_ADAPTER_ESPRESSIF_COMMON_TLS_BASIC_ENABLED (1)
37 #define EWF_ADAPTER_ESPRESSIF_COMMON_TLS_ENABLED (0)
38 #else
39 #define EWF_ADAPTER_ESPRESSIF_COMMON_TLS_BASIC_ENABLED (0)
40 #define EWF_ADAPTER_ESPRESSIF_COMMON_TLS_ENABLED (1)
41 #endif
42 #endif
43 
44 #ifndef EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED
45 #define EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED (1)
46 #endif
47 
48 #ifndef EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED
49 #define EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED (1)
50 #endif
51 
52 #ifndef EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_POOL_SIZE
54 #define EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_POOL_SIZE (5)
55 #endif
56 
57 #ifndef EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_RECV_BUFFER_SIZE
59 #define EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_RECV_BUFFER_SIZE (1500)
60 #endif
61 
62 #ifndef EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_INVALID
64 #define EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_INVALID (-1)
65 #endif
66 
67 /************************************************************************/
71 /************************************************************************/
79 {
80  ewf_adapter_espressif_common_internet_socket_service_type_not_initialized,
81  ewf_adapter_espressif_common_internet_socket_service_type_tcp,
82  ewf_adapter_espressif_common_internet_socket_service_type_udp,
83  ewf_adapter_espressif_common_internet_socket_service_type_tcp_listener,
84  ewf_adapter_espressif_common_internet_socket_service_type_udp_listener,
85 
87 
90 {
91  uint32_t id;
92  uint32_t local_port;
94  volatile bool used;
95  volatile bool open;
96  volatile bool open_error;
97  volatile bool conn;
98  volatile bool conn_error;
99  volatile bool recv;
100  ewf_platform_queue* recv_queue_ptr;
101 
103 
106 {
107  int dummy;
108 
109 #if EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED || EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED
114 #endif
115 
117 
118 /************************************************************************/
128 extern ewf_adapter_api_control ewf_adapter_espressif_common_api_control;
129 
130 ewf_result ewf_adapter_espressif_common_start(ewf_adapter* adapter_ptr);
131 ewf_result ewf_adapter_espressif_common_stop(ewf_adapter* adapter_ptr);
132 
141 extern ewf_adapter_api_info ewf_adapter_espressif_common_api_info;
142 
143 ewf_result ewf_adapter_espressif_common_info(ewf_adapter* adapter_ptr);
144 ewf_result ewf_adapter_espressif_common_get_ipv4_address(ewf_adapter* adapter_ptr, uint32_t* address_ptr);
145 ewf_result ewf_adapter_espressif_common_get_ipv4_netmask(ewf_adapter* adapter_ptr, uint32_t* netmask_ptr);
146 ewf_result ewf_adapter_espressif_common_get_ipv4_gateway(ewf_adapter* adapter_ptr, uint32_t* gateway_ptr);
147 ewf_result ewf_adapter_espressif_common_get_ipv4_dns(ewf_adapter* adapter_ptr, uint32_t* dns);
148 
157 ewf_result ewf_adapter_espressif_common_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
158 
167 extern ewf_adapter_api_wifi_station ewf_adapter_espressif_common_api_wifi_station;
168 
169 ewf_result ewf_adapter_espressif_common_wifi_station_connect(ewf_adapter* adapter_ptr, const char* ssid_str, const char* password_str);
170 ewf_result ewf_adapter_espressif_common_wifi_station_disconnect(ewf_adapter* adapter_ptr);
171 
180 #if EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED || EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED
181 
182 ewf_result ewf_adapter_espressif_common_internet_start(ewf_adapter* adapter_ptr);
183 ewf_result ewf_adapter_espressif_common_internet_stop(ewf_adapter* adapter_ptr);
184 
185 ewf_result ewf_adapter_espressif_common_internet_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
186 
187 #endif /* EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED || EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED */
188 
197 #if EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED
198 
199 extern ewf_adapter_api_tcp ewf_adapter_espressif_common_api_tcp;
200 
201 ewf_result ewf_adapter_espressif_common_tcp_open(ewf_adapter* adapter_ptr, ewf_socket_tcp* socket_ptr);
202 ewf_result ewf_adapter_espressif_common_tcp_close(ewf_socket_tcp* socket_ptr);
203 ewf_result ewf_adapter_espressif_common_tcp_control(ewf_socket_tcp* socket_ptr, const char* control_str, const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
204 ewf_result ewf_adapter_espressif_common_tcp_set_tls_configuration(ewf_socket_tcp* socket_ptr, uint32_t tls_configuration_id);
205 ewf_result ewf_adapter_espressif_common_tcp_bind(ewf_socket_tcp* socket_ptr, uint32_t port);
206 ewf_result ewf_adapter_espressif_common_tcp_listen(ewf_socket_tcp* socket_ptr);
207 ewf_result ewf_adapter_espressif_common_tcp_accept(ewf_socket_tcp* socket_ptr, ewf_socket_tcp* socket_new_ptr);
208 ewf_result ewf_adapter_espressif_common_tcp_connect(ewf_socket_tcp* socket_ptr, const char* const server, uint32_t port);
209 ewf_result ewf_adapter_espressif_common_tcp_shutdown(ewf_socket_tcp* socket_ptr);
210 ewf_result ewf_adapter_espressif_common_tcp_send(ewf_socket_tcp* socket_ptr, const uint8_t* buffer_ptr, uint32_t buffer_length);
211 ewf_result ewf_adapter_espressif_common_tcp_receive(ewf_socket_tcp* socket_ptr, uint8_t* buffer_ptr, uint32_t* buffer_length, bool wait);
212 
213 #endif /* EWF_ADAPTER_ESPRESSIF_COMMON_TCP_ENABLED */
214 
223 #if EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED
224 
225 extern ewf_adapter_api_udp ewf_adapter_espressif_common_api_udp;
226 
227 ewf_result ewf_adapter_espressif_common_udp_open(ewf_adapter* adapter_ptr, ewf_socket_udp* socket_ptr);
228 ewf_result ewf_adapter_espressif_common_udp_close(ewf_socket_udp* socket_ptr);
229 ewf_result ewf_adapter_espressif_common_udp_control(ewf_socket_udp* socket_ptr, const char* control_str, const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
230 ewf_result ewf_adapter_espressif_common_udp_set_dtls_configuration(ewf_socket_udp* socket_ptr, uint32_t dtls_configuration_id);
231 ewf_result ewf_adapter_espressif_common_udp_bind(ewf_socket_udp* socket_ptr, uint32_t port);
232 ewf_result ewf_adapter_espressif_common_udp_shutdown(ewf_socket_udp* socket_ptr);
233 ewf_result ewf_adapter_espressif_common_udp_send_to(ewf_socket_udp* socket_ptr, const char* remote_address_str, uint32_t remote_port, const uint8_t* buffer_ptr, uint32_t buffer_length);
234 ewf_result ewf_adapter_espressif_common_udp_receive_from(ewf_socket_udp* socket_ptr, char* remote_address, uint32_t* remote_address_length_ptr, uint32_t* remote_port_ptr, uint8_t* buffer_ptr, uint32_t* buffer_length_ptr, bool wait);
235 
236 #endif /* EWF_ADAPTER_ESPRESSIF_COMMON_UDP_ENABLED */
237 
240 /************************************************************************/
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif /* __ewf_adapter_espressif_common__h__included__ */
The Embedded Wireless Framework adapter API implementation.
struct _ewf_adapter_espressif_common_internet_socket ewf_adapter_espressif_common_internet_socket
Internal structure for internet socket status
_ewf_adapter_common_internet_socket_service_type
The socket service type
Definition: ewf_adapter_espressif_common.h:79
enum _ewf_adapter_common_internet_socket_service_type ewf_adapter_espressif_common_internet_socket_service_type
The socket service type
struct _ewf_adapter_espressif_common ewf_adapter_espressif_common
The ESPRESSIF common adapter data structure.
#define EWF_ADAPTER_ESPRESSIF_COMMON_INTERNET_SOCKET_POOL_SIZE
The total number of supported internet sockets in the adapter.
Definition: ewf_adapter_espressif_common.h:54
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
The adapter control API type.
Definition: ewf_adapter_api_control.h:28
Definition: ewf_adapter_api_info.h:26
The TCP API structure.
Definition: ewf_adapter_api_tcp.h:76
The UDP API type.
Definition: ewf_adapter_api_udp.h:63
Definition: ewf_adapter_api_wifi_station.h:29
Internal structure for internet socket status
Definition: ewf_adapter_espressif_common.h:90
The ESPRESSIF common adapter data structure.
Definition: ewf_adapter_espressif_common.h:106
bool passive_mode
Definition: ewf_adapter_espressif_common.h:111
int dummy
Definition: ewf_adapter_espressif_common.h:107
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The interface structure definition.
Definition: ewf_interface.h:66
The platform queue structure.
Definition: ewf_platform_bare_metal.h:74
The TCP socket structure definition.
Definition: ewf_adapter_api_tcp.h:47
The UDP socket structure definition.
Definition: ewf_adapter_api_udp.h:40