A kind of WIFI module and a plurality of AP carry out the method for WPS session negotiation simultaneously
Technical field
The present invention relates to a kind of WIFI module and a plurality of AP and carry out the method for WPS session negotiation simultaneously.
Background technology
Nearly all smart machine is with the WIFI function, and the user can realize online by WIFI, obtains required Internet resources, and its application is ubiquitous.A kind of WPS technology connected for safety is arranged in the WIFI function, and WPS is the abbreviation of WIFI Protected Setup, is up-to-date a kind of mode that simple connection is provided be applied in wireless network at present, receives and is divided into PBC, PIN, and tri-kinds of NFC.WPS can effectively simplify the connection procedure between WIFI module and AP, and protection mechanism safely and efficiently is provided, and wherein AP is the abbreviation of Access Point, i.e. wireless access points.
Yet all there is a problem in existing WPS mechanism: when WIFI module and an AP carry out WPS when being connected, when the WIFI module receives beacon frame (the Beacon Frame of the WPS of other AP, that AP starts the data that externally send after the WPS connection, declare that this AP has started the WPS connection, the WIFI module can obtain by beacon frame the information of AP) time, according to the WPS agreement of standard the WIFI module at once the transmitted signal reject frame (be WSC_NACK, mean that WIFI equipment refusal carries out WPS with AP and is connected), cause the WIFI module not carry out WPS with other AP is connected simultaneously.This has just brought the place of an inconvenience: if after the WPS connection failure that WIFI module and this AP carry out, the WPS that the user must manually restart the WIFI module connects, and could be connected with second AP, has increased user's operating procedure.
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of WIFI module and a plurality of AP to carry out the method for WPS session negotiation simultaneously, solves the existing loaded down with trivial details problem of WPS Connection Step.
The present invention is achieved in that
A kind of WIFI module and a plurality of AP carry out the method for WPS session negotiation simultaneously, it is characterized in that: comprise the steps:
Step 10, use WIFI module are obtained the AP signal that pending WPS connects on every side, the AP signal that record gets;
Step 20, select an AP signal from the AP signal recorded;
Step 30, use WIFI module are carried out the WPS connection to the AP signal of having selected, and detect connection result;
If step 40 connection result is successfully, end session negotiations process or all unselected AP signals are sent to AP signal reject frames end session negotiations process; Otherwise connection result is unsuccessfully, detects and whether also have non-selected AP signal;
If step 50 also has non-selected AP signal, from non-selected AP signal, select an AP signal, return to step 30; If there is no unselected AP signal, end session negotiations process.
Further, in described step 30, the concrete steps of using the WIFI module to carry out the WPS connection to the AP signal of having selected are:
Use the WIFI module to send the authentication start frame to the AP signal selected, set the first time-out time, wait for receiver module identification request frame, if the first time-out time to and do not receive module id claim frame, connection failure;
Otherwise receive the module id claim frame in the first time-out time, use WIFI module sending module sign acknowledgement frame, set the second time-out time, wait for and receive the initiation requests frame, if the second time-out time to and do not receive initiation requests frame, connection failure;
Otherwise receive the initiation requests frame in the second time-out time, use WIFI module sending module authentication information frame, set the 3rd time-out time, wait routing iinformation frame waiting, if the 3rd time-out time to and do not receive routing iinformation frame, connection failure;
Otherwise receive the initiation requests frame in the 3rd time-out time, successful connection.
Further, in step 50, if the AP signal of the Unrecorded pending WPS connection got is arranged, record this AP signal in step 20.
Further, described AP is Soft AP.
And the system that the present invention also provides a kind of while and a plurality of AP carry out the WPS session negotiation, include the WIFI module, it is characterized in that: comprise as lower module:
Signal acquisition module: for using the WIFI module, obtain the AP signal that pending WPS connects on every side, the AP signal that record gets;
Signal selection module: for the AP signal from having recorded, select an AP signal;
Signal link block: for using the WIFI module, the AP signal of having selected is carried out to the WPS connection, detect connection result;
Signal detection module: if be successfully for connection result, end session negotiations process or all unselected AP signals are sent to AP signal reject frames end session negotiations process; Otherwise connection result is unsuccessfully, detects and whether also have non-selected AP signal;
And signal is selected module again: if for also having non-selected AP signal, from non-selected AP signal, select an AP signal, and be delivered to the signal link block; If there is no unselected AP signal, end session negotiations process.
The present invention has following advantage: the user only needs to start a WPS and connects, and just can carry out the WPS session negotiation with the AP of a plurality of startup WPS, and complete the network connection when having available network to connect, and has simplified connection procedure, has played good effect.
The accompanying drawing explanation
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is method flowchart of the present invention.
Fig. 2 is system configuration schematic diagram of the present invention.
Embodiment
Please, in conjunction with Fig. 1 and Fig. 2, below will be elaborated to embodiments of the invention.
A kind of WIFI module and a plurality of AP carry out the method for WPS session negotiation simultaneously, and the flow process of this session negotiation starts from step S101, in step S101, use the WIFI module to obtain the AP signal that pending WPS connects on every side, the AP signal that record gets.The AP signal is meeting broadcast beacon frame (beacon frame) when work, and the WIFI module judges by getting beacon frame whether the AP signal is in pending WPS connection status, and the AP signal that has got pending WPS connection can directly be recorded on memory.
Then enter in step S102, select an AP signal in the AP signal recorded from step S101.Can select at random an AP signal or select in order an AP signal according to the connect hours that gets the AP signal.In step S103, first use the WIFI module to carry out the WPS connection to the AP signal of having selected in step S102, then detect connection result, whether successfully at step S104, detect connection result.
That the AP signal of having selected is carried out when WPS connects generally adopting is EAPOL or EAP authentication mechanism (Extensible Authentication Protocol, it is EAP, be an authentication mechanism generally used, often be used in the connection of wireless network or point-to-point).The key step that WPS connects is as follows: use the WIFI module to send authentication start frame (EAP-Start) to the AP signal selected, set the first time-out time, wait for receiver module identification request frame (EAP-Request/identity), if the first time-out time to and do not receive module id claim frame, connection failure.
Otherwise receive the module id claim frame in the first time-out time, use WIFI module sending module sign acknowledgement frame (EAP-Response/identity), set the second time-out time, wait for and receive initiation requests frame (EAP-Request (Start)), if the second time-out time to and do not receive initiation requests frame, connection failure.
Otherwise receive the initiation requests frame in the second time-out time, use WIFI module sending module authentication information frame (EAP-Response(M1)), set the 3rd time-out time, etc. routing iinformation frame waiting (EAP-Request (M2D)), if the 3rd time-out time to and do not receive routing iinformation frame, connection failure; Otherwise receive the initiation requests frame in the 3rd time-out time, successful connection.After time-out time of above-mentioned setting, do not receive reply if overtime, possibility AP work is undesired, connection failure.The connection that just can use the routing iinformation that gets to be surfed the Net after successful connection.
If connection result is successfully, entering step S107 sends AP signal reject frame and enters the negotiations process of step S108 end session all unselected AP signals, also can directly finish WPS session negotiation process, unselected AP signal not processed.Otherwise connection result is unsuccessfully, enters step S105 and detect whether also have non-selected AP signal.
If also have non-selected AP signal, also have untreated AP signal, enter step S106 and select an AP signal from non-selected AP signal, return to step S103, circular treatment, select an AP signal of not processing to be connected again after connection failure.If there is no unselected AP signal, all AP signals all are disposed, and enter the negotiations process of step S108 end session.
If the while in step S107, if the AP signal of the Unrecorded pending WPS connection got is arranged, is recorded this AP signal at step S103.The AP signal that Unrecorded pending WPS is connected is recorded when the session negotiation failure can connect trial to these AP signals.
The AP that carries out the WPS session negotiation can or be Soft AP for common router-A P, and Soft AP is software simulation AP, at notebook or intelligent movable equipment, can use software simulation AP.
The present invention simultaneously also provides a kind of system that realizes the inventive method, it is the system that a kind of while and a plurality of AP carry out the WPS session negotiation, as shown in Figure 2, native system comprises signal acquisition module 1, signal selection module 2, signal link block 3, signal detection module 4 and signal are selected module 5 again, wherein:
Signal acquisition module 1: for using the WIFI module, obtain the AP signal that pending WPS connects on every side, the AP signal that record gets;
Signal selection module 2: for the AP signal from having recorded, select an AP signal;
Signal link block 3: for using the WIFI module, the AP signal of having selected is carried out to the WPS connection, detect connection result;
Signal detection module 4: if be successfully for connection result, end session negotiations process or all unselected AP signals are sent to AP signal reject frames end session negotiations process; Otherwise connection result is unsuccessfully, detects and whether also have non-selected AP signal;
And signal is selected module 5 again: if for also having non-selected AP signal, from non-selected AP signal, select an AP signal, and be delivered to the signal link block; If there is no unselected AP signal, end session negotiations process.
By the present invention, a plurality of WPS sessions can be searched for simultaneously and store to the WIFI module, and order is carried out, until one of them WPS session success or all failures.The present invention only starts a WPS and connects, and just can carry out the WPS session negotiation with the AP of a plurality of startup WPS, has played good effect.
Although more than described the specific embodiment of the present invention; but being familiar with those skilled in the art is to be understood that; our described specific embodiment is illustrative; rather than for the restriction to scope of the present invention; those of ordinary skill in the art are in modification and the variation of the equivalence of doing according to spirit of the present invention, all should be encompassed in the scope that claim of the present invention protects.