Class Connector

java.lang.Object
org.ka2ddo.ax25.Connector
Direct Known Subclasses:
PortConnector

public abstract class Connector extends Object
This class defines the generic API for an object that connects a real-time data stream to this application.
Author:
Andrew Pavlin, KA2DDO
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Type of Connector, used in filtering and deciding whether to digipeat or I-gate traffic sourced from this connector.
    static class 
    A data structure recording throughput statistics for its containing PortConnector instance.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A port processing ADS-B data (not APRS or OpenTRAC).
    static final int
    A port doing 9600 baud RF data rate instead of the usual 1200.
    static final int
    A port that can both send and receive data simultaneously.
    static final int
    A port capable of consuming NMEA-0183 GPS data.
    static final int
    A port that has HF radio access (i.e., low bandwidth, excessive geographical coverage).
    static final int
    A port with a connection to the Internet and APRS-IS backbone.
    static final int
    A port that can use Kenwood radio control protocol to alter the settings of the attached radio.
    static final int
    A port that can speak the OpenTRAC protocol.
    static final int
    A port that can transmit or receive arbitrary raw AX.25 packets (not just APRS or OpenTRAC).
    static final int
    A port that is capable of receiving AX.25 (or equivalent) data frames.
    static final int
    A port that has local RF access.
    static final int
    A port from a sub-client using YAAC as a proxy.
    static final int
    A port capable of sending NMEA-0183 waypoint data.
    static final int
    A port that can provide weather data through the WeatherDistributor.
    static final int
    A port that is capable of transmitting AX.25 (or equivalent) data frames.
    Statistics about this PortConnector.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Add an object that wants to be informed of incoming raw AX.25 frames.
    void
    Shut down this port connection.
    protected void
    Clean up a Connector when the object is garbage-collected.
    protected AX25Frame
    fireConsumeFrame(byte[] buf, int offset, int length, long rcptTimeMsSinceEpoch)
    Extract an AX.25 frame from a byte array and send it to all the listeners expecting to process raw frames,
    static void
    fireConsumeFrame(AX25Frame frame, long rcptTimeMsSinceEpoch)
    Send an AX.25 frame to all the listeners expecting to process raw frames,
    For ports that have an AX.25 address (callsign), report the callsign associated with the port (used for transmissions initiated through this port instead of digipeated).
    int
    Specify what capabilities a port of this type has.
    Get the current statistics for this PortConnector instance.
    Report what type of traffic comes from this connector.
    boolean
    hasCapability(int capMask)
    Test if this Connector has the specified capability or capabilities.
    abstract boolean
    Reports whether this Connector has an open connection to its port.
    static void
    Remove an object that used to be informed about incoming raw AX.25 frames.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stats

      protected Connector.PortStats stats
      Statistics about this PortConnector.
    • CAP_XMT_PACKET_DATA

      public static final int CAP_XMT_PACKET_DATA
      A port that is capable of transmitting AX.25 (or equivalent) data frames.
      See Also:
    • CAP_RCV_PACKET_DATA

      public static final int CAP_RCV_PACKET_DATA
      A port that is capable of receiving AX.25 (or equivalent) data frames.
      See Also:
    • CAP_IGATE

      public static final int CAP_IGATE
      A port with a connection to the Internet and APRS-IS backbone.
      See Also:
    • CAP_GPS_DATA

      public static final int CAP_GPS_DATA
      A port capable of consuming NMEA-0183 GPS data.
      See Also:
    • CAP_WAYPOINT_SENDER

      public static final int CAP_WAYPOINT_SENDER
      A port capable of sending NMEA-0183 waypoint data.
      See Also:
    • CAP_FULL_DUPLEX

      public static final int CAP_FULL_DUPLEX
      A port that can both send and receive data simultaneously. For example, most TNC ports will not specify this (because the associated radio cannot transmit and receive simultaneously on the same channel), but an Internet connection may specify this capability.
      See Also:
    • CAP_WEATHER

      public static final int CAP_WEATHER
      A port that can provide weather data through the WeatherDistributor.
      See Also:
    • CAP_RF

      public static final int CAP_RF
      A port that has local RF access.
      See Also:
    • CAP_OPENTRAC

      public static final int CAP_OPENTRAC
      A port that can speak the OpenTRAC protocol.
      See Also:
    • CAP_HF

      public static final int CAP_HF
      A port that has HF radio access (i.e., low bandwidth, excessive geographical coverage). This implies 300 baud for APRS RF bit rate.
      See Also:
    • CAP_KENWOOD_CMD

      public static final int CAP_KENWOOD_CMD
      A port that can use Kenwood radio control protocol to alter the settings of the attached radio.
      See Also:
    • CAP_RAW_AX25

      public static final int CAP_RAW_AX25
      A port that can transmit or receive arbitrary raw AX.25 packets (not just APRS or OpenTRAC).
      See Also:
    • CAP_FAST_RF_9600

      public static final int CAP_FAST_RF_9600
      A port doing 9600 baud RF data rate instead of the usual 1200.
      See Also:
    • CAP_ADSB

      public static final int CAP_ADSB
      A port processing ADS-B data (not APRS or OpenTRAC).
      See Also:
    • CAP_SUBCLIENT

      public static final int CAP_SUBCLIENT
      A port from a sub-client using YAAC as a proxy. This is reserved for use by the Pseudo-APRS-IS-Server plugin.
      See Also:
  • Constructor Details

    • Connector

      public Connector()
  • Method Details

    • addFrameListener

      public static void addFrameListener(FrameListener l)
      Add an object that wants to be informed of incoming raw AX.25 frames.
      Parameters:
      l - FrameListener to add
    • removeFrameListener

      public static void removeFrameListener(FrameListener l)
      Remove an object that used to be informed about incoming raw AX.25 frames.
      Parameters:
      l - FrameListener to unregister
    • fireConsumeFrame

      public static void fireConsumeFrame(AX25Frame frame, long rcptTimeMsSinceEpoch)
      Send an AX.25 frame to all the listeners expecting to process raw frames,
      Parameters:
      frame - AX25Frame to process
      rcptTimeMsSinceEpoch - time since Unix epoch when frame started arriving
    • fireConsumeFrame

      protected AX25Frame fireConsumeFrame(byte[] buf, int offset, int length, long rcptTimeMsSinceEpoch)
      Extract an AX.25 frame from a byte array and send it to all the listeners expecting to process raw frames,
      Parameters:
      buf - byte array supposedly containing an AX.25 frame
      offset - zero-based index into byte array where frame starts
      length - number of consecutive bytes in buffer that make up the frame
      rcptTimeMsSinceEpoch - time since Unix epoch when frame started arriving
      Returns:
      the AX25Frame created from the specified bytes, or null if a frame could not be decoded
    • getStats

      public Connector.PortStats getStats()
      Get the current statistics for this PortConnector instance.
      Returns:
      PortStats for this port.
    • close

      public void close()
      Shut down this port connection. Expected to be overridden by sub-classes. Must be idempotent (may be called repeatedly on an already-closed Connector).
    • finalize

      protected void finalize() throws Throwable
      Clean up a Connector when the object is garbage-collected.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - if any unhandled problem occurs during cleanup
    • isOpen

      public abstract boolean isOpen()
      Reports whether this Connector has an open connection to its port.
      Returns:
      boolean true if Connector is open
    • getCallsign

      public String getCallsign()
      For ports that have an AX.25 address (callsign), report the callsign associated with the port (used for transmissions initiated through this port instead of digipeated). By default, returns null. Subclasses are expected to override this.
      Returns:
      callsign String, or null if no associated callsign
    • getCapabilities

      public int getCapabilities()
      Specify what capabilities a port of this type has. By default, returns a zero bitmask (not capable of anything). Expected to be overridden by subclasses.
      Returns:
      bitmask of capability flags
      See Also:
    • hasCapability

      public boolean hasCapability(int capMask)
      Test if this Connector has the specified capability or capabilities.
      Parameters:
      capMask - bitmask of capabilities to be tested for
      Returns:
      boolean true if this port has all the specified capabilities in its capability set
      See Also:
    • getType

      public Connector.ConnectorType getType()
      Report what type of traffic comes from this connector. By default, all Connector subclasses provide realtime data unless they override this method.
      Returns:
      type of traffic sourced by this incoming Connector