org.ka2ddo.yaac.io
Class KissOverTcpConnector

java.lang.Object
  extended by org.ka2ddo.ax25.Connector
      extended by org.ka2ddo.yaac.io.PortConnector
          extended by org.ka2ddo.yaac.io.TransmittingPortConnector
              extended by org.ka2ddo.yaac.io.TNCConnector
                  extended by org.ka2ddo.yaac.io.KissOverTcpConnector
All Implemented Interfaces:
java.lang.Runnable, java.lang.Thread.UncaughtExceptionHandler, PortFailureReportListener

public class KissOverTcpConnector
extends TNCConnector
implements java.lang.Runnable, java.lang.Thread.UncaughtExceptionHandler, PortFailureReportListener

This class defines the port driver for connecting to a KISS TNC over a TCP/IP network connection.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.ka2ddo.ax25.Connector
Connector.PortStats
 
Field Summary
static java.lang.String CONFIG_GUI
           
static java.lang.String TYPE_NAME
           
 
Fields inherited from class org.ka2ddo.yaac.io.PortConnector
currentCfg, portConfig
 
Fields inherited from class org.ka2ddo.ax25.Connector
CAP_FULL_DUPLEX, CAP_GPS_DATA, CAP_HF, CAP_IGATE, CAP_OPENTRAC, CAP_RCV_PACKET_DATA, CAP_RF, CAP_WAYPOINT_SENDER, CAP_WEATHER, CAP_XMT_PACKET_DATA, stats
 
Constructor Summary
KissOverTcpConnector()
           
 
Method Summary
 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 failureGuiDismissed()
          The GUI object has been dismissed by the user and should not be used any more by the requesting I/O code.
 int getBitRate()
          Get the bit transmission rate on this port.
 int getCapabilities()
          Specify what capabilities a port of this type has.
 java.lang.String getFldigiVersion()
          Get the version of Fldigi on the other end of the link.
 java.lang.String getModem()
          Get the last reported selected Fldigi modem from the remote TNC.
 java.lang.String[] getModemList()
          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 run()
          Do not call.
 void sendFrame(AX25Frame frame)
          Transmit an AX.25 frame through this port.
 void setModem(java.lang.String modem)
          Send a modem changing command to the remote TNC (assumed to be an instance of Fldigi).
 java.lang.String toString()
          Produce a String describing this Connector.
 void uncaughtException(java.lang.Thread t, java.lang.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, setPortAddress
 
Methods inherited from class org.ka2ddo.yaac.io.PortConnector
addFrameListener, addPortEventListener, createPort, fireConsumeFrame, fireConsumeFrame, fireFailed, fireReceiving, fireTransmitting, getPortConnectorClass, portConnectorClasses, portTypeNames, registerPortConnectorType, removeFrameListener, removePortEventListener, setPortConfig
 
Methods inherited from class org.ka2ddo.ax25.Connector
finalize, getStats, hasCapability
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

CONFIG_GUI

public static final java.lang.String CONFIG_GUI
See Also:
Constant Field Values
Constructor Detail

KissOverTcpConnector

public KissOverTcpConnector()
Method Detail

configure

public void configure(PortConfig config)
               throws java.io.IOException,
                      java.lang.IllegalArgumentException
Update the configuration of the connector to match the updated setup.

Specified by:
configure in class PortConnector
Parameters:
config - PortConfig defining new port settings
Throws:
java.io.IOException - if interface changes could not be applied
java.lang.IllegalArgumentException - if type information is invalid for changing the settings of this PortConnector

close

public void close()
Shut down this PortConnector.

Overrides:
close in class Connector

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

public java.lang.String toString()
Produce a String describing this Connector.

Overrides:
toString in class java.lang.Object
Returns:
descriptive String

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.

Overrides:
getCapabilities in class Connector
Returns:
bitmask of capability flags
See Also:
Connector.CAP_RCV_PACKET_DATA, Connector.CAP_XMT_PACKET_DATA, Connector.CAP_FULL_DUPLEX, Connector.CAP_GPS_DATA, Connector.CAP_IGATE, Connector.CAP_OPENTRAC, Connector.CAP_RF, Connector.CAP_WAYPOINT_SENDER, Connector.CAP_WEATHER

isOpen

public boolean isOpen()
Reports whether this Connector has an open connection to its port.

Specified by:
isOpen in class Connector
Returns:
boolean true if Connector is open

sendFrame

public void sendFrame(AX25Frame frame)
               throws java.io.IOException
Transmit an AX.25 frame through this port. May fail silently if port is not configured for transmission (receive-only).

Specified by:
sendFrame in class TransmittingPortConnector
Parameters:
frame - AX25Frame object to transmit
Throws:
java.io.IOException - if transmit failed for any reason other than a receive-only port

failureGuiCreated

public void failureGuiCreated(PortFailureReporterIfc failureGui)
Specify the lazily-created failure reporting GUI object for the reported failure.

Specified by:
failureGuiCreated in interface PortFailureReportListener
Parameters:
failureGui - PortFailureReporterIfc object for the GUI
See Also:
GuiIfc.showIOFailureDialog(org.ka2ddo.yaac.io.PortConfig, String, org.ka2ddo.yaac.io.PortFailureReportListener)

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 interface PortFailureReportListener

run

public void run()
Do not call. Reserved internal method for KissOverTcpConnector.

Specified by:
run in interface java.lang.Runnable

uncaughtException

public final void uncaughtException(java.lang.Thread t,
                                    java.lang.Throwable e)
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 interface java.lang.Thread.UncaughtExceptionHandler
Parameters:
t - the thread
e - the exception

getBitRate

public int getBitRate()
Get the bit transmission rate on this port.

Overrides:
getBitRate in class TNCConnector
Returns:
bit rate in bits per second (baud)

getFldigiVersion

public java.lang.String 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

public java.lang.String 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

getModemList

public java.lang.String[] 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

public void setModem(java.lang.String modem)
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:
getModemList()