In PC/SC you can spawn a thread on SCardGetStatusChange for the particular reader you are interested in. This will then block until an event occurs. If the event is not one you are interested in or if you want to keep listening for events, call SCardGetStatusChange again.

Here is a code example (this will not compile, but should give you an answer):
It initially blocks until a card is inserted and then blocks until any event occurs after that ....

eventThread(....)
{

readerState.dwCurrentState = SCARD_STATE_ABSENT;

do
{

rv = SCardGetStatusChange(hContext, readerName, readerState, 1);

if (readerState.dwEventState & SCARD_STATE_PRESENT)
// Do something

readerState.dwCurrentState = readerState.dwEventState;

}
while (1);
}

On Oct 25, 2004, at 8:38 AM, Bruce Barnett wrote:

What's the best way to detect the event of a card being removed
and/or inserted into the reader?


_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.drizzle.com/mailman/listinfo/muscle


<x-tad-bigger>*****************************************************************************
David Corcoran <[EMAIL PROTECTED]>
Identity Alliance [http://www.identityalliance.com]
Smart Cards, Biometrics, Training, Identity Management
*****************************************************************************
</x-tad-bigger>
_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to