Package org.openstreetmap.josm.io.nmea
Class NmeaReader
- java.lang.Object
-
- org.openstreetmap.josm.io.nmea.NmeaReader
-
- All Implemented Interfaces:
IGpxReader
public class NmeaReader extends java.lang.Object implements IGpxReader
Reads a NMEA 0183 file. Based on information from https://gpsd.gitlab.io/gpsd. NMEA files are 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".
-
-
Field Summary
Fields Modifier and Type Field Description (package private) GpxData
data
private NmeaParser
ps
private java.io.InputStream
source
-
Constructor Summary
Constructors Constructor Description NmeaReader(java.io.InputStream source)
Constructs a newNmeaReader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GpxData
getGpxData()
Replies the GPX data.int
getNumberOfCoordinates()
Returns the number of coordinates that have been successfully read.int
getParserChecksumErrors()
Number of checksum errorsint
getParserMalformed()
Number of malformed errorsint
getParserUnknown()
Number of unknown sentencesint
getParserZeroCoordinates()
Number of empty coordinatesboolean
parse(boolean tryToFinish)
Parse the GPX data.
-
-
-
Field Detail
-
source
private final java.io.InputStream source
-
ps
private NmeaParser ps
-
-
Constructor Detail
-
NmeaReader
public NmeaReader(java.io.InputStream source) throws java.io.IOException
Constructs a newNmeaReader
- Parameters:
source
- NMEA file input stream- Throws:
java.io.IOException
- if an I/O error occurs
-
-
Method Detail
-
getParserUnknown
public int getParserUnknown()
Number of unknown sentences- Returns:
- return the number of unknown sentences encountered
-
getParserZeroCoordinates
public int getParserZeroCoordinates()
Number of empty coordinates- Returns:
- return the number of coordinates which have been zero
-
getParserChecksumErrors
public int getParserChecksumErrors()
Number of checksum errors- Returns:
- return the number of sentences with checksum errors
-
getParserMalformed
public int getParserMalformed()
Number of malformed errors- Returns:
- return the number of malformed sentences
-
getNumberOfCoordinates
public int getNumberOfCoordinates()
Description copied from interface:IGpxReader
Returns the number of coordinates that have been successfully read.- Specified by:
getNumberOfCoordinates
in interfaceIGpxReader
- Returns:
- the number of coordinates that have been successfully read
-
parse
public boolean parse(boolean tryToFinish) throws java.io.IOException
Description copied from interface:IGpxReader
Parse the GPX data.- Specified by:
parse
in interfaceIGpxReader
- Parameters:
tryToFinish
- true, if the reader should return at least part of the GPX data in case of an error.- Returns:
- true if file was properly parsed, false if there was error during parsing but some data were parsed anyway
- Throws:
java.io.IOException
- if any I/O error occurs
-
getGpxData
public GpxData getGpxData()
Description copied from interface:IGpxReader
Replies the GPX data.- Specified by:
getGpxData
in interfaceIGpxReader
- Returns:
- The GPX data
-
-