SCR331-DI Product Technical Manual
// please add the name of the used reader here or use SCardListReaders to find the right reader
name
char
*ReaderName[]
= {
"SCM
Microsystems Inc. SCR331-DI USB ContactlessReader 0",
NULL
};
/********************************************************************************************************/
ContextHandle = -1;
ret = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &ContextHandle);
if (ret == SCARD_S_SUCCESS)
{
ret = SCardConnect(
ContextHandle,
ReaderName[0],
SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0
|
SCARD_PROTOCOL_T1,
&CardHandle,
&ActiveProtocol);
if (ret == SCARD_S_SUCCESS)
{
/* get actual PUPI status: ON/OFF */
InBufLen
=
2;
InWord
=
CCID_GET_PUPI_STATUS;
ret
=
SCardControl(CardHandle, IOCTL_CCID_ESCAPE,
&InWord,
InBufLen,
&OutByte,
1,
&ResLen);
printf ("\n Get PUPI status: %lx: %.2x", ret,OutByte);
Reader[0].dwCurrentState = SCARD_STATE_UNAWARE;
Reader[0].dwEventState = SCARD_STATE_UNAWARE;
Reader[0].szReader
=
ReaderName[0];
ret
=
SCardGetStatusChange(
ContextHandle, MINTIMEOUT, Reader, 1);
printf
("\nATR:
");
for
(i=0;
i<Reader->cbAtr;
i++)
{
printf
("%.2x
",Reader->rgbAtr[i]);
}
printf
("\n----------------------------------------------\n");
/* set actual PUPI status: ON */
printf
("\nenable
PUPI
");
InBufLen
=
2;
InWord
=
CCID_SET_PUPI_ON;
ret
=
SCardControl(CardHandle, IOCTL_CCID_ESCAPE,
&InWord,
InBufLen,
&OutByte,
1,
&ResLen);
ret
=
SCardDisconnect(CardHandle, SCARD_RESET_CARD);
ret
=
SCardConnect(
ContextHandle,
ReaderName[0],
SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0 |
SCARD_PROTOCOL_T1,
&CardHandle,
IND.SCR331-DI.MANUAL.VER.1.8
VER1.8
Page 34 of 36