/*
* The SET PASSWORD command enables the different passwords to be transmitted to the label
* to access the different protected functionalities of the following commands.
* The SET PASSWORD command has to be executed just once for the related passwords if the label is powered
*/
ISO15693ErrorCode PN5180ISO15693::setPassword(uint8_t *password, uint8_t *random) {
uint8_t setPassword[] = {0x02, 0xB3, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00};
uint8_t *readBuffer;
setPassword[4] = password[0] ^ random[0];
setPassword[5] = password[1] ^ random[1];
setPassword[6] = password[2] ^ random[0];
setPassword[7] = password[3] ^ random[1];
ISO15693ErrorCode rc = issueISO15693Command(setPassword, sizeof(setPassword), &readBuffer);
return rc;
}
ISO15693ErrorCode PN5180ISO15693::enablePrivacy(uint8_t *password, uint8_t *random) {
uint8_t setPrivacy[] = {0x02, 0xBA, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t *readBuffer;
setPrivacy[3] = password[0] ^ random[0];
setPrivacy[4] = password[1] ^ random[1];
setPrivacy[5] = password[2] ^ random[0];
setPrivacy[6] = password[3] ^ random[1];
ISO15693ErrorCode rc = issueISO15693Command(setPrivacy, sizeof(setPrivacy), &readBuffer);
return rc;
}