com.tibbo.aggregate.common.communication

## Class AbstractDeviceController<I extends Command,O extends Command>

- java.lang.Object
- - com.tibbo.aggregate.common.communication.AbstractDeviceController<I,O>

- All Implemented Interfaces:
    CommandParserListener
  Direct Known Subclasses:
    AbstractAggreGateDeviceController

      public abstract class AbstractDeviceController<I extends Command,O extends Command>
      extends java.lang.Object
      implements CommandParserListener

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractDeviceController(long commandTimeout, org.apache.log4j.Logger logger)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `checkAndConnect()`
    `void` | `connect()`
    `protected abstract boolean` | `connectImpl()`
    `void` | `disconnect()`
    `protected abstract void` | `disconnectImpl()`
    `java.util.List<ReplyMonitor<O,I>>` | `getActiveCommands()`
    `protected CommandParser<I>` | `getCommandParser()`
    `long` | `getCommandTimeout()`
    `org.apache.log4j.Logger` | `getLogger()`
    `CommandProcessorStatistics` | `getStatistics()`
    `boolean` | `isActive()`
    `boolean` | `isConnected()`
    `boolean` | `isLoggedIn()`
    `void` | `login()`
    `protected abstract boolean` | `loginImpl()`
    `void` | `newDataReceived()`
    `protected void` | `processAsyncCommand(I cmd)`
    `protected void` | `resetCommandTimeouts()`
    `protected abstract void` | `send(O cmd)`
    `I` | `sendCommand(O cmd)`
    `protected void` | `setCommandParser(CommandParser commandParser)`
    `void` | `setCommandTimeout(long commandTimeout)`
    `protected void` | `setConnected(boolean connected)`
    `void` | `setLoggedIn(boolean loggedIn)`
    `void` | `setResetTimeoutsOnData(boolean resetTimeoutWhenDataReceived)`
    `protected void` | `startCommandProcessor()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractDeviceController

          public AbstractDeviceController(long commandTimeout,
                                          org.apache.log4j.Logger logger)

  - ### Method Detail

    - #### connectImpl

          protected abstract boolean connectImpl()
                                          throws DisconnectionException,
                                                 java.io.IOException,
                                                 java.lang.InterruptedException,
                                                 RemoteDeviceErrorException,
                                                 ContextException

      Throws:
        `DisconnectionException`
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`
        `ContextException`

    - #### loginImpl

          protected abstract boolean loginImpl()
                                        throws ContextException

      Throws:
        `ContextException`

    - #### disconnectImpl

          protected abstract void disconnectImpl()
                                          throws java.io.IOException,
                                                 java.lang.InterruptedException,
                                                 RemoteDeviceErrorException

      Throws:
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`

    - #### send

          protected abstract void send(O cmd)
                                throws DisconnectionException,
                                       java.io.IOException,
                                       java.lang.InterruptedException

      Throws:
        `DisconnectionException`
        `java.io.IOException`
        `java.lang.InterruptedException`

    - #### connect

          public void connect()
                       throws DisconnectionException,
                              java.io.IOException,
                              java.lang.InterruptedException,
                              RemoteDeviceErrorException,
                              ContextException

      Throws:
        `DisconnectionException`
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`
        `ContextException`

    - #### checkAndConnect

          protected void checkAndConnect()
                                  throws DisconnectionException,
                                         java.io.IOException,
                                         java.lang.InterruptedException,
                                         RemoteDeviceErrorException,
                                         ContextException

      Throws:
        `DisconnectionException`
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`
        `ContextException`

    - #### login

          public void login()
                     throws ContextException

      Throws:
        `ContextException`

    - #### disconnect

          public void disconnect()
                          throws java.io.IOException,
                                 java.lang.InterruptedException,
                                 RemoteDeviceErrorException

      Throws:
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`

    - #### sendCommand

          public I sendCommand(O cmd)
                        throws DisconnectionException,
                               java.io.IOException,
                               java.lang.InterruptedException,
                               RemoteDeviceErrorException,
                               ContextException

      Throws:
        `DisconnectionException`
        `java.io.IOException`
        `java.lang.InterruptedException`
        `RemoteDeviceErrorException`
        `ContextException`

    - #### isActive

          public boolean isActive()

    - #### processAsyncCommand

          protected void processAsyncCommand(I cmd)

    - #### newDataReceived

          public void newDataReceived()

      Specified by:
        `newDataReceived` in interface `CommandParserListener`

    - #### resetCommandTimeouts

          protected void resetCommandTimeouts()

    - #### startCommandProcessor

          protected void startCommandProcessor()

    - #### setCommandParser

          protected void setCommandParser(CommandParser commandParser)

    - #### isConnected

          public boolean isConnected()

    - #### setConnected

          protected void setConnected(boolean connected)

    - #### isLoggedIn

          public boolean isLoggedIn()

    - #### setLoggedIn

          public void setLoggedIn(boolean loggedIn)

    - #### getCommandParser

          protected CommandParser<I> getCommandParser()

    - #### setResetTimeoutsOnData

          public void setResetTimeoutsOnData(boolean resetTimeoutWhenDataReceived)

    - #### getActiveCommands

          public java.util.List<ReplyMonitor<O,I>> getActiveCommands()

    - #### getCommandTimeout

          public long getCommandTimeout()

    - #### setCommandTimeout

          public void setCommandTimeout(long commandTimeout)

    - #### getLogger

          public org.apache.log4j.Logger getLogger()

    - #### getStatistics

          public CommandProcessorStatistics getStatistics()