Hi, I am working with Mifare Classic NFC card using your library. My application polls for cards (I use the same logic you implemented in nfc-poll utility) and when the card is polled I wait until its presence on the reader using nfc_initiator_target_is_present() function in another thread. During this process user can read and write to card using mifare_classic_read()mifare_classic_write() functions.
However when I try to do this I am getting the error below.
I tried to comment the code which always checks nfc_initiator_target_is_present() and it works fine now, but I need to know whether the card is inserted and ejected. I can infer that the problem is connected with infinite checking with nfc_initiator_target_is_present(). Is it possible to implement such logic: when we poll and check for card in another thread and read/write to card from the main thread? How to fix my error?
Here I try to write to card and the error is raised (before writing I connected to card and authenticated to needed blocks successfully):
if (SharpFreeFare.Functions.mifare_classic_write(freefareTag, blockNumber, data) == 0)
{
Console.WriteLine($"Successfully wrote to {blockNumber} block");
return true;
}
else
{
Console.WriteLine($"Couldn't wrote to {blockNumber} block");
return false;
}
Hi, I am working with Mifare Classic NFC card using your library. My application polls for cards (I use the same logic you implemented in nfc-poll utility) and when the card is polled I wait until its presence on the reader using nfc_initiator_target_is_present() function in another thread. During this process user can read and write to card using
mifare_classic_read()
mifare_classic_write()
functions.However when I try to do this I am getting the error below.
I tried to comment the code which always checks nfc_initiator_target_is_present() and it works fine now, but I need to know whether the card is inserted and ejected. I can infer that the problem is connected with infinite checking with nfc_initiator_target_is_present(). Is it possible to implement such logic: when we poll and check for card in another thread and read/write to card from the main thread? How to fix my error?
Here I wait for the card presence:
Here I try to write to card and the error is raised (before writing I connected to card and authenticated to needed blocks successfully):
Thanks in advance!