| 68 | } |
| 69 | |
| 70 | int RFID2::clone() { |
| 71 | if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) { return TAG_NOT_PRESENT; } |
| 72 | |
| 73 | if (mfrc522.uid.sak != uid.sak) return TAG_NOT_MATCH; |
| 74 | |
| 75 | MFRC522Hack mfrc522Hack(mfrc522, true); |
| 76 | MFRC522::MIFARE_Key key = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 77 | |
| 78 | bool success = mfrc522Hack.MIFARE_SetUid(uid.uidByte, uid.size, key, true); |
| 79 | mfrc522.PICC_HaltA(); |
| 80 | return success ? SUCCESS : FAILURE; |
| 81 | } |
| 82 | |
| 83 | int RFID2::erase() { |
| 84 | if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) { return TAG_NOT_PRESENT; } |
no test coverage detected