Nokia Extensions for JSR-257

com.nokia.nfc.llcp
Class LLCPManager

java.lang.Object
  com.nokia.nfc.llcp.LLCPManager

public class LLCPManager
extends java.lang.Object

The LLCPManager class is used for managing LLCP related listeners.


Constructor Summary
protected LLCPManager()
          Creates a LLCPManager instance.
 
Method Summary
 void addErrorRecoveryListener(ErrorRecoveryListener l)
          Adds a ErrorRecoveryListener to be notified about LLCP error recovery related events.
 void addLinkListener(LLCPLinkListener l)
          Adds a LLCPLinkListener to be notified about LLCP link related events.
static LLCPManager getInstance()
          Returns a LLCPManager instance.
 void removeErrorRecoveryListener(ErrorRecoveryListener l)
          Removes the specified ErrorRecoveryListener so that it will not be notified about LLCP error recovery related events.
 void removeLinkListener(LLCPLinkListener l)
          Removes the specified LLCPLinkListener so that it will not be notified about LLCP link related events.
 void startListening(byte type, byte pid, LLCPConnectionListener listener)
          Start listening for a connection.
 void stopListening(byte type, byte pid, LLCPConnectionListener listener)
          Stops listening for a connection.
 

Constructor Detail

LLCPManager

protected LLCPManager()
               throws java.io.IOException
Creates a LLCPManager instance.

Method Detail

getInstance

public static final LLCPManager getInstance()
                                     throws java.io.IOException
Returns a LLCPManager instance.

Returns:
a LLCPManager instance.
Throws:
java.io.IOException - if failed to create the instance.

addLinkListener

public void addLinkListener(LLCPLinkListener l)
Adds a LLCPLinkListener to be notified about LLCP link related events. The call will be ignored if the listener has already been added. Multiple listeners are allowed and the notifications must be sent to all of them.

Parameters:
l - the listener object to add.
Throws:
java.lang.NullPointerException - if the parameter l is null.

removeLinkListener

public void removeLinkListener(LLCPLinkListener l)
Removes the specified LLCPLinkListener so that it will not be notified about LLCP link related events. The call will be ignored if the specified listener has not been added using addLinkListener(LLCPLinkListener).

Parameters:
l - the listener object to remove.
Throws:
java.lang.NullPointerException - if the parameter l is null.

addErrorRecoveryListener

public void addErrorRecoveryListener(ErrorRecoveryListener l)
Adds a ErrorRecoveryListener to be notified about LLCP error recovery related events. The call will be ignored if the listener has already been added. Multiple listeners are allowed and the notifications must be sent to all of them.

Parameters:
l - the listener object to add.
Throws:
java.lang.NullPointerException - if the parameter l is null.

removeErrorRecoveryListener

public void removeErrorRecoveryListener(ErrorRecoveryListener l)
Removes the specified ErrorRecoveryListener so that it will not be notified about LLCP error recovery related events. The call will be ignored if the specified listener has not been added using addErrorRecoveryListener(ErrorRecoveryListener).

Parameters:
l - the listener object to remove.
Throws:
java.lang.NullPointerException - if the parameter l is null.

startListening

public void startListening(byte type,
                           byte pid,
                           LLCPConnectionListener listener)

Start listening for a connection. Once a connection has been opened the LLCPConnectionListener.connectionOpened(LLCPConnection) method will be called.

Valid values for parameter type are LLCPConnection.TYPE_1 and LLCPConnection.TYPE_2.

The implementation may limit the number of applications listening for connections for the specified protocol identifier. If such an limit exists and another application is already listening for a connection, then this method may throw an IllegalStateException.

Parameters:
type - type of the connection.
pid - the protocol identifier.
listener - the listener that will be notified once a connection has been opened.
Throws:
java.lang.NullPointerException - if the listener is null.
java.lang.IllegalStateException - if already listening to the connection.
java.lang.IllegalStateException - if the implementation doesn't allow listening to connections using the specified protocol.
java.lang.IllegalArgumentException - if the parameters are invalid.

stopListening

public void stopListening(byte type,
                          byte pid,
                          LLCPConnectionListener listener)

Stops listening for a connection. The parameters must match the parameters given when started to listen for a connection.

If listening to the specified connection hasn't started then this method will not do anything.

Parameters:
type - type of the connection.
pid - the protocol identifier.
listener - the associated listener object.
Throws:
java.lang.IllegalArgumentException - if the parameters are invalid.
java.lang.NullPointerException - if listener is null.

Nokia Extensions for JSR-257

Copyright © 2006 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.