Global Positioning System Reference
In-Depth Information
5. Additional features (found in many smartphones) would require more
sensors for acceleration and equilibration.
6. A more sophisticated
GPSunit
can display (digital) maps with the
trace.
Acquire Time and Place
Please execute the method
roaf.book.gps.GPSapplication.main
and
study the invoked method
gpsUnitDemo()
as you proceed.
You can
chose to comment out the method
routeTraceDemo()
.
When a GPS device is switched on, it searches for a satellite to acquire
the exact time and keeps searching for more satellites to determine its cur-
rent location. While the first GPS receivers in the early 1980s weighed
more than 20 kg and were the size of a suitcase, our
GPSunit
is virtual and
represents the location of the RO owning the unit. Time and place are pro-
vided by the RO's environment, the ROApp. The
GPSinfo
implementation
is vital since it supplies the coordinate system, universal time as well as
conversion tools. Here's a start for the new class:
public class GPSunit
{
public GPSunit( GPSinfo initialGPSinfo)
{ currentGPSinfo = initialGPSinfo.getNewGPSinfo(); }
private GPSinfo currentGPSinfo;
}
The satellite information has to be supplied at startup time. The con-
structor represents the on switch and initializes the
GPSunit
to current
time and location. The semantics indicate that the device starts up with
the
initialGPSinfo
to set the
currentGPSinfo
. The idea is to encapsulate
the
GPSinfo
implementation as a private member with one single instance
during the entire lifetime of the
GPSunit
. Whenever the unit is moved, the
instance is moved with
currentGPSinfo.move
.
The time information provided is treated a little differently. The envi-
ronmental time is defined at the construction time of the unit and is stored
as an oset to the time of the machine's operating system. The PC hard-
ware is responsible for keeping track and for changing the time; a real GPS
unit doesn't necessarily need an internal clock.
The initial design of a
GPSunit
could look like this:
+ GPSunit (GPSinfo) set place & time switch unit on
+ setGPSinfo (GPSinfo) reset place & time
+ getGPSinfo () get place & time now
+ setPosition(Position) reset place
+ setGPSdate (Date)
reset time
Search WWH ::
Custom Search