19 #ifndef __ewf_adapter_renesas_common__h__included__
20 #define __ewf_adapter_renesas_common__h__included__
35 #ifndef EWF_ADAPTER_RENESAS_COMMON_NVM_ENABLED
36 #define EWF_ADAPTER_RENESAS_COMMON_NVM_ENABLED (1)
39 #if !defined(EWF_ADAPTER_RENESAS_COMMON_TLS_ENABLED) && \
40 !defined(EWF_ADAPTER_RENESAS_COMMON_TLS_BASIC_ENABLED)
42 #define EWF_ADAPTER_RENESAS_COMMON_TLS_BASIC_ENABLED (1)
43 #define EWF_ADAPTER_RENESAS_COMMON_TLS_ENABLED (0)
45 #define EWF_ADAPTER_RENESAS_COMMON_TLS_BASIC_ENABLED (0)
46 #define EWF_ADAPTER_RENESAS_COMMON_TLS_ENABLED (1)
50 #ifndef EWF_ADAPTER_RENESAS_COMMON_TCP_ENABLED
51 #define EWF_ADAPTER_RENESAS_COMMON_TCP_ENABLED (1)
54 #ifndef EWF_ADAPTER_RENESAS_COMMON_UDP_ENABLED
55 #define EWF_ADAPTER_RENESAS_COMMON_UDP_ENABLED (1)
58 #if !defined(EWF_ADAPTER_RENESAS_COMMON_MQTT_ENABLED) && \
59 !defined(EWF_ADAPTER_RENESAS_COMMON_MQTT_BASIC_ENABLED)
61 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_BASIC_ENABLED (1)
62 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_ENABLED (0)
64 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_BASIC_ENABLED (0)
65 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_ENABLED (1)
70 #define EWF_ADAPTER_RENESAS_COMMON_INTERNET_SOCKET_POOL_SIZE (6)
73 #define EWF_ADAPTER_RENESAS_COMMON_INTERNET_SOCKET_INVALID (-1)
76 #define EWF_ADAPTER_RENESAS_COMMON_INTERNET_SOCKET_TCP (0)
77 #define EWF_ADAPTER_RENESAS_COMMON_INTERNET_SOCKET_UDP (1)
81 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_SOCKET_POOL_SIZE (1)
84 #define EWF_ADAPTER_RENESAS_COMMON_MQTT_SOCKET_INVALID (-1)
86 #define EWF_ADAPTER_RENESAS_COMMON_SOCKET_MAX_SEND_SIZE (1460)
87 #define EWF_ADAPTER_RENESAS_COMMON_SOCKET_MAX_RECEIVE_SIZE (1500)
88 #define EWF_ADAPTER_RENESAS_COMMON_SOCKET_COMMAND_MODE ("1")
89 #define EWF_ADAPTER_RENESAS_COMMON_SOCKET_ONLINE_DATA_MODE ("0")
96 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_ROOT_CA_CERTIFICATE_ID
97 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_ROOT_CA_CERTIFICATE_ID ("11")
105 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_USER_CA_CERTIFICATE_ID
106 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_USER_CA_CERTIFICATE_ID ("12")
115 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_CA_CERTIFICATE_ID
116 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CA_CERTIFICATE_ID ("11")
124 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_CERTIFICATE_ID
125 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_CERTIFICATE_ID ("13")
133 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_PRIVATE_KEY_ID
134 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_PRIVATE_KEY_ID ("13")
142 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_SECURITY_PROFILE_ID
143 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_SECURITY_PROFILE_ID ("5")
147 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME
148 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_ROOT_CA_CERTIFICATE_BUFFER_NAME (root_ca_cert_pem)
152 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME
153 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_USER_CA_CERTIFICATE_BUFFER_NAME (ca_cert_pem)
157 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME
158 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_CERTIFICATE_BUFFER_NAME (device_cert_pem)
162 #ifndef EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME
163 #define EWF_CONFIG_ADAPTER_RENESAS_COMMON_CLIENT_PRIVATE_KEY_BUFFER_NAME (device_key_pem)
167 #define EWF_ADAPTER_RENESAS_COMMON_FILE_TYPE_CERTIFICATE ("certificate")
168 #define EWF_ADAPTER_RENESAS_COMMON_FILE_TYPE_PRIVATEKEY ("privatekey")
170 #define EWF_ADAPTER_RENESAS_COMMON_CLOSE_LISTENING_SOCKET ("0")
171 #define EWF_ADAPTER_RENESAS_COMMON_OPEN_LISTNEING_IPV4_SOCKET ("1")
172 #define EWF_ADAPTER_RENESAS_COMMON_OPEN_LISTENING_IPV6_SOCKET ("2")
194 ewf_adapter_renesas_common_socket_service_type_not_initialized,
195 ewf_adapter_renesas_common_socket_service_type_tcp,
196 ewf_adapter_renesas_common_socket_service_type_udp,
197 ewf_adapter_renesas_common_socket_service_type_tcp_listener,
198 ewf_adapter_renesas_common_socket_service_type_udp_listener,
211 volatile bool open_error;
213 volatile bool conn_error;
224 #if EWF_ADAPTER_RENESAS_COMMON_TCP_ENABLED || EWF_ADAPTER_RENESAS_COMMON_UDP_ENABLED
229 #if EWF_ADAPTER_RENESAS_COMMON_MQTT_BASIC_ENABLED
232 volatile uint8_t mqtt_basic_conn_error;
233 volatile bool mqtt_basic_publish;
234 volatile uint8_t mqtt_basic_publish_error;
235 volatile bool mqtt_basic_subscribe;
236 volatile uint8_t mqtt_basic_subscribe_error;
285 ewf_result ewf_adapter_renesas_common_get_ipv4_address(
ewf_adapter* adapter_ptr, uint32_t* address_ptr);
286 ewf_result ewf_adapter_renesas_common_get_ipv4_netmask(
ewf_adapter* adapter_ptr, uint32_t* netmask_ptr);
287 ewf_result ewf_adapter_renesas_common_get_ipv4_gateway(
ewf_adapter* adapter_ptr, uint32_t* gateway_ptr);
298 ewf_result ewf_adapter_renesas_common_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
309 #if EWF_ADAPTER_RENESAS_COMMON_TLS_BASIC_ENABLED
316 ewf_result ewf_adapter_renesas_common_tls_basic_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
331 #if EWF_ADAPTER_RENESAS_COMMON_TCP_ENABLED || EWF_ADAPTER_RENESAS_COMMON_UDP_ENABLED
336 ewf_result ewf_adapter_renesas_common_internet_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
348 #if EWF_ADAPTER_RENESAS_COMMON_TCP_ENABLED
354 ewf_result ewf_adapter_renesas_common_tcp_control(
ewf_socket_tcp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
355 ewf_result ewf_adapter_renesas_common_tcp_set_tls_configuration(
ewf_socket_tcp* socket_ptr, uint32_t tls_configuration_id);
359 ewf_result ewf_adapter_renesas_common_tcp_connect(
ewf_socket_tcp* socket_ptr,
const char*
const server, uint32_t remote_port);
361 ewf_result ewf_adapter_renesas_common_tcp_send(
ewf_socket_tcp* socket_ptr,
const uint8_t* buffer_ptr, uint32_t buffer_length);
362 ewf_result ewf_adapter_renesas_common_tcp_receive(
ewf_socket_tcp* socket_ptr, uint8_t* buffer_ptr, uint32_t* buffer_length,
bool wait);
374 #if EWF_ADAPTER_RENESAS_COMMON_UDP_ENABLED
380 ewf_result ewf_adapter_renesas_common_udp_control(
ewf_socket_udp* socket_ptr,
const char* control_str,
const uint8_t* buffer_ptr, uint32_t* buffer_length_ptr);
381 ewf_result ewf_adapter_renesas_common_udp_set_dtls_configuration(
ewf_socket_udp* socket_ptr, uint32_t dtls_configuration_id);
384 ewf_result ewf_adapter_renesas_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);
385 ewf_result ewf_adapter_renesas_common_udp_receive_from(
ewf_socket_udp* socket_ptr,
char* remote_address_str, uint32_t* remote_address_length_ptr, uint32_t* remote_port_ptr,
char* buffer_ptr, uint32_t* buffer_length_ptr,
bool wait);
397 #if EWF_ADAPTER_RENESAS_COMMON_MQTT_ENABLED
401 ewf_result ewf_adapter_renesas_common_mqtt_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
403 ewf_result ewf_adapter_renesas_common_mqtt_connect(
ewf_adapter* adapter_ptr,
ewf_socket_mqtt* socket_ptr,
char const* server_str, uint32_t port,
char const* clientid,
char const* username,
char const* password);
420 #if EWF_ADAPTER_RENESAS_COMMON_MQTT_BASIC_ENABLED
427 ewf_result ewf_adapter_renesas_common_mqtt_basic_urc_callback(
ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
429 ewf_result ewf_adapter_renesas_common_mqtt_basic_default_state_callback(
ewf_adapter* adapter_ptr,
const char* state_cstr,
const char* param_cstr);
430 ewf_result ewf_adapter_renesas_common_mqtt_basic_default_message_callback(
ewf_adapter* adapter_ptr,
const char* topic_cstr,
const char* payload_cstr);
432 ewf_result ewf_adapter_renesas_common_mqtt_basic_connect(
ewf_adapter* adapter_ptr,
char const* server_str, uint32_t port,
char const* clientid,
char const* username,
char const* password);
434 ewf_result ewf_adapter_renesas_common_mqtt_basic_subscribe(
ewf_adapter* adapter_ptr,
char const* topic);
435 ewf_result ewf_adapter_renesas_common_mqtt_basic_unsubscribe(
ewf_adapter* adapter_ptr,
char const* topic);
436 ewf_result ewf_adapter_renesas_common_mqtt_basic_publish(
ewf_adapter* adapter_ptr,
const char* topic,
const char* msg_cstr);
437 ewf_result ewf_adapter_renesas_common_mqtt_basic_message_get(
ewf_adapter* adapter_ptr,
const char* topic,
char* message_buffer_ptr);
The Embedded Wireless Framework adapter API implementation.
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
struct _ewf_adapter_renesas_common ewf_adapter_renesas_common
The Renesas adapter data structure.
enum _ewf_adapter_bg96_internet_socket_service_type ewf_adapter_renesas_common_internet_socket_service_type
The socket service type
_ewf_adapter_bg96_internet_socket_service_type
The socket service type
Definition: ewf_adapter_renesas_common.h:193
struct _ewf_adapter_renesas_common_socket ewf_adapter_renesas_common_internet_socket
Internal structure for internet socket status
ewf_result ewf_adapter_renesas_common_nvm_upload(ewf_adapter *adapter_ptr, const char *filename_str, const uint8_t *data, uint32_t length, const char *index)
Upload a file to the NVM.
Definition: ewf_adapter_renesas_common_nvm.c:81
ewf_result ewf_adapter_renesas_common_nvm_start(ewf_adapter *adapter_ptr)
Start the NVM operation.
Definition: ewf_adapter_renesas_common_nvm.c:24
ewf_result ewf_adapter_renesas_common_nvm_stop(ewf_adapter *adapter_ptr)
Stop the NVM operation.
Definition: ewf_adapter_renesas_common_nvm.c:31
ewf_result ewf_adapter_renesas_common_nvm_list(ewf_adapter *adapter_ptr)
List the files in the NVM.
Definition: ewf_adapter_renesas_common_nvm.c:38
ewf_result ewf_adapter_renesas_common_nvm_urc_callback(ewf_interface *interface_ptr, uint8_t *buffer_ptr, uint32_t buffer_length)
NVM URC callback.
Definition: ewf_adapter_renesas_common_nvm.c:16
ewf_result ewf_adapter_renesas_common_nvm_delete(ewf_adapter *adapter_ptr, const char *const filename_str, const char *index)
Delete a file from the NVM.
Definition: ewf_adapter_renesas_common_nvm.c:67
ewf_result(* ewf_adapter_tcp_receive_callback)(ewf_socket_tcp *socket_ptr, const uint8_t *buffer_ptr, uint32_t buffer_length)
A function pointer type for TCP receive callbacks.
Definition: ewf_adapter_api_tcp.h:37
ewf_result(* ewf_adapter_udp_receive_callback)(ewf_socket_udp *socket_ptr, const char *server, uint32_t port, const char *buffer, uint32_t length)
A function pointer type for TCP receive callbacks.
Definition: ewf_adapter_api_udp.h:36
#define EWF_ADAPTER_RENESAS_COMMON_INTERNET_SOCKET_POOL_SIZE
The total number of supported Internet sockets in the adapter.
Definition: ewf_adapter_renesas_common.h:70
enum _ewf_result ewf_result
Success and error result codes specific to the EWF API.
ewf_result(* ewf_interface_urc_callback)(ewf_interface *interface_ptr, uint8_t *buffer_ptr, uint32_t length)
a function pointer type for URC callbacks
Definition: ewf_interface.h:62
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_renesas_common.h:204
The Renesas adapter data structure.
Definition: ewf_adapter_renesas_common.h:220
ewf_interface_urc_callback user_urc_callback
Definition: ewf_adapter_renesas_common.h:222
volatile bool mqtt_basic_conn
Internal MQTT basic API socket 0 status
Definition: ewf_adapter_renesas_common.h:231
ewf_adapter_tcp_receive_callback tcp_receive_callback
Definition: ewf_adapter_renesas_common.h:243
ewf_adapter_udp_receive_callback udp_receive_callback
Definition: ewf_adapter_renesas_common.h:246
volatile bool module_start
Definition: ewf_adapter_renesas_common.h:240
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
The MQTT socket structure definition.
Definition: ewf_adapter_api_mqtt.h:54