net.rim.device.api.io.nfc.readerwriter
Class ReaderWriterManager

java.lang.Object
  extended by net.rim.device.api.io.nfc.readerwriter.ReaderWriterManager

public class ReaderWriterManager
extends Object

Provides methods to allow listeners to register and unregister for events relating to tag detection - this includes targets of a specified or any type, NDEF messages and detection errors.

Since:
BlackBerry API 7.0.0

Method Summary
 void addDetectionErrorListener(DetectionErrorListener listener)
          Registers a listener to receive notifications when an error occurs during target detection.
 void addDetectionListener(DetectionListener listener)
          Registers a listener to receive notifications when the device connects to any type of target.
 void addDetectionListener(DetectionListener listener, int[] types)
          Registers a listener to receive notifications when the device connects to a specific type of target.
 void addNDEFMessageListener(NDEFMessageListener listener, int typeNameFormat, String recordType)
          Registers a listener to receive notifications when an NDEF message is read by the BlackBerry® device.
 void addNDEFMessageListener(NDEFMessageListener listener, int typeNameFormat, String recordType, boolean autoStart)
          Deprecated.  
static ReaderWriterManager getInstance()
          Retrieves an instance of the ReaderWriterManager object, which provides access to NFC functionality for reading/writing to NFC tags and cards.
 void removeDetectionErrorListener(DetectionErrorListener listener)
          Removes a detection error listener.
 void removeDetectionListener(DetectionListener listener)
          Removes a notification listener.
 void removeNDEFMessageListener(int typeNameFormat, String recordType)
          Removes an NDEF message notification listener.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

getInstance

public static ReaderWriterManager getInstance()
                                       throws NFCException
Retrieves an instance of the ReaderWriterManager object, which provides access to NFC functionality for reading/writing to NFC tags and cards.

Returns:
An instance of the ReaderWriterManager.
Throws:
SecurityException - If NFC is disabled by an IT policy.
ControlledAccessException - If NFC is disabled by application permissions.
NFCException - If an exception occurs while retrieving the instance.
Since:
BlackBerry API 7.0.0

addDetectionListener

public void addDetectionListener(DetectionListener listener)
                          throws NFCException
Registers a listener to receive notifications when the device connects to any type of target. In the event that the target can be detected as more than one type, the device dispatches a single notification for the first matching type: NDEF, ISO14443-4, ISO14443-3.

Parameters:
listener - The DetectionListener to listen for connection detection.
Throws:
SecurityException - If IT Policy has disallowed NFC or NFC read/write.
ControlledAccessException - If application permissions has disabled read/write.
NFCException
Since:
BlackBerry API 7.0.0

addDetectionListener

public void addDetectionListener(DetectionListener listener,
                                 int[] types)
                          throws NFCException
Registers a listener to receive notifications when the device connects to a specific type of target. If a target matches multiple requested types, the device dispatches a single notification for the first matching type: NDEF, ISO14443-4, ISO14443-3.

Parameters:
listener - The DetectionListener to listen for connection detection.
types - The types of targets that should trigger notification. Supported targets are Target.NDEF_TAG, Target.ISO_14443_4 and Target.ISO_14443_3.
Throws:
SecurityException - If an IT policy disallows NFC or NFC read/write.
ControlledAccessException - If read/write is disabled by application permissions.
NFCException
Since:
BlackBerry API 7.0.0

removeDetectionListener

public void removeDetectionListener(DetectionListener listener)
                             throws NFCException
Removes a notification listener.

Parameters:
listener - The object to remove from connection detection notification.
Throws:
NFCException - When the listener cannot be removed.
Since:
BlackBerry API 7.0.0

addDetectionErrorListener

public void addDetectionErrorListener(DetectionErrorListener listener)
                               throws NFCException
Registers a listener to receive notifications when an error occurs during target detection. This might occur when multiple tags are detected in the RF field at one time.

Parameters:
listener - The DetectionErrorListener to listen for detection errors.
Throws:
SecurityException - If IT Policy has disallowed NFC or NFC read/write.
ControlledAccessException - If application permissions has disabled read/write.
NFCException
Since:
BlackBerry API 7.0.0

removeDetectionErrorListener

public void removeDetectionErrorListener(DetectionErrorListener listener)
                                  throws NFCException
Removes a detection error listener.

Parameters:
listener - The detection error notification listener to remove.
Throws:
NFCException - When the listener cannot be removed.
Since:
BlackBerry API 7.0.0

addNDEFMessageListener

public void addNDEFMessageListener(NDEFMessageListener listener,
                                   int typeNameFormat,
                                   String recordType)
                            throws NFCException
Registers a listener to receive notifications when an NDEF message is read by the BlackBerry® device.

Parameters:
listener - The NDEFMessageListener object.
typeNameFormat - An NDEF type name format.
recordType - An NDEF record types.
Throws:
NFCException - When the listener cannot be added.
SecurityException - If an IT policy disallows NFC or NFC read/write.
ControlledAccessException - If read/write is disabled by application permissions.
Since:
BlackBerry API 7.1.0

addNDEFMessageListener

public void addNDEFMessageListener(NDEFMessageListener listener,
                                   int typeNameFormat,
                                   String recordType,
                                   boolean autoStart)
                            throws NFCException
Deprecated. 

Registers a listener to receive notifications when an NDEF message is read by the BlackBerry® device.

Parameters:
listener - The NDEFMessageListener object.
typeNameFormat - An NDEF type name format.
recordType - An NDEF record types.
autoStart - Indicates whether the application should be started if not running.
Throws:
NFCException - When the listener cannot be added.
SecurityException - If an IT policy disallows NFC or NFC read/write.
ControlledAccessException - If read/write is disabled by application permissions.
Since:
BlackBerry API 7.0.0

removeNDEFMessageListener

public void removeNDEFMessageListener(int typeNameFormat,
                                      String recordType)
                               throws NFCException
Removes an NDEF message notification listener.

Parameters:
typeNameFormat - An NDEF type name format.
recordType - One of NDEF record types.
Throws:
NFCException - When the listener cannot be removed.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal