Communicating Directly with the reader
SCardControl function
Send commands directly to the reader through the SCardControl function. Set
dwControlCode to SCARD_CTL_CODE(2048) and set lpInBuffer to the command you want to send
to the reader.
The following piece of C code displays the string "hello!" on a GCR500 reader.
// Note that you might need to clear LCD first (command 2Ah)
dwControlCode = SCARD_CTL_CODE(2048);
memcpy(lpInBuffer, "\x2B\x81Hello!", 8);
nInBufferSize = 8;
nOutBufferSize = 300;
return_code = SCardControl(hCard,
dwControlCode,
lpInBuffer,
nInBufferSize,
lpOutBuffer,
nOutBufferSize,
lpBytesReturned);
if ((*lpBytesReturned == 1) && (lpOutBuffer[0] ==
0x00))
printf ("OK!\n");
|