ACM1252U-Y3
– Reference Manual
Version 1.03
www.acs.com.hk
Page 12 of 92
www.acs.com
.hk
#define
SCARD_SCOPE_USER 0
#define
EscapeCommand 0x 3500*4
SCARDCONTEXT
hContext;
// Resource manager context
SCARDHANDLE
hCard;
// Card context handle
unsigned long
dwActProtocol;
// Established active protocol
int
retCode;
char
readerName [256];
// Lists reader name
char
rName [256];
// Reader name for connection
BYTE
SendBuff[262],
// APDU command buffer
RecvBuff[262];
// APDU response buffer
BYTE FWVersion [20],
// For storing firmware
version message
BYTE
ResponseData[50];
// For storing card response
DWORD
SendLen,
// APDU command length
RecvLen;
// APDU response length
void main ()
{
…
rName =
"ACS ACR1252 CL Reader PICC 0"
;
// Depends on what
reader will be used
// Should connect to
PICC interface
retCode = SCardConnect(hContext,
rName,
SCARD_SHARE_DIRECT,
SCARD_PROTOCOL_T0| SCARD_PROTOCOL_T1,
&hCard,
&dwActProtocol);
if
(retCode != SCARD_S_SUCCESS)
{
// Connection failed (may be because of incorrect reader
name, or no card was detected)
}
else
{
// Connection successful
RecvLen = 262;
// Get firmware version
SendBuff[0] = 0xE0;
SendBuff[1] = 0x00;
SendBuff[2] = 0x00;
SendBuff[3] = 0x18;
SendBuff[4] = 0x00;
5.1.4.
SCardControl
The SCardControl function gives you direct control of the reader. You can call it any time after a
successful call to SCardConnect and before a successful call to SCardDisconnect. The effect on the
state of the reader depends on the control code.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa379474%28v=vs.85%29.aspx
Note: Commands from Peripherals Control use this API for sending.
Example: