Class NmeaParser


  • public class NmeaParser
    extends java.lang.Object
    Parses NMEA 0183 data. Based on information from https://gpsd.gitlab.io/gpsd. NMEA data is in printable ASCII form and may include information such as position, speed, depth, frequency allocation, etc. Typical messages might be 11 to a maximum of 79 characters in length. NMEA standard aims to support one-way serial data transmission from a single "talker" to one or more "listeners". The type of talker is identified by a 2-character mnemonic. NMEA information is encoded through a list of "sentences".
    Since:
    18787
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  NmeaParser.GGA
      Global Positioning System Fix Data.
      (package private) static class  NmeaParser.GLL
      Geographic Position - Latitude/Longitude.
      (package private) static class  NmeaParser.GSA
      GNSS DOP and Active Satellites.
      (package private) static class  NmeaParser.GST
      GST - GNSS Pseudorange Noise Statistics
      (package private) static class  NmeaParser.RMC
      Recommended Minimum Specific GNSS Data.
      (package private) static class  NmeaParser.VTG
      Course Over Ground and Ground Speed.
    • Constructor Summary

      Constructors 
      Constructor Description
      NmeaParser()
      Constructs a new NmeaParser
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dropOldWaypoints()
      Get rid of older data no longer needed, drops everything except current coordinate
      java.util.Collection<WayPoint> getAndDropWaypoints()
      Return list of collected coordinates and drop old data When parsing a stream the last entry may be still incomplete and usually will not be dropped
      int getParserChecksumErrors()
      Number of checksum errors
      int getParserMalformed()
      Number of malformed errors
      int getParserUnknown()
      Number of unknown sentences
      int getParserZeroCoordinates()
      Number of empty coordinates
      int getSuccess()
      Number of successful coordinates
      java.util.Collection<WayPoint> getWaypoints()
      List of collected coordinates When parsing a stream the last entry may be still incomplete
      (package private) static boolean isSentence​(java.lang.String address, Sentence formatter)
      Determines if the given address denotes the given NMEA sentence formatter of a known talker.
      private static LatLon parseLatLon​(java.lang.String ns, java.lang.String ew, java.lang.String dlat, java.lang.String dlon)  
      boolean parseNMEASentence​(java.lang.String s)
      Parses split up sentences into WayPoints which are stored in the collection in the NMEAParserState object.
      private java.time.Instant readTime​(java.lang.String p)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NmeaParser

        public NmeaParser()
        Constructs a new NmeaParser
    • Method Detail

      • getParserUnknown

        public int getParserUnknown()
        Number of unknown sentences
        Returns:
        the number of unknown sentences encountered
      • getParserZeroCoordinates

        public int getParserZeroCoordinates()
        Number of empty coordinates
        Returns:
        the number of coordinates which have been zero
      • getParserChecksumErrors

        public int getParserChecksumErrors()
        Number of checksum errors
        Returns:
        the number of sentences with checksum errors
      • getParserMalformed

        public int getParserMalformed()
        Number of malformed errors
        Returns:
        the number of malformed sentences
      • getSuccess

        public int getSuccess()
        Number of successful coordinates
        Returns:
        the number of successfully read coordinates
      • getWaypoints

        public java.util.Collection<WayPointgetWaypoints()
        List of collected coordinates When parsing a stream the last entry may be still incomplete
        Returns:
        the collection of points collected
      • getAndDropWaypoints

        public java.util.Collection<WayPointgetAndDropWaypoints()
        Return list of collected coordinates and drop old data When parsing a stream the last entry may be still incomplete and usually will not be dropped
        Returns:
        the collection of points collected
      • dropOldWaypoints

        public void dropOldWaypoints()
        Get rid of older data no longer needed, drops everything except current coordinate
      • isSentence

        static boolean isSentence​(java.lang.String address,
                                  Sentence formatter)
        Determines if the given address denotes the given NMEA sentence formatter of a known talker.
        Parameters:
        address - first tag of an NMEA sentence
        formatter - sentence formatter mnemonic code
        Returns:
        true if the address denotes the given NMEA sentence formatter of a known talker
      • parseNMEASentence

        public boolean parseNMEASentence​(java.lang.String s)
                                  throws IllegalDataException
        Parses split up sentences into WayPoints which are stored in the collection in the NMEAParserState object.
        Parameters:
        s - data to parse
        Returns:
        true if the input made sense, false otherwise.
        Throws:
        IllegalDataException
      • parseLatLon

        private static LatLon parseLatLon​(java.lang.String ns,
                                          java.lang.String ew,
                                          java.lang.String dlat,
                                          java.lang.String dlon)