Topic: Function to check if a nfc target is still present

I am happy to see the ongoing development of libnfc, e.g. polling for targets without making an active connection.

Would it also be possible to check if an active connection made with nfc_initiator_select_tag is still valid? So far i can see no possibility to check if the target has been moved out of the field other than sending data to the tag.

Re: Function to check if a nfc target is still present

Hello,

frankmpunkt wrote:

I am happy to see the ongoing development of libnfc, e.g. polling for targets without making an active connection.

Thanks for this comment smile
Unfortunatly I can't contribute as I except (lack of time) and the polling method doesn't support each card type (and I haven't such cards) but only ISO 14443A. Its documentation is also missing, even this function is easy to understand...

frankmpunkt wrote:

Would it also be possible to check if an active connection made with nfc_initiator_select_tag is still valid? So far i can see no possibility to check if the target has been moved out of the field other than sending data to the tag.

AFAIK, there is no other way to know if a target is still here than sending some dummy command to act as "ping".
There is another similar topic : http://www.libnfc.org/community/topic/3 … the-field/

I agree that can be useful to have such function... maybe we could wrote a simple function that does the "ping" and returns the result...

PS: As I can see, you have done some interesting work using libnfc (IFD Handler for libnfc Devices¹) and your suggests or bug report are usefull (ATS of ISO14443-A too long?²). Thanks for that, and feel free to contribute to libnfc.

[1] http://www.libnfc.org/community/topic/1 … c-devices/
[2] http://www.libnfc.org/community/topic/1 … -too-long/

Romuald Conty

Re: Function to check if a nfc target is still present

hello,

Maybe i'm giving the wrong solution but  i had your problem as well. If and only if i understood correctly.

Simply I solved by saving the uid of my last tag on the field..
then i check periodically lets say every 200ms if the tag is in the field with
nfc_initiator_select_tag(pnd, NM_ISO14443A_106, lastUid, lastUidlen, NULL);
otherwise it means the tag has been moved out.

Re: Function to check if a nfc target is still present

Thanks for the idea, this works quite well. The documentation of nfc_initiator_select_tag says that this should also be possible for Felica, ISO14443B and for Topaz Polling. Do you know which fields of  the respective struct nfc_*_info_t would identify the UID and the length of the UID?

Note, that ISO does not require the UID to be static. The UID could also be chosen randomly by the card for everytime it gets powered up.

Re: Function to check if a nfc target is still present

Welcome
I only know about iso14443A i didn't work with the other tags
so i can't answer your question
Perhaps you can try the same approach instead of looking for the uid you can use (nfc_initiator_select_tag(pnd,*YOURCHOICE*,NULL,0,&*YOURSTRUCT))  find some static identification  the tag has and check with *lastusedstruct* data.
Check my tool http://www.libnfc.org/community/topic/1 … -gui-tool/ and see the autochecking at work! smile

Re: Function to check if a nfc target is still present

I agree with this solution..
But little confuse about this, coz I am in starting phrase of development. .. dreddolo, do you explain this please...  or pm me.