org.dellroad.jvser
Class ControlCommand

java.lang.Object
  extended by org.dellroad.jvser.ComPortCommand
      extended by org.dellroad.jvser.ControlCommand

public class ControlCommand
extends ComPortCommand

RFC 2217 SET-CONTROL command.

See Also:
RFC 2217

Constructor Summary
ControlCommand(boolean client, int command)
          Encoding constructor.
ControlCommand(int[] bytes)
          Decoding constructor.
 
Method Summary
 int getControl()
           
 String toString()
          Get the human-readable description of this option.
 void visit(ComPortCommandSwitch sw)
          Apply visitor pattern.
 
Methods inherited from class org.dellroad.jvser.ComPortCommand
equals, getBytes, getCommand, getName, hashCode, isServerCommand
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlCommand

public ControlCommand(int[] bytes)
Decoding constructor.

Parameters:
bytes - encoded option starting with the COM-PORT-OPTION byte
Throws:
NullPointerException - if bytes is null
IllegalArgumentException - if bytes has length != 3
IllegalArgumentException - if bytes[0] is not RFC2217.COM_PORT_OPTION
IllegalArgumentException - if bytes[1] is not RFC2217.SET_CONTROL (client or server)
IllegalArgumentException - if bytes[2] is not a valid RFC 2217 control value

ControlCommand

public ControlCommand(boolean client,
                      int command)
Encoding constructor.

Parameters:
command - control command
client - true for the client-to-server command, false for the server-to-client command
Throws:
IllegalArgumentException - if command is not a valid RFC 2217 control value
Method Detail

toString

public String toString()
Description copied from class: ComPortCommand
Get the human-readable description of this option.

Specified by:
toString in class ComPortCommand

visit

public void visit(ComPortCommandSwitch sw)
Description copied from class: ComPortCommand
Apply visitor pattern.

Specified by:
visit in class ComPortCommand
Parameters:
sw - visitor switch handler

getControl

public int getControl()