Subversion Repositories f9daq

Rev

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