# Modules.Nfc.TagTechnologyMifareClassic

Provides access to MIFARE Classic properties and I/O operations on a Modules.Nfc.NfcTag.

Availability
1.1.0

# Overview

Use the Modules.Nfc.createTagTechnologyMifareClassic method to create this tag technology.

See also: MifareClassic (opens new window)

# Properties

# apiName READONLY

Availability
3.2.0
apiName :String

The name of the API that this proxy corresponds to.

The value of this property is the fully qualified name of the API. For example, Titanium.UI.Button returns Ti.UI.Button.


# lifecycleContainer

Availability
3.6.0

The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.

If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.


# tag

Availability
1.1.0

The tag technology that has been discovered.

When a tag is discovered, a Modules.Nfc.NfcTag proxy is created and passed as a property to the onNdefDiscovered, onTagDiscovered, or onTechDiscovered callback (see NdefDiscovered).

# Methods

# authenticateSectorWithKeyA

Availability
1.1.0
authenticateSectorWithKeyA(sectorIndex, key) Boolean

Authenticate a sector with key A.

Parameters

Name Type Description
sectorIndex Number

Index of sector to authenticate, starting from 0.

key Titanium.Buffer

6-byte authentication key.

Returns

Returns true on success, false on authentication failure.

Type
Boolean

# authenticateSectorWithKeyB

Availability
1.1.0
authenticateSectorWithKeyB(sectorIndex, key) Boolean

Authenticate a sector with key B.

Parameters

Name Type Description
sectorIndex Number

Index of sector to authenticate, starting from 0.

key Titanium.Buffer

6-byte authentication key.

Returns

Returns true on success, false on authentication failure.

Type
Boolean

# blockToSector

Availability
1.1.0
blockToSector(blockIndex) Number

Return the sector that contains a given block.

Parameters

Name Type Description
blockIndex Number

Index of block to lookup, starting from 0.

Returns

Type
Number

# close

Availability
1.1.0
close() void

Disable I/O operations to the tag and release resources.

Returns

Type
void

# connect

Availability
1.1.0
connect() void

Enable I/O operations to the tag.

Only one Tag Technology proxy can be connected to a Tag at a time.

Returns

Type
void

# decrement

Availability
1.1.0
decrement(blockIndex, value) void

Decrement a value block, storing the result in the temporary block on the tag.

Parameters

Name Type Description
blockIndex Number

Index of block to decrement, starting from 0.

value Number

Non-negative to decrement by.

Returns

Type
void

# getBlockCount

Availability
1.1.0
getBlockCount() Number

Return the total number of MIFARE Classic blocks.

Returns

Type
Number

# getBlockCountInSector

Availability
1.1.0
getBlockCountInSector(sectorIndex) Number

Return the number of blocks in the given sector.

Parameters

Name Type Description
sectorIndex Number

Index of sector, starting from 0.

Returns

Type
Number

# getMaxTransceiveLength

Availability
1.1.0
getMaxTransceiveLength() Number

Return the maximum number of bytes that can be sent with transceive.

Returns

Type
Number

# getSectorCount

Availability
1.1.0
getSectorCount() Number

Return the number of MIFARE Classic sectors.

Returns

Type
Number

# getSize

Availability
1.1.0
getSize() Number

Return the size of the tag in bytes.

Returns

Type
Number

# getTimeout

Availability
1.1.0
getTimeout() Number

Get the current transceive timeout in milliseconds.

Returns

Type
Number

# getType

Availability
1.1.0
getType() Number

Return the type of this MIFARE Classic compatible tag.

Returns

Type
Number

# increment

Availability
1.1.0
increment(blockIndex, value) void

Increment a value block, storing the result in the temporary block on the tag.

Parameters

Name Type Description
blockIndex Number

Index of block to increment, starting from 0.

value Number

Non-negative to increment by.

Returns

Type
void

# isConnected

Availability
1.1.0
isConnected() Boolean

Returns true if connect has completed, and close has not been called, and the tag is not known to be out of range.

Returns

Type
Boolean

# isValid

Availability
1.1.0
isValid() Boolean

Return true if this tag technology was successfully obtained.

Returns

Type
Boolean

# readBlock

Availability
1.1.0
readBlock(blockIndex) Titanium.Buffer

Read 16-byte block.

Parameters

Name Type Description
blockIndex Number

Index of block to read, starting from 0.

Returns

16 byte block.


# restore

Availability
1.1.0
restore(blockIndex) void

Copy from a value block to the temporary block.

Parameters

Name Type Description
blockIndex Number

Index of block to copy from.

Returns

Type
void

# sectorToBlock

Availability
1.1.0
sectorToBlock(sectorIndex) Number

Return the first block of a given sector.

Parameters

Name Type Description
sectorIndex Number

Index of sector to lookup, starting from 0.

Returns

Type
Number

# setTimeout

Availability
1.1.0
setTimeout(timeout) void

Set the transceive timeout in milliseconds.

Parameters

Name Type Description
timeout Number

Timeout value in milliseconds.

Returns

Type
void

# transceive

Availability
1.1.0
transceive(data) Titanium.Buffer

Send raw NfcA data to the tag and receive the response.

Parameters

Name Type Description
data Titanium.Buffer

Bytes to send.

Returns

Response bytes received.


# transfer

Availability
1.1.0
transfer(blockIndex) void

Copy from the temporary block to a value block.

Parameters

Name Type Description
blockIndex Number

Index of block to copy to.

Returns

Type
void

# writeBlock

Availability
1.1.0
writeBlock(blockIndex, data) void

Write 16-byte block.

Parameters

Name Type Description
blockIndex Number

Index of block to write, starting from 0.

data Titanium.Buffer

16 bytes of data to write.

Returns

Type
void

# Constants

# KEY_DEFAULT

Availability
1.1.0
KEY_DEFAULT :Titanium.Buffer

The default factory key.


# KEY_MIFARE_APPLICATION_DIRECTORY

Availability
1.1.0
KEY_MIFARE_APPLICATION_DIRECTORY :Titanium.Buffer

The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.


# KEY_NFC_FORUM

Availability
1.1.0
KEY_NFC_FORUM :Titanium.Buffer

The well-known key for tags formatted according to the NDEF on MIFARE Classic specification.