public class AX25Stack extends java.lang.Object implements FrameListener, java.lang.Runnable
| Modifier and Type | Method and Description |
|---|---|
void |
addAprsMessageListener(AprsMessageListener listener)
Register an AprsMessageListener to be notified of incoming parsed APRS messages.
|
void |
addAX25FrameListener(AX25FrameListener l)
Add a listener for incoming AX.25 frames.
|
void |
addParsedAX25MessageListener(ParsedAX25MessageListener listener)
Register an ParsedAX25MessageListener to be notified of incoming parsed level 3 protocol
messages (other than APRS).
|
void |
consumeFrame(AX25Frame frame)
Queue one AX.25 frame (containing some sort of message) for parsing and processing.
|
void |
consumeFrameNow(Connector connector,
AX25Frame frame)
Process an incoming AX,25 frame.
|
void |
fireConsumeAX25Frame(AX25Frame frame,
Connector connector)
Send the specified incoming frame to all registered AX25FrameListeners.
|
java.util.Map<AX25Callsign,java.util.Map<AX25Callsign,ConnState>> |
getConnectionMap()
Get the map of all outstanding I-frame connected sessions observed by or end-pointed at this
station.
|
int |
getCurrentBacklog()
Return the current number of backlogged frames to be processed by the AX25Stack thread.
|
static java.lang.String[] |
getDigipeaters()
Get the default list of digipeaters for this stack.
|
static AX25Stack |
getInstance()
Get a handle to the AX25Stack singleton.
|
int |
getMaxBacklog()
Return the maximum backlog ever incurred by the AX25Stack parser thread.
|
int |
getMaxQueueCapacity()
Return the maximum allowed size of the queue.
|
int |
getNumConsumedMsgs()
Return the number of AX.25 messages consumed by the AX25Stack.
|
AX25Parser |
getParser(byte pid)
Get the protocol parsing handler for the specified protocol.
|
static ConnState.ConnType |
getStateOf(AX25Callsign src,
AX25Callsign dst)
Get the connection state of an I-frame connection session between the specified two
callsigns.
|
static java.lang.String |
getToCall()
Get the destination callsign (tocall) that should be used for messages originated
by this station.
|
boolean |
isFrozen()
Report if parser thread is frozen.
|
static boolean |
isLocalDest(AX25Callsign dest)
Test if this callsign is addressed to the local station.
|
static boolean |
isLocalDest(java.lang.String destCallsign)
Test if this callsign is addressed to the local station.
|
void |
openConnection(AX25Callsign src,
AX25Callsign dest,
AX25Callsign[] via,
ConnectionEstablishmentListener callback,
java.lang.Object sessionIdentifier)
Attempt to initiate an I-frame connected-mode session from the specified source (usually, the local station)
to another station by sending a SABM frame.
|
void |
processAPRSPacket(AX25Frame frame,
AX25Message aprsMsg)
Send this message (and its associated frame) to the APRS consumers.
|
boolean |
processIBody(AX25Frame frame,
boolean isUI,
Connector connector,
long rcvTimestamp)
This method consumes one information frame.
|
void |
processParsedAX25Message(AX25Frame frame,
AX25Message parsedMsg)
Dispatch an AX.25 frame that was parsed into a higher-level protocol to all
registered listeners.
|
void |
registerProtocolParser(byte pid,
AX25Parser parser)
Register another protocol parsing handler for a particular AX.25 UI/I message PID.
|
void |
removeAprsMessageListener(AprsMessageListener listener)
Unregister an AprsMessageListener to be notified of incoming parsed APRS messages.
|
void |
removeAX25FrameListener(AX25FrameListener l)
Remove a listener for incoming AX.25 frames.
|
void |
removeParsedAX25MessageListener(ParsedAX25MessageListener listener)
Unregister an ParsedAX25MessageListener to be notified of incoming parsed level 3 protocol
messages (other than APRS).
|
static AX25Callsign[] |
reverseDigipeaters(AX25Callsign[] srcRelays)
Reverse the order of a sequence of digipeaters (explicit and APRS aliases).
|
void |
run()
Private method to asynchronously consume AX25Frame objects for parsing.
|
static void |
setDigipeaters(java.lang.String[] digipeaters)
Set the default list of digipeaters for this stack.
|
void |
setFrozen(boolean frozen)
Specify whether the AX.25 parser thread should be paused (frozen) to allow the user to view
the output without it moving constantly
|
static void |
setToCall(java.lang.String toCall)
Set the destination callsign (tocall) that should be used for messages originated
by this station.
|
public static AX25Stack getInstance()
public static java.lang.String[] getDigipeaters()
public static void setDigipeaters(java.lang.String[] digipeaters)
digipeaters - array of String digipeater aliasespublic static java.lang.String getToCall()
public static void setToCall(java.lang.String toCall)
toCall - destination callsign (tocall)public void addAX25FrameListener(AX25FrameListener l)
l - AX25FrameListener to registerpublic void removeAX25FrameListener(AX25FrameListener l)
l - AX25FrameListener to unregisterpublic void registerProtocolParser(byte pid,
AX25Parser parser)
pid - pid byte code for this protocolparser - AX25Parser to handle receiving this protocolpublic AX25Parser getParser(byte pid)
pid - level 3 protocol ID byte (as defined by the AX.25 protocol specification)public void fireConsumeAX25Frame(AX25Frame frame, Connector connector)
frame - AX25Frame to dispatchconnector - Connector that received the framepublic void consumeFrame(AX25Frame frame)
consumeFrame in interface FrameListenerframe - the AX25Frame to be processedpublic int getCurrentBacklog()
public int getMaxBacklog()
public int getMaxQueueCapacity()
public int getNumConsumedMsgs()
public void run()
run in interface java.lang.Runnablepublic boolean isFrozen()
public void setFrozen(boolean frozen)
frozen - boolean true to freeze the parser thread, or false to resume executionpublic void consumeFrameNow(Connector connector, AX25Frame frame)
connector - Connector that received the frameframe - AX25Frame to processpublic java.util.Map<AX25Callsign,java.util.Map<AX25Callsign,ConnState>> getConnectionMap()
public static ConnState.ConnType getStateOf(AX25Callsign src, AX25Callsign dst)
src - AX25Callsign of originating end of sessiondst - AX25Callsign of receiving end of sessionpublic static AX25Callsign[] reverseDigipeaters(AX25Callsign[] srcRelays)
srcRelays - array of AX25Callsign indicating the path used to get from sender to recipientpublic boolean processIBody(AX25Frame frame, boolean isUI, Connector connector, long rcvTimestamp)
frame - AX25Frame to be decodedisUI - where frame was received in a UI AX.25 frame instead of an I frameconnector - PortConnector over which message arrived, or null for file playbackrcvTimestamp - time (in Java-standard milliseconds since Jan 1 1970 UTC) that message was receivedpublic void processParsedAX25Message(AX25Frame frame, AX25Message parsedMsg)
frame - AX25Frame of incoming messageparsedMsg - AX25Message subclass containing protocol decoding of messagepublic void processAPRSPacket(AX25Frame frame, AX25Message aprsMsg)
frame - AX25Frame containing the APRS messageaprsMsg - Message that was sentpublic void addAprsMessageListener(AprsMessageListener listener)
listener - AprsMessageListener to registerpublic void removeAprsMessageListener(AprsMessageListener listener)
listener - AprsMessageListener to unregisterpublic void addParsedAX25MessageListener(ParsedAX25MessageListener listener)
listener - ParsedAX25MessageListener to registerpublic void removeParsedAX25MessageListener(ParsedAX25MessageListener listener)
listener - ParsedAX25MessageListener to unregisterpublic static boolean isLocalDest(AX25Callsign dest)
dest - AX25Callsign to test as a destinationpublic static boolean isLocalDest(java.lang.String destCallsign)
destCallsign - String of AX.25 callsign-SSID to test as a destinationpublic void openConnection(AX25Callsign src, AX25Callsign dest, AX25Callsign[] via, ConnectionEstablishmentListener callback, java.lang.Object sessionIdentifier) throws java.io.IOException
src - AX25Callsign of originating stationdest - AX25Callsign of destination for connectionvia - digipeater path (may be null)callback - ConnectionEstablishmentListener to be notified of changes in state of the connectionsessionIdentifier - arbitrary unique identifier for the connection, so that the ConnectionEstablishmentListener
can tell which connection is being reported aboutjava.io.IOException - if connection initiation (SABM frame) could not be sent