#include <windows.h>
#include <cvirte.h>
#include <utility.h>
#include <stdio.h>
#include <stdarg.h>
#include "WIENER_SNMP.h"
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow) {
double ret;
// double voltage;
double vSet=0;
int ch=0;
int iret;
// int i, j;
// oid oidStr[MAX_OID_LEN];
// size_t lengthOidStr;
HSNMP crate1;
if (InitCVIRTE (hInstance, 0, 0) == 0)
return -1; /* out of memory */
if(!snmpInit()) return 1; // basic init
crate1 = snmpOpen("arich-mpod1.kek.jp"); // open TCP/IP socket
if(!crate1) return 1;
printf("-----------------------------------------------------------------\n");
iret=getMainSwitch(crate1);
printf("Main Switch = %i\n", iret
);
// strcpy(oidStr,"moduleNumber.0");
// strcpy(oidStr,"fanNominalSpeed.0");
// iret=snmpGetInt(crate1, oidStr, strlen(oidStr));
// printf("Module Number = %i\n", iret);
vSet = getOutputVoltage(crate1, ch);
printf("Output Voltage %i = %f.\n", ch
, vSet
);
//Test Channel Status
iret=getChannelSwitch(crate1, ch);
printf("Channel Status %i = %i\n", ch
, iret
);
//Test Reading the Sense Measurement
ret = getOutputSenseMeasurement(crate1, ch);
printf("Sense Voltage = %f\n", ret
);
//Test Reading the Current
ret = getCurrentMeasurement(crate1, ch);
printf("Current Measurement = %f\n", ret
);
printf("Turning channel %i ON\n", ch
);
setChannelSwitch(crate1, ch, 1);
Delay(1);
//Test Channel Status
iret=getChannelSwitch(crate1, ch);
printf("Channel Status %i = %i\n", ch
, iret
);
//Test Reading the Sense Measurement
ret = getOutputSenseMeasurement(crate1, ch);
printf("Sense Voltage = %f\n", ret
);
//Test Reading the Current
ret = getCurrentMeasurement(crate1, ch);
printf("Current Measurement = %f\n", ret
);
printf("Turning channel %i OFF\n", ch
);
setChannelSwitch(crate1, ch, 0);
printf("-----------------------------------------------------------------\n");
snmpClose(crate1);
snmpCleanup(); // finish
return 0;
}