Go to the source code of this file.
Functions | |
| int | wifi_load_driver () |
| Load the Wi-Fi driver. | |
| int | wifi_unload_driver () |
| Unload the Wi-Fi driver. | |
| int | wifi_start_supplicant () |
| Start supplicant. | |
| int | wifi_stop_supplicant () |
| Stop supplicant. | |
| int | wifi_connect_to_supplicant () |
| Open a connection to supplicant. | |
| void | wifi_close_supplicant_connection () |
| Close connection supplicant. | |
| int | wifi_wait_for_event (char *buf, size_t len) |
| wifi_wait_for_event() performs a blocking call to get a Wi-Fi event and returns a string representing a Wi-Fi event when it occurs. | |
| int | wifi_command (const char *command, char *reply, size_t *reply_len) |
| wifi_command() issues a command to the Wi-Fi driver. | |
| int | do_dhcp_request (int *ipaddr, int *gateway, int *mask, int *dns1, int *dns2, int *server, int *lease) |
| do_dhcp_request() issues a dhcp request and returns the acquired information. | |
| const char * | get_dhcp_error_string () |
| Return the error string of the last do_dhcp_request(). | |
| int do_dhcp_request | ( | int * | ipaddr, | |
| int * | gateway, | |||
| int * | mask, | |||
| int * | dns1, | |||
| int * | dns2, | |||
| int * | server, | |||
| int * | lease | |||
| ) |
do_dhcp_request() issues a dhcp request and returns the acquired information.
All IPV4 addresses/mask are in network byte order.
| ipaddr | return the assigned IPV4 address | |
| gateway | return the gateway being used | |
| mask | return the IPV4 mask | |
| dns1 | return the IPV4 address of a DNS server | |
| dns2 | return the IPV4 address of a DNS server | |
| server | return the IPV4 address of DHCP server | |
| lease | return the length of lease in seconds. |
| const char* get_dhcp_error_string | ( | ) |
Return the error string of the last do_dhcp_request().
| void wifi_close_supplicant_connection | ( | ) |
Close connection supplicant.
| int wifi_command | ( | const char * | command, | |
| char * | reply, | |||
| size_t * | reply_len | |||
| ) |
wifi_command() issues a command to the Wi-Fi driver.
Android extends the standard commands listed at /link http://hostap.epitest.fi/wpa_supplicant/devel/ctrl_iface_page.html to include support for sending commands to the driver:
| Command / Command summary | Form of Response | Processing |
| DRIVER START Turn on Wi-Fi Hardware | OK if successful | OK ? true : false |
| DRIVER STOP Turn off Wi-Fi hardware | OK if successful | OK ? true : false |
| DRIVER RSSI Return received signal strength indicator in -db for current AP | <ssid> Rssi xx | *s *s d", &rssi |
| DRIVER LINKSPEED Return link speed in MBPS | LinkSpeed xx | *s d", &linkspd |
| DRIVER MACADDR Return mac address of the station | Macaddr = xx.xx.xx.xx.xx.xx | "%*s = %s", &macadr |
| DRIVER SCAN-ACTIVE Set scan type to active | "OK" if successful | "OK" ? true : false |
| DRIVER SCAN-PASSIVE Set scan type to passive | "OK" if successful | "OK" ? true : false |
See libs/android_runtime/android_net_wifi_Wifi.cpp for more information describing how these and other commands are invoked.
| command | is the string command | |
| reply | is a buffer to receive a reply string | |
| reply_len | on entry, this is the maximum length of the reply buffer. On exit, the number of bytes in the reply buffer. |
| int wifi_connect_to_supplicant | ( | ) |
Open a connection to supplicant.
| int wifi_load_driver | ( | ) |
Load the Wi-Fi driver.
| int wifi_start_supplicant | ( | ) |
Start supplicant.
| int wifi_stop_supplicant | ( | ) |
Stop supplicant.
| int wifi_unload_driver | ( | ) |
Unload the Wi-Fi driver.
| int wifi_wait_for_event | ( | char * | buf, | |
| size_t | len | |||
| ) |
wifi_wait_for_event() performs a blocking call to get a Wi-Fi event and returns a string representing a Wi-Fi event when it occurs.
| buf | is the buffer that receives the event | |
| len | is the maximum length of the buffer |