Summary of the invention
In view of this, the invention provides a kind of method of attachment and device of Wi-Fi network, in order to solve the slower technical problem of Wi-Fi network connection speed in prior art.For realizing described goal of the invention, the invention provides following technical scheme:
A method of attachment for Wi-Fi network, comprising:
When receive with target Wi-Fi network link order time, detect and whether preserve the parameter that is connected for connecting with described target Wi-Fi network; Preservation when wherein, described connection parameter is carried out first connection with described target Wi-Fi network;
If so, according to the connection parameter of described preservation, foundation is connected with described target Wi-Fi network.
Said method, preferably, also comprises:
If not, the first connection of foundation and described target Wi-Fi network, and preserve the connection parameter in described first connection.
Said method, preferably, the first connection of described foundation and described target Wi-Fi network, and preserve the connection parameter in described first connection, comprising:
In a plurality of preset channel, send scan instruction successively, until receive the response instruction corresponding with scan instruction on a certain channel, obtain the sign of this channel;
In described response instruction, including cipher mode and described cipher mode is WPA/WPA2 cipher mode, according to user, input the PMK code that password is corresponding (Pairwise Master Key), set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this PMK code and described target Wi-Fi network be designated connection parameter; Wherein, the sign of this target Wi-Fi network gets from this response instruction;
While including cipher mode and the non-WPA/WPA2 cipher mode of described cipher mode in described response instruction, password according to described user's input, set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this input password and described target Wi-Fi network be designated connection parameter;
While not including cipher mode in described response instruction, set up and being connected of described target Wi-Fi network, and preserve this channel logo and described target Wi-Fi network be designated connection parameter.
Said method, preferably, the connection parameter of the described preservation of described foundation, foundation is connected with described target Wi-Fi network, comprising:
Obtain channel logo and target Wi-Fi network identity in the connection parameter of described preservation;
While including PMK code in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the PMK code of preservation, foundation is connected with described target Wi-Fi network;
While including input password in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the input password of preservation, foundation is connected with described target Wi-Fi network;
While not including PMK code and input password in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, foundation is connected with described target Wi-Fi network.
The application also provides a kind of jockey of Wi-Fi network, comprising:
Connect parameter detecting unit, during for link order when receiving with target Wi-Fi network, whether detection preserves the parameter that is connected for connecting with described target Wi-Fi network; Preservation when wherein, described connection parameter is carried out first connection with described target Wi-Fi network; If so, trigger the first linkage unit;
Linkage unit, for the connection parameter according to described preservation, foundation is connected with described target Wi-Fi network.
Said apparatus, preferably, also comprises:
Connect and storage unit, for when do not detect preserve for connect with described target Wi-Fi network be connected parameter time, set up the first connection with described target Wi-Fi network, and preserve the connection parameter in described first connection.
Said apparatus, preferably, described connection and storage unit comprise:
Scan channel subelement, for sending scan instruction successively in a plurality of preset channel, until receive the response instruction corresponding with scan instruction on a certain channel, obtains the sign of this channel;
First connects preservation subelement, for working as, described response instruction includes the first cipher mode and described the first cipher mode is WPA/WPA2 cipher mode, according to user, input the PMK code that password is corresponding (Pairwise Master Key), set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this PMK code and described target Wi-Fi network be designated connection parameter; Wherein, the sign of this target Wi-Fi network gets from this response instruction;
Second connects preservation subelement, for when described response instruction includes cipher mode and the non-WPA/WPA2 cipher mode of described cipher mode, password according to described user's input, set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this input password and described target Wi-Fi network be designated connection parameter;
The 3rd connect to preserve subelement, and for when described response instruction does not include cipher mode, foundation is connected with described target Wi-Fi network, and preserve this channel logo and described target Wi-Fi network be designated connection parameter.
Said apparatus, preferably, described linkage unit comprises:
Sign is obtained subelement, for obtaining channel logo and the target Wi-Fi network identity of the connection parameter of described preservation;
The first connexon unit, while including PMK code for the described connection parameter when preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the PMK code of preservation, foundation is connected with described target Wi-Fi network;
The second connexon unit, while including input password for the described connection parameter when preserving, on channel corresponding to described channel logo, the input password of preserving according to the cipher mode of described target Wi-Fi network identity, preservation, foundation is connected with described target Wi-Fi network;
The 3rd connexon unit, while not including PMK code and input password for the described connection parameter when preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, foundation is connected with described target Wi-Fi network.
Compared with prior art, the present invention has following beneficial effect:
The embodiment of the present invention provides a kind of Wi-Fi method for connecting network and device, when receive with target Wi-Fi network link order time, detect and whether preserve the parameter that is connected for connecting with described target Wi-Fi network, if preserve, and then the connection parameter of the described preservation of foundation, foundation is connected with described target Wi-Fi network.Compared with prior art, the embodiment of the present invention, when the connection parameter of preservation being detected, is directly obtained this connection parameter of preservation, does not need to expend to search and the connection parameter of reciprocal process to obtain, and connection speed is very fast.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Referring to Fig. 1, the method for attachment flow process that it shows the Wi-Fi network that the embodiment of the present invention provides, specifically comprises:
Step S100: when receive with target Wi-Fi network link order time, detect and whether preserve the parameter that is connected for connecting with described target Wi-Fi network; Preservation when wherein, described connection parameter is carried out first connection with described target Wi-Fi network; If so, perform step S200.
Wherein, when user need to be connected with a certain Wi-Fi network, this network is target Wi-Fi network.By user's operation, trigger and generate link order, and described link order is sent to the executive agent of the embodiment of the present invention, when this executive agent receives after this link order, detect and whether preserved connection parameter.Wherein, described connection parameter is the parameter for being connected with this target Wi-Fi network, the channel that can use including but not limited to sign and the target Wi-Fi network of target Wi-Fi network.When if described connection need to connect password, preserve described connection password simultaneously.
It should be noted that, above-mentioned connection parameter is the parameter of preserving while connecting first with target Wi-Fi network.
Step S200: according to the connection parameter of described preservation, foundation is connected with described target Wi-Fi network.
From above technical scheme, the Wi-Fi method for connecting network that the embodiment of the present invention provides, when receive with target Wi-Fi network link order time, detect and whether preserve the parameter that is connected for connecting with described target Wi-Fi network, if preserve, and then the connection parameter of the described preservation of foundation, foundation is connected with described target Wi-Fi network.Compared with prior art, the embodiment of the present invention, when the connection parameter of preservation being detected, is directly obtained this connection parameter of preservation, does not need to expend to search and the connection parameter of reciprocal process to obtain, and connection speed is very fast.
Alternatively, as shown in Figure 1, on the basis of said method embodiment, can also comprise: when step S100 is when the determination result is NO, execution step S300.
Step S300: the first connection of foundation and described target Wi-Fi network, and preserve the connection parameter in described first connection.
When do not detect preserve for connect with described target Wi-Fi network be connected parameter time, illustrate that this time that generates link order is connected to first connection, therefore, need to connect with this target Wi-Fi network.It should be noted that, first connection can be to utilize any one connected mode of the prior art.
Alternatively, referring to Fig. 2, step S300 can realize in the following manner:
Step S301: send scan instruction successively in a plurality of preset channel, until receive the response instruction corresponding with scan instruction on a certain channel, obtain the sign of this channel.
Wherein, what Wi-Fi network was used is wireless signal, corresponding a plurality of fixing radio communication channels.Corresponding 14 channels of Wi-Fi network, the wireless signal of each channel fixed frequency range.It should be noted that, when connecting a certain concrete Wi-Fi network, need to inquire about the channel that this network is used.
In the present embodiment, in described a plurality of channels, send scan instruction successively.Alternatively, according to channel logo sequence, send successively scan instruction.Particularly, according to channel 1, signal 2, channel 3 ... the order of channel 14 sends scan instruction successively.Wherein, described scan instruction is Probe Request, includes loading section Frame Body, further in this instruction, in described loading section, include ssid field, the value of this field is the title of searching the target Wi-Fi network using when target Wi-Fi network is used channel.
Wherein, during access points (AP) corresponding to the target Wi-Fi network identity that comprises in described scan instruction if exist in a certain channel, this wireless access points can return to the response instruction corresponding with this scan instruction by this channel, show that target target Wi-Fi network is used this channel, and then obtain the sign of this channel.
Alternatively, described response instruction is Probe Respond, and includes loading section, determines the attribute Capability in this loading section, checks the value of Privacy field in this attribute.When this field value is 1, show to include cipher mode in response instruction and cipher mode is WEP cipher mode; When this field value is not 1, further check the content of Vendor Specific field, if comprise WPA information in this field, show to include cipher mode in response instruction and cipher mode is WPA cipher mode, be more specifically WPA TKIP encryption mode, in the case, can further check RSN field, if this field is not empty, the cipher mode that shows this target Wi-Fi network is the WPAAES cipher mode in WPA cipher mode; When the value of each field is sky above, show that this target Wi-Fi network is non-encrypted network.In addition, by checking the version in loading section, can know whether described WPA cipher mode is WPA2 cipher mode.
Step S302: including cipher mode and described cipher mode in described response instruction is WPA/WPA2 cipher mode, according to user, input the PMK code that password is corresponding (Pairwise Master Key), set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this PMK code and described target Wi-Fi network be designated connection parameter; Wherein, the sign of this target Wi-Fi network gets from this response instruction.
Wherein, after receiving response instruction, and include cipher mode in described response instruction, show that described target Wi-Fi network is refined net, user need to input password (PSK code).If cipher mode is WPA/WPA2 cipher mode, need to calculate user and input the PMK code that password is corresponding, utilize this PMK code again to send the link order with target Wi-Fi network, to connect and being connected of target Wi-Fi network.
It should be noted that, the cipher mode of preserving in this step is WPA/WPA2 cipher mode.Meanwhile, in the above-mentioned response instruction that described target Wi-Fi network returns, include the sign of target Wi-Fi network, be specially the value of BSSID field in response instruction.This sign is the sign that wireless access points arranges, and this sign has uniqueness, is used for unique location this target Wi-Fi network.
Step S303: while including cipher mode and the non-WPA/WPA2 cipher mode of described cipher mode in described response instruction, password according to described user's input, set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this input password and described target Wi-Fi network be designated connection parameter.
Wherein, if the non-WPA/WPA2 cipher mode of cipher mode is for example WEP cipher mode, the password that directly utilizes user to input, sends link order, connects.It should be noted that, the non-WPA/WPA2 cipher mode of described cipher mode of preservation, when the cipher mode getting from response instruction is which kind of cipher mode which kind of save as.
Step S304: while not including cipher mode in described response instruction, set up and being connected of described target Wi-Fi network, and preserve this channel logo and described target Wi-Fi network be designated connection parameter.
Wherein, while not including cipher mode in response instruction, show the non-encrypted network of target Wi-Fi network.In the link order sending, do not need to comprise password, can connect.
From above technical scheme, in the Wi-Fi method for connecting network that the application provides, can, in setting up the process of first connection, preserve the connection parameter of using while connecting simultaneously.And, can whether encrypt and whether cipher mode is that WPA/WPA2 encrypts according to target Wi-Fi network, correspondingly preserve and connect parameter, realized the preservation to the connection parameter in the different safe mode situations of WPA/WPA2 refined net, non-WPA/WPA2 refined net and non-encrypted network.
Referring to Fig. 3, the step S200 in said method embodiment can realize in the following manner:
Step S201: obtain channel logo and target Wi-Fi network identity in the connection parameter of described preservation;
Step S202: while including PMK code in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the PMK code of preservation, foundation is connected with described target Wi-Fi network;
Step S203: while including input password in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the input password of preservation, foundation is connected with described target Wi-Fi network;
Step S204: while not including PMK code and input password in the described connection parameter of preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, foundation is connected with described target Wi-Fi network.
From above technical scheme, the Wi-Fi method for connecting network that the embodiment of the present invention provides, the connection parameter that can preserve under different safe modes according to target Wi-Fi network connects accordingly.It should be noted that, in connection procedure, use be the connection parameter preserving according to first connection, comprising channel logo, therefore, unlike the prior art, the present invention need to not search successively target Wi-Fi network in a plurality of channels, can save the search time of channel.
Further, for the target Wi-Fi network of encrypting, the embodiment of the present invention is used the password of preserving in advance, does not need user again to input password, has saved password input time.Further, when the cipher mode of refined net is WAP/WAP2 cipher mode, uses and calculate in advance the PMK code that generates and preserve, saved the time according to the cryptographic calculations PMK code of user's input, saved the key rise time.
In addition, when according to the connection parameter of above-mentioned preservation, and during unsuccessful connecting, can re-start according to new target Wi-Fi network identity the first connection with new target Wi-Fi network.
Through evidence, the Wi-Fi method for connecting network that the embodiment of the present invention provides, compared with the connection setup time of prior art 5-6 second, can minimumly reduce to 0.75 second, and visible, network connection speed obviously promotes.
The Wi-Fi the network connection device below embodiment of the present invention being provided is introduced, and it should be noted that, hereinafter the introduction of Wi-Fi network connection device can, referring to the explanation above Wi-Fi network being connected, not repeated at this.
Referring to Fig. 4, the structure that it shows the Wi-Fi network connection device that the embodiment of the present invention provides, specifically comprises:
Connect parameter detecting unit 100, during for link order when receiving with target Wi-Fi network, whether detection preserves the parameter that is connected for connecting with described target Wi-Fi network; Preservation when wherein, described connection parameter is carried out first connection with described target Wi-Fi network; If so, trigger the first linkage unit;
Linkage unit 200, for the connection parameter according to described preservation, foundation is connected with described target Wi-Fi network.
From above technical scheme, the Wi-Fi network connection device that the embodiment of the present invention provides, when receive with target Wi-Fi network link order time, detect and whether preserve the parameter that is connected for connecting with described target Wi-Fi network, if preserve, and then the connection parameter of the described preservation of foundation, foundation is connected with described target Wi-Fi network.Compared with prior art, the embodiment of the present invention, when the connection parameter of preservation being detected, is directly obtained this connection parameter of preservation, does not need to expend to search and the connection parameter of reciprocal process to obtain, and connection speed is very fast.
Alternatively, as shown in Figure 4, on the basis of said method embodiment, can also comprise: connect and storage unit 300, for when do not detect preserve for connect with described target Wi-Fi network be connected parameter time, the first connection of foundation and described target Wi-Fi network, and preserve the connection parameter in described first connection.
Alternatively, referring to Fig. 5, described connection and storage unit 300 can specifically comprise:
Scan channel subelement 301, for sending scan instruction successively in a plurality of preset channel, until receive the response instruction corresponding with scan instruction on a certain channel, obtains the sign of this channel;
First connects preservation subelement 302, for working as, described response instruction includes the first cipher mode and described the first cipher mode is WPA/WPA2 cipher mode, according to user, input the PMK code that password is corresponding (Pairwise Master Key), set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this PMK code and described target Wi-Fi network be designated connection parameter; Wherein, the sign of this target Wi-Fi network gets from this response instruction;
Second connects preservation subelement 303, for when described response instruction includes cipher mode and the non-WPA/WPA2 cipher mode of described cipher mode, password according to described user's input, set up and being connected of described target Wi-Fi network, and preserve this channel logo, this cipher mode, this input password and described target Wi-Fi network be designated connection parameter;
The 3rd connect to preserve subelement 304, and for when described response instruction does not include cipher mode, foundation is connected with described target Wi-Fi network, and preserve this channel logo and described target Wi-Fi network be designated connection parameter.
Alternatively, referring to Fig. 6, described linkage unit 200 can specifically comprise:
Sign is obtained subelement 201, for obtaining channel logo and the target Wi-Fi network identity of the connection parameter of described preservation;
The first connexon unit 202, while including PMK code for the described connection parameter when preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, the cipher mode of preservation and the PMK code of preservation, foundation is connected with described target Wi-Fi network;
The second connexon unit 203, while including input password for the described connection parameter when preserving, on channel corresponding to described channel logo, the input password of preserving according to the cipher mode of described target Wi-Fi network identity, preservation, foundation is connected with described target Wi-Fi network;
The 3rd connexon unit 204, while not including PMK code and input password for the described connection parameter when preserving, on channel corresponding to described channel logo, according to described target Wi-Fi network identity, foundation is connected with described target Wi-Fi network.
It should be noted that, each embodiment in this specification all adopts the mode of going forward one by one to describe, and each embodiment stresses is the difference with other embodiment, between each embodiment identical similar part mutually referring to.
Above-mentioned explanation to the disclosed embodiments, makes professional and technical personnel in the field can realize or use the present invention.To the multiple modification of these embodiment, will be apparent for those skilled in the art, General Principle as defined herein can, in the situation that not departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.