Package org.ka2ddo.yaac.core
Class SnifferDataModel
java.lang.Object
org.ka2ddo.yaac.core.SnifferDataModel
- All Implemented Interfaces:
Runnable
,AprsMessageListener
,AX25FrameListener
,ParsedAX25MessageListener
,ClearableTableModel
public final class SnifferDataModel
extends Object
implements AX25FrameListener, AprsMessageListener, ParsedAX25MessageListener, Runnable, ClearableTableModel
This class maintains a list of all messages heard by the application.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ka2ddo.yaac.util.ClearableTableModel
ClearableTableModel.ClearType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Connector
Bogus Connector instance used to identify historical packets loaded from a log file. -
Constructor Summary
ConstructorDescriptionCreate the singleton SnifferDataModel that collects incoming packet traffic for tabular display. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a SnifferDataListener.static void
addSnifferLogFilter
(SnifferLogFilter filter) Register aSnifferLogFilter
.void
Delivers the next packet received by YAAC that is an APRS message.void
consumeAX25Frame
(AX25Frame frame, Connector connector) Receive an incoming frame from the specified input Connector.int
deleteAllRows
(ClearableTableModel.ClearType clearType) Delete all rows from this table.void
exportMessages
(OutputStream o, PacketExportMode exportMode, boolean saveAll) Export packets passing the current filters in the SnifferDataModel to a file in the specified file format.Get the current format for AX.25 message logging.getMessage
(int rowIndex) Get the Nth packet stored in the SnifferDataModel.int
Get the number of packets currently stored in the SnifferDataModel.void
importMessages
(InputStream in, PacketExportMode exportMode, int scaleFactor, StatusListener statusListener, long fileSize, Filter filter) Import a file of AX.25 frames in any of three formats into YAAC.void
parsedAX25MessageReceived
(byte pid, AX25Message msg) Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message.void
Unregister a SnifferDataListener.static void
Unregister aSnifferLogFilter
.void
run()
Do not call.void
Set the format for AX.25 message logging.boolean
Identifies whether this table can contain playback (historical) data.boolean
Identifies whether this table can contain realtime data.
-
Field Details
-
LOGFILE_PLAYBACK_CONNECTOR
Bogus Connector instance used to identify historical packets loaded from a log file.
-
-
Constructor Details
-
SnifferDataModel
public SnifferDataModel()Create the singleton SnifferDataModel that collects incoming packet traffic for tabular display.
-
-
Method Details
-
getRowCount
public int getRowCount()Get the number of packets currently stored in the SnifferDataModel.- Returns:
- packet count
-
addSnifferDataListener
Register a SnifferDataListener.- Parameters:
l
- SnifferDataListener to register
-
removeSnifferDataListener
Unregister a SnifferDataListener.- Parameters:
l
- SnifferDataListener to unregister
-
consumeAX25Frame
Description copied from interface:AX25FrameListener
Receive an incoming frame from the specified input Connector. Note that the frame will not have any decoded AX25Message associated with it yet.- Specified by:
consumeAX25Frame
in interfaceAX25FrameListener
- Parameters:
frame
- AX25Frame that was receivedconnector
- Connector that was the source of the frame.
-
addSnifferLogFilter
Register aSnifferLogFilter
.- Parameters:
filter
- SnifferLogFilter to register
-
removeSnifferLogFilter
Unregister aSnifferLogFilter
.- Parameters:
filter
- SnifferLogFilter to register
-
aprsMessageReceived
Delivers the next packet received by YAAC that is an APRS message.- Specified by:
aprsMessageReceived
in interfaceAprsMessageListener
- Parameters:
msg
- some subclass of Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
parsedAX25MessageReceived
Delivers the next message received by YAAC that is some sort of parsed AX.25 higher-level message.- Specified by:
parsedAX25MessageReceived
in interfaceParsedAX25MessageListener
- Parameters:
pid
- AX.25 protocol IDmsg
- some subclass of Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
run
public void run()Do not call. Invoked by GUI dispatch thread to update the GUI with recently received packets. -
importMessages
public void importMessages(InputStream in, PacketExportMode exportMode, int scaleFactor, StatusListener statusListener, long fileSize, Filter filter) throws IOException Import a file of AX.25 frames in any of three formats into YAAC.- Parameters:
in
- InputStream to read the file data fromexportMode
- expected format of the data streamscaleFactor
- the speed-up factor for simulated playback, or zero for as-fast-as-possiblestatusListener
- StatusListener to receive file reading progress reports, or null if not desiredfileSize
- total length of file being read infilter
- Filter to use to discard unwanted messages, or null to keep all messages- Throws:
IOException
- if file reading fails for an unexpected reason
-
exportMessages
public void exportMessages(OutputStream o, PacketExportMode exportMode, boolean saveAll) throws IOException Export packets passing the current filters in the SnifferDataModel to a file in the specified file format.- Parameters:
o
- OutputStream to write the file data toexportMode
- PacketExportMode specifying the format of the saved packet datasaveAll
- boolean true if filters should be ignored and all currently held packets should be saved- Throws:
IOException
- if packets could not be written to the stream for any reason
-
getMessage
Get the Nth packet stored in the SnifferDataModel.- Parameters:
rowIndex
- zero-based index of the AX25Frame to return- Returns:
- AX25Frame
- Throws:
IndexOutOfBoundsException
- if rowIndex is not in range of the available frames
-
getLoggerFormat
Get the current format for AX.25 message logging.- Returns:
- PacketExportMode in use
-
setLoggerFormat
Set the format for AX.25 message logging.- Parameters:
pem
- PacketExportMode to use
-
deleteAllRows
Delete all rows from this table.- Specified by:
deleteAllRows
in interfaceClearableTableModel
- Parameters:
clearType
- type of rows to delete- Returns:
- number of rows deleted
-
tableCanContainPlayback
public boolean tableCanContainPlayback()Identifies whether this table can contain playback (historical) data.- Specified by:
tableCanContainPlayback
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain playback data.
-
tableCanContainRealtime
public boolean tableCanContainRealtime()Identifies whether this table can contain realtime data.- Specified by:
tableCanContainRealtime
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain realtime data.
-