Disclosure of Invention
The invention aims to provide a WiFi device connection method, a WiFi device connection device, terminal equipment and a readable storage medium, and aims to solve the problems of low safety and complex operation of Internet of things equipment during WiFi connection.
In order to achieve the above object, the present invention provides a WiFi device connection method, applied to a host, including:
receiving probe request messages sent by a plurality of surrounding slave machines, wherein specific fields are added in the probe request messages;
and analyzing the specific field to identify a target slave machine, and performing wireless connection with the target slave machine.
Further, it is preferable that the specific field is added to an nth byte of frambdy in the probe request message.
Further, it is preferable that N is an integer and satisfies 1. ltoreq. N.ltoreq.1000.
The invention also provides a WiFi equipment connection method, which is applied to the slave machines and comprises the following steps:
sending a probe request message to surrounding hosts, wherein a specific field is added in the probe request message;
and after the target host analyzes the specific field and identifies the slave, the slave is wirelessly connected with the target host.
Further, it is preferable that the specific field is added to an nth byte of frambdy in the probe request message.
Further, it is preferable that N is an integer and satisfies 1. ltoreq. N.ltoreq.1000.
The invention also provides a WiFi equipment connecting device, which is applied to a host and comprises:
the device comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving probe request messages sent by a plurality of peripheral slave machines, and specific fields are added in the probe request messages;
and the analysis unit is used for analyzing the specific field to identify a target slave machine and carrying out wireless connection with the target slave machine.
The invention also provides a WiFi equipment connecting device, which is applied to a slave computer and comprises:
the device comprises a sending unit, a receiving unit and a sending unit, wherein the sending unit is used for sending a probe request message to surrounding hosts, and a specific field is added in the probe request message;
and the connection unit is used for performing wireless connection with the target host after the target host analyzes the specific field and identifies the slave.
The present invention also provides a terminal device, including:
one or more processors;
a memory coupled to the processor for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the WiFi device connection method of any of the above.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a WiFi device connection method as described in any one of the above.
Compared with the prior art, the invention has the beneficial effects that:
the invention discloses a WiFi device connection method, a WiFi device connection device, terminal equipment and a readable storage medium, wherein the method comprises the following steps: receiving probe request messages sent by a plurality of surrounding slave machines, wherein specific fields are added in the probe request messages; and analyzing the specific field to identify a target slave machine, and performing wireless connection with the target slave machine.
According to the WiFi equipment connection method provided by the invention, the host can receive the probe Request message periodically sent by the slave while the slave is powered on, and then wireless connection is carried out by identifying and analyzing the specific field in the message. The invention overcomes the defects of easy password leakage and complex operation in the existing connection method, and has the advantages of high safety, simple operation, convenient management and the like.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, an embodiment of the invention provides a WiFi device connection method applied to a host. As shown in fig. 1, the WiFi device connection method includes steps S10 and S20. The concrete contents of each step are as follows:
s10, receiving probe request messages sent by a plurality of peripheral slaves, wherein the probe request messages are added with specific fields.
And S20, resolving the specific field to identify a target slave machine, and performing wireless connection with the target slave machine.
It should be noted that, when there is an internet of things (IoT) device supporting WiFi in a space, such as a smart socket, it is assumed that any device in the local area network wants to find the IoT device, if the IoT device must be involved in the local area network; thus, if an IoT device fails to intervene in a local area network, other devices cannot discover this IoT device and thus cannot connect with it. Furthermore, since the smart socket usually does not have a screen, if the smart socket is enabled to receive the name (SSID) and password of the AP, software (WeChat Airkiss, SmartConfig) must be used to make the smart socket listen to the unencrypted fields of the broadcast or multicast message by putting the SSID and password into these unencrypted fields, and then compose the SSID and password. Therefore, the existing WiFi connection mode for the IoT device is not only low in security and prone to generate password leakage problem, but also cannot be identified when the device is not involved in the local area network. Therefore, the present embodiment aims to provide a WiFi connection method that is secure, reliable, simple to operate, and also suitable for IoT devices that do not access the local area network.
Specifically, the operation principle of the present embodiment is as shown in fig. 2. As shown in fig. 2, after WiFi is turned on, any IoT device with WiFi function sends a probe request message to search all wireless access points ap (access points). All WiFi devices may receive the ProbeRequest message, and the IoT device only needs to add a specific field in the ProbeRequest message, and after receiving the ProbeRequest message, other WiFi devices may analyze the specific field, and may sense that a specific IoT device is nearby, thereby discovering the specific IoT device. Therefore, in one embodiment, a specific field is added to the nth byte of the franbody in the ProbeRequest message. Wherein N is an integer and satisfies 1-1000.
It should be noted that the format of the ProbeRequest frame belongs to a management frame, which follows the general format of the management frame, wherein the structure of the format of the ProbeRequest frame is shown in fig. 3. Wherein, the FrameControl size is fixed to 0x0100, and the 0x0100 can be identified as the ProbeRequest message. In FrameBody, information such as a support rate is generally included. Where FrameBody does not specify 2312 bytes of content, the content is optional. Generally, the FrameBody of the ProbeRequest does not exceed 100 bytes. It is therefore only necessary to add specific fields such as "fixed 0x 3137", "Vendor ID", "ProductId" starting at the nth byte of the framebody (N may be any number of bytes greater than normal information, 0-1000). The format of the added field is shown in the following table:
table 1 ProbeRequest message with specific fields added
Therefore, when the present embodiment executes step S10, the master only needs to receive probe request messages sent by multiple peripheral slaves, and then analyzes the specific field in step S20, so as to identify the target slave and wirelessly connect to the target slave.
In summary, the WiFi device connection method provided in the embodiment of the present invention overcomes the defects of easy password leakage and complex operation in the existing connection method, and has the advantages of high security, simple operation, and convenient management.
Referring to fig. 4, an embodiment of the present invention further provides a WiFi device connection method applied to a slave, including:
s30, sending a probe request message to surrounding hosts, wherein a specific field is added in the probe request message;
and S40, after the target host analyzes the specific field and identifies the slave, the slave is wirelessly connected with the target host.
Further, the specific field is added to the nth byte of frambdy in the probe request message. N is an integer and satisfies that N is more than or equal to 1 and less than or equal to 1000.
Referring to fig. 5, an embodiment of the present invention further provides a WiFi device connection apparatus, applied to a host, including:
the receivingunit 01 is configured to receive probe request messages sent by multiple peripheral slaves, where a specific field is added to the probe request messages;
and the analyzingunit 02 is used for analyzing the specific field to identify a target slave and performing wireless connection with the target slave.
Referring to fig. 6, an embodiment of the present invention further provides a WiFi device connection apparatus, applied to a slave, including:
a sendingunit 03, configured to send a probe request message to a peripheral host, where a specific field is added to the probe request message;
and theconnection unit 04 is configured to perform wireless connection with the target host after the target host parses the specific field and identifies the slave.
In summary, the WiFi device connection apparatus provided in the embodiments of the present invention overcomes the defects of easy password leakage and complex operation in the existing connection method, and has the advantages of high security, simple operation, and convenient management.
Referring to fig. 7, an embodiment of the present invention provides a terminal device, including:
one or more processors;
a memory coupled to the processor for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the WiFi device connection method as described above.
The processor is used for controlling the overall operation of the terminal device so as to complete all or part of the steps of the WiFi device connection method. The memory is used to store various types of data to support operation at the terminal device, and these data may include, for example, instructions for any application or method operating on the terminal device, as well as application-related data. The Memory may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
In an exemplary embodiment, the terminal Device may be implemented by one or more Application Specific 1 integrated circuits (AS 1C), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic components, and is configured to perform the WiFi Device connection method according to any one of the above embodiments, and achieve the technical effects consistent with the above methods.
In another exemplary embodiment, a computer readable storage medium is also provided, which comprises a computer program, which when executed by a processor, performs the steps of the WiFi device connection method as described in any one of the above embodiments. For example, the computer readable storage medium may be the above-mentioned memory including a computer program, which can be executed by a processor of a terminal device to implement the WiFi device connection method according to any of the above-mentioned embodiments, and achieve the technical effects consistent with the above-mentioned methods.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.