00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
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
00061
00062
00063
00064
00065
00066
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
00076
00077 public:
00078 FEDM_DataBase();
00079 virtual ~FEDM_DataBase();
00080
00081
00082
00083 virtual int EvalLibDependencies(string& sMessage)=0;
00084
00085
00086
00087
00088 virtual int Serialize(FEDM_XMLReaderCfgDataModul* xml,
00089 bool bRead,
00090 char* sFileName);
00091
00092
00093 virtual int SerializeProfile(FEDM_XMLReaderCfgProfileModul* xml,
00094 bool bRead,
00095 char* sFileName);
00096
00097
00098
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
00106
00107 void SetReaderHnd(int iReaderHnd);
00108 int GetReaderHnd();
00109
00110
00111
00112 void SetBusAddress(unsigned char ucBusAdr);
00113 unsigned char GetBusAddress();
00114
00115
00116 char* GetFamilyCode();
00117 char* GetReaderName();
00118 unsigned int GetReaderType();
00119
00120
00121 void SetModuleHnd(int iHnd);
00122 int GetModuleHnd();
00123
00124
00125 FEDM_Logger* GetLogger() { return m_pLogger; }
00126
00127
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
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
00179
00180 public:
00181
00182 virtual int SendProtocol(unsigned char ucStByte)=0;
00183
00184
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
00190 virtual int SetPortHnd(int iPortHnd)=0;
00191 virtual int GetPortHnd()=0;
00192
00193
00194
00195 virtual int SetProtocolFrameSupport(unsigned int uiType)=0;
00196 virtual int GetProtocolFrameSupport()=0;
00197
00198 virtual int SetReaderType(unsigned int uiReaderType)=0;
00199
00200
00201 virtual int Serialize(bool bRead, char* sFileName)=0;
00202
00203
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
00209 virtual int Serialize(CArchive& ar, int iMemType)=0;
00210 #endif
00211
00212
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
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
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
00263 virtual int VerifyTableData(int iIdx, unsigned int uiTableID, int iBlockNr, int iBlockCnt)=0;
00264
00265
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
00276 virtual int SetTableSize(unsigned int uiTableID, int iSize)=0;
00277
00278 virtual int GetTableSize(unsigned int uiTableID)=0;
00279
00280 virtual int GetTableLength(unsigned int uiTableID)=0;
00281
00282 virtual int ResetTable(unsigned int uiTableID, unsigned int uiDataFlags)=0;
00283
00284
00285
00286
00287
00288 protected:
00289
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
00308
00309 public:
00310
00311
00312 FEDM_BYTE_ARRAY m_RFC_EEData;
00313 FEDM_BYTE_ARRAY m_RFC_RAMData;
00314
00315 FEDM_BYTE_ARRAY m_ACC_EEData;
00316 FEDM_BYTE_ARRAY m_ACC_RAMData;
00317
00318
00319 FEDM_BYTE_ARRAY m_SN_Mem;
00320 FEDM_BYTE_ARRAY m_ID_Mem;
00321 FEDM_BYTE_ARRAY m_AC_Mem;
00322 FEDM_BYTE_ARRAY m_PubMem;
00323 FEDM_BYTE_ARRAY m_SecMem;
00324 FEDM_BYTE_ARRAY m_ConfMem;
00325 FEDM_BYTE_ARRAY m_DateMem;
00326
00327
00328 FEDM_BYTE_ARRAY m_TmpData;
00329 FEDM_BYTE_ARRAY m_MjpData;
00330
00331
00332
00333
00334 FEDM_BYTE_ARRAY m_RFC_CfgProfileMask;
00335 FEDM_BYTE_ARRAY m_ACC_CfgProfileMask;
00336
00337
00338
00339
00340 protected:
00341 int m_iReaderHnd;
00342 unsigned char m_ucBusAdr;
00343
00344 char m_sFamCode[32];
00345
00346
00347 char m_sReaderName[32];
00348 unsigned int m_uiReaderType;
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358 FEDM_MAP_ACCESS_ID m_mapAccessID;
00359
00360
00361
00362
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;
00382
00383
00384 FEDM_Logger* m_pLogger;
00385 };
00386
00387 #endif // !defined(_FEDM_DATABASE_H_INCLUDED_)