-18-
v7.0
Libelium’s library
8.7. Reading a block with authentication
This function authenticates a block of the card first, and then reads the 16 bytes stored in a block. This function is useful to do
these 2 steps in just one.
Example of use:
{
uint8_t state; // stores the status of the executed command
uint8_t aux[16]; // auxiliar buffer
uint8_t UID[4]; // stores the UID (unique identification) of a card
uint8_t key[6]; // stores the key or password
...
memset(key, 0xFF, 6); // the key by default, edit if needed
state = RFID13.init(UID, aux); // inits systems and look for cards
state = RFID13.readWithAuth(UID, key, aux, 2); // authenticates block 2, then reads it.
// Data is stored in aux.
}
8.8. Writing in a block
This function writes 16 bytes in a block. This block must have been authenticated before writing.
Example of use:
{
uint8_t state; // stores the status of the executed command
uint8_t aux[16]; // auxiliar buffer
uint8_t UID[4]; // stores the UID (unique identification) of a card
uint8_t key[6]; // stores the key or password
...
memset(key, 0xFF, 6); // the key by default, edit if needed
state = RFID13.init(UID, aux); // inits systems and look for cards
state = RFID13.authenticate(UID, 2, key); // authenticates block 2
memset(aux, 0x00, 16); // stores 0’s in aux, 16 bytes
state = RFID13.write(2, aux); // writes the content of aux in block number 2
}
http://www.libelium.com/development/waspmote/examples/RFID1356-03-bus-ticketing
8.9. Writing in a block with authentication
This function authenticates a block of the card first, and then writes 16 bytes in the block. This function is useful to do these 2
steps in just one.
Example of use:
{
uint8_t state; // stores the status of the executed command
uint8_t aux[16]; // auxiliar buffer
uint8_t UID[4]; // stores the UID (unique identification) of a card
uint8_t key[6]; // stores the key or password
...
memset(key, 0xFF, 6); // the key by default, edit if needed
state = RFID13.init(UID, aux); // inits systems and look for cards
memset(aux, 0x00, 16); // stores 0’s in aux, 16 bytes
state = RFID13.writeWithAuth(UID, key, aux, 2); // authenticates block 2, then writes the
// content of aux in it
}