net.rim.device.api.io.nfc.emulation
Class VirtualNDEFTag

java.lang.Object
  extended by net.rim.device.api.io.nfc.emulation.VirtualTarget
      extended by net.rim.device.api.io.nfc.emulation.VirtualNDEFTag

public class VirtualNDEFTag
extends VirtualTarget

Represents an emulated NFC NDEF tag target.

Since:
BlackBerry API 7.0.0

Field Summary
static int MAX_SIZE
          Constant for maximum allowed size for virtual NDEF tag.
static int MIN_SIZE
          Constant for minimum allowed size for virtual NDEF tag.
 
Constructor Summary
VirtualNDEFTag(NDEFMessage tagData)
          Constructs an emulated NFC Forum Type 4 NDEF tag target as ISO 14443 Type B.
VirtualNDEFTag(NDEFMessage tagData, int technologyType, String identifier, int maxSize)
          Constructs an emulated NFC Forum Type 4 NDEF tag target.
VirtualNDEFTag(NDEFMessage tagData, VirtualNDEFTagCallback callback)
          Constructs an emulated NFC Forum Type 4 NDEF tag target as ISO 14443 Type B.
VirtualNDEFTag(NDEFMessage tagData, VirtualNDEFTagCallback callback, int technologyType, String identifier, int maxSize)
          Constructs an emulated NFC Forum Type 4 NDEF tag target.
 
Method Summary
 NDEFMessage[] getTagData()
          Returns the NDEF tag data for this tag.
 int getType()
          Returns the type of the emulated NFC NDEF tag target.
 boolean isEmulating()
          Indicates whether this target is currently emulating.
 boolean isReadOnly()
          Indicates whether this tag should emulate in read only mode.
 void setReadOnly(boolean readOnly)
          Sets whether the emulating tag should be writable.
 void setType(int type)
          Sets the type of the emulated NFC NDEF tag target.
 void startEmulation()
          Starts virtual NDEF target emulation.
 void stopEmulation()
          Stops virtual NDEF target emulation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

MAX_SIZE

public static final int MAX_SIZE
Constant for maximum allowed size for virtual NDEF tag.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0

MIN_SIZE

public static final int MIN_SIZE
Constant for minimum allowed size for virtual NDEF tag.

See Also:
Constant Field Values
Since:
BlackBerry API 7.0.0


Constructor Detail

VirtualNDEFTag

public VirtualNDEFTag(NDEFMessage tagData)
Constructs an emulated NFC Forum Type 4 NDEF tag target as ISO 14443 Type B.

Parameters:
tagData - An NDEFMessage to store on the emulated tag.
Throws:
IllegalArgumentException - When tagData is null or has no records.
Since:
BlackBerry API 7.0.0

VirtualNDEFTag

public VirtualNDEFTag(NDEFMessage tagData,
                      VirtualNDEFTagCallback callback)
Constructs an emulated NFC Forum Type 4 NDEF tag target as ISO 14443 Type B.

Parameters:
tagData - An NDEFMessage to store on the emulated tag.
callback - The optional VirtualNDEFTagCallback callback to invoke when tag events occur.
Throws:
IllegalArgumentException - When tagData is null or has no records.
Since:
BlackBerry API 7.0.0

VirtualNDEFTag

public VirtualNDEFTag(NDEFMessage tagData,
                      int technologyType,
                      String identifier,
                      int maxSize)
Constructs an emulated NFC Forum Type 4 NDEF tag target.

Parameters:
tagData - An NDEFMessage to store on the emulated tag.
technologyType - The technology type of ISO 14443 NFC emulation target. Must be one of the constants TechnologyType.ISO14443A or TechnologyType.ISO14443B.
identifier - An identifier for the emulated NFC NDEF tag. If null, the identifier will be automatically generated. The identifier for type A must have length 4, 7 or 10. The identifier for type B must have length 4.
maxSize - The maximum length, in bytes, reserved for the data stored in the NFC NDEF tag.
Throws:
IllegalArgumentException - When any of the following conditions are encountered:
  • tagData is null or has no records.
  • technologyType is not one of TechnologyType.ISO14443A or TechnologyType.ISO14443B.
  • identifier for type A is not null and does not have length 4, 7 or 10.
  • identifier for type B is not null and does not have length 4.
  • maxSize is out of range.
Since:
BlackBerry API 7.0.0

VirtualNDEFTag

public VirtualNDEFTag(NDEFMessage tagData,
                      VirtualNDEFTagCallback callback,
                      int technologyType,
                      String identifier,
                      int maxSize)
Constructs an emulated NFC Forum Type 4 NDEF tag target.

Parameters:
tagData - An NDEFMessage to store on the emulated tag.
technologyType - The technology type of ISO 14443 NFC emulation target. Must be one of the constants TechnologyType.ISO14443A or TechnologyType.ISO14443B.
identifier - An identifier for the emulated NFC NDEF tag. If null, the identifier will be automatically generated. The identifier for type A must have length 4, 7 or 10. The identifier for type B must have length 4.
maxSize - The maximum length, in bytes, reserved for the data stored in the NFC NDEF tag.
callback - The optional VirtualNDEFTagCallback callback to invoke when tag events occur.
Throws:
IllegalArgumentException - When any of the following conditions are encountered:
  • tagData is null or has no records.
  • technologyType is not one of TechnologyType.ISO14443A or TechnologyType.ISO14443B.
  • identifier for type A is not null and does not have length 4, 7 or 10.
  • identifier for type B is not null and does not have length 4.
  • maxSize is out of range.
Since:
BlackBerry API 7.0.0


Method Detail

getType

public int getType()
Returns the type of the emulated NFC NDEF tag target.

Returns:
TechnologyType.ISO14443A or TechnologyType.ISO14443B.
Since:
BlackBerry API 7.0.0

setType

public void setType(int type)
Sets the type of the emulated NFC NDEF tag target.

Parameters:
type - One of TechnologyType.ISO14443A or TechnologyType.ISO14443B.
Since:
BlackBerry API 7.0.0

startEmulation

public final void startEmulation()
                          throws EmulationInProgressException,
                                 NFCException
Starts virtual NDEF target emulation.

Specified by:
startEmulation in class VirtualTarget
Throws:
EmulationInProgressException - When emulation cannot be started because an emulation operation is already in progress.
NFCException - When emulation cannot be started for any other reason
ControlledAccessException - When emulation cannot be started because of insufficient application permissions.
SecurityException - When emulation cannot be started because of IT Policy restrictions.
Since:
BlackBerry API 7.0.0

stopEmulation

public final void stopEmulation()
                         throws NFCException
Stops virtual NDEF target emulation.

Specified by:
stopEmulation in class VirtualTarget
Throws:
NFCException - When emulation cannot be stopped.
Since:
BlackBerry API 7.0.0

isEmulating

public final boolean isEmulating()
                          throws NFCException
Indicates whether this target is currently emulating.

Specified by:
isEmulating in class VirtualTarget
Returns:
true if target emulation has begun, otherwise false.
Throws:
NFCException - If a problem occurs while checking emulation status.
Since:
BlackBerry API 7.0.0

getTagData

public NDEFMessage[] getTagData()
Returns the NDEF tag data for this tag.

Returns:
An array of NDEF messages on tag.
Since:
BlackBerry API 7.1.0

isReadOnly

public boolean isReadOnly()
Indicates whether this tag should emulate in read only mode.

Returns:
true if the tag is read only, false otherwise.
Since:
BlackBerry API 7.1.0

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws NFCException
Sets whether the emulating tag should be writable.

Parameters:
readOnly - true if the tag should be read only; false otherwise.
Throws:
NFCException
Since:
BlackBerry API 7.1.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