Embedded Wireless Framework
ewf_adapter_simcom_sim868.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_adapter_simcom_sim868__h__included__
10 #define __ewf_adapter_simcom_sim868__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 /************************************************************************/
28 #define EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED (0)
29 #define EWF_ADAPTER_SIMCOM_SIM868_TCP_ENABLED (0)
30 #define EWF_ADAPTER_SIMCOM_SIM868_UDP_ENABLED (0)
31 #define EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED (0)
32 
33 #if !defined(EWF_ADAPTER_SIMCOM_SIM868_TLS_ENABLED) && !defined(EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED)
34 #if 1
35 #define EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED (1)
36 #define EWF_ADAPTER_SIMCOM_SIM868_TLS_ENABLED (0)
37 #else
38 #define EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED (0)
39 #define EWF_ADAPTER_SIMCOM_SIM868_TLS_ENABLED (1)
40 #endif
41 #endif
42 
43 #ifndef EWF_ADAPTER_SIMCOM_SIM868_TCP_ENABLED
44 #define EWF_ADAPTER_SIMCOM_SIM868_TCP_ENABLED (1)
45 #endif
46 
47 #ifndef EWF_ADAPTER_SIMCOM_SIM868_UDP_ENABLED
48 #define EWF_ADAPTER_SIMCOM_SIM868_UDP_ENABLED (1)
49 #endif
50 
51 #if !defined(EWF_ADAPTER_SIMCOM_SIM868_MQTT_ENABLED) && !defined(EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED)
52 #if 1
53 #define EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED (1)
54 #define EWF_ADAPTER_SIMCOM_SIM868_MQTT_ENABLED (0)
55 #else
56 #define EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED (0)
57 #define EWF_ADAPTER_SIMCOM_SIM868_MQTT_ENABLED (1)
58 #endif
59 #endif
60 
61 /************************************************************************/
64 /* Include the SIMCom common header here, to take the above configuration macros into account */
66 
67 /************************************************************************/
79 extern ewf_adapter_api_control ewf_adapter_simcom_sim868_api_control;
80 
81 ewf_result ewf_adapter_simcom_sim868_start(ewf_adapter* adapter_ptr);
82 ewf_result ewf_adapter_simcom_sim868_stop(ewf_adapter* adapter_ptr);
83 
92 ewf_result ewf_adapter_simcom_sim868_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
93 
103 #define ewf_adapter_simcom_sim868_info ewf_adapter_simcom_common_info
104 #define ewf_adapter_simcom_sim868_get_ipv4_address ewf_adapter_simcom_common_get_ipv4_address
105 #define ewf_adapter_simcom_sim868_get_ipv4_netmask ewf_adapter_simcom_common_get_ipv4_netmask
106 #define ewf_adapter_simcom_sim868_get_ipv4_gateway ewf_adapter_simcom_common_get_ipv4_gateway
107 #define ewf_adapter_simcom_sim868_get_ipv4_dns ewf_adapter_simcom_common_get_ipv4_dns
108 
112 /******************************************************************************
113  *
114  * Internal data
115  *
116  ******************************************************************************/
117 
126 {
129 
131 
140 #ifdef EWF_PARAMETER_CHECKING
141 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_HEADER(adapter_ptr) \
142 do { \
143 (adapter_ptr)->struct_magic = EWF_ADAPTER_STRUCT_MAGIC; \
144 (adapter_ptr)->struct_size = EWF_ADAPTER_STRUCT_SIZE; \
145 (adapter_ptr)->struct_version = EWF_ADAPTER_VERSION; \
146 (adapter_ptr)->struct_type = EWF_ADAPTER_TYPE_SIMCOM_SIM868; \
147 } while(0)
148 #else
149 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_HEADER(adapter_ptr)
150 #endif /* EWF_PARAMETER_CHECKING */
151 
152 #if EWF_ADAPTER_SIMCOM_SIM868_TCP_ENABLED
153 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TCP_API(adapter_ptr) \
154 do { \
155 adapter_ptr->tcp_api_ptr = &ewf_adapter_simcom_common_api_tcp; \
156 } while(0)
157 #else
158 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TCP_API(adapter_ptr)
159 #endif /* EWF_ADAPTER_SIMCOM_SIM868_TCP_ENABLED */
160 
161 #if EWF_ADAPTER_SIMCOM_SIM868_UDP_ENABLED
162 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_UDP_API(adapter_ptr) \
163 do { \
164 adapter_ptr->udp_api_ptr = &ewf_adapter_simcom_common_api_udp; \
165 } while(0)
166 #else
167 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_UDP_API(adapter_ptr)
168 #endif /* EWF_ADAPTER_SIMCOM_SIM868_UDP_ENABLED */
169 
170 #if EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED
171 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TLS_BASIC_API(adapter_ptr) \
172 do { \
173 adapter_ptr->tls_basic_api_ptr = &ewf_adapter_simcom_common_api_tls_basic; \
174 } while(0)
175 #else
176 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TLS_BASIC_API(adapter_ptr)
177 #endif /* EWF_ADAPTER_SIMCOM_SIM868_TLS_BASIC_ENABLED */
178 
179 #if EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED
180 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_MQTT_BASIC_API(adapter_ptr) \
181 do { \
182 adapter_ptr->mqtt_basic_api_ptr = &ewf_adapter_simcom_common_api_mqtt_basic; \
183 } while(0)
184 #else
185 #define EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_MQTT_BASIC_API(adapter_ptr)
186 #endif /* EWF_ADAPTER_SIMCOM_SIM868_MQTT_BASIC_ENABLED */
187 
196 #define EWF_ADAPTER_SIMCOM_SIM868_STATIC_DECLARE(adapter_ptr, adapter_name_symb, message_allocator_ptr_param, data_allocator_ptr_param, interface_ptr_param) \
197 do { \
198 static ewf_adapter_simcom_sim868 ewf_adapter_simcom_sim868__implementation__##adapter_name_symb = {0}; \
199 static ewf_adapter ewf_adapter_simcom_sim868__##adapter_name_symb = {0}; \
200 interface_ptr_param->message_allocator_ptr = message_allocator_ptr_param; \
201 interface_ptr_param->data_allocator_ptr = data_allocator_ptr_param; \
202 interface_ptr_param->urc_callback = ewf_adapter_simcom_sim868_urc_callback; \
203 ewf_adapter_simcom_sim868__##adapter_name_symb.interface_ptr = interface_ptr_param; \
204 ewf_adapter_simcom_sim868__##adapter_name_symb.implementation_ptr = &(ewf_adapter_simcom_sim868__implementation__##adapter_name_symb); \
205 adapter_ptr = &(ewf_adapter_simcom_sim868__##adapter_name_symb); \
206 interface_ptr_param->adapter_ptr = adapter_ptr; \
207 EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_HEADER(adapter_ptr); \
208 ewf_adapter_simcom_sim868__##adapter_name_symb.control_api_ptr = &ewf_adapter_simcom_sim868_api_control; \
209 ewf_adapter_simcom_sim868__##adapter_name_symb.info_api_ptr = &ewf_adapter_simcom_common_api_info; \
210 EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TCP_API(adapter_ptr); \
211 EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_UDP_API(adapter_ptr); \
212 EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_TLS_BASIC_API(adapter_ptr); \
213 EWF_ADAPTER_SIMCOM_SIM868_INITIALIZE_MQTT_BASIC_API(adapter_ptr); \
214 } while(0)
215 
218 /************************************************************************/
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif /* __ewf_adapter_simcom_sim868__h__included__ */
The Embedded Wireless Framework adapter API implementation.
The Embedded Wireless Framework modem adapter API.
The Embedded Wireless Framework SIMCom common adapter API.
The Embedded Wireless Framework host interface API.
struct _ewf_adapter_simcom_sim868 ewf_adapter_simcom_sim868
The SIMCom SIM868 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 SIMCom common adapter data structure.
Definition: ewf_adapter_simcom_common.h:33
The SIMCom SIM868 adapter data structure.
Definition: ewf_adapter_simcom_sim868.h:126
ewf_adapter_simcom_common common_implementation_data
Definition: ewf_adapter_simcom_sim868.h:128
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The interface structure definition.
Definition: ewf_interface.h:66