Android wifi--System Architecture

Source: Internet
Author: User

Android wifi--System Architecture

http://blog.csdn.net/myarrow/article/details/8129607


1. System Architecture
Android WiFi system introduced wpa_supplicant, its entire wifi system with Wpa_supplicant as the core to define the upper user interface and the lower driver interface. The entire WiFi system architecture looks like this:

Everything is in place, and each section is analyzed in detail below.

1.1 Wifiservice
Generated Connecttivityservice created by Systemserver startup, responsible for initiating shutdown wpa_supplicant, starting and closing wifimonitor threads, sending commands to Wpa_ supplicant and update the status of WiFi.

Handles the remote WiFi operation that other modules send over through the Iwifimanager interface.

1.2 Wifimonitor
Responsible for receiving event notifications from Wpa_supplicant.

1.3 Wpa_supplicant
1) Read the configuration file
2) Initialize configuration parameters, drive function
3) Let the driver scan all current BSSID
4) Check whether the scanned parameters match the user settings
5) If appropriate, notify the driver for permission and authentication actions
6) Connect the AP

1.4 WiFi Driver Module
Vendor-supplied source, primarily for load firware and kernel wireless communication

1.5 WiFi Power Management module
Main control hardware Gpio and upper and lower power, let the CPU and WiFi module through the Sdio interface or USB interface communication

1.6 WiFi Work steps
1) WiFi Boot
2) Start scanning
3) show the scanned APS
4) Configure the AP
5) Connect the AP
6) Get the IP address
7) Internet access

1.7 WiFi Module Code
1) Wifi Settings app
Packages/apps/settings/src/com/android/settings/wifi

2) Wifi Framework
Frameworks/base/wifi/java/android/net/wifi (UI via Android.net.wifi package
Send command to WIFI.C)

Frameworks/base/core/java/android/net (higher level of network management)
Frameworks/base/services/java/com/android/server

3) Wifi JNI
Frameworks/base/core/jni/android_net_wifi_wifi.cpp
4) WiFi Hardware (WiFi management Library)
Hardware/libhardware_legacy/wifi/wifi.c

5) wpa_supplicant (WiFi tool)

External/wpa_supplicant8
(1) wpa_client (Build library libwpaclient.so)

External/wpa_supplicant_8/wpa_supplicant/src/common/wpa_ctrl.c

(2) wpa_server (Generate daemon Wpa_supplicant)

External/wpa_supplicant_8/wpa_supplicant/main.c
6) Wifi Kernel
Net/wireless drivers/wlan_xxx ARCH/ARM/MACH-XXX/WLAN_PM.C


2. Wifiservice and Wpa_supplicant start-up process
Wifiservice and Wpa_supplicant start the process as shown in:

2.1 Status changes
• The status change process for loading WiFi drivers is as follows:

Initial state: Minitialstate

|
Mdriverunloadedstate

|
Mwaitforp2pdisablestate

|
Mdriverloadingstate (call Wifinative.loaddriver in its enter)

• The status changes of the start wpa_supplicant are as follows:
Called in the ProcessMessage of the Driverloadedstate state wifinative.startsupplicant

3. Automatically turn on WiFi during production
At production time, the default wifi is turned off, and if you need to open it by default, you can modify the following code in Wifiservice.java:

[CPP] View plaincopy
/**
* Check if Wi-Fi needs to BES enabled and start
* If needed
*
* This function was used only at boot time
*/
public void Checkandstartwifi () {
Mairplanemodeon.set (Isairplanemodeon ());
Mpersistwifistate.set (Getpersistedwifistate ());
/* Start If Wi-Fi should is enabled or the saved state indicates Wi-Fi is on */
Boolean wifienabled = shouldwifibeenabled () | | Testandclearwifisavedstate ();
SLOG.I (TAG, "wifiservice starting up with Wi-Fi" +
(wifienabled?) "Enabled": "Disabled"));
Setwifienabled (wifienabled); Force set to True

Mwifiwatchdogstatemachine = Wifiwatchdogstatemachine.
Makewifiwatchdogstatemachine (Mcontext);

}

Android wifi--System Architecture

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.