Memory card type selection – ACS ACR38K Smart Keyboard User Manual
Page 12
![background image](/manuals/248165/12/background.png)
ACR38x (CCID) – Reference Manual
Version 6.04
www.acs.com.hk
Page 12 of 58
8.0. Memory Card Type Selection
SELECT_CARD_TYPE command must be executed first before other memory card commands. This
command powers up and down the selected card inserted in the card reader and performs a card
reset. This command can only be used after the logical smart card reader communication has been
established using the SCardConnect() API.
For details of SCardConnect() API, please refer to PC/SC specifications.
For the Memory Card Command Set, please refer to
Section 9.3.
A code snippet for the program flow is given below to demonstrate how to select the memory card
type in ACR38x (CCID):
SCARDCONTEXT hContext;
SCARDHANDLE hCard;
unsigned long dwActProtocol;
SCARD_IO_REQUEST ioRequest;
DWORD size = 64, SendLen = 6, RecvLen = 255, retCode;
byte cardType;
//Establish PC/SC Connection
retCode = SCardEstablishContext (SCARD_SCOPE_USER, NULL, NULL, &hContext);
//List all readers in the system
retCode = SCardListReaders (hContext, NULL, readerName, &size);
//Connect to the reader
retCode = SCardConnect(hContext, readerName, SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0, &hCard, &dwActProtocol);
//Select Card Type
unsigned char SendBuff[] = {0xFF,0xA4,0x00,0x00,0x01,cardType};
retCode = SCardTransmit( hCard, &ioRequest, SendBuff, SendLen, NULL,
RecvBuff, &RecvLen);
//Disconnect from the reader
retCode = SCardDisconnect(hCard, SCARD_UNPOWER_CARD);
//End the established context
retCode = SCardReleaseContext(hContext);