public class GPSDistributor
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addGpsDataListener(GpsDataListener l)
Register to be informed when local GPS position data is updated.
|
static void |
addGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
Register to be informed when raw NMEA-0183 data is received.
|
static void |
appendToGpsLog(java.lang.String logMsg)
Append the specified log message to the current GPS log file (if logging is running).
|
java.lang.Object |
extractGpsdJsonInfo(java.util.Map<java.lang.String,java.lang.Object> jsonMsg,
boolean isLocal,
java.lang.String source)
Decode a JSON message from GPSD and update the appropriate GPS state objects.
|
static GpsFix |
getCurrentFix()
get the current GPS fix information of the local station.
|
static GPSDistributor |
getInstance()
Get a nonshareable instance of GPSDistributor.
|
static float |
getLocalBearingDegN(int stepBack)
Returns the current direction of motion in degrees relative to True North.
|
static float |
getLocalSpeedKnots()
Return the current movement speed of the local station in knots (nautical miles per hour).
|
static GpsLogMode |
getLogFormat()
Get the log file format that will be used for logging GPS position sentences
(assuming logging is turned on).
|
static GpsFix |
getNamedGpsFix(java.lang.String name)
Get the current GPS fix information for the named source.
|
static SatelliteCatalog |
getNamedSatCatalog(java.lang.String name)
Get the current GPS satellite catalog for the named source.
|
static java.lang.String[] |
getNamedSources()
Get the names for the currently known named remote GPS receivers.
|
static SatelliteCatalog |
getSatCatalog()
Get the current state of the GPS satellite constellation.
|
static java.util.ArrayList<GpsFix> |
getShortTermHistory()
Get a copy of the recent position history of this station.
|
static boolean |
isGpsDataListener(GpsDataListener l)
Test if specified listener is currently registered to be informed when local GPS position data is updated.
|
static boolean |
isGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
Test if specified listener is currently registered to be informed when local GPS position data is updated.
|
java.lang.Object |
parseGpsdJsonLine(java.util.Map<java.lang.String,java.lang.Object> jsonMsg,
GpsFix fix,
SatelliteCatalog satCatalog)
Decode a JSON message from GPSD and update the appropriate GPS state objects.
|
java.lang.Object |
parseNMEA0183DataLine(java.lang.String line,
PortConnector connector,
boolean isLocal,
java.lang.String source)
Parse an NMEA-0183 standard data sentence into GPS data structure values.
|
static void |
removeGpsDataListener(GpsDataListener l)
Stop being informed when GPS data is updated.
|
static void |
removeGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
Stop being informed when raw NMEA-0183 data is received.
|
static void |
setLogFormat(GpsLogMode logFormat)
Set the log file format that will be used for logging GPS position sentences
(assuming logging is turned on).
|
public static GPSDistributor getInstance()
public static GpsLogMode getLogFormat()
public static void setLogFormat(GpsLogMode logFormat)
logFormat
- GpsLogMode used for loggingpublic java.lang.Object parseNMEA0183DataLine(java.lang.String line, PortConnector connector, boolean isLocal, java.lang.String source)
GpsRawNMEA0183Listener
s.line
- String line to parseconnector
- PortConnector that received the sentenceisLocal
- boolean true if this is from this station's own GPS, not from some other stationsource
- callsign of source of remote GPSpublic java.lang.Object extractGpsdJsonInfo(java.util.Map<java.lang.String,java.lang.Object> jsonMsg, boolean isLocal, java.lang.String source)
jsonMsg
- Map<String,Object> as returned by Json.decodeJSON()isLocal
- boolean true if this is for the GPS local to this station (not a remote GPS)source
- String name of source, used for identifying specific remote GPS portsJson.decodeJSON(java.io.Reader, org.ka2ddo.yaac.io.PortConnector)
public java.lang.Object parseGpsdJsonLine(java.util.Map<java.lang.String,java.lang.Object> jsonMsg, GpsFix fix, SatelliteCatalog satCatalog)
jsonMsg
- Map<String,Object> as returned by Json.decodeJSON()fix
- GpsFix data structure to populate, or null if a new one should be allocatedsatCatalog
- SatelliteCatalog data structure to populate, or null if a new one should be allocatedJson.decodeJSON(java.io.Reader, org.ka2ddo.yaac.io.PortConnector)
public static void addGpsDataListener(GpsDataListener l)
l
- GpsDataListener to call when the GPS data is updatedpublic static void removeGpsDataListener(GpsDataListener l)
l
- GpsDataListener to unregisterpublic static boolean isGpsDataListener(GpsDataListener l)
l
- GpsDataListener to test for registrationpublic static void addGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
l
- GpsRawNMEA0183Listener to call when raw NMEA-0183 data is receivedpublic static void removeGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
l
- GpsRawNMEA0183Listener to unregisterpublic static boolean isGpsRawNMEA0183Listener(GpsRawNMEA0183Listener l)
l
- GpsRawNMEA0183Listener to test for registrationpublic static GpsFix getCurrentFix()
public static java.lang.String[] getNamedSources()
public static GpsFix getNamedGpsFix(java.lang.String name)
name
- String name of sourcepublic static float getLocalSpeedKnots()
public static float getLocalBearingDegN(int stepBack)
stepBack
- number of position samples to use to get direction (larger numbers average out motion more)public static SatelliteCatalog getSatCatalog()
public static SatelliteCatalog getNamedSatCatalog(java.lang.String name)
name
- String name of sourcepublic static java.util.ArrayList<GpsFix> getShortTermHistory()
public static void appendToGpsLog(java.lang.String logMsg)
logMsg
- String to log in GPS log