Geofence generation method, matching method, cloud equipment and electronic equipment

By using Wi-Fi signal scanning data and clustering technology of cloud devices to generate geofences, the problems of high power consumption, low precision and inability to be suitable for indoor use in the existing technology are solved, and high-precision and low-power geofence generation are achieved.

CN119906953AActive Publication Date: 2025-04-29HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311375923.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-20
Publication Date
2025-04-29
Estimated Expiration
2043-10-20

AI Technical Summary

Technical Problem

The existing geofence generation methods have problems such as high power consumption, low positioning accuracy, and inability to be applied to indoor locations.

Method used

Wi-Fi signal scanning data is used to generate geofences, and multiple Wi-Fi scan lists are clustered through cloud devices to calculate the feature weights of BSSID, and a high-precision geofence is generated based on these feature weights.

Benefits of technology

It reduces the power consumption of geofence generation, improves positioning accuracy, and can be suitable for positioning of indoor locations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119906953A_ABST
    Figure CN119906953A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of location services, and provides a geofence generation method, a matching method, cloud equipment and electronic equipment, and the method comprises the steps that the electronic equipment scans and collects a Wi-Fi scanning list including Wi-Fi access point information, and uploads the Wi-Fi scanning list to the cloud equipment; and the cloud equipment generates a geofence in a manner of clustering the Wi-Fi scanning list and extracting Wi-Fi feature weights. Subsequent electronic equipment can download the geo-fences generated by the cloud equipment to perform geo-fence matching so as to realize an information pushing service. Due to the wide application of the Wi-Fi technology, the electronic equipment has the Wi-Fi signal scanning capability, so that compared with the traditional high-power-consumption positioning technology for acquiring the position data, the Wi-Fi scanning is utilized to acquire and generate the position data of the geo-fences, the power consumption of the equipment can be reduced. Meanwhile, the Wi-Fi equipment is usually installed indoors, so that the Wi-Fi is used as a geographic fingerprint for indoor positioning to generate the geofence, and the high-precision geofence which can be suitable for indoor location positioning can be generated while the power consumption of the equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of location services, and in particular to a geographic fence generation method, a matching method, a cloud device, an electronic device, and a computer-readable storage medium. Background Art

[0002] Geo-fencing is a new application based on location-based services (LBS), which is to use a virtual fence to enclose a virtual geographic boundary. It can be understood that geo-fencing technology is a location-aware technology used for location-related service recommendation services.

[0003] Currently, most existing geo-fences are generated by collecting location data through network positioning technology, global navigation satellite system (GNSS) positioning technology, etc. However, the error of network positioning technology is generally large, while GNSS positioning technology consumes high power and cannot locate indoor locations, resulting in low accuracy, high power consumption, and inability to apply to indoor locations and other scenarios. Summary of the invention

[0004] The embodiments of the present application provide a geo-fence generation method, a matching method, a cloud device, an electronic device, and a computer-readable storage medium, which are used to solve the problems of high power consumption of existing geo-fence generation, low geo-fence positioning accuracy, and inability to be applied to indoor location positioning.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a method for generating a geo-fence is provided, the method being applied to a cloud device, comprising:

[0007] The cloud device obtains multiple Wi-Fi scan lists, each of which includes the BSSID and RSSI of one or more Wi-Fi access points scanned by an electronic device at one time. Then, the cloud device performs similarity clustering on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters including one or more Wi-Fi scan lists. The cloud device then obtains the feature weight corresponding to each BSSID in the Wi-Fi list cluster based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster and the RSSI corresponding to each BSSID. According to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, the first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster is calculated, and the matching threshold of the Wi-Fi list cluster is determined based on the multiple first matching scores. Finally, the cloud device generates a geographic fence corresponding to the Wi-Fi list cluster, and the generated geographic fence includes: multiple BSSIDs in the Wi-Fi list cluster and the feature weight corresponding to each BSSID, and the matching threshold of the Wi-Fi list cluster.

[0008] In the first aspect, since Wi-Fi technology has been widely used, most electronic devices have the ability to scan Wi-Fi signals. Furthermore, by using the Wi-Fi signal scanning capability of electronic devices to scan and collect the BSSID and RSSI of Wi-Fi access points as location data generated by geo-fences, there is no need to use existing network positioning, GNSS positioning and other technologies to collect location data, thereby avoiding the problems of high errors and high power consumption of equipment. At the same time, since Wi-Fi devices are usually installed and deployed in indoor locations and the coverage area of ​​the formed Wi-Fi signals is limited, Wi-Fi can be used as a high-precision geographic fingerprint for indoor positioning. Therefore, in the first aspect, the generation of geo-fences through information such as the BSSID and RSSI of Wi-Fi access points not only avoids the problem of high power consumption, but also can generate high-precision geo-fences that can be suitable for indoor positioning.

[0009] In a possible implementation of the first aspect, due to reasons such as wide Wi-Fi signal coverage or signal penetration, an electronic device that is not at the current indoor location may scan the Wi-Fi signal of this indoor location, resulting in the presence of the same BSSID in two Wi-Fi scan lists scanned at different indoor locations. Then, in order to eliminate interference from the same BSSID, the Wi-Fi scan lists scanned at different indoor locations are separated as much as possible to generate a more accurate geo-fence, and multiple Wi-Fi scan lists are clustered by similarity to obtain multiple Wi-Fi list clusters, which may include: for each two Wi-Fi scan lists in the multiple Wi-Fi scan lists, the similarity of the RSSI corresponding to the same BSSID in the two Wi-Fi scan lists is first calculated respectively. Then, the sum of the similarities of the RSSI corresponding to the same BSSID in the two Wi-Fi scan lists is calculated as the similarity of the two Wi-Fi scan lists. Then, based on the similarity of each two Wi-Fi scan lists in the multiple Wi-Fi scan lists, the multiple Wi-Fi scan lists are clustered by similarity to obtain multiple Wi-Fi list clusters.

[0010] Because the RSSI corresponding to the Wi-Fi device scanned by the electronic device that is closer to the Wi-Fi device will be higher, clustering based on the similarity of the RSSI corresponding to the same BSSID in the two Wi-Fi scan lists can improve the clustering accuracy, thereby achieving the effect of dividing more accurate geo-fences for different indoor locations. For example, when the similarity of the two RSSIs corresponding to the same BSSID is low, even if the two Wi-Fi scan lists include the same BSSID, the two Wi-Fi scan lists will not be considered to be Wi-Fi scan lists scanned for the same indoor location, and thus the Wi-Fi scan lists will not be divided into a cluster. Compared to directly dividing two Wi-Fi scan lists including the same BSSID into one cluster, the clustering accuracy is higher, thereby further ensuring the accuracy of the geo-fence.

[0011] In a possible implementation of the first aspect, since the larger the difference between two RSSIs, the larger the difference between the two RSSIs, the more dissimilar the two RSSIs can be determined accordingly, so whether the two RSSIs are similar can be determined by the signal strength difference between the RSSIs. Therefore, for each two Wi-Fi scan lists in a plurality of Wi-Fi scan lists, calculating the similarity of the RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists may include: calculating a first signal strength difference and a first signal strength weight of the RSSIs corresponding to the same BSSID in each two Wi-Fi scan lists in the plurality of Wi-Fi scan lists; multiplying the difference between the first signal strength difference and the second signal strength difference by the first signal strength weight as the similarity of the RSSIs corresponding to the same BSSID; wherein the first signal strength difference is negatively correlated with the first difference, the first difference is the difference between the RSSIs corresponding to the same BSSID, and the first signal strength weight is positively correlated with any RSSI corresponding to the same BSSID; the second signal strength difference is negatively correlated with the second difference, the second difference is the difference between any RSSI corresponding to the same BSSID and a preset RSSI.

[0012] In a possible implementation manner of the first aspect, the first signal strength difference and the first signal strength weight may be calculated by using the following formula:

[0013]

[0014] Among them, q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID, x i,b Indicates the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list; x j,b represents the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k q and d q is the preset parameter, k q =0.052160;d q =0.2; Ⅱ(x i,b <x j,b ) represents the indicator function. When the input condition x i,b <x j,b If true, the function value is 1, otherwise the function value is 0.

[0015]

[0016] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, x=x i,b or x j,b , including p(x i,b) or p(x j , b ), p(x i,b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list, p(x j , b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k p and b p is the preset parameter, k p =0.130401; b p =-65.

[0017] In a possible implementation manner of the first aspect, the similarity of RSSIs corresponding to the same BSSID may be calculated by using the following formula:

[0018] p(x)(q(x i,b , x j,b )-q(x,c x ))

[0019] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, including p(x i,b ) or p(x j,b );q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID; q(x,c x ) represents the second signal strength difference of any RSSI corresponding to the same BSSID, including q(x i,b ,c x ) or q(x j,b ,c x ), c x Indicates the preset RSSI.

[0020] Then, the similarity of two Wi-Fi scan lists can be calculated using the following formula:

[0021]

[0022] Among them, w(x i ,x j ) represents the similarity between the ith Wi-Fi i scan list and the jth Wi-Fi i scan list; B i ∩B j Indicates the i-th Wi-Fi scan list B i and the jth Wi-Fi scan list B j The set of the same BSSID in B, b∈B i ∩Bj .

[0023] In a possible implementation manner of the first aspect, the feature weight includes: a Wi-Fi signal strength median value, a Wi-Fi signal strength frequency weight, and a Wi-Fi signal strength benchmark feature. Then, based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster in the Wi-Fi list cluster and the RSSI corresponding to each BSSID, obtaining the feature weight corresponding to each BSSID in the Wi-Fi list cluster may include: calculating the median value of all RSSIs corresponding to the same BSSID in the Wi-Fi list cluster as the median value of the Wi-Fi signal strength corresponding to the BSSID; calculating the product of the second signal strength weight and the frequency of occurrence as the Wi-Fi signal strength frequency weight corresponding to the BSSID; wherein the frequency of occurrence is the ratio of the number of times the BSSID appears in the Wi-Fi list cluster to the number of Wi-Fi scan lists in the Wi-Fi list cluster; the second signal strength weight is positively correlated with the median value of the Wi-Fi signal strength; calculating the third signal strength difference as the Wi-Fi signal strength benchmark feature corresponding to the BSSID; wherein the third signal strength difference is negatively correlated with the third difference, and the third difference is the difference between the median value of the Wi-Fi signal strength and the preset RSSI.

[0024] In a possible implementation manner of the first aspect, the first matching score may be calculated by using the following formula:

[0025]

[0026] Where score(y,x) represents the first matching score between Wi-Fi list cluster y and Wi-Fi scan list x; B represents the set of identical BSSIDs in Wi-Fi list cluster y and Wi-Fi scan list x, b∈B; y b,f0 represents the Wi-Fi signal strength frequency weight f0 corresponding to BSSID b in Wi-Fi list cluster y; q(y b,i0 ,x b ) represents y b,i0 and x b The signal strength difference, y b,i0 represents the median value i0,x of the Wi-Fi signal strength corresponding to BSSID b in Wi-Fi list cluster y b Indicates the RSSI of BSSID b in Wi-Fi scan list x; y b,f1 It represents the Wi-Fi signal strength benchmark feature f1 corresponding to BSSID b in Wi-Fi list cluster y.

[0027] In a possible implementation of the first aspect, in order to enable the determined matching threshold to be used as a threshold for determining whether most Wi-Fi data matches a geo-fence, and the median value can generally reflect the central tendency of the data and avoid the influence of outliers, the matching threshold can be determined by the median value of the matching scores between the Wi-Fi list cluster and the multiple Wi-Fi scan lists. Based on this, determining the matching threshold of the Wi-Fi list cluster based on the multiple first matching scores may include: calculating the median value of the multiple first matching scores, and taking the product of the median value of the multiple first matching scores and the preset score weight as the matching threshold reference value; among the multiple first matching scores, taking the first matching score that is greater than or equal to the matching threshold reference value and has the smallest score as the matching threshold of the Wi-Fi list cluster.

[0028] In a possible implementation of the first aspect, when the number of Wi-Fi scan lists clustered together is large, the amount of BSSID data in the Wi-Fi list cluster will be relatively large, resulting in a large amount of data in the generated geo-fence. Therefore, in order to reduce the amount of data in the geo-fence, a first matching score between each Wi-Fi scan list in a plurality of Wi-Fi scan lists and the Wi-Fi list cluster is calculated according to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, and before determining the matching threshold of the Wi-Fi list cluster based on the plurality of first matching scores, the method may further include: filtering out the BSSIDs in the Wi-Fi list cluster according to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, and obtaining a Wi-Fi list cluster whose number of BSSIDs meets a preset number requirement.

[0029] Because only high-frequency, high-signal-strength BSSIDs are usually useful in geo-fences, a portion of the data in the Wi-Fi list cluster is filtered out based on feature weights, thereby reducing the amount of geo-fence data while retaining data with greater benefits.

[0030] In the second aspect, in order to apply the geo-fence generated by the first aspect to implement a location-based information push service, the second aspect mainly provides a geo-fence matching method, which is applied to an electronic device. One or more geo-fences are stored in the electronic device, and the geo-fences include multiple BSSIDs and feature weights corresponding to each BSSID, as well as a matching threshold of the geo-fence. The method includes: the electronic device scans the Wi-Fi signal at the current location to obtain a set of Wi-Fi data; wherein each set of Wi-Fi data includes a basic service set identifier BSSID and a signal strength RSSI of one or more Wi-Fi access points. Then, the electronic device calculates the second matching score between the Wi-Fi data and the geo-fence according to the feature weights corresponding to each BSSID in the geo-fence. If the second matching score is greater than or equal to the matching threshold, the electronic device determines that the Wi-Fi data matches the geo-fence. The above-mentioned feature weight is obtained based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster corresponding to the geo-fence and the RSSI corresponding to each BSSID; the Wi-Fi list cluster includes one or more Wi-Fi scan lists obtained by clustering, and each Wi-Fi scan list includes the BSSID and RSSI of one or more Wi-Fi access points obtained by one electronic device at a time.

[0031] In a possible implementation of the second aspect, in order to save the power consumption load of the electronic device, the storage space occupied by the geo-fence is saved. The geo-fence matching method may also include: obtaining positioning information, and determining the administrative area corresponding to the current location according to the positioning information; wherein the positioning information is the location information of the electronic device obtained according to a preset period, including any one or more of longitude and latitude and cellular cell identification; downloading one or more geo-fences corresponding to the administrative area from the cloud device and saving them locally. Thus, the geo-fence corresponding to the administrative area where the electronic device is located is downloaded through the positioning information, ensuring that only the geo-fence required for the location is stored in the electronic device, thereby meeting the matching requirements while reducing the power consumption of the electronic device load and saving storage space.

[0032] In a possible implementation of the second aspect, in order to prevent the increase in storage space and power consumption caused by the cumulative downloading and saving of geo-fences, the geo-fence matching method may also include: setting a validity period for the downloaded and saved geo-fences; when the validity period of the geo-fence expires, locally deleting the geo-fence with the expired validity period.

[0033] In a possible implementation manner of the second aspect, the geo-fence matching method may further include: expanding an area with the positioning information as the center point to the surrounding area to obtain a fence judgment area; if there is a geo-fence in the fence judgment area, registering a Wi-Fi scan callback function; after scanning the Wi-Fi signal at the current location to obtain a group of Wi-Fi data, executing the Wi-Fi scan callback function; executing the Wi-Fi scan callback function includes: calculating a second matching score between the Wi-Fi data and the geo-fence according to a feature weight corresponding to each BSSID in the geo-fence; if the second matching score is greater than or equal to a matching threshold, determining that the Wi-Fi data matches the geo-fence.

[0034] In this implementation, the key processing steps of geo-fence matching are encapsulated into a Wi-Fi scan callback function. This Wi-Fi scan callback function will only be registered and take effect when there is a geo-fence around the electronic device. Only then can the electronic device perform geo-fence matching, thereby avoiding the electronic device being in the geo-fence matching state all the time and preventing the matching power consumption from increasing.

[0035] In a possible implementation of the second aspect, in order to prevent the Wi-Fi scan callback function registration from being always valid, causing the electronic device to be continuously in a matching state, resulting in increased power consumption, the geo-fence matching method may also include: when there is no geo-fence in the fence judgment area, unregistering the registered Wi-Fi scan callback function.

[0036] In a possible implementation manner of the second aspect, calculating the second matching score of the Wi-Fi data and the geo-fence according to the feature weight corresponding to each BSSID in the geo-fence may include: calculating a fourth signal strength difference between the geo-fence and the same BSSID in the Wi-Fi data; wherein the fourth signal strength difference is negatively correlated with the fourth difference; the fourth difference is the difference between the median Wi-Fi signal strength corresponding to the same BSSID in the geo-fence and the RSSI corresponding to the same BSSID in the Wi-Fi data; calculating the matching score of the geo-fence and the same BSSID in the Wi-Fi data according to the fourth signal strength difference, the Wi-Fi signal strength frequency weight corresponding to the same BSSID in the geo-fence, and the Wi-Fi signal strength baseline feature; calculating the second matching score of the geo-fence and the Wi-Fi data; the second matching score is the sum of the matching scores of all the same BSSIDs in the geo-fence and the Wi-Fi data.

[0037] In a possible implementation of the second aspect, after the electronic device completes the matching of the geo-fence, the location-based information push service can be implemented based on the matched geo-fence. Therefore, the geo-fence matching method may also include: receiving or sending information push according to the matched geo-fence.

[0038] In a third aspect, an embodiment of the present application provides a cloud device, including: a communication module, one or more processors and a memory; the communication module, the memory and the processor are coupled; one or more computer program codes are stored in the memory, and the computer program code includes computer instructions; when the processor executes the computer instructions, the cloud device performs the following steps:

[0039] Acquire multiple Wi-Fi scan lists; wherein each Wi-Fi scan list includes a basic service set identifier (BSSID) and a signal strength (RSSI) of one or more Wi-Fi access points obtained by one electronic device at one time of scanning; perform similarity clustering on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters; wherein each Wi-Fi list cluster includes one or more Wi-Fi scan lists; obtain a feature weight corresponding to each BSSID in the Wi-Fi list cluster based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster and the RSSI corresponding to each BSSID; calculate a first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster according to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, and determine a matching threshold of the Wi-Fi list cluster based on the multiple first matching scores; generate a geographic fence corresponding to the Wi-Fi list cluster, the geographic fence including: multiple BSSIDs in the Wi-Fi list cluster and the feature weight corresponding to each BSSID, and the matching threshold of the Wi-Fi list cluster.

[0040] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0041] For every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, calculate the similarity of RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists;

[0042] Calculate the similarity of the two Wi-Fi scan lists; wherein the similarity of the two Wi-Fi scan lists is equal to the sum of the similarities of the RSSIs corresponding to the same BSSIDs in the two Wi-Fi scan lists;

[0043] Based on the similarity between every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, similarity clustering is performed on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters.

[0044] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0045] Calculate a first signal strength difference and a first signal strength weight of RSSIs corresponding to the same BSSID in every two Wi-Fi scan lists in the multiple Wi-Fi scan lists; wherein the first signal strength difference is negatively correlated with the first difference value, the first difference value is the difference value of RSSIs corresponding to the same BSSID, and the first signal strength weight is positively correlated with any RSSI corresponding to the same BSSID;

[0046] The product of the difference between the first signal strength difference and the second signal strength difference and the first signal strength weight is used as the similarity of the RSSI corresponding to the same BSSID; wherein the second signal strength difference is negatively correlated with the second difference, and the second difference is the difference between any RSSI corresponding to the same BSSID and the preset RSSI.

[0047] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0048] The first signal strength difference and the first signal strength weight are calculated using the following formula:

[0049]

[0050] Among them, q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID, x i,b represents the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list; x j,b Indicates the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k q and d q is the preset parameter, k q =0.052160;d q =0.2; Ⅱ(x i,b <x j,b ) represents the indicator function. When the input condition x i,b <x j,b When true, the function value is 1, otherwise the function value is 0;

[0051]

[0052] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, x=x i,b or x j,b , including p(x i,b ) or p(x j,b ), p(x i,b) represents the first signal strength weight of the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list, p(x j,b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k p and b p is the preset parameter, k p =0.130401; b p =-65.

[0053] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0054] The following formula is used to calculate the similarity of RSSI corresponding to the same BSSID:

[0055] p(x)(q(x i,b , x j,b )-q(x,c x ))

[0056] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, including p(x i,b ) or p(x j,b );q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID; q(x,c x ) represents the second signal strength difference of any RSSI corresponding to the same BSSID, including q(x i,b ,c x ) or q(x j,b ,c x ), c x Indicates the preset RSSI;

[0057] The similarity between two Wi-Fi scan lists is calculated using the following formula:

[0058]

[0059] Among them, w(x i ,x j ) represents the similarity between the i-th Wi-Fi scan list and the j-th Wi-Fi scan list; B i ∩B j Indicates the i-th Wi-Fi scan list B i and the jth Wi-Fi scan list B j The set of the same BSSID in B, b∈B i ∩B j .

[0060] In a possible implementation manner of the third aspect, the feature weight includes: a Wi-Fi signal strength median value, a Wi-Fi signal strength frequency weight, and a Wi-Fi signal strength baseline feature; when the foregoing computer instructions are executed by the processor, the cloud server further performs the following steps:

[0061] Calculate the median value of all RSSIs corresponding to the same BSSID in the Wi-Fi list cluster as the median value of the Wi-Fi signal strength corresponding to the BSSID;

[0062] Calculate the product of the second signal strength weight and the occurrence frequency as the Wi-Fi signal strength frequency weight corresponding to the BSSID; wherein the occurrence frequency is the ratio of the number of times the BSSID appears in the Wi-Fi list cluster to the number of Wi-Fi scan lists in the Wi-Fi list cluster; the second signal strength weight is positively correlated with the median value of the Wi-Fi signal strength;

[0063] A third signal strength difference is calculated as a Wi-Fi signal strength reference feature corresponding to the BSSID; wherein the third signal strength difference is negatively correlated with a third difference value, and the third difference value is a difference between a median Wi-Fi signal strength value and a preset RSSI.

[0064] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0065] The first match score is calculated using the following formula:

[0066]

[0067] Where score(y,x) represents the first matching score between Wi-Fi list cluster y and Wi-Fi scan list x; B represents the set of identical BSSIDs in Wi-Fi list cluster y and Wi-Fi scan list x, b∈B; y b,f0 represents the Wi-Fi signal strength frequency weight f0 corresponding to BSSID b in Wi-Fi list cluster y; q(y b,i0 ,x b ) represents y b,i0 and x b The signal strength difference, y b,i0 represents the median value i0,x of the Wi-Fi signal strength corresponding to BSSID b in Wi-Fi list cluster y b Indicates the RSSI of BSSID b in Wi-Fi scan list x; y b,f1 It represents the Wi-Fi signal strength benchmark feature f1 corresponding to BSSID b in Wi-Fi list cluster y.

[0068] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0069] Calculating a median value of a plurality of first matching scores, and taking a product of the median value of the plurality of first matching scores and a preset score weight as a matching threshold reference value;

[0070] Among the multiple first matching scores, a first matching score that is greater than or equal to the matching threshold reference value and has the smallest score is used as the matching threshold of the Wi-Fi list cluster.

[0071] In a possible implementation manner of the third aspect, when the computer instructions are executed by the processor, the cloud server further performs the following steps:

[0072] According to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, the BSSIDs in the Wi-Fi list cluster are screened out to obtain a Wi-Fi list cluster whose number of BSSIDs meets a preset number requirement.

[0073] In a fourth aspect, the present application provides an electronic device, comprising: a communication module, one or more processors and a memory; the communication module, the memory and the processor are coupled; the memory stores one or more computer program codes, the computer program codes including computer instructions; when the processor executes the computer instructions, the electronic device performs the following steps:

[0074] Scan the Wi-Fi signal at the current location to obtain a set of Wi-Fi data; wherein each set of Wi-Fi data includes a basic service set identifier BSSID and a signal strength RSSI of one or more Wi-Fi access points;

[0075] A second matching score between the Wi-Fi data and the geo-fence is calculated based on the feature weights corresponding to each BSSID in the geo-fence; wherein the feature weights are obtained based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster corresponding to the geo-fence and the RSSI corresponding to each BSSID; the Wi-Fi list cluster includes one or more Wi-Fi scan lists obtained by clustering, and each Wi-Fi scan list includes the BSSIDs and RSSIs of one or more Wi-Fi access points obtained by a single scan by an electronic device.

[0076] If the second matching score is greater than or equal to the matching threshold, it is determined that the Wi-Fi data matches the geo-fence.

[0077] In a possible implementation manner of the fourth aspect, when the computer instructions are executed by a processor, the electronic device further performs the following steps:

[0078] Acquire positioning information, and determine the administrative region corresponding to the current location according to the positioning information; wherein the positioning information is the location information of the electronic device acquired according to a preset period, including any one or more of latitude and longitude and cellular cell identification;

[0079] Download one or more geo-fences corresponding to the administrative area from the cloud device and save them locally.

[0080] In a possible implementation manner of the fourth aspect, when the computer instructions are executed by a processor, the electronic device further performs the following steps:

[0081] Set a validity period for the downloaded and saved geofence; when the validity period of the geofence expires, delete the geofence locally.

[0082] In a possible implementation manner of the fourth aspect, when the computer instructions are executed by a processor, the electronic device further performs the following steps:

[0083] The area is expanded to the surrounding area with the positioning information as the center point to obtain the fence judgment area;

[0084] If there is a geo-fence in the fence determination area, register the Wi-Fi scan callback function;

[0085] After scanning the Wi-Fi signal at the current location to obtain a set of Wi-Fi data, executing the Wi-Fi scan callback function; executing the Wi-Fi scan callback function includes: calculating a second matching score between the Wi-Fi data and the geo-fence according to the feature weights corresponding to each BSSID in the geo-fence; if the second matching score is greater than the matching threshold, determining that the Wi-Fi data matches the geo-fence.

[0086] In a possible implementation manner of the fourth aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: when there is no geographic fence in the fence judgment area, cancel the registered Wi-Fi scan callback function.

[0087] In a possible implementation manner of the fourth aspect, when the computer instructions are executed by a processor, the electronic device further performs the following steps:

[0088] Calculate the fourth signal strength difference between the geo-fence and the same BSSID in the Wi-Fi data; wherein the fourth signal strength difference is negatively correlated with the fourth difference value; the fourth difference value is the difference between the median value of the Wi-Fi signal strength corresponding to the same BSSID in the geo-fence and the RSSI corresponding to the same BSSID in the Wi-Fi data;

[0089] Calculate a match score between the geo-fence and the same BSSID in the Wi-Fi data based on the fourth signal strength difference, the Wi-Fi signal strength frequency weight corresponding to the same BSSID in the geo-fence, and the Wi-Fi signal strength benchmark feature;

[0090] Calculate a second matching score between the geofence and the Wi-Fi data; the second matching score is the sum of matching scores of all identical BSSIDs in the geofence and the Wi-Fi data.

[0091] In a possible implementation of the fourth aspect, when the above-mentioned computer instructions are executed by the processor, the electronic device further performs the following steps: receiving or sending information push according to the matched geographic fence.

[0092] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor in a cloud device, the cloud device executes the geo-fence generation method of the first aspect and any possible design thereof. Alternatively, when the computer program is executed by a processor in an electronic device, the electronic device executes the geo-fence matching method of the second aspect and any possible design thereof.

[0093] In a sixth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the geo-fence generation method of the first aspect and any possible design thereof, and the computer may be the above-mentioned cloud device. Alternatively, when executed on a computer, the computer enables the computer to execute the geo-fence matching method of the second aspect and any possible design thereof, and the computer may be the above-mentioned electronic device.

[0094] It can be understood that the beneficial effects that can be achieved by the cloud device of any possible design of the third aspect, the electronic device of any possible design of the fourth aspect, the computer-readable storage medium of the fifth aspect, and the computer program product of the sixth aspect can be referred to the beneficial effects in the first aspect and any possible design of it, the second aspect and any possible design of it, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] Figure 1 A schematic diagram of the system architecture of a Wi-Fi-based geo-fencing technology provided in an embodiment of the present application;

[0096] Figure 2 An interaction intention based on an electronic device and a cloud device provided in an embodiment of the present application;

[0097] Figure 3A schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application;

[0098] Figure 4 A schematic diagram of a flow chart of a method for generating a geographic fence provided in an embodiment of the present application;

[0099] Figure 5 A schematic diagram of a Wi-Fi list set provided in an embodiment of the present application;

[0100] Figure 6 A flowchart of a geo-fence matching method provided in an embodiment of the present application;

[0101] Figure 7 A flowchart of another geo-fence matching method provided in an embodiment of the present application;

[0102] Figure 8 A block diagram of the software and hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0103] The technical solutions of the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to limit the present application. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. It can be understood by those skilled in the art that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not limit certain differences. And, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" means two or more.

[0104] Geofencing is a new application based on location services, that is, using a virtual fence to enclose a virtual geographic boundary. It can be understood that geofencing technology is a location-aware technology used for location-related service recommendation services. When an electronic device (such as a mobile phone) enters, leaves, or moves within a specific geofence, the electronic device (such as a mobile phone) can receive or send corresponding information push. Information push can include automatic notifications, warnings, and triggering pre-subscribed activities, obtaining customized location-related services, etc.

[0105] Currently, most existing geo-fences are generated by collecting location data through network positioning technology, GNSS positioning technology, etc. However, the network positioning technology has a large error, which can generally reach hundreds of meters, which can easily reduce the accuracy of geo-fences due to errors. Although the GNSS positioning technology has a small error, it requires high power consumption and cannot be applied to indoor locations. As a result, it cannot be accurately applied to indoor locations and other scenarios under high power consumption.

[0106] Based on this, in order to improve the accuracy of geo-fences, reduce the power consumption required for geo-fence generation and make geo-fences accurately applicable to scenarios such as indoor locations, an embodiment of the present application provides a geo-fence generation method, which is mainly generated based on Wi-Fi (wireless fidelity) related data.

[0107] Since Wi-Fi technology has been widely popularized, most electronic devices have the ability to scan Wi-Fi signals. Therefore, using the Wi-Fi signal scanning capability of electronic devices to scan and collect information about Wi-Fi access points as location data for generating geo-fences can avoid the high error of network positioning technology and the high power consumption of GNSS positioning technology compared to traditional network positioning technology and GNSS positioning technology for collecting location data, thereby reducing errors and reducing high power consumption. At the same time, most existing Wi-Fi devices (such as routers) are installed and deployed in indoor locations and other scenarios. Therefore, Wi-Fi is a geographic fingerprint that can be used for indoor positioning. In addition, since the Wi-Fi signal coverage area formed by Wi-Fi devices is limited, the positioning accuracy of Wi-Fi will be relatively high, and its accuracy can reach up to ten meters. Therefore, the Wi-Fi-based geo-fence generation method provided in the embodiment of the present application can not only reduce power consumption and solve the problem of high power consumption of equipment. It can also generate geo-fences that can be used for indoor location positioning and the accuracy of geo-fences is high.

[0108] like Figure 1 As shown, the present application embodiment provides a schematic diagram of a system architecture applicable to a Wi-Fi-based geo-fence generation method. Figure 1 The system architecture shown provides a brief introduction to the geo-fence generation method provided in the embodiment of the present application.

[0109] refer to Figure 1 The system architecture provided in the embodiment of the present application mainly includes an electronic device 100 ( Figure 1The figure shows a mobile phone as an example), a cloud device 102, and a Wi-Fi device 103. The Wi-Fi device 103 can form a signal coverage area 104 corresponding to a Wi-Fi access point, and an electronic device 100 located in the signal coverage area 104 corresponding to the Wi-Fi access point can scan the Wi-Fi signal corresponding to the Wi-Fi device 103, and then obtain the information of the corresponding Wi-Fi access point (Access Point, AP).

[0110] Among them, the electronic device 100 can be understood as the application end of the geo-fence, which is used to scan and collect Wi-Fi data and provide it to the cloud device 102. The electronic device 100 can also be used to achieve the matching of the geo-fence, and implement the information push service according to the matched geo-fence, so as to receive or send the corresponding information push. The cloud device 102 can be understood as the service end of the electronic device 100, for example, it can be a cloud server, which is mainly used to generate the geo-fence based on the Wi-Fi data uploaded by the electronic device 100. At the same time, the cloud device 102 has the ability to store and process big data, and can manage and update all geo-fences.

[0111] It should be understood that Figure 1 The number of electronic devices 100, cloud devices 102, and Wi-Fi devices 103 in the illustrated system architecture is only used for illustration of the embodiments of the present application, and can be any number according to actual needs and actual device deployment. For example, the cloud device 102 can be a single cloud server or a cloud server cluster composed of multiple servers. The number of Wi-Fi devices 103 can mainly depend on the number installed in the actual application scenario.

[0112] Specifically, the electronic device 100 can scan nearby Wi-Fi signals at a certain frequency to obtain a Wi-Fi scan list. Alternatively, the electronic device 100 can scan nearby Wi-Fi signals in response to user operations to obtain a Wi-Fi scan list. Among them, the electronic device can scan Wi-Fi signals corresponding to one or more Wi-Fi devices 103 at the same time, and one Wi-Fi signal corresponds to one Wi-Fi access point, so that the electronic device 100 can obtain information about one or more Wi-Fi access points in one scan. Therefore, the Wi-Fi scan list includes information about one or more Wi-Fi access points scanned by the electronic device 100. The information of a Wi-Fi access point may include: Basic Service Set Identifier (BSSID), Received Signal Strength Indication (RSSI) and Service Set Identifier (SSID). In an embodiment of the present application, the information of the Wi-Fi access point includes at least the Basic Service Set Identifier BSSID and the Received Signal Strength Indication RSSI.

[0113] Then, the electronic device 100 may upload the scanned Wi-Fi scan list to the cloud device 102 via the network, and the cloud device 102 may generate a geo-fence based on the Wi-Fi scan list.

[0114] Optionally, in order to ensure the validity of the information of the Wi-Fi access point, after the electronic device 100 collects the Wi-Fi scan list, it can be pre-processed before uploading it to the cloud device 102. For example, the pre-processing of the Wi-Fi scan list can be to filter out the information of invalid Wi-Fi access points, filter out the information of Wi-Fi access points with null value parameters, or filter out the information of Wi-Fi access points with too low RSSI, etc. By filtering and screening the information in the Wi-Fi scan list, it is ensured that the Wi-Fi data in the Wi-Fi scan list uploaded to the cloud device 102 is valid.

[0115] It can be seen that the way in which the cloud device 102 in the embodiment of the present application obtains the Wi-Fi scan list required for generating the geographic fence is mainly completed by the electronic device 100 in a crowdsourcing manner (that is, the collection is completed by multiple electronic devices).

[0116] Optionally, in order to upload Wi-Fi data as quickly as possible, after collecting the Wi-Fi scan list, the electronic device 100 can use the mobile network or the Wi-Fi network to upload the collected Wi-Fi scan list to the cloud device 102. Alternatively, in order to save the user's mobile network traffic, the electronic device 100 can also use the Wi-Fi network to upload the collected Wi-Fi scan list to the cloud device 102 only when it is connected to the Wi-Fi network.

[0117] Of course, the electronic device 100 may also upload the collected Wi-Fi scan list in other situations that do not affect the user's use of the electronic device 100. In other words, the timing of the electronic device 100 actually uploading the Wi-Fi scan list can be set according to actual needs, and the embodiment of the present application does not impose any limitation on this.

[0118] After the cloud device 102 receives the Wi-Fi scan lists uploaded by each electronic device 100, these Wi-Fi scan lists can be loaded to generate a Wi-Fi-based geo-fence.

[0119] Specifically, the cloud device 102 first performs similarity clustering on multiple Wi-Fi scan lists, and divides the multiple Wi-Fi scan lists uploaded by the electronic device 100 into clusters through clustering to obtain a Wi-Fi list cluster. According to the actual clustering situation, each Wi-Fi list cluster includes one or more Wi-Fi scan lists. Among them, similarity clustering is mainly based on the similarity between each Wi-Fi scan list. The similarity between Wi-Fi scan lists is determined by measuring the similarity of RSSI corresponding to the same BSSID in the Wi-Fi scan list.

[0120] After the cloud device 102 obtains the Wi-Fi list cluster, due to similarity clustering, the same BSSID may exist in different Wi-Fi scan lists in the Wi-Fi list cluster. Then, one BSSID may correspond to multiple RSSIs. In this case, it is impossible to measure the signal condition of this BSSID with only one RSSI. Therefore, the cloud device 102 further extracts features based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster and the RSSI corresponding to each BSSID in the Wi-Fi list cluster, and obtains the feature weight corresponding to each BSSID in the Wi-Fi list cluster.

[0121] It should be understood that when different electronic devices scan Wi-Fi signals at the same location, the similarity of the obtained Wi-Fi scan lists will be higher. In the embodiment of the present application, only Wi-Fi scan lists with high similarity can be divided into a Wi-Fi list cluster. Therefore, the Wi-Fi scan lists in each Wi-Fi list cluster can basically be considered to be obtained by scanning at the same location, which can reflect the characteristics of the Wi-Fi signals at these locations. In this way, the embodiment of the present application subsequently generates a geo-fence for each Wi-Fi list cluster based on the Wi-Fi scan list in the Wi-Fi list cluster, and applies the geo-fence to the identification of entry into the corresponding place / venue, which can improve the accuracy of the judgment of identifying electronic devices entering the geo-fence.

[0122] Next, in order to ensure that the electronic device 100 can effectively match the geo-fence generated by the cloud device 102 based on the Wi-Fi list cluster in actual applications. And, in order to provide the electronic device 100 with a judgment threshold that can determine whether it matches the geo-fence, the cloud device 102 further determines the matching threshold of the Wi-Fi list cluster. The cloud device 102 calculates the first matching score of each Wi-Fi scan list in multiple Wi-Fi scan lists and the Wi-Fi list cluster based on the characteristic weights of each BSSID in the Wi-Fi list cluster, and determines the matching threshold of the Wi-Fi list cluster based on the multiple first matching scores. After calculating the matching scores of the Wi-Fi list cluster and different Wi-Fi scan lists by the characteristic weights of the BSSID, a suitable matching threshold is determined based on these multiple matching scores, which can ensure that the determined matching threshold can be used as the judgment threshold for matching most different Wi-Fi data with the geo-fence, thereby improving the accuracy of the matching judgment.

[0123] Finally, the cloud device 102 generates a geo-fence corresponding to the Wi-Fi list cluster. In the embodiment of the present application, the Wi-Fi list cluster corresponds to the geo-fence one-to-one, and one Wi-Fi list cluster can only generate one geo-fence. Therefore, the generated geo-fence includes: multiple BSSIDs in the Wi-Fi list cluster and the feature weights corresponding to each BSSID. At the same time, the cloud device 102 uses the matching threshold of this Wi-Fi list cluster as the matching threshold of the corresponding geo-fence. Therefore, the geo-fence also includes the matching threshold of the corresponding Wi-Fi list cluster, which facilitates the subsequent electronic device 100 to make matching judgments for the geo-fence based on this matching threshold.

[0124] At this point, the cloud device 102 has completed the generation of the geo-fence. Afterwards, the electronic device 100 can download and save the geo-fence generated by the cloud device 102 to the local computer, and the electronic device 100 can match and determine the geo-fence corresponding to the current location among these geo-fences, thereby realizing the information push service based on the geo-fence.

[0125] Based on this, the embodiment of the present application also provides a geo-fence matching method applied to the electronic device 100. Figure 1 The system architecture shown provides a brief introduction to the geo-fence matching method provided in the embodiment of the present application.

[0126] Specifically, when the electronic device 100 needs to match the geographic fence, it first scans the Wi-Fi signal at the current location to obtain a set of WiFi data. Among them, since there may be one or more Wi-Fi devices 103 corresponding to the coverage of the Wi-Fi signal at the current location. Therefore, the electronic device can simultaneously scan one or more Wi-Fi signals corresponding to the current location. Therefore, the set of Wi-Fi data obtained by the electronic device includes the BSSID and RSSI of one or more Wi-Fi access points. It can be seen that a set of Wi-Fi data scanned by the electronic device 100 during the matching process is equivalent to the Wi-Fi scan list uploaded by the electronic device 100 to the cloud device 102 for generating the geographic fence. The only difference between the two is that the timing of the electronic device 100 scanning and collecting is different, and the data content of the two is the same, and both can include BSSID, RSSI and SSID.

[0127] Then, the electronic device 100 calculates the matching score between this set of Wi-Fi data and each geo-fence based on the feature weights corresponding to each BSSID in the local geo-fence, and obtains a second matching score. Finally, the electronic device 100 compares the second matching score corresponding to each geo-fence with the matching threshold. When the second matching score corresponding to the geo-fence is greater than or equal to the matching threshold, it is determined that this set of Wi-Fi data matches the geo-fence corresponding to the second matching score. The geo-fence that matches the Wi-Fi data is the geo-fence corresponding to the current location of the electronic device.

[0128] Furthermore, after the electronic device 100 matches the geographic fence corresponding to the current location, an information push service can be implemented based on this matching geographic fence, and the electronic device can receive or send the corresponding information push.

[0129] like Figure 2 As shown, a schematic diagram of the interaction between an electronic device and a cloud device is provided. Figure 2 The interaction process between the electronic device and the cloud device is mainly explained by taking two electronic devices (electronic device A and electronic device B) as an example.

[0130] The following, combined Figure 2 The interaction process between the electronic device and the cloud device in the embodiment of the present application is described.

[0131] First, electronic device A and electronic device B scan nearby Wi-Fi signals respectively, and collect Wi-Fi scan lists including BSSIDs and RSSIs of one or more Wi-Fi access points. Electronic device A and electronic device B upload Wi-Fi scan lists to cloud devices respectively. Then, after obtaining the Wi-Fi scan lists uploaded by electronic device A and electronic device B, the cloud device executes the process of the geo-fence generation method to generate a geo-fence. Among them, the cloud device executes the geo-fence generation method, which may include: after the cloud device obtains multiple Wi-Fi scan lists, the multiple Wi-Fi scan lists are clustered by similarity to obtain multiple Wi-Fi list clusters. Then, the cloud device obtains the feature weight corresponding to each BSSID in the Wi-Fi list cluster based on the frequency of occurrence of each BSSID in the Wi-Fi list cluster and the RSSI corresponding to each BSSID. The cloud device then calculates the first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster according to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, and determines the matching threshold generation of the Wi-Fi list cluster based on the multiple first matching scores. Furthermore, the cloud device generates a geo-fence including multiple BSSIDs in the Wi-Fi list cluster and a feature weight corresponding to each BSSID, as well as a matching threshold of the Wi-Fi list cluster.

[0132] After the cloud device generates the geo-fence, electronic device A and electronic device B download the geo-fence generated by the cloud device from the cloud device, and then the electronic devices execute the process of the geo-fence matching method. By executing the geo-fence matching method, the electronic device can match the geo-fence corresponding to the current location from the downloaded geo-fence. Among them, the geo-fences downloaded by electronic device A and electronic device B include multiple BSSIDs and feature weights corresponding to each BSSID, as well as the matching threshold corresponding to this geo-fence. The electronic device executes the geo-fence matching method, which may include: electronic device A and electronic device B respectively scan the Wi-Fi signal at the current location to obtain a group of Wi-Fi data, and then calculate the matching score between the Wi-Fi data at the current location and the geo-fence according to the feature weights corresponding to each BSSID in the geo-fence. Then, the geo-fence with a matching score greater than or equal to the matching threshold is used as a matching geo-fence.

[0133] In addition to being a mobile phone including a Wi-Fi module, the above-mentioned electronic device 100 can also be a foldable electronic device, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a vehicle-mounted device, a smart home device, or at least one of a smart city device including a Wi-Fi module.

[0134] The embodiment of the present application does not impose any special limitation on the specific type of the electronic device 100 .

[0135] For example, Figure 3 As shown, an embodiment of the present application provides a structural schematic diagram of an electronic device 100.

[0136] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera module 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the wireless communication module 160 includes a Wi-Fi module 161, which is used to scan Wi-Fi signals to obtain information about Wi-Fi access points and access Wi-Fi networks. The sensor module 180 may include a pressure sensor, a gyro sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

[0137] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.

[0138] The different processing units may be independent devices or integrated into one or more processors. The processor may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0139] Specifically in the embodiment of the present application, the collection of the Wi-Fi scan list can be implemented by the processor 110 of the electronic device 100. That is, the processor 110 can control the Wi-Fi module 161 to scan the Wi-Fi signal at different times to obtain the information of the corresponding Wi-Fi access point (including at least BSSID and RSSI), thereby obtaining the Wi-Fi scan list.

[0140] The processor 110 of the electronic device 100 can also execute a geo-fence matching method to achieve geo-fence matching. That is, the processor 110 controls the Wi-Fi module 161 to scan the Wi-Fi signal at the current location to obtain information including one or more Wi-Fi access points (including at least BSSID and RSSI). Then, the processor 110 calculates the second matching score between the Wi-Fi data and the geo-fence based on the feature weights corresponding to each BSSID in the geo-fence downloaded from the cloud device. Finally, the processor 110 determines that the Wi-Fi data matches the geo-fence with a second matching score greater than or equal to the matching threshold.

[0141] A memory may also be provided in the processor 110 for storing instructions and data. For example, the memory may be used to store geo-fences downloaded from the cloud device 200, including multiple BSSIDs and feature weights corresponding to each BSSID, and a matching threshold for the geo-fence. In some embodiments, the memory in the processor 110 may be a cache memory. The memory may store instructions or data that have been used or are frequently used by the processor 110. If the processor 110 needs to use the instruction or data, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.

[0142] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 may be connected to a touch sensor, an audio module, a wireless communication module, a display screen, a camera assembly, and the like through at least one of the above interfaces.

[0143] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0144] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card. Or files such as music and videos are transferred from the electronic device 100 to the external memory card.

[0145] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional methods or data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0146] The charging management module 140 is used to receive the charging input of the charger and charge the battery 142. While the charging management module 140 is charging the battery 142, it can also supply power to the electronic device 100 through the power management module 141.

[0147] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera module 193, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0148] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0149] Among them, antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization rate of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0150] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0151] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), Bluetooth low energy (BLE), ultra wide band (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc.

[0152] The wireless communication module 160 may be one or more devices that integrate at least one communication processing module (in the embodiment of the present application, at least one Wi-Fi module). The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify the signal, and convert it into electromagnetic waves for radiation via the antenna 2.

[0153] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other electronic devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0154] The electronic device 100 can realize the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information. The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel.

[0155] The electronic device 100 can realize the camera function through the camera module 193, ISP, video codec, GPU, display screen 194, application processor AP, neural network processor NPU, etc. In some embodiments, the camera module 193 can be composed of a color camera module and a 3D sensing module. At the same time, the electronic device can include one or more camera modules 193. Specifically, the electronic device can include one front camera module 193 and one rear camera module 193.

[0156] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0157] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0158] like Figure 4 As shown, a schematic diagram of an interactive process of a method for generating a geographic fence is provided, and the method for generating a geographic fence is applied to a cloud device. Figure 4 The geo-fence generation method provided in the embodiment of the present application is described in detail, including steps S401-S405.

[0159] S401, obtaining multiple Wi-Fi scan lists.

[0160] Among them, the Wi-Fi scan list is obtained by scanning and collecting by an electronic device, and an electronic device can scan one or more Wi-Fi signals at the same time. Therefore, a Wi-Fi scan list includes information about one or more Wi-Fi access points obtained by an electronic device in one scan. In an embodiment of the present application, the information of the Wi-Fi access point must at least include BSSID and RSSI. After the electronic device scans and collects the Wi-Fi scan list, it uploads the Wi-Fi scan list to the cloud device.

[0161] For example, the electronic device uses the Wi-Fi module to scan nearby Wi-Fi signals, obtains the BSSID and RSSI of the Wi-Fi access point corresponding to each Wi-Fi signal, and obtains a Wi-Fi scan list. Afterwards, the electronic device uploads the scanned and collected Wi-Fi scan list to the cloud device at an appropriate time (for example, the appropriate time may be when the electronic device accesses the Wi-Fi network). After the cloud device receives the Wi-Fi scan list uploaded by an electronic device, it can store the Wi-Fi scan list in a local database. When the cloud device needs to generate a geo-fence or update the generated geo-fence, the cloud device can load and obtain the stored multiple Wi-Fi scan lists from the local database.

[0162] For example, the Wi-Fi scan list stored in the cloud device can constitute a Wi-Fi list set. Figure 5 As shown, a schematic diagram of a Wi-Fi list set is provided.

[0163] Figure 5 The Wi-Fi list set X shown includes three samples, namely samples ①, ② and ③. Each sample is a Wi-Fi scan list, and each list item in the Wi-Fi scan list is the information of a Wi-Fi access point scanned, including BSSID and RSSI.

[0164] S402: Perform similarity clustering on multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters.

[0165] In the embodiment of the present application, similarity clustering is performed on the Wi-Fi scan lists to separate the corresponding Wi-Fi access points of different indoor locations, so as to facilitate the accurate generation of the geo-fence corresponding to the indoor location based on the Wi-Fi scan lists corresponding to the different indoor locations. After the cloud device clusters multiple Wi-Fi scan lists by similarity, each obtained Wi-Fi list cluster may include one or more Wi-Fi scan lists. The Wi-Fi scan lists in the same Wi-Fi list cluster are similar Wi-Fi scan lists determined by the clustering algorithm.

[0166] It can be understood that the information of the Wi-Fi access points included in the Wi-Fi scan list in a Wi-Fi list cluster represents the information of the Wi-Fi access points corresponding to an indoor location, and a geo-fence corresponding to the indoor location can be generated based on the Wi-Fi list cluster. In other words, the area covered by the geo-fence generated later in the embodiment of the present application is the area covered by the signals of each Wi-Fi access point included in the Wi-Fi scan list in the corresponding Wi-Fi list cluster.

[0167] Among them, the Wi-Fi scan list obtained by the cloud device can be the information of the Wi-Fi access point scanned by any electronic device at any location. Generally speaking, the signal coverage area that can be formed by a Wi-Fi access point is limited. Therefore, when the distance between two locations is far enough, the similarity of the information of the Wi-Fi access point between the two Wi-Fi scan lists collected by any electronic device at these two locations will be relatively low. When the distance between the two locations is close enough or they are two Wi-Fi scan lists scanned by different electronic devices at the same location, the similarity of the information of the Wi-Fi access point between the two Wi-Fi scan lists will be relatively high.

[0168] For example, when the distance between store A and store B is far enough, the similarity of the Wi-Fi access point information included in Wi-Fi scan list A and Wi-Fi scan list B collected by electronic device A from store A and electronic device B from store B will be relatively low. However, since Wi-Fi scan list A collected by electronic device A in store A and Wi-Fi scan list B collected by electronic device B in store A are the information of Wi-Fi access points collected in the same store, the similarity of the Wi-Fi access point information between the two Wi-Fi scan lists will be relatively high.

[0169] Based on this, in some embodiments, the clustering of Wi-Fi scan lists can be implemented by the similarity of the information of Wi-Fi access points between two Wi-Fi scan lists, so as to ensure the accuracy of the clustering of Wi-Fi scan lists. That is, in order to improve the accuracy of the clustering of Wi-Fi scan lists, the embodiments of the present application can implement the clustering of Wi-Fi scan lists mainly based on the similarity between the information of Wi-Fi access points in the Wi-Fi scan lists.

[0170] In the embodiment of the present application, since the information of the Wi-Fi access point mainly includes BSSID and RSSI. And the clustering in the embodiment of the present application is mainly to distinguish the Wi-Fi scan lists corresponding to different indoor locations. Therefore, the similarity between the information of the Wi-Fi access points in two Wi-Fi scan lists can be measured by BSSID and RSSI.

[0171] In some embodiments, since Wi-Fi devices are usually installed indoors, electronic devices outdoors or in other indoor locations (not the indoor location where the Wi-Fi device is installed) may also be able to scan the Wi-Fi signal of the Wi-Fi device due to reasons such as wide Wi-Fi signal coverage or signal penetration. This means that the same BSSID will exist in two Wi-Fi scan lists scanned at different indoor locations. However, generally speaking, the closer the distance to the Wi-Fi device is, the higher the RSSI corresponding to the Wi-Fi device scanned by the electronic device.

[0172] Therefore, in order to accurately distinguish the Wi-Fi scan lists of different indoor locations, clustering can be performed based on the similarity of RSSI corresponding to the same BSSID, so as to achieve the effect of dividing more accurate geographic fences for different indoor locations.

[0173] Based on this, S402 may include: for every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, calculating the similarity of RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists; calculating the sum of the similarities of RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists to obtain the similarity of the two Wi-Fi scan lists; based on the similarity of every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, performing similarity clustering on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters.

[0174] Specifically, for any two Wi-Fi scan lists, the fewer the same BSSIDs, the lower the possibility that the two Wi-Fi scan lists are scanned and collected at the same indoor location or at two indoor locations with a small distance. Conversely, the more the same BSSIDs between two Wi-Fi scan lists, the higher the possibility that the two Wi-Fi scan lists are scanned and collected at the same indoor location or at two indoor locations with a small distance.

[0175] Therefore, in order to improve the accuracy of generating geo-fences based on different indoor locations, the similarity of two Wi-Fi scan lists in the embodiment of the present application can be determined by the similarity of RSSI corresponding to the same BSSID in the two Wi-Fi scan lists. Furthermore, the more the same BSSIDs are in the two Wi-Fi scan lists and the higher the similarity of RSSI corresponding to the same BSSID is, the higher the similarity of the two Wi-Fi scan lists will be.

[0176] After calculating the similarity of RSSI corresponding to the same BSSID in the two Wi-Fi scan lists, the cloud device sums the similarities of all RSSI corresponding to the same BSSID in the two Wi-Fi scan lists. The sum of the similarities is the similarity of the two Wi-Fi scan lists.

[0177] For example, Figure 5 Taking the Wi-Fi list set shown as an example, for the two Wi-Fi scan lists ① and ②, the same BSSIDs include: "04:d3:b5:b7:37:d4", "1c:28:af:9c:82:a2" and "1c:28:af:9c:82:a4". For the two Wi-Fi scan lists ① and ③, the same BSSIDs include: "04:d3:b5:b7:37:d5", "1c:28:af:9c:82:a2", "1c:28:af:9c:82:a4" and "1c:28:af:9c:82:b1". Similarly, for the two Wi-Fi scan lists ② and ③, the same BSSID can be determined in the same way as above, which will not be repeated here. Below, the similarity calculation process of the Wi-Fi scan list is explained by taking the two Wi-Fi scan lists ① and ② as examples.

[0178] That is, to calculate the similarity of the two Wi-Fi scan lists ① and ②, the cloud device needs to first calculate the similarity of the two RSSIs corresponding to "04:d3:b5:b7:37:d4" (hereinafter referred to as the first similarity), the similarity of the two RSSIs corresponding to "1c:28:af:9c:82:a2" (hereinafter referred to as the second similarity), and the similarity of the two RSSIs corresponding to "1c:28:af:9c:82:a4" (hereinafter referred to as the third similarity). Then, the cloud device will calculate the sum of the first similarity, the second similarity and the third similarity, and the sum of the similarities obtained by the sum is the similarity of the two Wi-Fi scan lists ① and ②.

[0179] In some embodiments, the similarity of RSSI corresponding to the same BSSID in every two Wi-Fi scan lists in multiple Wi-Fi scan lists may include: calculating the first signal strength difference and the first signal strength weight of the RSSI corresponding to the same BSSID in every two Wi-Fi scan lists in the multiple Wi-Fi scan lists; multiplying the difference between the first signal strength difference and the second signal strength difference by the first signal strength weight as the similarity of the RSSI corresponding to the same BSSID. The first signal strength difference is negatively correlated with the first difference, the first difference is the difference of the RSSI corresponding to the same BSSID, and the first signal strength weight is positively correlated with any RSSI corresponding to the same BSSID; the second signal strength difference is negatively correlated with the second difference, and the second difference is the difference between any RSSI corresponding to the same BSSID and the preset RSSI.

[0180] Specifically, the cloud device first calculates the first signal strength difference according to the first difference of RSSI corresponding to the same BSSID. At the same time, the cloud device calculates the first signal strength weight according to any RSSI corresponding to the same BSSID.

[0181] In some embodiments, the first signal strength difference may be calculated using the following formula.

[0182]

[0183] Among them, q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID, x i,b Indicates the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list; x j,b represents the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k q and d q is the preset parameter, k q =0.052160;d q =0.2; Ⅱ(x i,b <x j,b ) represents the indicator function. When the input condition x i,b <x j,b When it is true, the function value is 1, otherwise the function value is 0. According to the calculation formula of the first signal strength difference, the first difference between the RSSIs corresponding to the same BSSID |x i,b -x j,b | is larger, the first signal strength difference q(x i,b ,x j,b Therefore, the first signal strength difference is negatively correlated with the first difference value.

[0184] In some embodiments, the first signal strength weight may be calculated using the following formula:

[0185]

[0186] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, x=x i,b or x j,b , and then p(x)=p(x i,b ) or p(x j,b ), p(x i,b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list, p(x j,b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k p and b p is the preset parameter, k p =0.130401; b p =-65.

[0187] According to the calculation formula of the first signal strength weight, the larger the RSSI (i.e. x i,b or x j,b The larger the first signal strength weight (i.e., p(x i,b ) or p(x j,b Therefore, the first signal strength weight is positively correlated with RSSI.

[0188] In the present embodiment, k q ,d q , k p and b p The fixed values ​​of these four preset parameters are based on actual needs. After substituting multiple sets of preset values ​​for experimental calculations, they are determined according to the effects of different calculation results corresponding to different values.

[0189] After calculating the first signal strength difference and the first signal strength weight of the RSSI corresponding to the same BSSID in the two Wi-Fi scan lists, the cloud device calculates the similarity of the RSSI corresponding to the same BSSID in the two Wi-Fi scan lists based on the first signal strength difference and the first signal strength weight.

[0190] Specifically, the cloud device first calculates the difference between any RSSI corresponding to the same BSSDI and the preset RSSI to obtain a second difference. The second signal strength difference is calculated based on the second difference, and the product of the difference between the first signal strength difference and the second signal strength difference and the first signal strength weight is used as the similarity of the RSSI corresponding to the same BSSID. Among them, the preset RSSI is a preset RSSI for comparing the signal strength degree with the RSSI, which can be set according to actual needs and experience. In the embodiment of the present application, the preset RSSI = -105.

[0191] In some embodiments, the similarity of RSSI corresponding to the same BSSID can be calculated using the following formula:

[0192] p(x)(q(x i,b , x j,b )-q(x,c x ))

[0193] Where p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, including p(x i,b ) or p(x j,b );q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID; q(x,c x ) represents the second signal strength difference of any RSSI corresponding to the same BSSID, including q(x i,b ,c x ) or q(x j,b ,c x ), c x Indicates the preset RSSI.

[0194] After calculating the similarities of the RSSIs corresponding to all the same BSSIDs in the two Wi-Fi scan lists according to the above formula, the cloud device sums up the similarities of the RSSIs corresponding to all the same BSSIDs to obtain the similarities of the two Wi-Fi scan lists.

[0195] In some embodiments, the similarity between two Wi-Fi scan lists may be calculated using the following formula:

[0196]

[0197] Among them, w(x i ,x j ) represents the similarity between the i-th Wi-Fi scan list and the j-th Wi-Fi scan list; B i ∩B j Indicates the i-th Wi-Fi scan list B iand the jth Wi-Fi scan list B j The set of the same BSSID in B, b∈B i ∩B j .

[0198] Then, the cloud device performs similarity clustering on the multiple Wi-Fi scan lists based on the similarity between every two Wi-Fi scan lists in the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters. For example, the two Wi-Fi scan lists ① and ② are divided into one cluster through similarity clustering, and the corresponding Wi-Fi list cluster includes the two Wi-Fi scan lists ① and ②.

[0199] It should be noted that any of the RSSIs mentioned above refers to selecting an RSSI from the RSSIs corresponding to the same BSSID to calculate the signal strength weight or signal strength difference. Because, when the existing clustering algorithm clusters the data, it usually selects the corresponding cluster center first, and the number of selected cluster centers is equal to the number of clusters obtained after clustering. After determining the cluster center, all data that need to be clustered will determine the clusters they are divided into based on the similarity with the cluster center. In other words, when the data is clustered by similarity, the similarity between other data and each cluster center is usually calculated based on the cluster center. Then, the cluster corresponding to this data is determined based on the similarity between this data and the cluster center. Therefore, in an embodiment of the present application, any RSSI corresponding to the BSSID mentioned mainly depends on the cluster center selected in the actual clustering process of the clustering algorithm. The selected RSSI refers to the RSSI corresponding to the same BSSID in the Wi-Fi scan list as the cluster center.

[0200] For example, assume that the i-th Wi-Fi scan list is Figure 5 The Wi-Fi scan list ① shown in the figure, the jth Wi-Fi scan list is Figure 5 When performing similarity clustering, if the clustering algorithm selects Wi-Fi scan list ① as the cluster center, the first signal strength weight p(x) needs to be calculated as the signal strength weight of the RSSI corresponding to the same BSSID in Wi-Fi scan list ①, that is, p(x i,b ). At the same time, the second signal strength difference q(x,c x ) What actually needs to be calculated is q(x i,b ,c x ).

[0201] On the contrary, when the clustering algorithm selects Wi-Fi scan list ② as the cluster center, the first signal strength weight p(x) needs to calculate the signal strength weight of the RSSI corresponding to the same BSSID in Wi-Fi scan list ②, that is, p(xj,b ). At the same time, the second signal strength difference q(x,c x ) What actually needs to be calculated is q(x j,b ,c x ).

[0202] In some embodiments, the main purpose of similarity clustering of the Wi-Fi scan list is to accurately divide different indoor locations to obtain corresponding geographic fences. Therefore, if the actual installation of the Wi-Fi device is unknown, the specific number of geographic fences cannot be preset in advance. Then the number of clusters cannot be configured in advance. Therefore, the clustering algorithm selected for clustering in the embodiment of the present application can be a density-based clustering method. Because the density-based clustering method does not require the number of clusters to be determined in advance. That is, the cloud device can perform density clustering based on the similarity between the Wi-Fi scan lists to obtain the Wi-Fi list cluster.

[0203] In addition, although the embodiment of the present application can preset the number of clusters based solely on the number requirements for geo-fences without considering the actual distribution of the number of Wi-Fi devices, thereby selecting a clustering algorithm that requires the number of clusters to be determined in advance for similarity clustering. However, the density-based clustering method mainly performs clustering based on the compactness of sample distribution, and it mainly divides points in the feature space that are sufficiently dense into the same cluster. Samples classified into the same category through density clustering are closely connected, and the shape of the cluster can be arbitrary. Therefore, considering that the denser the distribution of Wi-Fi devices, the more likely they are to be multiple Wi-Fi devices corresponding to the same indoor location, the selection of a density-based clustering method will also be more suitable for the generation of Wi-Fi-based geo-fences in the embodiment of the present application, thereby improving the accuracy of the geo-fence while improving the clustering effect.

[0204] Among them, the density-based clustering method selected in the embodiment of the present application may include: a density-based spatial clustering of applications with noise (DBSCAN), a clustering algorithm that determines the clustering structure by point sorting (OPTICS), and a clustering algorithm based on a set of density distribution functions (density based clustering, DENCLUE), any one or more of which are used in combination.

[0205] In summary, in the embodiment of the present application, clustering of Wi-Fi scan lists based on the signal strength RSSI of the same Wi-Fi access point in different Wi-Fi scan lists can accurately divide Wi-Fi list clusters corresponding to different indoor locations, and then determine the geo-fence based on the Wi-Fi list cluster to improve the accuracy of geo-fence generation. At the same time, subsequent electronic devices can perform geo-fence matching based on the geo-fence generated by the Wi-Fi list cluster, and can also accurately push different services provided for different indoor locations.

[0206] S403 , obtaining a feature weight corresponding to each BSSID in the Wi-Fi list cluster based on the appearance frequency of each BSSID in the Wi-Fi list cluster and the RSSI corresponding to each BSSID.

[0207] After the cloud device obtains the Wi-Fi list cluster, it has actually obtained the Wi-Fi information corresponding to different indoor locations. Therefore, the cloud device can directly generate the corresponding geographic fence based on the Wi-Fi list cluster. However, since the Wi-Fi list cluster may contain multiple Wi-Fi scan lists, and in the embodiment of the present application, these multiple Wi-Fi scan lists are clustered together based on the similarity of the RSSI corresponding to the same BSSID. Therefore, the same BSSID may exist in different Wi-Fi scan lists in the Wi-Fi list cluster. Then, in this Wi-Fi list cluster, the BSSID may correspond to multiple different RSSIs.

[0208] For example, assuming Figure 5 After Wi-Fi scan list ① and Wi-Fi scan list ② are clustered together, the RSSI corresponding to BSSID: 04:d3:b5:b7:37:d4 in the Wi-Fi list cluster will include: -79 and -80.

[0209] In this case, it is inaccurate to use any of the RSSIs to measure the signal status of the Wi-Fi access point corresponding to the BSSID. When the electronic device performs geo-fence matching, it needs to measure the similarity based on the RSSI corresponding to the BSSID in the geo-fence to determine whether it matches.

[0210] Based on this, in order to accurately obtain the RSSI that can measure the signal status of the BSSID in the Wi-Fi list cluster, after obtaining the Wi-Fi list cluster, the cloud device further extracts the feature weight of each BSSID in the Wi-Fi list cluster based on the frequency of occurrence of the BSSID in the Wi-Fi list cluster and the RSSI corresponding to the BSSID.

[0211] In some embodiments, the feature weights of the BSSIDs in the Wi-Fi list cluster include the median Wi-Fi signal strength, the Wi-Fi signal strength frequency weight, and the Wi-Fi signal strength baseline feature. The Wi-Fi signal strength frequency weight and the Wi-Fi signal strength baseline feature are both features calculated using the median Wi-Fi signal strength as the baseline signal strength.

[0212] Therefore, the cloud device first needs to determine the median Wi-Fi signal strength of each BSSID in the Wi-Fi list cluster. Specifically, the cloud device first calculates the median value of all RSSIs corresponding to the same BSSID in the Wi-Fi list cluster, and uses this median value as the median Wi-Fi signal strength corresponding to this BSSID. In other words, the cloud device is equivalent to first determining all RSSIs corresponding to the same BSSID in this Wi-Fi list cluster, and then calculating the median value of all RSSIs corresponding to the same BSSID, and using the calculated median value as the median Wi-Fi signal strength corresponding to this BSSID.

[0213] In addition, in the embodiment of the present application, if the calculated median value of the Wi-Fi signal strength of the BSSID is not an integer, the median value of the Wi-Fi signal strength may be further rounded, wherein the rounding operation may be to omit the digits after the decimal point.

[0214] For example, assuming Figure 5 The three Wi-Fi scan lists shown are a cluster of Wi-Fi lists obtained by clustering, in which the RSSI corresponding to BSSID:04:d3:b5:b7:37:d4 includes -79 and -80. The cloud device calculates the median value of -79 and -80. The median value is -79.5, and the median value after rounding is -79. Therefore, the median value of the Wi-Fi signal strength corresponding to BSSID:04:d3:b5:b7:37:d4 in this Wi-Fi list cluster is -79, which can be expressed as i0=-79.

[0215] Then, the cloud device calculates the Wi-Fi signal strength frequency weight and Wi-Fi signal strength benchmark feature of the BSSID based on the obtained Wi-Fi signal strength feature of the BSSID.

[0216] Among them, the Wi-Fi signal strength frequency weight of the BSSID is the product of the occurrence frequency of this BSSID and the second signal strength weight. The occurrence frequency refers to the ratio of the number of times this BSSID appears in the Wi-Fi list cluster to the number of Wi-Fi scan lists in the Wi-Fi list cluster. The second signal strength weight is the signal strength weight of the median value of the Wi-Fi signal strength corresponding to this BSSID, and the second signal strength weight is positively correlated with the median value of the Wi-Fi signal strength.

[0217] The calculation of the second signal strength weight can be implemented by using the p function mentioned above, that is, calculating p(i0). The specific calculation process and principle can refer to the calculation process and principle of p(x) mentioned above, which will not be repeated here.

[0218] For example, Figure 5 The three Wi-Fi scan lists shown are taken as an example of a Wi-Fi list cluster, where the median Wi-Fi signal strength corresponding to BSSID:04:d3:b5:b7:37:d4 is i0 = -79. Since this Wi-Fi list cluster includes three Wi-Fi scan lists, and two Wi-Fi scan lists in this Wi-Fi list cluster include BSSID:04:d3:b5:b7:37:d4, the number of times BSSID:04:d3:b5:b7:37:d4 appears is 2, so the frequency of occurrence = 2 / 3. Then, the Wi-Fi signal strength frequency weight f0 corresponding to BSSID:04:d3:b5:b7:37:d4 is f0 = p(-79) × 2 / 3, and the result after substituting the parameters into the calculation is f0 = 0.092508.

[0219] The Wi-Fi signal strength benchmark feature of the BSSID is the signal strength difference between the median Wi-Fi signal strength corresponding to the BSSID and the preset RSSI. This signal strength difference is referred to as the third signal strength difference in this embodiment of the application. The third signal strength difference is negatively correlated with the third difference value. The third difference is the difference between the median Wi-Fi signal strength corresponding to the BSSID and the RSSI. x The calculation of the third signal strength difference can be implemented by using the q function mentioned above, that is, the third signal strength difference = q(i0,c x ).

[0220] For example, Figure 5 The Wi-Fi signal strength benchmark feature f1=q(-79,-105) of BSSID:04:d3:b5:b7:37:d4 is substituted into the calculated result f1=0.257646.

[0221] S404: Calculate a first matching score between each Wi-Fi scan list in a plurality of Wi-Fi scan lists and the Wi-Fi list cluster according to a feature weight corresponding to each BSSID in the Wi-Fi list cluster, and determine a matching threshold of the Wi-Fi list cluster based on the plurality of first matching scores.

[0222] In the embodiment of the present application, after the geo-fence is generated based on the Wi-Fi list cluster, in order to provide a threshold value for the geo-fence to determine whether it matches, the cloud device obtains the feature weights corresponding to each BSSID in the Wi-Fi list cluster, and then further calculates the matching score between the Wi-Fi list cluster and each Wi-Fi scan list according to the feature weights corresponding to each BSSID in the Wi-Fi list cluster, thereby obtaining a first matching score.

[0223] Then, the cloud device determines a matching threshold corresponding to the Wi-Fi list cluster based on the multiple first matching scores, and the matching threshold can be used as a matching threshold of the geo-fence corresponding to the Wi-Fi list cluster.

[0224] Among them, the Wi-Fi scan lists for which the first matching score is calculated with the Wi-Fi list cluster are those Wi-Fi scan lists uploaded by the electronic device to the cloud device. It should be understood that each Wi-Fi scan list mentioned here is not limited to all Wi-Fi scan lists saved by the cloud device. In order to improve the accuracy of the matching threshold, the cloud device can calculate the first matching score with each saved Wi-Fi scan list respectively. However, if you want to save a certain amount of computing and reduce the consumption of cloud devices, you can also select a part of the Wi-Fi scan lists from the saved Wi-Fi scan lists to calculate the first matching score with this Wi-Fi list cluster. The specific setting can be based on actual needs, and the embodiments of the present application do not impose any restrictions on this.

[0225] In some embodiments, the first matching score may be calculated using the following formula:

[0226]

[0227] Where score(y,x) represents the first matching score between Wi-Fi list cluster y and Wi-Fi scan list x; B represents the set of identical BSSIDs in Wi-Fi list cluster y and Wi-Fi scan list x, b∈B; y b,f0 represents the Wi-Fi signal strength frequency weight f0 corresponding to BSSID b in Wi-Fi list cluster y; q(y b,i0 ,x b ) represents y b,i0 and x b The signal strength difference, y b,i0represents the median value i0,x of the Wi-Fi signal strength corresponding to BSSID b in Wi-Fi list cluster y b Indicates the RSSI of BSSID b in Wi-Fi scan list x; y b,f1 It represents the Wi-Fi signal strength benchmark feature f1 corresponding to BSSID b in Wi-Fi list cluster y.

[0228] In some embodiments, determining the matching threshold of the Wi-Fi list cluster based on multiple first matching scores may include: calculating a median value of the multiple first matching scores, and taking the product of the median value of the multiple first matching scores and a preset score weight as a matching threshold reference value; and taking a first matching score that is greater than or equal to the matching threshold reference value and has the smallest score among the multiple first matching scores as the matching threshold of the Wi-Fi list cluster.

[0229] That is, after the cloud device calculates the first matching score between the Wi-Fi list cluster and each Wi-Fi scan list through the calculation formula of the above-mentioned first matching score, it first takes the median value among these multiple first matching scores to obtain a matching score that can centrally reflect the matching situation between the Wi-Fi list cluster and different Wi-Fi scan lists. Then, the cloud device calculates the product of the median value of the first matching score and the preset score weight, and uses this product as the matching threshold reference value. Among them, the preset score weight k is a preset parameter, which can be set according to the actual matching requirements. In the embodiment of the present application, k=0.6.

[0230] The cloud device determines a first matching score from all first matching scores as the matching threshold based on the matching threshold reference value. In the embodiment of the present application, the first matching score determined as the matching threshold needs to be greater than or equal to the matching threshold and the first matching score with the smallest score.

[0231] For example, suppose a Wi-Fi list cluster is Figure 5 The first matching scores of the three Wi-Fi scan lists are 1.248771, 1.404265 and 1.808534 respectively, so the first matching score corresponding to 0.6 times the median is 0.842558. According to the condition that the first matching score is greater than or equal to the matching threshold 0.842558 and the score is the smallest, it can be determined that the first matching score 1.248771 is the matching threshold of this Wi-Fi list cluster.

[0232] S405: Generate a geographic fence corresponding to the Wi-Fi list cluster.

[0233] The geographic fence includes: multiple BSSIDs in the Wi-Fi list cluster and the feature weight corresponding to each BSSID, and the matching threshold of the Wi-Fi list cluster.

[0234] Specifically, after the cloud device completes the clustering of the Wi-Fi scan list and obtains the feature weights of each BSSID in the Wi-Fi list cluster, the cloud device can generate geo-fences corresponding to different indoor locations based on the Wi-Fi list cluster. Correspondingly, the geo-fence generated corresponding to this Wi-Fi list cluster includes: multiple BSSIDs in the Wi-Fi list cluster and the feature weights corresponding to each BSSID. At the same time, the cloud device uses the matching threshold of this Wi-Fi list cluster as the matching threshold of this geo-fence, which will be used as a matching reference for subsequent electronic devices to match the geo-fence. Therefore, the geo-fence also includes the matching threshold of the corresponding Wi-Fi list cluster.

[0235] For example, assuming that the cloud device obtains three Wi-Fi list clusters through clustering, three geo-fences can be generated accordingly, and the three Wi-Fi list clusters correspond to the three geo-fences one-to-one, and different geo-fences correspond to different indoor locations.

[0236] For example, assuming Figure 5 In the figure, Wi-Fi scan list ① and Wi-Fi scan list ② are divided into a Wi-Fi list cluster. After extracting the feature weight corresponding to each BSSID in the Wi-Fi list cluster and calculating and determining the matching threshold of the Wi-Fi list cluster, the geo-fence corresponding to the Wi-Fi list cluster can be shown in Table 1 below.

[0237] The specific values ​​of the feature weights and matching thresholds corresponding to each BSSID in Table 1 below are for illustration only and are not necessarily completely correct calculation results.

[0238] Table 1

[0239]

[0240] In some embodiments, when there are a large number of Wi-Fi scan lists clustered together, the amount of BSSID data in the Wi-Fi list cluster will be relatively large, resulting in a larger amount of data in the generated geo-fence. However, since the signal strength of Wi-Fi can reflect its distance from the Wi-Fi device, it can also reflect its distance from indoor locations. Therefore, for the generation of geo-fences for indoor locations, only high-frequency, high-signal-strength BSSIDs are usually of practical use. Therefore, in order to reduce the amount of BSSID data included in the geo-fence, and at the same time ensure that the BSSIDs retained in the geo-fence are valid and practical BSSIDs. A portion of the BSSIDs can be further screened out from the geo-fence based on the feature weights of the BSSIDs.

[0241] Based on this, before S404, the method may further include: filtering out the BSSIDs in the Wi-Fi list cluster according to the feature weight corresponding to each BSSID in the Wi-Fi list cluster to obtain a Wi-Fi list cluster whose number of BSSIDs meets a preset number requirement.

[0242] The preset quantity requirement is a limit on the amount of BSSID data within the geo-fence. For example, the amount of BSSID data corresponding to a geo-fence can be limited to 30. Therefore, based on the preset quantity requirement, the cloud device can filter out some BSSIDs according to any one or more feature weights of the Wi-Fi signal strength median value i0, the Wi-Fi signal strength frequency weight f0, or the Wi-Fi signal strength baseline feature f1, so as to reduce the amount of data while retaining the BSSIDs that are truly useful.

[0243] For example, taking the geo-fence and Wi-Fi signal strength frequency weight f0 shown in Table 1 as an example, the cloud device can filter BSSIDs from small to large according to f0 until the number of retained BSSIDs meets the preset number requirement. Assuming that five BSSID data are filtered out, the data included in the geo-fence retained after filtering out these five BSSIDs in Table 1 can be referred to as shown in the following Table 2.

[0244] Table 2

[0245]

[0246] In addition, multiple feature weights can also be combined to filter out BSSIDs. For example, when the sizes of f0 corresponding to two or more BSSIDs are equal, the BSSIDs to be filtered out can be determined from the two or more BSSIDs according to the size of the i0 value or the f1 value corresponding to the BSSID. Taking Tables 1 and 2 above as examples, it can be seen that through data filtering, the amount of geo-fence data can be reduced from the original twelve to seven, thereby retaining valid data while achieving the effect of reducing the amount of geo-fence data.

[0247] After the cloud device completes the generation of the geo-fence according to the method described in the above embodiment, the electronic device can match the geo-fence based on the geo-fence generated by the cloud device.

[0248] like Figure 6 As shown, a schematic diagram of an interactive process of a geo-fence matching method is provided, and the geo-fence matching method is applied to an electronic device. Figure 6 The geo-fence matching method provided in the embodiment of the present application is described in detail, including steps S601-S605.

[0249] S601, obtaining positioning information, and determining the administrative district corresponding to the current location according to the positioning information.

[0250] S602, download one or more geographic fences corresponding to the administrative area from the cloud device and save them locally.

[0251] Among them, the positioning information is the location information used to trigger the download of the geo-fence obtained according to a preset period, and may include any one or more of longitude and latitude and cellular cell identification. The longitude and latitude can be obtained through the GPS module in the electronic device. The cellular cell identification can be the cell identity (CID), location area code (LAC), tracking area code (TAC), etc. of the cellular cell to which the electronic device is connected. It can be set according to the actual application scenario requirements, and the embodiments of the present application are not limited here.

[0252] The administrative regions can be first-level provincial administrative regions (including provinces, autonomous regions, municipalities directly under the Central Government, and special administrative regions), second-level prefecture-level administrative regions (including prefecture-level cities, regions, autonomous prefectures, and leagues), third-level county-level administrative regions (including urban districts, county-level cities, counties, autonomous counties, banners, autonomous banners, special zones, and forest areas), or fourth-level township-level administrative regions (including streets, towns, townships, ethnic townships, sumus, ethnic sumus, and county districts).

[0253] Specifically, the electronic device obtains the positioning information according to a preset period, which may be the latitude and longitude or the cellular cell identifier. The size of the preset period may be set according to actual needs.

[0254] Exemplarily, the size of the preset period can be set according to the level of the determined administrative region. Generally speaking, users holding electronic devices usually settle in the second-level prefecture-level administrative region for a long time. Therefore, when the administrative region for downloading the geo-fence is set to the first-level provincial administrative region or the second-level prefecture-level administrative region, because the possibility of users frequently moving between provincial or prefecture-level regions is small, the period for obtaining positioning information can be set longer. After the user holding the electronic device enters the third-level county-level administrative region or the fourth-level township-level administrative region, the possibility of users moving between county or township levels is relatively large. Therefore, when the administrative region for downloading the geo-fence is set to the third-level county-level administrative region or the fourth-level township-level administrative region, in order to ensure that the electronic device can obtain the geo-fence of the area in which it is located in a timely manner, the preset period can be set relatively shorter.

[0255] Then, after the electronic device determines the administrative area where the electronic device is currently located based on the positioning information, it can download one or more geographic fences included in this administrative area from the cloud device. The geographic fences downloaded by the electronic device include: multiple BSSIDs and feature weights corresponding to each BSSID, and the matching threshold of the geographic fence. Among them, the location information corresponding to the BSSID in the geographic fence can be the location information of the Wi-Fi scan list corresponding to this BSSID. The location information of the Wi-Fi scan list can be the location information when the electronic device scans and obtains this Wi-Fi scan list, and the location information can be collected and uploaded to the cloud device together with the Wi-Fi scan list.

[0256] Furthermore, when the electronic device downloads the geo-fence from the cloud device, it can determine the administrative district where the geo-fence is located based on the location information of the BSSID in the geo-fence, and thus download the geo-fence in the administrative district.

[0257] For example, when the electronic device determines that the electronic device has entered a province or prefecture-level city based on the positioning information, it can trigger communication with the cloud device to download the geo-fences included in the province or prefecture-level city. The downloaded geo-fences are used by the electronic device to perform geo-fence matching in this administrative area later.

[0258] Of course, without considering the storage space and load of the electronic device, you can also choose to download all the generated geo-fences from the cloud device according to actual needs. However, in the embodiment of the present application, after the administrative area is determined by positioning information, a part of the geo-fence is downloaded, which can ensure that the local storage has matching required geo-fences, reduce the power consumption load of the electronic device, and save the storage space of the electronic device.

[0259] In some embodiments, after the geo-fence is downloaded by the electronic device, if it is stored in the electronic device for a long time, the accumulated downloads will cause more and more geo-fence data to be stored in the electronic device, which will still occupy the storage space of the electronic device and increase power consumption.

[0260] Therefore, in order to prevent the accumulation of geo-fence downloads, the electronic device sets an expiration date for the downloaded geo-fence after downloading the corresponding geo-fence from the cloud device. Then, the electronic device monitors the expiration date of the geo-fences saved locally. If there is a geo-fence with an expiration date, the geo-fence with an expiration date is deleted locally.

[0261] In the embodiment of the present application, by setting the validity period to regularly clean up the expired geo-fences, it is possible to prevent the storage space of the electronic device from being occupied by the accumulated geo-fences. At the same time, since the electronic device will obtain the positioning information regularly according to the preset period to download the geo-fences, even if the electronic device has cleaned up the geo-fences that are still useful, it can trigger the re-download through the positioning information. In other words, the regular cleaning of the present application will not affect the matching of the geo-fences.

[0262] S603, scan the Wi-Fi signal at the current location to obtain a set of Wi-Fi data.

[0263] S604: Calculate a second matching score between the Wi-Fi data and the geo-fence according to the feature weights corresponding to the BSSIDs in the geo-fence.

[0264] S605: If the second matching score is greater than or equal to the matching threshold, it is determined that the Wi-Fi data matches the geo-fence.

[0265] Specifically, the electronic device can scan the Wi-Fi signal at the current location at a certain frequency to obtain a set of Wi-Fi data, wherein each set of Wi-Fi data includes the BSSID and RSSI of one or more Wi-Fi access points.

[0266] Furthermore, in the case where the electronic device locally stores the geo-fence, since the Wi-Fi data includes the BSSID and RSSI, and the geo-fence includes the BSSID and the characteristic weight used to characterize the signal condition of the BSSID, the electronic device can calculate the matching score between the set of Wi-Fi data and the geo-fence according to the characteristic weight corresponding to each BSSID in the geo-fence and the RSSI corresponding to the BSSID in the Wi-Fi data, and obtain a second matching score.

[0267] Then, the electronic device determines the geo-fence that matches the set of Wi-Fi data based on the second matching score. In the embodiment of the present application, the condition that needs to be met for the match is that the second matching score needs to be greater than or equal to the matching threshold corresponding to the geo-fence. That is, when the second matching score is greater than or equal to the matching threshold, it is determined that the corresponding Wi-Fi data matches the geo-fence.

[0268] In some embodiments, the calculation principle of the second matching score is the same as the calculation principle of the first matching score. The specific calculation method can refer to the calculation formula of the first matching score. The difference is that the parameters used in the calculation of the first matching score and the second matching score are different. In short, the calculation of the second matching score in the embodiment of the present application includes:

[0269] The electronic device first calculates the signal strength difference between the geo-fence and the same BSSID in the Wi-Fi data to obtain a fourth signal strength difference. The fourth signal strength difference is negatively correlated with the fourth difference value, and the fourth difference value is the difference between the median Wi-Fi signal strength corresponding to the same BSSID in the geo-fence and the RSSI corresponding to the same BSSID in the Wi-Fi data.

[0270] Then, the electronic device calculates the matching score of the same BSSID in the geofence and the Wi-Fi data based on the fourth signal strength difference, the Wi-Fi signal strength frequency weight corresponding to the same BSSID in the geofence, and the Wi-Fi signal strength baseline feature. The electronic device first calculates the difference between the fourth signal strength difference and the Wi-Fi signal strength baseline feature, and multiplies this difference with the Wi-Fi signal strength frequency weight corresponding to the same BSSID in the geofence as the matching score of the same BSSID in the geofence and the Wi-Fi data. Finally, the electronic device calculates the sum of the matching scores of all the same BSSIDs in the geofence and the Wi-Fi data to obtain a second matching score between the geofence and the Wi-Fi data.

[0271] Subsequently, if it is determined that the second matching score is greater than or equal to the matching threshold of the geo-fence, it means that the Wi-Fi data matches the geo-fence, indicating that the electronic device has currently entered the area covered by the geo-fence.

[0272] In some embodiments, after the Wi-Fi module of an existing electronic device is enabled, it will usually scan the surrounding Wi-Fi signals at a certain frequency, and the interval of the scanning frequency is relatively small. At the same time, most existing users have the habit of using electronic devices to activate the Wi-Fi module of the electronic device for a long time. Therefore, in this case, it is easy for the electronic device to use the Wi-Fi data collected by the scan to match the geo-fence every time it scans the Wi-Fi signal, so that the electronic device may always be in the geo-fence matching state, resulting in increased power consumption of the electronic device. Therefore, in order to avoid the electronic device being in the geo-fence matching state for a long time, the geo-fence matching can be triggered by setting certain events.

[0273] like Figure 7 As shown, another interactive flow diagram of a geo-fence matching method is provided. Figure 7 The geo-fence matching method provided in the embodiment of the present application is described in detail.

[0274] In the present embodiment, Figure 6S604 and S605 in the geographic matching method shown are encapsulated into a callback function as a Wi-Fi scan callback function. After the electronic device obtains the positioning information, in addition to downloading the geographic fence of the corresponding administrative area based on the positioning information. The electronic device also uses the positioning information as the center point to expand the area to the surrounding area to obtain a fence judgment area. Then, the electronic device determines whether there is a geographic fence in this fence judgment area. If there is a geographic fence, the electronic device registers the defined Wi-Fi scan callback function.

[0275] Specifically, the electronic device uses the positioning information as the center point (similar to the center of a circle) to expand the area to the surrounding area, and determines the area range after the area expansion. This area range is the fence judgment area obtained. Among them, the range size of the area expansion can be set based on actual needs. For example, if longitude and latitude are used as positioning information, the electronic device can expand 100 meters around the longitude and latitude after obtaining the longitude and latitude. Then, the circular area with longitude and latitude as the center and 100 meters as the radius is the fence judgment area obtained after the area expansion.

[0276] If the cellular cell identifier is used as the positioning information, for example, the cell number, the electronic device can use the area covered by the base station signal corresponding to the cell number as the fence judgment area obtained after the area expansion. Alternatively, the electronic device can also use the location of the base station corresponding to the cell number as the center point to expand 100 meters to obtain the fence judgment area.

[0277] After the electronic device determines the fence judgment area through area expansion, it can further determine whether the geo-fence is within the fence judgment area through the location information of the BSSID in the geo-fence, thereby determining whether there is a geo-fence in the fence judgment area. If the electronic device determines that there is a geo-fence in the fence judgment area, it registers a Wi-Fi scan callback function.

[0278] When the electronic device completes the registration of the Wi-Fi scan callback function, if the electronic device scans the Wi-Fi signal at the current location and obtains a set of Wi-Fi data, the electronic device executes the registered Wi-Fi scan callback function, including: calculating the second matching score between the Wi-Fi data and the geo-fence according to the feature weights corresponding to each BSSID in the geo-fence. If the second matching score is greater than or equal to the matching threshold, it is determined that the Wi-Fi data matches the geo-fence. Thus, the electronic device achieves the matching of the geo-fence by executing the Wi-Fi scan callback function.

[0279] That is to say, after the embodiment of the present application encapsulates the key steps of the geo-fence matching method into a Wi-Fi scan callback function, only when this Wi-Fi scan callback function is registered and takes effect, can the electronic device execute the calculation and processing steps of geo-fence matching to achieve geo-fence matching. Then, in the case that the electronic device has not registered the Wi-Fi scan callback function, even if the electronic device scans and collects a set of Wi-Fi data, it will not trigger the matching of Wi-Fi data with the geo-fence, thereby reducing the power consumption of the matching. Only when the electronic device determines that there is a geo-fence in the surrounding area and completes the registration of the Wi-Fi scan callback function, will it match the geo-fence based on the scanned Wi-Fi data, thereby avoiding the electronic device being in the geo-fence matching state all the time and reducing the power consumption of the electronic device.

[0280] In some embodiments, in order to avoid the electronic device being in a matching state for a long time and increasing power consumption, the embodiments of the present application set the condition that the Wi-Fi scan callback function needs to be registered. Then, after the Wi-Fi scan callback function is registered, if it is not deregistered according to the actual situation, the problem of increased power consumption caused by continuous matching cannot be avoided. Therefore, the electronic device also needs to trigger the deregistration of the Wi-Fi scan callback function based on the positioning information.

[0281] That is, if the electronic device determines that there is no geographic fence in the fence judgment area obtained by area expansion based on the positioning information, the electronic device further cancels the registered Wi-Fi scan callback function. After the Wi-Fi scan callback function is cancelled, even if the electronic device scans the Wi-Fi signal to collect a set of Wi-Fi data, it will not know the key processing steps of the geographic fence matching because the Wi-Fi scan callback function is not registered, and the electronic device cannot perform the matching operation between this set of Wi-Fi data and the geographic fence.

[0282] It can be simply understood that if the electronic device determines that there is a geo-fence in the expanded fence judgment area A based on the positioning information expansion, the electronic device will register the Wi-Fi scan callback function at this time. Afterwards, if the electronic device scans and collects Wi-Fi data, the Wi-Fi data can be matched with the geo-fence by executing the Wi-Fi scan callback function sequence. However, if the electronic device determines that the electronic device has left the fence judgment area A based on the latest acquired positioning information, and there is no geo-fence in the fence judgment area B determined based on the latest positioning information, the electronic device needs to cancel the Wi-Fi scan callback function. After that, even if the electronic device scans and collects Wi-Fi data, it will not trigger the electronic device to match the Wi-Fi data with the geo-fence. Thereby, the electronic device is prevented from always matching the geo-fence based on the scanned and collected Wi-Fi data, thereby reducing power consumption.

[0283] In some embodiments, after the electronic device determines the geo-fence that matches the current location, the electronic device can receive or send information push according to the matched geo-fence.

[0284] Specifically, after the electronic device determines the matching geographic fence, it can receive information push from the server device corresponding to the indoor location corresponding to the geographic fence. For example, taking shops and stores as an example, when a user enters a shop or store with an electronic device, the electronic device can scan the Wi-Fi signal of the shop or store and the surrounding area to obtain Wi-Fi data. Then, the electronic device calculates a second matching score for the Wi-Fi data scan list and the geographic fence in the administrative area corresponding to the shop or store. According to the second matching score, the geographic fence corresponding to the shop or store can be matched from the geographic fence. Finally, the electronic device can report the arrival of the electronic device to the server device corresponding to the shop or store based on the matched geographic fence corresponding to the shop or store (indicating that the user has arrived at the store).

[0285] After receiving the store arrival event sent by the electronic device, the service end of the store or shop can accurately push store-related services to the electronic device for the user of the electronic device. For example, store event information, store coupons, or store notices can be pushed to the electronic device, thereby achieving accurate push of different services provided at different indoor locations through geographic fence matching.

[0286] like Figure 8 As shown, a block diagram of the software and hardware structure of an electronic device is provided. Figure 8 The software and hardware structure block diagram shown illustrates the geo-fence matching method provided in the embodiment of the present application.

[0287] in, Figure 8 The hardware and software structure diagram shown includes a software layered architecture and a hardware layer. In the embodiment of the present application, the hardware layer at least includes hardware modules such as GPS, SIM card and Wi-Fi module.

[0288] The software layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: application layer (applications), application framework layer (application framework), hardware abstract layer (HAL) and kernel layer (kernel).

[0289] The application layer can include a series of applications. Figure 8As shown, in the embodiment of the present application, the application layer includes at least a perception application and a service application that needs to perform information push services. Among them, the service application can be an online shopping application launched by a merchant who opens a physical store offline. For example, an online shopping application launched by a coffee shop merchant or a fried chicken merchant. The service application can also be a recommendation application, a payment application, etc. It should be understood that according to actual needs, the application layer can also include basic applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc., and the implementation of this application does not impose any restrictions on this.

[0290] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 8 As shown, in the embodiment of the present application, the application framework layer includes a Wi-Fi manager and a positioning information acquisition module. The Wi-Fi manager is used to register the Wi-Fi scan callback function and execute the Wi-Fi scan callback function to obtain the matching result of the geo-fence. The positioning information acquisition module is used to obtain positioning information.

[0291] The hardware abstraction layer runs in user space, encapsulates kernel layer drivers, and provides a calling interface to the upper layer. Figure 8 As shown, the hardware abstraction layer of the embodiment of the present application includes at least Wi-Fi HAL, GPS HAL and cellular HAL.

[0292] Among them, the Wi-Fi manager can interact with the Wi-Fi HAL, and the Wi-Fi HAL is responsible for interacting with the Wi-Fi module that scans the Wi-Fi signal in the electronic device through the Wi-Fi driver, and transmits the Wi-Fi data scanned and collected by the Wi-Fi module, including BSSID and RSSI, to the Wi-Fi manager. The positioning information acquisition module interacts with the GPS and SIM card in the electronic device to obtain location information such as longitude and latitude and cellular cell identification used for positioning. In addition, according to actual needs, the HAL layer can also include display HAL, audio HAL, camera HAL, Bluetooth HAL, etc., and the implementation of this application does not impose any restrictions on this.

[0293] The kernel layer is the layer between hardware and software. Figure 8 As shown, the kernel layer of the embodiment of the present application at least includes GPS driver, cellular driver and Wi-Fi driver. In addition, according to actual needs, the kernel layer may also include display driver, camera driver, audio driver, Bluetooth driver, etc., and the implementation of the present application does not make any limitation on this.

[0294] Specifically in the embodiment of the present application, on the one hand, the positioning information acquisition module obtains the longitude and latitude from the GPS module of the electronic device through the GPS HAL and the GPS driver. At the same time, the cellular cell identifier is obtained from the SIM card through the cellular HAL and the cellular driver. Then the positioning information acquisition module reports the obtained longitude and latitude, cellular cell identifier and other location information as positioning information to the perception application.

[0295] On the other hand, the Wi-Fi module of the electronic device transmits the scanned Wi-Fi data to the Wi-Fi manager through the Wi-Fi driver and the Wi-Fi HAL.

[0296] Furthermore, when the perception application determines that there is a geographic fence in the area where the electronic device is currently located based on the positioning information reported by the positioning acquisition module, the Wi-Fi manager is called to register the Wi-Fi scan callback function. In addition, the perception application can also call the Wi-Fi manager to cancel the registered Wi-Fi scan callback function based on the positioning information.

[0297] After the Wi-Fi manager completes the registration of the Wi-Fi scan callback function based on the call of the perception application, if the Wi-Fi data reported by the Wi-Fi module is received again, the Wi-Fi manager will execute the registered Wi-Fi scan callback function. The reported Wi-Fi data is matched with the geo-fence downloaded from the cloud device. Finally, the Wi-Fi manager returns the matched geo-fence to the perception application. The perception application can transmit this geo-fence matching result to other applications, such as to an online shopping application. Then, this online shopping application can push information to be displayed on the display of the electronic device, thereby realizing accurate information push service for users holding this electronic device.

[0298] Another embodiment of the present application provides a cloud device, including: a communication module, one or more processors and a memory. The communication module and the memory are respectively coupled to the processor; the memory stores one or more computer program codes, and the computer program codes include computer instructions; when the processor executes the computer instructions, the cloud device implements the geo-fence generation method described in any of the above embodiments.

[0299] Another embodiment of the present application provides an electronic device, including: a communication module, one or more processors and a memory. The communication module and the memory are respectively coupled to the processor; the memory stores one or more computer program codes, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device implements the geo-fence matching method described in any of the above embodiments.

[0300] Another embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor in an electronic device, the electronic device implements the geo-fence generation method and the geo-fence matching method described in any of the above embodiments.

[0301] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step in the above method embodiment.

[0302] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0303] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0304] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0305] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0306] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.

[0307] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for generating a geographic fence, characterized in that: Applied to cloud devices, including: Acquire multiple Wi-Fi scan lists; wherein each Wi-Fi scan list includes a basic service set identifier BSSID and a received signal strength indicator RSSI of one or more Wi-Fi access points obtained by an electronic device in one scan; Performing similarity clustering on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters; wherein each Wi-Fi list cluster includes one or more Wi-Fi scan lists; Obtaining a feature weight corresponding to each BSSID in the Wi-Fi list cluster based on an appearance frequency of each BSSID in the Wi-Fi list cluster and an RSSI corresponding to each BSSID; Calculating, according to the feature weights corresponding to the BSSIDs in the Wi-Fi list cluster, a first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster, and determining a matching threshold of the Wi-Fi list cluster based on the multiple first matching scores; A geo-fence corresponding to the Wi-Fi list cluster is generated, where the geo-fence includes: a plurality of BSSIDs in the Wi-Fi list cluster and a feature weight corresponding to each BSSID, and a matching threshold of the Wi-Fi list cluster.

2. The method according to claim 1, characterized in that: The performing similarity clustering on the multiple Wi-Fi scan lists to obtain multiple Wi-Fi list clusters includes: For every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, calculate the similarity of RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists; Calculating the similarity of the two Wi-Fi scan lists; wherein the similarity of the two Wi-Fi scan lists is equal to the sum of the similarities of the RSSIs corresponding to the same BSSIDs in the two Wi-Fi scan lists; Based on the similarity between every two Wi-Fi scan lists in the multiple Wi-Fi scan lists, similarity clustering is performed on the multiple Wi-Fi scan lists to obtain the multiple Wi-Fi list clusters.

3. The method according to claim 2, characterized in that The calculating, for each two Wi-Fi scan lists in the multiple Wi-Fi scan lists, the similarity of RSSIs corresponding to the same BSSID in the two Wi-Fi scan lists includes: Calculate a first signal strength difference and a first signal strength weight of RSSIs corresponding to the same BSSID in every two Wi-Fi scan lists in the multiple Wi-Fi scan lists; wherein the first signal strength difference is negatively correlated with the first difference, the first difference is the difference of RSSIs corresponding to the same BSSID, and the first signal strength weight is positively correlated with any RSSI corresponding to the same BSSID; The product of the difference between the first signal strength difference and the second signal strength difference and the first signal strength weight is used as the similarity of the RSSI corresponding to the same BSSID; wherein the second signal strength difference is negatively correlated with the second difference, and the second difference is the difference between any RSSI corresponding to the same BSSID and the preset RSSI.

4. The method according to claim 3, characterized in that The calculating a first signal strength difference and a first signal strength weight of RSSIs corresponding to the same BSSID in every two Wi-Fi scan lists in the multiple Wi-Fi scan lists includes: The first signal strength difference and the first signal strength weight are calculated using the following formula: Among them, q(x i,b ,x j,b ) represents the first signal strength difference of the RSSI corresponding to the same BSSID, x i,b Indicates the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list; x j,b Indicates the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k q and d q is the preset parameter, k q =0.052160; d q =0.2; Ⅱ(x i,b <x j,b ) represents the indicator function. When the input condition x i,b <x j,b When true, the function value is 1, otherwise the function value is 0; Wherein, p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, x=x i,b or x j , b , including p(x i,b ) or p(x j , b ), p(x i,b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the i-th Wi-Fi scan list, p(x j , b ) represents the first signal strength weight of the RSSI corresponding to BSSID b in the jth Wi-Fi scan list; k p and b p is the preset parameter, k p =0.130401; b p =-65.

5. The method according to claim 3 or 4, characterized in that: The taking the product of the difference between the first signal strength difference and the second signal strength difference and the signal strength weight as the similarity of the RSSI corresponding to the same BSSID includes: The similarity of the RSSI corresponding to the same BSSID is calculated using the following formula: p(x)(q(x i,b ,x j,b )-q(x,c x )) Wherein, p(x) represents the first signal strength weight of any RSSI corresponding to the same BSSID, including p(x i,b ) or p(x j,b );q(x i,b ,x j,b ) represents the first signal strength difference of RSSI corresponding to the same BSSID; q(x,c x ) represents the second signal strength difference of any RSSI corresponding to the same BSSID, including q(x i,b ,c x ) or q(x j , b ,c x ), c x Indicates the preset RSSI; The calculating the similarity of the two Wi-Fi scan lists includes: The similarity between the two Wi-Fi scan lists is calculated using the following formula: Among them, w(x i ,x j ) represents the similarity between the i-th Wi-Fi scan list and the j-th Wi-Fi scan list; B i ∩B j Indicates the i-th Wi-Fi scan list B i and the jth Wi-Fi scan list B j The set of the same BSSID in B, b∈B i ∩B j .

6. The method according to any one of claims 1 to 5, characterized in that The feature weights include: Wi-Fi signal strength median value, Wi-Fi signal strength frequency weight, and Wi-Fi signal strength baseline feature; The obtaining, based on the appearance frequency of each BSSID in the Wi-Fi list cluster in the Wi-Fi list cluster and the RSSI corresponding to each BSSID, a feature weight corresponding to each BSSID in the Wi-Fi list cluster, includes: Calculate the median value of all RSSIs corresponding to the same BSSID in the Wi-Fi list cluster as the median value of the Wi-Fi signal strength corresponding to the BSSID; Calculate the product of the second signal strength weight and the occurrence frequency as the Wi-Fi signal strength frequency weight corresponding to the BSSID; wherein the occurrence frequency is the ratio of the number of times the BSSID appears in the Wi-Fi list cluster to the number of Wi-Fi scan lists in the Wi-Fi list cluster; the second signal strength weight is positively correlated with the median value of the Wi-Fi signal strength; A third signal strength difference is calculated as the Wi-Fi signal strength reference feature corresponding to the BSSID; wherein the third signal strength difference is negatively correlated with a third difference value, and the third difference value is a difference between the median value of the Wi-Fi signal strength and a preset RSSI.

7. The method according to claim 6, characterized in that The calculating, according to the feature weights corresponding to the BSSIDs in the Wi-Fi list cluster, a first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster includes: The first matching score is calculated using the following formula: Where score(y,x) represents the first matching score between Wi-Fi list cluster y and Wi-Fi scan list x; B represents the set of identical BSSIDs in Wi-Fi list cluster y and Wi-Fi scan list x, b∈B; y b,f0 represents the Wi-Fi signal strength frequency weight f0 corresponding to BSSID b in Wi-Fi list cluster y; q(y b,i0 ,x b ) represents y b,i0 and x b The signal strength difference, y b,i0 represents the median value i0,x of the Wi-Fi signal strength corresponding to BSSID b in Wi-Fi list cluster y b Indicates the RSSI of BSSID b in Wi-Fi scan list x; y b,f1 It represents the Wi-Fi signal strength benchmark feature f1 corresponding to BSSID b in Wi-Fi list cluster y.

8. The method according to any one of claims 1 to 7, characterized in that The determining a matching threshold of the Wi-Fi list cluster based on a plurality of first matching scores includes: Calculating a median value of the plurality of first matching scores, and taking a product of the median value of the plurality of first matching scores and a preset score weight as a matching threshold reference value; Among the multiple first matching scores, a first matching score that is greater than or equal to the matching threshold reference value and has the smallest score is used as the matching threshold of the Wi-Fi list cluster.

9. The method according to any one of claims 1 to 8, characterized in that Before calculating, according to the feature weights corresponding to the BSSIDs in the Wi-Fi list cluster, a first matching score between each Wi-Fi scan list in the multiple Wi-Fi scan lists and the Wi-Fi list cluster, and determining a matching threshold of the Wi-Fi list cluster based on the multiple first matching scores, the method further includes: According to the feature weight corresponding to each BSSID in the Wi-Fi list cluster, the BSSIDs in the Wi-Fi list cluster are screened out to obtain a Wi-Fi list cluster whose number of BSSIDs meets a preset number requirement.

10. A geographic fence matching method, characterized in that: Applied to an electronic device, wherein one or more geo-fences are stored in the electronic device, wherein the geo-fences include multiple BSSIDs and feature weights corresponding to each BSSID, and a matching threshold of the geo-fences; wherein the feature weights are obtained based on the appearance frequency of each BSSID in a Wi-Fi list cluster corresponding to the geo-fence in the Wi-Fi list cluster and the RSSI corresponding to each BSSID; the Wi-Fi list cluster includes one or more Wi-Fi scan lists obtained by clustering, and each Wi-Fi scan list includes the BSSIDs and RSSIs of one or more Wi-Fi access points obtained by one electronic device scanning at one time; the method includes: Scan the Wi-Fi signal at the current location to obtain a set of Wi-Fi data; wherein each set of Wi-Fi data includes a basic service set identifier BSSID and a signal strength RSSI of one or more Wi-Fi access points; Calculating a second matching score between the Wi-Fi data and the geo-fence according to feature weights corresponding to each BSSID in the geo-fence; If the second matching score is greater than or equal to the matching threshold, it is determined that the Wi-Fi data matches the geo-fence.

11. The method according to claim 10, characterized in that The method further comprises: Acquire positioning information, and determine the administrative region corresponding to the current location according to the positioning information; wherein the positioning information is the location information of the electronic device acquired according to a preset period, including any one or more of latitude and longitude and cellular cell identification; Download one or more geographic fences corresponding to the administrative area from the cloud device and save them locally.

12. The method according to claim 11, characterized in that The method further comprises: A validity period is set for the downloaded and saved geo-fence; when the validity period of the geo-fence expires, the geo-fence with the expired validity period is deleted locally.

13. The method according to any one of claims 11 to 12, characterized in that: The method further comprises: Expand the area around the positioning information as the center point to obtain a fence judgment area; If there is a geo-fence in the fence judgment area, register a Wi-Fi scan callback function; After scanning the Wi-Fi signal at the current location to obtain a group of Wi-Fi data, executing the Wi-Fi scan callback function; executing the Wi-Fi scan callback function includes: calculating a second matching score between the Wi-Fi data and the geo-fence according to a feature weight corresponding to each BSSID in the geo-fence; if the second matching score is greater than the matching threshold, determining that the Wi-Fi data matches the geo-fence.

14. The method according to claim 13, characterized in that The method further comprises: When there is no geographic fence in the fence judgment area, the registered Wi-Fi scan callback function is unregistered.

15. The method according to any one of claims 10 to 14, characterized in that: The calculating, according to the feature weights corresponding to the BSSIDs in the geo-fence, a second matching score between the Wi-Fi data and the geo-fence includes: Calculate a fourth signal strength difference between the geo-fence and the same BSSID in the Wi-Fi data; wherein the fourth signal strength difference is negatively correlated with a fourth difference value; the fourth difference value is a difference between a median value of the Wi-Fi signal strength corresponding to the same BSSID in the geo-fence and an RSSI corresponding to the same BSSID in the Wi-Fi data; Calculate a matching score between the geo-fence and the same BSSID in the Wi-Fi data based on the fourth signal strength difference, the Wi-Fi signal strength frequency weight corresponding to the same BSSID in the geo-fence, and a Wi-Fi signal strength benchmark feature; A second matching score between the geo-fence and the Wi-Fi data is calculated; the second matching score is the sum of matching scores of all identical BSSIDs between the geo-fence and the Wi-Fi data.

16. The method according to any one of claims 10 to 15, characterized in that The method also includes: receiving or sending information push according to the matched geographic fence.

17. A cloud device, characterized in that: include: A communication module, one or more processors and a memory; the communication module and the memory are respectively coupled to the processor; one or more computer program codes are stored in the memory, and the computer program codes include computer instructions; when the processor executes the computer instructions, the cloud device executes the geo-fence generation method as described in any one of claims 1-9.

18. An electronic device, characterized in that: include: A communication module, one or more processors and a memory; the communication module and the memory are respectively coupled to the processor; one or more computer program codes are stored in the memory, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device executes the geo-fence matching method as described in any one of claims 10-16.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor of a cloud device, the cloud device executes the geo-fence generation method as described in any one of claims 1-9; or, when the computer program is executed by the processor of an electronic device, the electronic device executes the geo-fence matching method as described in any one of claims 10-16.

Citation Information

Patent Citations

  • Geo-fence generation method and device, positioning method and device, medium and equipment

    CN113891240A

  • Shop arrival identification method and device, storage medium and electronic equipment

    CN114077978A

  • Virtual card pop-up method, electronic equipment and storage medium

    CN116055630A

  • Ai traffic measurement and forecasting system

    KR102270853B1