NFC service

The NFC service provides the following NFC capabilities:

  • tag reading and writing
  • peer-to-peer communication via Simple NDEF Exchange Protocol (SNEP)
  • Logical Link Control Protocol (LLCP) connections
  • Bluetooth and Wi-Fi connection handover
  • secure element (SE) transactions
  • card emulation, including
    • NDEF tag emulation
    • Host Card Emulation (HCE)
    • UICC SE card emulation (UICC SE CE)
These capabilities allow BlackBerry 10 devices to support NFC use cases such as the following:
  • reading and writing to NFC tags or smart posters
  • NFC-based data exchange
  • Bluetooth and Wi-Fi connection handover
  • contactless payment (acting as a credit card) and ticketing (for example, for events and transit systems)

Feature sets

Different BlackBerry 10 devices may have different NFC functionalities. These differences are called feature sets and are highlighted in the documentation as feature set 1 and feature set 2.

You can call nfc_get_feature_set() to see which feature set a device supports.

Currently, the following feature sets are available:
  • Feature set 0: NFC is not supported on the device.
  • Feature set 1: NFC is supported. See table below for details.
  • Feature set 2: NFC is supported. See table below for details.
Functionality and Affected APIs Feature set 1 Feature set 2
Jewel support: nfc_get_tag_name() Does not detect Jewel tags Detects Jewel tags
Writing multiple NDEF messages: nfc_write_ndef_message_to _tag() Supported Not supported
Battery mode: battery_mode_t Supports both low battery and empty (or no) battery mode Supports only low battery mode
Retrieving tag ID: nfc_get_tag_id()

Depends on the tag variant and the connection type

Depends on the tag variant and the connection type

Retrieving tag name: nfc_get_tag_name()

Depends on the tag variant and the connection type

Depends on the tag variant and the connection type

AID-based Host Card Emulation (HCE): nfc_hce_register_aid() nfc_hce_unregister_aid() nfc_hce_is_aid_registered() Not supported; affected functions return NFC_RESULT_ UNSUPPORTED_API Supported
NFC events: NFC_VIRTUAL_TAG_READ_EVENT Supported Not supported
Creating an LLCP connection listener: nfc_llcp_register _connection_listener() Supports a range of values for the sap parameter Supports a range of values for the sap parameter

NFC Forum tag reader and writer

A BlackBerry 10 device can read from or write to any tag that the NFC Forum supports. As a reader, the device detects the tag, reads the NFC Data Exchange Format (NDEF) message stored on the tag, and notifies the interested application for processing. To be able to read and act on a particular NDEF message from an NFC tag, an application must register its interest in that type of message.

An NDEF message may contain multiple records, and an NFC tag may contain two NDEF messages. In each case, an application is launched according to the following logic:
  • One NDEF message with multiple records: NFC looks for an application registered for the first record type. If it is found, the application is notified and handles the message. If no application is registered to handle the first record, NFC continues on to the next record. For example, an NDEF message may contain two records: a proprietary Type Name Format (TNF) for the first record and a link to the BlackBerry World storefront for the second record to allow users to download the app.
  • Two NDEF messages with one record each: NFC acts on both messages simultaneously. An example use case is:
    • The first NDEF message contains credentials for setting up a Bluetooth connection and is dispatched to an application to establish a connection with a Bluetooth headset.
    • The second NDEF message is dispatched to a separate handler, which responds by launching an application to play music using the Bluetooth connection.

The NFC service APIs also allow an application to detect the proximity of a tag and write an NDEF message to it.

Supported NFC Forum tags

The following NFC Forum compliant tags are supported:

NFC Forum tag type Supported tags
Type 1
  • Topaz 96
  • Topaz 512
Type 2
  • MiFare Ultra Light
  • MiFare Ultra Light C
  • Infineon my-D Move
  • Infineon my-D NFC
  • Kovio 2K
  • NTAG203
Type 3
  • FeliCa RC-S888
  • FeliCa RC-S965
  • FeliCa Lite-S RC-S966
Type 4
  • MiFare DESFire EV1 (2k, 4k, 8k)
  • MicroPass 4101-2K
MiFare DESFire EV1 tags must be pre-formatted before they can be used with a BlackBerry 10 device.

ISO 15693 tag reader and writer

The BlackBerry 10 device can also read and write to ISO 15693 tags.

To read an ISO 15693 tag, register for tag detection events by calling nfc_register_tag_readerwriter():
nfc_register_tag_readerwriter(TAG_TYPE_ISO_15693_3);
            
To write to an ISO 15693 tag, use nfc_tag_transceive().

Peer-to-peer communication

With peer-to-peer communication, a BlackBerry 10 device can exchange data with another NFC-enabled device using the Simple NDEF Exchange Protocol (SNEP), a client-server-based protocol defined by the NFC Forum.

A peer-to-peer application can also be built directly using the Logical Link Control Protocol (LLCP), a lower-level protocol over which SNEP runs. The NFC service provides a set of APIs for communication over LLCP. However, for its simplicity, we suggest using SNEP to build peer-to-peer communication applications.

Bluetooth and Wi-Fi connection handover

The NFC service provides Bluetooth and Wi-Fi connection handover capability, which allows an application to connect with another Bluetooth or Wi-Fi device and transfer files. The benefit of using Bluetooth and Wi-Fi connection handover is that connection setup does not require any further action from the user.

Due to its limited data rates and the requirement for physical proximity, NFC is typically used to transfer small amounts of data such as business cards or URLs. If your application needs to transfer large files (for example, audio or video files), consider using NFC to initiate a Bluetooth or Wi-Fi connection handover, and using the Bluetooth or Wi-Fi connection to transfer files.

Card emulation

The NFC service provides the following card emulation capabilities:

  • NDEF tag emulation: Using the tag emulation functions, an application can emulate an NFC tag that stores an NDEF message, which is detected and read by another NFC-enabled device that acts as an initiator.
  • Host Card Emulation (HCE): HCE allows the BlackBerry 10 device to look like an ISO 14443-4 smart card, ready to connect with a reader device and perform transactions such as payment and ticketing, without going through a UICC or secure element.
  • UICC secure element card emulation (UICC SE CE): Through applets that run on the SE, the SE emulates a smart card and performs card transactions with external card readers. In UICC SE CE, applications don't play a role in card transactions, but can communicate with the applet through card emulation APIs to obtain information related to card transactions. The card emulation APIs allow an application to:
    • communicate with the applets on the SE through formatted byte arrays called Application Protocol Data Units (APDUs)
    • register for and receive transaction notifications when transactions of interest take place on the SE

Parallel operation dependencies

NFC functions may depend on other NFC functions. Some passive mode functionalities may be available only when other passive modes are disabled or restricted in their applicable technologies.

The table below describes the NFC passive modes your device supports. An "X" indicates that the passive mode is supported under the specified technology (A, B, B', or F). Some of the passive modes cannot be enabled simultaneously. See the rules below on parallel operation among the different functionalities.

NFC Technology A B B' F
Host Card Emulation (HCE) X X    
NDEF tag emulation X X    
UICC secure element card emulation (UICC SE CE) X X X  
Peer-to-peer (P2P) mode in passive mode (P2P target) X     X

You may request any passive modes supported in the table above. The NFC service determines the passive modes and technologies to offer to the user after applying the following rules:

  • When nfc_start_iso14443_4_emulation() is used for HCE:
    • All other forms of card emulation are disabled.
    • HCE is only active when the application is in the foreground.
  • When nfc_hce_register_aid() is used with an AID wild card:
    • All other forms of card emulation are disabled.
    • HCE is only active when the application is in the foreground
  • When nfc_hce_register_aid() is used with a dedicated AID:
    • Other forms of card emulation may run in parallel.
    • HCE remains active while the application runs in the foreground or background, or is terminated.
  • When the UICC SE CE uses either technology A or B, other passive modes must use the same technology as the UICC SE CE. This rule doesn't affect technology F. For example, if UICC SE CE uses only technology A, then HCE and NDEF tag emulation must use only technology A.
  • When UICC SE CE is not active, HCE and NDEF tag emulation are enabled on both technologies A and B.
  • When UICC SE CE is active on technology B and inactive on technology A, P2P target is disabled on technology A.
  • The nfc_start_iso14443_4_emulation() function for HCE requires selecting either technology A or B. When you use this function to select technology B, P2P target is disabled on technology A.
  • When NDEF tag emulation is active, P2P target is disabled.
  • NDEF tag emulation is only active when the application is in the foreground.

Last modified: 2014-09-29



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus