
ACM1252U-Y3
– Reference Manual
Version 1.03
www.acs.com.hk
Page 14 of 92
www.acs.com
.hk
#define
SCARD_SCOPE_USER
0
SCARDCONTEXT
hContext;
// Resource manager context
SCARDHANDLE
hCard;
// Card context handle
unsigned long
dwActProtocol;
// Established active protocol
int
retCode;
char
readerName [256];
// List reader name
char
rName [256];
// Reader name for connect
BYTE
SendBuff[262],
// APDU command buffer
RecvBuff[262];
// APDU response buffer
BYTE CardID [8],
// For storing the FeliCa IDM/
MIFARE® UID
BYTE
ResponseData[50];
// For storing card response
DWORD
SendLen,
// APDU command length
RecvLen;
// APDU response length
SCARD_IO_REQUEST ioRequest;
void main ()
{
…
rName =
"ACS ACR1252 CL Reader PICC 0"
;
// Depends on what reader
should be used
// Should connect to PICC
interface
retCode = SCardConnect(hContext,
rName,
SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0,
&hCard,
&dwActProtocol);
if
(retCode != SCARD_S_SUCCESS)
{
// Connection failed (May be because of incorrect reader
name, or no card was detected)
}
else
{
// Connection successful
ioRequest.dwProtocol = dwActProtocol;
ioRequest.cbPciLength =
sizeof
(SCARD_IO_REQUEST);
RecvLen = 262;
5.1.5.
SCardTransmit
The SCardTransmit function sends a service request to the smart card and expects to receive data
back from the card.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa379804%28v=vs.85%29.aspx
Note: APDU Commands (i.e. the commands sent to connected card, PICC Commands for
MIFARE® Classic (1K/4K) Memory Cards and Pseudo APDU for Contactless Interface) use this
API for sending.
Example: