public static LeafVarBinding SetDeviceThresholdVariablesEatonPDU_M2(DeviceThreshold threshold, DevModelConfig modelcfg) { int inputNum = 1; LeafVarBinding leafVarBinding = new LeafVarBinding(); EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(inputNum); EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(inputNum); if (threshold.MaxCurrentMT != -500f) { leafVarBinding.Add(eatonInputCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f)); } if (threshold.MaxVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.MaxVoltageMT, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f)); } if (threshold.MinVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.MinVoltageMt, System.Convert.ToInt32(threshold.MinVoltageMT * 1000f)); } if (threshold.MaxCurrentMT != -500f) { leafVarBinding.Add(eatonInputCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f)); } if (threshold.MaxVoltageMT != -500f) { leafVarBinding.Add(eatonInputVoltageMib_M.VoltageUpperCritical, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f)); } return(leafVarBinding); }
public void copyPOPSetings(DeviceThreshold devThreshold) { this.popThreshold = devThreshold.PopThreshold; this.popEnableMode = devThreshold.PopEnableMode; this.popThreshold = devThreshold.PopThreshold; this.popModeOutlet = devThreshold.PopModeOutlet; this.popModeLIFO = devThreshold.PopModeLIFO; this.popModePriority = devThreshold.PopModePriority; this.popPriorityList = devThreshold.PopPriorityList; }
private static DeviceThreshold GetDeviceThreshold(System.Collections.Generic.Dictionary <string, string> result) { DeviceThreshold deviceThreshold = new DeviceThreshold(); System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator(); while (enumerator.MoveNext()) { string current = enumerator.Current; string text = result[current]; if ("\0".Equals(text)) { text = System.Convert.ToString(-1000000); } else { if (text == null || string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-500000); } else { if (text.Equals("Null")) { text = System.Convert.ToString(-500000); } } } int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (num == 1) { EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(num); EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(num); float num2 = (float)System.Convert.ToInt32(text) / 1000f; if (current.StartsWith(eatonInputCurrentMib_M.MaxCurrentMT)) { deviceThreshold.MaxCurrentMT = num2; } else { if (current.StartsWith(eatonInputVoltageMib_M.MaxVoltageMT)) { deviceThreshold.MaxVoltageMT = num2; } else { if (current.StartsWith(eatonInputCurrentMib_M.MinCurrentMt)) { deviceThreshold.MinCurrentMT = num2; } else { if (!current.StartsWith(eatonInputVoltageMib_M.MinVoltageMt)) { return(null); } deviceThreshold.MinVoltageMT = num2; } } } if (deviceThreshold.MinCurrentMT == -500f) { deviceThreshold.MinCurrentMT = -300f; } if (deviceThreshold.MinPowerMT == -500f) { deviceThreshold.MinPowerMT = -300f; } } } return(deviceThreshold); }
public bool SetDeviceThreshold(DeviceThreshold deviceThreshold, string myMac) { return(this.se.CheckDeviceMac(myMac) >= 0 && this.se.SetDeviceThreshold(deviceThreshold)); }
public bool SetDeviceThreshold_Slave(DeviceThreshold deviceThreshold, string myMac, int index) { return(this.se.CheckDeviceMac_Slave(myMac, index) && this.se.SetDeviceThreshold_Slave(deviceThreshold, index)); }
public static System.Collections.Generic.List <LeafVarBinding> SetDeviceThresholdVariablesApcPDU(DeviceThreshold threshold, DevModelConfig modelcfg) { int inputNum = 1; System.Collections.Generic.List <LeafVarBinding> list = new System.Collections.Generic.List <LeafVarBinding>(); ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(inputNum); ApcPhaseConfigMib apcPhaseConfigMib = new ApcPhaseConfigMib(inputNum); LeafVarBinding leafVarBinding = new LeafVarBinding(); LeafVarBinding leafVarBinding2 = new LeafVarBinding(); if (threshold.MaxPowerMT != -500f) { leafVarBinding.Add(apcDeviceConfigMib.MinPowerConfig, 0); leafVarBinding.Add(apcDeviceConfigMib.NearPowerConfig, 1); leafVarBinding2.Add(apcDeviceConfigMib.MaxPowerConfig, System.Convert.ToInt32(threshold.MaxPowerMT * 10f / 1000f)); leafVarBinding2.Add(apcDeviceConfigMib.NearPowerConfig, System.Convert.ToInt32(threshold.MaxPowerMT * 10f / 1000f)); } if (threshold.MinPowerMT != -500f) { leafVarBinding2.Add(apcDeviceConfigMib.MinPowerConfig, System.Convert.ToInt32(threshold.MinPowerMT * 10f / 1000f)); } if (threshold.MaxCurrentMT != -500f) { leafVarBinding.Add(apcPhaseConfigMib.MinCurrentConfig, 0); leafVarBinding.Add(apcPhaseConfigMib.NearCurrentConfig, 1); leafVarBinding2.Add(apcPhaseConfigMib.MaxCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT)); leafVarBinding2.Add(apcPhaseConfigMib.NearCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT)); } if (threshold.MinCurrentMT != -500f) { leafVarBinding2.Add(apcPhaseConfigMib.MinCurrentConfig, System.Convert.ToInt32(threshold.MinCurrentMT)); } list.Add(leafVarBinding); list.Add(leafVarBinding2); return(list); }
private static DeviceThreshold GetDeviceThreshold(System.Collections.Generic.Dictionary <string, string> result) { DeviceThreshold deviceThreshold = new DeviceThreshold(); System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator(); while (enumerator.MoveNext()) { string current = enumerator.Current; string text = result[current]; if ("\0".Equals(text)) { text = System.Convert.ToString(-10000); } else { if (text == null || string.IsNullOrEmpty(text)) { text = System.Convert.ToString(-5000); } else { if (text.Equals("Null")) { text = System.Convert.ToString(-5000); } } } int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1)); if (num == 1) { ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(num); ApcPhaseConfigMib apcPhaseConfigMib = new ApcPhaseConfigMib(num); if (current.StartsWith(apcDeviceConfigMib.MinPowerConfig)) { deviceThreshold.MinPowerMT = (float)System.Convert.ToInt32(text) / 10f; deviceThreshold.MinPowerMT *= 1000f; } else { if (current.StartsWith(apcDeviceConfigMib.MaxPowerConfig)) { deviceThreshold.MaxPowerMT = (float)System.Convert.ToInt32(text) / 10f; deviceThreshold.MaxPowerMT *= 1000f; } else { if (current.StartsWith(apcPhaseConfigMib.MinCurrentConfig)) { deviceThreshold.MinCurrentMT = (float)System.Convert.ToInt32(text); } else { if (current.StartsWith(apcPhaseConfigMib.MaxCurrentConfig)) { deviceThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text); } } } } } } return(deviceThreshold); }