Embedded Wireless Framework
ewf_adapter_simcom_sim900.h
Go to the documentation of this file.
1 /************************************************************************/
9 #ifndef __ewf_adapter_simcom_sim900__h__included__
10 #define __ewf_adapter_simcom_sim900__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_SIM900_TLS_BASIC_ENABLED (0)
29 #define EWF_ADAPTER_SIMCOM_SIM900_TCP_ENABLED (0)
30 #define EWF_ADAPTER_SIMCOM_SIM900_UDP_ENABLED (0)
31 #define EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED (0)
32 
33 #if !defined(EWF_ADAPTER_SIMCOM_SIM900_TLS_ENABLED) && !defined(EWF_ADAPTER_SIMCOM_SIM900_TLS_BASIC_ENABLED)
34 #if 1
35 #define EWF_ADAPTER_SIMCOM_SIM900_TLS_BASIC_ENABLED (1)
36 #define EWF_ADAPTER_SIMCOM_SIM900_TLS_ENABLED (0)
37 #else
38 #define EWF_ADAPTER_SIMCOM_SIM900_TLS_BASIC_ENABLED (0)
39 #define EWF_ADAPTER_SIMCOM_SIM900_TLS_ENABLED (1)
40 #endif
41 #endif
42 
43 #ifndef EWF_ADAPTER_SIMCOM_SIM900_TCP_ENABLED
44 #define EWF_ADAPTER_SIMCOM_SIM900_TCP_ENABLED (1)
45 #endif
46 
47 #ifndef EWF_ADAPTER_SIMCOM_SIM900_UDP_ENABLED
48 #define EWF_ADAPTER_SIMCOM_SIM900_UDP_ENABLED (1)
49 #endif
50 
51 #if !defined(EWF_ADAPTER_SIMCOM_SIM900_MQTT_ENABLED) && !defined(EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED)
52 #if 1
53 #define EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED (1)
54 #define EWF_ADAPTER_SIMCOM_SIM900_MQTT_ENABLED (0)
55 #else
56 #define EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED (0)
57 #define EWF_ADAPTER_SIMCOM_SIM900_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_sim900_api_control;
80 
81 ewf_result ewf_adapter_simcom_sim900_start(ewf_adapter* adapter_ptr);
82 ewf_result ewf_adapter_simcom_sim900_stop(ewf_adapter* adapter_ptr);
83 
92 ewf_result ewf_adapter_simcom_sim900_urc_callback(ewf_interface* interface_ptr, uint8_t* buffer_ptr, uint32_t buffer_length);
93 
102 #define ewf_adapter_simcom_sim900_info ewf_adapter_simcom_common_info
103 #define ewf_adapter_simcom_sim900_get_ipv4_address ewf_adapter_simcom_common_get_ipv4_address
104 #define ewf_adapter_simcom_sim900_get_ipv4_netmask ewf_adapter_simcom_common_get_ipv4_netmask
105 #define ewf_adapter_simcom_sim900_get_ipv4_gateway ewf_adapter_simcom_common_get_ipv4_gateway
106 #define ewf_adapter_simcom_sim900_get_ipv4_dns ewf_adapter_simcom_common_get_ipv4_dns
107 
110 /******************************************************************************
111  *
112  * Internal data
113  *
114  ******************************************************************************/
115 
124 {
127 
129 
138 #ifdef EWF_PARAMETER_CHECKING
139 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_HEADER(adapter_ptr) \
140 do { \
141 (adapter_ptr)->struct_magic = EWF_ADAPTER_STRUCT_MAGIC; \
142 (adapter_ptr)->struct_size = EWF_ADAPTER_STRUCT_SIZE; \
143 (adapter_ptr)->struct_version = EWF_ADAPTER_VERSION; \
144 (adapter_ptr)->struct_type = EWF_ADAPTER_TYPE_SIMCOM_SIM900; \
145 } while(0)
146 #else
147 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_HEADER(adapter_ptr)
148 #endif /* EWF_PARAMETER_CHECKING */
149 
150 #if EWF_ADAPTER_SIMCOM_SIM900_TCP_ENABLED
151 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TCP_API(adapter_ptr) \
152 do { \
153 adapter_ptr->tcp_api_ptr = &ewf_adapter_simcom_common_api_tcp; \
154 } while(0)
155 #else
156 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TCP_API(adapter_ptr)
157 #endif /* EWF_ADAPTER_SIMCOM_SIM900_TCP_ENABLED */
158 
159 #if EWF_ADAPTER_SIMCOM_SIM900_UDP_ENABLED
160 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_UDP_API(adapter_ptr) \
161 do { \
162 adapter_ptr->udp_api_ptr = &ewf_adapter_simcom_common_api_udp; \
163 } while(0)
164 #else
165 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_UDP_API(adapter_ptr)
166 #endif /* EWF_ADAPTER_SIMCOM_SIM900_UDP_ENABLED */
167 
168 #if EWF_ADAPTER_SIMCOM_SIM900_TLS_BASIC_ENABLED
169 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TLS_BASIC_API(adapter_ptr) \
170 do { \
171 adapter_ptr->tls_basic_api_ptr = &ewf_adapter_simcom_common_api_tls_basic; \
172 } while(0)
173 #else
174 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TLS_BASIC_API(adapter_ptr)
175 #endif /* EWF_ADAPTER_SIMCOM_SIM900_TLS_BASIC_ENABLED */
176 
177 #if EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED
178 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_MQTT_BASIC_API(adapter_ptr) \
179 do { \
180 adapter_ptr->mqtt_basic_api_ptr = &ewf_adapter_simcom_common_api_mqtt_basic; \
181 } while(0)
182 #else
183 #define EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_MQTT_BASIC_API(adapter_ptr)
184 #endif /* EWF_ADAPTER_SIMCOM_SIM900_MQTT_BASIC_ENABLED */
185 
194 #define EWF_ADAPTER_SIMCOM_SIM900_STATIC_DECLARE(adapter_ptr, adapter_name_symb, message_allocator_ptr_param, data_allocator_ptr_param, interface_ptr_param) \
195 do { \
196 static ewf_adapter_simcom_sim900 ewf_adapter_simcom_sim900__implementation__##adapter_name_symb = {0}; \
197 static ewf_adapter ewf_adapter_simcom_sim900__##adapter_name_symb = {0}; \
198 interface_ptr_param->message_allocator_ptr = message_allocator_ptr_param; \
199 interface_ptr_param->data_allocator_ptr = data_allocator_ptr_param; \
200 interface_ptr_param->urc_callback = ewf_adapter_simcom_sim900_urc_callback; \
201 ewf_adapter_simcom_sim900__##adapter_name_symb.interface_ptr = interface_ptr_param; \
202 ewf_adapter_simcom_sim900__##adapter_name_symb.implementation_ptr = &(ewf_adapter_simcom_sim900__implementation__##adapter_name_symb); \
203 adapter_ptr = &(ewf_adapter_simcom_sim900__##adapter_name_symb); \
204 interface_ptr_param->adapter_ptr = adapter_ptr; \
205 EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_HEADER(adapter_ptr); \
206 ewf_adapter_simcom_sim900__##adapter_name_symb.control_api_ptr = &ewf_adapter_simcom_sim900_api_control; \
207 ewf_adapter_simcom_sim900__##adapter_name_symb.info_api_ptr = &ewf_adapter_simcom_common_api_info; \
208 EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TCP_API(adapter_ptr); \
209 EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_UDP_API(adapter_ptr); \
210 EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_TLS_BASIC_API(adapter_ptr); \
211 EWF_ADAPTER_SIMCOM_SIM900_INITIALIZE_MQTT_BASIC_API(adapter_ptr); \
212 } while(0)
213 
216 /************************************************************************/
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif /* __ewf_adapter_simcom_sim900__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_sim900 ewf_adapter_simcom_sim900
The SIMCom SIM900 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 SIM900 adapter data structure.
Definition: ewf_adapter_simcom_sim900.h:124
ewf_adapter_simcom_common common_implementation_data
Definition: ewf_adapter_simcom_sim900.h:126
The EWF network adapter control structure definition.
Definition: ewf_adapter.h:50
The interface structure definition.
Definition: ewf_interface.h:66