Package org.ka2ddo.yaac.io
Class AprsIsConnector
java.lang.Object
org.ka2ddo.ax25.Connector
org.ka2ddo.yaac.io.PortConnector
org.ka2ddo.yaac.io.TNCConnector
org.ka2ddo.yaac.io.AprsIsConnector
- All Implemented Interfaces:
Runnable
,Thread.UncaughtExceptionHandler
,TransmittingConnector
,HasRemoteAppIfc
,NeedsAppVersionInfoIfc
,PortFailureReportListener
public class AprsIsConnector
extends TNCConnector
implements Runnable, Thread.UncaughtExceptionHandler, PortFailureReportListener, NeedsAppVersionInfoIfc, TransmittingConnector, HasRemoteAppIfc
This class defines a potentially bidirectional connection to an APRS-IS server.
New functionality includes support for SOCKS5 proxy server relay connections (RFC1928),
supporting username/password authentication (RFC1929), and GSSAPI authentication (RFC1961).
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.yaac.io.PortConnector
PortConnector.PortStatsType
Nested classes/interfaces inherited from class org.ka2ddo.ax25.Connector
Connector.ConnectorType, Connector.PortStats
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Set<PortConfig.Fields>
Set of PortConfig field identifiers for fields that should not be copied from another system and should therefore be blanked out when copying configuration files.static final String
Specify the fully-qualified platform-wildcarded class name for the editor for AprsIsConnector.static final Map<PortConfig.Fields,
PortConfig.RequireHints> List of PortConfig field identifiers that are mandated for this port type to work, and the ResourceBundle key to prompt for a value if missing.static final String
Specify the PortConnector type name for AprsIsConnector.Fields inherited from class org.ka2ddo.yaac.io.TNCConnector
RF_SEND_TIME_PER_BYTE_1200, RF_SEND_TIME_PER_BYTE_300, RF_SEND_TIME_PER_BYTE_9600, timeslotTimer
Fields inherited from class org.ka2ddo.yaac.io.PortConnector
currentCfg, portConfig
Fields inherited from class org.ka2ddo.ax25.Connector
CAP_ADSB, CAP_FAST_RF_9600, CAP_FULL_DUPLEX, CAP_GPS_DATA, CAP_HF, CAP_IGATE, CAP_KENWOOD_CMD, CAP_OPENTRAC, CAP_RAW_AX25, CAP_RCV_PACKET_DATA, CAP_RF, CAP_SUBCLIENT, CAP_WAYPOINT_SENDER, CAP_WEATHER, CAP_XMT_PACKET_DATA, stats
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Shut down this PortConnector.void
configure
(PortConfig config) Update the configuration of the connector to match the updated setup.void
failureGuiCreated
(PortFailureReporterIfc failureGui) Specify the lazily-created failure reporting GUI object for the reported failure.void
The GUI object has been dismissed by the user and should not be used any more by the requesting I/O code.static void
Set the correct defaults for a port in process of being created.int
Get the bitmask of AX.25 protocols supported by this port.int
Get the bit transmission rate on this port.int
Specify what capabilities a port of this type has.Return the address of the remote APRS-IS server this port is connected to.long
Return the time (in milliseconds since epoch) of when the connection to the remote application was opened.String[]
Get the application and version thereof of the remote application this Connector is connected to.boolean
isOpen()
Reports whether this PortConnector has an open connection to its port.final void
run()
Private internal method used to read the incoming APRS messages from the socket connection to the selected APRS-IS server.void
Transmit a AX.25 frame to the connected APRS-IS server.void
setAppVersion
(String name, String version) Sets the name and version of the containing application.toString()
Returns a string representation of the AprsIsConnector object.final void
uncaughtException
(Thread t, Throwable e) Method invoked when the given thread terminates due to the given uncaught exception.Methods inherited from class org.ka2ddo.yaac.io.TNCConnector
convertTNC2FormatToAX25Frame, getCallsign, getPortAddress, getRFSendTimePerByte, setPortAddress
Methods inherited from class org.ka2ddo.yaac.io.PortConnector
addPortEventListener, createPort, fillinConfigDefaultsForType, fireFailed, fireReceiving, fireTransmitting, getCollectedStatsTypes, getPortConfig, getPortConnectorClass, getPortConnectorInactivityTimer, getStats, portConnectorClasses, portTypeNames, registerPortConnectorType, removePortEventListener, setPortConfig
Methods inherited from class org.ka2ddo.ax25.Connector
addFrameListener, finalize, fireConsumeFrame, fireConsumeFrame, getStats, getType, hasCapability, removeFrameListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ka2ddo.ax25.TransmittingConnector
getCallsign, getStats, hasCapability
-
Field Details
-
TYPE_NAME
Specify the PortConnector type name for AprsIsConnector.- See Also:
-
CONFIG_GUI
Specify the fully-qualified platform-wildcarded class name for the editor for AprsIsConnector.- See Also:
-
BLANK_FIELDS
Set of PortConfig field identifiers for fields that should not be copied from another system and should therefore be blanked out when copying configuration files. -
REQ_FIELDS
List of PortConfig field identifiers that are mandated for this port type to work, and the ResourceBundle key to prompt for a value if missing.
-
-
Constructor Details
-
AprsIsConnector
public AprsIsConnector()Create an uninitialized instance of AprsIsConnector.
-
-
Method Details
-
fillinConfigDefaults
Set the correct defaults for a port in process of being created.- Parameters:
cfg
- PortConfig.Cfg whose defaults should be adjusted
-
setAppVersion
Sets the name and version of the containing application.- Specified by:
setAppVersion
in interfaceNeedsAppVersionInfoIfc
- Parameters:
name
- String name of the application (cannot contain whitespace)version
- String version of the application (cannot contain whitespace)
-
configure
Update the configuration of the connector to match the updated setup.- Specified by:
configure
in classPortConnector
- Parameters:
config
- PortConfig defining new port settings- Throws:
IOException
- if interface changes could not be appliedIllegalArgumentException
- if type information is invalid for changing the settings of this PortConnector
-
isOpen
public boolean isOpen()Reports whether this PortConnector has an open connection to its port.- Specified by:
isOpen
in interfaceTransmittingConnector
- Specified by:
isOpen
in classConnector
- Returns:
- boolean true if PortConnector is open
-
run
public final void run()Private internal method used to read the incoming APRS messages from the socket connection to the selected APRS-IS server. -
getBitRate
public int getBitRate()Get the bit transmission rate on this port.- Overrides:
getBitRate
in classTNCConnector
- Returns:
- bit rate in bits per second
-
getRemoteAppAndVersion
Get the application and version thereof of the remote application this Connector is connected to.- Specified by:
getRemoteAppAndVersion
in interfaceHasRemoteAppIfc
- Returns:
- String of remote application name and version, or null if it is not known
-
failureGuiCreated
Specify the lazily-created failure reporting GUI object for the reported failure.- Specified by:
failureGuiCreated
in interfacePortFailureReportListener
- Parameters:
failureGui
- PortFailureReporterIfc object for the GUI- See Also:
-
failureGuiDismissed
public void failureGuiDismissed()The GUI object has been dismissed by the user and should not be used any more by the requesting I/O code.- Specified by:
failureGuiDismissed
in interfacePortFailureReportListener
-
getCurrentConnectAddress
Return the address of the remote APRS-IS server this port is connected to.- Specified by:
getCurrentConnectAddress
in interfaceHasRemoteAppIfc
- Returns:
- InetSocketAddress of remote server, or null if port is not open
-
getPortOpenTime
public long getPortOpenTime()Return the time (in milliseconds since epoch) of when the connection to the remote application was opened.- Specified by:
getPortOpenTime
in interfaceHasRemoteAppIfc
- Returns:
- time in milliseconds, or 0 if not open
-
uncaughtException
Method invoked when the given thread terminates due to the given uncaught exception.Any exception thrown by this method will be ignored by the Java Virtual Machine.
- Specified by:
uncaughtException
in interfaceThread.UncaughtExceptionHandler
- Parameters:
t
- the threade
- the exception
-
sendFrame
Transmit a AX.25 frame to the connected APRS-IS server. Note this will silently do nothing if the connection is not open or transmission is not enabled for this PortConnector.- Specified by:
sendFrame
in interfaceTransmittingConnector
- Parameters:
frame
- AX25Frame to transmit
-
close
public void close()Shut down this PortConnector. -
toString
Returns a string representation of the AprsIsConnector object. -
getCapabilities
public int getCapabilities()Specify what capabilities a port of this type has.- Specified by:
getCapabilities
in interfaceTransmittingConnector
- Overrides:
getCapabilities
in classConnector
- Returns:
- bitmask of capability flags
- See Also:
-
Connector.CAP_RCV_PACKET_DATA
Connector.CAP_XMT_PACKET_DATA
Connector.CAP_FAST_RF_9600
Connector.CAP_FULL_DUPLEX
Connector.CAP_GPS_DATA
Connector.CAP_HF
Connector.CAP_IGATE
Connector.CAP_KENWOOD_CMD
Connector.CAP_OPENTRAC
Connector.CAP_ADSB
Connector.CAP_RAW_AX25
Connector.CAP_RF
Connector.CAP_WAYPOINT_SENDER
Connector.CAP_WEATHER
Connector.CAP_SUBCLIENT
-
getAcceptableProtocolsMask
public int getAcceptableProtocolsMask()Get the bitmask of AX.25 protocols supported by this port.- Specified by:
getAcceptableProtocolsMask
in interfaceTransmittingConnector
- Overrides:
getAcceptableProtocolsMask
in classTNCConnector
- Returns:
- protocol bitmask, or 0 for no AX.25 protocols supported
-