org.ka2ddo.yaac.io
Class AbstractGpsConnector

java.lang.Object
  extended by org.ka2ddo.ax25.Connector
      extended by org.ka2ddo.yaac.io.PortConnector
          extended by org.ka2ddo.yaac.io.AbstractGpsConnector
All Implemented Interfaces:
java.lang.Thread.UncaughtExceptionHandler, AprsMessageListener, ParsedAX25MessageListener
Direct Known Subclasses:
SerialGpsConnector

public abstract class AbstractGpsConnector
extends PortConnector
implements AprsMessageListener, ParsedAX25MessageListener, java.lang.Thread.UncaughtExceptionHandler

This class provides common functionality for PortConnectors that receive NMEA-0183 data from some kind of connection to a GPS receiver.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.ka2ddo.ax25.Connector
Connector.PortStats
 
Field Summary
protected  java.lang.String cachedToString
           
protected  java.lang.Thread dispatchThread
           
protected  java.lang.Runnable QUEUE_READER
          Runnable to extract, parse, and process incoming NMEA-0183 sentences.
protected  boolean queuedButNotConsumed
           
protected  FastBlockingQueue<java.lang.String> rtQueue
           
 
Fields inherited from class org.ka2ddo.yaac.io.PortConnector
currentCfg, portConfig
 
Fields inherited from class org.ka2ddo.ax25.Connector
CAP_FULL_DUPLEX, CAP_GPS_DATA, CAP_HF, CAP_IGATE, CAP_OPENTRAC, CAP_RCV_PACKET_DATA, CAP_RF, CAP_WAYPOINT_SENDER, CAP_WEATHER, CAP_XMT_PACKET_DATA, stats
 
Constructor Summary
protected AbstractGpsConnector()
          Initialize attributes of this abstract superclass.
 
Method Summary
 void aprsMessageReceived(Message msg)
          Delivers the next message received by YAAC that is an APRS message.
 int getCapabilities()
          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 startQueueReader()
          Start the thread that drains the queue
 void uncaughtException(java.lang.Thread t, java.lang.Throwable e)
          Method invoked when the given thread terminates due to the given uncaught exception.
abstract  void write(java.lang.String line)
          Transmit a line of text containing a waypoint sentence to the GPS device.
 
Methods inherited from class org.ka2ddo.yaac.io.PortConnector
addFrameListener, addPortEventListener, configure, createPort, fireConsumeFrame, fireConsumeFrame, fireFailed, fireReceiving, fireTransmitting, getPortConnectorClass, portConnectorClasses, portTypeNames, registerPortConnectorType, removeFrameListener, removePortEventListener, setPortConfig
 
Methods inherited from class org.ka2ddo.ax25.Connector
close, finalize, getCallsign, getStats, hasCapability, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cachedToString

protected transient java.lang.String cachedToString

rtQueue

protected final FastBlockingQueue<java.lang.String> rtQueue

dispatchThread

protected transient java.lang.Thread dispatchThread

queuedButNotConsumed

protected transient boolean queuedButNotConsumed

QUEUE_READER

protected final java.lang.Runnable QUEUE_READER
Runnable to extract, parse, and process incoming NMEA-0183 sentences.

Constructor Detail

AbstractGpsConnector

protected AbstractGpsConnector()
Initialize attributes of this abstract superclass.

Method Detail

startQueueReader

protected void startQueueReader()
Start the thread that drains the queue


getCapabilities

public int getCapabilities()
Specify what capabilities a port of this type has.

Overrides:
getCapabilities in class Connector
Returns:
bitmask of capability flags
See Also:
Connector.CAP_GPS_DATA, Connector.CAP_WAYPOINT_SENDER

aprsMessageReceived

public void aprsMessageReceived(Message msg)
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 interface AprsMessageListener
Parameters:
msg - some subclass of Message containing the message contents; the message should have an AX25Frame connected to it
See Also:
AX25Frame, AX25Message.ax25Frame, AX25Message.getAx25Frame()

write

public abstract void write(java.lang.String line)
Transmit a line of text containing a waypoint sentence to the GPS device.

Parameters:
line - String text to transmit

parsedAX25MessageReceived

public void parsedAX25MessageReceived(byte pid,
                                      AX25Message msg)
Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message.

Specified by:
parsedAX25MessageReceived in interface ParsedAX25MessageListener
Parameters:
pid - AX.25 protocol ID
msg - some subclass of AX25Message containing the message contents; the message should have an AX25Frame connected to it
See Also:
AX25Frame

uncaughtException

public final void uncaughtException(java.lang.Thread t,
                                    java.lang.Throwable e)
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 interface java.lang.Thread.UncaughtExceptionHandler
Parameters:
t - the thread
e - the exception