Disclosure of Invention
The invention aims to solve the technical problem of providing a method, a device, equipment and a medium for identifying a mobile wifi signal, which are convenient for establishing a mobile wifi library with low cost.
In a first aspect, the present invention provides a method for identifying a mobile wifi signal, including:
Step 1, establishing a gps-wifi corresponding relation table for the last n times;
Step 2, establishing and updating a local mobile wifi library;
and 3, identifying the mobile wifi through a mobile wifi library.
Further, the step 1 is further specifically: according to the gps coordinate information acquired in the positioning process, the gps coordinate and the wifi signal acquired at the time are formed into a gps-wifi list corresponding relation, and the gps-wifi list corresponding relation is updated to the gps-wifi corresponding relation list of the last n times; the relation table comprises mac addresses and signal strengths of wifi.
Further, the step 2 is further specifically: when the gps-wifi corresponding relation table is updated, acquiring the latest gps-wifi corresponding relation, and calculating the distance between the new gps coordinates and the gps coordinates in the latest n gps-wifi corresponding relations; when the gps distance of the two points is larger than the set distance, comparing wifi signals corresponding to the new gps coordinates with wifi in a stored wifi list, and if the same wifi-mac exists and the signal difference of the two points is smaller than the set threshold; the wifi signal is indicated to be mobile wifi, and the mac of the wifi signal is updated to a local mobile wifi library; the local mobile wifi library is stored in a hash table mode; if not, the local mobile wifi library is not updated.
Further, the step 3 is further specifically: obtaining the mac of each current wifi and carrying out hash searching in a local mobile wifi library; if mac of the corresponding wifi is found, the mobile wifi is obtained; if not, the wifi is fixed.
In a second aspect, the present invention provides an apparatus for identifying a mobile wifi signal, including:
The relation table module is used for establishing a gps-wifi corresponding relation table for the last n times;
the wifi library module is used for establishing and updating a local mobile wifi library;
and the identification module is used for identifying the mobile wifi through the mobile wifi library.
Further, the relationship table module is further specifically: according to the gps coordinate information acquired in the positioning process, the gps coordinate and the wifi signal acquired at the time are formed into a gps-wifi list corresponding relation, and the gps-wifi list corresponding relation is updated to the gps-wifi corresponding relation list of the last n times; the relation table comprises mac addresses and signal strengths of wifi.
Further, the wifi library module is further specifically: when the gps-wifi corresponding relation table is updated, acquiring the latest gps-wifi corresponding relation, and calculating the distance between the new gps coordinates and the gps coordinates in the latest n gps-wifi corresponding relations; when the gps distance of the two points is larger than the set distance, comparing wifi signals corresponding to the new gps coordinates with wifi in a stored wifi list, and if the same wifi-mac exists and the signal difference of the two points is smaller than the set threshold; the wifi signal is indicated to be mobile wifi, and the mac of the wifi signal is updated to a local mobile wifi library; the local mobile wifi library is stored in a hash table mode; if not, the local mobile wifi library is not updated.
Further, the identification module is further specifically: obtaining the mac of each current wifi and carrying out hash searching in a local mobile wifi library; if mac of the corresponding wifi is found, the mobile wifi is obtained; if not, the wifi is fixed.
In a third aspect, the invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect when executing the program.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the method of the first aspect.
One or more technical solutions provided in the embodiments of the present invention at least have the following technical effects or advantages:
Compared with the existing mode of storing a large amount of mobile wifi data at a server side, the method has the advantages that the amount of mobile wifi data required to be stored is very small due to regional reasons of equipment (for example, the equipment can only be used in fixed certain areas, and only 6.3M of equipment storage space is required according to the 100w mobile wifi data storage requirements of an example), and additional server development and construction cost is not required.
According to the method for identifying the whole wifi mobile data, the identification method for the whole wifi mobile data is directly realized at the equipment end, a service platform does not need to be developed, all the mobile wifi data volume nationwide does not need to be considered, and only various mobile wifi data volumes encountered in the mobile process when the equipment is used are considered, so that the difficulty of realizing the base is very low.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Detailed Description
In order to solve the defects of the existing mobile wifi identification method in terms of system construction difficulty, construction conditions and equipment inquiry convenience, the invention provides a low-cost easy-to-realize solution method by locally establishing a mobile wifi identification library, wherein the realization thinking is as follows:
1. The device establishes a gps-wifi corresponding relation table for the last n times: when the device acquires the gps coordinate information in the positioning process, the gps coordinate and a plurality of wifi signals (mac address+signal intensity) acquired at the time are formed into a gps-wifi list corresponding relation, and the gps-wifi list corresponding relation is updated to the gps-wifi corresponding relation list of the last n times (for example, when the n is 500, 500 nearest gps coordinates and wifi signal lists corresponding to the position of each gps coordinate are stored);
2. The equipment maintains a mobile wifi library: when the device acquires the gps coordinate information in the positioning process, acquiring the current gps-wifi corresponding relation, and calculating the distance by the new gps coordinate and the gps in the gps-wifi corresponding relation of the nearest n gps-wifi corresponding relations; when the gps distance of the two points is greater than 200 meters, searching wifi in the current wifi list one by one in the stored wifi list, and if the wifi-mac corresponding to the same wifi-mac is found and the signal difference of the two persons is less than 70dbm (when the wifi signal difference of the two persons is less than 70dbm, the distance is within 150 m); the same wifi is found in two different places, namely the mobile wifi is indicated, and the mac of the wifi signal is updated into a mobile wifi library; the local mobile wifi library is stored in a hash table mode, so that subsequent retrieval and identification operations are facilitated;
3. The equipment identifies whether a certain wifi signal is mobile wifi through a mobile wifi library, when the equipment acquires the wifi signal to judge whether the wifi signal is mobile wifi, hash searching is carried out in the mobile wifi library maintained locally through mac of the wifi; if mac of the corresponding wifi is found, the mac indicates that the wifi is a known mobile wifi signal, if not, the mac indicates that the wifi is uncertain whether the wifi is a mobile wifi signal, and therefore mobile wifi signals which cannot be used for positioning can be filtered out in advance when the wifi is positioned.
As shown in fig. 1, the method of the present invention comprises the steps of:
a. The device establishes a gps-wifi corresponding relation table for the last n times: when the device acquires the gps coordinate information in the positioning process, the gps coordinate and a plurality of wifi signals (mac address+signal intensity) acquired at the time are formed into a gps-wifi list corresponding relation, and the gps-wifi list corresponding relation is updated to the gps-wifi corresponding relation list of the last n times (for example, when the n is 500, 500 nearest gps coordinates and wifi signal lists corresponding to the position of each gps coordinate are stored);
b. The equipment maintains a mobile wifi library: when the device acquires the gps coordinate information in the positioning process, acquiring the current gps-wifi corresponding relation, and calculating the distance by the new gps coordinate and the gps in the gps-wifi corresponding relation of the nearest n gps-wifi corresponding relations; when the gps distance of the two points is greater than 200 meters, searching wifi in the current wifi list one by one in the stored wifi list, and if the wifi-mac corresponding to the same wifi-mac is found and the signal difference of the two persons is less than 70dbm (when the wifi signal difference of the two persons is less than 70dbm, the distance is within 150 m); the same wifi is found in two different places, namely the mobile wifi is indicated, and the mac of the wifi signal is updated into a mobile wifi library; the local mobile wifi library is stored in a hash table mode, so that subsequent retrieval and identification operations are facilitated;
c. The equipment identifies whether a certain wifi signal is mobile wifi through a mobile wifi library, when the equipment acquires the wifi signal to judge whether the wifi signal is mobile wifi, hash searching is carried out in the mobile wifi library maintained locally through mac of the wifi; if mac of the corresponding wifi is found, the mac indicates that the wifi is a known mobile wifi signal, if not, the mac indicates that the wifi is uncertain whether the wifi is a mobile wifi signal, and therefore mobile wifi signals which cannot be used for positioning can be filtered out in advance when the wifi is positioned.
2. The device establishes a gps-wifi corresponding relation table for the last n times:
When the device acquires the gps coordinate information in the positioning process, the gps coordinate and a plurality of wifi signals (mac address+signal intensity) acquired at the time are formed into a gps-wifi list corresponding relation, and the gps-wifi list corresponding relation is updated to the gps-wifi corresponding relation list of the last n times (for example, when the n is 500, 500 nearest gps coordinates and wifi signal lists corresponding to the position of each gps coordinate are stored);
as shown in fig. 2, the specific implementation is as follows:
firstly, acquiring a gps-wifi list, generating a key-value pair, and then storing the key-value pair into a specified gps-wifi corresponding relation table in a (annular storage) FIFO mode.
One example of a specific gps-value pair is as follows:
if gps coordinate data is acquired as (longitude, latitude): 119.256383, 26.105022
The wifi signal list is as follows (wifi-mac | signal strength #wifi-mac| signal strength ):54:a7:03:a3:62:ff!-53#d0:76:e7:f0:cc:fa!-62#e0:e0:fc:03:cc:fd!-33#e0:e0:fc:03:cc:f9!-21#e0:e0:fc:03:cc:f8!-38#cc:2d:21:a3:01:98!-52#6a:db:54:5d:a5:9f!-21#bc:3f:8f:08:04:8c!-35#d4:83:04:81:48:cc!-28#44:97:5a:1e:cf:ec!-36
When converting it into a key-value relation to be saved, the following conversion is performed:
GPS generates key: the coordinates x100000 are converted into shaping, and then each is stored into 4 bytes of data, and an 8-byte key is generated together, specifically: (119.256383, 26.105022)
= = > X100000 turns into 4 bytes (11925638, 2610502)
8-Byte key stored by combination of= = > and (00B 5F8860027D 546)
Wifi list generation value saving value data of 7 bytes of wifi generation of each group (mac address takes 6 bytes, signal strength takes 1 byte), such as the following raw data :54:a7:03:a3:62:ff!-53#d0:76:e7:f0:cc:fa!-62#e0:e0:fc:03:cc:fd!-33#e0:e0:fc:03:cc:f9!-21#e0:e0:fc:03:cc:f8!-38#cc:2d:21:a3:01:98!-52#6a:db:54:5d:a5:9f!-21#bc:3f:8f:08:04:8c!-35#d4:83:04:81:48:cc!-28#44:97:5a:1e:cf:ec!-36
The value data is generated by rules as follows= = > :54A703A362FFCBD076E7F0CCFAC2E0E0FC03CCFDDFE0E0FC03CCF9EBE0E0FC03CCF8DACC2D21A30198CC6ADB545DA59FEBBC3F8F08048CDDD483048148CCE444975A1ECFECDC
C. the key-value relationship table generated as in the above example is:
key:00B5F8860027D546
value:54A703A362FFCBD076E7F0CCFAC2E0E0FC03CCFDDFE0E0FC03CCF9EBE0E0FC03CCF8DACC2D21A30198CC6ADB545DA59FEBBC3F8F08048CDDD483048148CCE444975A1ECFECDC
The occupied storage space is as follows: key is 8 bytes, value is: n7 (N is the number of wifi acquired this time, and 7 is 7 bytes of each wifi).
3. The equipment maintains a mobile wifi library:
As shown in fig. 3, when the device acquires the gps coordinate information in the positioning process, acquiring the current gps-wifi corresponding relation, and calculating the distance by using the new gps coordinate and gps in the latest n stored gps-wifi corresponding relations; when the gps distance between the two points is greater than 200 meters, searching wifi in the current wifi list and the stored wifi list one by one, and if the wifi-mac corresponding to the same wifi-mac is found and the signal difference of the two persons is less than 70dbm (when the wifi signal difference of the two persons is less than 70dbm, the distance is within 150 m); the same wifi is found in two different places, namely the mobile wifi is indicated, and the mac of the wifi signal is updated into a mobile wifi library; the local mobile wifi library is stored in a hash table mode, so that subsequent retrieval and identification operations are facilitated;
and 4, a hash table stores a mobile wifi method:
As shown in fig. 4, it is assumed that the saved data may exist directly in a flash block or in a single file, and the storage space is pre-allocated in the following manner:
as shown in fig. 5, the specific implementation is as follows:
A. save data instantiation:
a save allocation unit: the mac address data of each wifi is 6 bytes, then each 100 data storage units are regarded as a hash table allocation unit, and each allocation unit is 600 bytes;
hash function: if the data is distributed to 1003 storage blocks, the hash function can be designed as '6-byte mac address of wifi is converted into 32-bit int post-remainder 1003', and wifi is mapped to 1003 hash linked lists;
Actual data storage area (mobile wifi save total number plan): assuming that we need to save 100w of mobile wifi number, the number of bytes needed is 600w bytes, turning to the save unit to be 1w, considering pre-allocated unsaved full data (if each hash map is pre-allocated with a minimum of 500 wifi save capabilities, the pre-allocation needs to occupy (1003×500)/1024=490 KB); the corresponding data needs to be:
600w bytes+preassigned 490 kb= (600 x 10000)/1024+ (1003 x 500)/1024=589kb+490kb is about 6.3MB
Hash header allocation (Hash function data storage address table)
Assuming that each hash map can store 5 allocation units (500 wifi) at minimum and can store 100 allocation units (10000 wifi) at maximum, if this part of data is calculated according to 100 allocation units of each mapping unit of firmware, 100 x 1003 storage addresses are occupied, and if each address is calculated according to 2 bytes in an index mode, this part needs to: about 196KB of 2X 100X 1003
B. Storage implementation of each hash map:
When the whole storage space allocation is initialized, M (here 5) storage allocation units are allocated for each hash mapping of 1003 storage mappings; if a certain hash memory map is not used enough, determining whether it exceeds a maximum number of storable units N (here exemplified as 100); if the hash mapping is maximally not up to N and the total data storage pool has available space, directly allocating a new storage unit, and if the hash mapping is more than N storage units or no space in the data storage pool can be allocated, starting to circularly cover the storage unit from the earliest allocation (realizing FIFO coverage in a ring storage mode);
5. The equipment is through removing wifi storehouse and discerns whether a certain wifi signal is removal wifi:
As shown in fig. 6, when the device acquires the wifi signal to determine whether the wifi signal is mobile wifi, performing hash lookup in a mobile wifi library maintained locally through mac of the wifi; if mac of the corresponding wifi is found, the mac indicates that the wifi is a known mobile wifi signal, if not, the mac indicates that the wifi is uncertain whether the wifi is a mobile wifi signal, and therefore mobile wifi signals which cannot be used for positioning can be filtered out in advance when the wifi is positioned.
Example 1
As shown in fig. 1, the present embodiment provides a method for identifying a mobile wifi signal, including:
Step 1, according to the gps coordinate information obtained in the positioning process, forming a gps-wifi list corresponding relation by the gps coordinate and the wifi signal obtained at the time, and updating the gps-wifi list corresponding relation to the gps-wifi list corresponding relation of the last n times; the relation table comprises mac addresses and signal intensities of wifi;
Step 2, when the gps-wifi corresponding relation table is updated, acquiring the latest gps-wifi corresponding relation, and calculating the distance between the new gps coordinates and the gps coordinates in the latest n gps-wifi corresponding relations; when the gps distance of the two points is larger than the set distance, comparing wifi signals corresponding to the new gps coordinates with wifi in a stored wifi list, and if the same wifi-mac exists and the signal difference of the two points is smaller than the set threshold; the wifi signal is indicated to be mobile wifi, and the mac of the wifi signal is updated to a local mobile wifi library; the local mobile wifi library is stored in a hash table mode; if the local mobile wifi library does not exist, updating the local mobile wifi library;
step 3, performing hash searching in a local mobile wifi library by acquiring the mac of each current wifi; if mac of the corresponding wifi is found, the mobile wifi is obtained; if not, the wifi is fixed.
Based on the same inventive concept, the application also provides a device corresponding to the method in the first embodiment, and the details of the second embodiment are shown.
Example two
In this embodiment, an apparatus for identifying a mobile wifi signal is provided, including:
The relation table module is used for acquiring gps coordinate information in the positioning process, forming a gps-wifi list corresponding relation by the gps coordinate and the acquired wifi signal, and updating the gps-wifi list corresponding relation to the gps-wifi list corresponding relation of the last n times; the relation table comprises mac addresses and signal intensities of wifi;
the wifi library module is used for acquiring the latest gps-wifi corresponding relation when the gps-wifi corresponding relation table is updated, and calculating the distance between the new gps coordinates and the gps coordinates in the latest n gps-wifi corresponding relations; when the gps distance of the two points is larger than the set distance, comparing wifi signals corresponding to the new gps coordinates with wifi in a stored wifi list, and if the same wifi-mac exists and the signal difference of the two points is smaller than the set threshold; the wifi signal is indicated to be mobile wifi, and the mac of the wifi signal is updated to a local mobile wifi library; the local mobile wifi library is stored in a hash table mode; if the local mobile wifi library does not exist, updating the local mobile wifi library;
The identification module is used for obtaining the mac of each current wifi and carrying out hash searching in the local mobile wifi library; if mac of the corresponding wifi is found, the mobile wifi is obtained; if not, the wifi is fixed.
Since the device described in the second embodiment of the present invention is a device for implementing the method described in the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, a person skilled in the art can understand the specific structure and the deformation of the device, and thus the detailed description thereof is omitted herein. All devices used in the method according to the first embodiment of the present invention are within the scope of the present invention.
Based on the same inventive concept, the application provides an electronic device embodiment corresponding to the first embodiment, and the details of the third embodiment are shown in the specification.
Example III
The present embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where any implementation of the first embodiment may be implemented when the processor executes the computer program.
Since the electronic device described in this embodiment is a device for implementing the method in the first embodiment of the present application, those skilled in the art will be able to understand the specific implementation of the electronic device and various modifications thereof based on the method described in the first embodiment of the present application, so how the electronic device implements the method in the embodiment of the present application will not be described in detail herein. The apparatus used to implement the methods of embodiments of the present application will be within the scope of the intended protection of the present application.
Based on the same inventive concept, the application provides a storage medium corresponding to the first embodiment, and the detail of the fourth embodiment is shown in the specification.
Example IV
The present embodiment provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, can implement any of the implementation modes of the embodiment.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that the specific embodiments described are illustrative only and not intended to limit the scope of the invention, and that equivalent modifications and variations of the invention in light of the spirit of the invention will be covered by the claims of the present invention.