Package org.ka2ddo.gps
Class GPSParser
java.lang.Object
org.ka2ddo.gps.GPSParser
- All Implemented Interfaces:
DebugCtl.DbgListener
This singleton functor class collects GPS data from GPS data sources and accumulates current
position data for use by other parts of the application.
- Author:
- Andrew Pavlin, KA2DDO
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
parseNMEA0183DataLine
(String line, GpsFix fix, SatelliteCatalog satCatalog, String source) Parse an NMEA-0183 standard data sentence into GPS data structure values.static boolean
registerSentenceParser
(String sentenceName, GPSSentenceParser parser) Register a parser for a particular NMEA-0183 sentence.void
Specify if a specific category of debug messages should be printed out.protected static String[]
This is a more optimized version of String.split() that doesn't require compiling and evaluating regular expression patterns to do it, thereby saving chunks of transient heap (and probably some CPU time as well).static boolean
unregisterSentenceParser
(String sentenceName) Unregister a parser for a particular NMEA-0183 sentence.
-
Method Details
-
setDebug
Specify if a specific category of debug messages should be printed out.- Specified by:
setDebug
in interfaceDebugCtl.DbgListener
- Parameters:
categoryName
- String name of category to enable debug logging forsetting
- boolean true or false to enable or disable debugging this category
-
parseNMEA0183DataLine
public static Object parseNMEA0183DataLine(String line, GpsFix fix, SatelliteCatalog satCatalog, String source) Parse an NMEA-0183 standard data sentence into GPS data structure values.- Parameters:
line
- String line to parsefix
- 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 allocatedsource
- callsign of source (used only for error messages)- Returns:
- populated data structure if valid sentence parsed, "ASTRAL" if the sentence was a DeLorme TripMate trying to initialize, or null if parse failed
-
registerSentenceParser
Register a parser for a particular NMEA-0183 sentence.- Parameters:
sentenceName
- String sentence name, starting with the '$' character and ending just before the delimiting comma; if multiple constellations are to be supported by a parser, the same parser must be registered for each variant, i.e., $GPTXT and $GATXT.parser
- GPSSentenceParser instance to call for the specified sentence name- Returns:
- whatever value the parser chooses to return
-
unregisterSentenceParser
Unregister a parser for a particular NMEA-0183 sentence.- Parameters:
sentenceName
- String sentence name, starting with the '$' character and ending just before the delimiting comma; if multiple constellations are to be supported by a parser, the same parser must be registered for each variant, i.e., $GPTXT and $GATXT.- Returns:
- whatever value the parser chooses to return
-
split
This is a more optimized version of String.split() that doesn't require compiling and evaluating regular expression patterns to do it, thereby saving chunks of transient heap (and probably some CPU time as well).- Parameters:
line
- the String to split at occurrences of the separatorseparator
- the char delimiting substrings of the line- Returns:
- array of Strings split at the various points the separator appears
-