public class SimpleGPS
extends java.lang.Thread
This class is primarily for use by the javax.microedition.location package. The preferred class to use for obtaining GPS data is the GPS class.
Modifier and Type | Field and Description |
---|---|
private boolean |
close |
protected GGASentence |
ggaSentence |
protected GSASentence |
gsaSentence |
private java.io.InputStream |
in |
private static java.util.ArrayList<GPSListener> |
listeners |
protected VTGSentence |
vtgSentence |
Constructor and Description |
---|
SimpleGPS(java.io.InputStream in)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
addListener(GPSListener listener)
add a listener to manage events with GPS
|
void |
close()
Method used to close connection.
|
float |
getAltitude()
The altitude above mean sea level
|
float |
getCourse()
Get the course heading of the GPS unit.
|
int |
getFixMode()
Fix quality:
0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning) (2.3 feature)
7 = Manual input mode
8 = Simulation mode
|
int |
getFixType()
3D fix - values include:
1 = no fix
2 = 2D fix
3 = 3D fix
|
float |
getHDOP()
Get the Horizontal Dilution of Precision (HDOP).
|
double |
getLatitude()
Get Latitude
|
char |
getLatitudeDirection()
Get Latitude Direction
|
double |
getLongitude()
Get Longitude
|
char |
getLongitudeDirection()
Get Longitude Direction
|
private java.lang.String |
getNextString()
Pulls the next NMEA sentence as a string
|
float |
getPDOP()
Get the 3D Position Dilution of Precision (PDOP).
|
int[] |
getPRN()
Get an Array of Pseudo-Random Noise codes (PRN).
|
int |
getSatellitesTracked()
Returns the number of satellites being tracked to
determine the coordinates.
|
java.lang.String |
getSelectionType()
Selection type of 2D or 3D fix
'M' = manual
'A' = automatic
|
float |
getSpeed()
Get speed in kilometers per hour
|
int |
getTimeStamp()
Get the last time stamp from the satellite for GGA sentence.
|
float |
getVDOP()
Get the Vertical Dilution of Precision (VDOP).
|
protected static void |
notifyListeners(NMEASentence sen) |
static void |
removeListener(GPSListener listener)
Remove a listener
|
void |
run()
Keeps reading sentences from GPS receiver stream and extracting data.
|
protected void |
sentenceChooser(java.lang.String header,
java.lang.String s)
Internal helper method to aid in the subclass architecture.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private java.io.InputStream in
protected GGASentence ggaSentence
protected VTGSentence vtgSentence
protected GSASentence gsaSentence
private boolean close
private static java.util.ArrayList<GPSListener> listeners
public SimpleGPS(java.io.InputStream in)
in
- An input stream from the GPS receiverpublic double getLatitude()
public char getLatitudeDirection()
public double getLongitude()
public char getLongitudeDirection()
public float getAltitude()
public int getSatellitesTracked()
public int getFixMode()
public int getTimeStamp()
public float getSpeed()
public float getCourse()
public java.lang.String getSelectionType()
public int getFixType()
public int[] getPRN()
public float getPDOP()
public float getHDOP()
public float getVDOP()
public void close() throws java.io.IOException
java.io.IOException
protected static void notifyListeners(NMEASentence sen)
public static void addListener(GPSListener listener)
listener
- public static void removeListener(GPSListener listener)
listener
- public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
private java.lang.String getNextString()
protected void sentenceChooser(java.lang.String header, java.lang.String s)
header
- s
-