A few days ago because of solving a bunch of bugs, no time to write. I do not write every day, just to archive some information.
Content Source: Work in contact with the + Master Blog + document (Books) = own understanding
Reference ^ ^ only
This blog is an add-on to the previous <<android WIFI boot process >>.
Reference Blog: http://blog.csdn.net/eoeandroida/article/details/40583353
To configure the AP:
When the user selects an AP on the Wifisettings interface, a dialog box is displayed that configures the AP parameters.
Showaccesspointdialog (state, accesspointdialog.mode_info); (By using the Wifidialog.java Class dialog box)
Connect the AP:
When the user selects the encryption method and the input key in the Accesspointdialog (Wifidialog.java Class dialog box), and then clicks the Connect button, Android will connect to the AP.
1 Wifilayer detects if the AP was previously configured, this is done by sending list_network (used in the Wifinative Class) command to Wpa_supplicant and comparing the return value.
Need wificonfiguration for the AP
wificonfiguration config = findconfigurednetwork (state);
If Wpa_supplicant does not have the configuration information for this AP, the Add_network command is sent to Wpa_supplicant to add the AP
The 2 add_network command returns a Id,wifilayer and then sends the Enable_network command to wpa_supplicant with the returned ID as a parameter, allowing Wpa_supplicant to connect to the AP.
Configure IP Address:
1 when the Wpa_supplicant successfully connects to the AP, it sends an event to the control channel, notifying the AP that it is connected, so that the Wifi_wait_for_event function receives the event. The monitorthread in this wifimonitor will be executed to handle this event.
2 Wifimonitor again calls Wifistatetracker Notifystatechange,wifistatetracker then sends itself a EVENT_DHCP_START message to start DHCP to obtain an IP address.
3 then broadcast to send network_state_changed_action this intent.
4 Wifilayer Register the receive network_state_changed_action this intent, so its related processing function handlenetworkstatechanged will be called, when DHCP gets the IP address, The event_dhcp_succeeded message will be sent again.
5 Wifilayer processing the event_dhcp_succeeded message, it will broadcast the send again.
So far, the entire connection process is complete. (The Wifilayer class and the event_dhcp_succeeded message are not found, but the basic idea is this)
*wpa_supplicant:
Corresponding to the above structure, the WiFi control in Android-based phones is divided into three main components:
1 client program, including WPA_CLI command line or Java GUI program, communicates with Wpa_supplicant Daemon service via socket, sends command and receives result.
2 wpa_supplicant daemon Service, corresponding to the above intermediate section, the function is "upload release". All clients control the hardware network card through it, send a string command to control whether the AP is scanned, extract the scan results and whether the AP is associated with the operation, while the driver's execution status is sent to the user.
The service is designed to support a variety of wireless card chips, so each vendor provides a common interface to wpa_supplicant calls.
3 NIC driver.
In the/etc/wpa_supplicant.conf of cell phone memory, we can directly see the type of network supported by WiFi, each type has examples, such as:
#Both Wpa-psk and Wpa-eap is accepted. Only CCMP is accepted as pairwise and
# Group Cipher.
#network ={
# ssid= "Example"
# bssid=00:11:22:33:44:55
# PROTO=WPA RSN
# KEY_MGMT=WPA-PSK Wpa-eap
# pairwise=ccmp
# group=ccmp
# PSK=06B4BE19DA289F475AA46A33CB793029D4AB3DB7A23EE92382EB0106C72AC7BB
#}
Different types of networks, different parameters and so on, everything.
Android WIFI Boot process (tip^^)