Topic: How do know when a card has left the field?

The scenario is a smartcard is used with a tapping action on a reader, we want to wait until the card has left the field before proceeding with a further transaction, (ie waiting for a new card to enter the field). 

With the WinSCard API you can do this by calling SCardGetStatusChange and checking for SCARD_STATE_PRESENT.

The API nfc_reader_list_passive() will tell you when a card has entered the field and go into the anti-collision and identification.

How do you wait until that card has left the field?

Re: How do know when a card has left the field?

After anti-collision & RATS, you could use the "ping" command that I describe in this post.
The frame last two CRC bytes are appended automatically by the reader (unless you have set the configuration option NOT to do this). By default, after doing a list_passive, the CRC will be enabled. So by transferring "ba  01" will give a response "ab 01".
If it fails and this will not be the case, then your card is not responding, and most probably out of the field wink

It may seems wierd to do this yourself, but you should know that in the background, the SCardGetStatusChange() does the same thing. As I wrote before, there is not much APDU support in libnfc yet, but we will work on this. I think it is very useful to have a wrapper for usage that is compatible with standard APDU applications.

Re: How do know when a card has left the field?

roel wrote:

After anti-collision & RATS, you could use the "ping" command that I describe in this post.
The frame last two CRC bytes are appended automatically by the reader (unless you have set the configuration option NOT to do this). By default, after doing a list_passive, the CRC will be enabled. So by transferring "ba  01" will give a response "ab 01".
If it fails and this will not be the case, then your card is not responding, and most probably out of the field wink

Unfortunately i don't get this ping to work... neither nfc_initiator_transceive_dep_bytes nor nfc_initiator_transceive_bytes was successful (NDO_HANDLE_CRC enabled). Obviously the libnfc API changed (list_passive no longer exists). Could you explain how the ping would work with todays API (maybe in a libnfc example, which you indicated in the other thread)?