Smart Card Resource

The Smart Card resource is used to control the smart card.

Interface

The IHaiSmartCard interface is used to access the Smart Card resource.

Usage

To be able to perform smart card requests the resource must be in the active state, use IHaiSmartCard_GetState function to find out. In order to find out about how requests are completed, card movements and if a card reset is successful or not register a IHaiSmartCardObserver_OnEvent function using the IHaiSmartCard_SetEventObserver call.

Requests are queued using the IHaiSmartCard_PushRequest call. For each HAI_SMARTCARD_REQUEST_COMPLETED event received call IHaiSmartCard_PopResponse in order to receive the response. The last two bytes in the response are SW1 and SW2.

When a smart card is inserted the resource perfoms a reset of the card automatically. Once in the failed state the only way to leave that state is a card removal or a successful call to the IHaiSmartCard_Reset function. See the state diagram below for more details. After each succesful reset the card's answer to reset (ATR) is available and can be fetched using the IHaiSmartCard_GetAnswerToReset call.

Smart card resource states and transition events.