WinCEGeräteSE_Handbuch_Programmierung_v3.00_EN
36 / 65
5.8.4 Example program
The program sequence below shows how the basic RFIDApi functions are applied based on a simple
example.
On the example of the transponder card families MIFARE, ICODE SLI and UHF, the aim is to demonstrate
how a family initialises, how various cards are detected in the RFID field and how individual cards are
selected. Finally, the content of the first block on the transponder card is read out. This command is an
example to be applied to all other basic commands (e.g. read out AFI etc.).
The ACD DeveloperPack offers among other features useful functions for RFID readers installed in ACD
devices.
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <conio.h>
#include "RfidApi.h"
HRFID g_hRfid;
void DspError(void)
{
RES Res;
// Get last error
RFIDGetLastError(&Res);
_tprintf(_T("error: function: %d status: %d Rfid error: %d"),
Res.m_lFunc, Res.m_usStat, Res.m_lRfid);
}
int RetDspError(void)
{
// Show last error
DspError();
// Uninitialise
RFIDUnInit(g_hRfid);
getch();
return 0;
}
void ShowCards(LPHTAG lpTag, UINT nFoundCards)
{
RFIDCARDINFO RfidCardInfo;
int i;
TCHAR szItem[250];
for(UINT nCards = 0; nCards < nFoundCards; +)
{
// Get card type information
RfidCardInfo.m_nSize = sizeof(RFIDCARDINFO);
RfidGetCardInfo(g_hRfid, lpTag[nCards], &RfidCardInfo);
_tprintf(_T("Transponder card %d: 0x"), 1);
CnvCardIdStr(lpTag[nCards], szItem, RfidCardInfo.m_dwCardFamily,
RfidCardInfo);
_tprintf(_T(“%s\n), szItem);
}
_tprintf(_T("\n"));
}