lejos.gps
Class GPS

java.lang.Object
  extended by java.lang.Thread
      extended by lejos.gps.SimpleGPS
          extended by lejos.gps.GPS
All Implemented Interfaces:
Runnable

public class GPS
extends SimpleGPS

This class manages a data received from a GPS Device. GPS Class manages the following NMEA Sentences: GPRMC GPGSV GPGSA GPGGA (superclass) GPVTG (superclass)

Author:
BB, Juan Antonio Brenha Moral

Field Summary
 
Fields inherited from class lejos.gps.SimpleGPS
errors, ggaSentence, listeners, vtgSentence
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GPS(InputStream in)
          The constructor.
 
Method Summary
 float getCompassDegrees()
          Return Compass Degrees in a range: 0.0-359.9
 Date getDate()
          Return a Date Object with data from GGA and RMC NMEA Sentence
 Satellite getSatellite(int index)
          Get NMEA Satellite.
 int getSatellitesInView()
          The satellites in view is a list of satellites the GPS could theoretically connect to (i.e.
 int getSatellitesTracked()
          Returns the number of satellites being tracked to determine the coordinates.
protected  void sentenceChooser(String token, String s)
          Internal helper method to aid in the subclass architecture.
 
Methods inherited from class lejos.gps.SimpleGPS
addListener, close, getAltitude, getCourse, getFixMode, getFixType, getHDOP, getLatitude, getLatitudeDirection, getLongitude, getLongitudeDirection, getPDOP, getPRN, getSelectionType, getSpeed, getTimeStamp, getVDOP, notifyListeners, removeListener, run
 
Methods inherited from class java.lang.Thread
currentThread, getPriority, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, setDaemon, setPriority, sleep, start, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPS

public GPS(InputStream in)
The constructor. It needs an InputStream

Parameters:
in - An input stream from the GPS receiver
Method Detail

getCompassDegrees

public float getCompassDegrees()
Return Compass Degrees in a range: 0.0-359.9

Returns:
the compass degrees

getDate

public Date getDate()
Return a Date Object with data from GGA and RMC NMEA Sentence

Returns:
the date

getSatellite

public Satellite getSatellite(int index)
Get NMEA Satellite. The satellite list is retrieved from the almanac data. Satellites are ordered by their elevation: highest elevation (index 0) -> lowest elevation.

Parameters:
index - the satellite index
Returns:
the NMEASaltellite object for the selected satellite

getSatellitesTracked

public int getSatellitesTracked()
Returns the number of satellites being tracked to determine the coordinates. This method overwrites the superclass method and returns the number from the GSV sentence.

Overrides:
getSatellitesTracked in class SimpleGPS
Returns:
Number of satellites e.g. 8

getSatellitesInView

public int getSatellitesInView()
The satellites in view is a list of satellites the GPS could theoretically connect to (i.e. satellites that are not over the earth's horizon). The getSatellitesInView() method will always return an equal or greater number than getSatellitesTracked().

Returns:
Number of satellites e.g. 8

sentenceChooser

protected void sentenceChooser(String token,
                               String s)
Internal helper method to aid in the subclass architecture. Overwrites the superclass method and calls it internally.

Overrides:
sentenceChooser in class SimpleGPS
Parameters:
token -
s -