]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Driver/src/Driver_WiFi.c
Updated CMSIS WiFi Interface API (header and documentation)
[cmsis] / CMSIS / DoxyGen / Driver / src / Driver_WiFi.c
1 /**
2 \defgroup wifi_interface_gr WiFi Interface
3 \brief Driver API for WiFi (%Driver_WiFi.h)
4 \details 
5
6 Wi-Fi is technology for radio wireless local area networking of devices. Wi-Fi compatible devices typically
7 connect to the Internet via a WLAN and a wireless access point (AP) also called hotspot.
8
9 Wikipedia offers more information about 
10 the <a href="http://en.wikipedia.org/wiki/Ethernet" target="_blank"><b>WiFi</b></a>.
11
12 <b>Driver Block Diagram</b>
13
14 \image html WiFi.png  "Block Diagram of the WiFi interface"
15
16 <b>WiFi API</b>
17
18 The following header files define the Application Programming Interface (API) for the WiFi interface:
19   - \b %Driver_WiFi.h : Driver API for WiFi
20
21 The CMSIS-Driver WiFi provides access to the following interfaces:
22
23  - \ref wifi_control_gr "Control interface": setup and control the WiFi module.
24  - \ref wifi_management_gr "Management interface": allows you to configure and manage the connection
25    to the WiFi access point (AP) or configure and manage the access point (AP).
26  - \ref wifi_socket_gr "Socket interface": provides the interface to an IP stack that is running
27    on the WiFi module. This IP stack handles data communication.
28  - \ref wifi_bypass_gr "Bypass interface": is an optional interface and enables the transmission of
29    Ethernet frames with the WiFi module. Using this interface requires the IP stack running on the microcontroller.
30
31 The WiFi interface usually requires CMSIS-RTOS features (i.e. mutex) and is often implemented
32 with a peripheral device that is connected to the system using the SPI or UART interface. However,
33 there are also some microcontroller devices with WiFi interface on the chip.
34
35 The implementation of the WiFi CMSIS-Driver is therefore generally provided as a separate software pack.
36 It is often implemented as wrapper to the SDK (Software Development Kit) of the WiFi chipset.
37
38
39 <b>Driver Functions</b>
40
41 The driver functions are published in the access struct as explained in \ref DriverFunctions
42   - \ref ARM_DRIVER_WIFI : access struct for WiFi driver functions
43
44
45 <b>Example Code</b>
46
47 @{
48 */
49
50 /**
51 \struct  ARM_DRIVER_WIFI
52 \details 
53 The functions of the WiFi driver are accessed by function pointers exposed by this structure.
54 Refer to \ref DriverFunctions for overview information.
55
56 Each instance of a WiFi interface provides such an access structure. 
57 The instance is identified by a postfix number in the symbol name of the access structure, for example:
58  - \b Driver_WiFi0 is the name of the access struct of the first instance (no. \token{0}).
59  - \b Driver_WiFi1 is the name of the access struct of the second instance (no. \token{1}).
60
61 A middleware configuration setting allows connecting the middleware to a specific driver instance \b %Driver_WiFi<i>n</i>.
62 The default is \token{0}, which connects a middleware to the first instance of a driver.
63 *******************************************************************************************************************/
64
65
66 /**
67 \defgroup wifi_control_gr WiFi Control
68 \ingroup wifi_interface_gr
69 \brief Control functions for the WiFi module
70 \details  
71 The \ref wifi_control_gr functions setup and control the WiFi module.
72 @{
73 */
74
75 /** 
76 \struct  ARM_WIFI_CAPABILITIES
77 \details
78 A WiFi driver can be implemented with different capabilities.
79 The data fields of this structure encode the capabilities implemented by this driver.
80
81 <b>Returned by:</b>
82   - \ref ARM_WIFI_GetCapabilities
83 *******************************************************************************************************************/
84
85 /**
86 \typedef ARM_WIFI_SignalEvent_t
87 \details
88 Provides the typedef for the callback function \ref ARM_WIFI_SignalEvent.
89
90 <b>Parameter for:</b>
91   - \ref ARM_WIFI_Initialize
92 *******************************************************************************************************************/
93
94 /**
95 \defgroup wifi_event WiFi Events
96 \ingroup wifi_control_gr
97 \brief The WiFi driver generates call back events that are notified via the function \ref ARM_WIFI_SignalEvent.
98 \details The following call back notification events are generated:
99 @{
100 \def ARM_WIFI_EVENT_AP_CONNECT
101 \def ARM_WIFI_EVENT_AP_DISCONNECT
102 \def ARM_WIFI_EVENT_ETH_RX_FRAME
103 @}
104 */
105
106 ARM_DRIVER_VERSION ARM_WIFI_GetVersion (void) {
107   return { 0, 0 };
108 }
109 /**
110 \fn ARM_DRIVER_VERSION ARM_WIFI_GetVersion (void)
111 \details
112 The function \b ARM_WIFI_GetVersion returns version information of the driver implementation in \ref ARM_DRIVER_VERSION.
113
114 API version is the version of the CMSIS-Driver specification used to implement this driver.
115 Driver version is source code version of the actual driver implementation.
116
117 \b Example:
118 \code
119 extern ARM_DRIVER_WIFI Driver_WiFi0;
120 static ARM_DRIVER_WIFI *wifi;
121  
122 void get_wifi_version (void)  {
123   ARM_DRIVER_VERSION version;
124  
125   wifi= &Driver_WiFi0;  
126   version = wifi->GetVersion ();
127   if (version.api < 0x100U) {        // requires at minimum API version 1.0 or higher
128     // error handling
129     return;
130   }
131 }
132 \endcode
133 */
134
135 ARM_WIFI_CAPABILITIES ARM_WIFI_GetCapabilities (void) {
136   return { 0 };
137 }
138 /**
139 \fn ARM_WIFI_CAPABILITIES ARM_WIFI_GetCapabilities (void)
140 \details
141 The function \b ARM_WIFI_GetCapabilities retrieves information about capabilities in this driver implementation.
142 The data fields of the struct \ref ARM_WIFI_CAPABILITIES encode various capabilities, for example
143 if a WiFi module supports the Access Point mode or the bypass mode, or is capable to signal events using
144 the \ref ARM_WIFI_SignalEvent callback function.
145
146 \b Example:
147 \code
148 extern ARM_DRIVER_WIFI Driver_WiFi0;
149 static ARM_DRIVER_WIFI *wifi;
150   
151 void get_wifi_capabilities (void)  {
152   ARM_WIFI_CAPABILITIES capabilities;
153  
154   wifi = &Driver_WiFi0;  
155   capabilities = wifi->GetCapabilities ();
156   // interrogate capabilities
157    :
158 }
159 \endcode
160 */
161
162 int32_t ARM_WIFI_Initialize (ARM_WIFI_SignalEvent_t cb_event) {
163   return ARM_DRIVER_OK;
164 }
165 /**
166 \fn int32_t ARM_WIFI_Initialize (ARM_WIFI_SignalEvent_t cb_event)
167 \details
168 The function \b ARM_WIFI_Initialize initializes the WiFi module.
169
170 It is called when the middleware component starts operation.
171
172 The \ref ARM_WIFI_Initialize function performs the following operations:
173   - Initializes the resources and peripherals required for the WiFi module.
174   - Registers the \ref ARM_WIFI_SignalEvent callback function.
175
176 The parameter \em cb_event is a pointer to the \ref ARM_WIFI_SignalEvent callback function;
177 use a \token{NULL} pointer when no callback signals are required.
178
179 \b Example:
180 \code
181 extern ARM_DRIVER_WIFI Driver_WiFi0;
182 static ARM_DRIVER_WIFI *wifi;
183 static ARM_ETH_MAC_ADDR own_mac_address;
184  
185 void initialize_wifi (void) {
186   wifi = &Driver_WiFi0;
187  
188   // Initialize and Power-on WiFi Module
189   wifi->Initialize (NULL);
190   wifi->PowerControl (ARM_POWER_FULL);
191  
192   // Populate own_mac_address with the address to use
193   wifi->SetOption(ARM_WIFI_MAC, &own_mac_address, 6U);
194 }
195 \endcode
196 */
197
198 int32_t ARM_WIFI_Uninitialize (void) {
199   return ARM_DRIVER_OK;
200 }
201 /**
202 \fn int32_t ARM_WIFI_Uninitialize (void)
203 \details
204 The function \b ARM_WIFI_Uninitialize de-initializes the resources of the WiFi module.
205
206 It is called when the middleware component stops operation and releases the software resources 
207 used by the module.
208
209 \b Example:
210 \code
211 extern ARM_DRIVER_WIFI Driver_WiFi0;
212 static ARM_DRIVER_WIFI *wifi;
213  
214 void uninitialize_wifi (void) {
215   wifi = &Driver_WiFi0;
216  
217   // Power off and De-initialize WiFi Module
218   wifi->PowerControl (ARM_POWER_OFF);
219   wifi->Uninitialize ();
220 }
221 \endcode
222 */
223
224 int32_t ARM_WIFI_PowerControl (ARM_POWER_STATE state) {
225   return ARM_DRIVER_OK;
226 }
227 /**
228 \fn int32_t ARM_WIFI_PowerControl (ARM_POWER_STATE state)
229 \details
230 The function \b ARM_WIFI_PowerControl allows you to configure the power modes of the WiFi module.
231
232 The parameter \em state specifies the \ref ARM_POWER_STATE.
233
234 Low-power mode depends on additional options set by \ref ARM_WIFI_SetOption :
235  - Deep-sleep mode is entered when \ref ARM_WIFI_LP_TIMER option is set to a value different than 0
236  - Sleep mode is entered otherwise
237
238 \b Deep-sleep mode (only for station):
239 Module turns off the radio and also internal CPU thus reducing power consumption to minimum,
240 only the timer is running that wakes-up the module after specified time.
241 When timer expires the module reconnects to the access point.
242
243 This mode is used when power consumption is a priority (battery powered devices) and when WiFi
244 is used in short intervals that do not occur very often
245 (example: sending a temperature from a sensor to a cloud every 10 seconds).
246
247 \b Sleep mode (only for station):
248 Module reduces power consumption by going into sleep and waking up periodically to listen for beacons.
249
250 Delivery Traffic Indication Message (DTIM) interval can be configured with option \ref ARM_WIFI_DTIM
251 (station and access point) and beacon interval with option \ref ARM_WIFI_BEACON (only for access point).
252
253 Default module intervals are used when those options are not explicitly set.
254
255 If power \em state specifies an unsupported mode, the function returns \ref ARM_DRIVER_ERROR_UNSUPPORTED as
256 status information and the previous power state of the peripheral is unchanged. Multiple calls with the same
257 \em state generate no error.
258
259 \b Example:
260  - see \ref ARM_WIFI_Initialize
261  - see \ref ARM_WIFI_Uninitialize
262 */
263
264 int32_t ARM_WIFI_GetModuleInfo (char *module_info, uint32_t max_len) {
265   return ARM_DRIVER_OK;
266 }
267 /**
268 \fn int32_t ARM_WIFI_GetModuleInfo (char *module_info, uint32_t max_len)
269 \details
270 The function \b ARM_WIFI_GetModuleInfo retrieves string containing information about the WiFi module.
271
272 The information might include module name, firmware version, ...
273
274 \note Module must be initialized and powered before module information can be retrieved.
275
276 \b Example:
277 \code
278 extern ARM_DRIVER_WIFI Driver_WiFi0;
279 static ARM_DRIVER_WIFI *wifi;
280  
281 void initialize_wifi (void) {
282   char info[32];
283  
284   wifi = &Driver_WiFi0;
285  
286   // Initialize and Power-on WiFi Module
287   wifi->Initialize (NULL);
288   wifi->PowerControl (ARM_POWER_FULL);
289  
290   // Retrieve module information
291   wifi->GetModuleInfo(&info, sizeof(info));
292 }
293 \endcode
294 */
295
296 void ARM_WIFI_SignalEvent (uint32_t event, void *arg) {
297 }
298 /**
299 \fn void ARM_WIFI_SignalEvent (uint32_t event, void *arg)
300 \details
301 The function \b ARM_WIFI_SignalEvent is a callback function registered by the function \ref ARM_WIFI_Initialize.
302 It is called by the WiFi driver to notify the application about WiFi Events occurred during operation.
303
304 The parameter \em event indicates the event that occurred during driver operation.
305
306 The parameter \em arg provides additional information about the event.
307
308 The following events can be generated:
309
310 Parameter \em event                  | Description
311 :------------------------------------|:------------------------------------------
312 \ref ARM_WIFI_EVENT_AP_CONNECT       | Occurs in access point mode when a station has connected to the access point.
313 \ref ARM_WIFI_EVENT_AP_DISCONNECT    | Occurs in access point mode when a station has disconnected from the access point.
314 \ref ARM_WIFI_EVENT_ETH_RX_FRAME     | Occurs in \ref wifi_bypass_gr when an ethernet frame is received.
315 */
316
317 /**
318 @}
319 */
320 // end group wifi_control_gr
321
322
323 /**
324 \defgroup wifi_management_gr WiFi Management
325 \ingroup wifi_interface_gr
326 \brief Configure and manage the connection to a WiFi access point (AP) or configure and manage the access point (AP).
327 \details The \ref wifi_management_gr functions are used to configure and manage the connection to a WiFi access point (AP)
328 also called hotspot when in station mode. They are also used to configure and manage the access point (AP) itself
329 when in access point mode.
330 @{
331 */
332
333 /**
334 \defgroup WiFi_option WiFi Option Codes
335 \ingroup wifi_management_gr
336 \brief  WiFi Option Codes for \ref ARM_WIFI_SetOption or \ref ARM_WIFI_GetOption function.
337 \details 
338 Many parameters of the WiFi module are configured using the \ref ARM_WIFI_SetOption or \ref ARM_WIFI_GetOption function.
339 @{
340 \def ARM_WIFI_BSSID
341 \details Specifies the BSSID of the access point to connect or the access point itself.
342 \sa WiFi_option
343 \def ARM_WIFI_TX_POWER
344 \details Specifies the transmit power in dBm.
345 \sa WiFi_option
346 \def ARM_WIFI_LP_TIMER
347 \details Specifies the low-power deep-sleep time in seconds for station (disabled when 0 - default).
348 \sa WiFi_option
349 \def ARM_WIFI_DTIM
350 \details Specifies the DTIM interval in number of beacons.
351 \sa WiFi_option
352 \def ARM_WIFI_BEACON
353 \details Specifies the beacon interval in milliseconds for access point.
354 \sa WiFi_option
355 \def ARM_WIFI_MAC
356 \details Specifies the MAC address.
357 \sa WiFi_option
358 \def ARM_WIFI_IP
359 \details Specifies the IP address.
360 \sa WiFi_option
361 \def ARM_WIFI_IP_SUBNET_MASK
362 \details Specifies the subnet mask.
363 \sa WiFi_option
364 \def ARM_WIFI_IP_GATEWAY
365 \details Specifies the gateway IP address.
366 \sa WiFi_option
367 \def ARM_WIFI_IP_DNS1
368 \details Specifies the IP address of the primary DNS server.
369 \sa WiFi_option
370 \def ARM_WIFI_IP_DNS2
371 \details Specifies the IP address of the secondary DNS server.
372 \sa WiFi_option
373 \def ARM_WIFI_IP_DHCP
374 \details Enables or disables the DHCP client for station or DHCP server for access point.
375 \sa WiFi_option
376 \def ARM_WIFI_IP_DHCP_POOL_BEGIN
377 \details Specifies the start IP address for DHCP server (access point).
378 \sa WiFi_option
379 \def ARM_WIFI_IP_DHCP_POOL_END
380 \details Specifies the end IP address for DHCP server (access point).
381 \sa WiFi_option
382 \def ARM_WIFI_IP_DHCP_LEASE_TIME
383 \details Specifies the lease time for DHCP server (access point).
384 \sa WiFi_option
385 \def ARM_WIFI_IP6_GLOBAL
386 \details Specifies the global IPv6 address.
387 \sa WiFi_option
388 \def ARM_WIFI_IP6_LINK_LOCAL
389 \details Specifies the link-local IPv6 address.
390 \sa WiFi_option
391 \def ARM_WIFI_IP6_SUBNET_PREFIX_LEN
392 \details Specifies the address prefix length.
393 \sa WiFi_option
394 \def ARM_WIFI_IP6_GATEWAY
395 \details Specifies the gateway IPv6 address.
396 \sa WiFi_option
397 \def ARM_WIFI_IP6_DNS1
398 \details Specifies the IPv6 address of the primary DNS server.
399 \sa WiFi_option
400 \def ARM_WIFI_IP6_DNS2
401 \details Specifies the IPv6 address of the secondary DNS server.
402 \sa WiFi_option
403 \def ARM_WIFI_IP6_DHCP_MODE
404 \details Specifies the operation mode of the DHCPv6 client.
405 \sa WiFi_option
406 @}
407 */
408
409 /**
410 \defgroup wifi_oper_mode WiFi Operating Mode
411 \ingroup wifi_management_gr
412 \brief Specifies WiFi operation for \ref ARM_WIFI_Activate.
413 \details
414 The WiFi operation mode defines in which mode the WiFi module operates when activated.
415 @{
416 \def ARM_WIFI_MODE_NONE
417 \details WiFi module is inactive (default).
418 \sa wifi_oper_mode
419 \def ARM_WIFI_MODE_STATION
420 \details WiFi module operates in station mode.
421 \sa wifi_oper_mode
422 \def ARM_WIFI_MODE_AP
423 \details WiFi module operates in access point mode.
424 \sa wifi_oper_mode
425 \def ARM_WIFI_MODE_STATION_AP
426 \details WiFi module operates in station mode and access point mode simultaneously.
427 \sa wifi_oper_mode
428 \def ARM_WIFI_MODE_AD_HOC
429 \details WiFi module operates in WiFi Ad-hoc mode.
430 \sa wifi_oper_mode
431 @}
432 */
433
434 /**
435 \defgroup wifi_sec_type WiFi Security Type
436 \ingroup wifi_management_gr
437 \brief Specifies WiFi security type for \ref ARM_WIFI_Configure.
438 \details
439 The WiFi security type defines the standard used to protect the wireless network from unauthorized access.
440 @{
441 \def ARM_WIFI_SECURITY_OPEN
442 \details This is an open system which provides \b no security.
443 \sa wifi_sec_type
444 \def ARM_WIFI_SECURITY_WEP
445 \details This security standard provides \b weak level of security.
446 \sa wifi_sec_type
447 \def ARM_WIFI_SECURITY_WPA
448 \details This security standard provides \b medium level of security.
449 \sa wifi_sec_type
450 \def ARM_WIFI_SECURITY_WPA2
451 \details This security standard provides \b strong level of security.
452 \sa wifi_sec_type
453 \def ARM_WIFI_SECURITY_UNKNOWN
454 \details Unknown security standard (reported by \ref ARM_WIFI_Scan).
455 \sa wifi_sec_type
456 @}
457 */
458
459 /**
460 \defgroup wifi_wps_method WiFi Protected Setup (WPS) Method
461 \ingroup wifi_management_gr
462 \brief Specifies WiFi WPS method for \ref ARM_WIFI_Configure.
463 \details
464 The WiFi WPS method defines which WPS method is used.
465 @{
466 \def ARM_WIFI_WPS_METHOD_NONE
467 \details WPS not used.
468 \sa wifi_wps_method
469 \def ARM_WIFI_WPS_METHOD_PBC
470 \details WPS with Push Button Configuration.
471 \sa wifi_wps_method
472 \def ARM_WIFI_WPS_METHOD_PIN
473 \details WPS with PIN.
474 \sa wifi_wps_method
475 @}
476 */
477
478 /**
479 \defgroup wifi_dhcp_v6_mode WiFi DHCPv6 Mode
480 \ingroup wifi_management_gr
481 \brief Specifies IPv6 Dynamic Host Configuration Protocol (DHCP) Mode.
482 \details
483 The WiFi DHCPv6 mode defines the DHCP mode in IPv6.
484 @{
485 \def ARM_WIFI_IP6_DHCP_OFF
486 \details
487 In the static host configuration mode, the IPv6 address, the default gateway address,
488 and the addresses of DNS servers are statically configured from the preset values.
489 \sa wifi_dhcp_v6_mode
490 \def ARM_WIFI_IP6_DHCP_STATELESS
491 \details
492 In the stateless DHCP configuration mode, the client obtains only extended information
493 from a DHCPv6 server, such as DNS server addresses. Stateless autoconfiguration of
494 IPv6 allows the client device to self configure it's IPv6 addresses and routing based
495 on the router advertisements.
496 \sa wifi_dhcp_v6_mode
497 \def ARM_WIFI_IP6_DHCP_STATEFULL
498 \details
499 In the stateful DHCP configuration mode, the client connects to a DHCPv6 server for
500 a leased IPv6 address and DNS server addresses.
501 \sa wifi_dhcp_v6_mode
502 @}
503 */
504
505 /**
506 \struct  ARM_WIFI_CONFIG_t
507 \details
508 Provides information needed to connect to the WiFi network for station or how to configure the access point (AP).
509
510 <b>Used in:</b>
511   - \ref ARM_WIFI_Configure
512 *******************************************************************************************************************/
513
514 /**
515 \struct  ARM_WIFI_SCAN_INFO_t
516 \details
517 Provides information about the wireless networks that were detected when searching for available WiFi networks. The structure
518 contains the information needed to connect to the WiFi network. Of course, the access password is not included and must
519 be provided separately.
520
521 <b>Used in:</b>
522   - \ref ARM_WIFI_Scan
523 *******************************************************************************************************************/
524
525 /**
526 \struct  ARM_WIFI_NET_INFO_t
527 \details
528 Provides information about the network that the station is connected to.
529
530 <b>Used in:</b>
531   - \ref ARM_WIFI_GetNetInfo
532 *******************************************************************************************************************/
533
534 int32_t ARM_WIFI_SetOption (uint32_t interface, uint32_t option, const void *data, uint32_t len) {
535   return ARM_DRIVER_OK;
536 }
537 /**
538 \fn int32_t ARM_WIFI_SetOption (uint32_t interface, uint32_t option, const void *data, uint32_t len)
539 \details
540 The function \b ARM_WIFI_SetOption sets the value of the specified option of the WiFi module.
541
542 The argument \em interface specifies the interface (0 = Station, 1 = Access Point).
543
544 The argument \em option specifies the option that is to be set (see below).
545
546 The argument \em data points to a buffer containing the value of the option to be set
547 and must be aligned to the data type of the corresponding option.
548
549 The argument \em len specifies the length of the buffer \em data and must be equal (or higher)
550 to the length of the corresponding option.
551  
552 Option                                 | Description                            | Data          | Type/Length
553 :--------------------------------------|:---------------------------------------|:--------------|:-----------
554 \ref ARM_WIFI_BSSID                    | BSSID of AP to connect or AP           | bssid         | uint8_t[6]
555 \ref ARM_WIFI_TX_POWER                 | Transmit power                         | power[dbm]    | uint32_t
556 \ref ARM_WIFI_LP_TIMER                 | Low-power deep-sleep time              | time[seconds] | uint32_t
557 \ref ARM_WIFI_DTIM                     | DTIM interval                          | dtim[beacons] | uint32_t
558 \ref ARM_WIFI_BEACON                   | Beacon interval                        | interval[ms]  | uint32_t
559 \ref ARM_WIFI_MAC                      | MAC address                            | mac           | uint8_t[6]
560 \ref ARM_WIFI_IP                       | IPv4 address                           | ip            | uint8_t[4]
561 \ref ARM_WIFI_IP_SUBNET_MASK           | IPv4 subnet mask                       | mask          | uint8_t[4]
562 \ref ARM_WIFI_IP_GATEWAY               | IPv4 gateway address                   | ip            | uint8_t[4]
563 \ref ARM_WIFI_IP_DNS1                  | IPv4 primary DNS server address        | ip            | uint8_t[4]
564 \ref ARM_WIFI_IP_DNS2                  | IPv4 secondary DNS server address      | ip            | uint8_t[4]
565 \ref ARM_WIFI_IP_DHCP                  | IPv4 DHCP client/server enable/disable | dhcp (0, 1)   | uint32_t
566 \ref ARM_WIFI_IP_DHCP_POOL_BEGIN       | IPv4 DHCP server begin address         | ip            | uint8_t[4]
567 \ref ARM_WIFI_IP_DHCP_POOL_END         | IPv4 DHCP server end address           | ip            | uint8_t[4]
568 \ref ARM_WIFI_IP_DHCP_LEASE_TIME       | IPv4 DHCP server lease time            | time[seconds] | uint32_t
569 \ref ARM_WIFI_IP6_GLOBAL               | IPv6 global address                    | ip6           | uint8_t[16]
570 \ref ARM_WIFI_IP6_LINK_LOCAL           | IPv6 link-local address                | ip6           | uint8_t[16]
571 \ref ARM_WIFI_IP6_SUBNET_PREFIX_LEN    | IPv6 subnet prefix length              | len (1..127)  | uint32_t
572 \ref ARM_WIFI_IP6_GATEWAY              | IPv6 gateway address                   | ip6           | uint8_t[16]
573 \ref ARM_WIFI_IP6_DNS1                 | IPv6 primary DNS server address        | ip6           | uint8_t[16]
574 \ref ARM_WIFI_IP6_DNS2                 | IPv6 secondary DNS server address      | ip6           | uint8_t[16]
575 \ref ARM_WIFI_IP6_DHCP_MODE            | IPv6 DHCP client mode                  | mode          | uint32_t
576
577 \b Example:
578 \code
579 uint8_t ip[4];
580  
581 ip[0] = 192U;
582 ip[1] = 168U;
583 ip[2] = 0U;
584 ip[3] = 1U;
585  
586 // Set IP static address
587 wifi->SetOption (ARM_WIFI_IP, &ip, sizeof(ip));
588 \endcode
589 */
590
591 int32_t ARM_WIFI_GetOption (uint32_t interface, uint32_t option, void *data, uint32_t *len) {
592   return ARM_DRIVER_OK;
593 }
594 /**
595 \fn int32_t ARM_WIFI_GetOption (uint32_t interface, uint32_t option, void *data, uint32_t *len)
596 \details
597 The function \b ARM_WIFI_GetOption retrieves the current value of the specified option of
598 the WiFi module.
599
600 The argument \em interface specifies the interface (0 = Station, 1 = Access Point).
601
602 The argument \em option specifies the option that is to be retrieved (see \ref ARM_WIFI_SetOption).
603
604 The argument \em data points to a buffer that will be used to store the value of 
605 the \em option and must be aligned to the data type of the corresponding option.
606
607 The argument \em len is a pointer to the length of the buffer at input and returns the length
608 of the option information on the output.
609
610 \b Example:
611 \code
612 uint8_t ip[4];          // IP address
613 uint8_t mask[4];        // Subnet mask
614 uint8_t gateway[4];     // Gateway address
615  
616 // Get IP address, Subnet mask and Gateway address
617 wifi->GetOption (ARM_WIFI_IP, &ip, sizeof(ip));
618 wifi->GetOption (ARM_WIFI_IP_SUBNET_MASK, &mask, sizeof(mask));
619 wifi->GetOption (ARM_WIFI_IP_GATEWAY, &gateway, sizeof(gateway));
620 \endcode
621 */
622
623 int32_t ARM_WIFI_Scan (ARM_WIFI_SCAN_INFO_t scan_info[], uint32_t max_num) {
624   return ARM_DRIVER_OK;
625 }
626 /**
627 \fn int32_t ARM_WIFI_Scan (ARM_WIFI_SCAN_INFO_t scan_info[], uint32_t max_num)
628 \details
629 The function \b ARM_WIFI_Scan searches for available WiFi networks. Using this function,
630 you can determine which wireless networks are available for the connection. If the network is
631 secured, you must also know the password for access so you can connect.
632  
633 The argument \em ap_info is a pointer to a buffer, where the available network information
634 will be returned.
635
636 The argument \em max_mum specifies maximum number of network information structures,
637 that can be stored to the \em ap_info.
638
639 \b Example:
640 \code
641 ARM_WIFI_AP_INFO_t ap_info[8];
642  
643 num = wifi->Scan (ap_info, 8U);
644  
645 // Print SSIDs of available WiFi networks
646 for (i = 0; i < num; i++) {
647   printf ("%d. ssid=%s\n", i, ap_info[i].ssid);
648 }
649 \endcode
650 */
651
652 int32_t ARM_WIFI_Configure (uint32_t interface, ARM_WIFI_CONFIG_t *config) {
653   return ARM_DRIVER_OK;
654 }
655 /**
656 \fn int32_t ARM_WIFI_Configure (uint32_t interface, ARM_WIFI_CONFIG_t *config)
657 \details
658 The function \b ARM_WIFI_Confiure configures the specified interface.
659
660 The argument \em interface specifies the interface (0 = Station, 1 = Access Point).
661
662 The argument \em config is a pointer to the configuration \ref ARM_WIFI_CONFIG_t
663 which provides information needed to connect to a WiFi network in station mode
664 or information used to configure the access point (AP) in access point mode.
665
666 \em ssid specifies the name of the network to connect to or the network to create.
667
668 \em pass specifies the password for accessing the wireless network.
669
670 \em security specifies the security type which will be used for the connection.
671
672 \em ch specifies the WiFi channel which will be used for the connection.
673 Valid channels are from \token{1} to \token{13}. If the value for \em ch = \token{0},
674 the system automatically selects the channel.
675 When in station mode the channel of the AP being connect to is used.
676 when in access point mode the AP automatically selects the best channel
677 for the WiFi connection.
678
679 \note
680 Optionally BSSID parameter can be also set using \ref ARM_WIFI_SetOption.
681 It allows connection to specific BSSID when connecting to an access point or specifies
682 the BSSID of the access point.
683
684 \em wps_method specifies if WiFi Protected Setup (WPS) is used and which method.
685
686 \em wps_pin specifies the PIN used with WPS (\ref ARM_WIFI_WPS_METHOD_PIN).
687
688 With the \b push-button method, you typically press the button, either real or virtual,
689 both at the access point and the station. No credentials are needed.
690
691 With \b PIN method, you must provide the PIN code that you read from the label or screen
692 on the wireless device, in the access point.
693
694 WPS configuration for station is used when station is activated and connects to an access point.
695 It enables to connect without specifying SSID, Password, Security Type or WiFi Channel.
696 The actual network information can be retrieved once connected with \ref ARM_WIFI_GetNetInfo.
697
698 WPS configuration for access point is used when access point is activated (\ref ARM_WIFI_Activate).
699 Subsequent activate calls re-trigger the WPS procedure.
700
701 \note
702 WPS is typically activated by pressing the WPS button at the access point.
703 During the discovery mode (usually 2 minutes or less) any wireless device may connect
704 to the access point (PIN needs to match when PIN method is selected).
705
706 \b Example:
707 \code
708 ARM_WIFI_CONFIG_t wifi_config;
709  
710 wifi_config.ssid = "GuestAccess";
711 wifi_config.pass = "guest";
712 wifi_config.security = ARM_WIFI_SECURITY_WPA2;
713 wifi_config.ch = 0U;
714 wifi_config.wps_method = ARM_WIFI_WPS_METHOD_NONE;
715  
716 // Configure station
717 status = wifi->Configure (0U, &wifi_config);
718 if (status != ARM_DRIVER_OK) {
719   // error handling
720 }
721  
722 // Connect to wireless network
723 status = wifi->Activate (ARM_WIFI_MODE_STATION);
724 if (status != ARM_DRIVER_OK) {
725   // error handling
726 }
727 \endcode
728 */
729
730 int32_t ARM_WIFI_Activate (uint32_t mode) {
731   return ARM_DRIVER_OK;
732 }
733 /**
734 \fn int32_t ARM_WIFI_Activate (uint32_t mode)
735 \details
736 The function \b ARM_WIFI_Activate activates the specified mode of the WiFi module.
737
738 The argument \em mode specifies which mode will be activated:
739  - Station mode: connect to a wireless network
740  - Access Point mode: activate access point
741  - Station and Access point mode: connect to a wireless network and activate access point 
742  - Ad-hoc mode: connect to or create a wireless network
743
744 The WiFi Station or Access Point needs to be configured before activating.
745
746 The function returns once the mode is activated:
747  - when station is connected to a wireless network  (Station mode)
748  - when access point is activated (Access Point mode)
749  - when station is connected and access point is activated (Station and Access point mode)
750  - when station is connected or access point is activated (Ad-hoc mode)
751
752 When in station mode the wireless network trying to connect to must be available,
753 otherwise the connection will fail after a timeout.
754
755 Available wireless networks can be scaned by using the function \ref ARM_WIFI_Scan.
756
757 \b Ad-hoc mode is very similar to standard infrastructure mode with a difference that there
758 are no dedicated access points in the network but a device can temporarily offer access point
759 functionality as Soft-AP (no routing capabilities) to other devices in its vicinity.
760
761 When in Ad-hoc mode the module tries to connect to network with specified SSID.
762 If there is no such network available the module becomes a Soft-AP with BSSID being
763 randomly generated (BSSID can be retrieved by using \ref ARM_WIFI_GetOption).
764
765 \b Example:
766  - see \ref ARM_WIFI_Initialize
767 */
768
769 int32_t ARM_WIFI_Deactivate (void) {
770   return ARM_DRIVER_OK;
771 }
772 /**
773 \fn int32_t ARM_WIFI_Deactivate (void)
774 \details
775 The function \b ARM_WIFI_Deactivate deactivates the current mode:
776  - terminates the connection to a wireless network
777  - deactivates the access point
778
779 \b Example:
780  - see \ref ARM_WIFI_GetNetInfo
781 */
782
783 int32_t ARM_WIFI_IsConnected (void) {
784   return 0;
785 }
786 /**
787 \fn int32_t ARM_WIFI_IsConnected (void)
788 \details
789 The function \b ARM_WIFI_IsConnected checks if the station is connected to a wireless network
790 and returns the connection status.
791
792 The function returns a \token{non-zero} value, if the station is connected. If the station
793 is not connected, the function returns \token{0}.
794
795 \b Example:
796  - see \ref ARM_WIFI_GetNetInfo
797 */
798
799 int32_t ARM_WIFI_GetNetInfo (ARM_WIFI_NET_INFO_t *net_info) {
800   return ARM_DRIVER_OK;
801 }
802 /**
803 \fn int32_t ARM_WIFI_GetNetInfo (ARM_WIFI_NET_INFO_t *net_info)
804 \details
805 The function \b ARM_WIFI_GetNetInfo retrieves wireless network information of a connected station.
806
807 It can be used to retrieve network connection information fur subsequent connections
808 after initially connecting using WPS.
809
810 \b Example:
811 \code
812 ARM_WIFI_CONFIG_t wifi_config;
813 ARM_WIFI_NET_INFO_t net_info;
814  
815 memset(&wifi_config, 0, sizeof(wifi_config);
816  
817 wifi_config.wps_method = ARM_WIFI_WPS_METHOD_PBC;
818  
819 // Configure station (WPS)
820 status = wifi->Configure (0U, &wifi_config);
821 if (status != ARM_DRIVER_OK) {
822   // error handling
823 }
824  
825 // Connect to wireless network
826 status = wifi->Activate (ARM_WIFI_MODE_STATION);
827 if (status != ARM_DRIVER_OK) {
828   // error handling
829 }
830  
831 // Retrieve network information
832 if (wifi->IsConnected ()) {
833   status = wifi->GetNetInfo (&net_info);
834   if (status != ARM_DRIVER_OK) {
835     // error handling
836   }
837   printf("SSID=%s, Password=%s",net_info.ssid, net_info.pass);
838 }
839  
840 // Disconnet from wireless network
841 wifi->Deactivate ();
842 \endcode
843 */
844
845 /**
846 @}
847 */
848 // end group wifi_management_gr
849
850
851 /**
852 \defgroup wifi_bypass_gr WiFi Bypass Mode
853 \ingroup wifi_interface_gr
854 \brief Transfer Ethernet frames by WiFi module.
855 \details The \ref wifi_bypass_gr functions are an optional interface and enable the transmission of
856 Ethernet frames with WiFi modules. The use of this interface requires that the IP stack is running
857 on the microcontroller. The internal IP stack of the WiFi module is therefore not used, and this
858 usually means that the \ref wifi_socket_gr functions can not be used.
859 @{
860 */
861
862 int32_t ARM_WIFI_BypassControl (uint32_t interface, uint32_t mode) {
863   return ARM_DRIVER_OK;
864 }
865 /**
866 \fn int32_t ARM_WIFI_BypassControl (uint32_t interface, uint32_t mode)
867 \details
868 The function \b ARM_WIFI_BypassControl enables or disables the WiFi bypass mode.
869
870 The WiFi Bypass mode can only be enabled, if there is a bypass mode supported in the WiFi driver.
871 You can check this by checking the driver's capabilities.
872
873 \note
874 Bypass mode is enabled by default if the module does not support the Socket interface.
875
876 The argument \em mode specifies the desired state of the WiFi Bypass mode, which is
877 enabled or disabled.
878  
879 \b Example:
880 \code
881 extern ARM_DRIVER_WIFI Driver_WiFi0;
882 static ARM_DRIVER_WIFI *wifi;
883 static ARM_ETH_MAC_ADDR own_mac_address;
884  
885 static void wifi_notify (uint32_t event, ,void *arg) {
886   switch (event)  {
887      :
888   }  
889 }
890  
891 void initialize_wifi_bypass (void) {
892   ARM_WIFI_CAPABILITIES capabilities;
893  
894   wifi = &Driver_WiFi0;
895   capabilities = wifi->GetCapabilities ();
896   if (capabilities.bypass_mode == 0) {
897     // error handling 
898   } 
899  
900   // Initialize and Power-on WiFi Interface
901   wifi->Initialize ((capabilities.eth_rx_frame_event) ? wifi_notify : NULL);
902   wifi->PowerControl (ARM_POWER_FULL);
903  
904   // populate own_mac_address with the address to use
905   wifi->SetOption(ARM_WIFI_MAC, &own_mac_address, 6U);
906  
907   wifi->BypassControl (1U);     // Enable bypass mode
908 }
909 \endcode
910 */
911
912 int32_t ARM_WIFI_EthSendFrame (uint32_t interface, const uint8_t *frame, uint32_t len) {
913   return ARM_DRIVER_OK;
914 }
915 /**
916 \fn int32_t ARM_WIFI_EthSendFrame (uint32_t interface, const uint8_t *frame, uint32_t len)
917 \details
918 The function \b ARM_WIFI_EthSendFrame writes an <b>Ethernet frame</b> to the WiFi transmit buffer.
919
920 The WiFi bypass mode must be enabled by using the function \ref ARM_WIFI_BypassControl
921 before a call to this function.
922
923 The frame data addressed by \em frame starts with MAC destination and ends with the last
924 Payload data byte. The frame data is copied into the transmit buffer of the WiFi interface.
925
926 The maximum value for \em len is implied by the size restrictions of the Ethernet frame
927 but is not verified. Using an invalid value for \em len may generate unpredicted results.
928
929 \b Example:
930 \code
931 status = wifi->EthSendFrame (&frame_data[0], frame_length);
932 if (status != ARM_DRIVER_OK)  {
933   // error handling
934 }
935 \endcode
936 */
937
938 int32_t ARM_WIFI_EthReadFrame (uint32_t interface, uint8_t *frame, uint32_t len) {
939   return ARM_DRIVER_OK;
940 }
941 /**
942 \fn int32_t ARM_WIFI_EthReadFrame (uint32_t interface, uint8_t *frame, uint32_t len)
943 \details
944 The function \b ARM_WIFI_EthReadFrame reads an <b>Ethernet frame</b> from the WiFi interface
945 in the bypass mode.
946
947 The \em len of the Ethernet frame can be checked using the function \ref ARM_WIFI_EthGetRxFrameSize.
948
949 The frame data addressed by \em frame starts with MAC destination and ends with the last
950 Payload data byte. The frame data is read from the receive buffer of the WiFi interface and
951 the number of bytes written into the memory addressed by \em frame is returned.
952 A negative return value indicates an error whereby the status code is defined with 
953 driver common return codes.
954
955 The function \ref ARM_WIFI_EthReadFrame may be called with \em buf = \token{NULL} and \em len = \token{0}
956 to discard or release a frame. This is useful when an incorrect frame has been received or
957 no memory is available to hold the Ethernet frame.
958  
959 \b Example:
960 \code
961 size = wifi->EthGetRxFrameSize ();
962 if ((size < 14) || (size > 1514)) {    // frame excludes CRC
963   wifi->EthReadFrame (NULL, 0);        // Frame error, release it
964 }
965 len = wifi->ReadFrame (&frame_data[0], size);
966 if (len < 0)  {
967   // error handling
968 }
969 \endcode
970 */
971
972 uint32_t ARM_WIFI_EthGetRxFrameSize (uint32_t interface, ) {
973   return 0;
974 }
975 /**
976 \fn uint32_t ARM_WIFI_EthGetRxFrameSize (uint32_t interface, )
977 \details
978 The function \b ARM_WIFI_EthGetRxFrameSize returns the size of a received <b>Ethernet frame</b>
979 in the bypass mode. This function is called before \ref ARM_WIFI_EthReadFrame and supplies
980 the value \em len.
981
982 The frame size includes MAC destination and ends with the last Payload data byte.
983 Value \token{0} indicates that no Ethernet frame is available in the receive buffer.
984 Values smaller than minimum size of Ethernet frame or larger than maximum size of Ethernet frame
985 indicate an invalid frame which needs to be discarded by calling \ref ARM_WIFI_EthReadFrame.
986  
987 \b Example:
988  - see \ref ARM_WIFI_EthReadFrame
989 */
990 /**
991 @}
992 */
993 // end group wifi_bypass_gr
994
995
996 /**
997 \defgroup wifi_socket_gr WiFi Socket
998 \ingroup wifi_interface_gr
999 \brief Socket interface to IP stack running on WiFi module
1000 \details The \ref wifi_socket_gr functions provide the interface to an IP stack that is running
1001 on the WiFi module. This IP stack handles data communication with the network and provides the user
1002 with a communication endpoint called sockets.
1003 @{
1004 */
1005
1006 /**
1007 \defgroup wifi_addr_family WiFi Socket Address Family definitions
1008 \ingroup wifi_socket_gr
1009 \brief WiFi Socket Address Family definitions.
1010 \details The WiFi Socket Address Family specifies the addressing scheme that an instance of the WiFi socket can use.
1011 @{
1012 \def ARM_SOCKET_AF_INET
1013 \details Internet Address Family version 4.
1014 \def ARM_SOCKET_AF_INET6
1015 \details Internet Address Family version 6.
1016 @}
1017 */
1018
1019 /**
1020 \defgroup wifi_socket_type WiFi Socket Type definitions
1021 \ingroup wifi_socket_gr
1022 \brief WiFi Socket Type definitions.
1023 \details The WiFi Socket Type specifies the type of the WiFi socket.
1024 @{
1025 \def ARM_SOCKET_SOCK_STREAM
1026 \details Stream Socket is connection-oriented, sequenced and reliable, implemented on top of the TCP protocol.
1027 \def ARM_SOCKET_SOCK_DGRAM
1028 \details Datagram Socket is connectionless, unreliable, using the UDP protocol.
1029 @}
1030 */
1031
1032 /**
1033 \defgroup wifi_protocol WiFi Socket Protocol definitions
1034 \ingroup WiFi_socket_gr
1035 \brief WiFi Socket Protocol definitions.
1036 \details The WiFi Socket Protocol specifies the Internet Protocol Type that the socket is using.
1037 @{
1038 \def ARM_SOCKET_IPPROTO_TCP
1039 \details Transmission Control Protocol.
1040 \def ARM_SOCKET_IPPROTO_UDP
1041 \details User Datagram Protocol.
1042 @}
1043 */
1044
1045 /**
1046 \defgroup wifi_soc_opt WiFi Socket Option definitions
1047 \ingroup WiFi_socket_gr
1048 \brief WiFi Socket Option definitions.
1049 \details The WiFi Socket Option specifies the socket option for which the value is to be set or obtained.
1050 @{
1051 \def ARM_SOCKET_IO_FIONBIO
1052 \details Enables or disables the non-blocking mode for the WiFi socket.
1053 \sa wifi_soc_opt
1054 \def ARM_SOCKET_SO_RCVTIMEO
1055 \details Specifies the time limit for receiving in blocking mode. The time limit is in milliseconds.
1056 \sa wifi_soc_opt
1057 \def ARM_SOCKET_SO_SNDTIMEO
1058 \details Specifies the time limit for sending in blocking mode. The time limit is in milliseconds.
1059 \sa wifi_soc_opt
1060 \def ARM_SOCKET_SO_KEEPALIVE
1061 \details Enables or disables the keep-alive mode for the stream socket.
1062 \sa wifi_soc_opt
1063 \def ARM_SOCKET_SO_TYPE
1064 \details Obtains the type of the Wifi socket.
1065 \sa wifi_soc_opt
1066 @}
1067 */
1068
1069 /**
1070 \defgroup wifi_soc_func WiFi Socket Function return codes
1071 \ingroup WiFi_socket_gr
1072 \brief WiFi Socket Function return codes.
1073 \details This section lists all the return errors the WiFi socket functions will return.
1074 The error codes are negative. This makes it easy to check an error when the return
1075 code is less than \token{0}.
1076 @{
1077 \def ARM_SOCKET_ERROR
1078 \sa wifi_soc_func
1079 \def ARM_SOCKET_ESOCK
1080 \sa wifi_soc_func
1081 \def ARM_SOCKET_EINVAL
1082 \sa wifi_soc_func
1083 \def ARM_SOCKET_ENOTSUP
1084 \sa wifi_soc_func
1085 \def ARM_SOCKET_ENOMEM
1086 \sa wifi_soc_func
1087 \def ARM_SOCKET_EAGAIN
1088 \sa wifi_soc_func
1089 \def ARM_SOCKET_EINPROGRESS
1090 \sa wifi_soc_func
1091 \def ARM_SOCKET_ETIMEDOUT
1092 \sa wifi_soc_func
1093 \def ARM_SOCKET_EISCONN
1094 \sa wifi_soc_func
1095 \def ARM_SOCKET_ENOTCONN
1096 \sa wifi_soc_func
1097 \def ARM_SOCKET_ECONNREFUSED
1098 \sa wifi_soc_func
1099 \def ARM_SOCKET_ECONNRESET
1100 \sa wifi_soc_func
1101 \def ARM_SOCKET_ECONNABORTED
1102 \sa wifi_soc_func
1103 \def ARM_SOCKET_EALREADY
1104 \sa wifi_soc_func
1105 \def ARM_SOCKET_EADDRINUSE
1106 \sa wifi_soc_func
1107 \def ARM_SOCKET_EHOSTNOTFOUND
1108 \sa wifi_soc_func
1109 @}
1110 */
1111
1112 int32_t ARM_WIFI_SocketCreate (int32_t af, int32_t type, int32_t protocol) {
1113   return 0;
1114 }
1115 /**
1116 \fn int32_t ARM_WIFI_SocketCreate (int32_t af, int32_t type, int32_t protocol)
1117 \details
1118 The function \b ARM_WIFI_SocketCreate creates a communication endpoint called a socket.
1119
1120 The argument \em af specifies the address family. The following values are supported:
1121 Family                       | Description
1122 :----------------------------|:-------------------------------------------------
1123 \ref ARM_SOCKET_AF_INET      | Address Family Internet
1124 \ref ARM_SOCKET_AF_INET6     | Address Family Internet version 6
1125
1126 The argument \em type specifies the communication semantics. The following are the currently supported types:
1127 Type                         | Description
1128 :----------------------------|:-------------------------------------------------
1129 \ref ARM_SOCKET_SOCK_STREAM  | Provides a reliable connection based data stream that is full-duplex
1130 \ref ARM_SOCKET_SOCK_DGRAM   | Provides connectionless communication that is unreliable
1131
1132 The argument \em protocol specifies the protocol that must be used with the socket type:
1133 Protocol                     | Description
1134 :----------------------------|:-------------------------------------------------
1135 \ref ARM_SOCKET_IPPROTO_TCP  | Must be used with ARM_SOCKET_SOCK_STREAM socket type
1136 \ref ARM_SOCKET_IPPROTO_UDP  | Must be used with ARM_SOCKET_SOCK_DGRAM socket type
1137  
1138 \b Example:
1139  - see \ref ARM_WIFI_SocketListen, \ref ARM_WIFI_SocketConnect
1140 */
1141
1142 int32_t ARM_WIFI_SocketBind (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port) {
1143   return 0;
1144 }
1145 /**
1146 \fn int32_t ARM_WIFI_SocketBind (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port)
1147 \details
1148 The function \b ARM_WIFI_SocketBind assigns a name to an unnamed socket. The name represents the local address
1149 and port of the communication endpoint.
1150
1151 The argument \em socket specifies a socket identification number returned from a previous call
1152 to \ref ARM_WIFI_SocketCreate.
1153
1154 The argument \em ip is a pointer to the buffer containing the IP address octets of the local IP address.
1155
1156 The argument \em ip_len specifies the length of the local IP address. The length is \token{4} bytes
1157 for the IPv4 address and \token{16} bytes for the IPv6 address.
1158
1159 The argument \em port specifies the local port. If the argument \em port is \token{0}, the function returns error,
1160 because this port is reserved.
1161  
1162 \b Example:
1163  - see \ref ARM_WIFI_SocketListen
1164 */
1165
1166 int32_t ARM_WIFI_SocketListen (int32_t socket, int32_t backlog) {
1167   return 0;
1168 }
1169 /**
1170 \fn int32_t ARM_WIFI_SocketListen (int32_t socket, int32_t backlog)
1171 \details
1172 The function \b ARM_WIFI_SocketListen sets the specified socket to listening mode, that is to the
1173 server mode of operation. Before calling the \b ARM_WIFI_SocketListen function, the \ref ARM_WIFI_SocketBind
1174 function must be called.
1175
1176 The argument \em socket specifies a socket identification number returned from a previous call
1177 to \ref ARM_WIFI_SocketCreate.
1178
1179 The argument \em backlog specifies a maximum number of connection requests that can be queued.
1180  
1181 \b Example:
1182 \code
1183 extern ARM_DRIVER_WIFI Driver_WiFi0;
1184 static ARM_DRIVER_WIFI *wifi;
1185  
1186 void Echo_Server_Thread (void *arg) {
1187   uint8_t ip[4] = { 0U, 0U, 0U, 0U };
1188   int32_t sock, sd, res;
1189   char dbuf[120];
1190  
1191   while (1) {
1192     wifi = &Driver_WiFi0;
1193     sock = wifi->SocketCreate (ARM_SOCKET_AF_INET, ARM_SOCKET_SOCK_STREAM, ARM_SOCKET_IPPROTO_TCP);
1194  
1195     wifi->SocketBind (sock, (uint8_t *)ip, sizeof(ip), 7U);
1196     wifi->SocketListen (sock, 1);
1197     sd = wifi->SocketAccept (sock, NULL, NULL, NULL);
1198     wifi->SocketClose (sock);
1199     sock = sd;
1200  
1201     while (1) {
1202       res = wifi->SocketRecv (sock, dbuf, sizeof(dbuf));
1203       if (res < 0) {
1204         break;                                      // Error occurred
1205       }
1206       if (res > 0) {
1207         wifi->SocketSend (sock, dbuf, res);         // Echo the data
1208       }    
1209     }
1210     wifi->SocketClose (sock);
1211   }
1212 }
1213 \endcode
1214 */
1215
1216 int32_t ARM_WIFI_SocketAccept (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port) {
1217   return 0;
1218 }
1219 /**
1220 \fn int32_t ARM_WIFI_SocketAccept (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)
1221 \details
1222 The function \b ARM_WIFI_SocketAccept accepts a connection request queued for a listening socket.
1223 If a connection request is pending, \b ARM_WIFI_SocketAccept removes the request from the queue,
1224 and creates a new socket for the connection. The original listening socket remains open and continues
1225 to queue new connection requests. The \em socket must be a socket of type \b ARM_SOCKET_SOCK_STREAM.
1226
1227 In blocking mode, which is enabled by default, this function waits for a connection request. In
1228 non blocking mode, you must call the \b ARM_WIFI_SocketAccept function again if the error code
1229 \c ARM_SOCKET_EAGAIN is returned.
1230
1231 The argument \em socket specifies a socket identification number returned from a previous call
1232 to \ref ARM_WIFI_SocketCreate.
1233
1234 The argument \em ip is a pointer to the buffer that will receive the IP address of the connection node.
1235 If the \em ip is \token{NULL}, the IP address is not returned.
1236
1237 The argument \em ip_len is a pointer to the IP address length. It should initially contain the amount of
1238 space pointed to by \em ip. On return it contains the actual length of the address returned in bytes.
1239
1240 The argument \em port is a pointer to the buffer, that will receive the port number of the connection node.
1241 If the \em port is \token{NULL}, the port number is not returned.
1242
1243 \b Example:
1244  - see \ref ARM_WIFI_SocketListen
1245 */
1246
1247 int32_t ARM_WIFI_SocketConnect (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port) {
1248   return 0;
1249 }
1250 /**
1251 \fn int32_t ARM_WIFI_SocketConnect (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port)
1252 \details
1253 The function \b ARM_WIFI_SocketConnect assigns the address of the peer communication endpoint. The function
1254 behaves differently according to the type of socket:
1255
1256 - \b ARM_SOCKET_SOCK_STREAM: A connection is established between the endpoints.
1257
1258   In blocking mode, which is enabled by default, this function waits for a connection to be established.
1259
1260   In non blocking mode, the function returns the error code \c ARM_SOCKET_EINPROGRESS and the connection
1261   is established asynchronously. Subsequent calls to \b ARM_WIFI_SocketConnect for the same socket,
1262   before the connection is established, return the error code \c ARM_SOCKET_EALREADY.  When the connection
1263   is established, the call to \b ARM_WIFI_SocketConnect returns the error code \c ARM_SOCKET_EISCONN. 
1264
1265 - \b ARM_SOCKET_SOCK_DGRAM: An address filter is established between the endpoints.
1266
1267   The address filter is changed with another \b ARM_WIFI_SocketConnect function call. If the socket
1268   is not yet bound, the system implicitly binds to a random dynamic port.
1269
1270 The argument \em socket specifies a socket identification number returned from a previous call
1271 to \ref ARM_WIFI_SocketCreate.
1272
1273 The argument \em ip is a pointer to the buffer containing the IP address octets of the endpoint node.
1274
1275 The argument \em ip_len specifies the length of the IP address. The length is \token{4} bytes
1276 for the IPv4 address and \token{16} bytes for the IPv6 address.
1277
1278 The argument \em port specifies the port of the endpoint node. If the argument \em port is \token{0}, 
1279 the function returns error, because this port is reserved.
1280
1281 \b Example:
1282 \code
1283 extern ARM_DRIVER_WIFI Driver_WiFi0;
1284 static ARM_DRIVER_WIFI *wifi;
1285  
1286 static const char message[] = { "The quick brown fox jumps over the lazy dog." };
1287   
1288 void Echo_Client_Thread (void *arg) {
1289   uint8_t ip[4] = { 192U, 168U, 0U, 100U };
1290   int32_t sock, res;
1291   char dbuf[120];
1292  
1293   while (1) {
1294     wifi = &Driver_WiFi0;
1295     sock = wifi->SocketCreate (ARM_SOCKET_AF_INET, ARM_SOCKET_SOCK_STREAM, ARM_SOCKET_IPPROTO_TCP);
1296  
1297     res = wifi->SocketConnect (sock, (uint8_t *)ip, sizeof(ip), 7U);
1298     if (res == 0) {
1299       wifi->SocketSend (sock, message, sizeof(message));
1300       res = wifi->SocketRecv (sock, dbuf, sizeof(dbuf));
1301       if (res < 0) {
1302         break;               // Error occured
1303       }
1304       if (res > 0) {
1305         if (memcmp (dbuf, message, res) != 0) {
1306           // error handling, message is not the same as sent
1307         }
1308       }    
1309     }
1310     wifi->SocketClose (sock);
1311     osDelay (1000U);
1312   }
1313 }
1314 \endcode
1315 */
1316
1317 int32_t ARM_WIFI_SocketRecv (int32_t socket, void *buf, uint32_t len) {
1318   return 1;
1319 }
1320 /**
1321 \fn int32_t ARM_WIFI_SocketRecv (int32_t socket, void *buf, uint32_t len)
1322 \details
1323 The function \b ARM_WIFI_SocketRecv receives incoming data that has been queued for the socket.
1324 You can use this function with both, the stream and the datagram socket. It reads as much
1325 information as currently available up to the size of the buffer specified.
1326
1327 In blocking mode, which is enabled by default, this function waits for received data. In non
1328 blocking mode, you must call the \b ARM_WIFI_SocketRecv function again if the error code 
1329 \c ARM_SOCKET_EAGAIN is returned.
1330
1331 The argument \em socket specifies a socket identification number returned from a previous call
1332 to \ref ARM_WIFI_SocketCreate.
1333
1334 The argument \em buf is a pointer to the application data buffer for storing the data to.
1335 If the available data is too large to fit in the supplied application buffer \em buf, excess bytes
1336 are discarded in case of a datagram sockets. For stream sockets, the data is buffered internally
1337 so the application can retrieve all data by multiple calls of \b ARM_WIFI_SocketRecv function.
1338
1339 The argument \em len specifies the size of the application data buffer.
1340
1341 \b Example:
1342  - see \ref ARM_WIFI_SocketListen
1343 */
1344
1345 int32_t ARM_WIFI_SocketRecvFrom (int32_t socket, void *buf, uint32_t len, uint8_t *ip, uint32_t *ip_len, uint16_t *port) {
1346   return 1;
1347 }
1348 /**
1349 \fn int32_t ARM_WIFI_SocketRecvFrom (int32_t socket, void *buf, uint32_t len, uint8_t *ip, uint32_t *ip_len, uint16_t *port)
1350 \details
1351 The function \b ARM_WIFI_SocketRecvFrom is used to receive data that has been queued for a socket.
1352 It is normally used to receive messages on datagram sockets, but can also be used to receive a reliable,
1353 ordered stream of data on a connected stream sockets. It reads as much information as currently available
1354 up to the size of the buffer specified.
1355
1356 In blocking mode, which is enabled by default, this function waits for received data. In non
1357 blocking mode, you must call the \b ARM_WIFI_SocketRecv function again if the error code 
1358 \c ARM_SOCKET_EAGAIN is returned.
1359
1360 The argument \em socket specifies a socket identification number returned from a previous call
1361 to \ref ARM_WIFI_SocketCreate.
1362
1363 The argument \em buf is a pointer to the application data buffer for storing the data to.
1364 If the available data is too large to fit in the supplied application buffer \em buf, excess bytes
1365 are discarded in case of a datagram sockets. For stream sockets, the data is buffered internally
1366 so the application can retrieve all data by multiple calls of \b ARM_WIFI_SocketRecv function.
1367
1368 The argument \em len specifies the size of the application data buffer.
1369
1370 The argument \em ip is a pointer to the buffer that will receive the IP address of the sender.
1371 If the \em ip is \token{NULL}, the IP address is not returned.
1372
1373 The argument \em ip_len is a pointer to the IP address length. It should initially contain the amount of
1374 space pointed to by \em ip. On return it contains the actual length of the address returned in bytes.
1375
1376 The argument \em port is a pointer to the buffer, that will receive the port number of the sender.
1377 If the \em port is \token{NULL}, the port number is not returned.
1378  
1379 \b Example:
1380 \code
1381 extern ARM_DRIVER_WIFI Driver_WiFi0;
1382 static ARM_DRIVER_WIFI *wifi;
1383  
1384 void Echo_Server_Thread (void *arg) {
1385   uint8_t ip[4];
1386   uint16_t port;
1387   int32_t sock, res;
1388   uint32_t ip_len;
1389   char dbuf[120];
1390  
1391   while (1) {
1392     wifi = &Driver_WiFi0;
1393     sock = wifi->SocketCreate (ARM_SOCKET_AF_INET, ARM_SOCKET_SOCK_DGRAM, ARM_SOCKET_IPPROTO_UDP);
1394  
1395     ip[0] = 0U;                 // Unspecified address
1396     ip[1] = 0U;
1397     ip[2] = 0U;
1398     ip[3] = 0U;
1399     port  = 7U;                 // Standard port for Echo service
1400  
1401     wifi->SocketBind (sock, (uint8_t *)ip, sizeof(ip), port);
1402  
1403     while (1) {
1404       ip_len = sizeof(ip);
1405       res = wifi->SocketRecvFrom (sock, dbuf, sizeof(dbuf), (uint8_t *)ip, &ip_len, &port);
1406       if (res < 0) {
1407         break;                  // Error occurred
1408       }
1409       if (res > 0) {            // Echo the data
1410         wifi->SocketSendTo (sock, dbuf, res, (uint8_t *)ip, ip_len, port);
1411       }    
1412     }
1413     wifi->SocketClose (sock);
1414   }
1415 }
1416 \endcode
1417 */
1418
1419 int32_t ARM_WIFI_SocketSend (int32_t socket, const void *buf, uint32_t len) {
1420   return 1;
1421 }
1422 /**
1423 \fn int32_t ARM_WIFI_SocketSend (int32_t socket, const void *buf, uint32_t len)
1424 \details
1425 The function \b ARM_WIFI_SocketSend is used to send data on an already connected socket. This function is
1426 normally used to send a reliable, ordered stream of data bytes on a stream sockets. It can also be used
1427 to send messages on datagram sockets.
1428
1429 The argument \em socket specifies a socket identification number returned from a previous call
1430 to \ref ARM_WIFI_SocketCreate.
1431
1432 The argument \a buf is a pointer to the application data buffer containing data to transmit. The buffer
1433 data length is not limited in size. If the data length is too large for one packet, the \b ARM_WIFI_SocketSend function
1434 will fragment the data and send it in several successive data packets:
1435 - In blocking mode, which is enabled by default, this function returns after the data has been successfully queued for transmission.
1436 - In non blocking mode, the function returns immediately without blocking the system.
1437
1438 The argument \a len specifies the length of data in bytes.
1439
1440 Return value, when positive, represents the number of bytes sent, which can be less than \a len.
1441  
1442 \b Example:
1443  - see \ref ARM_WIFI_SocketListen
1444 */
1445
1446 int32_t ARM_WIFI_SocketSendTo (int32_t socket, const void *buf, uint32_t len, const uint8_t *ip, uint32_t ip_len, uint16_t port) {
1447   return 1;
1448 }
1449 /**
1450 \fn int32_t ARM_WIFI_SocketSendTo (int32_t socket, const void *buf, uint32_t len, const uint8_t *ip, uint32_t ip_len, uint16_t port)
1451 \details
1452 The function \b ARM_WIFI_SocketSendTo is used to send data. It is normally used to send messages
1453 on a datagram sockets, but can also be used to send data on a connected stream sockets.
1454
1455 If the datagram socket is not yet bound, the system implicitly binds to a random dynamic port.
1456
1457 The argument \em socket specifies a socket identification number returned from a previous call
1458 to \ref ARM_WIFI_SocketCreate.
1459
1460 The argument \a buf is a pointer to the application data buffer containing data to transmit. The buffer
1461 data length is not limited in size. If the data length is too large for one packet, the \b ARM_WIFI_SocketSend function
1462 will fragment the data and send it in several successive data packets:
1463 - In blocking mode, which is enabled by default, this function returns after the data has been successfully queued for transmission.
1464 - In non blocking mode, the function returns immediately without blocking the system.
1465
1466 The argument \a len specifies the length of data in bytes.
1467
1468 The argument \em ip is a pointer to the buffer containing the IP address octets of the endpoint node.
1469
1470 The argument \em ip_len specifies the length of the IP address. The length is \token{4} bytes
1471 for the IPv4 address and \token{16} bytes for the IPv6 address.
1472
1473 The argument \em port specifies the port of the endpoint node. If the argument \em port is \token{0}, 
1474 the function returns error, because this port is reserved.
1475
1476 For the stream sockets, arguments \em ip, \em ip_len and \em port are ignored.
1477
1478 Return value, when positive, represents the number of bytes sent, which can be less than \a len.
1479
1480 \b Example:
1481  - see \ref ARM_WIFI_SocketRecvFrom
1482 */
1483
1484 int32_t ARM_WIFI_SocketGetSockName (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port) {
1485   return 0;
1486 }
1487 /**
1488 \fn int32_t ARM_WIFI_SocketGetSockName (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)
1489 \details
1490 The function \b ARM_WIFI_SocketGetSockName retrieves the local IP address and port for a socket.
1491
1492 The argument \em socket specifies a socket identification number returned from a previous call
1493 to \ref ARM_WIFI_SocketCreate.
1494
1495 The argument \em ip is a pointer to the buffer that will receive the local IP address.
1496 If the \em ip is \token{NULL}, the local IP address is not returned.
1497
1498 The argument \em ip_len is a pointer to the IP address length. It should initially contain the amount of
1499 space pointed to by \em ip. On return it contains the actual length of the address returned in bytes.
1500
1501 The argument \em port is a pointer to the buffer, that will receive the local port number.
1502 If the \em port is \token{NULL}, the local port number is not returned.
1503
1504 \b Example:
1505 \code
1506 static uint8_t  local_ip[4];    // Socket address and port
1507 static uint16_t local_port;
1508  
1509 static void get_socket_local_info (void) {
1510   uint32_t ip_len;
1511  
1512   ip_len = sizeof(local_ip);
1513   wifi->SocketGetSockName (sock, (uint8_t *)local_ip, &ip_len, &local_port);
1514 }
1515 \endcode
1516 */
1517
1518 int32_t ARM_WIFI_SocketGetPeerName (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port) {
1519   return 0;
1520 }
1521 /**
1522 \fn int32_t ARM_WIFI_SocketGetPeerName (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)
1523 \details
1524 The function \b ARM_WIFI_SocketGetPeerName retrieves the IP address and port of the peer to which
1525 a socket is connected.
1526
1527 The argument \em socket specifies a socket identification number returned from a previous call
1528 to \ref ARM_WIFI_SocketCreate.
1529
1530 The argument \em ip is a pointer to the buffer that will receive the IP address of the peer.
1531 If the \em ip is \token{NULL}, the IP address is not returned.
1532
1533 The argument \em ip_len is a pointer to the IP address length. It should initially contain the amount of
1534 space pointed to by \em ip. On return it contains the actual length of the address returned in bytes.
1535
1536 The argument \em port is a pointer to the buffer, that will receive the port number of the peer.
1537 If the \em port is \token{NULL}, the port number is not returned.
1538
1539 \b Example:
1540 \code
1541 static uint8_t  peer_ip[4];    // Socket address and port
1542 static uint16_t peer_port;
1543  
1544 static void get_socket_peer_info (void) {
1545   uint32_t ip_len;
1546  
1547   ip_len = sizeof(peer_ip);
1548   wifi->SocketGetPeerName (sock, (uint8_t *)peer_ip, &ip_len, &peer_port);
1549 }
1550 \endcode
1551 */
1552
1553 int32_t ARM_WIFI_SocketGetOpt (int32_t socket, int32_t opt_id, void *opt_val, uint32_t *opt_len) {
1554   return 0;
1555 }
1556 /**
1557 \fn int32_t ARM_WIFI_SocketGetOpt (int32_t socket, int32_t opt_id, void *opt_val, uint32_t *opt_len)
1558 \details
1559 The function \b ARM_WIFI_SocketGetOpt retrieves options for a socket.
1560
1561 The argument \em socket specifies a socket identification number returned from a previous call
1562 to \ref ARM_WIFI_SocketCreate.
1563
1564 The argument \em opt_id is the socket option for which the value is to be retrieved. The following
1565 socket options are supported:
1566 Option                       | Description
1567 :----------------------------|:-------------------------------------------------
1568 \ref ARM_SOCKET_SO_RCVTIMEO  | Timeout for receiving in blocking mode
1569 \ref ARM_SOCKET_SO_SNDTIMEO  | Timeout for sending in blocking mode
1570 \ref ARM_SOCKET_SO_KEEPALIVE | Keep-alive mode for the stream socket
1571 \ref ARM_SOCKET_SO_TYPE      | Type of the socket (stream or datagram)
1572
1573 The argument \em opt_val points to the buffer that will receive the value of the \em opt_id.
1574
1575 The argument \em opt_len contains the length of the buffer at the input and returns the length
1576 of the option information on the output.
1577
1578 \b Example:
1579 \code
1580 uint32_t type;
1581  
1582 wifi->SocketGetOpt (sock, ARM_SOCKET_SO_TYPE, &type, sizeof(type));
1583 if (type == ARM_SOCKET_SOCK_STREAM) {
1584   // Stream socket
1585 }
1586 if (type == ARM_SOCKET_SOCK_DGRAM) {
1587   // Datagram socket
1588 }
1589 \endcode
1590 */
1591
1592 int32_t ARM_WIFI_SocketSetOpt (int32_t socket, int32_t opt_id, const void *opt_val, uint32_t opt_len) {
1593   return 0;
1594 }
1595 /**
1596 \fn int32_t ARM_WIFI_SocketSetOpt (int32_t socket, int32_t opt_id, const void *opt_val, uint32_t opt_len)
1597 \details
1598 The function \b ARM_WIFI_SocketSetOpt sets options for a socket.
1599
1600 The argument \em socket specifies a socket identification number returned from a previous call
1601 to \ref ARM_WIFI_SocketCreate.
1602
1603 The argument \em opt_id is the socket option for which the value is to be set. The following
1604 socket options are supported:
1605 Option                       | Description
1606 :----------------------------|:-------------------------------------------------
1607 \ref ARM_SOCKET_IO_FIONBIO   | Non-blocking mode for the socket
1608 \ref ARM_SOCKET_SO_RCVTIMEO  | Timeout for receiving in blocking mode
1609 \ref ARM_SOCKET_SO_SNDTIMEO  | Timeout for sending in blocking mode
1610 \ref ARM_SOCKET_SO_KEEPALIVE | Keep-alive mode for the stream socket
1611
1612 The argument \em opt_val points to the buffer containing the value of the \em opt_id.
1613
1614 The argument \em opt_len tells the exact length of the option.
1615  
1616 \b Example:
1617 \code
1618 uint32_t nonblocking = 0U;    // Blocking mode
1619 uint32_t timeout = 10000U;    // Timeout 10 seconds
1620  
1621 wifi->SocketSetOpt (sock, ARM_SOCKET_IO_FIONBIO, &nonblocking, sizeof(nonblocking));
1622 wifi->SocketSetOpt (sock, ARM_SOCKET_SO_RCVTIMEO, &timeout, sizeof(timeout)); 
1623 wifi->SocketSetOpt (sock, ARM_SOCKET_SO_SNDTIMEO, &timeout, sizeof(timeout));
1624 \endcode
1625 */
1626
1627 int32_t ARM_WIFI_SocketClose (int32_t socket) {
1628   return 0;
1629 }
1630 /**
1631 \fn int32_t ARM_WIFI_SocketClose (int32_t socket)
1632 \details
1633 The function \b ARM_WIFI_SocketClose closes an existing socket and releases the socket descriptor.
1634 Further references to \em socket fail with \c ARM_SOCKET_EINVAL error code.
1635
1636 The argument \em socket specifies a socket identification number returned from a previous call
1637 to \ref ARM_WIFI_SocketCreate.
1638
1639 In blocking mode, which is enabled by default, this function will wait until a socket is closed.
1640 In non blocking mode, you must call the \b ARM_WIFI_SocketClose function again if the error code
1641 \c ARM_SOCKET_EAGAIN is returned.
1642
1643 \b Example:
1644  - see \ref ARM_WIFI_SocketListen
1645 */
1646
1647 int32_t ARM_WIFI_SocketGetHostByName (const char *name, int32_t af, uint8_t *ip, uint32_t *ip_len) {
1648   return 0;
1649 }
1650 /**
1651 \fn int32_t ARM_WIFI_SocketGetHostByName (const char *name, int32_t af, uint8_t *ip, uint32_t *ip_len)
1652 \details
1653 The function \b ARM_WIFI_SocketGetHostByName retrieves host information corresponding to
1654 a host name from a host database. It does this by sending DNS requests to the DNS server.
1655 The IP address of the DNS server is specified in the network interface configuration or can be
1656 obtained from the DHCP server for the local area network.
1657
1658 The argument \a name is a pointer to the \token{null}-terminated name of the host to resolve.
1659
1660 The argument \em af specifies the address family, that is, which type of IP address you want
1661 to resolve. The following values are supported:
1662 Family                       | Description
1663 :----------------------------|:-------------------------------------------------
1664 \ref ARM_SOCKET_AF_INET      | Resolve the IPv4 address
1665 \ref ARM_SOCKET_AF_INET6     | Resolve the IPv6 address
1666
1667 The argument \em ip is a pointer to the buffer that will receive the resolved IP address of the host.
1668 If the argument \em ip is \token{NULL}, the function returns error.
1669
1670 The argument \em ip_len is a pointer to the IP address length. It should initially contain the amount of
1671 space pointed to by \em ip. On return it contains the actual length of the address returned in bytes.
1672
1673 \b Example:
1674 \code
1675 extern ARM_DRIVER_WIFI Driver_WiFi0;
1676 static ARM_DRIVER_WIFI *wifi;
1677  
1678 void ping_arm_com (void) {
1679   uint8_t ip[4];
1680   uint32_t ip_len;
1681   int32_t res;
1682  
1683   wifi = &Driver_WiFi0;
1684   ip_len = sizeof(ip);
1685   res = wifi->SocketGetHostByName ("www.arm.com", ARM_SOCKET_AF_INET, (uint8_t *)ip, &ip_len);
1686   if (res == ARM_DRIVER_OK) {
1687     res = wifi->Ping ((uint8_t *)ip, sizeof(ip));
1688     if (res == ARM_DRIVER_OK) {
1689       // "www.arm.com" responded to ping  
1690     }
1691   }
1692   else {
1693     // "www.arm.com" not resolved
1694   }
1695 }
1696 \endcode
1697 */
1698
1699 int32_t ARM_WIFI_Ping (const uint8_t *ip, uint32_t ip_len) {
1700   return ARM_DRIVER_OK;
1701 }
1702 /**
1703 \fn int32_t ARM_WIFI_Ping (const uint8_t *ip, uint32_t ip_len)
1704 \details
1705 The function \b ARM_WIFI_Ping checks if the remote host is reachable. It does this by sending 
1706 an echo request and waiting for an echo response. The function then returns the result
1707 of the operation. Check the \ref ARM_WIFI_CAPABILITIES of the driver, if this function
1708 is supported in the driver implementation.
1709
1710 The argument \em ip is a pointer to the buffer containing the IP address octets of the host to ping.
1711
1712 The argument \em ip_len specifies the length of the IP address. The length is \token{4} bytes
1713 for the IPv4 address and \token{16} bytes for the IPv6 address.
1714  
1715 \note
1716 The host availability check fails, if the remote host does not respond to echo requests,
1717 or intermediate routers do not forward the echo requests or echo responses.
1718
1719 \b Example:
1720 \code
1721 extern ARM_DRIVER_WIFI Driver_WiFi0;
1722 static ARM_DRIVER_WIFI *wifi;
1723  
1724 void ping_host (void) {
1725   uint8_t ip[4] = { 192U, 168U, 0U, 100U };
1726   int32_t res;
1727  
1728   wifi = &Driver_WiFi0;
1729   res = wifi->Ping ((uint8_t *)ip, sizeof(ip));
1730   if (res == ARM_DRIVER_OK) {
1731     // Host responded
1732   }
1733 }
1734 \endcode
1735 */
1736 /**
1737 @}
1738 */
1739 // end group wifi_socket_gr
1740
1741
1742 /**
1743 @}
1744 */
1745 // End WiFi Interface