Class SerialGpsConnector

All Implemented Interfaces:
Thread.UncaughtExceptionHandler, jssc.SerialPortEventListener, AprsMessageListener, ParsedAX25MessageListener

public class SerialGpsConnector extends AbstractGpsConnector implements jssc.SerialPortEventListener
This class implements a port to a GPS receiver connected by a serial port over RS-232C (or USB emulating a RS-232C serial port). It optionally can send waypoint sentences back to the GPS (similar to the Kenwood D710 and TH-D72 working with AvMap GPS's) that are derived from the various formats of APRS and OpenTRAC position messages.

Note: For backwards compatibility, we are treating the FLAGS_LOCAL bit inversely (if clear, is a local GPS; if set, is a remote GPS).

Author:
Andrew Pavlin, KA2DDO
  • Field Details

    • TYPE_NAME

      public static final String TYPE_NAME
      The configuration type name for Serial_GPS ports.
      See Also:
    • CONFIG_GUI

      public static final String CONFIG_GUI
      The fully-qualified platform-wildcarded class name for the configuration editor for SerialGpsConnector.
      See Also:
    • BLANK_FIELDS

      public static final Set<PortConfig.Fields> BLANK_FIELDS
      Set of PortConfig field identifiers for fields that should not be copied from another system and should therefore be blanked out when copying configuration files.
    • REQ_FIELDS

      public static final Map<PortConfig.Fields,PortConfig.RequireHints> REQ_FIELDS
      List of PortConfig field identifiers that are mandated for this port type to work, and the ResourceBundle key to prompt for a value if missing.
  • Constructor Details

    • SerialGpsConnector

      public SerialGpsConnector()
  • Method Details

    • fillinConfigDefaults

      public static void fillinConfigDefaults(PortConfig.Cfg cfg)
      Set the correct defaults for a port in process of being created.
      Parameters:
      cfg - PortConfig.Cfg whose defaults should be adjusted
    • configure

      public void configure(PortConfig portConfig) throws IOException, IllegalArgumentException
      Update the configuration of the connector to match the updated setup.
      Specified by:
      configure in class PortConnector
      Parameters:
      portConfig - PortConfig defining new port settings
      Throws:
      IOException - if interface changes could not be applied
      IllegalArgumentException - if type information is invalid for changing the settings of this PortConnector
    • isOpen

      public boolean isOpen()
      Reports whether this PortConnector has an open connection to its port.
      Specified by:
      isOpen in class Connector
      Returns:
      boolean true if PortConnector is open
    • getBitRate

      public int getBitRate()
      Get the bit transmission rate on this port.
      Overrides:
      getBitRate in class PortConnector
      Returns:
      bit rate in bits per second (baud)
    • getCapabilities

      public int getCapabilities()
      Specify what capabilities a port of this type has.
      Overrides:
      getCapabilities in class AbstractGpsConnector
      Returns:
      bitmask of capability flags
      See Also:
    • serialEvent

      public void serialEvent(jssc.SerialPortEvent event)
      Process incoming serial port event.
      Specified by:
      serialEvent in interface jssc.SerialPortEventListener
      Parameters:
      event - SerialPortEvent describing the handling needed
    • close

      public void close()
      Shut down this port connection.
      Overrides:
      close in class Connector
    • write

      public void write(String line)
      Transmit a line of text containing a waypoint sentence to the GPS device.
      Specified by:
      write in class AbstractGpsConnector
      Parameters:
      line - String text to transmit
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.