Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific realApplying mode, the present invention is described in further detail.
Referring to Fig.1, a kind of step flow chart of the connection method embodiment 1 of Wireless LAN of the invention is shown,It can specifically include following steps:
Step 101, when the connection identifier for detecting the Wireless LAN in operation panel is triggered, wireless office is obtainedThe scanning result of domain network;
It should be noted that the embodiment of the present invention can be applied in mobile device, for example, mobile phone, tablet computer, intelligenceWrist-watch etc., the embodiments of the present invention are not limited thereto.
In a mobile device, usually provide one can quickly starting operation panel, such as in the arbitrary interface of mobile deviceDrop-down expansion or pull-up expansion.
In the operation panel, it is integrated with the shortcut of a variety of common functions, such as WLAN, flashlight, vibration, dataNetwork etc. when the user clicks when corresponding shortcut, can directly apply the function, without opening the function in mobile deviceIn respective interface started, be convenient for users to operate.
It takes the mobile phone as an example, as shown in Fig. 2, operation panel 201 can be unfolded by way of pull-up in mobile phone 200,The shortcut 202 (i.e. the connection identifier of Wireless LAN) of WLAN is contained in the operation panel 201, when the user clicksWhen the shortcut 202 of WLAN, mobile phone 200 can carry out the connection of WLAN.
In the concrete realization, mobile device can obtain the scanning result of WLAN, the scanning knot when carrying out the connection of WLANFruit can formerly scan the scanning result of WLAN near adjacent area for mobile device, or mobile device Current Scan phaseThe scanning result of WLAN near neighbouring region, the embodiments of the present invention are not limited thereto.
Wherein, which may include judging that the first Wireless LAN identifies (such as SSID (Service SetIdentifier, service set), BSSID (a kind of application of Ad-hoc (point-to-point) LAN) etc.), the first cipher mode is (such asWEP (802.11 Wired Equivalent Privacy), WPA (Wi-Fi Protected Access) etc.), signal strength,Frequency etc..
Step 102, judge whether the scanning result matches with the information for the Wireless LAN formerly connecting;
In practical applications, mobile device can have its relevant information in configuration file, tool to the WLAN connectedBody may include that the second Wireless LAN identifies (such as SSID, BSSID), the second cipher mode (such as WEP, WPA), and secondWireless LAN password etc..
The embodiment of the present invention obtains the Wireless LAN formerly connected by the configuration file of calling mobile deviceInformation is compared with the scanning result of WLAN.
In one preferred embodiment of the invention, step 102 may include following sub-step:
The first Wireless LAN mark and first cipher mode are judged, with second WLANWhether network mark and the second cipher mode are identical;
If so, confirm the information matches of the scanning result with the Wireless LAN formerly connecting,
If it is not, then confirming that the scanning result is mismatched with the information for the Wireless LAN formerly connecting.
In embodiments of the present invention, the scanning result of WLAN and the information for the WLAN formerly connecting can be compared, ifWireless LAN having the same mark (such as SSID) and cipher mode, if so, think the two WLAN be it is identical, it is noThen, it is believed that the two WLAN are not identical.
Step 103, when mismatching, the set interface of Wireless LAN is loaded, to show at least partly scanning result;
If the scanning result of WLAN is mismatched with the information for the WLAN formerly connecting, it can indicate that mobile device is firstThe not connected WLAN scanned, alternatively, the information of storage is no longer valid (such as SSID changes, information is deleted), it can not be directWLAN is accessed, under normal circumstances, user needs the control being arranged by system to enter system set interface, is then arranged in systemThe set interface of WLAN is found at interface, then carries out the selection and setting of WLAN, to access WLAN.
In embodiments of the present invention, the set interface that can load Wireless LAN automatically adds in the set interfaceIt is loaded onto small part scanning result and shows user, wherein may include that the first Wireless LAN mark (such as SSID), signal are strongDegree etc..
It should be noted that the set interface can be to be configured the interface of WLAN in mobile device, not in homologous rayWith different call methods.
For example, can be sent in the mobile device for being configured with Android (Android) system "The Intent of android.settings.WIFI_SETTINGS " (the set interface call request of WLAN) (is intended to, for solvingCommunication between every component of Android application) deactivation WLAN set interface, example is specific as follows:
Intent intent=new Intent (" android.settings.WIFI_SETTINGS ");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
Step 104, when receiving the first Wireless LAN password for first Wireless LAN mark,First Wireless LAN is accessed using the first Wireless LAN password and identifies corresponding Wireless LAN.
In the set interface of WLAN, user can be for the WLAN that some is scanned (with the first Wireless LAN markKnow characterization), the first Wireless LAN password is inputted, then mobile device can be accessed using the first Wireless LAN passwordThe WLAN.
By taking android system as an example, the process for accessing WLAN be can be such that
Connection request part
The connect function of one .Settings responds connection, updates network and saves configuration, updates what setting currently selectedHighest priority, and save.Then other networks are made to should not be used to be attached by enableNetwork.Finally callThe network that the reconnect functional link of WifiManager currently selects.
The reconnect function of two .WifiManager passes through the Binder mechanism of AIDL, calls WifiService'sReconnect function
Then three, can call the reconnectCommand function of WifiStateTracker, pass through JNI (android_Net_wifi_Wifi android_net_wifi_reconnectCommand function) is sent to WPA_WPASUPPLICANTRECONNECT order.
Four .android_net_wifi_Wifi are adjusted by doCommand (command name, response buffering, response buffer size)Order is sent with the wifi_command function in wifi.c.
Five, send bind command to control channel finally by the wpa_ctrl_request function of wpa_ctrl.
Return to requested part
Six, WPA_SUPPLICANT after connection is upper can send successful connection order to control channel.Wifi.c'sWifi_wait_for_event function obstruction calls and returns to the character string (CONNECTED) of this order.
Then WifiMonitor can be executed to handle this event seven, and WifiMonitor is recalledThe notifyStateChange of WifiStateTracker, WifiStateTracker then then can send EVENT_ toward itselfDHCP_START message goes to obtain IP address to start DHCP, then broadcasts NETWORK_STATE_CHANGED_ACTION and disappearsBreath, is finally responded by WifiSettings class, changes state and interface information.
Wherein, the function of connect function can be such that
1.updateNetwork:updateNetwork (config) can be by the AP configuration information information of current selection connectionTransmitting is entered, and configuration information has (network ID etc.).Network configuration is added again if network ID is -1, then to wpa_Supplicant transmission SET_NETWORK order (some other relevant information is arranged by this network ID, SSID is set,Password etc.) directly execution later step sends SET_NETWORK order if network configuration is not -1.
2.saveNetwork: supplicant is told to save current network and configure and update list.SaveNetwork meetingIt calls the saveConfiguration of WifiService to send SAVE_CONFIG order to wpa_supplicant to save currentlyNetwork configuration information retransmits RECONFIGURE order to wpa_supplicant and obtains configuration if returning to falseInformation, if after obtaining information success, it can mono- NETWORK_IDS_CHANGED_ACTION event of IntentWifiSettings, which can be registered, to be received this time and updates list.
3.enableNetwork function obtains interface name to system and makes the interface effective.Due to front transferDisableOthers be true then to wpa_supplicant send SELECT_NETWORK (if transmitting be false if send outSend ENABLE_NETWORK order),
4.reconnect function: connection AP.
Scanning result and the information of the Wireless LAN that formerly connect of the embodiment of the present invention in Wireless LANWhen mismatch, the automatic set interface for loading Wireless LAN, to show at least partly scanning result, by receive theOne Wireless LAN password accesses corresponding Wireless LAN, reduces opening system set interface, selection wireless local areaThe operation of the set interface of network improves the simplicity of operation, improves the speed of access Wireless LAN.
In one preferred embodiment of the invention, this method can also include the following steps:
Upon a match, the second Wireless LAN mark is accessed using the second Wireless LAN password to correspond toWireless LAN.
If the information matches of the scanning result of WLAN and the WLAN formerly connecting, it can indicate that mobile device formerly connectsThe WLAN scanned is taken over, and, the information of storage is effective, and the WLAN that can be directly used in configuration file is (wireless with secondLocal area network mark characterization) the second Wireless LAN password access the WLAN.
It should be noted that if the WLAN of information matches is two or more, then it can be according to preset selecting partyFormula (such as connection signal is most strong) is attached, and the embodiments of the present invention are not limited thereto.
By taking android system as an example, the process for accessing WLAN be can be such that
It is selected from scanning result by its selection mechanism (for example, strongest AP of selection signal etc.) in wpa_supplicantOne AP is attached, can be by connection state reporting after wpa_supplicant connection AP, and WifiMonitor receives state and changesWifiStateMachine is transmitted to after the message of change, then WifiStateMachine sends broadcast notice APP.
Referring to Fig. 3, a kind of step flow chart of the connection method embodiment 2 of Wireless LAN of the invention is shown,It can specifically include following steps:
Step 301, when meeting preset loading environment, load Wireless LAN driving;
Using the embodiment of the present invention, the loading environment of WLAN driving can be preset, meets the loading environment in judgementWhen, the driving of pre-loaded WLAN.
Meaning of the embodiment of the present invention " preparatory " can be relative to normal load (i.e. the connection of user's triggering starting WLAN)For.
Wherein, which at least may include one or more of:
1, system starts and does not access Wireless LAN;
In this example, by taking android system as an example, operating system during startup, will start System_serverThe process of (system service) starts WifiService (Wi-Fi service) in System_server, and createsThe state machine of WifiController (Wi-Fi controller) reads a data in the constructed fuction of WifiControllerThe value in library, the value can record the switch state of WLAN in real time, judge whether Wi-Fi (i.e. WLAN) opens (access), if connecingEnter, then can load WLAN driving.
2, Wireless LAN driving is closed.
In this example, by taking android system as an example, WLAN can issue the broadcast of WLAN closing after closing, at this time WLANComponent thoroughly closes power down, this example is when receiving the broadcast of WLAN closing, load WLAN driving.
Certainly, above-mentioned loading environment is intended only as example, in implementing the embodiments of the present invention, can set according to the actual situationOther loading environments are set, the embodiments of the present invention are not limited thereto.In addition, other than above-mentioned loading environment, art technologyPersonnel can also use other loading environments according to actual needs, and the embodiment of the present invention is also without restriction to this.
It, can be with linux kernel modular form dynamically load by taking android system as an example when loading WLAN drivingThe executable code that WLAN bottom function is realized is dispatched by operating system and is executed, and is worked to driving chip and according to nothingLine LAN protocol is interacted and is handled, with the co-ordination of linux kernel protocol stack to transmitting/receiving wireless LAN data packet,It is interacted simultaneously with Block Mid and state feedback to graphic user interface (Graphical User Interface, GUI).
Step 302, initialization process is carried out to Wireless LAN component.
It should be noted that Wireless LAN component is physical hardware (chip), such as Wi-Fi component.
Mobile device insertion wlan component can directly utilize wireless technology (such as Wi-Fi) to access WLAN.
To the initialization process that wlan component carries out, it can specifically refer to the relevant variable of initialization WLAN, parameter etc..
In embodiments of the present invention, load WLAN driving, initializes wlan component, and mobile device can be made to enter and at any time may be usedWhen scan pattern, it is to close, but wlan component is in the state of work that user, which looks at WLAN, can directly scan surroundingWlan network.
The pre-loaded Wireless LAN driving of the embodiment of the present invention carries out at initialization Wireless LAN componentReason reduces the load operation when starting Wireless LAN and initialization operation, further improves access WLANThe speed of network.
Step 303, when detecting operation panel load, judge whether to have accessed Wireless LAN;If it is not, then executingStep 304;
Step 304, it is driven by Wireless LAN and calls Wireless LAN component scans Wireless LAN, to obtainObtain scanning result.
Step 305, when detecting that operation panel is closed, stop Wlan scanning network.
Due to the prompt operation of operation panel, function needed for user is accustomed to the starting of opening operation panel, including connecingEnter WLAN.
When listening to prompt operation panel opening, a process can star, judge whether WLAN opens by the processIt opens, the wlan network around (such as timing scan) can be scanned if being not turned on, and update the scanning result of caching.
When listening to operation panel closing, can indicate stop scanning temporarily without the demand of starting WLAN.
The previously-scanned Wireless LAN of the embodiment of the present invention reduces the scan operation when starting Wireless LAN,Further improve the speed of access Wireless LAN.
It should be noted that load operation (step 301), initialization operation (step 302) can be in scan operation (steps304) it is executed before, it is possible to reduce in the load operation of Wlan scanning network, initialization operation, improve the speed of scanningDegree further improves the speed of access Wireless LAN.
Step 306, when the connection identifier for detecting the Wireless LAN in operation panel is triggered, wireless office is obtainedThe scanning result of domain network;
Step 307, judge whether the scanning result matches with the information for the Wireless LAN formerly connecting;
Step 308, when mismatching, the set interface of Wireless LAN is loaded, to show at least partly scanning result;Wherein, the scanning result of display is identified including the first Wireless LAN;
Step 309, when receiving the first Wireless LAN password for first Wireless LAN mark,First Wireless LAN is accessed using the first Wireless LAN password and identifies corresponding Wireless LAN.
It should be noted that for simple description, therefore, it is stated as a series of action groups for embodiment of the methodIt closes, but those skilled in the art should understand that, embodiment of that present invention are not limited by the describe sequence of actions, because according toAccording to the embodiment of the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art also shouldKnow, the embodiments described in the specification are all preferred embodiments, and the related movement not necessarily present invention is implementedNecessary to example.
Referring to Fig. 4, a kind of structural block diagram of the attachment device embodiment of Wireless LAN of the invention is shown, specificallyMay include following module:
Scanning result obtains module 401, in the connection identifier quilt for detecting the Wireless LAN in operation panelWhen triggering, the scanning result of Wireless LAN is obtained;
Information matches module 402, for judging the information of the scanning result with the Wireless LAN formerly connectingWhether match;
Set interface loading module 403, for loading the set interface of Wireless LAN when mismatching, with displayAt least partly scanning result;Wherein, the scanning result of display is identified including the first Wireless LAN;
First AM access module 404, for receiving the first wireless office for first Wireless LAN markWhen the network cipher of domain, first Wireless LAN is accessed using the first Wireless LAN password and identifies corresponding nothingLine local area network.
In one preferred embodiment of the invention, the information of the Wireless LAN formerly connected may include secondWireless LAN mark and the second Wireless LAN password;
Described device can also include following module:
Second AM access module, for accessing second nothing using the second Wireless LAN password in matchingLine local area network identifies corresponding Wireless LAN.
It in one preferred embodiment of the invention, may include the first Wireless LAN mark in the scanning resultAnd first cipher mode, the information of the Wireless LAN formerly connected include the second Wireless LAN identify and second plusClose mode;
The information matches module 402 may include following submodule:
Judging submodule, it is and described for judging first Wireless LAN mark and first cipher modeWhether the second Wireless LAN mark and the second cipher mode are identical;If so, the first confirmation submodule is called, if it is not, thenCall the second confirmation submodule;
First confirmation submodule, confirms the information matches of the scanning result with the Wireless LAN formerly connecting;
Second confirmation submodule does not confirm the scanning result and the information for the Wireless LAN formerly connecting notMatch.
In one preferred embodiment of the invention, which can also include following module:
Network insertion judgment module, for judging whether to have accessed WLAN when detecting operation panel loadNetwork;If it is not, then calling scan module;
Scan module calls Wireless LAN component scans WLAN for driving by Wireless LANNetwork, to obtain scanning result.
In one preferred embodiment of the invention, which can also include following module:
Stop scan module, for stopping Wlan scanning network when detecting that operation panel is closed.
In one preferred embodiment of the invention, which can also include following module:
Loading module, for when meeting preset loading environment, load Wireless LAN to be driven;
Initialization module, for carrying out initialization process to Wireless LAN component.
In the concrete realization, the loading environment may include system starting and not access Wireless LAN, and/or,Wireless LAN driving is closed.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simplePlace illustrates referring to the part of embodiment of the method.
All the embodiments in this specification are described in a progressive manner, the highlights of each of the examples are withThe difference of other embodiments, the same or similar parts between the embodiments can be referred to each other.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can provide as method, apparatus or calculateMachine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software andThe form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer canWith in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program codeThe form of the computer program product of implementation.
The embodiment of the present invention be referring to according to the method for the embodiment of the present invention, terminal device (system) and computer programThe flowchart and/or the block diagram of product describes.It should be understood that flowchart and/or the block diagram can be realized by computer program instructionsIn each flow and/or block and flowchart and/or the block diagram in process and/or box combination.It can provide theseComputer program instructions are set to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminalsStandby processor is to generate a machine, so that being held by the processor of computer or other programmable data processing terminal devicesCapable instruction generates for realizing in one or more flows of the flowchart and/or one or more blocks of the block diagramThe device of specified function.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing terminal devicesIn computer-readable memory operate in a specific manner, so that instruction stored in the computer readable memory generates packetThe manufacture of command device is included, which realizes in one side of one or more flows of the flowchart and/or block diagramThe function of being specified in frame or multiple boxes.
These computer program instructions can also be loaded into computer or other programmable data processing terminal devices, so thatSeries of operation steps are executed on computer or other programmable terminal equipments to generate computer implemented processing, thusThe instruction executed on computer or other programmable terminal equipments is provided for realizing in one or more flows of the flowchartAnd/or in one or more blocks of the block diagram specify function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, once a person skilled in the art knows basesThis creative concept, then additional changes and modifications can be made to these embodiments.So the following claims are intended to be interpreted asIncluding preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to byOne entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operationBetween there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaningCovering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements not only wrapThose elements are included, but also including other elements that are not explicitly listed, or further includes for this process, method, articleOr the element that terminal device is intrinsic.In the absence of more restrictions, being wanted by what sentence "including a ..." limitedElement, it is not excluded that there is also other identical elements in process, method, article or the terminal device for including the element.
Connection method to a kind of Wireless LAN provided by the present invention and a kind of company of Wireless LAN aboveConnection device is described in detail, and used herein a specific example illustrates the principle and implementation of the invention,The above description of the embodiment is only used to help understand the method for the present invention and its core ideas;Meanwhile for the one of this fieldAs technical staff, according to the thought of the present invention, there will be changes in the specific implementation manner and application range, to sum up instituteIt states, the contents of this specification are not to be construed as limiting the invention.