For the complete documentation index, see llms.txt. This page is also available as Markdown.

IDevice

Create an instance of the IDevice from CoreAPI::getDeviceList(). Then use the functions described in this chapter.

getName

This function retrieves the name of the device.

IDeviceControl* IDevice->getName() 

Return Value: IDeviceControl*

getConnectionInfo

This function retrieves the connection info of the device.

ConnectionInfo IDevice->getConnectionInfo() 

Return Value: ConnectionInfo

getConnectionState

This function retrieves the connection state of the device.

ConnectionState IDevice->getConnectionState() 

Return Value: ConnectionState

getDeviceInfo

This function retrieves the information class of the device.

Return Value: DeviceInfo

getDeviceCapabilities

This function retrieves the device capabilities class of the device.

Return Value: DeviceCapability

getDeviceControl

This function retrieves the device control class of the device.

Return Value: DeviceCapability

getConfiguration

This function retrieves the device configuration class of the device.

Return Value: IDeviceConfiguration*

subscribeAll

This function allows the host to be notified of all events sent by the device.

Parameter

Description

eventCallback

Name of a class that implements the IEventSubscriber interface event.

Return Value: Truth of successful. Otherwise, returns false.

unsubscribeAll

This function allows the host to no longer receive any events sent by the device.

Parameter

Description

eventCallback

Name of a class that implements the IEventSubscriber interface event.

Return Value: Truth of successful. Otherwise, returns false.

startTransaction

This function starts a transaction. This function will automatically handle the opening and closing of a device. The transaction will be processed through multiple calls to the event OnEvent(). See API Walk Through for how to process an EMV transaction.

Parameter

Description

eventCallback

Name of a class that implements the IEventSubscriber interface event.

Return Value: Truth of successful. Otherwise, returns false.

cancelTransaction

This function cancels a transaction. A transaction can only be canceled before a card is presented.

Return Value: True if canceled. Otherwise, returns false.

sendSelection

This function sends a user selection to the device. The response data will be returned in the event OnEvent().

Parameter for data

Description

Byte 0

Status of User Selection:

  • 0x00 = User Selection Request completed, see Selection Result

  • 0x01 = User Selection Request aborted, cancelled by user

  • 0x02 = User Selection Request aborted, timeout

Byte 1

The menu item selected by the user. This is a single byte zero based binary value.

Return Value: True if successful. Otherwise, returns false.

sendAuthorization

This function sends the Authorization Response Code (ARPC) blob to the device. The response data will be returned in the event OnEvent(). See API Walk Through for how to process an EMV transaction.

Parameter

Description

data

Contains ARPC blob.

Return Value: True if successful. Otherwise, returns false.

requestPAN

This function prompts the user to present their card and enter a PIN. A card is presented so that the device can retrieve the PAN, which is used for Format blocks requiring a PAN. The encrypted PIN block (EPB) will be returned in the event OnEvent().

For DynaFlex devices, this function starts a PIN session on the first call and shall be called again to send the PIN status to the device for completing the PIN session.

PANRequest:

Parameter

Type

Description

Timeout

unsigned char

Wait time in seconds.

Parameter

Type

Description

PaymentMethods

enum

PaymentMethod enumeration.

Usage:

  • MSR = 1 - For magnetic stripe cards.

  • Contact = 2 - For EMV chip cards.

  • Contactless = 4 - For NFC contactless cards.

  • ManualEntry = 8 - For user to manually enter transaction data without any card access. When set to ManualEntry, the other payment methods do not apply.

  • BARCODE = 16 - For barcode transaction.

  • APPLE_VAS = 32 - For Apple VAS support.

PINRequest:

Parameter

Type

Description

Timeout

unsigned char

Wait time in seconds.

PINMode

unsigned char

PIN mode.

Usage:

  • 0x00 - Enter PIN

  • 0x01 - Enter PIN Amount

  • 0x02 - Reenter PIN Amount

  • 0x03 - Reenter PIN

  • 0x04 - Verify PIN

For DynaFlex devices this is the User Interface Sequence:

  • 0x01 - Present Card / Enter PIN (start session)

  • 0x04 - Present Card / Enter PIN / Enter PIN Again (start session)

On the second call to requestPAN(), send the PIN status:

  • 0xFD - Cancel PIN Session (end session)

  • 0xFE - PIN Entry Failed (end session)

  • 0xFF - PIN Entry Successful (end session)

MinLength

unsigned char

Minimum length of accepted PIN (>= 4).

MaxLength

unsigned char

Maximum length of accepted PIN (=< 12).

Tone

unsigned char

Tone to play when prompting for the PIN. Usage:

  • 0x00 - No sound

  • 0x01 - One beep

  • 0x02 - Two beeps

Parameter

Type

Description

Format

unsigned char

ISO format for the PIN block.

  • 0x00 - ISO Format 0

  • 0x01 – Reserved / Invalid

  • 0x03 - ISO Format 3

  • 0x04 - ISO Format 4

PAN

string

First 12 digits of the Primary Account Number. Leave blank if not required by the ISO format for the PIN block.

Return Value: True if successful. Otherwise, returns false.

requestPIN

This function prompts the user to enter a PIN. The host must supply the PAN if the Format block selected requires a PAN. The encrypted PIN block (EPB) will be returned in the event OnEvent().

For DynaFlex devices, this function starts a PIN session on the first call and shall be called again to send the PIN status to the device for completing the PIN session.

Parameter

Type

Description

Timeout

unsigned char

Wait time in seconds.

PINMode

unsigned char

PIN mode.

Usage:

  • 0x00 - Enter PIN

  • 0x01 - Enter PIN Amount

  • 0x02 - Reenter PIN Amount

  • 0x03 - Reenter PIN

  • 0x04 - Verify PIN

For DynaFlex devices this is the User Interface Sequence:

  • 0x00 - Enter PIN (start session)

  • 0x02 - PIN Incorrect, Try Again (continue session)

  • 0x03 - Enter PIN / Enter PIN Again (start session)

  • 0x05 - Enter PIN Again (continue session)

On the second call to requestPIN(), send the PIN status:

  • 0xFD - Cancel PIN Session (end session)

  • 0xFE - PIN Entry Failed (end session)

  • 0xFF - PIN Entry Successful (end session)

MinLength

unsigned char

Minimum length of accepted PIN (>= 4).

Parameter

Type

Description

MaxLength

unsigned char

Maximum length of accepted PIN (=< 12).

Tone

unsigned char

Tone to play when prompting for the PIN. Usage:

  • 0x00 - No sound

  • 0x01 - One beep

  • 0x02 - Two beeps

Format

unsigned char

ISO format for the PIN block.

  • 0x00 - ISO Format 0

  • 0x01 - ISO Format 1 0x03 - ISO Format 3

  • 0x04 - ISO Format 4

PAN

string

First 12 digits of the Primary Account Number. Leave blank.

Return Value: True if successful. Otherwise, returns false.

requestSignature

This function prompts the user to enter a signature. The response data will be returned in the event OnEvent().

Parameter

Description

timeout

Time in seconds for the operation to complete. 0x01 – 0xFF

Return Value: True of successful. Otherwise, returns false.

sendNFCCommand

This function sends a command to an NFC tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

Parameter

Description

data

Command to send to the NFC tag.

  • Get Version

  • Read

  • Fast Read

  • Write

  • Compatibility Write

  • Read_Cnt

  • PWD_Auth

  • Read_Sig

For details of the command see the NFC commands table below or

DynaFlex Family Programmer’s Manual

lastCommand

Determines if this is the last NFC command to complete the operation.

true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.

false = Expect more commands (Default).

Either set to true or false, if the NFC tag command fails, device will provide a double beep.

encrypt

Determines if data returned is to be encrypted.

true = Encrypt data

false = Do not encrypt data (Default)

Return Value: True of successful. Otherwise, returns false.

NFC Commands

Command

Length

Field Value

Get Version

1

The GET_VERSION command is used to retrieve information on the NTAG family, the product version, storage size and other product data required to identify the specific NTAG21x.

Byte 0 = 0x60

Command

Length

Field Value

Read

2

The READ command requires a start page address, and returns the 16 bytes of four NTAG21x pages. For example, if address is 03h then pages 03h, 04h, 05h, 06h are returned. Special conditions apply if the READ command address is near the end of the accessible memory area. The special conditions also apply if at least part of the addressed pages is within a password protected area.

  • Byte 0 = 0x30

  • Byte 1 = Start Page Address

Fast Read

3

The FAST_READ command requires a start page address and an end page address and returns the all n*4 bytes of the addressed pages. For example, if the start address is 03h and the end address is 07h then pages 03h, 04h, 05h, 06h and 07h are returned.

  • Byte 0 = 0x3A

  • Byte 2 = Start Page Address

  • Byte 3 = End Page Address

Write

6

The WRITE command requires a block address, and writes 4 bytes of data into the addressed NTAG21x page.

  • Byte 0 = 0xA2

  • Byte 1 = Address to Write

  • Byte 2 to 5 = 4 Bytes of Data to Write

Compatibility Write

18

The COMPATIBILITY_WRITE command is implemented to guarantee interoperability with the established MIFARE Classic PCD infrastructure, in case of coexistence of ticketing and NFC applications. Even though 16 bytes are transferred to NTAG21x, only the least significant 4 bytes (bytes 0 to 3) are written to the specified address. Set all the remaining bytes, 04h to 0Fh, to logic 00h.

  • Byte 0 = 0xA0

  • Byte 1 = Address to Write

  • Byte 2 to 17 = 16 Bytes of Data to Write (only least significant 4 bytes are written)

Note: This command is sent in 2 steps, which the Firmware will handle

  1. <CMD><Address to Write><CRCH><CRCL>

  2. <16 Bytes of Data to Write><CRCH><CRCL>

Command

Length

Field Value

READ_CNT

2

The READ_CNT command is used to read out the current value of the NFC one-way counter of the NTAG213, NTAG215 and NTAG216. The command has a single argument specifying the counter number and returns the 24-bit counter value of the corresponding counter. If the NFC_CNT_PWD_PROT bit is set to 1b the counter is password protected and can only be read with the READ_CNT command after a previous valid password authentication

  • Byte 0 = 0x39

  • Byte 1 = 0x02 (NFC Counter Address)

PWD_AUTH

5

A protected memory area can be accessed only after a successful password verification using the PWD_AUTH command. The AUTH0 configuration byte defines the protected area. It specifies the first page that the password mechanism protects. The level of protection can be configured using the PROT bit either for write protection or read/write protection. The PWD_AUTH command takes the password as parameter and, if successful, returns the password authentication acknowledge, PACK. By setting the AUTHLIM configuration bits to a value larger than 000b, the number of unsuccessful password verifications can be limited. Each unsuccessful authentication is then counted in a counter featuring anti-tearing support. After reaching the limit of unsuccessful attempts, the memory access specified in PROT, is no longer possible.

  • Byte 0 = 0x1B

  • Byte 1..4 = password (4 bytes)

READ_SIG

2

The READ_SIG command returns an IC specific, 32-byte ECC signature, to verify NXP Semiconductors as the silicon vendor. The signature is programmed at chip production and cannot be changed afterwards.

  • Byte 0 = 0x3C

  • Byte 1 = 0x00, RFU

Response Data For NFC Tag Type 2

Tag

Len

Value / Description

81

01

Tag Response Code 0x00 = Success 0x01 = Failed

82

var

Encryption Control Payload

If unencrypted:

Tag

Len

Value / Description

FC

var

NFC Data Container

/DF7A

var

NFC Data

If encrypted:

/DFDF59

var

Encrypted Data Primitive to be decrypted.

/DFDF50

var

Encrypted Data KSN

/DFDF51

01

Encrypted Data Encryption Type

Example Unencrypted Payload for Fast Read

Example Encrypted Payload for Fast Read

sendClassicNFCCommand

This function sends a command to a Mifare Classic NFC tag type 2. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

Parameter

Description

data

Command to send to the NFC tag.

  • Get Version

  • Read

  • Fast Read

  • Write

  • Compatibility Write

  • Read Cnt

  • PWD Auth

  • Read Sig

For details of the command see NFC commands table below or

DynaFlex Family Programmer’s Manual

lastCommand

Determines if this is the last NFC command to complete the operation.

true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.

false = Expect more commands (Default).

Either set to true or false, if the NFC tag command fails, device will provide a double beep.

encrypt

Determines if data returned is to be encrypted.

true = Encrypt data

false = Do not encrypt data (Default)

Return Value: True of successful. Otherwise, returns false.

NFC Commands

Command

Length

Field Value

Get Version

1

The GET_VERSION command is used to retrieve information on the NTAG family, the product version, storage size and other product data required to identify the specific NTAG21x.

Byte 0 = 0x60

Command

Length

Field Value

Read

2

The READ command requires a start page address, and returns the 16 bytes of four NTAG21x pages. For example, if address is 03h then pages 03h, 04h, 05h, 06h are returned. Special conditions apply if the READ command address is near the end of the accessible memory area. The special conditions also apply if at least part of the addressed pages is within a password protected area.

  • Byte 0 = 0x30

  • Byte 1 = Start Page Address

Fast Read

3

The FAST_READ command requires a start page address and an end page address and returns the all n*4 bytes of the addressed pages. For example, if the start address is 03h and the end address is 07h then pages 03h, 04h, 05h, 06h and 07h are returned.

  • Byte 0 = 0x3A

  • Byte 2 = Start Page Address

  • Byte 3 = End Page Address

Write

6

The WRITE command requires a block address, and writes 4 bytes of data into the addressed NTAG21x page.

  • Byte 0 = 0xA2

  • Byte 1 = Address to Write

  • Byte 2 to 5 = 4 Bytes of Data to Write

Compatibility Write

18

The COMPATIBILITY_WRITE command is implemented to guarantee interoperability with the established MIFARE Classic PCD infrastructure, in case of coexistence of ticketing and NFC applications. Even though 16 bytes are transferred to NTAG21x, only the least significant 4 bytes (bytes 0 to 3) are written to the specified address. Set all the remaining bytes, 04h to 0Fh, to logic 00h.

  • Byte 0 = 0xA0

  • Byte 1 = Address to Write

  • Byte 2 to 17 = 16 Bytes of Data to Write (only least significant 4 bytes are written)

Note: This command is sent in 2 steps, which the Firmware will handle

  1. <CMD><Address to Write><CRCH><CRCL>

  2. <16 Bytes of Data to Write><CRCH><CRCL>

sendDESFireNFCCommand

This function sends a command to an NFC Mifare DESFire Light Tag Type 4. The NFC tag must first be activated by calling startTransaction() with NFC enabled.

Parameter

Description

data

Command to send to the NFC tag. See DESFire Data Sheet (MF2DLHX0). Should follow ISO 7816-4 APDU format.

For details of the command see

DynaFlex Family Programmer’s Manual

lastCommand

Determines if this is the last NFC command to complete the operation.

true = This is the last command. Device will provide a single beep after receiving a successful response from the NFC tag. To send subsequent commands, the NFC tag must be activated by calling startTransaction() with NFC enabled.

false = Expect more commands (Default).

Either set to true or false, if the NFC tag command fails, device will provide a double beep.

encrypt

Determines if data returned is to be encrypted.

true = Encrypt data

false = Do not encrypt data (Default)

Return Value: True of successful. Otherwise, returns false.

Response Data For NFC Mifare DESFire Light Tag Type 4

Tag

Len

Value / Description

81

02

Tag Response (SW1 SW2). See DESFire Data Sheet (MF2DLHX0). Should follow ISO 7816-4 APDU format.

  • SW1 and SW2 of R-APDU

If card is not able to respond:

  • SW1 = 0x64, SW2 = 0x00

Tag

Len

Value / Description

82

var

Encryption Control Payload tag data

  • Data of R-APDU

If unencrypted:

Tag

Len

Value / Description

FC

var

NFC Data Container

/DF7A

var

NFC Data

If encrypted:

Tag

Len

Value / Description

/DFDF59

var

Encrypted Data Primitive to be decrypted.

/DFDF50

var

Encrypted Data KSN

/DFDF51

01

Encrypted Data Encryption Type

Example Unencrypted Payload

Example Encrypted Payload

Last updated