lejos.gps
Class NMEASentence

java.lang.Object
  extended by lejos.gps.NMEASentence
Direct Known Subclasses:
GGASentence, GSASentence, GSVSentence, RMCSentence, VTGSentence

public abstract class NMEASentence
extends Object

Class designed to manage all NMEA Sentence. GGA and RMC Sentence needs to validate data. This class has methods to validate received data

Author:
BB

Field Summary
protected  String nmeaSentence
           
protected  StringTokenizer st
           
 
Constructor Summary
NMEASentence()
           
 
Method Summary
protected  void checkRefresh()
          This method is called by all the getter methods.
protected  double degreesMinToDegrees(String dd_mm)
          Any GPS Receiver gives Lat/Lon data in the following way: http://www.gpsinformation.org/dale/nmea.htm http://www.teletype.com/pages/support/Documentation/RMC_log_info.htm 4807.038,N Latitude 48 deg 07.038' N 01131.000,E Longitude 11 deg 31.000' E This data is necessary to convert to Decimal Degrees.
abstract  String getHeader()
          Retrieve the header constant for this sentence.
 long getTimeStamp()
          This method returns the system time at which the data for the NMEA Sentence was collected.
static boolean isValid(String sentence)
          Return if your NMEA Sentence is valid or not
protected abstract  void parse(String sentence)
          Abstract method to parse out all relevant data from the nmeaSentence.
 void setSentence(String sentence)
          Set a new nmea sentence into the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nmeaSentence

protected String nmeaSentence

st

protected StringTokenizer st
Constructor Detail

NMEASentence

public NMEASentence()
Method Detail

getHeader

public abstract String getHeader()
Retrieve the header constant for this sentence.

Returns:
The NMEA header string ($GPGGA, $GPVTG, etc...)

setSentence

public void setSentence(String sentence)
Set a new nmea sentence into the object

Parameters:
sentence -

getTimeStamp

public long getTimeStamp()
This method returns the system time at which the data for the NMEA Sentence was collected. It uses System.currentTimeMillis() to create the time stamp. Note: It might seem strange not to use the satellite time to time-stamp the data, but in fact the javax.microedition.location API calls for the system time.

Returns:
system time when the data was collected

checkRefresh

protected void checkRefresh()
This method is called by all the getter methods. It checks if a new sentence has been received since the last call. It sets nmeaSentence to null to act as flag for when method called again.


parse

protected abstract void parse(String sentence)
Abstract method to parse out all relevant data from the nmeaSentence.


isValid

public static boolean isValid(String sentence)
Return if your NMEA Sentence is valid or not

Parameters:
sentence - the NMEA sentence
Returns:
true iff the NMEA Sentence is true

degreesMinToDegrees

protected double degreesMinToDegrees(String dd_mm)
Any GPS Receiver gives Lat/Lon data in the following way: http://www.gpsinformation.org/dale/nmea.htm http://www.teletype.com/pages/support/Documentation/RMC_log_info.htm 4807.038,N Latitude 48 deg 07.038' N 01131.000,E Longitude 11 deg 31.000' E This data is necessary to convert to Decimal Degrees. Latitude values has the range: -90 <-> 90 Longitude values has the range: -180 <-> 180

Parameters:
dd_mm - the day and month
Returns:
the decimal degrees