Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, fig. 1 is a schematic flowchart of a WiFi-feature-based low power consumption control method provided in an embodiment of the present invention, where the method is applied to a wearable device, and specifically includes: steps S101 to S104.
S101, acquiring WiFi characteristics of the environment where the wearable equipment is located according to a positioning period, and storing the acquired WiFi characteristics in current WiFi characteristics;
s102, comparing the similarity of the current WiFi characteristic with the WiFi characteristics in the historical WiFi characteristic statistical results;
s103, performing low-power consumption control on the wearable equipment according to the similarity comparison result;
and S104, updating the historical WiFi characteristic statistical result according to the current WiFi characteristic.
In this embodiment, the WiFi features corresponding to the environment where the wearable device is located are collected and stored in the current WiFi features. And comparing the current WiFi characteristic with the historical WiFi characteristic statistical result for the collected current WiFi characteristic, so as to perform low power consumption control on the wearable equipment according to the comparison result, and updating the historical WiFi characteristic statistical result by using the current WiFi characteristic, so as to facilitate the next low power consumption control on the wearable equipment. Here, the preset feature set may exist in the form of an array, a linked list, a dictionary, and the like.
This embodiment judges wearable device's position based on the wiFi characteristic to whether take place the position change according to wearable device and control its consumption, so improve the consumption management effect to wearable device, save the consumption for wearable device.
In a specific embodiment, by the WiFi feature-based low power consumption control method provided in this embodiment, the wearable device can be in an actual positioning device, so that power consumption is greatly saved, and the total working time is increased by more than one time (for example, except for daily working hours and the original effect, most of other home and office time is in a low power consumption state), which is much longer than the total working time of the gsensor-based stationary algorithm version in the prior art.
In one embodiment, the step S101 includes:
based on the requirement of position real-time performance, WiFi characteristics are collected at each preset interval time through a WiFi scanning function of the wearable device;
aiming at each WiFi feature, a feature node is created by taking a WiFi MAC address as an index, and a feature element is set for each feature node; the characteristic elements comprise MAC addresses, signal strength, accumulated occurrence times and timestamps;
storing all of the feature nodes in a current WiFi feature.
In this embodiment, a corresponding feature node is created for each WiFi feature, and all feature nodes are stored in the current WiFi feature (maximum capacity M) for the WiFi feature. In a specific embodiment, each feature node may be regarded as an array node, also equivalent to a WiFi feature, and the array node elements include: the MAC address of WiFi, signal strength, number of cumulative occurrences, and timestamp, etc. For example, as shown in table 1:
| 1
|
MAC1
|
signal strength
|
Cumulative number of occurrences
|
Time stamp
|
| 2
|
MAC2
|
Signal strength
|
Cumulative number of occurrences
|
Time stamp
|
| 3
|
MAC3
|
Signal strength
|
Cumulative number of occurrences
|
Time stamp
|
| 4
|
MAC4
|
Signal strength
|
Cumulative number of occurrences
|
Time stamp
|
| 5
|
MAC5
|
Signal strength
|
Cumulative number of occurrences
|
Time stamp
|
| 6
|
MAC6
|
Signal strength
|
Cumulative number of occurrences
|
Time stamp |
TABLE 1
Specifically, the step S101 further includes:
when the WiFi characteristics of the environment where the wearable equipment is located are collected for the first time, the collected WiFi characteristics are stored in historical WiFi characteristic statistical results for the first time, and the accumulated occurrence times of all WiFi characteristics in the historical WiFi characteristic statistical results are set to be 1.
In one embodiment, the step S102 includes:
selecting a target WiFi feature with the signal intensity larger than N from the current WiFi features;
judging whether the number of the target WiFi features meets the requirement of a preset number K; and the preset number K is K WiFi characteristics in the previous Q WiFi characteristics in the historical WiFi characteristic statistical result.
In this embodiment, as shown in fig. 2, for the current WiFi feature created according to the collected current WiFi feature, it is determined whether the signal strength of each WiFi feature included in the current WiFi feature is greater than N (for example, -80dbm), and the WiFi feature whose signal strength is greater than N is selected as the target WiFi feature, or as shown in fig. 2, the selected WiFi features are collected into a qualified feature set. And then, judging the number P of the selected qualified feature sets to determine whether the requirement of a preset number K is met, for example, if the P number of the target WiFi features meets the condition, and if the preset number requirement is K, judging the number relation between the P number and the K number, so as to judge whether the wearable equipment is changed according to the number relation. Here, the preset number K is K WiFi features in the top Q WiFi features in the historical WiFi feature statistics.
Further, in an embodiment, the WiFi feature-based low power consumption control method further includes:
a position counter is preset to count the position change of the wearable device, and the power consumption state switching is controlled through the counter. The switching once judgment is avoided, and the misjudgment is caused.
The step S103 includes:
when the number of the target WiFi features reaches the requirement of the preset number K, judging that the position of the wearable device is not changed, and controlling the wearable device to switch or maintain a low power consumption state;
when the number of the target WiFi features does not reach the requirement of the preset number K, adding 1 to the numerical value of the position change counter;
when the value of the position change counter reaches a preset counting threshold value, the position of the wearable device is judged to be changed, the position change is reported, the position of the wearable device is updated, and the value of the position change counter is cleared.
In this embodiment, when the number P of the target WiFi features reaches the preset number requirement K, it may be determined that the current WiFi features are similar to the WiFi features collected several times before, so as to determine that the position of the wearable device does not change, and thus the wearable device may continue to maintain low-power operation. When the number P of the target WiFi features does not reach the preset number requirement K, adding 1 to the numerical value of the position change counter, judging whether the numerical value of the position change counter reaches a preset counting threshold value, and when the numerical value of the position change counter reaches the preset counting threshold value, judging that the position of the wearable device is changed. After the position of the wearable device is determined to change, the changed position can be reported so as to update the position of the wearable device. And meanwhile, the numerical value of the position change counter is reset, so that the subsequent position judgment is facilitated. The embodiment does not limit the manner of reporting the location change and updating the location of the wearable device.
In an embodiment, the step S104 further includes:
judging whether the current WiFi characteristic and the historical WiFi characteristic statistical result have WiFi characteristics with the same MAC;
if the same WiFi features exist, adding 1 to the occurrence times of the same WiFi features in the historical WiFi feature statistical results, and updating the corresponding timestamps;
if the same WiFi features do not exist, judging whether the total number of the WiFi features in the historical WiFi feature statistical result reaches a preset number threshold value or not;
when the total number of the WiFi features in the historical WiFi feature statistical result does not reach a preset number threshold value, inserting the WiFi features in the current WiFi features into the historical WiFi feature statistical result;
when the total number of the WiFi features in the historical WiFi feature statistical results reaches a preset number threshold value, deleting the WiFi feature with the timestamp farthest from the current time in the historical WiFi feature statistical results according to the number of the WiFi features to be inserted into the historical WiFi feature statistical results, and inserting the WiFi feature to be inserted into the historical WiFi feature statistical results after deletion;
and after the historical WiFi characteristic statistical results are updated, arranging the WiFi characteristics in the historical WiFi characteristic statistical results according to the accumulated occurrence times.
In this embodiment, with reference to fig. 3, when the historical WiFi feature statistical result is updated, it is first determined that the WiFi feature in the current WiFi feature already exists in the historical WiFi feature statistical result. And if the WiFi characteristic exists, adding 1 to the accumulated occurrence frequency of the corresponding WiFi characteristic in the historical WiFi characteristic statistical result, and updating the time stamp. If not, it is determined whether the capacity of the historical WiFi feature statistics is full (for example, whether the total WiFi feature number in fig. 3 is greater than M), that is, whether the total WiFi feature number in the historical WiFi feature statistics reaches a preset number threshold. If not, directly inserting the WiFi characteristics in the current WiFi characteristics into historical WiFi characteristic statistical results; and if the capacity is full or the capacity is full after a plurality of WiFi features are inserted, deleting the WiFi features with the same quantity and the latest far timestamps in the historical WiFi feature statistical results according to the quantity of the WiFi features to be inserted, so that all the WiFi features to be inserted can be inserted into the historical WiFi feature statistical results.
The updating of the historical WiFi feature statistical results can be completed through the above steps, further, after the updating is completed, the WiFi features in the historical WiFi feature statistical results are sorted, for example, sorted in a descending order according to the accumulated occurrence number, of course, an ascending order may also be adopted, as long as it is ensured that the target of comparison (selecting Q from the tail) in S103 is the WiFi feature set Q with the largest occurrence number.
Fig. 4 is a schematic block diagram of a wearable device 400 according to an embodiment of the present invention, where the wearable device 400 includes:
the first acquisition unit 401 is configured to acquire WiFi characteristics of an environment where the wearable device is located according to a positioning period, and store the acquired WiFi characteristics in current WiFi characteristics;
a similarity comparison unit 402, configured to compare similarity between the current WiFi feature and WiFi features in historical WiFi feature statistics results;
a low power consumption control unit 403, configured to perform low power consumption control on the wearable device according to the similarity comparison result;
a feature updating unit 404, configured to update the historical WiFi feature statistics according to the current WiFi feature.
In an embodiment, the first acquisition unit 401 includes:
the second acquisition unit is used for acquiring WiFi characteristics at each preset interval time through a WiFi scanning function of the wearable equipment based on the position real-time requirement;
the node creating unit is used for creating a characteristic node by taking the WiFi MAC address as an index aiming at each WiFi characteristic and setting a characteristic element for each characteristic node; the characteristic elements comprise MAC addresses, signal strength, accumulated occurrence times and timestamps;
a first storage unit, configured to store all the feature nodes in a current WiFi feature.
In an embodiment, the first acquisition unit 401 further includes:
and the second storage unit is used for storing the first acquired WiFi characteristics in the historical WiFi characteristic statistical result when the WiFi characteristics of the environment where the wearable equipment is located are acquired for the first time, and setting the accumulated occurrence times of all the WiFi characteristics in the historical WiFi characteristic statistical result to be 1.
In an embodiment, the similarity comparing unit 402 includes:
the characteristic selection unit is used for selecting a target WiFi characteristic with the signal intensity larger than N from the current WiFi characteristics;
the quantity judgment unit is used for judging whether the quantity of the target WiFi features meets the requirement of a preset quantity K; and the preset number K is K WiFi characteristics in the previous Q WiFi characteristics in the historical WiFi characteristic statistical result.
In an embodiment, the wearable device 400 further comprises:
and the position counting unit is used for presetting a position counter to count the position change of the wearable equipment and controlling the power consumption state switching through the counter.
In one embodiment, the low power consumption control unit 403 includes:
the first judging unit is used for judging that the position of the wearable device is not changed when the number of the target WiFi features reaches a preset number requirement K, and controlling the wearable device to switch or maintain a low power consumption state;
a counting and 1 adding unit, configured to add 1 to the value of the position change counter when the number of the target WiFi features does not meet a preset number K requirement;
and the second judgment unit is used for judging that the position of the wearable device is changed when the value of the position change counter reaches a preset counting threshold value, reporting the position change, updating the position of the wearable device, and clearing the value of the position change counter.
In an embodiment, the feature updating unit 404 further includes:
the characteristic judging unit is used for judging whether the current WiFi characteristic and the historical WiFi characteristic statistical result have the same WiFi characteristic or not;
the timestamp updating unit is used for adding 1 to the occurrence frequency of the same WiFi feature in the historical WiFi feature statistical result and updating the corresponding timestamp if the same WiFi feature exists;
the characteristic total judging unit is used for judging whether the total WiFi characteristics in the historical WiFi characteristic statistical results reach a preset quantity threshold value or not if the same WiFi characteristics do not exist;
the characteristic inserting unit is used for inserting the WiFi characteristics in the current WiFi characteristics into the historical WiFi characteristic statistical results when the total WiFi characteristics in the historical WiFi characteristic statistical results do not reach a preset quantity threshold value;
the characteristic deleting unit is used for deleting the WiFi characteristic with the timestamp farthest away from the current time in the historical WiFi characteristic statistical result according to the WiFi characteristic quantity to be inserted into the historical WiFi characteristic statistical result when the total WiFi characteristic quantity in the historical WiFi characteristic statistical result reaches a preset quantity threshold value, and inserting the WiFi characteristic to be inserted into the historical WiFi characteristic statistical result after deletion;
and the characteristic arrangement unit is used for arranging the WiFi characteristics in the historical WiFi characteristic statistical results according to the accumulated occurrence times after the historical WiFi characteristic statistical results are updated.
Since the embodiment of the wearable device portion and the embodiment of the method portion correspond to each other, please refer to the description of the embodiment of the method portion for the embodiment of the wearable device portion, which is not repeated here.
Embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps provided by the above embodiments can be implemented. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiment of the present invention further provides a computer device, which may include a memory and a processor, where the memory stores a computer program, and the processor may implement the steps provided in the above embodiment when calling the computer program in the memory. Of course, the computer device may also include various network interfaces, power supplies, and the like.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.