public class PortConfig extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<PortConfig>
Modifier and Type | Class and Description |
---|---|
static class |
PortConfig.Cfg
Port-type-specific configuration parameters for a PortConnector.
|
static class |
PortConfig.Fields
Enumeration identifying all the fields in a Cfg sub-record.
|
static class |
PortConfig.HintType
For the
ConfigImporter , provide hints of how required but non-transferable config fields
should be asked for. |
static class |
PortConfig.RequireFile
Data structure describing how the ConfigImporter should ask for missing (or
blanked-out) required port configuration parameters when they are a file in the
filesystem.
|
static class |
PortConfig.RequireHints
Data structure describing how the ConfigImporter should ask for missing (or
blanked-out) required port configuration parameters.
|
Modifier and Type | Field and Description |
---|---|
boolean |
enabled
Whether port should be opened automatically upon startup.
|
static int |
FLAGS_ALWAYS_RETRY
Indicates that port opening should always retry if it fails, even on initial opening.
|
static int |
FLAGS_DONT_COALESCE
When using timeslotting on a TNC port, don't coalesce duplicate packets (such as beacons or
status frames).
|
static int |
FLAGS_HARDWARE
Indicate that
PortConfig.Cfg.deviceName is of a hardware device rather than
some software concept (like a network port). |
static int |
FLAGS_HF
Indicates this is a TNC port over HF (low bandwidth, wide geographic coverage).
|
static int |
FLAGS_IS_SRV_INST_NAME
When looking up a TCP/IP network object, the
deviceName is not a fully-qualified domain name (FQDN)
or numeric IP address of the target, but rather a service instance name for some service supported
by the port per Internet RFC 6763 (DNS-Based Service Discovery), such that the code needs to do a
service discovery to get the correct host name prior to using DNS to translate the host name. |
static int |
FLAGS_LOCAL
Indicates that this data should be consumed locally as well as transmitted.
|
static int |
FLAGS_MASK_KISSPORT
These four bits contain the KISS device ID to be used in KISS frames sent through this port.
|
static int |
FLAGS_NODTR
Indicates that non-flow-control serial ports should not raise the DTR and RTS signals.
|
static int |
FLAGS_PIPELINED
Indicates that this port does not require the port driver to wait for the external
device to finish processing the last outbound traffic before sending more traffic.
|
static int |
FLAGS_SHIFT_KISSPORT
This constant gets the number of bits to shift the above
FLAGS_MASK_KISSPORT bits right
to put them in the least significant bits of an integer value. |
static int |
FLAGS_UDP
Indicates this is a UDP socket (not TCP).
|
static int |
FLAGS_USE_WORKAROUND
Indicates that work-around for strange device features should be used on this port.
|
static int |
MAX_PROTOCOL_BIT
Highest bit number supported in protocol bit mask.
|
static java.lang.String[] |
NO_ALIASES
Empty array for ports that have no supported aliases.
|
java.lang.String |
portType
Type of PortConnector used to implement this port, generally defined as a String constant
named PORT_TYPE on the PortConnector subclass.
|
static int |
PROTOCOL_APRS
Flag bit indicating this port allows transmitting APRS packets.
|
static int |
PROTOCOL_AX25
Flag bit indicating this port allows transmitting AX.25 frames containing traffic of types
other than APRS or OpenTRAC UI frames.
|
static int |
PROTOCOL_OPENTRAC
Flag bit indicating this port allows transmitting OpenTRAC packets.
|
static int |
PROTOCOL_OTHER_TRANSPORT
Flag bit indicating this port allows transmitting frames on some other
transport, where the port driver handles all transcription issues between
APRS packets and the other protocol.
|
static int |
SENTENCE_GPWPL
Send NMEA standard waypoint message back to GPS.
|
static int |
SENTENCE_NONE
No waypoint sentences sent to GPS on this port.
|
static int |
SENTENCE_PKWDWPL
Send Kenwood-specific waypoint message back to GPS.
|
Constructor and Description |
---|
PortConfig()
Create a new PortConfig record with a new port instance identifier.
|
PortConfig(java.lang.String displayName)
Craete a PortConfig record with the specified port instance identifier.
|
Modifier and Type | Method and Description |
---|---|
void |
assignPortNumber()
Allocate a new port number for this PortConfig object.
|
int |
compareTo(PortConfig other)
Compares this object with the specified object for order.
|
void |
copyInto(PortConfig dest)
Do a deep copy of this PortConfig object into another object..
|
PortConfig.Cfg |
current()
Get the port-type-specific configuration parameters for the currently specified port type.
|
void |
decodePreferenceValue(java.lang.String values)
Decode the storage format used to store a PortConfig in Java Preferences into
this PortConfig object.
|
PortConfig |
dup()
Make a deep copy of this PortConfig object.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
java.lang.String |
generatePrefsString()
Generate the encoded String for storing the PortConfig into Java Preferences.
|
java.lang.String |
getDisplayName()
Get the name by which this port will be identified.
|
int |
getPortNumber()
Get the arbitrary sequence port number assigned to this configuration record.
|
int |
hashCode()
Returns a hash code value for the object.
|
static PortConfig |
readFromPreferences(java.util.prefs.Preferences root,
java.lang.String displayName)
Read a PortConfig object from Java Preferences.
|
void |
removeFromPreferences(java.util.prefs.Preferences root)
Delete this PortConfig from the Java Preferences backing store.
|
PortConfig.Cfg |
specific(java.lang.String portType)
Get the port-type-specific configuration parameters for a specific port type.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
writeToPreferences(java.util.prefs.Preferences root)
Write this PortConfig object to Java Preferences on the Ports sub-node of the
specified Preferences node.
|
public static final java.lang.String[] NO_ALIASES
PortConfig.Cfg.digiAliases
public static final int PROTOCOL_APRS
public static final int PROTOCOL_OPENTRAC
public static final int PROTOCOL_AX25
public static final int PROTOCOL_OTHER_TRANSPORT
PROTOCOL_APRS
,
PROTOCOL_OPENTRAC
,
PortConfig.Cfg.acceptableProtocolsMask
,
ProtocolFamily.OTHER
,
Constant Field Valuespublic static final int MAX_PROTOCOL_BIT
public static final int SENTENCE_NONE
public static final int SENTENCE_GPWPL
public static final int SENTENCE_PKWDWPL
public static final int FLAGS_HF
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_UDP
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_LOCAL
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_NODTR
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_ALWAYS_RETRY
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_USE_WORKAROUND
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_PIPELINED
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_DONT_COALESCE
PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_MASK_KISSPORT
KissOverTcpConnector
port type when talking to the DireWolf
software TNC which can support up to 6 audio devices (and therefore up to 6 device IDs in
KISS frames). Conveniently, since these bits weren't used before, the backwards-compatible
default KISS device ID is zero.PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_SHIFT_KISSPORT
FLAGS_MASK_KISSPORT
bits right
to put them in the least significant bits of an integer value.PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_IS_SRV_INST_NAME
deviceName
is not a fully-qualified domain name (FQDN)
or numeric IP address of the target, but rather a service instance name for some service supported
by the port per Internet RFC 6763 (DNS-Based Service Discovery), such that the code needs to do a
service discovery to get the correct host name prior to using DNS to translate the host name.PortConfig.Cfg.flags
,
Constant Field Valuespublic static final int FLAGS_HARDWARE
PortConfig.Cfg.deviceName
is of a hardware device rather than
some software concept (like a network port).public java.lang.String portType
public boolean enabled
public PortConfig()
public PortConfig(java.lang.String displayName)
displayName
- port identifier name to usepublic final PortConfig.Cfg current()
public final PortConfig.Cfg specific(java.lang.String portType)
portType
- the name of the port type whose configuration parameters should be obtainedpublic void assignPortNumber()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.hashCode()
public int hashCode()
java.util.Hashtable
.hashCode
in class java.lang.Object
equals(Object)
public java.lang.String getDisplayName()
public int getPortNumber()
public java.lang.String toString()
toString
in class java.lang.Object
public PortConfig dup()
public void copyInto(PortConfig dest)
dest
- destination PortConfigpublic int compareTo(PortConfig other)
compareTo
in interface java.lang.Comparable<PortConfig>
other
- the object to be compared.java.lang.ClassCastException
- if the specified object's type prevents it
from being compared to this object.public void writeToPreferences(java.util.prefs.Preferences root)
root
- Preferences node to use to store the Ports sub-nodepublic java.lang.String generatePrefsString()
Generate the encoded String for storing the PortConfig into Java Preferences. The preferences String consists of multiple expressions separated by semicolon ";" characters. The first expression (required) will have the following format:
portType,deviceName,baudRateOrPortNumber,callsign,passcode,transmitEnabled[,digipeatAlias[,...]]
where deviceName and passcode are escaped to be legitimate text in an XML tag body, transmitEnabled is either "true" or "false", and there can be any number of digipeat aliases in the syntax of display-format AX.25 callsign-SSID values.
The second expression is a APRS-IS filter expression.
The third expression is "true" or "false" for whether this port is enabled for operation.
The fourth expression is "true" or "false" for whether flow control (or something overloading the meaning of this field) should be enabled or not.
The fifth expression is a decimal number of the value of the PortConfig.Cfg.acceptableProtocolsMask
bitmask.
The sixth expression is three decimal numbers separated by a slash "/" character representing the timeslot offset (relative to the top of the cycle) in seconds, the length of the timeslot cycle in seconds, and the length of one timeslot (time before sending station must stop sending even if there is more queued traffic to send). Negative cycle length indicates that timeslotting is not used, but the values are preserved in case the user wants to turn timeslotting back on.
The seventh expression is a decimal number of the value of the PortConfig.Cfg.flags
bitmask.
Bit meanings are portType-specific.
The eighth expression is a pipe "|" separated list of names of BeaconData
definitions that should be transmitted through this port. Only meaningful for ports
capable of transmitting APRS or OpenTRAC packets.
decodePreferenceValue(String)
public void removeFromPreferences(java.util.prefs.Preferences root)
root
- Preferences node used to store the Ports sub-nodepublic static PortConfig readFromPreferences(java.util.prefs.Preferences root, java.lang.String displayName)
root
- Preferences node used to store the Ports sub-nodedisplayName
- the String port identifier name to readpublic void decodePreferenceValue(java.lang.String values)
values
- String of encoded valuesgeneratePrefsString()