Disclosure of Invention
The embodiment of the invention provides a position measuring method and a position measuring device, which are used for solving the problem of higher power consumption when a terminal reports position information in the prior art.
In a first aspect, an embodiment of the present invention provides a position measurement method, including:
before position measurement, judging whether a position measurement condition is met; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal reports the position information last time is greater than or equal to a time length threshold value;
and if the position measurement condition is met, measuring the position of the terminal.
In one possible implementation, the method further includes:
and determining whether the terminal is in a motion state or not through an acceleration sensor of the terminal.
In one possible implementation design, the determining, by the acceleration sensor of the terminal, whether the terminal is in a motion state includes:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
In a design that may be implemented, a time length from a current time to a time at which the terminal last reported the location information is greater than or equal to a time length threshold includes:
the time length from the current time to the time when the terminal reports the position information last time is larger than or equal to the time length threshold value, and the period when the terminal reports the position information is larger than or equal to the period threshold value.
In one possible implementation design, after the measuring the position of the terminal, the method further includes:
judging whether the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to a distance threshold value or not;
and if the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to the distance threshold, reporting the measured position information to the server.
In a second aspect, an embodiment of the present invention provides a position measurement apparatus, including:
the first judgment module is used for judging whether the position measurement condition is met before the position measurement; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal reports the position information last time is greater than or equal to a time length threshold value;
and the measuring module is used for measuring the position of the terminal if the position measuring condition is met.
In one possible implementation, the apparatus further includes:
and the determining module is used for determining whether the terminal is in a motion state or not through an acceleration sensor of the terminal.
In one possible implementation, the determining module is specifically configured to:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
In a design that may be implemented, a time length from a current time to a time at which the terminal last reported the location information is greater than or equal to a time length threshold includes:
the time length from the current time to the time when the terminal reports the position information last time is larger than or equal to the time length threshold value, and the period when the terminal reports the position information is larger than or equal to the period threshold value.
In one possible implementation, the apparatus further includes: a second judging module and a reporting module;
the second judging module is used for judging whether the distance between the current position and the historical position when the terminal reports the position information last time is larger than or equal to a distance threshold value or not;
and the reporting module is used for reporting the position information obtained by measurement to the server if the distance between the current position and the historical position when the terminal reports the position information last time is larger than or equal to a distance threshold value.
The position measuring method and the position measuring device provided by the invention judge whether the position measuring condition is met before the position measurement, wherein the position measuring condition comprises the following steps: the terminal is in a motion state, and/or the time length from the time when the terminal last reports the position information at the current time is greater than or equal to a time length threshold value, if the position measurement condition is met, the position of the terminal is measured, the position measurement condition that the time length from the time when the terminal is in the motion state and/or the time length from the time when the terminal last reports the position information at the current time is greater than or equal to the time length threshold value is met, namely the position of the terminal is measured when the position measurement is necessary, and the power consumption caused by unnecessary position measurement when the terminal continuously measures the position is avoided, and the power consumption when the terminal reports the position information is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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.
Fig. 1 is a schematic view of an application scenario according to an embodiment of the present invention. As shown in fig. 1, the application scenario of the present invention may include: theterminal 11 and theserver 12 are connected in a communication mode, and theterminal 11 and theserver 12 are connected in a communication mode. Theterminal 11 may obtain the location information through measurement, and report the location information to theserver 12. Alternatively, the position of the terminal may be measured by a positioning chip on theterminal 11 to obtain the position information of the terminal.
Theterminal 11, which may also be referred to as a user equipment, may include, but is not limited to, a user terminal equipment (CPE), a smart phone (such as an Android phone and an IOS phone), a multimedia device, a streaming media device, a personal computer, a tablet computer, a palmtop computer, a Mobile Internet Device (MID), an internet device such as a wearable smart device, and the like.
Theserver 12 may specifically include one device, or may be a cluster of multiple devices, which is not limited in this embodiment.
It should be noted that the positioning chip can be understood as a Geographic Information System (GIS) for acquiring the position information. The positioning chip may specifically include one chip or a plurality of chips, and the present invention is not limited to this specific form of positioning chip. For example, the positioning chip may include a Global Positioning System (GPS) chip
It should be noted that, the relationship between theterminal 11 and the positioning chip may be understood that theterminal 11 includes the positioning chip, or the positioning chip is disposed on theterminal 11.
Fig. 2 is a flowchart of a first embodiment of a position measurement method according to an embodiment of the present invention, where an execution main body of the method according to the embodiment may be a terminal, and as shown in fig. 2, the method according to the embodiment may include:
step 201, before position measurement, judging whether a position measurement condition is met; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal last reports the position information is larger than or equal to a time length threshold value.
In this step, optionally, when the position of the terminal is not changed, the terminal may be considered to be in a stationary state; when the position of the terminal is changed, the terminal may be considered to be in a motion state. Or, optionally, when the position of the terminal is not changed, or the position change of the terminal is smaller than a position change threshold, the terminal may be considered to be in a stationary state; when the position change of the terminal is greater than or equal to the position change threshold, the terminal may be considered to be in a motion state.
When the terminal is in a stationary state, it may be considered that the location information has not changed or has a small change, and the location information obtained by re-measurement is approximately equal to the location information reported last time, so that there is no need to measure the location, and therefore, the measurement may not be performed temporarily. When the terminal is in a moving state, it can be considered that the position information of the terminal is changed greatly, and the difference between the position information obtained by re-measurement and the position information reported last time is large, so that the position measurement is necessary, and therefore, the measurement is not required immediately.
The time length from the current time to the time when the terminal reports the position information last time is less than the time length threshold value, the interval between the current time and the last time of reporting the position information is considered to be short, and the position information does not need to be reported in a long time later, and the position measurement does not need to be carried out, so the measurement can be temporarily not carried out. The time length from the current time to the time when the terminal last reports the position information is greater than or equal to the time length threshold value, the interval between the current time and the last reporting of the position information is considered to be longer, and the position information needs to be reported in a shorter time later, so that the position needs to be measured immediately. It should be noted that, when the time length from the time when the terminal last reported the location information at the current time is less than the time length threshold, the location information does not need to be reported for a longer time, so that when the condition that the time length from the time when the terminal last reported the location information at the current time is less than the time length threshold is not satisfied, the location measurement may not be performed.
Optionally, the duration threshold may be related to a period for reporting the location information by the terminal.
It should be noted that the duration threshold may be preset, or may also be configured by the network side, which is not limited in the present invention. The location change threshold may be preset, or may also be configured by the network side, which is not limited in the present invention.
It should be noted that the position measurement condition may also include other conditions except that the terminal is in a motion state and that a time length from a time when the terminal last reported the position information at the current time is greater than or equal to a time length threshold, which is not limited in the present invention.
And 202, if the position measurement condition is met, measuring the position of the terminal.
In this step, the position of the terminal is measured when the position measurement condition is satisfied. It is understood that the position of the terminal is not measured when the above measurement condition is not satisfied. Optionally, the measurement of the terminal position may be specifically completed by a positioning chip, and the positioning chip may measure or not measure the position of the terminal according to the control of the processor of the terminal.
Further optionally, the state of the positioning chip may include an off state, a standby state and an operating state. When the positioning chip is not powered on, the positioning chip can be considered to be in a closed state; when the positioning chip is powered on but measurement is not performed, the positioning chip can be considered to be in a standby state; when the positioning chip is powered on and measurement is performed, the positioning chip can be considered to be in a working state. Specifically, the positioning chip may be normally in an off state or a standby state, and when the position measurement condition is satisfied, the state of the positioning chip is switched to an operating state.
Optionally, if the position measurement condition is not satisfied, the process may return to step 201.
It can be understood that the position measurement method provided in this embodiment may specifically be to measure the position of the terminal after the terminal is powered on and the position measurement condition is satisfied, on the basis of reporting the position information at least once.
In this embodiment, before the position measurement, it is determined whether a position measurement condition is satisfied, where the position measurement condition includes: the terminal is in a motion state, and/or the time length from the time when the terminal last reports the position information at the current time is greater than or equal to a time length threshold value, if the position measurement condition is met, the position of the terminal is measured, the position measurement condition that the time length from the time when the terminal is in the motion state and/or the time length from the time when the terminal last reports the position information at the current time is greater than or equal to the time length threshold value is met, namely the position of the terminal is measured when the position measurement is necessary, and the power consumption caused by unnecessary position measurement when the terminal continuously measures the position is avoided, and the power consumption when the terminal reports the position information is reduced.
Fig. 3 is a flowchart of a second embodiment of a position measurement method according to the present invention. The embodiment mainly describes a specific implementation manner on the basis of the embodiment shown in fig. 2, and as shown in fig. 3, the method of the embodiment may include:
step 301, before position measurement, judging whether a position measurement condition is met; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal last reports the position information is larger than or equal to a time length threshold value, and the period when the terminal reports the position information is larger than or equal to a period threshold value.
In this step, when the period of reporting the location information by the terminal is greater than or equal to the period threshold, it may be considered that the server has a low requirement on the timeliness of the location information, so that it is not necessary to perform location measurement all the time. It should be noted that the period threshold may be preset, or may be configured by the network side, which is not limited in the present invention. The cycle threshold may be, for example, 10 minutes.
Optionally, when the position measurement condition includes that the terminal is in a moving state, and the time length from the time when the terminal last reports the position information at the current time is greater than or equal to the time length threshold and the period when the terminal reports the position information is greater than or equal to the period threshold, the determination sequence of the three is not limited in the present invention.
Optionally, it may be determined whether the terminal is in a moving state, after determining that the terminal is in the moving state, it may be determined whether a period of reporting the location information by the terminal is greater than a period threshold, when it is determined that the period of reporting the location information by the terminal is greater than or equal to the period threshold, it may be determined whether a time length from a current time to a time at which the terminal last reports the location information is greater than or equal to the time length threshold, and if the time length from the current time to the time at which the terminal last reports the location information is greater than or equal to the time length threshold, the location measurement condition is satisfied. And if the terminal is in a static state, the period of reporting the position information by the terminal is less than the period threshold value or the time length from the current time to the last time of reporting the position information by the terminal is less than the time length threshold value, the position measurement condition is not met.
Optionally, in the embodiment of the present invention, whether the terminal is in a motion state may be determined by an acceleration sensor. Optionally, the relationship between the acceleration sensor and the terminal may specifically be that the terminal is provided with the acceleration sensor, or the terminal includes the acceleration sensor. It should be noted that whether the terminal is in a motion state may also be determined by other sensors, such as a gyro sensor.
Further optionally, since the completely uniform speed condition does not exist basically, and when the terminal is stationary, the accelerations in the three-division directions of the acceleration sensor are all kept unchanged, it is possible to determine whether the terminal is in a motion state through the accelerations in the three directions of the acceleration sensor.
Optionally, the determining, by the acceleration sensor of the terminal, whether the terminal is in a motion state may include:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
The three directions may be specifically an X-axis, a Y-axis, and a Z-axis.
Considering that the acceleration of the acceleration sensor may slightly change when the terminal vibrates, in a specific implementation, it may be determined whether the variation amounts of the acceleration sensor in three directions are all less than or equal to an acceleration variation threshold;
if the variation of the acceleration sensor in three directions is less than or equal to the acceleration variation threshold, the terminal is in a static state;
and if the variation of the acceleration of any one direction of the three directions of the acceleration sensor is larger than the acceleration variation threshold, the terminal is in a motion state.
That is, whether or not the accelerations in the three directions of the acceleration sensor are all kept constant may be understood as that the amounts of change in the accelerations in the three directions of the acceleration sensor are all less than or equal to an acceleration change threshold. The change of the acceleration in any one direction of the three directions of the acceleration sensor may be understood as that the change amount of the acceleration in any one direction of the three directions of the acceleration sensor is larger than an acceleration change threshold.
It should be noted that the acceleration change threshold may be preset, or may be configured by the network side, which is not limited in the present invention.
Step 302, if the position measurement condition is satisfied, measuring the position of the terminal.
It should be noted thatstep 302 is similar to step 202, and is not described herein again.
In this embodiment, before the position measurement, it is determined whether a position measurement condition is satisfied, where the position measurement condition includes: the terminal is in a motion state, and/or the time length from the time when the terminal reports the position information last time at the current time is greater than or equal to a time length threshold value, and the period when the terminal reports the position information is greater than or equal to a period threshold value, if the position measurement condition is met, the position of the terminal is measured only when the position measurement condition is met, namely the position is necessary to be measured, the power consumption caused by unnecessary position measurement when the terminal continuously measures the position is avoided, and the power consumption when the terminal reports the position information is reduced.
Fig. 4 is a flowchart of a third embodiment of a position measurement method according to the present invention. In this embodiment, an optional implementation manner of reporting location information is mainly described on the basis of the embodiments shown in fig. 2 or fig. 3, and as shown in fig. 4, the method of this embodiment may include:
step 401, before position measurement, determining whether a position measurement condition is satisfied.
It should be noted thatstep 401 is similar tosteps 201 and 301, and is not described herein again.
And 402, if the position measurement condition is met, measuring the position of the terminal.
It should be noted thatstep 402 is similar to step 202, and is not described herein again.
Step 403, determining whether the distance between the current position and the historical position when the terminal last reported the position information is greater than or equal to the distance threshold.
In this step, the distance between the current position and the historical position of the terminal when reporting the position information last time is smaller than the distance threshold, which may indicate that the position change of the terminal is small, and the position information may not be reported to the server, i.e., it is not necessary to report the position information to the server. The distance between the current position and the historical position of the terminal when reporting the position information last time is greater than or equal to the distance threshold value, which can indicate that the position change of the terminal is large, and the position information needs to be reported to the server, that is, the position information needs to be reported to the server.
It should be noted that the distance threshold may be preset, or may be configured by the network side, which is not limited in the present invention. Optionally, when configured by the network side, the network side may configure the distance threshold and the period of reporting the location information to the terminal together. In the embodiment of the present invention, the network side may specifically be theserver 12.
And step 404, reporting the measured position information to a server if the distance between the current position and the historical position when the terminal reported the position information last time is larger than or equal to the distance threshold.
In this step, after it is determined that the distance between the current position and the historical position at the time when the terminal last reported the position information is greater than or equal to the distance threshold, the position information obtained by measurement is reported to the server.
Optionally, if the distance between the current location and the historical location when the terminal last reported the location information is smaller than the distance threshold,step 401 may be returned.
In this embodiment, if the distance between the current position and the historical position when the terminal last reported the position information is greater than or equal to the distance threshold, the measured position information is reported to the server, so that the position information is reported to the server only when the condition that the distance between the current position and the historical position when the terminal last reported the position information is greater than or equal to the distance threshold is met, that is, when the position information is necessary to be reported, power consumption and consumption of air interface resources caused by unnecessary position information reporting are avoided, air interface resources occupied by the terminal for reporting the information are reduced, and power consumption when the terminal reports the position information is further reduced.
Fig. 5 is a schematic structural diagram of a position measurement apparatus according to an embodiment of the present invention, where the apparatus according to this embodiment may be applied to the foregoing method embodiment to implement a function of a terminal thereof. As shown in fig. 5, the apparatus of the present embodiment may include: afirst judging module 501 and ameasuring module 502. Wherein,
afirst judging module 501, configured to judge whether a position measurement condition is met before position measurement; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal reports the position information last time is greater than or equal to a time length threshold value;
ameasuring module 502, configured to measure the location of the terminal if the location measurement condition is met.
Optionally, the apparatus provided in this embodiment further includes: a determiningmodule 503, configured to determine whether the terminal is in a motion state through an acceleration sensor of the terminal.
Optionally, the determiningmodule 503 is specifically configured to:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
Optionally, the time length from the time when the terminal last reported the location information at the current time is greater than or equal to the time length threshold includes:
the time length from the current time to the time when the terminal reports the position information last time is larger than or equal to the time length threshold value, and the period when the terminal reports the position information is larger than or equal to the period threshold value.
Optionally, the apparatus provided in this embodiment further includes: asecond judgment module 504 and areporting module 505;
a second determiningmodule 504, configured to determine whether a distance between the current location and a past location at which the terminal last reported the location information is greater than or equal to a distance threshold;
areporting module 505, configured to report, to the server, the position information obtained through measurement if a distance between the current position and a historical position of the terminal when reporting the position information last time is greater than or equal to a distance threshold.
The apparatus of this embodiment may be used to implement the technical solutions of the above method embodiments, and its implementation principles and technical effects are similar, and are not described herein again.
Fig. 6 is a schematic structural diagram of an embodiment of a terminal provided in the embodiment of the present invention, and as shown in fig. 6, the terminal of this embodiment may include: aprocessor 601 and amemory 602 for storing computer instructions.
Wherein, theprocessor 601 executes the computer instructions to execute the following method:
before position measurement, judging whether a position measurement condition is met; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal reports the position information last time is greater than or equal to a time length threshold value;
and if the position measurement condition is met, measuring the position of the terminal.
Optionally, the method further includes:
and determining whether the terminal is in a motion state or not through an acceleration sensor of the terminal.
Optionally, the determining, by the acceleration sensor of the terminal, whether the terminal is in a motion state includes:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
Optionally, the time length from the time when the terminal last reported the location information at the current time is greater than or equal to the time length threshold includes:
the time length from the current time to the time when the terminal reports the position information last time is larger than or equal to the time length threshold value, and the period when the terminal reports the position information is larger than or equal to the period threshold value.
Optionally, after measuring the position of the terminal, the method further includes:
judging whether the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to a distance threshold value or not;
and if the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to the distance threshold, reporting the measured position information to the server.
An embodiment of the present invention further provides a storage medium, where instructions in the storage medium, when executed by a processor of a terminal, enable the terminal to perform a position measurement method, where the method includes:
before position measurement, judging whether a position measurement condition is met; the position measurement conditions include: the terminal is in a motion state, and/or the time length from the current time to the time when the terminal reports the position information last time is greater than or equal to a time length threshold value;
and if the position measurement condition is met, measuring the position of the terminal.
Optionally, the method further includes:
and determining whether the terminal is in a motion state or not through an acceleration sensor of the terminal.
Optionally, the determining, by the acceleration sensor of the terminal, whether the terminal is in a motion state includes:
judging whether the accelerations of the acceleration sensor in three directions are all kept unchanged;
if the accelerations in the three directions of the acceleration sensor are all kept unchanged, the terminal is in a static state;
and if the acceleration of any one direction of the accelerations of the acceleration sensor in the three directions changes, the terminal is in a motion state.
Optionally, the time length from the time when the terminal last reported the location information at the current time is greater than or equal to the time length threshold includes:
the time length from the current time to the time when the terminal reports the position information last time is larger than or equal to the time length threshold value, and the period when the terminal reports the position information is larger than or equal to the period threshold value.
Optionally, after measuring the position of the terminal, the method further includes:
judging whether the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to a distance threshold value or not;
and if the distance between the current position and the historical position of the terminal when reporting the position information last time is larger than or equal to the distance threshold, reporting the measured position information to the server.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.