public class NmeaParser
extends java.lang.Object
| Constructor and Description |
|---|
NmeaParser() |
| Modifier and Type | Method and Description |
|---|---|
void |
addNmeaParserListener(NmeaParserListener l)
Usually called from the GUI thread.
|
void |
close()
Close() waits for the NMEA thread to stop before it closes the
port, so the NMEA thread can depend on the port being open while
it's running.
|
int |
getBaudRate() |
javax.swing.JPanel |
getConfigutron() |
java.lang.String |
getPortName() |
boolean |
isOpen() |
void |
open()
Notes about thread safety: when open() is called, it stops
the NMEA thread if it is still running by calling close().
|
static java.lang.String[] |
parseFields(java.lang.String s)
Handles the asterisk at the end.
|
void |
removeNmeaParserListener(NmeaParserListener l)
Usually called from the GUI thread.
|
void |
setPortName(java.lang.String portName)
Calls open() and close(), which do not contend with any threads.
|
void |
setSerialPortParams(int baudRate,
int dataBits,
int stopBits,
int parity)
Contends with readLine(), which is called from the NMEA thread.
|
public static java.lang.String[] parseFields(java.lang.String s)
s - public void addNmeaParserListener(NmeaParserListener l)
Usually called from the GUI thread. Contends with event dispatching, which iterates over the list, called from the NMEA thread.
l - public void close()
throws java.io.IOException
Close() waits for the NMEA thread to stop before it closes the port, so the NMEA thread can depend on the port being open while it's running.
Open() and close() are not thread-safe in general, just with respect to the NMEA thread. Both functions should be called from the same thread, usually the GUI.
java.io.IOExceptionpublic boolean isOpen()
public void open()
throws java.io.IOException
Notes about thread safety: when open() is called, it stops the NMEA thread if it is still running by calling close(). It starts the NMEA thread after setting all the parameters, so there is no chance of the thread reading an incomplete state.
Open() and close() are not thread-safe in general, just with respect to the NMEA thread. Both functions should be called from the same thread, usually the GUI.
java.io.IOExceptionpublic void removeNmeaParserListener(NmeaParserListener l)
Usually called from the GUI thread. Contends with event dispatching, which iterates over the list, called from the NMEA thread.
l - public void setPortName(java.lang.String portName)
throws java.io.IOException
Calls open() and close(), which do not contend with any threads.
portName - java.io.IOExceptionpublic void setSerialPortParams(int baudRate,
int dataBits,
int stopBits,
int parity)
throws java.io.IOException
Contends with readLine(), which is called from the NMEA thread.
baudRate - dataBits - stopBits - parity - java.io.IOExceptionpublic int getBaudRate()
public java.lang.String getPortName()
public javax.swing.JPanel getConfigutron()