FEDM_DataBase.h
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                  FEDM_DataBase.h                      |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright © 2000-2012   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                   :       13.05.2000
00018 
00019 Version                 :       04.00.10 / 06.02.2012 / M. Hultsch
00020                                                 - support for external logmanager (FELOGMNG.dll), when #define _FELOGMNG_SUPPORT is set
00021 
00022                                                 03.03.03 / 09.05.2011 / M. Hultsch
00023                                                 - parameter m_ucReaderType moved from unsigned char to unsigned int
00024 
00025                                                 03.01.06 / 10.05.2010 / M. Hultsch
00026 
00027 Operation Systems       :       independent
00028 
00029 Function                        :       abstract class with data memories
00030 
00031 
00032 Trademarks:
00033 -----------
00034 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00035 Other Trademarks: see FEDM.h
00036 */
00037 
00038 
00039 
00040 #if !defined(_FEDM_DATABASE_H_INCLUDED_)
00041 #define _FEDM_DATABASE_H_INCLUDED_
00042 
00043 
00044 
00045 #include "FEDM_Base.h"
00046 #include "FEDM_Xml.h"
00047 #include "FEDM_Logger.h"
00048 
00049 class FEDM_XMLBase;
00050 class FEDM_XMLReaderCfgDataModul;
00051 class FEDM_XMLReaderCfgProfileModul;
00052 #ifndef _FEDM_XML_SUPPORT
00053         struct FEDM_XML_TREEITEM;
00054 #endif
00055 
00056 
00057 
00058 
00059 
00060 // type definition for callback function for method FindBaudRate(..)
00061 // void* pAny                           - pointer to anything (e.g. 'this' pointer), which is transferred as last parameter in FindBaudRate
00062 // int iPortNr                          - serial port number
00063 // unsigned char ucBusAdr       - bus address
00064 // char* cBaud                          - actual selected baudrate ("230400", "115200", "57600", "38400", "19200", "9600", "4800")
00065 // char* cFrame                         - actual selected frame ("8E1", "8N1", "8O1")
00066 // int iPrtFrame                        - actual selected OBID protocol frame (FEDM_PRT_FRAME_STANDARD, FEDM_PRT_FRAME_ADVANCED)
00067 typedef void(*FEDM_CB_FIND_BAUDRATE)(void*, int, unsigned char, char*, char*, int);
00068 
00069 
00070 
00071 
00072 class _FEDM_ISC_CORE_EXT_CLASS FEDM_DataBase : public FEDM_Base
00073 {
00074 // #################
00075 // ### functions ###
00076 // #################
00077 public:
00078         FEDM_DataBase();
00079         virtual ~FEDM_DataBase();
00080 
00081 
00082         // check version numbers of dependent libraries
00083         virtual int EvalLibDependencies(string& sMessage)=0;
00084 
00085 
00086 
00087         // sub-function for XML file-I/O
00088         virtual int Serialize(FEDM_XMLReaderCfgDataModul* xml, 
00089                                                   bool bRead, 
00090                                                   char* sFileName);
00091 
00092         // sub-function for XML based reader customization
00093         virtual int SerializeProfile(FEDM_XMLReaderCfgProfileModul* xml, 
00094                                                                   bool bRead, 
00095                                                                   char* sFileName);
00096 
00097 
00098         // sub-function for XML based reader customization
00099         virtual int SerializeProfileIn( FEDM_XMLBase* xml,
00100                                                                         FEDM_XML_TREEITEM* root);
00101 
00102         virtual int SerializeProfileOut( FEDM_XMLBase* xml,
00103                                                                          FEDM_XML_TREEITEM* root);
00104 
00105         // set the reader handle
00106         // must be done before use of all other functions
00107         void SetReaderHnd(int iReaderHnd);
00108         int  GetReaderHnd();
00109 
00110         // set the busaddress for asynchrone communication
00111         // default: 0xFF
00112         void  SetBusAddress(unsigned char ucBusAdr);
00113         unsigned char GetBusAddress();
00114 
00115         // query functions
00116         char* GetFamilyCode();
00117         char* GetReaderName();
00118         unsigned int GetReaderType();
00119 
00120         // functions for management support
00121         void SetModuleHnd(int iHnd);
00122         int  GetModuleHnd();
00123 
00124         // log support
00125         FEDM_Logger* GetLogger()        { return m_pLogger; }
00126 
00127         // main access functions
00128         virtual int GetData( const char* ID, bool* Data );
00129 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00130         virtual int GetData( const char* ID, BOOL* Data );
00131 #endif
00132         virtual int GetData( const char* ID, unsigned char* Data );
00133         virtual int GetData( const char* ID, unsigned char* Data, int Cnt );
00134         virtual int GetData( const char* ID, unsigned int* Data );
00135         virtual int GetData( const char* ID, __int64* Data);
00136 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00137         virtual int GetData( const char* ID, CString& Data );
00138 #endif
00139         virtual int GetData( const char* ID, string& Data );
00140         virtual int GetData( const char* ID, char* Data, int DataLen );
00141         
00142         virtual int SetData( const char* ID, bool Data );
00143 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00144         virtual int SetData( const char* ID, BOOL Data );
00145 #endif
00146         virtual int SetData( const char* ID, unsigned char Data );
00147         virtual int SetData( const char* ID, unsigned char* Data, int Cnt );
00148         virtual int SetData( const char* ID, unsigned int Data );
00149         virtual int SetData( const char* ID, __int64 Data);
00150 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00151         virtual int SetData( const char* ID, CString Data );
00152 #endif
00153         virtual int SetData( const char* ID, string Data );
00154         virtual int SetData( const char* ID, char* Data, int DataLen );
00155 
00156         // for direct access with address (MemID is defined in FEDM.h)
00157         virtual int GetData( int Adr, unsigned char* Data, int MemID );
00158         virtual int GetData( int Adr, unsigned char* Data, int Cnt, int MemID );
00159         virtual int GetData( int Adr, unsigned int* Data, int MemID );
00160         virtual int GetData( int Adr, __int64* Data, int MemID );
00161 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00162         virtual int GetData( int Adr, CString& Data, int Cnt, int MemID );
00163 #endif
00164 
00165         virtual int SetData( int Adr, unsigned char Data, int MemID );
00166         virtual int SetData( int Adr, unsigned char* Data, int Cnt, int MemID );
00167         virtual int SetData( int Adr, unsigned int Data, int MemID );
00168         virtual int SetData( int Adr, __int64 Data, int MemID );
00169 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00170         virtual int SetData( int Adr, CString Data, int MemID );
00171 #endif
00172 
00173 
00174         int GetAccessID(string sParaName, string& sAccessID, bool bEEPROM);
00175 
00176 
00177 // ##########################
00178 // ### abstract functions ###
00179 // ##########################
00180 public:
00181         // abstract communication functions
00182         virtual int SendProtocol(unsigned char ucStByte)=0;
00183 
00184         // function to find the baudrate and frame of reader
00185         virtual int FindBaudRate(bool* pStop = NULL, int iTimeout = 300, int iFrameSupport = 0, FEDM_CB_FIND_BAUDRATE cbFct=NULL, void* pAny=NULL)=0;
00186 
00187         virtual int GetLastProt(char* sID, char* sProt)=0;
00188 
00189         // abstract functions for communication channel
00190         virtual int SetPortHnd(int iPortHnd)=0;
00191         virtual int GetPortHnd()=0;
00192 
00193         // change the protocol type (STANDARD or ADVANCED)
00194         // STANDARD is preset
00195         virtual int SetProtocolFrameSupport(unsigned int uiType)=0;
00196         virtual int GetProtocolFrameSupport()=0;
00197 
00198         virtual int SetReaderType(unsigned int uiReaderType)=0;
00199 
00200         // abstract main function for XML serialization
00201         virtual int Serialize(bool bRead, char* sFileName)=0;
00202 
00203         // abstract sub-functions for XML serialization
00204         virtual int SerializeIn(FEDM_XMLBase* xml, FEDM_XML_TREEITEM* root)=0;
00205         virtual int SerializeOut(FEDM_XMLBase* xml, FEDM_XML_TREEITEM* root)=0;
00206 
00207 #ifdef _FEDM_MFC_SUPPORT
00208         // abstract function for proprietary file-I/O
00209         virtual int Serialize(CArchive& ar, int iMemType)=0;
00210 #endif
00211 
00212         // abstract miscellaneous functions
00213         virtual int             GetLastError()=0;
00214         virtual int             GetLastStatus()=0;
00215         virtual int             GetErrorText(char* cErrorText, int iErrorCode)=0;
00216         virtual char*   GetErrorText(int iErrorCode)=0;
00217         virtual int             GetStatusText(char* cStatusText, unsigned char ucStatus)=0;
00218         virtual char*   GetStatusText(unsigned char ucStatus)=0;
00219 
00220         // abstract functions for access of one attribute from table
00221         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, bool* bData)=0;
00222         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char* ucData)=0;
00223         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char* ucData, int iDataBufLen)=0;
00224         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int* uiData)=0;
00225         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, __int64* i64Data)=0;
00226         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, char* Data, int iDataBufLen)=0;
00227         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, string& sData)=0;
00228 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00229         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, CString& sData)=0;
00230 #endif
00231 
00232         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, bool bData)=0;
00233         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char ucData)=0;
00234         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int uiData)=0;
00235         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, __int64 i64Data)=0;
00236         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, string sData)=0;
00237 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00238         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID, CString sData)=0;
00239 #endif
00240         
00241         // abstract functions for access of one datablock from table
00242         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00243                                                          int iBlockNr, unsigned char* ucData, int iDataBufLen)=0;
00244         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00245                                                          int iBlockNr, string& sData)=0;
00246         
00247 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00248         virtual int GetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00249                                                          int iBlockNr, CString& sData)=0;
00250 #endif
00251 
00252         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00253                                                          int iBlockNr, unsigned char* ucData, int iDataBufLen)=0;
00254         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00255                                                          int iBlockNr, string sData)=0;
00256 
00257 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00258         virtual int SetTableData(int iIdx, unsigned int uiTableID, unsigned int uiDataID,
00259                                                          int iBlockNr, CString sData)=0;
00260 #endif
00261         
00262         // abstract function for verify read/write-data block(s) in table
00263         virtual int VerifyTableData(int iIdx, unsigned int uiTableID, int iBlockNr, int iBlockCnt)=0;
00264         
00265         // abstract functions for search of index of one table data
00266         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, bool bData)=0;
00267         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned char ucData)=0;
00268         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, unsigned int uiData)=0;
00269         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, __int64 i64Data)=0;
00270         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, string sData)=0;
00271 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00272         virtual int FindTableIndex(int iStartIdx, unsigned int uiTableID, unsigned int uiDataID, CString sData)=0;
00273 #endif
00274 
00275         // abstract function for setting the size of a table
00276         virtual int SetTableSize(unsigned int uiTableID, int iSize)=0;
00277         // abstract function for query the size of a table
00278         virtual int GetTableSize(unsigned int uiTableID)=0;
00279         // abstract function for query the length of valid data in a table
00280         virtual int GetTableLength(unsigned int uiTableID)=0;
00281         // abstract function to reset the table (the content of the table)
00282         virtual int ResetTable(unsigned int uiTableID, unsigned int uiDataFlags)=0;
00283 
00284 
00285 // ###############################
00286 // ### serialization functions ###
00287 // ###############################
00288 protected:
00289         // sub-function for XML serialization
00290         virtual int SerializeIn(int iMemType,
00291                                                         FEDM_XMLBase* xml,
00292                                                         FEDM_XML_TREEITEM* root);
00293 
00294         virtual int SerializeOut(int iMemType,
00295                                                          FEDM_XMLBase* xml,
00296                                                          FEDM_XML_TREEITEM* root);
00297 
00298         void OptionalSetDataAction( const char* ID, __int64 Data );
00299         void OptionalSetDataAction( const char* ID, string Data );
00300 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00301         void OptionalSetDataAction( const char* ID, CString Data );
00302 #endif
00303 
00304 
00305 
00306 // ############################
00307 // ### public datacontainer ###
00308 // ############################
00309 public:
00310         // memories (block-organized; data in Motorolas "Big Endian" format)
00311         // ### for reader
00312         FEDM_BYTE_ARRAY m_RFC_EEData;   // EEPROM parameter for RF-Controller
00313         FEDM_BYTE_ARRAY m_RFC_RAMData;  // RAM parameter for RF-Controller
00314 
00315         FEDM_BYTE_ARRAY m_ACC_EEData;   // EEPROM parameter for AC-Controller
00316         FEDM_BYTE_ARRAY m_ACC_RAMData;  // RAM parameter for AC-Controller
00317 
00318         // ### for transponder
00319         FEDM_BYTE_ARRAY m_SN_Mem;               // serial number
00320         FEDM_BYTE_ARRAY m_ID_Mem;               // ID number
00321         FEDM_BYTE_ARRAY m_AC_Mem;               // account
00322         FEDM_BYTE_ARRAY m_PubMem;               // public memory
00323         FEDM_BYTE_ARRAY m_SecMem;               // secret memory
00324         FEDM_BYTE_ARRAY m_ConfMem;              // configuration memory
00325         FEDM_BYTE_ARRAY m_DateMem;              // date memory
00326 
00327         // ### for temporary Data
00328         FEDM_BYTE_ARRAY m_TmpData;
00329         FEDM_BYTE_ARRAY m_MjpData;
00330 
00331 
00332         // memories (block-organized; data in Motorolas "Big Endian" format)
00333         // ### for Profiling masks
00334         FEDM_BYTE_ARRAY m_RFC_CfgProfileMask;   // profiling mask for EEPROM parameter in RF-Controller
00335         FEDM_BYTE_ARRAY m_ACC_CfgProfileMask;   // profiling mask for EEPROM parameter in RF-Controller
00336 
00337 // ############################
00338 // ### protected attributes ###
00339 // ############################
00340 protected:
00341         int                                     m_iReaderHnd;           // for FExxx.DLL functions
00342         unsigned char           m_ucBusAdr;                     // bus address for reader
00343 
00344         char                            m_sFamCode[32];         // reader family code
00345 
00346 //      unsigned char           m_ucReaderType;         // reader type number
00347         char                            m_sReaderName[32];      // name of reader type
00348         unsigned int            m_uiReaderType;         // extended reader type number
00349                                                                                         // bit  0...7   ReaderType/ReaderClass (SW-TYPE) according system manual from [0x65] or [0x66] with Mode 0
00350                                                                                         //                              if bit7 == 0 >> value is ReaderType
00351                                                                                         //                              if bit7 == 1 >> value is ReaderClass
00352                                                                                         //              8..15   ReaderType, if bit7 == 1; otherwise 0
00353                                                                                         //         16..23       reserved
00354                                                                                         //         24..31       reserved
00355                                                                                         //
00356 
00357         // map for namespace to access-id map
00358         FEDM_MAP_ACCESS_ID      m_mapAccessID;
00359 
00360         // the following parameters are for internal use and
00361         // depend on reader families
00362         // they are set in specialized reader class
00363         int m_iUsedEEDataBlocks;
00364         int m_iUsedRAMDataBlocks;
00365         int m_iUsedAccEEDataBlocks;
00366         int m_iUsedAccRAMDataBlocks;
00367         int m_iUsedTmpDataBlocks;
00368         int m_iUsedMjpDataBlocks;
00369         int m_iUsedSNMemBlocks;
00370         int m_iUsedIDMemBlocks;
00371         int m_iUsedACMemBlocks;
00372         int m_iUsedPubMemBlocks;
00373         int m_iUsedSecMemBlocks;
00374         int m_iUsedConfMemBlocks;
00375         int m_iUsedDateMemBlocks;
00376 
00377         int m_iRFC_DataBlockSize;
00378         int m_iACC_DataBlockSize;
00379         int m_iPubMemBlockSize;
00380 
00381         int m_iModuleHnd;       // handle for manager class FEDM_ReaderManager
00382 
00383         // for logmanager support
00384         FEDM_Logger* m_pLogger;
00385 };
00386 
00387 #endif // !defined(_FEDM_DATABASE_H_INCLUDED_)


maggie_rfid_drivers
Author(s): Raul Perula-Martinez
autogenerated on Mon Sep 14 2015 03:05:28