Configure and manage the connection to a WiFi access point (AP) or configure and manage the access point (AP). More...
Configure and manage the connection to a WiFi access point (AP) or configure and manage the access point (AP).
The WiFi Management functions are used to configure and manage the connection to a WiFi access point (AP) also called hotspot when in station mode. They are also used to configure and manage the access point (AP) itself when in access point mode.
WiFi Configuration.
Provides information needed to connect to the WiFi network for station or how to configure the access point (AP).
Used in:
Data Fields const char * ssid Pointer to Service Set Identifier (SSID) null-terminated string. const char * pass Pointer to Password null-terminated string. uint8_t security Security type (ARM_WIFI_SECURITY_xxx) uint8_t ch WiFi Channel (0 = auto, otherwise = exact channel) uint8_t reserved Reserved. uint8_t wps_method WiFi Protected Setup (WPS) method (ARM_WIFI_WPS_METHOD_xxx) const char * wps_pin Pointer to WiFi Protected Setup (WPS) PIN null-terminated string. struct ARM_WIFI_SCAN_INFO_tWiFi Scan Information.
Provides information about the wireless networks that were detected when searching for available WiFi networks. The structure contains the information needed to connect to the WiFi network. Of course, the access password is not included and must be provided separately.
Used in:
Data Fields char ssid[32+1] Service Set Identifier (SSID) null-terminated string. uint8_t bssid[6] Basic Service Set Identifier (BSSID) uint8_t security Security type (ARM_WIFI_SECURITY_xxx) uint8_t ch WiFi Channel. uint8_t rssi Received Signal Strength Indicator. struct ARM_WIFI_NET_INFO_tWiFi Network Information.
Provides information about the network that the station is connected to.
Used in:
Data Fields char ssid[32+1] Service Set Identifier (SSID) null-terminated string. char pass[64+1] Password null-terminated string. uint8_t security Security type (ARM_WIFI_SECURITY_xxx) uint8_t ch WiFi Channel. uint8_t rssi Received Signal Strength Indicator. int32_t ARM_WIFI_SetOption ( uint32_t interface, uint32_t option, const void * data, uint32_t len )Set WiFi Module Options.
The function ARM_WIFI_SetOption sets the value of the specified option of the WiFi module.
The argument interface specifies the interface (0 = Station, 1 = Access Point).
The argument option specifies the option that is to be set (see below).
The argument data points to a buffer containing the value of the option to be set and must be aligned to the data type of the corresponding option.
The argument len specifies the length of the buffer data and must be equal (or higher) to the length of the corresponding option.
Example:
uint8_t ip[4];
ip[0] = 192U;
ip[1] = 168U;
ip[2] = 0U;
ip[3] = 1U;
int32_t ARM_WIFI_GetOption ( uint32_t interface, uint32_t option, void * data, uint32_t * len )Get WiFi Module Options.
The function ARM_WIFI_GetOption retrieves the current value of the specified option of the WiFi module.
The argument interface specifies the interface (0 = Station, 1 = Access Point).
The argument option specifies the option that is to be retrieved (see ARM_WIFI_SetOption).
The argument data points to a buffer that will be used to store the value of the option and must be aligned to the data type of the corresponding option.
The argument len is a pointer to the length of the buffer at input and returns the length of the option information on the output.
Example:
uint8_t ip[4];
uint8_t mask[4];
uint8_t gateway[4];
Scan for available networks in range.
The function ARM_WIFI_Scan searches for available WiFi networks. Using this function, you can determine which wireless networks are available for the connection. If the network is secured, you must also know the password to connect.
The argument scan_info is a pointer to an array of network information structures, where the available network information will be returned.
The argument max_num specifies maximum number of network information structures, that can be stored to the scan_info.
Example:
num = wifi->
Scan(scan_info, 8U);
for (i = 0; i < num; i++) {
printf ("%d. ssid=%s\n", i, scan_info[i].ssid);
}
Activate interface (Connect to a wireless network or activate an access point).
The function ARM_WIFI_Activate activates the specified interface.
The argument interface specifies the interface (0 = Station, 1 = Access Point).
When station interface is specified, the WiFi module connects to a wireless network.
The wireless network trying to connect to must be available, otherwise the operation will fail after a timeout.
Available wireless networks can be scanned by using the function ARM_WIFI_Scan.
When access point interface is specified, the WiFi module creates a wireless network by activating the access point.
The argument config is a pointer to the configuration ARM_WIFI_CONFIG_t which provides information needed to connect to a WiFi network for station interface or information used to configure the access point (AP) for access point interface.
ssid specifies the name of the network to connect to or the network to create.
pass specifies the password for accessing the wireless network.
security specifies the security type which will be used for the connection.
ch specifies the WiFi channel which will be used for the connection. Valid channels for 2.4 GHz frequency are from 1 to 13. If the value for ch = 0, the system automatically selects the channel. For station interface the channel of the AP being connected to is used. For access point interface the module automatically selects the best channel for the WiFi connection.
wps_method specifies if WiFi Protected Setup (WPS) is used and which method.
wps_pin specifies the PIN used with WPS (ARM_WIFI_WPS_METHOD_PIN).
With the push-button method, you typically press the button, either real or virtual, both at the access point and the station. No credentials are needed.
With PIN method, you must provide the PIN code that you read from the label or screen on the wireless device.
WPS configuration for station is used when station connects to an access point. It enables to connect without specifying SSID, Password, Security Type or WiFi Channel. The actual network information can be retrieved once connected with ARM_WIFI_GetNetInfo.
WPS configuration for access point is used when access point is activated. Subsequent activate calls re-trigger the WPS procedure.
Example:
wifi_config.
ssid=
"GuestAccess";
wifi_config.
pass=
"guest";
status = wifi->
Activate(0U, &wifi_config);
}
int32_t ARM_WIFI_Deactivate ( uint32_t interface )Deactivate interface (Disconnect from a wireless network or deactivate an access point).
The function ARM_WIFI_Deactivate deactivates the specified interface.
The argument interface specifies the interface (0 = Station, 1 = Access Point).
When station interface is specified, the WiFi module disconnects from the wireless network.
When access point interface is specified, the WiFi module deactivates the access point.
Example:
uint32_t ARM_WIFI_IsConnected ( void )Get station connection status.
The function ARM_WIFI_IsConnected checks if the station is connected to a wireless network and returns the connection status.
The function returns a non-zero value, if the station is connected. If the station is not connected, the function returns 0.
Example:
Get station Network Information.
The function ARM_WIFI_GetNetInfo retrieves wireless network information of a connected station.
It can be used to retrieve network connection information for subsequent connections after initially connecting using WPS.
Example:
memset(&wifi_config, 0, sizeof(wifi_config));
status = wifi->
Activate(0U, &wifi_config);
}
}
printf(
"SSID=%s, Password=%s",net_info.
ssid, net_info.
pass);
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4