2.2.7 Reader State

The Reader State packet has a sub-structure as shown in the following table.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Reader State

Reader State (4 bytes): Both the dwCurrentState field and the dwEventState field, found in the ReaderState_Common_Call (section 2.2.1.5) and ReaderState_Return (section 2.2.1.11) structures, consist of the following two subfields.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Count

State

Count (2 bytes): The contents of this field depend on the value of the associated reader name. If the reader name (for more information, see sections 2.2.1.6 and 2.2.1.7 for the szReader field) is \\?PnP?\Notification, then Count is a count of the number of readers installed on the system and all bits except SCARD_STATE_CHANGED in State MUST be zero. Otherwise, Count is a count of the number of times a card has been inserted and/or removed from the smart card reader being monitored.

State (2 bytes): The state of a reader. The value MUST be according to the following table.

Value

Meaning

SCARD_STATE_UNAWARE

0x0000

The application requires the current state but does not know it. The use of this value results in an immediate return from state transition monitoring services.

SCARD_STATE_IGNORE

0x0001

The application requested that this reader be ignored. If this bit is set in the dwCurrentState field of a ReaderState_Common_Call structure, other bits MUST NOT be set in the dwEventState field of the corresponding ReaderState_Return structure.

SCARD_STATE_CHANGED

0x0002

There is a difference between the state believed by the application, and the state known by Smart Cards for Windows.

SCARD_STATE_UNKNOWN

0x0004

The reader name is not recognized by Smart Cards for Windows. If this bit is set in the dwEventState field of the ReaderState_Return structure, both SCARD_STATE_IGNORE and SCARD_STATE_CHANGED values MUST be set. This bit SHOULD NOT be set in the dwCurrentState field of a ReaderState_Common_Call structure.

SCARD_STATE_UNAVAILABLE

0x0008

The actual state of this reader is not available. If this bit is set, all of the following bits MUST be clear.

SCARD_STATE_EMPTY

0x0010

There is no card in the reader. If this bit is set, all of the following bits MUST be clear.

SCARD_STATE_PRESENT

0x0020

There is a card in the reader.

SCARD_STATE_ATRMATCH

0x0040

There is a card in the reader with an ATR that matches one of the target cards. If this bit is set, SCARD_STATE_PRESENT MUST be set.

SCARD_STATE_EXCLUSIVE

0x0080

The card in the reader is allocated for exclusive use by another application. If this bit is set, SCARD_STATE_PRESENT MUST be set.

SCARD_STATE_INUSE

0x0100

The card in the reader is in use by one or more other applications, but it can be connected to in shared mode. If this bit is set, SCARD_STATE_PRESENT MUST be set.

SCARD_STATE_MUTE

0x0200

The card in the reader is unresponsive or is not supported by the reader or software.

SCARD_STATE_UNPOWERED

0x0400

This implies that the card in the reader has not been turned on.