Example sequence
The following is an example sequence of IOCTLs in the Smart Card resource manager:
Start-up sequence
Use the DevObj or CfgMgr API with the Smart Card access device interface GUID to discover the NFC device driver's name, and use it with CreateFile to open a device handle.
Initialize thread pool.
Determine reader name.
- IOCTL_SMARTCARD_GET_ATTRIBUTE on SCARD_ATTR_VENDOR_NAME, SCARD_ATTR_VENDOR_IFD_TYPE, and SCARD_ATTR_DEVICE_UNIT
Determine reader characteristics.
- IOCTL_SMARTCARD_GET_ATTRIBUTE on SCARD_ATTR_CHARACTERISTICS
Start the card state monitor.
IOCTL_SMARTCARD_IS_PRESENT – To wait for a smart card arrival.
IOCTL_SMARTCARD_IS_ABSENT – To wait for the smart card departure.
The Power reset is irrelevant since we do not support SCARD_SWALLOWED, SCARD_POWERED state.
Connect sequence
Start of loop.
IOCTL_SMARTCARD_GET_STATE
Case SCARD_UNKNOWN and SCARD_ABSENT, do nothing
Case SCARD_PRESENT, swallow card
Case SCARD_SWALLOWED, cold reset
Case SCARD_POWERED, warm reset
Case SCARD_NEGOTIABLE, determine the card ATR
Case SCARD_SPECIFIC, determine the card ATR and protocol
IOCTL_SMARTCARD_SET_PROTOCOL
Disconnect sequence
Power-down timeout starts.
Start of loop.
IOCTL_SMARTCARD_GET_STATE
Case SCARD_SPECIFIC, SCARD_NEGOTIABLE, SCARD_POWERED, set power down
Case SCARD_SWALLOWED, SCARD_PRESENT, do nothing
Case SCARD_ABSENT, SCARD_UNKNOWN, do nothing