00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <QMainWindow>
00025 #include "NotifySampleDlg.h"
00026
00027
00028 #include "../../../../feisc-lib/include/feisc.h"
00029 #include "../../../../fedm-classlib/src/FedmIscCore.h"
00030 #include "ISO_IEC_7816_6_ICManufacturerRegistration.h"
00031
00032
00033 #include <iostream>
00034 #include <fstream>
00035
00036
00037 using namespace std;
00038
00039
00040
00041
00042
00043
00044 void NotifySampleDlg::displayData(void* pAny, int iError, unsigned char ucCmd)
00045 {
00046 bool bSNR = false;
00047 bool bDB = false;
00048 bool bTime = false;
00049 bool bDate = false;
00050 bool bAnt = false;
00051 bool bIn = false;
00052 bool bExt = false;
00053 bool bEpc = false;
00054 unsigned char ucTrType = 0;
00055
00056 unsigned char ucReadBlock[512] = {0};
00057 unsigned char ucDBSize = 0;
00058 unsigned char ucTmp;
00059 unsigned char ucSnr[32];
00060 unsigned char ucSnrLen = 0;
00061 unsigned char ucTimer[4];
00062 unsigned char ucDate[5];
00063 unsigned char ucAntNr = 0;
00064 unsigned char ucInput = 0;
00065 unsigned char ucState = 0;
00066 unsigned int uiDBN = 0;
00067 unsigned int uiTmp = 0;
00068 static char str[1024] = {0};
00069 char sMfr[256] = {0};
00070 char sTmp[256] = {0};
00071
00072 if (ucCmd != 0x22)
00073 return;
00074
00075 if(iError < 0)
00076 return;
00077
00078 if(!(iError==0x00 ||
00079 iError==0x83 ||
00080 iError==0x84 ||
00081 iError==0x93 ||
00082 iError==0x94 ))
00083 {
00084 return;
00085 }
00086
00087 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_SNR, &bSNR);
00088 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_DB, &bDB);
00089 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_ANT, &bAnt);
00090 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_TIME, &bTime);
00091 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_DATE, &bDate);
00092 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1_EXT, &bExt);
00093 m_iscReader->GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA2_IN, &bIn);
00094
00095 memset(m_cLineTxt, 0, 1024);
00096 memset(m_cLogTxt, 0, 1024);
00097
00098 for(int iIdx=0; iIdx<m_iscReader->GetTableLength(FEDM_ISC_BRM_TABLE); iIdx++)
00099 {
00100 sprintf(m_cLineTxt, "%07d", m_iLineCnt);
00101 sprintf(m_cLogTxt, "%07d;", m_iLineCnt++);
00102 memset(sMfr, 0, sizeof(sMfr));
00103 memset(sTmp, 0, sizeof(sTmp));
00104
00105 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_SNR_LEN, &ucSnrLen);
00106
00107 if(bSNR)
00108 {
00109 if(ucSnrLen > 0)
00110 {
00111 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_TRTYPE, &ucTrType);
00112
00113 sprintf(str, " - 0x%02X", ucTrType);
00114 strcat(m_cLineTxt, str);
00115 strcat(m_cLogTxt, str);
00116
00117 switch(ucTrType)
00118 {
00119 case FEDM_ISC_TR_TYPE_ICODE1:
00120 sprintf(str, "%s", " (Philips I-Code1)");
00121 break;
00122
00123 case FEDM_ISC_TR_TYPE_TAGIT:
00124 sprintf(str, "%s", " (Texas Instruments Tag-it HF)");
00125 break;
00126
00127 case FEDM_ISC_TR_TYPE_ISO15693:
00128 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_SNR, ucSnr, 8);
00129 strcpy(sMfr, getISOMfrCode(ucSnr[1]));
00130 sprintf(str, " (ISO15693 - %s)", sMfr);
00131 break;
00132
00133 case FEDM_ISC_TR_TYPE_ISO14443A:
00134 sprintf(str, "%s", " (ISO14443-A)");
00135 break;
00136
00137 case FEDM_ISC_TR_TYPE_ISO14443B:
00138 sprintf(str, "%s", " (ISO14443-B)");
00139 break;
00140
00141 case FEDM_ISC_TR_TYPE_EPC:
00142 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_IS_EPC, &bEpc);
00143 if(bEpc)
00144 {
00145 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_TYPE, &ucTmp);
00146 switch(ucTmp)
00147 {
00148 case FEDM_ISC_EPC_TYPE_1:
00149 sprintf(str, "%s", " (EPC 96 bit)");
00150
00151 break;
00152 case FEDM_ISC_EPC_TYPE_2:
00153 sprintf(str, "%s", " (EPC 64 bit type I)");
00154
00155 break;
00156 case FEDM_ISC_EPC_TYPE_3:
00157 sprintf(str, "%s", " (EPC 64 bit type II)");
00158
00159 break;
00160 case FEDM_ISC_EPC_TYPE_4:
00161 sprintf(str, "%s", " (EPC 64 bit type III)");
00162
00163 break;
00164 default:
00165 sprintf(str, "%s", " (unknown EPC type)");
00166 }
00167 }
00168 break;
00169
00170 case FEDM_ISC_TR_TYPE_0x64:
00171 sprintf(str, "%s", " (Unknown)");
00172 break;
00173
00174 case FEDM_ISC_TR_TYPE_ICODE_UID:
00175 sprintf(str, "%s", " (I-CODE UID)");
00176 break;
00177
00178 case FEDM_ISC_TR_TYPE_ISO18000_6_A:
00179 sprintf(str, "%s", " (18000-6-A)");
00180 break;
00181
00182 case FEDM_ISC_TR_TYPE_ISO18000_6_B:
00183 sprintf(str, "%s", " (18000-6-B)");
00184 break;
00185
00186 case FEDM_ISC_TR_TYPE_EM4222:
00187 sprintf(str, "%s", " (EM4222)");
00188 break;
00189
00190 case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2:
00191 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_IS_EPC, &bEpc);
00192 if(bEpc)
00193 {
00194 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_TYPE, &ucTmp);
00195 switch(ucTmp)
00196 {
00197 case FEDM_ISC_EPC_TYPE_1:
00198 sprintf(str, "%s", " (EPC Class 1 Gen 2 - EPC 96 bit)");
00199 break;
00200 case FEDM_ISC_EPC_TYPE_2:
00201 sprintf(str, "%s", " (EPC Class 1 Gen 2 - EPC 64 bit type I)");
00202 break;
00203 case FEDM_ISC_EPC_TYPE_3:
00204 sprintf(str, "%s", " (EPC Class 1 Gen 2 - EPC 64 bit type II)");
00205 break;
00206 case FEDM_ISC_EPC_TYPE_4:
00207 sprintf(str, "%s", " (EPC Class 1 Gen 2 - EPC 64 bit type III)");
00208 break;
00209 default:
00210 sprintf(str, "%s", " (EPC Class 1 Gen 2 - unknown EPC type)");
00211 }
00212 }
00213 else
00214 {
00215 sprintf(str, "%s", " (EPC Class 1 Gen 2)");
00216 }
00217 break;
00218
00219 case FEDM_ISC_TR_TYPE_EPC_CLASS0:
00220 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_IS_EPC, &bEpc);
00221 if(bEpc)
00222 {
00223 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_TYPE, &ucTmp);
00224 switch(ucTmp)
00225 {
00226 case FEDM_ISC_EPC_TYPE_1:
00227 sprintf(str, "%s", " (EPC Class 0 - EPC 96 bit)");
00228 break;
00229 case FEDM_ISC_EPC_TYPE_2:
00230 sprintf(str, "%s", " (EPC Class 0 - EPC 64 bit type I)");
00231 break;
00232 case FEDM_ISC_EPC_TYPE_3:
00233 sprintf(str, "%s", " (EPC Class 0 - EPC 64 bit type II)");
00234 break;
00235 case FEDM_ISC_EPC_TYPE_4:
00236 sprintf(str, "%s", " (EPC Class 0 - EPC 64 bit type III)");
00237 break;
00238 default:
00239 sprintf(str, "%s", " (EPC Class 0 - unknown EPC type)");
00240 }
00241 }
00242 else
00243 {
00244 sprintf(str, "%s", " (EPC Class 0)");
00245 }
00246 break;
00247
00248 case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN1:
00249 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_IS_EPC, &bEpc);
00250 if(bEpc)
00251 {
00252 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_TYPE, &ucTmp);
00253 switch(ucTmp)
00254 {
00255 case FEDM_ISC_EPC_TYPE_1:
00256 sprintf(str, "%s", " (EPC Class 1 Gen 1 - EPC 96 bit)");
00257 break;
00258 case FEDM_ISC_EPC_TYPE_2:
00259 sprintf(str, "%s", " (EPC Class 1 Gen 1 - EPC 64 bit type I)");
00260 break;
00261 case FEDM_ISC_EPC_TYPE_3:
00262 sprintf(str, "%s", " (EPC Class 1 Gen 1 - EPC 64 bit type II)");
00263 break;
00264 case FEDM_ISC_EPC_TYPE_4:
00265 sprintf(str, "%s", " (EPC Class 1 Gen 1 - EPC 64 bit type III)");
00266 break;
00267 default:
00268 sprintf(str, "%s", " (EPC Class 1 Gen 1 - unknown EPC type)");
00269 }
00270 }
00271 else
00272 {
00273 sprintf(str, "%s", " (EPC Class 1 Gen 1)");
00274 }
00275 break;
00276 default:
00277 sprintf(str, "%s", " (unknown)");
00278 break;
00279 }
00280
00281
00282 strcat(m_cLineTxt, str);
00283 strcat(m_cLogTxt, str);
00284 strcat(m_cLogTxt, ";");
00285
00286
00287 if(ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2)
00288 {
00289 memset(sTmp, 0, sizeof(sTmp));
00290 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_CL1_GEN2_PC, sTmp, sizeof(sTmp));
00291 sprintf(str, " PC.........: %s", sTmp);
00292 strcat(m_cLineTxt, str);
00293 strcat(m_cLogTxt, str);
00294 strcat(m_cLogTxt, ";");
00295 }
00296
00297
00298 if(bEpc)
00299 {
00300 memset(sTmp, 0, sizeof(sTmp));
00301 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC, sTmp, sizeof(sTmp));
00302 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_EPC_TYPE, &ucTmp);
00303
00304 switch(ucTmp)
00305 {
00306 case FEDM_ISC_EPC_TYPE_1:
00307 case FEDM_ISC_EPC_TYPE_2:
00308 case FEDM_ISC_EPC_TYPE_3:
00309 case FEDM_ISC_EPC_TYPE_4:
00310 sprintf(str, "%s", sTmp);
00311 break;
00312 default:
00313 sprintf(str, "%s", "EPC ??");
00314 }
00315 }
00316 else
00317 {
00318 memset(sTmp, 0, sizeof(sTmp));
00319 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_SNR, sTmp, sizeof(sTmp));
00320 sprintf(str, " - SNR..%s \n", sTmp);
00321 }
00322
00323
00324 strcat(m_cLineTxt, str);
00325 strcat(m_cLogTxt, str);
00326 strcat(m_cLogTxt, ";");
00327 }
00328 else
00329 {
00330 strcat(m_cLogTxt, ";");
00331 strcat(m_cLogTxt, ";");
00332 }
00333
00334 }
00335 else
00336 {
00337 strcat(m_cLogTxt, ";");
00338 strcat(m_cLogTxt, ";");
00339 }
00340
00341
00342 if(bDB)
00343 {
00344 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_DBN, &uiDBN);
00345 if(uiDBN > 0)
00346 {
00347 sprintf(str, " - DB-N..0x%04X", uiDBN);
00348
00349 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_BLOCK_SIZE, &ucDBSize);
00350 sprintf(str, " - DB-SIZE..0x%02X", ucDBSize);
00351
00352 sprintf(str, "%s", " - DB..");
00353 strcat(m_cLineTxt, str);
00354 strcat(m_cLogTxt, str);
00355
00356
00357 for(int iCnt=0; iCnt<(int)uiDBN; iCnt++)
00358 {
00359 memset(sTmp, 0, sizeof(sTmp));
00360 memset(ucReadBlock, 0, sizeof(ucReadBlock));
00361 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_RxDB, iCnt, ucReadBlock, ucDBSize);
00362 for (int pos=0; pos<(int)ucDBSize; pos++)
00363 {
00364 sprintf(sTmp, "%02X", ucReadBlock[pos]);
00365 strcat(m_cLineTxt, sTmp);
00366 strcat(m_cLineTxt, " ");
00367 }
00368 }
00369
00370 strcat(m_cLogTxt, ";");
00371 }
00372 else
00373 {
00374 strcat(m_cLogTxt, ";");
00375 }
00376
00377 }
00378 else
00379 {
00380 strcat(m_cLogTxt, ";");
00381 }
00382
00383
00384 if(bDate)
00385 {
00386 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_DATE, ucDate, 5);
00387
00388 sprintf(str, " - DATE..%02d/%02d/%02d%02d", ucDate[2], ucDate[3], ucDate[0], ucDate[1]);
00389 strcat(m_cLineTxt, str);
00390 strcat(m_cLogTxt, str);
00391 strcat(m_cLogTxt, ";");
00392 }
00393
00394
00395 if(bTime)
00396 {
00397 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_TIMER, ucTimer, 4);
00398 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_TIMER, &uiTmp);
00399
00400 unsigned int uiHours = ucTimer[0];
00401 unsigned int uiMinutes = ucTimer[1];
00402 unsigned int uiMilliSecs = (ucTimer[2]<<8) + ucTimer[3];
00403 unsigned int uiSeconds = uiMilliSecs / 1000;
00404 uiMilliSecs = uiMilliSecs % 1000;
00405
00406 sprintf(str, " - TIME..%02d:%02d:%02d.%03d (%08X)", uiHours, uiMinutes, uiSeconds, uiMilliSecs, uiTmp);
00407 strcat(m_cLineTxt, str);
00408 strcat(m_cLogTxt, str);
00409 strcat(m_cLogTxt, ";");
00410 }
00411
00412
00413 if(bAnt && ((bSNR && ucSnrLen>0) || (bDB && uiDBN>0)))
00414 {
00415 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_ANT_NR, &ucAntNr);
00416
00417 sprintf(str, " - ANT..0x%02X", ucAntNr);
00418 strcat(m_cLineTxt, str);
00419 strcat(m_cLogTxt, str);
00420 strcat(m_cLogTxt, ";");
00421 }
00422 else
00423 {
00424 strcat(m_cLogTxt, ";");
00425 }
00426
00427
00428 if(bExt && bIn)
00429 {
00430 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_INPUT, &ucInput);
00431
00432 sprintf(str, " - INPUT..0x%02X", ucInput);
00433 strcat(m_cLineTxt, str);
00434 strcat(m_cLogTxt, str);
00435 strcat(m_cLogTxt, ";");
00436
00437 m_iscReader->GetTableData(iIdx, FEDM_ISC_BRM_TABLE, FEDM_ISC_DATA_STATE, &ucState);
00438
00439 sprintf(str, " - STATE..0x%02X", ucState);
00440 strcat(m_cLineTxt, str);
00441 strcat(m_cLogTxt, str);
00442 strcat(m_cLogTxt, ";");
00443 }
00444
00445 QString outStr;
00446 outStr = m_cLineTxt;
00447 outStr += "\n";
00448 ui.receiveWindowTextEdit->append(outStr);
00449
00450
00451 if(ui.fileCheckBox->isChecked())
00452 {
00453 strcat(m_cLogTxt, "\r\n");
00454 writeLogFile();
00455 }
00456
00457 }
00458
00459 }
00460
00461
00462
00463
00464
00465 void NotifySampleDlg::writeLogFile()
00466 {
00467 ofstream file;
00468
00469 if(strlen(m_cFileName) == 0)
00470 return;
00471
00472 file.open(m_cFileName, ios::app);
00473 if (file.is_open())
00474 {
00475 file.seekp(0, ios::end);
00476 file << m_cLogTxt;
00477 file.close();
00478 }
00479 }
00480
00481
00482
00483
00484
00485 void NotifySampleDlg::displayError(int error)
00486 {
00487 char sErrorText[256] = {0};
00488
00489 m_iscReader->GetErrorText(sErrorText, error);
00490 ui.statusLineEdit->setText(sErrorText);
00491 }
00492
00493
00494
00495
00496
00497 NotifySampleDlg::NotifySampleDlg()
00498 {
00499 ui.setupUi(this);
00500
00501 memset(m_cFileName, 0, sizeof(m_cFileName));
00502 memset(m_cLogTxt, 0, sizeof(m_cLogTxt));
00503 strcpy(m_cFileName, "log.txt");
00504
00505 m_bRunning = false;
00506 m_iLineCnt = 0;
00507
00508 m_iscReader = new FEDM_ISCReaderModule;
00509
00510 int iBack = m_iscReader->SetTableSize(FEDM_ISC_BRM_TABLE, 512);
00511 if(iBack < 0)
00512 {
00513 delete m_iscReader;
00514 printf("FEDM_ISCReaderModule::SetTableSize() failed. Error code = %d\n", iBack);
00515 return;
00516 }
00517
00518 connect(ui.clearRecWndPushButton, SIGNAL(clicked()), ui.receiveWindowTextEdit, SLOT(clear()));
00519 connect(ui.clearProtPushButton, SIGNAL(clicked()), ui.protocolTextEdit, SLOT(clear()));
00520 connect(ui.listenPushButton, SIGNAL(clicked()), this, SLOT(listenButtonClicked()));
00521 connect(ui.fileCheckBox, SIGNAL(clicked()), this, SLOT(writeToFileClicked()));
00522
00523
00524
00525 setGetClassInstance(this);
00526
00527 connect(this, SIGNAL(onProtocolEvent(int,int)), this, SLOT(displayProtocol(int,int)));
00528
00529
00530 int iReaderHnd = m_iscReader->GetReaderHnd();
00531 FEISC_EVENT_INIT taskInit;
00532 taskInit.cbFct = &protCallBackHelper;
00533 taskInit.uiUse = FEISC_PRT_EVENT;
00534 taskInit.uiFlag = FEISC_CALLBACK;
00535 iBack = FEISC_AddEventHandler(iReaderHnd,&taskInit);
00536 if(iBack < 0)
00537 {
00538 displayError(iBack);
00539 }
00540
00541 }
00542
00543
00544
00545
00546
00547 void NotifySampleDlg::writeToFileClicked()
00548 {
00549 if(ui.fileCheckBox->isChecked())
00550 {
00551 FEISC_SetReaderPara(m_iscReader->GetReaderHnd(), "LogProt", "1");
00552 }
00553 else
00554 {
00555 FEISC_SetReaderPara(m_iscReader->GetReaderHnd(), "LogProt", "0");
00556 }
00557 }
00558
00559
00560
00561
00562
00563 NotifySampleDlg::~NotifySampleDlg()
00564 {
00565
00566 if (m_iscReader != NULL)
00567 {
00568 int iReaderHnd = m_iscReader->GetReaderHnd();
00569 if (iReaderHnd > 0)
00570 {
00571 FEISC_EVENT_INIT taskInit;
00572 taskInit.cbFct = &protCallBackHelper;
00573 taskInit.uiUse = FEISC_PRT_EVENT;
00574 taskInit.uiFlag = FEISC_CALLBACK;
00575 FEISC_DelEventHandler (iReaderHnd,&taskInit);
00576 }
00577 if (m_bRunning)
00578 m_iscReader->CancelAsyncTask();
00579 delete m_iscReader;
00580 m_iscReader = NULL;
00581 }
00582 }
00583
00584
00585
00586
00587
00588 void NotifySampleDlg::startTask()
00589 {
00590 ui.statusLineEdit->setText("");
00591
00592 if(!m_iscReader)
00593 {
00594 QMessageBox::critical(this, tr("GetReaderHnd() error "), "No reader module", QMessageBox::Abort);
00595 return;
00596 }
00597 else
00598 {
00599 int iBack = 0;
00600
00601
00602 char *sPort = qstrdup(ui.portLineEdit->text().toLatin1());
00603 int iPort;
00604 sscanf(sPort, "%d", &iPort);
00605 FEDM_TASK_INIT event;
00606 event.iConnectByHost = 0;
00607 event.pAny = this;
00608 event.uiFlag = FEDM_TASKCB1;
00609 event.uiUse = FEDM_TASKID_NOTIFICATION;
00610 memset(event.cIPAdr, 0, 16);
00611 event.iPortNr = iPort;
00612 event.cbFct1 = &cbsFct1;
00613 event.iNotifyWithAck = ui.withAckCheckBox->isChecked();
00614 event.uiTimeout = 30;
00615 delete [] sPort;
00616
00617 connect(this, SIGNAL(onDataEvent(void*,int,unsigned char)),
00618 this, SLOT(displayData(void*,int,unsigned char)));
00619
00620 iBack = m_iscReader->StartAsyncTask(&event);
00621 if(iBack < 0)
00622 {
00623 displayError(iBack);
00624 return;
00625 }
00626
00627 }
00628 }
00629
00630
00631
00632
00633
00634
00635 NotifySampleDlg* NotifySampleDlg::setGetClassInstance(NotifySampleDlg* classInstance)
00636 {
00637 static NotifySampleDlg* statInstance = NULL;
00638
00639 if (classInstance != NULL)
00640 {
00641 statInstance = classInstance;
00642 return NULL;
00643 }
00644 else
00645 {
00646 return statInstance;
00647 }
00648 }
00649
00650
00651
00652
00653
00654
00655
00656
00657 void NotifySampleDlg::protCallBackHelper(int iMsg,int iLen)
00658 {
00659 NotifySampleDlg* classInstance = setGetClassInstance(NULL);
00660
00661 emit(classInstance->onProtocolEvent(iMsg, iLen));
00662 }
00663
00664
00665
00666
00667
00668
00669 void NotifySampleDlg::displayProtocol(int iMsg,int iLen)
00670 {
00671 if ((char*)iMsg == NULL)
00672 return;
00673
00674 int len = strlen((char*)iMsg);
00675 if (len > 0)
00676 {
00677 QString outStr;
00678 outStr = (char*)iMsg;
00679 outStr += "\n";
00680 ui.protocolTextEdit->append(outStr);
00681 }
00682 }
00683
00684
00685
00686
00687
00688 void NotifySampleDlg::cbsFct1(void* pAny, int iError, unsigned char ucCmd)
00689 {
00690 NotifySampleDlg* classInstance = (NotifySampleDlg*)pAny;
00691
00692 emit(classInstance->onDataEvent(pAny, iError, ucCmd));
00693 }
00694
00695
00696
00697
00698
00699 void NotifySampleDlg::listenButtonClicked()
00700 {
00701
00702 if (m_bRunning)
00703 {
00704 ui.listenPushButton->setText("&Listen");
00705 m_bRunning = false;
00706 m_iscReader->CancelAsyncTask();
00707 }
00708 else
00709 {
00710
00711 ui.listenPushButton->setText("&Stop");
00712 m_bRunning = true;
00713 startTask();
00714
00715 }
00716 }
00717
00718 char* NotifySampleDlg::getISOMfrCode(unsigned char ucMfr)
00719 {
00720 switch(ucMfr)
00721 {
00722 case 0x01:
00723 return FEISC_ISO_MOTOROLA;
00724 case 0x02:
00725 return FEISC_ISO_STM;
00726 case 0x03:
00727 return FEISC_ISO_HITACHI;
00728 case 0x04:
00729 return FEISC_ISO_PHILIPS;
00730 case 0x05:
00731 return FEISC_ISO_INFINEON;
00732 case 0x06:
00733 return FEISC_ISO_CYLINC;
00734 case 0x07:
00735 return FEISC_ISO_TI;
00736 case 0x08:
00737 return FEISC_ISO_FUJITSU;
00738 case 0x09:
00739 return FEISC_ISO_MATSUSHITA;
00740 case 0x0A:
00741 return FEISC_ISO_NEC;
00742 case 0x0B:
00743 return FEISC_ISO_OKI;
00744 case 0x0C:
00745 return FEISC_ISO_TOSHIBA;
00746 case 0x0D:
00747 return FEISC_ISO_MITSUBISHI;
00748 case 0x0E:
00749 return FEISC_ISO_SAMSUNG;
00750 case 0x0F:
00751 return FEISC_ISO_HYUNDAI;
00752 case 0x10:
00753 return FEISC_ISO_LG;
00754 case 0x11:
00755 return FEISC_ISO_EMOSYN;
00756 case 0x12:
00757 return FEISC_ISO_INSIDE;
00758 case 0x13:
00759 return FEISC_ISO_ORGA;
00760 case 0x14:
00761 return FEISC_ISO_SHARP;
00762 case 0x15:
00763 return FEISC_ISO_ATMEL;
00764 case 0x16:
00765 return FEISC_ISO_EM;
00766 case 0x17:
00767 return FEISC_ISO_KSW;
00768 case 0x19:
00769 return FEISC_ISO_XICOR;
00770 }
00771
00772 return "unknown manufacturer";
00773 }