Attempt to provide clean types for API
This commit is contained in:
parent
9020014160
commit
d289eabc36
19 changed files with 437 additions and 311 deletions
|
|
@ -60,6 +60,11 @@ static byte_t keys[] = {
|
|||
0xab, 0xcd, 0xef, 0x12, 0x34, 0x56
|
||||
};
|
||||
|
||||
static const nfc_modulation_t nmMifare = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
|
||||
static size_t num_keys = sizeof (keys) / 6;
|
||||
|
||||
static void
|
||||
|
|
@ -150,7 +155,7 @@ authenticate (uint32_t uiBlock)
|
|||
return true;
|
||||
}
|
||||
|
||||
nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, mp.mpa.abtUid, 4, NULL);
|
||||
nfc_initiator_select_passive_target (pnd, nmMifare, mp.mpa.abtUid, 4, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +182,7 @@ read_card (void)
|
|||
// Show if the readout went well
|
||||
if (bFailure) {
|
||||
// When a failure occured we need to redo the anti-collision
|
||||
if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) {
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) {
|
||||
printf ("!\nError: tag was removed\n");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -242,7 +247,7 @@ write_card (void)
|
|||
// Show if the readout went well
|
||||
if (bFailure) {
|
||||
// When a failure occured we need to redo the anti-collision
|
||||
if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) {
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) {
|
||||
printf ("!\nError: tag was removed\n");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -442,7 +447,7 @@ main (int argc, const char *argv[])
|
|||
printf ("Connected to NFC reader: %s\n", pnd->acName);
|
||||
|
||||
// Try to find a MIFARE Classic tag
|
||||
if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) {
|
||||
if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) {
|
||||
printf ("Error: no tag was found\n");
|
||||
nfc_disconnect (pnd);
|
||||
exit (EXIT_FAILURE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue