FEDM_ISCReaderModule.h
Go to the documentation of this file.
00001 /*-------------------------------------------------------
00002 |                                                       |
00003 |                  FEDM_ISCReaderModule.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                   :       06.11.2003
00018 
00019 Version                 :       04.02.08 / 13.08.2012 / M. Hultsch
00020                                                 - support for events from People Counter
00021                  
00022                                                 04.02.00 / 04.04.2012 / M. Hultsch
00023                                                 - renamed method: GetNonAddressedTagHandler to CreateNonAddressedTagHandler
00024                  
00025                                                 04.00.00 / 21.07.2011 / M. Hultsch
00026                                                 - new method: GetTcpConnectionState()
00027 
00028                                                 03.02.07 / 25.10.2010 / M. Hultsch
00029                                                 - non-addressed with taghandler
00030 
00031                                                 03.01.04 / 30.03.2010 / M. Hultsch
00032 
00033 Operation Systems       :       independent
00034 
00035 Function                        :       classes for OBID i-scan and OBID classic-pro reader family
00036 
00037 
00038 Trademarks:
00039 -----------
00040 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH
00041 Other Trademarks: see FEDM.h
00042 */
00043 
00044 #if !defined(_FEDM_ISCREADER_MODULE_H_INCLUDED_)
00045 #define _FEDM_ISCREADER_MODULE_H_INCLUDED_
00046 
00047 
00048 
00049 #include "FEDM_ISCReader.h"
00050 #include "../FEDM_XmlReaderCfgProfileModul.h"
00051 
00052 class FEDM_ISOTabItem;                          // class for iso host mode
00053 class FedmIscTagHandler;
00054 class FedmIscMyAxxessReader;
00055 
00056 
00057 //#####################################################################################
00058 // constants
00059 //#####################################################################################
00060 
00061 
00062 // defines for uiFlag in FEDM_TASK_INIT
00063 #define FEDM_TASKCB1                                            1
00064 #define FEDM_TASKCB2                                            2
00065 #define FEDM_TASKCB3                                            3
00066 #define FEDM_TASKCB_NET1                                  101 // not applicable
00067 
00068 // defines for task identifier
00069 #define FEDM_TASKID_FIRST_NEW_TAG                       1
00070 #define FEDM_TASKID_EVERY_NEW_TAG                       2
00071 #define FEDM_TASKID_NOTIFICATION                        3
00072 #define FEDM_TASKID_QUEUE_RESPONSE                      4 // not applicable
00073 #define FEDM_TASKID_APDU_RESPONSE                       5 // not applicable
00074 #define FEDM_TASKID_SAM_RESPONSE                        6 // not applicable
00075 #define FEDM_TASKID_MAX_EVENT                           7 // not applicable
00076 
00077 
00078 
00079 //#####################################################################################
00080 // types
00081 //#####################################################################################
00082 
00083 
00084 typedef map<string, FedmIscTagHandler*>                         FEDM_ISC_TAG_LIST;
00085 typedef map<string, FedmIscTagHandler*>::iterator       FEDM_ISC_TAG_LIST_ITOR;
00086 
00087 
00088 // structure for initializing task event handlers
00089 typedef struct _FEDM_TASK_INIT
00090 {
00091         unsigned int    uiUse;                  // defines the task (e.g. FEDM_TASKID_FIRST_NEW_TAG)
00092         unsigned int    uiFlag;                 // specifies the use of the union (e.g. FEDM_TASKCB1)
00093         void*                   pAny;                   // pointer to anything, which is reflected as the first parameter 
00094                                                                         // in the callback function (e.g. can be used to pass the object pointer)
00095         int                             iConnectByHost; // if 0: TCP/IP connection is initiated by reader. otherwise by host
00096         char                    cIPAdr[16];             // server ip address
00097         int                             iPortNr;                // server or host port address
00098         unsigned int    uiTimeout;              // timeout for asynchronous task:
00099                                                                         // FEDM_TASKID_FIRST_NEW_TAG            : in steps of 100ms 
00100                                                                         // FEDM_TASKID_EVERY_NEW_TAG            : in steps of 100ms
00101                                                                         // FEDM_TASKID_QUEUE_RESPONSE           : in steps of 100ms
00102                                                                         // FEDM_TASKID_APDU_RESPONSE            : in steps of 100ms
00103                                                                         // FEDM_TASKID_SAM_RESPONSE                     : in steps of 100ms
00104                                                                         // FEDM_TASKID_NOTIFICATION                     : in s
00105                                                                         // FEDM_TASKID_MAX_EVENT                        : in s
00106                                                                         // FEDM_TASKID_PEOPLE_COUNTER_EVENT     : in s
00107 
00108         //  only for authentication in notification mode
00109         bool                    bCryptoMode;            // security mode on/off
00110         unsigned int    uiAuthentKeyLength;     // authent key length
00111         unsigned char   ucAuthentKey[32];       // authent key
00112 
00113         // only for notification tasks
00114         bool                    bKeepAlive;                                     // if true, keep alive option will be enabled (recommended)
00115         unsigned int    uiKeepAliveIdleTime;            // wait time in ms for first probe after connection is dropped down
00116                                                                                                 // for Linux: time is rounded up to seconds
00117         unsigned int    uiKeepAliveProbeCount;          // only for Linux: number of probes
00118                                                                                                 // for Windows Server 2003, 2000 and XP it is fixed to 5 by Microsoft
00119                                                                                                 // for Windows Vista and later it is fixed to 10 by Microsoft
00120         unsigned int    uiKeepAliveIntervalTime;        // wait time in ms between probes
00121 
00122         // list with different function pointers
00123         union
00124         {
00125                 // for C++ callback; for inventory and notification task
00126                 void    (FEDM_CALL* cbFct1)(void* pAny, int iError, unsigned char ucCmd);
00127                 // for C++; only for notification task
00128                 void    (FEDM_CALL* cbFct2)(void* pAny, int iError, unsigned char ucCmd, char* cIPAdr, int iPortNr);
00129                 // for C++; only for my axxess Reader events handled by class FedmIscMyAxxessReader
00130                 //int           (*cbFct3)(void* pAny, int iError, unsigned char ucCmd, char* cIPAdr, int iPortNr, unsigned char& ucAction);
00131 #ifdef _FEDM_WINDOWS
00132                 // for .NET delegates; for inventory and notification task
00133                 void    (CALLBACK* cbFctNET1)(int iError, unsigned char ucCmd);
00134 #endif
00135         };
00136 
00137         // list with different additional options
00138         union
00139         {
00140                 int iNotifyWithAck;     // 0: notification without acknowledge
00141                                                         // 1: notification with acknowledge
00142         };
00143 
00144 } FEDM_TASK_INIT;
00145 
00146 
00147 
00148 //#####################################################################################
00149 // class FEDM_ISCReaderModule
00150 //#####################################################################################
00151 
00152 class _FEDM_ISC_CORE_EXT_CLASS FEDM_ISCReaderModule : public FEDM_ISCReader
00153 {
00154 public:
00155 
00156         // friend classes have access rights to protected members
00157         friend class FEDM_ISOTabItem;
00158         friend class FedmIscMyAxxessReader;
00159 
00160         FEDM_ISCReaderModule();
00161         virtual ~FEDM_ISCReaderModule();
00162 
00163 
00164         // serial port
00165         int ConnectCOMM(int iPortNr);
00166         
00167         // LAN, WLAN (TCP/IP)
00168         int ConnectTCP(char* cHostAdr, int iPortNr);
00169         
00170         // USB (optional: nDeviceID=0 >> ScanAndOpen)
00171         int ConnectUSB(unsigned long dwDeviceID);
00172         
00173         int DisConnect();                                                               // for all port types
00174         bool IsConnected();                                                             // for all port types
00175         int GetTcpConnectionState();                                    // for TCP/IP connection
00176 
00177         // for Reader in crypto-mode
00178         int ReaderAuthentication(unsigned char ucAuthentType, string sAuthentKey);
00179         int ReaderAuthentication(unsigned char ucAuthentType, unsigned int uiAuthentKeyLength, unsigned char* ucAuthentKey);
00180 
00181         // main transponder communication methods
00182 #ifdef _FEDM_TAG_HANDLER
00183         // method executes synchronous Inventory (for all i-scan and classic-pro Readers)
00184         FEDM_ISC_TAG_LIST*      TagInventory(   bool bAll=true,
00185                                                                                 unsigned char ucMode=0x00,
00186                                                                                 unsigned char ucAntennas=1 );
00187 
00188         FedmIscTagHandler*  TagSelect(          FedmIscTagHandler* pTagHandler,
00189                                                                                 unsigned int uiTagDriver=0 );
00190 
00191         FEDM_ISC_TAG_LIST*      GetTagList();
00192   #ifdef _WIN32_WCE
00193         FedmIscTagHandler*  GetTagHandler(char* sSnr);
00194   #else
00195         FedmIscTagHandler*  GetTagHandler(string sSnr);
00196   #endif
00197         FedmIscTagHandler*  CreateNonAddressedTagHandler(unsigned int uiTagHandlerType);
00198         FedmIscTagHandler*  GetSelectedTagHandler();
00199         FedmIscTagHandler*  Convert_EPC_C1_G2_TagHandler(FedmIscTagHandler* pTagHandler, unsigned char ucMfrCode, unsigned int uiTagHandlerType);
00200 #endif
00201 
00202         // methods for executing asynchronous tasks
00203         int StartAsyncTask(FEDM_TASK_INIT* pInit);
00204         int CancelAsyncTask();
00205         int TriggerAsyncTask();
00206 
00207         // callback functions, invoked by asynchronous task
00208         static void cbsTaskRsp1(void* pAny, 
00209                                                         int iReaderHnd, 
00210                                                         int iTaskID, 
00211                                                         int iError, 
00212                                                         unsigned char ucCmd,
00213                                                         unsigned char* ucRspData, 
00214                                                         int iRspLen );
00215 
00216         static void cbsTaskRsp2(void* pAny, 
00217                                                         int iReaderHnd, 
00218                                                         int iTaskID, 
00219                                                         int iError, 
00220                                                         unsigned char ucCmd,
00221                                                         unsigned char* ucRspData, 
00222                                                         int iRspLen,
00223                                                         char* cIPAdr,
00224                                                         int iPortNr );
00225 
00226         // setting port parameters
00227         int SetPortPara(char* cPara, char* cValue);             // for all port types
00228         int SetPortPara(char* cPara, int iValue);               // for all port types
00229 
00230         // getting port parameters
00231         int GetPortPara(char* cPara, char* cValue);             // for all port types
00232         int GetPortPara(char* cPara, int* iValue);              // for all port types
00233 
00234         int SetPortHnd(int iPortHnd);
00235 
00236         // complex communication methods
00237         int ReadCompleteConfiguration(bool bEEPROM);    // reads complete reader configuration
00238         int WriteCompleteConfiguration(bool bEEPROM);   // writes complete reader configuration
00239         int ResetCompleteConfiguration(bool bEEPROM);   // resets complete configuration to factory default
00240         int ApplyConfiguration(bool bEEPROM);                   // writes modified configuration pages to reader
00241         unsigned char* GetModifiedCfgPageFlags();               // returns a 16 byte flag-field
00242         
00243         // main method for XML based reader profiling
00244         int SerializeProfile(bool bRead, char* sFileName);
00245 
00246         int TransferXmlFileToReaderCfg(char* sFileName);        // transfer configuration from XML file to reader
00247         int TransferReaderCfgToXmlFile(char* sFileName);        // transfer configuration from reader to XML file
00248 
00249         // reads readers software information
00250         int ReadSoftVersion(unsigned char* ucSWRev,     
00251                                                 unsigned char* ucDevRev, 
00252                                                 unsigned char* ucHWType, 
00253                                                 unsigned char* ucSWType, 
00254                                                 unsigned char* ucTrp);
00255 
00256         // read complete reader info
00257         FEDM_ISC_READER_INFO*           ReadReaderInfo(unsigned int uiProtocolFrame = FEDM_PRT_FRAME_STANDARD);
00258 
00259         // read the complete reader diagnostic
00260         FEDM_ISC_READER_DIAGNOSTIC* ReadReaderDiagnostic();
00261 
00262 
00263 protected:
00264 #ifdef _FEDM_TAG_HANDLER
00265         FedmIscTagHandler* TagSelect_CreateNewTagHandler(int iIdx, unsigned int uiTagDriver, FedmIscTagHandler* pTagHandler);
00266 #if !defined(_FEDM_NO_TAG_HANDLER_ISO14443)
00267         FedmIscTagHandler* TagSelect_EvaFormat1(int iIdx, FedmIscTagHandler* pTagHandler);
00268         FedmIscTagHandler* TagSelect_EvaFormat2(int iIdx, FedmIscTagHandler* pTagHandler);
00269         FedmIscTagHandler* TagSelect_EvaFormat3(int iIdx, FedmIscTagHandler* pTagHandler);
00270 #endif
00271 #endif
00272 
00273         // callback function for asynchronous inventory, invoked by static callback member
00274         virtual void cbNewTag(  int iReaderHnd, 
00275                                                         int iTaskID, 
00276                                                         int iError, 
00277                                                         unsigned char* ucRspData, 
00278                                                         int iRspLen );
00279 
00280         // callback function for notifications from a reader, invoked by static callback member
00281         virtual void cbNewNotify(       int iReaderHnd, 
00282                                                                 int iTaskID, 
00283                                                                 int iError, 
00284                                                                 unsigned char* ucRspData, 
00285                                                                 int iRspLen,
00286                                                                 char* cIPAdr,
00287                                                                 int iPortNr );
00288 
00289         // callback function for keep alive message with protocol [0x6E] from a reader, invoked by static callback member
00290         virtual void cbNewReaderDiagnostic(     int iReaderHnd, 
00291                                                                                 int iTaskID, 
00292                                                                                 int iError, 
00293                                                                                 unsigned char* ucRspData, 
00294                                                                                 int iRspLen,
00295                                                                                 char* cIPAdr,
00296                                                                                 int iPortNr );
00297         
00298         virtual void cbNewInputEvent(   int iReaderHnd, 
00299                                                                         int iTaskID, 
00300                                                                         int iError, 
00301                                                                         unsigned char* ucRspData, 
00302                                                                         int iRspLen,
00303                                                                         char* cIPAdr,
00304                                                                         int iPortNr );
00305 
00306         // callback function for notifications from a People Counter, invoked by static callback member
00307         virtual void cbNewNotifyFromPeopleCounter(      int iReaderHnd, 
00308                                                                                                 int iTaskID, 
00309                                                                                                 int iError, 
00310                                                                                                 unsigned char* ucRspData, 
00311                                                                                                 int iRspLen,
00312                                                                                                 char* cIPAdr,
00313                                                                                                 int iPortNr );
00314 
00315 
00316 public:
00317 #ifdef _FEDM_XML_SUPPORT
00318         FEDM_XMLReaderCfgProfileModul   m_ProfileModule;
00319 #endif
00320 
00321 protected:
00322         int m_iCommMode;        // see constants in fedm.h
00323 
00324         bool m_bActiveAsyncTask;
00325 
00326         FEDM_TASK_INIT          m_TaskInit;
00327 
00328 #ifdef _FEDM_TAG_HANDLER
00329         FEDM_ISC_TAG_LIST       m_mapTagHandler;
00330 #endif
00331 
00332         unsigned char           m_ucModifiedCfgPages[16];       // flag field with modified CFG pages is valid after ApplyConfiguration
00333 
00334 };
00335 
00336 #endif // !defined(_FEDM_ISCREADER_MODULE_H_INCLUDED_)


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