h4kbas / nfc-reader

A simple library that provides to use rfid card readers.
MIT License
128 stars 44 forks source link

Always unauthorized #13

Closed layos closed 2 years ago

layos commented 3 years ago

Hi folks, I'm a complete newbie about NFC, so I'm at my first try. Please forgive my question if it is too dumb. I got your useful lib from git and I try to use it. I can connect to my reader, handle the "card-in" event, but when I try to write a tag in block, I always get as return code "6" that means, as far as I understand, that I'm not allowed to write. Could you please help understand why? Thank you.

h4kbas commented 3 years ago

Idk if I understood it correctly but If you want to write into some block first you need to authorize it, it is a process of locking that block and then writing it

layos commented 3 years ago

Idk if I understood it correctly but If you want to write into some block first you need to authorize it, it is a process of locking that block and then writing it

Thank you I just understand that it was a problem of "threads". I opened a connection in a separate thread in my UI and it was not still active when I tented to write.

h4kbas commented 3 years ago

Oh I see, yeah you should have a async lock kind of thing to wait it