Package org.ka2ddo.aprs
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 Summary
Modifier and TypeMethodDescriptionstatic void
addAprsMessageListener
(AprsMessageListener listener) Register an AprsMessageListener to be notified of incoming parsed APRS messages.static APRSStack
Get the singleton instance of APRSStack.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.parse
(byte[] body, AX25Callsign src, AX25Callsign dest, AX25Callsign[] digipeaters, long rcvTimestamp, Connector connector) Parse a message to the appropriate object class.void
processParsedAX25Packet
(AX25Frame frame, AX25Message parsedMsg) Send this message (and its associated frame) to the APRS consumers.static void
removeAprsMessageListener
(AprsMessageListener listener) Unregister an AprsMessageListener to be notified of incoming parsed APRS messages.void
Specify if a specific category of debug messages should be printed out.
-
Method Details
-
setDebug
Specify if a specific category of debug messages should be printed out.- Specified by:
setDebug
in interfaceDebugCtl.DbgListener
- Parameters:
categoryName
- String name of category to enable debug logging forsetting
- boolean true or false to enable or disable debugging this category
-
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 bodyoffset
- zero-based starting index in the body array where the message is supposed to startsrc
- AX25Callsign of transmitting stationdest
- AX25Callsign of destination station (or tocall)digipeaters
- array of AX25Callsigns for the digipeaters of the frametp
- String of third party prefix, or null if no third-party prefix detected yetrcvTimestamp
- time (in milliseconds since Jan 1 1970 UTC) that message was receivedconnector
- 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 interfaceAX25Parser
- Parameters:
body
- byte array containing the message to be parsedsrc
- AX25Callsign of the sending stationdest
- AX25Callsign of the destination (probably an APRS alias)digipeaters
- array of AX25Callsigns for digipeaters, or null if nonercvTimestamp
- 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
Register an AprsMessageListener to be notified of incoming parsed APRS messages.- Parameters:
listener
- AprsMessageListener to register
-
removeAprsMessageListener
Unregister an AprsMessageListener to be notified of incoming parsed APRS messages.- Parameters:
listener
- AprsMessageListener to unregister
-
processParsedAX25Packet
Send this message (and its associated frame) to the APRS consumers.- Specified by:
processParsedAX25Packet
in interfaceAX25ParserWithDistributor
- Parameters:
frame
- AX25Frame containing the APRS messageparsedMsg
- AX25Message that was decoded from the frame
-