WinCEGeräteSE_Handbuch_Programmierung_v3.00_EN
37 / 65
void ShowReadData(HTAG Tag, LPBYTE lpabReadBlockData)
{
RFIDCARDINFO RfidCardInfo;
// Get card type information
RfidCardInfo.m_nSize = sizeof(RFIDCARDINFO);
RFIDGetCardInfo(g_hRfid, Tag, &RfidCardInfo);
_tprintf(_T("Block 0: 0x"));
for(int nChar = 0; nChar < RfidCardInfo.m_nSizeBlock; nChar++)
_tprintf(_T("%02X"), lpabReadBlockData[nChar]);
_tprintf(_T("\n"));
}
BOOL ChangeBuffer(LPBYTE lpabBuf, int nSize)
{
LPBYTE lpbHlp = (LPBYTE) malloc(nSize);
if (!lpbHlp)
return FALSE;
memcpy(lpbHlp, lpabBuf, nSize);
for(int i = 0; i < nSize; i++)
lpabBuf[i] = lpbHlp[nSize - 1 - i];
free(lpbHlp);
return TRUE;
}
int main(int argc, char* argv[])
{
BYTE abReadBlockData[SIZE_ONEBLOCK_MIF];
UINT nFoundCards, nCards;
LONG lResult;
HTAG Tag[MAXCARD];
BYTE bCardSize;
int nSize;
RES Res;
DWORD dwCardFamily = CARDFAMILY_MIFARE;
//*******************************************************************
// MIFARE
//*******************************************************************
// Initialise
_tprintf(_T("initialise Mifare...\n\n"));
nFoundCards = MAXCARD;
// Interface port e.g. COM1:
// Interface parameter e.g. 115200,N,8,1
lResult = RFIDInit(&dwCardFamily, 5000, 0, TRUE, &g_hRfid);
if (lResult != RFID_SUCCESS)
return(RetDspError());
// Initialisation correct
_tprintf(_T("Initialise Mifare Ok!\n\n"));
// Get and show transponder cards in Rfid field
_tprintf(_T("get Mifare transponder cards in field...\n\n"));