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)
To support configuration transfer, the subclass must also define the following public static final fields:
PortConfig.Fields
enums for the fields that should not be copied for this port driverPortConfig.Fields
enums for the fields that must be defined for this port driver,
mapping to PortConfig.RequireHints
structures containing the ResourceBundle keys for their UI prompt strings
if they are undefinedIf a field is both required and blanked, the configuration import code will prompt for the missing field.
To support the -createport command-line option, a port type whose port editor class changes the defaults in the PortConfig.Cfg object for a new port should have those changes performed by a public static method named fillinConfigDefaults(PortConfig.Cfg) in the PortConnector subclass, so that the command-line port creation logic can fill in those defaults to deal with new port specifications that are not complete.
PortConfig.RequireHints
Modifier and Type | Class and Description |
---|---|
static class |
PortConnector.PortStatsType
This enum is used to select which sets of statistics should be returned.
|
Connector.ConnectorType, 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_ADSB, CAP_FAST_RF_9600, CAP_FULL_DUPLEX, CAP_GPS_DATA, CAP_HF, CAP_IGATE, CAP_KENWOOD_CMD, CAP_OPENTRAC, CAP_OTHER_TRANSPORT, CAP_RAW_AX25, CAP_RCV_PACKET_DATA, CAP_RF, CAP_SUBCLIENT, CAP_WAYPOINT_SENDER, CAP_WEATHER, CAP_XMT_PACKET_DATA, stats
Modifier | Constructor and Description |
---|---|
protected |
PortConnector()
Create a PortConnector.
|
Modifier and Type | Method and Description |
---|---|
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 |
fillinConfigDefaultsForType(PortConfig cfg)
Fill in the port-type-specific defaults for a port configuration.
|
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.
|
int |
getBitRate()
Get the bit transmission rate on this port.
|
java.util.Set<PortConnector.PortStatsType> |
getCollectedStatsTypes()
Get all the categories of statistics currently collected on this port.
|
PortConfig |
getPortConfig()
Get the current configuration object for this PortConnector.
|
static java.lang.Class<? extends PortConnector> |
getPortConnectorClass(java.lang.String portTypeName)
Get the class corresponding to a particular port type name.
|
protected static java.util.Timer |
getPortConnectorInactivityTimer()
Get the Timer for use by PortConnectors to handle inactivity tests.
|
Connector.PortStats |
getStats(PortConnector.PortStatsType type)
Get a particular category of statistics for this port.
|
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.
|
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.
|
addFrameListener, close, finalize, fireConsumeFrame, fireConsumeFrame, getCallsign, getCapabilities, getStats, getType, hasCapability, isOpen, removeFrameListener
public PortConfig portConfig
public PortConfig.Cfg currentCfg
public Connector.PortStats getStats(PortConnector.PortStatsType type)
getCollectedStatsTypes()
method,
to prevent creation of spurious statistics with zero counts.type
- PortStatsType to obtainpublic java.util.Set<PortConnector.PortStatsType> getCollectedStatsTypes()
protected static java.util.Timer getPortConnectorInactivityTimer()
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 void addPortEventListener(PortEventListener l)
l
- PortEventListener to registerpublic void removePortEventListener(PortEventListener l)
l
- PortEventListener to unregisterprotected 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 void fillinConfigDefaultsForType(PortConfig cfg) throws java.net.UnknownServiceException, java.io.IOException
cfg
- PortConfig whose default values are to be adjustedjava.net.UnknownServiceException
- if the port type is unknownjava.io.IOException
- if some other problem occurs trying to fill in the defaultspublic 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 PortConfig getPortConfig()
configure(PortConfig)
,
Connector.close()
public void setPortConfig(PortConfig portConfig)
portConfig
- PortConfig matching the PortConnector subclass's typepublic int getBitRate()