|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject org.fosstrak.llrp.adaptor.ReaderImpl
public class ReaderImpl
This class implements the ReaderInterface. The Reader implementation
maintains two queues to decouple the user interface from the actual message
delivery over the network.
1. from the user to the LLRP reader: the message to be sent is put into a
queue. a queue watch-dog awakes as soon as there are messages in the queue
and delivers them via LTK.
2. from the LLRP reader to user: the incoming message from the reader is
stored into a queue. a queue watch-dog awakes as soon as there are messages
in the queue and delivers them to the user.
Nested Class Summary | |
---|---|
static class |
ReaderImpl.QueuePolicy
queue policies. |
Field Summary | |
---|---|
static int |
DEFAULT_KEEPALIVE_PERIOD
the default keep-alive interval for the reader. |
static int |
DEFAULT_MISS_KEEPALIVE
default how many times a keep-alive can be missed. |
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Constructor Summary | |
---|---|
ReaderImpl(Adaptor adaptor,
java.lang.String readerName,
java.lang.String readerAddress)
constructor for a local reader stub. the stub maintains connection to the llrp reader. |
|
ReaderImpl(Adaptor adaptor,
java.lang.String readerName,
java.lang.String readerAddress,
int port)
constructor for a local reader stub. the stub maintains connection to the llrp reader. |
Method Summary | |
---|---|
void |
connect(boolean clientInitiatedConnection)
connects this reader to the real physical llrp reader. |
void |
deregisterFromAsynchronous(AsynchronousNotifiable receiver)
deregister from the asynchronous messages. the receiver will no more receive asynchronous llrp messages. |
void |
disconnect()
disconnect the reader stub from the physical reader. |
void |
errorOccured(java.lang.String message)
when there is an error, the ltk will call this method. |
int |
getKeepAlivePeriod()
returns the keepalive period set for this reader. |
ReaderMetaData |
getMetaData()
the reader meta-data contains information about the reader, the settings, etc. |
int |
getPort()
return the port of this reader. |
java.lang.String |
getReaderAddress()
return the ip address of this reader. |
java.lang.String |
getReaderName()
return the name of this reader. |
boolean |
isClientInitiated()
tell if this reader maintains a client initiated connection or if the reader accepts a connection from a llrp reader. |
boolean |
isConnected()
tells if the reader is connected or not. |
boolean |
isConnectImmediate()
tells whether this reader connects immediately after creation. |
boolean |
isReportKeepAlive()
|
void |
messageReceived(org.llrp.ltk.types.LLRPMessage message)
when a message arrives through ltk, this method is called. |
void |
reconnect()
try to reconnect the reader. |
void |
registerForAsynchronous(AsynchronousNotifiable receiver)
register for asynchronous messages from the physical reader. |
void |
send(byte[] message)
send a message to the llrp reader. |
void |
setClientInitiated(boolean clientInitiated)
sets the connect behavior to the specified value. |
void |
setConnectImmediate(boolean value)
tells whether this reader connects immediately after creation. |
void |
setKeepAlivePeriod(int keepAlivePeriod,
int times,
boolean report,
boolean throwException)
sets the connection timeout period for the reader. if the times * keepAlivePeriod has passed by without a notification from the reader the reader gets disconnected. |
void |
setReportKeepAlive(boolean report)
if set to true, the reader will report all the keep-alive messages exchanged between the reader and the driver stub. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_KEEPALIVE_PERIOD
public static final int DEFAULT_MISS_KEEPALIVE
Constructor Detail |
---|
public ReaderImpl(Adaptor adaptor, java.lang.String readerName, java.lang.String readerAddress) throws java.rmi.RemoteException
adaptor
- the adaptor responsible for this reader.readerName
- the name of this reader.readerAddress
- the address where to connect.
java.rmi.RemoteException
- whenever there is an RMI exceptionpublic ReaderImpl(Adaptor adaptor, java.lang.String readerName, java.lang.String readerAddress, int port) throws java.rmi.RemoteException
adaptor
- the adaptor responsible for this reader.readerName
- the name of this reader.readerAddress
- the address where to connect.port
- the port where to connect.
java.rmi.RemoteException
- whenever there is an RMI exceptionMethod Detail |
---|
public void connect(boolean clientInitiatedConnection) throws LLRPRuntimeException, java.rmi.RemoteException
Reader
connect
in interface Reader
clientInitiatedConnection
- if the connection is initiated by the client then
you should pass true. if the physical reader initiates the connection then provide false.
LLRPRuntimeException
- whenever an error occurs.
java.rmi.RemoteException
- whenever there is an rmi error.public void disconnect() throws java.rmi.RemoteException
Reader
disconnect
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public void reconnect() throws LLRPRuntimeException, java.rmi.RemoteException
Reader
reconnect
in interface Reader
LLRPRuntimeException
- whenever there is a exception during connection setup.
java.rmi.RemoteException
- whenever there is an rmi error.public void send(byte[] message) throws java.rmi.RemoteException
Reader
send
in interface Reader
message
- the message to be sent.
java.rmi.RemoteException
- whenever there is an rmi error.public boolean isConnected() throws java.rmi.RemoteException
Reader
isConnected
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public void errorOccured(java.lang.String message)
errorOccured
in interface org.llrp.ltk.net.LLRPEndpoint
message
- the error message from ltk.public void messageReceived(org.llrp.ltk.types.LLRPMessage message)
messageReceived
in interface org.llrp.ltk.net.LLRPEndpoint
message
- the llrp message delivered by ltk.public java.lang.String getReaderAddress() throws java.rmi.RemoteException
Reader
getReaderAddress
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public int getPort() throws java.rmi.RemoteException
Reader
getPort
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public boolean isClientInitiated() throws java.rmi.RemoteException
Reader
isClientInitiated
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public void setClientInitiated(boolean clientInitiated) throws java.rmi.RemoteException
Reader
setClientInitiated
in interface Reader
clientInitiated
- if true then the client issues the connect.
java.rmi.RemoteException
- whever there is an RMI error.public void registerForAsynchronous(AsynchronousNotifiable receiver) throws java.rmi.RemoteException
Reader
registerForAsynchronous
in interface Reader
receiver
- the receiver that shall be notified with the message.
java.rmi.RemoteException
- whenever there is an RMI error.public void deregisterFromAsynchronous(AsynchronousNotifiable receiver) throws java.rmi.RemoteException
Reader
deregisterFromAsynchronous
in interface Reader
receiver
- the receiver to deregister.
java.rmi.RemoteException
- whenever there is an RMI error.public java.lang.String getReaderName() throws java.rmi.RemoteException
Reader
getReaderName
in interface Reader
java.rmi.RemoteException
- whenever there is an rmi error.public boolean isConnectImmediate() throws java.rmi.RemoteException
Reader
isConnectImmediate
in interface Reader
java.rmi.RemoteException
- whenever there is an RMI error.public void setConnectImmediate(boolean value) throws java.rmi.RemoteException
Reader
setConnectImmediate
in interface Reader
value
- whether this reader connects immediately after creation.
java.rmi.RemoteException
- whenever there is an RMI error.public int getKeepAlivePeriod() throws java.rmi.RemoteException
Reader
getKeepAlivePeriod
in interface Reader
java.rmi.RemoteException
- whenever there is an RMI error.public void setKeepAlivePeriod(int keepAlivePeriod, int times, boolean report, boolean throwException) throws java.rmi.RemoteException
Reader
setKeepAlivePeriod
in interface Reader
keepAlivePeriod
- the reader must send in this period a keepalive message. time in ms.times
- how many missed keepalive messages are ok.report
- whether to report the keepalive messages to the repo or not.throwException
- whether to throw an exception upon disconnection.
java.rmi.RemoteException
- whenever there is an RMI error.public void setReportKeepAlive(boolean report) throws java.rmi.RemoteException
Reader
setReportKeepAlive
in interface Reader
report
- if true report the status messages. if false not.
java.rmi.RemoteException
- whenever there is an RMI error.public boolean isReportKeepAlive() throws java.rmi.RemoteException
isReportKeepAlive
in interface Reader
java.rmi.RemoteException
- whenever there is an RMI error.public final ReaderMetaData getMetaData() throws java.rmi.RemoteException
Reader
getMetaData
in interface Reader
java.rmi.RemoteException
- whenever there is an RMI error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |