org.llrp.ltk.net
Class LLRPAcceptor

java.lang.Object
  extended by org.llrp.ltk.net.LLRPConnection
      extended by org.llrp.ltk.net.LLRPAcceptor

public class LLRPAcceptor
extends LLRPConnection

LLRPAcceptor implements a remotely initiated LLRP connection. Here is a simple code example:

LLRPAcceptor c = new LLRPAcceptor(endpoint);

c.bind();

// wait for incoming reader initiated connection .....

// send message asynchronously

c.send(llrpmessage);

// asynchronously LLRP messages arrive via LLRPEndpoint.messageReceived

// send message synchronously

LLRPMessage m = c.transact(llrpmessage);


Field Summary
static int IDLE_TIME
           
 
Fields inherited from class org.llrp.ltk.net.LLRPConnection
CONNECT_TIMEOUT, endpoint, handler, session, SYNC_MESSAGE_ANSWER
 
Constructor Summary
LLRPAcceptor()
           
LLRPAcceptor(LLRPEndpoint endpoint)
          creates a remotely initiated LLRP connection on default PORT 5084 and uses LLRPIoHandlerAdapterImpl by default
LLRPAcceptor(LLRPEndpoint endpoint, int port)
          creates a remotely initiated LLRP connection and uses LLRPIoHandlerAdapterImpl by default
LLRPAcceptor(LLRPEndpoint endpoint, int port, LLRPIoHandlerAdapter handler)
          creates a remotely initiated LLRP connection and uses LLRPIoHandlerAdapterImpl by default
LLRPAcceptor(LLRPEndpoint endpoint, LLRPIoHandlerAdapter handler)
          creates a remotely initiated LLRP connection on default PORT 5084
 
Method Summary
 void bind()
          binds the LLRPIOHandler registered to the port specified.
 void bind(long timeout)
          binds the LLRPIOHandler registered to the port specified.
 void close()
          close acceptor socket.
 int getPort()
          get host address of reader device.
 boolean reconnect()
          reconnect method.
 void setPort(int port)
           
 
Methods inherited from class org.llrp.ltk.net.LLRPConnection
checkLLRPConnectionAttemptStatus, getEndpoint, getHandler, send, setEndpoint, setHandler, transact, transact
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDLE_TIME

public static final int IDLE_TIME
See Also:
Constant Field Values
Constructor Detail

LLRPAcceptor

public LLRPAcceptor()

LLRPAcceptor

public LLRPAcceptor(LLRPEndpoint endpoint)
creates a remotely initiated LLRP connection on default PORT 5084 and uses LLRPIoHandlerAdapterImpl by default

Parameters:
endpoint - that handles incoming, asynchronous LLRP messages

LLRPAcceptor

public LLRPAcceptor(LLRPEndpoint endpoint,
                    int port)
creates a remotely initiated LLRP connection and uses LLRPIoHandlerAdapterImpl by default

Parameters:
endpoint - that handles incoming, asynchronous LLRP messages
port - on which LLRPAcceptor is waiting for incoming connections

LLRPAcceptor

public LLRPAcceptor(LLRPEndpoint endpoint,
                    int port,
                    LLRPIoHandlerAdapter handler)
creates a remotely initiated LLRP connection and uses LLRPIoHandlerAdapterImpl by default

Parameters:
endpoint - that handles incoming, asynchronous LLRP messages
port - on which LLRPAcceptor is waiting for incoming connections
handler - which handles incoming LLRP messages

LLRPAcceptor

public LLRPAcceptor(LLRPEndpoint endpoint,
                    LLRPIoHandlerAdapter handler)
creates a remotely initiated LLRP connection on default PORT 5084

Parameters:
endpoint - that handles incoming, asynchronous LLRP messages
handler - which handles incoming LLRP messages
Method Detail

bind

public void bind()
          throws LLRPConnectionAttemptFailedException
binds the LLRPIOHandler registered to the port specified. It does not wait for an incoming READER_NOTIFICATION message with a successful ConnectionAttemptEvent. Use the bind method where you can specify a timeout instead.

Throws:
LLRPConnectionAttemptFailedException

bind

public void bind(long timeout)
          throws LLRPConnectionAttemptFailedException
binds the LLRPIOHandler registered to the port specified. The bind method waits for an incoming READER_NOTIFICATION message with a successful ConnectionAttemptEvent for the timeout specified. If the timeout is set to zero, the bind method will not wait for an incoming READER_NOTIFICATION message.

Parameters:
timeout - time in ms
Throws:
LLRPConnectionAttemptFailedException - if ConnectionAttemptStatus 'Success' in READER_NOTIFICATION message is not received within time interval specified by timeout

close

public void close()
close acceptor socket.


reconnect

public boolean reconnect()
reconnect method. currently not implemented. always returns false.

Specified by:
reconnect in class LLRPConnection
Returns:
boolean indicating failure (false) or success (true)

getPort

public int getPort()
get host address of reader device.

Returns:
the port

setPort

public void setPort(int port)
Parameters:
port - the port to set


Copyright © 2007 ETH Zurich.