Class GpsdConnector

All Implemented Interfaces:
Runnable, Thread.UncaughtExceptionHandler

public class GpsdConnector extends PortConnector implements Runnable, Thread.UncaughtExceptionHandler
This class provides a driver to connect YAAC to a gpsd daemon, so that YAAC can use a shared GPS receiver, or non-standard hardware that acts like a GPS receiver or speaks protocols other than NMEA 0183.

More information can be found at the gpsd website.

Author:
Andrew Pavlin, KA2DDO
  • Field Details

    • TYPE_NAME

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

      public static final String CONFIG_GUI
      The fully-qualified platform-wildcarded class name for the configuration editor for GpsdConnector.
      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

    • GpsdConnector

      public GpsdConnector()
  • 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 config) throws IOException, IllegalArgumentException
      Update the configuration of the connector to match the updated setup.
      Specified by:
      configure in class PortConnector
      Parameters:
      config - 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
    • run

      public void run()
      Read the socket connection until it closes.
      Specified by:
      run in interface Runnable
      See Also:
    • close

      public void close()
      Shut down this port connection. Expected to be overridden by sub-classes.
      Overrides:
      close in class Connector
    • 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:
    • getBitRate

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

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

      public final void uncaughtException(Thread t, Throwable e)
      Method invoked when the given thread terminates due to the given uncaught exception.
      Specified by:
      uncaughtException in interface Thread.UncaughtExceptionHandler
      Parameters:
      t - the thread
      e - the exception