Class APRSStack

java.lang.Object
org.ka2ddo.aprs.APRSStack
All Implemented Interfaces:
AX25Parser, AX25ParserWithDistributor, DebugCtl.DbgListener

public final class APRSStack extends Object implements AX25ParserWithDistributor, DebugCtl.DbgListener
This class parses incoming binary messages into the appropriate classes of APRS message objects.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Method Details

    • setDebug

      public void setDebug(String categoryName, boolean setting)
      Specify if a specific category of debug messages should be printed out.
      Specified by:
      setDebug in interface DebugCtl.DbgListener
      Parameters:
      categoryName - String name of category to enable debug logging for
      setting - boolean true or false to enable or disable debugging this category
    • getInstance

      public static APRSStack getInstance()
      Get the singleton instance of APRSStack.
      Returns:
      APRSStack singleton Object
    • parse

      public static Message parse(byte[] body, int offset, AX25Callsign src, AX25Callsign dest, AX25Callsign[] digipeaters, String tp, long rcvTimestamp, Connector connector)
      Analyze the contents of an AX.25 packet that appears to be identified as an APRS packet.
      Parameters:
      body - byte array containing the packet body
      offset - zero-based starting index in the body array where the message is supposed to start
      src - AX25Callsign of transmitting station
      dest - AX25Callsign of destination station (or tocall)
      digipeaters - array of AX25Callsigns for the digipeaters of the frame
      tp - String of third party prefix, or null if no third-party prefix detected yet
      rcvTimestamp - time (in milliseconds since Jan 1 1970 UTC) that message was received
      connector - Connector that received the packet
      Returns:
      Message object of the decoded APRS frame (if not valid APRS, it will be an instance of DefaultMessage marked invalid)
    • parse

      public AX25Message parse(byte[] body, AX25Callsign src, AX25Callsign dest, AX25Callsign[] digipeaters, long rcvTimestamp, Connector connector)
      Parse a message to the appropriate object class.
      Specified by:
      parse in interface AX25Parser
      Parameters:
      body - byte array containing the message to be parsed
      src - AX25Callsign of the sending station
      dest - AX25Callsign of the destination (probably an APRS alias)
      digipeaters - array of AX25Callsigns for digipeaters, or null if none
      rcvTimestamp - the time in Java/Unix milliseconds since midnight Jan 1, 1970 UTC when this message was actually received (as opposed to any timestamp that might be embedded in the message body)
      connector - Connector over which the message was received (null if from a file)
      Returns:
      the decoded Message (if not decipherable, a DefaultMessage is returned)
    • addAprsMessageListener

      public static void addAprsMessageListener(AprsMessageListener listener)
      Register an AprsMessageListener to be notified of incoming parsed APRS messages.
      Parameters:
      listener - AprsMessageListener to register
    • removeAprsMessageListener

      public static void removeAprsMessageListener(AprsMessageListener listener)
      Unregister an AprsMessageListener to be notified of incoming parsed APRS messages.
      Parameters:
      listener - AprsMessageListener to unregister
    • processParsedAX25Packet

      public void processParsedAX25Packet(AX25Frame frame, AX25Message parsedMsg)
      Send this message (and its associated frame) to the APRS consumers.
      Specified by:
      processParsedAX25Packet in interface AX25ParserWithDistributor
      Parameters:
      frame - AX25Frame containing the APRS message
      parsedMsg - AX25Message that was decoded from the frame