org.llrp.ltk.net
Class LLRPConnection

java.lang.Object
  extended by org.llrp.ltk.net.LLRPConnection
Direct Known Subclasses:
LLRPAcceptor, LLRPConnector

public abstract class LLRPConnection
extends java.lang.Object

LLRPConnection represents an abstract interface for an LLRP connection at a LLRP reader or client. The actual implementation differ depending on whether it is a self-initiated connection or a remotely initiated connection.


Field Summary
static int CONNECT_TIMEOUT
           
protected  LLRPEndpoint endpoint
           
protected  LLRPIoHandlerAdapter handler
           
protected  org.apache.mina.common.IoSession session
           
static java.lang.String SYNC_MESSAGE_ANSWER
           
 
Constructor Summary
LLRPConnection()
           
 
Method Summary
protected  void checkLLRPConnectionAttemptStatus(long timeout)
          check whether ConnectionAttemptStatus in READER_NOTIFICATION message was set by reader to 'Success'.
 LLRPEndpoint getEndpoint()
          returns the endpoint which receives incoming LLRPMessages
 LLRPIoHandlerAdapter getHandler()
          returns the handler that handles incoming LLRPMessages and forwards them to LLRPEndpoint registered.
abstract  boolean reconnect()
          reconnect to existing connection
 void send(LLRPMessage message)
          sends an LLRP message without waiting for a response message.
 void setEndpoint(LLRPEndpoint endpoint)
          sets the endpoint which receives incoming LLRPMessages
 void setHandler(LLRPIoHandlerAdapter handler)
          sets the handler that handles incoming LLRPMessages and forwards them to LLRPEndpoint registered.
 LLRPMessage transact(LLRPMessage message)
          sends an LLRP message and returns the response message as defined in the LLRP specification.
 LLRPMessage transact(LLRPMessage message, long transactionTimeout)
          sends an LLRP message and returns the response message as defined in the LLRP specification timing out after the time interval specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECT_TIMEOUT

public static final int CONNECT_TIMEOUT
See Also:
Constant Field Values

SYNC_MESSAGE_ANSWER

public static final java.lang.String SYNC_MESSAGE_ANSWER
See Also:
Constant Field Values

endpoint

protected LLRPEndpoint endpoint

handler

protected LLRPIoHandlerAdapter handler

session

protected org.apache.mina.common.IoSession session
Constructor Detail

LLRPConnection

public LLRPConnection()
Method Detail

checkLLRPConnectionAttemptStatus

protected void checkLLRPConnectionAttemptStatus(long timeout)
                                         throws LLRPConnectionAttemptFailedException
check whether ConnectionAttemptStatus in READER_NOTIFICATION message was set by reader to 'Success'.

Parameters:
timeout - the wait time before reader replies with a status report
Throws:
LLRPConnectionAttemptFailedException

reconnect

public abstract boolean reconnect()
reconnect to existing connection

Returns:
boolean indicating failure (false) or success (true)

send

public void send(LLRPMessage message)
sends an LLRP message without waiting for a response message.

Parameters:
message - LLRP message to be sent

transact

public LLRPMessage transact(LLRPMessage message)
                     throws java.util.concurrent.TimeoutException
sends an LLRP message and returns the response message as defined in the LLRP specification.

Parameters:
message - LLRP message to be sent
Returns:
message LLRP response message
Throws:
java.util.concurrent.TimeoutException

transact

public LLRPMessage transact(LLRPMessage message,
                            long transactionTimeout)
                     throws java.util.concurrent.TimeoutException
sends an LLRP message and returns the response message as defined in the LLRP specification timing out after the time interval specified.

Parameters:
message - LLRP message to be sent
transactionTimeout - timeout
Returns:
message LLRP response message
Throws:
java.util.concurrent.TimeoutException

getEndpoint

public LLRPEndpoint getEndpoint()
returns the endpoint which receives incoming LLRPMessages

Returns:
the endpoint

setEndpoint

public void setEndpoint(LLRPEndpoint endpoint)
sets the endpoint which receives incoming LLRPMessages

Parameters:
endpoint - the endpoint to set

getHandler

public LLRPIoHandlerAdapter getHandler()
returns the handler that handles incoming LLRPMessages and forwards them to LLRPEndpoint registered.

Returns:
the handler

setHandler

public void setHandler(LLRPIoHandlerAdapter handler)
sets the handler that handles incoming LLRPMessages and forwards them to LLRPEndpoint registered.

Parameters:
handler - the handler to set


Copyright © 2007 ETH Zurich.