public abstract class PortConnector extends Connector
To support the dynamically plugin-built support for multiple port types, each non-abstract PortConnector subclass must define the following public static final fields:
PortConfig.portType field of PortConfig records)
Connector.PortStats| Modifier and Type | Field and Description |
|---|---|
PortConfig.Cfg |
currentCfg
The port type-specific configuration associated with this PortConnector.
|
PortConfig |
portConfig
The port configuration associated with this PortConnector.
|
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 and Description |
|---|
PortConnector() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addFrameListener(FrameListener l)
Add an object that wants to be informed of incoming raw AX.25 frames.
|
void |
addPortEventListener(PortEventListener l)
Register a listener for port transmission and/or reception events.
|
abstract void |
configure(PortConfig cfg)
Update the configuration of the connector to match the updated
setup.
|
static PortConnector |
createPort(PortConfig cfg)
Instantiate a PortConnector object of the type specified in the configuration object.
|
static void |
fireConsumeFrame(AX25Frame frame,
long rcptTimeInMsecSinceEpoch)
Send an AX.25 frame to all the listeners expecting to process raw frames,
|
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,
|
void |
fireFailed()
Report to interested listeners that the port has failed for some reason.
|
void |
fireReceiving(boolean isReceiving)
Report to interested listeners that the port has started or stopped receiving.
|
protected void |
fireTransmitting(boolean isTransmitting)
Report to interested listeners that the port has started or stopped transmitting.
|
static java.lang.Class<? extends PortConnector> |
getPortConnectorClass(java.lang.String portTypeName)
Get the class corresponding to a particular port type name.
|
static java.util.Collection<java.lang.Class<? extends PortConnector>> |
portConnectorClasses()
Get all the concrete subclasses of PortConnector currently registered in YAAC for
which instances can be created and configured.
|
static java.util.Set<java.lang.String> |
portTypeNames()
Get all the registered PortConnector names that should be displayed in the port configuration
dialog as a port type.
|
static void |
registerPortConnectorType(java.lang.String typeName,
java.lang.Class<? extends PortConnector> pcClazz)
Add a new subclass of PortConnector to the supported map of PortConnector types.
|
static void |
removeFrameListener(FrameListener l)
Remove an object that used to be informed about incoming raw AX.25 frames.
|
void |
removePortEventListener(PortEventListener l)
Unregister a listener so it no longer is informed of transmission and
reception events.
|
void |
setPortConfig(PortConfig portConfig)
Store the configuration associated with this PortConnector.
|
close, finalize, getCallsign, getCapabilities, getStats, hasCapability, isOpenpublic PortConfig portConfig
public PortConfig.Cfg currentCfg
public static void registerPortConnectorType(java.lang.String typeName,
java.lang.Class<? extends PortConnector> pcClazz)
typeName - String name of PortConnector subclasspcClazz - the Class object for instantiating objects of this typepublic static java.util.Set<java.lang.String> portTypeNames()
public static java.util.Collection<java.lang.Class<? extends PortConnector>> portConnectorClasses()
public static java.lang.Class<? extends PortConnector> getPortConnectorClass(java.lang.String portTypeName)
portTypeName - String name of port connector typepublic static void addFrameListener(FrameListener l)
l - FrameListener to addpublic static void removeFrameListener(FrameListener l)
l - FrameListener to unregisterpublic void addPortEventListener(PortEventListener l)
l - PortEventListener to registerpublic void removePortEventListener(PortEventListener l)
l - PortEventListener to unregisterprotected AX25Frame fireConsumeFrame(byte[] buf, int offset, int length, long rcptTimeInMsecSinceEpoch)
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 arrivingpublic static void fireConsumeFrame(AX25Frame frame, long rcptTimeInMsecSinceEpoch)
frame - AX25Frame to processrcptTimeInMsecSinceEpoch - time since Unix epoch when frame started arrivingprotected void fireTransmitting(boolean isTransmitting)
isTransmitting - boolean true if transmission has started, false if stoppedpublic void fireReceiving(boolean isReceiving)
isReceiving - boolean true if reception has started, false if stoppedpublic void fireFailed()
public static PortConnector createPort(PortConfig cfg) throws java.net.UnknownServiceException, java.io.IOException
cfg - PortConfig object identifying what type of port to createjava.io.IOException - if port could not be instantiatedjava.net.UnknownServiceException - if port type not recognizedpublic abstract void configure(PortConfig cfg) throws java.io.IOException, java.lang.IllegalArgumentException
cfg - PortConfig defining new port settingsjava.io.IOException - if interface changes could not be appliedjava.lang.IllegalArgumentException - if type information is invalid for
changing the settings of this PortConnectorpublic void setPortConfig(PortConfig portConfig)
portConfig - PortConfig matching the PortConnector subclass's type