API for the PN532 based NFC/RFID reader/writer.
More...
Identify a card and print out basic info
Add a URI to an already NDEF formatted ultralight or NTAG2XX tag
|
class | BAUD_T |
|
class | MIFARE_CMD_T |
|
class | NDEF_URI_T |
|
class | PN532_CMD_T |
|
class | PN532_RSP_T |
|
class | TAG_TYPE_T |
|
|
synchronized void | delete () |
|
| PN532 (int irq, int reset, int bus, short address) |
|
| PN532 (int irq, int reset, int bus) |
|
| PN532 (int irq, int reset) |
|
boolean | init () |
|
long | getFirmwareVersion () |
|
boolean | sendCommandCheckAck (byte[] cmd, short cmdlen, int timeout) |
|
boolean | sendCommandCheckAck (byte[] cmd, short cmdlen) |
|
boolean | SAMConfig () |
|
boolean | setPassiveActivationRetries (short maxRetries) |
|
boolean | readPassiveTargetID (PN532.BAUD_T cardbaudrate, byte[] uid, short[] uidLength, int timeout) |
|
boolean | inDataExchange (byte[] send, short sendLength, byte[] response, short[] responseLength) |
|
boolean | inListPassiveTarget () |
|
boolean | mifareclassic_IsFirstBlock (long uiBlock) |
|
boolean | mifareclassic_IsTrailerBlock (long uiBlock) |
|
boolean | mifareclassic_AuthenticateBlock (byte[] uid, short uidLen, long blockNumber, short keyNumber, byte[] keyData) |
|
boolean | mifareclassic_ReadDataBlock (short blockNumber, byte[] data) |
|
boolean | mifareclassic_WriteDataBlock (short blockNumber, byte[] data) |
|
boolean | mifareclassic_FormatNDEF () |
|
boolean | mifareclassic_WriteNDEFURI (short sectorNumber, PN532.NDEF_URI_T uriIdentifier, String url) |
|
boolean | ntag2xx_ReadPage (short page, byte[] buffer) |
|
boolean | ntag2xx_WritePage (short page, byte[] data) |
|
boolean | ntag2xx_WriteNDEFURI (PN532.NDEF_URI_T uriIdentifier, String url, short dataLen) |
|
int | getATQA () |
|
short | getSAK () |
|
void | pn532Debug (boolean enable) |
|
void | mifareDebug (boolean enable) |
|
PN532.TAG_TYPE_T | tagType () |
|
PN532 |
( |
int |
irq, |
|
|
int |
reset, |
|
|
int |
bus, |
|
|
short |
address |
|
) |
| |
pn532 constructor
- Parameters
-
irq | pin to use for IRQ |
reset | reset pin |
bus | i2c bus to use |
address | the address for this device |
return the ATQA (Answer to Request Acknowlege) value. This value is only valid after a successfull call to readPassiveTargetID()
- Returns
- ATQA value
long getFirmwareVersion |
( |
| ) |
|
Checks the firmware version of the PN5xx chip
- Returns
- the chip's firmware version and ID
return the SAK (Select Acknowlege) value. This value is only valid after a successfull call to readPassiveTargetID()
- Returns
- SAK value
boolean inDataExchange |
( |
byte[] |
send, |
|
|
short |
sendLength, |
|
|
byte[] |
response, |
|
|
short[] |
responseLength |
|
) |
| |
exchanges an APDU (Application Protocol Data Unit) with the currently inlisted peer
- Parameters
-
send | Pointer to data to send |
sendLength | Length of the data to send |
response | Pointer to response data |
responseLength | Pointer to the response data length |
- Returns
- true if everything executed properly, false for an error
set up initial values and start operation
- Returns
- true if successful
boolean inListPassiveTarget |
( |
| ) |
|
'InLists' a passive target. PN532 acting as reader/initiator, peer acting as card/responder.
- Returns
- true if everything executed properly, false for an error
boolean mifareclassic_AuthenticateBlock |
( |
byte[] |
uid, |
|
|
short |
uidLen, |
|
|
long |
blockNumber, |
|
|
short |
keyNumber, |
|
|
byte[] |
keyData |
|
) |
| |
tries to authenticate a block of memory on a MIFARE card using the INDATAEXCHANGE command. See section 7.3.8 of the PN532 User Manual for more information on sending MIFARE and other commands.
- Parameters
-
uid | Pointer to a byte array containing the card UID |
uidLen | The length (in bytes) of the card's UID (Should be 4 for MIFARE Classic) |
blockNumber | The block number to authenticate. (0..63 for 1KB cards, and 0..255 for 4KB cards). |
keyNumber | Which key type to use during authentication (0 = MIFARE_CMD_AUTH_A, 1 = MIFARE_CMD_AUTH_B) |
keyData | Pointer to a byte array containing the 6 byte key value |
- Returns
- true if everything executed properly, false for an error
boolean mifareclassic_IsFirstBlock |
( |
long |
uiBlock | ) |
|
Indicates whether the specified block number is the first block in the sector (block 0 relative to the current sector)
- Returns
- true if it's the first block, false otherwise
boolean mifareclassic_IsTrailerBlock |
( |
long |
uiBlock | ) |
|
indicates whether the specified block number is the sector trailer
- Returns
- true if it's the trailer block, false otherwise
boolean mifareclassic_ReadDataBlock |
( |
short |
blockNumber, |
|
|
byte[] |
data |
|
) |
| |
tries to read an entire 16-byte data block at the specified block address.
- Parameters
-
blockNumber | The block number to read (0..63 for 1KB cards, and 0..255 for 4KB cards). |
data | Pointer to the byte array that will hold the retrieved data (if any) |
- Returns
- true if everything executed properly, false for an error
boolean mifareclassic_WriteDataBlock |
( |
short |
blockNumber, |
|
|
byte[] |
data |
|
) |
| |
tries to write an entire 16-byte data block at the specified block address.
- Parameters
-
blockNumber | The block number to write. (0..63 for 1KB cards, and 0..255 for 4KB cards). |
data | The byte array that contains the data to write. |
- Returns
- true if everything executed properly, false for an error
boolean mifareclassic_WriteNDEFURI |
( |
short |
sectorNumber, |
|
|
PN532.NDEF_URI_T |
uriIdentifier, |
|
|
String |
url |
|
) |
| |
writes an NDEF URI Record to the specified sector (1..15)
Note that this function assumes that the Mifare Classic card is already formatted to work as an "NFC Forum Tag" and uses a MAD1 file system. You can use the NXP TagWriter app on Android to properly format cards for this.
- Parameters
-
sectorNumber | The sector that the URI record should be written to (can be 1..15 for a 1K card) |
uriIdentifier | The uri identifier code (one of the NDEF_URI_T values |
url | the uri text to write (max 38 characters). |
- Returns
- true if everything executed properly, false for an error
void mifareDebug |
( |
boolean |
enable | ) |
|
enable or disable debugging output for mifare related operations
- Parameters
-
enable | true to enabloe debug output, false to disable |
boolean ntag2xx_ReadPage |
( |
short |
page, |
|
|
byte[] |
buffer |
|
) |
| |
read an entire 4-byte page at the specified address
- Parameters
-
page | The page number (0..63 in most cases) |
buffer | Pointer to the byte array that will hold the retrieved data (if any) |
- Returns
- true if everything executed properly, false for an error
boolean ntag2xx_WriteNDEFURI |
( |
PN532.NDEF_URI_T |
uriIdentifier, |
|
|
String |
url, |
|
|
short |
dataLen |
|
) |
| |
writes an NDEF URI Record starting at the specified page (4..nn)
Note that this function assumes that the NTAG2xx card is already formatted to work as an "NFC Forum Tag".
- Parameters
-
uriIdentifier | The uri identifier code (one of the NDEF_URI_T values |
url | The uri text to write (null-terminated string). |
dataLen | The size of the data area for overflow checks. |
- Returns
- true if everything executed properly, false for an error
boolean ntag2xx_WritePage |
( |
short |
page, |
|
|
byte[] |
data |
|
) |
| |
write an entire 4-byte page at the specified block address
- Parameters
-
page | The page number to write. (0..63 for most cases) |
data | The byte array that contains the data to write. Should be exactly 4 bytes long. |
- Returns
- true if everything executed properly, false for an error
void pn532Debug |
( |
boolean |
enable | ) |
|
enable or disable debugging output for pn532 related operations
- Parameters
-
enable | true to enabloe debug output, false to disable |
boolean readPassiveTargetID |
( |
PN532.BAUD_T |
cardbaudrate, |
|
|
byte[] |
uid, |
|
|
short[] |
uidLength, |
|
|
int |
timeout |
|
) |
| |
waits for an ISO14443A target to enter the field
- Parameters
-
cardbaudbate | baud rate of the card, one of the BAUD_T values |
uid | Pointer to the array that will be populated with the cards UID, up to 7 bytes |
uidLength | Pointer to the variable that will hold the length of the card's UID. |
timeout | the number of milliseconds to wait |
- Returns
- true if everything executed properly, false for an error
boolean sendCommandCheckAck |
( |
byte[] |
cmd, |
|
|
short |
cmdlen, |
|
|
int |
timeout |
|
) |
| |
sends a command and waits a specified period for the ACK
- Parameters
-
cmd | Pointer to the command buffer |
cmdlen | the size of the command in bytes |
timeout | timeout before giving up (in ms) |
- Returns
- true if everything is OK, false if timeout occured before an ACK was recieved
boolean setPassiveActivationRetries |
( |
short |
maxRetries | ) |
|
sets the MxRtyPassiveActivation byte of the RFConfiguration register. By default the pn532 will retry indefinitely.
- Parameters
-
maxRetries | 0xFF to wait forever, 0x00..0xFE to timeout after maxRetries. 0x00 means try once, with no retries on failure. |
- Returns
- true if everything executed properly, false for an error
PN532.TAG_TYPE_T tagType |
( |
| ) |
|
try to determine the tag type
- Returns
- one of the TAG_TYPE_T values
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/pn532/PN532.java