Package com.metratec.lib.rfidreader
Class ConnectableDevice
- java.lang.Object
-
- com.metratec.lib.rfidreader.ConnectableDevice
-
- Direct Known Subclasses:
StandardReader
public abstract class ConnectableDevice extends Object
- Author:
- jannis becke
-
-
Field Summary
Fields Modifier and Type Field Description static int
STATE_CONFIGURING
the master is being configuredstatic int
STATE_CONNECTING
the master is connectingstatic int
STATE_RUNNING
the master is runningstatic int
STATE_STOPPED
the master is stoppedstatic int
STATE_WAITING_FOR_RECONNECT
the master is waiting during reconnect
-
Constructor Summary
Constructors Constructor Description ConnectableDevice(String identifier, ICommConnection connection)
Construct a new StandardReader instance with the specified connection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect()
start the reader but also wait until the reader is connected and initializedvoid
connect(long timeout)
connect the reader and wait until the reader is connectedvoid
disconnect()
close the connectionString
getIdentifier()
int
getReceiveTimeout()
boolean
isConnected()
void
setIdentifier(String identifier)
void
setMaxReconnectWaitTime(long timeInMilliseconds)
Set the minimum time before attempting to reconnect.void
setMinReconnectWaitTime(long timeInMilliseconds)
Set the minimum time before attempting to reconnect.void
setReceiveTimeout(int receiveTimeout)
void
start()
Start the readervoid
start(int heartBeatInterval)
Start the readervoid
stop()
stop the reader
-
-
-
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 identifierconnection
- 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() throws CommConnectionException
start the reader but also wait until the reader is connected and initialized- Throws:
CommConnectionException
- if an error occurs
-
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
-
stop
public void stop() throws CommConnectionException
stop the reader- Throws:
CommConnectionException
- possible ICommConnection Error codes:- UNHANDLED_ERROR
-
disconnect
public void disconnect() throws CommConnectionException
close the connection- Throws:
CommConnectionException
- possible ICommConnection Error codes:- UNHANDLED_ERROR
-
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
-
-