Package org.ka2ddo.yaac.io
Class AbstractGpsConnector
java.lang.Object
org.ka2ddo.ax25.Connector
org.ka2ddo.yaac.io.PortConnector
org.ka2ddo.yaac.io.AbstractGpsConnector
- All Implemented Interfaces:
Thread.UncaughtExceptionHandler
,AprsMessageListener
,ParsedAX25MessageListener
- Direct Known Subclasses:
SerialGpsConnector
public abstract class AbstractGpsConnector
extends PortConnector
implements AprsMessageListener, ParsedAX25MessageListener, Thread.UncaughtExceptionHandler
This class provides common functionality for PortConnectors that receive NMEA-0183 data from some
kind of connection to a GPS receiver.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.yaac.io.PortConnector
PortConnector.PortStatsType
Nested classes/interfaces inherited from class org.ka2ddo.ax25.Connector
Connector.ConnectorType, Connector.PortStats
-
Field Summary
Modifier and TypeFieldDescriptionprotected Thread
Pointer to consumer thread forrtQueue
.protected final GPSDistributor
Instance specific pointer to GPS parser.protected final Runnable
Runnable to extract, parse, and process incoming NMEA-0183 sentences.protected boolean
Flag indicating when traffic has been queued to the dispatch thread and not yet consumed.protected final FastBlockingQueue<String>
Queue for passing NMEA-0183 GPS sentences from interface-specific subclasses to the common parsing code in the AbstractGpsConnector superclass.Fields inherited from class org.ka2ddo.yaac.io.PortConnector
currentCfg, portConfig
Fields inherited from class org.ka2ddo.ax25.Connector
CAP_ADSB, CAP_FAST_RF_9600, CAP_FULL_DUPLEX, CAP_GPS_DATA, CAP_HF, CAP_IGATE, CAP_KENWOOD_CMD, CAP_OPENTRAC, CAP_RAW_AX25, CAP_RCV_PACKET_DATA, CAP_RF, CAP_SUBCLIENT, CAP_WAYPOINT_SENDER, CAP_WEATHER, CAP_XMT_PACKET_DATA, stats
-
Constructor Summary
ModifierConstructorDescriptionprotected
Initialize attributes of this abstract superclass. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Delivers the next message received by YAAC that is an APRS message.int
Specify what capabilities a port of this type has.void
parsedAX25MessageReceived
(byte pid, AX25Message msg) Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message.protected void
Start the thread that drains the queueprotected void
Cause the queue draining thread to shut down.final void
uncaughtException
(Thread t, Throwable e) Method invoked when the given thread terminates due to the given uncaught exception.abstract void
Transmit a line of text containing a waypoint sentence to the GPS device.Methods inherited from class org.ka2ddo.yaac.io.PortConnector
addPortEventListener, configure, createPort, fillinConfigDefaultsForType, fireFailed, fireReceiving, fireTransmitting, getBitRate, getCollectedStatsTypes, getPortConfig, getPortConnectorClass, getPortConnectorInactivityTimer, getStats, portConnectorClasses, portTypeNames, registerPortConnectorType, removePortEventListener, setPortConfig
Methods inherited from class org.ka2ddo.ax25.Connector
addFrameListener, close, finalize, fireConsumeFrame, fireConsumeFrame, getCallsign, getStats, getType, hasCapability, isOpen, removeFrameListener
-
Field Details
-
rtQueue
Queue for passing NMEA-0183 GPS sentences from interface-specific subclasses to the common parsing code in the AbstractGpsConnector superclass. -
dispatchThread
Pointer to consumer thread forrtQueue
. -
queuedButNotConsumed
protected transient boolean queuedButNotConsumedFlag indicating when traffic has been queued to the dispatch thread and not yet consumed. -
gpsDistributor
Instance specific pointer to GPS parser. -
QUEUE_READER
Runnable to extract, parse, and process incoming NMEA-0183 sentences.
-
-
Constructor Details
-
AbstractGpsConnector
protected AbstractGpsConnector()Initialize attributes of this abstract superclass.
-
-
Method Details
-
startQueueReader
protected void startQueueReader()Start the thread that drains the queue -
stopQueueReader
protected void stopQueueReader()Cause the queue draining thread to shut down. -
getCapabilities
public int getCapabilities()Specify what capabilities a port of this type has.- Overrides:
getCapabilities
in classConnector
- Returns:
- bitmask of capability flags
- See Also:
-
aprsMessageReceived
Delivers the next message received by YAAC that is an APRS message. Used to forward APRS positions to GPS devices with screens to display as waypoints.- Specified by:
aprsMessageReceived
in interfaceAprsMessageListener
- Parameters:
msg
- some subclass of Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
write
Transmit a line of text containing a waypoint sentence to the GPS device.- Parameters:
line
- String text to transmit
-
parsedAX25MessageReceived
Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message.- Specified by:
parsedAX25MessageReceived
in interfaceParsedAX25MessageListener
- Parameters:
pid
- AX.25 protocol IDmsg
- some subclass of AX25Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
uncaughtException
Method invoked when the given thread terminates due to the given uncaught exception.Any exception thrown by this method will be ignored by the Java Virtual Machine.
- Specified by:
uncaughtException
in interfaceThread.UncaughtExceptionHandler
- Parameters:
t
- the threade
- the exception
-