9 #ifndef __ewf_adapter_quectel_common__h__included__
10 #define __ewf_adapter_quectel_common__h__included__
25 #ifndef EWF_ADAPTER_QUECTEL_COMMON_DEFAULT_TIMEOUT
26 #define EWF_ADAPTER_QUECTEL_COMMON_DEFAULT_TIMEOUT (EWF_PLATFORM_TICKS_PER_SECOND * 10)
29 #ifndef EWF_ADAPTER_QUECTEL_COMMON_UFS_ENABLED
30 #define EWF_ADAPTER_QUECTEL_COMMON_UFS_ENABLED (1)
33 #if !defined(EWF_ADAPTER_QUECTEL_COMMON_TLS_ENABLED) && !defined(EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED)
35 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED (1)
36 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_ENABLED (0)
38 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED (0)
39 #define EWF_ADAPTER_QUECTEL_COMMON_TLS_ENABLED (1)
43 #ifndef EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED
44 #define EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED (1)
47 #ifndef EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED
48 #define EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED (1)
51 #if !defined(EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED) && !defined(EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED)
53 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED (1)
54 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED (0)
56 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED (0)
57 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED (1)
61 #ifndef EWF_ADAPTER_QUECTEL_COMMON_INTERNET_SOCKET_POOL_SIZE
63 #define EWF_ADAPTER_QUECTEL_COMMON_INTERNET_SOCKET_POOL_SIZE (12)
66 #ifndef EWF_ADAPTER_QUECTEL_COMMON_INTERNET_SOCKET_INVALID
68 #define EWF_ADAPTER_QUECTEL_COMMON_INTERNET_SOCKET_INVALID (-1)
71 #ifndef EWF_ADAPTER_QUECTEL_COMMON_MQTT_SOCKET_POOL_SIZE
73 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_SOCKET_POOL_SIZE (12)
76 #ifndef EWF_ADAPTER_QUECTEL_COMMON_MQTT_SOCKET_INVALID
78 #define EWF_ADAPTER_QUECTEL_COMMON_MQTT_SOCKET_INVALID (-1)
82 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_FILE_NAME
83 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_FILE_NAME ("root_ca_cert.pem")
87 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_FILE_NAME
88 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_FILE_NAME ("ca_cert.pem")
98 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CA_CERTIFICATE_FILE_NAME
99 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CA_CERTIFICATE_FILE_NAME ("root_ca_cert.pem")
103 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_FILE_NAME
104 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_FILE_NAME ("device_cert.pem")
108 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_FILE_NAME
109 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_FILE_NAME ("device_key.pem")
113 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME
114 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME (root_ca_cert_pem)
118 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME
119 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME (ca_cert_pem)
123 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME
124 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME (device_cert_pem)
128 #ifndef EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME
129 #define EWF_CONFIG_ADAPTER_QUECTEL_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME (device_key_pem)
152 ewf_adapter_quectel_common_internet_socket_service_type_not_initialized,
153 ewf_adapter_quectel_common_internet_socket_service_type_tcp,
154 ewf_adapter_quectel_common_internet_socket_service_type_udp,
155 ewf_adapter_quectel_common_internet_socket_service_type_tcp_listener,
156 ewf_adapter_quectel_common_internet_socket_service_type_udp_listener,
167 volatile bool used : 1;
168 volatile bool open : 1;
169 volatile bool open_error : 1;
170 volatile bool conn : 1;
171 volatile bool conn_error : 1;
178 volatile bool open : 1;
179 volatile bool open_error : 1;
180 volatile bool conn : 1;
181 volatile bool conn_error : 1;
190 #if EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED || EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED
195 #if EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED
198 volatile bool mqtt_basic_open_error;
199 volatile bool mqtt_basic_conn;
200 volatile bool mqtt_basic_conn_error;
201 volatile bool mqtt_basic_publish;
202 volatile bool mqtt_basic_subscribe;
205 #if EWF_ADAPTER_QUECTEL_COMMON_MQTT_ENABLED
266 ewf_result ewf_adapter_quectel_common_ufs_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
314 ewf_result ewf_adapter_quectel_common_get_ipv4_address(
ewf_adapter* adapter_ptr, uint32_t* address_ptr);
315 ewf_result ewf_adapter_quectel_common_get_ipv4_netmask(
ewf_adapter* adapter_ptr, uint32_t* netmask_ptr);
316 ewf_result ewf_adapter_quectel_common_get_ipv4_gateway(
ewf_adapter* adapter_ptr, uint32_t* gateway_ptr);
327 ewf_result ewf_adapter_quectel_common_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
337 #if EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED || EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED
342 ewf_result ewf_adapter_quectel_common_internet_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
354 #if EWF_ADAPTER_QUECTEL_COMMON_TCP_ENABLED
360 ewf_result ewf_adapter_quectel_common_tcp_control(
ewf_socket_tcp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
361 ewf_result ewf_adapter_quectel_common_tcp_set_tls_configuration(
ewf_socket_tcp* socket_ptr, uint32_t tls_configuration_id);
365 ewf_result ewf_adapter_quectel_common_tcp_connect(
ewf_socket_tcp* socket_ptr,
const char*
const server, uint32_t port);
367 ewf_result ewf_adapter_quectel_common_tcp_send(
ewf_socket_tcp* socket_ptr,
const uint8_t* buffer_ptr, uint32_t buffer_length);
368 ewf_result ewf_adapter_quectel_common_tcp_receive(
ewf_socket_tcp* socket_ptr, uint8_t* buffer_ptr, uint32_t* buffer_length,
bool wait);
380 #if EWF_ADAPTER_QUECTEL_COMMON_UDP_ENABLED
386 ewf_result ewf_adapter_quectel_common_udp_control(
ewf_socket_udp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
387 ewf_result ewf_adapter_quectel_common_udp_set_dtls_configuration(
ewf_socket_udp* socket_ptr, uint32_t dtls_configuration_id);
390 ewf_result ewf_adapter_quectel_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);
391 ewf_result ewf_adapter_quectel_common_udp_receive_from(
ewf_socket_udp* socket_ptr,
char* remote_address, uint32_t* remote_address_length_ptr, uint32_t* remote_port_ptr,
char* buffer_ptr, uint32_t* buffer_length_ptr,
bool wait);
403 #if EWF_ADAPTER_QUECTEL_COMMON_TLS_BASIC_ENABLED
410 ewf_result ewf_adapter_quectel_common_tls_basic_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
425 #if EWF_ADAPTER_QUECTEL_COMMON_MQTT_BASIC_ENABLED
432 ewf_result ewf_adapter_quectel_common_mqtt_basic_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
434 ewf_result ewf_adapter_quectel_common_mqtt_basic_default_state_callback(
ewf_adapter* adapter_ptr,
const char* state_cstr,
const char* param_cstr);
435 ewf_result ewf_adapter_quectel_common_mqtt_basic_default_message_callback(
ewf_adapter* adapter_ptr,
const char* topic_cstr,
const char* payload_cstr);
437 ewf_result ewf_adapter_quectel_common_mqtt_basic_connect(
ewf_adapter* adapter_ptr,
char const* server_str, uint32_t port,
char const* clientid,
char const* username,
char const* password);
439 ewf_result ewf_adapter_quectel_common_mqtt_basic_subscribe(
ewf_adapter* adapter_ptr,
char const* topic);
440 ewf_result ewf_adapter_quectel_common_mqtt_basic_unsubscribe(
ewf_adapter* adapter_ptr,
char const* topic);
441 ewf_result ewf_adapter_quectel_common_mqtt_basic_publish(
ewf_adapter* adapter_ptr,
const char* topic,
const char* msg_cstr);
The Embedded Wireless Framework adapter API implementation.
_ewf_adapter_common_internet_socket_service_type
The socket service type
Definition: ewf_adapter_espressif_common.h:79
ewf_result(* ewf_adapter_mqtt_message_callback)(ewf_socket_mqtt *socket_ptr, const char *topic_str, ewf_adapter_mqtt_message *message_ptr)
A function pointer type for MQTT message callbacks.
Definition: ewf_adapter_api_mqtt.h:50
ewf_result ewf_adapter_quectel_common_context_configure(ewf_adapter *adapter_ptr, uint32_t ctx, uint32_t type, const char *apn, const char *username, const char *password, uint32_t authentication)
Configure a context.
Definition: ewf_adapter_quectel_common_context.c:79
ewf_result ewf_adapter_quectel_common_context_deactivate(ewf_adapter *adapter_ptr, uint32_t ctx)
Deactivate a context.
Definition: ewf_adapter_quectel_common_context.c:46
ewf_result ewf_adapter_quectel_common_context_configure_dns(ewf_adapter *adapter_ptr, uint32_t ctx, const char *primary_dns, const char *secondary_dns)
Configure a context DNS.
Definition: ewf_adapter_quectel_common_context.c:140
ewf_result ewf_adapter_quectel_common_context_activate(ewf_adapter *adapter_ptr, uint32_t ctx)
Activate a context.
Definition: ewf_adapter_quectel_common_context.c:13
struct _ewf_adapter_quectel_common ewf_adapter_quectel_common
The Quectel common adapter data structure.
struct _ewf_adapter_quectel_common_internet_socket ewf_adapter_quectel_common_internet_socket
Internal structure for internet socket status
enum _ewf_adapter_common_internet_socket_service_type ewf_adapter_quectel_common_internet_socket_service_type
The socket service type
struct _ewf_adapter_quectel_common_mqtt_socket ewf_adapter_quectel_common_mqtt_socket
Internal structure for MQTT socket status
ewf_result ewf_adapter_quectel_common_ufs_delete(ewf_adapter *adapter_ptr, const char *filename_str)
Delete a file from the user file system.
Definition: ewf_adapter_quectel_common_ufs.c:54
ewf_result ewf_adapter_quectel_common_ufs_upload(ewf_adapter *adapter_ptr, const char *filename_str, const uint8_t *buffer_ptr, uint32_t buffer_length)
Upload a file to the user file system.
Definition: ewf_adapter_quectel_common_ufs.c:68
ewf_result ewf_adapter_quectel_common_ufs_list(ewf_adapter *adapter_ptr)
List the files in the user file system.
Definition: ewf_adapter_quectel_common_ufs.c:32
#define EWF_ADAPTER_QUECTEL_COMMON_INTERNET_SOCKET_POOL_SIZE
The total number of supported internet sockets in the adapter.
Definition: ewf_adapter_quectel_common.h:63
#define EWF_ADAPTER_QUECTEL_COMMON_MQTT_SOCKET_POOL_SIZE
The total number of supported MQTT sockets in the adapter.
Definition: ewf_adapter_quectel_common.h:73
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
Definition: ewf_adapter_api_mqtt_basic.h:55
The TCP API structure.
Definition: ewf_adapter_api_tcp.h:76
The TLS basic API structure.
Definition: ewf_adapter_api_tls_basic.h:29
The UDP API type.
Definition: ewf_adapter_api_udp.h:63
Internal structure for internet socket status
Definition: ewf_adapter_quectel_common.h:162
Internal structure for MQTT socket status
Definition: ewf_adapter_quectel_common.h:177
The Quectel common adapter data structure.
Definition: ewf_adapter_quectel_common.h:187
volatile bool mqtt_basic_open
Internal MQTT basic API socket 0 status
Definition: ewf_adapter_quectel_common.h:197
uint32_t default_timeout
Definition: ewf_adapter_quectel_common.h:188
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The interface structure definition.
Definition: ewf_interface.h:66
The TCP socket structure definition.
Definition: ewf_adapter_api_tcp.h:47
The UDP socket structure definition.
Definition: ewf_adapter_api_udp.h:40