FEDM_Base.h
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                      FEDM_Base.h                      |
00004 |                                                       |
00005 ---------------------------------------------------------
00006 
00007 Copyright © 2000-2011   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 Version                 :       04.00.00 / 21.07.2011 / M. Hultsch
00019 
00020 Operation Systems       :       Windows, WindowsCE
00021                                                 Linux, µClinux
00022 
00023 Function                        :       base class for FEDM class library
00024                                                 collects all access functions for data memories
00025 
00026 
00027 Trademarks:
00028 -----------
00029 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00030 Other Trademarks: see FEDM.h
00031 */
00032 
00033 #if !defined(_FEDM_BASE_H_INCLUDED_)
00034 #define _FEDM_BASE_H_INCLUDED_
00035 
00036 
00037 
00038 
00039 #ifdef _MSC_VER
00040         // The (microsoft) debugger can't handle symbols more than 255 characters long.
00041         // STL often creates symbols longer than that.
00042         // When symbols are longer than 255 characters, the warning is disabled.
00043         #pragma warning(disable:4786)   // for MFC
00044 #endif
00045 
00046 
00047 
00048 #include <string>
00049 #include <vector>
00050 #include <map>
00051 #include "FEDM.h"
00052 
00053 class FEDM_DataBase;
00054 
00055 // the following include is for serial port support
00056 // please define _FEDM_COM_SUPPORT with compiler option
00057 // additionally, you must define _FEDM_WINDOWS or _FEDM_LINUX with compiler option
00058 #ifdef _FEDM_COM_SUPPORT
00059         #include "fecom.h"
00060 #endif
00061 
00062 // the following include is for USB support
00063 // please define _FEDM_USB_SUPPORT with compiler option
00064 // additionally, you must define _FEDM_WINDOWS or _FEDM_LINUX with compiler option
00065 #ifdef _FEDM_USB_SUPPORT
00066         #include "feusb.h"
00067 #endif
00068 
00069 // the following include is for TCP support
00070 // please define _FEDM_TCP_SUPPORT with compiler option
00071 // additionally, you must define _FEDM_WINDOWS or _FEDM_LINUX with compiler option
00072 #ifdef _FEDM_TCP_SUPPORT
00073         #include "fetcp.h"
00074 #endif
00075 
00076 
00077 // STL - Standard Template Library
00078 using namespace std;
00079 
00080 
00081 // type declarations
00082 typedef vector<unsigned char>                           FEDM_BYTE_ARRAY;
00083 typedef vector<unsigned char>::iterator         FEDM_BYTE_ARRAY_ITOR;
00084 
00085 typedef vector<int>                                                     FEDM_INT_ARRAY;
00086 typedef vector<int>::iterator                           FEDM_INT_ARRAY_ITOR;
00087 
00088 typedef vector<string>                                          FEDM_STRING_ARRAY;
00089 typedef vector<string>::iterator                        FEDM_STRING_ARRAY_ITOR;
00090 
00091 typedef vector<FEDM_DataBase*>                          FEDM_READER_ARRAY;
00092 typedef vector<FEDM_DataBase*>::iterator        FEDM_READER_ARRAY_ITOR;
00093 
00094 // map with namespace as key and access-id as value
00095 typedef map<string, string>                                     FEDM_MAP_ACCESS_ID;
00096 typedef map<string, string>::iterator           FEDM_MAP_ACCESS_ID_ITOR;
00097 
00098 
00099 class _FEDM_ISC_CORE_EXT_CLASS FEDM_Base
00100 {
00101 public:
00102         FEDM_Base();
00103         virtual ~FEDM_Base();
00104 
00105         char* GetLibVersion();
00106 
00107         // language setting for error text
00108         int SetLanguage(int iLanguage);
00109         static int GetLanguage();
00110 
00111         // for access with ID
00112         static int GetData(const char* ID, bool* Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00113 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00114         static int GetData(const char* ID, BOOL* Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00115 #endif
00116         static int GetData(const char* ID, unsigned char* Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00117         static int GetData(const char* ID, unsigned char* Data, int Cnt, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00118         static int GetData(const char* ID, unsigned int* Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00119         static int GetData(const char* ID, __int64* Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00120 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00121         static int GetData(const char* ID, CString& Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00122 #endif
00123         static int GetData(const char* ID, string& Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00124         static int GetData(const char* ID, char* Data, int DataLen, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00125 
00126         static int SetData(const char* ID, bool Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00127 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00128         static int SetData(const char* ID, BOOL Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00129 #endif
00130         static int SetData(const char* ID, unsigned char Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00131         static int SetData(const char* ID, unsigned char* Data, int Cnt, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00132         static int SetData(const char* ID, unsigned int Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00133         static int SetData(const char* ID, __int64 Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00134 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00135         static int SetData(const char* ID, CString Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00136 #endif
00137         static int SetData(const char* ID, string Data, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00138         static int SetData(const char* ID, char* Data, int DataLen, FEDM_BYTE_ARRAY& cArray, int BlockSize);
00139 
00140         // for direct access with address
00141         static int GetData(int Adr, unsigned char* Data, FEDM_BYTE_ARRAY& cArray);
00142         static int GetData(int Adr, unsigned char* Data, int Cnt, FEDM_BYTE_ARRAY& cArray);
00143         static int GetData(int Adr, unsigned int* Data, FEDM_BYTE_ARRAY& cArray);
00144         static int GetData(int Adr, __int64* Data, FEDM_BYTE_ARRAY& cArray);
00145 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00146         static int GetData(int Adr, CString& Data, int Cnt, FEDM_BYTE_ARRAY& cArray);
00147 #endif
00148 
00149         static int SetData(int Adr, unsigned char Data, FEDM_BYTE_ARRAY& cArray);
00150         static int SetData(int Adr, unsigned char* Data, int Cnt, FEDM_BYTE_ARRAY& cArray);
00151         static int SetData(int Adr, unsigned int Data, FEDM_BYTE_ARRAY& cArray);
00152         static int SetData(int Adr, __int64 Data, FEDM_BYTE_ARRAY& cArray);
00153 #if defined(_FEDM_MFC_SUPPORT) //|| defined(__BORLANDC__)
00154         static int SetData(int Adr, CString Data, FEDM_BYTE_ARRAY& cArray);
00155 #endif
00156 
00157         // return an error text for FEDM-error code
00158         static int GetErrorText(char* sText, int iErrCode);
00159 
00160 #ifdef _FEDM_COM_SUPPORT
00161         void SetFecomLibName(char* pszLibName);
00162 #endif
00163 #ifdef _FEDM_USB_SUPPORT
00164         void SetFeusbLibName(char* pszLibName);
00165 #endif
00166 #ifdef _FEDM_TCP_SUPPORT
00167         void SetFetcpLibName(char* pszLibName);
00168 #endif
00169 
00170 protected:
00171         int m_iLastError;
00172         static int m_iLanguage;
00173 
00174         static int GetErrorText(int iLanguage, char* sText, int iErrCode);
00175         void SetLastError(int iErrorCode);
00176 
00177         
00178 #ifdef _FEDM_WINDOWS
00179         // function detects the Windows operation version
00180         void GetOS();
00181         // Windows version
00182         int m_iWinVer;
00183 #endif
00184 
00185         //void* LoadLib(const char* pszLibName);
00186         //void  CloseLib(void* pLib);
00187 
00188 #if !defined(_FEDM_SUPPORT_SLINK)
00189         void* GetFunctionPtr(void* pLib, const char* szFctName);
00190 #endif
00191 
00192 // the following codelines are for serial port support
00193 // please define _FEDM_COM_SUPPORT with compiler option
00194 #ifdef _FEDM_COM_SUPPORT
00195 #if !defined(_FEDM_SUPPORT_SLINK)
00196 
00197 public:
00198         void* GetFeComFunction(unsigned int uiFct);
00199 
00200 protected:
00201         void* LoadFeCom();
00202 
00203 protected:
00204         struct _FEDM_FECOM_PTR
00205         {
00206                 // function pointers for fecom library
00207                 LPFN_FECOM_GET_DLL_VERSION              lpfnGetDLLVersion;
00208                 LPFN_FECOM_GET_ERROR_TEXT               lpfnGetErrorText;
00209                 LPFN_FECOM_GET_LAST_ERROR               lpfnGetLastError;
00210                 LPFN_FECOM_DETECT_PORT                  lpfnDetectPort;
00211                 LPFN_FECOM_ADD_EVENT_HANDLER    lpfnAddEventHandler;
00212                 LPFN_FECOM_DEL_EVENT_HANDLER    lpfnDelEventHandler;
00213                 LPFN_FECOM_OPEN_PORT                    lpfnOpenPort;
00214                 LPFN_FECOM_CLOSE_PORT                   lpfnClosePort;
00215                 LPFN_FECOM_GET_PORT_LIST                lpfnGetPortList;
00216                 LPFN_FECOM_GET_PORT_PARA                lpfnGetPortPara;
00217                 LPFN_FECOM_SET_PORT_PARA                lpfnSetPortPara;
00218                 LPFN_FECOM_DO_PORT_CMD                  lpfnDoPortCmd;
00219                 LPFN_FECOM_GET_PORT_HND                 lpfnGetPortHnd;
00220                 LPFN_FECOM_TRANSCEIVE                   lpfnTransceive;
00221                 LPFN_FECOM_TRANSMIT                             lpfnTransmit;
00222                 LPFN_FECOM_RECEIVE                              lpfnReceive;
00223 
00224                 // initialization
00225                 _FEDM_FECOM_PTR() :     lpfnGetDLLVersion(NULL),
00226                                                         lpfnGetErrorText(NULL),
00227                                                         lpfnGetLastError(NULL),
00228                                                         lpfnDetectPort(NULL),
00229                                                         lpfnAddEventHandler(NULL),
00230                                                         lpfnDelEventHandler(NULL),
00231                                                         lpfnOpenPort(NULL),
00232                                                         lpfnClosePort(NULL),
00233                                                         lpfnGetPortList(NULL),
00234                                                         lpfnGetPortPara(NULL),
00235                                                         lpfnSetPortPara(NULL),
00236                                                         lpfnDoPortCmd(NULL),
00237                                                         lpfnGetPortHnd(NULL),
00238                                                         lpfnTransceive(NULL),
00239                                                         lpfnTransmit(NULL),
00240                                                         lpfnReceive(NULL)
00241                                                         {}
00242         };
00243 #endif // #if !defined(_FEDM_SUPPORT_SLINK)
00244 #endif // #ifdef _FEDM_COM_SUPPORT
00245 
00246 
00247 // the following codelines are for USB support
00248 // please define _FEDM_USB_SUPPORT with compiler option
00249 #ifdef _FEDM_USB_SUPPORT
00250 #if !defined(_FEDM_SUPPORT_SLINK)
00251 
00252 public:
00253         void* GetFeUsbFunction(unsigned int uiFct);
00254 
00255 protected:
00256         void* LoadFeUsb();
00257 
00258 protected:
00259         struct _FEDM_FEUSB_PTR
00260         {
00261                 // function pointers for feusb library
00262                 LPFN_FEUSB_GET_DLL_VERSION              lpfnGetDLLVersion;
00263                 LPFN_FEUSB_GET_DRV_VERSION              lpfnGetDrvVersion;
00264                 LPFN_FEUSB_GET_ERROR_TEXT               lpfnGetErrorText;
00265                 LPFN_FEUSB_GET_LAST_ERROR               lpfnGetLastError;
00266                 LPFN_FEUSB_SCAN                                 lpfnScan;
00267                 LPFN_FEUSB_SCAN_AND_OPEN                lpfnScanAndOpen;
00268                 LPFN_FEUSB_GET_SCAN_LIST_PARA   lpfnGetScanListPara;
00269                 LPFN_FEUSB_GET_SCAN_LIST_SIZE   lpfnGetScanListSize;
00270                 LPFN_FEUSB_CLEAR_SCAN_LIST              lpfnClearScanList;
00271                 LPFN_FEUSB_ADD_EVENT_HANDLER    lpfnAddEventHandler;
00272                 LPFN_FEUSB_DEL_EVENT_HANDLER    lpfnDelEventHandler;
00273                 LPFN_FEUSB_OPEN_DEVICE                  lpfnOpenDevice;
00274                 LPFN_FEUSB_CLOSE_DEVICE                 lpfnCloseDevice;
00275                 LPFN_FEUSB_IS_DEVICE_PRESENT    lpfnIsDevicePresent;
00276                 LPFN_FEUSB_GET_DEVICE_LIST              lpfnGetDeviceList;
00277                 LPFN_FEUSB_GET_DEVICE_PARA              lpfnGetDevicePara;
00278                 LPFN_FEUSB_SET_DEVICE_PARA              lpfnSetDevicePara;
00279                 LPFN_FEUSB_GET_DEVICE_HND               lpfnGetDeviceHnd;
00280                 LPFN_FEUSB_TRANSCEIVE                   lpfnTransceive;
00281                 LPFN_FEUSB_TRANSMIT                             lpfnTransmit;
00282                 LPFN_FEUSB_RECEIVE                              lpfnReceive;
00283 
00284                 // initialization
00285                 _FEDM_FEUSB_PTR() :     lpfnGetDLLVersion(NULL),
00286                                                         lpfnGetDrvVersion(NULL),
00287                                                         lpfnGetErrorText(NULL),
00288                                                         lpfnGetLastError(NULL),
00289                                                         lpfnScan(NULL),
00290                                                         lpfnScanAndOpen(NULL),
00291                                                         lpfnGetScanListPara(NULL),
00292                                                         lpfnGetScanListSize(NULL),
00293                                                         lpfnClearScanList(NULL),
00294                                                         lpfnAddEventHandler(NULL),
00295                                                         lpfnDelEventHandler(NULL),
00296                                                         lpfnOpenDevice(NULL),
00297                                                         lpfnCloseDevice(NULL),
00298                                                         lpfnIsDevicePresent(NULL),
00299                                                         lpfnGetDeviceList(NULL),
00300                                                         lpfnGetDevicePara(NULL),
00301                                                         lpfnSetDevicePara(NULL),
00302                                                         lpfnGetDeviceHnd(NULL),
00303                                                         lpfnTransceive(NULL),
00304                                                         lpfnTransmit(NULL),
00305                                                         lpfnReceive(NULL)
00306                                                         {}
00307         };
00308 #endif // #if !defined(_FEDM_SUPPORT_SLINK)
00309 #endif
00310 
00311 
00312 // the following codelines are for TCP support
00313 // please define _FEDM_TCP_SUPPORT with compiler option
00314 #ifdef _FEDM_TCP_SUPPORT
00315 #if !defined(_FEDM_SUPPORT_SLINK)
00316 
00317 public:
00318         void* GetFeTcpFunction(unsigned int uiFct);
00319 
00320 protected:
00321         void* LoadFeTcp();
00322 
00323 protected:
00324         struct _FEDM_FETCP_PTR
00325         {
00326                 // function pointers for fetcp library
00327                 LPFN_FETCP_GET_DLL_VERSION              lpfnGetDLLVersion;
00328                 LPFN_FETCP_GET_ERROR_TEXT               lpfnGetErrorText;
00329                 LPFN_FETCP_GET_LAST_ERROR               lpfnGetLastError;
00330                 LPFN_FETCP_ADD_EVENT_HANDLER    lpfnAddEventHandler;
00331                 LPFN_FETCP_DEL_EVENT_HANDLER    lpfnDelEventHandler;
00332                 LPFN_FETCP_DETECT                               lpfnDetect;
00333                 LPFN_FETCP_CONNECT                              lpfnConnect;
00334                 LPFN_FETCP_DISCONNECT                   lpfnDisConnect;
00335                 LPFN_FETCP_GET_SOCKET_LIST              lpfnGetSocketList;
00336                 LPFN_FETCP_GET_SOCKET_PARA              lpfnGetSocketPara;
00337                 LPFN_FETCP_SET_SOCKET_PARA              lpfnSetSocketPara;
00338                 LPFN_FETCP_GET_SOCKET_HND               lpfnGetSocketHnd;
00339                 LPFN_FETCP_GET_SOCKET_STATE             lpfnGetSocketState;
00340                 LPFN_FETCP_TRANSCEIVE                   lpfnTransceive;
00341                 LPFN_FETCP_TRANSMIT                             lpfnTransmit;
00342                 LPFN_FETCP_RECEIVE                              lpfnReceive;
00343 
00344                 // initialization
00345                 _FEDM_FETCP_PTR() :     lpfnGetDLLVersion(NULL),
00346                                                         lpfnGetErrorText(NULL),
00347                                                         lpfnGetLastError(NULL),
00348                                                         lpfnAddEventHandler(NULL),
00349                                                         lpfnDelEventHandler(NULL),
00350                                                         lpfnDetect(NULL),
00351                                                         lpfnConnect(NULL),
00352                                                         lpfnDisConnect(NULL),
00353                                                         lpfnGetSocketList(NULL),
00354                                                         lpfnGetSocketPara(NULL),
00355                                                         lpfnSetSocketPara(NULL),
00356                                                         lpfnGetSocketHnd(NULL),
00357                                                         lpfnGetSocketState(NULL),
00358                                                         lpfnTransceive(NULL),
00359                                                         lpfnTransmit(NULL),
00360                                                         lpfnReceive(NULL)
00361                                                         {}
00362         };
00363 #endif // #if !defined(_FEDM_SUPPORT_SLINK)
00364 #endif // #ifdef _FEDM_TCP_SUPPORT
00365 
00366 protected:
00367 #ifdef _FEDM_COM_SUPPORT
00368         void* m_pFeComLib;              // pointer or handle to fecom
00369         void* m_pFeComPtrList;  // pointer to structure with function pointers of FECOM
00370         char* m_pFecomLibName;  // pointer to alternative fecom library name
00371 #endif
00372 
00373 #ifdef _FEDM_USB_SUPPORT
00374         void* m_pFeUsbLib;              // pointer or handle to feusb
00375         void* m_pFeUsbPtrList;  // pointer to structure with function pointers of FEUSB
00376         char* m_pFeusbLibName;  // pointer to alternative feusb library name
00377 #endif
00378 
00379 #ifdef _FEDM_TCP_SUPPORT
00380         void* m_pFeTcpLib;              // pointer or handle to feusb
00381         void* m_pFeTcpPtrList;  // pointer to structure with function pointers of FETCP
00382         char* m_pFetcpLibName;  // pointer to alternative fetcp library name
00383 #endif
00384 };
00385 
00386 #endif // !defined(_FEDM_BASE_H_INCLUDED_)


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