public abstract class ComPortCommand
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
ComPortCommand(java.lang.String name,
int command,
int[] bytes)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
int[] |
getBytes()
Get the encoding of this instance.
|
int |
getCommand()
Get the command byte.
|
java.lang.String |
getName()
Get the human-readable name of this option.
|
int |
hashCode() |
boolean |
isServerCommand()
Determine if this command is client-to-server or server-to-client.
|
abstract java.lang.String |
toString()
Get the human-readable description of this option.
|
abstract void |
visit(ComPortCommandSwitch sw)
Apply visitor pattern.
|
protected ComPortCommand(java.lang.String name,
int command,
int[] bytes)
name - human readable name of this commandcommand - required COM-PORT-OPTION command byte value (must be the client-to-server value)bytes - encoded command starting with the COM-PORT-OPTION byte
NullPointerException if bytes is null
IllegalArgumentException if bytes has length that is too short or too long
IllegalArgumentException if bytes[0] is not RFC2217.COM_PORT_OPTION
IllegalArgumentException if command is greater than or equal to RFC2217.SERVER_OFFSET
IllegalArgumentException if bytes[1] is not command
or command + RFC2217.SERVER_OFFSETpublic final boolean isServerCommand()
public final int[] getBytes()
COM-PORT-OPTIONpublic final int getCommand()
public java.lang.String getName()
public abstract java.lang.String toString()
toString in class java.lang.Objectpublic abstract void visit(ComPortCommandSwitch sw)
sw - visitor switch handlerpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object