Class ConnectableDevice

  • Direct Known Subclasses:
    StandardReader

    public abstract class ConnectableDevice
    extends Object
    Author:
    jannis becke
    • Field Detail

      • STATE_CONNECTING

        public static final int STATE_CONNECTING
        the master is connecting
        See Also:
        Constant Field Values
      • STATE_RUNNING

        public static final int STATE_RUNNING
        the master is running
        See Also:
        Constant Field Values
      • STATE_STOPPED

        public static final int STATE_STOPPED
        the master is stopped
        See Also:
        Constant Field Values
      • STATE_WAITING_FOR_RECONNECT

        public static final int STATE_WAITING_FOR_RECONNECT
        the master is waiting during reconnect
        See Also:
        Constant Field Values
      • STATE_CONFIGURING

        public static final int STATE_CONFIGURING
        the master is being configured
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConnectableDevice

        public ConnectableDevice​(String identifier,
                                 ICommConnection connection)
        Construct a new StandardReader instance with the specified connection
        Parameters:
        identifier - reader identifier
        connection - connection
    • Method Detail

      • getIdentifier

        public String getIdentifier()
        Returns:
        the identifier
      • setIdentifier

        public void setIdentifier​(String identifier)
        Parameters:
        identifier - the identifier to set
      • start

        public void start()
        Start the reader
      • start

        public void start​(int heartBeatInterval)
        Start the reader
        Parameters:
        heartBeatInterval - heart beat interval in seconds
      • connect

        public void connect​(long timeout)
                     throws CommConnectionException
        connect the reader and wait until the reader is connected
        Parameters:
        timeout - max time to try connect and configure the reader
        Throws:
        CommConnectionException - if an error occurs
      • isConnected

        public boolean isConnected()
        Returns:
        the connection state
      • setMaxReconnectWaitTime

        public void setMaxReconnectWaitTime​(long timeInMilliseconds)
        Set the minimum time before attempting to reconnect. Default value 21600000ms (6h).
        Parameters:
        timeInMilliseconds - maximum reconnect wait time in milliseconds
      • setMinReconnectWaitTime

        public void setMinReconnectWaitTime​(long timeInMilliseconds)
        Set the minimum time before attempting to reconnect. Default value 2000ms.
        Parameters:
        timeInMilliseconds - minimum reconnect wait time in milliseconds
      • getReceiveTimeout

        public int getReceiveTimeout()
        Returns:
        the receiveTimeout
      • setReceiveTimeout

        public void setReceiveTimeout​(int receiveTimeout)
        Parameters:
        receiveTimeout - the receiveTimeout to set