Embedded Wireless Framework
ewf_adapter_quectel_bg96.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_adapter_quectel_bg96__h__included__
10 #define __ewf_adapter_quectel_bg96__h__included__
11 
12 #include "ewf_adapter.h"
13 #include "ewf_allocator.h"
14 #include "ewf_interface.h"
15 #include "ewf_adapter_api_modem.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /************************************************************************/
29 #ifndef EWF_ADAPTER_QUECTEL_BG96_UFS_ENABLED
30 #define EWF_ADAPTER_QUECTEL_BG96_UFS_ENABLED (1)
31 #define EWF_ADAPTER_QUECTEL_COMMON_ENABLED (1)
32 #endif
33 
34 #if !defined(EWF_ADAPTER_QUECTEL_BG96_TLS_ENABLED) && !defined(EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED)
35 #if 1
36 #define EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED (1)
37 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED (1)
38 #define EWF_ADAPTER_QUECTEL_BG96_TLS_ENABLED (0)
39 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_ENABLED (0)
40 #else
41 #define EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED (0)
42 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED (0)
43 #define EWF_ADAPTER_QUECTEL_BG96_TLS_ENABLED (1)
44 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_ENABLED (1)
45 #endif
46 #endif
47 
48 #ifndef EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED
49 #define EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED (1)
50 #define EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED (1)
51 #endif
52 
53 #ifndef EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED
54 #define EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED (1)
55 #define EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED (1)
56 #endif
57 
58 #if !defined(EWF_ADAPTER_QUECTEL_BG96_MQTT_ENABLED) && !defined(EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED)
59 #if 1
60 #define EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED (1)
61 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED (1)
62 #define EWF_ADAPTER_QUECTEL_BG96_MQTT_ENABLED (0)
63 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED (0)
64 #else
65 #define EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED (0)
66 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED (0)
67 #define EWF_ADAPTER_QUECTEL_BG96_MQTT_ENABLED (1)
68 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED (1)
69 #endif
70 #endif
71 
73 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_ROOT_CA_CERTIFICATE_FILE_NAME
74 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_FILE_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_ROOT_CA_CERTIFICATE_FILE_NAME
75 #endif
76 
78 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_USER_CA_CERTIFICATE_FILE_NAME
79 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_FILE_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_USER_CA_CERTIFICATE_FILE_NAME
80 #endif
81 
87 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_CERTIFICATE_CA_FILE_NAME
88 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CA_CERTIFICATE_FILE_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_CA_CERTIFICATE_FILE_NAME
89 #endif
90 
92 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_CERTIFICATE_FILE_NAME
93 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_FILE_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_CERTIFICATE_FILE_NAME
94 #endif
95 
97 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_PRIVATE_KEY_FILE_NAME
98 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_FILE_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_PRIVATE_KEY_FILE_NAME
99 #endif
100 
102 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_ROOT_CA_CERTIFICATE_BUFFER_NAME
103 #undef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME
104 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_ROOT_CA_CERTIFICATE_BUFFER_NAME
105 #endif
106 
108 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_USER_CA_CERTIFICATE_BUFFER_NAME
109 #undef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME
110 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_USER_CA_CERTIFICATE_BUFFER_NAME
111 #endif
112 
114 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_CERTIFICATE_BUFFER_NAME
115 #undef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME
116 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_CERTIFICATE_BUFFER_NAME
117 #endif
118 
120 #ifdef EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_PRIVATE_KEY_BUFFER_NAME
121 #undef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME
122 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME EWF_CONFIG_ADAPTER_QUECTEL_BG96_CLIENT_PRIVATE_KEY_BUFFER_NAME
123 #endif
124 
125 /************************************************************************/
129 /* Include the Quectel common header here, to take the above configuration macros into account */
131 
132 /************************************************************************/
144 extern ewf_adapter_api_control ewf_adapter_quectel_bg96_api_control;
145 
146 ewf_result ewf_adapter_quectel_bg96_start(ewf_adapter* adapter_ptr);
147 ewf_result ewf_adapter_quectel_bg96_stop(ewf_adapter* adapter_ptr);
148 
157 ewf_result ewf_adapter_quectel_bg96_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
158 
167 #define ewf_adapter_quectel_bg96_info ewf_adapter_quectel_common_info
168 #define ewf_adapter_quectel_bg96_get_ipv4_address ewf_adapter_quectel_common_get_ipv4_address
169 #define ewf_adapter_quectel_bg96_get_ipv4_netmask ewf_adapter_quectel_common_get_ipv4_netmask
170 #define ewf_adapter_quectel_bg96_get_ipv4_gateway ewf_adapter_quectel_common_get_ipv4_gateway
171 #define ewf_adapter_quectel_bg96_get_ipv4_dns ewf_adapter_quectel_common_get_ipv4_dns
172 
181 #define ewf_adapter_quectel_bg96_context_start ewf_adapter_quectel_common_context_start
182 #define ewf_adapter_quectel_bg96_context_stop ewf_adapter_quectel_common_context_stop
183 
184 #define ewf_adapter_quectel_bg96_context_urc_callback ewf_adapter_quectel_common_context_urc_callback
185 
186 #define ewf_adapter_quectel_bg96_context_activate ewf_adapter_quectel_common_context_activate
187 #define ewf_adapter_quectel_bg96_context_deactivate ewf_adapter_quectel_common_context_deactivate
188 #define ewf_adapter_quectel_bg96_context_configure ewf_adapter_quectel_common_context_configure
189 #define ewf_adapter_quectel_bg96_context_configure_dns ewf_adapter_quectel_common_context_configure_dns
190 
199 #if EWF_ADAPTER_QUECTEL_BG96_UFS_ENABLED
200 
201 #define ewf_adapter_quectel_bg96_ufs_start ewf_adapter_quectel_common_ufs_start
202 #define ewf_adapter_quectel_bg96_ufs_stop ewf_adapter_quectel_common_ufs_stop
203 
204 #define ewf_adapter_quectel_bg96_ufs_urc_callback ewf_adapter_quectel_common_ufs_urc_callback
205 
206 #define ewf_adapter_quectel_bg96_ufs_list ewf_adapter_quectel_common_ufs_list
207 #define ewf_adapter_quectel_bg96_ufs_delete ewf_adapter_quectel_common_ufs_delete
208 #define ewf_adapter_quectel_bg96_ufs_upload ewf_adapter_quectel_common_ufs_upload
209 
210 #endif /* EWF_ADAPTER_QUECTEL_BG96_UFS_ENABLED */
211 
220 #if EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED
221 
222 #define ewf_adapter_quectel_bg96_tls_basic_start ewf_adapter_quectel_common_tls_basic_start
223 #define ewf_adapter_quectel_bg96_tls_basic_stop ewf_adapter_quectel_common_tls_basic_stop
224 
225 #define ewf_adapter_quectel_bg96_tls_basic_urc_callback ewf_adapter_quectel_common_tls_basic_urc_callback
226 
227 #define ewf_adapter_quectel_bg96_tls_basic_init ewf_adapter_quectel_common_tls_basic_init
228 #define ewf_adapter_quectel_bg96_tls_basic_clean ewf_adapter_quectel_common_tls_basic_clean
229 
230 #endif /* EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED */
231 
240 #define ewf_adapter_quectel_bg96_internet_start ewf_adapter_quectel_common_internet_start
241 #define ewf_adapter_quectel_bg96_internet_stop ewf_adapter_quectel_common_internet_stop
242 
243 #define ewf_adapter_quectel_bg96_internet_urc_callback ewf_adapter_quectel_common_internet_urc_callback
244 
253 #if EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED
254 
255 #define ewf_adapter_quectel_bg96_tcp_open ewf_adapter_quectel_common_tcp_open
256 #define ewf_adapter_quectel_bg96_tcp_close ewf_adapter_quectel_common_tcp_close
257 #define ewf_adapter_quectel_bg96_tcp_control ewf_adapter_quectel_common_tcp_control
258 #define ewf_adapter_quectel_bg96_tcp_set_tls_configuration ewf_adapter_quectel_common_tcp_set_tls_configuration
259 #define ewf_adapter_quectel_bg96_tcp_bind ewf_adapter_quectel_common_tcp_bind
260 #define ewf_adapter_quectel_bg96_tcp_listen ewf_adapter_quectel_common_tcp_listen
261 #define ewf_adapter_quectel_bg96_tcp_accept ewf_adapter_quectel_common_tcp_accept
262 #define ewf_adapter_quectel_bg96_tcp_connect ewf_adapter_quectel_common_tcp_connect
263 #define ewf_adapter_quectel_bg96_tcp_shutdown ewf_adapter_quectel_common_tcp_shutdown
264 #define ewf_adapter_quectel_bg96_tcp_send ewf_adapter_quectel_common_tcp_send
265 #define ewf_adapter_quectel_bg96_tcp_receive ewf_adapter_quectel_common_tcp_receive
266 
267 #endif /* EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED */
268 
277 #if EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED
278 
279 #define ewf_adapter_quectel_bg96_udp_open ewf_adapter_quectel_common_udp_open
280 #define ewf_adapter_quectel_bg96_udp_close ewf_adapter_quectel_common_udp_close
281 #define ewf_adapter_quectel_bg96_udp_control ewf_adapter_quectel_common_udp_control
282 #define ewf_adapter_quectel_bg96_udp_set_dtls_configuration ewf_adapter_quectel_common_udp_set_dtls_configuration
283 #define ewf_adapter_quectel_bg96_udp_bind ewf_adapter_quectel_common_udp_bind
284 #define ewf_adapter_quectel_bg96_udp_send_to ewf_adapter_quectel_common_udp_send_to
285 #define ewf_adapter_quectel_bg96_udp_receive_from ewf_adapter_quectel_common_udp_receive_from
286 
287 #endif /* EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED */
288 
297 #if EWF_ADAPTER_QUECTEL_BG96_MQTT_ENABLED
298 
299 ewf_result ewf_adapter_quectel_bg96_mqtt_start(ewf_adapter* adapter_ptr);
300 ewf_result ewf_adapter_quectel_bg96_mqtt_stop(ewf_adapter* adapter_ptr);
301 
302 ewf_result ewf_adapter_quectel_bg96_mqtt_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
303 
304 #endif /* EWF_ADAPTER_QUECTEL_BG96_MQTT_ENABLED */
305 
314 #if EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED
315 
316 #define ewf_adapter_quectel_bg96_mqtt_basic_start ewf_adapter_quectel_common_mqtt_basic_start
317 #define ewf_adapter_quectel_bg96_mqtt_basic_stop ewf_adapter_quectel_common_mqtt_basic_stop
318 
319 #define ewf_adapter_quectel_bg96_mqtt_basic_urc_callback ewf_adapter_quectel_common_mqtt_basic_urc_callback
320 
321 #define ewf_adapter_quectel_bg96_mqtt_basic_default_state_callback ewf_adapter_quectel_common_mqtt_basic_default_state_callback
322 #define ewf_adapter_quectel_bg96_mqtt_basic_default_message_callback ewf_adapter_quectel_common_mqtt_basic_default_message_callback
323 
324 #define ewf_adapter_quectel_bg96_mqtt_basic_connect ewf_adapter_quectel_common_mqtt_basic_connect
325 #define ewf_adapter_quectel_bg96_mqtt_basic_disconnect ewf_adapter_quectel_common_mqtt_basic_disconnect
326 #define ewf_adapter_quectel_bg96_mqtt_basic_subscribe ewf_adapter_quectel_common_mqtt_basic_subscribe
327 #define ewf_adapter_quectel_bg96_mqtt_basic_unsubscribe ewf_adapter_quectel_common_mqtt_basic_unsubscribe
328 #define ewf_adapter_quectel_bg96_mqtt_basic_publish ewf_adapter_quectel_common_mqtt_basic_publish
329 
330 #endif /* EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED */
331 
334 /******************************************************************************
335  *
336  * Internal data
337  *
338  ******************************************************************************/
339 
348 {
351 
353 
362 #ifdef EWF_PARAMETER_CHECKING
363 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_HEADER(adapter_ptr) \
364 do { \
365 (adapter_ptr)->struct_magic = EWF_ADAPTER_STRUCT_MAGIC; \
366 (adapter_ptr)->struct_size = EWF_ADAPTER_STRUCT_SIZE; \
367 (adapter_ptr)->struct_version = EWF_ADAPTER_VERSION; \
368 (adapter_ptr)->struct_type = EWF_ADAPTER_TYPE_QUECTEL_BG96; \
369 } while(0)
370 #else
371 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_HEADER(adapter_ptr)
372 #endif /* EWF_PARAMETER_CHECKING */
373 
374 #if EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED
375 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TCP_API(adapter_ptr) \
376 do { \
377 adapter_ptr->tcp_api_ptr = &ewf_adapter_quectel_common_api_tcp; \
378 } while(0)
379 #else
380 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TCP_API(adapter_ptr)
381 #endif /* EWF_ADAPTER_QUECTEL_BG96_TCP_ENABLED */
382 
383 #if EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED
384 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_UDP_API(adapter_ptr) \
385 do { \
386 adapter_ptr->udp_api_ptr = &ewf_adapter_quectel_common_api_udp; \
387 } while(0)
388 #else
389 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_UDP_API(adapter_ptr)
390 #endif /* EWF_ADAPTER_QUECTEL_BG96_UDP_ENABLED */
391 
392 #if EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED
393 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TLS_BASIC_API(adapter_ptr) \
394 do { \
395 adapter_ptr->tls_basic_api_ptr = &ewf_adapter_quectel_common_api_tls_basic; \
396 } while(0)
397 #else
398 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TLS_BASIC_API(adapter_ptr)
399 #endif /* EWF_ADAPTER_QUECTEL_BG96_TLS_BASIC_ENABLED */
400 
401 #if EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED
402 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_MQTT_BASIC_API(adapter_ptr) \
403 do { \
404 adapter_ptr->mqtt_basic_api_ptr = &ewf_adapter_quectel_common_api_mqtt_basic; \
405 } while(0)
406 #else
407 #define EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_MQTT_BASIC_API(adapter_ptr)
408 #endif /* EWF_ADAPTER_QUECTEL_BG96_MQTT_BASIC_ENABLED */
409 
418 #define EWF_ADAPTER_QUECTEL_BG96_STATIC_DECLARE(adapter_ptr, adapter_name_symb, message_allocator_ptr_param, data_allocator_ptr_param, interface_ptr_param) \
419 do { \
420 static ewf_adapter_quectel_bg96 ewf_adapter_quectel_bg96__implementation__##adapter_name_symb = {0}; \
421 static ewf_adapter ewf_adapter_quectel_bg96__##adapter_name_symb = {0}; \
422 interface_ptr_param->message_allocator_ptr = message_allocator_ptr_param; \
423 interface_ptr_param->data_allocator_ptr = data_allocator_ptr_param; \
424 interface_ptr_param->urc_callback = ewf_adapter_quectel_bg96_urc_callback; \
425 ewf_adapter_quectel_bg96__##adapter_name_symb.interface_ptr = interface_ptr_param; \
426 ewf_adapter_quectel_bg96__##adapter_name_symb.implementation_ptr = &(ewf_adapter_quectel_bg96__implementation__##adapter_name_symb); \
427 adapter_ptr = &(ewf_adapter_quectel_bg96__##adapter_name_symb); \
428 interface_ptr_param->adapter_ptr = adapter_ptr; \
429 EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_HEADER(adapter_ptr); \
430 ewf_adapter_quectel_bg96__##adapter_name_symb.control_api_ptr = &ewf_adapter_quectel_bg96_api_control; \
431 ewf_adapter_quectel_bg96__##adapter_name_symb.info_api_ptr = &ewf_adapter_quectel_common_api_info; \
432 EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TCP_API(adapter_ptr); \
433 EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_UDP_API(adapter_ptr); \
434 EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_TLS_BASIC_API(adapter_ptr); \
435 EWF_ADAPTER_QUECTEL_BG96_INITIALIZE_MQTT_BASIC_API(adapter_ptr); \
436 } while(0)
437 
440 /************************************************************************/
444 #ifdef __cplusplus
445 }
446 #endif
447 
448 #endif /* __ewf_adapter_quectel_bg96__h__included__ */
The Embedded Wireless Framework adapter API implementation.
The Embedded Wireless Framework modem adapter API.
The Embedded Wireless Framework generic Quectel adapter functionality.
The Embedded Wireless Framework host interface API.
struct _ewf_adapter_quectel_bg96 ewf_adapter_quectel_bg96
The Quectel BG96 adapter data structure.
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
The Quectel BG96 adapter data structure.
Definition: ewf_adapter_quectel_bg96.h:348
ewf_adapter_quectel_common common_implementation_data
Definition: ewf_adapter_quectel_bg96.h:350
The Quectel common adapter data structure.
Definition: ewf_adapter_quectel_common.h:187
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The interface structure definition.
Definition: ewf_interface.h:66