WinCEGeräteSE_Handbuch_Programmierung_v3.00_EN
39 / 65
#ifdef _UHF
lResult = RFIDInit(&dwCardFamily, 5000, 8000, TRUE, &g_hRfid);
#endif
if (lResult != RFID_SUCCESS)
return(RetDspError());
// Initialisation correct
_tprintf(_T("Initialise Ok!\n\n"));
// Get and show transponder cards in Rfid field
_tprintf(_T("Get transponder card in field...\n\n"));
lResult = RFIDFindCards(g_hRfid, dwCardFamily, &Tag[0],
&nFoundCards, FALSE);
if (lResult != RFID_SUCCESS)
{
// Error occurred when getting the transponder cards
if (lResult == RFID_NO_TAG)
// No transponder card found
_tprintf(_T("no transponder card found!\n"));
else
return(RetDspError());
}
if (nFoundCards > 0)
{
// Show transponder addresses
ShowCards(&Tag[0], nFoundCards);
for(nCards = 0; nCards < nFoundCards; +)
{
// Select transponder cards
lResult = RFIDSelectCard(g_hRfid, Tag[nCards], &bCardSize, TRUE);
if (lResult != RFID_SUCCESS)
return(RetDspError());
nSize = sizeof(from ReadBlockData);
#ifndef CARDFAMILY_UHF
// Read out block 0
lResult = RFIDReadBlock(g_hRfid, Tag[nCards], 0,
fromReadBlockData, &nSize, TRUE);
if (lResult != RFID_SUCCESS)
return(RetDspError());
// Show block data
ShowReadData(Tag[nCards], abReadBlockData);
#else
// Read Block 0 (Accesspwd) from RFU memory
lResult = EPC_ReadBlockFromBank(g_hRfid, Tag[nCards], 0,
0, 0x00000000, fromReadBlockData, &nSize);
if (lResult != RFID_SUCCESS)
return(RetDspError());
ChangeBuffer(fromReadBlockData, nSize);
// Show from ReadBlockData…
#endif
}
}
// Uninitialise
RFIDUnInit(g_hRfid);
getch();
return 0;
}