Class NmeaParser

java.lang.Object
org.openstreetmap.josm.io.nmea.NmeaParser

public class NmeaParser extends 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
  • Field Details

  • Constructor Details

    • NmeaParser

      public NmeaParser()
      Constructs a new NmeaParser
  • Method Details

    • getParserUnknown

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

      Number of empty coordinates
      Returns:
      the number of coordinates which have been zero
    • 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

      List of collected coordinates When parsing a stream the last entry may be still incomplete
      Returns:
      the collection of points collected
    • 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
      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(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(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(String ns, String ew, String dlat, String dlon)