FEDM_ISCReader.cpp
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                 FEDM_ISCReader.cpp                    |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright © 2000-2014   FEIG ELECTRONIC GmbH, All Rights Reserved.
00008                                                 Lange Strasse 4
00009                                                 D-35781 Weilburg
00010                                                 Federal Republic of Germany
00011                                                 phone    : +49 6471 31090
00012                                                 fax      : +49 6471 310999
00013                                                 e-mail   : obid-support@feig.de
00014                                                 Internet : http://www.feig.de
00015                                         
00016 Author                  :       Markus Hultsch
00017 Begin                   :       07.06.2000
00018         
00019 Version                 :       04.06.10 / 02.12.2014 / M. Hultsch
00020                                                 - new [0xB4] NXP Custom Commands: 0x10, 0x11, 0x12
00021                                                 - new [0xB4] EM Custom Commands: 0x00, 0x01, 0x02, 0x04, 0xD1
00022 
00023                                                 04.06.09 / 30.10.2014 / M. Hultsch
00024                                                 - support for new baudrates: 921600 and 460800
00025   
00026                                                 04.06.08 / 13.10.2014 / M. Hultsch
00027                                                 - [0x66] Reader Info: additional LAN link information with mode=0x50
00028 
00029                                                 04.06.06 / 23.09.2013 / M. Hultsch
00030                                                 - only for EPC Class1 Gen2:
00031                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
00032 
00033                                                 04.06.04 / 20.08.2014 / M. Hultsch
00034                                                 - bugfix in SendProtocol: [0xB0] with received status 0x02 (data false) returns now at once for all sub-commands, except [0x01] Inventory
00035 
00036                                                 04.06.03 / 26.06.2014 / M. Hultsch
00037                                                 - [0x2C] Get Multiple Block Security Status with extended addressed mode: bugfix for received data above address 255
00038                                                 - new reader: ID MAX.U1002
00039 
00040                                                 04.06.01 / 07.03.2014 / M. Hultsch
00041                                                 - support for [0x22] Lock Multiple Blocks with extended addressed mode
00042                                                 - support for [0x2C] Get Multiple Block Security Status with extended addressed mode
00043                                                 - [0x6E] Reader Diagnostic: support for new mode 0x07
00044 
00045                                                 04.05.05 / 29.11.2013 / M. Hultsch
00046                                                 - exception for ISO 14443 Transponder after FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true), when Reader is configuered with Anticollision = off
00047                                                 - new reader: ID CPR.POS and ID ISC.PRH200
00048                                                 - [0x66] Reader Info: new mode 0x09 for WLAN-Firmware
00049                                                 
00050                                                 04.05.04 / 03.09.2013 / M. Hultsch
00051                                                 - new reader: ID ISC.LRU1002
00052 
00053                                                 04.05.03 / 30.08.2013 / M. Hultsch
00054                                                 - new reader: OBID myAXXESS onTop
00055                                                 - bugfix for LRU3x00: max number of CFG-pages increased from 86 to 88
00056 
00057                                                 04.04.03 / 05.03.2013 / M. Hultsch
00058                                                 - bugfix for EPC with 8-Byte length
00059                                                 - new method: GetDependentLibVersions
00060 
00061                                                 
00062                                                 04.04.02 / 18.01.2013 / M. Hultsch
00063                                                 - support for new reader ID CPR47
00064                                                 - SendProtocol: [0xB0] with status 0x84 (RF-Warning) takes returned records
00065 
00066                                                 04.03.01 / 05.11.2012 / M. Hultsch
00067                                                 - new methods: SetCommandPara/GetCommandPara
00068                                                 - support for Recommissioning Bits in [0xB3][0x18] Kill
00069                                                 - Reader Diagnostic: support for new mode 0x21
00070 
00071                                                 04.02.06 / 03.08.2012 / M. Hultsch
00072                                                 - FinBaudRate returns crypto processing error
00073 
00074                                                 04.02.06 / 03.08.2012 / M. Hultsch
00075                                                 - new reader: ID CPR46
00076                                                 - [0x66] Read Reader Info: new mode 0x08 (with firmware supported tag drivers)
00077 
00078                                                 04.02.05 / 05.07.2012 / M. Hultsch
00079                                                 - new reader: ID CPR20
00080 
00081                                                 04.02.04 / 19.06.2012 / M. Hultsch
00082                                                 - BRM: support for direction information (in combination with Gate People Counter)
00083                                                 - UHF Class1 Gen2: support for [0xB3][0x25] Block Permalock and [0xB3][0x26] Read Permalock Status
00084 
00085                                                 04.02.01 / 31.05.2012 / M. Hultsch
00086                                                 - support for new tag types: Innovatron and ASK CTx
00087 
00088                                                 04.00.10 / 10.02.2012 / M. Hultsch
00089                                                 - support for external logmanager (FELOGMNG.dll), when #define _FELOGMNG_SUPPORT is set
00090 
00091                                                 04.00.09 / 23.01.2012 / M. Hultsch
00092                                                 - new reader: ID ISC.LR1002
00093 
00094                                                 04.00.06 / 01.12.2011 / M. Hultsch
00095                                                 - new nPA reader: OBID myAXXESS standard, OBID myAXXESS comfort
00096                                                 - workaround for LRU3000 for get/set selection mask
00097                                         
00098                                                 04.00.02 / 09.08.2011 / M. Hultsch
00099                                                 - new method for setting OEM Reader names
00100 
00101                                                 04.00.01 / 04.08.2011 / M. Hultsch
00102                                                 - bugfix for LR2500-A/B and LRU3000 concerning m_iUsedEEDataBlocks, m_iUsedRAMDataBlocks
00103 
00104                                                 04.00.00 / 29.07.2011 / M. Hultsch
00105                                                 - max. UID length increased to 96 Bytes
00106                                                 - LRU3000: ACC configuration moved to device RFC
00107                                                 - only for EPC Class1 Gen2:
00108                                                   if Reader is configured for UID = EPC + TID, set TID as UID for next Host-Mode request in addressed mode
00109                                                 - support for [0x74] Input Event from CPR50
00110 
00111                                                 03.03.03 / 09.05.2011 / M. Hultsch
00112                                                 - parameter m_ucReaderType moved from unsigned char to unsigned int
00113 
00114                                                 03.03.01 / 19.04.2011 / B. Tschunko
00115                                                 - FindBaudRate() alternating (iFrameSupport = 3), beginning with standard protocol frame 
00116 
00117                                                 03.03.01 / 31.03.2011 / M. Hultsch
00118                                                 - new TagHandler classes for ISO 15693 IDS SL13A
00119                                                   and EPC Class1 Gen2 IDS SL900A
00120                                                 - FindBaudRate() with modified default parameter (iFrameSupport = 3)
00121 
00122                                                 03.03.00 / 21.02.2011 / M. Hultsch
00123                                                 - ID ISC.LR2500-A added
00124 
00125                                                 03.02.09 / 21.11.2010 / M. Hultsch
00126                                                 - GetTableData extended for MAC Address
00127 
00128                                                 03.02.07 / 29.10.2010 / M. Hultsch
00129                                                 - Updated [0x66] Reader Info
00130                                                 - Support for [0xC3] DESFire commands
00131 
00132                                                 03.02.05 / 18.10.2010 / M. Sahm
00133                                                 - Get_0xC3_IsoTableData(): Command 0xFA (Authent): No ApplicationID used anymore
00134                                                 
00135                                                 03.02.05 / 08.09.2010 / M. Hultsch
00136                                                 - support for [0xC3] DESFire Command
00137 
00138                                                 03.01.05 / 23.04.2010 / M. Hultsch
00139                                                 - new UHF custom commands for NXP
00140                                                 - ID ISC.MR102 and ID ISC.LR2500-B added
00141 
00142                                                 03.01.03 / 25.03.2010 / M. Hultsch
00143                                                 - modifications for peripheral devices
00144 
00145                                                 03.01.02 / 18.03.2010 / M. Hultsch
00146                                                 - handling of new USB enumeration after [0x64] System Reset
00147 
00148                                                 03.01.01 / 25.02.2010 / M. Hultsch
00149                                                 - support for peripheral devices
00150                                                 - Reader Info addings
00151 
00152                                                 03.01.00 / 05.02.2010 / M. Hultsch
00153                                                 - Reader Info addings
00154                                                 - new FU-Type: ID ISC.ANT.GPC
00155                                                 - full support for CPR50.XX
00156 
00157                                                 03.00.18 / 15.12.2009 / M. Hultsch
00158                                                 - ID MLC.COM and ID MLC.EMPS added
00159 
00160                                                 03.00.17 / 24.11.2009 / M. Hultsch
00161                                                 03.00.16 / 20.11.2009 / M. Hultsch
00162                                                 03.00.15 / 17.11.2009 / M. Hultsch                              
00163                                                 03.00.14 / 29.10.2009 / M. Hultsch
00164                                                 - ID MAX50.xx added
00165                                                 - [0xBx] Host Commands in non-addressed mode from table index > 0
00166                                                 - ISO 15693 Cust & Prop Commands
00167 
00168 Operation Systems       :       independent
00169 
00170 Function                        :       classes for OBID i-scan® and OBID® classic-pro reader family
00171 
00172 Trademarks:
00173 -----------
00174 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00175 Other Trademarks: see FEDM.h
00176 */
00177 
00178 #include <time.h>
00179 #include <stdio.h>
00180 #include <math.h>
00181 #include "FEDM_ISCReader.h"
00182 #include "FEDM_BRMTabItem.h"
00183 #include "FEDM_ISOTabItem.h"
00184 #include "FEDM_ISCReaderID.h"
00185 #if !defined(_FEDM_NO_PD_SUPPORT)
00186         #include "./peripheral_devices/FedmIscPeripheralDevice.h"
00187         #include "./peripheral_devices/FedmIscPeopleCounter.h"
00188         #include "./peripheral_devices/FedmIscExternalIO.h"
00189 #endif
00190 #include "../FEDM_Functions.h"
00191 #include "../FEDM_XmlReaderCfgDataModul.h"
00192 #include "../FEDM_XmlReaderCfgProfileModul.h"
00193 #include "feisc.h"
00194 #ifdef _FEDM_FU_SUPPORT
00195         #include "fefu.h"
00196 #endif
00197 #ifdef _FEDM_TAG_HANDLER
00198   #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00199         #include "fetcl.h"
00200   #endif
00201 #endif
00202 
00203 #if defined(_FEDM_ISC_CORE_DLL) || defined(_OBIDISC4J_DLL) || defined(_OBIDISC4NETnativePI_DLL)
00204         #include "feswversions.h"
00205 #endif
00206 
00207 #if _MSC_VER >= 1400
00208         #pragma warning(disable : 4996)
00209 #endif
00210 
00211 #ifdef _FEDM_LINUX
00212         #include <stdlib.h>
00213 #endif
00214 
00215 
00216 //####################################################################
00217 // class FEDM_CADTable
00218 //####################################################################
00219 
00220 #if !defined(__BORLANDC__)
00221 FEDM_CADTable::FEDM_CADTable()
00222 {
00223         Init();
00224 }
00225 
00226 FEDM_CADTable::~FEDM_CADTable()
00227 {
00228         FEDM_CAD_HISTORY_ARRAY_ITOR Itor;
00229 
00230         for(Itor = m_History.begin(); Itor != m_History.end(); Itor++)
00231         {
00232                 if((*Itor) != NULL)
00233                         delete (*Itor);
00234         }
00235 
00236         m_History.clear();
00237 }
00238 
00239 void FEDM_CADTable::Init()
00240 {
00241         FEDM_CAD_HISTORY_ARRAY_ITOR Itor;
00242 
00243         for(Itor = m_History.begin(); Itor != m_History.end(); Itor++)
00244         {
00245                 if((*Itor) != NULL)
00246                         delete (*Itor);
00247         }
00248 
00249         m_History.clear();
00250         memset(m_ucPowerAvg,    0, 15);
00251         memset(m_ucPowerPeak,   0, 15);
00252         memset(m_nData,                 0, 4*sizeof(long));
00253 
00254         m_ucMode                        = 0;
00255         m_bValid                        = false;
00256 }
00257 #endif
00258 
00259 
00260 
00261 //####################################################################
00262 // class FEDM_ISCReader
00263 //####################################################################
00264 
00266 // Construction/Destruction     
00268 
00269 FEDM_ISCReader::FEDM_ISCReader()
00270 {
00271         int i;
00272 
00273         m_bDisableReadCfgBeforeWriteCfg = false;
00274 
00275         m_bEnableTagHandler                     = false;        // must be enabled manually
00276 #ifdef _FEDM_TAG_HANDLER
00277         m_bTagHandlerOption_CreateCondition_Smart = false;
00278 #endif
00279 
00280         m_bSelectWithCinf                       = false;        // is set after detecting reader type
00281         m_bDisableSelectWithCinf        = false;        // is a general setting
00282 
00283         m_uiBRMTableLength      = 0;
00284         m_uiISOTableLength      = 0;
00285         m_uiNonAddressedTabIndex = 0;
00286 
00287         memset( m_ucData, 0, FEDM_MAX_PROTOCOL_SIZE+1);
00288         memset( m_nData,  0,  516*sizeof(long));
00289 
00290         m_ReaderInfo.Init();
00291         m_ReaderDiagnostic.Init();
00292 
00293         m_iUsedEEDataBlocks             = 64;   // do not change this setting !!!
00294         m_iUsedRAMDataBlocks    = 64;   // do not change this setting !!!
00295         m_iUsedAccEEDataBlocks  = 128;  // do not change this setting !!!
00296         m_iUsedAccRAMDataBlocks = 128;  // do not change this setting !!!
00297         m_iUsedTmpDataBlocks    = 128;  // do not change this setting !!!
00298         m_iUsedMjpDataBlocks    = 0;    // do not change this setting !!!
00299         m_iUsedSNMemBlocks              = 0;    // do not change this setting !!!
00300         m_iUsedIDMemBlocks              = 0;    // do not change this setting !!!
00301         m_iUsedACMemBlocks              = 0;    // do not change this setting !!!
00302         m_iUsedPubMemBlocks             = 0;    // do not change this setting !!!
00303         m_iUsedSecMemBlocks             = 0;    // do not change this setting !!!
00304         m_iUsedConfMemBlocks    = 0;    // do not change this setting !!!
00305         m_iUsedDateMemBlocks    = 0;    // do not change this setting !!!
00306 
00307         // identifies this object as an OBID i-scan and OBID classic-pro object
00308         strcpy(m_sFamCode, FEDM_STR_ISC_FAMILY);
00309 
00310         // memory for reader
00311         m_RFC_EEData.reserve(FEDM_ISC_MAX_RFC_EEDATA_MEM);              // parameter in EEPROM
00312         m_RFC_EEData.resize(FEDM_ISC_MAX_RFC_EEDATA_MEM);               // parameter in EEPROM
00313         m_RFC_RAMData.reserve(FEDM_ISC_MAX_RFC_RAMDATA_MEM);    // parameter in EEPROM
00314         m_RFC_RAMData.resize(FEDM_ISC_MAX_RFC_RAMDATA_MEM);             // parameter in EEPROM
00315 
00316         m_ACC_EEData.reserve(FEDM_ISC_MAX_ACC_EEDATA_MEM);              // parameter in EEPROM
00317         m_ACC_EEData.resize(FEDM_ISC_MAX_ACC_EEDATA_MEM);               // parameter in EEPROM
00318         m_ACC_RAMData.reserve(FEDM_ISC_MAX_ACC_RAMDATA_MEM);    // parameter in RAM
00319         m_ACC_RAMData.resize(FEDM_ISC_MAX_ACC_RAMDATA_MEM);             // parameter in RAM
00320 
00321         // memory for temporary data
00322         m_TmpData.reserve(FEDM_ISC_MAX_TMPDATA_MEM);
00323         m_TmpData.resize(FEDM_ISC_MAX_TMPDATA_MEM);
00324 
00325         // memories for profile masks
00326         m_RFC_CfgProfileMask.reserve(FEDM_ISC_MAX_RFC_EEDATA_MEM);
00327         m_RFC_CfgProfileMask.resize(FEDM_ISC_MAX_RFC_EEDATA_MEM);
00328         m_ACC_CfgProfileMask.reserve(FEDM_ISC_MAX_ACC_EEDATA_MEM);
00329         m_ACC_CfgProfileMask.resize(FEDM_ISC_MAX_ACC_EEDATA_MEM);
00330 
00331         // initialize memories with 0x00
00332         for( i=0; i<FEDM_ISC_MAX_RFC_EEDATA_MEM; i++ )          { m_RFC_EEData[i]                       = 0x00; }
00333         for( i=0; i<FEDM_ISC_MAX_RFC_RAMDATA_MEM; i++ )         { m_RFC_RAMData[i]                      = 0x00; }
00334         
00335         for( i=0; i<FEDM_ISC_MAX_ACC_EEDATA_MEM; i++ )          { m_ACC_EEData[i]                       = 0x00; }
00336         for( i=0; i<FEDM_ISC_MAX_ACC_RAMDATA_MEM; i++ )         { m_ACC_RAMData[i]                      = 0x00; }
00337 
00338         for( i=0; i<FEDM_ISC_MAX_TMPDATA_MEM; i++ )                     { m_TmpData[i]                          = 0x00; }
00339 
00340         for( i=0; i<FEDM_ISC_MAX_RFC_EEDATA_MEM; i++ )          { m_RFC_CfgProfileMask[i]       = 0x00; }
00341         for( i=0; i<FEDM_ISC_MAX_ACC_EEDATA_MEM; i++ )          { m_ACC_CfgProfileMask[i]       = 0x00; }
00342 }
00343 
00344 FEDM_ISCReader::~FEDM_ISCReader()
00345 {
00346         unsigned int i;
00347 #if !defined(_FEDM_NO_PD_SUPPORT)
00348         FEDM_PD_MAP_ITOR itor;
00349 #endif
00350 
00351         // clean up
00352         m_RFC_EEData.clear();
00353         m_RFC_RAMData.clear();
00354         m_ACC_EEData.clear();
00355         m_ACC_RAMData.clear();
00356         m_TmpData.clear();
00357         m_RFC_CfgProfileMask.clear();
00358         m_ACC_CfgProfileMask.clear();
00359 
00360         for( i=0; i<m_BRMTable.size(); i++ )
00361                 delete m_BRMTable[i];
00362 
00363         for( i=0; i<m_ISOTable.size(); i++ )
00364                 delete m_ISOTable[i];
00365 
00366         m_BRMTable.clear();
00367         m_ISOTable.clear();
00368 
00369 #if !defined(_FEDM_NO_PD_SUPPORT)
00370         for(itor  = m_mapPeripheralDevices.begin();
00371                 itor != m_mapPeripheralDevices.end();
00372                 itor++ )
00373         {
00374                 if(itor->second != NULL)
00375                         delete itor->second;
00376         }
00377 #endif
00378 }
00379 
00380 
00381 
00382 /***************************************************************************
00383   Begin         :       23.04.2008 / M. Hultsch
00384   Version       :       03.00.11 / 06.08.2009 / M. Hultsch
00385 
00386   Function              :       check version numbers of dependent libraries
00387                                         FECOM, FETCP, FEUSB, FEISC, FEFU, FETCL
00388 
00389   Parameters    :       string& sMessage        - reference to STL-string
00390                                         
00391   Return value  :       FEDM_OK or error code
00392 
00393 ***************************************************************************/
00394 int FEDM_ISCReader::EvalLibDependencies(string& sMessage)
00395 {
00396         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL, __FUNCTION__);
00397 
00398 #if !defined(_FEDM_ISC_CORE_DLL) && !defined(_OBIDISC4J_DLL) && !defined(_OBIDISC4NETnativePI_DLL)
00399         int iBack = FEDM_ERROR_UNSUPPORTED;
00400         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
00401 #else
00402         int iBack = FEDM_OK;
00403         unsigned int uiTmp[3];
00404         unsigned int uiVersionLib = 0;
00405         unsigned int uiVersionMin = 0;
00406         char cVersion[256];
00407         char cTmp[256];
00408         
00409         // check FEISC
00410         memset(uiTmp, 0, 3);
00411         uiVersionLib = 0;
00412         uiVersionMin = 0;
00413         FEISC_GetDLLVersion(cVersion);
00414         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00415         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00416 #ifdef _FEDM_WINDOWS
00417         #ifdef _WIN32_WCE
00418         sscanf(FEISC_CE_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00419         #else
00420         sscanf(FEISC_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00421         #endif
00422 #endif
00423 #ifdef _FEDM_LINUX
00424         sscanf(FEISC_TUX_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00425 #endif
00426         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00427         if(uiVersionLib < uiVersionMin)
00428         {
00429 #ifdef _FEDM_WINDOWS
00430         #ifdef _WIN32_WCE
00431                 sprintf(cTmp, "FEISC: V%s detected, but at least V%s expected", cVersion, FEISC_CE_DLL_VERSION);
00432         #else
00433                 sprintf(cTmp, "FEISC: V%s detected, but at least V%s expected", cVersion, FEISC_DLL_VERSION);
00434         #endif
00435 #endif
00436 #ifdef _FEDM_LINUX
00437                 sprintf(cTmp, "FEISC: V%s detected, but at least V%s expected", cVersion, FEISC_TUX_DLL_VERSION);
00438 #endif
00439                 sMessage = cTmp;
00440                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00441         }
00442         
00443 #ifdef _FEDM_FU_SUPPORT
00444         // check FEFU
00445         memset(uiTmp, 0, 3);
00446         uiVersionLib = 0;
00447         uiVersionMin = 0;
00448         FEFU_GetDLLVersion(cVersion);
00449         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00450         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00451         sscanf(FEFU_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00452         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00453         if(uiVersionLib < uiVersionMin)
00454         {
00455                 sprintf(cTmp, "FEFU: V%s detected, but at least V%s expected", cVersion, FEFU_DLL_VERSION);
00456                 if(sMessage.length() > 0)
00457                         sMessage += "\n";
00458 
00459                 sMessage += cTmp;
00460                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00461         }
00462 #endif
00463         
00464 #ifdef _FEDM_TAG_HANDLER
00465   #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00466         // check FETCL
00467         memset(uiTmp, 0, 3);
00468         uiVersionLib = 0;
00469         uiVersionMin = 0;
00470         FETCL_GetDLLVersion(cVersion);
00471         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00472         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00473         sscanf(FETCL_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00474         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00475         if(uiVersionLib < uiVersionMin)
00476         {
00477                 sprintf(cTmp, "FETCL: V%s detected, but at least V%s expected", cVersion, FETCL_DLL_VERSION);
00478                 if(sMessage.length() > 0)
00479                         sMessage += "\n";
00480 
00481                 sMessage += cTmp;
00482                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00483         }
00484   #endif
00485 #endif
00486         
00487 #ifdef _FEDM_COM_SUPPORT
00488         // check FECOM
00489         memset(uiTmp, 0, 3);
00490         uiVersionLib = 0;
00491         uiVersionMin = 0;
00492 #if defined(_FEDM_SUPPORT_SLINK)
00493         FECOM_GetDLLVersion(cVersion);
00494 #else
00495         LPFN_FECOM_GET_DLL_VERSION lpfnFecom = (LPFN_FECOM_GET_DLL_VERSION)GetFeComFunction(FECOM_GET_DLL_VERSION);
00496         if(lpfnFecom == NULL)
00497         {
00498 #ifdef _FEDM_WINDOWS
00499                 sprintf(cTmp, "FECOM.DLL is missing");
00500                 if(sMessage.length() > 0)
00501                         sMessage += "\n";
00502 
00503                 sMessage += cTmp;
00504 #endif
00505 #ifdef _FEDM_LINUX
00506                 sprintf(cTmp, "libfecom.so is missing");
00507                 if(sMessage.length() > 0)
00508                         sMessage += "\n";
00509 
00510                 sMessage += cTmp;
00511 #endif
00512                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00513                 FEDM_RETURN(FEDM_ERROR_NULL_POINTER);
00514         }
00515         lpfnFecom(cVersion);
00516 #endif
00517         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00518         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00519 #ifdef _FEDM_WINDOWS
00520         #ifdef _WIN32_WCE
00521         sscanf(FECOM_CE_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00522         #else
00523         sscanf(FECOM_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00524         #endif
00525 #endif
00526 #ifdef _FEDM_LINUX
00527         sscanf(FECOM_TUX_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00528 #endif
00529         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00530         if(uiVersionLib < uiVersionMin)
00531         {
00532 #ifdef _FEDM_WINDOWS
00533         #ifdef _WIN32_WCE
00534                 sprintf(cTmp, "FECOM: V%s detected, but at least V%s expected", cVersion, FECOM_CE_DLL_VERSION);
00535         #else
00536                 sprintf(cTmp, "FECOM: V%s detected, but at least V%s expected", cVersion, FECOM_DLL_VERSION);
00537         #endif
00538 #endif
00539 #ifdef _FEDM_LINUX
00540                 sprintf(cTmp, "FECOM: V%s detected, but at least V%s expected", cVersion, FECOM_TUX_DLL_VERSION);
00541 #endif
00542                 if(sMessage.length() > 0)
00543                         sMessage += "\n";
00544 
00545                 sMessage += cTmp;
00546                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00547         }
00548 #endif
00549 
00550 #ifdef _FEDM_USB_SUPPORT
00551         // check FEUSB
00552         memset(uiTmp, 0, 3);
00553         uiVersionLib = 0;
00554         uiVersionMin = 0;
00555 #if defined(_FEDM_SUPPORT_SLINK)
00556         FEUSB_GetDLLVersion(cVersion);
00557 #else
00558         LPFN_FEUSB_GET_DLL_VERSION lpfnFeusb = (LPFN_FEUSB_GET_DLL_VERSION)GetFeUsbFunction(FEUSB_GET_DLL_VERSION);
00559         if(lpfnFeusb == NULL)
00560         {
00561 #ifdef _FEDM_WINDOWS
00562                 sprintf(cTmp, "FEUSB.DLL is missing");
00563                 if(sMessage.length() > 0)
00564                         sMessage += "\n";
00565 
00566                 sMessage += cTmp;
00567 #endif
00568 #ifdef _FEDM_LINUX
00569                 sprintf(cTmp, "libfeusb.so is missing");
00570                 if(sMessage.length() > 0)
00571                         sMessage += "\n";
00572 
00573                 sMessage += cTmp;
00574 #endif
00575                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00576                 FEDM_RETURN(FEDM_ERROR_NULL_POINTER);
00577         }
00578         lpfnFeusb(cVersion);
00579 #endif
00580         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00581         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00582 #ifdef _FEDM_WINDOWS
00583         #ifdef _WIN32_WCE
00584         sscanf(FEUSB_CE_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00585         #else
00586         sscanf(FEUSB_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00587         #endif
00588 #endif
00589 #ifdef _FEDM_LINUX
00590         sscanf(FEUSB_TUX_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00591 #endif
00592         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00593         if(uiVersionLib < uiVersionMin)
00594         {
00595 #ifdef _FEDM_WINDOWS
00596         #ifdef _WIN32_WCE
00597                 sprintf(cTmp, "FEUSB: V%s detected, but at least V%s expected", cVersion, FEUSB_CE_DLL_VERSION);
00598         #else
00599                 sprintf(cTmp, "FEUSB: V%s detected, but at least V%s expected", cVersion, FEUSB_DLL_VERSION);
00600         #endif
00601 #endif
00602 #ifdef _FEDM_LINUX
00603                 sprintf(cTmp, "FEUSB: V%s detected, but at least V%s expected", cVersion, FEUSB_TUX_DLL_VERSION);
00604 #endif
00605                 if(sMessage.length() > 0)
00606                         sMessage += "\n";
00607 
00608                 sMessage += cTmp;
00609                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00610         }
00611 #endif
00612 
00613 #ifdef _FEDM_TCP_SUPPORT
00614         // check FETCP
00615         memset(uiTmp, 0, 3);
00616         uiVersionLib = 0;
00617         uiVersionMin = 0;
00618 #if defined(_FEDM_SUPPORT_SLINK)
00619         FETCP_GetDLLVersion(cVersion);
00620 #else
00621         LPFN_FETCP_GET_DLL_VERSION lpfnFetcp = (LPFN_FETCP_GET_DLL_VERSION)GetFeTcpFunction(FETCP_GET_DLL_VERSION);
00622         if(lpfnFetcp == NULL)
00623         {
00624 #ifdef _FEDM_WINDOWS
00625                 sprintf(cTmp, "FETCP.DLL is missing");
00626                 if(sMessage.length() > 0)
00627                         sMessage += "\n";
00628 
00629                 sMessage += cTmp;
00630 #endif
00631 #ifdef _FEDM_LINUX
00632                 sprintf(cTmp, "libfetcp.so is missing");
00633                 if(sMessage.length() > 0)
00634                         sMessage += "\n";
00635 
00636                 sMessage += cTmp;
00637 #endif
00638                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00639                 FEDM_RETURN(FEDM_ERROR_NULL_POINTER);
00640         }
00641         lpfnFetcp(cVersion);
00642 #endif
00643         sscanf(cVersion, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00644         uiVersionLib = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00645         sscanf(FETCP_DLL_VERSION, "%d.%d.%d", &uiTmp[0], &uiTmp[1], &uiTmp[2]);
00646         uiVersionMin = (uiTmp[0]<<16) + (uiTmp[1]<<8) + uiTmp[2];
00647         if(uiVersionLib < uiVersionMin)
00648         {
00649                 sprintf(cTmp, "FETCP: V%s detected, but at least V%s expected", cVersion, FETCP_DLL_VERSION);
00650                 if(sMessage.length() > 0)
00651                         sMessage += "\n";
00652 
00653                 sMessage += cTmp;
00654                 iBack = FEDM_ERROR_VERSION_CONFLICT;
00655         }
00656 #endif
00657 #endif // #if !defined(_FEDM_ISC_CORE_DLL) && !defined(_OBIDISC4J_DLL) && !defined(_OBIDISC4NETnativePI_DLL)
00658 
00659         if(iBack < 0)
00660         {
00661                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Version conflict: " << sMessage.c_str());
00662         }
00663 
00664         FEDM_RETURN(iBack);
00665 }
00666 
00667 
00668 
00669 /***************************************************************************
00670   Begin         :       05.03.2013 / M. Hultsch
00671   Version       :       04.04.03 / 05.03.2013 / M. Hultsch
00672 
00673   Function              :       return version numbers of dependent libraries
00674                                         FECOM, FETCP, FEUSB, FEISC, FEFU, FETCL
00675 
00676   Parameters    :       string& sMessage        - reference to STL-string
00677                                         
00678   Return value  :       FEDM_OK or error code
00679 
00680 ***************************************************************************/
00681 string FEDM_ISCReader::GetDependentLibVersions()
00682 {
00683         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL, __FUNCTION__);
00684 
00685 #if !defined(_FEDM_ISC_CORE_DLL) && !defined(_OBIDISC4J_DLL) && !defined(_OBIDISC4NETnativePI_DLL)
00686         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
00687         return "";
00688 #else
00689         char cVersion[256];
00690         char cTmp[256];
00691         string sMessage;
00692         
00693 #ifdef _FEDM_COM_SUPPORT
00694         // FECOM
00695 #if defined(_FEDM_SUPPORT_SLINK)
00696         FECOM_GetDLLVersion(cVersion);
00697 #else
00698         LPFN_FECOM_GET_DLL_VERSION lpfnFecom = (LPFN_FECOM_GET_DLL_VERSION)GetFeComFunction(FECOM_GET_DLL_VERSION);
00699         if(lpfnFecom == NULL)
00700         {
00701 #ifdef _FEDM_WINDOWS
00702                 sprintf(cTmp, "FECOM.DLL is missing\n");
00703                 sMessage += cTmp;
00704 #endif
00705 #ifdef _FEDM_LINUX
00706                 sprintf(cTmp, "libfecom.so is missing\n");
00707                 sMessage += cTmp;
00708 #endif
00709                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00710         }
00711         else
00712         {
00713                 lpfnFecom(cVersion);
00714 #endif
00715 #ifdef _FEDM_WINDOWS
00716         #ifdef _WIN32_WCE
00717                 sprintf(cTmp, "FECOM: V%s detected, (at least V%s expected)\n", cVersion, FECOM_CE_DLL_VERSION);
00718         #else
00719                 sprintf(cTmp, "FECOM: V%s detected, (at least V%s expected)\n", cVersion, FECOM_DLL_VERSION);
00720         #endif
00721 #endif
00722 #ifdef _FEDM_LINUX
00723                 sprintf(cTmp, "FECOM: V%s detected, (at least V%s expected)\n", cVersion, FECOM_TUX_DLL_VERSION);
00724 #endif
00725                 sMessage += cTmp;
00726         }
00727 #endif // _FEDM_COM_SUPPORT
00728 
00729 #ifdef _FEDM_USB_SUPPORT
00730         // FEUSB
00731 #if defined(_FEDM_SUPPORT_SLINK)
00732         FEUSB_GetDLLVersion(cVersion);
00733 #else
00734         LPFN_FEUSB_GET_DLL_VERSION lpfnFeusb = (LPFN_FEUSB_GET_DLL_VERSION)GetFeUsbFunction(FEUSB_GET_DLL_VERSION);
00735         if(lpfnFeusb == NULL)
00736         {
00737 #ifdef _FEDM_WINDOWS
00738                 sprintf(cTmp, "FEUSB.DLL is missing\n");
00739                 sMessage += cTmp;
00740 #endif
00741 #ifdef _FEDM_LINUX
00742                 sprintf(cTmp, "libfeusb.so is missing\n");
00743                 sMessage += cTmp;
00744 #endif
00745                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00746         }
00747         else
00748         {
00749                 lpfnFeusb(cVersion);
00750 #endif
00751 #ifdef _FEDM_WINDOWS
00752         #ifdef _WIN32_WCE
00753                 sprintf(cTmp, "FEUSB: V%s detected, (at least V%s expected)\n", cVersion, FEUSB_CE_DLL_VERSION);
00754         #else
00755                 sprintf(cTmp, "FEUSB: V%s detected, (at least V%s expected)\n", cVersion, FEUSB_DLL_VERSION);
00756         #endif
00757 #endif
00758 #ifdef _FEDM_LINUX
00759                 sprintf(cTmp, "FEUSB: V%s detected, (at least V%s expected)\n", cVersion, FEUSB_TUX_DLL_VERSION);
00760 #endif
00761                 sMessage += cTmp;
00762         }
00763 #endif
00764 
00765 #ifdef _FEDM_TCP_SUPPORT
00766         // FETCP
00767 #if defined(_FEDM_SUPPORT_SLINK)
00768         FETCP_GetDLLVersion(cVersion);
00769 #else
00770         LPFN_FETCP_GET_DLL_VERSION lpfnFetcp = (LPFN_FETCP_GET_DLL_VERSION)GetFeTcpFunction(FETCP_GET_DLL_VERSION);
00771         if(lpfnFetcp == NULL)
00772         {
00773 #ifdef _FEDM_WINDOWS
00774                 sprintf(cTmp, "FETCP.DLL is missing\n");
00775                 sMessage += cTmp;
00776 #endif
00777 #ifdef _FEDM_LINUX
00778                 sprintf(cTmp, "libfetcp.so is missing\n");
00779                 sMessage += cTmp;
00780 #endif
00781                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << cTmp << " " << GetErrorText(FEDM_ERROR_NULL_POINTER));
00782         }
00783         else
00784         {
00785                 lpfnFetcp(cVersion);
00786 #endif
00787                 sprintf(cTmp, "FETCP: V%s detected, (at least V%s expected)\n", cVersion, FETCP_DLL_VERSION);
00788                 sMessage += cTmp;
00789         }
00790 #endif
00791         
00792         // FEISC
00793         FEISC_GetDLLVersion(cVersion);
00794         sprintf(cTmp, "FEISC: V%s detected (at least V%s expected)\n", cVersion, FEISC_TUX_DLL_VERSION);
00795         sMessage += cTmp;
00796         
00797 #ifdef _FEDM_FU_SUPPORT
00798         // FEFU
00799         FEFU_GetDLLVersion(cVersion);
00800         sprintf(cTmp, "FEFU:  V%s detected, (at least V%s expected)\n", cVersion, FEFU_DLL_VERSION);
00801         sMessage += cTmp;
00802 #endif
00803         
00804 #ifdef _FEDM_TAG_HANDLER
00805   #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00806         // FETCL
00807         FETCL_GetDLLVersion(cVersion);
00808         sprintf(cTmp, "FETCL: V%s detected, (at least V%s expected\n", cVersion, FETCL_DLL_VERSION);
00809         sMessage += cTmp;
00810   #endif
00811 #endif
00812 
00813         return sMessage;
00814 
00815 #endif // #if !defined(_FEDM_ISC_CORE_DLL) && !defined(_OBIDISC4J_DLL) && !defined(_OBIDISC4NETnativePI_DLL)
00816 }
00817 
00819 // Settings
00821 
00822 int FEDM_ISCReader::SetPortHnd(int iPortHnd)
00823 {
00824         // no reader handle -> no communication
00825         if( m_iReaderHnd == 0 )
00826         {
00827                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_READER_HANDLE));
00828                 FEDM_RETURN(FEDM_ERROR_NO_READER_HANDLE);
00829         }
00830 
00831         int iErr;
00832         char cPortHnd[11];
00833         memset(cPortHnd, 0, 11);
00834         sprintf(cPortHnd, "%d", iPortHnd);
00835 
00836         // Set port handle into DLL
00837         FEDM_CHK2(iErr, FEISC_SetReaderPara(m_iReaderHnd, "PortHnd", cPortHnd));
00838 
00839         return FEDM_OK;
00840 }
00841 
00842 
00843 int FEDM_ISCReader::SetProtocolFrameSupport(unsigned int uiType)
00844 {
00845         switch(uiType)
00846         {
00847         case FEDM_PRT_FRAME_STANDARD:
00848                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_INFO, __FUNCTION__ << "(STANDARD)");
00849                 return FEISC_SetReaderPara(m_iReaderHnd, "FRAMESUPPORT", "STANDARD");
00850 
00851         case FEDM_PRT_FRAME_ADVANCED:
00852                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_INFO, __FUNCTION__ << "(ADVANCED)");
00853                 return FEISC_SetReaderPara(m_iReaderHnd, "FRAMESUPPORT", "ADVANCED");
00854         }
00855 
00856         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_PARAMETER));
00857         FEDM_RETURN(FEDM_ERROR_PARAMETER);
00858 }
00859 
00860 #ifdef _FEDM_TAG_HANDLER
00861 void FEDM_ISCReader::SetTagHandlerOption(string sParameter, string sValue)
00862 {
00863         FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN_SET_GET, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "sParameter=" << sParameter << ", sValue=" << sValue);
00864 
00865         if(sParameter == "CreateCondition_Smart")
00866         {
00867                 if(sValue == "On" || sValue == "1")
00868                 {
00869                         m_bTagHandlerOption_CreateCondition_Smart = true;
00870                 }
00871                 else
00872                 {
00873                         m_bTagHandlerOption_CreateCondition_Smart = false;
00874                 }
00875         }
00876 }
00877 #endif
00878 
00879 int FEDM_ISCReader::SetTableSize(unsigned int uiTableID, int iSize)
00880 {
00881         unsigned int i;
00882 
00883         if(iSize <= 0)
00884         {
00885                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_PARAMETER));
00886                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
00887         }
00888 
00889         switch(uiTableID)
00890         {
00891         case FEDM_ISC_BRM_TABLE:
00892                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN_SET_GET, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "BRMTable, Size=" << iSize);
00893                 // delete old table entries
00894                 for( i=0; i<m_BRMTable.size(); i++ )
00895                         delete m_BRMTable[i];
00896 
00897                 m_BRMTable.clear();
00898                 m_BRMTable.resize(iSize);
00899 
00900                 // allocate memory for table entries
00901                 for( i=0; i<(unsigned int)iSize; i++ )
00902                 {
00903                         m_BRMTable[i] = (FEDM_BRMTabItem*) new FEDM_BRMTabItem(i);
00904                         if(m_BRMTable[i] == NULL)
00905                                 break;
00906                         m_BRMTable[i]->Init();
00907                 }
00908                 break;
00909 
00910         case FEDM_ISC_ISO_TABLE:
00911                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN_SET_GET, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "ISOTable, Size=" << iSize);
00912                 // delete old table entries
00913                 for( i=0; i<m_ISOTable.size(); i++ )
00914                         delete m_ISOTable[i];
00915 
00916                 m_ISOTable.clear();
00917                 m_ISOTable.resize(iSize);
00918 
00919                 // allocate memory for table entries
00920                 for( i=0; i<(unsigned int)iSize; i++ )
00921                 {
00922                         m_ISOTable[i] = (FEDM_ISOTabItem*) new FEDM_ISOTabItem(i, this);
00923                         if(m_ISOTable[i] == NULL)
00924                                 break;
00925                         m_ISOTable[i]->Init();
00926                 }
00927                 break;
00928 
00929         case FEDM_ISC_CAD_TABLE:
00930                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
00931                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
00932         
00933         default:
00934                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
00935                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
00936         }
00937 
00938         return FEDM_OK;
00939 }
00940 
00941 
00942 int FEDM_ISCReader::SetTableSize(       unsigned int uiTableID, 
00943                                                                         int iSize, 
00944                                                                         int iRxDB_BlockCount, 
00945                                                                         int iRxDB_BlockSize, 
00946                                                                         int iTxDB_BlockCount,
00947                                                                         int iTxDB_BlockSize )
00948 {
00949         unsigned int i;
00950 
00951         if(iSize <= 0)
00952         {
00953                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_PARAMETER));
00954                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
00955         }
00956 
00957         switch(uiTableID)
00958         {
00959         case FEDM_ISC_BRM_TABLE:
00960                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN_SET_GET, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "BRMTable, Size=" << iSize << ", RxDB_BlockCount=" << iRxDB_BlockCount << ", RxDB_BlockSize=" << iRxDB_BlockSize << ", TxDB_BlockCount=" << iTxDB_BlockCount << ", TxDB_BlockSize=" << iTxDB_BlockSize);
00961                 // delete old table entries
00962                 for( i=0; i<m_BRMTable.size(); i++ )
00963                         delete m_BRMTable[i];
00964 
00965                 m_BRMTable.clear();
00966                 m_BRMTable.resize(iSize);
00967 
00968                 // allocate memory for table entries
00969                 for( i=0; i<(unsigned int)iSize; i++ )
00970                 {
00971                         m_BRMTable[i] = (FEDM_BRMTabItem*) new FEDM_BRMTabItem(i);
00972                         if(m_BRMTable[i] == NULL)
00973                                 break;
00974                         m_BRMTable[i]->Init(iRxDB_BlockCount, 
00975                                                                 iRxDB_BlockSize);
00976                 }
00977                 break;
00978 
00979         case FEDM_ISC_ISO_TABLE:
00980                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN_SET_GET, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "ISOTable, Size=" << iSize << ", RxDB_BlockCount=" << iRxDB_BlockCount << ", RxDB_BlockSize=" << iRxDB_BlockSize << ", TxDB_BlockCount=" << iTxDB_BlockCount << ", TxDB_BlockSize=" << iTxDB_BlockSize);
00981                 // delete old table entries
00982                 for( i=0; i<m_ISOTable.size(); i++ )
00983                         delete m_ISOTable[i];
00984 
00985                 m_ISOTable.clear();
00986                 m_ISOTable.resize(iSize);
00987 
00988                 // allocate memory for table entries
00989                 for( i=0; i<(unsigned int)iSize; i++ )
00990                 {
00991                         m_ISOTable[i] = (FEDM_ISOTabItem*) new FEDM_ISOTabItem(i, this);
00992                         if(m_ISOTable[i] == NULL)
00993                                 break;
00994                         m_ISOTable[i]->Init(iRxDB_BlockCount, 
00995                                                                 iRxDB_BlockSize, 
00996                                                                 iTxDB_BlockCount,
00997                                                                 iTxDB_BlockSize);
00998                 }
00999                 break;
01000 
01001         case FEDM_ISC_CAD_TABLE:
01002                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01003                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
01004         
01005         default:
01006                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
01007                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
01008         }
01009 
01010         return FEDM_OK;
01011 }
01012 
01013 
01014 
01015 /***************************************************************************
01016   Begin         :       10.05.2001 / M. Hultsch
01017   Version       :       03.00.06 / 31.03.2006 / M. Hultsch
01018                                         - remove of all tag handler in every tag item
01019 
01020                                         02.03.00 / 28.07.2005 / M. Hultsch
01021 
01022   Function              :       delete all data entries in table (list)
01023 
01024   Parameters    :       unsigned int uiTableID          - identifies the table
01025                                         unsigned int uiDataFlags        - additional reset conditions
01026                                                                                   0 or FEDM_ISC_DATA_ALL
01027 
01028   Return value  :       FEDM_OK or error code
01029 ***************************************************************************/
01030 int FEDM_ISCReader::ResetTable(unsigned int uiTableID, unsigned int uiDataFlags)
01031 {
01032         unsigned int iCnt, iIdx, iCnt1;
01033 
01034         switch(uiTableID)
01035         {
01036         case FEDM_ISC_BRM_TABLE:
01037                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "BRMTable, DataFlags=0x" << std::hex << std::uppercase << uiDataFlags);
01038                 if(m_BRMTable.size() == 0)
01039                 {
01040                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(BRMTable, ..) " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
01041                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
01042                 }
01043 
01044                 m_uiBRMTableLength = 0;
01045                 break;
01046 
01047         case FEDM_ISC_ISO_TABLE:
01048                 FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_ADMIN, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "ISOTable, DataFlags=0x" << std::hex << std::uppercase << uiDataFlags);
01049                 if(m_ISOTable.size() == 0)
01050                 {
01051                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(ISOTable, ..) " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
01052                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
01053                 }
01054 
01055                 if(m_uiISOTableLength == 0)
01056                         return FEDM_OK;
01057 
01058 
01059                 // delete all flags in the table
01060                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01061                         m_ISOTable[iIdx]->m_bIsSelected = false;
01062 
01063                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01064                         m_ISOTable[iIdx]->m_bIsBlockSizeSet = false;
01065 
01066                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01067                         m_ISOTable[iIdx]->m_bIsSnr = false;
01068 
01069                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01070                         m_ISOTable[iIdx]->m_bIsEpc = false;
01071 
01072                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01073                         m_ISOTable[iIdx]->m_bIsAFI = false;
01074 
01075                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01076                         m_ISOTable[iIdx]->m_bIsSnr = false;
01077 
01078                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01079                         m_ISOTable[iIdx]->m_bIsSnr = false;
01080 
01081                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01082                         m_ISOTable[iIdx]->m_bIsSysInfo = false;
01083 
01084                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01085                         m_ISOTable[iIdx]->m_bIsISO14443_4Info = false;
01086 
01087                 if(uiDataFlags != FEDM_ISC_DATA_ALL)
01088                 {
01089                         m_uiISOTableLength = 0; // set length to zero
01090                         return FEDM_OK;
01091                 }
01092 
01093                 // overwrite complete table with zero
01094                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01095                         for(iCnt=0; iCnt<FEDM_ISC_MAX_UID_LENGTH; iCnt++)
01096                                 m_ISOTable[iIdx]->m_ucSnr[iCnt] = 0x00;
01097 
01098                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01099                         m_ISOTable[iIdx]->m_ucTrType = 0x00;
01100 
01101                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01102                         m_ISOTable[iIdx]->m_ucEpcType = 0x00;
01103 
01104                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01105                         m_ISOTable[iIdx]->m_ucAFI = 0x00;
01106 
01107                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01108                         m_ISOTable[iIdx]->m_ucDsfID = 0x00;
01109 
01110                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01111                         for(iCnt=0; iCnt<2; iCnt++)
01112                                 m_ISOTable[iIdx]->m_ucMemSize[iCnt] = 0x00;
01113 
01114                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01115                         m_ISOTable[iIdx]->m_ucICRef = 0x00;
01116 
01117                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01118                         m_ISOTable[iIdx]->m_ucBlockSize = 0x00;
01119 
01120                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01121                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucSecStatus.size(); iCnt++)
01122                                 m_ISOTable[iIdx]->m_ucSecStatus[iCnt] = 0x00;
01123 
01124                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01125                 {
01126                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucTxDB.size(); iCnt++)
01127                                 m_ISOTable[iIdx]->m_ucTxDB[iCnt] = 0x00;
01128 
01129                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size(); iCnt++)
01130                                 m_ISOTable[iIdx]->m_ucTxDB_EpcBank[iCnt] = 0x00;
01131 
01132                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucTxDB_TidBank.size(); iCnt++)
01133                                 m_ISOTable[iIdx]->m_ucTxDB_TidBank[iCnt] = 0x00;
01134 
01135                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucTxDB_ResBank.size(); iCnt++)
01136                                 m_ISOTable[iIdx]->m_ucTxDB_ResBank[iCnt] = 0x00;
01137                 }
01138 
01139                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01140                 {
01141                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucRxDB.size(); iCnt++)
01142                                 m_ISOTable[iIdx]->m_ucRxDB[iCnt] = 0x00;
01143 
01144                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size(); iCnt++)
01145                                 m_ISOTable[iIdx]->m_ucRxDB_EpcBank[iCnt] = 0x00;
01146 
01147                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucRxDB_TidBank.size(); iCnt++)
01148                                 m_ISOTable[iIdx]->m_ucRxDB_TidBank[iCnt] = 0x00;
01149 
01150                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucRxDB_ResBank.size(); iCnt++)
01151                                 m_ISOTable[iIdx]->m_ucRxDB_ResBank[iCnt] = 0x00;
01152                 }
01153 
01154                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01155                         for(iCnt=0; iCnt<4; iCnt++)
01156                                 for(iCnt1=0; iCnt1<4; iCnt1++)
01157                                         m_ISOTable[iIdx]->m_ucTxCB[iCnt][iCnt1] = 0x00;
01158 
01159                 for(iIdx=0; iIdx<m_uiISOTableLength; iIdx++)
01160                         for(iCnt=0; iCnt<4; iCnt++)
01161                                 for(iCnt1=0; iCnt1<4; iCnt1++)
01162                                         m_ISOTable[iIdx]->m_ucRxCB[iCnt][iCnt1] = 0x00;
01163 
01164 
01165                 m_uiISOTableLength = 0; // set length to zero
01166 
01167                 break;
01168         
01169 #if !defined(__BORLANDC__)
01170         case FEDM_ISC_CAD_TABLE:
01171                 m_CADTable.Init();
01172                 break;
01173 #endif
01174 
01175         default:
01176                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
01177                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
01178         }
01179 
01180         return FEDM_OK;
01181 }
01182 
01183 
01185 // Queries
01187 
01188 int  FEDM_ISCReader::GetPortHnd()
01189 {
01190         // no reader handle -> no communication
01191         if( m_iReaderHnd == 0 )
01192         {
01193                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_READER_HANDLE));
01194                 FEDM_RETURN(FEDM_ERROR_NO_READER_HANDLE);
01195         }
01196 
01197         int iErr;
01198         char cPortHnd[13];
01199 
01200         // Get port handle from DLL
01201         FEDM_CHK2(iErr, FEISC_GetReaderPara(m_iReaderHnd, "PortHnd", cPortHnd));
01202 
01203         return atoi(cPortHnd);
01204 }
01205 
01206 
01207 int FEDM_ISCReader::GetProtocolFrameSupport()
01208 {
01209         int iErr;
01210         char cValue[24];
01211 
01212         FEDM_CHK2(iErr, FEISC_GetReaderPara(m_iReaderHnd, "FRAMESUPPORT", cValue));
01213 
01214         if(strcmp(cValue, "STANDARD") == 0)
01215         {
01216                 SetLastError(FEDM_OK);
01217                 return FEDM_PRT_FRAME_STANDARD;
01218         }
01219         else if(strcmp(cValue, "ADVANCED") == 0)
01220         {
01221                 SetLastError(FEDM_OK);
01222                 return FEDM_PRT_FRAME_ADVANCED;
01223         }
01224 
01225         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_PARAMETER));
01226         FEDM_RETURN(FEDM_ERROR_PARAMETER);
01227 }
01228 
01229 
01230 int FEDM_ISCReader::GetTableSize(unsigned int uiTableID)
01231 {
01232         switch(uiTableID)
01233         {
01234         case FEDM_ISC_BRM_TABLE:
01235                 return (int)m_BRMTable.size();
01236 
01237         case FEDM_ISC_ISO_TABLE:
01238                 return (int)m_ISOTable.size();
01239 
01240 #if !defined(__BORLANDC__)
01241         case FEDM_ISC_CAD_TABLE:
01242                 if(m_CADTable.m_ucMode == 0x04)                 // CH_HISTORY
01243                 {
01244                         return (int)m_CADTable.m_History.size();
01245                 }
01246                 else if(m_CADTable.m_ucMode == 0x08)    // CH_POWER
01247                 {
01248                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01249                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
01250                 }
01251                 else
01252                 {
01253                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01254                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
01255                 }
01256                 break;
01257 #endif
01258 
01259         default:
01260                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
01261                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
01262         }
01263 
01264         return FEDM_OK;
01265 }
01266 
01267 int FEDM_ISCReader::GetTableLength(unsigned int uiTableID)
01268 {
01269         switch(uiTableID)
01270         {
01271         case FEDM_ISC_BRM_TABLE:
01272                 return (int)m_uiBRMTableLength;
01273 
01274         case FEDM_ISC_ISO_TABLE:
01275                 return (int)m_uiISOTableLength;
01276         
01277         default:
01278                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
01279                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
01280         }
01281 
01282         return FEDM_OK;
01283 }
01284 
01285 int FEDM_ISCReader::SetTableLength(unsigned int uiTableID, unsigned int uiLength)
01286 {
01287         switch(uiTableID)
01288         {
01289         case FEDM_ISC_BRM_TABLE:
01290                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(BRMTable, Length=" << uiLength << ")" << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01291                 return FEDM_ERROR_UNSUPPORTED;
01292 
01293         case FEDM_ISC_ISO_TABLE:
01294                 if(uiLength == 0 && uiLength > m_ISOTable.size())
01295                 {
01296                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(ISOTable, Length=" << uiLength << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
01297                         return FEDM_ERROR_PARAMETER;
01298                 }
01299 
01300                 m_uiISOTableLength = uiLength;
01301                 return FEDM_OK;
01302         
01303         default:
01304                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
01305                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
01306         }
01307 
01308         return FEDM_OK;
01309 }
01310 
01311 FEDM_ISOTabItem* FEDM_ISCReader::GetISOTableItem(unsigned int uiIdx) 
01312 {
01313         if(uiIdx > m_ISOTable.size())
01314         {
01315                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Index > table size");
01316                 return NULL;
01317         }
01318 
01319 #ifdef _FEDM_WINDOWS
01320   #if _MSC_VER >= 1400
01321         vector<FEDM_ISOTabItem*>::pointer ptr = &m_ISOTable[uiIdx];
01322         return *ptr;
01323   #else
01324         vector<FEDM_ISOTabItem*>::iterator itor;
01325         for(itor  = m_ISOTable.begin();
01326                 itor != m_ISOTable.end();
01327                 itor++)
01328         {
01329                 if( (*itor)->m_uiTabIndex == uiIdx )
01330                         return *itor;
01331         }
01332   #endif
01333 #else
01334         vector<FEDM_ISOTabItem*>::pointer ptr = &m_ISOTable[uiIdx];
01335         return *ptr;
01336 #endif
01337 
01338         return NULL;
01339 }
01340 
01341 FEDM_BRMTabItem* FEDM_ISCReader::GetBRMTableItem(unsigned int uiIdx) 
01342 {
01343         if(uiIdx > m_BRMTable.size())
01344         {
01345                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Index > table size");
01346                 return NULL;
01347         }
01348 
01349 #ifdef _FEDM_WINDOWS
01350   #if _MSC_VER >= 1400
01351         vector<FEDM_BRMTabItem*>::pointer ptr = &m_BRMTable[uiIdx];
01352         return *ptr;
01353   #else
01354         vector<FEDM_BRMTabItem*>::iterator itor;
01355         for(itor  = m_BRMTable.begin();
01356                 itor != m_BRMTable.end();
01357                 itor++)
01358         {
01359                 if( (*itor)->m_uiTabIndex == uiIdx )
01360                         return *itor;
01361         }
01362   #endif
01363 #else
01364         vector<FEDM_BRMTabItem*>::pointer ptr = &m_BRMTable[uiIdx];
01365         return *ptr;
01366 #endif
01367 
01368         return NULL;
01369 }
01370 
01371 
01372 
01374 // Data I/O
01376 
01377 
01378 /***************************************************************************
01379   Begin                 :       14.08.2003 / M. Hultsch
01380   Version               :       02.04.04 / 22.08.2006 / M. Hultsch
01381 
01382   Function                      :       main-function for XML file I/O
01383 
01384   Parameters            :       bool bRead              -       if true : serialize from XML-File
01385                                                                                         if false: serialize into XML-File
01386                                                 char* sFileName -       pointer to file name with directory
01387 
01388   Return value          :       OK or error code
01389 
01390 ***************************************************************************/
01391 int FEDM_ISCReader::Serialize(bool bRead, char* sFileName)
01392 {
01393 #ifdef _FEDM_XML_SUPPORT
01394         FEDM_XMLReaderCfgDataModul xml;
01395 
01396         int iBack = FEDM_DataBase::Serialize(&xml, bRead, sFileName);
01397 
01398         FEDM_RETURN(iBack);
01399 #else
01400         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01401         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
01402 #endif
01403 }
01404 
01405 /***************************************************************************
01406   Begin                 :       23.04.2003 / M. Hultsch
01407   Version               :       03.00.00 / 20.10.2006 / M. Hultsch
01408 
01409   Function                      :       sub-function for XML file input
01410 
01411   Parameters            :       FEDM_XMLBase xml                - pointer to the xml handler
01412                                                 FEDM_XML_TREEITEM* root - pointer to the root item
01413 
01414   Return value          :       OK or error code
01415 
01416 ***************************************************************************/
01417 int FEDM_ISCReader::SerializeIn(FEDM_XMLBase* xml, FEDM_XML_TREEITEM* root)
01418 {
01419         int iBack = 0;
01420 #ifdef _FEDM_XML_SUPPORT
01421 #ifndef FEDM_NEW_LRU3000_ACC_CFG
01422         switch(m_uiReaderType)
01423         {
01424         case FEDM_ISC_TYPE_ISCLRU3000:
01425 
01426         //case FEDM_ISC_TYPE_ISCLR2500_A:
01427                 iBack = FEDM_DataBase::SerializeIn(FEDM_RFC_EEDATA_MEM, xml, root);
01428                 if(iBack)
01429                         return iBack;
01430 
01431                 iBack = FEDM_DataBase::SerializeIn(FEDM_RFC_RAMDATA_MEM, xml, root);
01432                 if(iBack)
01433                         return iBack;
01434 
01435                 iBack = FEDM_DataBase::SerializeIn(FEDM_ACC_EEDATA_MEM, xml, root);
01436                 if(iBack)
01437                         return iBack;
01438 
01439                 iBack = FEDM_DataBase::SerializeIn(FEDM_ACC_RAMDATA_MEM, xml, root);
01440                 if(iBack)
01441                         return iBack;
01442 
01443                 break;
01444         default:
01445 #endif
01446                 iBack = FEDM_DataBase::SerializeIn(FEDM_RFC_EEDATA_MEM, xml, root);
01447                 if(iBack)
01448                         return iBack;
01449 
01450                 iBack = FEDM_DataBase::SerializeIn(FEDM_RFC_RAMDATA_MEM, xml, root);
01451                 if(iBack)
01452                         return iBack;
01453 
01454 #ifndef FEDM_NEW_LRU3000_ACC_CFG
01455                 break;
01456         }
01457 #endif
01458 
01459         return FEDM_OK;
01460 #else
01461         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01462         return FEDM_ERROR_UNSUPPORTED;
01463 #endif
01464 }
01465 
01466 /***************************************************************************
01467   Begin                 :       23.04.2003 / M. Hultsch
01468   Version               :       03.00.00 / 20.10.2006 / M. Hultsch
01469 
01470   Function                      :       sub-function for XML file output
01471 
01472   Parameters            :       FEDM_XMLBase xml                - pointer to the xml handler
01473                                                 FEDM_XML_TREEITEM* root - pointer to the root item
01474 
01475   Return value          :       OK or error code
01476 
01477 ***************************************************************************/
01478 int FEDM_ISCReader::SerializeOut(FEDM_XMLBase* xml, FEDM_XML_TREEITEM* root)
01479 {
01480         int iBack = 0;
01481 #ifdef _FEDM_XML_SUPPORT
01482 #ifndef FEDM_NEW_LRU3000_ACC_CFG
01483         switch(m_uiReaderType)
01484         {
01485         case FEDM_ISC_TYPE_ISCLRU3000:
01486         //case FEDM_ISC_TYPE_ISCLR2500_A:
01487                 iBack = FEDM_DataBase::SerializeOut(FEDM_RFC_EEDATA_MEM, xml, root);
01488                 if(iBack)
01489                         return iBack;
01490 
01491                 iBack = FEDM_DataBase::SerializeOut(FEDM_RFC_RAMDATA_MEM, xml, root);
01492                 if(iBack)
01493                         return iBack;
01494 
01495                 iBack = FEDM_DataBase::SerializeOut(FEDM_ACC_EEDATA_MEM, xml, root);
01496                 if(iBack)
01497                         return iBack;
01498 
01499                 iBack = FEDM_DataBase::SerializeOut(FEDM_ACC_RAMDATA_MEM, xml, root);
01500                 if(iBack)
01501                         return iBack;
01502 
01503                 break;
01504         default:
01505 #endif
01506                 iBack = FEDM_DataBase::SerializeOut(FEDM_RFC_EEDATA_MEM, xml, root);
01507                 if(iBack)
01508                         return iBack;
01509 
01510                 iBack = FEDM_DataBase::SerializeOut(FEDM_RFC_RAMDATA_MEM, xml, root);
01511                 if(iBack)
01512                         return iBack;
01513 
01514 #ifndef FEDM_NEW_LRU3000_ACC_CFG
01515                 break;
01516         }
01517 #endif
01518 
01519         return FEDM_OK;
01520 #else
01521         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
01522         return FEDM_ERROR_UNSUPPORTED;
01523 #endif
01524 }
01525 
01526 /***************************************************************************
01527   Begin                 :       07.06.2000 / M. Hultsch
01528   Version               :       01.00.00 / 19.11.2000 / M. Hultsch
01529 
01530   Function                      :       function for proprietary file-I/O
01531                                                 for every iMemType call Serialize
01532 
01533   Parameters            :       CArchive ar             -       MFC archive class
01534                                                 int iMemType    -       mem type identifier
01535 
01536   Return value          :       OK or error code
01537 
01538 ***************************************************************************/
01539 
01540 #ifdef _FEDM_MFC_SUPPORT
01541 int FEDM_ISCReader::Serialize(CArchive& ar, int iMemType)
01542 {
01543 /*      FEDM_CHK3(&ar);
01544 
01545         int i;
01546 
01547         if( ar.IsStoring() )    // write data to file
01548         {
01549                 switch( iMemType )
01550                 {
01551                 case FEDM_RFC_EEDATA_MEM:               
01552                         for( i=0; i<FEDM_ISC_MAX_RFC_EEDATA_MEM; i++ )
01553                                 ar << m_RFC_EEData[i];
01554                         break;
01555                 
01556                 case FEDM_RFC_RAMDATA_MEM:
01557                         for( i=0; i<FEDM_ISC_MAX_RFC_RAMDATA_MEM; i++ )
01558                                 ar << m_RFC_RAMData[i];
01559                         break;
01560 
01561                 case FEDM_TMPDATA_MEM:
01562                         for( i=0; i<FEDM_ISC_MAX_TMPDATA_MEM; i++ )
01563                                 ar << m_TmpData[i];
01564                         break;
01565 
01566                 default:
01567                         return FEDM_ERROR_UNKNOWN_MEM_ID;
01568                 }
01569         }
01570         else if( ar.IsLoading() )       // read data from file
01571         {
01572                 switch( iMemType )
01573                 {
01574                 case FEDM_RFC_EEDATA_MEM:               
01575                         for( i=0; i<FEDM_ISC_MAX_RFC_EEDATA_MEM; i++ )
01576                                 ar >> m_RFC_EEData[i];
01577                         break;
01578 
01579                 case FEDM_RFC_RAMDATA_MEM:
01580                         for( i=0; i<FEDM_ISC_MAX_RFC_RAMDATA_MEM; i++ )
01581                                 ar >> m_RFC_RAMData[i];
01582                         break;
01583 
01584                 case FEDM_TMPDATA_MEM:
01585                         for( i=0; i<FEDM_ISC_MAX_TMPDATA_MEM; i++ )
01586                                 ar >> m_TmpData[i];
01587                         break;
01588 
01589                 default:
01590                         return FEDM_ERROR_UNKNOWN_MEM_ID;
01591                 }
01592         }
01593 */
01594         return FEDM_ERROR_UNSUPPORTED;
01595 }
01596 #endif
01597 
01598 
01599 
01601 // Communication
01603 
01604 /***************************************************************************
01605   Begin                 :       07.06.2000 / M. Hultsch
01606   
01607   Version               :       04.06.04 / 20.08.2014 / M. Hultsch
01608                                                 - [0xB0] with status 0x02 (data false) returns now at once for all sub-commands, except [0x01] Inventory
01609 
01610                                                 04.04.02 / 22.01.2013 / M. Hultsch
01611                                                 - [0xB0] with status 0x84 (RF-Warning) takes returned records
01612 
01613                                                 03.00.14 / 29.10.2009 / M. Hultsch
01614 
01615   Function                      :       main function for communication with i-scan reader and transponder
01616 
01617   Parameters            :       unsigned char ucCmdByte         -       command byte
01618 
01619   Return value          :       status byte (>=0) or error code (<0)
01620 ***************************************************************************/
01621 int FEDM_ISCReader::SendProtocol(unsigned char ucCmdByte)
01622 {
01623         bool    bExtAdr = false;
01624         int             iErr = 0;
01625         int     iCnt = 0;
01626         int     iByteCnt = 0;
01627         int     iBlockCnt = 0;
01628         int             iBack = 0;
01629         int             iLen = 0;
01630         int             iIdx = 0;
01631         int             iPortHnd = 0;
01632         int             iTmpMemAdr = 0;
01633         unsigned int uiAdr = 0;
01634         char    cPortHnd[11];
01635         unsigned char   ucIsoCmd = 0;
01636         unsigned char   ucEpcCmd = 0;
01637         unsigned char ucDesFireCmd = 0;
01638         unsigned char ucMifarePlusCmd = 0;
01639         unsigned char   ucIsoMode = 0;
01640         unsigned char   ucHeader = 0;
01641         unsigned char   ucValue[40];    memset( ucValue, '\0', 40*sizeof(unsigned char) );
01642         unsigned char   ucPW[4];                memset( ucPW, '\0', 4);
01643         unsigned int    uiValue[5];             memset( uiValue, 0, 5*sizeof(unsigned int) );
01644         int             iValue[5];              memset( iValue, 0, 5*sizeof(int) );
01645 
01646         FEDM_TRACE_FNC(m_pLogger, FELOGMNG_DBG_FUNCTION_CALL | FELOGMNG_DBG_LF_COMM_UNI, __FUNCTION__, FELOGMNG_DBG_FUNCTION_PARAMETER, "CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte);
01647 
01648         SetLastError(FEDM_OK);
01649 
01650         // no reader handle -> no communication
01651         if( m_iReaderHnd == 0 )
01652         {
01653                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_READER_HANDLE) );
01654                 FEDM_RETURN(FEDM_ERROR_NO_READER_HANDLE);
01655         }
01656 
01657         // get port handle from DLL
01658         FEDM_CHK2(iErr, FEISC_GetReaderPara(m_iReaderHnd, "PortHnd", cPortHnd));
01659         
01660         iPortHnd = atoi(cPortHnd);
01661         if( iPortHnd == 0 )
01662         {
01663                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_PORT_HANDLE) );
01664                 FEDM_RETURN(FEDM_ERROR_NO_PORT_HANDLE);
01665         }
01666 
01667         // reset last error
01668         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_ERROR, (unsigned int)0));
01669 
01670 
01671         switch(ucCmdByte)
01672         {
01673         case 0x18:
01674                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_EPC_DESTROY_MODE, &ucValue[0]));
01675                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DESTROY_EPC, &ucValue[1], 16));
01676                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_EPC_DESTROY_PASSWORD, &ucPW[0], 3));
01677 
01678                 switch(ucValue[0])      // mode byte
01679                 {
01680                 case 0x00: // EPC (HF and UHF)
01681                         ucHeader = (ucValue[1] & 0xC0) >> 6;
01682                         switch(ucHeader) // mask first two bits
01683                         {
01684                         case FEDM_ISC_EPC_TYPE_1: // 96 bit EPC
01685                                 iLen = 12;
01686                                 break;
01687                         case FEDM_ISC_EPC_TYPE_2: // 64 bit Type 1 EPC
01688                         case FEDM_ISC_EPC_TYPE_3: // 64 bit Type 2 EPC
01689                         case FEDM_ISC_EPC_TYPE_4: // 64 bit Type 3 EPC
01690                                 iLen = 8;
01691                                 break;
01692                         default:
01693                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
01694                         }
01695                         
01696                         break;
01697 
01698                 case 0x01: // I-Code UID
01699                         iLen = 19;
01700                         break;
01701 
01702                 default:
01703                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x18) - " << GetErrorText(FEDM_ERROR_PARAMETER));
01704                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
01705                 }
01706 
01707                 if(iLen <= 32)
01708                 {
01709                         FEDM_CHK2(iErr, GetData(FEDM_GetAdrOfID(FEDM_ISC_TMP_DESTROY_EPC, 32), &ucValue[1], iLen, FEDM_TMPDATA_MEM));
01710                 }
01711                 else
01712                 {
01713                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x18) - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
01714                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
01715                 }
01716 
01717                 iBack = FEISC_0x18_Destroy( m_iReaderHnd, 
01718                                                                     m_ucBusAdr,
01719                                                                         ucValue[0],
01720                                                                         &ucValue[1],
01721                                                                         &ucPW[0]);
01722                 break;
01723 
01724         case 0x1A:
01725                 iBack = FEISC_0x1A_Halt( m_iReaderHnd, m_ucBusAdr );
01726                 break;
01727 
01728         case 0x1B:
01729                 iBack = FEISC_0x1B_ResetQuietBit( m_iReaderHnd, m_ucBusAdr );
01730                 break;
01731 
01732         case 0x1C:
01733                 iBack = FEISC_0x1C_EASRequest( m_iReaderHnd, m_ucBusAdr );
01734                 break;
01735 
01736         case 0x21:
01737                 FEDM_CHK2(iErr, GetData(FEDM_ISCLR_TMP_BRM_SETS, &ucValue[0]));
01738                 
01739                 iBack = FEISC_0x21_ReadBuffer( m_iReaderHnd, 
01740                                                                            m_ucBusAdr, 
01741                                                                            ucValue[0], 
01742                                                                            &ucValue[1], 
01743                                                                            &ucValue[2], 
01744                                                                            &m_ucData[0], 
01745                                                                            0 );
01746 
01747                 if( iBack==0x00 || 
01748                         iBack==0x83 || 
01749                         iBack==0x84 || 
01750                         iBack==0x85 || 
01751                         iBack==0x90 || 
01752                         iBack==0x93 || 
01753                         iBack==0x94 )
01754                 {       
01755                         FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_BRM_TRDATA,      ucValue[1]));
01756                         FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_BRM_RECSETS, ucValue[2]));
01757 
01758                         if(ucValue[2] == 0)     // no more data
01759                         {
01760                                 // reset BRM-table
01761                                 m_uiBRMTableLength = 0;
01762 
01763                                 FEDM_RETURN(iBack);
01764                         }
01765 
01766                         // save new buffered read mode data in iso-table
01767                         FEDM_CHK2(iErr, SetBrmTableData(0x21, &m_ucData[0]));
01768                 }
01769                 else
01770                 {
01771                         // reset BRM-table
01772                         m_uiBRMTableLength = 0;
01773                 }
01774                 break;
01775         
01776         case 0x22:
01777                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_ADV_BRM_SETS, (unsigned int*)&iValue[0]));
01778                 
01779                 iBack = FEISC_0x22_ReadBuffer( m_iReaderHnd, 
01780                                                                            m_ucBusAdr, 
01781                                                                            iValue[0], 
01782                                                                            &ucValue[0], 
01783                                                                            &iValue[1], 
01784                                                                            &m_ucData[0], 
01785                                                                            0 );
01786 
01787                 if( iBack==0x00 || 
01788                         iBack==0x83 || // RF Communication Error
01789                         iBack==0x84 || // RF Warning
01790                         iBack==0x85 || 
01791                         iBack==0x90 || 
01792                         iBack==0x93 || 
01793                         iBack==0x94 )
01794                 {       
01795                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1,  ucValue[0]));
01796                         if(ucValue[0] & 0x80)   // extension flag?
01797                         {
01798                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_ADV_BRM_TRDATA2,  ucValue[1]));
01799                         }
01800                         else
01801                         {
01802                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_ADV_BRM_TRDATA2,  (unsigned char)0));
01803                         }
01804 
01805                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_ADV_BRM_RECSETS, (unsigned int)iValue[1]));
01806 
01807                         if(iValue[1] == 0)      // no more data
01808                         {
01809                                 // reset BRM-table
01810                                 m_uiBRMTableLength = 0;
01811 
01812                                 FEDM_RETURN(iBack);
01813                         }
01814 
01815                         // save new buffered read mode data in iso-table
01816                         FEDM_CHK2(iErr, SetBrmTableData(0x22, &m_ucData[0]));
01817                 }
01818                 else
01819                 {
01820                         // reset BRM-table
01821                         m_uiBRMTableLength = 0;
01822                 }
01823                 break;
01824         
01825         case 0x31:
01826                 iBack = FEISC_0x31_ReadDataBufferInfo( m_iReaderHnd, 
01827                                                                                            m_ucBusAdr, 
01828                                                                                            &ucValue[0], 
01829                                                                                            &ucValue[2], 
01830                                                                                            &ucValue[4], 
01831                                                                                            0 );
01832 
01833                 if( iBack==0x00 || iBack==0x84 || iBack==0x85 || iBack==0x90 || iBack==0x93 )
01834                 {
01835                         FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_TAB_SIZE,        &ucValue[0], 2));
01836                         FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_TAB_START,       &ucValue[2], 2));
01837                         FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_TAB_LEN,         &ucValue[4], 2));
01838                 }
01839                 else
01840                 {
01841                         if(iBack) 
01842                                 FEDM_RETURN(iBack);
01843                 }
01844                 break;
01845         
01846         case 0x32:
01847                 iBack = FEISC_0x32_ClearDataBuffer( m_iReaderHnd, m_ucBusAdr );
01848                 break;
01849         
01850         case 0x33:
01851                 iBack = FEISC_0x33_InitBuffer( m_iReaderHnd, m_ucBusAdr );
01852                 break;
01853         
01854         case 0x34:
01855                 iBack = FEISC_0x34_ForceNotifyTrigger( m_iReaderHnd, m_ucBusAdr, 0 );
01856                 break;
01857         
01858         case 0x35:
01859                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x35_MODE, &ucValue[0]));
01860                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x35_OPTION, &ucValue[1]));
01861                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x35_CYCLE, &ucValue[2]));
01862                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x35_CYCLE_TIMEOUT, &uiValue[0]));
01863                 iBack = FEISC_0x35_SoftwareTrigger( m_iReaderHnd, m_ucBusAdr, ucValue[0], ucValue[1], ucValue[2], uiValue[0] );
01864                 break;
01865         
01866         case 0x52:
01867                 iBack = FEISC_0x52_GetBaud( m_iReaderHnd, m_ucBusAdr );
01868                 break;
01869         
01870         case 0x55:
01871                 iBack = FEISC_0x55_StartFlashLoaderEx( m_iReaderHnd, m_ucBusAdr );
01872                 break;
01873         
01874         case 0x63:
01875                 iBack = FEISC_0x63_CPUReset( m_iReaderHnd, m_ucBusAdr );
01876 
01877                 // we must wait for Reader finishing CPU-Reset
01878 #ifdef _FEDM_USB_SUPPORT
01879                 HandleUsbEnumeration();
01880 #endif
01881                 break;
01882         
01883         case 0x64:
01884                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_SYSTEM_RESET_MODE, &ucValue[0]));
01885                 iBack = FEISC_0x64_SystemReset( m_iReaderHnd, m_ucBusAdr, ucValue[0] );
01886 
01887                 // we must wait for Reader finishing CPU-Reset
01888 #ifdef _FEDM_USB_SUPPORT
01889                 HandleUsbEnumeration();
01890 #endif
01891                 break;
01892         
01893         case 0x65:
01894                 iBack = FEISC_0x65_SoftVersion( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
01895                 if(iBack == 0x80)
01896                 {
01897                         // command not available is the status, if a Reader doesn't support Standard Frames
01898                         // we switch to Advanced Frame and repeat the command
01899                         SetProtocolFrameSupport(FEDM_PRT_FRAME_ADVANCED);
01900                         iBack = FEISC_0x65_SoftVersion( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
01901                 }
01902                 
01903                 if(iBack!=0x00 && iBack!=0x84 && iBack!=0xF1)
01904                 {
01905                         FEDM_RETURN(iBack);
01906                 }
01907 
01908                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_SOFTVER, &ucValue[0], 16));
01909                 // save reader type in member attribute m_ucReaderType
01910                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_SOFTVER_SW_TYPE, &ucValue[0]));
01911                 if(ucValue[0] & 0x80)
01912                 {
01913                         // reader class: read more information
01914                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_READER_INFO_MODE, (unsigned char)0x00));
01915                         iBack = SendProtocol(0x66);
01916                 }
01917                 else
01918                 {
01919                         FEDM_CHK2(iErr, SetReaderType((unsigned int)ucValue[0]));
01920                 }
01921                 break;
01922         
01923         case 0x66:
01924                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_READER_INFO_MODE, &ucValue[0]));
01925                 iBack = FEISC_0x66_ReaderInfo( m_iReaderHnd, m_ucBusAdr, ucValue[0], m_ucData, 0 );
01926                 if(iBack == 0x80 && (ucValue[0]==0x00 || ucValue[0]==0xFF))
01927                 {
01928                         // command not available in the status, if a Reader doesn't support Standard Frames
01929                         // we switch to Advanced Frame and repeat the command
01930                         SetProtocolFrameSupport(FEDM_PRT_FRAME_ADVANCED);
01931                         iBack = FEISC_0x66_ReaderInfo( m_iReaderHnd, m_ucBusAdr, ucValue[0], m_ucData, 0 );
01932                 }
01933                 
01934                 if(iBack!=0x00 && iBack!=0x84 && iBack!=0xF1)
01935                         FEDM_RETURN(iBack);
01936 
01937                 switch(ucValue[0])
01938                 {
01939                 case 0x00: // RF-Controller
01940                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_SOFTVER, &m_ucData[0], 16));
01941                         FEDM_CHK2(iErr, SetData(FEDM_GetAdrOfID(FEDM_ISC_TMP_READER_INFO, 32), &m_ucData[0], 31, FEDM_TMPDATA_MEM));
01942                         FEDM_CHK2(iErr, Set_0x66_ReaderInfoData(ucValue[0], m_ucData));
01943                         break;
01944 
01945                 case 0xFF: // all
01946                         FEDM_CHK2(iErr, Set_0x66_ReaderInfoData(ucValue[0], m_ucData));
01947                         break;
01948 
01949                 default:
01950                         FEDM_CHK2(iErr, SetData(FEDM_GetAdrOfID(FEDM_ISC_TMP_READER_INFO, 32), &m_ucData[0], 31, FEDM_TMPDATA_MEM));
01951                         FEDM_CHK2(iErr, Set_0x66_ReaderInfoData(ucValue[0], m_ucData));
01952                         break;
01953                 }
01954                 break;
01955         
01956 #if !defined(__BORLANDC__)
01957         case 0x68:
01958                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x68_CA_MODE, &ucValue[0]));
01959                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x68_CA_RES1, &ucValue[1]));
01960                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x68_CA_RES2, &ucValue[2]));
01961                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x68_CA_RES3, &ucValue[3]));
01962                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x68_CA_RES4, (unsigned int*)&iValue[0]));
01963                 
01964                 iBack = FEISC_0x68_ChannelAnalyze(      m_iReaderHnd, 
01965                                                                                         m_ucBusAdr,
01966                                                                                         ucValue[0],     // mode
01967                                                                                         ucValue[1],     // reserved
01968                                                                                         ucValue[2],     // reserved
01969                                                                                         ucValue[3],     // reserved
01970                                                                                         iValue[0],      // reserved
01971                                                                                         m_nData );
01972                 if(iBack!=0x00 && iBack!=0x94)
01973                         FEDM_RETURN(iBack);
01974 
01975                 FEDM_CHK2(iErr, SetCADTableData(ucValue[0], m_nData));
01976                 break;
01977 #endif
01978 
01979         case 0x69:
01980                 iBack = FEISC_0x69_RFReset( m_iReaderHnd, m_ucBusAdr );
01981                 if(iBack==0)
01982                 {
01983                         // remove a selection flag inside ISO table
01984                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
01985                         if(iIdx >= 0)
01986                                 m_ISOTable[iIdx]->m_bIsSelected = false;
01987                 }
01988                 break;
01989         
01990         case 0x6A:
01991                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_RF_ONOFF, &ucValue[0]));
01992                 iBack = FEISC_0x6A_RFOnOff( m_iReaderHnd, m_ucBusAdr, ucValue[0] );
01993                 break;
01994         
01995         case 0x6B:
01996                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x6B_MODE, &ucValue[0]));
01997                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x6B_TX_CHANNEL, &ucValue[1]));
01998                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x6B_TX_PERIOD, &uiValue[0]));
01999                 iBack = FEISC_0x6B_CentralizedRFSync(   m_iReaderHnd, 
02000                                                                                                 m_ucBusAdr, 
02001                                                                                                 ucValue[0], // mode byte
02002                                                                                                 ucValue[1], // RF transmit channel
02003                                                                                                 uiValue[0], // RF transmit period
02004                                                                                                 0,                      // reserved
02005                                                                                                 0 );            // reserved
02006                 break;
02007         
02008         case 0x6C:
02009                 FEDM_CHK2(iErr, GetData(FEDM_ISCLR_TMP_NOISE_LEVEL, &ucValue[0], 6));
02010                 iBack = FEISC_0x6C_SetNoiseLevel( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
02011                 break;
02012         
02013         case 0x6D:
02014                 iBack = FEISC_0x6D_GetNoiseLevel( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
02015                 if(iBack!=0x00 && iBack!=0x84)
02016                         FEDM_RETURN(iBack);
02017 
02018                 FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_NOISE_LEVEL, &ucValue[0], 6));
02019                 break;
02020         
02021         case 0x6E:
02022                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DIAG_MODE, &ucValue[0]));
02023                 if(ucValue[0] == 0x21)
02024                 {
02025                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DIAG_REQ_DATA, &m_ucData[0]));
02026                 }
02027                 iBack = FEISC_0x6E_RdDiag( m_iReaderHnd, m_ucBusAdr, ucValue[0], &m_ucData[0] );
02028                 if(iBack!=0x00 && iBack!=0x84)
02029                         FEDM_RETURN(iBack);
02030                 
02031                 if(ucValue[0] == 0xFF)
02032                 {
02033                         FEDM_CHK2(iErr, Set_0x6E_ReaderDiagnosticData(ucValue[0], m_ucData));
02034                 }
02035                 else
02036                 {
02037                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DIAG_DATA, &m_ucData[0], 31));
02038                         FEDM_CHK2(iErr, Set_0x6E_ReaderDiagnosticData(ucValue[0], m_ucData));
02039                 }
02040 
02041                 break;
02042         
02043         case 0x6F:
02044                 iBack = FEISC_0x6F_AntennaTuning( m_iReaderHnd, m_ucBusAdr );
02045                 break;
02046         
02047         case 0x71:
02048                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_OUT_OS,            &uiValue[0]));
02049                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_OUT_OSF,           &uiValue[1]));
02050                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_OUT_OSTIME,        &uiValue[2]));
02051                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_OUT_OUTTIME,       &uiValue[3]));
02052                 
02053                 iBack = FEISC_0x71_SetOutput( m_iReaderHnd, 
02054                                                                           m_ucBusAdr, 
02055                                                                           uiValue[0], 
02056                                                                           uiValue[1], 
02057                                                                           (int)uiValue[2], 
02058                                                                           (int)uiValue[3] );
02059 
02060                 break;
02061         
02062         case 0x72:
02063                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x72_OUT_MODE,     &ucValue[0]));
02064                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x72_OUT_N,        &ucValue[1]));
02065                 FEDM_CHK2(iErr, Get_0x72_OutputData(ucValue[1], &ucValue[2]));
02066                 
02067                 iBack = FEISC_0x72_SetOutput( m_iReaderHnd, 
02068                                                                           m_ucBusAdr, 
02069                                                                           ucValue[0], 
02070                                                                           ucValue[1], 
02071                                                                           &ucValue[2] );
02072 
02073                 break;
02074         
02075         case 0x74:
02076                 iBack = FEISC_0x74_ReadInput( m_iReaderHnd, m_ucBusAdr, &ucValue[0] );
02077                 if(iBack!=0x00 && iBack!=0x84)
02078                         FEDM_RETURN(iBack);
02079 
02080                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_INP_STATE, ucValue[0]));
02081                 break;
02082         
02083         case 0x75:
02084                 iBack = FEISC_0x75_AdjAntenna( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
02085                 if(iBack!=0x00 && iBack!=0xF1)
02086                         FEDM_RETURN(iBack);
02087 
02088                 FEDM_CHK2(iErr, SetData(FEDM_ISCM_TMP_ANTENNA_VALUE, &ucValue[0], 2));
02089                 break;
02090         
02091         case 0x76:
02092                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x76_MODE, &ucValue[0]));
02093                 iBack = FEISC_0x76_CheckAntennas( m_iReaderHnd, m_ucBusAdr, ucValue[0], &ucValue[1], &iValue[0] );
02094                 if(iBack!=0x00)
02095                         FEDM_RETURN(iBack);
02096 
02097                 if(iValue[0] > 0)
02098                 {
02099                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_ANTENNA_OUT, &ucValue[1], 5));
02100                 }
02101                 break;
02102         
02103         case 0x80:
02104                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_READ_CFG,          &ucValue[0]));
02105                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_READ_CFG_ADR,      &ucValue[1]));
02106                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_READ_CFG_LOC,      &ucValue[2]));
02107                 iBack = FEISC_0x80_ReadConfBlock( m_iReaderHnd, m_ucBusAdr, ucValue[0], &ucValue[3], 0 );
02108                 if(iBack!=0x00 && iBack!=0x17 && iBack!=0x18 && iBack!=0x84 && iBack!=0xF1)
02109                         FEDM_RETURN(iBack);
02110 
02111                 // save new configuration data in RAM or EEPROM memory
02112                 switch(ucValue[2])
02113                 {
02114                 case 0x00:      // RAM
02115 //                      for( iCnt=0; iCnt<14; iCnt++ )
02116 //                              m_RFC_RAMData[16*ucValue[1]+iCnt] = ucValue[3+iCnt];
02117                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02118                                 m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1] + iCnt] = ucValue[3+iCnt];
02119                         
02120                         // mark cfg block as read with a 0x01 in last (unused) byte
02121                         // unmark cfg block as modified
02122                         //m_RFC_RAMData[16*ucValue[1]+15] = 0x01;
02123                         m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1] + m_iRFC_DataBlockSize-1] = 0x01;
02124                         break;
02125                 case 0x01:      // EEPROM
02126 //                      for( iCnt=0; iCnt<14; iCnt++ )
02127 //                              m_RFC_EEData[16*ucValue[1]+iCnt] = ucValue[3+iCnt];
02128                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02129                                 m_RFC_EEData[m_iRFC_DataBlockSize*ucValue[1] + iCnt] = ucValue[3+iCnt];
02130                         
02131                         // mark cfg block as read with a 0x01 in last (unused) byte
02132                         // unmark cfg block as modified
02133 //                      m_RFC_EEData[16*ucValue[1]+15] = 0x01;
02134                         m_RFC_EEData[m_iRFC_DataBlockSize*ucValue[1] + m_iRFC_DataBlockSize-1] = 0x01;
02135                         break;
02136                 }
02137                 break;
02138 
02139         case 0x81:
02140                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_WRITE_CFG,  &ucValue[0]));
02141                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_WRITE_CFG_ADR, &ucValue[1]));
02142                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_WRITE_CFG_LOC, &ucValue[2]));
02143                 switch(ucValue[2])
02144                 {
02145                 case 0x00: // RAM
02146                         if(!m_bDisableReadCfgBeforeWriteCfg)
02147                         {
02148 //                              if( (m_RFC_RAMData[16*ucValue[1]+15] & 0x01) == 0x00)
02149                                 if( (m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1]+m_iRFC_DataBlockSize-1] & 0x01) == 0x00)
02150                                 {
02151                                         FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02152                                 }
02153                         }
02154 
02155 //                      for( iCnt=0; iCnt<14; iCnt++ )
02156 //                              ucValue[3+iCnt] = m_RFC_RAMData[16*ucValue[1]+iCnt];
02157                         for( iCnt=0; iCnt<m_iRFC_DataBlockSize-2; iCnt++ )
02158                                 ucValue[3+iCnt] = m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1]+iCnt];
02159                         break;
02160                 case 0x01: // RAM and EEPROM
02161                         if(!m_bDisableReadCfgBeforeWriteCfg)
02162                         {
02163 //                              if( (m_RFC_EEData[16*ucValue[1]+15] & 0x01) == 0x00)
02164                                 if( (m_RFC_EEData[m_iRFC_DataBlockSize*ucValue[1]+m_iRFC_DataBlockSize-1] & 0x01) == 0x00)
02165                                 {
02166                                         FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02167                                 }
02168                         }
02169 
02170 //                      for( iCnt=0; iCnt<14; iCnt++ )
02171 //                              ucValue[3+iCnt] = m_RFC_EEData[16*ucValue[1]+iCnt];
02172                         for( iCnt=0; iCnt<m_iRFC_DataBlockSize-2; iCnt++ )
02173                                 ucValue[3+iCnt] = m_RFC_EEData[m_iRFC_DataBlockSize*ucValue[1]+iCnt];
02174                         break;
02175                 }
02176                 
02177                 iBack = FEISC_0x81_WriteConfBlock( m_iReaderHnd, m_ucBusAdr, ucValue[0], &ucValue[3], 0 );
02178                 if(iBack == 0x00 || iBack == 0x16)
02179                 {
02180                         switch(ucValue[2])
02181                         {
02182                         case 0x00: // RAM
02183 //                              m_RFC_RAMData[16*ucValue[1]+15] &= (~0x02); // unmark as modified
02184                                 m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1]+m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02185                                 break;
02186                         case 0x01: // RAM and EEPROM
02187 //                              m_RFC_EEData[16*ucValue[1]+15] &= (~0x02); // unmark as modified
02188 //                              m_RFC_RAMData[16*ucValue[1]+15] &= (~0x02); // unmark as modified
02189                                 m_RFC_EEData[m_iRFC_DataBlockSize*ucValue[1]+m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02190                                 m_RFC_RAMData[m_iRFC_DataBlockSize*ucValue[1]+m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02191                                 break;
02192                         }
02193                 }
02194 
02195                 break;
02196 
02197         case 0x82:
02198                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_SAVE_CFG, &ucValue[0]));
02199                 iBack = FEISC_0x82_SaveConfBlock( m_iReaderHnd, m_ucBusAdr, ucValue[0] );
02200                 break;
02201         
02202         case 0x83:
02203                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_RESET_CFG, &ucValue[0]));
02204                 iBack = FEISC_0x83_ResetConfBlock( m_iReaderHnd, m_ucBusAdr, ucValue[0] );
02205                 break;
02206 
02207         case 0x85:
02208                 FEDM_CHK2(iErr, GetData(FEDM_ISCLR_TMP_TIME, &ucValue[0], 4));
02209                 iBack = FEISC_0x85_SetSysTimer( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
02210                 break;
02211 
02212         case 0x86:
02213                 iBack = FEISC_0x86_GetSysTimer( m_iReaderHnd, m_ucBusAdr, &ucValue[0], 0 );
02214                 if(iBack!=0x00 && iBack!=0x84)
02215                         FEDM_RETURN(iBack);
02216 
02217                 FEDM_CHK2(iErr, SetData(FEDM_ISCLR_TMP_TIME, &ucValue[0], 4));
02218                 break;
02219 
02220         case 0x87:
02221                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_CENTURY,      &ucValue[0]));
02222                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_YEAR,         &ucValue[1]));
02223                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_MONTH,        &ucValue[2]));
02224                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_DAY,          &ucValue[3]));
02225                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_TIMEZONE,     &ucValue[4]));
02226                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_HOUR,         &ucValue[5]));
02227                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_MINUTE,       &ucValue[6]));
02228                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_DATE_MILLISECOND,  &uiValue[0]));
02229 
02230                 iBack = FEISC_0x87_SetSystemDate(       m_iReaderHnd, 
02231                                                                                         m_ucBusAdr, 
02232                                                                                         ucValue[0], 
02233                                                                                         ucValue[1], 
02234                                                                                         ucValue[2], 
02235                                                                                         ucValue[3], 
02236                                                                                         ucValue[4], 
02237                                                                                         ucValue[5], 
02238                                                                                         ucValue[6], 
02239                                                                                         (int)uiValue[0] );
02240                 break;
02241 
02242         case 0x88:
02243                 iBack = FEISC_0x88_GetSystemDate(       m_iReaderHnd, 
02244                                                                                         m_ucBusAdr, 
02245                                                                                         &ucValue[0], 
02246                                                                                         &ucValue[1], 
02247                                                                                         &ucValue[2], 
02248                                                                                         &ucValue[3], 
02249                                                                                         &ucValue[4], 
02250                                                                                         &ucValue[5], 
02251                                                                                         &ucValue[6], 
02252                                                                                         (int*)&uiValue[0] );
02253                 if(iBack!=0x00 && iBack!=0x84)
02254                         FEDM_RETURN(iBack);
02255 
02256                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_CENTURY,      ucValue[0]));
02257                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_YEAR,         ucValue[1]));
02258                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_MONTH,        ucValue[2]));
02259                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_DAY,          ucValue[3]));
02260                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_TIMEZONE,     ucValue[4]));
02261                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_HOUR,         ucValue[5]));
02262                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_MINUTE,       ucValue[6]));
02263                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_DATE_MILLISECOND,  uiValue[0]));
02264                 break;
02265         
02266         case 0x8A:
02267                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8A_READ_DEVICE,          &ucValue[0]));
02268                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8A_READ_BANK,            &ucValue[1]));
02269                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8A_READ_MODE,            &ucValue[2]));
02270                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8A_READ_REQ_CFG_ADR,     (unsigned int*)&iValue[0]));
02271                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8A_READ_REQ_CFG_N,       &ucValue[3]));
02272 
02273                 iBack = FEISC_0x8A_ReadConfiguration(   m_iReaderHnd, 
02274                                                                                                 m_ucBusAdr, 
02275                                                                                                 ucValue[0],             // in: device
02276                                                                                                 ucValue[1],             // in: bank
02277                                                                                                 ucValue[2],             // in: mode
02278                                                                                                 (unsigned int)iValue[0],                // in: first block address
02279                                                                                                 ucValue[3],             // in: number of blocks
02280                                                                                                 &ucValue[4],    // out: number of blocks
02281                                                                                                 &ucValue[5],    // out: blocksize
02282                                                                                                 m_ucData );             // out: configuration data
02283 
02284                 if(iBack!=0x00 && iBack!=0x17 && iBack!=0x18 && iBack!=0x84 && iBack!=0xF1)
02285                         FEDM_RETURN(iBack);
02286 
02287                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0x8A_READ_RSP_CFG_N,        ucValue[4]));
02288                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0x8A_READ_RSP_CFG_SIZE, ucValue[5]));
02289 
02290                 // save new configuration data in RAM or EEPROM memory
02291                 switch(ucValue[2] & 0x01)
02292                 {
02293                 case 0x00:      // RAM
02294                         if(ucValue[0] == FEDM_CNTRL_TYPE_RFC)
02295                         {
02296                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[4]); iBlockCnt++ )
02297                                 {
02298                                         uiAdr = (m_ucData[iBlockCnt * (ucValue[5]+2)] << 8) + m_ucData[iBlockCnt * (ucValue[5]+2)+1];
02299                                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02300                                                 m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02301                                         
02302                                         // mark cfg block as read with a 0x01 in last (unused) byte
02303                                         // unmark cfg block as modified
02304                                         m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] = 0x01;
02305                                 }
02306                         }
02307                         else if(ucValue[0] == FEDM_CNTRL_TYPE_ACC)
02308                         {
02309                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[4]); iBlockCnt++ )
02310                                 {
02311                                         uiAdr = (m_ucData[iBlockCnt * (ucValue[5]+2)] << 8) + m_ucData[iBlockCnt * (ucValue[5]+2)+1];
02312                                         if(uiAdr < 64)
02313                                         {
02314                                                 for( iCnt=0; iCnt<14; iCnt++ )
02315                                                         m_RFC_RAMData[16*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02316                                         
02317                                                 // mark cfg block as read with a 0x01 in last (unused) byte
02318                                                 // unmark cfg block as modified
02319                                                 m_RFC_RAMData[16*uiAdr + 15] = 0x01;
02320                                         }
02321                                         else
02322                                         {
02323                                                 for( iCnt=0; iCnt<(int)(ucValue[5]); iCnt++ )
02324                                                         m_ACC_RAMData[(int)(ucValue[5]+2)*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02325                                         
02326                                                 // mark cfg block as read with a 0x01 in last (unused) byte
02327                                                 // unmark cfg block as modified
02328                                                 m_ACC_RAMData[(int)(ucValue[5]+2)*uiAdr + (int)(ucValue[5]+1)] = 0x01;
02329                                         }
02330                                 }
02331                         }
02332                         break;
02333 
02334                 case 0x01:      // EEPROM
02335                         if(ucValue[0] == FEDM_CNTRL_TYPE_RFC)
02336                         {
02337                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[4]); iBlockCnt++ )
02338                                 {
02339                                         uiAdr = (m_ucData[iBlockCnt * (ucValue[5]+2)] << 8) + m_ucData[iBlockCnt * (ucValue[5]+2)+1];
02340                                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02341                                                 m_RFC_EEData[m_iRFC_DataBlockSize*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02342                                         
02343                                         // mark cfg block as read with a 0x01 in last (unused) byte
02344                                         // unmark cfg block as modified
02345                                         m_RFC_EEData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] = 0x01;
02346                                 }
02347                         }
02348                         else if(ucValue[0] == FEDM_CNTRL_TYPE_ACC)
02349                         {
02350                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[4]); iBlockCnt++ )
02351                                 {
02352                                         uiAdr = (m_ucData[iBlockCnt * (ucValue[5]+2)] << 8) + m_ucData[iBlockCnt * (ucValue[5]+2)+1];
02353                                         if(uiAdr < 64)
02354                                         {
02355                                                 for( iCnt=0; iCnt<14; iCnt++ )
02356                                                         m_RFC_EEData[16*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02357                                                 
02358                                                 // mark cfg block as read with a 0x01 in last (unused) byte
02359                                                 // unmark cfg block as modified
02360                                                 m_RFC_EEData[16*uiAdr + 15] = 0x01;
02361                                         }
02362                                         else
02363                                         {
02364                                                 for( iCnt=0; iCnt<(int)ucValue[5]; iCnt++ )
02365                                                         m_ACC_EEData[(int)(ucValue[5]+2)*uiAdr + iCnt] = m_ucData[2 + iBlockCnt * (ucValue[5]+2) + iCnt];
02366                                                 
02367                                                 // mark cfg block as read with a 0x01 in last (unused) byte
02368                                                 // unmark cfg block as modified
02369                                                 m_ACC_EEData[(int)(ucValue[5]+2)*uiAdr + (int)(ucValue[5]+1)] = 0x01;
02370                                         }
02371                                 }
02372                         }
02373                         break;
02374                 }
02375                 break;
02376 
02377         case 0x8B:
02378                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8B_WRITE_DEVICE,         &ucValue[0]));
02379                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8B_WRITE_BANK,           &ucValue[1]));
02380                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8B_WRITE_MODE,           &ucValue[2]));
02381                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8B_WRITE_CFG_N,          &ucValue[3]));
02382                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8B_WRITE_CFG_SIZE,       &ucValue[4]));
02383                 iTmpMemAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_0x8B_WRITE_CFG_ADR, 32);      // start address in memory
02384 
02385                 switch(ucValue[2] & 0x01)
02386                 {
02387                 case 0x00: // RAM
02388                         if(ucValue[0] == FEDM_CNTRL_TYPE_RFC)
02389                         {
02390                                 iByteCnt = 0;
02391                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[3]); iBlockCnt++ )
02392                                 {
02393                                         uiAdr = ((unsigned int)m_TmpData[iTmpMemAdr]<<8) + m_TmpData[iTmpMemAdr+1];
02394                                         if(!m_bDisableReadCfgBeforeWriteCfg)
02395                                         {
02396                                                 if( (m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] & 0x01) == 0x00)
02397                                                         FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02398                                         }
02399 
02400                                         // insert first CFG-ADR...
02401                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr];
02402                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr+1];
02403                                         iTmpMemAdr += 2;
02404 
02405                                         // ...then add CFG-DATA
02406                                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02407                                                 m_ucData[iByteCnt++] = m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + iCnt];
02408                                 }
02409                         }
02410                         else if(ucValue[0] == FEDM_CNTRL_TYPE_ACC)
02411                         {
02412                                 iByteCnt = 0;
02413                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[3]); iBlockCnt++ )
02414                                 {
02415                                         uiAdr = ((unsigned int)m_TmpData[iTmpMemAdr]<<8) + m_TmpData[iTmpMemAdr+1];
02416                                         if(uiAdr < 64)
02417                                         {
02418                                                 if(!m_bDisableReadCfgBeforeWriteCfg)
02419                                                 {
02420                                                         if( (m_RFC_RAMData[16*uiAdr + 15] & 0x01) == 0x00)
02421                                                                 FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02422                                                 }
02423                                         }
02424                                         else
02425                                         {
02426                                                 if(!m_bDisableReadCfgBeforeWriteCfg)
02427                                                 {
02428                                                         if( (m_ACC_RAMData[(int)(ucValue[4]+2)*uiAdr + (int)(ucValue[4]+1)] & 0x01) == 0x00)
02429                                                                 FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02430                                                 }
02431                                         }
02432 
02433                                         // insert first CFG-ADR...
02434                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr];
02435                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr+1];
02436                                         iTmpMemAdr += 2;
02437 
02438                                         // ...then add CFG-DATA
02439                                         if(uiAdr < 64)
02440                                         {
02441                                                 for( iCnt=0; iCnt<14; iCnt++ )
02442                                                         m_ucData[iByteCnt++] = m_RFC_RAMData[16*uiAdr + iCnt];
02443                                         }
02444                                         else
02445                                         {
02446                                                 for( iCnt=0; iCnt<(int)(ucValue[4]); iCnt++ )
02447                                                         m_ucData[iByteCnt++] = m_ACC_RAMData[(int)(ucValue[4]+2)*uiAdr + iCnt];
02448                                         }
02449                                 }
02450                         }
02451                         break;
02452 
02453                 case 0x01: // RAM and EEPROM
02454                         if(ucValue[0] == FEDM_CNTRL_TYPE_RFC)
02455                         {
02456                                 iByteCnt = 0;
02457                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[3]); iBlockCnt++ )
02458                                 {
02459                                         uiAdr = ((unsigned int)m_TmpData[iTmpMemAdr]<<8) + m_TmpData[iTmpMemAdr+1];
02460                                         if(!m_bDisableReadCfgBeforeWriteCfg)
02461                                         {
02462                                                 if( (m_RFC_EEData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] & 0x01) == 0x00)
02463                                                         FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02464                                         }
02465 
02466                                         // insert first CFG-ADR...
02467                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr];
02468                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr+1];
02469                                         iTmpMemAdr += 2;
02470 
02471                                         // ...then add CFG-DATA
02472                                         for( iCnt=0; iCnt<(m_iRFC_DataBlockSize-2); iCnt++ )
02473                                                 m_ucData[iByteCnt++] = m_RFC_EEData[m_iRFC_DataBlockSize*uiAdr + iCnt];
02474                                 }
02475                         }
02476                         else if(ucValue[0] == FEDM_CNTRL_TYPE_ACC)
02477                         {
02478                                 iByteCnt = 0;
02479                                 for( iBlockCnt=0; iBlockCnt<(int)(ucValue[3]); iBlockCnt++ )
02480                                 {
02481                                         uiAdr = ((unsigned int)m_TmpData[iTmpMemAdr]<<8) + m_TmpData[iTmpMemAdr+1];
02482                                         if(uiAdr < 64)
02483                                         {
02484                                                 if(!m_bDisableReadCfgBeforeWriteCfg)
02485                                                 {
02486                                                         if( (m_RFC_EEData[16*uiAdr + 15] & 0x01) == 0x00)
02487                                                                 FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02488                                                 }
02489                                         }
02490                                         else
02491                                         {
02492                                                 if(!m_bDisableReadCfgBeforeWriteCfg)
02493                                                 {
02494                                                         if( (m_ACC_EEData[(int)(ucValue[4]+2)*uiAdr + (int)(ucValue[4]+1)] & 0x01) == 0x00)
02495                                                                 FEDM_RETURN(FEDM_ERROR_CFG_BLOCK_PREVIOUSLY_NOT_READ);
02496                                                 }
02497                                         }
02498 
02499                                         // insert first CFG-ADR...
02500                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr];
02501                                         m_ucData[iByteCnt++] = m_TmpData[iTmpMemAdr+1];
02502                                         iTmpMemAdr += 2;
02503 
02504                                         // ...then add CFG-DATA
02505                                         if(uiAdr < 64)
02506                                         {
02507                                                 for( iCnt=0; iCnt<14; iCnt++ )
02508                                                         m_ucData[iByteCnt++] = m_RFC_EEData[16*uiAdr + iCnt];
02509                                         }
02510                                         else
02511                                         {
02512                                                 for( iCnt=0; iCnt<(int)(ucValue[4]); iCnt++ )
02513                                                         m_ucData[iByteCnt++] = m_ACC_EEData[(int)(ucValue[4]+2)*uiAdr + iCnt];
02514                                         }
02515                                 }
02516                         }
02517                         break;
02518                 }
02519 
02520                 iBack = FEISC_0x8B_WriteConfiguration(  m_iReaderHnd, 
02521                                                                                                 m_ucBusAdr, 
02522                                                                                                 ucValue[0],             // in: device
02523                                                                                                 ucValue[1],             // in: bank
02524                                                                                                 ucValue[2],             // in: mode
02525                                                                                                 ucValue[3],             // in: number of blocks
02526                                                                                                 ucValue[4],             // in: blocksize
02527                                                                                                 m_ucData );             // in: configuration data
02528 
02529                 if(iBack == 0x00 || iBack == 0x16)
02530                 {
02531                         iTmpMemAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_0x8B_WRITE_CFG_ADR, 32);      // start address in memory
02532                         iByteCnt = 0;
02533                         for( iBlockCnt=0; iBlockCnt<(int)(ucValue[3]); iBlockCnt++ )
02534                         {
02535                                 uiAdr = ((unsigned int)m_TmpData[iTmpMemAdr]<<8) + m_TmpData[iTmpMemAdr+1];
02536                                 iTmpMemAdr += 2;
02537 
02538                                 if(ucValue[0] == FEDM_CNTRL_TYPE_RFC)
02539                                 {
02540                                         switch(ucValue[2])
02541                                         {
02542                                         case 0x00: // RAM
02543                                                 m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02544                                                 break;
02545                                         case 0x01: // RAM and EEPROM
02546                                                 m_RFC_RAMData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02547                                                 m_RFC_EEData[m_iRFC_DataBlockSize*uiAdr + m_iRFC_DataBlockSize-1] &= (~0x02); // unmark as modified
02548                                                 break;
02549                                         }
02550                                 }
02551                                 else if(ucValue[0] == FEDM_CNTRL_TYPE_ACC)
02552                                 {
02553                                         if(uiAdr < 64)
02554                                         {
02555                                                 switch(ucValue[2])
02556                                                 {
02557                                                 case 0x00: // RAM
02558                                                         m_RFC_RAMData[16*uiAdr + 15] &= (~0x02); // unmark as modified
02559                                                         break;
02560                                                 case 0x01: // RAM and EEPROM
02561                                                         m_RFC_RAMData[16*uiAdr + 15] &= (~0x02); // unmark as modified
02562                                                         m_RFC_EEData[16*uiAdr + 15] &= (~0x02); // unmark as modified
02563                                                         break;
02564                                                 }
02565                                         }
02566                                         else
02567                                         {
02568                                                 switch(ucValue[2])
02569                                                 {
02570                                                 case 0x00: // RAM
02571                                                         m_ACC_RAMData[(int)(ucValue[4]+2)*uiAdr + (int)(ucValue[4]+1)] &= (~0x02); // unmark as modified
02572                                                         break;
02573                                                 case 0x01: // RAM and EEPROM
02574                                                         m_ACC_RAMData[(int)(ucValue[4]+2)*uiAdr + (int)(ucValue[4]+1)] &= (~0x02); // unmark as modified
02575                                                         m_ACC_EEData[(int)(ucValue[4]+2)*uiAdr + (int)(ucValue[4]+1)] &= (~0x02); // unmark as modified
02576                                                         break;
02577                                                 }
02578                                         }
02579                                 }
02580                         }
02581                 }
02582                 break;
02583         
02584         case 0x8C:
02585                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8C_RESET_DEVICE,         &ucValue[0]));
02586                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8C_RESET_BANK,           &ucValue[1]));
02587                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8C_RESET_MODE,           &ucValue[2]));
02588                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8C_RESET_CFG_ADR,        (unsigned int*)&iValue[0]));
02589                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0x8C_RESET_CFG_N,          &ucValue[3]));
02590 
02591                 iBack = FEISC_0x8C_ResetConfiguration(  m_iReaderHnd, 
02592                                                                                                 m_ucBusAdr, 
02593                                                                                                 ucValue[0],             // in: device
02594                                                                                                 ucValue[1],             // in: bank
02595                                                                                                 ucValue[2],             // in: mode
02596                                                                                                 (unsigned int)iValue[0],                // in: block address
02597                                                                                                 ucValue[3] );   // in: number of blocks
02598                 break;
02599         
02600         case 0xA0:
02601                 FEDM_CHK2(iErr, GetData(FEDM_ISCLR_TMP_READER_PW, ucPW, 4));
02602                 iBack = FEISC_0xA0_RdLogin( m_iReaderHnd, m_ucBusAdr, ucPW, 0 );
02603                 break;
02604         
02605         case 0xA2:
02606                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_ISO14443A_KEY_TYPE, &ucValue[0]));
02607                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_ISO14443A_KEY_ADR, &ucValue[1]));
02608                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_ISO14443A_KEY, &ucValue[2], 6));
02609                 iBack = FEISC_0xA2_WriteMifareKeys( m_iReaderHnd, 
02610                                                                                         m_ucBusAdr, 
02611                                                                                         ucValue[0], 
02612                                                                                         ucValue[1], 
02613                                                                                         &ucValue[2], 
02614                                                                                         0 );
02615                 break;
02616         
02617         case 0xA3:
02618                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xA3_MODE, &ucValue[0]));
02619                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xA3_KEY_INDEX, &ucValue[1]));
02620                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xA3_AUTHENTICATE_MODE, &ucValue[2]));
02621                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xA3_KEY_LEN, &ucValue[3]));
02622                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xA3_KEY, &ucValue[4], ucValue[3]));
02623                 iBack = FEISC_0xA3_Write_DES_AES_Keys(  m_iReaderHnd, 
02624                                                                                                 m_ucBusAdr, 
02625                                                                                                 ucValue[0], 
02626                                                                                                 ucValue[1], 
02627                                                                                                 ucValue[2], 
02628                                                                                                 ucValue[3], 
02629                                                                                                 &ucValue[4], 
02630                                                                                                 0 );
02631                 break;
02632         
02633         case 0xAD:
02634                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAD_MODE, &ucValue[0]));
02635                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAD_KEY_TYPE, &ucValue[1]));
02636                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAD_KEY_LEN, &ucValue[2]));
02637                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAD_KEY, &ucValue[3], ucValue[2]));
02638                 iBack = FEISC_0xAD_WriteReaderAuthentKey(       m_iReaderHnd, 
02639                                                                                                         m_ucBusAdr, 
02640                                                                                                         ucValue[0], 
02641                                                                                                         ucValue[1], 
02642                                                                                                         ucValue[2], 
02643                                                                                                         &ucValue[3], 
02644                                                                                                         0 );
02645                 break;
02646         
02647         case 0xAE:
02648                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAE_MODE, &ucValue[0]));
02649                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAE_KEY_TYPE, &ucValue[1]));
02650                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAE_KEY_LEN, &ucValue[2]));
02651                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xAE_KEY, &ucValue[3], ucValue[2]));
02652                 iBack = FEISC_0xAE_ReaderAuthent(       m_iReaderHnd, 
02653                                                                                         m_ucBusAdr, 
02654                                                                                         ucValue[0], 
02655                                                                                         ucValue[1], 
02656                                                                                         ucValue[2], 
02657                                                                                         &ucValue[3], 
02658                                                                                         0 );
02659                 break;
02660 
02661         case 0xB0:
02662                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucIsoCmd));
02663                 FEDM_CHK2(iLen, Get_0xB0_IsoTableData(ucIsoCmd, &m_ucData[0]));
02664 
02665                 iBack = FEISC_0xB0_ISOCmd( m_iReaderHnd, 
02666                                                                    m_ucBusAdr, 
02667                                                                    &m_ucData[0], 
02668                                                                    iLen, 
02669                                                                    &m_ucData[0], 
02670                                                                    &iLen, 
02671                                                                    0 );
02672 
02673                 // evaluate status byte
02674                 if( iBack==0x00 ||      // ok
02675                         iBack==0x01 ||  // no transponder
02676                         iBack==0x02 ||  // data false
02677                         iBack==0x03 ||  // write error
02678                         iBack==0x83 ||  // rf communication error
02679                         iBack==0x84 ||  // rf warning
02680                         iBack==0x90 ||  // no valid data
02681                         iBack==0x93 ||  // data buffer overflow
02682                         iBack==0x94 ||  // more data
02683                         iBack==0x95 )   // tag error
02684                 {       
02685                         if(iBack == 0x01)
02686                         {
02687                                 // if command in selected mode and transponder doesn't respond
02688                                 // then remove selection flag
02689                                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B0_MODE_ADR, &ucIsoMode));
02690                                 if(ucIsoMode == FEDM_ISC_ISO_MODE_SEL)
02691                                 {
02692                                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
02693                                         if(iIdx >= 0)
02694                                                 m_ISOTable[iIdx]->m_bIsSelected = false;
02695                                 }
02696                         }
02697                         else if(iBack == 0x02)
02698                         {
02699                                 if (ucIsoCmd == 0x01) // exception for Inventory
02700                                 {
02701                                         // save new transponder data in iso-table
02702                                         FEDM_CHK2(iErr, Set_0xB0_IsoTableData(&m_ucData[0], iLen, iBack));
02703                                 }
02704                                 else
02705                                 {
02706                                         FEDM_RETURN(iBack);
02707                                 }
02708                         }
02709                         else if(iBack == 0x03)
02710                         {
02711                                 // additional data with
02712                                 // [0x22] Lock Multiple Blocks or 
02713                                 // [0x24] Write Multiple Blocks
02714                                 if( ucIsoCmd==0x22 || ucIsoCmd==0x24 )
02715                                 {
02716                                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
02717                                         if(bExtAdr)
02718                                         {
02719                                                 // verify data length (some old readers don't support additional bytes)
02720                                                 if(iLen == 2)
02721                                                 {
02722                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_EXT_ADR_E, &m_ucData[0], 2));
02723                                                 }
02724                                                 else
02725                                                 {
02726                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_ADR_E, m_ucData[0]));
02727                                                 }
02728                                         }
02729                                         else
02730                                         {
02731                                                 // verify data length (some old readers don't support additional bytes)
02732                                                 if(iLen == 1)
02733                                                 {
02734                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_ADR_E, m_ucData[0]));
02735                                                 }
02736                                         }
02737                                 }
02738                         }
02739                         else if(iBack == 0x95)
02740                         {
02741                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iBack));
02742                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_ISO_ERROR, m_ucData[0]));
02743 
02744                                 // additional data with
02745                                 // [0x22] Lock Multiple Blocks or 
02746                                 // [0x24] Write Multiple Blocks
02747                                 if( ucIsoCmd==0x22 || ucIsoCmd==0x24 )
02748                                 {
02749                                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
02750                                         if(bExtAdr)
02751                                         {
02752                                                 // verify data length (some old readers don't support additional bytes)
02753                                                 if(iLen == 3)
02754                                                 {
02755                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_EXT_ADR_E, &m_ucData[1], 2));
02756                                                 }
02757                                                 else
02758                                                 {
02759                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_ADR_E, m_ucData[1]));
02760                                                 }
02761                                         }
02762                                         else
02763                                         {
02764                                                 // verify data length (some old readers don't support additional bytes)
02765                                                 if(iLen == 2)
02766                                                 {
02767                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_ADR_E, m_ucData[1]));
02768                                                 }
02769                                         }
02770                                 }
02771                         }
02772                         else
02773                         {
02774                                 // save new transponder data in iso-table
02775                                 FEDM_CHK2(iErr, Set_0xB0_IsoTableData(&m_ucData[0], iLen, iBack));
02776                         }
02777                 }
02778                 else
02779                 {
02780                         FEDM_RETURN(iBack);
02781                 }
02782                 
02783                 break;
02784         
02785         case 0xB1:
02786                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B1_MFR, &ucValue[0]));
02787                 switch(ucValue[0])
02788                 {
02789                 case FEDM_ISC_ISO_MFR_NXP:
02790                 case FEDM_ISC_ISO_MFR_TI:
02791                 case FEDM_ISC_ISO_MFR_STM:
02792                 case FEDM_ISC_ISO_MFR_EM:
02793                 case FEDM_ISC_ISO_MFR_FUJITSU:
02794                 case FEDM_ISC_ISO_MFR_KSW:
02795                 case FEDM_ISC_ISO_MFR_INFINEON:
02796                 case FEDM_ISC_ISO_MFR_IDS:
02797                         break;
02798                 default:
02799                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0xB1, Manufacturer=0x" << std::hex << std::uppercase << (int)ucValue[0] << ") - is not supported");
02800                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
02801                 }
02802                         
02803                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_CMD, &ucIsoCmd));
02804                 FEDM_CHK2(iLen, Get_0xB1_IsoTableData(ucIsoCmd, &m_ucData[0]));
02805                 
02806                 iBack = FEISC_0xB1_ISOCustAndPropCmd( m_iReaderHnd, 
02807                                                                                           m_ucBusAdr, 
02808                                                                                           ucValue[0], // mfr
02809                                                                                           &m_ucData[0], 
02810                                                                                           iLen, 
02811                                                                                           &m_ucData[0], 
02812                                                                                           &iLen, 
02813                                                                                           0 );
02814 
02815                 if(iBack == 0x00)
02816                 {
02817                         FEDM_CHK2(iErr, Set_0xB1_IsoTableData(ucIsoCmd, &m_ucData[0], iLen));
02818                 }
02819                 else if(iBack == 0x01)
02820                 {
02821                         // if command in selected mode and transponder doesn't respond
02822                         // then remove selection flag
02823                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B1_MODE_ADR, &ucIsoMode));
02824                         if(ucIsoMode == FEDM_ISC_ISO_MODE_SEL)
02825                         {
02826                                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
02827                                 if(iIdx >= 0)
02828                                         m_ISOTable[iIdx]->m_bIsSelected = false;
02829                         }
02830                 }
02831                 else if(iBack == 0x03)
02832                 {
02833                         // for Infineon:
02834                         // [0x30] Write
02835                         // [0x90] Write Byte
02836                         // [0xAB] Set Advanced Quiet Bit
02837                         if(iLen == 1)
02838                         {
02839                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B1_RSP_DB_ADR_E, m_ucData[0]));
02840                         }
02841                 }
02842                 else if(iBack == 0x95)
02843                 {
02844                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iBack));
02845                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B1_ISO_ERROR, m_ucData[0]));
02846                         // for Infineon:
02847                         // [0x30] Write
02848                         // [0x90] Write Byte
02849                         // [0xAB] Set Advanced Quiet Bit
02850                         if(iLen == 2)
02851                         {
02852                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B1_RSP_DB_ADR_E, m_ucData[1]));
02853                         }
02854                 }
02855 
02856                 break;
02857 
02858         case 0xB2:
02859                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucIsoCmd));
02860                 FEDM_CHK2(iLen, Get_0xB2_IsoTableData(ucIsoCmd, &m_ucData[0]));
02861 
02862                 iBack = FEISC_0xB2_ISOCmd( m_iReaderHnd, 
02863                                                                    m_ucBusAdr, 
02864                                                                    &m_ucData[0], 
02865                                                                    iLen, 
02866                                                                    &m_ucData[0], 
02867                                                                    &iLen, 
02868                                                                    0 );
02869                 
02870                 if(iBack == 0x00)
02871                 {
02872                         // save new transponder data in iso-table
02873                         FEDM_CHK2(iErr, Set_0xB2_IsoTableData(&m_ucData[0], iLen, iBack));
02874                 }
02875                 else if(iBack == 0x01)
02876                 {
02877                         // if command in selected mode and transponder doesn't respond
02878                         // then remove selection flag
02879                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B2_MODE_ADR, &ucIsoMode));
02880                         if(ucIsoMode == FEDM_ISC_ISO_MODE_SEL)
02881                         {
02882                                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
02883                                 if(iIdx >= 0)
02884                                         m_ISOTable[iIdx]->m_bIsSelected = false;
02885                         }
02886                 }
02887                 else if(iBack == 0x95)
02888                 {
02889                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iBack));
02890                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B2_ISO_ERROR, m_ucData[0]));
02891                 }
02892                 
02893                 break;
02894 
02895         case 0xB3:
02896                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucEpcCmd));
02897                 FEDM_CHK2(iLen, Get_0xB3_IsoTableData(ucEpcCmd, &m_ucData[0]));
02898         
02899                 iBack = FEISC_0xB3_EPCCmd( m_iReaderHnd, 
02900                                                                    m_ucBusAdr, 
02901                                                                    &m_ucData[0], 
02902                                                                    iLen, 
02903                                                                    &m_ucData[0], 
02904                                                                    &iLen, 
02905                                                                    0 );
02906 
02907                 if( iBack==0x00 || 
02908                         iBack==0x03 || 
02909                         iBack==0x83 || 
02910                         iBack==0x84 || 
02911                         iBack==0x90 || 
02912                         iBack==0x93 || 
02913                         iBack==0x94 || 
02914                         iBack==0x95 )
02915                 {       
02916                         if(iBack == 0x03)
02917                         {
02918                                 // additional data with
02919                                 // [0x24] Write Multiple Blocks
02920                                 if( ucEpcCmd==0x24 )
02921                                 {
02922                                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EXT_ADR, &bExtAdr));
02923                                         if(bExtAdr)
02924                                         {
02925                                                 // verify data length (some old readers don't support additional bytes)
02926                                                 if(iLen == 2)
02927                                                 {
02928                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_EXT_ADR_E, &m_ucData[0], 2));
02929                                                 }
02930                                                 else
02931                                                 {
02932                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_ADR_E, m_ucData[0]));
02933                                                 }
02934                                         }
02935                                         else
02936                                         {
02937                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_ADR_E, m_ucData[0]));
02938                                         }
02939                                 }
02940                         }
02941                         else if(iBack == 0x95)
02942                         {
02943                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iBack));
02944                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_TAG_ERROR, m_ucData[0]));
02945 
02946                                 // additional data with
02947                                 // [0x24] Write Multiple Blocks
02948                                 if( ucEpcCmd==0x24 )
02949                                 {
02950                                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EXT_ADR, &bExtAdr));
02951                                         if(bExtAdr)
02952                                         {
02953                                                 // verify data length (some old readers don't support additional bytes)
02954                                                 if(iLen == 3)
02955                                                 {
02956                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_EXT_ADR_E, &m_ucData[1], 2));
02957                                                 }
02958                                                 else
02959                                                 {
02960                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_ADR_E, m_ucData[1]));
02961                                                 }
02962                                         }
02963                                         else
02964                                         {
02965                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B3_RSP_DB_ADR_E, m_ucData[1]));
02966                                         }
02967                                 }
02968                         }
02969                         else
02970                         {
02971                                 // save data
02972                                 FEDM_CHK2(iErr, Set_0xB3_IsoTableData(&m_ucData[0], iLen, iBack));
02973                         }
02974                 }
02975                 else
02976                 {
02977                         FEDM_RETURN(iBack);
02978                 }
02979                 
02980                 break;
02981 
02982         case 0xB4:
02983                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B4_MFR, &ucValue[0]));
02984                 switch(ucValue[0])
02985                 {
02986                 case FEDM_ISC_ISO_MFR_NXP:
02987                 case FEDM_ISC_ISO_MFR_EM:
02988                 case FEDM_ISC_ISO_MFR_IDS:
02989                         break;
02990                 default:
02991                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0xB4), Manufacturer=0x" << std::hex << std::uppercase << (int)ucValue[0] << ") - is not supported");
02992                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
02993                 }
02994                         
02995                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B4_CMD, &ucEpcCmd));
02996                 FEDM_CHK2(iLen, Get_0xB4_IsoTableData(ucEpcCmd, &m_ucData[0]));
02997         
02998                 iBack = FEISC_0xB4_EPC_UHF_Cmd( m_iReaderHnd, 
02999                                                                                 m_ucBusAdr, 
03000                                                                                 ucValue[0],             // MFR
03001                                                                                 &m_ucData[0], 
03002                                                                                 iLen, 
03003                                                                                 &m_ucData[0], 
03004                                                                                 &iLen, 
03005                                                                                 0 );
03006 
03007                 if( iBack==0x00 || 
03008                         iBack==0x03 || 
03009                         iBack==0x83 || 
03010                         iBack==0x84 || 
03011                         iBack==0x90 || 
03012                         iBack==0x93 || 
03013                         iBack==0x94 || 
03014                         iBack==0x95 )
03015                 {       
03016                         if(iBack == 0x00)
03017                         {
03018                                 FEDM_CHK2(iErr, Set_0xB4_IsoTableData(ucEpcCmd, &m_ucData[0], iLen));
03019                         }
03020                         else if(iBack == 0x03)
03021                         {
03022                                 if(ucValue[0] == FEDM_ISC_ISO_MFR_NXP)
03023                                 {
03024                                         // additional data with
03025                                         // [0x00] Block Lock
03026                                         if( ucEpcCmd==0x00 )
03027                                         {
03028                                                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
03029                                                 if(bExtAdr)
03030                                                 {
03031                                                         // verify data length (some old readers don't support additional bytes)
03032                                                         if(iLen == 2)
03033                                                         {
03034                                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_EXT_ADR_E, &m_ucData[0], 2));
03035                                                         }
03036                                                         else
03037                                                         {
03038                                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_ADR_E, m_ucData[0]));
03039                                                         }
03040                                                 }
03041                                                 else
03042                                                 {
03043                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_ADR_E, m_ucData[0]));
03044                                                 }
03045                                         }
03046                                 }
03047                         }
03048                         else if(iBack == 0x95)
03049                         {
03050                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iBack));
03051                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_ISO_ERROR, m_ucData[0]));
03052 
03053                                 if(ucValue[0] == FEDM_ISC_ISO_MFR_NXP)
03054                                 {
03055                                         // additional data with
03056                                         // [0x00] Block Lock
03057                                         if( ucEpcCmd==0x00 )
03058                                         {
03059                                                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
03060                                                 if(bExtAdr)
03061                                                 {
03062                                                         // verify data length (some old readers don't support additional bytes)
03063                                                         if(iLen == 3)
03064                                                         {
03065                                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_EXT_ADR_E, &m_ucData[1], 2));
03066                                                         }
03067                                                         else
03068                                                         {
03069                                                                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_ADR_E, m_ucData[1]));
03070                                                         }
03071                                                 }
03072                                                 else
03073                                                 {
03074                                                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_B4_RSP_DB_ADR_E, m_ucData[1]));
03075                                                 }
03076                                         }
03077                                 }
03078                         }
03079                         else
03080                         {
03081                         }
03082                 }
03083                 else
03084                 {
03085                         FEDM_RETURN(iBack);
03086                 }
03087                 
03088                 break;
03089 
03090         case 0xC1:
03091                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_CMD, &ucDesFireCmd));
03092                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_MODE, &m_ucData[0]));
03093                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_APP_ID, &m_ucData[1], 3));
03094                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_INDEX, &m_ucData[4]));
03095                 FEDM_CHK2(iLen, Get_0xC1_IsoTableData(ucDesFireCmd, &m_ucData[5]));
03096         
03097                 iBack = FEISC_0xC1_DESFireCmd( m_iReaderHnd, 
03098                                                                            m_ucBusAdr, 
03099                                                                            ucDesFireCmd,        // sub command
03100                                                                            m_ucData[0],         // mode
03101                                                                            &m_ucData[1],        // application ID
03102                                                                            m_ucData[4],         // reader key index
03103                                                                            &m_ucData[5],        // request data
03104                                                                            iLen,
03105                                                                            &m_ucData[0], 
03106                                                                            &iLen,
03107                                                                            0 );
03108 
03109                 if( iBack==0x00 )
03110                 {
03111                         FEDM_CHK2(iErr, Set_0xC1_IsoTableData(ucDesFireCmd, &m_ucData[0], iLen));
03112                 }
03113                 else if( iBack==0x97 )
03114                 {
03115                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC1_ERROR_SOURCE, m_ucData[0]));
03116                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC1_ERROR_CODE, &m_ucData[1], 2));
03117                 }
03118                 else
03119                 {
03120                         FEDM_RETURN(iBack);
03121                 }
03122 
03123                 break;
03124 
03125         case 0xC2:
03126                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_CMD, &ucMifarePlusCmd));
03127                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_MODE, &m_ucData[0]));
03128                 FEDM_CHK2(iLen, Get_0xC2_IsoTableData(ucMifarePlusCmd, &m_ucData[1]));
03129         
03130                 iBack = FEISC_0xC2_MifarePlusCmd(       m_iReaderHnd, 
03131                                                                                         m_ucBusAdr, 
03132                                                                                         ucMifarePlusCmd,        // sub command
03133                                                                                         m_ucData[0],            // mode
03134                                                                                         &m_ucData[1],           // request data
03135                                                                                         iLen,
03136                                                                                         &m_ucData[0], 
03137                                                                                         &iLen,
03138                                                                                         0 );
03139 
03140                 if( iBack==0x00 )
03141                 {
03142                         FEDM_CHK2(iErr, Set_0xC2_IsoTableData(ucMifarePlusCmd, &m_ucData[0], iLen));
03143                 }
03144                 else if( iBack==0x97 )
03145                 {
03146                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC2_ERROR_SOURCE, m_ucData[0]));
03147                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC2_ERROR_CODE, &m_ucData[1], 2));
03148                 }
03149                 else
03150                 {
03151                         FEDM_RETURN(iBack);
03152                 }
03153 
03154                 break;
03155 
03156         case 0xC3:
03157                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_CMD, &ucDesFireCmd));
03158                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_MODE, &m_ucData[0]));
03159                 FEDM_CHK2(iLen, Get_0xC3_IsoTableData(ucDesFireCmd, m_ucData[0], &m_ucData[1]));
03160         
03161                 iBack = FEISC_0xC3_DESFireCmd( m_iReaderHnd, 
03162                                                                            m_ucBusAdr, 
03163                                                                            ucDesFireCmd,        // sub command
03164                                                                            m_ucData[0],         // mode
03165                                                                            &m_ucData[1],        // request data
03166                                                                            iLen,
03167                                                                            &m_ucData[0], 
03168                                                                            &iLen,
03169                                                                            0 );
03170 
03171                 if( iBack==0x00 )
03172                 {
03173                         FEDM_CHK2(iErr, Set_0xC3_IsoTableData(ucDesFireCmd, &m_ucData[0], iLen));
03174                 }
03175                 else if( iBack==0x97 )
03176                 {
03177                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC3_ERROR_SOURCE, m_ucData[0]));
03178                         FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC3_ERROR_CODE, &m_ucData[1], 2));
03179                 }
03180                 else
03181                 {
03182                         FEDM_RETURN(iBack);
03183                 }
03184 
03185                 break;
03186 
03187         default:
03188                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_CONTROL_BYTE));
03189                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_CONTROL_BYTE);
03190         }
03191 
03192         FEDM_RETURN(iBack);
03193 }
03194 
03195 
03196 /***************************************************************************
03197   Begin                 :       16.08.2000 / M. Hultsch
03198   Version               :       04.06.09 / 30.10.2014 / M. Hultsch
03199                                                 - support for new baudrates: 921600 and 460800
03200   
03201                                                 04.02.07 / 09.08.2012 / M. Hultsch
03202                                                 - return of crypto processing error
03203   
03204                                                 03.01.06 / 10.05.2010 / M. Hultsch
03205                                                 - new parameters cbFct and pAny
03206                                                 - iFrameSupport = 3
03207 
03208                                                 02.04.02 / 11.05.2006 / M. Hultsch
03209 
03210   Function                      :       find the baudrate and frame of reader
03211                                                 !!! no multi-threading !!!
03212                                                 !!! only for serial port !!!
03213 
03214   Parameters            :       bool* pStop                     - optional: when true, function returns at once
03215                                                 int iTimeout            - optional: timeout to be used (default: 300ms)
03216                                                 int iFrameSupport       - optional: protocol frame to be used (default: 2)
03217                                                                                                                 0: both protocol frames
03218                                                                                                                 1: only standard protocol frame
03219                                                                                                                 2: only advanced protocol frame
03220                                                                                                                 3: alternating, beginning with standard protocol frame
03221                                                 FEDM_CB_FIND_BAUDRATE cbFct     -       callback function (s. FEDM_DataBase.h) to signal application actual action
03222                                                 void* pAny                      - pointer to anything which is reflected as 1st parameter in cbFct
03223 
03224   Return value          :       OK (0) or error code (<0)
03225 
03226 ***************************************************************************/
03227 int FEDM_ISCReader::FindBaudRate(bool* pStop, int iTimeout, int iFrameSupport, FEDM_CB_FIND_BAUDRATE cbFct, void* pAny)
03228 {
03229 #ifdef _FEDM_COM_SUPPORT
03230         int             iBack = 0;
03231         int             iErr = 0;
03232         int             iPortHnd = 0;
03233         int             iPortNr = 0;
03234         char    cPortHnd[11];
03235         char    cTimeout[8];
03236         char    cOldBaud[8];
03237         char    cOldFrame[8];
03238         char    cOldTimeout[8];
03239         char    cPortNr[8];
03240         char*   baud[]  = { "921600", "460800", "230400", "115200", "57600", "38400", "19200", "9600", "4800" };
03241         char*   frame[] = { "8E1", "8N1", "8O1" };
03242 
03243         size_t uiNoOfBaudrates = sizeof(baud)/sizeof(baud[0]);
03244 
03245         if( m_iReaderHnd == 0 )
03246         {
03247                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_READER_HANDLE));
03248                 return FEDM_ERROR_NO_READER_HANDLE;
03249         }
03250 
03251         // get port handle from reader object
03252         FEDM_CHK1(iErr, FEISC_GetReaderPara( m_iReaderHnd, "PortHnd", cPortHnd ));
03253 
03254         iPortHnd = atoi( cPortHnd );
03255         if( iPortHnd == 0 )
03256         {
03257                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_PORT_HANDLE));
03258                 return FEDM_ERROR_NO_PORT_HANDLE;
03259         }
03260 
03261         if(FEDM_IS_USBPORT(iPortHnd) || FEDM_IS_TCPPORT(iPortHnd))
03262         {
03263                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED_PORT_DRIVER));
03264                 return FEDM_ERROR_UNSUPPORTED_PORT_DRIVER;
03265         }
03266 
03267         if(iTimeout < 0 || iTimeout > 99999)
03268         {
03269                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_PARAMETER));
03270                 return FEDM_ERROR_PARAMETER;
03271         }
03272 
03273         sprintf(cTimeout, "%d", iTimeout);
03274 
03275 #if !defined(_FEDM_SUPPORT_SLINK)
03276         LPFN_FECOM_GET_PORT_PARA lpfnGetPortPara = (LPFN_FECOM_GET_PORT_PARA)GetFeComFunction(FECOM_GET_PORT_PARA);
03277         LPFN_FECOM_SET_PORT_PARA lpfnSetPortPara = (LPFN_FECOM_SET_PORT_PARA)GetFeComFunction(FECOM_SET_PORT_PARA);
03278 
03279         FEDM_CHK5(lpfnGetPortPara);
03280         FEDM_CHK5(lpfnSetPortPara);
03281 
03282         // save actual baudrate
03283         FEDM_CHK1(iErr, lpfnGetPortPara( iPortHnd, "baud", cOldBaud ));
03284         // save actual frame
03285         FEDM_CHK1(iErr, lpfnGetPortPara( iPortHnd, "frame", cOldFrame ));
03286         // save actual timeout
03287         FEDM_CHK1(iErr, lpfnGetPortPara( iPortHnd, "timeout", cOldTimeout ));
03288         // get the port number
03289         FEDM_CHK1(iErr, lpfnGetPortPara( iPortHnd, "PortNr", cPortNr ));
03290 
03291         // reduce timeout
03292         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "timeout", cTimeout ));
03293 #else
03294         // save actual baudrate
03295         FEDM_CHK1(iErr, FECOM_GetPortPara( iPortHnd, "baud", cOldBaud ));
03296         // save actual frame
03297         FEDM_CHK1(iErr, FECOM_GetPortPara( iPortHnd, "frame", cOldFrame ));
03298         // save actual timeout
03299         FEDM_CHK1(iErr, FECOM_GetPortPara( iPortHnd, "timeout", cOldTimeout ));
03300         // get the port number
03301         FEDM_CHK1(iErr, FECOM_GetPortPara( iPortHnd, "PortNr", cPortNr ));
03302 
03303         // reduce timeout
03304         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "timeout", cTimeout ));
03305 #endif
03306 
03307         sscanf(cPortNr, "%d", &iPortNr);
03308 
03309         switch(iFrameSupport)
03310         {
03311         case 0:
03312                 break; // use the preset and change after first loop
03313         case FEDM_PRT_FRAME_STANDARD:
03314                 SetProtocolFrameSupport(FEDM_PRT_FRAME_STANDARD);
03315                 break;
03316         case FEDM_PRT_FRAME_ADVANCED:
03317                 SetProtocolFrameSupport(FEDM_PRT_FRAME_ADVANCED);
03318                 break;
03319         case 3:
03320                 SetProtocolFrameSupport(FEDM_PRT_FRAME_STANDARD);
03321                 break;
03322         }
03323 
03324         for( unsigned int k=0; k<2; k++) // try all protocol frame support (standard, advanced)
03325         {
03326                 for( unsigned int j=0; j<3; j++ )       // try all frames
03327                 {
03328                         if(pStop!=NULL && *pStop==true)
03329                                 break;
03330 
03331                         // set frame im Porttreiber setzen
03332 #if !defined(_FEDM_SUPPORT_SLINK)
03333                         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "frame", frame[j] ));
03334 #else
03335                         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "frame", frame[j] ));
03336 #endif
03337 
03338                         for( unsigned int i=0; i<uiNoOfBaudrates; i++ ) // try all baudrates
03339                         {
03340                                 if(pStop!=NULL && *pStop==true)
03341                                         break;
03342 
03343                                 // set baudrate in port driver
03344 #if !defined(_FEDM_SUPPORT_SLINK)
03345                                 iErr = lpfnSetPortPara( iPortHnd, "baud", baud[i] );
03346                                 if(iErr) // if baudrate not available, continue with next baudrate
03347                                         continue;
03348 #else
03349                                 iErr = FECOM_SetPortPara( iPortHnd, "baud", baud[i] );
03350                                 if(iErr) // if baudrate not available, continue with next baudrate
03351                                         continue;
03352 #endif
03353 
03354                                 if(iFrameSupport == 3) // alternating protocol frames
03355                                 {
03356                                         for( unsigned int h=0; h<2; h++ ) // try both protocol frames
03357                                         {
03358                                                 // optional message to user application
03359                                                 if(cbFct != NULL)
03360                                                         cbFct(pAny, iPortNr, m_ucBusAdr, baud[i], frame[j], GetProtocolFrameSupport());
03361 
03362                                                 // send test protocol [0x52]
03363                                                 iBack = SendProtocol(0x52);
03364                                                 if( iBack == 0 ||               // OK
03365                                                         iBack == 0x19 )         // crypto processing error
03366                                                 {
03367                                                         // restore timeout
03368 #if !defined(_FEDM_SUPPORT_SLINK)
03369                                                         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "timeout", cOldTimeout ));
03370 #else
03371                                                         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "timeout", cOldTimeout ));
03372 #endif
03373                                                         
03374                                                         return iBack;
03375                                                 }
03376 
03377                                                 if(GetProtocolFrameSupport() == FEDM_PRT_FRAME_STANDARD)
03378                                                         SetProtocolFrameSupport(FEDM_PRT_FRAME_ADVANCED);
03379                                                 else
03380                                                         SetProtocolFrameSupport(FEDM_PRT_FRAME_STANDARD);
03381 
03382                                         } // for( int h=0; h<2; h++ ) // try both protocol frames
03383                                 }
03384                                 else
03385                                 {
03386                                         // optional message to user application
03387                                         if(cbFct != NULL)
03388                                                 cbFct(pAny, iPortNr, m_ucBusAdr, baud[i], frame[j], GetProtocolFrameSupport());
03389 
03390                                         // send test protocol [0x52]
03391                                         iBack = SendProtocol(0x52);
03392                                         if( iBack == 0 ||               // OK
03393                                                 iBack == 0x19 )         // crypto processing error
03394                                         {
03395                                                 // restore timeout
03396 #if !defined(_FEDM_SUPPORT_SLINK)
03397                                                 FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "timeout", cOldTimeout ));
03398 #else
03399                                                 FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "timeout", cOldTimeout ));
03400 #endif
03401                                                 
03402                                                 return iBack;
03403                                         }
03404                                 }
03405                         }
03406 
03407                 } // for( int j=0; j<3; j++ )   // try all frames (8E1, 8N1, 8O1)
03408 
03409                 if(iFrameSupport == 0)
03410                 {
03411                         if(GetProtocolFrameSupport() == FEDM_PRT_FRAME_STANDARD)
03412                                 SetProtocolFrameSupport(FEDM_PRT_FRAME_ADVANCED);
03413                         else
03414                                 SetProtocolFrameSupport(FEDM_PRT_FRAME_STANDARD);
03415                 }
03416                 else if(iFrameSupport == 3) // alternating protocol frames
03417                 {
03418                         break;
03419                 }
03420         
03421         } // for( int k=0; k<2; k++) // try all protocol frame support (standard, advanced)
03422 
03423 #if !defined(_FEDM_SUPPORT_SLINK)
03424         // restore old baudrate
03425         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "baud", cOldBaud ));
03426         // restore old frame
03427         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "frame", cOldFrame ));
03428         // restore timeout
03429         FEDM_CHK1(iErr, lpfnSetPortPara( iPortHnd, "timeout", cOldTimeout ));
03430 #else
03431         // restore old baudrate
03432         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "baud", cOldBaud ));
03433         // restore old frame
03434         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "frame", cOldFrame ));
03435         // restore timeout
03436         FEDM_CHK1(iErr, FECOM_SetPortPara( iPortHnd, "timeout", cOldTimeout ));
03437 #endif
03438 
03439         return FEDM_ERROR_NO_READER_FOUND;
03440 #else
03441         return FEDM_ERROR_UNSUPPORTED;
03442 #endif
03443 }
03444 
03445 
03446 #ifdef _FEDM_USB_SUPPORT
03447 void FEDM_ISCReader::HandleUsbEnumeration()
03448 {
03449         if(! FEDM_IS_USBPORT(GetPortHnd()))
03450                 return;
03451 
03452 #if !defined(_FEDM_SUPPORT_SLINK)
03453         LPFN_FEUSB_IS_DEVICE_PRESENT lpfnIsDevicePresent = (LPFN_FEUSB_IS_DEVICE_PRESENT)GetFeUsbFunction(FEUSB_IS_DEVICE_PRESENT);
03454         if(lpfnIsDevicePresent==NULL)
03455                 return;
03456 #endif
03457 
03458         FEDM_SLEEP(FE_1000MS);
03459         FEDM_SLEEP(FE_500MS);
03460 
03461         // reader enumerates new -> we must wait for presence event
03462         int iWaitCnt = 20;
03463         while(iWaitCnt > 0)
03464         {
03465 #if !defined(_FEDM_SUPPORT_SLINK)
03466                 if(lpfnIsDevicePresent(GetPortHnd()))
03467                         break;
03468 #else
03469                 if(FEUSB_IsDevicePresent(GetPortHnd()))
03470                         break;
03471 #endif
03472                 //TRACE("FEDM_ISCReader::HandleUsbEnumeration()\n");
03473                 FEDM_SLEEP(FE_500MS);
03474 
03475                 iWaitCnt--;
03476         }
03477 }
03478 #endif
03479 
03481 // miscellaneous functions
03483 
03484 
03485 /***************************************************************************
03486   Begin                 :       08.06.2000 / M. Hultsch
03487   Version               :       01.06.00 / 23.09.2002 / M. Hultsch
03488 
03489   Function                      :       returns the last communication protocol
03490 
03491   Parameters            :       sID             -       parameter id
03492                                                 sProt   -       pointer to buffer for string
03493 
03494   Return value          :       status byte (>=0) or error code (<0)
03495 
03496 ***************************************************************************/
03497 int FEDM_ISCReader::GetLastProt(char* sID, char* sProt)
03498 {
03499         FEDM_CHK3(sID);
03500         FEDM_CHK3(sProt);
03501 
03502         int             iErr;
03503         unsigned char   ucBuf[1024];
03504 
03505         memset(ucBuf, '\0', 1024);
03506 
03507         // no handle -> no communication
03508         if( m_iReaderHnd == 0 )
03509                 FEDM_RETURN(FEDM_ERROR_NO_READER_HANDLE);
03510 
03511         // make upper case
03512         char ID[128];
03513         memset(ID, 0, 128);
03514         for(int i=0; i<(int)strlen(sID); ++i)
03515                 ID[i] = (char)toupper(sID[i]);
03516 
03517         
03518         if( strcmp(ID, "SEND")==0 )             // last send protocol
03519         {
03520                 FEDM_CHK2(iErr, FEISC_GetLastSendProt(m_iReaderHnd, ucBuf, 1));
03521                 
03522                 strcpy(sProt, (const char*)&ucBuf[0]);
03523                 FEDM_RETURN(FEDM_OK);
03524         }
03525         else if(strcmp(ID, "SENDSTR")==0)               // last send protocol with date and time
03526         {
03527                 FEDM_CHK2(iErr, FEISC_GetReaderPara(m_iReaderHnd, "SENDSTR", (char*)ucBuf));
03528 
03529                 strcpy(sProt, (const char*)&ucBuf[0]);
03530                 FEDM_RETURN(FEDM_OK);
03531         }
03532         else if(strcmp(ID, "REC")==0)   // last receive protocol
03533         {
03534                 FEDM_CHK2(iErr, FEISC_GetLastRecProt(m_iReaderHnd, ucBuf, 1));
03535 
03536                 strcpy(sProt, (const char*)&ucBuf[0]);
03537                 FEDM_RETURN(FEDM_OK);
03538         }
03539         else if(strcmp(ID, "RECSTR")==0)        // last receive protocol with date and time
03540         {
03541                 FEDM_CHK2(iErr, FEISC_GetReaderPara(m_iReaderHnd, "RECSTR", (char*)ucBuf));
03542                 
03543                 strcpy(sProt, (const char*)&ucBuf[0]);
03544                 FEDM_RETURN(FEDM_OK);
03545         }
03546 
03547         FEDM_RETURN(FEDM_ERROR_PARAMETER);
03548 }
03549 
03550 
03551 /***************************************************************************
03552   Begin                 :       22.11.2000 / M. Hultsch
03553   Version               :       01.00.00 / 22.11.2000 / M. Hultsch
03554 
03555   Function                      :       returns the last protocol status
03556 
03557   Parameters            :       -
03558 
03559   Return value          :       status byte (>=0) or error code (<0)
03560 
03561 ***************************************************************************/
03562 int FEDM_ISCReader::GetLastStatus()
03563 {
03564         unsigned char   ucStatus = 0;
03565         int             iErr;
03566         
03567         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_LAST_STATE, &ucStatus));
03568 
03569         return (int)ucStatus;
03570 }
03571 
03572 
03573 /***************************************************************************
03574   Begin                 :       22.11.2000 / M. Hultsch
03575   Version               :       01.03.00 / 09.07.2001 / M. Hultsch
03576                                                 - error correction
03577   
03578                                                 01.00.00 / 22.11.2000 / M. Hultsch
03579 
03580   Function                      :       returns the last error code
03581 
03582   Parameters            :       -
03583 
03584   Return value          :       error code (<0)
03585 
03586 ***************************************************************************/
03587 int FEDM_ISCReader::GetLastError()
03588 {
03589         int     iErr;
03590         int iErrorCode = 0;
03591         
03592         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_LAST_ERROR, (unsigned int*)&iErrorCode));
03593 
03594         if(iErr < 0)
03595                 return iErr;
03596         else
03597                 return iErrorCode;
03598 }
03599 
03600 
03601 /***************************************************************************
03602   Begin                 :       25.02.2009 / M. Hultsch
03603   Version               :       03.00.05 / 25.02.2009 / M. Hultsch
03604 
03605   Function                      :       return an error text for error code
03606 
03607   Parameters            :       int iErrCode    -       error code
03608 
03609   Return value          :       pointer to char with error text
03610 ***************************************************************************/
03611 char* FEDM_ISCReader::GetErrorText(int iErrorCode)
03612 {
03613         static char cMsgText[256];
03614         memset(cMsgText, 0, 256);
03615 
03616         this->GetErrorText(cMsgText, iErrorCode);
03617         
03618         return cMsgText;
03619 }
03620 
03621 /***************************************************************************
03622   Begin                 :       10.09.2000 / M. Hultsch
03623   Version               :       01.09.06 / 01.04.2004 / M. Hultsch
03624 
03625   Function                      :       return an error text for error code
03626 
03627   Parameters            :       char* sTxt              -       pointer to text buffer
03628                                                 int iErrCode    -       error code
03629 
03630   Return value          :       OK (0) or error code (<0)
03631 
03632 ***************************************************************************/
03633 int FEDM_ISCReader::GetErrorText(char* cErrorText, int iErrorCode)
03634 {
03635         FEDM_CHK3(cErrorText);
03636 
03637         if(iErrorCode == 0)
03638         {
03639                 strcpy(cErrorText, "OK");
03640                 return FEDM_OK;
03641         }
03642         else if(iErrorCode > -1000 && iErrorCode <= -100)
03643         {
03644                 // errors from this object
03645                 return FEDM_Base::GetErrorText(cErrorText, iErrorCode);
03646         }
03647         else if( iErrorCode > -1100 && iErrorCode <= -1000 )
03648         {
03649 #ifdef _FEDM_COM_SUPPORT
03650 #if !defined(_FEDM_SUPPORT_SLINK)
03651                 LPFN_FECOM_GET_ERROR_TEXT lpfn = (LPFN_FECOM_GET_ERROR_TEXT)GetFeComFunction(FECOM_GET_ERROR_TEXT);
03652                 FEDM_CHK3(lpfn);
03653 
03654                 // errors from fecom library
03655                 return lpfn(iErrorCode, cErrorText);
03656 #else
03657                 // errors from fecom library
03658                 return FECOM_GetErrorText(iErrorCode, cErrorText);
03659 #endif
03660 #else
03661                 return FEDM_ERROR_UNSUPPORTED;
03662 #endif
03663         }
03664         else if( iErrorCode > -1200 && iErrorCode <= -1100 )
03665         {
03666 #ifdef _FEDM_USB_SUPPORT
03667 #if !defined(_FEDM_SUPPORT_SLINK)
03668                 LPFN_FEUSB_GET_ERROR_TEXT lpfn = (LPFN_FEUSB_GET_ERROR_TEXT)GetFeUsbFunction(FEUSB_GET_ERROR_TEXT);
03669                 FEDM_CHK3(lpfn);
03670 
03671                 // errors from feusb library
03672                 return lpfn(iErrorCode, cErrorText);
03673 #else
03674                 // errors from feusb library
03675                 return FEUSB_GetErrorText(iErrorCode, cErrorText);
03676 #endif
03677 #else
03678                 return FEDM_ERROR_UNSUPPORTED;
03679 #endif
03680         }
03681         else if( iErrorCode > -1300 && iErrorCode <= -1200 )
03682         {
03683 #ifdef _FEDM_TCP_SUPPORT
03684 #if !defined(_FEDM_SUPPORT_SLINK)
03685                 LPFN_FETCP_GET_ERROR_TEXT lpfn = (LPFN_FETCP_GET_ERROR_TEXT)GetFeTcpFunction(FETCP_GET_ERROR_TEXT);
03686                 FEDM_CHK3(lpfn);
03687 
03688                 // errors from fetcp library
03689                 return lpfn(iErrorCode, cErrorText);
03690 #else
03691                 // errors from fetcp library
03692                 return FETCP_GetErrorText(iErrorCode, cErrorText);
03693 #endif
03694 #else
03695                 return FEDM_ERROR_UNSUPPORTED;
03696 #endif
03697         }
03698         else if(iErrorCode > -4100 && iErrorCode < -4000)
03699         {
03700                 // errors from feisc library
03701                 return FEISC_GetErrorText(iErrorCode, cErrorText);
03702         }
03703 #ifdef _FEDM_FU_SUPPORT
03704         else if(iErrorCode > -4200 && iErrorCode < -4100)
03705         {
03706                 // errors from fefu library
03707                 return FEFU_GetErrorText(iErrorCode, cErrorText);
03708         }
03709 #endif
03710 #ifdef _FEDM_TAG_HANDLER
03711   #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
03712         else if(iErrorCode > -4300 && iErrorCode < -4200)
03713         {
03714                 // errors from fetcl library
03715                 return FETCL_GetErrorText(iErrorCode, cErrorText);
03716         }
03717   #endif
03718 #endif
03719         else if(iErrorCode >= (int)0xE0000001 && iErrorCode <= (int)0xE8001000)
03720         {
03721 #ifdef _FEDM_USB_SUPPORT
03722 #if !defined(_FEDM_SUPPORT_SLINK)
03723                 LPFN_FEUSB_GET_ERROR_TEXT lpfn = (LPFN_FEUSB_GET_ERROR_TEXT)GetFeUsbFunction(FEUSB_GET_ERROR_TEXT);
03724                 FEDM_CHK3(lpfn);
03725 
03726                 // error codes from USB Kernel-Driver OBIDUSB.SYS
03727                 return lpfn(iErrorCode, cErrorText);
03728 #else
03729                 // error codes from USB Kernel-Driver OBIDUSB.SYS
03730                 return FEUSB_GetErrorText(iErrorCode, cErrorText);
03731 #endif
03732 #else
03733                 return FEDM_ERROR_UNSUPPORTED;
03734 #endif
03735         }
03736         else
03737         {
03738                 FEDM_Base::GetErrorText(cErrorText, iErrorCode);
03739         }
03740 
03741         return FEDM_ERROR_UNKNOWN_ERROR_CODE;
03742 }
03743 
03744 
03745 
03746 /***************************************************************************
03747   Begin                 :       25.02.2009 / M. Hultsch
03748   Version               :       03.00.05 / 25.02.2009 / M. Hultsch
03749 
03750   Function                      :       return a status text for status byte
03751 
03752   Parameters            :       unsigned char ucStatus  -       status byte
03753 
03754   Return value          :       pointer to char with error text
03755 ***************************************************************************/
03756 char* FEDM_ISCReader::GetStatusText(unsigned char ucStatus)
03757 {
03758         static char cMsgText[256];
03759         memset(cMsgText, 0, 256);
03760 
03761         this->GetStatusText(cMsgText, ucStatus);
03762         
03763         return cMsgText;
03764 }
03765 
03766 
03767 /***************************************************************************
03768   Begin                 :       05.03.2001 / M. Hultsch
03769   Version               :       01.01.00 / 05.03.2001 / M. Hultsch
03770 
03771 
03772   Function                      :       return a status text for status byte
03773 
03774   Parameters            :       char* sTxt              -       pointer to text buffer
03775                                                 unsigned char ucStatus  -       status byte
03776 
03777   Return value          :       OK (0) or error code (<0)
03778 
03779 ***************************************************************************/
03780 int FEDM_ISCReader::GetStatusText(char* cStatusText, unsigned char ucStatus)
03781 {
03782         FEDM_CHK3(cStatusText);
03783 
03784         // status text from feisc library
03785         return FEISC_GetStatusText(ucStatus, cStatusText);
03786 }
03787 
03788 
03789 
03790 
03791 //#####################################################################################
03792 // access functions
03793 //#####################################################################################
03794         
03795 // methods for getting command parameter values
03796 
03797 
03798 int FEDM_ISCReader::GetCommandPara( string sParaName, bool* Data )
03799 {
03800         return GetData(sParaName.c_str(), Data);
03801 }
03802 
03803 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
03804 int FEDM_ISCReader::GetCommandPara( string sParaName, BOOL* Data )
03805 {
03806         return GetData(sParaName.c_str(), Data);
03807 }
03808 #endif
03809 
03810 int FEDM_ISCReader::GetCommandPara( string sParaName, unsigned char* Data )
03811 {
03812         return GetData(sParaName.c_str(), Data);
03813 }
03814 
03815 int FEDM_ISCReader::GetCommandPara( string sParaName, unsigned char* Data, int DataLen )
03816 {
03817         return GetData(sParaName.c_str(), Data, DataLen);
03818 }
03819 
03820 int FEDM_ISCReader::GetCommandPara( string sParaName, unsigned int* Data )
03821 {
03822         return GetData(sParaName.c_str(), Data);
03823 }
03824 
03825 int FEDM_ISCReader::GetCommandPara( string sParaName, __int64* Data )
03826 {
03827         return GetData(sParaName.c_str(), Data);
03828 }
03829 
03830 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
03831 int FEDM_ISCReader::GetCommandPara( string sParaName, CString Data )
03832 {
03833         return GetData(sParaName.c_str(), Data);
03834 }
03835 #endif
03836 
03837 int FEDM_ISCReader::GetCommandPara( string sParaName, string Data )
03838 {
03839         return GetData(sParaName.c_str(), Data);
03840 }
03841 
03842 int FEDM_ISCReader::GetCommandPara( string sParaName, char* Data, int DataLen )
03843 {
03844         return GetData(sParaName.c_str(), Data, DataLen);
03845 }
03846 
03847 
03848 // methods for setting command parameter values
03849 
03850 int FEDM_ISCReader::SetCommandPara( string sParaName, bool Data )
03851 {
03852         return SetData(sParaName.c_str(), Data);
03853 }
03854 
03855 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
03856 int FEDM_ISCReader::SetCommandPara( string sParaName, BOOL Data )
03857 {
03858         return SetData(sParaName.c_str(), Data);
03859 }
03860 #endif
03861 
03862 int FEDM_ISCReader::SetCommandPara( string sParaName, unsigned char Data )
03863 {
03864         return SetData(sParaName.c_str(), Data);
03865 }
03866 
03867 int FEDM_ISCReader::SetCommandPara( string sParaName, unsigned char* Data, int DataLen )
03868 {
03869         return SetData(sParaName.c_str(), Data, DataLen);
03870 }
03871 
03872 int FEDM_ISCReader::SetCommandPara( string sParaName, unsigned int Data )
03873 {
03874         return SetData(sParaName.c_str(), Data);
03875 }
03876 
03877 int FEDM_ISCReader::SetCommandPara( string sParaName, __int64 Data )
03878 {
03879         return SetData(sParaName.c_str(), Data);
03880 }
03881 
03882 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
03883 int FEDM_ISCReader::SetCommandPara( string sParaName, CString Data )
03884 {
03885         return SetData(sParaName.c_str(), Data);
03886 }
03887 #endif
03888 
03889 int FEDM_ISCReader::SetCommandPara( string sParaName, string Data )
03890 {
03891         return SetData(sParaName.c_str(), Data);
03892 }
03893 
03894 int FEDM_ISCReader::SetCommandPara( string sParaName, char* Data, int DataLen )
03895 {
03896         return SetData(sParaName.c_str(), Data, DataLen);
03897 }
03898 
03899 
03900 /***************************************************************************
03901   Begin         :       19.08.2008 / M. Hultsch
03902   Version       :       03.00.00 / 19.08.2008 / M. Hultsch
03903 
03904   Function              :       test a namespace for using for the reader type
03905 
03906   Parameter             :       string sParaName        -       parameter identifier
03907 
03908   Return Value  :       FEDM_OK (0) or error code (<0)
03909 ***************************************************************************/
03910 int FEDM_ISCReader::TestConfigPara(string sParaName)
03911 {
03912         FEDM_CHK8(sParaName.size());
03913 
03914         FEDM_MAP_ACCESS_ID_ITOR         itor;
03915 
03916         itor = m_mapAccessID.find(sParaName);
03917         if(itor == m_mapAccessID.end())
03918                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED_NAMESPACE);
03919 
03920         FEDM_RETURN(FEDM_OK);
03921 }
03922 
03923 /***************************************************************************
03924   Begin         :       15.08.2008 / M. Hultsch
03925   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
03926 
03927   Function              :       read a value from specified memory
03928 
03929   Parameter             :       string sParaName        -       parameter identifier
03930                                         bool* Data              -       pointer to value
03931                                         bool bEEPROM    -       true : from EEPROM
03932                                                                                 false: from RAM
03933 
03934   Return Value  :       FEDM_OK (0) or error code (<0)
03935 ***************************************************************************/
03936 int FEDM_ISCReader::GetConfigPara(string sParaName, bool* Data, bool bEEPROM)
03937 {
03938         FEDM_CHK8(sParaName.size());
03939         FEDM_CHK3(Data);
03940 
03941         int iErr = 0;
03942         string sAccessID;
03943 
03944         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
03945 
03946         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
03947 }
03948 
03949 /***************************************************************************
03950   Begin         :       15.08.2008 / M. Hultsch
03951   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
03952 
03953   Function              :       read a value from specified memory
03954 
03955   Parameter             :       string sParaName        -       parameter identifier
03956                                         BOOL* Data              -       pointer to value
03957                                         bool bEEPROM    -       true : from EEPROM
03958                                                                                 false: from RAM
03959 
03960   Return Value  :       FEDM_OK (0) or error code (<0)
03961 ***************************************************************************/
03962 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
03963 int FEDM_ISCReader::GetConfigPara(string sParaName, BOOL* Data, bool bEEPROM)
03964 {
03965         FEDM_CHK8(sParaName.size());
03966         FEDM_CHK3(Data);
03967 
03968         int iErr = 0;
03969         string sAccessID;
03970 
03971         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
03972 
03973         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
03974 }
03975 #endif
03976 
03977 /***************************************************************************
03978   Begin         :       15.08.2008 / M. Hultsch
03979   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
03980 
03981   Function              :       read a value from specified memory
03982 
03983   Parameter             :       string sParaName                -       parameter identifier
03984                                         unsigned char* Data             -       pointer to value
03985                                         bool bEEPROM                    -       true : from EEPROM
03986                                                                                                 false: from RAM
03987 
03988   Return Value  :       FEDM_OK (0) or error code (<0)
03989 ***************************************************************************/
03990 int FEDM_ISCReader::GetConfigPara(string sParaName, unsigned char* Data, bool bEEPROM)
03991 {
03992         FEDM_CHK8(sParaName.size());
03993         FEDM_CHK3(Data);
03994 
03995         int iErr = 0;
03996         string sAccessID;
03997 
03998         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
03999 
04000         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
04001 }
04002 
04003 /***************************************************************************
04004   Begin         :       15.08.2008 / M. Hultsch
04005   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04006 
04007   Function              :       read a value from specified memory
04008 
04009   Parameter             :       string sParaName                -       parameter identifier
04010                                         unsigned char* Data             -       pointer to value
04011                                         int Cnt                                 -       length of Data
04012                                         bool bEEPROM                    -       true : from EEPROM
04013                                                                                                 false: from RAM
04014 
04015   Return Value  :       FEDM_OK (0) or error code (<0)
04016 ***************************************************************************/
04017 int FEDM_ISCReader::GetConfigPara(string sParaName, unsigned char* Data, int Cnt, bool bEEPROM)
04018 {
04019         FEDM_CHK8(sParaName.size());
04020         FEDM_CHK3(Data);
04021 
04022         int iErr = 0;
04023         string sAccessID;
04024 
04025         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04026 
04027         return FEDM_DataBase::GetData(sAccessID.c_str(), Data, Cnt);
04028 }
04029 
04030 /***************************************************************************
04031   Begin         :       15.08.2008 / M. Hultsch
04032   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04033 
04034   Function              :       read a value from specified memory
04035 
04036   Parameter             :       string sParaName                -       parameter identifier
04037                                         unsigned int* Data              -       pointer to value
04038                                         bool bEEPROM                    -       true : from EEPROM
04039                                                                                                 false: from RAM
04040 
04041   Return Value  :       FEDM_OK (0) or error code (<0)
04042 ***************************************************************************/
04043 int FEDM_ISCReader::GetConfigPara(string sParaName, unsigned int* Data, bool bEEPROM)
04044 {
04045         FEDM_CHK8(sParaName.size());
04046         FEDM_CHK3(Data);
04047 
04048         int iErr = 0;
04049         string sAccessID;
04050 
04051         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04052 
04053         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
04054 }
04055 
04056 /***************************************************************************
04057   Begin         :       15.08.2008 / M. Hultsch
04058   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04059 
04060   Function              :       read a value from specified memory
04061 
04062   Parameter             :       string sParaName        -       parameter identifier
04063                                         __int64* Data           -       pointer to value
04064                                         bool bEEPROM            -       true : from EEPROM
04065                                                                                         false: from RAM
04066 
04067   Return Value  :       FEDM_OK (0) or error code (<0)
04068 ***************************************************************************/
04069 int FEDM_ISCReader::GetConfigPara(string sParaName, __int64* Data, bool bEEPROM)
04070 {
04071         FEDM_CHK8(sParaName.size());
04072         FEDM_CHK3(Data);
04073 
04074         int iErr = 0;
04075         string sAccessID;
04076 
04077         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04078 
04079         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
04080 }
04081 
04082 /***************************************************************************
04083   Begin         :       15.08.2008 / M. Hultsch
04084   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04085                                         - workaround for LRU3000
04086 
04087                                         03.00.00 / 20.08.2008 / M. Hultsch
04088 
04089   Function              :       read a value from specified memory
04090 
04091   Parameter             :       string sParaName        -       parameter identifier
04092                                         CString& Data   -       reference of value
04093                                         bool bEEPROM    -       true : from EEPROM
04094                                                                                 false: from RAM
04095 
04096   Return Value  :       FEDM_OK (0) or error code (<0)
04097 ***************************************************************************/
04098 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
04099 int FEDM_ISCReader::GetConfigPara(string sParaName, CString& Data, bool bEEPROM)
04100 {
04101         FEDM_CHK8(sParaName.size());
04102         FEDM_CHK3(&Data);
04103 
04104         int iErr = 0;
04105         string sAccessID;
04106 
04107         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04108 
04109         // workaround for selection masks, stored in RFC of LRU3000
04110         // get of new mask must be split into two steps
04111         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04112         {
04113                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04114                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04115                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04116                 {
04117                         char cID[32];
04118                         int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04119                         // extract access parameters
04120                         sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04121 
04122                         CString sData1;
04123                         CString sData2;
04124 
04125                         // build new access id for 1st step
04126                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04127                         int back = FEDM_DataBase::GetData(cID, sData1);
04128                         if(back < 0)
04129                                 return back;
04130 
04131                         // build new access id for 2nd step
04132                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04133                         back = FEDM_DataBase::GetData(cID, sData2);
04134                         if(back < 0)
04135                                 return back;
04136 
04137                         Data = sData1 + sData2;
04138                         return 0;
04139                 }
04140         }
04141 
04142         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
04143 }
04144 #endif
04145 
04146 /***************************************************************************
04147   Begin         :       15.08.2008 / M. Hultsch
04148   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04149                                         - workaround for LRU3000
04150 
04151                                         03.00.00 / 20.08.2008 / M. Hultsch
04152 
04153   Function              :       read a value from specified memory
04154 
04155   Parameter             :       string sParaName        -       parameter identifier
04156                                         string& Data    -       reference of value
04157                                         bool bEEPROM    -       true : from EEPROM
04158                                                                                 false: from RAM
04159 
04160   Return Value  :       FEDM_OK (0) or error code (<0)
04161 ***************************************************************************/
04162 int FEDM_ISCReader::GetConfigPara(string sParaName, string& Data, bool bEEPROM)
04163 {
04164         FEDM_CHK8(sParaName.size());
04165         FEDM_CHK3(&Data);
04166 
04167         int iErr = 0;
04168         string sAccessID;
04169 
04170         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04171 
04172         // workaround for selection masks, stored in RFC of LRU3000
04173         // get of new mask must be split into two steps
04174         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04175         {
04176                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04177                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04178                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04179                 {
04180                         char cID[32];
04181                         int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04182                         // extract access parameters
04183                         sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04184 
04185                         string sData1;
04186                         string sData2;
04187 
04188                         // build new access id for 1st step
04189                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04190                         int back = FEDM_DataBase::GetData(cID, sData1);
04191                         if(back < 0)
04192                                 return back;
04193 
04194                         // build new access id for 2nd step
04195                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04196                         back = FEDM_DataBase::GetData(cID, sData2);
04197                         if(back < 0)
04198                                 return back;
04199 
04200                         Data = sData1 + sData2;
04201                         return 0;
04202                 }
04203         }
04204 
04205         return FEDM_DataBase::GetData(sAccessID.c_str(), Data);
04206 }
04207 
04208 /***************************************************************************
04209   Begin         :       15.08.2008 / M. Hultsch
04210   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04211                                         - workaround for LRU3000
04212 
04213                                         03.00.00 / 20.08.2008 / M. Hultsch
04214 
04215   Function              :       read a value from specified memory
04216 
04217   Parameter             :       string sParaName        -       parameter identifier
04218                                         char* Data              -       pointer to value
04219                                         int DataLen             -       length of Data
04220                                         bool bEEPROM    -       true : from EEPROM
04221                                                                                 false: from RAM
04222 
04223   Return Value  :       FEDM_OK (0) or error code (<0)
04224 ***************************************************************************/
04225 int FEDM_ISCReader::GetConfigPara(string sParaName, char* Data, int DataLen, bool bEEPROM)
04226 {
04227         FEDM_CHK8(sParaName.size());
04228         FEDM_CHK3(Data);
04229 
04230         int iErr = 0;
04231         string sAccessID;
04232 
04233         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04234 
04235         // workaround for selection masks, stored in RFC of LRU3000
04236         // get of new mask must be split into two steps
04237         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04238         {
04239                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04240                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04241                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04242                 {
04243                         char cID[32];
04244                         int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04245                         // extract access parameters
04246                         sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04247 
04248                         char sData1[21];
04249                         char sData2[29];
04250 
04251                         // build new access id for 1st step
04252                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04253                         int back = FEDM_DataBase::GetData(cID, sData1, 20);
04254                         if(back < 0)
04255                                 return back;
04256 
04257                         sData1[20] = '\0';
04258 
04259                         // build new access id for 2nd step
04260                         sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04261                         back = FEDM_DataBase::GetData(cID, sData2, 28);
04262                         if(back < 0)
04263                                 return back;
04264 
04265                         sData2[28] = '\0';
04266 
04267                         memcpy(&Data[0], sData1, 20);
04268                         memcpy(&Data[20], sData2, 28);
04269                         Data[48] = '\0';
04270                         return 0;
04271                 }
04272         }
04273 
04274         return FEDM_DataBase::GetData(sAccessID.c_str(), Data, DataLen);
04275 }
04276 
04277 /***************************************************************************
04278   Begin         :       15.08.2008 / M. Hultsch
04279   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04280 
04281   Function              :       write a value in specified memory
04282 
04283   Parameter             :       string sParaName        -       parameter identifier
04284                                         bool Data               -       value
04285                                         bool bEEPROM    -       true : from EEPROM
04286                                                                                 false: from RAM
04287 
04288   Return Value  :       FEDM_OK (0) or error code (<0)
04289 ***************************************************************************/
04290 int FEDM_ISCReader::SetConfigPara( string sParaName, bool Data, bool bEEPROM )
04291 {
04292         FEDM_CHK8(sParaName.size());
04293 
04294         int iErr = 0;
04295         string sAccessID;
04296 
04297         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04298 
04299         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04300 }
04301 
04302 /***************************************************************************
04303   Begin         :       15.08.2008 / M. Hultsch
04304   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04305 
04306   Function              :       write a value in specified memory
04307 
04308   Parameter             :       string sParaName        -       parameter identifier
04309                                         BOOL Data               -       value
04310                                         bool bEEPROM    -       true : from EEPROM
04311                                                                                 false: from RAM
04312 
04313   Return Value  :       FEDM_OK (0) or error code (<0)
04314 ***************************************************************************/
04315 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
04316 int FEDM_ISCReader::SetConfigPara( string sParaName, BOOL Data, bool bEEPROM )
04317 {
04318         FEDM_CHK8(sParaName.size());
04319 
04320         int iErr = 0;
04321         string sAccessID;
04322 
04323         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04324 
04325         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04326 }
04327 #endif
04328 
04329 /***************************************************************************
04330   Begin         :       15.08.2008 / M. Hultsch
04331   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04332 
04333   Function              :       write a value in specified memory
04334 
04335   Parameter             :       string sParaName                -       parameter identifier
04336                                         unsigned char Data              -       value
04337                                         bool bEEPROM                    -       true : from EEPROM
04338                                                                                                 false: from RAM
04339 
04340   Return Value  :       FEDM_OK (0) or error code (<0)
04341 ***************************************************************************/
04342 int FEDM_ISCReader::SetConfigPara( string sParaName, unsigned char Data, bool bEEPROM )
04343 {
04344         FEDM_CHK8(sParaName.size());
04345 
04346         int iErr = 0;
04347         string sAccessID;
04348 
04349         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04350 
04351         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04352 }
04353 
04354 /***************************************************************************
04355   Begin         :       15.08.2008 / M. Hultsch
04356   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04357 
04358   Function              :       write a value in specified memory
04359 
04360   Parameter             :       string sParaName        -       parameter identifier
04361                                         unsigned char* Data     -       pointer to value
04362                                         int Cnt                         -       length of Data
04363                                         bool bEEPROM            -       true : from EEPROM
04364                                                                                         false: from RAM
04365 
04366   Return Value  :       FEDM_OK (0) or error code (<0)
04367 ***************************************************************************/
04368 int FEDM_ISCReader::SetConfigPara( string sParaName, unsigned char* Data, int Cnt, bool bEEPROM )
04369 {
04370         FEDM_CHK8(sParaName.size());
04371         FEDM_CHK3(Data);
04372 
04373         int iErr = 0;
04374         string sAccessID;
04375 
04376         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04377 
04378         return FEDM_DataBase::SetData(sAccessID.c_str(), Data, Cnt);
04379 }
04380 
04381 /***************************************************************************
04382   Begin         :       15.08.2008 / M. Hultsch
04383   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04384 
04385   Function              :       write a value in specified memory
04386 
04387   Parameter             :       string sParaName        -       parameter identifier
04388                                         unsigned int Data       -       value
04389                                         bool bEEPROM            -       true : from EEPROM
04390                                                                                         false: from RAM
04391 
04392   Return Value  :       FEDM_OK (0) or error code (<0)
04393 ***************************************************************************/
04394 int FEDM_ISCReader::SetConfigPara( string sParaName, unsigned int Data, bool bEEPROM )
04395 {
04396         FEDM_CHK8(sParaName.size());
04397 
04398         int iErr = 0;
04399         string sAccessID;
04400 
04401         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04402 
04403         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04404 }
04405 
04406 /***************************************************************************
04407   Begin         :       15.08.2008 / M. Hultsch
04408   Version       :       03.00.00 / 20.08.2008 / M. Hultsch
04409 
04410   Function              :       write a value in specified memory
04411 
04412   Parameter             :       string sParaName        -       parameter identifier
04413                                         __int64 Data    -       value
04414                                         bool bEEPROM    -       true : from EEPROM
04415                                                                                 false: from RAM
04416 
04417   Return Value  :       FEDM_OK (0) or error code (<0)
04418 ***************************************************************************/
04419 int FEDM_ISCReader::SetConfigPara( string sParaName, __int64 Data, bool bEEPROM )
04420 {
04421         FEDM_CHK8(sParaName.size());
04422 
04423         int iErr = 0;
04424         string sAccessID;
04425 
04426         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04427 
04428         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04429 }
04430 
04431 /***************************************************************************
04432   Begin         :       15.08.2008 / M. Hultsch
04433   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04434                                         - workaround for LRU3000
04435 
04436                                         03.00.00 / 20.08.2008 / M. Hultsch
04437 
04438   Function              :       write a value in specified memory
04439 
04440   Parameter             :       string sParaName        -       parameter identifier
04441                                         CString Data    -       value
04442                                         bool bEEPROM    -       true : from EEPROM
04443                                                                                 false: from RAM
04444 
04445   Return Value  :       FEDM_OK (0) or error code (<0)
04446 ***************************************************************************/
04447 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
04448 int FEDM_ISCReader::SetConfigPara( string sParaName, CString Data, bool bEEPROM )
04449 {
04450         FEDM_CHK8(sParaName.size());
04451 
04452         int iErr = 0;
04453         string sAccessID;
04454 
04455         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04456 
04457         // workaround for selection masks, stored in RFC of LRU3000
04458         // set of new mask must be split into two steps
04459         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04460         {
04461                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04462                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04463                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04464                 {
04465                         if(Data.GetLength() > 20)
04466                         {
04467                                 char cID[32];
04468                                 int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04469                                 // extract access parameters
04470                                 sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04471 
04472                                 CString sData1 = Data.Left(20);
04473                                 CString sData2 = Data.Mid(20);
04474 
04475                                 // build new access id for 1st step
04476                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04477                                 int back = FEDM_DataBase::SetData(cID, sData1);
04478                                 if(back < 0)
04479                                         return back;
04480 
04481                                 // build new access id for 2nd step
04482                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04483                                 return FEDM_DataBase::SetData(cID, sData2);
04484                         }
04485                 }
04486         }
04487 
04488         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04489 }
04490 #endif
04491 
04492 /***************************************************************************
04493   Begin         :       15.08.2008 / M. Hultsch
04494   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04495                                         - workaround for LRU3000
04496 
04497                                         03.00.00 / 20.08.2008 / M. Hultsch
04498 
04499   Function              :       write a value in specified memory
04500 
04501   Parameter             :       string sParaName        -       parameter identifier
04502                                         string Data             -       value
04503                                         bool bEEPROM    -       true : from EEPROM
04504                                                                                 false: from RAM
04505 
04506   Return Value  :       FEDM_OK (0) or error code (<0)
04507 ***************************************************************************/
04508 int FEDM_ISCReader::SetConfigPara( string sParaName, string Data, bool bEEPROM )
04509 {
04510         FEDM_CHK8(sParaName.size());
04511 
04512         int iErr = 0;
04513         string sAccessID;
04514 
04515         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04516 
04517         // workaround for selection masks, stored in RFC of LRU3000
04518         // set of new mask must be split into two steps
04519         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04520         {
04521                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04522                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04523                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04524                 {
04525                         if(Data.size() > 20)
04526                         {
04527                                 char cID[32];
04528                                 int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04529                                 // extract access parameters
04530                                 sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04531 
04532                                 string sData1 = Data.substr(0, 20);
04533                                 string sData2 = Data.substr(20);
04534 
04535                                 // build new access id for 1st step
04536                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04537                                 int back = FEDM_DataBase::SetData(cID, sData1);
04538                                 if(back < 0)
04539                                         return back;
04540 
04541                                 // build new access id for 2nd step
04542                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04543                                 return FEDM_DataBase::SetData(cID, sData2);
04544                         }
04545                 }
04546         }
04547 
04548         return FEDM_DataBase::SetData(sAccessID.c_str(), Data);
04549 }
04550 
04551 /***************************************************************************
04552   Begin         :       15.08.2008 / M. Hultsch
04553   Version       :       04.00.06 / 01.12.2011 / M. Hultsch
04554                                         - workaround for LRU3000
04555 
04556                                         03.00.00 / 20.08.2008 / M. Hultsch
04557 
04558   Function              :       write a value in specified memory
04559 
04560   Parameter             :       string sParaName        -       parameter identifier
04561                                         char* Data              -       pointer to value
04562                                         int DataLen             -       length of Data
04563                                         bool bEEPROM    -       true : from EEPROM
04564                                                                                 false: from RAM
04565 
04566   Return Value  :       FEDM_OK (0) or error code (<0)
04567 ***************************************************************************/
04568 int FEDM_ISCReader::SetConfigPara( string sParaName, char* Data, int DataLen, bool bEEPROM )
04569 {
04570         FEDM_CHK8(sParaName.size());
04571         FEDM_CHK3(Data);
04572         if(strlen(Data) != DataLen)
04573                 return FEDM_ERROR_STRING_LENGTH;
04574 
04575         int iErr = 0;
04576         string sAccessID;
04577 
04578         FEDM_CHK1(iErr, GetAccessID(sParaName, sAccessID, bEEPROM));
04579 
04580         // workaround for selection masks, stored in RFC of LRU3000
04581         // set of new mask must be split into two steps
04582         if(m_uiReaderType == FEDM_ISC_TYPE_ISCLRU3000)
04583         {
04584                 if( sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No1.Mask") != string::npos ||
04585                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No2.Mask") != string::npos ||
04586                         sParaName.find("Transponder.UHF.EPC_Class1Gen2.SelectionMask.No3.Mask") != string::npos )
04587                 {
04588                         if(DataLen > 20)
04589                         {
04590                                 char cID[32];
04591                                 int FamID=0, MemID=0, Block=0, BytePos=0, ByteCnt=0, BitPos=0, BitCnt=0;
04592                                 // extract access parameters
04593                                 sscanf( sAccessID.c_str(), "%d %d %d %d %d %d %d", &FamID, &MemID, &Block, &BytePos, &ByteCnt, &BitPos, &BitCnt );
04594 
04595                                 char* sData1 = &Data[0];
04596                                 char* sData2 = &Data[20];
04597 
04598                                 // build new access id for 1st step
04599                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block, BytePos, 10, BitPos, BitCnt);
04600                                 int back = FEDM_DataBase::SetData(cID, sData1, 20);
04601                                 if(back < 0)
04602                                         return back;
04603 
04604                                 // build new access id for 2nd step
04605                                 sprintf(cID, "%02d %02d %02d %02d %02d %02d %02d", FamID, MemID, Block+1, 0, 14, BitPos, BitCnt);
04606                                 return FEDM_DataBase::SetData(cID, sData2, 28);
04607                         }
04608                 }
04609         }
04610 
04611         return FEDM_DataBase::SetData(sAccessID.c_str(), Data, DataLen);
04612 }
04613 
04614 
04616 // functions for data member access in iso-table
04618 
04619 /***************************************************************************
04620   Begin                 :       20.08.2003 / M. Hultsch
04621   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
04622 
04623   Function                      :       get one data member from a table
04624                                                 (only one byte)
04625 
04626   Parameters            :       int iIdx                -       index of table
04627                                                 unsigned int uiTableID  -       identifies the table
04628                                                 unsigned int uiDataID   -       identifies the table data
04629                                                 bool* bData             -       pointer to data buffer
04630 
04631   Return value          :       0 or error code (<0)
04632 
04633 ***************************************************************************/
04634 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, bool* bData)
04635 {
04636         FEDM_CHK3(bData);
04637 
04638         if(iIdx < 0)
04639         {
04640                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - Index < 0");
04641                 FEDM_RETURN(iIdx);
04642         }
04643 
04644         switch(uiTableID)
04645         {
04646         case FEDM_ISC_BRM_TABLE:
04647                 if(m_BRMTable.size() == 0)
04648                 {
04649                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
04650                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
04651                 }
04652 
04653                 if((unsigned int)iIdx > m_BRMTable.size())
04654                 {
04655                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - Index > size");
04656                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
04657                 }
04658 
04659                 switch(uiDataID)
04660                 {
04661                 case FEDM_ISC_DATA_IS_SNR:
04662                         *bData = m_BRMTable[iIdx]->m_bIsSnr;
04663                         break;
04664 
04665                 case FEDM_ISC_DATA_IS_EPC:
04666                         *bData = m_BRMTable[iIdx]->m_bIsEpc;
04667                         break;
04668 
04669                 case FEDM_ISC_DATA_IS_AFI:
04670                         *bData = m_BRMTable[iIdx]->m_bIsAFI;
04671                         break;
04672 
04673                 case FEDM_ISC_DATA_IS_DB:
04674                         *bData = m_BRMTable[iIdx]->m_bIsDB;
04675                         break;
04676 
04677                 case FEDM_ISC_DATA_IS_TIMER:
04678                         *bData = m_BRMTable[iIdx]->m_bIsTimer;
04679                         break;
04680 
04681                 case FEDM_ISC_DATA_IS_DATE:
04682                         *bData = m_BRMTable[iIdx]->m_bIsDate;
04683                         break;
04684 
04685                 case FEDM_ISC_DATA_IS_ANT_NR:
04686                         *bData = m_BRMTable[iIdx]->m_bIsAntNr;
04687                         break;
04688 
04689                 case FEDM_ISC_DATA_IS_INPUT:
04690                         *bData = m_BRMTable[iIdx]->m_bIsInput;
04691                         break;
04692 
04693                 case FEDM_ISC_DATA_IS_RSSI:
04694                         *bData = m_BRMTable[iIdx]->m_bIsRSSI;
04695                         break;
04696 
04697                 case FEDM_ISC_DATA_IS_MAC_ADR:
04698                         *bData = m_BRMTable[iIdx]->m_bIsMacAddr;
04699                         break;
04700 
04701                 case FEDM_ISC_DATA_TRTYPE:
04702                 case FEDM_ISC_DATA_EPC_TYPE:
04703                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
04704                 case FEDM_ISC_DATA_DB_ADR:
04705                 case FEDM_ISC_DATA_DBN:
04706                 case FEDM_ISC_DATA_ANT_NR:
04707                 case FEDM_ISC_DATA_INPUT:
04708                 case FEDM_ISC_DATA_STATE:
04709                 case FEDM_ISC_DATA_BLOCK_SIZE:
04710                 case FEDM_ISC_DATA_SNR:
04711                 case FEDM_ISC_DATA_TIMER:
04712                 case FEDM_ISC_DATA_RxDB:
04713                 case FEDM_ISC_DATA_SNR_LEN:
04714                 case FEDM_ISC_DATA_EPC:
04715                 case FEDM_ISC_DATA_ANT_COUNT:
04716                 case FEDM_ISC_DATA_ANT_STATUS:
04717                 case FEDM_ISC_DATA_ANT_RSSI:
04718                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
04719                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
04720 
04721                 default:
04722                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
04723                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
04724                         break;
04725                 }
04726                 break;
04727         
04728         case FEDM_ISC_ISO_TABLE:
04729                 if(m_ISOTable.size() == 0)
04730                 {
04731                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
04732                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
04733                 }
04734 
04735                 if((unsigned int)iIdx > m_ISOTable.size())
04736                 {
04737                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - Index > size");
04738                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
04739                 }
04740 
04741                 switch(uiDataID)
04742                 {
04743                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
04744                         *bData = m_ISOTable[iIdx]->m_bIsBlockSizeSet;
04745                         break;
04746 
04747                 case FEDM_ISC_DATA_IS_SELECTED:
04748                         *bData = m_ISOTable[iIdx]->m_bIsSelected;
04749                         break;
04750 
04751                 case FEDM_ISC_DATA_IS_SNR:
04752                         *bData = m_ISOTable[iIdx]->m_bIsSnr;
04753                         break;
04754 
04755                 case FEDM_ISC_DATA_IS_EPC:
04756                         *bData = m_ISOTable[iIdx]->m_bIsEpc;
04757                         break;
04758 
04759                 case FEDM_ISC_DATA_IS_AFI:
04760                         *bData = m_ISOTable[iIdx]->m_bIsAFI;
04761                         break;
04762 
04763                 case FEDM_ISC_DATA_IS_DSFID:
04764                 case FEDM_ISC_DATA_CHIP_ID:
04765                         *bData = m_ISOTable[iIdx]->m_bIsSnr;
04766                         break;
04767 
04768                 case FEDM_ISC_DATA_IS_TRINFO:
04769                         *bData = m_ISOTable[iIdx]->m_bIsSnr;
04770                         break;
04771 
04772                 case FEDM_ISC_DATA_IS_SYSINFO:
04773                         *bData = m_ISOTable[iIdx]->m_bIsSysInfo;
04774                         break;
04775 
04776                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
04777                         *bData = m_ISOTable[iIdx]->m_bIsISO14443_4Info;
04778                         break;
04779 
04780                 case FEDM_ISC_DATA_IS_RSSI:
04781                         *bData = m_ISOTable[iIdx]->m_bIsRSSI;
04782                         break;
04783 
04784                 case FEDM_ISC_DATA_TRTYPE:
04785                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
04786                 case FEDM_ISC_DATA_AFI:
04787                 case FEDM_ISC_DATA_DSFID:
04788                 case FEDM_ISC_DATA_IC_REF:
04789                 case FEDM_ISC_DATA_BLOCK_SIZE:
04790                 case FEDM_ISC_DATA_TRINFO:
04791                 case FEDM_ISC_DATA_OPTINFO:
04792                 case FEDM_ISC_DATA_PROTOINFO:
04793                 case FEDM_ISC_DATA_EPC:
04794                 case FEDM_ISC_DATA_EPC_TYPE:
04795                 case FEDM_ISC_DATA_EPC_HEADER:
04796                 case FEDM_ISC_DATA_EPC_DOMAIN:
04797                 case FEDM_ISC_DATA_EPC_OBJECT:
04798                 case FEDM_ISC_DATA_EPC_SNR:
04799                 case FEDM_ISC_DATA_MEM_SIZE:
04800                 case FEDM_ISC_DATA_SNR:
04801                 case FEDM_ISC_DATA_SNR_LEN:
04802                 case FEDM_ISC_DATA_SEC_STATUS:
04803                 case FEDM_ISC_DATA_TxDB:
04804                 case FEDM_ISC_DATA_RxDB:
04805                 case FEDM_ISC_DATA_TxCB:
04806                 case FEDM_ISC_DATA_RxCB:
04807                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
04808                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
04809                 case FEDM_ISC_DATA_RxDB_TID_BANK:
04810                 case FEDM_ISC_DATA_TxDB_TID_BANK:
04811                 case FEDM_ISC_DATA_RxDB_RES_BANK:
04812                 case FEDM_ISC_DATA_TxDB_RES_BANK:
04813                 case FEDM_ISC_DATA_ANT_COUNT:
04814                 case FEDM_ISC_DATA_ANT_STATUS:
04815                 case FEDM_ISC_DATA_ANT_RSSI:
04816                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
04817                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
04818 
04819                 default:
04820                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
04821                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
04822                         break;
04823                 }
04824                 break;
04825         
04826         case FEDM_ISC_CAD_TABLE:
04827                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
04828                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
04829         
04830         default:
04831                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool*) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
04832                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
04833         }
04834 
04835         FEDM_RETURN(FEDM_OK);
04836 }
04837 
04838 /***************************************************************************
04839   Begin                 :       08.06.2000 / M. Hultsch
04840   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
04841 
04842   Function                      :       get one data member from a table
04843                                                 (only one byte)
04844 
04845   Parameters            :       int iIdx                -       index of table
04846                                                 unsigned int uiTableID  -       identifies the table
04847                                                 unsigned int uiDataID   -       identifies the table data
04848                                                 unsigned char* ucData   -       pointer to data buffer
04849 
04850   Return value          :       0 or error code (<0)
04851 
04852 ***************************************************************************/
04853 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char* ucData)
04854 {
04855         FEDM_CHK3(ucData);
04856 
04857         if(iIdx < 0)
04858                 FEDM_RETURN(iIdx);
04859 
04860         int iCnt;
04861 
04862         switch(uiTableID)
04863         {
04864         case FEDM_ISC_BRM_TABLE:
04865                 if(m_BRMTable.size() == 0)
04866                 {
04867                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
04868                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
04869                 }
04870 
04871                 if((unsigned int)iIdx > m_BRMTable.size())
04872                 {
04873                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - Index > size");
04874                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
04875                 }
04876 
04877                 switch(uiDataID)
04878                 {
04879                 case FEDM_ISC_DATA_TRTYPE:
04880                         *ucData = m_BRMTable[iIdx]->m_ucTrType;
04881                         break;
04882 
04883                 case FEDM_ISC_DATA_EPC_TYPE:
04884                         *ucData = m_BRMTable[iIdx]->m_ucEpcType;
04885                         break;
04886 
04887                 case FEDM_ISC_DATA_TRINFO:
04888                         *ucData = m_BRMTable[iIdx]->m_ucIDDT; // for ISO 14443
04889                         break;
04890 
04891                 case FEDM_ISC_DATA_AFI:
04892                         *ucData = m_BRMTable[iIdx]->m_ucAFI;
04893                         break;
04894 
04895                 case FEDM_ISC_DATA_DSFID:
04896                         *ucData = m_BRMTable[iIdx]->m_ucDsfID;
04897                         break;
04898 
04899                 case FEDM_ISC_DATA_DB_ADR:
04900                         *ucData = m_BRMTable[iIdx]->m_ucDBAdr;
04901                         break;
04902 
04903                 case FEDM_ISC_DATA_BLOCK_SIZE:
04904                         *ucData = m_BRMTable[iIdx]->m_ucBlockSize;
04905                         break;
04906 
04907                 case FEDM_ISC_DATA_ANT_NR:
04908                         *ucData = m_BRMTable[iIdx]->m_ucAntNr;
04909                         break;
04910 
04911                 case FEDM_ISC_DATA_SNR_LEN:
04912                         *ucData = m_BRMTable[iIdx]->m_ucSnrLen;
04913                         break;
04914 
04915                 case FEDM_ISC_DATA_INPUT:
04916                         *ucData = m_BRMTable[iIdx]->m_ucInput;
04917                         break;
04918 
04919                 case FEDM_ISC_DATA_STATE:
04920                         *ucData = m_BRMTable[iIdx]->m_ucState;
04921                         break;
04922 
04923                 case FEDM_ISC_DATA_ANT_COUNT:
04924                         *ucData = m_BRMTable[iIdx]->m_ucAntCount;
04925                         break;
04926 
04927                 case FEDM_ISC_DATA_DBN:
04928                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
04929                 case FEDM_ISC_DATA_SNR:
04930                 case FEDM_ISC_DATA_TIMER:
04931                 case FEDM_ISC_DATA_DATE:
04932                 case FEDM_ISC_DATA_RxDB:
04933                 case FEDM_ISC_DATA_EPC:
04934                 case FEDM_ISC_DATA_ANT_STATUS:
04935                 case FEDM_ISC_DATA_ANT_RSSI:
04936                 case FEDM_ISC_DATA_MAC_ADR:
04937                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
04938                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
04939 
04940                 default:
04941                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
04942                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
04943                         break;
04944                 }
04945                 break;
04946         
04947         case FEDM_ISC_ISO_TABLE:
04948                 if(m_ISOTable.size() == 0)
04949                 {
04950                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
04951                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
04952                 }
04953 
04954                 if((unsigned int)iIdx > m_ISOTable.size())
04955                 {
04956                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - Index > size");
04957                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
04958                 }
04959 
04960                 switch(uiDataID)
04961                 {
04962                 case FEDM_ISC_DATA_TRTYPE:
04963                         *ucData = m_ISOTable[iIdx]->m_ucTrType;
04964                         break;
04965 
04966                 case FEDM_ISC_DATA_SNR_LEN:
04967                         *ucData = m_ISOTable[iIdx]->m_ucSnrLen;
04968                         break;
04969 
04970                 case FEDM_ISC_DATA_AFI:
04971                         *ucData = m_ISOTable[iIdx]->m_ucAFI;
04972                         break;
04973 
04974                 case FEDM_ISC_DATA_DSFID:
04975                         *ucData = m_ISOTable[iIdx]->m_ucDsfID;
04976                         break;
04977 
04978                 case FEDM_ISC_DATA_CHIP_ID:
04979                         *ucData = m_ISOTable[iIdx]->m_ucChipID;
04980                         break;
04981 
04982                 case FEDM_ISC_DATA_IC_REF:
04983                         *ucData = m_ISOTable[iIdx]->m_ucICRef;
04984                         break;
04985 
04986                 case FEDM_ISC_DATA_IS_SELECTED:
04987                         *ucData = (unsigned char)m_ISOTable[iIdx]->m_bIsSelected;
04988                         break;
04989 
04990                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
04991                         *ucData = (unsigned char)m_ISOTable[iIdx]->m_bIsISO14443_4Info;
04992                         break;
04993 
04994                 case FEDM_ISC_DATA_IS_EPC:
04995                         *ucData = (unsigned char)m_ISOTable[iIdx]->m_bIsEpc;
04996                         break;
04997 
04998                 case FEDM_ISC_DATA_BLOCK_SIZE:
04999                         *ucData = m_ISOTable[iIdx]->m_ucBlockSize;
05000                         break;
05001 
05002                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
05003                         *ucData = (unsigned char)m_ISOTable[iIdx]->m_bIsBlockSizeSet;
05004                         break;
05005 
05006                 case FEDM_ISC_DATA_TRINFO:
05007                         *ucData = m_ISOTable[iIdx]->m_ucTrInfo;
05008                         break;
05009 
05010                 case FEDM_ISC_DATA_OPTINFO:
05011                         *ucData = m_ISOTable[iIdx]->m_ucOptInfo;
05012                         break;
05013 
05014                 case FEDM_ISC_DATA_PROTOINFO:
05015                         *ucData = m_ISOTable[iIdx]->m_ucProtoInfo;
05016                         break;
05017 
05018                 case FEDM_ISC_DATA_EPC_TYPE:
05019                         *ucData = m_ISOTable[iIdx]->m_ucEpcType;
05020                         break;
05021 
05022                 case FEDM_ISC_DATA_FSCI:
05023                         *ucData = m_ISOTable[iIdx]->m_ucFSCI;
05024                         break;
05025 
05026                 case FEDM_ISC_DATA_FWI:
05027                         *ucData = m_ISOTable[iIdx]->m_ucFWI;
05028                         break;
05029 
05030                 case FEDM_ISC_DATA_DSI:
05031                         *ucData = m_ISOTable[iIdx]->m_ucDSI;
05032                         break;
05033 
05034                 case FEDM_ISC_DATA_DRI:
05035                         *ucData = m_ISOTable[iIdx]->m_ucDRI;
05036                         break;
05037 
05038                 case FEDM_ISC_DATA_NAD:
05039                         *ucData = m_ISOTable[iIdx]->m_ucNad;
05040                         break;
05041 
05042                 case FEDM_ISC_DATA_CID:
05043                         *ucData = m_ISOTable[iIdx]->m_ucCid;
05044                         break;
05045 
05046                 case FEDM_ISC_DATA_MEM_SIZE_LEN:
05047                         *ucData = m_ISOTable[iIdx]->m_ucMemSizeLen;
05048                         break;
05049 
05050                 case FEDM_ISC_DATA_ANT_COUNT:
05051                         *ucData = m_ISOTable[iIdx]->m_ucAntCount;
05052                         break;
05053 
05054                 case FEDM_ISC_DATA_EPC:
05055                 case FEDM_ISC_DATA_EPC_HEADER:
05056                 case FEDM_ISC_DATA_EPC_DOMAIN:
05057                 case FEDM_ISC_DATA_EPC_OBJECT:
05058                 case FEDM_ISC_DATA_EPC_SNR:
05059                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
05060                 case FEDM_ISC_DATA_MEM_SIZE:
05061                 case FEDM_ISC_DATA_SNR:
05062                 case FEDM_ISC_DATA_SEC_STATUS:
05063                 case FEDM_ISC_DATA_TxDB:
05064                 case FEDM_ISC_DATA_RxDB:
05065                 case FEDM_ISC_DATA_TxCB:
05066                 case FEDM_ISC_DATA_RxCB:
05067                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
05068                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
05069                 case FEDM_ISC_DATA_RxDB_TID_BANK:
05070                 case FEDM_ISC_DATA_TxDB_TID_BANK:
05071                 case FEDM_ISC_DATA_RxDB_RES_BANK:
05072                 case FEDM_ISC_DATA_TxDB_RES_BANK:
05073                 case FEDM_ISC_DATA_ANT_STATUS:
05074                 case FEDM_ISC_DATA_ANT_RSSI:
05075                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05076                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05077 
05078                 default:
05079                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05080                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05081                         break;
05082                 }
05083                 break;
05084         
05085 #if !defined(__BORLANDC__)
05086         case FEDM_ISC_CAD_TABLE:
05087                 switch(uiDataID)
05088                 {
05089                 case FEDM_ISC_DATA_POWER_AVG:
05090                         if(iIdx<0 || iIdx>=15)
05091                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05092 
05093                         *ucData = m_CADTable.m_ucPowerAvg[iIdx];
05094                         break;
05095 
05096                 case FEDM_ISC_DATA_POWER_PEAK:
05097                         if(iIdx<0 || iIdx>=15)
05098                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05099 
05100                         *ucData = m_CADTable.m_ucPowerPeak[iIdx];
05101                         break;
05102 
05103                 case FEDM_ISC_DATA_HISTORY_ALLOC:
05104                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05105 
05106                 case FEDM_ISC_DATA_HISTORY_TX:
05107                         // request of number of record sets
05108                         iCnt = (int)m_CADTable.m_History.size();
05109                         if(iIdx<0 || iIdx>=iCnt)
05110                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05111 
05112                         *ucData = m_CADTable.m_History[iIdx]->ucTxChannel;
05113                         break;
05114 
05115                 case FEDM_ISC_DATA_HISTORY_RX:
05116                         // request of number of record sets
05117                         iCnt = (int)m_CADTable.m_History.size();
05118                         if(iIdx<0 || iIdx>=iCnt)
05119                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05120 
05121                         *ucData = m_CADTable.m_History[iIdx]->ucRxChannel;
05122                         break;
05123 
05124                 default:
05125                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05126                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05127                 }
05128                 break;
05129 #endif
05130 
05131         default:
05132                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
05133                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
05134                 break;
05135         }
05136 
05137         FEDM_RETURN(FEDM_OK);
05138 }
05139 
05140 /***************************************************************************
05141   Begin                 :       08.06.2000 / M. Hultsch
05142   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
05143 
05144   Function                      :       get one data member from a table
05145                                                 (one or more than one byte)
05146 
05147   Parameters            :       int iIdx                -       index of table
05148                                                 unsigned int uiTableID  -       identifies the table
05149                                                 unsigned int uiDataID   -       identifies the table data
05150                                                 unsigned char* ucData   -       pointer to data buffer
05151                                                 int iDataBufLen -       length of ucData
05152 
05153   Return value          :       0 or error code (<0)
05154 
05155 ***************************************************************************/
05156 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char* ucData, int iDataBufLen)
05157 {
05158         FEDM_CHK3(ucData);
05159 
05160         if(iIdx < 0)
05161         {
05162                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - Index < 0");
05163                 FEDM_RETURN(iIdx);
05164         }
05165 
05166         if(iDataBufLen == 0)
05167                 return FEDM_OK; // nothing to do
05168 
05169         if(iDataBufLen < 0)
05170         {
05171                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05172                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05173         }
05174 
05175         int i;
05176         int iCnt = 0;
05177         int iLen = 0;
05178         int iErr = 0;
05179 
05180         switch(uiTableID)
05181         {
05182         case FEDM_ISC_BRM_TABLE:
05183                 if(m_BRMTable.size() == 0)
05184                 {
05185                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
05186                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
05187                 }
05188 
05189                 if((unsigned int)iIdx > m_BRMTable.size())
05190                 {
05191                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - Index > size");
05192                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
05193                 }
05194 
05195                 switch(uiDataID)
05196                 {
05197                 case FEDM_ISC_DATA_EPC:
05198                 case FEDM_ISC_DATA_SNR:
05199                         if(iDataBufLen < m_BRMTable[iIdx]->m_ucSnrLen)
05200                         {
05201                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05202                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05203                         }
05204 
05205                         for(iCnt=0; iCnt<m_BRMTable[iIdx]->m_ucSnrLen; iCnt++)
05206                                 ucData[iCnt] = m_BRMTable[iIdx]->m_ucSnr[iCnt];
05207                         break;
05208 
05209                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
05210                         ucData[0] = m_BRMTable[iIdx]->m_ucClass1Gen2_PC[0];
05211                         ucData[1] = m_BRMTable[iIdx]->m_ucClass1Gen2_PC[1];
05212                         break;
05213 
05214                 case FEDM_ISC_DATA_TRTYPE:
05215                         ucData[0] = m_BRMTable[iIdx]->m_ucTrType;
05216                         break;
05217 
05218                 case FEDM_ISC_DATA_EPC_TYPE:
05219                         ucData[0] = m_BRMTable[iIdx]->m_ucEpcType;
05220                         break;
05221 
05222                 case FEDM_ISC_DATA_TRINFO:
05223                         ucData[0] = m_BRMTable[iIdx]->m_ucIDDT; // for ISO 14443
05224                         break;
05225 
05226                 case FEDM_ISC_DATA_AFI:
05227                         ucData[0] = m_BRMTable[iIdx]->m_ucAFI;
05228                         break;
05229 
05230                 case FEDM_ISC_DATA_DSFID:
05231                         ucData[0] = m_BRMTable[iIdx]->m_ucDsfID;
05232                         break;
05233 
05234                 case FEDM_ISC_DATA_TIMER:
05235                         if(iDataBufLen < 4)
05236                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05237 
05238                         for(iCnt=0; iCnt<4; iCnt++)
05239                                 ucData[iCnt] = m_BRMTable[iIdx]->m_ucTimer[iCnt];
05240                         break;
05241 
05242                 case FEDM_ISC_DATA_DATE:
05243                         if(iDataBufLen < 5)
05244                         {
05245                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05246                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05247                         }
05248 
05249                         for(iCnt=0; iCnt<5; iCnt++)
05250                                 ucData[iCnt] = m_BRMTable[iIdx]->m_ucDate[iCnt];
05251                         break;
05252 
05253                 case FEDM_ISC_DATA_DB_ADR:
05254                         ucData[0] = m_BRMTable[iIdx]->m_ucDBAdr;
05255                         break;
05256 
05257                 case FEDM_ISC_DATA_ANT_NR:
05258                         ucData[0] = m_BRMTable[iIdx]->m_ucAntNr;
05259                         break;
05260 
05261                 case FEDM_ISC_DATA_SNR_LEN:
05262                         ucData[0] = m_BRMTable[iIdx]->m_ucSnrLen;
05263                         break;
05264 
05265                 case FEDM_ISC_DATA_INPUT:
05266                         ucData[0] = m_BRMTable[iIdx]->m_ucInput;
05267                         break;
05268 
05269                 case FEDM_ISC_DATA_STATE:
05270                         ucData[0] = m_BRMTable[iIdx]->m_ucState;
05271                         break;
05272 
05273                 case FEDM_ISC_DATA_DBN:
05274                         ucData[0] = ((m_BRMTable[iIdx]->m_uiDBN & 0xFF00) >> 8);
05275                         ucData[1] =  (m_BRMTable[iIdx]->m_uiDBN & 0x00FF);
05276                         break;
05277 
05278                 case FEDM_ISC_DATA_BLOCK_SIZE:
05279                         ucData[0] = m_BRMTable[iIdx]->m_ucBlockSize;
05280                         break;
05281 
05282                 case FEDM_ISC_DATA_RxDB:
05283                         if(iDataBufLen < FEDM_ISC_BRM_TABLE_RxDB_SIZE)
05284                         {
05285                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05286                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05287                         }
05288                         memcpy(ucData, &m_BRMTable[iIdx]->m_ucRxDB[0], FEDM_ISC_BRM_TABLE_RxDB_SIZE);
05289                         break;
05290 
05291                 case FEDM_ISC_DATA_ANT_COUNT:
05292                         ucData[0] = m_BRMTable[iIdx]->m_ucAntCount;
05293                         break;
05294 
05295                 case FEDM_ISC_DATA_ANT_RSSI:
05296                         if(m_BRMTable[iIdx]->m_ucAntCount > FEDM_ISC_BRM_TABLE_MAX_ANTENNA)
05297                         {
05298                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
05299                                 return FEDM_ERROR_ARRAY_BOUNDARY;
05300                         }
05301 
05302                         ucData[iCnt++] = m_BRMTable[iIdx]->m_ucAntCount;
05303                         for(i=0; i<m_BRMTable[iIdx]->m_ucAntCount; i++)
05304                         {
05305                                 ucData[iCnt++] = m_BRMTable[iIdx]->m_ucAntNumber[i];
05306                                 ucData[iCnt++] = m_BRMTable[iIdx]->m_ucAntRSSI[i];
05307                         }
05308                         break;
05309 
05310                 case FEDM_ISC_DATA_MAC_ADR:
05311                         for(i=0; i<6; i++)
05312                                 ucData[iCnt++] = m_BRMTable[iIdx]->m_ucMacAddress[i];
05313                         break;
05314 
05315                 case FEDM_ISC_DATA_ANT_STATUS:
05316                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05317                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05318 
05319                 default:
05320                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
05321                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05322                 }
05323                 break;
05324         
05325         case FEDM_ISC_ISO_TABLE:
05326                 if(m_ISOTable.size() == 0)
05327                 {
05328                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
05329                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
05330                 }
05331 
05332                 if((unsigned int)iIdx > m_ISOTable.size())
05333                 {
05334                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - Index > size");
05335                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
05336                 }
05337 
05338                 switch(uiDataID)
05339                 {
05340                 case FEDM_ISC_DATA_SNR:
05341                         if(iDataBufLen < m_ISOTable[iIdx]->m_ucSnrLen)
05342                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05343 
05344                         for(iCnt=0; iCnt<m_ISOTable[iIdx]->m_ucSnrLen; iCnt++)
05345                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucSnr[iCnt];
05346                         break;
05347 
05348                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
05349                         ucData[0] = m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0];
05350                         ucData[1] = m_ISOTable[iIdx]->m_ucClass1Gen2_PC[1];
05351                         break;
05352 
05353                 case FEDM_ISC_DATA_TRTYPE:
05354                         ucData[0] = m_ISOTable[iIdx]->m_ucTrType;
05355                         break;
05356 
05357                 case FEDM_ISC_DATA_SNR_LEN:
05358                         ucData[0] = m_ISOTable[iIdx]->m_ucSnrLen;
05359                         break;
05360 
05361                 case FEDM_ISC_DATA_AFI:
05362                         ucData[0] = m_ISOTable[iIdx]->m_ucAFI;
05363                         break;
05364 
05365                 case FEDM_ISC_DATA_DSFID:
05366                         ucData[0] = m_ISOTable[iIdx]->m_ucDsfID;
05367                         break;
05368 
05369                 case FEDM_ISC_DATA_CHIP_ID:
05370                         ucData[0] = m_ISOTable[iIdx]->m_ucChipID;
05371                         break;
05372 
05373                 case FEDM_ISC_DATA_MEM_SIZE:
05374                         if(iDataBufLen < 2)
05375                         {
05376                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05377                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05378                         }
05379                         else if(iDataBufLen == 2)
05380                         {
05381                                 iLen = 2;
05382                         }
05383                         else if(iDataBufLen > 2)
05384                         {
05385                                 if(m_ISOTable[iIdx]->m_ucMemSizeLen == 2)
05386                                         iLen = 2;
05387                                 else
05388                                         iLen = 3;
05389                         }
05390 
05391                         for(iCnt=0; iCnt<iLen; iCnt++)
05392                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucMemSize[iCnt];
05393                         break;
05394 
05395                 case FEDM_ISC_DATA_IC_REF:
05396                         ucData[0] = m_ISOTable[iIdx]->m_ucICRef;
05397                         break;
05398 
05399                 case FEDM_ISC_DATA_IS_SELECTED:
05400                         ucData[0] = (unsigned char)m_ISOTable[iIdx]->m_bIsSelected;
05401                         break;
05402 
05403                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
05404                         ucData[0] = (unsigned char)m_ISOTable[iIdx]->m_bIsISO14443_4Info;
05405                         break;
05406 
05407                 case FEDM_ISC_DATA_IS_EPC:
05408                         ucData[0] = (unsigned char)m_ISOTable[iIdx]->m_bIsEpc;
05409                         break;
05410 
05411                 case FEDM_ISC_DATA_BLOCK_SIZE:
05412                         ucData[0] = m_ISOTable[iIdx]->m_ucBlockSize;
05413                         break;
05414 
05415                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
05416                         ucData[0] = (unsigned char)m_ISOTable[iIdx]->m_bIsBlockSizeSet;
05417                         break;
05418 
05419                 case FEDM_ISC_DATA_TRINFO:
05420                         ucData[0] = m_ISOTable[iIdx]->m_ucTrInfo;
05421                         break;
05422 
05423                 case FEDM_ISC_DATA_OPTINFO:
05424                         ucData[0] = m_ISOTable[iIdx]->m_ucOptInfo;
05425                         break;
05426 
05427                 case FEDM_ISC_DATA_PROTOINFO:
05428                         ucData[0] = m_ISOTable[iIdx]->m_ucProtoInfo;
05429                         break;
05430 
05431                 case FEDM_ISC_DATA_EPC_TYPE:
05432                         ucData[0] = m_ISOTable[iIdx]->m_ucEpcType;
05433                         break;
05434 
05435                 case FEDM_ISC_DATA_FSCI:
05436                         ucData[0] = m_ISOTable[iIdx]->m_ucFSCI;
05437                         break;
05438 
05439                 case FEDM_ISC_DATA_FWI:
05440                         ucData[0] = m_ISOTable[iIdx]->m_ucFWI;
05441                         break;
05442 
05443                 case FEDM_ISC_DATA_DSI:
05444                         ucData[0] = m_ISOTable[iIdx]->m_ucDSI;
05445                         break;
05446 
05447                 case FEDM_ISC_DATA_DRI:
05448                         ucData[0] = m_ISOTable[iIdx]->m_ucDRI;
05449                         break;
05450 
05451                 case FEDM_ISC_DATA_NAD:
05452                         ucData[0] = m_ISOTable[iIdx]->m_ucNad;
05453                         break;
05454 
05455                 case FEDM_ISC_DATA_CID:
05456                         ucData[0] = m_ISOTable[iIdx]->m_ucCid;
05457                         break;
05458 
05459                 case FEDM_ISC_DATA_EPC:
05460                         switch(m_ISOTable[iIdx]->m_ucEpcType)
05461                         {
05462                         case FEDM_ISC_EPC_TYPE_1:
05463                                 if(iDataBufLen < 12)
05464                                 {
05465                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05466                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05467                                 }
05468                                 FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpcRaw(ucData, 12));
05469                                 break;
05470                         case FEDM_ISC_EPC_TYPE_2:
05471                         case FEDM_ISC_EPC_TYPE_3:
05472                         case FEDM_ISC_EPC_TYPE_4:
05473                                 if(iDataBufLen < 8)
05474                                 {
05475                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05476                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05477                                 }
05478                                 FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpcRaw(ucData, 8));
05479                                 break;
05480                         default:
05481                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
05482                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
05483                         }
05484 
05485                         break;
05486 
05487                 case FEDM_ISC_DATA_ANT_RSSI:
05488                         iCnt = 0;
05489                         if(m_ISOTable[iIdx]->m_ucAntCount > FEDM_ISC_ISO_TABLE_MAX_ANTENNA)
05490                         {
05491                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
05492                                 return FEDM_ERROR_ARRAY_BOUNDARY;
05493                         }
05494 
05495                         ucData[iCnt++] = m_ISOTable[iIdx]->m_ucAntCount;
05496                         for(i=0; i<m_ISOTable[iIdx]->m_ucAntCount; i++)
05497                         {
05498                                 ucData[iCnt++] = m_ISOTable[iIdx]->m_ucAntNumber[i];
05499                                 ucData[iCnt++] = m_ISOTable[iIdx]->m_ucAntStatus[i];
05500                                 ucData[iCnt++] = m_ISOTable[iIdx]->m_ucAntRSSI[i];
05501                         }
05502                         break;
05503 
05504                 case FEDM_ISC_DATA_EPC_HEADER:
05505                 case FEDM_ISC_DATA_EPC_DOMAIN:
05506                 case FEDM_ISC_DATA_EPC_OBJECT:
05507                 case FEDM_ISC_DATA_EPC_SNR:
05508                 case FEDM_ISC_DATA_ANT_STATUS:
05509                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05510                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05511 
05512                 case FEDM_ISC_DATA_SEC_STATUS:
05513                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucSecStatus.size())
05514                         {
05515                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05516                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05517                         }
05518                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucSecStatus[0], m_ISOTable[iIdx]->m_ucSecStatus.size());
05519                         break;
05520 
05521                 case FEDM_ISC_DATA_TxDB:
05522                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB.size())
05523                         {
05524                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05525                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05526                         }
05527                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxDB[0], m_ISOTable[iIdx]->m_ucTxDB.size());
05528                         break;
05529 
05530                 case FEDM_ISC_DATA_RxDB:
05531                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB.size())
05532                         {
05533                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05534                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05535                         }
05536                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxDB[0], m_ISOTable[iIdx]->m_ucRxDB.size());
05537                         break;
05538 
05539                 case FEDM_ISC_DATA_TxCB:
05540                         if(iDataBufLen < 16)
05541                         {
05542                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05543                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05544                         }
05545                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxCB[0], 16);
05546                         break;
05547 
05548                 case FEDM_ISC_DATA_RxCB:
05549                         if(iDataBufLen < 16)
05550                         {
05551                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05552                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05553                         }
05554                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxCB[0], 16);
05555                         break;
05556 
05557                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
05558                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
05559                         {
05560                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05561                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05562                         }
05563                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxDB_EpcBank[0], m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size());
05564                         break;
05565 
05566                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
05567                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
05568                         {
05569                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05570                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05571                         }
05572                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxDB_EpcBank[0], m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size());
05573                         break;
05574 
05575                 case FEDM_ISC_DATA_RxDB_TID_BANK:
05576                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
05577                         {
05578                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05579                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05580                         }
05581                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxDB_TidBank[0], m_ISOTable[iIdx]->m_ucRxDB_TidBank.size());
05582                         break;
05583 
05584                 case FEDM_ISC_DATA_TxDB_TID_BANK:
05585                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
05586                         {
05587                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05588                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05589                         }
05590                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxDB_TidBank[0], m_ISOTable[iIdx]->m_ucTxDB_TidBank.size());
05591                         break;
05592 
05593                 case FEDM_ISC_DATA_RxDB_RES_BANK:
05594                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
05595                         {
05596                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05597                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05598                         }
05599                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxDB_ResBank[0], m_ISOTable[iIdx]->m_ucRxDB_ResBank.size());
05600                         break;
05601 
05602                 case FEDM_ISC_DATA_TxDB_RES_BANK:
05603                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
05604                         {
05605                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
05606                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
05607                         }
05608                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxDB_ResBank[0], m_ISOTable[iIdx]->m_ucTxDB_ResBank.size());
05609                         break;
05610 
05611                 default:
05612                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
05613                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05614                 }
05615                 break;
05616         
05617         case FEDM_ISC_CAD_TABLE:
05618                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05619                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05620                 
05621         default:
05622                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
05623                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
05624         }
05625 
05626         FEDM_RETURN(FEDM_OK);
05627 }
05628 
05629 /***************************************************************************
05630   Begin                 :       17.11.2000 / M. Hultsch
05631   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
05632 
05633   Function                      :       get one data member from a table
05634 
05635   Parameters            :       int iIdx                -       index of table
05636                                                 unsigned int uiTableID  -       identifies the table
05637                                                 unsigned int uiDataID   -       identifies the table data
05638                                                 unsigned int* uiData    -       pointer to data buffer
05639 
05640   Return value          :       0 or error code (<0)
05641 
05642 ***************************************************************************/
05643 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int* uiData)
05644 {
05645         FEDM_CHK3(uiData);
05646 
05647         if(iIdx < 0)
05648         {
05649                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - Index < 0");
05650                 FEDM_RETURN(iIdx);
05651         }
05652 
05653         int iCnt = 0;
05654 
05655         switch(uiTableID)
05656         {
05657         case FEDM_ISC_BRM_TABLE:
05658                 if(m_BRMTable.size() == 0)
05659                 {
05660                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
05661                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
05662                 }
05663 
05664                 if((unsigned int)iIdx > m_BRMTable.size())
05665                 {
05666                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - Index > size");
05667                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
05668                 }
05669 
05670                 switch(uiDataID)
05671                 {
05672                 case FEDM_ISC_DATA_TRTYPE:
05673                         *uiData = m_BRMTable[iIdx]->m_ucTrType;
05674                         break;
05675 
05676                 case FEDM_ISC_DATA_EPC_TYPE:
05677                         *uiData = m_BRMTable[iIdx]->m_ucEpcType;
05678                         break;
05679 
05680                 case FEDM_ISC_DATA_TRINFO:
05681                         *uiData = m_BRMTable[iIdx]->m_ucIDDT; // for ISO 14443
05682                         break;
05683 
05684                 case FEDM_ISC_DATA_AFI:
05685                         *uiData = m_BRMTable[iIdx]->m_ucAFI;
05686                         break;
05687 
05688                 case FEDM_ISC_DATA_DSFID:
05689                         *uiData = m_BRMTable[iIdx]->m_ucDsfID;
05690                         break;
05691 
05692                 case FEDM_ISC_DATA_DB_ADR:
05693                         *uiData = m_BRMTable[iIdx]->m_ucDBAdr;
05694                         break;
05695 
05696                 case FEDM_ISC_DATA_DBN:
05697                         *uiData = m_BRMTable[iIdx]->m_uiDBN;
05698                         break;
05699 
05700                 case FEDM_ISC_DATA_BLOCK_SIZE:
05701                         *uiData = m_BRMTable[iIdx]->m_ucBlockSize;
05702                         break;
05703 
05704                 case FEDM_ISC_DATA_ANT_NR:
05705                         *uiData = m_BRMTable[iIdx]->m_ucAntNr;
05706                         break;
05707 
05708                 case FEDM_ISC_DATA_SNR_LEN:
05709                         *uiData = m_BRMTable[iIdx]->m_ucSnrLen;
05710                         break;
05711 
05712                 case FEDM_ISC_DATA_INPUT:
05713                         *uiData = m_BRMTable[iIdx]->m_ucInput;
05714                         break;
05715 
05716                 case FEDM_ISC_DATA_STATE:
05717                         *uiData = m_BRMTable[iIdx]->m_ucState;
05718                         break;
05719 
05720                 case FEDM_ISC_DATA_ANT_COUNT:
05721                         *uiData = m_BRMTable[iIdx]->m_ucAntCount;
05722                         break;
05723 
05724                 case FEDM_ISC_DATA_TIMER:
05725                         *uiData  = m_BRMTable[iIdx]->m_ucTimer[0]<<24;
05726                         *uiData += m_BRMTable[iIdx]->m_ucTimer[1]<<16;
05727                         *uiData += m_BRMTable[iIdx]->m_ucTimer[2]<<8;
05728                         *uiData += m_BRMTable[iIdx]->m_ucTimer[3];
05729                         break;
05730 
05731                 case FEDM_ISC_DATA_DATE:
05732                 case FEDM_ISC_DATA_SNR:
05733                 case FEDM_ISC_DATA_RxDB:
05734                 case FEDM_ISC_DATA_EPC:
05735                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
05736                 case FEDM_ISC_DATA_ANT_STATUS:
05737                 case FEDM_ISC_DATA_ANT_RSSI:
05738                 case FEDM_ISC_DATA_MAC_ADR:
05739                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05740                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05741 
05742                 default:
05743                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05744                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05745                 }
05746                 break;
05747 
05748         case FEDM_ISC_ISO_TABLE:
05749 
05750                 if(m_ISOTable.size() == 0)
05751                 {
05752                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
05753                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
05754                 }
05755 
05756                 if((unsigned int)iIdx > m_ISOTable.size())
05757                 {
05758                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - Index > size");
05759                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
05760                 }
05761                 
05762                 switch(uiDataID)
05763                 {
05764                 case FEDM_ISC_DATA_TRTYPE:
05765                         *uiData = m_ISOTable[iIdx]->m_ucTrType;
05766                         break;
05767 
05768                 case FEDM_ISC_DATA_SNR_LEN:
05769                         *uiData = m_ISOTable[iIdx]->m_ucSnrLen;
05770                         break;
05771 
05772                 case FEDM_ISC_DATA_AFI:
05773                         *uiData = m_ISOTable[iIdx]->m_ucAFI;
05774                         break;
05775 
05776                 case FEDM_ISC_DATA_DSFID:
05777                         *uiData = m_ISOTable[iIdx]->m_ucDsfID;
05778                         break;
05779 
05780                 case FEDM_ISC_DATA_CHIP_ID:
05781                         *uiData = m_ISOTable[iIdx]->m_ucChipID;
05782                         break;
05783 
05784                 case FEDM_ISC_DATA_IC_REF:
05785                         *uiData = m_ISOTable[iIdx]->m_ucICRef;
05786                         break;
05787 
05788                 case FEDM_ISC_DATA_IS_SELECTED:
05789                         *uiData = (unsigned int)m_ISOTable[iIdx]->m_bIsSelected;
05790                         break;
05791 
05792                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
05793                         *uiData = (unsigned int)m_ISOTable[iIdx]->m_bIsISO14443_4Info;
05794                         break;
05795 
05796                 case FEDM_ISC_DATA_IS_EPC:
05797                         *uiData = (unsigned int)m_ISOTable[iIdx]->m_bIsEpc;
05798                         break;
05799 
05800                 case FEDM_ISC_DATA_BLOCK_SIZE:
05801                         *uiData = m_ISOTable[iIdx]->m_ucBlockSize;
05802                         break;
05803 
05804                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
05805                         *uiData = (unsigned int)m_ISOTable[iIdx]->m_bIsBlockSizeSet;
05806                         break;
05807 
05808                 case FEDM_ISC_DATA_TRINFO:
05809                         *uiData = m_ISOTable[iIdx]->m_ucTrInfo;
05810                         break;
05811 
05812                 case FEDM_ISC_DATA_OPTINFO:
05813                         *uiData = m_ISOTable[iIdx]->m_ucOptInfo;
05814                         break;
05815 
05816                 case FEDM_ISC_DATA_PROTOINFO:
05817                         *uiData = m_ISOTable[iIdx]->m_ucProtoInfo;
05818                         break;
05819 
05820                 case FEDM_ISC_DATA_EPC_TYPE:
05821                         *uiData = m_ISOTable[iIdx]->m_ucEpcType;
05822                         break;
05823 
05824                 case FEDM_ISC_DATA_EPC_HEADER:
05825                         *uiData = m_ISOTable[iIdx]->GetEpcHeader();
05826                         if(((int)*uiData) < 0)
05827                                 FEDM_RETURN((int)*uiData);
05828                         break;
05829                         
05830                 case FEDM_ISC_DATA_MEM_SIZE:
05831                         if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
05832                         {
05833                                 *uiData  = ((unsigned int)(m_ISOTable[iIdx]->m_ucMemSize[0])<<16);
05834                                 *uiData += ((unsigned int)(m_ISOTable[iIdx]->m_ucMemSize[1])<<8);
05835                                 *uiData += ( unsigned int)(m_ISOTable[iIdx]->m_ucMemSize[2]);
05836                         }
05837                         else
05838                         {
05839                                 *uiData  = ((unsigned int)(m_ISOTable[iIdx]->m_ucMemSize[0])<<8);
05840                                 *uiData += ( unsigned int)(m_ISOTable[iIdx]->m_ucMemSize[1]);
05841                         }
05842 
05843                         break;
05844 
05845                 case FEDM_ISC_DATA_FSCI:
05846                         *uiData = m_ISOTable[iIdx]->m_ucFSCI;
05847                         break;
05848 
05849                 case FEDM_ISC_DATA_FWI:
05850                         *uiData = m_ISOTable[iIdx]->m_ucFWI;
05851                         break;
05852 
05853                 case FEDM_ISC_DATA_DSI:
05854                         *uiData = m_ISOTable[iIdx]->m_ucDSI;
05855                         break;
05856 
05857                 case FEDM_ISC_DATA_DRI:
05858                         *uiData = m_ISOTable[iIdx]->m_ucDRI;
05859                         break;
05860 
05861                 case FEDM_ISC_DATA_NAD:
05862                         *uiData = m_ISOTable[iIdx]->m_ucNad;
05863                         break;
05864 
05865                 case FEDM_ISC_DATA_CID:
05866                         *uiData = m_ISOTable[iIdx]->m_ucCid;
05867                         break;
05868 
05869                 case FEDM_ISC_DATA_VALUE:
05870                         *uiData = m_ISOTable[iIdx]->m_uiValue;
05871                         break;
05872 
05873                 case FEDM_ISC_DATA_ANT_COUNT:
05874                         *uiData = m_ISOTable[iIdx]->m_ucAntCount;
05875                         break;
05876 
05877                 case FEDM_ISC_DATA_EPC:
05878                 case FEDM_ISC_DATA_EPC_DOMAIN:
05879                 case FEDM_ISC_DATA_EPC_OBJECT:
05880                 case FEDM_ISC_DATA_EPC_SNR:
05881                 case FEDM_ISC_DATA_SNR:
05882                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
05883                 case FEDM_ISC_DATA_SEC_STATUS:
05884                 case FEDM_ISC_DATA_TxDB:
05885                 case FEDM_ISC_DATA_RxDB:
05886                 case FEDM_ISC_DATA_TxCB:
05887                 case FEDM_ISC_DATA_RxCB:
05888                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
05889                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
05890                 case FEDM_ISC_DATA_RxDB_TID_BANK:
05891                 case FEDM_ISC_DATA_TxDB_TID_BANK:
05892                 case FEDM_ISC_DATA_RxDB_RES_BANK:
05893                 case FEDM_ISC_DATA_TxDB_RES_BANK:
05894                 case FEDM_ISC_DATA_ANT_NR:
05895                 case FEDM_ISC_DATA_ANT_STATUS:
05896                 case FEDM_ISC_DATA_ANT_RSSI:
05897                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
05898                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
05899 
05900                 default:
05901                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05902                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05903                 }
05904                 break;
05905         
05906 #if !defined(__BORLANDC__)
05907         case FEDM_ISC_CAD_TABLE:
05908                 switch(uiDataID)
05909                 {
05910                 case FEDM_ISC_DATA_POWER_AVG:
05911                         if(iIdx<0 || iIdx>=15)
05912                         {
05913                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05914                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05915                         }
05916 
05917                         *uiData = m_CADTable.m_ucPowerAvg[iIdx];
05918                         break;
05919 
05920                 case FEDM_ISC_DATA_POWER_PEAK:
05921                         if(iIdx<0 || iIdx>=15)
05922                         {
05923                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05924                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05925                         }
05926 
05927                         *uiData = m_CADTable.m_ucPowerPeak[iIdx];
05928                         break;
05929 
05930                 case FEDM_ISC_DATA_HISTORY_ALLOC:
05931                         // request of number of record sets
05932                         iCnt = (int)m_CADTable.m_History.size();
05933                         if(iIdx<0 || iIdx>=iCnt)
05934                         {
05935                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05936                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05937                         }
05938 
05939                         *uiData = m_CADTable.m_History[iIdx]->uiAlloc;
05940                         break;
05941 
05942                 case FEDM_ISC_DATA_HISTORY_TX:
05943                         // request of number of record sets
05944                         iCnt = (int)m_CADTable.m_History.size();
05945                         if(iIdx<0 || iIdx>=iCnt)
05946                         {
05947                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05948                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05949                         }
05950 
05951                         *uiData = m_CADTable.m_History[iIdx]->ucTxChannel;
05952                         break;
05953 
05954                 case FEDM_ISC_DATA_HISTORY_RX:
05955                         // request of number of record sets
05956                         iCnt = (int)m_CADTable.m_History.size();
05957                         if(iIdx<0 || iIdx>=iCnt)
05958                         {
05959                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05960                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
05961                         }
05962 
05963                         *uiData = m_CADTable.m_History[iIdx]->ucRxChannel;
05964                         break;
05965 
05966                 default:
05967                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
05968                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
05969                 }
05970                 break;
05971 #endif          
05972         default:
05973                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint*) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
05974                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
05975         }
05976 
05977         FEDM_RETURN(FEDM_OK);
05978 }
05979 
05980 /***************************************************************************
05981   Begin                 :       17.11.2000 / M. Hultsch
05982   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
05983 
05984   Function                      :       get one data member from a table
05985 
05986   Parameters            :       int iIdx                        -       index of table
05987                                                 unsigned int uiTableID          -       identifies the table
05988                                                 unsigned int uiDataID           -       identifies the table data
05989                                                 __int64* i64Data        -       pointer to data buffer
05990 
05991   Return value          :       0 or error code (<0)
05992 
05993 ***************************************************************************/
05994 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, __int64* i64Data)
05995 {
05996         FEDM_CHK3(i64Data);
05997 
05998         if(iIdx < 0)
05999         {
06000                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - Index < 0");
06001                 FEDM_RETURN(iIdx);
06002         }
06003 
06004         switch(uiTableID)
06005         {
06006         case FEDM_ISC_BRM_TABLE:
06007                 if(m_BRMTable.size() == 0)
06008                 {
06009                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06010                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06011                 }
06012 
06013                 if((unsigned int)iIdx > m_BRMTable.size())
06014                 {
06015                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - Index > size");
06016                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06017                 }
06018 
06019                 switch(uiDataID)
06020                 {
06021                 case FEDM_ISC_DATA_SNR:
06022                         *i64Data = m_BRMTable[iIdx]->GetSnr();  // only the lower 8 bytes
06023                         break;
06024 
06025                 case FEDM_ISC_DATA_TRTYPE:
06026                 case FEDM_ISC_DATA_EPC_TYPE:
06027                 case FEDM_ISC_DATA_AFI:
06028                 case FEDM_ISC_DATA_DSFID:
06029                 case FEDM_ISC_DATA_TIMER:
06030                 case FEDM_ISC_DATA_DATE:
06031                 case FEDM_ISC_DATA_DB_ADR:
06032                 case FEDM_ISC_DATA_DBN:
06033                 case FEDM_ISC_DATA_BLOCK_SIZE:
06034                 case FEDM_ISC_DATA_RxDB:
06035                 case FEDM_ISC_DATA_INPUT:
06036                 case FEDM_ISC_DATA_STATE:
06037                 case FEDM_ISC_DATA_SNR_LEN:
06038                 case FEDM_ISC_DATA_EPC:
06039                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06040                 case FEDM_ISC_DATA_VALUE:
06041                 case FEDM_ISC_DATA_ANT_NR:
06042                 case FEDM_ISC_DATA_ANT_COUNT:
06043                 case FEDM_ISC_DATA_ANT_STATUS:
06044                 case FEDM_ISC_DATA_ANT_RSSI:
06045                 case FEDM_ISC_DATA_MAC_ADR:
06046                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06047                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06048 
06049                 default:
06050                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
06051                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06052                 }
06053                 break;
06054         
06055         case FEDM_ISC_ISO_TABLE:
06056                 if(m_ISOTable.size() == 0)
06057                 {
06058                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06059                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06060                 }
06061 
06062                 if((unsigned int)iIdx > m_ISOTable.size())
06063                 {
06064                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - Index > size");
06065                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06066                 }
06067 
06068                 switch(uiDataID)
06069                 {
06070                 case FEDM_ISC_DATA_SNR:
06071                         *i64Data = m_ISOTable[iIdx]->GetSnr();  // only the lower 8 bytes
06072                         break;
06073 
06074                 case FEDM_ISC_DATA_EPC_DOMAIN:
06075                         *i64Data = m_ISOTable[iIdx]->GetEpcDomainManager();
06076                         if(*i64Data < 0)
06077                                 FEDM_RETURN((int)*i64Data);
06078                         break;
06079 
06080                 case FEDM_ISC_DATA_EPC_OBJECT:
06081                         *i64Data = m_ISOTable[iIdx]->GetEpcObjectClass();
06082                         if(*i64Data < 0)
06083                                 FEDM_RETURN((int)*i64Data);
06084                         break;
06085 
06086                 case FEDM_ISC_DATA_EPC_SNR:
06087                         *i64Data = m_ISOTable[iIdx]->GetEpcSnr();
06088                         if(*i64Data < 0)
06089                                 FEDM_RETURN((int)*i64Data);
06090                         break;
06091 
06092                 case FEDM_ISC_DATA_VALUE:
06093                         *i64Data = m_ISOTable[iIdx]->m_uiValue;
06094                         break;
06095 
06096                 case FEDM_ISC_DATA_FSCI:
06097                 case FEDM_ISC_DATA_FWI:
06098                 case FEDM_ISC_DATA_DSI:
06099                 case FEDM_ISC_DATA_DRI:
06100                 case FEDM_ISC_DATA_NAD:
06101                 case FEDM_ISC_DATA_CID:
06102                 case FEDM_ISC_DATA_SNR_LEN:
06103                 case FEDM_ISC_DATA_TRINFO:
06104                 case FEDM_ISC_DATA_OPTINFO:
06105                 case FEDM_ISC_DATA_PROTOINFO:
06106                 case FEDM_ISC_DATA_EPC:
06107                 case FEDM_ISC_DATA_EPC_TYPE:
06108                 case FEDM_ISC_DATA_EPC_HEADER:
06109                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06110                 case FEDM_ISC_DATA_TRTYPE:
06111                 case FEDM_ISC_DATA_AFI:
06112                 case FEDM_ISC_DATA_DSFID:
06113                 case FEDM_ISC_DATA_CHIP_ID:
06114                 case FEDM_ISC_DATA_MEM_SIZE:
06115                 case FEDM_ISC_DATA_IC_REF:
06116                 case FEDM_ISC_DATA_IS_EPC:
06117                 case FEDM_ISC_DATA_IS_SELECTED:
06118                 case FEDM_ISC_DATA_SEC_STATUS:
06119                 case FEDM_ISC_DATA_TxDB:
06120                 case FEDM_ISC_DATA_RxDB:
06121                 case FEDM_ISC_DATA_TxCB:
06122                 case FEDM_ISC_DATA_RxCB:
06123                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
06124                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
06125                 case FEDM_ISC_DATA_RxDB_TID_BANK:
06126                 case FEDM_ISC_DATA_TxDB_TID_BANK:
06127                 case FEDM_ISC_DATA_RxDB_RES_BANK:
06128                 case FEDM_ISC_DATA_TxDB_RES_BANK:
06129                 case FEDM_ISC_DATA_BLOCK_SIZE:
06130                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
06131                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
06132                 case FEDM_ISC_DATA_ANT_NR:
06133                 case FEDM_ISC_DATA_ANT_COUNT:
06134                 case FEDM_ISC_DATA_ANT_STATUS:
06135                 case FEDM_ISC_DATA_ANT_RSSI:
06136                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06137                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06138 
06139                 default:
06140                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_PARAMETER));
06141                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06142                 }
06143                 break;
06144         
06145         case FEDM_ISC_CAD_TABLE:
06146                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06147                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06148                 
06149         default:
06150                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64*) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
06151                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
06152         }
06153 
06154         FEDM_RETURN(FEDM_OK);
06155 }
06156 
06157 
06158 /***************************************************************************
06159   Begin                 :       19.11.2000 / M. Hultsch
06160   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
06161 
06162   Function                      :       get one data member from a table
06163 
06164   Parameters            :       int iIdx                -       index of table
06165                                                 unsigned int uiTableID  -       identifies the table
06166                                                 unsigned int uiDataID   -       identifies the table data
06167                                                 CString& sData  -       reference to data buffer
06168 
06169   Return value          :       0 or error code (<0)
06170 
06171 ***************************************************************************/
06172 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
06173 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, CString& sData)
06174 {
06175         FEDM_CHK3(&sData);
06176 
06177         if(iIdx < 0)
06178         {
06179                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - Index < 0");
06180                 FEDM_RETURN(iIdx);
06181         }
06182 
06183         int iErr;
06184         char cEpc[FEDM_ISC_MAX_UID_LENGTH];
06185         CString sTmp;
06186 
06187         switch(uiTableID)
06188         {
06189         case FEDM_ISC_BRM_TABLE:
06190                 if(m_BRMTable.size() == 0)
06191                 {
06192                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06193                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06194                 }
06195 
06196                 if((unsigned int)iIdx > m_BRMTable.size())
06197                 {
06198                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - Index > size");
06199                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06200                 }
06201 
06202                 switch(uiDataID)
06203                 {
06204                 case FEDM_ISC_DATA_SNR:
06205                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnr[0], (int)m_BRMTable[iIdx]->m_ucSnrLen, sData));
06206                         break;          
06207 
06208                 case FEDM_ISC_DATA_EPC:
06209                         FEDM_CHK2(iErr, m_BRMTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
06210                         sData = cEpc;
06211                         break;
06212 
06213                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06214                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(m_BRMTable[iIdx]->m_ucClass1Gen2_PC, 2, sData));
06215                         break;
06216 
06217                 case FEDM_ISC_DATA_TRTYPE:
06218                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucTrType, 1, sData));
06219                         break;          
06220 
06221                 case FEDM_ISC_DATA_TRINFO:
06222                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucIDDT, 1, sData)); // for ISO 14443
06223                         break;
06224 
06225                 case FEDM_ISC_DATA_AFI:
06226                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAFI, 1, sData));
06227                         break;          
06228 
06229                 case FEDM_ISC_DATA_DSFID:
06230                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucDsfID, 1, sData));
06231                         break;          
06232 
06233                 case FEDM_ISC_DATA_EPC_TYPE:
06234                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucEpcType, 1, sData));
06235                         break;
06236 
06237                 case FEDM_ISC_DATA_DB_ADR:
06238                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucDBAdr, 1, sData));
06239                         break;          
06240 
06241                 case FEDM_ISC_DATA_DBN:
06242                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexStr(m_BRMTable[iIdx]->m_uiDBN, sData));
06243                         break;          
06244 
06245                 case FEDM_ISC_DATA_BLOCK_SIZE:
06246                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucBlockSize, 1, sData));
06247                         break;          
06248 
06249                 case FEDM_ISC_DATA_ANT_NR:
06250                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAntNr, 1, sData));
06251                         break;          
06252 
06253                 case FEDM_ISC_DATA_SNR_LEN:
06254                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnrLen, 1, sData));
06255                         break;          
06256 
06257                 case FEDM_ISC_DATA_INPUT:
06258                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucInput, 1, sData));
06259                         break;          
06260 
06261                 case FEDM_ISC_DATA_STATE:
06262                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucState, 1, sData));
06263                         break;          
06264 
06265                 case FEDM_ISC_DATA_ANT_COUNT:
06266                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAntCount, 1, sData));
06267                         break;          
06268 
06269                 case FEDM_ISC_DATA_MAC_ADR:
06270                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[0], 1, sTmp));
06271                         sData = sTmp;
06272                         sData += ":";
06273                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[1], 1, sTmp));
06274                         sData = sTmp;
06275                         sData += ":";
06276                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[2], 1, sTmp));
06277                         sData = sTmp;
06278                         sData += ":";
06279                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[3], 1, sTmp));
06280                         sData = sTmp;
06281                         sData += ":";
06282                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[4], 1, sTmp));
06283                         sData = sTmp;
06284                         sData += ":";
06285                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[5], 1, sTmp));
06286                         sData = sTmp;
06287                         break;          
06288 
06289                 case FEDM_ISC_DATA_TIMER:
06290                 case FEDM_ISC_DATA_DATE:
06291                 case FEDM_ISC_DATA_RxDB:
06292                 case FEDM_ISC_DATA_ANT_STATUS:
06293                 case FEDM_ISC_DATA_ANT_RSSI:
06294                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06295                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06296 
06297                 default:
06298                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
06299                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06300                 }
06301                 break;
06302         
06303         case FEDM_ISC_ISO_TABLE:
06304                 if(m_ISOTable.size() == 0)
06305                 {
06306                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06307                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06308                 }
06309 
06310                 if((unsigned int)iIdx > m_ISOTable.size())
06311                 {
06312                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - Index > size");
06313                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06314                 }
06315 
06316                 switch(uiDataID)
06317                 {
06318                 case FEDM_ISC_DATA_SNR:
06319                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnr[0], (int)m_ISOTable[iIdx]->m_ucSnrLen, sData));
06320                         break;          
06321 
06322                 case FEDM_ISC_DATA_SNR_LEN:
06323                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnrLen, 1, sData));
06324                         break;          
06325 
06326                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06327                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(m_ISOTable[iIdx]->m_ucClass1Gen2_PC, 2, sData));
06328                         break;
06329 
06330                 case FEDM_ISC_DATA_TRTYPE:
06331                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucTrType, 1, sData));
06332                         break;          
06333 
06334                 case FEDM_ISC_DATA_AFI:
06335                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucAFI, 1, sData));
06336                         break;          
06337 
06338                 case FEDM_ISC_DATA_DSFID:
06339                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDsfID, 1, sData));
06340                         break;          
06341 
06342                 case FEDM_ISC_DATA_CHIP_ID:
06343                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucChipID, 1, sData));
06344                         break;          
06345 
06346                 case FEDM_ISC_DATA_MEM_SIZE:
06347                         if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
06348                         {
06349                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucMemSize[0], 3, sData));
06350                         }
06351                         else
06352                         {
06353                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucMemSize[0], 2, sData));
06354                         }
06355                         break;
06356 
06357                 case FEDM_ISC_DATA_IC_REF:
06358                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucICRef, 1, sData));
06359                         break;          
06360 
06361                 case FEDM_ISC_DATA_TRINFO:
06362                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucTrInfo, 1, sData));
06363                         break;
06364 
06365                 case FEDM_ISC_DATA_OPTINFO:
06366                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucOptInfo, 1, sData));
06367                         break;
06368 
06369                 case FEDM_ISC_DATA_PROTOINFO:
06370                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucProtoInfo, 1, sData));
06371                         break;
06372 
06373                 case FEDM_ISC_DATA_EPC_TYPE:
06374                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucEpcType, 1, sData));
06375                         break;
06376 
06377                 case FEDM_ISC_DATA_EPC:
06378                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
06379                         sData = cEpc;
06380                         break;
06381 
06382                 case FEDM_ISC_DATA_EPC_HEADER:
06383                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpcHeader());
06384                         sprintf(cEpc, "%02X", iErr);
06385                         sData = cEpc;
06386                         break;
06387 
06388                 case FEDM_ISC_DATA_EPC_DOMAIN:
06389                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06390                         {
06391                         case FEDM_ISC_EPC_TYPE_1:
06392                                 sprintf(cEpc, "%07lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
06393                                 break;
06394                         case FEDM_ISC_EPC_TYPE_2:
06395                         case FEDM_ISC_EPC_TYPE_3:
06396                         case FEDM_ISC_EPC_TYPE_4:
06397                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
06398                                 break;
06399                         default:
06400                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06401                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06402                         }
06403                         sData = cEpc;
06404                         break;
06405 
06406                 case FEDM_ISC_DATA_EPC_OBJECT:
06407                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06408                         {
06409                         case FEDM_ISC_EPC_TYPE_1:
06410                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
06411                                 break;
06412                         case FEDM_ISC_EPC_TYPE_2:
06413                         case FEDM_ISC_EPC_TYPE_3:
06414                         case FEDM_ISC_EPC_TYPE_4:
06415                                 sprintf(cEpc, "%05lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
06416                                 break;
06417                         default:
06418                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06419                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06420                         }
06421                         sData = cEpc;
06422                         break;
06423 
06424                 case FEDM_ISC_DATA_EPC_SNR:
06425                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06426                         {
06427                         case FEDM_ISC_EPC_TYPE_1:
06428                                 sprintf(cEpc, "%09lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
06429                                 break;
06430                         case FEDM_ISC_EPC_TYPE_2:
06431                         case FEDM_ISC_EPC_TYPE_3:
06432                         case FEDM_ISC_EPC_TYPE_4:
06433                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
06434                                 break;
06435                         default:
06436                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06437                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06438                         }
06439                         sData = cEpc;
06440                         break;
06441 
06442                 case FEDM_ISC_DATA_FSCI:
06443                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucFSCI, 1, sData));
06444                         break;
06445 
06446                 case FEDM_ISC_DATA_FWI:
06447                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucFWI, 1, sData));
06448                         break;
06449 
06450                 case FEDM_ISC_DATA_DSI:
06451                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDSI, 1, sData));
06452                         break;
06453 
06454                 case FEDM_ISC_DATA_DRI:
06455                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDRI, 1, sData));
06456                         break;
06457 
06458                 case FEDM_ISC_DATA_NAD:
06459                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucNad, 1, sData));
06460                         break;
06461 
06462                 case FEDM_ISC_DATA_CID:
06463                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucCid, 1, sData));
06464                         break;
06465 
06466                 case FEDM_ISC_DATA_VALUE:
06467                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexStr(m_ISOTable[iIdx]->m_uiValue, sData));
06468                         break;
06469 
06470                 case FEDM_ISC_DATA_ANT_COUNT:
06471                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucAntCount, 1, sData));
06472                         break;
06473 
06474                 case FEDM_ISC_DATA_ANT_NR:
06475                 case FEDM_ISC_DATA_ANT_STATUS:
06476                 case FEDM_ISC_DATA_ANT_RSSI:
06477                 case FEDM_ISC_DATA_IS_SELECTED:
06478                 case FEDM_ISC_DATA_IS_EPC:
06479                 case FEDM_ISC_DATA_SEC_STATUS:
06480                 case FEDM_ISC_DATA_TxDB:
06481                 case FEDM_ISC_DATA_RxDB:
06482                 case FEDM_ISC_DATA_TxCB:
06483                 case FEDM_ISC_DATA_RxCB:
06484                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
06485                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
06486                 case FEDM_ISC_DATA_RxDB_TID_BANK:
06487                 case FEDM_ISC_DATA_TxDB_TID_BANK:
06488                 case FEDM_ISC_DATA_RxDB_RES_BANK:
06489                 case FEDM_ISC_DATA_TxDB_RES_BANK:
06490                 case FEDM_ISC_DATA_BLOCK_SIZE:
06491                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
06492                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
06493                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06494                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06495 
06496                 default:
06497                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
06498                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06499                 }
06500                 break;
06501         
06502         case FEDM_ISC_CAD_TABLE:
06503                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06504                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06505                 
06506         default:
06507                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
06508                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
06509         }
06510 
06511         FEDM_RETURN(FEDM_OK);
06512 }
06513 #endif
06514 
06515 
06516 /***************************************************************************
06517   Begin                 :       20.02.2006 / M. Hultsch
06518   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
06519 
06520   Function                      :       get one data member from a table
06521 
06522   Parameters            :       int iIdx                -       index of table
06523                                                 unsigned int uiTableID  -       identifies the table
06524                                                 unsigned int uiDataID   -       identifies the table data
06525                                                 char* cData             -       pointer to data buffer
06526                                                 int iDataBufLen -       length of cData (includes additional '\0')
06527 
06528   Return value          :       0 or error code (<0)
06529 
06530 ***************************************************************************/
06531 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, char* cData, int iDataBufLen)
06532 {
06533         FEDM_CHK3(cData);
06534 
06535         if(iIdx < 0)
06536         {
06537                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - Index < 0");
06538                 FEDM_RETURN(iIdx);
06539         }
06540 
06541         if(iDataBufLen == 0)
06542                 return FEDM_OK; // nothing to do
06543 
06544         if(iDataBufLen < 0)
06545         {
06546                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06547                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06548         }
06549 
06550         int iErr;
06551         string sTmp;
06552 
06553         switch(uiTableID)
06554         {
06555         case FEDM_ISC_BRM_TABLE:
06556                 if(m_BRMTable.size() == 0)
06557                 {
06558                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06559                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06560                 }
06561 
06562                 if((unsigned int)iIdx > m_BRMTable.size())
06563                 {
06564                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - Index > size");
06565                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06566                 }
06567 
06568                 switch(uiDataID)
06569                 {
06570                 case FEDM_ISC_DATA_SNR:
06571                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucSnr[0], (int)m_BRMTable[iIdx]->m_ucSnrLen, cData, iDataBufLen));
06572                         break;          
06573 
06574                 case FEDM_ISC_DATA_EPC:
06575                         FEDM_CHK2(iErr, m_BRMTable[iIdx]->GetEpc(cData, iDataBufLen));
06576                         break;
06577 
06578                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06579                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(m_BRMTable[iIdx]->m_ucClass1Gen2_PC, 2, cData, iDataBufLen));
06580                         break;
06581 
06582                 case FEDM_ISC_DATA_TRTYPE:
06583                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucTrType, 1, cData, iDataBufLen));
06584                         break;          
06585 
06586                 case FEDM_ISC_DATA_EPC_TYPE:
06587                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucEpcType, 1, cData, iDataBufLen));
06588                         break;
06589 
06590                 case FEDM_ISC_DATA_TRINFO:
06591                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucIDDT, 1, cData, iDataBufLen)); // for ISO 14443
06592                         break;
06593 
06594                 case FEDM_ISC_DATA_AFI:
06595                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucAFI, 1, cData, iDataBufLen));
06596                         break;          
06597 
06598                 case FEDM_ISC_DATA_DSFID:
06599                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucDsfID, 1, cData, iDataBufLen));
06600                         break;          
06601 
06602                 case FEDM_ISC_DATA_DB_ADR:
06603                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucDBAdr, 1, cData, iDataBufLen));
06604                         break;          
06605 
06606                 case FEDM_ISC_DATA_DBN:
06607                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexChar(m_BRMTable[iIdx]->m_uiDBN, cData, iDataBufLen));
06608                         break;          
06609 
06610                 case FEDM_ISC_DATA_BLOCK_SIZE:
06611                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucBlockSize, 1, cData, iDataBufLen));
06612                         break;          
06613 
06614                 case FEDM_ISC_DATA_ANT_NR:
06615                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucAntNr, 1, cData, iDataBufLen));
06616                         break;          
06617 
06618                 case FEDM_ISC_DATA_SNR_LEN:
06619                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucSnrLen, 1, cData, iDataBufLen));
06620                         break;          
06621 
06622                 case FEDM_ISC_DATA_INPUT:
06623                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucInput, 1, cData, iDataBufLen));
06624                         break;          
06625 
06626                 case FEDM_ISC_DATA_STATE:
06627                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucState, 1, cData, iDataBufLen));
06628                         break;          
06629 
06630                 case FEDM_ISC_DATA_ANT_COUNT:
06631                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_BRMTable[iIdx]->m_ucAntCount, 1, cData, iDataBufLen));
06632                         break;          
06633 
06634                 case FEDM_ISC_DATA_MAC_ADR:
06635                         if(iDataBufLen < 18)
06636                         {
06637                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06638                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06639                         }
06640 
06641                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[0], 1, sTmp));
06642                         strcpy(cData, sTmp.c_str());
06643                         strcat(cData, ":");
06644                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[1], 1, sTmp));
06645                         strcat(cData, sTmp.c_str());
06646                         strcat(cData, ":");
06647                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[2], 1, sTmp));
06648                         strcat(cData, sTmp.c_str());
06649                         strcat(cData, ":");
06650                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[3], 1, sTmp));
06651                         strcat(cData, sTmp.c_str());
06652                         strcat(cData, ":");
06653                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[4], 1, sTmp));
06654                         strcat(cData, sTmp.c_str());
06655                         strcat(cData, ":");
06656                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[5], 1, sTmp));
06657                         strcat(cData, sTmp.c_str());
06658                         break;          
06659 
06660                 case FEDM_ISC_DATA_TIMER:
06661                 case FEDM_ISC_DATA_DATE:
06662                 case FEDM_ISC_DATA_RxDB:
06663                 case FEDM_ISC_DATA_ANT_STATUS:
06664                 case FEDM_ISC_DATA_ANT_RSSI:
06665                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06666                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06667 
06668                 default:
06669                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
06670                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06671                 }
06672                 break;
06673         
06674         case FEDM_ISC_ISO_TABLE:
06675                 if(m_ISOTable.size() == 0)
06676                 {
06677                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06678                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06679                 }
06680 
06681                 if((unsigned int)iIdx > m_ISOTable.size())
06682                 {
06683                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - Index > size");
06684                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06685                 }
06686 
06687                 switch(uiDataID)
06688                 {
06689                 case FEDM_ISC_DATA_SNR:
06690                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucSnr[0], (int)m_ISOTable[iIdx]->m_ucSnrLen, cData, iDataBufLen));
06691                         break;          
06692 
06693                 case FEDM_ISC_DATA_SNR_LEN:
06694                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucSnrLen, 1, cData, iDataBufLen));
06695                         break;          
06696 
06697                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06698                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(m_ISOTable[iIdx]->m_ucClass1Gen2_PC, 2, cData, iDataBufLen));
06699                         break;
06700 
06701                 case FEDM_ISC_DATA_TRTYPE:
06702                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucTrType, 1, cData, iDataBufLen));
06703                         break;          
06704 
06705                 case FEDM_ISC_DATA_AFI:
06706                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucAFI, 1, cData, iDataBufLen));
06707                         break;          
06708 
06709                 case FEDM_ISC_DATA_DSFID:
06710                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucDsfID, 1, cData, iDataBufLen));
06711                         break;          
06712 
06713                 case FEDM_ISC_DATA_CHIP_ID:
06714                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucChipID, 1, cData, iDataBufLen));
06715                         break;          
06716 
06717                 case FEDM_ISC_DATA_MEM_SIZE:
06718                         if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
06719                         {
06720                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucMemSize[0], 3, cData, iDataBufLen));
06721                         }
06722                         else
06723                         {
06724                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucMemSize[0], 2, cData, iDataBufLen));
06725                         }
06726                         break;
06727 
06728                 case FEDM_ISC_DATA_IC_REF:
06729                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucICRef, 1, cData, iDataBufLen));
06730                         break;          
06731 
06732                 case FEDM_ISC_DATA_TRINFO:
06733                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucTrInfo, 1, cData, iDataBufLen));
06734                         break;
06735 
06736                 case FEDM_ISC_DATA_OPTINFO:
06737                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucOptInfo, 1, cData, iDataBufLen));
06738                         break;
06739 
06740                 case FEDM_ISC_DATA_PROTOINFO:
06741                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucProtoInfo, 1, cData, iDataBufLen));
06742                         break;
06743 
06744                 case FEDM_ISC_DATA_EPC_TYPE:
06745                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucEpcType, 1, cData, iDataBufLen));
06746                         break;
06747 
06748                 case FEDM_ISC_DATA_EPC:
06749                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpc(cData, iDataBufLen));
06750 
06751                         break;
06752 
06753                 case FEDM_ISC_DATA_EPC_HEADER:
06754                         if(iDataBufLen < 3)
06755                         {
06756                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06757                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06758                         }
06759 
06760                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpcHeader());
06761                         sprintf(cData, "%02X", iErr);
06762                         break;
06763 
06764                 case FEDM_ISC_DATA_EPC_DOMAIN:
06765                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06766                         {
06767                         case FEDM_ISC_EPC_TYPE_1:
06768                                 if(iDataBufLen < 8)
06769                                 {
06770                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06771                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06772                                 }
06773 
06774                                 sprintf(cData, "%07lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
06775                                 break;
06776                         case FEDM_ISC_EPC_TYPE_2:
06777                         case FEDM_ISC_EPC_TYPE_3:
06778                         case FEDM_ISC_EPC_TYPE_4:
06779                                 if(iDataBufLen < 7)
06780                                 {
06781                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06782                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06783                                 }
06784 
06785                                 sprintf(cData, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
06786                                 break;
06787                         default:
06788                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06789                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06790                         }
06791                         break;
06792 
06793                 case FEDM_ISC_DATA_EPC_OBJECT:
06794                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06795                         {
06796                         case FEDM_ISC_EPC_TYPE_1:
06797                                 if(iDataBufLen < 7)
06798                                 {
06799                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06800                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06801                                 }
06802 
06803                                 sprintf(cData, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
06804                                 break;
06805                         case FEDM_ISC_EPC_TYPE_2:
06806                         case FEDM_ISC_EPC_TYPE_3:
06807                         case FEDM_ISC_EPC_TYPE_4:
06808                                 if(iDataBufLen < 6)
06809                                 {
06810                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06811                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06812                                 }
06813 
06814                                 sprintf(cData, "%05lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
06815                                 break;
06816                         default:
06817                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06818                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06819                         }
06820                         break;
06821 
06822                 case FEDM_ISC_DATA_EPC_SNR:
06823                         switch(m_ISOTable[iIdx]->m_ucEpcType)
06824                         {
06825                         case FEDM_ISC_EPC_TYPE_1:
06826                                 if(iDataBufLen < 10)
06827                                 {
06828                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06829                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06830                                 }
06831 
06832                                 sprintf(cData, "%09lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
06833                                 break;
06834                         case FEDM_ISC_EPC_TYPE_2:
06835                         case FEDM_ISC_EPC_TYPE_3:
06836                         case FEDM_ISC_EPC_TYPE_4:
06837                                 if(iDataBufLen < 7)
06838                                 {
06839                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
06840                                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
06841                                 }
06842 
06843                                 sprintf(cData, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
06844                                 break;
06845                         default:
06846                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
06847                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
06848                         }
06849                         break;
06850 
06851                 case FEDM_ISC_DATA_FSCI:
06852                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucFSCI, 1, cData, iDataBufLen));
06853                         break;
06854 
06855                 case FEDM_ISC_DATA_FWI:
06856                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucFWI, 1, cData, iDataBufLen));
06857                         break;
06858 
06859                 case FEDM_ISC_DATA_DSI:
06860                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucDSI, 1, cData, iDataBufLen));
06861                         break;
06862 
06863                 case FEDM_ISC_DATA_DRI:
06864                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucDRI, 1, cData, iDataBufLen));
06865                         break;
06866 
06867                 case FEDM_ISC_DATA_NAD:
06868                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucNad, 1, cData, iDataBufLen));
06869                         break;
06870 
06871                 case FEDM_ISC_DATA_CID:
06872                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucCid, 1, cData, iDataBufLen));
06873                         break;
06874 
06875                 case FEDM_ISC_DATA_VALUE:
06876                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexChar(m_ISOTable[iIdx]->m_uiValue, cData, iDataBufLen));
06877                         break;
06878 
06879                 case FEDM_ISC_DATA_ANT_COUNT:
06880                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexChar(&m_ISOTable[iIdx]->m_ucAntCount, 1, cData, iDataBufLen));
06881                         break;
06882 
06883                 case FEDM_ISC_DATA_ANT_NR:
06884                 case FEDM_ISC_DATA_ANT_STATUS:
06885                 case FEDM_ISC_DATA_ANT_RSSI:
06886                 case FEDM_ISC_DATA_IS_SELECTED:
06887                 case FEDM_ISC_DATA_IS_EPC:
06888                 case FEDM_ISC_DATA_SEC_STATUS:
06889                 case FEDM_ISC_DATA_TxDB:
06890                 case FEDM_ISC_DATA_RxDB:
06891                 case FEDM_ISC_DATA_TxCB:
06892                 case FEDM_ISC_DATA_RxCB:
06893                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
06894                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
06895                 case FEDM_ISC_DATA_RxDB_TID_BANK:
06896                 case FEDM_ISC_DATA_TxDB_TID_BANK:
06897                 case FEDM_ISC_DATA_RxDB_RES_BANK:
06898                 case FEDM_ISC_DATA_TxDB_RES_BANK:
06899                 case FEDM_ISC_DATA_BLOCK_SIZE:
06900                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
06901                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
06902                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06903                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06904 
06905                 default:
06906                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
06907                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
06908                 }
06909                 break;
06910         
06911         case FEDM_ISC_CAD_TABLE:
06912                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
06913                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
06914                 
06915         default:
06916                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", char*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
06917                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
06918         }
06919 
06920         FEDM_RETURN(FEDM_OK);
06921 }
06922 
06923 
06924 /***************************************************************************
06925   Begin                 :       19.08.2003 / M. Hultsch
06926   Version               :       03.03.00 / 21.02.2011 / M. Hultsch
06927 
06928   Function                      :       get one data member from a table
06929 
06930   Parameters            :       int iIdx                -       index of table
06931                                                 unsigned int uiTableID  -       identifies the table
06932                                                 unsigned int uiDataID   -       identifies the table data
06933                                                 string& sData   -       reference to data buffer
06934 
06935   Return value          :       0 or error code (<0)
06936 
06937 ***************************************************************************/
06938 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, string& sData)
06939 {
06940         FEDM_CHK3(&sData);
06941 
06942         if(iIdx < 0)
06943         {
06944                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - Index < 0");
06945                 FEDM_RETURN(iIdx);
06946         }
06947 
06948         int iErr;
06949         char cEpc[FEDM_ISC_MAX_UID_LENGTH];
06950         string sTmp;
06951 
06952         switch(uiTableID)
06953         {
06954         case FEDM_ISC_BRM_TABLE:
06955                 if(m_BRMTable.size() == 0)
06956                 {
06957                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
06958                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
06959                 }
06960 
06961                 if((unsigned int)iIdx > m_BRMTable.size())
06962                 {
06963                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - Index > size");
06964                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
06965                 }
06966 
06967                 switch(uiDataID)
06968                 {
06969                 case FEDM_ISC_DATA_SNR:
06970                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnr[0], (int)m_BRMTable[iIdx]->m_ucSnrLen, sData));
06971                         break;          
06972 
06973                 case FEDM_ISC_DATA_EPC:
06974                         FEDM_CHK2(iErr, m_BRMTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
06975                         sData = cEpc;
06976                         break;
06977 
06978                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
06979                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(m_BRMTable[iIdx]->m_ucClass1Gen2_PC, 2, sData));
06980                         break;
06981 
06982                 case FEDM_ISC_DATA_TRTYPE:
06983                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucTrType, 1, sData));
06984                         break;          
06985 
06986                 case FEDM_ISC_DATA_EPC_TYPE:
06987                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucEpcType, 1, sData));
06988                         break;
06989 
06990                 case FEDM_ISC_DATA_TRINFO:
06991                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucIDDT, 1, sData)); // for ISO 14443
06992                         break;
06993 
06994                 case FEDM_ISC_DATA_AFI:
06995                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAFI, 1, sData));
06996                         break;          
06997 
06998                 case FEDM_ISC_DATA_DSFID:
06999                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucDsfID, 1, sData));
07000                         break;          
07001 
07002                 case FEDM_ISC_DATA_DB_ADR:
07003                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucDBAdr, 1, sData));
07004                         break;          
07005 
07006                 case FEDM_ISC_DATA_DBN:
07007                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexStr(m_BRMTable[iIdx]->m_uiDBN, sData));
07008                         break;          
07009 
07010                 case FEDM_ISC_DATA_BLOCK_SIZE:
07011                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucBlockSize, 1, sData));
07012                         break;          
07013 
07014                 case FEDM_ISC_DATA_ANT_NR:
07015                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAntNr, 1, sData));
07016                         break;          
07017 
07018                 case FEDM_ISC_DATA_SNR_LEN:
07019                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnrLen, 1, sData));
07020                         break;          
07021 
07022                 case FEDM_ISC_DATA_INPUT:
07023                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucInput, 1, sData));
07024                         break;          
07025 
07026                 case FEDM_ISC_DATA_STATE:
07027                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucState, 1, sData));
07028                         break;          
07029 
07030                 case FEDM_ISC_DATA_ANT_COUNT:
07031                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucAntCount, 1, sData));
07032                         break;          
07033 
07034                 case FEDM_ISC_DATA_MAC_ADR:
07035                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[0], 1, sTmp));
07036                         sData = sTmp;
07037                         sData += ":";
07038                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[1], 1, sTmp));
07039                         sData = sTmp;
07040                         sData += ":";
07041                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[2], 1, sTmp));
07042                         sData = sTmp;
07043                         sData += ":";
07044                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[3], 1, sTmp));
07045                         sData = sTmp;
07046                         sData += ":";
07047                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[4], 1, sTmp));
07048                         sData = sTmp;
07049                         sData += ":";
07050                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucMacAddress[5], 1, sTmp));
07051                         sData = sTmp;
07052                         break;          
07053 
07054                 case FEDM_ISC_DATA_ANT_STATUS:
07055                 case FEDM_ISC_DATA_ANT_RSSI:
07056                 case FEDM_ISC_DATA_TIMER:
07057                 case FEDM_ISC_DATA_DATE:
07058                 case FEDM_ISC_DATA_RxDB:
07059                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07060                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07061 
07062                 default:
07063                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
07064                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07065                 }
07066                 break;
07067         
07068         case FEDM_ISC_ISO_TABLE:
07069                 if(m_ISOTable.size() == 0)
07070                 {
07071                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
07072                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
07073                 }
07074 
07075                 if((unsigned int)iIdx > m_ISOTable.size())
07076                 {
07077                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - Index > size");
07078                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
07079                 }
07080 
07081                 switch(uiDataID)
07082                 {
07083                 case FEDM_ISC_DATA_SNR:
07084                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnr[0], (int)m_ISOTable[iIdx]->m_ucSnrLen, sData));
07085                         break;          
07086 
07087                 case FEDM_ISC_DATA_SNR_LEN:
07088                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnrLen, 1, sData));
07089                         break;          
07090 
07091                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
07092                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(m_ISOTable[iIdx]->m_ucClass1Gen2_PC, 2, sData));
07093                         break;
07094 
07095                 case FEDM_ISC_DATA_TRTYPE:
07096                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucTrType, 1, sData));
07097                         break;          
07098 
07099                 case FEDM_ISC_DATA_AFI:
07100                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucAFI, 1, sData));
07101                         break;          
07102 
07103                 case FEDM_ISC_DATA_DSFID:
07104                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDsfID, 1, sData));
07105                         break;          
07106 
07107                 case FEDM_ISC_DATA_CHIP_ID:
07108                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucChipID, 1, sData));
07109                         break;          
07110 
07111                 case FEDM_ISC_DATA_MEM_SIZE:
07112                         if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
07113                         {
07114                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucMemSize[0], 3, sData));
07115                         }
07116                         else
07117                         {
07118                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucMemSize[0], 2, sData));
07119                         }
07120                         break;
07121 
07122                 case FEDM_ISC_DATA_IC_REF:
07123                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucICRef, 1, sData));
07124                         break;          
07125 
07126                 case FEDM_ISC_DATA_TRINFO:
07127                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucTrInfo, 1, sData));
07128                         break;
07129 
07130                 case FEDM_ISC_DATA_OPTINFO:
07131                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucOptInfo, 1, sData));
07132                         break;
07133 
07134                 case FEDM_ISC_DATA_PROTOINFO:
07135                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucProtoInfo, 1, sData));
07136                         break;
07137 
07138                 case FEDM_ISC_DATA_EPC_TYPE:
07139                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucEpcType, 1, sData));
07140                         break;
07141 
07142                 case FEDM_ISC_DATA_EPC:
07143                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
07144                         sData = cEpc;
07145                         break;
07146 
07147                 case FEDM_ISC_DATA_EPC_HEADER:
07148                         FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpcHeader());
07149                         sprintf(cEpc, "%02X", iErr);
07150                         sData = cEpc;
07151                         break;
07152 
07153                 case FEDM_ISC_DATA_EPC_DOMAIN:
07154                         switch(m_ISOTable[iIdx]->m_ucEpcType)
07155                         {
07156                         case FEDM_ISC_EPC_TYPE_1:
07157                                 sprintf(cEpc, "%07lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
07158                                 break;
07159                         case FEDM_ISC_EPC_TYPE_2:
07160                         case FEDM_ISC_EPC_TYPE_3:
07161                         case FEDM_ISC_EPC_TYPE_4:
07162                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcDomainManager());
07163                                 break;
07164                         default:
07165                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
07166                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
07167                         }
07168                         sData = cEpc;
07169                         break;
07170 
07171                 case FEDM_ISC_DATA_EPC_OBJECT:
07172                         switch(m_ISOTable[iIdx]->m_ucEpcType)
07173                         {
07174                         case FEDM_ISC_EPC_TYPE_1:
07175                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
07176                                 break;
07177                         case FEDM_ISC_EPC_TYPE_2:
07178                         case FEDM_ISC_EPC_TYPE_3:
07179                         case FEDM_ISC_EPC_TYPE_4:
07180                                 sprintf(cEpc, "%05lX", (unsigned long)m_ISOTable[iIdx]->GetEpcObjectClass());
07181                                 break;
07182                         default:
07183                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
07184                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
07185                         }
07186                         sData = cEpc;
07187                         break;
07188 
07189                 case FEDM_ISC_DATA_EPC_SNR:
07190                         switch(m_ISOTable[iIdx]->m_ucEpcType)
07191                         {
07192                         case FEDM_ISC_EPC_TYPE_1:
07193                                 sprintf(cEpc, "%09lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
07194                                 break;
07195                         case FEDM_ISC_EPC_TYPE_2:
07196                         case FEDM_ISC_EPC_TYPE_3:
07197                         case FEDM_ISC_EPC_TYPE_4:
07198                                 sprintf(cEpc, "%06lX", (unsigned long)m_ISOTable[iIdx]->GetEpcSnr());
07199                                 break;
07200                         default:
07201                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_EPC_TYPE));
07202                                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_EPC_TYPE);
07203                         }
07204                         sData = cEpc;
07205                         break;
07206 
07207                 case FEDM_ISC_DATA_FSCI:
07208                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucFSCI, 1, sData));
07209                         break;
07210 
07211                 case FEDM_ISC_DATA_FWI:
07212                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucFWI, 1, sData));
07213                         break;
07214 
07215                 case FEDM_ISC_DATA_DSI:
07216                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDSI, 1, sData));
07217                         break;
07218 
07219                 case FEDM_ISC_DATA_DRI:
07220                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucDRI, 1, sData));
07221                         break;
07222 
07223                 case FEDM_ISC_DATA_NAD:
07224                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucNad, 1, sData));
07225                         break;
07226 
07227                 case FEDM_ISC_DATA_CID:
07228                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucCid, 1, sData));
07229                         break;
07230 
07231                 case FEDM_ISC_DATA_VALUE:
07232                         FEDM_CHK2(iErr, FEDM_ConvUIntToHexStr(m_ISOTable[iIdx]->m_uiValue, sData));
07233                         break;
07234 
07235                 case FEDM_ISC_DATA_ANT_COUNT:
07236                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucAntCount, 1, sData));
07237                         break;
07238 
07239                 case FEDM_ISC_DATA_ANT_NR:
07240                 case FEDM_ISC_DATA_ANT_STATUS:
07241                 case FEDM_ISC_DATA_ANT_RSSI:
07242                 case FEDM_ISC_DATA_IS_SELECTED:
07243                 case FEDM_ISC_DATA_IS_EPC:
07244                 case FEDM_ISC_DATA_SEC_STATUS:
07245                 case FEDM_ISC_DATA_TxDB:
07246                 case FEDM_ISC_DATA_RxDB:
07247                 case FEDM_ISC_DATA_TxCB:
07248                 case FEDM_ISC_DATA_RxCB:
07249                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
07250                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
07251                 case FEDM_ISC_DATA_RxDB_TID_BANK:
07252                 case FEDM_ISC_DATA_TxDB_TID_BANK:
07253                 case FEDM_ISC_DATA_RxDB_RES_BANK:
07254                 case FEDM_ISC_DATA_TxDB_RES_BANK:
07255                 case FEDM_ISC_DATA_BLOCK_SIZE:
07256                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
07257                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
07258                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07259                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07260 
07261                 default:
07262                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
07263                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07264                 }
07265                 break;
07266         
07267         case FEDM_ISC_CAD_TABLE:
07268                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07269                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07270                 
07271         default:
07272                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
07273                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
07274         }
07275 
07276         FEDM_RETURN(FEDM_OK);
07277 }
07278 
07279 /***************************************************************************
07280   Begin                 :       20.08.2003 / M. Hultsch
07281   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
07282 
07283   Function                      :       set one data member in a table
07284 
07285   Parameters            :       int iIdx                -       index of table
07286                                                 unsigned int uiTableID  -       identifies the table
07287                                                 unsigned int uiDataID   -       identifies the table data
07288                                                 bool bData              -       data
07289 
07290   Return value          :       0 or error code (<0)
07291 
07292 ***************************************************************************/
07293 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, bool bData)
07294 {
07295         int iSelIdx = 0;
07296 
07297         if(iIdx < 0)
07298         {
07299                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - Index < 0");
07300                 FEDM_RETURN(iIdx);
07301         }
07302 
07303         switch(uiTableID)
07304         {
07305         case FEDM_ISC_BRM_TABLE:
07306         case FEDM_ISC_CAD_TABLE:
07307                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07308                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07309         
07310         case FEDM_ISC_ISO_TABLE:
07311                 if(m_ISOTable.size() == 0)
07312                 {
07313                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
07314                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
07315                 }
07316 
07317                 if((unsigned int)iIdx > m_ISOTable.size())
07318                 {
07319                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - Index > size");
07320                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
07321                 }
07322 
07323                 switch(uiDataID)
07324                 {
07325                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
07326                         m_ISOTable[iIdx]->m_bIsBlockSizeSet = bData;
07327                         break;
07328 
07329                 case FEDM_ISC_DATA_IS_SELECTED:
07330                         // search old selected entry and deselect it
07331                         iSelIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
07332                         if(iSelIdx >= 0)
07333                                 m_ISOTable[iSelIdx]->m_bIsSelected = false;
07334 
07335                         m_ISOTable[iIdx]->m_bIsSelected = bData;
07336                         break;
07337 
07338                 case FEDM_ISC_DATA_IS_EPC:
07339                         m_ISOTable[iIdx]->m_bIsEpc = bData;
07340                         break;
07341 
07342                 case FEDM_ISC_DATA_IS_SNR:
07343                         m_ISOTable[iIdx]->m_bIsSnr = bData;
07344                         break;
07345 
07346                 case FEDM_ISC_DATA_IS_AFI:
07347                         m_ISOTable[iIdx]->m_bIsAFI = bData;
07348                         break;
07349 
07350                 case FEDM_ISC_DATA_IS_SYSINFO:
07351                         m_ISOTable[iIdx]->m_bIsSysInfo = bData;
07352                         break;
07353 
07354                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
07355                         m_ISOTable[iIdx]->m_bIsISO14443_4Info = bData;
07356                         break;
07357 
07358                 case FEDM_ISC_DATA_SNR_LEN:
07359                 case FEDM_ISC_DATA_AFI:
07360                 case FEDM_ISC_DATA_DSFID:
07361                 case FEDM_ISC_DATA_CHIP_ID:
07362                 case FEDM_ISC_DATA_BLOCK_SIZE:
07363                 case FEDM_ISC_DATA_OPTINFO:
07364                 case FEDM_ISC_DATA_PROTOINFO:
07365                 case FEDM_ISC_DATA_TRINFO:
07366                 case FEDM_ISC_DATA_FSCI:
07367                 case FEDM_ISC_DATA_FWI:
07368                 case FEDM_ISC_DATA_DSI:
07369                 case FEDM_ISC_DATA_DRI:
07370                 case FEDM_ISC_DATA_NAD:
07371                 case FEDM_ISC_DATA_CID:
07372                 case FEDM_ISC_DATA_EPC:
07373                 case FEDM_ISC_DATA_EPC_TYPE:
07374                 case FEDM_ISC_DATA_EPC_HEADER:
07375                 case FEDM_ISC_DATA_EPC_DOMAIN:
07376                 case FEDM_ISC_DATA_EPC_OBJECT:
07377                 case FEDM_ISC_DATA_EPC_SNR:
07378                 case FEDM_ISC_DATA_SNR:
07379                 case FEDM_ISC_DATA_TRTYPE:
07380                 case FEDM_ISC_DATA_MEM_SIZE:
07381                 case FEDM_ISC_DATA_IC_REF:
07382                 case FEDM_ISC_DATA_SEC_STATUS:
07383                 case FEDM_ISC_DATA_TxDB:
07384                 case FEDM_ISC_DATA_RxDB:
07385                 case FEDM_ISC_DATA_TxCB:
07386                 case FEDM_ISC_DATA_RxCB:
07387                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
07388                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
07389                 case FEDM_ISC_DATA_RxDB_TID_BANK:
07390                 case FEDM_ISC_DATA_TxDB_TID_BANK:
07391                 case FEDM_ISC_DATA_RxDB_RES_BANK:
07392                 case FEDM_ISC_DATA_TxDB_RES_BANK:
07393                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
07394                 case FEDM_ISC_DATA_ANT_NR:
07395                 case FEDM_ISC_DATA_ANT_COUNT:
07396                 case FEDM_ISC_DATA_ANT_STATUS:
07397                 case FEDM_ISC_DATA_ANT_RSSI:
07398                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07399                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07400 
07401                 default:
07402                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_PARAMETER));
07403                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07404                 }
07405                 break;
07406                 
07407         default:
07408                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
07409                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
07410         }
07411 
07412         FEDM_RETURN(FEDM_OK);
07413 }
07414 
07415 /***************************************************************************
07416   Begin                 :       17.11.2000 / M. Hultsch
07417   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
07418 
07419   Function                      :       set one data member in a table
07420 
07421   Parameters            :       int iIdx                -       index of table
07422                                                 unsigned int uiTableID  -       identifies the table
07423                                                 unsigned int uiDataID   -       identifies the table data
07424                                                 unsigned char ucData    -       data
07425 
07426   Return value          :       0 or error code (<0)
07427 
07428 ***************************************************************************/
07429 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char ucData)
07430 {
07431         if(iIdx < 0)
07432         {
07433                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - Index < 0");
07434                 FEDM_RETURN(iIdx);
07435         }
07436 
07437         switch(uiTableID)
07438         {
07439         case FEDM_ISC_BRM_TABLE:
07440         case FEDM_ISC_CAD_TABLE:
07441                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07442                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07443         
07444         case FEDM_ISC_ISO_TABLE:
07445                 if(m_ISOTable.size() == 0)
07446                 {
07447                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
07448                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
07449                 }
07450 
07451                 if((unsigned int)iIdx > m_ISOTable.size())
07452                 {
07453                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - Index > size");
07454                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
07455                 }
07456 
07457                 switch(uiDataID)
07458                 {
07459                 case FEDM_ISC_DATA_AFI:
07460                         m_ISOTable[iIdx]->m_ucAFI = ucData;
07461                         break;
07462 
07463                 case FEDM_ISC_DATA_DSFID:
07464                         m_ISOTable[iIdx]->m_ucDsfID = ucData;
07465                         break;
07466 
07467                 case FEDM_ISC_DATA_CHIP_ID:
07468                         m_ISOTable[iIdx]->m_ucChipID = ucData;
07469                         break;
07470 
07471                 case FEDM_ISC_DATA_IS_SELECTED:
07472                         if(ucData)
07473                                 m_ISOTable[iIdx]->m_bIsSelected = true;
07474                         else
07475                                 m_ISOTable[iIdx]->m_bIsSelected = false;
07476                         break;
07477 
07478                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
07479                         if(ucData)
07480                                 m_ISOTable[iIdx]->m_bIsISO14443_4Info = true;
07481                         else
07482                                 m_ISOTable[iIdx]->m_bIsISO14443_4Info = false;
07483                         break;
07484 
07485                 case FEDM_ISC_DATA_IS_EPC:
07486                         if(ucData)
07487                                 m_ISOTable[iIdx]->m_bIsEpc = true;
07488                         else
07489                                 m_ISOTable[iIdx]->m_bIsEpc = false;
07490                         break;
07491 
07492                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
07493                         if(ucData)
07494                                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = true;
07495                         else
07496                                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = false;
07497                         break;
07498 
07499                 case FEDM_ISC_DATA_BLOCK_SIZE:
07500                         m_ISOTable[iIdx]->m_ucBlockSize = ucData;
07501                         break;
07502 
07503                 case FEDM_ISC_DATA_TRTYPE:
07504                         m_ISOTable[iIdx]->m_ucTrType = ucData;
07505                         break;
07506 
07507                 case FEDM_ISC_DATA_EPC_TYPE:
07508                         m_ISOTable[iIdx]->m_ucEpcType = ucData;
07509                         break;
07510 
07511                 case FEDM_ISC_DATA_IC_REF:
07512                         m_ISOTable[iIdx]->m_ucICRef = ucData;
07513                         break;
07514 
07515                 case FEDM_ISC_DATA_SNR_LEN:
07516                         m_ISOTable[iIdx]->m_ucSnrLen = ucData;
07517                         break;
07518 
07519                 case FEDM_ISC_DATA_TRINFO:
07520                         m_ISOTable[iIdx]->m_ucTrInfo = ucData;
07521                         break;
07522 
07523                 case FEDM_ISC_DATA_OPTINFO:
07524                         m_ISOTable[iIdx]->m_ucOptInfo = ucData;
07525                         break;
07526 
07527                 case FEDM_ISC_DATA_PROTOINFO:
07528                         m_ISOTable[iIdx]->m_ucProtoInfo = ucData;
07529                         break;
07530 
07531                 case FEDM_ISC_DATA_FSCI:
07532                         m_ISOTable[iIdx]->m_ucFSCI = ucData;
07533                         break;
07534 
07535                 case FEDM_ISC_DATA_FWI:
07536                         m_ISOTable[iIdx]->m_ucFWI = ucData;
07537                         break;
07538 
07539                 case FEDM_ISC_DATA_DSI:
07540                         m_ISOTable[iIdx]->m_ucDSI = ucData;
07541                         break;
07542 
07543                 case FEDM_ISC_DATA_DRI:
07544                         m_ISOTable[iIdx]->m_ucDRI = ucData;
07545                         break;
07546 
07547                 case FEDM_ISC_DATA_NAD:
07548                         m_ISOTable[iIdx]->m_ucNad = ucData;
07549                         break;
07550 
07551                 case FEDM_ISC_DATA_CID:
07552                         m_ISOTable[iIdx]->m_ucCid = ucData;
07553                         break;
07554 
07555                 case FEDM_ISC_DATA_EPC:
07556                 case FEDM_ISC_DATA_EPC_HEADER:
07557                 case FEDM_ISC_DATA_EPC_DOMAIN:
07558                 case FEDM_ISC_DATA_EPC_OBJECT:
07559                 case FEDM_ISC_DATA_EPC_SNR:
07560                 case FEDM_ISC_DATA_SNR:
07561                 case FEDM_ISC_DATA_MEM_SIZE:
07562                 case FEDM_ISC_DATA_SEC_STATUS:
07563                 case FEDM_ISC_DATA_TxDB:
07564                 case FEDM_ISC_DATA_RxDB:
07565                 case FEDM_ISC_DATA_TxCB:
07566                 case FEDM_ISC_DATA_RxCB:
07567                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
07568                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
07569                 case FEDM_ISC_DATA_RxDB_TID_BANK:
07570                 case FEDM_ISC_DATA_TxDB_TID_BANK:
07571                 case FEDM_ISC_DATA_RxDB_RES_BANK:
07572                 case FEDM_ISC_DATA_TxDB_RES_BANK:
07573                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
07574                 case FEDM_ISC_DATA_ANT_NR:
07575                 case FEDM_ISC_DATA_ANT_COUNT:
07576                 case FEDM_ISC_DATA_ANT_STATUS:
07577                 case FEDM_ISC_DATA_ANT_RSSI:
07578                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07579                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07580 
07581                 default:
07582                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_PARAMETER));
07583                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07584                 }
07585                 break;
07586                 
07587         default:
07588                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
07589                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
07590         }
07591 
07592         FEDM_RETURN(FEDM_OK);
07593 }
07594 
07595 /***************************************************************************
07596   Begin                 :       11.11.2003 / M. Hultsch
07597   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
07598 
07599   Function                      :       set one data member in a table
07600                                                 (one or more than one byte)
07601 
07602   Parameters            :       int iIdx                -       index of table
07603                                                 unsigned int uiTableID  -       identifies the table
07604                                                 unsigned int uiDataID   -       identifies the table data
07605                                                 unsigned char* ucData   -       pointer to data buffer
07606                                                 int iDataBufLen -       length of ucData
07607 
07608   Return value          :       0 or error code (<0)
07609 
07610 ***************************************************************************/
07611 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char* ucData, int iDataBufLen)
07612 {
07613         FEDM_CHK3(ucData);
07614 
07615         if(iIdx < 0)
07616         {
07617                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - Index < 0");
07618                 FEDM_RETURN(iIdx);
07619         }
07620 
07621         if(iDataBufLen == 0)
07622                 return FEDM_OK; // nothing to do
07623 
07624         if(iDataBufLen < 0)
07625         {
07626                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07627                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07628         }
07629 
07630         int iCnt;
07631         int iLen = 0;
07632 
07633         switch(uiTableID)
07634         {
07635         case FEDM_ISC_BRM_TABLE:
07636         case FEDM_ISC_CAD_TABLE:
07637                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07638                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07639         
07640         case FEDM_ISC_ISO_TABLE:
07641                 if(m_ISOTable.size() == 0)
07642                 {
07643                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
07644                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
07645                 }
07646 
07647                 if((unsigned int)iIdx > m_ISOTable.size())
07648                 {
07649                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - Index > size");
07650                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
07651                 }
07652 
07653                 switch(uiDataID)
07654                 {
07655                 case FEDM_ISC_DATA_SNR:
07656                         if(iDataBufLen < 8 || iDataBufLen > FEDM_ISC_MAX_UID_LENGTH)
07657                         {
07658                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07659                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07660                         }
07661 
07662                         for(iCnt=0; iCnt<iDataBufLen; iCnt++)
07663                                 m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucData[iCnt];
07664                         break;
07665 
07666                 case FEDM_ISC_DATA_MEM_SIZE:
07667                         if(iDataBufLen < 2)
07668                         {
07669                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07670                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07671                         }
07672                         else if(iDataBufLen == 2)
07673                         {
07674                                 iLen = 2;
07675                         }
07676                         else if(iDataBufLen > 2)
07677                         {
07678                                 if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
07679                                         iLen = 3;
07680                                 else
07681                                         iLen = 2;
07682                         }
07683 
07684                         for(iCnt=0; iCnt<iLen; iCnt++)
07685                                 m_ISOTable[iIdx]->m_ucMemSize[iCnt] = ucData[iCnt];
07686                         break;
07687 
07688                 case FEDM_ISC_DATA_SNR_LEN:
07689                 case FEDM_ISC_DATA_TRTYPE:
07690                 case FEDM_ISC_DATA_AFI:
07691                 case FEDM_ISC_DATA_DSFID:
07692                 case FEDM_ISC_DATA_CHIP_ID:
07693                 case FEDM_ISC_DATA_IC_REF:
07694                 case FEDM_ISC_DATA_FSCI:
07695                 case FEDM_ISC_DATA_FWI:
07696                 case FEDM_ISC_DATA_DSI:
07697                 case FEDM_ISC_DATA_DRI:
07698                 case FEDM_ISC_DATA_NAD:
07699                 case FEDM_ISC_DATA_CID:
07700                 case FEDM_ISC_DATA_IS_SELECTED:
07701                 case FEDM_ISC_DATA_IS_EPC:
07702                 case FEDM_ISC_DATA_BLOCK_SIZE:
07703                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
07704                 case FEDM_ISC_DATA_OPTINFO:
07705                 case FEDM_ISC_DATA_PROTOINFO:
07706                 case FEDM_ISC_DATA_TRINFO:
07707                 case FEDM_ISC_DATA_EPC_TYPE:
07708                 case FEDM_ISC_DATA_EPC:
07709                 case FEDM_ISC_DATA_EPC_HEADER:
07710                 case FEDM_ISC_DATA_EPC_DOMAIN:
07711                 case FEDM_ISC_DATA_EPC_OBJECT:
07712                 case FEDM_ISC_DATA_EPC_SNR:
07713                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
07714                 case FEDM_ISC_DATA_ANT_NR:
07715                 case FEDM_ISC_DATA_ANT_COUNT:
07716                 case FEDM_ISC_DATA_ANT_STATUS:
07717                 case FEDM_ISC_DATA_ANT_RSSI:
07718                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07719                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07720 
07721                 case FEDM_ISC_DATA_SEC_STATUS:
07722                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucSecStatus.size())
07723                         {
07724                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07725                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07726                         }
07727                         memcpy(&m_ISOTable[iIdx]->m_ucSecStatus[0], ucData, m_ISOTable[iIdx]->m_ucSecStatus.size());
07728                         break;
07729 
07730                 case FEDM_ISC_DATA_TxDB:
07731                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB.size())
07732                         {
07733                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07734                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07735                         }
07736                         memcpy(&m_ISOTable[iIdx]->m_ucTxDB[0], ucData, m_ISOTable[iIdx]->m_ucTxDB.size());
07737                         break;
07738 
07739                 case FEDM_ISC_DATA_RxDB:
07740                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB.size())
07741                         {
07742                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07743                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07744                         }
07745                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB[0], ucData, m_ISOTable[iIdx]->m_ucRxDB.size());
07746                         break;
07747 
07748                 case FEDM_ISC_DATA_TxCB:
07749                         if(iDataBufLen < 16)
07750                         {
07751                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07752                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07753                         }
07754                         memcpy(&m_ISOTable[iIdx]->m_ucTxCB[0], ucData, 16);
07755                         break;
07756 
07757                 case FEDM_ISC_DATA_RxCB:
07758                         if(iDataBufLen < 16)
07759                         {
07760                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07761                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07762                         }
07763                         memcpy(&m_ISOTable[iIdx]->m_ucRxCB[0], ucData, 16);
07764                         break;
07765 
07766                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
07767                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
07768                         {
07769                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07770                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07771                         }
07772                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB_EpcBank[0], ucData, m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size());
07773                         break;
07774 
07775                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
07776                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
07777                         {
07778                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07779                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07780                         }
07781                         memcpy(&m_ISOTable[iIdx]->m_ucTxDB_EpcBank[0], ucData, m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size());
07782                         break;
07783 
07784                 case FEDM_ISC_DATA_RxDB_TID_BANK:
07785                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
07786                         {
07787                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07788                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07789                         }
07790                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB_TidBank[0], ucData, m_ISOTable[iIdx]->m_ucRxDB_TidBank.size());
07791                         break;
07792 
07793                 case FEDM_ISC_DATA_TxDB_TID_BANK:
07794                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
07795                         {
07796                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07797                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07798                         }
07799                         memcpy(&m_ISOTable[iIdx]->m_ucTxDB_TidBank[0], ucData, m_ISOTable[iIdx]->m_ucTxDB_TidBank.size());
07800                         break;
07801 
07802                 case FEDM_ISC_DATA_RxDB_RES_BANK:
07803                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
07804                         {
07805                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07806                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07807                         }
07808                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB_ResBank[0], ucData, m_ISOTable[iIdx]->m_ucRxDB_ResBank.size());
07809                         break;
07810 
07811                 case FEDM_ISC_DATA_TxDB_RES_BANK:
07812                         if((unsigned int)iDataBufLen < m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
07813                         {
07814                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
07815                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
07816                         }
07817                         memcpy(&m_ISOTable[iIdx]->m_ucTxDB_ResBank[0], ucData, m_ISOTable[iIdx]->m_ucTxDB_ResBank.size());
07818                         break;
07819 
07820                 default:
07821                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
07822                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07823                 }
07824                 break;
07825                 
07826         default:
07827                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
07828                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
07829         }
07830 
07831         FEDM_RETURN(FEDM_OK);
07832 }
07833 
07834 
07835 /***************************************************************************
07836   Begin                 :       17.11.2000 / M. Hultsch
07837   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
07838 
07839   Function                      :       set one data member in a table
07840 
07841   Parameters            :       int iIdx                -       index of table
07842                                                 unsigned int uiTableID  -       identifies the table
07843                                                 unsigned int uiDataID   -       identifies the table data
07844                                                 unsigned int uiData             -       data
07845 
07846   Return value          :       0 or error code (<0)
07847 
07848 ***************************************************************************/
07849 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int uiData)
07850 {
07851         if(iIdx < 0)
07852         {
07853                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - Index < 0");
07854                 FEDM_RETURN(iIdx);
07855         }
07856 
07857         switch(uiTableID)
07858         {
07859         case FEDM_ISC_BRM_TABLE:
07860         case FEDM_ISC_CAD_TABLE:
07861                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07862                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07863         
07864         case FEDM_ISC_ISO_TABLE:
07865                 if(m_ISOTable.size() == 0)
07866                 {
07867                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
07868                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
07869                 }
07870 
07871                 if((unsigned int)iIdx > m_ISOTable.size())
07872                 {
07873                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - Index > size");
07874                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
07875                 }
07876 
07877                 switch(uiDataID)
07878                 {
07879                 case FEDM_ISC_DATA_SNR_LEN:
07880                         m_ISOTable[iIdx]->m_ucSnrLen = (unsigned char)uiData;
07881                         break;
07882 
07883                 case FEDM_ISC_DATA_AFI:
07884                         m_ISOTable[iIdx]->m_ucAFI = (unsigned char)uiData;
07885                         break;
07886 
07887                 case FEDM_ISC_DATA_DSFID:
07888                         m_ISOTable[iIdx]->m_ucDsfID = (unsigned char)uiData;
07889                         break;
07890 
07891                 case FEDM_ISC_DATA_CHIP_ID:
07892                         m_ISOTable[iIdx]->m_ucChipID = (unsigned char)uiData;
07893                         break;
07894 
07895                 case FEDM_ISC_DATA_IS_SELECTED:
07896                         if(uiData)
07897                                 m_ISOTable[iIdx]->m_bIsSelected = true;
07898                         else
07899                                 m_ISOTable[iIdx]->m_bIsSelected = false;
07900                         break;
07901 
07902                 case FEDM_ISC_DATA_IS_ISO14443_4_INFO:
07903                         if(uiData)
07904                                 m_ISOTable[iIdx]->m_bIsISO14443_4Info = true;
07905                         else
07906                                 m_ISOTable[iIdx]->m_bIsISO14443_4Info = false;
07907                         break;
07908 
07909                 case FEDM_ISC_DATA_IS_EPC:
07910                         if(uiData)
07911                                 m_ISOTable[iIdx]->m_bIsEpc = true;
07912                         else
07913                                 m_ISOTable[iIdx]->m_bIsEpc = false;
07914                         break;
07915 
07916                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
07917                         if(uiData)
07918                                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = true;
07919                         else
07920                                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = false;
07921                         break;
07922 
07923                 case FEDM_ISC_DATA_BLOCK_SIZE:
07924                         m_ISOTable[iIdx]->m_ucBlockSize = (unsigned char)uiData;
07925                         break;
07926 
07927                 case FEDM_ISC_DATA_MEM_SIZE:
07928                         if(m_ISOTable[iIdx]->m_ucMemSizeLen == 3)
07929                         {
07930                                 m_ISOTable[iIdx]->m_ucMemSize[0] = (unsigned char)((uiData&0xFF0000) >> 16);
07931                                 m_ISOTable[iIdx]->m_ucMemSize[1] = (unsigned char)((uiData&0x00FF00) >> 8);
07932                                 m_ISOTable[iIdx]->m_ucMemSize[2] = (unsigned char)( uiData&0x0000FF);
07933                         }
07934                         else
07935                         {
07936                                 m_ISOTable[iIdx]->m_ucMemSize[0] = (unsigned char)((uiData&0xFF00) >> 8);
07937                                 m_ISOTable[iIdx]->m_ucMemSize[1] = (unsigned char)( uiData&0x00FF);
07938                         }
07939                         break;
07940 
07941                 case FEDM_ISC_DATA_TRINFO:
07942                 case FEDM_ISC_DATA_OPTINFO:
07943                 case FEDM_ISC_DATA_PROTOINFO:
07944                 case FEDM_ISC_DATA_EPC:
07945                 case FEDM_ISC_DATA_EPC_TYPE:
07946                 case FEDM_ISC_DATA_EPC_HEADER:
07947                 case FEDM_ISC_DATA_EPC_DOMAIN:
07948                 case FEDM_ISC_DATA_EPC_OBJECT:
07949                 case FEDM_ISC_DATA_EPC_SNR:
07950                 case FEDM_ISC_DATA_SNR:
07951                 case FEDM_ISC_DATA_TRTYPE:
07952                 case FEDM_ISC_DATA_IC_REF:
07953                 case FEDM_ISC_DATA_SEC_STATUS:
07954                 case FEDM_ISC_DATA_FSCI:
07955                 case FEDM_ISC_DATA_FWI:
07956                 case FEDM_ISC_DATA_DSI:
07957                 case FEDM_ISC_DATA_DRI:
07958                 case FEDM_ISC_DATA_NAD:
07959                 case FEDM_ISC_DATA_CID:
07960                 case FEDM_ISC_DATA_TxDB:
07961                 case FEDM_ISC_DATA_RxDB:
07962                 case FEDM_ISC_DATA_TxCB:
07963                 case FEDM_ISC_DATA_RxCB:
07964                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
07965                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
07966                 case FEDM_ISC_DATA_RxDB_TID_BANK:
07967                 case FEDM_ISC_DATA_TxDB_TID_BANK:
07968                 case FEDM_ISC_DATA_RxDB_RES_BANK:
07969                 case FEDM_ISC_DATA_TxDB_RES_BANK:
07970                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
07971                 case FEDM_ISC_DATA_ANT_NR:
07972                 case FEDM_ISC_DATA_ANT_COUNT:
07973                 case FEDM_ISC_DATA_ANT_STATUS:
07974                 case FEDM_ISC_DATA_ANT_RSSI:
07975                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
07976                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
07977 
07978                 default:
07979                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - " << GetErrorText(FEDM_ERROR_PARAMETER));
07980                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
07981                 }
07982                 break;
07983                 
07984         default:
07985                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
07986                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
07987         }
07988 
07989         FEDM_RETURN(FEDM_OK);
07990 }
07991 
07992 
07993 /***************************************************************************
07994   Begin                 :       20.08.2003 / M. Hultsch
07995   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
07996 
07997   Function                      :       set one data member in a table
07998 
07999   Parameters            :       int iIdx                -       index of table
08000                                                 unsigned int uiTableID  -       identifies the table
08001                                                 unsigned int uiDataID   -       identifies the table data
08002                                                 __int64 i64Data -       data
08003 
08004   Return value          :       0 or error code (<0)
08005 
08006 ***************************************************************************/
08007 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, __int64 i64Data)
08008 {
08009         int iErr = 0;
08010 
08011         if(iIdx < 0)
08012         {
08013                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - Index < 0");
08014                 FEDM_RETURN(iIdx);
08015         }
08016 
08017         switch(uiTableID)
08018         {
08019         case FEDM_ISC_BRM_TABLE:
08020         case FEDM_ISC_CAD_TABLE:
08021                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08022                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08023         
08024         case FEDM_ISC_ISO_TABLE:
08025                 if(m_ISOTable.size() == 0)
08026                 {
08027                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08028                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08029                 }
08030 
08031                 if((unsigned int)iIdx > m_ISOTable.size())
08032                 {
08033                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - Index > size");
08034                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08035                 }
08036 
08037                 switch(uiDataID)
08038                 {
08039                 case FEDM_ISC_DATA_SNR:
08040                         FEDM_CHK2(iErr, FEDM_ConvInt64ToHexUChar(i64Data, &m_ISOTable[iIdx]->m_ucSnr[0], 8));
08041                         break;          
08042 
08043                 case FEDM_ISC_DATA_SNR_LEN:
08044                 case FEDM_ISC_DATA_BLOCK_SIZE:
08045                 case FEDM_ISC_DATA_AFI:
08046                 case FEDM_ISC_DATA_DSFID:
08047                 case FEDM_ISC_DATA_CHIP_ID:
08048                 case FEDM_ISC_DATA_OPTINFO:
08049                 case FEDM_ISC_DATA_PROTOINFO:
08050                 case FEDM_ISC_DATA_TRINFO:
08051                 case FEDM_ISC_DATA_EPC:
08052                 case FEDM_ISC_DATA_EPC_TYPE:
08053                 case FEDM_ISC_DATA_EPC_HEADER:
08054                 case FEDM_ISC_DATA_EPC_DOMAIN:
08055                 case FEDM_ISC_DATA_EPC_OBJECT:
08056                 case FEDM_ISC_DATA_EPC_SNR:
08057                 case FEDM_ISC_DATA_TRTYPE:
08058                 case FEDM_ISC_DATA_MEM_SIZE:
08059                 case FEDM_ISC_DATA_IC_REF:
08060                 case FEDM_ISC_DATA_IS_SELECTED:
08061                 case FEDM_ISC_DATA_IS_EPC:
08062                 case FEDM_ISC_DATA_SEC_STATUS:
08063                 case FEDM_ISC_DATA_FSCI:
08064                 case FEDM_ISC_DATA_FWI:
08065                 case FEDM_ISC_DATA_DSI:
08066                 case FEDM_ISC_DATA_DRI:
08067                 case FEDM_ISC_DATA_NAD:
08068                 case FEDM_ISC_DATA_CID:
08069                 case FEDM_ISC_DATA_TxDB:
08070                 case FEDM_ISC_DATA_RxDB:
08071                 case FEDM_ISC_DATA_TxCB:
08072                 case FEDM_ISC_DATA_RxCB:
08073                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
08074                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
08075                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
08076                 case FEDM_ISC_DATA_RxDB_TID_BANK:
08077                 case FEDM_ISC_DATA_TxDB_TID_BANK:
08078                 case FEDM_ISC_DATA_RxDB_RES_BANK:
08079                 case FEDM_ISC_DATA_TxDB_RES_BANK:
08080                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08081                 case FEDM_ISC_DATA_ANT_NR:
08082                 case FEDM_ISC_DATA_ANT_COUNT:
08083                 case FEDM_ISC_DATA_ANT_STATUS:
08084                 case FEDM_ISC_DATA_ANT_RSSI:
08085                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08086                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08087 
08088                 default:
08089                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - " << GetErrorText(FEDM_ERROR_PARAMETER));
08090                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08091                 }
08092                 break;
08093                 
08094         default:
08095                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64 - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
08096                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
08097         }
08098 
08099         FEDM_RETURN(FEDM_OK);
08100 }
08101 
08102 
08103 /***************************************************************************
08104   Begin                 :       19.08.2003 / M. Hultsch
08105   Version               :       03.00.07 /30.04.2009 / M. Hultsch
08106 
08107   Function                      :       set one data member in a table
08108 
08109   Parameters            :       int iIdx                -       index of table
08110                                                 unsigned int uiTableID  -       identifies the table
08111                                                 unsigned int uiDataID   -       identifies the table data
08112                                                 string sData    -       data
08113 
08114   Return value          :       0 or error code (<0)
08115 
08116 ***************************************************************************/
08117 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, string sData)
08118 {
08119         int iErr = 0;
08120 
08121         if(iIdx < 0)
08122         {
08123                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - Index < 0");
08124                 FEDM_RETURN(iIdx);
08125         }
08126 
08127         switch(uiTableID)
08128         {
08129         case FEDM_ISC_BRM_TABLE:
08130         case FEDM_ISC_CAD_TABLE:
08131                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08132                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08133         
08134         case FEDM_ISC_ISO_TABLE:
08135                 if(m_ISOTable.size() == 0)
08136                 {
08137                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08138                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08139                 }
08140 
08141                 if((unsigned int)iIdx > m_ISOTable.size())
08142                 {
08143                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - Index > size");
08144                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08145                 }
08146 
08147                 switch(uiDataID)
08148                 {
08149                 case FEDM_ISC_DATA_SNR:
08150                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucSnr[0], m_ISOTable[iIdx]->m_ucSnrLen));
08151                         break;          
08152 
08153                 case FEDM_ISC_DATA_SNR_LEN:
08154                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucSnrLen, 1));
08155                         break;
08156 
08157                 case FEDM_ISC_DATA_BLOCK_SIZE:
08158                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucBlockSize, 1));
08159                         break;          
08160 
08161                 case FEDM_ISC_DATA_AFI:
08162                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucAFI, 1));
08163                         break;          
08164 
08165                 case FEDM_ISC_DATA_DSFID:
08166                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucDsfID, 1));
08167                         break;          
08168 
08169                 case FEDM_ISC_DATA_CHIP_ID:
08170                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucChipID, 1));
08171                         break;          
08172 
08173                 case FEDM_ISC_DATA_OPTINFO:
08174                 case FEDM_ISC_DATA_PROTOINFO:
08175                 case FEDM_ISC_DATA_TRINFO:
08176                 case FEDM_ISC_DATA_EPC:
08177                 case FEDM_ISC_DATA_EPC_TYPE:
08178                 case FEDM_ISC_DATA_EPC_HEADER:
08179                 case FEDM_ISC_DATA_EPC_DOMAIN:
08180                 case FEDM_ISC_DATA_EPC_OBJECT:
08181                 case FEDM_ISC_DATA_EPC_SNR:
08182                 case FEDM_ISC_DATA_TRTYPE:
08183                 case FEDM_ISC_DATA_MEM_SIZE:
08184                 case FEDM_ISC_DATA_IC_REF:
08185                 case FEDM_ISC_DATA_IS_SELECTED:
08186                 case FEDM_ISC_DATA_IS_EPC:
08187                 case FEDM_ISC_DATA_SEC_STATUS:
08188                 case FEDM_ISC_DATA_FSCI:
08189                 case FEDM_ISC_DATA_FWI:
08190                 case FEDM_ISC_DATA_DSI:
08191                 case FEDM_ISC_DATA_DRI:
08192                 case FEDM_ISC_DATA_NAD:
08193                 case FEDM_ISC_DATA_CID:
08194                 case FEDM_ISC_DATA_TxDB:
08195                 case FEDM_ISC_DATA_RxDB:
08196                 case FEDM_ISC_DATA_TxCB:
08197                 case FEDM_ISC_DATA_RxCB:
08198                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
08199                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
08200                 case FEDM_ISC_DATA_RxDB_TID_BANK:
08201                 case FEDM_ISC_DATA_TxDB_TID_BANK:
08202                 case FEDM_ISC_DATA_RxDB_RES_BANK:
08203                 case FEDM_ISC_DATA_TxDB_RES_BANK:
08204                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
08205                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08206                 case FEDM_ISC_DATA_ANT_NR:
08207                 case FEDM_ISC_DATA_ANT_COUNT:
08208                 case FEDM_ISC_DATA_ANT_STATUS:
08209                 case FEDM_ISC_DATA_ANT_RSSI:
08210                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08211                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08212 
08213                 default:
08214                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - " << GetErrorText(FEDM_ERROR_PARAMETER));
08215                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08216                 }
08217                 break;
08218                 
08219         default:
08220                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
08221                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
08222         }
08223 
08224         FEDM_RETURN(FEDM_OK);
08225 }
08226 
08227 
08228 /***************************************************************************
08229   Begin                 :       17.11.2000 / M. Hultsch
08230   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
08231 
08232   Function                      :       set one data member in a table
08233 
08234   Parameters            :       int iIdx                -       index of table
08235                                                 unsigned int uiTableID  -       identifies the table
08236                                                 unsigned int uiDataID   -       identifies the table data
08237                                                 CString sData   -       data
08238 
08239   Return value          :       0 or error code (<0)
08240 
08241 ***************************************************************************/
08242 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
08243 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, CString sData)
08244 {
08245         int iErr = 0;
08246 
08247         if(iIdx < 0)
08248         {
08249                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - Index < 0");
08250                 FEDM_RETURN(iIdx);
08251         }
08252 
08253         switch(uiTableID)
08254         {
08255         case FEDM_ISC_BRM_TABLE:
08256         case FEDM_ISC_CAD_TABLE:
08257                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08258                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08259         
08260         case FEDM_ISC_ISO_TABLE:
08261                 if(m_ISOTable.size() == 0)
08262                 {
08263                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08264                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08265                 }
08266 
08267                 if((unsigned int)iIdx > m_ISOTable.size())
08268                 {
08269                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - Index > size");
08270                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08271                 }
08272 
08273                 switch(uiDataID)
08274                 {
08275                 case FEDM_ISC_DATA_SNR:
08276                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucSnr[0], m_ISOTable[iIdx]->m_ucSnrLen));
08277                         break;          
08278 
08279                 case FEDM_ISC_DATA_SNR_LEN:
08280                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucSnrLen, 1));
08281                         break;
08282 
08283                 case FEDM_ISC_DATA_BLOCK_SIZE:
08284                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucBlockSize, 1));
08285                         break;          
08286 
08287                 case FEDM_ISC_DATA_AFI:
08288                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucAFI, 1));
08289                         break;          
08290 
08291                 case FEDM_ISC_DATA_DSFID:
08292                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucDsfID, 1));
08293                         break;          
08294 
08295                 case FEDM_ISC_DATA_CHIP_ID:
08296                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar(sData, &m_ISOTable[iIdx]->m_ucChipID, 1));
08297                         break;          
08298 
08299                 case FEDM_ISC_DATA_OPTINFO:
08300                 case FEDM_ISC_DATA_PROTOINFO:
08301                 case FEDM_ISC_DATA_TRINFO:
08302                 case FEDM_ISC_DATA_EPC:
08303                 case FEDM_ISC_DATA_EPC_TYPE:
08304                 case FEDM_ISC_DATA_EPC_HEADER:
08305                 case FEDM_ISC_DATA_EPC_DOMAIN:
08306                 case FEDM_ISC_DATA_EPC_OBJECT:
08307                 case FEDM_ISC_DATA_EPC_SNR:
08308                 case FEDM_ISC_DATA_TRTYPE:
08309                 case FEDM_ISC_DATA_MEM_SIZE:
08310                 case FEDM_ISC_DATA_IC_REF:
08311                 case FEDM_ISC_DATA_IS_SELECTED:
08312                 case FEDM_ISC_DATA_IS_EPC:
08313                 case FEDM_ISC_DATA_SEC_STATUS:
08314                 case FEDM_ISC_DATA_FSCI:
08315                 case FEDM_ISC_DATA_FWI:
08316                 case FEDM_ISC_DATA_DSI:
08317                 case FEDM_ISC_DATA_DRI:
08318                 case FEDM_ISC_DATA_NAD:
08319                 case FEDM_ISC_DATA_CID:
08320                 case FEDM_ISC_DATA_TxDB:
08321                 case FEDM_ISC_DATA_RxDB:
08322                 case FEDM_ISC_DATA_TxCB:
08323                 case FEDM_ISC_DATA_RxCB:
08324                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
08325                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
08326                 case FEDM_ISC_DATA_RxDB_TID_BANK:
08327                 case FEDM_ISC_DATA_TxDB_TID_BANK:
08328                 case FEDM_ISC_DATA_RxDB_RES_BANK:
08329                 case FEDM_ISC_DATA_TxDB_RES_BANK:
08330                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
08331                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08332                 case FEDM_ISC_DATA_ANT_NR:
08333                 case FEDM_ISC_DATA_ANT_COUNT:
08334                 case FEDM_ISC_DATA_ANT_STATUS:
08335                 case FEDM_ISC_DATA_ANT_RSSI:
08336                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08337                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08338 
08339                 default:
08340                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - " << GetErrorText(FEDM_ERROR_PARAMETER));
08341                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08342                 }
08343                 break;
08344                 
08345         default:
08346                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
08347                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
08348         }
08349 
08350         FEDM_RETURN(FEDM_OK);
08351 }
08352 #endif
08353 
08355 // functions for data block access in a table
08357 
08358 /***************************************************************************
08359   Begin                 :       17.11.2000 / M. Hultsch
08360   Version               :       03.00.08 / 12.05.2009 / M. Hultsch
08361 
08362   Function                      :       get data block from a table
08363 
08364   Parameters            :       int iIdx                -       index of table
08365                                                 unsigned int uiTableID  -       identifies the table
08366                                                 unsigned int uiDataID   -       identifies the table data
08367                                                 int iBlockNr    -       block number
08368                                                 unsigned char* ucData   -       pointer to data buffer
08369                                                 int iDataBufLen -       length of ucData
08370 
08371   Return value          :       0 or error code (<0)
08372 
08373 ***************************************************************************/
08374 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, unsigned char* ucData, int iDataBufLen)
08375 {
08376         FEDM_CHK3(ucData);
08377 
08378         if(iIdx < 0)
08379         {
08380                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - Index < 0");
08381                 FEDM_RETURN(iIdx);
08382         }
08383 
08384         if(iDataBufLen == 0)
08385                 return FEDM_OK; // nothing to do
08386 
08387         if(iDataBufLen < 0)
08388         {
08389                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08390                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08391         }
08392 
08393         unsigned char ucBlockSize = 0x04;
08394         int iCnt = 0;
08395 
08396         switch(uiTableID)
08397         {
08398         case FEDM_ISC_BRM_TABLE:
08399                 if(m_BRMTable.size() == 0)
08400                 {
08401                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08402                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08403                 }
08404 
08405                 if((unsigned int)iIdx > m_BRMTable.size())
08406                 {
08407                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - Index > size");
08408                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08409                 }
08410 
08411                 switch(uiDataID)
08412                 {
08413                 case FEDM_ISC_DATA_RxDB:
08414                         ucBlockSize = m_BRMTable[iIdx]->m_ucBlockSize;
08415                         
08416                         if(iBlockNr < 0 || (iBlockNr+1)*ucBlockSize > FEDM_ISC_BRM_TABLE_RxDB_SIZE)
08417                         {
08418                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08419                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08420                         }
08421 
08422 
08423                         if(iDataBufLen < ucBlockSize)
08424                         {
08425                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08426                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08427                         }
08428 
08429                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08430                                 ucData[iCnt] = m_BRMTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)+iCnt];
08431                         
08432                         break;
08433 
08434                 case FEDM_ISC_DATA_ANT_NR:
08435                         if(iBlockNr < 0 || iBlockNr >= FEDM_ISC_BRM_TABLE_MAX_ANTENNA)
08436                         {
08437                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08438                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08439                         }
08440 
08441                         ucData[0] = m_BRMTable[iIdx]->m_ucAntNumber[iBlockNr];
08442                         break;
08443 
08444                 case FEDM_ISC_DATA_ANT_RSSI:
08445                         if(iBlockNr < 0 || iBlockNr >= FEDM_ISC_BRM_TABLE_MAX_ANTENNA)
08446                         {
08447                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08448                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08449                         }
08450 
08451                         ucData[0] = m_BRMTable[iIdx]->m_ucAntRSSI[iBlockNr];
08452                         break;
08453 
08454                 case FEDM_ISC_DATA_ANT_COUNT:
08455                 case FEDM_ISC_DATA_ANT_STATUS:
08456                 case FEDM_ISC_DATA_SNR:
08457                 case FEDM_ISC_DATA_TRTYPE:
08458                 case FEDM_ISC_DATA_TIMER:
08459                 case FEDM_ISC_DATA_DATE:
08460                 case FEDM_ISC_DATA_DB_ADR:
08461                 case FEDM_ISC_DATA_DBN:
08462                 case FEDM_ISC_DATA_SNR_LEN:
08463                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08464                 case FEDM_ISC_DATA_MAC_ADR:
08465                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08466                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08467 
08468                 default:
08469                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
08470                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08471                 }
08472                 break;
08473         
08474         case FEDM_ISC_ISO_TABLE:
08475                 if(m_ISOTable.size() == 0)
08476                 {
08477                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08478                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08479                 }
08480 
08481                 if((unsigned int)iIdx > m_ISOTable.size())
08482                 {
08483                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - Index > size");
08484                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08485                 }
08486 
08487                 switch(uiDataID)
08488                 {
08489                 case FEDM_ISC_DATA_SEC_STATUS:
08490                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
08491                         {
08492                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08493                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08494                         }
08495 
08496                         ucData[0] = m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr];
08497                         break;
08498 
08499                 case FEDM_ISC_DATA_TxDB:
08500                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08501                         
08502                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
08503                         {
08504                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08505                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08506                         }
08507 
08508                         if(iDataBufLen < ucBlockSize)
08509                         {
08510                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08511                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08512                         }
08513 
08514                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08515                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)+iCnt];
08516 
08517                         break;
08518 
08519                 case FEDM_ISC_DATA_RxDB:
08520                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08521                         
08522                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
08523                         {
08524                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08525                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08526                         }
08527 
08528                         if(iDataBufLen < ucBlockSize)
08529                         {
08530                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08531                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08532                         }
08533 
08534                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08535                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)+iCnt];
08536                         
08537                         break;
08538 
08539                 case FEDM_ISC_DATA_TxDB_PLAIN:
08540                         // iBlockNr is byte offset
08541                         // iDataBufLen is number of bytes to be copied to
08542                         if(iBlockNr < 0 || (unsigned int)(iBlockNr+iDataBufLen) >= m_ISOTable[iIdx]->m_ucTxDB.size())
08543                         {
08544                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08545                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08546                         }
08547 
08548                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucTxDB[iBlockNr], iDataBufLen);
08549                         
08550                         break;
08551 
08552                 case FEDM_ISC_DATA_RxDB_PLAIN:
08553                         // iBlockNr is byte offset
08554                         // iDataBufLen is number of bytes to be copied to
08555                         if(iBlockNr < 0 || (unsigned int)(iBlockNr+iDataBufLen) >= m_ISOTable[iIdx]->m_ucRxDB.size())
08556                         {
08557                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08558                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08559                         }
08560 
08561                         memcpy(ucData, &m_ISOTable[iIdx]->m_ucRxDB[iBlockNr], iDataBufLen);
08562                         
08563                         break;
08564 
08565                 case FEDM_ISC_DATA_TxCB:
08566                         if(iBlockNr < 0 || iBlockNr >= 4)
08567                         {
08568                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08569                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08570                         }
08571 
08572                         if(iDataBufLen < 4)
08573                         {
08574                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08575                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08576                         }
08577                         
08578                         for(iCnt=0; iCnt<4; iCnt++)
08579                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][iCnt];
08580 
08581                         break;
08582                 
08583                 case FEDM_ISC_DATA_RxCB:
08584                         if(iBlockNr < 0 || iBlockNr >= 4)
08585                         {
08586                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08587                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08588                         }
08589 
08590                         if(iDataBufLen < 4)
08591                         {
08592                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08593                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08594                         }
08595                         
08596                         for(iCnt=0; iCnt<4; iCnt++)
08597                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][iCnt];
08598 
08599                         break;
08600 
08601                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
08602                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08603                         
08604                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
08605                         {
08606                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08607                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08608                         }
08609 
08610                         if(iDataBufLen < ucBlockSize)
08611                         {
08612                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08613                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08614                         }
08615 
08616                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08617                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)+iCnt];
08618                         
08619                         break;
08620 
08621                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
08622                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08623                         
08624                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
08625                         {
08626                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08627                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08628                         }
08629 
08630                         if(iDataBufLen < ucBlockSize)
08631                         {
08632                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08633                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08634                         }
08635 
08636                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08637                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)+iCnt];
08638 
08639                         break;
08640 
08641                 case FEDM_ISC_DATA_RxDB_TID_BANK:
08642                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08643                         
08644                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
08645                         {
08646                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08647                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08648                         }
08649 
08650                         if(iDataBufLen < ucBlockSize)
08651                         {
08652                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08653                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08654                         }
08655 
08656                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08657                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)+iCnt];
08658                         
08659                         break;
08660 
08661                 case FEDM_ISC_DATA_TxDB_TID_BANK:
08662                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08663                         
08664                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
08665                         {
08666                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08667                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08668                         }
08669 
08670                         if(iDataBufLen < ucBlockSize)
08671                         {
08672                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08673                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08674                         }
08675 
08676                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08677                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)+iCnt];
08678 
08679                         break;
08680 
08681                 case FEDM_ISC_DATA_RxDB_RES_BANK:
08682                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08683                         
08684                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
08685                         {
08686                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08687                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08688                         }
08689 
08690                         if(iDataBufLen < ucBlockSize)
08691                         {
08692                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08693                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08694                         }
08695 
08696                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08697                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)+iCnt];
08698                         
08699                         break;
08700 
08701                 case FEDM_ISC_DATA_TxDB_RES_BANK:
08702                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08703 
08704                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
08705                         {
08706                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08707                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08708                         }
08709 
08710                         if(iDataBufLen < ucBlockSize)
08711                         {
08712                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
08713                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
08714                         }
08715 
08716                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
08717                                 ucData[iCnt] = m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)+iCnt];
08718 
08719                         break;
08720 
08721                 case FEDM_ISC_DATA_ANT_NR:
08722                         if(iBlockNr < 0 || iBlockNr >= FEDM_ISC_ISO_TABLE_MAX_ANTENNA)
08723                         {
08724                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08725                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08726                         }
08727 
08728                         ucData[0] = m_ISOTable[iIdx]->m_ucAntNumber[iBlockNr];
08729                         break;
08730 
08731                 case FEDM_ISC_DATA_ANT_STATUS:
08732                         if(iBlockNr < 0 || iBlockNr >= FEDM_ISC_ISO_TABLE_MAX_ANTENNA)
08733                         {
08734                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08735                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08736                         }
08737 
08738                         ucData[0] = m_ISOTable[iIdx]->m_ucAntStatus[iBlockNr];
08739                         break;
08740 
08741                 case FEDM_ISC_DATA_ANT_RSSI:
08742                         if(iBlockNr < 0 || iBlockNr >= FEDM_ISC_ISO_TABLE_MAX_ANTENNA)
08743                         {
08744                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08745                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08746                         }
08747 
08748                         ucData[0] = m_ISOTable[iIdx]->m_ucAntRSSI[iBlockNr];
08749                         break;
08750 
08751                 case FEDM_ISC_DATA_ANT_COUNT:
08752                 case FEDM_ISC_DATA_SNR_LEN:
08753                 case FEDM_ISC_DATA_OPTINFO:
08754                 case FEDM_ISC_DATA_PROTOINFO:
08755                 case FEDM_ISC_DATA_TRINFO:
08756                 case FEDM_ISC_DATA_EPC:
08757                 case FEDM_ISC_DATA_EPC_TYPE:
08758                 case FEDM_ISC_DATA_EPC_HEADER:
08759                 case FEDM_ISC_DATA_EPC_DOMAIN:
08760                 case FEDM_ISC_DATA_EPC_OBJECT:
08761                 case FEDM_ISC_DATA_EPC_SNR:
08762                 case FEDM_ISC_DATA_SNR:
08763                 case FEDM_ISC_DATA_TRTYPE:
08764                 case FEDM_ISC_DATA_AFI:
08765                 case FEDM_ISC_DATA_DSFID:
08766                 case FEDM_ISC_DATA_CHIP_ID:
08767                 case FEDM_ISC_DATA_MEM_SIZE:
08768                 case FEDM_ISC_DATA_IC_REF:
08769                 case FEDM_ISC_DATA_IS_SELECTED:
08770                 case FEDM_ISC_DATA_IS_EPC:
08771                 case FEDM_ISC_DATA_BLOCK_SIZE:
08772                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
08773                 case FEDM_ISC_DATA_FSCI:
08774                 case FEDM_ISC_DATA_FWI:
08775                 case FEDM_ISC_DATA_DSI:
08776                 case FEDM_ISC_DATA_DRI:
08777                 case FEDM_ISC_DATA_NAD:
08778                 case FEDM_ISC_DATA_CID:
08779                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08780                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08781                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08782 
08783                 default:
08784                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
08785                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08786                 }
08787                 break;
08788                 
08789         case FEDM_ISC_CAD_TABLE:
08790                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08791                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08792 
08793         default:
08794                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
08795                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
08796         }
08797 
08798         FEDM_RETURN(FEDM_OK);
08799 }
08800 
08801 /***************************************************************************
08802   Begin                 :       19.08.2003 / M. Hultsch
08803   Version               :       03.00.08 / 26.05.2009 / M. Hultsch
08804 
08805   Function                      :       get data block from a table
08806 
08807   Parameters            :       int iIdx                -       index of table
08808                                                 unsigned int uiTableID  -       identifies the table
08809                                                 unsigned int uiDataID   -       identifies the table data
08810                                                 int iBlockNr    -       block number
08811                                                 string& sData   -       referenz of data
08812 
08813   Return value          :       0 or error code (<0)
08814 
08815 ***************************************************************************/
08816 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, string& sData)
08817 {
08818         FEDM_CHK3(&sData);
08819 
08820         unsigned char ucBlockSize = 0x04;
08821         int iErr;
08822 
08823         if(iIdx < 0)
08824         {
08825                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - Index < 0");
08826                 FEDM_RETURN(iIdx);
08827         }
08828 
08829         switch(uiTableID)
08830         {
08831         case FEDM_ISC_BRM_TABLE:
08832                 if(m_BRMTable.size() == 0)
08833                 {
08834                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08835                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08836                 }
08837 
08838                 if((unsigned int)iIdx > m_BRMTable.size())
08839                 {
08840                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - Index > size");
08841                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08842                 }
08843 
08844                 switch(uiDataID)
08845                 {
08846                 case FEDM_ISC_DATA_RxDB:
08847                         ucBlockSize = m_BRMTable[iIdx]->m_ucBlockSize;
08848                         
08849                         if(iBlockNr < 0 || (iBlockNr+1)*ucBlockSize > FEDM_ISC_BRM_TABLE_RxDB_SIZE)
08850                         {
08851                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08852                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08853                         }
08854 
08855                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_BRMTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)], 
08856                                                                                                                 (int)ucBlockSize, 
08857                                                                                                                 sData ));
08858 
08859                         break;
08860 
08861 
08862                 case FEDM_ISC_DATA_ANT_STATUS:
08863                 case FEDM_ISC_DATA_ANT_RSSI:
08864                 case FEDM_ISC_DATA_ANT_COUNT:
08865                 case FEDM_ISC_DATA_SNR:
08866                 case FEDM_ISC_DATA_TRTYPE:
08867                 case FEDM_ISC_DATA_TIMER:
08868                 case FEDM_ISC_DATA_DATE:
08869                 case FEDM_ISC_DATA_DB_ADR:
08870                 case FEDM_ISC_DATA_DBN:
08871                 case FEDM_ISC_DATA_ANT_NR:
08872                 case FEDM_ISC_DATA_SNR_LEN:
08873                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
08874                 case FEDM_ISC_DATA_MAC_ADR:
08875                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
08876                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
08877 
08878                 default:
08879                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
08880                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
08881                 }
08882                 break;
08883         
08884         case FEDM_ISC_ISO_TABLE:
08885                 if(m_ISOTable.size() == 0)
08886                 {
08887                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
08888                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
08889                 }
08890 
08891                 if((unsigned int)iIdx > m_ISOTable.size())
08892                 {
08893                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - Index > size");
08894                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08895                 }
08896 
08897                 switch(uiDataID)
08898                 {
08899                 case FEDM_ISC_DATA_SEC_STATUS:
08900                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
08901                         {
08902                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08903                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08904                         }
08905 
08906                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr], 
08907                                                                                                                 1, 
08908                                                                                                                 sData ));
08909 
08910                         break;
08911 
08912                 case FEDM_ISC_DATA_TxDB:
08913                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08914                         
08915                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
08916                         {
08917                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08918                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08919                         }
08920 
08921                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)], 
08922                                                                                                                 (int)ucBlockSize, 
08923                                                                                                                 sData ));
08924 
08925                         break;
08926 
08927                 case FEDM_ISC_DATA_RxDB:
08928                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08929                         
08930                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
08931                         {
08932                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08933                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08934                         }
08935 
08936                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)], 
08937                                                                                                                 (int)ucBlockSize, 
08938                                                                                                                 sData ));
08939 
08940                         break;
08941 
08942                 case FEDM_ISC_DATA_TxCB:
08943                         if(iBlockNr < 0 || iBlockNr >= 4)
08944                         {
08945                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08946                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08947                         }
08948 
08949                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][0], 
08950                                                                                                                 4, 
08951                                                                                                                 sData ));
08952 
08953                         break;
08954                 
08955                 case FEDM_ISC_DATA_RxCB:
08956                         if(iBlockNr < 0 || iBlockNr >= 4)
08957                         {
08958                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08959                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08960                         }
08961 
08962                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][0], 
08963                                                                                                                 4, 
08964                                                                                                                 sData ));
08965 
08966                         break;
08967 
08968                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
08969                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08970                         
08971                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
08972                         {
08973                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08974                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08975                         }
08976 
08977                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)], 
08978                                                                                                                 (int)ucBlockSize, 
08979                                                                                                                 sData ));
08980 
08981                         break;
08982 
08983                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
08984                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
08985                         
08986                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
08987                         {
08988                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
08989                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
08990                         }
08991 
08992                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)], 
08993                                                                                                                 (int)ucBlockSize, 
08994                                                                                                                 sData ));
08995 
08996                         break;
08997 
08998                 case FEDM_ISC_DATA_RxDB_TID_BANK:
08999                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09000                         
09001                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
09002                         {
09003                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09004                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09005                         }
09006 
09007                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)], 
09008                                                                                                                 (int)ucBlockSize, 
09009                                                                                                                 sData ));
09010 
09011                         break;
09012 
09013                 case FEDM_ISC_DATA_TxDB_TID_BANK:
09014                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09015                         
09016                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
09017                         {
09018                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09019                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09020                         }
09021 
09022                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)], 
09023                                                                                                                 (int)ucBlockSize, 
09024                                                                                                                 sData ));
09025 
09026                         break;
09027 
09028                 case FEDM_ISC_DATA_RxDB_RES_BANK:
09029                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09030                         
09031                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
09032                         {
09033                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09034                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09035                         }
09036 
09037                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)], 
09038                                                                                                                 (int)ucBlockSize, 
09039                                                                                                                 sData ));
09040 
09041                         break;
09042 
09043                 case FEDM_ISC_DATA_TxDB_RES_BANK:
09044                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09045                         
09046                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
09047                         {
09048                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09049                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09050                         }
09051 
09052                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)], 
09053                                                                                                                 (int)ucBlockSize, 
09054                                                                                                                 sData ));
09055 
09056                         break;
09057 
09058 
09059                 case FEDM_ISC_DATA_ANT_NR:
09060                 case FEDM_ISC_DATA_ANT_STATUS:
09061                 case FEDM_ISC_DATA_ANT_RSSI:
09062                 case FEDM_ISC_DATA_ANT_COUNT:
09063                 case FEDM_ISC_DATA_SNR_LEN:
09064                 case FEDM_ISC_DATA_OPTINFO:
09065                 case FEDM_ISC_DATA_PROTOINFO:
09066                 case FEDM_ISC_DATA_TRINFO:
09067                 case FEDM_ISC_DATA_EPC:
09068                 case FEDM_ISC_DATA_EPC_TYPE:
09069                 case FEDM_ISC_DATA_EPC_HEADER:
09070                 case FEDM_ISC_DATA_EPC_DOMAIN:
09071                 case FEDM_ISC_DATA_EPC_OBJECT:
09072                 case FEDM_ISC_DATA_EPC_SNR:
09073                 case FEDM_ISC_DATA_SNR:
09074                 case FEDM_ISC_DATA_TRTYPE:
09075                 case FEDM_ISC_DATA_AFI:
09076                 case FEDM_ISC_DATA_DSFID:
09077                 case FEDM_ISC_DATA_CHIP_ID:
09078                 case FEDM_ISC_DATA_MEM_SIZE:
09079                 case FEDM_ISC_DATA_IC_REF:
09080                 case FEDM_ISC_DATA_IS_SELECTED:
09081                 case FEDM_ISC_DATA_IS_EPC:
09082                 case FEDM_ISC_DATA_BLOCK_SIZE:
09083                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
09084                 case FEDM_ISC_DATA_FSCI:
09085                 case FEDM_ISC_DATA_FWI:
09086                 case FEDM_ISC_DATA_DSI:
09087                 case FEDM_ISC_DATA_DRI:
09088                 case FEDM_ISC_DATA_NAD:
09089                 case FEDM_ISC_DATA_CID:
09090                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
09091                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09092                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09093 
09094                 default:
09095                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
09096                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
09097                 }
09098                 break;
09099 
09100 #if !defined(__BORLANDC__)
09101         case FEDM_ISC_CAD_TABLE:
09102                 switch(uiDataID)
09103                 {
09104                 case FEDM_ISC_DATA_MISC:
09105                         if(iBlockNr < 0 || (unsigned int)iBlockNr > 3)
09106                         {
09107                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09108                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09109                         }
09110 
09111                         FEDM_CHK2(iErr, FEDM_ConvIntToHexStr( m_CADTable.m_nData[iBlockNr], sData ));
09112                         break;
09113 
09114                 default:
09115                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
09116                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
09117                 }
09118                 break;
09119 #endif
09120 
09121         default:
09122                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
09123                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
09124         }
09125 
09126         FEDM_RETURN(FEDM_OK);
09127 }
09128 
09129 
09130 /***************************************************************************
09131   Begin                 :       15.02.2001 / M. Hultsch
09132   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
09133 
09134   Function                      :       get data block from a table
09135 
09136   Parameters            :       int iIdx                -       index of table
09137                                                 unsigned int uiTableID  -       identifies the table
09138                                                 unsigned int uiDataID   -       identifies the table data
09139                                                 int iBlockNr    -       block number
09140                                                 CString& sData  -       referenz of data
09141 
09142   Return value          :       0 or error code (<0)
09143 
09144 ***************************************************************************/
09145 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
09146 int FEDM_ISCReader::GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, CString& sData)
09147 {
09148         FEDM_CHK3(&sData);
09149 
09150         unsigned char ucBlockSize = 0x04;
09151         int iErr;
09152 
09153         if(iIdx < 0)
09154         {
09155                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - Index < 0");
09156                 FEDM_RETURN(iIdx);
09157         }
09158 
09159         switch(uiTableID)
09160         {
09161         case FEDM_ISC_BRM_TABLE:
09162                 if(m_BRMTable.size() == 0)
09163                 {
09164                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
09165                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
09166                 }
09167 
09168                 if((unsigned int)iIdx > m_BRMTable.size())
09169                 {
09170                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - Index > size");
09171                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09172                 }
09173 
09174                 switch(uiDataID)
09175                 {
09176                 case FEDM_ISC_DATA_RxDB:
09177                         ucBlockSize = m_BRMTable[iIdx]->m_ucBlockSize;
09178                         
09179                         if(iBlockNr < 0 || ((iBlockNr+1)*ucBlockSize) > FEDM_ISC_BRM_TABLE_RxDB_SIZE)
09180                         {
09181                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09182                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09183                         }
09184 
09185                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_BRMTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)], 
09186                                                                                                                 (int)ucBlockSize, 
09187                                                                                                                 sData ));
09188 
09189                         break;
09190 
09191                 case FEDM_ISC_DATA_ANT_STATUS:
09192                 case FEDM_ISC_DATA_ANT_RSSI:
09193                 case FEDM_ISC_DATA_ANT_COUNT:
09194                 case FEDM_ISC_DATA_SNR:
09195                 case FEDM_ISC_DATA_TRTYPE:
09196                 case FEDM_ISC_DATA_TIMER:
09197                 case FEDM_ISC_DATA_DATE:
09198                 case FEDM_ISC_DATA_DB_ADR:
09199                 case FEDM_ISC_DATA_DBN:
09200                 case FEDM_ISC_DATA_ANT_NR:
09201                 case FEDM_ISC_DATA_SNR_LEN:
09202                 case FEDM_ISC_DATA_EPC:
09203                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
09204                 case FEDM_ISC_DATA_MAC_ADR:
09205                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09206                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09207 
09208                 default:
09209                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
09210                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
09211                 }
09212                 break;
09213         
09214         case FEDM_ISC_ISO_TABLE:
09215                 if(m_ISOTable.size() == 0)
09216                 {
09217                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
09218                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
09219                 }
09220 
09221                 if((unsigned int)iIdx > m_ISOTable.size())
09222                 {
09223                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - Index > size");
09224                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09225                 }
09226 
09227                 switch(uiDataID)
09228                 {
09229                 case FEDM_ISC_DATA_SEC_STATUS:
09230                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
09231                         {
09232                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09233                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09234                         }
09235 
09236                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr], 
09237                                                                                                                 1, 
09238                                                                                                                 sData ));
09239 
09240                         break;
09241 
09242                 case FEDM_ISC_DATA_TxDB:
09243                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09244                         
09245                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
09246                         {
09247                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09248                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09249                         }
09250 
09251                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)], 
09252                                                                                                                 (int)ucBlockSize, 
09253                                                                                                                 sData ));
09254 
09255                         break;
09256 
09257                 case FEDM_ISC_DATA_RxDB:
09258                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09259                         
09260                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
09261                         {
09262                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09263                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09264                         }
09265 
09266                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)], 
09267                                                                                                                 (int)ucBlockSize, 
09268                                                                                                                 sData ));
09269 
09270                         break;
09271 
09272                 case FEDM_ISC_DATA_TxCB:
09273                         if(iBlockNr < 0 || iBlockNr >= 4)
09274                         {
09275                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09276                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09277                         }
09278 
09279                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][0], 
09280                                                                                                                 4, 
09281                                                                                                                 sData ));
09282 
09283                         break;
09284                 
09285                 case FEDM_ISC_DATA_RxCB:
09286                         if(iBlockNr < 0 || iBlockNr >= 4)
09287                         {
09288                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09289                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09290                         }
09291 
09292                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][0], 
09293                                                                                                                 4, 
09294                                                                                                                 sData ));
09295 
09296                         break;
09297 
09298                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
09299                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09300                         
09301                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
09302                         {
09303                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09304                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09305                         }
09306 
09307                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)], 
09308                                                                                                                 (int)ucBlockSize, 
09309                                                                                                                 sData ));
09310 
09311                         break;
09312 
09313                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
09314                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09315                         
09316                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
09317                         {
09318                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09319                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09320                         }
09321 
09322                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)], 
09323                                                                                                                 (int)ucBlockSize, 
09324                                                                                                                 sData ));
09325 
09326                         break;
09327 
09328                 case FEDM_ISC_DATA_RxDB_TID_BANK:
09329                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09330                         
09331                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
09332                         {
09333                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09334                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09335                         }
09336 
09337                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)], 
09338                                                                                                                 (int)ucBlockSize, 
09339                                                                                                                 sData ));
09340 
09341                         break;
09342 
09343                 case FEDM_ISC_DATA_TxDB_TID_BANK:
09344                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09345                         
09346                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
09347                         {
09348                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09349                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09350                         }
09351 
09352                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)], 
09353                                                                                                                 (int)ucBlockSize, 
09354                                                                                                                 sData ));
09355 
09356                         break;
09357 
09358                 case FEDM_ISC_DATA_RxDB_RES_BANK:
09359                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09360                         
09361                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
09362                         {
09363                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09364                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09365                         }
09366 
09367                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)], 
09368                                                                                                                 (int)ucBlockSize, 
09369                                                                                                                 sData ));
09370 
09371                         break;
09372 
09373                 case FEDM_ISC_DATA_TxDB_RES_BANK:
09374                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09375                         
09376                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
09377                         {
09378                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09379                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09380                         }
09381 
09382                         FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr( &m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)], 
09383                                                                                                                 (int)ucBlockSize, 
09384                                                                                                                 sData ));
09385 
09386                         break;
09387 
09388                 case FEDM_ISC_DATA_ANT_NR:
09389                 case FEDM_ISC_DATA_ANT_STATUS:
09390                 case FEDM_ISC_DATA_ANT_RSSI:
09391                 case FEDM_ISC_DATA_ANT_COUNT:
09392                 case FEDM_ISC_DATA_SNR_LEN:
09393                 case FEDM_ISC_DATA_OPTINFO:
09394                 case FEDM_ISC_DATA_PROTOINFO:
09395                 case FEDM_ISC_DATA_TRINFO:
09396                 case FEDM_ISC_DATA_EPC:
09397                 case FEDM_ISC_DATA_EPC_TYPE:
09398                 case FEDM_ISC_DATA_EPC_HEADER:
09399                 case FEDM_ISC_DATA_EPC_DOMAIN:
09400                 case FEDM_ISC_DATA_EPC_OBJECT:
09401                 case FEDM_ISC_DATA_EPC_SNR:
09402                 case FEDM_ISC_DATA_SNR:
09403                 case FEDM_ISC_DATA_TRTYPE:
09404                 case FEDM_ISC_DATA_AFI:
09405                 case FEDM_ISC_DATA_DSFID:
09406                 case FEDM_ISC_DATA_CHIP_ID:
09407                 case FEDM_ISC_DATA_MEM_SIZE:
09408                 case FEDM_ISC_DATA_IC_REF:
09409                 case FEDM_ISC_DATA_IS_SELECTED:
09410                 case FEDM_ISC_DATA_IS_EPC:
09411                 case FEDM_ISC_DATA_BLOCK_SIZE:
09412                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
09413                 case FEDM_ISC_DATA_FSCI:
09414                 case FEDM_ISC_DATA_FWI:
09415                 case FEDM_ISC_DATA_DSI:
09416                 case FEDM_ISC_DATA_DRI:
09417                 case FEDM_ISC_DATA_NAD:
09418                 case FEDM_ISC_DATA_CID:
09419                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
09420                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09421                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09422 
09423                 default:
09424                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_PARAMETER));
09425                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
09426                 }
09427                 break;
09428 
09429         case FEDM_ISC_CAD_TABLE:
09430                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09431                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09432                 
09433         default:
09434                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString&) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
09435                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
09436         }
09437 
09438         FEDM_RETURN(FEDM_OK);
09439 }
09440 #endif
09441 
09442 /***************************************************************************
09443   Begin                 :       17.11.2000 / M. Hultsch
09444   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
09445 
09446   Function                      :       set data block in a table
09447 
09448   Parameters            :       int iIdx                -       index of table
09449                                                 unsigned int uiTableID  -       identifies the table
09450                                                 unsigned int uiDataID   -       identifies the table data
09451                                                 int iBlockNr    -       block number
09452                                                 unsigned char* ucData   -       pointer to data buffer
09453                                                 int iDataBufLen -       length of ucData
09454 
09455   Return value          :       0 or error code (<0)
09456 
09457 ***************************************************************************/
09458 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, unsigned char* ucData, int iDataBufLen)
09459 {
09460         FEDM_CHK3(ucData);
09461 
09462         if(iDataBufLen == 0)
09463                 return FEDM_OK; // nothing to do
09464 
09465         if(iDataBufLen < 0)
09466         {
09467                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09468                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09469         }
09470 
09471         unsigned char ucBlockSize = 0x04;
09472         int iCnt;
09473 
09474         if(iIdx < 0)
09475         {
09476                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - Index < 0");
09477                 FEDM_RETURN(iIdx);
09478         }
09479 
09480         switch(uiTableID)
09481         {
09482         case FEDM_ISC_BRM_TABLE:
09483         case FEDM_ISC_CAD_TABLE:
09484                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09485                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09486         
09487         case FEDM_ISC_ISO_TABLE:
09488                 if(m_ISOTable.size() == 0)
09489                 {
09490                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
09491                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
09492                 }
09493 
09494                 if((unsigned int)iIdx > m_ISOTable.size())
09495                 {
09496                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - Index > size");
09497                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09498                 }
09499 
09500                 switch(uiDataID)
09501                 {
09502                 case FEDM_ISC_DATA_SEC_STATUS:
09503                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
09504                         {
09505                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09506                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09507                         }
09508 
09509                         m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr] = ucData[0];
09510                         break;
09511 
09512                 case FEDM_ISC_DATA_TxDB:
09513                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09514                         
09515                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
09516                         {
09517                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09518                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09519                         }
09520 
09521                         if(iDataBufLen < ucBlockSize)
09522                         {
09523                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09524                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09525                         }
09526 
09527                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09528                                 m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09529 
09530                         break;
09531 
09532                 case FEDM_ISC_DATA_RxDB:
09533                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09534                         
09535                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
09536                         {
09537                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09538                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09539                         }
09540 
09541                         if(iDataBufLen < ucBlockSize)
09542                         {
09543                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09544                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09545                         }
09546 
09547                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09548                                 m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09549 
09550                         break;
09551 
09552                 case FEDM_ISC_DATA_TxDB_PLAIN:
09553                         // iBlockNr is byte offset
09554                         // iDataBufLen is number of bytes to be copied to
09555                         if(iBlockNr < 0 || (unsigned int)(iBlockNr+iDataBufLen) >= m_ISOTable[iIdx]->m_ucTxDB.size())
09556                         {
09557                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09558                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09559                         }
09560 
09561                         memcpy(&m_ISOTable[iIdx]->m_ucTxDB[iBlockNr], ucData, iDataBufLen);
09562                         
09563                         break;
09564 
09565                 case FEDM_ISC_DATA_RxDB_PLAIN:
09566                         // iBlockNr is byte offset
09567                         // iDataBufLen is number of bytes to be copied to
09568                         if(iBlockNr < 0 || (unsigned int)(iBlockNr+iDataBufLen) >= m_ISOTable[iIdx]->m_ucRxDB.size())
09569                         {
09570                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09571                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09572                         }
09573 
09574                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB[iBlockNr], ucData, iDataBufLen);
09575                         
09576                         break;
09577 
09578                 case FEDM_ISC_DATA_TxCB:
09579                         if(iBlockNr < 0 || iBlockNr >= 4)
09580                         {
09581                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09582                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09583                         }
09584 
09585                         if(iDataBufLen < 4)
09586                         {
09587                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09588                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09589                         }
09590 
09591                         for(iCnt=0; iCnt<4; iCnt++)
09592                                 m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][iCnt] = ucData[iCnt];
09593 
09594                         break;
09595                 
09596                 case FEDM_ISC_DATA_RxCB:
09597                         if(iBlockNr < 0 || iBlockNr >= 4)
09598                         {
09599                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09600                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09601                         }
09602 
09603                         if(iDataBufLen < 4)
09604                         {
09605                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09606                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09607                         }
09608 
09609                         for(iCnt=0; iCnt<4; iCnt++)
09610                                 m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][iCnt] = ucData[iCnt];
09611 
09612                         break;
09613 
09614                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
09615                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09616                         
09617                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
09618                         {
09619                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09620                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09621                         }
09622 
09623                         if(iDataBufLen < ucBlockSize)
09624                         {
09625                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09626                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09627                         }
09628 
09629                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09630                                 m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09631 
09632                         break;
09633 
09634                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
09635                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09636                         
09637                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
09638                         {
09639                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09640                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09641                         }
09642 
09643                         if(iDataBufLen < ucBlockSize)
09644                         {
09645                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09646                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09647                         }
09648 
09649                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09650                                 m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09651 
09652                         break;
09653 
09654                 case FEDM_ISC_DATA_RxDB_TID_BANK:
09655                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09656                         
09657                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
09658                         {
09659                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09660                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09661                         }
09662 
09663                         if(iDataBufLen < ucBlockSize)
09664                         {
09665                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09666                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09667                         }
09668 
09669                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09670                                 m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09671 
09672                         break;
09673 
09674                 case FEDM_ISC_DATA_TxDB_TID_BANK:
09675                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09676                         
09677                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
09678                         {
09679                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09680                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09681                         }
09682 
09683                         if(iDataBufLen < ucBlockSize)
09684                         {
09685                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09686                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09687                         }
09688 
09689                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09690                                 m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09691 
09692                         break;
09693 
09694                 case FEDM_ISC_DATA_RxDB_RES_BANK:
09695                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09696                         
09697                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
09698                         {
09699                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09700                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09701                         }
09702 
09703                         if(iDataBufLen < ucBlockSize)
09704                         {
09705                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09706                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09707                         }
09708 
09709                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09710                                 m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09711 
09712                         break;
09713 
09714                 case FEDM_ISC_DATA_TxDB_RES_BANK:
09715                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09716                         
09717                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
09718                         {
09719                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09720                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09721                         }
09722 
09723                         if(iDataBufLen < ucBlockSize)
09724                         {
09725                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
09726                                 FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
09727                         }
09728 
09729                         for(iCnt=0; iCnt<ucBlockSize; iCnt++)
09730                                 m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)+iCnt] = ucData[iCnt];
09731 
09732                         break;
09733 
09734                 case FEDM_ISC_DATA_ANT_NR:
09735                 case FEDM_ISC_DATA_ANT_STATUS:
09736                 case FEDM_ISC_DATA_ANT_RSSI:
09737                 case FEDM_ISC_DATA_ANT_COUNT:
09738                 case FEDM_ISC_DATA_SNR_LEN:
09739                 case FEDM_ISC_DATA_OPTINFO:
09740                 case FEDM_ISC_DATA_PROTOINFO:
09741                 case FEDM_ISC_DATA_TRINFO:
09742                 case FEDM_ISC_DATA_EPC:
09743                 case FEDM_ISC_DATA_EPC_TYPE:
09744                 case FEDM_ISC_DATA_EPC_HEADER:
09745                 case FEDM_ISC_DATA_EPC_DOMAIN:
09746                 case FEDM_ISC_DATA_EPC_OBJECT:
09747                 case FEDM_ISC_DATA_EPC_SNR:
09748                 case FEDM_ISC_DATA_SNR:
09749                 case FEDM_ISC_DATA_TRTYPE:
09750                 case FEDM_ISC_DATA_AFI:
09751                 case FEDM_ISC_DATA_DSFID:
09752                 case FEDM_ISC_DATA_CHIP_ID:
09753                 case FEDM_ISC_DATA_MEM_SIZE:
09754                 case FEDM_ISC_DATA_IC_REF:
09755                 case FEDM_ISC_DATA_IS_SELECTED:
09756                 case FEDM_ISC_DATA_IS_EPC:
09757                 case FEDM_ISC_DATA_BLOCK_SIZE:
09758                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
09759                 case FEDM_ISC_DATA_FSCI:
09760                 case FEDM_ISC_DATA_FWI:
09761                 case FEDM_ISC_DATA_DSI:
09762                 case FEDM_ISC_DATA_DRI:
09763                 case FEDM_ISC_DATA_NAD:
09764                 case FEDM_ISC_DATA_CID:
09765                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
09766                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09767                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09768 
09769                 default:
09770                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
09771                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
09772                 }
09773                 break;
09774                 
09775         default:
09776                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", uchar*, " << iDataBufLen << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
09777                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
09778         }
09779 
09780         FEDM_RETURN(FEDM_OK);
09781 }
09782 
09783 /***************************************************************************
09784   Begin                 :       19.08.2003 / M. Hultsch
09785   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
09786 
09787   Function                      :       set data block in a table
09788 
09789   Parameters            :       int iIdx                -       index of table
09790                                                 unsigned int uiTableID  -       identifies the table
09791                                                 unsigned int uiDataID   -       identifies the table data
09792                                                 int iBlockNr    -       block number
09793                                                 string sData    -       data
09794 
09795   Return value          :       0 or error code (<0)
09796 
09797 ***************************************************************************/
09798 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, string sData)
09799 {
09800         unsigned char ucBlockSize = 0x04;
09801         int iErr;
09802 
09803         if(iIdx < 0)
09804         {
09805                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - Index < 0");
09806                 FEDM_RETURN(iIdx);
09807         }
09808 
09809         switch(uiTableID)
09810         {
09811         case FEDM_ISC_BRM_TABLE:
09812         case FEDM_ISC_CAD_TABLE:
09813                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
09814                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
09815         
09816         case FEDM_ISC_ISO_TABLE:
09817                 if(m_ISOTable.size() == 0)
09818                 {
09819                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
09820                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
09821                 }
09822 
09823                 if((unsigned int)iIdx > m_ISOTable.size())
09824                 {
09825                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - Index > size");
09826                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09827                 }
09828 
09829                 switch(uiDataID)
09830                 {
09831                 case FEDM_ISC_DATA_SEC_STATUS:
09832                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
09833                         {
09834                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09835                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09836                         }
09837 
09838 
09839                         if(sData.size()%2)      // number of chars in data string has to be even
09840                         {
09841                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09842                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09843                         }
09844 
09845                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
09846                         {
09847                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09848                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09849                         }
09850 
09851                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09852                                                                                                            &m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr],
09853                                                                                                            1 ));
09854                         break;
09855 
09856                 case FEDM_ISC_DATA_TxDB:
09857                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09858                         
09859                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
09860                         {
09861                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09862                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09863                         }
09864 
09865                         if(sData.size()%2)      // number of chars in data string has to be even
09866                         {
09867                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09868                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09869                         }
09870 
09871                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
09872                         {
09873                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09874                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09875                         }
09876 
09877                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09878                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)],
09879                                                                                                            (int)ucBlockSize ));
09880 
09881                         break;
09882 
09883                 case FEDM_ISC_DATA_RxDB:
09884                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09885                         
09886                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
09887                         {
09888                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09889                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09890                         }
09891 
09892                         if(sData.size()%2)      // number of chars in data string has to be even
09893                         {
09894                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09895                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09896                         }
09897 
09898                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
09899                         {
09900                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09901                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09902                         }
09903 
09904                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09905                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)],
09906                                                                                                            (int)ucBlockSize ));
09907 
09908                         break;
09909 
09910                 case FEDM_ISC_DATA_TxCB:
09911                         if(iBlockNr < 0 || iBlockNr >= 4)
09912                         {
09913                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09914                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09915                         }
09916 
09917                         if(sData.size()%2)      // number of chars in data string has to be even
09918                         {
09919                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09920                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09921                         }
09922 
09923                         if((sData.size()/2) != 4)
09924                         {
09925                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09926                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09927                         }
09928 
09929                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09930                                                                                                            &m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][0],
09931 
09932                                                                                                            4 ));
09933 
09934                         break;
09935                 
09936                 case FEDM_ISC_DATA_RxCB:
09937                         if(iBlockNr < 0 || iBlockNr >= 4)
09938                         {
09939                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09940                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09941                         }
09942 
09943                         if(sData.size()%2)      // number of chars in data string has to be even
09944                         {
09945                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09946                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09947                         }
09948 
09949                         if((sData.size()/2) != 4)
09950                         {
09951                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09952                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09953                         }
09954 
09955                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09956                                                                                                            &m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][0],
09957                                                                                                            4 ));
09958 
09959                         break;
09960 
09961                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
09962                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09963                         
09964                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
09965                         {
09966                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09967                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09968                         }
09969 
09970                         if(sData.size()%2)      // number of chars in data string has to be even
09971                         {
09972                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
09973                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
09974                         }
09975 
09976                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
09977                         {
09978                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
09979                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
09980                         }
09981 
09982                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
09983                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)],
09984                                                                                                            (int)ucBlockSize ));
09985 
09986                         break;
09987 
09988                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
09989                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
09990                         
09991                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
09992                         {
09993                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
09994                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
09995                         }
09996 
09997                         if(sData.size()%2)      // number of chars in data string has to be even
09998                         {
09999                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10000                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10001                         }
10002 
10003                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
10004                         {
10005                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10006                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10007                         }
10008 
10009                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10010                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)],
10011                                                                                                            (int)ucBlockSize ));
10012 
10013                         break;
10014 
10015                 case FEDM_ISC_DATA_RxDB_TID_BANK:
10016                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10017                         
10018                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
10019                         {
10020                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10021                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10022                         }
10023 
10024                         if(sData.size()%2)      // number of chars in data string has to be even
10025                         {
10026                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10027                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10028                         }
10029 
10030                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
10031                         {
10032                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10033                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10034                         }
10035 
10036                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10037                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)],
10038                                                                                                            (int)ucBlockSize ));
10039 
10040                         break;
10041 
10042                 case FEDM_ISC_DATA_TxDB_TID_BANK:
10043                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10044                         
10045                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
10046                         {
10047                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10048                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10049                         }
10050 
10051                         if(sData.size()%2)      // number of chars in data string has to be even
10052                         {
10053                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10054                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10055                         }
10056 
10057                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
10058                         {
10059                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10060                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10061                         }
10062 
10063                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10064                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)],
10065                                                                                                            (int)ucBlockSize ));
10066 
10067                         break;
10068 
10069                 case FEDM_ISC_DATA_RxDB_RES_BANK:
10070                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10071                         
10072                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
10073                         {
10074                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10075                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10076                         }
10077 
10078                         if(sData.size()%2)      // number of chars in data string has to be even
10079                         {
10080                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10081                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10082                         }
10083 
10084                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
10085                         {
10086                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10087                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10088                         }
10089 
10090                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10091                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)],
10092                                                                                                            (int)ucBlockSize ));
10093 
10094                         break;
10095 
10096                 case FEDM_ISC_DATA_TxDB_RES_BANK:
10097                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10098                         
10099                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
10100                         {
10101                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10102                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10103                         }
10104 
10105                         if(sData.size()%2)      // number of chars in data string has to be even
10106                         {
10107                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10108                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10109                         }
10110 
10111                         if((sData.size()/2) != (basic_string <char>::size_type)ucBlockSize)
10112                         {
10113                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10114                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10115                         }
10116 
10117                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10118                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)],
10119                                                                                                            (int)ucBlockSize ));
10120 
10121                         break;
10122 
10123                 case FEDM_ISC_DATA_ANT_NR:
10124                 case FEDM_ISC_DATA_ANT_STATUS:
10125                 case FEDM_ISC_DATA_ANT_RSSI:
10126                 case FEDM_ISC_DATA_ANT_COUNT:
10127                 case FEDM_ISC_DATA_SNR_LEN:
10128                 case FEDM_ISC_DATA_OPTINFO:
10129                 case FEDM_ISC_DATA_PROTOINFO:
10130                 case FEDM_ISC_DATA_TRINFO:
10131                 case FEDM_ISC_DATA_EPC:
10132                 case FEDM_ISC_DATA_EPC_TYPE:
10133                 case FEDM_ISC_DATA_EPC_HEADER:
10134                 case FEDM_ISC_DATA_EPC_DOMAIN:
10135                 case FEDM_ISC_DATA_EPC_OBJECT:
10136                 case FEDM_ISC_DATA_EPC_SNR:
10137                 case FEDM_ISC_DATA_SNR:
10138                 case FEDM_ISC_DATA_TRTYPE:
10139                 case FEDM_ISC_DATA_AFI:
10140                 case FEDM_ISC_DATA_DSFID:
10141                 case FEDM_ISC_DATA_CHIP_ID:
10142                 case FEDM_ISC_DATA_MEM_SIZE:
10143                 case FEDM_ISC_DATA_IC_REF:
10144                 case FEDM_ISC_DATA_IS_SELECTED:
10145                 case FEDM_ISC_DATA_IS_EPC:
10146                 case FEDM_ISC_DATA_BLOCK_SIZE:
10147                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
10148                 case FEDM_ISC_DATA_FSCI:
10149                 case FEDM_ISC_DATA_FWI:
10150                 case FEDM_ISC_DATA_DSI:
10151                 case FEDM_ISC_DATA_DRI:
10152                 case FEDM_ISC_DATA_NAD:
10153                 case FEDM_ISC_DATA_CID:
10154                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
10155                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10156                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10157 
10158                 default:
10159                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_PARAMETER));
10160                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
10161                 }
10162                 break;
10163                 
10164         default:
10165                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", string) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
10166                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
10167         }
10168 
10169         FEDM_RETURN(FEDM_OK);
10170 }
10171 
10172 
10173 /***************************************************************************
10174   Begin                 :       15.02.2001 / M. Hultsch
10175   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
10176 
10177   Function                      :       set data block in a table
10178 
10179   Parameters            :       int iIdx                -       index of table
10180                                                 unsigned int uiTableID  -       identifies the table
10181                                                 unsigned int uiDataID   -       identifies the table data
10182                                                 int iBlockNr    -       block number
10183                                                 CString sData   -       data
10184 
10185   Return value          :       0 or error code (<0)
10186 
10187 ***************************************************************************/
10188 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
10189 int FEDM_ISCReader::SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, int iBlockNr, CString sData)
10190 {
10191         unsigned char ucBlockSize = 0x04;
10192         int iErr;
10193 
10194         if(iIdx < 0)
10195         {
10196                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - Index < 0");
10197                 FEDM_RETURN(iIdx);
10198         }
10199 
10200         switch(uiTableID)
10201         {
10202         case FEDM_ISC_BRM_TABLE:
10203         case FEDM_ISC_CAD_TABLE:
10204                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10205                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10206         
10207         case FEDM_ISC_ISO_TABLE:
10208                 if(m_ISOTable.size() == 0)
10209                 {
10210                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
10211                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
10212                 }
10213 
10214                 if((unsigned int)iIdx > m_ISOTable.size())
10215                 {
10216                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - Index > size");
10217                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10218                 }
10219 
10220                 switch(uiDataID)
10221                 {
10222                 case FEDM_ISC_DATA_SEC_STATUS:
10223                         if(iBlockNr < 0 || (unsigned int)iBlockNr > m_ISOTable[iIdx]->m_ucSecStatus.size())
10224                         {
10225                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10226                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10227                         }
10228 
10229 
10230 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10231                         if(sData.GetLength()%2) // number of chars in data string has to be even
10232 #endif
10233 #ifdef __BORLANDC__     // Borland C++ Builder
10234                         if(sData.Length()%2)    // number of chars in data string has to be even
10235 #endif
10236                         {
10237                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10238                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10239                         }
10240 
10241 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10242                         if((sData.GetLength()/2) != (int)ucBlockSize)
10243 #endif
10244 #ifdef __BORLANDC__     // Borland C++ Builder
10245                         if((sData.Length()/2) != (int)ucBlockSize)
10246 #endif
10247                         {
10248                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10249                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10250                         }
10251 
10252                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10253                                                                                                            &m_ISOTable[iIdx]->m_ucSecStatus[iBlockNr],
10254                                                                                                            1 ));
10255                         break;
10256 
10257                 case FEDM_ISC_DATA_TxDB:
10258                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10259                         
10260                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB.size())
10261                         {
10262                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10263                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10264                         }
10265 
10266 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10267                         if(sData.GetLength()%2) // number of chars in data string has to be even
10268 #endif
10269 #ifdef __BORLANDC__     // Borland C++ Builder
10270                         if(sData.Length()%2)    // number of chars in data string has to be even
10271 #endif
10272                         {
10273                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10274                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10275                         }
10276 
10277 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10278                         if((sData.GetLength()/2) != (int)ucBlockSize)
10279 #endif
10280 #ifdef __BORLANDC__     // Borland C++ Builder
10281                         if((sData.Length()/2) != (int)ucBlockSize)
10282 #endif
10283                         {
10284                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10285                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10286                         }
10287 
10288                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10289                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB[(iBlockNr*ucBlockSize)],
10290                                                                                                            (int)ucBlockSize ));
10291 
10292                         break;
10293 
10294                 case FEDM_ISC_DATA_RxDB:
10295                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10296                         
10297                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
10298                         {
10299                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10300                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10301                         }
10302 
10303 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10304                         if(sData.GetLength()%2) // number of chars in data string has to be even
10305 #endif
10306 #ifdef __BORLANDC__     // Borland C++ Builder
10307                         if(sData.Length()%2)    // number of chars in data string has to be even
10308 #endif
10309                         {
10310                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10311                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10312                         }
10313 
10314 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10315                         if((sData.GetLength()/2) != (int)ucBlockSize)
10316 #endif
10317 #ifdef __BORLANDC__     // Borland C++ Builder
10318                         if((sData.Length()/2) != (int)ucBlockSize)
10319 #endif
10320                         {
10321                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10322                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10323                         }
10324 
10325                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10326                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB[(iBlockNr*ucBlockSize)],
10327                                                                                                            (int)ucBlockSize ));
10328 
10329                         break;
10330 
10331                 case FEDM_ISC_DATA_TxCB:
10332                         if(iBlockNr < 0 || iBlockNr >= 4)
10333                         {
10334                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10335                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10336                         }
10337 
10338 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10339                         if(sData.GetLength()%2) // number of chars in data string has to be even
10340 #endif
10341 #ifdef __BORLANDC__     // Borland C++ Builder
10342                         if(sData.Length()%2)    // number of chars in data string has to be even
10343 #endif
10344                         {
10345                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10346                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10347                         }
10348 
10349 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10350                         if((sData.GetLength()/2) != 4)
10351 #endif
10352 #ifdef __BORLANDC__     // Borland C++ Builder
10353                         if((sData.Length()/2) != 4)
10354 #endif
10355                         {
10356                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10357                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10358                         }
10359 
10360                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10361                                                                                                            &m_ISOTable[iIdx]->m_ucTxCB[iBlockNr][0],
10362 
10363                                                                                                            4 ));
10364 
10365                         break;
10366                 
10367                 case FEDM_ISC_DATA_RxCB:
10368                         if(iBlockNr < 0 || iBlockNr >= 4)
10369                         {
10370                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10371                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10372                         }
10373 
10374 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10375                         if(sData.GetLength()%2) // number of chars in data string has to be even
10376 #endif
10377 #ifdef __BORLANDC__     // Borland C++ Builder
10378                         if(sData.Length()%2)    // number of chars in data string has to be even
10379 #endif
10380                         {
10381                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10382                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10383                         }
10384 
10385 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10386                         if((sData.GetLength()/2) != 4)
10387 #endif
10388 #ifdef __BORLANDC__     // Borland C++ Builder
10389                         if((sData.Length()/2) != 4)
10390 #endif
10391                         {
10392                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10393                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10394                         }
10395 
10396                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10397                                                                                                            &m_ISOTable[iIdx]->m_ucRxCB[iBlockNr][0],
10398                                                                                                            4 ));
10399 
10400                         break;
10401 
10402                 case FEDM_ISC_DATA_RxDB_EPC_BANK:
10403                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10404                         
10405                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size())
10406                         {
10407                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10408                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10409                         }
10410 
10411 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10412                         if(sData.GetLength()%2) // number of chars in data string has to be even
10413 #endif
10414 #ifdef __BORLANDC__     // Borland C++ Builder
10415                         if(sData.Length()%2)    // number of chars in data string has to be even
10416 #endif
10417                         {
10418                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10419                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10420                         }
10421 
10422 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10423                         if((sData.GetLength()/2) != (int)ucBlockSize)
10424 #endif
10425 #ifdef __BORLANDC__     // Borland C++ Builder
10426                         if((sData.Length()/2) != (int)ucBlockSize)
10427 #endif
10428                         {
10429                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10430                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10431                         }
10432 
10433                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10434                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_EpcBank[(iBlockNr*ucBlockSize)],
10435                                                                                                            (int)ucBlockSize ));
10436 
10437                         break;
10438 
10439                 case FEDM_ISC_DATA_TxDB_EPC_BANK:
10440                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10441                         
10442                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_EpcBank.size())
10443                         {
10444                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10445                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10446                         }
10447 
10448 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10449                         if(sData.GetLength()%2) // number of chars in data string has to be even
10450 #endif
10451 #ifdef __BORLANDC__     // Borland C++ Builder
10452                         if(sData.Length()%2)    // number of chars in data string has to be even
10453 #endif
10454                         {
10455                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10456                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10457                         }
10458 
10459 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10460                         if((sData.GetLength()/2) != (int)ucBlockSize)
10461 #endif
10462 #ifdef __BORLANDC__     // Borland C++ Builder
10463                         if((sData.Length()/2) != (int)ucBlockSize)
10464 #endif
10465                         {
10466                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10467                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10468                         }
10469 
10470                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10471                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_EpcBank[(iBlockNr*ucBlockSize)],
10472                                                                                                            (int)ucBlockSize ));
10473 
10474                         break;
10475 
10476                 case FEDM_ISC_DATA_RxDB_TID_BANK:
10477                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10478                         
10479                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_TidBank.size())
10480                         {
10481                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10482                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10483                         }
10484 
10485 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10486                         if(sData.GetLength()%2) // number of chars in data string has to be even
10487 #endif
10488 #ifdef __BORLANDC__     // Borland C++ Builder
10489                         if(sData.Length()%2)    // number of chars in data string has to be even
10490 #endif
10491                         {
10492                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10493                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10494                         }
10495 
10496 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10497                         if((sData.GetLength()/2) != (int)ucBlockSize)
10498 #endif
10499 #ifdef __BORLANDC__     // Borland C++ Builder
10500                         if((sData.Length()/2) != (int)ucBlockSize)
10501 #endif
10502                         {
10503                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10504                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10505                         }
10506 
10507                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10508                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_TidBank[(iBlockNr*ucBlockSize)],
10509                                                                                                            (int)ucBlockSize ));
10510 
10511                         break;
10512 
10513                 case FEDM_ISC_DATA_TxDB_TID_BANK:
10514                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10515                         
10516                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_TidBank.size())
10517                         {
10518                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10519                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10520                         }
10521 
10522 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10523                         if(sData.GetLength()%2) // number of chars in data string has to be even
10524 #endif
10525 #ifdef __BORLANDC__     // Borland C++ Builder
10526                         if(sData.Length()%2)    // number of chars in data string has to be even
10527 #endif
10528                         {
10529                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10530                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10531                         }
10532 
10533 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10534                         if((sData.GetLength()/2) != (int)ucBlockSize)
10535 #endif
10536 #ifdef __BORLANDC__     // Borland C++ Builder
10537                         if((sData.Length()/2) != (int)ucBlockSize)
10538 #endif
10539                         {
10540                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10541                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10542                         }
10543 
10544                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10545                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_TidBank[(iBlockNr*ucBlockSize)],
10546                                                                                                            (int)ucBlockSize ));
10547 
10548                         break;
10549 
10550                 case FEDM_ISC_DATA_RxDB_RES_BANK:
10551                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10552                         
10553                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB_ResBank.size())
10554                         {
10555                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10556                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10557                         }
10558 
10559 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10560                         if(sData.GetLength()%2) // number of chars in data string has to be even
10561 #endif
10562 #ifdef __BORLANDC__     // Borland C++ Builder
10563                         if(sData.Length()%2)    // number of chars in data string has to be even
10564 #endif
10565                         {
10566                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10567                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10568                         }
10569 
10570 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10571                         if((sData.GetLength()/2) != (int)ucBlockSize)
10572 #endif
10573 #ifdef __BORLANDC__     // Borland C++ Builder
10574                         if((sData.Length()/2) != (int)ucBlockSize)
10575 #endif
10576                         {
10577                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10578                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10579                         }
10580 
10581                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10582                                                                                                            &m_ISOTable[iIdx]->m_ucRxDB_ResBank[(iBlockNr*ucBlockSize)],
10583                                                                                                            (int)ucBlockSize ));
10584 
10585                         break;
10586 
10587                 case FEDM_ISC_DATA_TxDB_RES_BANK:
10588                         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
10589                         
10590                         if(iBlockNr < 0 || (unsigned int)((iBlockNr+1)*ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucTxDB_ResBank.size())
10591                         {
10592                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10593                                 FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10594                         }
10595 
10596 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10597                         if(sData.GetLength()%2) // number of chars in data string has to be even
10598 #endif
10599 #ifdef __BORLANDC__     // Borland C++ Builder
10600                         if(sData.Length()%2)    // number of chars in data string has to be even
10601 #endif
10602                         {
10603                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_ODD_STRING_LENGTH));
10604                                 FEDM_RETURN(FEDM_ERROR_ODD_STRING_LENGTH);
10605                         }
10606 
10607 #ifdef _FEDM_MFC_SUPPORT                // Microsoft Compiler
10608                         if((sData.GetLength()/2) != (int)ucBlockSize)
10609 #endif
10610 #ifdef __BORLANDC__     // Borland C++ Builder
10611                         if((sData.Length()/2) != (int)ucBlockSize)
10612 #endif
10613                         {
10614                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_STRING_LENGTH));
10615                                 FEDM_RETURN(FEDM_ERROR_STRING_LENGTH);
10616                         }
10617 
10618                         FEDM_CHK2(iErr, FEDM_ConvHexStrToHexUChar( sData,
10619                                                                                                            &m_ISOTable[iIdx]->m_ucTxDB_ResBank[(iBlockNr*ucBlockSize)],
10620                                                                                                            (int)ucBlockSize ));
10621 
10622                         break;
10623 
10624                 case FEDM_ISC_DATA_ANT_NR:
10625                 case FEDM_ISC_DATA_ANT_STATUS:
10626                 case FEDM_ISC_DATA_ANT_RSSI:
10627                 case FEDM_ISC_DATA_ANT_COUNT:
10628                 case FEDM_ISC_DATA_SNR_LEN:
10629                 case FEDM_ISC_DATA_OPTINFO:
10630                 case FEDM_ISC_DATA_PROTOINFO:
10631                 case FEDM_ISC_DATA_TRINFO:
10632                 case FEDM_ISC_DATA_EPC:
10633                 case FEDM_ISC_DATA_EPC_TYPE:
10634                 case FEDM_ISC_DATA_EPC_HEADER:
10635                 case FEDM_ISC_DATA_EPC_DOMAIN:
10636                 case FEDM_ISC_DATA_EPC_OBJECT:
10637                 case FEDM_ISC_DATA_EPC_SNR:
10638                 case FEDM_ISC_DATA_SNR:
10639                 case FEDM_ISC_DATA_TRTYPE:
10640                 case FEDM_ISC_DATA_AFI:
10641                 case FEDM_ISC_DATA_DSFID:
10642                 case FEDM_ISC_DATA_CHIP_ID:
10643                 case FEDM_ISC_DATA_MEM_SIZE:
10644                 case FEDM_ISC_DATA_IC_REF:
10645                 case FEDM_ISC_DATA_IS_SELECTED:
10646                 case FEDM_ISC_DATA_IS_EPC:
10647                 case FEDM_ISC_DATA_BLOCK_SIZE:
10648                 case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
10649                 case FEDM_ISC_DATA_FSCI:
10650                 case FEDM_ISC_DATA_FWI:
10651                 case FEDM_ISC_DATA_DSI:
10652                 case FEDM_ISC_DATA_DRI:
10653                 case FEDM_ISC_DATA_NAD:
10654                 case FEDM_ISC_DATA_CID:
10655                 case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
10656                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10657                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10658 
10659                 default:
10660                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_PARAMETER));
10661                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
10662                 }
10663                 break;
10664                 
10665         default:
10666                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", " << iBlockNr << ", CString) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
10667                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
10668         }
10669 
10670         FEDM_RETURN(FEDM_OK);
10671 }
10672 #endif
10673 
10675 // functions for verify data blocks in a table
10677 
10678 /***************************************************************************
10679   Begin                 :       28.03.2002 / M. Hultsch
10680   Version               :       03.00.05 / 26.03.2009 / M. Hultsch
10681 
10682   Function                      :       verify read data block(s) with write data block(s) in a table
10683 
10684   Parameters            :       int iIdx                -       index of table
10685                                                 unsigned int uiTableID  -       identifies the table
10686                                                 int iBlockNr    -       first block number
10687                                                 int iBlockCnt   -       number of blocks to verify
10688 
10689   Return value          :       0 or error code (<0)
10690 
10691 ***************************************************************************/
10692 int FEDM_ISCReader::VerifyTableData(int iIdx, unsigned int uiTableID, int iBlockNr, int iBlockCnt)
10693 {
10694         int iCnt = 0;
10695 
10696         if(iIdx < 0)
10697         {
10698                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - Index < 0");
10699                 FEDM_RETURN(iIdx);
10700         }
10701 
10702         if(iBlockCnt<=0)
10703         {
10704                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
10705                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
10706         }
10707 
10708         switch(uiTableID)
10709         {
10710         case FEDM_ISC_BRM_TABLE:
10711         case FEDM_ISC_CAD_TABLE:
10712                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10713                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10714         
10715         case FEDM_ISC_ISO_TABLE:
10716                 if(m_ISOTable.size() == 0)
10717                 {
10718                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
10719                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
10720                 }
10721 
10722                 if(m_uiISOTableLength == 0)
10723                 {
10724                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
10725                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
10726                 }
10727 
10728                 if((unsigned int)iIdx > m_ISOTable.size())
10729                 {
10730                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10731                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10732                 }
10733 
10734                 if(iBlockNr < 0 || (unsigned int)((iBlockNr+iBlockCnt)*m_ISOTable[iIdx]->m_ucBlockSize - 1) >= m_ISOTable[iIdx]->m_ucRxDB.size())
10735                 {
10736                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10737                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10738                 }
10739 
10740                 for(iCnt=iBlockNr; iCnt<iBlockNr+iBlockCnt; ++iCnt)
10741                 {
10742                         if( memcmp( &m_ISOTable[iIdx]->m_ucRxDB[iCnt*m_ISOTable[iIdx]->m_ucBlockSize],
10743                                                 &m_ISOTable[iIdx]->m_ucTxDB[iCnt*m_ISOTable[iIdx]->m_ucBlockSize],
10744                                                 m_ISOTable[iIdx]->m_ucBlockSize ) )
10745                         {
10746                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_VERIFY));
10747                                 FEDM_RETURN(FEDM_ERROR_VERIFY);
10748                         }
10749                 }
10750 
10751                 break;
10752 
10753         default:
10754                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iBlockNr << ", " << iBlockCnt << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
10755                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
10756         }
10757 
10758         FEDM_RETURN(FEDM_OK);
10759 }
10760 
10761 
10763 // functions for copy data array inside a table
10765 
10766 /***************************************************************************
10767   Begin                 :       12.02.2004 / M. Hultsch
10768   Version               :       03.00.05 / 26.03.2009 / M. Hultsch
10769 
10770   Function                      :       copy data array inside a table
10771 
10772   Parameters            :       int iIdx                -       index of table
10773                                                 unsigned int uiTableID  -       identifies the table
10774                                                 int iSrcDataID  -       identifier of source
10775                                                 int iDstDataID  -       identifier of destination
10776 
10777   Return value          :       0 or error code (<0)
10778 
10779 ***************************************************************************/
10780 int FEDM_ISCReader::CopyTableData(int iIdx, unsigned int uiTableID, int iSrcDataID, int iDstDataID)
10781 {
10782         if(iIdx < 0)
10783         {
10784                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - Index < 0");
10785                 FEDM_RETURN(iIdx);
10786         }
10787 
10788         switch(uiTableID)
10789         {
10790         case FEDM_ISC_BRM_TABLE:
10791         case FEDM_ISC_CAD_TABLE:
10792                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10793                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10794         
10795         case FEDM_ISC_ISO_TABLE:
10796                 if(m_ISOTable.size() == 0)
10797                 {
10798                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
10799                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
10800                 }
10801 
10802                 if(m_uiISOTableLength == 0)
10803                 {
10804                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
10805                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
10806                 }
10807 
10808                 if((unsigned int)iIdx > m_ISOTable.size())
10809                 {
10810                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
10811                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10812                 }
10813 
10814                 if(iSrcDataID == iDstDataID)
10815                 {
10816                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
10817                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
10818                 }
10819 
10820                 switch(iSrcDataID)
10821                 {
10822                 case FEDM_ISC_DATA_RxDB:
10823                         switch(iDstDataID)
10824                         {
10825                         case FEDM_ISC_DATA_TxDB:
10826                                 memcpy( &m_ISOTable[iIdx]->m_ucTxDB[0], &m_ISOTable[iIdx]->m_ucRxDB[0], m_ISOTable[iIdx]->m_ucRxDB.size());
10827                                 break;
10828                         default:
10829                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
10830                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
10831                         }
10832                         break;
10833                 
10834                 case FEDM_ISC_DATA_TxDB:
10835                         switch(iDstDataID)
10836                         {
10837                         case FEDM_ISC_DATA_RxDB:
10838                                 memcpy( &m_ISOTable[iIdx]->m_ucRxDB[0], &m_ISOTable[iIdx]->m_ucTxDB[0], m_ISOTable[iIdx]->m_ucTxDB.size());
10839                                 break;
10840                         default:
10841                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
10842                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
10843                         }
10844                 
10845                 default:
10846                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_PARAMETER));
10847                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
10848                 }
10849 
10850                 break;
10851 
10852         default:
10853                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iIdx << ", " << uiTableID << ", " << iSrcDataID << ", " << iDstDataID << ") - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
10854                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
10855         }
10856 
10857         FEDM_RETURN(FEDM_OK);
10858 }
10859 
10861 // functions to find index of specific table data
10863 
10864 /***************************************************************************
10865   Begin                 :       24.08.2000 / M. Hultsch
10866   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
10867 
10868   Function                      :       search the table index of bData member inside a table
10869 
10870   Parameters            :       int iStartIdx   -       start index of table (>=0)
10871                                                 unsigned int uiTableID  -       identifies the table
10872                                                 unsigned int uiDataID   -       identifies the table data
10873                                                 bool bData              -       compare data
10874 
10875   Return value          :       0..<table size  : index
10876                                                 < -1                    : error code
10877 
10878 ***************************************************************************/
10879 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, bool bData)
10880 {
10881         int iIdx = 0;
10882 
10883         switch(uiTableID)
10884         {
10885         case FEDM_ISC_BRM_TABLE:
10886                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10887                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10888         
10889         case FEDM_ISC_ISO_TABLE:
10890                 if(m_ISOTable.size() == 0)
10891                 {
10892                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
10893                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
10894                 }
10895 
10896                 if(m_uiISOTableLength == 0)
10897                 {
10898                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
10899                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
10900                 }
10901 
10902                 if(iStartIdx < 0)
10903                 {
10904                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_PARAMETER));
10905                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
10906                 }
10907                 
10908                 if((unsigned int)iStartIdx > m_ISOTable.size())
10909                 {
10910                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - Index > size");
10911                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
10912                 }
10913 
10914                 for(iIdx=iStartIdx; (unsigned int)iIdx<m_uiISOTableLength; iIdx++)
10915                 {
10916                         switch(uiDataID)
10917                         {
10918                         case FEDM_ISC_DATA_IS_SELECTED:
10919                                 if( m_ISOTable[iIdx]->m_bIsSelected == bData )
10920                                         return iIdx;
10921                                 break;
10922 
10923                         case FEDM_ISC_DATA_IS_EPC:
10924                                 if( m_ISOTable[iIdx]->m_bIsEpc == bData )
10925                                         return iIdx;
10926                                 break;
10927 
10928                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
10929                                 if( m_ISOTable[iIdx]->m_bIsBlockSizeSet == bData )
10930                                         return iIdx;
10931                                 break;
10932 
10933                         case FEDM_ISC_DATA_ANT_NR:
10934                         case FEDM_ISC_DATA_ANT_STATUS:
10935                         case FEDM_ISC_DATA_ANT_RSSI:
10936                         case FEDM_ISC_DATA_ANT_COUNT:
10937                         case FEDM_ISC_DATA_SNR_LEN:
10938                         case FEDM_ISC_DATA_OPTINFO:
10939                         case FEDM_ISC_DATA_PROTOINFO:
10940                         case FEDM_ISC_DATA_TRINFO:
10941                         case FEDM_ISC_DATA_EPC:
10942                         case FEDM_ISC_DATA_EPC_TYPE:
10943                         case FEDM_ISC_DATA_EPC_HEADER:
10944                         case FEDM_ISC_DATA_EPC_DOMAIN:
10945                         case FEDM_ISC_DATA_EPC_OBJECT:
10946                         case FEDM_ISC_DATA_EPC_SNR:
10947                         case FEDM_ISC_DATA_TRTYPE:
10948                         case FEDM_ISC_DATA_SNR:
10949                         case FEDM_ISC_DATA_AFI:
10950                         case FEDM_ISC_DATA_DSFID:
10951                         case FEDM_ISC_DATA_CHIP_ID:
10952                         case FEDM_ISC_DATA_MEM_SIZE:
10953                         case FEDM_ISC_DATA_IC_REF:
10954                         case FEDM_ISC_DATA_SEC_STATUS:
10955                         case FEDM_ISC_DATA_TxDB:
10956                         case FEDM_ISC_DATA_RxDB:
10957                         case FEDM_ISC_DATA_TxCB:
10958                         case FEDM_ISC_DATA_RxCB:
10959                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
10960                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
10961                         case FEDM_ISC_DATA_RxDB_TID_BANK:
10962                         case FEDM_ISC_DATA_TxDB_TID_BANK:
10963                         case FEDM_ISC_DATA_RxDB_RES_BANK:
10964                         case FEDM_ISC_DATA_TxDB_RES_BANK:
10965                         case FEDM_ISC_DATA_BLOCK_SIZE:
10966                         case FEDM_ISC_DATA_FSCI:
10967                         case FEDM_ISC_DATA_FWI:
10968                         case FEDM_ISC_DATA_DSI:
10969                         case FEDM_ISC_DATA_DRI:
10970                         case FEDM_ISC_DATA_NAD:
10971                         case FEDM_ISC_DATA_CID:
10972                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
10973                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10974                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10975 
10976                         default:
10977                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_PARAMETER));
10978                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
10979                         }
10980                 }
10981                 break;
10982         
10983         case FEDM_ISC_CAD_TABLE:
10984                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
10985                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
10986                 
10987         default:
10988                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
10989                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
10990         }
10991 
10992         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", bool) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
10993         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
10994 }
10995 
10996 /***************************************************************************
10997   Begin                 :       24.08.2000 / M. Hultsch
10998   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
10999 
11000   Function                      :       search the table index of ucData member inside a table
11001 
11002   Parameters            :       int iStartIdx   -       start index of table (>=0)
11003                                                 unsigned int uiTableID  -       identifies the table
11004                                                 unsigned int uiDataID   -       identifies the table data
11005                                                 unsigned char ucData    -       compare data
11006 
11007   Return value          :       0..<table size  : index
11008                                                 < -1                    : error code
11009 
11010 ***************************************************************************/
11011 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char ucData)
11012 {
11013         int iIdx = 0;
11014 
11015         switch(uiTableID)
11016         {
11017         case FEDM_ISC_BRM_TABLE:
11018                 if(m_BRMTable.size() == 0)
11019                 {
11020                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11021                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11022                 }
11023 
11024                 if(m_uiBRMTableLength == 0)
11025                 {
11026                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11027                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11028                 }
11029 
11030                 if(iStartIdx < 0)
11031                 {
11032                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11033                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11034                 }
11035 
11036                 if((unsigned int)iStartIdx > m_BRMTable.size())
11037                 {
11038                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11039                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11040                 }
11041 
11042                 for(iIdx=iStartIdx; (unsigned int)iIdx<m_uiBRMTableLength; iIdx++)
11043                 {
11044                         switch(uiDataID)
11045                         {
11046                         case FEDM_ISC_DATA_TRTYPE:
11047                                 if( m_BRMTable[iIdx]->m_ucTrType == ucData )
11048                                         return iIdx;
11049                                 break;
11050 
11051                         case FEDM_ISC_DATA_ANT_NR:
11052                                 if( m_BRMTable[iIdx]->m_ucAntNr == ucData )
11053                                         return iIdx;
11054                                 break;
11055 
11056                         case FEDM_ISC_DATA_ANT_STATUS:
11057                         case FEDM_ISC_DATA_ANT_RSSI:
11058                         case FEDM_ISC_DATA_ANT_COUNT:
11059                         case FEDM_ISC_DATA_SNR_LEN:
11060                         case FEDM_ISC_DATA_SNR:
11061                         case FEDM_ISC_DATA_EPC:
11062                         case FEDM_ISC_DATA_TIMER:
11063                         case FEDM_ISC_DATA_DATE:
11064                         case FEDM_ISC_DATA_DB_ADR:
11065                         case FEDM_ISC_DATA_DBN:
11066                         case FEDM_ISC_DATA_INPUT:
11067                         case FEDM_ISC_DATA_STATE:
11068                         case FEDM_ISC_DATA_BLOCK_SIZE:
11069                         case FEDM_ISC_DATA_RxDB:
11070                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11071                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11072                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11073 
11074                         default:
11075                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11076                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11077                         }
11078                 }
11079                 break;
11080         
11081         case FEDM_ISC_ISO_TABLE:
11082                 if(m_ISOTable.size() == 0)
11083                 {
11084                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11085                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11086                 }
11087 
11088                 if(m_uiISOTableLength == 0)
11089                 {
11090                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11091                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11092                 }
11093 
11094                 if(iStartIdx < 0)
11095                 {
11096                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11097                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11098                 }
11099 
11100                 if((unsigned int)iStartIdx > m_ISOTable.size())
11101                 {
11102                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11103                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11104                 }
11105 
11106                 for(iIdx=iStartIdx; (unsigned int)iIdx<m_uiISOTableLength; iIdx++)
11107                 {
11108                         switch(uiDataID)
11109                         {
11110                         case FEDM_ISC_DATA_TRTYPE:
11111                                 if( m_ISOTable[iIdx]->m_ucTrType == ucData )
11112                                         return iIdx;
11113                                 break;
11114 
11115                         case FEDM_ISC_DATA_AFI:
11116                                 if( m_ISOTable[iIdx]->m_ucAFI == ucData )
11117                                         return iIdx;
11118                                 break;
11119 
11120                         case FEDM_ISC_DATA_DSFID:
11121                                 if( m_ISOTable[iIdx]->m_ucDsfID == ucData )
11122                                         return iIdx;
11123                                 break;
11124 
11125                         case FEDM_ISC_DATA_CHIP_ID:
11126                                 if( m_ISOTable[iIdx]->m_ucChipID == ucData )
11127                                         return iIdx;
11128                                 break;
11129 
11130                         case FEDM_ISC_DATA_MEM_SIZE:
11131                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11132 
11133                         case FEDM_ISC_DATA_IC_REF:
11134                                 if( m_ISOTable[iIdx]->m_ucICRef == ucData )
11135                                         return iIdx;
11136                                 break;
11137 
11138                         case FEDM_ISC_DATA_TRINFO:
11139                                 if( m_ISOTable[iIdx]->m_ucTrInfo == ucData )
11140                                         return iIdx;
11141                                 break;
11142 
11143                         case FEDM_ISC_DATA_EPC_TYPE:
11144                                 if( m_ISOTable[iIdx]->m_ucEpcType == ucData )
11145                                         return iIdx;
11146                                 break;
11147 
11148                         case FEDM_ISC_DATA_ANT_NR:
11149                         case FEDM_ISC_DATA_ANT_STATUS:
11150                         case FEDM_ISC_DATA_ANT_RSSI:
11151                         case FEDM_ISC_DATA_ANT_COUNT:
11152                         case FEDM_ISC_DATA_SNR_LEN:
11153                         case FEDM_ISC_DATA_OPTINFO:
11154                         case FEDM_ISC_DATA_PROTOINFO:
11155                         case FEDM_ISC_DATA_EPC:
11156                         case FEDM_ISC_DATA_EPC_HEADER:
11157                         case FEDM_ISC_DATA_EPC_DOMAIN:
11158                         case FEDM_ISC_DATA_EPC_OBJECT:
11159                         case FEDM_ISC_DATA_EPC_SNR:
11160                         case FEDM_ISC_DATA_SNR:
11161                         case FEDM_ISC_DATA_IS_SELECTED:
11162                         case FEDM_ISC_DATA_IS_EPC:
11163                         case FEDM_ISC_DATA_SEC_STATUS:
11164                         case FEDM_ISC_DATA_TxDB:
11165                         case FEDM_ISC_DATA_RxDB:
11166                         case FEDM_ISC_DATA_TxCB:
11167                         case FEDM_ISC_DATA_RxCB:
11168                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
11169                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
11170                         case FEDM_ISC_DATA_RxDB_TID_BANK:
11171                         case FEDM_ISC_DATA_TxDB_TID_BANK:
11172                         case FEDM_ISC_DATA_RxDB_RES_BANK:
11173                         case FEDM_ISC_DATA_TxDB_RES_BANK:
11174                         case FEDM_ISC_DATA_BLOCK_SIZE:
11175                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
11176                         case FEDM_ISC_DATA_FSCI:
11177                         case FEDM_ISC_DATA_FWI:
11178                         case FEDM_ISC_DATA_DSI:
11179                         case FEDM_ISC_DATA_DRI:
11180                         case FEDM_ISC_DATA_NAD:
11181                         case FEDM_ISC_DATA_CID:
11182                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11183                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11184                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11185 
11186                         default:
11187                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11188                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11189                         }
11190                 }
11191                 break;
11192         
11193         case FEDM_ISC_CAD_TABLE:
11194                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11195                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11196                 
11197         default:
11198                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
11199                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
11200         }
11201 
11202         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uchar) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11203         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
11204 }
11205 
11206 
11207 /***************************************************************************
11208   Begin                 :       19.11.2000 / M. Hultsch
11209   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
11210 
11211   Function                      :       search the table index of uiData member inside a table
11212 
11213   Parameters            :       int iStartIdx   -       start index of table (>=0)
11214                                                 unsigned int uiTableID  -       identifies the table
11215                                                 unsigned int uiDataID   -       identifies the table data
11216                                                 unsigned int uiData             -       compare data
11217 
11218   Return value          :       0..<table size  : index
11219                                                 < -1                    : error code
11220 
11221 ***************************************************************************/
11222 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int uiData)
11223 {
11224         int iIdx = 0;
11225 
11226         switch(uiTableID)
11227         {
11228         case FEDM_ISC_BRM_TABLE:
11229                 if(m_BRMTable.size() == 0)
11230                 {
11231                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11232                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11233                 }
11234 
11235                 if(m_uiBRMTableLength == 0)
11236                 {
11237                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11238                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11239                 }
11240 
11241                 if(iStartIdx < 0)
11242                 {
11243                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11244                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11245                 }
11246 
11247                 if((unsigned int)iStartIdx > m_BRMTable.size())
11248                 {
11249                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11250                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11251                 }
11252 
11253                 for(iIdx=iStartIdx; (unsigned int)iIdx<m_uiBRMTableLength; iIdx++)
11254                 {
11255                         switch(uiDataID)
11256                         {
11257                         case FEDM_ISC_DATA_TRTYPE:
11258                                 if( (unsigned int)m_BRMTable[iIdx]->m_ucTrType == uiData )
11259                                         return iIdx;
11260                                 break;
11261 
11262                         case FEDM_ISC_DATA_ANT_NR:
11263                                 if( (unsigned int)m_BRMTable[iIdx]->m_ucAntNr == uiData )
11264                                         return iIdx;
11265                                 break;
11266 
11267                         case FEDM_ISC_DATA_ANT_STATUS:
11268                         case FEDM_ISC_DATA_ANT_RSSI:
11269                         case FEDM_ISC_DATA_ANT_COUNT:
11270                         case FEDM_ISC_DATA_SNR_LEN:
11271                         case FEDM_ISC_DATA_SNR:
11272                         case FEDM_ISC_DATA_EPC:
11273                         case FEDM_ISC_DATA_TIMER:
11274                         case FEDM_ISC_DATA_DATE:
11275                         case FEDM_ISC_DATA_DB_ADR:
11276                         case FEDM_ISC_DATA_INPUT:
11277                         case FEDM_ISC_DATA_STATE:
11278                         case FEDM_ISC_DATA_DBN:
11279                         case FEDM_ISC_DATA_BLOCK_SIZE:
11280                         case FEDM_ISC_DATA_RxDB:
11281                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11282                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11283                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11284 
11285                         default:
11286                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11287                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11288                         }
11289                 }
11290                 break;
11291         
11292         case FEDM_ISC_ISO_TABLE:
11293                 if(m_ISOTable.size() == 0)
11294                 {
11295                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11296                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11297                 }
11298 
11299                 if(m_uiISOTableLength == 0)
11300                 {
11301                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11302                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11303                 }
11304 
11305                 if(iStartIdx < 0)
11306                 {
11307                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11308                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11309                 }
11310 
11311                 if((unsigned int)iStartIdx > m_ISOTable.size())
11312                 {
11313                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11314                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11315                 }
11316 
11317                 for(iIdx=iStartIdx; (unsigned int)iIdx<m_uiISOTableLength; iIdx++)
11318                 {
11319                         switch(uiDataID)
11320                         {
11321                         case FEDM_ISC_DATA_TRTYPE:
11322                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucTrType == uiData )
11323                                         return iIdx;
11324                                 break;
11325 
11326                         case FEDM_ISC_DATA_AFI:
11327                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucAFI == uiData )
11328                                         return iIdx;
11329                                 break;
11330                         
11331                         case FEDM_ISC_DATA_DSFID:
11332                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucDsfID == uiData )
11333                                         return iIdx;
11334                                 break;
11335                         
11336                         case FEDM_ISC_DATA_CHIP_ID:
11337                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucChipID == uiData )
11338                                         return iIdx;
11339                                 break;
11340 
11341                         case FEDM_ISC_DATA_IC_REF:
11342                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucICRef == uiData )
11343                                         return iIdx;
11344                                 break;
11345 
11346                         case FEDM_ISC_DATA_TRINFO:
11347                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucTrInfo == uiData )
11348                                         return iIdx;
11349                                 break;
11350 
11351                         case FEDM_ISC_DATA_EPC_TYPE:
11352                                 if( (unsigned int)m_ISOTable[iIdx]->m_ucEpcType == uiData )
11353                                         return iIdx;
11354                                 break;
11355 
11356                         case FEDM_ISC_DATA_EPC_HEADER:
11357                                 if( (unsigned int)m_ISOTable[iIdx]->GetEpcHeader() == uiData )
11358                                         return iIdx;
11359                                 break;
11360 
11361                         case FEDM_ISC_DATA_ANT_NR:
11362                         case FEDM_ISC_DATA_ANT_STATUS:
11363                         case FEDM_ISC_DATA_ANT_RSSI:
11364                         case FEDM_ISC_DATA_ANT_COUNT:
11365                         case FEDM_ISC_DATA_SNR_LEN:
11366                         case FEDM_ISC_DATA_OPTINFO:
11367                         case FEDM_ISC_DATA_PROTOINFO:
11368                         case FEDM_ISC_DATA_EPC:
11369                         case FEDM_ISC_DATA_EPC_DOMAIN:
11370                         case FEDM_ISC_DATA_EPC_OBJECT:
11371                         case FEDM_ISC_DATA_EPC_SNR:
11372                         case FEDM_ISC_DATA_MEM_SIZE:
11373                         case FEDM_ISC_DATA_SNR:
11374                         case FEDM_ISC_DATA_IS_SELECTED:
11375                         case FEDM_ISC_DATA_IS_EPC:
11376                         case FEDM_ISC_DATA_SEC_STATUS:
11377                         case FEDM_ISC_DATA_TxDB:
11378                         case FEDM_ISC_DATA_RxDB:
11379                         case FEDM_ISC_DATA_TxCB:
11380                         case FEDM_ISC_DATA_RxCB:
11381                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
11382                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
11383                         case FEDM_ISC_DATA_RxDB_TID_BANK:
11384                         case FEDM_ISC_DATA_TxDB_TID_BANK:
11385                         case FEDM_ISC_DATA_RxDB_RES_BANK:
11386                         case FEDM_ISC_DATA_TxDB_RES_BANK:
11387                         case FEDM_ISC_DATA_BLOCK_SIZE:
11388                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
11389                         case FEDM_ISC_DATA_FSCI:
11390                         case FEDM_ISC_DATA_FWI:
11391                         case FEDM_ISC_DATA_DSI:
11392                         case FEDM_ISC_DATA_DRI:
11393                         case FEDM_ISC_DATA_NAD:
11394                         case FEDM_ISC_DATA_CID:
11395                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11396                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11397                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11398 
11399                         default:
11400                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11401                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11402                         }
11403                 }
11404                 break;
11405         
11406         case FEDM_ISC_CAD_TABLE:
11407                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11408                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11409                 
11410         default:
11411                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
11412                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
11413         }
11414 
11415         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", uint) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11416         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
11417 }
11418 
11419 
11420 /***************************************************************************
11421   Begin                 :       24.08.2000 / M. Hultsch
11422   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
11423 
11424   Function                      :       search the table index of i64Data member inside a table
11425 
11426   Parameters            :       int iStartIdx   -       start index of table (>=0)
11427                                                 unsigned int uiTableID  -       identifies the table
11428                                                 unsigned int uiDataID   -       identifies the table data
11429                                                 __int64 i64Data -       data
11430 
11431   Return value          :       0..<table size  : index
11432                                                 < -1                    : error code
11433 
11434 ***************************************************************************/
11435 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, __int64 i64Data)
11436 {
11437         int iIdx;
11438         __int64 i64Tmp = 0;
11439 
11440         switch(uiTableID)
11441         {
11442         case FEDM_ISC_BRM_TABLE:
11443                 if(m_BRMTable.size() == 0)
11444                 {
11445                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11446                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11447                 }
11448 
11449                 if(m_uiBRMTableLength == 0)
11450                 {
11451                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11452                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11453                 }
11454 
11455                 if(iStartIdx < 0)
11456                 {
11457                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11458                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11459                 }
11460 
11461                 if((unsigned int)iStartIdx > m_BRMTable.size())
11462                 {
11463                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11464                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11465                 }
11466 
11467                 for(iIdx=0; (unsigned int)iIdx<m_uiBRMTableLength; iIdx++)
11468                 {
11469                         switch(uiDataID)
11470                         {
11471                         case FEDM_ISC_DATA_SNR:
11472                                 if( i64Data == m_BRMTable[iIdx]->GetSnr() )
11473                                         return iIdx;
11474                                 break;          
11475 
11476                         case FEDM_ISC_DATA_ANT_NR:
11477                         case FEDM_ISC_DATA_ANT_STATUS:
11478                         case FEDM_ISC_DATA_ANT_RSSI:
11479                         case FEDM_ISC_DATA_ANT_COUNT:
11480                         case FEDM_ISC_DATA_SNR_LEN:
11481                         case FEDM_ISC_DATA_TRTYPE:
11482                         case FEDM_ISC_DATA_TIMER:
11483                         case FEDM_ISC_DATA_DATE:
11484                         case FEDM_ISC_DATA_DB_ADR:
11485                         case FEDM_ISC_DATA_DBN:
11486                         case FEDM_ISC_DATA_INPUT:
11487                         case FEDM_ISC_DATA_STATE:
11488                         case FEDM_ISC_DATA_BLOCK_SIZE:
11489                         case FEDM_ISC_DATA_RxDB:
11490                         case FEDM_ISC_DATA_EPC:
11491                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11492                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11493                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11494 
11495                         default:
11496                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11497                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11498                         }
11499                 }
11500                 break;
11501         
11502         case FEDM_ISC_ISO_TABLE:
11503                 if(m_ISOTable.size() == 0)
11504                 {
11505                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11506                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11507                 }
11508 
11509                 if(m_uiISOTableLength == 0)
11510                 {
11511                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11512                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11513                 }
11514 
11515                 if(iStartIdx < 0)
11516                 {
11517                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11518                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11519                 }
11520 
11521                 if((unsigned int)iStartIdx > m_ISOTable.size())
11522                 {
11523                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11524                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11525                 }
11526 
11527                 for(iIdx=0; (unsigned int)iIdx<m_uiISOTableLength; iIdx++)
11528                 {
11529                         switch(uiDataID)
11530                         {
11531                         case FEDM_ISC_DATA_SNR:
11532                                 if( i64Data == m_ISOTable[iIdx]->GetSnr() )
11533                                         return iIdx;
11534                                 break;          
11535 
11536                         case FEDM_ISC_DATA_OPTINFO:
11537                         case FEDM_ISC_DATA_PROTOINFO:
11538                         case FEDM_ISC_DATA_TRINFO:
11539                         case FEDM_ISC_DATA_EPC_TYPE:
11540                         case FEDM_ISC_DATA_EPC_HEADER:
11541                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11542                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11543 
11544                         case FEDM_ISC_DATA_EPC_DOMAIN:
11545                                 i64Tmp = m_ISOTable[iIdx]->GetEpcDomainManager();
11546                                 if(i64Tmp < 0)
11547                                         break;
11548 
11549                                 if(i64Tmp == i64Data)
11550                                         return iIdx;
11551                                 break;          
11552 
11553                         case FEDM_ISC_DATA_EPC_SNR:
11554                                 i64Tmp = m_ISOTable[iIdx]->GetEpcSnr();
11555                                 if(i64Tmp < 0)
11556                                         break;
11557 
11558                                 if(i64Tmp == i64Data)
11559                                         return iIdx;
11560                                 break;          
11561 
11562                         case FEDM_ISC_DATA_EPC_OBJECT:
11563                                 i64Tmp = m_ISOTable[iIdx]->GetEpcObjectClass();
11564                                 if(i64Tmp < 0)
11565                                         break;
11566 
11567                                 if(i64Tmp == i64Data)
11568                                         return iIdx;
11569                                 break;          
11570 
11571                         case FEDM_ISC_DATA_ANT_NR:
11572                         case FEDM_ISC_DATA_ANT_STATUS:
11573                         case FEDM_ISC_DATA_ANT_RSSI:
11574                         case FEDM_ISC_DATA_ANT_COUNT:
11575                         case FEDM_ISC_DATA_SNR_LEN:
11576                         case FEDM_ISC_DATA_EPC:
11577                         case FEDM_ISC_DATA_TRTYPE:
11578                         case FEDM_ISC_DATA_AFI:
11579                         case FEDM_ISC_DATA_DSFID:
11580                         case FEDM_ISC_DATA_CHIP_ID:
11581                         case FEDM_ISC_DATA_MEM_SIZE:
11582                         case FEDM_ISC_DATA_IC_REF:
11583                         case FEDM_ISC_DATA_IS_SELECTED:
11584                         case FEDM_ISC_DATA_IS_EPC:
11585                         case FEDM_ISC_DATA_SEC_STATUS:
11586                         case FEDM_ISC_DATA_TxDB:
11587                         case FEDM_ISC_DATA_RxDB:
11588                         case FEDM_ISC_DATA_TxCB:
11589                         case FEDM_ISC_DATA_RxCB:
11590                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
11591                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
11592                         case FEDM_ISC_DATA_RxDB_TID_BANK:
11593                         case FEDM_ISC_DATA_TxDB_TID_BANK:
11594                         case FEDM_ISC_DATA_RxDB_RES_BANK:
11595                         case FEDM_ISC_DATA_TxDB_RES_BANK:
11596                         case FEDM_ISC_DATA_BLOCK_SIZE:
11597                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
11598                         case FEDM_ISC_DATA_FSCI:
11599                         case FEDM_ISC_DATA_FWI:
11600                         case FEDM_ISC_DATA_DSI:
11601                         case FEDM_ISC_DATA_DRI:
11602                         case FEDM_ISC_DATA_NAD:
11603                         case FEDM_ISC_DATA_CID:
11604                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11605                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11606                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11607 
11608                         default:
11609                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11610                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11611                         }
11612                 }
11613                 break;
11614         
11615         case FEDM_ISC_CAD_TABLE:
11616                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11617                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11618                 
11619         default:
11620                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
11621                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
11622         }
11623 
11624         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", __int64) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11625         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
11626 }
11627 
11628 
11629 /***************************************************************************
11630   Begin                 :       19.08.2003 / M. Hultsch
11631   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
11632 
11633   Function                      :       search the table index of sData member inside a table
11634 
11635   Parameters            :       int iStartIdx   -       start index of table (>=0)
11636                                                 unsigned int uiTableID  -       identifies the table
11637                                                 unsigned int uiDataID   -       identifies the table data
11638                                                 string sData    -       data
11639 
11640   Return value          :       0..<table size  : index
11641                                                 <0                              : error code
11642 
11643 ***************************************************************************/
11644 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, string sData)
11645 {
11646         char cEpc[FEDM_ISC_MAX_UID_LENGTH];
11647         int iIdx, iErr;
11648         __int64 i64Tmp = 0;
11649         string sStr;
11650 
11651         switch(uiTableID)
11652         {
11653         case FEDM_ISC_BRM_TABLE:
11654                 if(m_BRMTable.size() == 0)
11655                 {
11656                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11657                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11658                 }
11659 
11660                 if(m_uiBRMTableLength == 0)
11661                 {
11662                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11663                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11664                 }
11665 
11666                 if(iStartIdx < 0)
11667                 {
11668                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11669                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11670                 }
11671 
11672                 if((unsigned int)iStartIdx > m_BRMTable.size())
11673                 {
11674                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11675                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11676                 }
11677 
11678                 for(iIdx=0; iIdx<(int)m_uiBRMTableLength; iIdx++)
11679                 {
11680                         switch(uiDataID)
11681                         {
11682                         case FEDM_ISC_DATA_SNR:
11683                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnr[0], (int)m_BRMTable[iIdx]->m_ucSnrLen, sStr));
11684                                 if(sStr == sData)
11685                                         return iIdx;
11686                                 break;          
11687                         
11688                         case FEDM_ISC_DATA_EPC:
11689                                 if(m_BRMTable[iIdx]->m_ucIDDT == 0x01)
11690                                 {
11691                                         FEDM_CHK2(iErr, m_BRMTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
11692                                         if(strcmp(sData.c_str(), cEpc)==0)
11693                                                 return iIdx;
11694                                 }
11695                                 break;
11696 
11697                         case FEDM_ISC_DATA_ANT_NR:
11698                         case FEDM_ISC_DATA_ANT_STATUS:
11699                         case FEDM_ISC_DATA_ANT_RSSI:
11700                         case FEDM_ISC_DATA_ANT_COUNT:
11701                         case FEDM_ISC_DATA_SNR_LEN:
11702                         case FEDM_ISC_DATA_TRTYPE:
11703                         case FEDM_ISC_DATA_TIMER:
11704                         case FEDM_ISC_DATA_DATE:
11705                         case FEDM_ISC_DATA_DB_ADR:
11706                         case FEDM_ISC_DATA_DBN:
11707                         case FEDM_ISC_DATA_INPUT:
11708                         case FEDM_ISC_DATA_STATE:
11709                         case FEDM_ISC_DATA_BLOCK_SIZE:
11710                         case FEDM_ISC_DATA_RxDB:
11711                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11712                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11713                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11714 
11715                         default:
11716                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11717                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11718                         }
11719                 }
11720                 break;
11721         
11722         case FEDM_ISC_ISO_TABLE:
11723                 if(m_ISOTable.size() == 0)
11724                 {
11725                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11726                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11727                 }
11728 
11729                 if(m_uiISOTableLength == 0)
11730                 {
11731                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11732                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11733                 }
11734 
11735                 if(iStartIdx < 0)
11736                 {
11737                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11738                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11739                 }
11740 
11741                 if((unsigned int)iStartIdx > m_ISOTable.size())
11742                 {
11743                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11744                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11745                 }
11746 
11747                 for(iIdx=0; iIdx<(int)m_uiISOTableLength; iIdx++)
11748                 {
11749                         switch(uiDataID)
11750                         {
11751                         case FEDM_ISC_DATA_SNR:
11752                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnr[0], (int)m_ISOTable[iIdx]->m_ucSnrLen, sStr));
11753                                 if(sStr == sData)
11754                                         return iIdx;
11755                                 break;          
11756 
11757                         case FEDM_ISC_DATA_EPC_DOMAIN:
11758                                 i64Tmp = m_ISOTable[iIdx]->GetEpcDomainManager();
11759                                 if(i64Tmp < 0)
11760                                         break;
11761 
11762                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
11763                                 if(sStr == sData)
11764                                         return iIdx;
11765                                 break;          
11766 
11767                         case FEDM_ISC_DATA_EPC_SNR:
11768                                 i64Tmp = m_ISOTable[iIdx]->GetEpcSnr();
11769                                 if(i64Tmp < 0)
11770                                         break;
11771 
11772                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
11773                                 if(sStr == sData)
11774                                         return iIdx;
11775                                 break;          
11776 
11777                         case FEDM_ISC_DATA_EPC_OBJECT:
11778                                 i64Tmp = m_ISOTable[iIdx]->GetEpcObjectClass();
11779                                 if(i64Tmp < 0)
11780                                         break;
11781 
11782                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
11783                                 if(sStr == sData)
11784                                         return iIdx;
11785                                 break;          
11786 
11787                         case FEDM_ISC_DATA_EPC:
11788                                 FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
11789                                 if(strcmp(sData.c_str(), cEpc)==0)
11790                                         return iIdx;
11791                                 break;
11792 
11793                         case FEDM_ISC_DATA_TRTYPE:
11794                         case FEDM_ISC_DATA_OPTINFO:
11795                         case FEDM_ISC_DATA_PROTOINFO:
11796                         case FEDM_ISC_DATA_TRINFO:
11797                         case FEDM_ISC_DATA_EPC_TYPE:
11798                         case FEDM_ISC_DATA_EPC_HEADER:
11799                         case FEDM_ISC_DATA_ANT_NR:
11800                         case FEDM_ISC_DATA_ANT_STATUS:
11801                         case FEDM_ISC_DATA_ANT_RSSI:
11802                         case FEDM_ISC_DATA_ANT_COUNT:
11803                         case FEDM_ISC_DATA_SNR_LEN:
11804                         case FEDM_ISC_DATA_AFI:
11805                         case FEDM_ISC_DATA_DSFID:
11806                         case FEDM_ISC_DATA_CHIP_ID:
11807                         case FEDM_ISC_DATA_MEM_SIZE:
11808                         case FEDM_ISC_DATA_IC_REF:
11809                         case FEDM_ISC_DATA_IS_SELECTED:
11810                         case FEDM_ISC_DATA_IS_EPC:
11811                         case FEDM_ISC_DATA_SEC_STATUS:
11812                         case FEDM_ISC_DATA_TxDB:
11813                         case FEDM_ISC_DATA_RxDB:
11814                         case FEDM_ISC_DATA_TxCB:
11815                         case FEDM_ISC_DATA_RxCB:
11816                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
11817                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
11818                         case FEDM_ISC_DATA_RxDB_TID_BANK:
11819                         case FEDM_ISC_DATA_TxDB_TID_BANK:
11820                         case FEDM_ISC_DATA_RxDB_RES_BANK:
11821                         case FEDM_ISC_DATA_TxDB_RES_BANK:
11822                         case FEDM_ISC_DATA_BLOCK_SIZE:
11823                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
11824                         case FEDM_ISC_DATA_FSCI:
11825                         case FEDM_ISC_DATA_FWI:
11826                         case FEDM_ISC_DATA_DSI:
11827                         case FEDM_ISC_DATA_DRI:
11828                         case FEDM_ISC_DATA_NAD:
11829                         case FEDM_ISC_DATA_CID:
11830                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11831                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11832                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11833 
11834                         default:
11835                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11836                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11837                         }
11838                 }
11839                 break;
11840         
11841         case FEDM_ISC_CAD_TABLE:
11842                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11843                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11844                 
11845         default:
11846                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
11847                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
11848         }
11849 
11850         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", string) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11851         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
11852 }
11853 
11854 
11855 /***************************************************************************
11856   Begin                 :       19.11.2000 / M. Hultsch
11857   Version               :       03.00.07 / 30.04.2009 / M. Hultsch
11858 
11859   Function                      :       search the table index of sData member inside a table
11860 
11861   Parameters            :       int iStartIdx   -       start index of table (>=0)
11862                                                 unsigned int uiTableID  -       identifies the table
11863                                                 unsigned int uiDataID   -       identifies the table data
11864                                                 CString sData   -       data
11865 
11866   Return value          :       0..<table size  : index
11867                                                 <0                              : error code
11868 
11869 ***************************************************************************/
11870 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
11871 int FEDM_ISCReader::FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, CString sData)
11872 {
11873         char cEpc[FEDM_ISC_MAX_UID_LENGTH];
11874         int iIdx, iErr;
11875         __int64 i64Tmp = 0;
11876         CString sStr;
11877 
11878         switch(uiTableID)
11879         {
11880         case FEDM_ISC_BRM_TABLE:
11881                 if(m_BRMTable.size() == 0)
11882                 {
11883                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11884                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11885                 }
11886 
11887                 if(m_uiBRMTableLength == 0)
11888                 {
11889                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11890                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11891                 }
11892 
11893                 if(iStartIdx < 0 || (unsigned int)iStartIdx > m_BRMTable.size())
11894                 {
11895                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11896                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11897                 }
11898 
11899                 if(iStartIdx < 0 || (unsigned int)iStartIdx > m_BRMTable.size())
11900                 {
11901                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11902                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11903                 }
11904 
11905                 for(iIdx=0; iIdx<(int)m_uiBRMTableLength; iIdx++)
11906                 {
11907                         switch(uiDataID)
11908                         {
11909                         case FEDM_ISC_DATA_SNR:
11910                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_BRMTable[iIdx]->m_ucSnr[0], (int)m_BRMTable[iIdx]->m_ucSnrLen, sStr));
11911                                 if(sStr == sData)
11912                                         return iIdx;
11913                                 break;          
11914                         
11915                         case FEDM_ISC_DATA_EPC:
11916                                 if(m_BRMTable[iIdx]->m_ucIDDT == 0x01)
11917                                 {
11918                                         FEDM_CHK2(iErr, m_BRMTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
11919                                         if(sData == cEpc)
11920                                                 return iIdx;
11921                                 }
11922                                 break;
11923                         
11924                         case FEDM_ISC_DATA_ANT_NR:
11925                         case FEDM_ISC_DATA_ANT_STATUS:
11926                         case FEDM_ISC_DATA_ANT_RSSI:
11927                         case FEDM_ISC_DATA_ANT_COUNT:
11928                         case FEDM_ISC_DATA_SNR_LEN:
11929                         case FEDM_ISC_DATA_TRTYPE:
11930                         case FEDM_ISC_DATA_TIMER:
11931                         case FEDM_ISC_DATA_DATE:
11932                         case FEDM_ISC_DATA_DB_ADR:
11933                         case FEDM_ISC_DATA_DBN:
11934                         case FEDM_ISC_DATA_INPUT:
11935                         case FEDM_ISC_DATA_STATE:
11936                         case FEDM_ISC_DATA_BLOCK_SIZE:
11937                         case FEDM_ISC_DATA_RxDB:
11938                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
11939                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
11940                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
11941 
11942                         default:
11943                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11944                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
11945                         }
11946                 }
11947                 break;
11948         
11949         case FEDM_ISC_ISO_TABLE:
11950                 if(m_ISOTable.size() == 0)
11951                 {
11952                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
11953                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_SIZE);
11954                 }
11955 
11956                 if(m_uiISOTableLength == 0)
11957                 {
11958                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
11959                         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);
11960                 }
11961 
11962                 if(iStartIdx < 0)
11963                 {
11964                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_PARAMETER));
11965                         FEDM_RETURN(FEDM_ERROR_PARAMETER);
11966                 }
11967 
11968                 if((unsigned int)iStartIdx > m_ISOTable.size())
11969                 {
11970                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
11971                         FEDM_RETURN(FEDM_ERROR_ARRAY_BOUNDARY);
11972                 }
11973 
11974                 for(iIdx=0; iIdx<(int)m_uiISOTableLength; iIdx++)
11975                 {
11976                         switch(uiDataID)
11977                         {       
11978                         case FEDM_ISC_DATA_SNR:
11979                                 FEDM_CHK2(iErr, FEDM_ConvHexUCharToHexStr(&m_ISOTable[iIdx]->m_ucSnr[0], (int)m_ISOTable[iIdx]->m_ucSnrLen, sStr));
11980                                 if(sStr == sData)
11981                                         return iIdx;
11982                                 break;          
11983 
11984                         case FEDM_ISC_DATA_EPC_DOMAIN:
11985                                 i64Tmp = m_ISOTable[iIdx]->GetEpcDomainManager();
11986                                 if(i64Tmp < 0)
11987                                         break;
11988 
11989                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
11990                                 if(sStr == sData)
11991                                         return iIdx;
11992                                 break;          
11993 
11994                         case FEDM_ISC_DATA_EPC_SNR:
11995                                 i64Tmp = m_ISOTable[iIdx]->GetEpcSnr();
11996                                 if(i64Tmp < 0)
11997                                         break;
11998 
11999                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
12000                                 if(sStr == sData)
12001                                         return iIdx;
12002                                 break;          
12003 
12004                         case FEDM_ISC_DATA_EPC_OBJECT:
12005                                 i64Tmp = m_ISOTable[iIdx]->GetEpcObjectClass();
12006                                 if(i64Tmp < 0)
12007                                         break;
12008 
12009                                 FEDM_CHK2(iErr, FEDM_ConvInt64ToHexStr(i64Tmp, sStr));
12010                                 if(sStr == sData)
12011                                         return iIdx;
12012                                 break;          
12013 
12014                         case FEDM_ISC_DATA_EPC:
12015                                 FEDM_CHK2(iErr, m_ISOTable[iIdx]->GetEpc(cEpc, FEDM_ISC_MAX_UID_LENGTH));
12016                                 if(sData == cEpc)
12017                                         return iIdx;
12018                                 break;
12019 
12020                         case FEDM_ISC_DATA_TRTYPE:
12021                         case FEDM_ISC_DATA_OPTINFO:
12022                         case FEDM_ISC_DATA_PROTOINFO:
12023                         case FEDM_ISC_DATA_TRINFO:
12024                         case FEDM_ISC_DATA_EPC_TYPE:
12025                         case FEDM_ISC_DATA_EPC_HEADER:
12026                         case FEDM_ISC_DATA_ANT_NR:
12027                         case FEDM_ISC_DATA_ANT_STATUS:
12028                         case FEDM_ISC_DATA_ANT_RSSI:
12029                         case FEDM_ISC_DATA_ANT_COUNT:
12030                         case FEDM_ISC_DATA_SNR_LEN:
12031                         case FEDM_ISC_DATA_AFI:
12032                         case FEDM_ISC_DATA_DSFID:
12033                         case FEDM_ISC_DATA_CHIP_ID:
12034                         case FEDM_ISC_DATA_MEM_SIZE:
12035                         case FEDM_ISC_DATA_IC_REF:
12036                         case FEDM_ISC_DATA_IS_SELECTED:
12037                         case FEDM_ISC_DATA_IS_EPC:
12038                         case FEDM_ISC_DATA_SEC_STATUS:
12039                         case FEDM_ISC_DATA_TxDB:
12040                         case FEDM_ISC_DATA_RxDB:
12041                         case FEDM_ISC_DATA_TxCB:
12042                         case FEDM_ISC_DATA_RxCB:
12043                         case FEDM_ISC_DATA_RxDB_EPC_BANK:
12044                         case FEDM_ISC_DATA_TxDB_EPC_BANK:
12045                         case FEDM_ISC_DATA_RxDB_TID_BANK:
12046                         case FEDM_ISC_DATA_TxDB_TID_BANK:
12047                         case FEDM_ISC_DATA_RxDB_RES_BANK:
12048                         case FEDM_ISC_DATA_TxDB_RES_BANK:
12049                         case FEDM_ISC_DATA_BLOCK_SIZE:
12050                         case FEDM_ISC_DATA_IS_BLOCK_SIZE_SET:
12051                         case FEDM_ISC_DATA_FSCI:
12052                         case FEDM_ISC_DATA_FWI:
12053                         case FEDM_ISC_DATA_DSI:
12054                         case FEDM_ISC_DATA_DRI:
12055                         case FEDM_ISC_DATA_NAD:
12056                         case FEDM_ISC_DATA_CID:
12057                         case FEDM_ISC_DATA_EPC_CL1_GEN2_PC:
12058                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
12059                                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
12060 
12061                         default:
12062                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_PARAMETER));
12063                                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
12064                         }
12065                 }
12066                 break;
12067         
12068         case FEDM_ISC_CAD_TABLE:
12069                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
12070                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
12071                 
12072         default:
12073                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_UNKNOWN_TABLE_ID));
12074                 FEDM_RETURN(FEDM_ERROR_UNKNOWN_TABLE_ID);
12075         }
12076 
12077         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(" << iStartIdx << ", " << uiTableID << ", 0x" << std::hex << std::uppercase << uiDataID << ", CString) - " << GetErrorText(FEDM_ERROR_NO_TABLE_DATA));
12078         FEDM_RETURN(FEDM_ERROR_NO_TABLE_DATA);  // table data not found
12079 }
12080 #endif
12081 
12082 
12083 
12085 // protected functions
12087 
12088 /***************************************************************************
12089   Begin                 :       10.12.2008 / M. Hultsch
12090   
12091   Version               :       04.06.08 / 13.10.2014 / M. Hultsch
12092                                                 - additional LAN link information with mode=0x50
12093 
12094                                                 04.05.05 / 29.11.2013 / M. Hultsch
12095                                                 - new mode: 0x09 for WLAN-Firmware
12096 
12097                                                 04.02.06 / 25.07.2012 / M. Hultsch
12098                                                 - new mode 0x08 (with firmware supported tag drivers)
12099 
12100                                                 04.00.08 / 24.01.2012 / M. Hultsch
12101 
12102   Function                      :       sets the received data of last [0x66] Reader Info protocol
12103                                                 with mode 0xFF (means all) into FEDM_ISC_READER_INFO
12104 
12105   Parameters            :       unsigned char ucMode    -       mode byte
12106                                                 unsigned char* ucData   -       pointer to buffer with data
12107 
12108   Return value          :       OK (=0) or error code (<0)
12109 ***************************************************************************/
12110 int FEDM_ISCReader::Set_0x66_ReaderInfoData(unsigned char ucMode, unsigned char* ucData)
12111 {
12112         int iErr = 0;
12113         unsigned int uiReaderType = m_uiReaderType;
12114         unsigned char ucNextMode = 0;
12115         unsigned int uiByteCnt = 0;
12116         unsigned int uiMaxRecCnt = 1;
12117         unsigned int uiRecCnt = 0;
12118 
12119         if(ucMode == 0xFF)
12120         {
12121                 uiMaxRecCnt = ucData[uiByteCnt++];
12122                 m_ReaderInfo.Init();
12123         }
12124         else
12125         {
12126                 ucNextMode = ucMode;
12127         }
12128 
12129         for(uiRecCnt=0; uiRecCnt<uiMaxRecCnt; uiRecCnt++)
12130         {
12131                 if(ucMode == 0xFF)
12132                 {
12133                         ucNextMode = ucData[uiByteCnt++];
12134                 }
12135 
12136                 switch(ucNextMode)
12137                 {
12138                 case 0x00: // RF-Controller
12139                         FEDM_CHK2(iErr, SetData(FEDM_GetAdrOfID(FEDM_ISC_TMP_SOFTVER, 32), &ucData[uiByteCnt], 16, FEDM_TMPDATA_MEM));
12140                         memcpy(&m_ReaderInfo.ucRfcSwVer[0], &ucData[uiByteCnt], 16);
12141                         m_ReaderInfo.bIsMode0x00Read = true;
12142                         uiReaderType = m_ReaderInfo.GetReaderType();
12143                         FEDM_CHK2(iErr, SetReaderType(uiReaderType));
12144                         uiByteCnt += 30;
12145         
12146                         // ReaderInfo is partial or completely read
12147                         m_ReaderInfo.bIsInfoRead = true;
12148                         break;
12149 
12150                 case 0x01: // Application Communication Controller
12151                         memcpy(&m_ReaderInfo.ucAccSwVer[0], &ucData[uiByteCnt], 7);
12152                         m_ReaderInfo.bIsMode0x01Read = true;
12153                         uiByteCnt += 30;
12154                         break;
12155 
12156                 case 0x02: // USB Controller
12157                         memcpy(&m_ReaderInfo.ucUsbSwVer[0], &ucData[uiByteCnt], 4);
12158                         m_ReaderInfo.bIsMode0x02Read = true;
12159                         uiByteCnt += 30;
12160                         break;
12161 
12162                 case 0x03: // RF-Decoder
12163                         switch(uiReaderType)    // reader type
12164                         {
12165                         // megalock C
12166                         case FEDM_ISC_TYPE_MLC_COM:
12167                         // classic-pro
12168                         case FEDM_ISC_TYPE_CPR20_XX:
12169                         case FEDM_ISC_TYPE_CPR40_XX_U:
12170                         case FEDM_ISC_TYPE_CPR40_XX:
12171                         case FEDM_ISC_TYPE_CPR44_XX:
12172                         case FEDM_ISC_TYPE_CPR46_XX:
12173                         case FEDM_ISC_TYPE_CPR47_XX:
12174                         //case FEDM_ISC_TYPE_MAX_ONTOP:
12175                                 memcpy(&m_ReaderInfo.ucDecoderType[0], &ucData[uiByteCnt], 6);
12176                                 m_ReaderInfo.bIsMode0x03Read = true;
12177                                 break;
12178                         // HF-Reader
12179                         case FEDM_ISC_TYPE_ISCLR2000:
12180                         case FEDM_ISC_TYPE_ISCLR2500_A:
12181                         case FEDM_ISC_TYPE_ISCLR2500_B:
12182                         // myAXXESS
12183                         case FEDM_ISC_TYPE_MAXU1002:
12184                         // UHF-Reader
12185                         case FEDM_ISC_TYPE_ISCMRU200:
12186                         case FEDM_ISC_TYPE_ISCLRU1002:
12187                         case FEDM_ISC_TYPE_ISCLRU2000:
12188                         case FEDM_ISC_TYPE_ISCLRU3000:
12189                                 memcpy(&m_ReaderInfo.ucFpgaSwVer[0], &ucData[uiByteCnt], 4);
12190                                 m_ReaderInfo.bIsMode0x03Read = true;
12191                                 break;
12192                         }
12193                         uiByteCnt += 30;
12194                         break;
12195 
12196                 case 0x04: // Additional Firmware Functionality
12197                         switch(uiReaderType)    // reader type
12198                         {
12199                         // LF classic types
12200                         case 20: // ID RW40.30
12201                         // megalock C
12202                         case FEDM_ISC_TYPE_MLC_COM:
12203                         // classic-pro
12204                         case FEDM_ISC_TYPE_CPRM02:
12205                         case FEDM_ISC_TYPE_CPR02:
12206                         case FEDM_ISC_TYPE_CPR04_U:
12207                         case FEDM_ISC_TYPE_CPR20_XX:
12208                         case FEDM_ISC_TYPE_CPR40_XX_U:
12209                         case FEDM_ISC_TYPE_CPR40_XX:
12210                         case FEDM_ISC_TYPE_CPR44_XX:
12211                         case FEDM_ISC_TYPE_CPR46_XX:
12212                         case FEDM_ISC_TYPE_CPR47_XX:
12213                         case FEDM_ISC_TYPE_MAX_ONTOP:
12214                         case FEDM_ISC_TYPE_CPR30_XX:
12215                         case FEDM_ISC_TYPE_CPR50_XX:
12216                         case FEDM_ISC_TYPE_CPR52_XX:
12217                         case FEDM_ISC_TYPE_CPR60_XX:
12218                         case FEDM_ISC_TYPE_MAX50_XX:
12219                         // myAXXESS
12220                         case FEDM_ISC_TYPE_MAX_STANDARD:
12221                         case FEDM_ISC_TYPE_MAX_COMFORT:
12222                                 memcpy(&m_ReaderInfo.ucCprFctTemplate, &ucData[uiByteCnt], 11);
12223                                 m_ReaderInfo.bIsMode0x04Read = true;
12224                                 break;
12225 
12226                         // HF-Reader
12227                         case FEDM_ISC_TYPE_ISCLR2000:
12228                         case FEDM_ISC_TYPE_ISCLR2500_A:
12229                         case FEDM_ISC_TYPE_ISCLR2500_B:
12230                         case FEDM_ISC_TYPE_ISCLR1002:
12231                         // myAXXESS
12232                         case FEDM_ISC_TYPE_MAXU1002:
12233                         // UHF-Reader
12234                         case FEDM_ISC_TYPE_ISCMU02:
12235                         case FEDM_ISC_TYPE_ISCMU95:
12236                         case FEDM_ISC_TYPE_ISCLRU1002:
12237                         case FEDM_ISC_TYPE_ISCLRU2000:
12238                         case FEDM_ISC_TYPE_ISCLRU3000:
12239                                 memcpy(&m_ReaderInfo.ucReserved1, &ucData[uiByteCnt], 11);
12240                                 m_ReaderInfo.bIsMode0x04Read = true;
12241                                 break;
12242 
12243                         default:
12244                                 memcpy(&m_ReaderInfo.ucReserved1, &ucData[uiByteCnt], 11);
12245                                 m_ReaderInfo.bIsMode0x04Read = true;
12246                                 break;
12247                         }
12248                         uiByteCnt += 30;
12249                         break;
12250 
12251                 case 0x05: // Bootloader Firmware
12252                         memcpy(&m_ReaderInfo.ucBootSwVer[0], &ucData[uiByteCnt], 2);
12253                         m_ReaderInfo.bIsMode0x05Read = true;
12254                         uiByteCnt += 30;
12255                         break;
12256 
12257                 case 0x06: // information from keyboard unit
12258                         memcpy(&m_ReaderInfo.ucKeybStatus[0], &ucData[uiByteCnt], 8);
12259                         m_ReaderInfo.bIsMode0x06Read = true;
12260                         uiByteCnt += 30;
12261                         break;
12262 
12263                 case 0x07: // information about CPRIO unit
12264                         memcpy(&m_ReaderInfo.ucCprioSwVer[0], &ucData[uiByteCnt], 7);
12265                         m_ReaderInfo.bIsMode0x07Read = true;
12266                         uiByteCnt += 30;
12267                         break;
12268 
12269                 case 0x08: // information with supported tag drivers
12270                         memcpy(&m_ReaderInfo.ucRfcSupportedTagDriver[0], &ucData[uiByteCnt], 14);
12271                         m_ReaderInfo.bIsMode0x08Read = true;
12272                         uiByteCnt += 30;
12273                         break;
12274 
12275                 case 0x09: // information with WLAN-Modul firmware
12276                         memcpy(&m_ReaderInfo.ucWlanVer[0], &ucData[uiByteCnt], 14);
12277                         m_ReaderInfo.bIsMode0x09Read = true;
12278                         uiByteCnt += 30;
12279                         break;
12280 
12281                 case 0x10: // Hardware Information
12282                         switch(uiReaderType)    // reader type
12283                         {
12284                         // HF-Reader
12285                         case FEDM_ISC_TYPE_ISCMR102:
12286                         case FEDM_ISC_TYPE_ISCMR10X:
12287                         case FEDM_ISC_TYPE_ISCPRH102:
12288                         case FEDM_ISC_TYPE_ISCPRH200:
12289                         case FEDM_ISC_TYPE_ISCLR1002:
12290                         case FEDM_ISC_TYPE_ISCLR2000:
12291                         case FEDM_ISC_TYPE_ISCLR2500_A:
12292                         case FEDM_ISC_TYPE_ISCLR2500_B:
12293                                 memcpy(&m_ReaderInfo.ucRfcHwInfo[0], &ucData[uiByteCnt], 11);
12294                                 m_ReaderInfo.bIsMode0x10Read    = true;
12295                                 break;
12296                         // UHF-Reader
12297                         case FEDM_ISC_TYPE_ISCMRU200:
12298                                 memcpy(&m_ReaderInfo.ucRfcHwInfo[0], &ucData[uiByteCnt], 11);
12299                                 m_ReaderInfo.bIsMode0x10Read    = true;
12300                                 m_ReaderInfo.ucRfcFrequency             = (m_ReaderInfo.ucRfcHwInfo[1] & 0x01) + 1;     // 0: EU; 1: FCC
12301                                 m_ReaderInfo.bIsRfcFrequency    = true;
12302                                 break;                  
12303                         // UHF-Reader
12304                         case FEDM_ISC_TYPE_ISCLRU1000:
12305                         case FEDM_ISC_TYPE_ISCLRU2000:
12306                                 memcpy(&m_ReaderInfo.ucRfcHwInfo[0], &ucData[uiByteCnt], 11);
12307                                 m_ReaderInfo.bIsMode0x10Read    = true;
12308                                 break;
12309                         default:
12310                                 memcpy(&m_ReaderInfo.ucRfcHwInfo[0], &ucData[uiByteCnt], 11);
12311                                 m_ReaderInfo.bIsMode0x10Read    = true;
12312                                 m_ReaderInfo.bIsRfcFrequency    = true;
12313                                 break;
12314                         }
12315                         uiByteCnt += 30;
12316                         break;
12317 
12318                 case 0x11: // SAM information
12319                         memcpy(&m_ReaderInfo.ucNoOfSlots, &ucData[uiByteCnt], 5);
12320                         m_ReaderInfo.bIsMode0x11Read = true;
12321                         uiByteCnt += 30;
12322                         break;
12323 
12324                 case 0x12: // CPU information of RFC
12325                         memcpy(&m_ReaderInfo.ucRfcCpuManufacturer, &ucData[uiByteCnt], 8);
12326                         m_ReaderInfo.bIsMode0x12Read = true;
12327                         uiByteCnt += 30;
12328                         break;
12329 
12330                 case 0x40: // CFG information with read permission
12331                         memcpy(&m_ReaderInfo.ucNoOfCfgPages[0], &ucData[uiByteCnt], 18);
12332                         m_ReaderInfo.bIsMode0x40Read = true;
12333                         uiByteCnt += 30;
12334                         break;
12335 
12336                 case 0x41: // CFG information with write permission
12337                         memcpy(&m_ReaderInfo.ucNoOfCfgPages[0], &ucData[uiByteCnt], 2);
12338                         uiByteCnt += 2;
12339                         memcpy(&m_ReaderInfo.ucCfgWritePermissions[0], &ucData[uiByteCnt], 16);
12340                         m_ReaderInfo.bIsMode0x41Read = true;
12341                         uiByteCnt += 28;
12342                         break;
12343 
12344                 case 0x50: // information with MAC for LAN
12345                         m_ReaderInfo.ucLanFlags = ucData[uiByteCnt++];
12346                         memcpy(&m_ReaderInfo.ucLanMac[0], &ucData[uiByteCnt], 6);
12347                         uiByteCnt += 6;
12348                         m_ReaderInfo.ucLanLinkInfo = ucData[uiByteCnt++];
12349                         m_ReaderInfo.bIsMode0x50Read = true;
12350                         uiByteCnt += 22;
12351                         break;
12352 
12353                 case 0x51: // information with IP Address for LAN
12354                         m_ReaderInfo.ucLanFlags = ucData[uiByteCnt++];
12355                         memcpy(&m_ReaderInfo.ucLanIpV4[0], &ucData[uiByteCnt], 20);
12356                         m_ReaderInfo.bIsMode0x51Read = true;
12357                         uiByteCnt += 29;
12358                         break;
12359 
12360                 case 0x52: // information with Netmask for LAN
12361                         m_ReaderInfo.ucLanFlags = ucData[uiByteCnt++];
12362                         memcpy(&m_ReaderInfo.ucLanNetmaskV4[0], &ucData[uiByteCnt], 20);
12363                         m_ReaderInfo.bIsMode0x52Read = true;
12364                         uiByteCnt += 29;
12365                         break;
12366 
12367                 case 0x53: // information with Gateway Address for LAN
12368                         m_ReaderInfo.ucLanFlags = ucData[uiByteCnt++];
12369                         memcpy(&m_ReaderInfo.ucLanGatewayV4[0], &ucData[uiByteCnt], 20);
12370                         m_ReaderInfo.bIsMode0x53Read = true;
12371                         uiByteCnt += 29;
12372                         break;
12373 
12374                 case 0x54: // information with MAC for WLAN
12375                         m_ReaderInfo.ucWlanFlags = ucData[uiByteCnt++];
12376                         memcpy(&m_ReaderInfo.ucWlanMac[0], &ucData[uiByteCnt], 6);
12377                         m_ReaderInfo.bIsMode0x54Read = true;
12378                         uiByteCnt += 29;
12379                         break;
12380 
12381                 case 0x55: // information with IP Address for WLAN
12382                         m_ReaderInfo.ucWlanFlags = ucData[uiByteCnt++];
12383                         memcpy(&m_ReaderInfo.ucWlanIpV4[0], &ucData[uiByteCnt], 20);
12384                         m_ReaderInfo.bIsMode0x55Read = true;
12385                         uiByteCnt += 29;
12386                         break;
12387 
12388                 case 0x56: // information with Netmask for WLAN
12389                         m_ReaderInfo.ucWlanFlags = ucData[uiByteCnt++];
12390                         memcpy(&m_ReaderInfo.ucWlanNetmaskV4[0], &ucData[uiByteCnt], 20);
12391                         m_ReaderInfo.bIsMode0x56Read = true;
12392                         uiByteCnt += 29;
12393                         break;
12394 
12395                 case 0x57: // information with Gateway Address for WLAN
12396                         m_ReaderInfo.ucWlanFlags = ucData[uiByteCnt++];
12397                         memcpy(&m_ReaderInfo.ucWlanGatewayV4[0], &ucData[uiByteCnt], 20);
12398                         m_ReaderInfo.bIsMode0x57Read = true;
12399                         uiByteCnt += 29;
12400                         break;
12401 
12402                 case 0x60: // input/output capabilities information
12403                         memcpy(&m_ReaderInfo.ucNoOfInputs, &ucData[uiByteCnt], 3);
12404                         m_ReaderInfo.bIsMode0x60Read = true;
12405                         uiByteCnt += 30;
12406                         break;
12407 
12408                 case 0x61: // external peripheral devices information
12409                         if(ucData[uiByteCnt] > 0 && ucData[uiByteCnt] < 4)
12410                         {
12411                                 memcpy(&m_ReaderInfo.ucNoOfPeripheralDevices, &ucData[uiByteCnt], ucData[uiByteCnt]*2+1);
12412                                 m_ReaderInfo.bIsMode0x61Read = true;
12413 #if !defined(_FEDM_NO_PD_SUPPORT)
12414                                 BuildPDMap();
12415 #endif
12416                         }
12417                         uiByteCnt += 30;
12418                         break;
12419 
12420                 case 0x80: // Device Info
12421                         memcpy(&m_ReaderInfo.ucRfcDevID[0], &ucData[uiByteCnt], 18);
12422                         m_ReaderInfo.bIsMode0x80Read = true;
12423                         FEDM_SETPROP2(m_pLogger, FELOGMNG_PROP_DEVICED_ID, m_ReaderInfo.GetDeviceID());
12424                         uiByteCnt += 30;
12425 #ifdef _FELOGMNG_SUPPORT
12426                         {
12427                                 // for log manager
12428                                 char cDeviceID[24];
12429                                 sprintf(cDeviceID, "%u", m_ReaderInfo.GetDeviceID());
12430                                 FEISC_SetReaderPara(m_iReaderHnd, "Device-ID", cDeviceID);
12431                         }
12432 #endif
12433                         break;
12434 
12435                 default:
12436                         uiByteCnt += 30;
12437                         break;
12438                 }
12439         }
12440 
12441         return 0;
12442 }
12443 
12444 
12445 /***************************************************************************
12446   Begin                 :       24.02.2010 / M. Hultsch
12447   Version               :       03.01.01 / 24.02.2010 / M. Hultsch
12448 
12449   Function                      :       build or rebuild the map with detected peripheral devices
12450 
12451   Parameters            :       -
12452 
12453   Return value          :       -
12454 ***************************************************************************/
12455 #if !defined(_FEDM_NO_PD_SUPPORT)
12456 void FEDM_ISCReader::BuildPDMap()
12457 {
12458         bool bFound = false;
12459         FEDM_PD_MAP_ITOR itor;
12460 
12461         // remove first all disappeared peripheral devices
12462         itor = m_mapPeripheralDevices.begin();
12463         while(itor != m_mapPeripheralDevices.end())
12464         {
12465                 bFound = false;
12466                 for(unsigned char ucCnt=0; ucCnt<m_ReaderInfo.ucNoOfPeripheralDevices; ucCnt++)
12467                 {
12468                         if(itor->second->GetBusAddress() == m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr)
12469                         {
12470                                 bFound = true;
12471                                 break;
12472                         }
12473                 }
12474 
12475                 if(!bFound)
12476                 {
12477 #ifdef _FEDM_LINUX
12478                         m_mapPeripheralDevices.erase(itor++);
12479 #else
12480                         itor = m_mapPeripheralDevices.erase(itor);
12481 #endif
12482                 }
12483                 else
12484                 {
12485                         itor++;
12486                 }
12487         }
12488 
12489         // create now all new peripheral devices
12490         for(unsigned char ucCnt=0; ucCnt<m_ReaderInfo.ucNoOfPeripheralDevices; ucCnt++)
12491         {
12492                 itor = m_mapPeripheralDevices.find(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr);
12493                 if(itor == m_mapPeripheralDevices.end())
12494                 {
12495                         // pd not fount >> create a new one
12496                         switch(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDType)
12497                         {
12498                         case FEDM_ISC_PD_TYPE_PEOPLE_COUNTER:
12499                                 {
12500                                 FedmIscPeopleCounter* pPD = new FedmIscPeopleCounter(this, m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr);
12501                                 m_mapPeripheralDevices.insert(make_pair(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr, (FedmIscPeripheralDevice*)pPD));
12502                                 }
12503                                 break;
12504 
12505                         case FEDM_ISC_PD_TYPE_EXTERNAL_IO:
12506                                 {
12507                                 FedmIscExternalIO* pPD = new FedmIscExternalIO(this, m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr);
12508                                 m_mapPeripheralDevices.insert(make_pair(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr, (FedmIscPeripheralDevice*)pPD));
12509                                 }
12510                                 break;
12511                         }
12512                         continue;
12513                 }
12514 
12515                 if(itor->second->GetPDType() != m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDType)
12516                 {
12517                         // pd type changed >> remove old pd and create a new one
12518                         delete itor->second;
12519                         m_mapPeripheralDevices.erase(itor);
12520 
12521                         switch(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDType)
12522                         {
12523                         case FEDM_ISC_PD_TYPE_PEOPLE_COUNTER:
12524                                 {
12525                                 FedmIscPeopleCounter* pPD = new FedmIscPeopleCounter(this, m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr);
12526                                 m_mapPeripheralDevices.insert(make_pair(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr, (FedmIscPeripheralDevice*)pPD));
12527                                 }
12528                                 break;
12529 
12530                         case FEDM_ISC_PD_TYPE_EXTERNAL_IO:
12531                                 {
12532                                 FedmIscExternalIO* pPD = new FedmIscExternalIO(this, m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr);
12533                                 m_mapPeripheralDevices.insert(make_pair(m_ReaderInfo.aPeripheralDevice[ucCnt].ucPDBusAdr, (FedmIscPeripheralDevice*)pPD));
12534                                 }
12535                                 break;
12536                         }
12537                 }
12538         }
12539 }
12540 #endif
12541 
12542 
12543 int FEDM_ISCReader::Set_0x6E_ReaderDiagnosticData(unsigned char ucMode, unsigned char* ucData)
12544 {
12545         return Set_0x6E_ReaderDiagnosticData(ucMode, ucData, &m_ReaderDiagnostic);
12546 }
12547 
12548 
12549 /***************************************************************************
12550   Begin                 :       11.12.2008 / M. Hultsch
12551   
12552   Version               :       04.06.00 / 12.12.2013 / M. Hultsch
12553                                                 - support for new mode 0x07
12554 
12555                                                 04.03.01 / 05.11.2012 / M. Hultsch
12556                                                 - support for new mode 0x21
12557 
12558                                                 03.00.18 / 15.12.2009 / M. Hultsch
12559 
12560   Function                      :       sets the received data of last [0x6E] Reader Diagnostic protocol
12561                                                 with mode 0xFF (means all) into FEDM_ISC_READER_DIAGNOSTIC
12562 
12563   Parameters            :       unsigned char ucMode    -       mode byte
12564                                                 unsigned char* ucData   -       pointer to buffer with data
12565 
12566   Return value          :       OK (=0) or error code (<0)
12567 ***************************************************************************/
12568 int FEDM_ISCReader::Set_0x6E_ReaderDiagnosticData(unsigned char ucMode, unsigned char* ucData, FEDM_ISC_READER_DIAGNOSTIC* pReaderDiagnostic)
12569 {
12570         unsigned char ucNextMode = 0;
12571         unsigned int uiByteCnt = 0;
12572         unsigned int uiMaxRecCnt = 1;
12573         unsigned int uiRecCnt = 0;
12574 
12575         if(ucMode == 0xFF)
12576         {
12577                 uiMaxRecCnt = ucData[uiByteCnt++];
12578                 pReaderDiagnostic->Init();
12579         }
12580         else
12581         {
12582                 ucNextMode = ucMode;
12583         }
12584 
12585         for(uiRecCnt=0; uiRecCnt<uiMaxRecCnt; uiRecCnt++)
12586         {
12587                 if(ucMode == 0xFF)
12588                 {
12589                         ucNextMode = ucData[uiByteCnt++];
12590                 }
12591 
12592                 switch(ucNextMode)
12593                 {
12594                 case 0x01: // General RF Status
12595                         memcpy(&pReaderDiagnostic->ucFlagsA, &ucData[uiByteCnt], 2);
12596                         pReaderDiagnostic->bIsMode0x01Read = true;
12597                         pReaderDiagnostic->bIsDiagnosticRead = true;
12598                         uiByteCnt += 30;
12599                         break;
12600 
12601                 case 0x02: // RF Power Amplifier Status
12602                         memcpy(&pReaderDiagnostic->ucRfPower, &ucData[uiByteCnt], 3);
12603                         pReaderDiagnostic->bIsMode0x02Read = true;
12604                         pReaderDiagnostic->bIsDiagnosticRead = true;
12605                         uiByteCnt += 30;
12606                         break;
12607 
12608                 case 0x03: // Multiplexer Status
12609                         memcpy(&pReaderDiagnostic->ucMuxStatusCh1, &ucData[uiByteCnt], 8);
12610                         pReaderDiagnostic->bIsMode0x03Read = true;
12611                         pReaderDiagnostic->bIsDiagnosticRead = true;
12612                         uiByteCnt += 30;
12613                         break;
12614 
12615                 case 0x04: // Hardware and Configuration Status
12616                         memcpy(&pReaderDiagnostic->ucIntErrorA, &ucData[uiByteCnt], 2);
12617                         pReaderDiagnostic->bIsMode0x04Read = true;
12618                         pReaderDiagnostic->bIsDiagnosticRead = true;
12619                         uiByteCnt += 30;
12620                         break;
12621 
12622                 case 0x05: // Multiplexer Impedance Status
12623                         switch(m_uiReaderType)
12624                         {
12625                         case FEDM_ISC_TYPE_ISCLRU2000:
12626                                 memcpy(&pReaderDiagnostic->CNTRL_OUT1.ucMux_PowerAmp, &ucData[uiByteCnt], 12);
12627                                 pReaderDiagnostic->bIsMode0x05Read = true;
12628                                 pReaderDiagnostic->bIsDiagnosticRead = true;
12629                                 uiByteCnt += 30;
12630                                 break;
12631 
12632                         case FEDM_ISC_TYPE_ISCLRU3000:
12633                                 memcpy(&pReaderDiagnostic->CNTRL_OUT1.ucMux_PowerAmp, &ucData[uiByteCnt], 12);
12634                                 pReaderDiagnostic->bIsMode0x05Read = true;
12635                                 pReaderDiagnostic->bIsDiagnosticRead = true;
12636                                 uiByteCnt += 30;
12637                                 break;
12638 
12639                         default:
12640                                 memcpy(&pReaderDiagnostic->CNTRL_OUT1.ucMux_PowerAmp, &ucData[uiByteCnt], 3);
12641                                 pReaderDiagnostic->bIsMode0x05Read = true;
12642                                 pReaderDiagnostic->bIsDiagnosticRead = true;
12643                                 uiByteCnt += 30;
12644                                 break;
12645                         }
12646                         break;
12647 
12648                 case 0x06: // MAX Status
12649                         memcpy((char*)&pReaderDiagnostic->usErrorFlags, &ucData[uiByteCnt], 6);
12650                         pReaderDiagnostic->bIsMode0x06Read = true;
12651                         pReaderDiagnostic->bIsDiagnosticRead = true;
12652                         uiByteCnt += 30;
12653                         break;
12654 
12655                 case 0x07: // PRH200 LED Status
12656                         memcpy((char*)&pReaderDiagnostic->ucNoOfLEDs, &ucData[uiByteCnt], 30);
12657                         pReaderDiagnostic->bIsMode0x07Read = true;
12658                         pReaderDiagnostic->bIsDiagnosticRead = true;
12659                         uiByteCnt += 30;
12660                         break;
12661 
12662                 // ID ISC.LR2500-B Antenna Tuning Status
12663                 case 0x08:
12664                         memcpy((char*)&pReaderDiagnostic->usRes1, &ucData[uiByteCnt], 15);
12665                         pReaderDiagnostic->bIsMode0x08Read = true;
12666                         pReaderDiagnostic->bIsDiagnosticRead = true;
12667                         uiByteCnt += 30;
12668                         break;
12669 
12670                 case 0x20: // Firmware Status
12671                         memcpy(&pReaderDiagnostic->ucFirmwareStatus[0], &ucData[uiByteCnt], 30);
12672                         pReaderDiagnostic->bIsMode0x20Read = true;
12673                         pReaderDiagnostic->bIsDiagnosticRead = true;
12674                         uiByteCnt += 30;
12675                         break;
12676 
12677                 case 0x21: // Config-Para Change
12678                         pReaderDiagnostic->ucConfigParaChange = ucData[uiByteCnt];
12679                         pReaderDiagnostic->bIsMode0x21Read = true;
12680                         pReaderDiagnostic->bIsDiagnosticRead = true;
12681                         uiByteCnt += 30;
12682                         break;
12683 
12684                 default:
12685                         uiByteCnt += 30;
12686                         break;
12687                 }
12688         }
12689 
12690         return 0;
12691 }
12692 
12693 int FEDM_ISCReader::Get_0x72_OutputData(unsigned char ucOutN, unsigned char* pOutRec)
12694 {
12695         if(ucOutN > 8)
12696                 return FEDM_ERROR_PARAMETER;
12697 
12698         int iFirstAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_0x72_OUT_TYPE_1, 32);
12699 
12700         for(unsigned char i=0; i<ucOutN; ++i)
12701         {
12702                 memcpy(&pOutRec[4*i], &m_TmpData[iFirstAdr+4*i], 4*sizeof(unsigned char));
12703         }
12704 
12705         return 0;
12706 }
12707 
12709 // function for buffered read mode
12711 
12712 /***************************************************************************
12713   Begin                 :       08.06.2000 / M. Hultsch
12714   Version               :       04.02.04 / 19.06.2012 / M. Hultsch
12715                                                 - support for direction information (in combination with Gate People Counter)
12716 
12717                                                 03.03.04 / 04.07.2011 / M. Hultsch
12718 
12719   Function                      :       sets the received data of last read buffer protocol
12720                                                 into BRM-table
12721                                                 
12722                                                 !! Attention!!
12723                                                 When serialnumber is multiple in data stream,
12724                                                 then the record set is only insert once in the table
12725 
12726   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
12727 
12728   Return value          :       OK (=0) or error code (<0)
12729 
12730 ***************************************************************************/
12731 int FEDM_ISCReader::SetBrmTableData(unsigned char ucCmd, unsigned char* ucData)
12732 {
12733         FEDM_CHK3(ucData);
12734 
12735         if(m_BRMTable.size() <= 0)
12736         {
12737                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
12738                 return FEDM_ERROR_NO_TABLE_SIZE;
12739         }
12740 
12741         if(ucCmd != 0x21 && ucCmd != 0x22 && ucCmd != 0x74)
12742         {
12743                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_UNKNOWN_COMMAND));
12744                 return FEDM_ERROR_UNKNOWN_COMMAND;
12745         }
12746 
12747         unsigned char   ucTrData[2];
12748         unsigned int    uiSets  = 0;
12749         int             iErr    = 0;
12750         unsigned int    uiByteCnt = 0;
12751 
12752         memset(ucTrData, 0, 2);
12753 
12754         switch(ucCmd)
12755         {
12756         case 0x21:
12757                 FEDM_CHK1(iErr, GetData(FEDM_ISCLR_TMP_BRM_TRDATA,      &ucTrData[0]));
12758                 FEDM_CHK1(iErr, GetData(FEDM_ISCLR_TMP_BRM_RECSETS, &uiSets));
12759                 break;
12760 
12761         case 0x22:
12762         case 0x74:
12763                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA1, &ucTrData[0]));
12764                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_ADV_BRM_TRDATA2, &ucTrData[1]));
12765                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_ADV_BRM_RECSETS, &uiSets));
12766                 break;
12767         }
12768 
12769 
12770         // reset BRM-table
12771         m_uiBRMTableLength = 0;
12772         
12773         // write data in BrmTable
12774         for( unsigned int iCnt=0; iCnt<uiSets; iCnt++ )
12775         {
12776                 m_BRMTable[iCnt]->Init();
12777                 iErr = m_BRMTable[iCnt]->SetData(ucCmd, ucData, ucTrData, uiByteCnt);
12778                 if(iErr < 0)
12779                 {
12780                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(iErr));
12781                         return iErr;
12782                 }
12783 
12784                 m_uiBRMTableLength++;
12785 
12786                 if(m_uiBRMTableLength > (unsigned int)m_BRMTable.size())
12787                 {
12788                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
12789                         return FEDM_ERROR_ARRAY_BOUNDARY;
12790                 }
12791         }
12792 
12793         return FEDM_OK;
12794 }
12795 
12796 
12797 
12799 // functions for [0xB0], [0xB1], [0xB2] ISO Host Protocol
12801 
12802 /***************************************************************************
12803   Begin                 :       08.06.2000 / M. Hultsch
12804   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
12805                                                 - only for EPC Class1 Gen2:
12806                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
12807 
12808                                                 04.06.01 / 07.03.2014 / M. Hultsch
12809                                                 - support for [0x22] Lock Multiple Blocks with extended addressed mode
12810                                                 - support for [0x2C] Get Multiple Block Security Status with extended addressed mode
12811 
12812                                                 04.02.00 / 11.05.2012 / M. Hultsch
12813                                                 - only for EPC Class1 Gen2:
12814                                                   if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
12815 
12816                                                 03.03.04 / 21.06.2011 / M. Hultsch
12817                                                 - only for EPC Class1 Gen2:
12818                                                   if Reader is configured for UID = EPC + TID, set TID as UID for next request in addressed mode
12819 
12820                                                 03.00.12 / 01.09.2009 / M. Hultsch
12821                                                 - new mode for Select command: request with manual selected transponder driver
12822                                                 
12823                                                 03.00.07 / 29.04.2008 / M. Hultsch
12824                                                 - new mode for Inventory command: request with antenna select
12825                                                 
12826                                                 03.00.06 / 31.03.2008 / M. Hultsch
12827                                                 - if m_bSelectWithCinf=true (preset only with classic-pro Reader)
12828                                                   execute always with CINF-flag
12829                                                 
12830                                                 02.04.01 / 22.02.2006 / M. Hultsch
12831 
12832   Function                      :       collects the necessary data for the next [0xB0] iso protocol
12833 
12834   Parameters            :       unsigned char ucCmdByte -       iso command byte
12835                                                 unsigned char* ucData   -       pointer to buffer for data
12836 
12837   Return value          :       iCnt (>0) or error code (<0)
12838 ***************************************************************************/
12839 int FEDM_ISCReader::Get_0xB0_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData)
12840 {
12841         FEDM_CHK3(ucData);
12842 
12843         bool bUidLF = false;
12844         bool bExtAdr = false;
12845         bool bAccessPw = false;
12846         bool bNotify = false;
12847         bool bAntenna = false;
12848         int iCnt = 0;
12849         int iErr = 0;
12850         int iIdx = 0;
12851         unsigned char ucUidLen  = 0x00;
12852         unsigned char ucEpcLen  = 0x00;
12853         unsigned char ucLen             = 0x00;
12854         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
12855         string sUid = "";
12856 
12857         memset(ucUid, 0, FEDM_ISC_MAX_UID_LENGTH);
12858 
12859         switch(ucCmdByte)
12860         {
12861         case 0x01:      // [0x01] Read Serial Number
12862                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
12863                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
12864                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_NOTIFY, &bNotify));
12865                 if(bNotify)
12866                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_NOTIFY_TIMEOUT, &ucData[iCnt++]));
12867                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_ANT, &bAntenna));
12868                 if(bAntenna)
12869                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_ANT_SEL, &ucData[iCnt++]));
12870 
12871                 break;
12872 
12873         case 0x02:      // [0x02] Stay Quiet
12874                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
12875                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
12876                 // UID = unified identifier = serial number
12877                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
12878                 iCnt += 8;
12879                 break;
12880 
12881         case 0x22:      // [0x22] Lock Multiple Blocks
12882                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
12883                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
12884                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
12885                 {
12886                         // UID = unified identifier = serial number
12887                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
12888                         iCnt += 8;
12889                 }
12890                 
12891                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
12892                 if(bExtAdr)
12893                 {
12894                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK, &ucData[iCnt++]));
12895                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
12896                         iCnt += 2;
12897                 }
12898                 else
12899                 {
12900                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &ucData[iCnt++]));
12901                 }
12902                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DBN, &ucData[iCnt++]));
12903                 break;
12904 
12905         case 0x23:      // [0x23] Read Multiple Blocks
12906                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
12907                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
12908                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
12909                 {
12910                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_UID_LF, &bUidLF));
12911                         if(bUidLF)      // variable UID length
12912                         {
12913                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID_LEN, &ucUidLen));
12914                         }
12915                         else
12916                         {
12917                                 ucUidLen = 8;
12918                         }
12919 
12920                         // UID = unified identifier = serial number
12921                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucUid[0], (int)ucUidLen));
12922                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
12923                         
12924                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
12925                         if(iIdx < 0)
12926                                 return iIdx;
12927 
12928                         // only for UHF EPC Class1 Gen2
12929                         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
12930                                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
12931                         {
12932                                 // check, if Reader is configured for UID = EPC + TID
12933                                 if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
12934                                 {
12935                                         // check, if response contains UID = EPC + TID
12936                                         ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
12937                                         if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
12938                                                 ucEpcLen -= 2;
12939 
12940                                         if( ucEpcLen < ucUidLen)
12941                                         {
12942                                                 // take TID as UID for next request
12943                                                 if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
12944                                                         ucData[iCnt++] = (ucUidLen - ucEpcLen);
12945 
12946                                                 memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
12947                                                 iCnt += (ucUidLen - ucEpcLen);
12948                                         }
12949                                         else
12950                                         {
12951                                                 // error in the Reader response: TID is missing
12952                                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
12953                                                 return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
12954                                         }
12955                                 }
12956                                 else
12957                                 {
12958                                         if(bUidLF || (ucUidLen != 8))
12959                                                 ucData[iCnt++] = ucUidLen;
12960                                         
12961                                         // UID = unified identifier = serial number
12962                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], ucUidLen));
12963                                         iCnt += ucUidLen;
12964                                 }
12965                         }
12966                         else
12967                         {
12968                                 if(bUidLF)      // variable UID length
12969                                 {
12970                                         ucData[iCnt++] = ucUidLen;
12971                                         // UID = unified identifier = serial number
12972                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], ucUidLen));
12973                                         iCnt += ucUidLen;
12974                                 }
12975                                 else
12976                                 {
12977                                         // UID = unified identifier = serial number
12978                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
12979                                         iCnt += 8;
12980                                 }
12981                         }
12982                 }
12983 
12984                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
12985                 if(bExtAdr)
12986                 {
12987                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK, &ucData[iCnt++]));
12988                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK_ACCESS_FLAG, &bAccessPw));
12989                         if(bAccessPw)
12990                         {
12991                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_ACCESS_PW_LENGTH, &ucLen));
12992                                 ucData[iCnt++] = ucLen;
12993                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_ACCESS_PW, &ucData[iCnt], ucLen));
12994                                 iCnt += ucLen;
12995                         }
12996                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
12997                         iCnt += 2;
12998                 }
12999                 else
13000                 {
13001                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &ucData[iCnt++]));
13002                 }
13003 
13004                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DBN, &ucData[iCnt++]));
13005                 break;
13006 
13007         case 0x24:      // [0x24] Write Multiple Blocks
13008                 FEDM_CHK1(iErr, Get_0xB0_0x24_IsoTableData(ucData));
13009                 iCnt += iErr;
13010                 break;
13011 
13012         case 0x25:      // [0x25] Select
13013                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13014 
13015                 // new since V3.00.06 to request more tag information
13016                 if( m_bSelectWithCinf && (!m_bDisableSelectWithCinf) )
13017                 {
13018                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_MODE_CINF, true));
13019                 }
13020 
13021                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13022 
13023                 // new since V3.00.12
13024                 if( ucData[1] & FEDM_ISC_ISO_MODE_DRV_SEL )     // manual selection of transponder driver
13025                 {
13026                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_TR_DRIVER, &ucData[iCnt++]));
13027                 }
13028 
13029                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13030                 {
13031                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_UID_LF, &bUidLF));
13032                         if(bUidLF)      // variable UID length
13033                         {
13034                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID_LEN, &ucUidLen));
13035                                 ucData[iCnt++] = ucUidLen;
13036                                 // UID = unified identifier = serial number
13037                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], ucUidLen));
13038                                 iCnt += ucUidLen;
13039                         }
13040                         else
13041                         {
13042                                 // UID = unified identifier = serial number
13043                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13044                                 iCnt += 8;
13045                         }
13046                 }
13047                 break;
13048 
13049         case 0x26:      // [0x26] Reset to Ready
13050                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13051                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13052                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13053                 {
13054                         // UID = unified identifier = serial number
13055                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13056                         iCnt += 8;
13057                 }
13058                 break;
13059 
13060         case 0x27:      // [0x27] Write AFI
13061                 FEDM_CHK1(iErr, Get_0xB0_0x27_IsoTableData(ucData));
13062                 iCnt += iErr;
13063                 break;
13064 
13065         case 0x28:      // [0x28] Lock AFI
13066                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13067                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13068                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13069                 {
13070                         // UID = unified identifier = serial number
13071                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13072                         iCnt += 8;
13073                 }
13074                 break;
13075 
13076         case 0x29:      // [0x29] Write DSFID
13077                 FEDM_CHK1(iErr, Get_0xB0_0x29_IsoTableData(ucData));
13078                 iCnt += iErr;
13079                 break;
13080 
13081         case 0x2A:      // [0x2A] Lock DSFID
13082                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13083                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13084                 if((unsigned char)(ucData[1]&0x07) == 0x01)     // addressed
13085                 {
13086                         // UID = unified identifier = serial number
13087                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13088                         iCnt += 8;
13089                 }
13090                 break;
13091 
13092         case 0x2B:      // [0x2B] Get System Information
13093                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13094                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13095                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13096                 {
13097                         // UID = unified identifier = serial number
13098                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13099                         iCnt += 8;
13100                 }
13101                 break;
13102 
13103         case 0x2C:      // [0x2C] Get Multiple Block Security Status
13104                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13105                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13106                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13107                 {
13108                         // UID = unified identifier = serial number
13109                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13110                         iCnt += 8;
13111                 }
13112                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
13113                 if(bExtAdr)
13114                 {
13115                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK, &ucData[iCnt++]));
13116                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
13117                         iCnt += 2;
13118                 }
13119                 else
13120                 {
13121                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &ucData[iCnt++]));
13122                 }
13123                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DBN, &ucData[iCnt++]));
13124                 break;
13125 
13126         case 0xA0:      // [0xA0] Read Config Block
13127                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13128                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13129                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13130                 {
13131                         // UID = unified identifier = serial number
13132                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
13133                         iCnt += 8;
13134                 }
13135                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_CB_ADR, &ucData[iCnt++]));
13136                 break;
13137         
13138         case 0xA1:      // [0xA1] Write Config Block
13139                 FEDM_CHK1(iErr, Get_0xB0_0xA1_IsoTableData(ucData));
13140                 iCnt += iErr;
13141                 break;
13142 
13143         case 0xC0:      // [0xC0] Halt
13144                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
13145                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
13146                 break;
13147         }
13148 
13149         return iCnt;
13150 }
13151 
13152 /***************************************************************************
13153   Begin                 :       28.07.2005 / M. Hultsch
13154   Version               :       03.03.01 / 31.03.2011 / M. Hultsch
13155 
13156   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13157 
13158   Parameters            :       unsigned char ucCmdByte -       iso command byte
13159                                                 unsigned char* ucData   -       pointer to buffer for data
13160 
13161   Return value          :       iCnt (>0) or error code (<0)
13162 ***************************************************************************/
13163 int FEDM_ISCReader::Get_0xB1_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData)
13164 {
13165         FEDM_CHK3(ucData);
13166 
13167         int iErr = 0;
13168         unsigned char ucMfr             = 0x00;
13169 
13170         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MFR, &ucMfr));
13171 
13172         switch(ucMfr)
13173         {
13174         case FEDM_ISC_ISO_MFR_NXP:
13175                 return Get_0xB1_IsoTableData_NXP(ucCmdByte, ucData);
13176                 
13177         case FEDM_ISC_ISO_MFR_TI:
13178                 return Get_0xB1_IsoTableData_TI(ucCmdByte, ucData);
13179 
13180         case FEDM_ISC_ISO_MFR_STM:
13181                 return Get_0xB1_IsoTableData_STM(ucCmdByte, ucData);
13182 
13183         case FEDM_ISC_ISO_MFR_EM:
13184                 return Get_0xB1_IsoTableData_EM(ucCmdByte, ucData);
13185 
13186         case FEDM_ISC_ISO_MFR_INFINEON:
13187                 return Get_0xB1_IsoTableData_Infineon(ucCmdByte, ucData);
13188 
13189         case FEDM_ISC_ISO_MFR_FUJITSU:
13190                 return Get_0xB1_IsoTableData_Fujitsu(ucCmdByte, ucData);
13191 
13192         case FEDM_ISC_ISO_MFR_KSW:
13193                 return Get_0xB1_IsoTableData_KSW(ucCmdByte, ucData);
13194 
13195         case FEDM_ISC_ISO_MFR_IDS:
13196                 return Get_0xB1_IsoTableData_IDS(ucCmdByte, ucData);
13197 
13198         }
13199 
13200         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ", Manufacturer=0x" << std::hex << std::uppercase << (int)ucMfr << ") - is not supported");
13201         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13202 }
13203 
13204 /***************************************************************************
13205   Begin                 :       07.10.2009 / M. Hultsch
13206   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
13207 
13208   Function                      :       collects the necessary data for the next [] iso protocol
13209                                                 manufacturer NXP
13210 
13211   Parameters            :       unsigned char ucCmdByte -       iso command byte
13212                                                 unsigned char* ucData   -       pointer to buffer for data
13213 
13214   Return value          :       iCnt (>0) or error code (<0)
13215 ***************************************************************************/
13216 int FEDM_ISCReader::Get_0xB1_IsoTableData_NXP(unsigned char ucCmdByte, unsigned char* ucData)
13217 {
13218         int iCnt = 0;
13219         int iErr = 0;
13220         int iIdx = 0;
13221         unsigned int uiDBAdr=0;
13222 
13223         switch(ucCmdByte)
13224         {
13225         case 0xA0:  // [0xA0] Inventory Read
13226         case 0xA1:  // [0xA1] Fast Inventory Read
13227         case 0xB0:  // [0xB0] Inventory Page Read 
13228         case 0xB1:  // [0xB1] Fast Page Inventory Read 
13229                 ucData[iCnt++] = ucCmdByte;
13230                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13231                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_DB_ADR, &ucData[iCnt++]));
13232                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_DB_N, &ucData[iCnt++]));
13233                 break;
13234 
13235         case 0xA2:      // [0xA2] Set EAS
13236         case 0xA3:      // [0xA3] Reset EAS
13237         case 0xA4:      // [0xA4] Lock EAS
13238         case 0xA5:      // [0xA5] EAS Alarm
13239         case 0xA6:      // [0xA6] Password Protect EAS
13240         case 0xA8:      // [0xA8] Read EPC
13241         case 0xB2:      // [0xB2] Get Random Number
13242         case 0xB9:      // [0xB9] Destroy SLI-S
13243         case 0xBA:      // [0xBA] Enable Privacy
13244                 ucData[iCnt++] = ucCmdByte;
13245                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13246                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13247                 {
13248                         // UID = unified identifier = serial number
13249                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13250                         iCnt += 8;
13251                 }
13252                 break;
13253 
13254         case 0xA7:      // [0xA7] Write EAS ID
13255                 ucData[iCnt++] = ucCmdByte;
13256                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13257                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13258                 {
13259                         // UID = unified identifier = serial number
13260                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13261                         iCnt += 8;
13262                 }
13263                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_EAS_ID, &ucData[iCnt], 2));
13264                 iCnt += 2;
13265                 break;
13266 
13267         case 0xB3:      // [0xB3] Set Password
13268         case 0xB4:      // [0xB4] Write Password
13269                 ucData[iCnt++] = ucCmdByte;
13270                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13271                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13272                 {
13273                         // UID = unified identifier = serial number
13274                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13275                         iCnt += 8;
13276                 }
13277                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PASSWORD_ID, &ucData[iCnt++]));
13278                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PASSWORD, &ucData[iCnt], 4));
13279                 iCnt += 4;
13280                 break;
13281 
13282         case 0xB5:      // [0xB5] Lock Password
13283                 ucData[iCnt++] = ucCmdByte;
13284                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13285                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13286                 {
13287                         // UID = unified identifier = serial number
13288                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13289                         iCnt += 8;
13290                 }
13291                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PASSWORD_ID, &ucData[iCnt++]));
13292                 break;
13293 
13294         case 0xB6:      // [0xB6] Protect Page
13295                 ucData[iCnt++] = ucCmdByte;
13296                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13297                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13298                 {
13299                         // UID = unified identifier = serial number
13300                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13301                         iCnt += 8;
13302                 }
13303                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PAGE_NO, &ucData[iCnt++]));
13304                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PROTECTION_STATUS, &ucData[iCnt++]));
13305                 break;
13306 
13307         case 0xB7:      // [0xB7] Lock Page Protection Condition
13308                 ucData[iCnt++] = ucCmdByte;
13309                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13310                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13311                 {
13312                         // UID = unified identifier = serial number
13313                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13314                         iCnt += 8;
13315                 }
13316                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_PAGE_NO, &ucData[iCnt++]));
13317                 break;
13318 
13319         case 0xB8:      // [0xB8] Get Multiple Bloock Protection Status
13320                 ucData[iCnt++] = ucCmdByte;
13321                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13322                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13323                 {
13324                         // UID = unified identifier = serial number
13325                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13326                         iCnt += 8;
13327                 }
13328                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_DB_ADR, &ucData[iCnt++]));
13329                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_DBN, &ucData[iCnt++]));
13330                 break;
13331 
13332         case 0xBB:      // [0xBB] 64 Bit Password Protection
13333                 ucData[iCnt++] = ucCmdByte;
13334                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13335                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13336                 {
13337                         // UID = unified identifier = serial number
13338                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13339                         iCnt += 8;
13340                 }
13341                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_NXP_64BIT_PWD_PARAMETER, &ucData[iCnt++]));
13342                 break;
13343 
13344         default:
13345                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13346                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13347         }
13348 
13349         return iCnt;
13350 }
13351 
13352 /***************************************************************************
13353   Begin                 :       07.10.2009 / M. Hultsch
13354   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
13355 
13356   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13357                                                 manufacturer TI
13358 
13359   Parameters            :       unsigned char ucCmdByte -       iso command byte
13360                                                 unsigned char* ucData   -       pointer to buffer for data
13361 
13362   Return value          :       iCnt (>0) or error code (<0)
13363 ***************************************************************************/
13364 int FEDM_ISCReader::Get_0xB1_IsoTableData_TI(unsigned char ucCmdByte, unsigned char* ucData)
13365 {
13366         int iCnt = 0;
13367         int iErr = 0;
13368         int iIdx = 0;
13369         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13370         string sUid = "";
13371         unsigned int uiDBAdr=0;
13372         
13373         switch(ucCmdByte)
13374         {
13375         case 0xA2:
13376                 ucData[iCnt++] = ucCmdByte;
13377                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13378                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13379                 {
13380                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13381                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13382                         
13383 
13384                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13385                         if(iIdx < 0)
13386                                 return iIdx;
13387 
13388                         // UID = unified identifier = serial number
13389                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13390                         iCnt += 8;
13391                 }
13392                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_DB_ADR, &ucData[iCnt++]));
13393                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_DB_SIZE, &ucData[iCnt++]));
13394                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_EVEN_DB, &ucData[iCnt], 4));
13395                 iCnt += 4;
13396                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_ODD_DB, &ucData[iCnt], 4));
13397                 iCnt += 4;
13398                 break;
13399 
13400         case 0xA3:
13401                 ucData[iCnt++] = ucCmdByte;
13402                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13403                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13404                 {
13405                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13406                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13407                         
13408 
13409                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13410                         if(iIdx < 0)
13411                                 return iIdx;
13412 
13413                         // UID = unified identifier = serial number
13414                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13415                         iCnt += 8;
13416                 }
13417                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_DB_ADR, &ucData[iCnt++]));
13418                 break;
13419         
13420         case 0xA4:      // [0xA4] Kill (Tag it HF-I Light)
13421                 ucData[iCnt++] = ucCmdByte;
13422                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13423                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13424                 {
13425                         // UID = unified identifier = serial number
13426                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13427                         iCnt += 8;
13428                 }
13429                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_PASSWORD, &ucData[iCnt], 4));
13430                 iCnt += 4;
13431                 break;
13432 
13433         case 0xA5:      // [0xA5] Write Single Block Pwd (Tag it HF-I Light)
13434                 ucData[iCnt++] = ucCmdByte;
13435                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13436                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13437                 {
13438                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13439                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13440                         
13441 
13442                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13443                         if(iIdx < 0)
13444                                 return iIdx;
13445 
13446                         // UID = unified identifier = serial number
13447                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13448                         iCnt += 8;
13449                 }
13450                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_TI_PASSWORD, &ucData[iCnt], 4));
13451                 iCnt += 4;
13452                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_DB_ADR, &ucData[iCnt++]));
13453                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_DB_ADR, &uiDBAdr));
13454                 FEDM_CHK1(iErr, m_ISOTable[iIdx]->GetData(0x24, ucData, iCnt, FEDM_ISC_ISO_BANK_USER_MEMORY, uiDBAdr));
13455                 break;
13456 
13457         default:
13458                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13459                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13460         }
13461 
13462         return iCnt;
13463 }       
13464 
13465 /***************************************************************************
13466   Begin                 :       07.10.2009 / M. Hultsch
13467   Version               :       03.00.17 / 24.11.2009 / M. Hultsch
13468 
13469   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13470                                                 manufacturer STM
13471 
13472   Parameters            :       unsigned char ucCmdByte -       iso command byte
13473                                                 unsigned char* ucData   -       pointer to buffer for data
13474 
13475   Return value          :       iCnt (>0) or error code (<0)
13476 ***************************************************************************/
13477 int FEDM_ISCReader::Get_0xB1_IsoTableData_STM(unsigned char ucCmdByte, unsigned char* ucData)
13478 {
13479         int iCnt = 0;
13480         int iErr = 0;
13481         int iIdx = 0;
13482         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13483         string sUid = "";
13484 
13485         switch(ucCmdByte)
13486         {
13487         case 0xA0: // since V4.05.00: dual support for old LRI512 and new M24LRxxE-R
13488                 ucData[iCnt++] = ucCmdByte;
13489                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13490                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13491                 {
13492                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13493                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13494                         
13495 
13496                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13497                         if(iIdx < 0)
13498                                 return iIdx;
13499 
13500                         // UID = unified identifier = serial number
13501                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13502                         iCnt += 8;
13503                 }
13504                 break;
13505 
13506         case 0xA1: // since V4.05.00: removed support for old LRI512, new support for M24LRxxE-R
13507                 ucData[iCnt++] = ucCmdByte;
13508                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13509                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13510                 {
13511                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13512                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13513                         
13514 
13515                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13516                         if(iIdx < 0)
13517                                 return iIdx;
13518 
13519                         // UID = unified identifier = serial number
13520                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13521                         iCnt += 8;
13522                 }
13523                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_DATA, &ucData[iCnt++]));
13524                 break;
13525 
13526         case 0xA2: // since V4.05.00: removed support for old LRI512, new support for M24LRxxE-R
13527                 ucData[iCnt++] = ucCmdByte;
13528                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13529                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13530                 {
13531                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13532                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13533                         
13534 
13535                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13536                         if(iIdx < 0)
13537                                 return iIdx;
13538 
13539                         // UID = unified identifier = serial number
13540                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13541                         iCnt += 8;
13542                 }
13543                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_DATA, &ucData[iCnt++]));
13544                 break;
13545 
13546         case 0xA3:
13547                 ucData[iCnt++] = ucCmdByte;
13548                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13549                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13550                 {
13551                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13552                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13553                         
13554 
13555                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13556                         if(iIdx < 0)
13557                                 return iIdx;
13558 
13559                         // UID = unified identifier = serial number
13560                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13561                         iCnt += 8;
13562                 }
13563                 break;
13564 
13565         case 0xA4:
13566                 ucData[iCnt++] = ucCmdByte;
13567                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13568                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13569                 {
13570                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13571                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13572                         
13573 
13574                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13575                         if(iIdx < 0)
13576                                 return iIdx;
13577 
13578                         // UID = unified identifier = serial number
13579                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13580                         iCnt += 8;
13581                 }
13582                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_DATA, &ucData[iCnt++]));
13583                 break;
13584 
13585         case 0xA6:
13586                 ucData[iCnt++] = ucCmdByte;
13587                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13588                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13589                 {
13590                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13591                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13592                         
13593 
13594                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13595                         if(iIdx < 0)
13596                                 return iIdx;
13597 
13598                         // UID = unified identifier = serial number
13599                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13600                         iCnt += 8;
13601                 }
13602                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_KILL_CODE, &ucData[iCnt], 4));
13603                 iCnt += 4;
13604                 break;
13605 
13606         case 0xB1:
13607                 ucData[iCnt++] = ucCmdByte;
13608                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13609                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13610                 {
13611                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13612                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13613                         
13614 
13615                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13616                         if(iIdx < 0)
13617                                 return iIdx;
13618 
13619                         // UID = unified identifier = serial number
13620                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13621                         iCnt += 8;
13622                 }
13623                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_PASSWORD_NO, &ucData[iCnt++]));
13624                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_PASSWORD, &ucData[iCnt], 4));
13625                 iCnt += 4;
13626                 break;
13627 
13628         case 0xB2:
13629                 ucData[iCnt++] = ucCmdByte;
13630                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13631                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13632                 {
13633                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13634                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13635                         
13636 
13637                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13638                         if(iIdx < 0)
13639                                 return iIdx;
13640 
13641                         // UID = unified identifier = serial number
13642                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13643                         iCnt += 8;
13644                 }
13645                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_INFO_BYTE, &ucData[iCnt++]));
13646                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_BLOCK_NO, &ucData[iCnt++]));
13647                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_PROTECT_STATUS, &ucData[iCnt++]));
13648                 break ;
13649 
13650         case 0xB3:
13651                 ucData[iCnt++] = ucCmdByte;
13652                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13653                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13654                 {
13655                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13656                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13657                         
13658 
13659                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13660                         if(iIdx < 0)
13661                                 return iIdx;
13662 
13663                         // UID = unified identifier = serial number
13664                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13665                         iCnt += 8;
13666                 }
13667                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_PASSWORD_NO, &ucData[iCnt++]));
13668                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_STM_PASSWORD, &ucData[iCnt], 4));
13669                 iCnt += 4;
13670                 break;
13671 
13672         default:
13673                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13674                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13675         }
13676 
13677         return iCnt;
13678 }
13679 
13680 /***************************************************************************
13681   Begin                 :       07.10.2009 / M. Hultsch
13682   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
13683 
13684   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13685                                                 manufacturer Infineon
13686 
13687   Parameters            :       unsigned char ucCmdByte -       iso command byte
13688                                                 unsigned char* ucData   -       pointer to buffer for data
13689 
13690   Return value          :       iCnt (>0) or error code (<0)
13691 ***************************************************************************/
13692 int FEDM_ISCReader::Get_0xB1_IsoTableData_Infineon(unsigned char ucCmdByte, unsigned char* ucData)
13693 {
13694         int iCnt = 0;
13695         int iErr = 0;
13696         int iIdx = 0;
13697         unsigned char ucBlockCnt = 0;
13698         unsigned char ucDBAdr = 0;
13699         unsigned char ucDBSize = 0;
13700         unsigned char ucDBN             = 0x00;
13701         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13702         string sUid = "";
13703 
13704         switch(ucCmdByte)
13705         {
13706         case 0x90:
13707         case 0x10:
13708                 ucData[iCnt++] = ucCmdByte;
13709                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13710                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13711                 {
13712                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13713                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13714 
13715                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13716                         if(iIdx < 0)
13717                                 return iIdx;
13718 
13719                         // UID = unified identifier = serial number
13720                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13721                         iCnt += 8;
13722                 }
13723                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_ADR, &ucData[iCnt++]));
13724                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_N, &ucData[iCnt++]));
13725                 break;
13726 
13727         case 0x30:
13728                 ucData[iCnt++] = ucCmdByte;
13729                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13730                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13731                 {
13732                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13733                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13734 
13735                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13736                         if(iIdx < 0)
13737                                 return iIdx;
13738 
13739                         // UID = unified identifier = serial number
13740                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13741                         iCnt += 8;
13742                 }
13743                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_ADR, &ucData[iCnt++]));
13744                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_ADR, &ucDBAdr));
13745                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_N, &ucData[iCnt++]));
13746                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_N, &ucDBN));
13747                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_SIZE, &ucData[iCnt++]));
13748                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_SIZE, &ucDBSize));
13749 
13750                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[ucDBAdr * ucDBSize], ucDBN * ucDBSize);
13751                 iCnt += (unsigned int)(ucDBN * ucDBSize);
13752                 break;
13753 
13754         case 0xAB:
13755                 ucData[iCnt++] = ucCmdByte;
13756                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13757                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13758                 {
13759                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13760                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13761 
13762                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13763                         if(iIdx < 0)
13764                                 return iIdx;
13765 
13766                         // UID = unified identifier = serial number
13767                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13768                         iCnt += 8;
13769                 }
13770                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_AQM, &ucData[iCnt++]));
13771                 break;
13772 
13773         default:
13774                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13775                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13776         }
13777 
13778         return iCnt;
13779 }
13780 /***************************************************************************
13781   Begin                 :       07.10.2009 / M. Hultsch
13782   Version               :       03.00.13 / 08.10.2009 / M. Hultsch
13783 
13784   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13785                                                 manufacturer EM
13786 
13787   Parameters            :       unsigned char ucCmdByte -       iso command byte
13788                                                 unsigned char* ucData   -       pointer to buffer for data
13789 
13790   Return value          :       iCnt (>0) or error code (<0)
13791 ***************************************************************************/
13792 int FEDM_ISCReader::Get_0xB1_IsoTableData_EM(unsigned char ucCmdByte, unsigned char* ucData)
13793 {
13794         int iCnt = 0;
13795         int iErr = 0;
13796         int iIdx = 0;
13797         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13798         string sUid = "";
13799         switch(ucCmdByte)
13800         {
13801         case 0xA0:
13802                 ucData[iCnt++] = ucCmdByte;
13803                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13804                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_EM_PASSWORD, &ucData[iCnt], 4));
13805                 iCnt += 4;
13806                 break;
13807 
13808         case 0xE4:
13809                 ucData[iCnt++] = ucCmdByte;
13810                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13811                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13812                 {
13813                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13814                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13815 
13816                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13817                         if(iIdx < 0)
13818                                 return iIdx;
13819 
13820                         // UID = unified identifier = serial number
13821                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13822                         iCnt += 8;
13823                 }
13824                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_EM_PASSWORD, &ucData[iCnt], 4));
13825                 iCnt += 4;
13826                 break;
13827 
13828         default:
13829                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13830                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13831         }
13832 
13833         return iCnt;
13834 }
13835 /***************************************************************************
13836   Begin                 :       07.10.2009 / M. Hultsch
13837   Version               :       03.00.13 / 08.10.2009 / M. Hultsch
13838 
13839   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13840                                                 manufacturer FUJITSU
13841 
13842   Parameters            :       unsigned char ucCmdByte -       iso command byte
13843                                                 unsigned char* ucData   -       pointer to buffer for data
13844 
13845   Return value          :       iCnt (>0) or error code (<0)
13846 ***************************************************************************/
13847 int FEDM_ISCReader::Get_0xB1_IsoTableData_Fujitsu(unsigned char ucCmdByte, unsigned char* ucData)
13848 {
13849         int iCnt = 0;
13850         int iErr = 0;
13851         int iIdx = 0;
13852         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13853         string sUid = "";
13854         unsigned int uiDBAdr=0;
13855         
13856         switch(ucCmdByte)
13857         {
13858         case 0xA0:
13859                 ucData[iCnt++] = ucCmdByte;
13860                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13861                 break;
13862 
13863         case 0xA1:
13864                 ucData[iCnt++] = ucCmdByte;
13865                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13866                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13867                 {
13868                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13869                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13870 
13871                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13872                         if(iIdx < 0) 
13873                                 return iIdx;
13874 
13875                         // UID = unified identifier = serial number
13876                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13877                         iCnt += 8;
13878                 }
13879                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_FUJITSU_DATA, &ucData[iCnt++]));
13880                 break;
13881 
13882         case 0xA2:
13883         case 0xA6:
13884                 ucData[iCnt++] = ucCmdByte;
13885                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13886                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13887                 {
13888                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13889                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13890 
13891                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13892                         if(iIdx < 0)
13893                                 return iIdx;
13894 
13895                         // UID = unified identifier = serial number
13896                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13897                         iCnt += 8;
13898                 }
13899                 break;
13900 
13901         default:
13902                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13903                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13904         }
13905 
13906         return iCnt;
13907 }
13908 
13909 /***************************************************************************
13910   Begin                 :       07.10.2009 / M. Hultsch
13911   Version               :       03.00.13 / 08.10.2009 / M. Hultsch
13912 
13913   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13914                                                 manufacturer KSW
13915 
13916   Parameters            :       unsigned char ucCmdByte -       iso command byte
13917                                                 unsigned char* ucData   -       pointer to buffer for data
13918 
13919   Return value          :       iCnt (>0) or error code (<0)
13920 ***************************************************************************/
13921 int FEDM_ISCReader::Get_0xB1_IsoTableData_KSW(unsigned char ucCmdByte, unsigned char* ucData)
13922 {
13923         int iCnt = 0;
13924         int iErr = 0;
13925         int iIdx = 0;
13926         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
13927         string sUid = "";
13928         unsigned int uiDBAdr=0;
13929         
13930         switch(ucCmdByte)
13931         {
13932         case 0xA2:
13933         case 0xA3:
13934                 ucData[iCnt++] = ucCmdByte;
13935                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13936                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13937                 {
13938                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13939                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13940 
13941                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13942                         if(iIdx < 0)
13943                                 return iIdx;
13944 
13945                         // UID = unified identifier = serial number
13946                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13947                         iCnt += 8;
13948                 }
13949                 break;
13950 
13951         case 0xA4:
13952         case 0xA5:
13953                 ucData[iCnt++] = ucCmdByte;
13954                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
13955                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
13956                 {
13957                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucUid[0], 8));
13958                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], 8, sUid));
13959 
13960                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
13961                         if(iIdx < 0)
13962                                 return iIdx;
13963 
13964                         // UID = unified identifier = serial number
13965                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
13966                         iCnt += 8;
13967                 }
13968                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_KSW_PASSWORD, &ucData[iCnt], 6));
13969                 iCnt += 6;
13970                 break;
13971 
13972         default:
13973                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
13974                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
13975         }
13976 
13977         return iCnt;
13978 }
13979 
13980 /***************************************************************************
13981   Begin                 :       31.03.2011 / M. Hultsch
13982   Version               :       03.03.01 / 31.03.2011 / M. Hultsch
13983 
13984   Function                      :       collects the necessary data for the next [0xB1] iso protocol
13985                                                 manufacturer IDS Microchip AG
13986 
13987   Parameters            :       unsigned char ucCmdByte -       iso command byte
13988                                                 unsigned char* ucData   -       pointer to buffer for data
13989 
13990   Return value          :       iCnt (>0) or error code (<0)
13991 ***************************************************************************/
13992 int FEDM_ISCReader::Get_0xB1_IsoTableData_IDS(unsigned char ucCmdByte, unsigned char* ucData)
13993 {
13994         int iCnt = 0;
13995         int iErr = 0;
13996         
13997         switch(ucCmdByte)
13998         {
13999         case 0xA0:
14000                 ucData[iCnt++] = ucCmdByte;
14001                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14002                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14003                 {
14004                         // UID = unified identifier = serial number
14005                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14006                         iCnt += 8;
14007                 }
14008                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_PASSWORD_LEVEL, &ucData[iCnt++]));
14009                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_PASSWORD, &ucData[iCnt], 4));
14010                 iCnt += 4;
14011                 break;
14012 
14013         case 0xA1:
14014                 ucData[iCnt++] = ucCmdByte;
14015                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14016                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14017                 {
14018                         // UID = unified identifier = serial number
14019                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14020                         iCnt += 8;
14021                 }
14022                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_LOG_MODE, &ucData[iCnt], 4));
14023                 iCnt += 4;
14024                 break;
14025 
14026         case 0xA2:
14027                 ucData[iCnt++] = ucCmdByte;
14028                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14029                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14030                 {
14031                         // UID = unified identifier = serial number
14032                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14033                         iCnt += 8;
14034                 }
14035                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_LOG_LIMITS, &ucData[iCnt], 4));
14036                 iCnt += 4;
14037                 break;
14038 
14039         case 0xA3:
14040                 ucData[iCnt++] = ucCmdByte;
14041                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14042                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14043                 {
14044                         // UID = unified identifier = serial number
14045                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14046                         iCnt += 8;
14047                 }
14048                 break;
14049 
14050         case 0xA4:
14051                 ucData[iCnt++] = ucCmdByte;
14052                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14053                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14054                 {
14055                         // UID = unified identifier = serial number
14056                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14057                         iCnt += 8;
14058                 }
14059                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_EXT_CAL_DATA, &ucData[iCnt], 4));
14060                 iCnt += 4;
14061                 break;
14062 
14063         case 0xA5:
14064                 ucData[iCnt++] = ucCmdByte;
14065                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14066                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14067                 {
14068                         // UID = unified identifier = serial number
14069                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14070                         iCnt += 8;
14071                 }
14072                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_INT_CAL_DATA, &ucData[iCnt], 4));
14073                 iCnt += 4;
14074                 break;
14075 
14076         case 0xA6:
14077                 ucData[iCnt++] = ucCmdByte;
14078                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14079                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14080                 {
14081                         // UID = unified identifier = serial number
14082                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14083                         iCnt += 8;
14084                 }
14085                 break;
14086 
14087         case 0xA7:
14088                 ucData[iCnt++] = ucCmdByte;
14089                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14090                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14091                 {
14092                         // UID = unified identifier = serial number
14093                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14094                         iCnt += 8;
14095                 }
14096                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_START_TIME, &ucData[iCnt], 4));
14097                 iCnt += 4;
14098                 break;
14099 
14100         case 0xA8:
14101         case 0xA9:
14102         case 0xAA:
14103                 ucData[iCnt++] = ucCmdByte;
14104                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14105                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14106                 {
14107                         // UID = unified identifier = serial number
14108                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14109                         iCnt += 8;
14110                 }
14111                 break;
14112 
14113         case 0xAB:
14114                 ucData[iCnt++] = ucCmdByte;
14115                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14116                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14117                 {
14118                         // UID = unified identifier = serial number
14119                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14120                         iCnt += 8;
14121                 }
14122                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_PASSWORD_LEVEL, &ucData[iCnt++]));
14123                 break;
14124 
14125         case 0xAC:
14126                 ucData[iCnt++] = ucCmdByte;
14127                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14128                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14129                 {
14130                         // UID = unified identifier = serial number
14131                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14132                         iCnt += 8;
14133                 }
14134                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB1_REQ_IDS_INIT_DATA, &ucData[iCnt], 4));
14135                 iCnt += 4;
14136                 break;
14137 
14138         case 0xAD:
14139                 ucData[iCnt++] = ucCmdByte;
14140                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucData[iCnt++]));
14141                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14142                 {
14143                         // UID = unified identifier = serial number
14144                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, &ucData[iCnt], 8));
14145                         iCnt += 8;
14146                 }
14147                 break;
14148 
14149         default:
14150                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
14151                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
14152         }
14153 
14154         return iCnt;
14155 }
14156 
14157 /***************************************************************************
14158   Begin                 :       28.07.2005 / M. Hultsch
14159   Version               :       03.00.07 / 05.05.2009 / M. Hultsch
14160 
14161   Function                      :       collects the necessary data for the next [0xB2] iso protocol
14162 
14163   Parameters            :       unsigned char ucCmdByte -       iso command byte
14164                                                 unsigned char* ucData   -       pointer to buffer for data
14165 
14166   Return value          :       iCnt (>0) or error code (<0)
14167 ***************************************************************************/
14168 int FEDM_ISCReader::Get_0xB2_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData)
14169 {
14170         FEDM_CHK3(ucData);
14171 
14172         bool bKL = false;
14173         int iCnt = 0;
14174         int iErr;
14175 
14176         switch(ucCmdByte)
14177         {
14178         case 0x2B:      // [0x2B] ISO14443-4 Transponder Info
14179                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucData[iCnt++]));
14180                 break;
14181 
14182         case 0x30:      // [0x30] Mifare Value Commands
14183                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucData[iCnt++]));
14184                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_MODE, &ucData[iCnt++]));
14185                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_MF_CMD, &ucData[iCnt++]));
14186                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_DB_ADR, &ucData[iCnt++]));
14187                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_OP_VALUE, &ucData[iCnt], 4));
14188                 iCnt += 4;
14189                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_DEST_ADR, &ucData[iCnt++]));
14190                 break;
14191 
14192         case 0xB0:      // [0xB0] Authent Mifare
14193                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_MODE_KL, &bKL));
14194                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucData[iCnt++]));
14195                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_MODE, &ucData[iCnt++]));
14196                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_DB_ADR, &ucData[iCnt++]));
14197                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_TYPE, &ucData[iCnt++]));
14198                 if(bKL)
14199                 {
14200                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_ISO14443A_KEY, &ucData[iCnt], 6));
14201                         iCnt += 6;
14202                 }
14203                 else
14204                 {
14205                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_ADR, &ucData[iCnt++]));
14206                 }
14207                 break;
14208 
14209         case 0xB1:      // [0xB1] Authent my-d
14210                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucData[iCnt++]));
14211                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_MODE, &ucData[iCnt++]));
14212                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14213                 {
14214                         // UID = unified identifier = serial number
14215                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_UID, &ucData[iCnt], 8));
14216                         iCnt += 8;
14217                 }
14218                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_ADR_TAG, &ucData[iCnt++]));
14219                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_AUTH_COUNTER_ADR, &ucData[iCnt++]));
14220                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_AUTH_SEQUENCE, &ucData[iCnt++]));
14221                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_ADR_SAM, &ucData[iCnt++]));
14222                 // reserved bytes
14223                 ucData[iCnt++] = 0;
14224                 ucData[iCnt++] = 0;
14225                 ucData[iCnt++] = 0;
14226                 ucData[iCnt++] = 0;
14227                 ucData[iCnt++] = 0;
14228                 ucData[iCnt++] = 0;
14229                 break;
14230 
14231         case 0xB2:      // [0xB2] Authent Mifare Ultralight C
14232                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucData[iCnt++]));
14233                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_MODE, &ucData[iCnt++]));
14234                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_REQ_KEY_INDEX, &ucData[iCnt++]));
14235                 break;
14236 
14237         default:
14238                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") - is not supported");
14239                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
14240         }
14241 
14242         return iCnt;
14243 }
14244 
14245 /***************************************************************************
14246   Begin                 :       08.03.2001 / M. Hultsch
14247   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
14248                                                 - only for EPC Class1 Gen2:
14249                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
14250 
14251                                                 04.02.00 / 11.05.2012 / M. Hultsch
14252                                                 - only for EPC Class1 Gen2:
14253                                                   if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
14254 
14255                                                 03.03.04 / 21.06.2011 / M. Hultsch
14256                                                 - only for EPC Class1 Gen2:
14257                                                   if Reader is configured for UID = EPC + TID, set TID as UID for next request in addressed mode
14258 
14259                                                 03.00.13 / 07.10.2009 / M. Hultsch
14260 
14261   Function                      :       collects the necessary data for the next [0xB0][0x24] iso protocol
14262 
14263   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
14264 
14265   Return value          :       iCnt (>0) or error code (<0)
14266 
14267 ***************************************************************************/
14268 int FEDM_ISCReader::Get_0xB0_0x24_IsoTableData(unsigned char* ucData)
14269 {
14270         FEDM_CHK3(ucData);
14271 
14272         bool bUidLF = false;
14273         bool bExtAdr = false;
14274         bool bAccessPw = false;
14275         int iCnt = 0;
14276         int iIdx, iErr, iBlockCnt;
14277         unsigned char ucBank    = 0x03; // User Memory Bank
14278         unsigned char ucDBN             = 0x00;
14279         unsigned char ucBlockSize = 0x04;
14280         unsigned char ucUidLen  = 0x00;
14281         unsigned char ucEpcLen  = 0x00;
14282         unsigned char ucLen             = 0x00;
14283         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
14284         unsigned int uiDBAdr    = 0;
14285         string sUid = "";
14286 
14287         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
14288         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
14289 
14290         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
14291         {
14292                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
14293         }
14294         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
14295         {
14296                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_UID_LF, &bUidLF));
14297                 if(bUidLF)
14298                 {
14299                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID_LEN, &ucUidLen));
14300                 }
14301                 else
14302                 {
14303                         ucUidLen = 8;
14304                 }
14305 
14306                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucUid[0], (int)ucUidLen));
14307                 FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
14308                 
14309                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
14310                 if(iIdx < 0)
14311                         return iIdx;
14312 
14313                 // only for UHF EPC Class1 Gen2
14314                 if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
14315                         m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
14316                 {
14317                         // check, if Reader is configured for UID = EPC + TID
14318                         if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
14319                         {
14320                                 // check, if response contains UID = EPC + TID
14321                                 ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
14322                                 if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
14323                                         ucEpcLen -= 2;
14324 
14325                                 if( ucEpcLen < ucUidLen)
14326                                 {
14327                                         // take TID as UID for next request
14328                                         if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
14329                                                 ucData[iCnt++] = (ucUidLen - ucEpcLen);
14330                                         
14331                                         memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
14332                                         iCnt += (ucUidLen - ucEpcLen);
14333                                 }
14334                                 else
14335                                 {
14336                                         // error in the Reader response: TID is missing
14337                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
14338                                         return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
14339                                 }
14340                         }
14341                         else
14342                         {
14343                                 if(bUidLF || (ucUidLen != 8))
14344                                         ucData[iCnt++] = ucUidLen;
14345 
14346                                 // UID = unified identifier = serial number
14347                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], ucUidLen));
14348                                 iCnt += ucUidLen;
14349                         }
14350                 }
14351                 else
14352                 {
14353                         if(bUidLF)      // variable UID length
14354                         {
14355                                 ucData[iCnt++] = ucUidLen;
14356                                 // UID = unified identifier = serial number
14357                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], ucUidLen));
14358                                 iCnt += ucUidLen;
14359                         }
14360                         else
14361                         {
14362                                 // UID = unified identifier = serial number
14363                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
14364                                 iCnt += 8;
14365                         }
14366                 }
14367         }
14368         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_SEL)       // selected
14369         {
14370                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
14371                 if(iIdx < 0)
14372                 {
14373                         // exception for ISO 14443 Transponder, when Reader is configuered with Anticollision = off
14374                         if(  m_uiISOTableLength == 1 && (m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A || m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B) )
14375                                 iIdx = 0;
14376                         else
14377                                 return iIdx;
14378                 }
14379         }
14380         else
14381         {
14382                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
14383                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
14384         }
14385 
14386         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
14387         if(bExtAdr)
14388         {
14389                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK, &ucData[iCnt++]));
14390                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK_BANK_NR, &ucBank));
14391                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK_ACCESS_FLAG, &bAccessPw));
14392                 if(bAccessPw)
14393                 {
14394                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_ACCESS_PW_LENGTH, &ucLen));
14395                         ucData[iCnt++] = ucLen;
14396                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_ACCESS_PW, &ucData[iCnt], ucLen));
14397                         iCnt += ucLen;
14398                 }
14399                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
14400                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &uiDBAdr));
14401                 iCnt += 2;
14402         }
14403         else
14404         {
14405                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &ucData[iCnt++]));
14406                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &uiDBAdr));
14407         }
14408 
14409         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DBN, &ucData[iCnt++]));
14410         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DBN, &ucDBN));
14411         
14412 
14413         // take the blocksize from table
14414         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
14415         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_REQ_DB_SIZE, ucBlockSize));
14416         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_SIZE, &ucData[iCnt++]));
14417 
14418         // avoid buffer overflow
14419         if( (5+iCnt+ucDBN*ucBlockSize) > FEDM_MAX_PROTOCOL_SIZE)        //    5 : general protocol frame
14420                                                                                                                                 // iCnt : [0x24] protocol frame
14421         {
14422                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_SENDBUFFER_OVERFLOW));
14423                 return FEDM_ERROR_SENDBUFFER_OVERFLOW;
14424         }
14425 
14426         for(iBlockCnt=0; iBlockCnt<ucDBN; iBlockCnt++)
14427         {
14428                 FEDM_CHK1(iErr, m_ISOTable[iIdx]->GetData(0x24, ucData, iCnt, ucBank, uiDBAdr));
14429                 uiDBAdr++;
14430         }
14431 
14432         return iCnt;
14433 }
14434 
14435 /***************************************************************************
14436   Begin                 :       19.03.2001 / M. Hultsch
14437   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
14438 
14439   Function                      :       collects the necessary data for the next [0xB0][0x27] iso protocol
14440 
14441   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
14442 
14443   Return value          :       iCnt (>0) or error code (<0)
14444 
14445 ***************************************************************************/
14446 int FEDM_ISCReader::Get_0xB0_0x27_IsoTableData(unsigned char* ucData)
14447 {
14448         FEDM_CHK3(ucData);
14449 
14450         int iCnt = 0;
14451         int iIdx = 0;
14452         int iErr = 0;
14453         string sSnr, tmp;
14454 
14455         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
14456         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
14457 
14458         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
14459         {
14460                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
14461         }
14462         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
14463         {
14464                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
14465                 sSnr = tmp.substr(0, 16);
14466                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
14467                 if(iIdx < 0)
14468                         return iIdx;
14469 
14470                 // UID = unified identifier = serial number
14471                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
14472                 iCnt += 8;
14473         }
14474         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_SEL)       // selected
14475         {
14476                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
14477                 if(iIdx < 0)
14478                 {
14479                         // exception for ISO 14443 Transponder, when Reader is configuered with Anticollision = off
14480                         if(  m_uiISOTableLength == 1 && (m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A || m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B) )
14481                                 iIdx = 0;
14482                         else
14483                                 return iIdx;
14484                 }
14485         }
14486         else
14487         {
14488                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
14489                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
14490         }
14491 
14492         ucData[iCnt++] = m_ISOTable[iIdx]->m_ucAFI;
14493 
14494         return iCnt;
14495 }
14496 
14497 /***************************************************************************
14498   Begin                 :       19.03.2001 / M. Hultsch
14499   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
14500 
14501   Function                      :       collects the necessary data for the next [0xB0][0x29] iso protocol
14502 
14503   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
14504 
14505   Return value          :       iCnt (>0) or error code (<0)
14506 
14507 ***************************************************************************/
14508 int FEDM_ISCReader::Get_0xB0_0x29_IsoTableData(unsigned char* ucData)
14509 {
14510         FEDM_CHK3(ucData);
14511 
14512         int iCnt = 0;
14513         int iIdx = 0;
14514         int iErr = 0;
14515         string sSnr, tmp;
14516 
14517         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
14518         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
14519 
14520         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
14521         {
14522                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
14523         }
14524         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
14525         {
14526                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
14527                 sSnr = tmp.substr(0, 16);
14528                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
14529                 if(iIdx < 0)
14530                         return iIdx;
14531 
14532                 // UID = unified identifier = serial number
14533                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
14534                 iCnt += 8;
14535         }
14536         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_SEL)       // selected
14537         {
14538                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
14539                 if(iIdx < 0)
14540                 {
14541                         // exception for ISO 14443 Transponder, when Reader is configuered with Anticollision = off
14542                         if(  m_uiISOTableLength == 1 && (m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A || m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B) )
14543                                 iIdx = 0;
14544                         else
14545                                 return iIdx;
14546                 }
14547         }
14548         else
14549         {
14550                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
14551                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
14552         }
14553 
14554         ucData[iCnt++] = m_ISOTable[iIdx]->m_ucDsfID;
14555 
14556         return iCnt;
14557 }
14558 
14559 /***************************************************************************
14560   Begin                 :       17.07.2001 / M. Hultsch
14561   Version               :       02.03.01 / 23.08.2005 / M. Hultsch
14562 
14563   Function                      :       collects the necessary data for the next [0xB0][0xA1] iso protocol
14564 
14565   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
14566 
14567   Return value          :       iCnt (>0) or error code (<0)
14568 
14569 ***************************************************************************/
14570 int FEDM_ISCReader::Get_0xB0_0xA1_IsoTableData(unsigned char* ucData)
14571 {
14572         FEDM_CHK3(ucData);
14573 
14574         int iCnt = 0;
14575         int iIdx = 0;
14576         int iErr = 0;
14577         unsigned char ucCBAdr   = 0x00;
14578         unsigned char ucMode    = 0x00;
14579         string sSnr, tmp;
14580 
14581 
14582         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
14583         // only addressed supported
14584         if((unsigned char)(ucMode&0x07) != FEDM_ISC_ISO_MODE_ADR)
14585         {
14586                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
14587                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
14588         }
14589 
14590         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucData[iCnt++]));
14591         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucData[iCnt++]));
14592         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
14593         {
14594                 // UID = unified identifier = serial number
14595 
14596                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, &ucData[iCnt], 8));
14597                 iCnt += 8;
14598         }
14599         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_CB_ADR, &ucData[iCnt++]));
14600         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_CB_ADR, &ucCBAdr));
14601 
14602         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
14603         sSnr = tmp.substr(0, 16);
14604         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
14605         if(iIdx < 0)
14606                 return iIdx;
14607         
14608         FEDM_CHK1(iErr, m_ISOTable[iIdx]->GetData(0xA1, ucData, iCnt, 0, (unsigned int)ucCBAdr ));
14609 
14610         return iCnt;
14611 }
14612 
14613 
14614 /***************************************************************************
14615   Begin                 :       08.06.2000 / M. Hultsch
14616   Version               :       03.00.00 / 03.09.2007 / M. Hultsch
14617 
14618   Function                      :       sets the received data of last [0xB0] iso protocol
14619                                                 into iso-table
14620 
14621   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
14622                                                 int iLen                -       length of data
14623                                                 int iStatusByte -       status byte of receive protocol
14624 
14625   Return value          :       OK (=0) or error code (<0)
14626 
14627 ***************************************************************************/
14628 int FEDM_ISCReader::Set_0xB0_IsoTableData(unsigned char* ucData, int iLen, int iStatusByte)
14629 {
14630         FEDM_CHK3(ucData);
14631 
14632         if(m_ISOTable.size() <= 0)
14633         {
14634                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
14635                 return FEDM_ERROR_NO_TABLE_SIZE;
14636         }
14637 
14638         bool bCardInfo = false;
14639         unsigned char   ucCmd   = 0x00;
14640         int iByteCnt = 0;
14641         int     iCnt = 0;
14642         int iErr = 0;
14643         int iIdx = 0;
14644         string sSnr, tmp;
14645 
14646         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_CMD, &ucCmd));
14647 
14648         switch(ucCmd)
14649         {
14650         case 0x01:      // [0x01] Read Serial Number
14651                 if(iLen <= 0)
14652                 {
14653                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DATASETS, (unsigned char)0));
14654                         if(     iStatusByte == 0x83 || 
14655                                 iStatusByte == 0x84)
14656                         {
14657                                 return iStatusByte;
14658                         }
14659                         else
14660                         {
14661                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_DATA));
14662                                 return FEDM_ERROR_NO_DATA;
14663                         }
14664                 }
14665 
14666                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DATASETS, ucData[iByteCnt++]));
14667 
14668                 // add new items to table
14669                 for(iCnt=0; iCnt<ucData[0]; iCnt++)
14670                 {
14671                         if(m_uiISOTableLength >= m_ISOTable.size())
14672                         {
14673                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
14674                                 return FEDM_ERROR_ARRAY_BOUNDARY;
14675                         }
14676 
14677                         FEDM_CHK1(iErr, m_ISOTable[m_uiISOTableLength]->SetData(0x01, &ucData[0], iByteCnt));
14678                         m_uiISOTableLength++;
14679                 }
14680 
14681                 // reset selected flags in the table
14682                 for(iIdx=0; iIdx<(int)m_uiISOTableLength; iIdx++)
14683                         m_ISOTable[iIdx]->m_bIsSelected = false;
14684 
14685                 break;
14686 
14687         case 0x02:      // [0x02] Stay Quiet
14688                 // search serial number in iso-table
14689                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
14690                 sSnr = tmp.substr(0, 16);
14691                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
14692                 if(iIdx >= 0)
14693                         m_ISOTable[iIdx]->m_bIsSelected = false; // reset selection
14694 
14695                 break;
14696 
14697         case 0x22:      // [0x22] Lock Multiple Blocks
14698                 break;
14699         
14700         case 0x23:      // [0x23] Read Multiple Blocks
14701                 FEDM_CHK1(iErr, Set_0xB0_0x23_IsoTableData(ucData, iLen));
14702                 break;
14703 
14704         case 0x24:      // [0x24] Write Multiple Blocks
14705                 break;
14706 
14707         case 0x25:      // [0x25] Select
14708                 FEDM_CHK1(iErr, Set_0xB0_0x25_IsoTableData(ucData, iLen));
14709                 break;
14710 
14711         case 0x26:      // [0x26] Reset to Ready
14712                 FEDM_CHK1(iErr, Set_0xB0_0x26_IsoTableData(ucData, iLen));
14713                 break;
14714 
14715         case 0x27:      // [0x27] Write AFI
14716         case 0x28:      // [0x28] Lock AFI
14717         case 0x29:      // [0x29] Write DSFID
14718         case 0x2A:      // [0x2A] Lock DSFID
14719                 break;
14720         
14721         case 0x2B:      // [0x2B] Get System Information
14722                 FEDM_CHK1(iErr, Set_0xB0_0x2B_IsoTableData(ucData, iLen, iStatusByte));
14723                 break;
14724         
14725         case 0x2C:      // [0x2C] Get Multiple Block Security Status
14726                 if(iLen == 0)
14727                         return iStatusByte;
14728 
14729                 FEDM_CHK1(iErr, Set_0xB0_0x2C_IsoTableData(ucData, iLen));
14730                 break;
14731         
14732         case 0xA0:      // [0xA0] Read Config Block
14733                 FEDM_CHK1(iErr, Set_0xB0_0xA0_IsoTableData(ucData, iLen));
14734                 break;
14735 
14736         case 0xA1:      // [0xA1] Write Config Block
14737                 break;
14738         
14739         case 0xC0:      // [0xC0] Halt
14740                 break;
14741 
14742         default:
14743                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
14744                 return FEDM_ERROR_UNSUPPORTED;
14745         }
14746 
14747         return FEDM_OK;
14748 }
14749 
14750 
14751 /***************************************************************************
14752   Begin                 :       06.11.2006 / M. Hultsch
14753   Version               :       03.03.01 / 31.03.2011 / M. Hultsch
14754 
14755   Function                      :       sets the received data of last [0xB1] iso protocol
14756                                                 into iso-table
14757 
14758   Parameters            :       unsigned char ucCmdByte - command byte
14759                                                 unsigned char* ucData   -       pointer to buffer with data
14760                                                 int iLen                -       length of data
14761 
14762   Return value          :       OK (=0) or error code (<0)
14763 ***************************************************************************/
14764 int FEDM_ISCReader::Set_0xB1_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
14765 {
14766         FEDM_CHK3(ucData);
14767 
14768         int iErr = 0;
14769         unsigned char ucMfr     = 0x00;
14770 
14771         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MFR, &ucMfr));
14772 
14773         switch(ucMfr)
14774         {
14775         case FEDM_ISC_ISO_MFR_NXP:
14776                 return Set_0xB1_IsoTableData_NXP(ucCmdByte, ucData, iLen);
14777                 
14778         case FEDM_ISC_ISO_MFR_TI:
14779                 return Set_0xB1_IsoTableData_TI(ucCmdByte, ucData, iLen);
14780 
14781         case FEDM_ISC_ISO_MFR_STM:
14782                 return Set_0xB1_IsoTableData_STM(ucCmdByte, ucData, iLen);
14783 
14784         case FEDM_ISC_ISO_MFR_EM:
14785                 return Set_0xB1_IsoTableData_EM(ucCmdByte, ucData, iLen);
14786 
14787         case FEDM_ISC_ISO_MFR_INFINEON:
14788                 return Set_0xB1_IsoTableData_Infineon(ucCmdByte, ucData, iLen);
14789 
14790         case FEDM_ISC_ISO_MFR_FUJITSU:
14791                 return Set_0xB1_IsoTableData_Fujitsu(ucCmdByte, ucData, iLen);
14792 
14793         case FEDM_ISC_ISO_MFR_KSW:
14794                 return Set_0xB1_IsoTableData_KSW(ucCmdByte, ucData, iLen);
14795 
14796         case FEDM_ISC_ISO_MFR_IDS:
14797                 return Set_0xB1_IsoTableData_IDS(ucCmdByte, ucData, iLen);
14798         }
14799 
14800         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ", Manufacturer=0x" << std::hex << std::uppercase << (int)ucMfr << ")" << GetErrorText(FEDM_ERROR_UNSUPPORTED));
14801         return FEDM_ERROR_UNSUPPORTED;
14802 }
14803 
14804 /***************************************************************************
14805   Begin                 :       07.10.2009 / M. Hultsch
14806   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
14807 
14808   Function                      :       sets the received data of last [0xB1] iso protocol
14809                                                 into iso-table
14810                                                 MFR : NXP
14811 
14812   Parameters            :       unsigned char ucCmdByte - command byte
14813                                                 unsigned char* ucData   -       pointer to buffer with data
14814                                                 int iLen                -       length of data
14815 
14816   Return value          :       OK (=0) or error code (<0)
14817 ***************************************************************************/
14818 int FEDM_ISCReader::Set_0xB1_IsoTableData_NXP(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
14819 {
14820         FEDM_CHK3(ucData);
14821 
14822         if(m_ISOTable.size() <= 0)
14823         {
14824                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
14825                 return FEDM_ERROR_NO_TABLE_SIZE;
14826         }
14827 
14828         unsigned char   ucMode  = 0x00;
14829         unsigned char   ucDBAdr = 0;
14830         unsigned char   ucUid[FEDM_ISC_MAX_UID_LENGTH];
14831         int             iErr = 0;
14832         int             iByteCnt = 0;
14833         int             iIdx = 0;
14834         int             iBlockCnt = 0;
14835         int             iCnt = 0;
14836         string  sUid;
14837 
14838 
14839         switch(ucCmdByte)
14840         {
14841         case 0xA0:
14842                 break;
14843 
14844         case 0xA1:
14845                 break;
14846 
14847         case 0xA2:
14848                 break;
14849 
14850         case 0xA3:
14851                 break;
14852 
14853         case 0xA4:
14854                 break;
14855 
14856         case 0xA5:
14857                 break;
14858 
14859         case 0xB0:
14860                 break;
14861 
14862         case 0xB1:
14863                 break;
14864 
14865         case 0xA6:
14866                 break;
14867 
14868         case 0xA7:
14869                 break;
14870 
14871         case 0xA8:      // [0xA8] Read EPC
14872                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_NXP_EPC_DATA, ucData, 12));
14873                 break;
14874 
14875         case 0xB2:      // [0xB2] Get Random Number
14876                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_NXP_RANDOM_NUMBER, ucData, 2));
14877                 break;
14878 
14879         case 0xB3:
14880                 break;
14881 
14882         case 0xB4:
14883                 break;
14884 
14885         case 0xB5:
14886                 break;
14887 
14888         case 0xB6:
14889                 break;
14890 
14891         case 0xB7:
14892                 break;
14893 
14894         case 0xB8:      // [0xB8] Get Multiple Block Protection Status
14895                 // save number of received data blocks
14896                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_DBN, ucData[iByteCnt++]));
14897                 if(ucData[0] == 0)
14898                         return FEDM_OK;
14899 
14900                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucMode));
14901 
14902                 if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
14903                 {
14904                         iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
14905                 }               
14906                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
14907                 {
14908                         // search serial number in iso-table
14909                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, sUid));
14910                         if(sUid.size() > 16)
14911                                 sUid = sUid.substr(0, 16);
14912                         
14913                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
14914                         if(iIdx < 0)
14915                         {
14916                                 // new entry in table
14917                                 iIdx = m_uiISOTableLength;
14918                                 m_uiISOTableLength++;
14919 
14920                                 // write new serial number (UID) into table
14921                                 FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sUid, &ucUid[0], 8));
14922                                 for(iCnt=0; iCnt<8; iCnt++)
14923                                         m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucUid[iCnt];
14924                         }
14925                 }
14926                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
14927                 {
14928                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
14929                         if(iIdx < 0)
14930                                 return iIdx;
14931                 }
14932                 else
14933                 {
14934                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
14935                         return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
14936                 }
14937 
14938                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_DB_ADR, &ucDBAdr));
14939                 // write the received block protection status into table
14940                 for(iBlockCnt=0; iBlockCnt<ucData[0]; iBlockCnt++)
14941                 {
14942                         m_ISOTable[iIdx]->m_ucSecStatus[ucDBAdr + iBlockCnt];
14943                 }
14944                 
14945                 break;
14946 
14947         case 0xB9:
14948                 break;
14949 
14950         case 0xBA:
14951                 break;
14952 
14953         case 0xBB:
14954                 break;
14955 
14956         default:
14957                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
14958                 return FEDM_ERROR_UNSUPPORTED;
14959         }
14960 
14961         return FEDM_OK;
14962 }
14963 
14964 /***************************************************************************
14965   Begin                 :       07.10.2009 / M. Hultsch
14966   Version               :       04.03.01 / 26.10.2012 / M. Hultsch
14967 
14968   Function                      :       sets the received data of last [0xB1] iso protocol
14969                                                 into iso-table
14970                                                 MFR : STM
14971 
14972   Parameters            :       unsigned char ucCmdByte - command byte
14973                                                 unsigned char* ucData   -       pointer to buffer with data
14974                                                 int iLen                -       length of data
14975 
14976   Return value          :       OK (=0) or error code (<0)
14977 ***************************************************************************/
14978 int FEDM_ISCReader::Set_0xB1_IsoTableData_STM(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
14979 {
14980         FEDM_CHK3(ucData);
14981 
14982         int     iErr = 0;
14983 
14984         if(m_ISOTable.size() <= 0)
14985         {
14986                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
14987                 return FEDM_ERROR_NO_TABLE_SIZE;
14988         }
14989 
14990         switch(ucCmdByte)
14991         {
14992         case 0xA1:
14993         case 0xA2:
14994         case 0xA4:
14995         case 0xA6:
14996         case 0xB1:
14997         case 0xB2:
14998         case 0xB3:
14999                 break;
15000 
15001         case 0xA0: // ReadCfg
15002         case 0xA3: // CheckEHEn
15003                 if(iLen < 1)
15004                 {
15005                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15006                         return FEDM_ERROR_NO_DATA;
15007                 }
15008 
15009                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_STM_DATA, ucData[0]));
15010                 break;
15011 
15012         default:
15013                 return FEDM_ERROR_UNSUPPORTED;
15014         }
15015 
15016         return FEDM_OK;
15017 }
15018 
15019 /***************************************************************************
15020   Begin                 :       07.10.2009 / M. Hultsch
15021   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
15022 
15023   Function                      :       sets the received data of last [0xB1] iso protocol
15024                                                 into iso-table
15025                                                 MFR : INFINEON
15026 
15027   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
15028                                                 int iLen                -       length of data
15029 
15030   Return value          :       OK (=0) or error code (<0)
15031 ***************************************************************************/
15032 int FEDM_ISCReader::Set_0xB1_IsoTableData_Infineon(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15033 {
15034         FEDM_CHK3(ucData);
15035 
15036         if(m_ISOTable.size() <= 0)
15037         {
15038                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15039                 return FEDM_ERROR_NO_TABLE_SIZE;
15040         }
15041 
15042         unsigned char ucCnt=0;
15043         unsigned char ucMode = 0;
15044         unsigned char ucDBAdr = 0;
15045         unsigned char ucDBN = 0;
15046         unsigned char ucDBSize = 0;
15047         unsigned char ucSnr[FEDM_ISC_MAX_UID_LENGTH];
15048         int     iErr = 0;
15049         int iIdx = 0;
15050         int iCnt = 0;
15051         string  sSnr;
15052 
15053         switch(ucCmdByte)
15054         {
15055         case 0x10:
15056                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_MODE, &ucMode));
15057                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_INFINEON_DB_ADR, &ucDBAdr));
15058                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_INFINEON_DB_N, ucData[iCnt]));
15059                 ucDBN = ucData[iCnt++];
15060                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_INFINEON_DB_SIZE, ucData[iCnt]));
15061                 ucDBSize = ucData[iCnt++];
15062 
15063                 if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
15064                 {
15065                         iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
15066                 }               
15067                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
15068                 {
15069                         // search serial number in iso-table
15070                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B1_REQ_UID, sSnr));
15071                         if(sSnr.size() > 16)
15072                                 sSnr = sSnr.substr(0, 16);
15073                         
15074                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
15075                         if(iIdx < 0)
15076                         {
15077                                 // new entry in table
15078                                 iIdx = m_uiISOTableLength;
15079                                 m_uiISOTableLength++;
15080 
15081                                 // write new serial number (UID) into table
15082                                 FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sSnr, &ucSnr[0], 8));
15083                                 for(iCnt=0; iCnt<8; iCnt++)
15084                                         m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucSnr[iCnt];
15085                         }
15086                 }
15087                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
15088                 {
15089                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
15090                         if(iIdx < 0)
15091                                 return iIdx;
15092                 }
15093                 else
15094                 {
15095                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
15096                         return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
15097                 }
15098 
15099                 m_ISOTable[iIdx]->m_ucBlockSize = ucDBSize;
15100                 for(ucCnt=0; ucCnt<ucDBN; ucCnt++)
15101                 {
15102                         m_ISOTable[iIdx]->m_ucSecStatus[ucDBAdr + ucCnt] = ucData[iCnt++];
15103                         memcpy(&m_ISOTable[iIdx]->m_ucRxDB[(ucDBAdr + ucCnt) * ucDBSize], &ucData[iCnt], ucDBSize);
15104                         iCnt += (unsigned int)ucDBSize;
15105                 }
15106                 break;
15107 
15108         case 0x30:
15109         case 0x90:
15110         case 0xAB:
15111                 break;
15112 
15113         default:
15114                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15115                 return FEDM_ERROR_UNSUPPORTED;
15116         }
15117         
15118         return FEDM_OK;
15119 }
15120 
15121 /***************************************************************************
15122   Begin                 :       07.10.2009 / M. Hultsch
15123   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
15124 
15125   Function                      :       sets the received data of last [0xB1] iso protocol
15126                                                 into iso-table
15127                                                 MFR : TI
15128 
15129   Parameters            :       unsigned char ucCmdByte - command byte
15130                                                 unsigned char* ucData   -       pointer to buffer with data
15131                                                 int iLen                -       length of data
15132 
15133   Return value          :       OK (=0) or error code (<0)
15134 ***************************************************************************/
15135 int FEDM_ISCReader::Set_0xB1_IsoTableData_TI(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15136 {
15137         FEDM_CHK3(ucData);
15138 
15139         if(m_ISOTable.size() <= 0)
15140         {
15141                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15142                 return FEDM_ERROR_NO_TABLE_SIZE;
15143         }
15144 
15145         int     iErr = 0;
15146         
15147         switch(ucCmdByte)
15148         {
15149         case 0xA2:
15150         case 0xA3:
15151                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_TI_DB_ADR_E, ucData, 1));
15152                 break;
15153         
15154         default:
15155                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15156                 return FEDM_ERROR_UNSUPPORTED;
15157         }
15158 
15159         return FEDM_OK;
15160 }
15161 
15162 /***************************************************************************
15163   Begin                 :       07.10.2009 / M. Hultsch
15164   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
15165 
15166   Function                      :       sets the received data of last [0xB1] iso protocol
15167                                                 into iso-table
15168                                                 MFR : Fujitsu
15169 
15170   Parameters            :       unsigned char ucCmdByte - command byte
15171                                                 unsigned char* ucData   -       pointer to buffer with data
15172                                                 int iLen                -       length of data
15173 
15174   Return value          :       OK (=0) or error code (<0)
15175 ***************************************************************************/
15176 int FEDM_ISCReader::Set_0xB1_IsoTableData_Fujitsu(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15177 {
15178         FEDM_CHK3(ucData);
15179 
15180         if(m_ISOTable.size() <= 0)
15181         {
15182                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15183                 return FEDM_ERROR_NO_TABLE_SIZE;
15184         }
15185 
15186 /*      switch(ucCmdByte)
15187         {
15188         default:
15189                 return FEDM_ERROR_UNSUPPORTED;
15190         }*/
15191         
15192         return FEDM_OK;
15193 }
15194 
15195 /***************************************************************************
15196   Begin                 :       07.10.2009 / M. Hultsch
15197   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
15198 
15199   Function                      :       sets the received data of last [0xB1] iso protocol
15200                                                 into iso-table
15201                                                 MFR : KSW
15202 
15203   Parameters            :       unsigned char ucCmdByte - command byte
15204                                                 unsigned char* ucData   -       pointer to buffer with data
15205                                                 int iLen                -       length of data
15206 
15207   Return value          :       OK (=0) or error code (<0)
15208 ***************************************************************************/
15209 int FEDM_ISCReader::Set_0xB1_IsoTableData_KSW(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15210 {
15211         FEDM_CHK3(ucData);
15212 
15213         if(m_ISOTable.size() <= 0)
15214         {
15215                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15216                 return FEDM_ERROR_NO_TABLE_SIZE;
15217         }
15218 
15219         int             iErr = 0;
15220         
15221         switch(ucCmdByte)
15222         {
15223         case 0xA2:
15224                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_LOGFLAGS, ucData, 1));
15225                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_LOGPOINTER, ucData, 1));
15226                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_LOGLIMITLO, ucData, 2));
15227                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_LOGLIMITHI, ucData, 2));
15228                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_LOGPERIODE, ucData, 2));
15229                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_KSW_TIMERTICKS, ucData, 2));                                        
15230                 break;
15231 
15232         default:
15233                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15234                 return FEDM_ERROR_UNSUPPORTED;
15235         }
15236 
15237         return FEDM_OK;
15238 }
15239 
15240 /***************************************************************************
15241   Begin                 :       31.03.2011 / M. Hultsch
15242   Version               :       03.03.01 / 31.03.2011 / M. Hultsch
15243 
15244   Function                      :       sets the received data of last [0xB1] iso protocol
15245                                                 into iso-table
15246                                                 MFR : IDS Microchip AG
15247 
15248   Parameters            :       unsigned char ucCmdByte - command byte
15249                                                 unsigned char* ucData   -       pointer to buffer with data
15250                                                 int iLen                                -       length of data
15251 
15252   Return value          :       OK (=0) or error code (<0)
15253 ***************************************************************************/
15254 int FEDM_ISCReader::Set_0xB1_IsoTableData_IDS(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15255 {
15256         FEDM_CHK3(ucData);
15257 
15258         if(m_ISOTable.size() <= 0)
15259         {
15260                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15261                 return FEDM_ERROR_NO_TABLE_SIZE;
15262         }
15263 
15264         int     iErr = 0;
15265         int iCnt = 0;
15266         
15267         switch(ucCmdByte)
15268         {
15269         case 0xA0:
15270         case 0xA1:
15271         case 0xA2:
15272                 break;
15273 
15274         case 0xA3:
15275                 if(iLen < 16)
15276                 {
15277                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15278                         return FEDM_ERROR_BUFFER_LENGTH;
15279                 }
15280 
15281                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_START_TIME, &ucData[iCnt], 4));
15282                 iCnt += 4;
15283                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_LOG_LIMITS, &ucData[iCnt], 4));
15284                 iCnt += 4;
15285                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_LOG_MODE, &ucData[iCnt], 4));
15286                 iCnt += 4;
15287                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_DELAY_TIME, &ucData[iCnt], 4));
15288                 break;
15289 
15290         case 0xA4:
15291         case 0xA5:
15292         case 0xA6:
15293         case 0xA7:
15294                 break;
15295 
15296         case 0xA8:
15297                 if(iLen < 8)
15298                 {
15299                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15300                         return FEDM_ERROR_BUFFER_LENGTH;
15301                 }
15302 
15303                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_MEAS_STATE, &ucData[iCnt], 4));
15304                 iCnt += 4;
15305                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_LIMITS_COUNTER, &ucData[iCnt], 4));
15306                 break;
15307 
15308         case 0xA9:
15309                 if(iLen < 8)
15310                 {
15311                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15312                         return FEDM_ERROR_BUFFER_LENGTH;
15313                 }
15314 
15315                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_INT_CAL_DATA, &ucData[iCnt], 4));
15316                 iCnt += 4;
15317                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_EXT_CAL_DATA, &ucData[iCnt], 4));
15318                 break;
15319 
15320         case 0xAA:
15321                 if(iLen < 1)
15322                 {
15323                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15324                         return FEDM_ERROR_BUFFER_LENGTH;
15325                 }
15326 
15327                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_BATTERY_LEVEL, ucData, 1));
15328                 break;
15329 
15330         case 0xAB:
15331         case 0xAC:
15332                 break;
15333 
15334         case 0xAD:
15335                 if(iLen < 2)
15336                 {
15337                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15338                         return FEDM_ERROR_BUFFER_LENGTH;
15339                 }
15340 
15341                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB1_RSP_IDS_MEAS_TEMP, ucData, 2));
15342                 break;
15343 
15344         default:
15345                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15346                 return FEDM_ERROR_UNSUPPORTED;
15347         }
15348 
15349         return FEDM_OK;
15350 }
15351 
15352 /***************************************************************************
15353   Begin                 :       07.10.2009 / M. Hultsch
15354   Version               :       03.00.14 / 15.10.2009 / M. Hultsch
15355 
15356   Function                      :       sets the received data of last [0xB1] iso protocol
15357                                                 into iso-table
15358                                                 MFR : EM
15359 
15360   Parameters            :       unsigned char ucCmdByte - command byte
15361                                                 unsigned char* ucData   -       pointer to buffer with data
15362                                                 int iLen                -       length of data
15363 
15364   Return value          :       OK (=0) or error code (<0)
15365 ***************************************************************************/
15366 int FEDM_ISCReader::Set_0xB1_IsoTableData_EM(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15367 {
15368         FEDM_CHK3(ucData);
15369 
15370         if(m_ISOTable.size() <= 0)
15371         {
15372                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15373                 return FEDM_ERROR_NO_TABLE_SIZE;
15374         }
15375 
15376         int iErr=0;
15377 
15378         switch(ucCmdByte)
15379         {
15380         case 0xA0:
15381                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B1_RSP_EM_EAS_BIT, ucData, 1));
15382                 break;
15383 
15384         default:
15385                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15386                 return FEDM_ERROR_UNSUPPORTED;
15387         }
15388 
15389         return FEDM_OK;
15390 }
15391 
15392 /***************************************************************************
15393   Begin                 :       08.06.2000 / M. Hultsch
15394   Version               :       02.03.00 / 28.07.2005 / M. Hultsch
15395 
15396   Function                      :       sets the received data of last [0xB2] iso protocol
15397                                                 into iso-table
15398 
15399   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
15400                                                 int iLen                -       length of data
15401                                                 int iStatusByte -       status byte of receive protocol
15402 
15403   Return value          :       OK (=0) or error code (<0)
15404 ***************************************************************************/
15405 int FEDM_ISCReader::Set_0xB2_IsoTableData(unsigned char* ucData, int iLen, int iStatusByte)
15406 {
15407         FEDM_CHK3(ucData);
15408 
15409         if(m_ISOTable.size() <= 0)
15410         {
15411                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_TABLE_SIZE));
15412                 return FEDM_ERROR_NO_TABLE_SIZE;
15413         }
15414 
15415         unsigned char   ucCmdByte = 0x00;
15416         int iErr = 0;
15417 
15418         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B2_CMD, &ucCmdByte));
15419 
15420         switch(ucCmdByte)
15421         {
15422         case 0x30: // MIFARE Value Commands
15423                 return FEDM_OK;
15424 
15425         case 0x2B:      // ISO14443-4 Transponder Info
15426                 FEDM_CHK1(iErr, Set_0xB2_0x2B_IsoTableData(ucData, iLen));
15427                 break;
15428 
15429         case 0xB0: // Authent MIFARE
15430                 return FEDM_OK;
15431 
15432         case 0xB2: // Authent MIFARE Ultralight C
15433                 return FEDM_OK;
15434 
15435         default:
15436                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15437                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
15438         }
15439 
15440         return FEDM_OK;
15441 }
15442 
15443 /***************************************************************************
15444   Begin                 :       22.04.2010 / M. Hultsch
15445   Version               :       03.03.01 / 08.04.2011 / M. Hultsch
15446 
15447   Function                      :       sets the received data of last [0xB4] iso protocol
15448                                                 into tmpdata field (and not into iso-table!!)
15449 
15450   Parameters            :       unsigned char ucCmdByte - command byte
15451                                                 unsigned char* ucData   -       pointer to buffer with data
15452                                                 int iLen                -       length of data
15453 
15454   Return value          :       OK (=0) or error code (<0)
15455 ***************************************************************************/
15456 int FEDM_ISCReader::Set_0xB4_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15457 {
15458         FEDM_CHK3(ucData);
15459 
15460         int iErr = 0;
15461         unsigned char ucMfr     = 0x00;
15462 
15463         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MFR, &ucMfr));
15464 
15465         switch(ucMfr)
15466         {
15467         case FEDM_ISC_ISO_MFR_NXP:
15468                 return Set_0xB4_IsoTableData_NXP(ucCmdByte, ucData, iLen);
15469 
15470         case FEDM_ISC_ISO_MFR_EM:
15471                 return Set_0xB4_IsoTableData_EM(ucCmdByte, ucData, iLen);
15472 
15473         case FEDM_ISC_ISO_MFR_IDS:
15474                 return Set_0xB4_IsoTableData_IDS(ucCmdByte, ucData, iLen);
15475 
15476         default:
15477                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ", Manufacturer=0x" << std::hex << std::uppercase << (int)ucMfr << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15478                 return FEDM_ERROR_UNSUPPORTED;
15479         }
15480 
15481         return FEDM_OK;
15482 }
15483 
15484 /***************************************************************************
15485   Begin                 :       22.04.2010 / M. Hultsch
15486   Version               :       04.06.10 / 02.12.2014 / M. Hultsch
15487                                                 - new [0xB4] NXP Custom Commands: 0x10, 0x11, 0x12
15488 
15489                                                 03.01.05 / 22.04.2010 / M. Hultsch
15490 
15491   Function                      :       sets the received data of last [0xB4] iso protocol
15492                                                 into tmpdata field (and not into iso-table!!)
15493                                                 MFR : NXP
15494 
15495   Parameters            :       unsigned char ucCmdByte - command byte
15496                                                 unsigned char* ucData   -       pointer to buffer with data
15497                                                 int iLen                -       length of data
15498 
15499   Return value          :       OK (=0) or error code (<0)
15500 ***************************************************************************/
15501 int FEDM_ISCReader::Set_0xB4_IsoTableData_NXP(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15502 {
15503         FEDM_CHK3(ucData);
15504 
15505         int     iErr = 0;
15506         int iByteCnt = 0;
15507         unsigned char ucProfile = 0;
15508         unsigned int uiOffset = 0;
15509         unsigned char ucRspDataLen = 0;
15510         bool bUidLF = false;
15511         unsigned char   ucMode  = 0x00;
15512         unsigned char   ucUidLen = 0x00;
15513         unsigned char   ucUid[FEDM_ISC_MAX_UID_LENGTH];
15514         int             iCnt, iIdx;
15515         string  sUid, tmp;
15516         FEDM_BYTE_ARRAY_ITOR itor;
15517 
15518         switch(ucCmdByte)
15519         {
15520         case 0x00:
15521         case 0x01:
15522         case 0x03:
15523         case 0x04:
15524         case 0x05:
15525                 break;
15526 
15527         case 0x06:
15528                 if(iLen < 2)
15529                 {
15530                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15531                         return FEDM_ERROR_NO_DATA;
15532                 }
15533 
15534                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_NXP_CONFIG_WORD, ucData, 2));
15535                 break;
15536 
15537         case 0x07:
15538         case 0x08:
15539                 break;
15540 
15541 /*      case 0x10:      // [0x10] Untraceable
15542                 break;
15543 
15544         case 0x11:      // [0x11] Authenticate
15545                 if(iLen <= 0)
15546                 {
15547                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15548                         return FEDM_ERROR_NO_DATA;
15549                 }
15550 
15551                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE, &ucMode));
15552 
15553                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_PROFILE, &ucProfile));
15554                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_OFFSET, &uiOffset));
15555 
15556                 if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
15557                 {
15558                         iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
15559                 }               
15560                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
15561                 {
15562                         // search serial number in iso-table
15563                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, tmp));
15564                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EPC_LF, &bUidLF));
15565                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC_LEN, &ucUidLen));
15566                         if(bUidLF)
15567                         {
15568                                 sUid = tmp.substr(0, (ucUidLen<<1));
15569                         }
15570                         else
15571                         {
15572                                 sUid = tmp.substr(0, 16);
15573                         }
15574                 
15575                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
15576                         if(iIdx < 0)
15577                         {
15578                                 // new entry in table
15579                                 iIdx = m_uiISOTableLength;
15580                                 m_uiISOTableLength++;
15581 
15582                                 // write new serial number (UID) into table
15583                                 FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sUid, &ucUid[0], ucUidLen));
15584                                 for(iCnt=0; iCnt<ucUidLen; iCnt++)
15585                                         m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucUid[iCnt];
15586                         }
15587                 }
15588                 else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
15589                 {
15590                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; selected mode) " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15591                         return FEDM_ERROR_UNSUPPORTED;
15592                 }
15593                 else
15594                 {
15595                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
15596                         return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
15597                 }
15598 
15599                 // first responded byte contains the number of following data bytes
15600                 ucRspDataLen = ucData[iByteCnt++];
15601                 
15602                 if(iLen < (ucRspDataLen+1))
15603                 {
15604                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15605                         return FEDM_ERROR_NO_DATA;
15606                 }
15607 
15608                 switch(ucProfile)
15609                 {
15610                 case 0: // EPC memory bank
15611                         if( ((uiOffset+1)*8 + ucRspDataLen) > m_ISOTable[iIdx]->m_ucRxDB_EpcBank.size() )
15612                         {
15613                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Offset too large for EPC memory bank) " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
15614                                 return FEDM_ERROR_ARRAY_BOUNDARY;
15615                         }
15616 
15617                         itor = m_ISOTable[iIdx]->m_ucRxDB_EpcBank.begin() + (uiOffset+1)*8;
15618                         break;
15619                 case 1: // TID memory bank
15620                         if( ((uiOffset+1)*8 + ucRspDataLen) > m_ISOTable[iIdx]->m_ucRxDB_TidBank.size() )
15621                         {
15622                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Offset too large for EPC memory bank) " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
15623                                 return FEDM_ERROR_ARRAY_BOUNDARY;
15624                         }
15625 
15626                         itor = m_ISOTable[iIdx]->m_ucRxDB_TidBank.begin() + (uiOffset+1)*8;
15627                         break;
15628                 case 2: // USER memory bank
15629                         if( ((uiOffset+1)*8 + ucRspDataLen) > m_ISOTable[iIdx]->m_ucRxDB.size() )
15630                         {
15631                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Offset too large for EPC memory bank) " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
15632                                 return FEDM_ERROR_ARRAY_BOUNDARY;
15633                         }
15634 
15635                         itor = m_ISOTable[iIdx]->m_ucRxDB.begin() + (uiOffset+1)*8;
15636                         break;
15637                 default:
15638                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Profile=0x" << std::hex << std::uppercase << (int)ucProfile << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15639                         return FEDM_ERROR_UNSUPPORTED;
15640                         break;
15641                 }
15642 
15643                 // write the received public data into table
15644                 for(iCnt=0; iCnt<ucRspDataLen; iCnt++)
15645                 {
15646                         *itor = ucData[iByteCnt++];
15647                         itor++;
15648                 }
15649                 break;*/
15650 
15651         case 0x12:      // [0x12] Write Key
15652                 break;
15653 
15654         default:
15655                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15656                 return FEDM_ERROR_UNSUPPORTED;
15657         }
15658 
15659         return FEDM_OK;
15660 }
15661 
15662 /***************************************************************************
15663   Begin                 :       09.12.2014 / M. Hultsch
15664   Version               :       04.06.10 / 09.12.2014 / M. Hultsch
15665 
15666   Function                      :       sets the received data of last [0xB4] iso protocol
15667                                                 into tmpdata field (and not into iso-table!!)
15668                                                 MFR : EM Microelectronic-Marin SA
15669 
15670   Parameters            :       unsigned char ucCmdByte - command byte
15671                                                 unsigned char* ucData   -       pointer to buffer with data
15672                                                 int iLen                -       length of data
15673 
15674   Return value          :       OK (=0) or error code (<0)
15675 ***************************************************************************/
15676 int FEDM_ISCReader::Set_0xB4_IsoTableData_EM(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15677 {
15678         FEDM_CHK3(ucData);
15679 
15680         int     iErr = 0;
15681         int iAdr = 0;
15682         unsigned int uiByteCnt = 0;
15683         unsigned int uiRspDataLen = 0;
15684         unsigned int uiCnt = 0;
15685         unsigned char ucRespSize = 0;
15686         unsigned char ucBuffer[20];
15687 
15688         switch(ucCmdByte)
15689         {
15690         case 0x00:
15691                 if(iLen < 8)
15692                 {
15693                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15694                         return FEDM_ERROR_NO_DATA;
15695                 }
15696 
15697                 iAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_B4_RSP_EM_UID, 32);
15698                 if(iAdr < 0)
15699                 {
15700                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(iAdr));
15701                         return iAdr;
15702                 }
15703                 
15704                 memset(ucBuffer, 0, 20);
15705 
15706                 // copy responded UID with length information coded in first byte
15707                 switch(ucData[0])
15708                 {
15709                 case 0xE0: // ISO/IEC 7816-6 (64 bit)
15710                         uiRspDataLen = 8;
15711                         break;
15712                 case 0xE2: // EPC global Class1 Gen2 (96 bit)
15713                         uiRspDataLen = 12;
15714                         break;
15715                 case 0xE3: // ISO/IEC 7816-6 (80 bit)
15716                         uiRspDataLen = 10;
15717                         break;
15718                 case 0x44: // legacy TOTAL (64 bit)
15719                 case 0x45:
15720                 case 0x46:
15721                 case 0x47:
15722                         uiRspDataLen = 8;
15723                         break;
15724                 default:
15725                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Class-ID=0x" << std::hex << std::uppercase << (int)ucData[0] << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15726                         return FEDM_ERROR_UNSUPPORTED;
15727                 }
15728 
15729                 memcpy(ucBuffer, ucData, uiRspDataLen);
15730                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_EM_UID, ucBuffer, 12));
15731                 break;
15732 
15733         case 0x01:
15734                 if(iLen < 16)
15735                 {
15736                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15737                         return FEDM_ERROR_NO_DATA;
15738                 }
15739 
15740                 iAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_B4_RSP_EM_UID, 32);
15741                 if(iAdr < 0)
15742                 {
15743                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(iAdr));
15744                         return iAdr;
15745                 }
15746                 
15747                 memset(ucBuffer, 0, 20);
15748 
15749                 // copy responded UID with length information coded in first byte
15750                 switch(ucData[0])
15751                 {
15752                 case 0xE0: // ISO/IEC 7816-6 (64 bit)
15753                         uiRspDataLen = 8;
15754                         break;
15755                 case 0xE2: // EPC global Class1 Gen2 (96 bit)
15756                         uiRspDataLen = 12;
15757                         break;
15758                 case 0xE3: // ISO/IEC 7816-6 (80 bit)
15759                         uiRspDataLen = 10;
15760                         break;
15761                 case 0x44: // legacy TOTAL (64 bit)
15762                 case 0x45:
15763                 case 0x46:
15764                 case 0x47:
15765                         uiRspDataLen = 8;
15766                         break;
15767                 default:
15768                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << "; Class-ID=0x" << std::hex << std::uppercase << (int)ucData[0] << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15769                         return FEDM_ERROR_UNSUPPORTED;
15770                 }
15771 
15772                 memcpy(ucBuffer, ucData, uiRspDataLen);
15773                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_EM_UID, ucBuffer, 12));
15774                 uiByteCnt += uiRspDataLen;
15775                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_EM_SENSOR_DATA, &ucData[uiByteCnt], 4));
15776                 uiByteCnt += 4;
15777                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_EM_UTC_TIMESTAMP, &ucData[uiByteCnt], 4));
15778                 uiByteCnt += 4;
15779                 break;
15780 
15781         case 0x02:
15782                 if(iLen > 0)
15783                 {
15784                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_RESP_SIZE, &ucRespSize));
15785                         if(ucRespSize != (unsigned int)iLen)
15786                         {
15787                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
15788                                 return FEDM_ERROR_BUFFER_LENGTH;
15789                         }
15790 
15791                         memset(ucBuffer, 0, 20);
15792                         memcpy(ucBuffer, ucData, iLen);
15793                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B4_RSP_EM_SPI_DATA, ucBuffer, 7));
15794                 }
15795                 break;
15796 
15797         case 0x04:
15798                 break;
15799 
15800         case 0xD1:
15801                 break;
15802 
15803         default:
15804                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15805                 return FEDM_ERROR_UNSUPPORTED;
15806         }
15807 
15808         return FEDM_OK;
15809 }
15810 
15811 /***************************************************************************
15812   Begin                 :       03.03.01 / 08.04.2011 / M. Hultsch
15813   Version               :       03.03.01 / 08.04.2011 / M. Hultsch
15814 
15815   Function                      :       sets the received data of last [0xB4] iso protocol
15816                                                 into tmpdata field (and not into iso-table!!)
15817                                                 MFR : IDS
15818 
15819   Parameters            :       unsigned char ucCmdByte - command byte
15820                                                 unsigned char* ucData   -       pointer to buffer with data
15821                                                 int iLen                -       length of data
15822 
15823   Return value          :       OK (=0) or error code (<0)
15824 ***************************************************************************/
15825 int FEDM_ISCReader::Set_0xB4_IsoTableData_IDS(unsigned char ucCmdByte, unsigned char* ucData, int iLen)
15826 {
15827         FEDM_CHK3(ucData);
15828 
15829         int     iErr = 0;
15830         int iCnt = 0;
15831 
15832         switch(ucCmdByte)
15833         {
15834         case 0xA0:
15835         case 0xA1:
15836         case 0xA2:
15837                 break;
15838 
15839         case 0xA3:
15840                 if(iLen < 16)
15841                 {
15842                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15843                         return FEDM_ERROR_NO_DATA;
15844                 }
15845 
15846                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_START_TIME, &ucData[iCnt], 4));
15847                 iCnt += 4;
15848                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_LOG_LIMITS, &ucData[iCnt], 5));
15849                 iCnt += 5;
15850                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_LOG_MODE, &ucData[iCnt], 1));
15851                 iCnt += 1;
15852                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_LOG_INTERVAL, &ucData[iCnt], 2));
15853                 iCnt += 2;
15854                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_DELAY_TIME, &ucData[iCnt], 2));
15855                 iCnt += 2;
15856                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_APP_DATA, &ucData[iCnt], 2));
15857                 break;
15858 
15859         case 0xA4:
15860         case 0xA5:
15861         case 0xA6:
15862         case 0xA7:
15863                 break;
15864 
15865         case 0xA8:
15866                 if(iLen == 9)
15867                 {
15868                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_LIMITS_COUNTER, &ucData[iCnt], 4));
15869                         iCnt += 4;
15870                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SYSTEM_STATUS, &ucData[iCnt], 4));
15871                         iCnt += 4;
15872                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SL_BLOCK_0, (std::string)"00000000"));
15873                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SL_BLOCK_1, (std::string)"00000000"));
15874                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_CURRENT_SHELF_LIFE, (std::string)"000000"));
15875                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_STATUS_FLAG, &ucData[iCnt], 1));
15876                 }
15877                 else if(iLen == 20)
15878                 {
15879                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_LIMITS_COUNTER, &ucData[iCnt], 4));
15880                         iCnt += 4;
15881                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SYSTEM_STATUS, &ucData[iCnt], 4));
15882                         iCnt += 4;
15883                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SL_BLOCK_0, &ucData[iCnt], 4));
15884                         iCnt += 4;
15885                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SL_BLOCK_1, &ucData[iCnt], 4));
15886                         iCnt += 4;
15887                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_CURRENT_SHELF_LIFE, &ucData[iCnt], 3));
15888                         iCnt += 3;
15889                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_STATUS_FLAG, &ucData[iCnt], 1));
15890                 }
15891                 else
15892                 {
15893                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15894                         return FEDM_ERROR_NO_DATA;
15895                 }
15896                 break;
15897 
15898         case 0xA9:
15899                 if(iLen < 9)
15900                 {
15901                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15902                         return FEDM_ERROR_NO_DATA;
15903                 }
15904 
15905                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_CAL_DATA, &ucData[iCnt], 7));
15906                 iCnt += 7;
15907                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SFE_PARA, &ucData[iCnt], 2));
15908                 break;
15909 
15910         case 0xAA:
15911                 if(iLen < 2)
15912                 {
15913                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15914                         return FEDM_ERROR_NO_DATA;
15915                 }
15916 
15917                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_BATTERY_LEVEL, &ucData[iCnt], 2));
15918                 break;
15919 
15920         case 0xAB:
15921         case 0xAC:
15922                 break;
15923 
15924         case 0xAD:
15925                 if(iLen < 2)
15926                 {
15927                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_NO_DATA));
15928                         return FEDM_ERROR_NO_DATA;
15929                 }
15930 
15931                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_SENSOR_INFO, &ucData[iCnt], 2));
15932                 break;
15933 
15934         case 0xAE:
15935                 break;
15936 
15937         case 0xAF:
15938                 if(iLen > 0)
15939                 {
15940                         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_0xB4_RSP_IDS_PAYLOAD, &ucData[iCnt], iLen));
15941                 }
15942                 break;
15943 
15944         default:
15945                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
15946                 return FEDM_ERROR_UNSUPPORTED;
15947         }
15948 
15949         return FEDM_OK;
15950 }
15951 
15952 /***************************************************************************
15953   Begin                 :       09.02.2009 / M. Hultsch
15954   Version               :       03.00.06 / 02.04.2009 / M. Hultsch
15955 
15956   Function                      :       sets the received data of last [0xC1] iso protocol
15957                                                 into iso-table
15958 
15959   Parameters            :       unsigned char  ucDESFireCmd     -       sub command
15960                                                 unsigned char* ucData           -       pointer to buffer with data
15961                                                 int iLen                        -       length of data
15962 
15963   Return value          :       OK (=0) or error code (<0)
15964 
15965 ***************************************************************************/
15966 int FEDM_ISCReader::Set_0xC1_IsoTableData(unsigned char ucDESFireCmd, unsigned char* ucData, int iLen)
15967 {
15968         FEDM_CHK3(ucData);
15969 
15970         int iErr = 0;
15971         int iCnt = 0;
15972 
15973         unsigned int uiFileOffset = 0;
15974         unsigned int uiFileLen = 0;
15975         unsigned int uiNoOfRecords = 0;
15976         unsigned int uiRecordSize = 0;
15977 
15978         int iIdx = 0;
15979 
15980         switch(ucDESFireCmd)
15981         {
15982         case 0xFA:      // DESFire Authent
15983                 break;
15984 
15985         case 0xBD:      // DESFire Read Standard Data
15986                 // command only in selected mode
15987                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
15988                 if(iIdx < 0)
15989                         return iIdx;
15990 
15991                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_OFFSET, &uiFileOffset));
15992                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_DATA_LEN, &uiFileLen));
15993 
15994                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
15995                 {
15996                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
15997                         return FEDM_ERROR_ARRAY_BOUNDARY;
15998                 }
15999 
16000                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[uiFileOffset], &ucData[0], uiFileLen);
16001                 break;
16002 
16003         case 0x3D:      // DESFire Write Standard Data
16004                 break;
16005 
16006         case 0x6C:      // DESFire Get Value
16007                 // command only in selected mode
16008                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16009                 if(iIdx < 0)
16010                         return iIdx;
16011 
16012                 m_ISOTable[iIdx]->m_uiValue  = ucData[iCnt++];
16013                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) <<  8);
16014                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) << 16);
16015                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) << 24);
16016 
16017                 break;
16018 
16019         case 0x0C:      // DESFire Credit
16020                 break;
16021 
16022         case 0xDC:      // DESFire Debit
16023                 break;
16024 
16025         case 0x1C:      // DESFire Limited Credit
16026                 break;
16027 
16028         case 0x3B:      // DESFire Write Record
16029                 break;
16030 
16031         case 0xBB:      // DESFire Read Records
16032                 // command only in selected mode
16033                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16034                 if(iIdx < 0)
16035                         return iIdx;
16036 
16037                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NO_OF_RECORDS, &uiNoOfRecords));
16038                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_RECORD_SIZE, &uiRecordSize));
16039 
16040                 if(uiNoOfRecords * uiRecordSize > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
16041                 {
16042                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
16043                         return FEDM_ERROR_ARRAY_BOUNDARY;
16044                 }
16045 
16046                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[0], &ucData[0], uiNoOfRecords*uiRecordSize);
16047                 break;
16048 
16049         case 0xEB:      // DESFire Clear Record File
16050                 break;
16051 
16052         case 0x5F:      // DESFire Change File Settings
16053                 break;
16054 
16055         case 0x54:      // DESFire Change Key Settings
16056                 break;
16057 
16058         case 0xC4:      // DESFire Change Key
16059                 break;
16060 
16061         default:
16062                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
16063                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
16064         }
16065 
16066         return FEDM_OK;
16067 }
16068 
16069 /***************************************************************************
16070   Begin                 :       08.09.2010 / M. Hultsch
16071   Version               :       03.02.05 / 08.09.2010 / M. Hultsch
16072 
16073   Function                      :       sets the received data of last [0xC3] DESFire Command
16074                                                 into iso-table
16075 
16076   Parameters            :       unsigned char  ucDESFireCmd     -       sub command
16077                                                 unsigned char* ucData           -       pointer to buffer with data
16078                                                 int iLen                                        -       length of data
16079 
16080   Return value          :       OK (=0) or error code (<0)
16081 
16082 ***************************************************************************/
16083 int FEDM_ISCReader::Set_0xC3_IsoTableData(unsigned char ucDESFireCmd, unsigned char* ucData, int iLen)
16084 {
16085         FEDM_CHK3(ucData);
16086 
16087         int iErr = 0;
16088         int iCnt = 0;
16089         int iAdr = 0;
16090 
16091         unsigned int uiFileOffset = 0;
16092         unsigned int uiFileLen = 0;
16093         unsigned int uiNoOfRecords = 0;
16094         unsigned int uiRecordSize = 0;
16095         unsigned char* pData = NULL;
16096 
16097         int iIdx = 0;
16098 
16099         switch(ucDESFireCmd)
16100         {
16101         // all command with no response data
16102         case 0xFA: // DESFire Authent
16103         case 0xFC: // DESFire Format PICC
16104         case 0xCA: // DESFire Create Application
16105         case 0xDA: // DESFire Delete Application
16106         case 0x0C: // DESFire Credit
16107         case 0xDC: // DESFire Debit
16108         case 0x1C: // DESFire Limited Credit
16109         case 0x3B: // DESFire Write Record
16110         case 0x3D: // DESFire Write Standard Data
16111         case 0xEB: // DESFire Clear Record File
16112         case 0x5F: // DESFire Change File Settings
16113         case 0x54: // DESFire Change Key Settings
16114         case 0xC4: // DESFire Change Key
16115         case 0x5A: // DESFire Select Application
16116         case 0x5C: // DESFire Set Configuration
16117         case 0xCD: // DESFire Create Standard Data File
16118         case 0xCB: // DESFire Create Backup Data File
16119         case 0xCC: // DESFire Create Value File
16120         case 0xC1: // DESFire Create Linear Record File
16121         case 0xC0: // DESFire Create Cyclic Record File
16122         case 0xDF: // DESFire Delete File
16123         case 0xC7: // DESFire Commit Transaction
16124         case 0xA7: // DESFire Abort Transaction
16125                 break;
16126 
16127         // all commands with response data which are not stored in the table
16128         case 0x45: // DESFire Get Key Settings
16129         case 0x64: // DESFire Get Key Version
16130         case 0x6A: // DESFire Get Application IDs
16131         case 0x6D: // DESFire Get DF Names
16132         case 0x60: // DESFire Get Version
16133         case 0x51: // DESFire Get Card UID
16134         case 0x6F: // DESFire Get File IDs
16135         case 0xF5: // DESFire Get File Settings
16136         case 0x61: // DESFire Get ISO File IDs
16137         case 0x6E: // DESFire Free Mem
16138                 iAdr = FEDM_GetAdrOfID(FEDM_ISC_TMP_0xC3_RSP_DATA, 32);
16139                 if(iAdr < 0)
16140                         return iAdr;
16141                 pData = &m_TmpData[iAdr];
16142                 memcpy(pData, ucData, iLen);
16143                 FEDM_CHK2(iErr, SetData(FEDM_ISC_TMP_0xC3_RSP_DATA_LEN, (unsigned int)iLen));
16144                 break;
16145 
16146         case 0xBD:      // DESFire Read Standard Data
16147                 // command only in selected mode
16148                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16149                 if(iIdx < 0)
16150                         return iIdx;
16151 
16152                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_OFFSET, &uiFileOffset));
16153                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_DATA_LEN, &uiFileLen));
16154 
16155                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
16156                 {
16157                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
16158                         return FEDM_ERROR_ARRAY_BOUNDARY;
16159                 }
16160 
16161                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[uiFileOffset], &ucData[0], uiFileLen);
16162                 break;
16163 
16164         case 0x6C:      // DESFire Get Value
16165                 // command only in selected mode
16166                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16167                 if(iIdx < 0)
16168                         return iIdx;
16169 
16170                 m_ISOTable[iIdx]->m_uiValue  = ucData[iCnt++];
16171                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) <<  8);
16172                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) << 16);
16173                 m_ISOTable[iIdx]->m_uiValue += (((unsigned int)ucData[iCnt++]) << 24);
16174 
16175                 break;
16176 
16177         case 0xBB:      // DESFire Read Records
16178                 // command only in selected mode
16179                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16180                 if(iIdx < 0)
16181                         return iIdx;
16182 
16183                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NO_OF_RECORDS, &uiNoOfRecords));
16184                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_RECORD_SIZE, &uiRecordSize));
16185 
16186                 if(uiNoOfRecords * uiRecordSize > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
16187                 {
16188                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
16189                         return FEDM_ERROR_ARRAY_BOUNDARY;
16190                 }
16191 
16192                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[0], &ucData[0], uiNoOfRecords*uiRecordSize);
16193                 break;
16194 
16195         default:
16196                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
16197                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
16198         }
16199 
16200         return FEDM_OK;
16201 }
16202 
16203 
16204 /***************************************************************************
16205   Begin                 :       24.08.2009 / M. Hultsch
16206   Version               :       03.00.13 / 01.10.2009 / M. Hultsch
16207 
16208   Function                      :       sets the received data of last [0xC2] iso protocol
16209                                                 into iso-table
16210 
16211   Parameters            :       unsigned char  ucMifarePlusCmd  -       sub command
16212                                                 unsigned char* ucData                   -       pointer to buffer with data
16213                                                 int iLen                                -       length of data
16214 
16215   Return value          :       OK (=0) or error code (<0)
16216 ***************************************************************************/
16217 int FEDM_ISCReader::Set_0xC2_IsoTableData(unsigned char ucMifarePlusCmd, unsigned char* ucData, int iLen)
16218 {
16219         FEDM_CHK3(ucData);
16220 
16221         int iErr = 0;
16222         int iCnt = 0;
16223         int iIdx = 0;
16224         unsigned int uiBlockNo = 0;
16225         unsigned int uiLength = 0;
16226 
16227         switch(ucMifarePlusCmd)
16228         {
16229         // commands for all security levels
16230         case 0x70:      // First Authent
16231                 break;
16232 
16233         case 0x76:      // Following Authent
16234                 break;
16235 
16236         // Security Level 1 commands
16237         case 0x77:      // SL1 AES Authent
16238                 break;
16239 
16240         // Security Level 2 commands
16241         case 0x75:      // SL2 AES and Crypto Authent
16242                 break;
16243 
16244         case 0x38:      // SL2 Multiblock Read
16245                 // command only in selected mode
16246                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16247                 if(iIdx < 0)
16248                         return iIdx;
16249 
16250                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_SRC_BLOCK_NO, &uiBlockNo));
16251                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &uiLength));
16252 
16253                 if( (uiBlockNo + uiLength)*16 > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
16254                 {
16255                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
16256                         return FEDM_ERROR_ARRAY_BOUNDARY;
16257                 }
16258 
16259                 m_ISOTable[iIdx]->m_ucBlockSize = 16;
16260                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = true;
16261                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[uiBlockNo*16], &ucData[0], uiLength*16);
16262                 break;
16263 
16264         case 0xA8:      // SL2 Multiblock Write
16265                 break;
16266 
16267         // Security Level 3 commands
16268         case 0x78:      // SL3 Reset Authent
16269                 break;
16270 
16271         case 0x30:      // SL3 Read Encrypted
16272         case 0x31:      // SL3 Read Encrypted Maced
16273         case 0x32:      // SL3 Read Plain
16274         case 0x33:      // SL3 Read Plain Maced
16275         case 0x34:      // SL3 Read Encrypted Unmaced
16276         case 0x35:      // SL3 Read Encrypted Unmaced Respond Maced
16277         case 0x36:      // SL3 Read Plain Unmaced
16278         case 0x37:      // SL3 Read Plain Unmaced Respond Maced
16279                 // command only in selected mode
16280                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16281                 if(iIdx < 0)
16282                         return iIdx;
16283 
16284                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_BLOCK_NO, &uiBlockNo));
16285                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &uiLength));
16286 
16287                 if( (uiBlockNo + uiLength)*16 > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
16288                 {
16289                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
16290                         return FEDM_ERROR_ARRAY_BOUNDARY;
16291                 }
16292 
16293                 m_ISOTable[iIdx]->m_ucBlockSize = 16;
16294                 m_ISOTable[iIdx]->m_bIsBlockSizeSet = true;
16295                 memcpy(&m_ISOTable[iIdx]->m_ucRxDB[uiBlockNo*16], &ucData[0], uiLength*16);
16296                 break;
16297 
16298         case 0xA0:      // SL3 Write Encrypted
16299                 break;
16300 
16301         case 0xA1:      // SL3 Write Encrypted Maced
16302                 break;
16303 
16304         case 0xA2:      // SL3 Write Plain
16305                 break;
16306 
16307         case 0xA3:      // SL3 Write Plain Maced
16308                 break;
16309 
16310         case 0xB0:      // SL3 Increment Encrypted
16311                 break;
16312 
16313         case 0xB1:      // SL3 Increment Encrypted Maced
16314                 break;
16315 
16316         case 0xB2:      // SL3 Decrement Encrypted
16317                 break;
16318 
16319         case 0xB3:      // SL3 Decrement Encrypted Maced
16320                 break;
16321 
16322         case 0xB4:      // SL3 Transfer
16323                 break;
16324 
16325         case 0xB5:      // SL3 Transfer Maced
16326                 break;
16327 
16328         case 0xB6:      // SL3 Increment Transfer Encrypted
16329                 break;
16330 
16331         case 0xB7:      // SL3 Increment Transfer Encrypted Maced
16332                 break;
16333 
16334         case 0xB8:      // SL3 Decrement Transfer Encrypted
16335                 break;
16336 
16337         case 0xB9:      // SL3 Decrement Transfer Encrypted Maced
16338                 break;
16339 
16340         case 0xC2:      // SL3 Restore
16341                 break;
16342 
16343         case 0xC3:      // SL3 Restore Maced
16344                 break;
16345 
16346         default:
16347                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
16348                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
16349         }
16350 
16351         return FEDM_OK;
16352 }
16353 
16354 
16355 /***************************************************************************
16356   Begin                 :       08.03.2001 / M. Hultsch
16357   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
16358 
16359   Function                      :       sets the received data of last [0xB0][0x23] iso protocol
16360                                                 into iso-table
16361 
16362   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16363                                                 int iLen                -       length of data
16364 
16365   Return value          :       OK (=0) or error code (<0)
16366 
16367 ***************************************************************************/
16368 int FEDM_ISCReader::Set_0xB0_0x23_IsoTableData(unsigned char* ucData, int iLen)
16369 {
16370         FEDM_CHK3(ucData);
16371 
16372         if(iLen <= 0)
16373                 return FEDM_ERROR_NO_DATA;
16374 
16375         bool bUidLF = false;
16376         bool bExtAdr = false;
16377         unsigned char   ucMode  = 0x00;
16378         unsigned char   ucBank  = 0x03; // User Memory Bank
16379         unsigned char   ucBlockSize = 0x04;
16380         unsigned char   ucUidLen = 0x00;
16381         unsigned int    uiDBAdr = 0x00;
16382 
16383         unsigned char   ucSnr[FEDM_ISC_MAX_UID_LENGTH];
16384         int             iByteCnt = 0;
16385         int             iCnt, iIdx, iBlockCnt, iErr;
16386         string  sSnr, tmp;
16387 
16388         // save number of received data blocks
16389         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DBN, ucData[iByteCnt++]));
16390         if(ucData[0] == 0)
16391                 return FEDM_OK;
16392 
16393         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
16394         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAdr));
16395         if(bExtAdr)
16396         {
16397                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &uiDBAdr));
16398                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_BANK_BANK_NR, &ucBank));
16399         }
16400         else
16401         {
16402                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &uiDBAdr));
16403         }
16404 
16405         if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
16406         {
16407                 iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
16408         }               
16409         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
16410         {
16411                 // search serial number in iso-table
16412                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
16413                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_UID_LF, &bUidLF));
16414                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID_LEN, &ucUidLen));
16415                 if(bUidLF)
16416                 {
16417                         sSnr = tmp.substr(0, (ucUidLen<<1));
16418                 }
16419                 else
16420                 {
16421                         sSnr = tmp.substr(0, 16);
16422                 }
16423                 
16424                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
16425                 if(iIdx < 0)
16426                 {
16427                         // new entry in table
16428                         iIdx = m_uiISOTableLength;
16429                         m_uiISOTableLength++;
16430 
16431                         // write new serial number (UID) into table
16432                         FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sSnr, &ucSnr[0], ucUidLen));
16433                         for(iCnt=0; iCnt<ucUidLen; iCnt++)
16434                                 m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucSnr[iCnt];
16435                 }
16436         }
16437         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
16438         {
16439                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16440                 if(iIdx < 0)
16441                 {
16442                         // exception for ISO 14443 Transponder, when Reader is configuered with Anticollision = off
16443                         if(  m_uiISOTableLength == 1 && (m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A || m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B) )
16444                                 iIdx = 0;
16445                         else
16446                                 return iIdx;
16447                 }
16448         }
16449         else
16450         {
16451                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
16452                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
16453         }
16454 
16455         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DB_SIZE, ucData[1]));
16456 
16457         ucBlockSize     = ucData[iByteCnt++];
16458 
16459         // save the blocksize in table and set the flag, that blocksize is guilty
16460         m_ISOTable[iIdx]->m_ucBlockSize = ucBlockSize;
16461         m_ISOTable[iIdx]->m_bIsBlockSizeSet = true;
16462 
16463         // write the received public data into table
16464         for(iBlockCnt=0; iBlockCnt<ucData[0]; iBlockCnt++)
16465         {
16466                 FEDM_CHK1(iErr, m_ISOTable[iIdx]->SetData(0x23, &ucData[0], iByteCnt, ucBank, uiDBAdr));
16467                 uiDBAdr++;
16468         }
16469 
16470         return FEDM_OK;
16471 }
16472 
16473 /***************************************************************************
16474   Begin                 :       09.03.2001 / M. Hultsch
16475   Version               :       04.02.01 / 31.05.2012 / M. Hultsch
16476                                                 - support for Innovatron
16477 
16478                                                 03.00.16 / 20.11.2009 / M. Hultsch
16479                                                 - clear of Card Info Format
16480 
16481                                                 02.03.05 / 07.12.2005 / M. Hultsch
16482 
16483   Function                      :       sets the received data of last [oxB0][0x25] iso protocol
16484                                                 into iso-table
16485 
16486   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16487 
16488                                                 int iLen                -       length of data
16489 
16490   Return value          :       OK (=0) or error code (<0)
16491 
16492 ***************************************************************************/
16493 int FEDM_ISCReader::Set_0xB0_0x25_IsoTableData(unsigned char* ucData, int iLen)
16494 {
16495         FEDM_CHK3(ucData);
16496 
16497         bool bUidLF = false;
16498         unsigned char   ucMode  = 0x00;
16499         unsigned char   ucUidLen = 0x00;
16500         unsigned char   ucFormat = 0x00;
16501         int             iIdx, iErr;
16502         string  sSnr, tmp;
16503 
16504         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
16505         // only addressed supported
16506         if((unsigned char)(ucMode&0x07) != FEDM_ISC_ISO_MODE_ADR)
16507         {
16508                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
16509                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
16510         }
16511 
16512         // clear card info format
16513         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_FORMAT, (unsigned char)0x00));
16514 
16515         // save card information, comming with ISO14443 Transponder, if CINF flag is set in MODE
16516         // memory space in m_TmpData is used, beginning with offset 2048
16517         if(ucMode & FEDM_ISC_ISO_MODE_CINF)
16518         {
16519                 ucFormat = ucData[0];
16520                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_FORMAT, ucFormat));
16521 
16522                 switch(ucFormat)
16523                 {
16524                 case 0x00: // no card information
16525                         break;
16526 
16527                 case 0x01: // card information of an ISO14443-4 Type-A Transponder
16528                         memcpy(&m_TmpData[2048], &ucData[1], 4);
16529                         memcpy(&m_TmpData[2052], &ucData[5], ucData[4]); // ucData[4] is TL
16530                         break;
16531 
16532                 case 0x02: // card information of an ISO14443-4 Type-B Transponder
16533                         memcpy(&m_TmpData[2048], &ucData[1], 4);
16534                         break;
16535 
16536                 case 0x03: // card information of an ISO14443-3 Type-A Transponder
16537                         memcpy(&m_TmpData[2048], &ucData[1], 3);
16538                         break;
16539 
16540                 case 0x04: // card information of an Innovatron (ISO 14443B') Transponder
16541                         memcpy(&m_TmpData[2048], &ucData[1], 1);
16542                         break;
16543                 }
16544 
16545         }
16546 
16547         // reset selected flags in the table
16548         for(iIdx=0; iIdx<(int)m_uiISOTableLength; iIdx++)
16549                 m_ISOTable[iIdx]->m_bIsSelected = false;
16550 
16551         // search serial number in iso-table
16552         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
16553         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_UID_LF, &bUidLF));
16554         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID_LEN, &ucUidLen));
16555         if(bUidLF)
16556         {
16557                 sSnr = tmp.substr(0, (ucUidLen<<1));
16558         }
16559         else
16560         {
16561                 sSnr = tmp.substr(0, 16);
16562         }
16563 
16564         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
16565         if(iIdx < 0)
16566                 return iIdx;
16567 
16568         // select new tag
16569         m_ISOTable[iIdx]->m_bIsSelected = true;
16570 
16571         // create command handler for ISO14443 transponder, if not previously done
16572         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A ||
16573                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B )
16574         {
16575                 if(! m_ISOTable[iIdx]->HasTagHandler())
16576                 {
16577                         if(ucMode & FEDM_ISC_ISO_MODE_CINF)
16578                         {
16579                                 // identify transponder chip and create corresponding class
16580                         }
16581                 }
16582         }
16583 
16584         return FEDM_OK;
16585 }
16586 
16587 /***************************************************************************
16588   Begin                 :       19.03.2001 / M. Hultsch
16589   Version               :       02.03.00 / 28.07.2005 / M. Hultsch
16590 
16591   Function                      :       sets the received data of last [0xB0][0x26] iso protocol
16592                                                 into iso-table
16593 
16594   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16595                                                 int iLen                -       length of data
16596 
16597   Return value          :       OK (=0) or error code (<0)
16598 
16599 ***************************************************************************/
16600 int FEDM_ISCReader::Set_0xB0_0x26_IsoTableData(unsigned char* ucData, int iLen)
16601 {
16602         FEDM_CHK3(ucData);
16603 
16604         // search selected entry and deselect it
16605         int iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16606         if(iIdx >= 0)
16607                 m_ISOTable[iIdx]->m_bIsSelected = false;
16608 
16609         return FEDM_OK;
16610 }
16611 
16612 /***************************************************************************
16613   Begin                 :       09.03.2001 / M. Hultsch
16614   Version               :       03.00.13 / 07.10.2009 / M. Hultsch
16615 
16616   Function                      :       sets the received data of last [0xB0][0x2B] iso protocol
16617                                                 into iso-table
16618 
16619   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16620                                                 int iLen                -       length of data
16621                                                 int iStatusByte -       status byte of response protocol
16622 
16623   Return value          :       OK (=0) or error code (<0)
16624 
16625 ***************************************************************************/
16626 int FEDM_ISCReader::Set_0xB0_0x2B_IsoTableData(unsigned char* ucData, int iLen, int iStatusByte)
16627 {
16628         FEDM_CHK3(ucData);
16629 
16630         unsigned char   ucMode  = 0x00;
16631         unsigned char   ucSnr[FEDM_ISC_MAX_UID_LENGTH];
16632         int             iCnt, iIdx, iErr;
16633         string  sSnr, tmp;
16634 
16635         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
16636 
16637         if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
16638         {
16639                 if(iLen == 0)
16640                         return iStatusByte;
16641 
16642                 iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
16643 
16644                 // write new serial number (UID) into table
16645                 for(iCnt=0; iCnt<8; iCnt++)
16646                         m_ISOTable[0]->m_ucSnr[iCnt] = ucData[1+iCnt];
16647         }               
16648         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
16649         {
16650                 if(iLen == 0)
16651                         return iStatusByte;
16652 
16653                 // search serial number in iso-table
16654                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
16655                 sSnr = tmp.substr(0, 16);
16656                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
16657                 if(iIdx < 0)
16658                 {
16659                         // new entry in table
16660                         iIdx = m_uiISOTableLength;
16661                         m_uiISOTableLength++;
16662 
16663                         // write new serial number (UID) into table
16664                         FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sSnr, &ucSnr[0], 8));
16665                         for(iCnt=0; iCnt<8; iCnt++)
16666                                 m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucSnr[iCnt];
16667                 }
16668         }
16669         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
16670         {
16671                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16672                 if(iIdx < 0)
16673                         return iIdx;
16674         }
16675         else
16676         {
16677                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
16678                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
16679         }
16680 
16681         // the reader sends no data, the tag is probably lost: 
16682         // we deselect the tag and return with the status byte of the response protocol
16683         if(iLen == 0)
16684         {
16685                 m_ISOTable[iIdx]->m_bIsSelected = false;
16686                 return iStatusByte;
16687         }
16688 
16689         // save the response data (except the UID)
16690         m_ISOTable[iIdx]->m_ucDsfID                     = ucData[ 0];
16691         m_ISOTable[iIdx]->m_ucAFI                       = ucData[ 9];
16692         m_ISOTable[iIdx]->m_ucMemSize[0]        = ucData[10];   // contains block size
16693         m_ISOTable[iIdx]->m_ucMemSize[1]        = ucData[11];   // block length (single or high byte)
16694         if(iLen == 14)
16695         {
16696                 m_ISOTable[iIdx]->m_ucMemSize[2]        = ucData[12];   // block length (low byte)
16697                 m_ISOTable[iIdx]->m_ucICRef                     = ucData[13];
16698                 m_ISOTable[iIdx]->m_ucMemSizeLen        = 3;
16699         }
16700         else
16701         {
16702                 m_ISOTable[iIdx]->m_ucICRef                     = ucData[12];
16703                 m_ISOTable[iIdx]->m_ucMemSizeLen        = 2;
16704         }
16705 
16706         // if valid data in mem size, save block size information
16707         if(ucData[10] > 0)
16708                 m_ISOTable[iIdx]->m_ucBlockSize = (ucData[10] & 0x1F) + (unsigned char)0x01;
16709                 
16710         m_ISOTable[iIdx]->m_bIsSnr                      = true;
16711         m_ISOTable[iIdx]->m_bIsAFI                      = true;
16712         m_ISOTable[iIdx]->m_bIsSysInfo          = true;
16713         m_ISOTable[iIdx]->m_bIsBlockSizeSet     = true;
16714 
16715         return FEDM_OK;
16716 }
16717 
16718 /***************************************************************************
16719   Begin                 :       09.03.2001 / M. Hultsch
16720   Version               :       04.06.03 / 26.06.2014 / M. Hultsch
16721                                                 - support for extended address mode
16722 
16723                                                 03.00.13 / 07.10.2009 / M. Hultsch
16724 
16725   Function                      :       sets the received data of last [0xB0][0x2C] iso protocol
16726                                                 into iso-table
16727 
16728   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16729                                                 int iLen                -       length of data
16730 
16731   Return value          :       OK (=0) or error code (<0)
16732 
16733 ***************************************************************************/
16734 int FEDM_ISCReader::Set_0xB0_0x2C_IsoTableData(unsigned char* ucData, int iLen)
16735 {
16736         FEDM_CHK3(ucData);
16737 
16738         if(iLen <= 0)
16739                 return FEDM_ERROR_NO_DATA;
16740 
16741         bool bExtAddr = false;
16742         unsigned int    uiDBAdr = 0x00;
16743         unsigned char   ucMode  = 0x00;
16744         unsigned char   ucSnr[FEDM_ISC_MAX_UID_LENGTH];
16745         int             iCnt, iIdx, iBlockCnt, iErr;
16746         string  sSnr, tmp;
16747 
16748         // save number of received data blocks
16749         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B0_RSP_DBN, ucData[0]));
16750         if(ucData[0] == 0)
16751                 return FEDM_OK;
16752 
16753         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE_EXT_ADR, &bExtAddr));
16754         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
16755 
16756         if(bExtAddr)
16757         {
16758                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR_EXT, &uiDBAdr));
16759         }
16760         else
16761         {
16762                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_DB_ADR, &uiDBAdr));
16763         }
16764         
16765         if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_NONADR)    // non addressed
16766         {
16767                 iIdx = m_uiNonAddressedTabIndex;        // use entry with index >= 0
16768         }               
16769         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_ADR)  // addressed
16770         {
16771                 // search serial number in iso-table
16772                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, tmp));
16773                 sSnr = tmp.substr(0, 16);
16774                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
16775                 if(iIdx < 0)
16776                 {
16777                         // new entry in table
16778                         iIdx = m_uiISOTableLength;
16779                         m_uiISOTableLength++;
16780 
16781                         // write new serial number (UID) into table
16782                         FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sSnr, &ucSnr[0], 8));
16783                         for(iCnt=0; iCnt<8; iCnt++)
16784                                 m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucSnr[iCnt];
16785                 
16786                         m_ISOTable[iIdx]->m_bIsSnr = true;
16787                 }
16788         }
16789         else if((unsigned char)(ucMode&0x07) == FEDM_ISC_ISO_MODE_SEL)  // selected
16790         {
16791                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16792                 if(iIdx < 0)
16793                         return iIdx;
16794         }
16795         else
16796         {
16797                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
16798                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
16799         }
16800 
16801         if((unsigned int)(uiDBAdr+ucData[0]) >= m_ISOTable[iIdx]->m_ucSecStatus.size())
16802         {
16803                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_BUFFER_LENGTH));
16804                 return FEDM_ERROR_BUFFER_LENGTH;
16805         }
16806 
16807         // write the received security status into table
16808         for(iBlockCnt=1; iBlockCnt<=ucData[0]; iBlockCnt++)
16809                 m_ISOTable[iIdx]->m_ucSecStatus[uiDBAdr++] = ucData[iBlockCnt];
16810 
16811         return FEDM_OK;
16812 }
16813 
16814 /***************************************************************************
16815   Begin                 :       09.03.2001 / M. Hultsch
16816   Version               :       02.04.01 / 28.03.2006 / M. Hultsch
16817 
16818   Function                      :       sets the received data of last [0xB0][0xA0] iso protocol
16819                                                 into iso-table
16820 
16821   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16822                                                 int iLen                -       length of data
16823 
16824   Return value          :       OK (=0) or error code (<0)
16825 
16826 ***************************************************************************/
16827 int FEDM_ISCReader::Set_0xB0_0xA0_IsoTableData(unsigned char* ucData, int iLen)
16828 {
16829         FEDM_CHK3(ucData);
16830 
16831         if(iLen <= 0)
16832                 return FEDM_ERROR_NO_DATA;
16833 
16834         unsigned char   ucCBAdr = 0x00;
16835         unsigned char   ucMode  = 0x00;
16836         unsigned char   ucSnr[FEDM_ISC_MAX_UID_LENGTH];
16837         int             iByteCnt = 0;
16838         int             iCnt, iIdx, iErr;
16839         string  sSnr, tmp;
16840 
16841         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_MODE, &ucMode));
16842         // only addressed supported
16843         if((unsigned char)(ucMode&0x07) != FEDM_ISC_ISO_MODE_ADR)
16844         {
16845                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
16846                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
16847         }
16848 
16849         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_CB_ADR, &ucCBAdr));
16850         
16851         // search serial number in iso-table
16852         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B0_REQ_UID, sSnr));
16853         sSnr = tmp.substr(0, 16);
16854         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sSnr);
16855         if(iIdx < 0)
16856         {
16857                 // new entry in table
16858                 iIdx = m_uiISOTableLength;
16859                 m_uiISOTableLength++;
16860 
16861                 // write new serial number (UID) into table
16862                 FEDM_CHK1(iErr, FEDM_ConvHexStrToHexUChar(sSnr, &ucSnr[0], 8));
16863                 for(iCnt=0; iCnt<8; iCnt++)
16864                         m_ISOTable[iIdx]->m_ucSnr[iCnt] = ucSnr[iCnt];
16865         }
16866 
16867         // write config data into table
16868         FEDM_CHK1(iErr, m_ISOTable[iIdx]->SetData(0xA0, &ucData[0], iByteCnt, 0, (int)ucCBAdr));
16869 
16870         return FEDM_OK;
16871 }
16872 
16873 
16874 /***************************************************************************
16875   Begin                 :       28.07.2005 / M. Hultsch
16876   Version               :       02.03.00 / 28.07.2005 / M. Hultsch
16877 
16878   Function                      :       sets the received data of last [0xB2][0x2B] iso protocol
16879                                                 into iso-table
16880 
16881   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
16882                                                 int iLen                -       length of data
16883 
16884   Return value          :       OK (=0) or error code (<0)
16885 
16886 ***************************************************************************/
16887 int FEDM_ISCReader::Set_0xB2_0x2B_IsoTableData(unsigned char* ucData, int iLen)
16888 {
16889         FEDM_CHK3(ucData);
16890 
16891         if(iLen <= 0)
16892         {
16893                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_DATA));
16894                 return FEDM_ERROR_NO_DATA;
16895         }
16896 
16897         int             iIdx;
16898 
16899         // command only in selected mode
16900         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
16901         if(iIdx < 0)
16902         {
16903                 // exception for ISO 14443 Transponder, when Reader is configuered with Anticollision = off
16904                 if(  m_uiISOTableLength == 1 && (m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443A || m_ISOTable[0]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO14443B) )
16905                         iIdx = 0;
16906                 else
16907                         return iIdx;
16908         }
16909 
16910         // save the response data
16911         m_ISOTable[iIdx]->m_ucFSCI      = ucData[0];
16912         m_ISOTable[iIdx]->m_ucFWI       = ucData[1];
16913         m_ISOTable[iIdx]->m_ucDSI       = ucData[2];
16914         m_ISOTable[iIdx]->m_ucDRI       = ucData[3];
16915         m_ISOTable[iIdx]->m_ucNad       = ucData[4];
16916         m_ISOTable[iIdx]->m_ucCid       = ucData[5];
16917 
16918         m_ISOTable[iIdx]->m_bIsISO14443_4Info   = true;
16919 
16920         return FEDM_OK;
16921 }
16922 
16924 // functions for [0xB3] EPC Host Protocol
16926 
16927 /***************************************************************************
16928   Begin                 :       30.06.2005 / M. Hultsch
16929   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
16930                                                 - only for EPC Class1 Gen2:
16931                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
16932 
16933                                                 04.03.01 / 01.11.2012 / M. Hultsch
16934                                                 - support for Recommissioning Bits in [0xB3][0x18] Kill
16935 
16936                                                 04.02.04 / 21.06.2012 / M. Hultsch
16937                                                 - UHF Class1 Gen2: support for [0xB3][0x25] Block Permalock and [0xB3][0x26] Read Permalock Status
16938 
16939                                                 04.02.00 / 11.05.2012 / M. Hultsch
16940                                                 - only for EPC Class1 Gen2:
16941                                                   if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
16942 
16943                                                 03.03.04 / 21.06.2011 / M. Hultsch
16944                                                 - only for EPC Class1 Gen2:
16945                                                   if Reader is configured for UID = EPC + TID, set TID as UID for next request in addressed mode
16946 
16947                                                 02.05.05 / 24.10.2006 / M. Hultsch
16948 
16949   Function                      :       collects the necessary data for the next [0xB3] epc protocol
16950 
16951   Parameters            :       unsigned char ucCmdByte -       epc command byte
16952                                                 unsigned char* ucData   -       pointer to buffer for data
16953 
16954   Return value          :       iCnt (>0) or error code (<0)
16955 
16956 ***************************************************************************/
16957 int FEDM_ISCReader::Get_0xB3_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData)
16958 {
16959         FEDM_CHK3(ucData);
16960 
16961         bool bUidLF = false;
16962         bool bRecomBits = false;
16963         int iCnt = 0;
16964         int iErr = 0;
16965         int iIdx = 0;
16966         unsigned char ucUidLen  = 0x00;
16967         unsigned char ucEpcLen  = 0x00;
16968         unsigned char ucTrType  = 0x00;
16969         unsigned char ucLen             = 0x00;
16970         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
16971         string sUid;
16972 
16973         switch(ucCmdByte)
16974         {
16975         case 0x18:      // [0x18] Kill
16976                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucData[iCnt++]));
16977                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE, &ucData[iCnt++]));
16978                 
16979                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
16980                 {
16981                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EPC_LF, &bUidLF));
16982                         if(bUidLF)      // variable UID length
16983                         {
16984                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC_LEN, &ucUidLen));
16985                         }
16986                         else
16987                         {
16988                                 ucUidLen = 8;
16989                         }
16990 
16991                         // UID = unified identifier = serial number
16992                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucUid[0], (int)ucUidLen));
16993                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
16994                         
16995                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
16996                         if(iIdx < 0)
16997                                 return iIdx;
16998 
16999                         // only for UHF EPC Class1 Gen2
17000                         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17001                                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17002                         {
17003                                 // check, if Reader is configured for UID = EPC + TID
17004                                 if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17005                                 {
17006                                         // check, if response contains UID = EPC + TID
17007                                         ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17008                                         if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17009                                                 ucEpcLen -= 2;
17010 
17011                                         if( ucEpcLen < ucUidLen)
17012                                         {
17013                                                 // take TID as UID for next request
17014                                                 if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17015                                                         ucData[iCnt++] = (ucUidLen - ucEpcLen);
17016                                                 
17017                                                 memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17018                                                 iCnt += (ucUidLen - ucEpcLen);
17019                                         }
17020                                         else
17021                                         {
17022                                                 // error in the Reader response: TID is missing
17023                                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17024                                                 return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17025                                         }
17026                                 }
17027                                 else
17028                                 {
17029                                         if(bUidLF || (ucUidLen != 8))
17030                                                 ucData[iCnt++] = ucUidLen;
17031                                         
17032                                         // UID = unified identifier = serial number
17033                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17034                                         iCnt += ucUidLen;
17035                                 }
17036                         }
17037                         else
17038                         {
17039                                 if(bUidLF)      // variable UID length
17040                                 {
17041                                         ucData[iCnt++] = ucUidLen;
17042                                         // UID = unified identifier = serial number
17043                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17044                                         iCnt += ucUidLen;
17045                                 }
17046                                 else
17047                                 {
17048                                         // UID = unified identifier = serial number
17049                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], 8));
17050                                         iCnt += 8;
17051                                 }
17052                         }
17053                 }
17054 
17055                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_KILL_PW_LENGTH, &ucLen));
17056                 ucData[iCnt++] = ucLen;
17057                 if(ucLen > 0)
17058                 {
17059                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_KILL_PW, &ucData[iCnt], ucLen));
17060                         iCnt += ucLen;
17061                 }
17062                 
17063                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_RECOM, &bRecomBits));
17064                 if(bRecomBits)
17065                 {
17066                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_RECOM_BITS, &ucData[iCnt++]));
17067                 }
17068 
17069                 break;
17070 
17071         case 0x22:      // [0x22] Lock
17072                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucData[iCnt++]));
17073                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE, &ucData[iCnt++]));
17074                 
17075                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
17076                 {
17077                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EPC_LF, &bUidLF));
17078                         if(bUidLF)      // variable UID length
17079                         {
17080                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC_LEN, &ucUidLen));
17081                         }
17082                         else
17083                         {
17084                                 ucUidLen = 8;
17085                         }
17086 
17087                         // UID = unified identifier = serial number
17088                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucUid[0], (int)ucUidLen));
17089                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
17090                         
17091                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
17092                         if(iIdx < 0)
17093                                 return iIdx;
17094 
17095                         // only for UHF EPC Class1 Gen2
17096                         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17097                                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17098                         {
17099                                 // check, if Reader is configured for UID = EPC + TID
17100                                 if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17101                                 {
17102                                         // check, if response contains UID = EPC + TID
17103                                         ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17104                                         if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17105                                                 ucEpcLen -= 2;
17106 
17107                                         if( ucEpcLen < ucUidLen)
17108                                         {
17109                                                 // take TID as UID for next request
17110                                                 if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17111                                                         ucData[iCnt++] = (ucUidLen - ucEpcLen);
17112                                                 
17113                                                 memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17114                                                 iCnt += (ucUidLen - ucEpcLen);
17115                                         }
17116                                         else
17117                                         {
17118                                                 // error in the Reader response: TID is missing
17119                                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17120                                                 return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17121                                         }
17122                                 }
17123                                 else
17124                                 {
17125                                         if(bUidLF || (ucUidLen != 8))
17126                                                 ucData[iCnt++] = ucUidLen;
17127                                         
17128                                         // UID = unified identifier = serial number
17129                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17130                                         iCnt += ucUidLen;
17131                                 }
17132                         }
17133                         else
17134                         {
17135                                 if(bUidLF)      // variable UID length
17136                                 {
17137                                         ucData[iCnt++] = ucUidLen;
17138                                         // UID = unified identifier = serial number
17139                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17140                                         iCnt += ucUidLen;
17141                                 }
17142                                 else
17143                                 {
17144                                         // UID = unified identifier = serial number
17145                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], 8));
17146                                         iCnt += 8;
17147                                 }
17148                         }
17149                 }
17150                         
17151                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_TR_TYPE, &ucTrType));
17152                 ucData[iCnt++] = ucTrType;
17153 
17154                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_LOCK_DATA_LENGTH, &ucLen));
17155                 ucData[iCnt++] = ucLen;
17156 
17157                 switch(ucTrType)
17158                 {
17159                 case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN1:
17160                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_LOCK_DATA, &ucData[iCnt], ucLen));
17161                         iCnt += ucLen;
17162                         ucData[iCnt++] = 0x00; // PW-Length
17163                         break;
17164 
17165                 case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2:
17166                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_LOCK_DATA, &ucData[iCnt], ucLen));
17167                         iCnt += ucLen;
17168                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW_LENGTH, &ucLen));
17169                         ucData[iCnt++] = ucLen;
17170                         if(ucLen > 0)
17171                         {
17172                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW, &ucData[iCnt], ucLen));
17173                                 iCnt += ucLen;
17174                         }
17175                         break;
17176                 }
17177 
17178                 break;
17179 
17180         case 0x24:      // [0x24] Write Multiple Blocks
17181                 FEDM_CHK1(iErr, Get_0xB3_0x24_IsoTableData(ucData));
17182                 iCnt += iErr;
17183                 break;
17184 
17185         case 0x25:      // [0x25] Block Permalock
17186                 FEDM_CHK1(iErr, Get_0xB3_0x25_IsoTableData(ucData));
17187                 iCnt += iErr;
17188                 break;
17189 
17190         case 0x26:      // [0x26] Read Permalock Status
17191                 FEDM_CHK1(iErr, Get_0xB3_0x26_IsoTableData(ucData));
17192                 iCnt += iErr;
17193                 break;
17194 
17195         default:
17196                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
17197                 return FEDM_ERROR_UNSUPPORTED;
17198         }
17199 
17200         return iCnt;
17201 }
17202 
17203 /***************************************************************************
17204   Begin                 :       30.06.2005 / M. Hultsch
17205   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
17206                                                 - only for EPC Class1 Gen2:
17207                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
17208 
17209                                                 04.02.00 / 11.05.2012 / M. Hultsch
17210                                                 - only for EPC Class1 Gen2:
17211                                                   if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
17212 
17213                                                 04.00.99 / 29.07.2011 / M. Hultsch
17214 
17215   Function                      :       collects the necessary data for the next [0xB3][0x24] epc protocol
17216 
17217   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
17218 
17219   Return value          :       iCnt (>0) or error code (<0)
17220 
17221 ***************************************************************************/
17222 int FEDM_ISCReader::Get_0xB3_0x24_IsoTableData(unsigned char* ucData)
17223 {
17224         FEDM_CHK3(ucData);
17225 
17226         bool bUidLF = false;
17227         bool bExtAdr = false;
17228         bool bAccessPw = false;
17229         int iCnt = 0;
17230         int iIdx = 0;
17231         int iErr = 0;
17232         int iBlockCnt = 0;
17233         unsigned char ucBank    = 0x03; // User Memory Bank
17234         unsigned char ucDBN             = 0x00;
17235         unsigned char ucBlockSize = 0x04;
17236         unsigned char ucUidLen  = 0x00;
17237         unsigned char ucEpcLen  = 0x00;
17238         unsigned char ucLen             = 0x00;
17239         unsigned int uiDBAdr    = 0;
17240         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
17241         string sUid;
17242 
17243         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucData[iCnt++]));
17244         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE, &ucData[iCnt++]));
17245 
17246         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
17247         {
17248                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
17249         }
17250         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
17251         {
17252                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EPC_LF, &bUidLF));
17253                 if(bUidLF)      // variable UID length
17254                 {
17255                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC_LEN, &ucUidLen));
17256                 }
17257                 else
17258                 {
17259                         ucUidLen = 8;
17260                 }
17261 
17262                 // UID = unified identifier = serial number
17263                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucUid[0], (int)ucUidLen));
17264                 FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
17265                 
17266                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
17267                 if(iIdx < 0)
17268                         return iIdx;
17269 
17270                 // only for UHF EPC Class1 Gen2
17271                 if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17272                         m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17273                 {
17274                         // check, if Reader is configured for UID = EPC + TID
17275                         if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17276                         {
17277                                 // check, if response contains UID = EPC + TID
17278                                 ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17279                                 if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17280                                         ucEpcLen -= 2;
17281 
17282                                 if( ucEpcLen < ucUidLen)
17283                                 {
17284                                         // take TID as UID for next request
17285                                         if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17286                                                 ucData[iCnt++] = (ucUidLen - ucEpcLen);
17287                                         
17288                                         memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17289                                         iCnt += (ucUidLen - ucEpcLen);
17290                                 }
17291                                 else
17292                                 {
17293                                         // error in the Reader response: TID is missing
17294                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17295                                         return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17296                                 }
17297                         }
17298                         else
17299                         {
17300                                 if(bUidLF || (ucUidLen != 8))
17301                                         ucData[iCnt++] = ucUidLen;
17302                                 
17303                                 // UID = unified identifier = serial number
17304                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17305                                 iCnt += ucUidLen;
17306                         }
17307                 }
17308                 else
17309                 {
17310                         if(bUidLF)      // variable UID length
17311                         {
17312                                 ucData[iCnt++] = ucUidLen;
17313                                 // UID = unified identifier = serial number
17314                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17315                                 iCnt += ucUidLen;
17316                         }
17317                         else
17318                         {
17319                                 // UID = unified identifier = serial number
17320                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], 8));
17321                                 iCnt += 8;
17322                         }
17323                 }
17324         }
17325         else
17326         {
17327                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
17328                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
17329         }
17330 
17331         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EXT_ADR, &bExtAdr));
17332         if(bExtAdr)
17333         {
17334                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK, &ucData[iCnt++]));
17335                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_BANK_NR, &ucBank));
17336                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_ACCESS_FLAG, &bAccessPw));
17337                 if(bAccessPw)
17338                 {
17339                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW_LENGTH, &ucLen));
17340                         ucData[iCnt++] = ucLen;
17341                         if(ucLen > 0)
17342                         {
17343                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW, &ucData[iCnt], ucLen));
17344                                 iCnt += ucLen;
17345                         }
17346                 }
17347                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
17348                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DB_ADR_EXT, &uiDBAdr));
17349                 iCnt += 2;
17350         }
17351         else
17352         {
17353                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DB_ADR, &ucData[iCnt++]));
17354                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DB_ADR, &uiDBAdr));
17355         }
17356 
17357         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DBN, &ucData[iCnt++]));
17358         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DBN, &ucDBN));
17359         
17360 
17361         // take the blocksize from table
17362         ucBlockSize = m_ISOTable[iIdx]->m_ucBlockSize;
17363         FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B3_REQ_DB_SIZE, ucBlockSize));
17364         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_DB_SIZE, &ucData[iCnt++]));
17365 
17366         // avoid buffer overflow
17367         if( (5+iCnt+ucDBN*ucBlockSize) > FEDM_MAX_PROTOCOL_SIZE)        //    5 : general protocol frame
17368                                                                                                                                 // iCnt : [0x24] protocol frame
17369         {
17370                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_SENDBUFFER_OVERFLOW));
17371                 return FEDM_ERROR_SENDBUFFER_OVERFLOW;
17372         }
17373 
17374         for(iBlockCnt=0; iBlockCnt<ucDBN; iBlockCnt++)
17375         {
17376                 FEDM_CHK1(iErr, m_ISOTable[iIdx]->GetData(0x24, ucData, iCnt, ucBank, uiDBAdr));
17377                 uiDBAdr++;
17378         }
17379 
17380         return iCnt;
17381 }
17382 
17383 /***************************************************************************
17384   Begin                 :       21.06.2012 / M. Hultsch
17385   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
17386                                                 - only for EPC Class1 Gen2:
17387                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
17388 
17389                                                 04.02.04 / 21.06.2012 / M. Hultsch
17390 
17391   Function                      :       collects the necessary data for the next [0xB3][0x25] Block Permalock protocol
17392 
17393   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
17394 
17395   Return value          :       iCnt (>0) or error code (<0)
17396 
17397 ***************************************************************************/
17398 int FEDM_ISCReader::Get_0xB3_0x25_IsoTableData(unsigned char* ucData)
17399 {
17400         FEDM_CHK3(ucData);
17401 
17402         bool bUidLF = false;
17403         bool bExtAdr = false;
17404         bool bAccessPw = false;
17405         int iCnt = 0;
17406         int iIdx = 0;
17407         int iErr = 0;
17408         unsigned char ucBank    = 0x03; // User Memory Bank
17409         unsigned char ucUidLen  = 0x00;
17410         unsigned char ucEpcLen  = 0x00;
17411         unsigned char ucLen             = 0x00;
17412         unsigned char ucBlockRange      = 0;
17413         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
17414         string sUid;
17415 
17416         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucData[iCnt++]));
17417         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE, &ucData[iCnt++]));
17418 
17419         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
17420         {
17421                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
17422         }
17423         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
17424         {
17425                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EPC_LF, &bUidLF));
17426                 if(bUidLF)      // variable UID length
17427                 {
17428                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC_LEN, &ucUidLen));
17429                 }
17430                 else
17431                 {
17432                         // error: EPC_LF is missing
17433                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " - mode flag EPC_LF is missing");
17434                         return FEDM_ERROR_PARAMETER;
17435                 }
17436 
17437                 // UID = unified identifier = serial number
17438                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucUid[0], (int)ucUidLen));
17439                 FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
17440                 
17441                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
17442                 if(iIdx < 0)
17443                         return iIdx;
17444 
17445                 // only for UHF EPC Class1 Gen2
17446                 if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17447                         m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17448                 {
17449                         // check, if Reader is configured for UID = EPC + TID
17450                         if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17451                         {
17452                                 // check, if response contains UID = EPC + TID
17453                                 ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17454                                 if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17455                                         ucEpcLen -= 2;
17456 
17457                                 if( ucEpcLen < ucUidLen)
17458                                 {
17459                                         // take TID as UID for next request
17460                                         if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17461                                                 ucData[iCnt++] = (ucUidLen - ucEpcLen);
17462                                         
17463                                         memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17464                                         iCnt += (ucUidLen - ucEpcLen);
17465                                 }
17466                                 else
17467                                 {
17468                                         // error in the Reader response: TID is missing
17469                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17470                                         return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17471                                 }
17472                         }
17473                         else
17474                         {
17475                                 if(bUidLF || (ucUidLen != 8))
17476                                         ucData[iCnt++] = ucUidLen;
17477                                 
17478                                 // UID = unified identifier = serial number
17479                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17480                                 iCnt += ucUidLen;
17481                         }
17482                 }
17483                 else
17484                 {
17485                         if(bUidLF)      // variable UID length
17486                         {
17487                                 ucData[iCnt++] = ucUidLen;
17488                                 // UID = unified identifier = serial number
17489                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17490                                 iCnt += ucUidLen;
17491                         }
17492                         else
17493                         {
17494                                 // UID = unified identifier = serial number
17495                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], 8));
17496                                 iCnt += 8;
17497                         }
17498                 }
17499         }
17500         else
17501         {
17502                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
17503                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
17504         }
17505 
17506         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EXT_ADR, &bExtAdr));
17507         if(bExtAdr)
17508         {
17509                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK, &ucData[iCnt++]));
17510                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_BANK_NR, &ucBank));
17511                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_ACCESS_FLAG, &bAccessPw));
17512                 if(bAccessPw)
17513                 {
17514                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW_LENGTH, &ucLen));
17515                         ucData[iCnt++] = ucLen;
17516                         if(ucLen > 0)
17517                         {
17518                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW, &ucData[iCnt], ucLen));
17519                                 iCnt += ucLen;
17520                         }
17521                 }
17522         }
17523         else
17524         {
17525                 // error: flag EXT_ADR is missing
17526                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " - mode flag EXT_ADR is missing");
17527                 return FEDM_ERROR_PARAMETER;
17528         }
17529 
17530         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_PTR, &ucData[iCnt], 2));
17531         iCnt += 2;
17532         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_RANGE, &ucData[iCnt]));
17533         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_RANGE, &ucBlockRange));
17534         iCnt++;
17535 
17536         // avoid mask buffer overflow
17537         if( (2*ucBlockRange) > 8) // FEDM_ISC_TMP_B3_REQ_MASK is limited to 8 bytes
17538         {
17539                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Block-Range is greater than 4");
17540                 return FEDM_ERROR_BUFFER_LENGTH;
17541         }
17542 
17543         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_MASK, &ucData[iCnt], 2*ucBlockRange));
17544         iCnt += 2*ucBlockRange;
17545 
17546         return iCnt;
17547 }
17548 
17549 
17550 /***************************************************************************
17551   Begin                 :       21.06.2012 / M. Hultsch
17552   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
17553                                                 - only for EPC Class1 Gen2:
17554                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
17555 
17556                                                 04.02.04 / 21.06.2012 / M. Hultsch
17557 
17558   Function                      :       collects the necessary data for the next [0xB3][0x26] Read Permalock Status protocol
17559 
17560   Parameters            :       unsigned char* ucData   -       pointer to buffer for data
17561 
17562   Return value          :       iCnt (>0) or error code (<0)
17563 
17564 ***************************************************************************/
17565 int FEDM_ISCReader::Get_0xB3_0x26_IsoTableData(unsigned char* ucData)
17566 {
17567         FEDM_CHK3(ucData);
17568 
17569         bool bUidLF = false;
17570         bool bExtAdr = false;
17571         bool bAccessPw = false;
17572         int iCnt = 0;
17573         int iIdx = 0;
17574         int iErr = 0;
17575         unsigned char ucBank    = 0x03; // User Memory Bank
17576         unsigned char ucUidLen  = 0x00;
17577         unsigned char ucEpcLen  = 0x00;
17578         unsigned char ucLen             = 0x00;
17579         unsigned char ucBlockRange      = 0;
17580         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
17581         string sUid;
17582 
17583         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucData[iCnt++]));
17584         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE, &ucData[iCnt++]));
17585 
17586         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_NONADR) // non addressed
17587         {
17588                 iIdx = m_uiNonAddressedTabIndex;        // take data from entry with index >= 0
17589         }
17590         else if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)       // addressed
17591         {
17592                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EPC_LF, &bUidLF));
17593                 if(bUidLF)      // variable UID length
17594                 {
17595                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC_LEN, &ucUidLen));
17596                 }
17597                 else
17598                 {
17599                         // error: EPC_LF is missing
17600                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " - mode flag EPC_LF is missing");
17601                         return FEDM_ERROR_PARAMETER;
17602                 }
17603 
17604                 // UID = unified identifier = serial number
17605                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucUid[0], (int)ucUidLen));
17606                 FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
17607                 
17608                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
17609                 if(iIdx < 0)
17610                         return iIdx;
17611 
17612                 // only for UHF EPC Class1 Gen2
17613                 if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17614                         m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17615                 {
17616                         // check, if Reader is configured for UID = EPC + TID
17617                         if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17618                         {
17619                                 // check, if response contains UID = EPC + TID
17620                                 ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17621                                 if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17622                                         ucEpcLen -= 2;
17623 
17624                                 if( ucEpcLen < ucUidLen)
17625                                 {
17626                                         // take TID as UID for next request
17627                                         if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17628                                                 ucData[iCnt++] = (ucUidLen - ucEpcLen);
17629                                         
17630                                         memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17631                                         iCnt += (ucUidLen - ucEpcLen);
17632                                 }
17633                                 else
17634                                 {
17635                                         // error in the Reader response: TID is missing
17636                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17637                                         return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17638                                 }
17639                         }
17640                         else
17641                         {
17642                                 if(bUidLF || (ucUidLen != 8))
17643                                         ucData[iCnt++] = ucUidLen;
17644                                 
17645                                 // UID = unified identifier = serial number
17646                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17647                                 iCnt += ucUidLen;
17648                         }
17649                 }
17650                 else
17651                 {
17652                         if(bUidLF)      // variable UID length
17653                         {
17654                                 ucData[iCnt++] = ucUidLen;
17655                                 // UID = unified identifier = serial number
17656                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], ucUidLen));
17657                                 iCnt += ucUidLen;
17658                         }
17659                         else
17660                         {
17661                                 // UID = unified identifier = serial number
17662                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_EPC, &ucData[iCnt], 8));
17663                                 iCnt += 8;
17664                         }
17665                 }
17666         }
17667         else
17668         {
17669                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_UNKNOWN_ADDRESS_MODE));
17670                 return FEDM_ERROR_UNKNOWN_ADDRESS_MODE;
17671         }
17672 
17673         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_MODE_EXT_ADR, &bExtAdr));
17674         if(bExtAdr)
17675         {
17676                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK, &ucData[iCnt++]));
17677                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_BANK_NR, &ucBank));
17678                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BANK_ACCESS_FLAG, &bAccessPw));
17679                 if(bAccessPw)
17680                 {
17681                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW_LENGTH, &ucLen));
17682                         ucData[iCnt++] = ucLen;
17683                         if(ucLen > 0)
17684                         {
17685                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_ACCESS_PW, &ucData[iCnt], ucLen));
17686                                 iCnt += ucLen;
17687                         }
17688                 }
17689         }
17690         else
17691         {
17692                 // error: flag EXT_ADR is missing
17693                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " - mode flag EXT_ADR is missing");
17694                 return FEDM_ERROR_PARAMETER;
17695         }
17696 
17697         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_PTR, &ucData[iCnt], 2));
17698         iCnt += 2;
17699         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_RANGE, &ucData[iCnt]));
17700         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_RANGE, &ucBlockRange));
17701         iCnt++;
17702 
17703         // avoid mask buffer overflow
17704         if( (2*ucBlockRange) > 8) // FEDM_ISC_TMP_B3_REQ_MASK is limited to 8 bytes
17705         {
17706                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Block-Range is greater than 4");
17707                 return FEDM_ERROR_BUFFER_LENGTH;
17708         }
17709 
17710         return iCnt;
17711 }
17712 
17713 
17714 /***************************************************************************
17715   Begin                 :       21.06.2012 / M. Hultsch
17716   Version               :       04.02.06 / 03.08.2012 / M. Hultsch
17717 
17718   Function                      :       sets the received data of last [0xB3] epc protocol
17719 
17720   Parameters            :       unsigned char* ucData   -       pointer to buffer with data
17721                                                 int iLen                                -       length of data
17722                                                 int iStatusByte                 -       status byte of receive protocol
17723 
17724   Return value          :       OK (=0) or error code (<0)
17725 
17726 ***************************************************************************/
17727 int FEDM_ISCReader::Set_0xB3_IsoTableData(unsigned char* ucData, int iLen, int iStatusByte)
17728 {
17729         FEDM_CHK3(ucData);
17730 
17731         unsigned char   ucCmd   = 0x00;
17732         unsigned char ucBlockRange      = 0;
17733         int iByteCnt = 0;
17734         int iErr = 0;
17735 
17736         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_CMD, &ucCmd));
17737 
17738         switch(ucCmd)
17739         {
17740         case 0x18:      // [0xB3][0x18] Kill
17741         case 0x22:      // [0xB3][0x22] Lock
17742         case 0x24:      // [0xB3][0x24] Write Multiple Blocks
17743         case 0x25:      // [0xB3][0x25] Block Permalock
17744                 break;
17745 
17746         case 0x26:      // [0xB3][0x26] Read Permalock Status
17747                 if(iLen <= 0)
17748                 {
17749                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_NO_DATA));
17750                         return FEDM_ERROR_NO_DATA;
17751                 }
17752 
17753                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B3_REQ_BLOCK_RANGE, &ucBlockRange));
17754 
17755                 // avoid mask buffer overflow
17756                 if( (2*ucBlockRange) > 8) // FEDM_ISC_TMP_B3_REQ_MASK is limited to 8 bytes
17757                 {
17758                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " Block-Range is greater than 4");
17759                         return FEDM_ERROR_BUFFER_LENGTH;
17760                 }
17761 
17762                 FEDM_CHK1(iErr, SetData(FEDM_ISC_TMP_B3_RSP_MASK, &ucData[iByteCnt++], 2*ucBlockRange));
17763 
17764                 break;
17765 
17766         default:
17767                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
17768                 return FEDM_ERROR_UNSUPPORTED;
17769         }
17770 
17771         return FEDM_OK;
17772 }
17773 
17774 
17776 // functions for [0xB4] EPC UHF Host Protocol
17778 
17779 /***************************************************************************
17780   Begin                 :       23.10.2006 / M. Hultsch
17781   Version               :       03.01.05 / 22.04.2010 / M. Hultsch
17782 
17783   Function                      :       collects the necessary data for the next [0xB4] epc uhf protocol
17784 
17785   Parameters            :       unsigned char ucCmdByte -       epc command byte
17786                                                 unsigned char* ucData   -       pointer to buffer for data
17787 
17788   Return value          :       iCnt (>0) or error code (<0)
17789 
17790 ***************************************************************************/
17791 int FEDM_ISCReader::Get_0xB4_IsoTableData(unsigned char ucCmdByte, unsigned char* ucData)
17792 {
17793         FEDM_CHK3(ucData);
17794 
17795         int iErr = 0;
17796         int iCnt = 0;
17797         unsigned char ucMfr     = 0x00;
17798 
17799         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MFR, &ucMfr));
17800 
17801         switch(ucMfr)
17802         {
17803         case FEDM_ISC_ISO_MFR_NXP:
17804                 return Get_0xB4_IsoTableData_NXP(ucCmdByte, ucData);
17805 
17806         case FEDM_ISC_ISO_MFR_EM:
17807                 return Get_0xB4_IsoTableData_EM(ucCmdByte, ucData);
17808 
17809         case FEDM_ISC_ISO_MFR_IDS:
17810                 return Get_0xB4_IsoTableData_IDS(ucCmdByte, ucData);
17811 
17812         default:
17813                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ", Manufacturer=0x" << std::hex << std::uppercase << (int)ucMfr << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
17814                 return FEDM_ERROR_UNSUPPORTED;
17815         }
17816 
17817         return iCnt;
17818 }
17819 
17820 /***************************************************************************
17821   Begin                 :       22.04.2010 / M. Hultsch
17822   Version               :       04.06.10 / 02.12.2014 / M. Hultsch
17823                                                 - new [0xB4] NXP Custom Commands: 0x10, 0x11, 0x12
17824 
17825                                                 04.06.06 / 23.09.2013 / M. Hultsch
17826                                                 - only for EPC Class1 Gen2:
17827                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
17828 
17829                                                 04.02.00 / 11.05.2012 / M. Hultsch
17830                                                 - if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
17831 
17832                                                 04.00.00 / 29.07.2011 / M. Hultsch
17833 
17834   Function                      :       collects the necessary data for the next [0xB4] epc uhf protocol
17835 
17836   Parameters            :       unsigned char ucCmdByte -       epc command byte
17837                                                 unsigned char* ucData   -       pointer to buffer for data
17838 
17839   Return value          :       iCnt (>0) or error code (<0)
17840 
17841 ***************************************************************************/
17842 int FEDM_ISCReader::Get_0xB4_IsoTableData_NXP(unsigned char ucCmdByte, unsigned char* ucData)
17843 {
17844         FEDM_CHK3(ucData);
17845 
17846         bool bUidLF = false;
17847         bool bExtAdr = false;
17848         bool bAccessPw = false;
17849         int iErr = 0;
17850         int iCnt = 0;
17851         int iIdx = 0;
17852         unsigned char ucUidLen  = 0x00;
17853         unsigned char ucEpcLen  = 0x00;
17854         unsigned char ucLen             = 0x00;
17855         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
17856         string sUid;
17857 
17858         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_CMD, &ucData[iCnt++]));
17859         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE, &ucData[iCnt++]));
17860 
17861         switch(ucCmdByte)
17862         {
17863         case 0x04:      // [0x04] EAS Alarm
17864                 break; // only non-addressed
17865 
17866         case 0x00:      // [0x00] Lock Block
17867         case 0x01:      // [0x01] Change Quiet Bit
17868         case 0x03:      // [0x03] Change EAS
17869         case 0x05:      // [0x05] Calibrate
17870         case 0x06:      // [0x06] Change Config
17871         case 0x07:      // [0x07] Read Protect
17872         case 0x08:      // [0x08] Reset Read Protect
17873         //case 0x10:    // [0x10] Untraceable
17874         //case 0x11:    // [0x11] Authenticate
17875         case 0x12:      // [0x12] Write Key
17876                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
17877                 {
17878                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EPC_LF, &bUidLF));
17879                         if(bUidLF)      // variable UID length
17880                         {
17881                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC_LEN, &ucUidLen));
17882                         }
17883                         else
17884                         {
17885                                 ucUidLen = 8;
17886                         }
17887 
17888                         // UID = unified identifier = serial number
17889                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucUid[0], (int)ucUidLen));
17890                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
17891                         
17892                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
17893                         if(iIdx < 0)
17894                                 return iIdx;
17895 
17896                         // only for UHF EPC Class1 Gen2
17897                         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
17898                                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
17899                         {
17900                                 // check, if Reader is configured for UID = EPC + TID
17901                                 if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
17902                                 {
17903                                         // check, if response contains UID = EPC + TID
17904                                         ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
17905                                         if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
17906                                                 ucEpcLen -= 2;
17907 
17908                                         if( ucEpcLen < ucUidLen)
17909                                         {
17910                                                 // take TID as UID for next request
17911                                                 if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
17912                                                         ucData[iCnt++] = (ucUidLen - ucEpcLen);
17913                                                 
17914                                                 memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
17915                                                 iCnt += (ucUidLen - ucEpcLen);
17916                                         }
17917                                         else
17918                                         {
17919                                                 // error in the Reader response: TID is missing
17920                                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
17921                                                 return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
17922                                         }
17923                                 }
17924                                 else
17925                                 {
17926                                         if(bUidLF || (ucUidLen != 8))
17927                                                 ucData[iCnt++] = ucUidLen;
17928                                         
17929                                         // UID = unified identifier = serial number
17930                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
17931                                         iCnt += ucUidLen;
17932                                 }
17933                         }
17934                         else
17935                         {
17936                                 if(bUidLF)      // variable UID length
17937                                 {
17938                                         ucData[iCnt++] = ucUidLen;
17939                                         // UID = unified identifier = serial number
17940                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
17941                                         iCnt += ucUidLen;
17942                                 }
17943                                 else
17944                                 {
17945                                         // UID = unified identifier = serial number
17946                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], 8));
17947                                         iCnt += 8;
17948                                 }
17949                         }
17950                 }
17951                 break;
17952 
17953         default:
17954                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
17955                 return FEDM_ERROR_PARAMETER;
17956         }
17957 
17958         switch(ucCmdByte)
17959         {
17960         case 0x00:      // [0x00] Lock Block
17961                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
17962                 if(bExtAdr)
17963                 {
17964                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
17965                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
17966                         if(bAccessPw)
17967                         {
17968                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
17969                                 ucData[iCnt++] = ucLen;
17970                                 if(ucLen > 0)
17971                                 {
17972                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
17973                                         iCnt += ucLen;
17974                                 }
17975                         }
17976                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_DB_ADR_EXT, &ucData[iCnt], 2));
17977                         iCnt += 2;
17978                 }
17979                 else
17980                 {
17981                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_DB_ADR, &ucData[iCnt++]));
17982                 }
17983 
17984                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_DBN, &ucData[iCnt++]));
17985                 break;
17986 
17987         case 0x01:      // [0x01] Change Quiet Bit
17988                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
17989                 if(bExtAdr)
17990                 {
17991                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
17992                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
17993                         if(bAccessPw)
17994                         {
17995                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
17996                                 ucData[iCnt++] = ucLen;
17997                                 if(ucLen > 0)
17998                                 {
17999                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18000                                         iCnt += ucLen;
18001                                 }
18002                         }
18003                 }
18004                 else
18005                 {
18006                 }
18007 
18008                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_QUIET_BIT, &ucData[iCnt++]));
18009                 break;
18010 
18011         case 0x03:      // [0x03] Change EAS
18012                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18013                 if(bExtAdr)
18014                 {
18015                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18016                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18017                         if(bAccessPw)
18018                         {
18019                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18020                                 ucData[iCnt++] = ucLen;
18021                                 if(ucLen > 0)
18022                                 {
18023                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18024                                         iCnt += ucLen;
18025                                 }
18026                         }
18027                 }
18028                 else
18029                 {
18030                 }
18031 
18032                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_EAS, &ucData[iCnt++]));
18033                 break;
18034 
18035         case 0x04:      // [0x04] EAS Alarm
18036                 break;
18037 
18038         case 0x05:      // [0x05] Calibrate
18039         case 0x07:      // [0x07] Read Protect
18040         case 0x08:      // [0x08] Reset Read Protect
18041                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18042                 if(bExtAdr)
18043                 {
18044                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18045                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18046                         if(bAccessPw)
18047                         {
18048                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18049                                 ucData[iCnt++] = ucLen;
18050                                 if(ucLen > 0)
18051                                 {
18052                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18053                                         iCnt += ucLen;
18054                                 }
18055                         }
18056                 }
18057                 break;
18058 
18059         case 0x06:      // [0x06] Change Config
18060                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18061                 if(bExtAdr)
18062                 {
18063                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18064                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18065                         if(bAccessPw)
18066                         {
18067                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18068                                 ucData[iCnt++] = ucLen;
18069                                 if(ucLen > 0)
18070                                 {
18071                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18072                                         iCnt += ucLen;
18073                                 }
18074                         }
18075                 }
18076 
18077                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_CONFIG_WORD, &ucData[iCnt], 2));
18078                 iCnt += 2;
18079                 break;
18080 
18081 /*      case 0x10:      // [0x10] Untraceable
18082                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18083                 if(bExtAdr)
18084                 {
18085                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18086                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18087                         if(bAccessPw)
18088                         {
18089                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18090                                 ucData[iCnt++] = ucLen;
18091                                 if(ucLen > 0)
18092                                 {
18093                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18094                                         iCnt += ucLen;
18095                                 }
18096                         }
18097                 }
18098 
18099                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_UFLAG, &ucData[iCnt++]));
18100                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_HIDE, &ucData[iCnt], 2));
18101                 iCnt += 2;
18102                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_RANGE, &ucData[iCnt++]));
18103                 break;
18104 
18105         case 0x11:      // [0x11] Authenticate
18106                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18107                 if(bExtAdr)
18108                 {
18109                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18110                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18111                         if(bAccessPw)
18112                         {
18113                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18114                                 ucData[iCnt++] = ucLen;
18115                                 if(ucLen > 0)
18116                                 {
18117                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18118                                         iCnt += ucLen;
18119                                 }
18120                         }
18121                 }
18122 
18123                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_RESP_FLAG, &ucData[iCnt++]));
18124                 iCnt++; // reserved byte
18125                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_TAM, &ucData[iCnt++]));
18126                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_KEY_ID, &ucData[iCnt++]));
18127                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_PROFILE, &ucData[iCnt++]));
18128                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_OFFSET, &ucData[iCnt], 2));
18129                 iCnt += 2;
18130                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_BLOCK_COUNT, &ucData[iCnt++]));
18131                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_PROT_MODE, &ucData[iCnt++]));
18132                 break;*/
18133 
18134         case 0x12:      // [0x12] Write Key
18135                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18136                 if(bExtAdr)
18137                 {
18138                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18139                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18140                         if(bAccessPw)
18141                         {
18142                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18143                                 ucData[iCnt++] = ucLen;
18144                                 if(ucLen > 0)
18145                                 {
18146                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18147                                         iCnt += ucLen;
18148                                 }
18149                         }
18150                 }
18151 
18152                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_KEY_TYPE, &ucData[iCnt++]));
18153                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_NXP_KEY, &ucData[iCnt], 16));
18154                 iCnt += 16;
18155                 break;
18156         }
18157 
18158         return iCnt;
18159 }
18160 
18161 /***************************************************************************
18162   Begin                 :       09.12.2014 / M. Hultsch
18163   Version               :       04.06.10 / 09.12.2014 / M. Hultsch
18164 
18165   Function                      :       collects the necessary data for the next [0xB4] epc uhf protocol
18166 
18167   Parameters            :       unsigned char ucCmdByte -       epc command byte
18168                                                 unsigned char* ucData   -       pointer to buffer for data
18169 
18170   Return value          :       iCnt (>0) or error code (<0)
18171 
18172 ***************************************************************************/
18173 int FEDM_ISCReader::Get_0xB4_IsoTableData_EM(unsigned char ucCmdByte, unsigned char* ucData)
18174 {
18175         FEDM_CHK3(ucData);
18176 
18177         bool bUidLF = false;
18178         int iErr = 0;
18179         int iCnt = 0;
18180         int iIdx = 0;
18181         unsigned char ucUidLen  = 0x00;
18182         unsigned char ucEpcLen  = 0x00;
18183         unsigned char ucCmdSize = 0x00;
18184         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
18185         string sUid;
18186 
18187         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_CMD, &ucData[iCnt++]));
18188         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE, &ucData[iCnt++]));
18189 
18190         switch(ucCmdByte)
18191         {
18192         case 0x00:      // [0x00] GetUid
18193         case 0x01:      // [0x01] Get Sensor Data
18194         case 0x02:      // [0x02] Send SPI Command
18195         case 0x04:      // [0x04] Reset Alarms
18196         case 0xD1:      // [0xD1] Broadcast Sync
18197                 if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
18198                 {
18199                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EPC_LF, &bUidLF));
18200                         if(bUidLF)      // variable UID length
18201                         {
18202                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC_LEN, &ucUidLen));
18203                         }
18204                         else
18205                         {
18206                                 ucUidLen = 8;
18207                         }
18208 
18209                         // UID = unified identifier = serial number
18210                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucUid[0], (int)ucUidLen));
18211                         FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
18212                         
18213                         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
18214                         if(iIdx < 0)
18215                                 return iIdx;
18216 
18217                         // only for UHF EPC Class1 Gen2
18218                         if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
18219                                 m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
18220                         {
18221                                 // check, if Reader is configured for UID = EPC + TID
18222                                 if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
18223                                 {
18224                                         // check, if response contains UID = EPC + TID
18225                                         ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
18226                                         if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
18227                                                 ucEpcLen -= 2;
18228 
18229                                         if( ucEpcLen < ucUidLen)
18230                                         {
18231                                                 // take TID as UID for next request
18232                                                 if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
18233                                                         ucData[iCnt++] = (ucUidLen - ucEpcLen);
18234                                                 
18235                                                 memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
18236                                                 iCnt += (ucUidLen - ucEpcLen);
18237                                         }
18238                                         else
18239                                         {
18240                                                 // error in the Reader response: TID is missing
18241                                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
18242                                                 return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
18243                                         }
18244                                 }
18245                                 else
18246                                 {
18247                                         if(bUidLF || (ucUidLen != 8))
18248                                                 ucData[iCnt++] = ucUidLen;
18249                                         
18250                                         // UID = unified identifier = serial number
18251                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
18252                                         iCnt += ucUidLen;
18253                                 }
18254                         }
18255                         else
18256                         {
18257                                 if(bUidLF)      // variable UID length
18258                                 {
18259                                         ucData[iCnt++] = ucUidLen;
18260                                         // UID = unified identifier = serial number
18261                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
18262                                         iCnt += ucUidLen;
18263                                 }
18264                                 else
18265                                 {
18266                                         // UID = unified identifier = serial number
18267                                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], 8));
18268                                         iCnt += 8;
18269                                 }
18270                         }
18271                 }
18272                 break;
18273 
18274         default:
18275                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
18276                 return FEDM_ERROR_PARAMETER;
18277         }
18278 
18279         switch(ucCmdByte)
18280         {
18281         case 0x00:      // [0x00] GetUID
18282                 break;
18283         case 0x01:      // [0x01] Get Sensor Data
18284                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_OPTION, &ucData[iCnt++]));
18285                 break;
18286         case 0x02:      // [0x02] Send SPI Command
18287                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_CMD_SIZE, &ucCmdSize));
18288                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_CMD_SIZE, &ucData[iCnt++]));
18289                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_RESP_SIZE, &ucData[iCnt++]));
18290                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_SCLK, &ucData[iCnt++]));
18291                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_DELAY_TIME, &ucData[iCnt++]));
18292                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_SPI_CMD, &ucData[iCnt], 8)); // get 8 bytes
18293                 if(ucCmdSize == 0)
18294                 {
18295                         iCnt += 8;
18296                 }
18297                 else
18298                 {
18299                         memset(&ucData[iCnt+ucCmdSize], 8-ucCmdSize, 0); // clear unused bytes
18300                         iCnt += (int)ucCmdSize;
18301                 }
18302                 break;
18303         case 0x04:      // [0x04] Reset Alarms
18304                 break;
18305         case 0xD1:      // [0xD1] Broadcast Sync
18306                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EM_UTC_TIME, &ucData[iCnt], 4));
18307                 iCnt += 4;
18308                 break;
18309         }
18310 
18311         return iCnt;
18312 }
18313 
18314 /***************************************************************************
18315   Begin                 :       03.03.01 / 08.04.2011 / M. Hultsch
18316   Version               :       04.06.06 / 23.09.2013 / M. Hultsch
18317                                                 - only for EPC Class1 Gen2:
18318                                                   bugfix for addressed Host commands, if Reader is configured for UID = EPC + TID
18319 
18320                                                 04.02.00 / 11.05.2012 / M. Hultsch
18321                                                 - if Reader is configured for UID = EPC + TID, use IDDT from last Inventory to evaluate UID
18322 
18323                                                 04.00.00 / 29.07.2011 / M. Hultsch
18324 
18325   Function                      :       collects the necessary data for the next [0xB4] epc uhf protocol
18326 
18327   Parameters            :       unsigned char ucCmdByte -       epc command byte
18328                                                 unsigned char* ucData   -       pointer to buffer for data
18329 
18330   Return value          :       iCnt (>0) or error code (<0)
18331 
18332 ***************************************************************************/
18333 int FEDM_ISCReader::Get_0xB4_IsoTableData_IDS(unsigned char ucCmdByte, unsigned char* ucData)
18334 {
18335         FEDM_CHK3(ucData);
18336 
18337         bool bUidLF = false;
18338         bool bExtAdr = false;
18339         bool bAccessPw = false;
18340         int iErr = 0;
18341         int iCnt = 0;
18342         int iIdx = 0;
18343         unsigned char ucUidLen  = 0x00;
18344         unsigned char ucEpcLen  = 0x00;
18345         unsigned char ucLen             = 0x00;
18346         unsigned char ucSubCommand = 0x00;
18347         unsigned char ucNoOfBytes = 0x00;
18348         unsigned char ucUid[FEDM_ISC_MAX_UID_LENGTH];
18349         string sUid;
18350 
18351         switch(ucCmdByte)
18352         {
18353         case 0xA0:
18354         case 0xA1:
18355         case 0xA2:
18356         case 0xA3:
18357         case 0xA4:
18358         case 0xA5:
18359         case 0xA6:
18360         case 0xA7:
18361         case 0xA8:
18362         case 0xA9:
18363         case 0xAA:
18364         case 0xAB:
18365         case 0xAC:
18366         case 0xAD:
18367         case 0xAE:
18368         case 0xAF:
18369                 break;
18370         default:
18371                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
18372                 return FEDM_ERROR_PARAMETER;
18373         }
18374 
18375         ucData[iCnt++] = ucCmdByte;
18376         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE, &ucData[iCnt++]));
18377         if((unsigned char)(ucData[1]&0x07) == FEDM_ISC_ISO_MODE_ADR)    // addressed
18378         {
18379                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EPC_LF, &bUidLF));
18380                 if(bUidLF)      // variable UID length
18381                 {
18382                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC_LEN, &ucUidLen));
18383                 }
18384                 else
18385                 {
18386                         ucUidLen = 8;
18387                 }
18388 
18389                 // UID = unified identifier = serial number
18390                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucUid[0], (int)ucUidLen));
18391                 FEDM_CHK1(iErr, FEDM_ConvHexUCharToHexStr(&ucUid[0], (int)ucUidLen, sUid));
18392                 
18393                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_SNR, sUid);
18394                 if(iIdx < 0)
18395                         return iIdx;
18396 
18397                 // only for UHF EPC Class1 Gen2
18398                 if(     m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2 ||
18399                         m_ISOTable[iIdx]->m_ucTrType == FEDM_ISC_TR_TYPE_ISO18000_3M3)
18400                 {
18401                         // check, if Reader is configured for UID = EPC + TID
18402                         if(m_ISOTable[iIdx]->m_ucIDDT == 0x02)
18403                         {
18404                                 // check, if response contains UID = EPC + TID
18405                                 ucEpcLen = ((m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0xF8) >> 3) * 2;
18406                                 if(m_ISOTable[iIdx]->m_ucClass1Gen2_PC[0] & 0x02) // extended PC W1
18407                                         ucEpcLen -= 2;
18408 
18409                                 if( ucEpcLen < ucUidLen)
18410                                 {
18411                                         // take TID as UID for next request
18412                                         if(bUidLF || ((ucUidLen - ucEpcLen) != 8))
18413                                                 ucData[iCnt++] = (ucUidLen - ucEpcLen);
18414                                         
18415                                         memcpy(&ucData[iCnt], &ucUid[ucEpcLen], ucUidLen - ucEpcLen);
18416                                         iCnt += (ucUidLen - ucEpcLen);
18417                                 }
18418                                 else
18419                                 {
18420                                         // error in the Reader response: TID is missing
18421                                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << " " << GetErrorText(FEDM_ERROR_INVENTORY_NO_TID_IN_UID));
18422                                         return FEDM_ERROR_INVENTORY_NO_TID_IN_UID;
18423                                 }
18424                         }
18425                         else
18426                         {
18427                                 if(bUidLF || (ucUidLen != 8))
18428                                         ucData[iCnt++] = ucUidLen;
18429                                 
18430                                 // UID = unified identifier = serial number
18431                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
18432                                 iCnt += ucUidLen;
18433                         }
18434                 }
18435                 else
18436                 {
18437                         if(bUidLF)      // variable UID length
18438                         {
18439                                 ucData[iCnt++] = ucUidLen;
18440                                 // UID = unified identifier = serial number
18441                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], ucUidLen));
18442                                 iCnt += ucUidLen;
18443                         }
18444                         else
18445                         {
18446                                 // UID = unified identifier = serial number
18447                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_EPC, &ucData[iCnt], 8));
18448                                 iCnt += 8;
18449                         }
18450                 }
18451         }
18452 
18453         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_MODE_EXT_ADR, &bExtAdr));
18454         if(bExtAdr)
18455         {
18456                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK, &ucData[iCnt++]));
18457                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_REQ_BANK_ACCESS_FLAG, &bAccessPw));
18458                 if(bAccessPw)
18459                 {
18460                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW_LENGTH, &ucLen));
18461                         ucData[iCnt++] = ucLen;
18462                         if(ucLen > 0)
18463                         {
18464                                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_B4_ACCESS_PW, &ucData[iCnt], ucLen));
18465                                 iCnt += ucLen;
18466                         }
18467                 }
18468         }
18469 
18470 
18471         switch(ucCmdByte)
18472         {
18473         case 0xA0:
18474                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_PASSWORD_LEVEL, &ucData[iCnt++]));
18475                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_PASSWORD, &ucData[iCnt], 4));
18476                 iCnt += 4;
18477                 break;
18478 
18479         case 0xA1:
18480                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_LOG_MODE, &ucData[iCnt], 3));
18481                 iCnt += 3;
18482                 break;
18483 
18484         case 0xA2:
18485                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_LOG_LIMITS, &ucData[iCnt], 5));
18486                 iCnt += 5;
18487                 break;
18488 
18489         case 0xA3:
18490                 break;
18491 
18492         case 0xA4:
18493                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_SFE_PARA, &ucData[iCnt], 2));
18494                 iCnt += 2;
18495                 break;
18496 
18497         case 0xA5:
18498                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_CAL_DATA, &ucData[iCnt], 7));
18499                 iCnt += 7;
18500                 break;
18501 
18502         case 0xA6:
18503                 break;
18504 
18505         case 0xA7:
18506                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_START_TIME, &ucData[iCnt], 4));
18507                 iCnt += 4;
18508                 break;
18509 
18510         case 0xA8:
18511         case 0xA9:
18512                 break;
18513 
18514         case 0xAA:
18515                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_BATTERY_RETRIGGER, &ucData[iCnt++]));
18516                 break;
18517 
18518         case 0xAB:
18519                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_SL_BLOCK_0, &ucData[iCnt], 4));
18520                 iCnt += 4;
18521                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_SL_BLOCK_1, &ucData[iCnt], 4));
18522                 iCnt += 4;
18523                 break;
18524 
18525         case 0xAC:
18526                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_DELAY_TIME, &ucData[iCnt], 2));
18527                 iCnt += 2;
18528                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_APP_DATA, &ucData[iCnt], 2));
18529                 iCnt += 2;
18530                 break;
18531 
18532         case 0xAD:
18533                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_SENSOR_VALUE, &ucData[iCnt++]));
18534                 break;
18535 
18536         case 0xAE:
18537                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_PASSWORD_LEVEL, &ucData[iCnt++]));
18538                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_PASSWORD, &ucData[iCnt], 4));
18539                 iCnt += 4;
18540                 break;
18541 
18542         case 0xAF:
18543                 FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_SUB_COMMAND, &ucData[iCnt]));
18544                 ucSubCommand = ((ucData[iCnt] & 0xE0) >> 5);
18545                 ucNoOfBytes = (ucData[iCnt] & 0x07);
18546                 iCnt++;
18547                 if(ucSubCommand == 0x05) // write to FIFO
18548                 {
18549                         FEDM_CHK1(iErr, GetData(FEDM_ISC_TMP_0xB4_REQ_IDS_PAYLOAD, &ucData[iCnt], ucNoOfBytes));
18550                         iCnt += ucNoOfBytes;
18551                 }
18552                 break;
18553 
18554         default:
18555                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(CmdByte=0x" << std::hex << std::uppercase << (int)ucCmdByte << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
18556                 FEDM_RETURN(FEDM_ERROR_UNSUPPORTED);
18557         }
18558 
18559         return iCnt;
18560 }
18561 
18562 /***************************************************************************
18563   Begin                 :       09.02.2009 / M. Hultsch
18564   Version               :       03.00.06 / 02.04.2009 / M. Hultsch
18565 
18566   Function                      :       collects the necessary data for the next  [0xC1] iso protocol
18567 
18568   Parameters            :       unsigned char  ucDESFireCmd     -       sub command
18569                                                 unsigned char* ucData           -       pointer to buffer with data
18570 
18571   Return value          :       iCnt (>0) or error code (<0)
18572 
18573 ***************************************************************************/
18574 int FEDM_ISCReader::Get_0xC1_IsoTableData(unsigned char ucDESFireCmd, unsigned char* ucData)
18575 {
18576         FEDM_CHK3(ucData);
18577 
18578         int iErr = 0;
18579         int iCnt = 0;
18580         int     iIdx = 0;
18581 
18582         unsigned char ucKeyLen = 0;
18583         unsigned int uiFileOffset = 0;
18584         unsigned int uiFileLen = 0;
18585         unsigned int uiRecordOffset = 0;
18586         unsigned int uiNoOfRecords = 0;
18587         unsigned int uiRecordSize = 0;
18588         unsigned int uiValue = 0;
18589 
18590         switch(ucDESFireCmd)
18591         {
18592         case 0xFA:      // DESFire Authent
18593                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18594                 break;
18595 
18596         case 0xBD:      // DESFire Read Standard Data
18597                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18598                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18599                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18600                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_OFFSET, &uiFileOffset));
18601                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
18602                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
18603                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
18604                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_DATA_LEN, &uiFileLen));
18605                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
18606                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
18607                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
18608                 break;
18609 
18610         case 0x3D:      // DESFire Write Standard Data
18611                 // command only in selected mode
18612                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
18613                 if(iIdx < 0)
18614                         return iIdx;
18615 
18616                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18617                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18618                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18619                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_OFFSET, &uiFileOffset));
18620                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
18621                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
18622                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
18623                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_DATA_LEN, &uiFileLen));
18624                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
18625                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
18626                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
18627 
18628                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
18629                 {
18630                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
18631                         return FEDM_ERROR_ARRAY_BOUNDARY;
18632                 }
18633 
18634                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[uiFileOffset], uiFileLen);
18635                 iCnt += uiFileLen;
18636 
18637                 break;
18638 
18639         case 0x6C:      // DESFire Get Value
18640                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18641                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18642                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18643                 break;
18644 
18645         case 0x0C:      // DESFire Credit
18646                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18647                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18648                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18649                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_CREDIT_VALUE, &uiValue));
18650                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
18651                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
18652                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
18653                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
18654                 break;
18655 
18656         case 0xDC:      // DESFire Debit
18657                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18658                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18659                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18660                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_DEBIT_VALUE, &uiValue));
18661                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
18662                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
18663                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
18664                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
18665                 break;
18666 
18667         case 0x1C:      // DESFire Limited Credit
18668                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18669                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18670                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18671                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_CREDIT_VALUE, &uiValue));
18672                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
18673                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
18674                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
18675                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
18676                 break;
18677 
18678         case 0x3B:      // DESFire Write Record
18679                 // command only in selected mode
18680                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
18681                 if(iIdx < 0)
18682                         return iIdx;
18683 
18684                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18685                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18686                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18687                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_OFFSET, &uiFileOffset));
18688                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
18689                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
18690                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
18691                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_DATA_LEN, &uiFileLen));
18692                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
18693                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
18694                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
18695 
18696                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
18697                 {
18698                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
18699                         return FEDM_ERROR_ARRAY_BOUNDARY;
18700                 }
18701 
18702                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[uiFileOffset], uiFileLen);
18703                 iCnt += uiFileLen;
18704 
18705                 break;
18706 
18707         case 0xBB:      // DESFire Read Records
18708                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18709                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18710                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18711                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_RECORD_OFFSET, &uiRecordOffset));
18712                 ucData[iCnt++] = (unsigned char) (uiRecordOffset & 0x000000FF);
18713                 ucData[iCnt++] = (unsigned char)((uiRecordOffset & 0x0000FF00) >> 8);
18714                 ucData[iCnt++] = (unsigned char)((uiRecordOffset & 0x00FF0000) >> 16);
18715                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NO_OF_RECORDS, &uiNoOfRecords));
18716                 ucData[iCnt++] = (unsigned char) (uiNoOfRecords & 0x000000FF);
18717                 ucData[iCnt++] = (unsigned char)((uiNoOfRecords & 0x0000FF00) >> 8);
18718                 ucData[iCnt++] = (unsigned char)((uiNoOfRecords & 0x00FF0000) >> 16);
18719                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_RECORD_SIZE, &uiRecordSize));
18720                 ucData[iCnt++] = (unsigned char) (uiRecordSize & 0x000000FF);
18721                 ucData[iCnt++] = (unsigned char)((uiRecordSize & 0x0000FF00) >> 8);
18722                 ucData[iCnt++] = (unsigned char)((uiRecordSize & 0x00FF0000) >> 16);
18723                 break;
18724 
18725         case 0xEB:      // DESFire Clear Record File
18726                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18727                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18728                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18729                 break;
18730 
18731         case 0x5F:      // DESFire Change File Settings
18732                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18733                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_NO, &ucData[iCnt++]));
18734                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18735                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_FILE_ACCESS_RIGHTS, &ucData[iCnt], 2));
18736                 iCnt += 2;
18737                 break;
18738 
18739         case 0x54:      // DESFire Change Key Settings
18740                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NEW_KEY_SETTINGS, &ucData[iCnt++]));
18741                 break;
18742 
18743         case 0xC4:      // DESFire Change Key
18744                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO, &ucData[iCnt++]));
18745                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_NO_TB_CHANGED, &ucData[iCnt++]));
18746                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_LEN, &ucKeyLen));
18747                 if(ucKeyLen > 24)
18748                 {
18749                         return FEDM_ERROR_ARRAY_BOUNDARY;
18750                 }
18751                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_KEY_LEN, &ucData[iCnt++]));
18752                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_OLD_KEY, &ucData[iCnt], 24));
18753                 iCnt += 24;
18754                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NEW_KEY, &ucData[iCnt], 24));
18755                 iCnt += 24;
18756                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC1_NEW_KEY_VERSION, &ucData[iCnt++]));
18757                 break;
18758         }
18759 
18760         return iCnt;
18761 }
18762 
18763 
18764 /***************************************************************************
18765   Begin                 :       08.09.2010 / M. Hultsch
18766   Version               :       03.02.05 / 08.09.2010 / M. Hultsch
18767 
18768   Function                      :       collects the necessary data for the next  [0xC3] DESFire Command
18769 
18770   Parameters            :       unsigned char  ucDESFireCmd     -       sub command
18771                                                 unsigned char* ucData           -       pointer to buffer with data
18772 
18773   Return value          :       iCnt (>0) or error code (<0)
18774 
18775 ***************************************************************************/
18776 int FEDM_ISCReader::Get_0xC3_IsoTableData(unsigned char ucDESFireCmd, unsigned char ucMode, unsigned char* ucData)
18777 {
18778         FEDM_CHK3(ucData);
18779 
18780         int iErr = 0;
18781         int iCnt = 0;
18782         int     iIdx = 0;
18783 
18784         unsigned char ucBuffer[32];
18785         unsigned char ucFlags = 0;
18786         unsigned char ucLen = 0;
18787         unsigned char ucKeyLen = 0;
18788         unsigned int uiFileOffset = 0;
18789         unsigned int uiFileLen = 0;
18790         unsigned int uiRecordOffset = 0;
18791         unsigned int uiNoOfRecords = 0;
18792         unsigned int uiRecordSize = 0;
18793         unsigned int uiValue = 0;
18794 
18795         // command only in selected mode
18796         iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
18797         if(iIdx < 0)
18798                 return iIdx;
18799 
18800         if(ucMode & 0x01)
18801         {
18802                 // SAM flag is set
18803                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SLOT_NO, &ucData[iCnt++]));
18804                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_TIMEOUT, &ucData[iCnt++]));
18805         }
18806 
18807 
18808         switch(ucDESFireCmd)
18809         {
18810         case 0xFA:      // DESFire Authent
18811                 if( (ucMode & 0x01) == 0)
18812                 {
18813                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_INDEX, &ucData[iCnt++]));
18814                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_NO, &ucData[iCnt++]));
18815                 }
18816                 else
18817                 {
18818                         // SAM flag is set
18819                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DESFIRE_AUTH_MODE, &ucData[iCnt++]));
18820                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_NO, &ucData[iCnt++]));
18821                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_AUTH_MODE, &ucData[iCnt++]));
18822                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_NO, &ucData[iCnt++]));
18823                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_VERSION, &ucData[iCnt++]));
18824                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT_LEN, &ucData[iCnt++]));
18825                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT_LEN, &ucLen));
18826                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT, ucBuffer, 16));
18827                         memcpy(&ucData[iCnt], ucBuffer, ucLen);
18828                         iCnt += ucLen;
18829                 }
18830                 break;
18831 
18832         case 0x54:      // DESFire Change Key Settings
18833                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_NEW_KEY_SETTINGS, &ucData[iCnt++]));
18834                 break;
18835 
18836         case 0x45:      // DESFire Get Key Settings
18837                 break;
18838 
18839         case 0xC4:      // DESFire Change Key
18840                 if( (ucMode & 0x01) == 0)
18841                 {
18842                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_NO_TB_CHANGED, &ucData[iCnt++]));
18843                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_LEN, &ucKeyLen));
18844                         if(ucKeyLen > 24)
18845                         {
18846                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ", Mode=0x" << std::hex << std::uppercase << (int)ucMode << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
18847                                 return FEDM_ERROR_ARRAY_BOUNDARY;
18848                         }
18849                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_LEN, &ucData[iCnt++]));
18850                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_OLD_KEY, &ucData[iCnt], 24));
18851                         iCnt += 24;
18852                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_NEW_KEY, &ucData[iCnt], 24));
18853                         iCnt += 24;
18854                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_NEW_KEY_VERSION, &ucData[iCnt++]));
18855                 }
18856                 else
18857                 {
18858                         // SAM flag is set
18859                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_COMP_METHOD, &ucData[iCnt++]));
18860                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_CFG, &ucData[iCnt++]));
18861                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_NO_CURRENT_KEY, &ucData[iCnt++]));
18862                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_VERSION_CURRENT_KEY, &ucData[iCnt++]));
18863                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_NO_NEW_KEY, &ucData[iCnt++]));
18864                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_KEY_VERSION_NEW_KEY, &ucData[iCnt++]));
18865                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT_LEN, &ucData[iCnt++]));
18866                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT_LEN, &ucLen));
18867                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_SAM_DIV_INPUT, ucBuffer, 16));
18868                         memcpy(&ucData[iCnt], ucBuffer, ucLen);
18869                         iCnt += ucLen;
18870                 }
18871                 break;
18872 
18873         case 0x64: // Get Key Version
18874                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_NO, &ucData[iCnt++]));
18875                 break;
18876 
18877         case 0xCA: // Create Application
18878                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_PICC_LEVEL_FLAGS, &ucData[iCnt++]));
18879                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_PICC_LEVEL_FLAGS, &ucFlags));
18880                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APP_ID, &ucData[iCnt], 3));
18881                 iCnt += 3;
18882                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_SETTINGS1, &ucData[iCnt++]));
18883                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_KEY_SETTINGS2, &ucData[iCnt++]));
18884 /*              if( (ucFlags & 0x03) == 0x03)
18885                 {
18886                         return FEDM_ERROR_PARAMETER;
18887                 }
18888                 else*/ if( (ucFlags & 0x01) )
18889                 {
18890                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_FILE_ID, &ucData[iCnt], 2));
18891                         iCnt += 2;
18892                 }
18893                 /*else*/ if( (ucFlags & 0x02) )
18894                 {
18895                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_DF_NAME_LEN, &ucData[iCnt++]));
18896                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_DF_NAME_LEN, &ucLen));
18897                         if(ucLen > 16)
18898                         {
18899                                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ", Mode=0x" << std::hex << std::uppercase << (int)ucMode << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
18900                                 return FEDM_ERROR_PARAMETER;
18901                         }
18902                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_DF_NAME, &ucData[iCnt], ucLen));
18903                         iCnt += ucLen;
18904                 }
18905                 break;
18906 
18907         case 0xDA: // Delete Application
18908         case 0x5A: // Select Application
18909                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_PICC_LEVEL_FLAGS, &ucData[iCnt++]));
18910                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APP_ID, &ucData[iCnt], 3));
18911                 iCnt += 3;
18912                 break;
18913 
18914         case 0x6A: // Get Application IDs
18915         case 0x6D: // Get DF Names
18916         case 0xFC: // Format PICC
18917         case 0x60: // Get Version
18918         case 0x6E: // Free Mem
18919         case 0x51: // Get Card UID
18920                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_PICC_LEVEL_FLAGS, &ucData[iCnt++]));
18921                 break;
18922 
18923         case 0x5C: // Set Configuration
18924                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_PICC_LEVEL_FLAGS, &ucData[iCnt++]));
18925                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_OPTION, &ucData[iCnt++]));
18926                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_OPTION, &uiValue));
18927                 if(uiValue == 0x00)
18928                 {
18929                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_CONFIG, &ucData[iCnt++]));
18930                 }
18931                 else if(uiValue == 0x01)
18932                 {
18933                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_DEFAULT_KEY_VERSION, &ucData[iCnt++]));
18934                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_DEFAULT_KEY, &ucData[iCnt], 24));
18935                         iCnt += 24;
18936                 }
18937                 else if(uiValue == 0x02)
18938                 {
18939                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_0x6E_USER_DEF_ATS, ucBuffer, 20));
18940                         memcpy(&ucData[iCnt], ucBuffer, ucBuffer[0]); // first byte of ATS contains length information TL
18941                         iCnt += ucBuffer[0];
18942                 }
18943                 else
18944                 {
18945                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ", Mode=0x" << std::hex << std::uppercase << (int)ucMode << ") " << GetErrorText(FEDM_ERROR_PARAMETER));
18946                         return FEDM_ERROR_PARAMETER;
18947                 }
18948 
18949                 break;
18950 
18951         case 0x6F: // Get File IDs
18952         case 0x61: // Get ISO File IDs
18953                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
18954                 break;
18955 
18956         case 0xF5: // Get File Settings
18957         case 0xDF: // Delete File
18958                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
18959                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
18960                 break;
18961 
18962         case 0x5F:      // DESFire Change File Settings
18963                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
18964                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
18965                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18966                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_ACCESS_RIGHTS, &ucData[iCnt], 2));
18967                 iCnt += 2;
18968                 break;
18969 
18970         case 0xCD:      // DESFire Create Standard Data File
18971         case 0xCB:      // DESFire Create Backup Data File
18972                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
18973                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucFlags));
18974                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
18975                 if( (ucFlags & 0x01) )
18976                 {
18977                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_FILE_ID, &ucData[iCnt], 2));
18978                         iCnt += 2;
18979                 }
18980                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18981                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_ACCESS_RIGHTS, &ucData[iCnt], 2));
18982                 iCnt += 2;
18983                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_SIZE, &ucData[iCnt], 3));
18984                 iCnt += 3;
18985                 break;
18986 
18987         case 0xCC:      // DESFire Create Value File
18988                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
18989                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
18990                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
18991                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_ACCESS_RIGHTS, &ucData[iCnt], 2));
18992                 iCnt += 2;
18993                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_LOWER_LIMIT, &ucData[iCnt], 4));
18994                 iCnt += 4;
18995                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_UPPER_LIMIT, &ucData[iCnt], 4));
18996                 iCnt += 4;
18997                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_VALUE, &ucData[iCnt], 4));
18998                 iCnt += 4;
18999                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_LIMITED_CREDIT_ENABLED, &ucData[iCnt++]));
19000                 break;
19001 
19002         case 0xC1:      // DESFire Create Linear Record File
19003         case 0xC0:      // DESFire Create Cyclic Record File
19004                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucData[iCnt++]));
19005                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_APPLICATION_LEVEL_FLAGS, &ucFlags));
19006                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19007                 if( (ucFlags & 0x01) )
19008                 {
19009                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_ISO7816_FILE_ID, &ucData[iCnt], 2));
19010                         iCnt += 2;
19011                 }
19012                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19013                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_ACCESS_RIGHTS, &ucData[iCnt], 2));
19014                 iCnt += 2;
19015                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_RECORD_SIZE, &ucData[iCnt], 3));
19016                 iCnt += 3;
19017                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_NO_OF_RECORDS, &ucData[iCnt], 3));
19018                 iCnt += 3;
19019                 break;
19020 
19021         case 0xBD:      // DESFire Read Standard Data
19022                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19023                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19024                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19025                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_OFFSET, &uiFileOffset));
19026                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
19027                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
19028                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
19029                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_DATA_LEN, &uiFileLen));
19030                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
19031                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
19032                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
19033                 break;
19034 
19035         case 0x3D:      // DESFire Write Standard Data
19036                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19037                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19038                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19039                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_OFFSET, &uiFileOffset));
19040                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
19041                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
19042                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
19043                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_DATA_LEN, &uiFileLen));
19044                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
19045                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
19046                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
19047 
19048                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
19049                 {
19050                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ", Mode=0x" << std::hex << std::uppercase << (int)ucMode << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
19051                         return FEDM_ERROR_ARRAY_BOUNDARY;
19052                 }
19053 
19054                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[uiFileOffset], uiFileLen);
19055                 iCnt += uiFileLen;
19056 
19057                 break;
19058 
19059         case 0x6C:      // DESFire Get Value
19060                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19061                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19062                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19063                 break;
19064 
19065         case 0x0C:      // DESFire Credit
19066                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19067                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19068                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19069                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_CREDIT_VALUE, &uiValue));
19070                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
19071                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
19072                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
19073                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
19074                 break;
19075 
19076         case 0xDC:      // DESFire Debit
19077                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19078                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19079                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19080                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DEBIT_VALUE, &uiValue));
19081                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
19082                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
19083                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
19084                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
19085                 break;
19086 
19087         case 0x1C:      // DESFire Limited Credit
19088                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19089                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19090                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19091                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_CREDIT_VALUE, &uiValue));
19092                 ucData[iCnt++] = (unsigned char) (uiValue & 0x000000FF);
19093                 ucData[iCnt++] = (unsigned char)((uiValue & 0x0000FF00) >> 8);
19094                 ucData[iCnt++] = (unsigned char)((uiValue & 0x00FF0000) >> 16);
19095                 ucData[iCnt++] = (unsigned char)((uiValue & 0xFF000000) >> 24);
19096                 break;
19097 
19098         case 0x3B:      // DESFire Write Record
19099                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19100                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19101                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19102                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_OFFSET, &uiFileOffset));
19103                 ucData[iCnt++] = (unsigned char) (uiFileOffset & 0x000000FF);
19104                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x0000FF00) >> 8);
19105                 ucData[iCnt++] = (unsigned char)((uiFileOffset & 0x00FF0000) >> 16);
19106                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_DATA_LEN, &uiFileLen));
19107                 ucData[iCnt++] = (unsigned char) (uiFileLen & 0x000000FF);
19108                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x0000FF00) >> 8);
19109                 ucData[iCnt++] = (unsigned char)((uiFileLen & 0x00FF0000) >> 16);
19110 
19111                 if(uiFileOffset + uiFileLen > FEDM_ISC_ISO_TABLE_RxDB_SIZE)
19112                 {
19113                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(DESFireCmd=0x" << std::hex << std::uppercase << (int)ucDESFireCmd << ", Mode=0x" << std::hex << std::uppercase << (int)ucMode << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
19114                         return FEDM_ERROR_ARRAY_BOUNDARY;
19115                 }
19116 
19117                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[uiFileOffset], uiFileLen);
19118                 iCnt += uiFileLen;
19119 
19120                 break;
19121 
19122         case 0xBB:      // DESFire Read Records
19123                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19124                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19125                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19126                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_RECORD_OFFSET, &uiRecordOffset));
19127                 ucData[iCnt++] = (unsigned char) (uiRecordOffset & 0x000000FF);
19128                 ucData[iCnt++] = (unsigned char)((uiRecordOffset & 0x0000FF00) >> 8);
19129                 ucData[iCnt++] = (unsigned char)((uiRecordOffset & 0x00FF0000) >> 16);
19130                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_NO_OF_RECORDS, &uiNoOfRecords));
19131                 ucData[iCnt++] = (unsigned char) (uiNoOfRecords & 0x000000FF);
19132                 ucData[iCnt++] = (unsigned char)((uiNoOfRecords & 0x0000FF00) >> 8);
19133                 ucData[iCnt++] = (unsigned char)((uiNoOfRecords & 0x00FF0000) >> 16);
19134                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_RECORD_SIZE, &uiRecordSize));
19135                 ucData[iCnt++] = (unsigned char) (uiRecordSize & 0x000000FF);
19136                 ucData[iCnt++] = (unsigned char)((uiRecordSize & 0x0000FF00) >> 8);
19137                 ucData[iCnt++] = (unsigned char)((uiRecordSize & 0x00FF0000) >> 16);
19138                 break;
19139 
19140         case 0xEB:      // DESFire Clear Record File
19141                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19142                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_NO, &ucData[iCnt++]));
19143                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_FILE_COMM_SETTINGS, &ucData[iCnt++]));
19144                 break;
19145 
19146         case 0xC7:      // DESFire Commit Transaction
19147         case 0xA7:      // DESFire Abort Transaction
19148                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC3_DATA_MANIPULATION_FLAGS, &ucData[iCnt++]));
19149                 break;
19150         }
19151 
19152         return iCnt;
19153 }
19154 
19155 
19156 /***************************************************************************
19157   Begin                 :       24.08.2009 / M. Hultsch
19158   Version               :       03.00.13 / 30.09.2009 / M. Hultsch
19159 
19160   Function                      :       collects the necessary data for the next  [0xC2] iso protocol
19161 
19162   Parameters            :       unsigned char  ucMifarePlusCmd  -       sub command
19163                                                 unsigned char* ucData                   -       pointer to buffer with data
19164 
19165   Return value          :       iCnt (>0) or error code (<0)
19166 
19167 ***************************************************************************/
19168 int FEDM_ISCReader::Get_0xC2_IsoTableData(unsigned char ucMifarePlusCmd, unsigned char* ucData)
19169 {
19170         FEDM_CHK3(ucData);
19171 
19172         unsigned char ucTmp = 0;
19173         int iErr = 0;
19174         int iCnt = 0;
19175         int iIdx = 0;
19176         unsigned int uiLength = 0;
19177         unsigned int uiBlockNo = 0;
19178 
19179         switch(ucMifarePlusCmd)
19180         {
19181         // commands for all security levels
19182         case 0x70:      // First Authent
19183                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_AES_KEY_BLOCK_NO, &uiBlockNo));
19184                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19185                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19186                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_PCD_CAP_LEN, &ucData[iCnt++]));
19187                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_PCD_CAP_LEN, &ucTmp));
19188                 if(ucTmp > 0)
19189                 {
19190                         FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_PCD_CAP, &ucData[iCnt], ucTmp));
19191                         iCnt += ucTmp;
19192                 }
19193                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_INDEX, &ucData[iCnt++]));
19194                 break;
19195 
19196         case 0x76:      // Following Authent
19197                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_AES_KEY_BLOCK_NO, &uiBlockNo));
19198                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19199                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19200                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_INDEX, &ucData[iCnt++]));
19201                 break;
19202 
19203         // Security Level 1 commands
19204         case 0x77:      // SL1 AES Authent
19205                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_INDEX, &ucData[iCnt++]));
19206                 break;
19207 
19208         // Security Level 2 commands
19209         case 0x75:      // SL2 AES and Crypto Authent
19210                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_DB_ADR, &ucData[iCnt++]));
19211                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_TYPE, &ucData[iCnt++]));
19212                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_NO, &ucData[iCnt++]));
19213                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_KEY_INDEX, &ucData[iCnt++]));
19214                 break;
19215 
19216         case 0x38:      // SL2 Multiblock Read
19217                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_SRC_BLOCK_NO, &uiBlockNo));
19218                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF); // only LSB !!
19219                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &ucData[iCnt++]));
19220                 break;
19221 
19222         case 0xA8:      // SL2 Multiblock Write
19223                 // commands only in selected mode
19224                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
19225                 if(iIdx < 0)
19226                         return iIdx;
19227 
19228                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_BLOCK_NO, &uiBlockNo));
19229                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF); // only LSB !!
19230                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &uiLength));
19231                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &ucData[iCnt++]));
19232 
19233                 if( ((uiBlockNo + uiLength)*16) > FEDM_ISC_ISO_TABLE_TxDB_SIZE)
19234                 {
19235                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
19236                         return FEDM_ERROR_ARRAY_BOUNDARY;
19237                 }
19238 
19239                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[uiBlockNo*16], uiLength*16);
19240                 iCnt += uiLength*16;
19241                 break;
19242 
19243         // Security Level 3 commands
19244         case 0x78:      // SL3 Reset Authent
19245                 break;
19246 
19247         case 0x30:      // SL3 Read Encrypted
19248         case 0x31:      // SL3 Read Encrypted Maced
19249         case 0x32:      // SL3 Read Plain
19250         case 0x33:      // SL3 Read Plain Maced
19251         case 0x34:      // SL3 Read Encrypted Unmaced
19252         case 0x35:      // SL3 Read Encrypted Unmaced Respond Maced
19253         case 0x36:      // SL3 Read Plain Unmaced
19254         case 0x37:      // SL3 Read Plain Unmaced Respond Maced
19255                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_BLOCK_NO, &uiBlockNo));
19256                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19257                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19258                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &ucData[iCnt++]));
19259                 break;
19260 
19261         case 0xA0:      // SL3 Write Encrypted
19262         case 0xA1:      // SL3 Write Encrypted Maced
19263         case 0xA2:      // SL3 Write Plain
19264         case 0xA3:      // SL3 Write Plain Maced
19265                 // commands only in selected mode
19266                 iIdx = FindTableIndex(0, FEDM_ISC_ISO_TABLE, FEDM_ISC_DATA_IS_SELECTED, true);
19267                 if(iIdx < 0)
19268                         return iIdx;
19269 
19270                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_BLOCK_NO, &uiBlockNo));
19271                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19272                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19273                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &uiLength));
19274                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_EXT, &ucData[iCnt++]));
19275 
19276                 if( (((uiBlockNo & 0x000000FF) + uiLength)*16) > FEDM_ISC_ISO_TABLE_TxDB_SIZE)
19277                 {
19278                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_ARRAY_BOUNDARY));
19279                         return FEDM_ERROR_ARRAY_BOUNDARY;
19280                 }
19281 
19282                 memcpy(&ucData[iCnt], &m_ISOTable[iIdx]->m_ucTxDB[(uiBlockNo & 0x000000FF)*16], uiLength*16);
19283                 iCnt += uiLength*16;
19284 
19285                 break;
19286 
19287         case 0xB0:      // SL3 Increment Encrypted
19288         case 0xB1:      // SL3 Increment Encrypted Maced
19289         case 0xB2:      // SL3 Decrement Encrypted
19290         case 0xB3:      // SL3 Decrement Encrypted Maced
19291                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_SRC_BLOCK_NO, &uiBlockNo));
19292                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19293                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19294                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_VALUE, &ucData[iCnt], 4));
19295                 iCnt += 4;
19296                 break;
19297 
19298         case 0xB4:      // SL3 Transfer
19299         case 0xB5:      // SL3 Transfer Maced
19300                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_DST_BLOCK_NO, &uiBlockNo));
19301                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19302                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19303                 break;
19304 
19305         case 0xB6:      // SL3 Increment Transfer Encrypted
19306         case 0xB7:      // SL3 Increment Transfer Encrypted Maced
19307         case 0xB8:      // SL3 Decrement Transfer Encrypted
19308         case 0xB9:      // SL3 Decrement Transfer Encrypted Maced
19309                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_SRC_BLOCK_NO, &uiBlockNo));
19310                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19311                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19312                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_DST_BLOCK_NO, &uiBlockNo));
19313                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19314                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19315                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_VALUE, &ucData[iCnt], 4));
19316                 iCnt += 4;
19317                 break;
19318 
19319         case 0xC2:      // SL3 Restore
19320         case 0xC3:      // SL3 Restore Maced
19321                 FEDM_CHK2(iErr, GetData(FEDM_ISC_TMP_0xC2_SRC_BLOCK_NO, &uiBlockNo));
19322                 ucData[iCnt++] = (unsigned char) (uiBlockNo & 0x000000FF);
19323                 ucData[iCnt++] = (unsigned char)((uiBlockNo & 0x0000FF00) >> 8);
19324                 break;
19325 
19326         default:
19327                 FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(MifarePlusCmd=0x" << std::hex << std::uppercase << (int)ucMifarePlusCmd << ") " << GetErrorText(FEDM_ERROR_UNSUPPORTED));
19328                 return FEDM_ERROR_UNSUPPORTED;
19329         }
19330 
19331         return iCnt;
19332 }
19333 
19334 
19336 // functions for Channel Analyze Data table
19338 
19339 #if !defined(__BORLANDC__)
19340 int FEDM_ISCReader::SetCADTableData(unsigned char ucMode, long* nData)
19341 {
19342         int iCnt = 0;
19343         int iByteCnt = 0;
19344         int iDataSets = 0;
19345         FEDM_ISC_STRUCT_CAD_HISTORY*    pData = NULL;
19346 
19347         if(ucMode & 0x01)                       // mode TDM
19348         {
19349                 // initializations
19350                 m_CADTable.Init();
19351                 m_CADTable.m_ucMode = 0x01;
19352                 m_CADTable.m_bValid = true;
19353 
19354                 m_CADTable.m_nData[0] = nData[0];
19355                 m_CADTable.m_nData[1] = nData[1];
19356                 m_CADTable.m_nData[2] = nData[2];
19357                 m_CADTable.m_nData[3] = nData[3];
19358         }
19359         else if(ucMode & 0x04)                  // mode CH_HISTORY
19360         {
19361                 // build number of records
19362                 iDataSets  = ((nData[iByteCnt++] & 0x000000FF) << 8); 
19363                 iDataSets +=  (nData[iByteCnt++] & 0x000000FF);
19364                 
19365                 if(iDataSets > 516)
19366                         FEDM_RETURN(FEDM_ERROR_BUFFER_LENGTH);
19367 
19368                 // initializations
19369                 if(m_CADTable.m_bValid && (m_CADTable.m_ucMode != 0x04)) 
19370                         m_CADTable.Init();
19371 
19372                 m_CADTable.m_ucMode = 0x04;
19373 
19374                 // allocate memory
19375 //              m_CADTable.m_History.reserve(iDataSets);
19376 
19377                 for(iCnt=0; iCnt<iDataSets; ++iCnt)
19378                 {
19379                         pData = new FEDM_ISC_STRUCT_CAD_HISTORY;
19380                         if(pData == NULL)
19381                                 FEDM_RETURN(FEDM_ERROR_NO_MORE_MEM);
19382 
19383                         pData->uiAlloc  = ((nData[iByteCnt++] & 0x000000FF) << 8); 
19384                         pData->uiAlloc +=  (nData[iByteCnt++] & 0x000000FF);
19385                         pData->ucTxChannel = (unsigned char)(nData[iByteCnt++] & 0x000000FF);
19386                         pData->ucRxChannel = (unsigned char)(nData[iByteCnt++] & 0x000000FF);
19387 
19388                         m_CADTable.m_History.push_back(pData);
19389                 }
19390 
19391                 m_CADTable.m_bValid = true;
19392         }
19393         else if(ucMode & 0x08)          // mode CH_POWER
19394         {
19395                 // initializations
19396                 m_CADTable.Init();
19397                 m_CADTable.m_ucMode = 0x08;
19398                 m_CADTable.m_bValid = true;
19399 
19400                 for(iCnt=0; iCnt<15; ++iCnt)
19401                         m_CADTable.m_ucPowerPeak[iCnt] = (unsigned char)(nData[iByteCnt++] & 0x000000FF); 
19402 
19403                 for(iCnt=0; iCnt<15; ++iCnt)
19404                         m_CADTable.m_ucPowerAvg[iCnt] = (unsigned char)(nData[iByteCnt++] & 0x000000FF); 
19405         }
19406         else
19407         {
19408                 FEDM_RETURN(FEDM_ERROR_PARAMETER);
19409         }
19410 
19411         FEDM_RETURN(FEDM_OK);
19412 }
19413 #endif
19414 
19416 // miscellaneous functions
19418 
19419 
19420 void FEDM_ISCReader::SetLastError(int iError)
19421 {
19422         if(iError == 0)
19423         {
19424                 SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)0);
19425                 SetData(FEDM_ISC_TMP_LAST_ERROR, (unsigned int)0);
19426                 m_iLastError = 0;
19427         }
19428         else if(iError > 0)
19429         {
19430                 SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)iError);
19431                 SetData(FEDM_ISC_TMP_LAST_ERROR, (unsigned int)0);
19432                 m_iLastError = 0;
19433         }
19434         else
19435         {
19436                 SetData(FEDM_ISC_TMP_LAST_ERROR, (unsigned int)iError);
19437                 SetData(FEDM_ISC_TMP_LAST_STATE, (unsigned char)0);
19438                 m_iLastError = iError;
19439         }
19440 }
19441 
19442 
19443 /***************************************************************************
19444   Begin                 :       15.04.2003 / M. Hultsch
19445   
19446   Version               :       04.05.05 / 04.11.2013 / M. Hultsch
19447                                                 - new reader: ID ISC.PRH200
19448 
19449                                                 04.05.03 / 30.08.2013 / M. Hultsch
19450                                                 - new reader: OBID myAXXESS onTop
19451                                                 - bugfix for LRU3x00: max number of CFG-pages increased from 86 to 88
19452 
19453                                                 04.03.01 / 30.10.2012 / M. Hultsch
19454                                                 - new reader: ID ISC.MU95
19455 
19456                                                 04.02.06 / 23.07.2012 / M. Hultsch
19457                                                 - new reader: ID CPR46
19458 
19459                                                 04.02.05 / 05.07.2012 / M. Hultsch
19460                                                 - new reader: ID CPR20
19461 
19462                                                 04.01.01 / 29.03.2012 / M. Hultsch
19463                                                 - set default blocksize for RFC configuration
19464 
19465                                                 04.00.09 / 23.01.2012 / M. Hultsch
19466                                                 - new reader: ID ISC.LR1002
19467 
19468                                                 04.00.06 / 22.11.2011 / M. Hultsch
19469                                                 - new nPA reader: OBID myAXXESS standard, OBID myAXXESS comfort
19470 
19471                                                 04.00.02 / 09.08.2011 / M. Hultsch
19472                                                 - support for OEM Reader names
19473 
19474                                                 04.00.01 / 04.08.2011 / M. Hultsch
19475                                                 - bugfix for LR2500-A/B and LRU3000 concerning m_iUsedEEDataBlocks, m_iUsedRAMDataBlocks
19476 
19477                                                 03.03.03 / 09.05.2011 / M. Hultsch
19478                                                 - parameter ReaderType moved from unsigned char to unsigned int
19479 
19480                                                 03.03.01 / 07.03.2011 / M. Hultsch
19481                                                 - ID ISC.MRU102 added
19482 
19483                                                 03.03.00 / 01.02.2011 / M. Hultsch
19484                                                 - ID ISC.LR2500-A added
19485 
19486                                                 03.01.05 / 23.04.2010 / M. Hultsch
19487                                                 - ID ISC.MR102 and ID ISC.LR2500-B added
19488 
19489                                                 03.00.19 / 22.01.2010 / M. Hultsch
19490                                                 - new FU-Type: ID ISC.ANT.GPC
19491                                                 - full support for CPR50.XX
19492 
19493                                                 03.00.18 / 02.12.2009 / M. Hultsch
19494                                                 - ID MLC.COM and ID MLC.EMPS added
19495 
19496                                                 03.00.13 / 29.09.2009 / M. Hultsch
19497                                                 - ID MAX50.xx added
19498                                                 - used CFG Pages increased for PR101, MR101, MR200
19499 
19500                                                 03.00.08 / 09.06.2009 / M. Hultsch
19501                                                 - new reader type CPR44.xx
19502 
19503                                                 03.00.07 / 29.04.2009 / M. Hultsch
19504                                                 - new reader type ISC.M02.M8
19505 
19506                                                 03.00.06 / 15.04.2009 / M. Hultsch
19507                                                 - new reader type ISC.UM02
19508 
19509                                                 03.00.00 / 10.10.2008 / M. Hultsch
19510 
19511   Function                      :       sets the reader type and reader name
19512 
19513   Parameters            :       unsigned char uiReaderType      -       reader type from system manual
19514 
19515   Return value          :       OK (=0) or error code (<0)
19516 
19517 ***************************************************************************/
19518 int FEDM_ISCReader::SetReaderType(unsigned int uiReaderType)
19519 {
19520         unsigned char ucHWType = 0;
19521         char cReaderType[8];
19522         map<unsigned int, string>::iterator itor;
19523 
19524         FEDM_SETPROP2(m_pLogger, FELOGMNG_PROP_READER_TYPE, uiReaderType);
19525         sprintf(cReaderType, "%u", uiReaderType);
19526         FEISC_SetReaderPara(m_iReaderHnd, "ReaderType", cReaderType);
19527 
19528         // set blocksize for RFC configuration to default value
19529         // some Readers can change this blocksize
19530         m_iRFC_DataBlockSize    = 16;
19531 
19532         if(uiReaderType & 0x00000080)
19533         {
19534                 // reader class defined
19535                 // rfu
19536 #if defined(_FEDM_SUPPORT_READER_CLASS)
19537                 m_uiReaderType = uiReaderType;
19538 
19539                 switch(uiReaderType)
19540                 {
19541                 case FEDM_ISC_TYPE_ISCMR10X:
19542                         m_bSelectWithCinf = false;
19543                         itor = m_mapOemNames.find(uiReaderType);
19544                         if(itor != m_mapOemNames.end())
19545                                 strcpy(m_sReaderName, itor->second.c_str());
19546                         else
19547                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR10X);
19548                         m_iUsedEEDataBlocks = 64;
19549                         m_iUsedRAMDataBlocks = 64;
19550                         BuildAccessIdMap_Class_ISC_HF_MR1();
19551                         break;
19552                 }
19553 #endif
19554         }
19555         else
19556         {
19557                 // no reader class defined
19558 
19559                 m_uiReaderType = uiReaderType;
19560 
19561                 switch(uiReaderType)
19562                 {
19563                 // HF function units
19564                 case 11: // ID ISC.DAT
19565                         m_bSelectWithCinf = false;
19566                         itor = m_mapOemNames.find(uiReaderType);
19567                         if(itor != m_mapOemNames.end())
19568                                 strcpy(m_sReaderName, itor->second.c_str());
19569                         else
19570                                 strcpy(m_sReaderName, "ID ISC.DAT");
19571                         m_iUsedEEDataBlocks = 0;
19572                         m_iUsedRAMDataBlocks = 0;
19573                         break;
19574                 case 12: // ID ISC.UMUX
19575                         m_bSelectWithCinf = false;
19576                         itor = m_mapOemNames.find(uiReaderType);
19577                         if(itor != m_mapOemNames.end())
19578                                 strcpy(m_sReaderName, itor->second.c_str());
19579                         else
19580                                 strcpy(m_sReaderName, "ID ISC.UMUX");
19581                         m_iUsedEEDataBlocks = 0;
19582                         m_iUsedRAMDataBlocks = 0;
19583                         break;
19584                 case FEDM_ISC_TYPE_ANT_GPC: // ID ISC.ANT.GPC (Gate People Counter)
19585                         m_bSelectWithCinf = false;
19586                         itor = m_mapOemNames.find(uiReaderType);
19587                         if(itor != m_mapOemNames.end())
19588                                 strcpy(m_sReaderName, itor->second.c_str());
19589                         else
19590                                 strcpy(m_sReaderName, "ID ISC.ANT.GPC");
19591                         m_iUsedEEDataBlocks = 2;
19592                         m_iUsedRAMDataBlocks = 2;
19593                         break;
19594 
19595                 // LF classic types
19596                 case 20: // ID RW40.30
19597                         m_bSelectWithCinf = false;
19598                         itor = m_mapOemNames.find(uiReaderType);
19599                         if(itor != m_mapOemNames.end())
19600                                 strcpy(m_sReaderName, itor->second.c_str());
19601                         else
19602                                 strcpy(m_sReaderName, "ID RW40.30");
19603                         m_iUsedEEDataBlocks = 0;
19604                         m_iUsedRAMDataBlocks = 0;
19605                         break;
19606                 case FEDM_ISC_TYPE_ISCM01:
19607                         m_bSelectWithCinf = false;
19608                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED_READER_TYPE);
19609                 case FEDM_ISC_TYPE_ISCM02:
19610                         m_bSelectWithCinf = false;
19611                         itor = m_mapOemNames.find(uiReaderType);
19612                         if(itor != m_mapOemNames.end())
19613                                 strcpy(m_sReaderName, itor->second.c_str());
19614                         else
19615                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCM02);
19616                         m_iUsedEEDataBlocks = 16;
19617                         m_iUsedRAMDataBlocks = 16;
19618                         BuildAccessIdMap_M02();
19619                         break;
19620                 case 32: // ID ISC.M02.M8-B-DM
19621                         m_bSelectWithCinf = false;
19622                         itor = m_mapOemNames.find(uiReaderType);
19623                         if(itor != m_mapOemNames.end())
19624                                 strcpy(m_sReaderName, itor->second.c_str());
19625                         else
19626                                 strcpy(m_sReaderName, "ID ISC.M02.M8-B-DM");
19627                         m_iUsedEEDataBlocks = 0;
19628                         m_iUsedRAMDataBlocks = 0;
19629                         break;
19630                 case FEDM_ISC_TYPE_ISCM02_M8:
19631                         m_bSelectWithCinf = false;
19632                         itor = m_mapOemNames.find(uiReaderType);
19633                         if(itor != m_mapOemNames.end())
19634                                 strcpy(m_sReaderName, itor->second.c_str());
19635                         else
19636                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCM02_M8);
19637                         m_iUsedEEDataBlocks = 8;
19638                         m_iUsedRAMDataBlocks = 8;
19639                         BuildAccessIdMap_M02();
19640                         break;
19641                 case FEDM_ISC_TYPE_ISCLR100:
19642                         m_bSelectWithCinf = false;
19643                         FEDM_RETURN(FEDM_ERROR_UNSUPPORTED_READER_TYPE);
19644                 case FEDM_ISC_TYPE_ISCLR200:
19645                         m_bSelectWithCinf = false;
19646                         itor = m_mapOemNames.find(uiReaderType);
19647                         if(itor != m_mapOemNames.end())
19648                                 strcpy(m_sReaderName, itor->second.c_str());
19649                         else
19650                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLR200);
19651                         m_iUsedEEDataBlocks = 16;
19652                         m_iUsedRAMDataBlocks = 16;
19653                         BuildAccessIdMap_LR200();
19654                         break;
19655                 case FEDM_ISC_TYPE_ISCLR1002:
19656                         m_bSelectWithCinf = false;
19657                         itor = m_mapOemNames.find(uiReaderType);
19658                         if(itor != m_mapOemNames.end())
19659                                 strcpy(m_sReaderName, itor->second.c_str());
19660                         else
19661                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLR1002);
19662                         m_iUsedEEDataBlocks = 64;
19663                         m_iUsedRAMDataBlocks = 64;
19664                         BuildAccessIdMap_LR1002();
19665                         break;
19666                 case FEDM_ISC_TYPE_ISCLR2000:
19667                         m_bSelectWithCinf = false;
19668                         GetData(FEDM_ISC_TMP_SOFTVER_HW_TYPE, &ucHWType);
19669                         if(ucHWType & 0xC0)
19670                         {
19671                                 unsigned int uiType = ((unsigned int)ucHWType << 24) + uiReaderType;
19672                                 itor = m_mapOemNames4ReaderVariants.find(uiType);
19673                                 if(itor != m_mapOemNames4ReaderVariants.end())
19674                                         strcpy(m_sReaderName, itor->second.c_str());
19675                                 else
19676                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRM2000);
19677                         }
19678                         else
19679                         {
19680                                 itor = m_mapOemNames.find(uiReaderType);
19681                                 if(itor != m_mapOemNames.end())
19682                                         strcpy(m_sReaderName, itor->second.c_str());
19683                                 else
19684                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLR2000);
19685                         }
19686                         m_iUsedEEDataBlocks = 64;
19687                         m_iUsedRAMDataBlocks = 64;
19688                         BuildAccessIdMap_LR2000();
19689                         break;
19690                 case FEDM_ISC_TYPE_ISCLR2500_A:
19691                         m_bSelectWithCinf = false;
19692                         itor = m_mapOemNames.find(uiReaderType);
19693                         if(itor != m_mapOemNames.end())
19694                                 strcpy(m_sReaderName, itor->second.c_str());
19695                         else
19696                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLR2500_A);
19697                         m_iUsedEEDataBlocks = 87;
19698                         m_iUsedRAMDataBlocks = 87;
19699                         m_iRFC_DataBlockSize = 32;
19700                         BuildAccessIdMap_LR2500_A();
19701                         break;
19702                 case FEDM_ISC_TYPE_ISCLR2500_B:
19703                         m_bSelectWithCinf = false;
19704                         itor = m_mapOemNames.find(uiReaderType);
19705                         if(itor != m_mapOemNames.end())
19706                                 strcpy(m_sReaderName, itor->second.c_str());
19707                         else
19708                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLR2500_B);
19709                         m_iUsedEEDataBlocks = 87;
19710                         m_iUsedRAMDataBlocks = 87;
19711                         m_iRFC_DataBlockSize = 32;
19712                         BuildAccessIdMap_LR2500_B();
19713                         break;
19714                 case FEDM_ISC_TYPE_ISCPRH100_U:
19715                         m_bSelectWithCinf = false;
19716                         itor = m_mapOemNames.find(uiReaderType);
19717                         if(itor != m_mapOemNames.end())
19718                                 strcpy(m_sReaderName, itor->second.c_str());
19719                         else
19720                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH100_U);
19721                         m_iUsedEEDataBlocks = 16;
19722                         m_iUsedRAMDataBlocks = 16;
19723                         BuildAccessIdMap_MR101();
19724                         break;
19725                 case FEDM_ISC_TYPE_ISCPRH100:
19726                         m_bSelectWithCinf = false;
19727                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH100);
19728                         m_iUsedEEDataBlocks = 16;
19729                         m_iUsedRAMDataBlocks = 16;
19730                         BuildAccessIdMap_MR101();
19731                         break;
19732                 case FEDM_ISC_TYPE_ISCPRH101:
19733                         m_bSelectWithCinf = false;
19734                         itor = m_mapOemNames.find(uiReaderType);
19735                         if(itor != m_mapOemNames.end())
19736                                 strcpy(m_sReaderName, itor->second.c_str());
19737                         else
19738                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH101);
19739                         m_iUsedEEDataBlocks = 64;
19740                         m_iUsedRAMDataBlocks = 64;
19741                         BuildAccessIdMap_MR101();
19742                         break;
19743                 case FEDM_ISC_TYPE_ISCPRH101_U:
19744                         m_bSelectWithCinf = false;
19745                         itor = m_mapOemNames.find(uiReaderType);
19746                         if(itor != m_mapOemNames.end())
19747                                 strcpy(m_sReaderName, itor->second.c_str());
19748                         else
19749                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH101_U);
19750                         m_iUsedEEDataBlocks = 64;
19751                         m_iUsedRAMDataBlocks = 64;
19752                         BuildAccessIdMap_MR101();
19753                         break;
19754                 case FEDM_ISC_TYPE_ISCPRH102:
19755                         m_bSelectWithCinf = false;
19756                         itor = m_mapOemNames.find(uiReaderType);
19757                         if(itor != m_mapOemNames.end())
19758                                 strcpy(m_sReaderName, itor->second.c_str());
19759                         else
19760                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH102);
19761                         m_iUsedEEDataBlocks = 64;
19762                         m_iUsedRAMDataBlocks = 64;
19763                         BuildAccessIdMap_PRH102();
19764                         break;
19765                 case FEDM_ISC_TYPE_ISCPRH200:
19766                         m_bSelectWithCinf = false;
19767                         itor = m_mapOemNames.find(uiReaderType);
19768                         if(itor != m_mapOemNames.end())
19769                                 strcpy(m_sReaderName, itor->second.c_str());
19770                         else
19771                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRH200);
19772                         m_iUsedEEDataBlocks = 64;
19773                         m_iUsedRAMDataBlocks = 64;
19774                         BuildAccessIdMap_PRH200();
19775                         break;
19776                 case FEDM_ISC_TYPE_ISCMR100_U:
19777                         m_bSelectWithCinf = false;
19778                         itor = m_mapOemNames.find(uiReaderType);
19779                         if(itor != m_mapOemNames.end())
19780                                 strcpy(m_sReaderName, itor->second.c_str());
19781                         else
19782                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR100_U);
19783                         m_iUsedEEDataBlocks = 16;
19784                         m_iUsedRAMDataBlocks = 16;
19785                         BuildAccessIdMap_MR101();
19786                         break;
19787                 case FEDM_ISC_TYPE_ISCMR100:
19788                         m_bSelectWithCinf = false;
19789                         itor = m_mapOemNames.find(uiReaderType);
19790                         if(itor != m_mapOemNames.end())
19791                                 strcpy(m_sReaderName, itor->second.c_str());
19792                         else
19793                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR100);
19794                         m_iUsedEEDataBlocks = 16;
19795                         m_iUsedRAMDataBlocks = 16;
19796                         BuildAccessIdMap_MR101();
19797                         break;
19798                 case FEDM_ISC_TYPE_ISCMR102:
19799                         m_bSelectWithCinf = false;
19800                         itor = m_mapOemNames.find(uiReaderType);
19801                         if(itor != m_mapOemNames.end())
19802                                 strcpy(m_sReaderName, itor->second.c_str());
19803                         else
19804                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR102);
19805                         m_iUsedEEDataBlocks = 64;
19806                         m_iUsedRAMDataBlocks = 64;
19807                         BuildAccessIdMap_MR102();
19808                         break;
19809                 case FEDM_ISC_TYPE_ISCMR200:
19810                         m_bSelectWithCinf = false;
19811                         itor = m_mapOemNames.find(uiReaderType);
19812                         if(itor != m_mapOemNames.end())
19813                                 strcpy(m_sReaderName, itor->second.c_str());
19814                         else
19815                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR200);
19816                         m_iUsedEEDataBlocks = 64;
19817                         m_iUsedRAMDataBlocks = 64;
19818                         BuildAccessIdMap_MR200();
19819                         break;
19820                 case FEDM_ISC_TYPE_ISCMR101:
19821                         m_bSelectWithCinf = false;
19822                         itor = m_mapOemNames.find(uiReaderType);
19823                         if(itor != m_mapOemNames.end())
19824                                 strcpy(m_sReaderName, itor->second.c_str());
19825                         else
19826                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR101);
19827                         m_iUsedEEDataBlocks = 64;
19828                         m_iUsedRAMDataBlocks = 64;
19829                         BuildAccessIdMap_MR101();
19830                         break;
19831                 case FEDM_ISC_TYPE_ISCMR101_U:
19832                         m_bSelectWithCinf = false;
19833                         itor = m_mapOemNames.find(uiReaderType);
19834                         if(itor != m_mapOemNames.end())
19835                                 strcpy(m_sReaderName, itor->second.c_str());
19836                         else
19837                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMR101_U);
19838                         m_iUsedEEDataBlocks = 64;
19839                         m_iUsedRAMDataBlocks = 64;
19840                         BuildAccessIdMap_MR101();
19841                         break;
19842                 case FEDM_ISC_TYPE_CPRM02:
19843                         m_bSelectWithCinf = true;
19844                         itor = m_mapOemNames.find(uiReaderType);
19845                         if(itor != m_mapOemNames.end())
19846                                 strcpy(m_sReaderName, itor->second.c_str());
19847                         else
19848                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPRM02);
19849                         m_iUsedEEDataBlocks = 16;
19850                         m_iUsedRAMDataBlocks = 16;
19851                         BuildAccessIdMap_CPR();
19852                         break;
19853                 case FEDM_ISC_TYPE_CPR02:
19854                         m_bSelectWithCinf = true;
19855                         itor = m_mapOemNames.find(uiReaderType);
19856                         if(itor != m_mapOemNames.end())
19857                                 strcpy(m_sReaderName, itor->second.c_str());
19858                         else
19859                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR02);
19860                         m_iUsedEEDataBlocks = 16;
19861                         m_iUsedRAMDataBlocks = 16;
19862                         BuildAccessIdMap_CPR();
19863                         break;
19864                 case FEDM_ISC_TYPE_CPR04_U:
19865                         m_bSelectWithCinf = true;
19866                         itor = m_mapOemNames.find(uiReaderType);
19867                         if(itor != m_mapOemNames.end())
19868                                 strcpy(m_sReaderName, itor->second.c_str());
19869                         else
19870                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR04_U);
19871                         m_iUsedEEDataBlocks = 16;
19872                         m_iUsedRAMDataBlocks = 16;
19873                         BuildAccessIdMap_CPR();
19874                         break;
19875                 case FEDM_ISC_TYPE_CPR20_XX:
19876                         m_bSelectWithCinf = true;
19877                         itor = m_mapOemNames.find(uiReaderType);
19878                         if(itor != m_mapOemNames.end())
19879                                 strcpy(m_sReaderName, itor->second.c_str());
19880                         else
19881                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR20_XX);
19882                         m_iUsedEEDataBlocks = 16;
19883                         m_iUsedRAMDataBlocks = 16;
19884                         BuildAccessIdMap_CPR20();
19885                         break;
19886                 case FEDM_ISC_TYPE_CPR30_XX:
19887                         m_bSelectWithCinf = true;
19888                         itor = m_mapOemNames.find(uiReaderType);
19889                         if(itor != m_mapOemNames.end())
19890                                 strcpy(m_sReaderName, itor->second.c_str());
19891                         else
19892                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR30_XX);
19893                         m_iUsedEEDataBlocks = 64;
19894                         m_iUsedRAMDataBlocks = 64;
19895                         BuildAccessIdMap_CPR30();
19896                         break;
19897                 case FEDM_ISC_TYPE_CPR40_XX_U:
19898                         m_bSelectWithCinf = true;
19899                         itor = m_mapOemNames.find(uiReaderType);
19900                         if(itor != m_mapOemNames.end())
19901                                 strcpy(m_sReaderName, itor->second.c_str());
19902                         else
19903                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR40_XX_U);
19904                         m_iUsedEEDataBlocks = 16;
19905                         m_iUsedRAMDataBlocks = 16;
19906                         BuildAccessIdMap_CPR40();
19907                         break;
19908                 case FEDM_ISC_TYPE_CPR40_XX:
19909                         m_bSelectWithCinf = true;
19910                         itor = m_mapOemNames.find(uiReaderType);
19911                         if(itor != m_mapOemNames.end())
19912                                 strcpy(m_sReaderName, itor->second.c_str());
19913                         else
19914                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR40_XX);
19915                         m_iUsedEEDataBlocks = 16;
19916                         m_iUsedRAMDataBlocks = 16;
19917                         BuildAccessIdMap_CPR40();
19918                         break;
19919                 case FEDM_ISC_TYPE_CPR44_XX:
19920                         m_bSelectWithCinf = true;
19921                         itor = m_mapOemNames.find(uiReaderType);
19922                         if(itor != m_mapOemNames.end())
19923                                 strcpy(m_sReaderName, itor->second.c_str());
19924                         else
19925                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR44_XX);
19926                         m_iUsedEEDataBlocks = 16;
19927                         m_iUsedRAMDataBlocks = 16;
19928                         BuildAccessIdMap_CPR44();
19929                         break;
19930                 case FEDM_ISC_TYPE_CPR46_XX:
19931                         m_bSelectWithCinf = true;
19932                         itor = m_mapOemNames.find(uiReaderType);
19933                         if(itor != m_mapOemNames.end())
19934                                 strcpy(m_sReaderName, itor->second.c_str());
19935                         else
19936                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR46_XX);
19937                         m_iUsedEEDataBlocks = 16;
19938                         m_iUsedRAMDataBlocks = 16;
19939                         BuildAccessIdMap_CPR46();
19940                         break;
19941                 case FEDM_ISC_TYPE_CPR47_XX:
19942                         m_bSelectWithCinf = true;
19943                         itor = m_mapOemNames.find(uiReaderType);
19944                         if(itor != m_mapOemNames.end())
19945                                 strcpy(m_sReaderName, itor->second.c_str());
19946                         else
19947                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR47_XX);
19948                         m_iUsedEEDataBlocks = 16;
19949                         m_iUsedRAMDataBlocks = 16;
19950                         BuildAccessIdMap_CPR47();
19951                         break;
19952                 case FEDM_ISC_TYPE_CPR50_XX:
19953                         m_bSelectWithCinf = true;
19954                         itor = m_mapOemNames.find(uiReaderType);
19955                         if(itor != m_mapOemNames.end())
19956                                 strcpy(m_sReaderName, itor->second.c_str());
19957                         else
19958                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR50_XX);
19959                         m_iUsedEEDataBlocks = 64;
19960                         m_iUsedRAMDataBlocks = 64;
19961                         BuildAccessIdMap_CPR50();
19962                         break;
19963                 case FEDM_ISC_TYPE_CPR52_XX:
19964                         m_bSelectWithCinf = true;
19965                         itor = m_mapOemNames.find(uiReaderType);
19966                         if(itor != m_mapOemNames.end())
19967                                 strcpy(m_sReaderName, itor->second.c_str());
19968                         else
19969                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR52_XX);
19970                         m_iUsedEEDataBlocks = 16;
19971                         m_iUsedRAMDataBlocks = 16;
19972                         BuildAccessIdMap_CPR52();
19973                         break;
19974                 case FEDM_ISC_TYPE_CPR60_XX:
19975                         m_bSelectWithCinf = true;
19976                         itor = m_mapOemNames.find(uiReaderType);
19977                         if(itor != m_mapOemNames.end())
19978                                 strcpy(m_sReaderName, itor->second.c_str());
19979                         else
19980                                 strcpy(m_sReaderName, FEDM_ISC_NAME_CPR60_XX);
19981                         m_iUsedEEDataBlocks = 16;
19982                         m_iUsedRAMDataBlocks = 16;
19983                         BuildAccessIdMap_CPR60();
19984                         break;
19985 
19986                 // OBID myAXXESS reader types
19987                 case FEDM_ISC_TYPE_MAX50_XX:
19988                         m_bSelectWithCinf = true;
19989                         itor = m_mapOemNames.find(uiReaderType);
19990                         if(itor != m_mapOemNames.end())
19991                                 strcpy(m_sReaderName, itor->second.c_str());
19992                         else
19993                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MAX50_XX);
19994                         m_iUsedEEDataBlocks = 64;
19995                         m_iUsedRAMDataBlocks = 64;
19996                         BuildAccessIdMap_MAX50();
19997                         break;
19998                 case FEDM_ISC_TYPE_MAX_STANDARD:
19999                         m_bSelectWithCinf = true;
20000                         itor = m_mapOemNames.find(uiReaderType);
20001                         if(itor != m_mapOemNames.end())
20002                                 strcpy(m_sReaderName, itor->second.c_str());
20003                         else
20004                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MAX_STANDARD);
20005                         m_iUsedEEDataBlocks = 64;
20006                         m_iUsedRAMDataBlocks = 64;
20007                         BuildAccessIdMap_CPR30();
20008                         break;
20009                 case FEDM_ISC_TYPE_MAX_COMFORT:
20010                         m_bSelectWithCinf = true;
20011                         itor = m_mapOemNames.find(uiReaderType);
20012                         if(itor != m_mapOemNames.end())
20013                                 strcpy(m_sReaderName, itor->second.c_str());
20014                         else
20015                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MAX_COMFORT);
20016                         m_iUsedEEDataBlocks = 64;
20017                         m_iUsedRAMDataBlocks = 64;
20018                         BuildAccessIdMap_CPR30();
20019                         break;
20020                 case FEDM_ISC_TYPE_MAX_ONTOP:
20021                         m_bSelectWithCinf = true;
20022                         itor = m_mapOemNames.find(uiReaderType);
20023                         if(itor != m_mapOemNames.end())
20024                                 strcpy(m_sReaderName, itor->second.c_str());
20025                         else
20026                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MAX_ONTOP);
20027                         m_iUsedEEDataBlocks = 64;
20028                         m_iUsedRAMDataBlocks = 64;
20029                         BuildAccessIdMap_MAX_ONTOP();
20030                         break;
20031                 case FEDM_ISC_TYPE_MAXU1002:
20032                         m_bSelectWithCinf = false;
20033                         itor = m_mapOemNames.find(uiReaderType);
20034                         if(itor != m_mapOemNames.end())
20035                                 strcpy(m_sReaderName, itor->second.c_str());
20036                         else
20037                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MAXU1002);
20038                         m_iUsedEEDataBlocks = 64;
20039                         m_iUsedRAMDataBlocks = 64;
20040                         BuildAccessIdMap_MAXU1002();
20041                         break;
20042                 
20043                 // UHF reader types
20044                 case FEDM_ISC_TYPE_ISCMU02:
20045                         m_bSelectWithCinf = false;
20046                         itor = m_mapOemNames.find(uiReaderType);
20047                         if(itor != m_mapOemNames.end())
20048                                 strcpy(m_sReaderName, itor->second.c_str());
20049                         else
20050                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMU02);
20051                         m_iUsedEEDataBlocks = 64;
20052                         m_iUsedRAMDataBlocks = 64;
20053                         BuildAccessIdMap_ISCMU02();
20054                         break;
20055                 case FEDM_ISC_TYPE_ISCMU95:
20056                         m_bSelectWithCinf = false;
20057                         itor = m_mapOemNames.find(uiReaderType);
20058                         if(itor != m_mapOemNames.end())
20059                                 strcpy(m_sReaderName, itor->second.c_str());
20060                         else
20061                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMU95);
20062                         m_iUsedEEDataBlocks = 64;
20063                         m_iUsedRAMDataBlocks = 64;
20064                         BuildAccessIdMap_ISCMU02();
20065                         break;
20066                 case FEDM_ISC_TYPE_ISCMRU102:
20067                         m_bSelectWithCinf = false;
20068                         itor = m_mapOemNames.find(uiReaderType);
20069                         if(itor != m_mapOemNames.end())
20070                                 strcpy(m_sReaderName, itor->second.c_str());
20071                         else
20072                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMRU102);
20073                         m_iUsedEEDataBlocks = 64;
20074                         m_iUsedRAMDataBlocks = 64;
20075                         BuildAccessIdMap_MRU102();
20076                         break;
20077                 case FEDM_ISC_TYPE_ISCMRU200:
20078                         m_bSelectWithCinf = false;
20079                         itor = m_mapOemNames.find(uiReaderType);
20080                         if(itor != m_mapOemNames.end())
20081                                 strcpy(m_sReaderName, itor->second.c_str());
20082                         else
20083                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCMRU200);
20084                         m_iUsedEEDataBlocks = 64;
20085                         m_iUsedRAMDataBlocks = 64;
20086                         BuildAccessIdMap_MRU200();
20087                         break;
20088                 case FEDM_ISC_TYPE_ISCLRU1000:
20089                         m_bSelectWithCinf = false;
20090                         GetData(FEDM_ISC_TMP_SOFTVER_HW_TYPE, &ucHWType);
20091                         if(ucHWType & 0xC0)
20092                         {
20093                                 unsigned int uiType = ((unsigned int)ucHWType << 24) + uiReaderType;
20094                                 itor = m_mapOemNames4ReaderVariants.find(uiType);
20095                                 if(itor != m_mapOemNames4ReaderVariants.end())
20096                                         strcpy(m_sReaderName, itor->second.c_str());
20097                                 else
20098                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRMU1000);
20099                         }
20100                         else
20101                         {
20102                                 itor = m_mapOemNames.find(uiReaderType);
20103                                 if(itor != m_mapOemNames.end())
20104                                         strcpy(m_sReaderName, itor->second.c_str());
20105                                 else
20106                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRU1000);
20107                         }
20108                         m_iUsedEEDataBlocks = 64;
20109                         m_iUsedRAMDataBlocks = 64;
20110                         BuildAccessIdMap_LRU1000();
20111                         break;
20112                 case FEDM_ISC_TYPE_ISCLRU1002:
20113                         m_bSelectWithCinf = false;
20114                         itor = m_mapOemNames.find(uiReaderType);
20115                         if(itor != m_mapOemNames.end())
20116                                 strcpy(m_sReaderName, itor->second.c_str());
20117                         else
20118                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRU1002);
20119                         m_iUsedEEDataBlocks = 64;
20120                         m_iUsedRAMDataBlocks = 64;
20121                         BuildAccessIdMap_LRU1002();
20122                         break;
20123                 case FEDM_ISC_TYPE_ISCLRU2000:
20124                         m_bSelectWithCinf = false;
20125                         GetData(FEDM_ISC_TMP_SOFTVER_HW_TYPE, &ucHWType);
20126                         if(ucHWType & 0xC0)
20127                         {
20128                                 unsigned int uiType = ((unsigned int)ucHWType << 24) + uiReaderType;
20129                                 itor = m_mapOemNames4ReaderVariants.find(uiType);
20130                                 if(itor != m_mapOemNames4ReaderVariants.end())
20131                                         strcpy(m_sReaderName, itor->second.c_str());
20132                                 else
20133                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRMU2000);
20134                         }
20135                         else
20136                         {
20137                                 itor = m_mapOemNames.find(uiReaderType);
20138                                 if(itor != m_mapOemNames.end())
20139                                         strcpy(m_sReaderName, itor->second.c_str());
20140                                 else
20141                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRU2000);
20142                         }
20143                         m_iUsedEEDataBlocks = 64;
20144                         m_iUsedRAMDataBlocks = 64;
20145                         BuildAccessIdMap_LRU2000();
20146                         break;
20147                 case FEDM_ISC_TYPE_ISCLRU3000:
20148                         m_bSelectWithCinf = false;
20149                         GetData(FEDM_ISC_TMP_SOFTVER_HW_TYPE, &ucHWType);
20150                         if(ucHWType & 0x01)
20151                         {
20152                                 unsigned int uiType = ((unsigned int)ucHWType << 24) + uiReaderType;
20153                                 itor = m_mapOemNames4ReaderVariants.find(uiType);
20154                                 if(itor != m_mapOemNames4ReaderVariants.end())
20155                                         strcpy(m_sReaderName, itor->second.c_str());
20156                                 else
20157                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRU3500);
20158                         }
20159                         else
20160                         {
20161                                 itor = m_mapOemNames.find(uiReaderType);
20162                                 if(itor != m_mapOemNames.end())
20163                                         strcpy(m_sReaderName, itor->second.c_str());
20164                                 else
20165                                         strcpy(m_sReaderName, FEDM_ISC_NAME_ISCLRU3000);
20166                         }
20167 #ifndef FEDM_NEW_LRU3000_ACC_CFG
20168                         m_iUsedEEDataBlocks = 64;
20169                         m_iUsedRAMDataBlocks = 64;
20170 #else
20171                         m_iUsedEEDataBlocks = 88;
20172                         m_iUsedRAMDataBlocks = 88;
20173                         m_iRFC_DataBlockSize = 32;
20174 #endif
20175                         BuildAccessIdMap_LRU3000();
20176                         break;
20177 
20178                 // HF/UHF dual frequency reader types
20179                 case FEDM_ISC_TYPE_ISCPRHD102:
20180                         m_bSelectWithCinf = false;
20181                         itor = m_mapOemNames.find(uiReaderType);
20182                         if(itor != m_mapOemNames.end())
20183                                 strcpy(m_sReaderName, itor->second.c_str());
20184                         else
20185                                 strcpy(m_sReaderName, FEDM_ISC_NAME_ISCPRHD102);
20186                         m_iUsedEEDataBlocks = 64;
20187                         m_iUsedRAMDataBlocks = 64;
20188                         BuildAccessIdMap_PRHD102();
20189                         break;
20190 
20191                 // OBID megalock C reader types
20192                 case FEDM_ISC_TYPE_MLC_COM:     // communicator
20193                         m_bSelectWithCinf = false;
20194                         itor = m_mapOemNames.find(uiReaderType);
20195                         if(itor != m_mapOemNames.end())
20196                                 strcpy(m_sReaderName, itor->second.c_str());
20197                         else
20198                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MLC_COM);
20199                         m_iUsedEEDataBlocks = 8;
20200                         m_iUsedRAMDataBlocks = 8;
20201                         BuildAccessIdMap_CPR();
20202         //              m_mapAccessID.clear(); // no configuration
20203                         break;
20204                 case FEDM_ISC_TYPE_MLC_EMPS: // locker
20205                         m_bSelectWithCinf = false;
20206                         itor = m_mapOemNames.find(uiReaderType);
20207                         if(itor != m_mapOemNames.end())
20208                                 strcpy(m_sReaderName, itor->second.c_str());
20209                         else
20210                                 strcpy(m_sReaderName, FEDM_ISC_NAME_MLC_EMPS);
20211                         m_iUsedEEDataBlocks = 0;
20212                         m_iUsedRAMDataBlocks = 0;
20213                         m_mapAccessID.clear(); // no configuration
20214                         break;
20215 
20216                 default:
20217                         m_bSelectWithCinf = false;
20218                         m_sReaderName[0] = '\0';
20219                         m_iUsedEEDataBlocks = 64;
20220                         m_iUsedRAMDataBlocks = 64;
20221                         FEDM_TRACE(m_pLogger, FELOGMNG_DBG_ERROR, __FUNCTION__ << "(ReaderType=" << uiReaderType << ") " << GetErrorText(FEDM_ERROR_UNKNOWN_READER_TYPE));
20222                         FEDM_RETURN(FEDM_ERROR_UNKNOWN_READER_TYPE);
20223                 }
20224         }
20225 
20226         FEDM_RETURN(FEDM_OK);
20227 }
20228 
20229 char* FEDM_ISCReader::GetReaderName()
20230 {
20231         return FEDM_DataBase::GetReaderName();
20232 }
20233 
20234 char* FEDM_ISCReader::GetReaderName(unsigned int uiReaderType)
20235 {
20236         map<unsigned int, string>::iterator itor;
20237 
20238         itor = m_mapOemNames.find(uiReaderType);
20239         if(itor != m_mapOemNames.end())
20240                 return (char*)itor->second.c_str();
20241 
20242         switch(uiReaderType)
20243         {
20244         // HF Function Units
20245         case 11: // ID ISC.DAT
20246                 return "ID ISC.DAT";
20247         case 12: // ID ISC.UMUX
20248                 return "ID ISC.UMUX";
20249         case FEDM_ISC_TYPE_ANT_GPC: // ID ISC.ANT.GPC (Gate People Counter)
20250                 return "ID ISC.ANT.GPC";
20251         // LF classic reader types
20252         case 20:
20253                 return "ID RW40.30-U";
20254         // HF reader types
20255         case FEDM_ISC_TYPE_ISCM01:
20256                 break; // no more support
20257         case FEDM_ISC_TYPE_ISCM02:
20258                 return FEDM_ISC_NAME_ISCM02;
20259         case 32: // ID ISC.M02.M8-B-DM
20260                 return "ID ISC.M02.M8-B-DM";
20261         case FEDM_ISC_TYPE_ISCM02_M8:
20262                 return FEDM_ISC_NAME_ISCM02_M8;
20263         case FEDM_ISC_TYPE_ISCLR100:
20264                 break; // no more support
20265         case FEDM_ISC_TYPE_ISCLR200:
20266                 return FEDM_ISC_NAME_ISCLR200;
20267         case FEDM_ISC_TYPE_ISCLR1002:
20268                 return FEDM_ISC_NAME_ISCLR1002;
20269         case FEDM_ISC_TYPE_ISCLR2000:
20270                 return FEDM_ISC_NAME_ISCLR2000;
20271         case FEDM_ISC_TYPE_ISCLR2500_A:
20272                 return FEDM_ISC_NAME_ISCLR2500_A;
20273         case FEDM_ISC_TYPE_ISCLR2500_B:
20274                 return FEDM_ISC_NAME_ISCLR2500_B;
20275         case FEDM_ISC_TYPE_ISCPRH100_U:
20276                 return FEDM_ISC_NAME_ISCPRH100_U;
20277         case FEDM_ISC_TYPE_ISCPRH100:
20278                 return FEDM_ISC_NAME_ISCPRH100;
20279         case FEDM_ISC_TYPE_ISCPRH101:
20280                 return FEDM_ISC_NAME_ISCPRH101;
20281         case FEDM_ISC_TYPE_ISCPRH101_U:
20282                 return FEDM_ISC_NAME_ISCPRH101_U;
20283         case FEDM_ISC_TYPE_ISCPRH102:
20284                 return FEDM_ISC_NAME_ISCPRH102;
20285         case FEDM_ISC_TYPE_ISCPRH200:
20286                 return FEDM_ISC_NAME_ISCPRH200;
20287         case FEDM_ISC_TYPE_ISCMR100_U:
20288                 return FEDM_ISC_NAME_ISCMR100_U;
20289         case FEDM_ISC_TYPE_ISCMR100:
20290                 return FEDM_ISC_NAME_ISCMR100;
20291         case FEDM_ISC_TYPE_ISCMR200:
20292                 return FEDM_ISC_NAME_ISCMR200;
20293         case FEDM_ISC_TYPE_ISCMR101:
20294                 return FEDM_ISC_NAME_ISCMR101;
20295         case FEDM_ISC_TYPE_ISCMR102:
20296                 return FEDM_ISC_NAME_ISCMR102;
20297         case FEDM_ISC_TYPE_ISCMR10X:
20298                 return FEDM_ISC_NAME_ISCMR10X;
20299         case FEDM_ISC_TYPE_ISCMR101_U:
20300                 return FEDM_ISC_NAME_ISCMR101_U;
20301         case FEDM_ISC_TYPE_CPRM02:
20302                 return FEDM_ISC_NAME_CPRM02;
20303         case FEDM_ISC_TYPE_CPR02:
20304                 return FEDM_ISC_NAME_CPR02;
20305         case FEDM_ISC_TYPE_CPR04_U:
20306                 return FEDM_ISC_NAME_CPR04_U;
20307         case FEDM_ISC_TYPE_CPR20_XX:
20308                 return FEDM_ISC_NAME_CPR20_XX;
20309         case FEDM_ISC_TYPE_CPR30_XX:
20310                 return FEDM_ISC_NAME_CPR30_XX;
20311         case FEDM_ISC_TYPE_CPR40_XX_U:
20312                 return FEDM_ISC_NAME_CPR40_XX_U;
20313         case FEDM_ISC_TYPE_CPR40_XX:
20314                 return FEDM_ISC_NAME_CPR40_XX;
20315         case FEDM_ISC_TYPE_CPR44_XX:
20316                 return FEDM_ISC_NAME_CPR44_XX;
20317         case FEDM_ISC_TYPE_CPR46_XX:
20318                 return FEDM_ISC_NAME_CPR46_XX;
20319         case FEDM_ISC_TYPE_CPR47_XX:
20320                 return FEDM_ISC_NAME_CPR47_XX;
20321         case FEDM_ISC_TYPE_CPR50_XX:
20322                 return FEDM_ISC_NAME_CPR50_XX;
20323         
20324         // OBID myAXXESS reader types
20325         case FEDM_ISC_TYPE_MAX50_XX:
20326                 return FEDM_ISC_NAME_MAX50_XX;
20327         case FEDM_ISC_TYPE_MAX_STANDARD:
20328                 return FEDM_ISC_NAME_MAX_STANDARD;
20329         case FEDM_ISC_TYPE_MAX_COMFORT:
20330                 return FEDM_ISC_NAME_MAX_COMFORT;
20331         case FEDM_ISC_TYPE_MAX_ONTOP:
20332                 return FEDM_ISC_NAME_MAX_ONTOP;
20333         case FEDM_ISC_TYPE_MAXU1002:
20334                 return FEDM_ISC_NAME_MAXU1002;
20335         
20336         // UHF reader types
20337         case FEDM_ISC_TYPE_ISCMU02:
20338                 return FEDM_ISC_NAME_ISCMU02;
20339         case FEDM_ISC_TYPE_ISCMRU102:
20340                 return FEDM_ISC_NAME_ISCMRU102;
20341         case FEDM_ISC_TYPE_ISCMRU200:
20342                 return FEDM_ISC_NAME_ISCMRU200;
20343         case FEDM_ISC_TYPE_ISCLRU1000:
20344                 return FEDM_ISC_NAME_ISCLRU1000;
20345         case FEDM_ISC_TYPE_ISCLRU1002:
20346                 return FEDM_ISC_NAME_ISCLRU1002;
20347         case FEDM_ISC_TYPE_ISCLRU2000:
20348                 return FEDM_ISC_NAME_ISCLRU2000;
20349         case FEDM_ISC_TYPE_ISCLRU3000:
20350                 return FEDM_ISC_NAME_ISCLRU3000;
20351 
20352         // HF/UHF dual frequency reader types
20353         case FEDM_ISC_TYPE_ISCPRHD102:
20354                 return FEDM_ISC_NAME_ISCPRHD102;
20355 
20356         // OBID megalock C reader types
20357         case FEDM_ISC_TYPE_MLC_COM:     // communicator
20358                 return FEDM_ISC_NAME_MLC_COM;
20359 
20360         case FEDM_ISC_TYPE_MLC_EMPS: // locker
20361                 return FEDM_ISC_NAME_MLC_EMPS;
20362         }
20363 
20364         return "";
20365 }
20366 
20367 /***************************************************************************
20368   Begin                 :       09.08.2011 / M. Hultsch
20369   Version               :       04.00.02 / 09.08.2011 / M. Hultsch
20370 
20371   Function                      :       set OEM names for Readers
20372 
20373   Parameters            :       two maps with OEM names for Readers
20374 
20375   Return value          :       -
20376 ***************************************************************************/
20377 void FEDM_ISCReader::SetOemReaderNames(map<unsigned int, string> mapOemNames,
20378                                                                            map<unsigned int, string> mapOemNames4ReaderVariants)
20379 {
20380         m_mapOemNames.swap(mapOemNames);
20381         m_mapOemNames4ReaderVariants.swap(mapOemNames4ReaderVariants);
20382 }
20383 
20384 /***************************************************************************
20385   Begin                 :       06.06.2005 / M. Hultsch
20386   Version               :       03.00.14 / 29.10.2009 / M. Hultsch
20387 
20388   Function                      :       gets the tag name of the tag type
20389 
20390   Parameters            :       unsigned char ucTagType -       tag type from system manual
20391 
20392   Return value          :       C-string
20393 
20394 ***************************************************************************/
20395 char* FEDM_ISCReader::GetTagName(unsigned char ucTagType)
20396 {
20397         switch(ucTagType)
20398         {
20399         case FEDM_ISC_TR_TYPE_ICODE1:
20400                 return FEDM_ISC_TR_NAME_ICODE1;
20401 
20402         case FEDM_ISC_TR_TYPE_TAGIT:
20403                 return FEDM_ISC_TR_NAME_TAGIT;
20404 
20405         case FEDM_ISC_TR_TYPE_ISO15693:
20406                 return FEDM_ISC_TR_NAME_ISO15693;
20407 
20408         case FEDM_ISC_TR_TYPE_ISO14443A:
20409                 return FEDM_ISC_TR_NAME_ISO14443A;
20410 
20411         case FEDM_ISC_TR_TYPE_ISO14443B:
20412                 return FEDM_ISC_TR_NAME_ISO14443B;
20413 
20414         case FEDM_ISC_TR_TYPE_EPC:
20415                 return FEDM_ISC_TR_NAME_EPC;
20416 
20417         case FEDM_ISC_TR_TYPE_ICODE_UID:
20418                 return FEDM_ISC_TR_NAME_ICODE_UID;
20419 
20420         case FEDM_ISC_TR_TYPE_JEWEL:
20421                 return FEDM_ISC_TR_NAME_JEWEL;
20422 
20423         case FEDM_ISC_TR_TYPE_ISO18000_3M3:
20424                 return FEDM_ISC_TR_NAME_ISO18000_3M3;
20425 
20426         case FEDM_ISC_TR_TYPE_STM_SR176:
20427                 return FEDM_ISC_TR_NAME_STM_SR176;
20428 
20429         case FEDM_ISC_TR_TYPE_STM_SRIxx:
20430                 return FEDM_ISC_TR_NAME_STM_SRIxx;
20431 
20432         case FEDM_ISC_TR_TYPE_MCRFxxx:
20433                 return FEDM_ISC_TR_NAME_MCRFxxx;
20434 
20435         case FEDM_ISC_TR_TYPE_INNOVATRON:
20436                 return FEDM_ISC_TR_NAME_INNOVATRON;
20437 
20438         case FEDM_ISC_TR_TYPE_ASK_CTx:
20439                 return FEDM_ISC_TR_NAME_ASK_CTx;
20440 
20441         /*case FEDM_ISC_TR_TYPE_0x64:
20442                 return FEDM_ISC_TR_NAME_0x64;*/
20443 
20444         case FEDM_ISC_TR_TYPE_ISO18000_6_A:
20445                 return FEDM_ISC_TR_NAME_ISO18000_6_A;
20446 
20447         case FEDM_ISC_TR_TYPE_ISO18000_6_B:
20448                 return FEDM_ISC_TR_NAME_ISO18000_6_B;
20449 
20450         case FEDM_ISC_TR_TYPE_EM4222:
20451                 return FEDM_ISC_TR_NAME_EM4222;
20452 
20453         case FEDM_ISC_TR_TYPE_EPC_CLASS0:
20454                 return FEDM_ISC_TR_NAME_EPC_CLASS0;
20455 
20456         case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN2:
20457                 return FEDM_ISC_TR_NAME_EPC_CLASS1_GEN2;
20458 
20459         case FEDM_ISC_TR_TYPE_EPC_CLASS1_GEN1:
20460                 return FEDM_ISC_TR_NAME_EPC_CLASS1_GEN1;
20461 
20462         case 0x7F:
20463                 return "Generic Tag";
20464 
20465         default:
20466                 return "";
20467         }
20468 }


rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Thu Apr 2 2015 03:06:12