Subversion Repositories f9daq

Rev

Rev 155 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #ifndef __MPOD_H__
  2. #define __MPOD_H__
  3.  
  4. #ifdef __cplusplus
  5.     extern "C" {
  6. #endif
  7.  
  8. #include <cvidef.h>
  9. #include <ivi.h>
  10.  
  11. //#include "WIENER_SNMP.h"
  12. //************************* WIENER_SNMP.h *****************************
  13. #ifdef _MSC_VER
  14. #define EXPORT extern "C" _declspec(dllexport)
  15. #else
  16. #define EXPORT extern "C"
  17. #endif
  18.  
  19. #define WIN32_LEAN_AND_MEAN
  20.  
  21. //SAMO #include <net-snmp/net-snmp-config.h>
  22. #include "net-snmp-config.h" // SAMO
  23. //SAMO #define NET_SNMP_SNMPV3_H                   // we don't need SNMPV3 (one include file is missing)
  24. #include <net-snmp/net-snmp-includes.h>
  25.  
  26. typedef void *HSNMP;   // SNMP handle (like FILE)
  27.  
  28. // DLL functions
  29. EXPORT void   snmpSetStdErrLog(void);
  30. EXPORT void   snmpSetFileLog(const char * const fileName);
  31. EXPORT unsigned int snmpGetVersion(void);
  32. EXPORT char  *snmpGetVersionString(void);
  33.  
  34. EXPORT int    snmpInit(void);
  35. EXPORT void   snmpCleanup(void);
  36. EXPORT void   snmpSetReadCommunityName(const char * const readCommunityName);
  37. EXPORT void   snmpSetWriteCommunityName(const char * const writeCommunityName);
  38.  
  39. EXPORT HSNMP  snmpOpen(const char * const ipAddress);
  40. EXPORT void   snmpClose(HSNMP session);
  41. EXPORT char  *snmpGetLastError(void);
  42.  
  43. // System Functions
  44. EXPORT char *getSysDescr(HSNMP session);
  45. EXPORT int  getMainSwitch(HSNMP session);
  46. EXPORT int  setMainSwitch(HSNMP session, int value);
  47. EXPORT int  getMainStatus(HSNMP session);
  48. EXPORT int  getVmeReset(HSNMP session);
  49. EXPORT int  setVmeReset(HSNMP session);
  50. EXPORT int  getIpStaticAddress(HSNMP session);
  51. EXPORT int  setIpStaticAddress(HSNMP session, int value);
  52. EXPORT char *getPsSerialNumber(HSNMP session);
  53.  
  54. // Output Counts
  55. EXPORT int  getOutputNumber(HSNMP session);
  56. EXPORT int  getOutputGroups(HSNMP session);
  57.  
  58. //Output Channel Information
  59. //std::string  getOutputName(HSNMP session, int channel);
  60. EXPORT int     getOutputGroup(HSNMP session, int channel);
  61. EXPORT int     getOutputStatus(HSNMP session, int channel);
  62. EXPORT int     getChannelStatus(HSNMP m_sessmp, int channel);
  63. EXPORT double  getOutputSenseMeasurement(HSNMP session, int channel);
  64. EXPORT double  getOutputTerminalMeasurement(HSNMP session, int channel);
  65. EXPORT double  getCurrentMeasurement(HSNMP session, int channel);
  66. EXPORT int     getTemperatureMeasurement(HSNMP session, int channel);
  67. EXPORT int     setChannelSwitch(HSNMP session, int channel, int value);
  68. EXPORT int     setOutputSwitch(HSNMP session, int channel, int value);
  69. EXPORT int     getChannelSwitch(HSNMP session, int channel);
  70. EXPORT int     getOutputSwitch(HSNMP session, int channel);
  71. EXPORT int     setHighVoltageGroupsSwitch(HSNMP session, int value);
  72. EXPORT int     getHighVoltageGroupsSwitch(HSNMP session);
  73. EXPORT int     setLowVoltageGroupsSwitch(HSNMP session, int value);
  74. EXPORT int     getLowVoltageGroupsSwitch(HSNMP session);
  75. EXPORT double  getOutputVoltage(HSNMP session, int channel);
  76. EXPORT double  setOutputVoltage(HSNMP session, int channel, double value);
  77. EXPORT double  getOutputCurrent(HSNMP session, int channel);
  78. EXPORT double  setOutputCurrent(HSNMP session, int channel, double value);
  79. EXPORT double  getOutputRiseRate(HSNMP session, int channel);
  80. EXPORT double  setOutputRiseRate(HSNMP session, int channel, double value);
  81. EXPORT double  getOutputFallRate(HSNMP session, int channel);
  82. EXPORT double  setOutputFallRate(HSNMP session, int channel, double value);
  83. EXPORT double  getOutputCurrentRiseRate(HSNMP session, int channel);
  84. EXPORT double  setOutputCurrentRiseRate(HSNMP session, int channel, double value);
  85. EXPORT double  getOutputCurrentFallRate(HSNMP session, int channel);
  86. EXPORT double  setOutputCurrentFallRate(HSNMP session, int channel, double value);
  87. EXPORT int     getOutputSupervisionBehavior(HSNMP session, int channel);
  88. EXPORT int     setOutputSupervisionBehavior(HSNMP session, int channel, int value);
  89. EXPORT double  getOutputSupervisionMinSenseVoltage(HSNMP session, int channel);
  90. EXPORT double  setOutputSupervisionMinSenseVoltage(HSNMP session, int channel, double value);
  91. EXPORT double  getOutputSupervisionMaxSenseVoltage(HSNMP session, int channel);
  92. EXPORT double  setOutputSupervisionMaxSenseVoltage(HSNMP session, int channel, double value);
  93. EXPORT double  getOutputSupervisionMaxTerminalVoltage(HSNMP session, int channel);
  94. EXPORT double  setOutputSupervisionMaxTerminalVoltage(HSNMP session, int channel, double value);
  95. EXPORT double  getOutputSupervisionMaxCurrent(HSNMP session, int channel);
  96. EXPORT double  setOutputSupervisionMaxCurrent(HSNMP session, int channel, double value);
  97. EXPORT int     setOutputSupervisionMaxTemperature(HSNMP session, int channel, int value);
  98. EXPORT double  getOutputConfigMaxSenseVoltage(HSNMP session, int channel);
  99. EXPORT double  getOutputConfigMaxTerminalVoltage(HSNMP session, int channel);
  100. EXPORT double  getOutputConfigMaxCurrent(HSNMP session, int channel);
  101. EXPORT double  getOutputSupervisionMaxPower(HSNMP session, int channel);
  102. EXPORT int     getOutputTripTimeMaxCurrent(HSNMP session, int channel);
  103. EXPORT int     setOutputTripTimeMaxCurrent(HSNMP session, int channel, int delay);
  104.  
  105. //Sensor Information functions
  106. EXPORT int  getSensorNumber(HSNMP session);
  107. EXPORT int  getSensorTemp(HSNMP session, int sensor);
  108. EXPORT int  getSensorWarningTemperature(HSNMP session, int sensor);
  109. EXPORT int  setSensorWarningTemperature(HSNMP session, int sensor, int value);
  110. EXPORT int  getSensorFailureTemperature(HSNMP session, int sensor);
  111. EXPORT int  setSensorFailureTemperature(HSNMP session, int sensor, int value);
  112.  
  113. //SNMP Community Name Functions
  114. //std::string  getSnmpCommunityName(HSNMP session, int index);
  115. //std::string  setSnmpCommunityName(HSNMP session, int index , int value);
  116.  
  117. //Power Supply Detail Functions
  118. //std::string  getPsFirmwareVersion(HSNMP session);
  119. //std::string  getPsSerialNumber(HSNMP session);
  120. EXPORT int    getPsOperatingTime(HSNMP session);
  121. EXPORT double getPsAuxVoltage(HSNMP session, int auxIndex);
  122. EXPORT double getPsAuxCurrent(HSNMP session, int auxIndex);
  123. //std::string  getPsDirectAccess(HSNMP session);
  124. //std::string  setPsDirectAccess(HSNMP session);
  125.  
  126. //Fan Tray Functions
  127. //std::string  getFanFirmwareVersion(HSNMP session);
  128. //std::string  getFanSerialNumber(HSNMP session);
  129. EXPORT int  getFanOperatingTime(HSNMP session);
  130. EXPORT int  getFanAirTemperature(HSNMP session);
  131. EXPORT int  getFanSwitchOffDelay(HSNMP session);
  132. EXPORT int  setFanSwitchOffDelay(HSNMP session, int value);
  133. EXPORT int  getFanNominalSpeed(HSNMP session);
  134. EXPORT int  setFanNominalSpeed(HSNMP session, int value);
  135. EXPORT int  getFanNumberOfFans(HSNMP session);
  136. EXPORT int  getFanSpeed(HSNMP session, int fan);
  137.  
  138. // Module functions
  139. EXPORT char  *getModuleDescription(HSNMP session, int slot);
  140. EXPORT double getModuleSupply24(HSNMP session, int slot);
  141. EXPORT double getModuleSupply5(HSNMP session, int slot);
  142. EXPORT double getModuleAuxTemperature(HSNMP session, int slot, int index);
  143. EXPORT double getModuleHardwareLimitVoltage(HSNMP session, int slot);
  144. EXPORT double getModuleHardwareLimitCurrent(HSNMP session, int slot);
  145. EXPORT double getModuleRampSpeedVoltage(HSNMP session, int slot);
  146. EXPORT double setModuleRampSpeedVoltage(HSNMP session, int slot, double value);
  147. EXPORT double getModuleRampSpeedCurrent(HSNMP session, int slot);
  148. EXPORT double setModuleRampSpeedCurrent(HSNMP session, int slot, double value);
  149. EXPORT int    getModuleStatus(HSNMP session, int slot);
  150. EXPORT int    getModuleEventStatus(HSNMP session, int slot);
  151. EXPORT int    setModuleDoClear(HSNMP session, int slot);
  152.  
  153. /**
  154.  * @enum MaximumCrateValues
  155.  */
  156. typedef enum MaximumCrateValues {
  157.         MaxModuleAuxSupplies = 2,     ///< The maximum number of module auxiliary supply measurements
  158.         MaxModuleAuxTemperatures = 4, ///< The maximum number of module temperature sensors (iseg HV only)
  159.         MaxCommunities = 4,           ///< The maximum number of SNMP community names
  160.         MaxFans = 6,
  161.         MaxPsAuxSupplies = 8,
  162.         MaxSlotsPerCrate = 10,        ///< The number of slots per crate
  163.         MaxSensors = 12,              ///< The maximum
  164.         MaxChannelsPerSlot = 100,     ///< The maximum number of channels per slot
  165.         MaxChannelsPerCrate = 1000    ///< The maximum number of channels per crate
  166. } MaximumCrateValues;
  167.  
  168. /**
  169.  * @struct SnmpDoubleBuffer
  170.  * This struct is used to pass double parameters to setMultiple... functions
  171.  * and for the result value of getMultiple.../setMultiple... functions.
  172.  */
  173. typedef struct SnmpDoubleBuffer {
  174.         int size;                         ///< The number of values used in value[]
  175.         double value[MaxChannelsPerSlot]; ///< An array of max. 100 double values
  176. } SnmpDoubleBuffer;
  177.  
  178. /**
  179.  * @struct SnmpIntegerBuffer
  180.  * This struct is used to pass integer parameters to setMultiple... functions
  181.  * and for the result value of getMultiple.../setMultiple... functions.
  182. */
  183. typedef struct SnmpIntegerBuffer {
  184.         int size;                      ///< The number of values used in value[]
  185.         int value[MaxChannelsPerSlot]; ///< An array of max. 100 int values
  186. } SnmpIntegerBuffer;
  187.  
  188. // Functions for multiple data transfer in one SNMP packet
  189. EXPORT SnmpIntegerBuffer *getMultipleChannelStatuses(HSNMP session, int start, int size);
  190. EXPORT SnmpIntegerBuffer *getMultipleOutputStatuses(HSNMP session, int start, int size);
  191. EXPORT SnmpIntegerBuffer *getMultipleOutputSwitches(HSNMP session, int start, int size);
  192. EXPORT SnmpIntegerBuffer *setMultipleOutputSwitches(HSNMP session, int start, SnmpIntegerBuffer *values);
  193. EXPORT SnmpDoubleBuffer *getMultipleOutputVoltages(HSNMP session, int start, int size);
  194. EXPORT SnmpDoubleBuffer *setMultipleOutputVoltages(HSNMP session, int start, SnmpDoubleBuffer *values);
  195. EXPORT SnmpDoubleBuffer *getMultipleMeasurementTerminalVoltages(HSNMP session, int start, int size);
  196. EXPORT SnmpDoubleBuffer *getMultipleOutputMeasurementTerminalVoltages(HSNMP session, int start, int size);
  197. EXPORT SnmpDoubleBuffer *getMultipleOutputConfigMaxTerminalVoltages(HSNMP session, int start, int size);
  198. EXPORT SnmpDoubleBuffer *getMultipleOutputCurrents(HSNMP session, int start, int size);
  199. EXPORT SnmpDoubleBuffer *setMultipleOutputCurrents(HSNMP session, int start, SnmpDoubleBuffer *values);
  200. EXPORT SnmpDoubleBuffer *getMultipleMeasurementCurrents(HSNMP session, int start, int size);
  201. EXPORT SnmpDoubleBuffer *getMultipleOutputMeasurementCurrents(HSNMP session, int start, int size);
  202. EXPORT SnmpDoubleBuffer *getMultipleOutputConfigMaxCurrents(HSNMP session, int start, int size);
  203. EXPORT SnmpIntegerBuffer *getMultipleOutputTripTimeMaxCurrents(HSNMP session, int start, int size);
  204. EXPORT SnmpIntegerBuffer *setMultipleOutputTripTimeMaxCurrents(HSNMP session, int start, SnmpIntegerBuffer *values);
  205. EXPORT SnmpIntegerBuffer *getMultipleOutputSupervisionBehaviors(HSNMP session, int start, int size);
  206. EXPORT SnmpIntegerBuffer *setMultipleOutputSupervisionBehaviors(HSNMP session, int start, SnmpIntegerBuffer *values);
  207. //************************************************************
  208. #define MAX_CRATES 10
  209.  
  210. extern HSNMP crateHsnmp[MAX_CRATES];
  211.  
  212. int _VI_FUNC MPOD_Start (void);
  213.  
  214. int _VI_FUNC MPOD_Open (int mpodn, char *address);
  215.  
  216. int _VI_FUNC MPOD_GetInt (int mpodn, char *oidstr);
  217.  
  218. int _VI_FUNC MPOD_SetInt (int mpodn, char *oidstr, int iset);
  219.  
  220. double _VI_FUNC MPOD_GetDouble (int mpodn, char *oidstr);
  221.  
  222. double _VI_FUNC MPOD_SetDouble (int mpodn, char *oidstr, double dset);
  223.  
  224. char * _VI_FUNC MPOD_GetString (int mpodn, char *oidstr);
  225.  
  226. int _VI_FUNC MPOD_GetIntCh (int mpodn, char *oidstrbase, int ich);
  227.  
  228. int _VI_FUNC MPOD_SetIntCh (int mpodn, char *oidstrbase, int ich, int iset);
  229.  
  230. double _VI_FUNC MPOD_GetDoubleCh (int mpodn, char *oidstrbase, int ich);
  231.  
  232. double _VI_FUNC MPOD_SetDoubleCh (int mpodn, char *oidstrbase, int ich,
  233.                                   double dset);
  234.  
  235. char * _VI_FUNC MPOD_GetStringCh (int mpodn, char oidstrbase[], int ich);
  236.  
  237. int _VI_FUNC MPOD_Close (int mpodn);
  238.  
  239. int _VI_FUNC MPOD_End (void);
  240.  
  241. #ifdef __cplusplus
  242.     }
  243. #endif
  244.  
  245. #endif  /* __MPOD_H__ */
  246.