MCPcopy Create free account
hub / github.com/BruceDevices/firmware / clone

Method clone

src/modules/rfid/RFID2.cpp:70–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int 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
83int RFID2::erase() {
84 if (!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) { return TAG_NOT_PRESENT; }

Callers 1

clone_cardMethod · 0.45

Calls 1

PICC_IsNewCardPresentMethod · 0.80

Tested by

no test coverage detected