00001 /*------------------------------------------------------- 00002 | | 00003 | FedmIscPeripheralDevice.h | 00004 | | 00005 --------------------------------------------------------- 00006 00007 Copyright © 2010 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 : Manuel Sahm 00017 Begin : 18.02.2010 00018 00019 Version : 03.02.00 / 18.05.2010 / M. Sahm, M. Hultsch 00020 00021 Operation Systems : independent 00022 00023 Function : classes for OBID i-scan® peripheral devices 00024 00025 00026 Trademarks: 00027 ----------- 00028 OBID®, OBID i-scan® and OBID myAXXESS® are registered Trademarks of FEIG ELECTRONIC GmbH 00029 Other Trademarks: see FEDM.h 00030 */ 00031 00032 #if !defined(_FEDM_ISC_PERIPHERAL_DEVICE_H_INCLUDED_) 00033 #define _FEDM_ISC_PERIPHERAL_DEVICE_H_INCLUDED_ 00034 00035 #ifdef _MSC_VER 00036 // The (microsoft) debugger can't handle symbols more than 255 characters long. 00037 // STL often creates symbols longer than that. 00038 // When symbols are longer than 255 characters, the warning is disabled. 00039 #pragma warning(disable:4786) // for MFC 00040 #endif 00041 00042 #if !defined(_FEDM_NO_PD_SUPPORT) 00043 00044 #include "../../FEDM_Base.h" 00045 #include <vector> 00046 #ifdef _FEDM_LINUX 00047 #include <string.h> 00048 #endif 00049 00050 class FEDM_ISCReader; 00051 class FedmIscPeripheralDevice; 00052 00053 00054 // STL - Standard Template Library 00055 using namespace std; 00056 00057 00058 //##################################################################################### 00059 // constants 00060 //##################################################################################### 00061 00062 00063 //Peripheral Device Ports 00064 #define FEDM_ISC_PD_PORT_TYPE_NONE 0x00 00065 #define FEDM_ISC_PD_PORT_TYPE_RS4XX 0x02 00066 00067 // Peripheral Device types 00068 #define FEDM_ISC_PD_TYPE_NONE 0x00 00069 #define FEDM_ISC_PD_TYPE_PEOPLE_COUNTER 0x01 00070 #define FEDM_ISC_PD_TYPE_EXTERNAL_IO 0x02 00071 00072 // Peripheral Device Software-Types 00073 // see FEDM_ISC.h at location HF/UHF function unit types 00074 00075 00076 00077 //##################################################################################### 00078 // type definitions 00079 //##################################################################################### 00080 00081 typedef struct _FEISC_GPC_OUTPUT 00082 { 00083 unsigned char ucNumber; //OUT-Number 00084 unsigned char ucType; //OUT-Type 00085 unsigned char ucMode; //OUTx-mode 00086 unsigned char ucFrequency; //OUTx-frq 00087 unsigned int uiHoldTime; //OUT-TIME 00088 00089 _FEISC_GPC_OUTPUT() : ucNumber(0), 00090 ucType(0), 00091 ucMode(0), 00092 ucFrequency(0), 00093 uiHoldTime(0) 00094 {} 00095 00096 } FEISC_GPC_OUTPUT; 00097 00098 00099 typedef struct _FEDM_ISC_PERIPHERAL_DEVICE_INFO 00100 { 00101 // software information 00102 // [0x66] and Mode=0x00 00103 unsigned char ucSwVer[2]; // major and minor version number 00104 unsigned char ucDevVer; // developer version number 00105 unsigned char ucHwType; // flag field with hardware options 00106 unsigned char ucDeviceType; // software type == type of peripheral device 00107 unsigned char Reserved[2]; // Reserved 00108 unsigned char ucRxBufferSize[2]; // size of reader's receive buffer 00109 unsigned char ucTxBufferSize[2]; // size of reader's transmit buffer 00110 00111 // hardware information 00112 // [0x66] and Mode=0x10 00113 unsigned char ucHwInfo[2]; // flag field with hardware info 00114 unsigned char ucDHw[2]; // for internal use 00115 unsigned char ucAHw[2]; // for internal use 00116 unsigned char ucFrequency; // frequency information (HF, UHF, .., EU, FCC) 00117 unsigned char ucPortTypes; // flag field with supported port types 00118 unsigned char ucReserved1; // reserved byte 00119 unsigned char ucReserved2; // reserved byte 00120 unsigned char ucReserved3; // reserved byte 00121 00122 // CFG information with read and write permission 00123 // [0x66] and Mode=0x40 and Mode=0x41 00124 unsigned char ucNoOfCfgPages[2]; // number of configuration pages 00125 unsigned char ucCfgReadPermissions[16]; // flag field with readable CFG pages 00126 unsigned char ucCfgWritePermissions[16]; // flag field with writeable CFG pages 00127 00128 // input/output capabilities information 00129 // [0x66] and Mode=0x60 00130 unsigned char ucNoOfInputs; // number of inputs 00131 unsigned char ucNoOfOutputs; // number of outputs 00132 unsigned char ucNoOfRelays; // number of relays 00133 00134 bool bIsMode0x00Read; 00135 bool bIsMode0x10Read; 00136 bool bIsMode0x40Read; 00137 bool bIsMode0x41Read; 00138 bool bIsMode0x60Read; 00139 00140 // initialization 00141 void Init() 00142 { 00143 memset(&ucSwVer[0], 0, sizeof(_FEDM_ISC_PERIPHERAL_DEVICE_INFO)); 00144 } 00145 00146 } FEDM_ISC_PERIPHERAL_DEVICE_INFO; 00147 00148 00149 //#################################################################### 00150 // class FEDM_ISCPeripheralDevice 00151 //#################################################################### 00152 00153 class _FEDM_ISC_CORE_EXT_CLASS FedmIscPeripheralDevice 00154 { 00155 // public functions 00156 public: 00157 00158 // constructor 00159 FedmIscPeripheralDevice(FEDM_ISCReader* pReader, 00160 unsigned char ucBusAdr, 00161 unsigned char ucPort, 00162 int iFUType = FEDM_ISC_PD_TYPE_NONE); 00163 00164 // destructor 00165 virtual ~FedmIscPeripheralDevice(); 00166 00167 // get/set function unit type, which controlls internal operations 00168 int GetPDType(); 00169 00170 unsigned char GetBusAddress(); 00171 00172 FEDM_ISCReader* GetReaderObject(); 00173 00174 // get the last error code 00175 int GetLastError(); 00176 // get the last status byte 00177 unsigned char GetLastStatus(); 00178 00179 // get error text 00180 const char* GetErrorText(int iErrorCode); 00181 // get status text 00182 const char* GetStatusText(unsigned char ucStatus); 00183 00184 int Reset(); 00185 FEDM_ISC_PERIPHERAL_DEVICE_INFO* ReadInfo(); 00186 FEDM_ISC_PERIPHERAL_DEVICE_INFO* GetInfo() { return &m_DeviceInfo; } 00187 void BuildInfoReport(string& sReport); 00188 00189 // protected functions 00190 protected: 00191 void SetLastError(int iError); 00192 00193 void Add0x00InfoText(string& sReport); 00194 void Add0x10InfoText(string& sReport); 00195 void Add0x60InfoText(string& sReport); 00196 00197 // public data 00198 public: 00199 00200 // protected data 00201 protected: 00202 // reader for communication 00203 FEDM_ISCReader* m_pReader; 00204 00205 // Reader Handle 00206 int m_iReaderHnd; 00207 00208 //Bus Address of Peripheral Device 00209 unsigned char m_ucBusAdr; 00210 //Port of the Peripheral Device 00211 unsigned char m_ucPort; 00212 00213 int m_iLastError; 00214 unsigned char m_ucLastStatus; 00215 00216 int m_iPDType; 00217 00218 // Buffer for Data Transfer 00219 unsigned char m_ucSendData[128]; 00220 int m_iSendDataLen; 00221 unsigned char m_ucSendProt[128]; 00222 int m_iSendProtLen; 00223 unsigned char m_ucRspProt[128]; 00224 int m_iRspProtLen; 00225 unsigned char m_ucRspData[128]; 00226 int m_iRspDataLen; 00227 00228 // Info struture for peripheral Devices 00229 FEDM_ISC_PERIPHERAL_DEVICE_INFO m_DeviceInfo; 00230 }; 00231 00232 #endif // #if !defined(_FEDM_NO_PD_SUPPORT) 00233 00234 #endif // !defined(_FEDM_ISC_PERIPHERAL_DEVICE_H_INCLUDED_)