lejos.devices
Class GPS

java.lang.Object
  extended by java.lang.Thread
      extended by lejos.devices.GPS

public class GPS
extends Thread

Class to pull data from a GPS receiver

Author:
BB

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
GPS(InputStream in)
           
 
Method Summary
 void addGPSListener()
           
 float getAltitude()
          The altitude above mean sea level
 int getHeading()
          Placeholder idea: returns heading (from North) based on previous lat/long reading.
 float getLatitude()
           
 float getLongitude()
           
 byte getSatellitesTracked()
          Returns the number of satellites being tracked to determine the coordinates.
 int getSpeed()
          Placeholder idea: returns speed based on previous lat/long reading.
 int getTime()
          Returns the last time stamp retrieved from a satellite
 void run()
          Keeps reading sentences from GPS receiver stream and extracting data.
 void setOriginPoint(String longitude, String latitude)
          Placeholder Idea: Set a latitude/longitude as origin, then it will return x, y coordinates (in CM or Inches).
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

GPS

public GPS(InputStream in)
Parameters:
in - An input stream from the GPS receiver
Method Detail

getLatitude

public float getLatitude()

getLongitude

public float getLongitude()

getAltitude

public float getAltitude()
The altitude above mean sea level

Returns:
Meters above sea level e.g. 545.4

getTime

public int getTime()
Returns the last time stamp retrieved from a satellite

Returns:
The time as a UTC integer. 123519 = 12:35:19 UTC

getSatellitesTracked

public byte getSatellitesTracked()
Returns the number of satellites being tracked to determine the coordinates.

Returns:
Number of satellites e.g. 8

getHeading

public int getHeading()
Placeholder idea: returns heading (from North) based on previous lat/long reading.

Returns:
heading

getSpeed

public int getSpeed()
Placeholder idea: returns speed based on previous lat/long reading.

Returns:
speed

addGPSListener

public void addGPSListener()

setOriginPoint

public void setOriginPoint(String longitude,
                           String latitude)
Placeholder Idea: Set a latitude/longitude as origin, then it will return x, y coordinates (in CM or Inches). By default, uses first reading as origin. Need to make methods for getX() and getY(), setUnits()

Parameters:
longitude -
latitude -

run

public void run()
Keeps reading sentences from GPS receiver stream and extracting data. This is a daemon thread so when program ends it won't keep running.

Specified by:
run in class Thread