Class ComPortCommand

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ComPortCommand​(java.lang.String name, int command, int[] bytes)
      Constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ComPortCommand

        protected ComPortCommand​(java.lang.String name,
                                 int command,
                                 int[] bytes)
        Constructor.
        Parameters:
        name - human readable name of this command
        command - 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_OFFSET
    • Method Detail

      • isServerCommand

        public final boolean isServerCommand()
        Determine if this command is client-to-server or server-to-client.
        Returns:
        true if this command is sent from the server to the client, false for the opposite
      • getBytes

        public final int[] getBytes()
        Get the encoding of this instance.
        Returns:
        encoding starting with COM-PORT-OPTION
      • getCommand

        public final int getCommand()
        Get the command byte.
        Returns:
        RFC 2217-defined byte value for this command
      • getName

        public java.lang.String getName()
        Get the human-readable name of this option.
      • toString

        public abstract java.lang.String toString()
        Get the human-readable description of this option.
        Overrides:
        toString in class java.lang.Object
      • visit

        public abstract void visit​(ComPortCommandSwitch sw)
        Apply visitor pattern.
        Parameters:
        sw - visitor switch handler
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object