CN110120987A - A kind of WiFi connection method and device - Google Patents

A kind of WiFi connection method and device Download PDF

Info

Publication number
CN110120987A
CN110120987A CN201810118969.7A CN201810118969A CN110120987A CN 110120987 A CN110120987 A CN 110120987A CN 201810118969 A CN201810118969 A CN 201810118969A CN 110120987 A CN110120987 A CN 110120987A
Authority
CN
China
Prior art keywords
character
address
value
predetermined bit
bit position
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810118969.7A
Other languages
Chinese (zh)
Other versions
CN110120987B (en
Inventor
章浙锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810118969.7A priority Critical patent/CN110120987B/en
Priority to PCT/CN2018/120311 priority patent/WO2019153869A1/en
Publication of CN110120987A publication Critical patent/CN110120987A/en
Application granted granted Critical
Publication of CN110120987B publication Critical patent/CN110120987B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/35Network arrangements, protocols or services for addressing or naming involving non-standard use of addresses for implementing network functionalities, e.g. coding subscription information within the address or functional addressing, i.e. assigning an address to a function
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5069Address allocation for group communication, multicast communication or broadcast communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention provides a kind of WiFi connection method and devices, applied to the first electronic equipment, the described method includes: being encoded respectively to each character in the first character string and the second character string, obtain the corresponding IP address of each character, wherein, first character string are as follows: the service set of the second electronic equipment WiFi network to be accessed, second character string are as follows: the password of second electronic equipment WiFi network to be accessed;The corresponding IP address of each character is mapped as MAC Address;Periodicity sending by each MAC Address for mapping address as a purpose multicast frame so that second electronic equipment is according to grabbing and parse the service set that the multicast frame obtains and password accesses the WiFi network.Equipment may be implemented using scheme provided in an embodiment of the present invention and quickly access WiFi network.

Description

A kind of WiFi connection method and device
Technical field
The present invention relates to wireless communication technology fields, more particularly to a kind of WiFi connection method and device.
Background technique
Currently, various electronic equipments using more and more extensive, under some cases, two electronic equipments is needed to be connected It connects, so that an electronic equipment in above-mentioned two electronic equipments controls another electronic equipment, for example, user can wear in use Wearable device and handheld device (such as mobile phone) would generally be attached when wearing equipment, in order to be operated by handheld device With control wearable device.
In the prior art, WiFi connection can be used between handheld device and wearable device, for example, making with handheld device For Wi-Fi hotspot, wearable device realizes that WiFi is connect with handheld device by connecting the Wi-Fi hotspot, or holds and set It is standby to be all connected with same WiFi network with wearable device to realize that the WiFi of two equipment is connected.That is, both sides Formula is required to wearable device accessing WiFi network.
But the scheme of both access WiFi networks, user is required to manually for Wi-Fi hotspot or WiFi network WiFi parameter (including SSID (Service Set Identifier, service set) and PWD (Pass Word, password)) exists It is configured on wearable device to realize, and the mode of manual configuration WiFi parameter is more troublesome, leads to wearable device not WiFi network can be quickly accessed.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of WiFi connection method and device, electronic equipment, computer-readable Storage medium, to realize that equipment quickly accesses WiFi network.Specific technical solution is as follows:
In order to achieve the above objectives, the embodiment of the invention provides a kind of WiFi connection methods, are applied to the first electronic equipment, The described method includes:
Each character in first character string and the second character string is encoded respectively, obtains the corresponding IP of each character Address, wherein first character string are as follows: the service set of the second electronic equipment WiFi network to be accessed, described second Character string are as follows: the password of second electronic equipment WiFi network to be accessed;
The corresponding IP address of each character is mapped as MAC Address;
Periodicity sending by each MAC Address for mapping address as a purpose multicast frame so that described second Electronic equipment is according to the service set and the password access WiFi network for grabbing and parsing the multicast frame acquisition.
Optionally, each character in the first character string and the second character string encodes respectively, obtains each The step of character corresponding IP address, comprising:
In the following way, the corresponding IP address of each character in the first character string and the second character string is obtained:
According to the classification of character string where character, the value of the first predetermined bit position of the corresponding IP address of character is determined;
According to serial number of the character in character string, taking for the second predetermined bit position of the corresponding IP address of character is determined Value;
According to the content of character, the value of the third predetermined bit position of the corresponding IP address of character is determined, wherein described The sum of one predetermined bit position, second predetermined bit position and digit of third predetermined bit position are by IP address and MAC What the mapping relations of address determined.
Optionally, the quantity of third predetermined bit position is more than or equal to 16;
The content according to character, the step of determining the value of third predetermined bit position of the corresponding IP address of character, Include:
It is two bytes by character code, wherein described first yard according to the high nibble and low nibble of the first code value Value are as follows: character corresponding code value in pre-arranged code rule;
According to two bytes after coding, the value of the third predetermined bit position of the corresponding IP address of character is determined.
Optionally, character code is the step of two bytes by the high nibble and low nibble according to the first code value Suddenly, comprising:
According to the low nibble of the second code value, the high nibble of the first byte in two bytes is determined, wherein described second Code value are as follows: a upper character in character string where the character corresponding code value in pre-arranged code rule;
According to the high nibble of the first code value, the low nibble of first byte is determined;
According to the high nibble of the first code value, the high nibble of the second byte in two bytes is determined;
According to the low nibble of the first code value, the low nibble of second byte is determined;
Two bytes according to after coding, determine the value of the third predetermined bit position of the corresponding IP address of character Step, comprising:
First byte is determined as to the value of the first default 8 bits in third predetermined bit position;
Second byte is determined as to the value of the second default 8 bits in third predetermined bit position.
Optionally, the method also includes:
The information for being successfully accessed the WiFi network for receiving the second electronic equipment feedback, terminates to send by mapping The multicast frame of each MAC Address arrived address as a purpose.
In order to achieve the above objectives, it the embodiment of the invention also provides a kind of WiFi attachment device, is set applied to the first electronics Standby, described device includes:
Coding module obtains every for encoding respectively to each character in the first character string and the second character string The corresponding IP address of one character, wherein first character string are as follows: the services set of the second electronic equipment WiFi network to be accessed Mark, second character string are as follows: the password of second electronic equipment WiFi network to be accessed;
Mapping block, for the corresponding IP address of each character to be mapped as MAC Address;
Sending module, for periodicity sending by the multicast frame of each MAC Address for mapping address as a purpose, with So that second electronic equipment is according to the service set and the password access institute for grabbing and parsing the multicast frame acquisition State WiFi network.
Optionally, the coding module, comprising:
First determines submodule, for the classification according to character string where character, determines the of the corresponding IP address of character The value of one predetermined bit position;
Second determines that submodule determines the corresponding address IP of character for the serial number according to character in character string The value of second predetermined bit position;
Third determines submodule, for the content according to character, determines the third predetermined bit of the corresponding IP address of character Position value, wherein first predetermined bit position, second predetermined bit position and third predetermined bit position digit The sum of be to be determined by the mapping relations of IP address and MAC Address.
Optionally, the quantity of third predetermined bit position is more than or equal to 16;
The third determines submodule, comprising:
Character code is two bytes for the high nibble and low nibble according to the first code value by coding unit, In, first code value are as follows: character corresponding code value in pre-arranged code rule;
Determination unit, for determining the third predetermined bit of the corresponding IP address of character according to two bytes after coding The value of position.
Optionally, the coding unit, comprising:
First determines that subelement determines the height of the first byte in two bytes for the low nibble according to the second code value Nibble, wherein second code value are as follows: a upper character in character string where the character corresponding code in pre-arranged code rule Value;
Second determines that subelement determines the low nibble of first byte for the high nibble according to the first code value;
Third determines subelement, for the high nibble according to the first code value, determines the height of the second byte in two bytes Nibble;
4th determines that subelement determines the low nibble of second byte for the low nibble according to the first code value;
The determination unit, comprising:
5th determines subelement, for first byte to be determined as first default 8 in third predetermined bit position The value of bit;
6th determines subelement, for second byte to be determined as second default 8 in third predetermined bit position The value of bit.
Optionally, described device further include:
Receiving module, for receiving the information for being successfully accessed the WiFi network of the second electronic equipment feedback, knot Beam sends the multicast frame of each MAC Address obtained by mapping address as a purpose.
In order to achieve the above objectives, the embodiment of the invention also provides a kind of electronic equipment, including processor, communication interface, Memory and communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, being realized and any of the above-described described being applied to the first electricity The WiFi connection method of sub- equipment.
In order to achieve the above objectives, the embodiment of the invention also provides a kind of computer readable storage medium, the computers It is stored with computer program in readable storage medium storing program for executing, the computer program is realized any of the above-described described when being executed by processor WiFi connection method applied to the first electronic equipment.
Scheme provided in an embodiment of the present invention, the first electronic equipment is by the second electronic equipment WiFi network to be accessed Each character code in service set and password is IP address, and is mapped as MAC Address, is then sent by each MAC The multicast frame of location address as a purpose, in this way, the second electronic equipment can grab and parse multicast frame obtain server identification and Password, to access WiFi network.As it can be seen that the embodiment of the present invention provides scheme, do not need to match on the second electronic equipment manually WiFi parameter is set, the second electronic equipment can be realized and quickly access WiFi network.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of WiFi connection method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram encoded in embodiment illustrated in fig. 1 to character;
Fig. 3 is the flow diagram of another kind WiFi connection method provided in an embodiment of the present invention;
Fig. 4 is the flow diagram for carrying out Gray code in embodiment illustrated in fig. 3 to IP address;
Fig. 5 is a kind of structural schematic diagram of WiFi attachment device provided in an embodiment of the present invention;
Fig. 6 is the structural schematic diagram of coding module in embodiment illustrated in fig. 5;
Fig. 7 is the structural schematic diagram of another kind WiFi attachment device provided in an embodiment of the present invention;
Fig. 8 is the structural schematic diagram of parsing module in embodiment illustrated in fig. 7;
Fig. 9 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention;
Figure 10 is the structural schematic diagram of another electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
For solve problem of the prior art, the embodiment of the invention provides a kind of WiFi connection method, device electronic equipment, Computer readable storage medium.
Below with the IP address of 32 bits (Internet Protocol Address, Internet protocol) and 48 bits For the MAC Address (Media Access Control Address, physical address) of position, first to involved in the embodiment of the present application IP address and MAC Address between conversion be introduced.
In this data sender's formula of multicast, IP address is with the D class address of 1110 beginnings, by 1110 and multicast group It number constitutes, range is and the MAC of the IP address of 32 bits and 48 bits from 224.0.0.0 to 239.255.255.255 There is fixed rule, high 24 bit of MAC Address is 01:00:5e for conversion between location, and the 23rd bit is 0, will Low 23 bit that low 23 bit of IP address is copied directly to MAC Address can form the MAC Address of multicast frame.Due to IP High 4 bit of address is 1110, and low 23 bit copies to low 23 bit of MAC Address, therefore has 5 among IP address A bit does not use, and so IP address and MAC Address are not just one-to-one, and a MAC Address at most may be used To map out 32 IP address.However, it is possible to set fixed value for 5 bits among IP address, one can be realized MAC Address maps out an IP address.
A kind of WiFi connection method provided in an embodiment of the present invention is introduced again below.
Referring to Fig. 1, Fig. 1 is a kind of flow diagram of WiFi connection method provided in an embodiment of the present invention, and this method is answered For the first electronic equipment, include the following steps:
S101 encodes each character in the first character string and the second character string respectively, obtains each character pair The IP address answered.
Wherein, the first character string are as follows: the service set of the second electronic equipment WiFi network to be accessed, the second character string Are as follows: the password of the second electronic equipment WiFi network to be accessed.Service set refers to a string of words of unique name WiFi network Symbol.
In one implementation, the default application software that can use in the first electronic equipment is come to the word in character string Symbol is encoded respectively, obtains the corresponding IP address of each character.Character is encoded to obtain the mode of corresponding IP address It wouldn't be described in detail.
That is, being encoded respectively in this step to each character in the first character string and the second character string, obtain To the coding result of each character, then for each character, using the coding result of this character, with obtaining an IP Location, as the corresponding IP address of this character.
In a kind of implementation, when being encoded to character, it can be and encoded according to preset code table, obtain character Coding result, for example, above-mentioned preset code table can be ASCII character table etc..
In a kind of implementation, above-mentioned first electronic equipment can be the intelligent terminals such as mobile phone, computer, tablet computer, on Stating the second electronic equipment can be the intelligent terminals such as mobile phone, computer, tablet computer, can also be Intelligent bracelet, intelligent hand certainly The wearable devices such as table, intelligent glasses.
The corresponding IP address of each character is mapped as MAC Address by S102.
Seen from the above description, in one implementation, the predetermined bit position in IP address can be copied directly to The predetermined bit position of MAC Address, the MAC Address after being mapped.
S103, periodicity sending by each MAC Address for mapping address as a purpose multicast frame so that second Electronic equipment is according to the service set and password access WiFi network for grabbing and parsing multicast frame acquisition.
In one implementation, the second electronic equipment can grab the multicast frame of the transmission of the first electronic equipment in air And parsed, the MAC Address in each multicast frame is obtained, to each MAC according to IP address and the mapping relations of MAC Address Location reflection penetrates to obtain each IP address, then obtains the corresponding character of each IP address to each IP address Gray code, according to each The corresponding character of IP address determines the service set and password of WiFi network to be accessed, finally according to service set and Password accesses WiFi network.
Scheme provided in an embodiment of the present invention can be applied in several scenes.For example, the second electronic equipment is to be accessed WiFi network is the WiFi network that the first electronic equipment has accessed itself, alternatively, the WiFi network that the second electronic equipment is to be accessed It is not the network that the first electronic equipment is currently accessed, WiFi network is required dependent on router in both application scenarios Creation.For another example, can be using the first electronic equipment as Wi-Fi hotspot if the first electronic equipment is handheld device, the second electronics Equipment accesses the Wi-Fi hotspot, at this point, the second electronic equipment can carry out data by 3G the or 4G network of the first electronic equipment Transmission, such as internet is uploaded data to, the WiFi in this application scenarios, between the first electronic equipment and the second electronic equipment Connection gets rid of the dependence to router, and the first electronic equipment and the second electronics can be still kept in the case where no router The WiFi connection of equipment, and realize that the second electronic equipment accesses the mode phase of WiFi network by router with other needs Than, using the second electronic equipment of scheme provided in an embodiment of the present invention can succinctly, easily access WiFi network.
It should be understood that the first electronic equipment is then unnecessary to be continued to send after the second electronic equipment accesses WiFi network By the multicast frame of each MAC Address address as a purpose, therefore, in order to save Internet resources, in a specific embodiment, This method can also include: to receive the information for being successfully accessed WiFi network of the second electronic equipment feedback, terminate to send by mapping The multicast frame of obtained each MAC Address address as a purpose.
In conclusion scheme provided in an embodiment of the present invention, the first electronic equipment is to be accessed by the second electronic equipment Each character code in the service set and password of WiFi network is IP address, and is mapped as MAC Address, is then sent By the multicast frame of each MAC Address address as a purpose, taken in this way, the second electronic equipment can grab and parse multicast frame Business device mark and password, to access WiFi network.As it can be seen that the embodiment of the present invention provides scheme, do not need manually in the second electricity WiFi parameter is configured in sub- equipment, and the second electronic equipment can be realized and quickly access WiFi network.
When the second electronic equipment is wearable device, due to being not easy to configuration WiFi parameter on wearable device, because This, using scheme provided in an embodiment of the present invention, do not need on wearable device configure WiFi parameter can just make it is wearable Equipment accesses WiFi network, it is seen that scheme provided in an embodiment of the present invention accesses WiFi network convenient for wearable device.Further , if the first electronic equipment is handheld device and using handheld device as Wi-Fi hotspot, and wearable device needs to access this Wi-Fi hotspot realizes the WiFi connection of two equipment, then can quickly make using scheme provided in an embodiment of the present invention any one A handheld device and wearable device interconnection.
It is described in detail below in step S101 and each character in the first character string and the second character string is compiled respectively Code, obtains a kind of implementation of the corresponding IP address of each character.
Specifically, as shown in Fig. 2, according to the following steps, obtaining each character pair in the first character string and the second character string The IP address answered:
S1011 determines the first predetermined bit position of the corresponding IP address of character according to the classification of character string where character Value;
Wherein, for any character to be encoded, if the character is the character in the first character string, word where the character The classification of symbol string is service set, if the character is the character in the second character string, the classification of character string where the character For password;
S1012 determines the second predetermined bit position of the corresponding IP address of character according to serial number of the character in character string Value;
S1013 determines the value of the third predetermined bit position of the corresponding IP address of character according to the content of character;
Wherein, the sum of the first predetermined bit position, the second predetermined bit position and digit of third predetermined bit position are by IP What the mapping relations of location and MAC Address determined.In one implementation, the mapping relations of IP address and the address MAC can be with Are as follows: it is low 23 bit that low 23 bit of IP address is copied directly to MAC Address when IP address is mapped to MAC Address Position.
It, can be with by the bit sum of the mapping relations and IP address of IP address and MAC Address in a kind of implementation It determines in IP address for identifying the bit of the coding result of character.
For example, IP address is 32 bits, and when IP address is mapped to MAC Address is by low the 23 of the address IP Bit is copied directly to low 23 bit of MAC Address, then can be used to identify character for low 23 bit of IP address Coding result, and fixed value is set by high 9 bit of IP address.Due to the IP address in multicast high 4 bit always 1110, therefore the most-significant byte that IP address can be set is fixed value, range is 224~239.And the 23rd bit of IP address It can be set to fixed value, such as be set as 0 or for 1.
In bit in IP address for the coding result for identifying character, the first predetermined bit position can be used to mark The classification of character string where remembering character, that is, marking the character is to be located in service set or be located in password, pre- by second If bit is used for serial number of the tab character in character string, third predetermined bit position is used for tool represented by tab character Hold in vivo.
For the first predetermined bit position, for example, if IP address is 32 bits and low 23 bit is used for identifier word The coding result of symbol, can using 1 bit of IP address as the first predetermined bit position, such as the 22nd bit, specifically: 22nd bit is 0, and character string where indicating character is service set, and the 22nd bit is 1, indicates character string where character For password.It can also be using two bits in IP address as the first predetermined bit position, such as the 22nd, 21 bits, specifically Are as follows: the 22nd, 21 bits be 00, indicate character where character string be service set, the 22nd, 21 bits be 01, indicate word Character string where symbol is password.Certainly, in the specific implementation, the digit of the first predetermined bit position and position can as required into Row setting, it is not limited in the embodiment of the present invention.
For the second predetermined bit position, for example, if IP address is 32 bits and low 23 bit is used for identifier word The coding result of symbol, can be using several bits in low 23 bit in addition to the first predetermined bit position as the second default ratio Special position.By taking the digit of the second predetermined bit position is 3 as an example, second predetermined bit position can be expressed as 000 when serial number is 1, suitable Second predetermined bit position can be expressed as 001 when serial number 2, and so on.It should be understood that the digit of the second predetermined bit position It is related to the quantity for the character that character string at most may include, if the character quantity that character string at most may include is more, second The digit of predetermined bit position is more.In the specific implementation, the digit of the second predetermined bit position and position can carry out as required Setting, it is not limited in the embodiment of the present invention.
In a specific embodiment, the 23rd~16 bit of IP address is as shown in table 1, wherein the 23rd bit The 0, the 22nd bit of fixed value is redefined for as the first predetermined bit position, wherein the character string where character is services set mark The 22nd bit is 0 when knowledge, and the 22nd bit is 1 when the character string where the character is password, and the 21st~16 bit is as the Two predetermined bit positions.That is, the 23rd~16 bit of IP address can be used for distinguishing SSID and PWD.
Table 1
When being encoded in the manner as shown in table 1, for the 2nd character in service set, the IP that is obtained after coding The 23rd~16 bit is 000000001 (with decimal representation for 1) in address, for the 2nd character in password, after coding To IP address in the 23rd~16 bit be 010000001 (with decimal representation for 65).
For third predetermined bit position, third predetermined bit position is for particular content represented by tab character, in one kind In implementation, can by searching for character under pre-arranged code regular (such as ASCII coding) corresponding to binary digit, with Value of the binary digit found as third predetermined bit position.In this mode, the digit of third predetermined bit position can To be determined by pre-arranged code rule.
In another implementation, the quantity that can preset third predetermined bit position is more than or equal to 16, then exists The above-mentioned content according to character can in the step S1013 for determining the value of the third predetermined bit position of the corresponding IP address of character To include:
It is two bytes by character code, wherein the first code value according to the high nibble and low nibble of the first code value Are as follows: character corresponding code value in pre-arranged code rule;
According to two bytes after coding, the value of the third predetermined bit position of the corresponding IP address of character is determined.
Above-mentioned pre-arranged code rule can encode for ASCII, and in ASCII coding, the corresponding code value of character is by 8 bits Binary digit composition, then preceding 4 bit can be defined as to the high nibble H of code value, rear 4 bit definitions are code value Low nibble L.For example, character " M ", corresponding code value is 0x4D (with hexadecimal representation) in ASCII coding, wherein 0x4 It is low nibble L for high nibble H, 0xD.
In a kind of specific implementation, encode to obtain i-th character by the high nibble and low nibble of the first code value The mode of corresponding two bytes can be as shown in table 2, table 3, table 4, wherein HiAnd LiI-th of character is respectively indicated in ASCII The high nibble and low nibble of corresponding code value in coding rule.In this specific implementation, only according to first yard Character code is two bytes by value.
Coding mode as shown in Table 2, directly using the low nibble of the first code value and high nibble as the first word The high nibble of section and the second byte is distinguished after the high nibble of the first code value and low nibble are carried out preset data processing Low nibble as the first byte and the second byte.
Coding mode as shown in table 3, directly using the high nibble of the first code value and low nibble as the first word The low nibble of section and the second byte is distinguished after the low nibble of the first code value and high nibble are carried out preset data processing High nibble as the first byte and the second byte.
Coding mode as shown in table 4, directly using the low nibble of the first code value and high nibble as the first word The high nibble of section and the second byte, using the high nibble of the first code value and low nibble as the first byte and the second word The low nibble of section.
Table 2
Byte serial number High nibble Low nibble
First byte 2i Li Hi^ (1%16)
Second byte 2i+1 Hi Li^ (2%16)
Table 3
Byte serial number High nibble Low nibble
First byte 2i Li^ (2i%16) Hi
Second byte 2i+1 Hi^ ((2i+1) %16) Li
Table 4
Byte serial number High nibble Low nibble
First byte 2i Li Hi
Second byte 2i+1 Hi Li
Since the quantity of third predetermined bit position is more than or equal to 16, it can be true by the first byte and the second byte It is set to wherein 16 values, and fixed value can be set in advance as other remaining bits.
It can also be two by character code according to the first code value and the second code value in another specific implementation Byte, wherein the second code value are as follows: a upper character corresponding code value, utilization in pre-arranged code rule where character in character string Whether the first code value and the second code value are encoded, correct convenient for the sequence checked character during subsequent decoding.Above-mentioned According to the high nibble and low nibble of the first code value, the step of by character code being two bytes, may include:
According to the low nibble of the second code value, the high nibble of the first byte in two bytes is determined, wherein the second code value Are as follows: a upper character in character string where the character corresponding code value in pre-arranged code rule;
According to the high nibble of the first code value, the low nibble of first byte is determined;
According to the high nibble of the first code value, the high nibble of the second byte in two bytes is determined;
According to the low nibble of the first code value, the low nibble of second byte is determined.
Correspondingly, above-mentioned two bytes according to after coding, determine the third predetermined bit position of the corresponding IP address of character Value the step of, may include:
First byte is determined as to the value of the first default 8 bits in third predetermined bit position;
Second byte is determined as to the value of the second default 8 bits in third predetermined bit position.
It is, after determining above-mentioned first byte and the second byte, it can taking bit each in the first byte Value is assigned in third predetermined bit position each bit in the first default 8 bits, by bit each in the second byte Value is assigned in third predetermined bit position each bit in the second default 8 bits.
In addition, the above-mentioned first default 8 bits and the second default 8 bits refer to: in third predetermined bit position, in advance setting 8 bits set, wherein each bit in the first default 8 bits and the second default 8 bits does not weigh mutually It closes.
Here above-mentioned " the upper character where character in character string " is illustrated down again, is with character string " asdf " Example, a upper character of the character s in the character string are a.
It can be such as table by i-th of character code in the character string using above-mentioned coding mode by taking a character string as an example 5, two bytes shown in table 6 or table 7, wherein Li-1Indicate that (i-1)-th character is corresponding in pre-arranged code rule in the character string Code value low nibble.It should be understood that utilizing L in codingi-1I-th of character is encoded, according to Li-1Determine The high nibble of one byte, convenient for decoding when by the high nibble of the first byte come the correctness of check byte serial number.It needs It is noted that by taking character string " asdf " as an example, since character a is the first character in the character string, in the character string There is no a upper characters of character a, then, can be directly by L when encoding to first character ai-10 is set to determine The high nibble of one byte.
Table 5
Byte serial number High nibble Low nibble
First byte 2i Li-1 Hi^ (2i%16)
Second byte 2i+1 Hi Li^ ((2i+1) %16)
Table 6
Byte serial number High nibble Low nibble
First byte 2i Li-1^ (2i%16) Hi
Second byte 2i+1 Hi^ ((2i+1) %16) Li
Table 7
Byte serial number High nibble Low nibble
First byte 2i Li-1 Hi
Second byte 2i+1 Hi Li
For each character, after by character code being two bytes, according to two bytes after coding, character pair is determined The value of the third predetermined bit position for the IP address answered.It, can be by the first word when the quantity of third predetermined bit position is 16 Section is determined as the value of high 8 bit in 16 bits, and the second byte is determined as to the value of low 8 bit in 16 bits; When the quantity of third predetermined bit position is greater than 16, such as 18 bits, the first byte can be determined as in 18 bits 0-7 bit value, the second byte is determined as to the value of 8-15 bit in 18 bits, for the 16th, 17 bits The value of position can be set in advance as fixed value.
For example, the character string for being My for service set, as shown in table 8, under ASCII coding rule, character M Corresponding code value is 0x4D, then the high nibble H of the corresponding code value of character M0With low nibble L0Respectively 0x4 and 0xD, character y Corresponding code value is 0x79, then the high nibble H of the corresponding code value of character y1With low nibble L1Respectively 0x7 and 0x9.
Table 8
The third predetermined bit position that IP address is arranged is 16, then carries out coding third predetermined bit position according to the above method When, it is respectively 0x04,0x5D (with hexadecimal representation) to two bytes obtained after character M coding, by it as shown in table 9 In the first byte 0x04 it is default as third as the value of high 8 bit in third predetermined bit position, the second byte 0x5D The value of low 8 bit in bit, and with the first predetermined bit position and the second predetermined bit position of IP address shown in table 1 Coding mode, finally, the IP address encoded to character M can be 239.0.4.93 (with decimal representation), right The IP address that character y is encoded can be 239.1.247.73 (with decimal representation), wherein turn hexadecimal When for the decimal system, 0x04=4,0x5D=93,0xF7=247,0x49=73.
Table 9
As shown in Table 7, in coding, the high nibble of the byte of serial number 2i+1 is the byte using serial number 2i What low nibble was formed, and the second electronic equipment is after the decoding, by the low nibble of the byte of previous serial number and it can work as The high nibble of the byte of preceding serial number verifies the correctness of current byte serial number, in this way can be to avoid the dry of external data packet It disturbs.As it can be seen that the serial number for the two neighboring byte for encoding out by means of which is relevant, when the data packet for receiving interference When, the second electronic equipment can verify the validity of serial number by previous byte.
Using the coding mode of embodiment illustrated in fig. 2, by each character in the service set and password of WiFi network It is encoded to IP address, the second electronic equipment can be improved and parse to obtain the speed of the service set of WiFi network and password, into One step improves the speed of the second electronic equipment access WiFi network.Also, using the structure of multicast ip address and itself and MAC The IP address obtained after service set and cipher coding is carried out multicast, reduces multicast in this way by the special corresponding relationship in location When the data volume transmitted, and it is also safer, efficient by IP address mode to carry the data for needing to transmit.
In order to realize that equipment quickly accesses WiFi network, based on the above-mentioned WiFi connection applied to the first electronic equipment Method, the embodiment of the invention also provides a kind of WiFi connection method, this method is applied to the second electronic equipment, as shown in figure 3, Include the following steps:
S301 grabs each multicast frame of the first electronic equipment periodicity sending.
S302 parses the multicast frame grabbed, obtains the MAC Address in each multicast frame, reflects to each MAC Address It penetrates to obtain each IP address, the corresponding character of each IP address is obtained to each IP address Gray code, according to each IP address pair The character answered determines the service set and password of WiFi network to be accessed.
Wherein, each IP address is that the first electronic equipment distinguishes each character in the first character string and the second character string It is encoded, the first character string are as follows: service set, the second character string are as follows: password.
After parsing multicast frame obtains the MAC Address in multicast frame, it can be closed according to the mapping of IP address and MAC Address System, reflection penetrate to obtain IP address.
In one implementation, it can use the default application software in the second electronic equipment to come to parsing multicast frame, Obtain the corresponding IP address of each character.
Specifically, corresponding to the first electronic equipment in embodiment illustrated in fig. 2 in the first character string and the second character string Each character is encoded to obtain respectively the coding mode of the corresponding IP address of each character, to each IP in the embodiment of the present invention Address Gray code obtains the step of each IP address corresponding character as shown in figure 4, may include:
According to the following steps, the corresponding character of each IP address is obtained to each IP address Gray code:
S3021 determines character string where the corresponding character of IP address according to the value of the first predetermined bit position of IP address Classification;
S3022 determines the corresponding character of IP address in character string according to the value of the second predetermined bit position of IP address Serial number;
S3023 determines the content of the corresponding character of IP address according to the value of the third predetermined bit position of IP address.
Correspondingly, the above-mentioned third according to IP address is default when the quantity in third predetermined bit position is more than or equal to 16 The value of bit the step of determining the content of the corresponding character of IP address, may include:
According to the value of the third predetermined bit position of IP address, two bytes are determined;
According to identified two bytes, the high nibble and low nibble of the first code value are determined;Wherein, the first code value is The corresponding character of IP address corresponding code value in pre-arranged code rule;
Determine that the first code value being made of the high nibble and low nibble is corresponding from the pre-arranged code rule The content of character, the content as the corresponding character of IP address.
In a kind of specific implementation, the value of the above-mentioned third predetermined bit position according to IP address determines two words The step of section may include:
By the value of the in third predetermined bit position first default 8 bits, the first byte being determined as in two bytes;
By the value of the in third predetermined bit position second default 8 bits, the second byte being determined as in two bytes.
Above-mentioned two bytes according to determined by, the step of determining the high nibble and low nibble of the first code value, can be with Include:
According to the low nibble of the first byte, the high nibble of the first code value is determined;
According to the low nibble of the second byte, the low nibble of the first code value is determined.
For example, for the first byte and the second byte that are encoded with coding mode shown in table 3, table 4, table 6, table 7, The low nibble of first byte can be directly determined as to the high nibble of the first code value in decoding, by low the half of the second byte Byte is determined as the low nibble of the first code value.
It, can be by the in decoding for the first byte and the second byte encoded with coding mode shown in table 2 The low nibble of one byte carries out corresponding inverse operation, the high nibble of the first code value is obtained, by the low nibble of the second byte Corresponding inverse operation is carried out, the low nibble of the first code value is obtained.
For the first byte and the second byte encoded with coding mode shown in table 5, in decoding, due in step Had confirmed serial number i of the character in character string in rapid S3022, then it at this time can be according to serial number i by the first byte Low nibble carry out corresponding inverse operation, the high nibble of the first code value is obtained, according to serial number i by low the half of the second byte Byte carries out corresponding inverse operation, obtains the low nibble of the first code value.
In addition, for the correctness of the check byte serial number in decoding, in the above-mentioned low nibble according to the first byte, really Before the step of high nibble of fixed first code value, it can also be determined according to the high nibble of the first byte in two bytes Then the content of one nibble judges whether low nibble is identical with the second code value for identified nibble, if identical, Two byte verifications determined by indicating pass through, then can execute the low nibble according to the first byte, determine the first code value The step of high nibble, and subsequent decoding step is carried out, correct character is obtained, if it is not the same, two determined by indicating A byte verification does not pass through, then can terminate decoding step.
S303 accesses WiFi network according to service set and password.
Scheme provided in an embodiment of the present invention can be applied in several scenes.For example, the second electronic equipment is to be accessed WiFi network is the WiFi network that the first electronic equipment has accessed itself, alternatively, the WiFi network that the second electronic equipment is to be accessed It is not the network that the first electronic equipment is currently accessed, WiFi network is required dependent on router in both application scenarios Creation.For another example, can be using the first electronic equipment as Wi-Fi hotspot if the first electronic equipment is handheld device, the second electronics Equipment accesses the Wi-Fi hotspot, at this point, the second electronic equipment can carry out data biography by the 3G/4G network of the first electronic equipment It is defeated, such as internet is uploaded data to, in this application scenarios, the WiFi between the first electronic equipment and the second electronic equipment connects The dependence got rid of to router is connect, can still keep the first electronic equipment and the second electronics to set in the case where no router Standby WiFi connection.
It should be understood that the first electronic equipment is then unnecessary to be continued to send after the second electronic equipment accesses WiFi network By the multicast frame of each MAC Address address as a purpose, therefore, in order to save Internet resources, in a specific embodiment, This method can also include: that the information of WiFi network is successfully accessed to the first electronic equipment feedback after accessing WiFi network, with So that the first electronic equipment terminates to send the multicast frame of each MAC Address obtained by mapping address as a purpose.
In conclusion scheme provided in an embodiment of the present invention, the second electronic equipment grabs and parses the first electronic equipment hair The multicast frame sent obtains the MAC Address in each multicast frame, penetrates to obtain each IP address to the reflection of each MAC Address, to each IP address Gray code obtains the corresponding character of each IP address, determines WiFi to be accessed according to the corresponding character of each IP address The service set and password of network, to access WiFi network.As it can be seen that the embodiment of the present invention provides scheme, do not need manually WiFi parameter is configured on the second electronic equipment, and the second electronic equipment can be realized and quickly access WiFi network.
Corresponding with the above-mentioned embodiment of the method for being applied to the first electronic equipment, the embodiment of the invention also provides one kind WiFi attachment device, as shown in figure 5, the device may include: applied to the first electronic equipment
Coding module 501 is obtained for encoding respectively to each character in the first character string and the second character string The corresponding IP address of each character, wherein first character string are as follows: the service of the second electronic equipment WiFi network to be accessed Set identifier, second character string are as follows: the password of second electronic equipment WiFi network to be accessed;
Mapping block 502, for the corresponding IP address of each character to be mapped as MAC Address;
Sending module 503, for periodicity sending by the multicast of each MAC Address for mapping address as a purpose Frame, so that second electronic equipment is according to grabbing and parse the service set that the multicast frame obtains and password connects Enter the WiFi network.
As a specific embodiment of the invention, as shown in fig. 6, the coding module 501, may include:
First determines submodule 5011, for the classification according to character string where character, determines the corresponding IP address of character The first predetermined bit position value;
Second determines submodule 5012, for the serial number according to character in character string, with determining the corresponding IP of character The value of second predetermined bit position of location;
Third determines submodule 5013, for the content according to character, determines that the third of the corresponding IP address of character is default The value of bit, wherein first predetermined bit position, second predetermined bit position and third predetermined bit position The sum of digit is determined by the mapping relations of IP address and MAC Address.
As a specific embodiment of the invention, the quantity of third predetermined bit position is more than or equal to 16;
The third determines submodule 5013, may include:
Character code is two bytes for the high nibble and low nibble according to the first code value by coding unit, In, first code value are as follows: character corresponding code value in pre-arranged code rule;
Determination unit, for determining the third predetermined bit of the corresponding IP address of character according to two bytes after coding The value of position.
As a specific embodiment of the invention, the coding unit may include:
First determines that subelement determines the height of the first byte in two bytes for the low nibble according to the second code value Nibble, wherein second code value are as follows: a upper character in character string where the character corresponding code in pre-arranged code rule Value;
Second determines that subelement determines the low nibble of first byte for the high nibble according to the first code value;
Third determines subelement, for the high nibble according to the first code value, determines the height of the second byte in two bytes Nibble;
4th determines that subelement determines the low nibble of second byte for the low nibble according to the first code value;
Correspondingly, the determination unit, may include:
5th determines subelement, for first byte to be determined as first default 8 in third predetermined bit position The value of bit;
6th determines subelement, for second byte to be determined as second default 8 in third predetermined bit position The value of bit.
As a specific embodiment of the invention, described device can also include:
Receiving module, for receiving the information for being successfully accessed the WiFi network of the second electronic equipment feedback, knot Beam sends the multicast frame of each MAC Address obtained by mapping address as a purpose.
Scheme provided in an embodiment of the present invention, the second electronic equipment grab and parse the multicast of the first electronic equipment transmission Frame obtains the MAC Address in each multicast frame, penetrates to obtain each IP address to the reflection of each MAC Address, to each IP address Gray code obtains the corresponding character of each IP address, determines WiFi network to be accessed according to the corresponding character of each IP address Service set and password, to access WiFi network.As it can be seen that the embodiment of the present invention provides scheme, do not need manually second WiFi parameter is configured on electronic equipment, and the second electronic equipment can be realized and quickly access WiFi network.
Corresponding with the above-mentioned embodiment of the method for being applied to the second electronic equipment, the embodiment of the invention also provides one kind WiFi attachment device, as shown in fig. 7, the device may include: applied to the second electronic equipment
Handling module 701, for grabbing each multicast frame of the first electronic equipment periodicity sending;
Parsing module 702 obtains the MAC Address in each multicast frame, to each for parsing the multicast frame grabbed MAC Address reflection penetrates to obtain each IP address, the corresponding character of each IP address is obtained to each IP address Gray code, according to each The corresponding character of a IP address determines the service set and password of WiFi network to be accessed;Wherein, each IP address is institute State what the first electronic equipment encoded each character in the first character string and the second character string respectively, described first Character string are as follows: the service set, second character string are as follows: the password;
Link block 703, for accessing the WiFi network according to the service set and password.
As a specific embodiment of the invention, as shown in figure 8, the parsing module 702, may include:
First determines submodule 7021, for the value according to the first predetermined bit position of IP address, determines the address pair IP The classification of character string where the character answered;
Second determines submodule 7022, for the value according to the second predetermined bit position of IP address, determines the address pair IP Serial number of the character answered in character string;
Third determines submodule 7023, for the value according to the third predetermined bit position of IP address, determines the address pair IP The content for the character answered.
As a specific embodiment of the invention, the quantity of third predetermined bit position can be more than or equal to 16;
The third determines submodule 7023, may include:
First determination unit determines two bytes for the value according to the third predetermined bit position of IP address;
Second determination unit, for according to identified two bytes, determine the first code value high nibble and low half-word Section;Wherein, the first code value is the corresponding character of IP address corresponding code value in pre-arranged code rule;
Third determination unit is made of for determining from the pre-arranged code rule the high nibble and low nibble The corresponding character of the first code value content, the content as the corresponding character of IP address.
As a specific embodiment of the invention, first determination unit may include:
First determines subelement, for being determined as the value of the in third predetermined bit position first default 8 bits The first byte in two bytes;
Second determines subelement, for being determined as the value of the in third predetermined bit position second default 8 bits The second byte in two bytes;
Correspondingly, second determination unit, may include:
Third determines subelement, for the low nibble according to first byte, determines the high nibble of the first code value;
4th determines that subelement determines the low nibble of the first code value for the low nibble according to second byte.
As a specific embodiment of the invention, described device can also include:
5th determine subelement, for the third determine subelement according to the low nibble of first byte, really Before the high nibble of fixed first code value, according to the high nibble of first byte, the first nibble is determined;
Judgment sub-unit, for judging first nibble, whether low nibble is identical with the second code value, wherein institute State the second code value are as follows: a upper character in character string where the character corresponding code value in pre-arranged code rule;If identical, touching Sending out third described determines subelement.
As a specific embodiment of the invention, described device can also include:
Sending module, for after accessing the WiFi network, the first electronic equipment of Xiang Suoshu feedback to be successfully accessed described The information of WiFi network, so that first electronic equipment terminates to send each MAC Address obtained by mapping as a purpose The multicast frame of address.
Scheme provided in an embodiment of the present invention, the second electronic equipment grab and parse the multicast of the first electronic equipment transmission Frame obtains the MAC Address in each multicast frame, penetrates to obtain each IP address to the reflection of each MAC Address, to each IP address Gray code obtains the corresponding character of each IP address, determines WiFi network to be accessed according to the corresponding character of each IP address Service set and password, to access WiFi network.As it can be seen that the embodiment of the present invention provides scheme, do not need manually second WiFi parameter is configured on electronic equipment, and the second electronic equipment can be realized and quickly access WiFi network.
The embodiment of the invention also provides a kind of electronic equipment, as shown in figure 9, include processor 901, communication interface 902, Memory 903 and communication bus 904, wherein processor 901, communication interface 902, memory 903 are complete by communication bus 904 At mutual communication,
Memory 903, for storing computer program;
Processor 901 when for executing the program stored on memory 903, realizes following steps:
Each character in first character string and the second character string is encoded respectively, obtains the corresponding IP of each character Address, wherein first character string are as follows: the service set of the second electronic equipment WiFi network to be accessed, described second Character string are as follows: the password of second electronic equipment WiFi network to be accessed;
The corresponding IP address of each character is mapped as MAC Address;
Periodicity sending by each MAC Address for mapping address as a purpose multicast frame so that described second Electronic equipment is according to the service set and the password access WiFi network for grabbing and parsing the multicast frame acquisition.
As it can be seen that the embodiment of the present invention provides electronic equipment, by the services set of other electronic equipments WiFi network to be accessed Each character code in mark and password is IP address, and is mapped as MAC Address, is then sent by each MAC Address conduct The multicast frame of destination address, in this way, other electronic equipments, which can grab and parse multicast frame, obtains server identification and password, and It does not need to configure WiFi parameter on other electronic equipments manually, other electronic equipments can be realized and quickly access WiFi network.
Specific implementation and relevant explanation content about each step of this method may refer to above-mentioned method shown in FIG. 1 Embodiment, this will not be repeated here.
In addition, processor 901 executes other realities of the program stored on memory 903 and the WiFi connection method realized Existing mode, it is identical as implementation mentioned by preceding method embodiment part, it also repeats no more here.
The embodiment of the invention also provides a kind of electronic equipment, as shown in Figure 10, including processor 101, communication interface 102, memory 103 and communication bus 104, wherein processor 101, communication interface 102, memory 103 pass through communication bus 104 complete mutual communication,
Memory 103, for storing computer program;
Processor 101 when for executing the program stored on memory 103, realizes following steps:
Grab each multicast frame of the first electronic equipment periodicity sending;
The multicast frame grabbed is parsed, the MAC Address in each multicast frame is obtained, the reflection of each MAC Address is penetrated to obtain Each IP address obtains the corresponding character of each IP address to each IP address Gray code, according to the corresponding word of each IP address Symbol determines the service set and password of WiFi network to be accessed;Wherein, each IP address is first electronic equipment pair What each character in the first character string and the second character string was encoded respectively, first character string are as follows: the clothes Business set identifier, second character string are as follows: the password;
The WiFi network is accessed according to the service set and password.
As it can be seen that the embodiment of the present invention provides electronic equipment, the multicast frame sent by grabbing and parsing other electronic equipments, The MAC Address in each multicast frame is obtained, the reflection of each MAC Address is penetrated to obtain each IP address, it is counter to each IP address to compile Code obtains the corresponding character of each IP address, and the service of WiFi network to be accessed is determined according to the corresponding character of each IP address Set identifier and password can be realized without manual configuration WiFi parameter and quickly access WiFi network.
Specific implementation and relevant explanation content about each step of this method may refer to above-mentioned method shown in Fig. 3 Embodiment, this will not be repeated here.
In addition, processor 101 executes other realities of the program stored on memory 103 and the WiFi connection method realized Existing mode, it is identical as implementation mentioned by preceding method embodiment part, it also repeats no more here.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processing, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components.
The embodiment of the invention also provides a kind of computer readable storage medium, stored in the computer readable storage medium There is instruction, when run on a computer, so that computer executes in above-described embodiment applied to the first electronic equipment WiFi connection method.
By running computer program product provided in an embodiment of the present invention, by the WiFi that other electronic equipments are to be accessed Each character code in the service set and password of network is IP address, and is mapped as the address MAC, is then sent by each The multicast frame of a MAC Address address as a purpose, in this way, other electronic equipments, which can grab and parse multicast frame, obtains server It is quick that other electronic equipments can be realized without configuring WiFi parameter on other electronic equipments manually in mark and password Access WiFi network.
The embodiment of the invention also provides a kind of computer readable storage medium, stored in the computer readable storage medium There is instruction, when run on a computer, so that computer executes in above-described embodiment applied to the second electronic equipment WiFi connection method.
By running computer program product provided in an embodiment of the present invention, sent out by grabbing and parsing other electronic equipments The multicast frame sent obtains the MAC Address in each multicast frame, penetrates to obtain each IP address to the reflection of each MAC Address, to each IP address Gray code obtains the corresponding character of each IP address, determines WiFi to be accessed according to the corresponding character of each IP address The service set and password of network can be realized without manual configuration WiFi parameter and quickly access WiFi network.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device, For electronic equipment and computer readable storage medium embodiment, since it is substantially similar to the method embodiment, so description It is fairly simple, the relevent part can refer to the partial explaination of embodiments of method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (12)

1. a kind of WiFi connection method, which is characterized in that be applied to the first electronic equipment, which comprises
Each character in first character string and the second character string is encoded respectively, with obtaining the corresponding IP of each character Location, wherein first character string are as follows: the service set of the second electronic equipment WiFi network to be accessed, second word Symbol string are as follows: the password of second electronic equipment WiFi network to be accessed;
The corresponding IP address of each character is mapped as MAC Address;
Periodicity sending by each MAC Address for mapping address as a purpose multicast frame so that second electronics Equipment is according to the service set and the password access WiFi network for grabbing and parsing the multicast frame acquisition.
2. the method according to claim 1, wherein described to each in the first character string and the second character string The step of character is encoded respectively, obtains each character corresponding IP address, comprising:
In the following way, the corresponding IP address of each character in the first character string and the second character string is obtained:
According to the classification of character string where character, the value of the first predetermined bit position of the corresponding IP address of character is determined;
According to serial number of the character in character string, the value of the second predetermined bit position of the corresponding IP address of character is determined;
According to the content of character, the value of the third predetermined bit position of the corresponding IP address of character is determined, wherein described first is pre- If the sum of bit, second predetermined bit position and digit of third predetermined bit position are by IP address and MAC Address Mapping relations determine.
3. according to the method described in claim 2, it is characterized in that, the quantity of third predetermined bit position is more than or equal to 16 Position;
The content according to character, the step of determining the value of third predetermined bit position of the corresponding IP address of character, comprising:
It is two bytes by character code, wherein first code value according to the high nibble and low nibble of the first code value Are as follows: character corresponding code value in pre-arranged code rule;
According to two bytes after coding, the value of the third predetermined bit position of the corresponding IP address of character is determined.
4. according to the method described in claim 3, it is characterized in that, the high nibble according to the first code value and low half-word Section, by character code be two bytes the step of, comprising:
According to the low nibble of the second code value, the high nibble of the first byte in two bytes is determined, wherein second code value Are as follows: a upper character in character string where the character corresponding code value in pre-arranged code rule;
According to the high nibble of the first code value, the low nibble of first byte is determined;
According to the high nibble of the first code value, the high nibble of the second byte in two bytes is determined;
According to the low nibble of the first code value, the low nibble of second byte is determined;
Two bytes according to after coding, determine the step of the value of the third predetermined bit position of the corresponding IP address of character Suddenly, comprising:
First byte is determined as to the value of the first default 8 bits in third predetermined bit position;
Second byte is determined as to the value of the second default 8 bits in third predetermined bit position.
5. the method according to claim 1, wherein the method also includes:
The information for being successfully accessed the WiFi network for receiving the second electronic equipment feedback, terminates what transmission was obtained by mapping The multicast frame of each MAC Address address as a purpose.
6. a kind of WiFi attachment device, which is characterized in that be applied to the first electronic equipment, described device includes:
Coding module obtains each word for encoding respectively to each character in the first character string and the second character string Accord with corresponding IP address, wherein first character string are as follows: the services set mark of the second electronic equipment WiFi network to be accessed Know, second character string are as follows: the password of second electronic equipment WiFi network to be accessed;
Mapping block, for the corresponding IP address of each character to be mapped as MAC Address;
Sending module, for periodicity sending by the multicast frame of each MAC Address for mapping address as a purpose, so that Second electronic equipment is according to grabbing and parse described in the service set and password access that the multicast frame obtains WiFi network.
7. device according to claim 6, which is characterized in that the coding module, comprising:
First determines submodule, for the classification according to character string where character, determines that the first of the corresponding IP address of character is pre- If the value of bit;
Second determines that submodule determines the second of the corresponding IP address of character for the serial number according to character in character string The value of predetermined bit position;
Third determines submodule, for the content according to character, determines the third predetermined bit position of the corresponding IP address of character Value, wherein the sum of first predetermined bit position, second predetermined bit position and digit of third predetermined bit position It is to be determined by the mapping relations of IP address and MAC Address.
8. device according to claim 7, which is characterized in that the quantity of third predetermined bit position is more than or equal to 16 Position;
The third determines submodule, comprising:
Character code is two bytes for the high nibble and low nibble according to the first code value by coding unit, wherein First code value are as follows: character corresponding code value in pre-arranged code rule;
Determination unit, for determining the third predetermined bit position of the corresponding IP address of character according to two bytes after coding Value.
9. device according to claim 8, which is characterized in that the coding unit, comprising:
First determines that subelement determines the high half-word of the first byte in two bytes for the low nibble according to the second code value Section, wherein second code value are as follows: a upper character in character string where the character corresponding code value in pre-arranged code rule;
Second determines that subelement determines the low nibble of first byte for the high nibble according to the first code value;
Third determines subelement, for the high nibble according to the first code value, determines the high half-word of the second byte in two bytes Section;
4th determines that subelement determines the low nibble of second byte for the low nibble according to the first code value;
The determination unit, comprising:
5th determines subelement, for first byte to be determined as the first default 8 bits in third predetermined bit position The value of position;
6th determines subelement, for second byte to be determined as the second default 8 bits in third predetermined bit position The value of position.
10. device according to claim 6, which is characterized in that described device further include:
Receiving module terminates hair for receiving the information for being successfully accessed the WiFi network of the second electronic equipment feedback Send the multicast frame of each MAC Address obtained by mapping address as a purpose.
11. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 1-5.
12. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program realizes claim 1-5 any method and step when the computer program is executed by processor.
CN201810118969.7A 2018-02-06 2018-02-06 WiFi connection method and device Active CN110120987B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810118969.7A CN110120987B (en) 2018-02-06 2018-02-06 WiFi connection method and device
PCT/CN2018/120311 WO2019153869A1 (en) 2018-02-06 2018-12-11 Wifi connection method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810118969.7A CN110120987B (en) 2018-02-06 2018-02-06 WiFi connection method and device

Publications (2)

Publication Number Publication Date
CN110120987A true CN110120987A (en) 2019-08-13
CN110120987B CN110120987B (en) 2021-03-26

Family

ID=67519449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810118969.7A Active CN110120987B (en) 2018-02-06 2018-02-06 WiFi connection method and device

Country Status (2)

Country Link
CN (1) CN110120987B (en)
WO (1) WO2019153869A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114697258B (en) * 2022-04-11 2024-07-02 网易(杭州)网络有限公司 Data communication method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104065765A (en) * 2014-07-09 2014-09-24 杭州古北电子科技有限公司 WIFI data transmitting method and system and related method thereof
CN104660726A (en) * 2015-02-03 2015-05-27 普联技术有限公司 Network configuration method, device and system for intelligent device
CN105101102A (en) * 2015-07-01 2015-11-25 北京奇虎科技有限公司 Multicast transmission method, information extraction method and corresponding terminal and equipment
US20170126491A1 (en) * 2015-11-02 2017-05-04 Mobitv, Inc. Self-configuration of wireless connections
CN106973124A (en) * 2017-03-02 2017-07-21 深圳壹秘科技有限公司 Network connection collocation method and its electronic installation

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8023513B2 (en) * 2009-02-24 2011-09-20 Fujitsu Limited System and method for reducing overhead in a wireless network
CN105119957A (en) * 2015-07-10 2015-12-02 普联技术有限公司 Information transmission method and device used for intelligent device
CN105515845A (en) * 2015-11-30 2016-04-20 青岛海尔智能家电科技有限公司 Data transmission method, data receiving method, data transmitting end and data receiving end
CN107371219B (en) * 2016-05-13 2020-08-25 华为终端有限公司 WiFi configuration method, WiFi mobile terminal and WiFi equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104065765A (en) * 2014-07-09 2014-09-24 杭州古北电子科技有限公司 WIFI data transmitting method and system and related method thereof
CN104660726A (en) * 2015-02-03 2015-05-27 普联技术有限公司 Network configuration method, device and system for intelligent device
CN105101102A (en) * 2015-07-01 2015-11-25 北京奇虎科技有限公司 Multicast transmission method, information extraction method and corresponding terminal and equipment
US20170126491A1 (en) * 2015-11-02 2017-05-04 Mobitv, Inc. Self-configuration of wireless connections
CN106973124A (en) * 2017-03-02 2017-07-21 深圳壹秘科技有限公司 Network connection collocation method and its electronic installation

Also Published As

Publication number Publication date
CN110120987B (en) 2021-03-26
WO2019153869A1 (en) 2019-08-15

Similar Documents

Publication Publication Date Title
US9674315B2 (en) Methods for dynamically binding header field identifiers in a network control protocol
CN101796779B (en) Aggregate data frame generation
CN103220371B (en) Content adaptation method and system
CN107750058A (en) Method, control terminal and the system of equipment access network based on wifi Beacon frames
CN105430713A (en) Identification method of wireless fidelity WiFi hotspot and terminal
WO2017000915A1 (en) Multicast transmission method, information extraction method and corresponding terminal and device
CN113162931A (en) Method for transmitting Modbus RTU protocol in wide area network
CN207766561U (en) A kind of system of control terminal and equipment access network
CN104937896A (en) Method for processing address resolution protocol message, forwarder and controller
CN105471917A (en) Data transmission method and system
CN108430091A (en) A kind of efficient smart home wifi distribution method and apparatus
CN107707557A (en) Anonymous access method, apparatus, the network equipment and readable storage medium storing program for executing
CN110457137A (en) Flow analytic method, device, electronic equipment and computer-readable medium
CN106162647B (en) Intelligent equipment configuration network access method and device
CN107370685A (en) A kind of internet-of-things terminal cut-in method and device
CN207652705U (en) A kind of system of control terminal and the equipment access network based on wifi Beacon frames
CN104205764A (en) Frame passing based on ethertype
CN110213756A (en) A kind of data transmission method, device and its relevant device
CN115150795A (en) Information filtering method, bluetooth antenna and Internet of things data platform
CN112422485B (en) Communication method and device of transmission control protocol
CN104853447B (en) A kind of data information processing method and device
CN110120987A (en) A kind of WiFi connection method and device
CN108809549B (en) Data transmission method and equipment
CN108460044B (en) Data processing method and device
CN111901813A (en) Network configuration method and equipment for customer premises equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant