The present invention relates to the field of GPS location technologies, and in particular, to a method and an apparatus for locating a terminal device.
Global positioning system (Global Positioning System, GPS) technologies are getting mature, and more and more terminal devices having GPS functions are available on the market. For a conventional GPS, the time to first locate (cold start) normally takes several minutes, or even more in areas with poor signals, which seriously affects locating efficiency.
The prior art compensates for the weakness of long time to first locate of a conventional GPS by using an assisted global positioning system (Assisted GPS, AGPS), where ephemeris data is obtained by using an AGPS server. When a terminal device starts GPS, ephemeris data about the sky above a current location of the terminal device is obtained from an AGPS server, and then a corresponding satellite is quickly found according to the ephemeris data, thereby implementing locating by signals received from the satellites. In the AGPS, only satellites above the terminal device are searched, which reduces the search scope and effectively shortens the locating time. However, it still takes several seconds for the conventional AGPS to perform locating, which still fails to meet user requirements of quick locating.
Embodiments of the present invention provide a method for locating a terminal device to solve the problem of long time consumed for locating by a GPS in a terminal device in the prior art.
The embodiments of the present invention are implemented as follows: A method for locating a terminal device is provided, where the method includes:
The embodiments of the present invention further provide an apparatus for locating a terminal device, where the apparatus includes:
Embodiments of the present invention further provide an apparatus for locating a terminal device, where the apparatus includes:
Embodiments of the present invention further provide a terminal device, where the terminal device includes the apparatus for locating a terminal device described above.
According to the above technical solutions, in the embodiments of the present invention, ephemeris data is pre-stored before a terminal device starts GPS, so that after the terminal device starts GPS, it is no longer necessary to obtain ephemeris data, and corresponding satellites may be quickly found according to the stored ephemeris data to implement locating. Compared with the prior art, the embodiments of the present invention require no time for obtaining ephemeris data during a locating process, which obviously accelerates locating and shortens locating time, thereby implementing quick responding to a user's GPS request and greatly improving user experience.
To illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly describes the accompanying drawings required for describing the embodiments or the prior art. Apparently, the accompanying drawings in the following description merely show some embodiments of the present invention, and persons of ordinary skill in the art can derive other drawings from these accompanying drawings without creative efforts.
To make the objective, technical solution, and advantage of the present invention more comprehensible, the following describes the present invention in further detail with reference to the accompanying drawings and embodiments. It is understandable that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
In order to illustrate the technical solutions according to the present invention, illustration is provided below through specific embodiments.
In step S101, information about starting a global positioning system is received.
In this embodiment, the global positioning system includes but is not limited to a Galileo system and a BeiDou (Compass) system. The information includes but is not limited to a startup instruction sent by a user or trigger information generated at preset startup time.
In step S102, a signal of a corresponding satellite currently in the sky is obtained according to pre-stored ephemeris data to implement locating.
In this embodiment, ephemeris data is pre-stored before the GPS is started. After the GPS is started, satellites (at least three satellites) currently in the sky corresponding to the terminal device are quickly determined according to pre-stored latest ephemeris data and signals of the satellites are obtained to implement locating. The ephemeris data includes satellite numbers (at least three), parameters used for describing satellite locations and speeds, and orbit information about satellite movements. For a satellite, there is a mapping relationship between the satellite number, the parameters describing the satellite location and speed, and the orbit information about satellite movements. It should be noted that in this embodiment, the pre-stored ephemeris data is ephemeris data about the sky above a current location (which is normally a location of a base station nearest to the terminal device) of the terminal device.
A specific process of obtaining a signal of a corresponding satellite currently in the sky according to the ephemeris data to implement locating may be implemented by using the prior art. For example, the terminal device determines a corresponding satellite currently in the sky according to the ephemeris data, receives a signal of the satellite, demodulates the signal, calculates a pseudo distance between the terminal device and the satellite according to the signal, and sends the calculated pseudo distance to a location server; the location server calculates an exact location of the terminal device according to the pseudo distance together with other information (such as information about differential GPS benchmark stations), and sends the exact location to the terminal device.
According to a preferred embodiment of the present invention, before the step of receiving information about starting a global positioning system, the method further includes:
In this embodiment, ephemeris data is obtained at a preset time interval. For example, ephemeris data is obtained every hour. When the obtained ephemeris data is stored, all obtained ephemeris data may be stored or only latest ephemeris data is stored. All obtained ephemeris data is stored for the purpose of comparing latest ephemeris data with historical ephemeris data to facilitate subsequent analysis. For example, a current location (such as Shanghai or Beijing) of a terminal device is determined according to the difference between ephemeris data. The latest ephemeris data is stored for the purpose of saving a storage space of the terminal device.
It should be noted that in this embodiment, the obtained ephemeris data is ephemeris data about the sky above the current location of the terminal device. Location information of the terminal device may be obtained by using the prior art. For example, a mobile terminal sends a request for obtaining ephemeris data to an AGPS server through a base station; the AGPS determines a current location of the mobile terminal according to longitude and latitude information recorded in the base station, that is, uses a location of the base station as the current location (such as Shanghai or Beijing) of the terminal device, and sends ephemeris data about the sky above the current location of the mobile terminal (for example, ephemeris data about the Shanghai area or ephemeris data about the Beijing area) to the terminal device.
In this embodiment, ephemeris data is obtained at a time interval instead of at fixed time because if fixed time is set, attention needs to be paid to current time all the time, the current time and the fixed time are compared, and ephemeris data is obtained when the current time is equal to the fixed time. However, when the time interval is set, it is not necessary to pay attention to the current time, and ephemeris data is obtained when the set time interval expires.
In the embodiment of the present invention, before a terminal device starts GPS, ephemeris data is downloaded and stored in the terminal device at a preset time interval, so that after the terminal device starts GPS, corresponding satellites may be quickly determined according to the stored latest ephemeris data to implement locating. Compared with the prior art, in the embodiment of the present invention, locating is obviously accelerated and the locating time is shortened, thereby quick responding to a user's GPS request is implemented and user experience is greatly improved.
In step S201, when a terminal device is not in a sleep or standby state, whether a preset time interval expires is determined; if a determining result is “yes”, step S202 is executed; and if the determining result is “no”, waiting continues until the preset time interval expires.
In step S202, if the preset time interval expires, ephemeris data is obtained and the obtained ephemeris data is stored.
In step S203, after information indicating that a user starts a global positioning system GPS of the terminal device is received, a signal of a corresponding satellite currently in the sky is obtained according to the stored latest ephemeris data to implement locating. According to another preferred embodiment of the present invention, to save data traffic and avoid power consumption of an application, the method further includes:
According to another preferred embodiment of the present invention, the method further includes:
In this embodiment, to ensure that ephemeris data is timely updated, time in which the terminal device is in the sleep or standby state needs to be included in the time interval.
For example, in the above process, assume that a time interval is set to 60 minutes. Before the terminal device enters the sleep or standby state, ephemeris data is obtained last time at 7:00. At 7:20, the terminal device enters the sleep or standby state and the sleep or standby time is 30 minutes. After 30 minutes, the terminal device is started. Because the time when the terminal device is in the sleep or standby state needs to be included, the first time interval is (7:20−7:00)+30=50 minutes, and time for obtaining ephemeris data next time is modified to (60−50)=10 minutes later (initial time for obtaining ephemeris data next time is 60 minutes later).
According to another preferred embodiment of the present invention, if the preset time interval expires, the obtaining the ephemeris data specifically further includes:
The specific time range may be set according to the user's actual situation, for example, from 00:00 to 06:00.
The above process is described by using an example as follows:
Assume that a time interval for obtaining ephemeris data is 60 minutes and a specific time range is from 00:00 to 06:00. At 00:00 of system time, because ephemeris data is obtained last time 60 minutes earlier (23:00), according to the preset time interval, the terminal device should obtain ephemeris data at 00:00. However, because the specific time range 00:00 to 06:00 is set in advance (the specific time range is set according to daily schedules of common people, and according to a relevant questionnaire survey, users are least probable to use the GPS for locating from 00:00 to 06:00), it is necessary to determine whether the user sets not to obtain ephemeris data within the specific time range. If yes, ephemeris data will not be obtained until 06:00 (because the second time interval (06:00−23:00=420 minutes) is greater than the preset time interval; otherwise, ephemeris data is directly obtained.
Preferably, this embodiment further includes:
For example, assume that: a time interval for obtaining ephemeris data is 60 minutes, time when ephemeris data is obtained last time is 23:50, and a specific time range is 00:00 to 00:30. At 00:30 of system time, a second time interval is obtained, where the second time interval is (00:00−23:50)+30=40 minutes, which is smaller than the preset time interval; time for obtaining ephemeris data next time is modified according to the second time interval, where the time for obtaining ephemeris data next time is a difference between the preset time interval 60 minutes and the second time interval, that is 60−40=20 minutes later (initial time for obtaining ephemeris data next time is 60 minutes later), and ephemeris data will be obtained at 00:50.
It should be noted that when the specific time range is greater than or equal to the preset time interval and it is set not to obtain ephemeris data within the specific time range, ephemeris data is obtained at a moment when the specific time range ends.
To enhance practicability of the present invention, save data traffic, and avoid unnecessary power consumption by an application for obtaining ephemeris data, in embodiments of the present invention, time for obtaining ephemeris data is limited or modified according to various aspects (for example, when a terminal device is in a sleep or standby state, or a specific time range), thereby accomplishing a purpose of saving resources and timely updating ephemeris data at the same time.
The apparatus for locating a terminal device may run on a software unit, a hardware unit, or a unit combining software and hardware in various terminal devices (such as a mobile phone and an IPAD).
The apparatus 3 for locating a terminal device includes an information receiving unit 31 and a locating unit 33 whose specific functions are as follows:
The information receiving unit 31 is configured to receive information about starting a global positioning system.
The locating unit 32 is configured to: after the information receiving unit 31 receives the information about starting the global positioning system, obtain a signal of a corresponding satellite currently in the sky according to pre-stored ephemeris data to implement locating.
Further, the apparatus further includes:
Further, the ephemeris data obtaining unit 33 includes:
Further, the ephemeris data obtaining unit 33 further includes:
Further, the obtaining module 332 includes:
The apparatus for locating a terminal device according to this embodiment may be used in corresponding methods for locating a terminal device. Reference may be made to relevant descriptions in the embodiments of the method for locating a terminal device, and details are omitted herein.
Persons of ordinary skill in the art may understand that units and modules included in the embodiment 3 are divided according to functional logic, but are not limited to the above division as long as corresponding functions are implemented. In addition, specific names of the functional units and modules are only for differentiating from each other and are not used to limit the protection scope of the present invention.
The apparatus for locating a terminal device may run on a hardware unit in various terminal devices (such as a mobile phone and an IPAD).
The apparatus 4 for locating a terminal device includes a receiver 41 and a processor 42.
The receiver 41 is configured to receive information about starting a global positioning system.
The processor 42 is configured to: after the receiver 41 receives the information about starting the global positioning system, obtain a signal of a corresponding satellite currently in the sky according to pre-stored ephemeris data to implement locating.
Further, the processor 42 is configured to obtain ephemeris data at a preset time interval and send the obtained ephemeris data to a memory 43 for storing.
The apparatus 4 further includes:
Further, the processor 42 is configured to obtain ephemeris data at a preset time interval, which specifically is: determining whether the terminal device is in a sleep or standby state; when the terminal device is not in the sleep or standby state, determining whether the preset time interval expires; and obtaining ephemeris data when the preset time interval expires.
Further, the processor 42 is configured to determine whether the terminal device is in a sleep or standby state, which specifically is: when the terminal device is in the sleep or standby state, stopping obtaining ephemeris data, and recording time when ephemeris data is obtained last time; when the terminal device is started from the sleep or standby state, obtaining a first time interval; determining whether the first time interval is greater than or equal to the preset time interval; if yes, obtaining ephemeris data; if no, modifying time for obtaining ephemeris data next time according to the first time interval, where the modified time for obtaining ephemeris data next time is a difference between the preset time interval and the first time interval, and the first time interval is a difference between current startup time of the terminal device and time when ephemeris data is obtained last time.
Further, the processor 42 is configured to determine whether the preset time interval expires, which specifically is: when the preset time interval expires, determining whether current time for obtaining ephemeris data is within a specific time range; and if no, obtaining ephemeris data.
Further, the processor 42 is configured to determine whether the current time for obtaining ephemeris data is within a specific time range, which specifically is: when the current time for obtaining ephemeris data is within the specific time range, determining whether it is set not to obtain ephemeris data within the specific time range; and if no, obtaining ephemeris data.
Further, the processor 42 is configured to determine whether it is set not to obtain ephemeris data within the specific time range, which specifically is: when it is set not to obtain ephemeris data within the specific time range, obtaining a second time interval; when the second time interval is greater than or equal to the preset time interval, starting obtaining ephemeris data at a moment when the specific time range ends, where the second time interval is a difference between time when the specific time range ends and time when ephemeris data is obtained last time.
Further, the processor 42 is configured to determine whether it is set not to obtain ephemeris data within the specific time range, which specifically is: when it is set not to obtain ephemeris data within the specific time range, obtaining a second time interval; and when the second time interval is smaller than the preset time interval, modifying time for obtaining ephemeris data next time according to the second time interval, where the modified time for obtaining ephemeris data next time is a difference between the preset time interval and the second time interval, and the second time interval is a difference between time when the specific time range ends and time when ephemeris data is obtained last time.
The apparatus for locating a terminal device according to this embodiment may be used in corresponding methods for locating a terminal device. Reference may be made to relevant descriptions in the embodiments of the method for locating a terminal device, and details are omitted herein.
In summary, in the embodiments of the present invention, ephemeris data is pre-stored before a terminal device starts GPS, so that after the terminal device starts GPS, corresponding satellites may be quickly determined according to the stored latest ephemeris data to implement quick locating. Compared with the prior art, the embodiments of the present invention obviously accelerate locating and shorten the locating time, thereby implementing quick responding to a user's locating request during using GPS and greatly improving user experience. Furthermore, to enhance practicability of the present invention, save data traffic, and avoid unnecessary power consumption by an application for obtaining ephemeris data, in the embodiments of the present invention, time for obtaining ephemeris data is limited or modified according to various aspects (for example, when the terminal is in a sleep or standby state or in a specific time range), thereby accomplishing a purpose of saving resources and timely updating ephemeris data at the same time.
Persons of ordinary skill in the art may also understand that all or a part of the steps of the method according to the embodiments may be implemented by a program instructing relevant hardware. The program may be stored in a computer readable storage medium, and the storage medium may be a ROM/RAM, a magnetic disk, or a CD-ROM, and so on.
The foregoing descriptions are merely exemplary embodiments of the present invention, but are not intended to limit the present invention. All modifications, equivalent replacements, and improvements made without departing from the spirit and principle of the present invention shall fall within the protection scope of the present invention.
This application is a continuation of International Application No. PCT/CN2012/078052, filed on Jul. 2, 2012, which is hereby incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2012/078052 | Jul 2012 | US |
Child | 13722448 | US |