Package org.ka2ddo.ax25
Class Connector
java.lang.Object
org.ka2ddo.ax25.Connector
- Direct Known Subclasses:
PortConnector
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 ClassesModifier and TypeClassDescriptionstatic 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
FieldsModifier and TypeFieldDescriptionstatic 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 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.protected Connector.PortStats
Statistics about this PortConnector. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Add an object that wants to be informed of incoming raw AX.25 frames.void
close()
Shut down this port connection.protected void
finalize()
Clean up a Connector when the object is garbage-collected.protected AX25Frame
fireConsumeFrame
(byte[] buf, int offset, int length, long rcptTimeInMsecSinceEpoch) 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 rcptTimeInMsecSinceEpoch) 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.getStats()
Get the current statistics for this PortConnector instance.getType()
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
isOpen()
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.
-
Field Details
-
stats
Statistics about this PortConnector. -
CAP_XMT_PACKET_DATA
public static final int CAP_XMT_PACKET_DATAA 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_DATAA port that is capable of receiving AX.25 (or equivalent) data frames.- See Also:
-
CAP_IGATE
public static final int CAP_IGATEA port with a connection to the Internet and APRS-IS backbone.- See Also:
-
CAP_GPS_DATA
public static final int CAP_GPS_DATAA port capable of consuming NMEA-0183 GPS data.- See Also:
-
CAP_WAYPOINT_SENDER
public static final int CAP_WAYPOINT_SENDERA port capable of sending NMEA-0183 waypoint data.- See Also:
-
CAP_FULL_DUPLEX
public static final int CAP_FULL_DUPLEXA 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_WEATHERA port that can provide weather data through the WeatherDistributor.- See Also:
-
CAP_RF
public static final int CAP_RFA port that has local RF access.- See Also:
-
CAP_OPENTRAC
public static final int CAP_OPENTRACA port that can speak the OpenTRAC protocol.- See Also:
-
CAP_HF
public static final int CAP_HFA 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_CMDA 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_AX25A 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_9600A port doing 9600 baud RF data rate instead of the usual 1200.- See Also:
-
CAP_ADSB
public static final int CAP_ADSBA port processing ADS-B data (not APRS or OpenTRAC).- See Also:
-
-
Constructor Details
-
Connector
public Connector()
-
-
Method Details
-
addFrameListener
Add an object that wants to be informed of incoming raw AX.25 frames.- Parameters:
l
- FrameListener to add
-
removeFrameListener
Remove an object that used to be informed about incoming raw AX.25 frames.- Parameters:
l
- FrameListener to unregister
-
fireConsumeFrame
Send an AX.25 frame to all the listeners expecting to process raw frames,- Parameters:
frame
- AX25Frame to processrcptTimeInMsecSinceEpoch
- time since Unix epoch when frame started arriving
-
fireConsumeFrame
protected AX25Frame fireConsumeFrame(byte[] buf, int offset, int length, long rcptTimeInMsecSinceEpoch) 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 frameoffset
- zero-based index into byte array where frame startslength
- number of consecutive bytes in buffer that make up the framercptTimeInMsecSinceEpoch
- 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
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
Clean up a Connector when the object is garbage-collected. -
isOpen
public abstract boolean isOpen()Reports whether this Connector has an open connection to its port.- Returns:
- boolean true if Connector is open
-
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
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
-