Package org.ka2ddo.yaac.io
Class KissOverTcpConnector
java.lang.Object
org.ka2ddo.ax25.Connector
org.ka2ddo.yaac.io.PortConnector
org.ka2ddo.yaac.io.TNCConnector
org.ka2ddo.yaac.io.KissOverTcpConnector
- All Implemented Interfaces:
Runnable
,Thread.UncaughtExceptionHandler
,TransmittingConnector
,PortFailureReportListener
public class KissOverTcpConnector
extends TNCConnector
implements Runnable, Thread.UncaughtExceptionHandler, PortFailureReportListener, TransmittingConnector
This class defines the port driver for connecting to a KISS TNC over
a TCP/IP network connection.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Specify listener callback so YAAC can be informed of modem changes made at the fldigi UI.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
Class name for the port configuration editing widget for the KISS-over-TCP port type, with a wildcard to insert the GUI implementation name.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
Port type identifying name for the KISS-over-TCP port type.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
Register a listener to be informed when fldigi changes its modem selection.void
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 bit transmission rate on this port.int
Specify what capabilities a port of this type has.Get the version of Fldigi on the other end of the link.getModem()
Get the last reported selected Fldigi modem from the remote TNC.String[]
Get the list of Fldigi modems capable of supporting AX.25 packet frames.static boolean
hasLocalKissOverTcp
(int portNum) Test if the host computer is potentially running a Kiss-over-TCP server.boolean
isOpen()
Reports whether this Connector has an open connection to its port.void
Unregister a listener to no longer be informed when fldigi changes its modem selection.void
run()
Do not call.void
Transmit an AX.25 frame through this port.void
Send a modem changing command to the remote TNC (assumed to be an instance of Fldigi).toString()
Produce a String describing this Connector.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, getAcceptableProtocolsMask, 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
getAcceptableProtocolsMask, getCallsign, getStats, hasCapability
-
Field Details
-
TYPE_NAME
Port type identifying name for the KISS-over-TCP port type.- See Also:
-
CONFIG_GUI
Class name for the port configuration editing widget for the KISS-over-TCP port type, with a wildcard to insert the GUI implementation name.- 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
-
KissOverTcpConnector
public KissOverTcpConnector()
-
-
Method Details
-
fillinConfigDefaults
Set the correct defaults for a port in process of being created.- Parameters:
cfg
- PortConfig.Cfg whose defaults should be adjusted
-
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
-
close
public void close()Shut down this PortConnector. -
hasLocalKissOverTcp
public static boolean hasLocalKissOverTcp(int portNum) Test if the host computer is potentially running a Kiss-over-TCP server.- Parameters:
portNum
- int TCP port number to test for a listening socket- Returns:
- boolean true if the KISS-over-TCP service appears to be running
-
toString
Produce a String describing this Connector. -
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.- 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
-
isOpen
public boolean isOpen()Reports whether this Connector has an open connection to its port.- Specified by:
isOpen
in interfaceTransmittingConnector
- Specified by:
isOpen
in classConnector
- Returns:
- boolean true if Connector is open
-
sendFrame
Transmit an AX.25 frame through this port. May delay packet if using timeslotting or still transmitting another packet.- Specified by:
sendFrame
in interfaceTransmittingConnector
- Parameters:
frame
- AX25Frame object to transmit- Throws:
IOException
- if transmit failed for any reason other than a receive-only port
-
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
-
run
public void run()Do not call. Reserved internal method for KissOverTcpConnector. -
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
-
getBitRate
public int getBitRate()Get the bit transmission rate on this port.- Overrides:
getBitRate
in classTNCConnector
- Returns:
- bit rate in bits per second (baud)
-
getFldigiVersion
Get the version of Fldigi on the other end of the link. If the remote TNC is not an instance of Fldigi, this will return null.- Returns:
- Fldigi version String, or null if not Fldigi
-
getModem
Get the last reported selected Fldigi modem from the remote TNC. If the remote TNC is not an instance of Fldigi, this will return null.- Returns:
- current modem name, or null if unspecified/unknown
-
addFldigiModemChangeListener
Register a listener to be informed when fldigi changes its modem selection.- Parameters:
l
- FldigiModemChangeListener instance to register
-
removeFldigiModemChangeListener
Unregister a listener to no longer be informed when fldigi changes its modem selection.- Parameters:
l
- FldigiModemChangeListener instance to unregister
-
getModemList
Get the list of Fldigi modems capable of supporting AX.25 packet frames. If the remote TNC is not an instance of Fldigi, this will return null.- Returns:
- array of String modem names, or null if the remote TNC is not Fldigi
-
setModem
Send a modem changing command to the remote TNC (assumed to be an instance of Fldigi).- Parameters:
modem
- name of modem (as reported by getModemList()) to use- See Also:
-