public class GenericGPS extends java.lang.Object implements SerialSensor
Modifier and Type | Field and Description |
---|---|
private static int |
DATA_RATE |
private java.time.LocalDateTime |
date |
private GGASentence |
ggaSentence |
private GSASentence |
gsaSentence |
private GSVSentence |
gsvSentence |
private java.io.BufferedReader |
input |
private java.io.OutputStream |
output |
private RMCSentence |
rmcSentence |
(package private) SerialPort |
serialPort |
private static int |
TIME_OUT |
private java.lang.String |
USBPort |
private VTGSentence |
vtgSentence |
Constructor and Description |
---|
GenericGPS(java.lang.String USBPort) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This should be called when you stop using the port.
|
float |
getAltitude()
The altitude above mean sea level
|
float |
getCompassDegrees()
Return Compass Degrees
in a range: 0.0-359.9
|
float |
getCourse()
Get the course heading of the GPS unit.
|
java.time.LocalDateTime |
getDate()
Return a Date Object with data from GGA and RMC NMEA Sentence
|
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
|
float |
getPDOP()
Get the 3D Position Dilution of Precision (PDOP).
|
int[] |
getPRN()
Get an Array of Pseudo-Random Noise codes (PRN).
|
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.
|
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).
|
void |
init() |
protected void |
sentenceChooser(java.lang.String header,
java.lang.String s)
Internal helper method to aid in the subclass architecture.
|
void |
serialEvent(SerialPortEvent oEvent)
Handle an event on the serial port.
|
private void |
setPortProperty() |
private void |
updateDate()
Update Date values
|
private void |
updateTime()
Update Time values
|
private java.io.BufferedReader input
private java.io.OutputStream output
private static final int TIME_OUT
private static final int DATA_RATE
SerialPort serialPort
private final java.lang.String USBPort
private GGASentence ggaSentence
private VTGSentence vtgSentence
private GSASentence gsaSentence
private RMCSentence rmcSentence
private GSVSentence gsvSentence
private java.time.LocalDateTime date
private void setPortProperty()
public void init() throws SerialServiceException
init
in interface SerialSensor
SerialServiceException
public void close()
close
in interface SerialSensor
public void serialEvent(SerialPortEvent oEvent)
protected void sentenceChooser(java.lang.String header, java.lang.String s)
header
- s
- public 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 float getCompassDegrees()
public java.time.LocalDateTime getDate()
private void updateTime()
private void updateDate()
public Satellite getSatellite(int index)
index
- the satellite indexpublic int getSatellitesInView()