# Modules.Nfc.TagTechnologyMifareClassic
Provides access to MIFARE Classic properties and I/O operations on a Modules.Nfc.NfcTag.
# Overview
Use the Modules.Nfc.createTagTechnologyMifareClassic method to create this tag technology.
See also: MifareClassic (opens new window)
# Properties
# apiName READONLY
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
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
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
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
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
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
# connect
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
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
Return the total number of MIFARE Classic blocks.
Returns
- Type
- Number
# getBlockCountInSector
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
Return the maximum number of bytes that can be sent with transceive
.
Returns
- Type
- Number
# getSectorCount
Return the number of MIFARE Classic sectors.
Returns
- Type
- Number
# getTimeout
Get the current transceive
timeout in milliseconds.
Returns
- Type
- Number
# getType
Return the type of this MIFARE Classic compatible tag.
Returns
- Type
- Number
# increment
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
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
Return true if this tag technology was successfully obtained.
Returns
- Type
- Boolean
# readBlock
Read 16-byte block.
Parameters
Name | Type | Description |
---|---|---|
blockIndex | Number | Index of block to read, starting from 0. |
Returns
16 byte block.
- Type
- Titanium.Buffer
# restore
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
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
Set the transceive
timeout in milliseconds.
Parameters
Name | Type | Description |
---|---|---|
timeout | Number | Timeout value in milliseconds. |
Returns
- Type
- void
# transceive
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.
- Type
- Titanium.Buffer
# transfer
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
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_MIFARE_APPLICATION_DIRECTORY
The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.
# KEY_NFC_FORUM
The well-known key for tags formatted according to the NDEF on MIFARE Classic specification.