Beispiel #1
0
 public System.Collections.Generic.Dictionary <int, System.Collections.Generic.List <int> > TurnOffDeviceOutlets()
 {
     this.devMap.Clear();
     foreach (DevSnmpConfig current in this.devsnmpconfigs)
     {
         this.cfg     = DevAccessCfg.GetInstance();
         this.snmpCfg = current;
         this.sc      = this.cfg.getSnmpConfig(this.snmpCfg);
         this.mc      = this.cfg.getDeviceModelConfig(this.snmpCfg.modelName, this.snmpCfg.fmwareVer);
         if (this.mc.switchable == 2)
         {
             this.se = new DefaultSnmpExecutor(new SnmpConfiger(this.sc, this.mc));
             bool flag = this.se.TurnOffOutlets();
             if (flag)
             {
                 for (int i = 1; i <= this.mc.portNum; i++)
                 {
                     current.groupOutlets.Add(i);
                 }
                 this.devMap.Add(current.devID, current.groupOutlets);
             }
         }
     }
     return(this.devMap);
 }
Beispiel #2
0
 public DevAccessAPI(DevSnmpConfig snmpSettings)
 {
     this.cfg     = DevAccessCfg.GetInstance();
     this.snmpCfg = snmpSettings;
     this.sc      = this.cfg.getSnmpConfig(this.snmpCfg);
     this.mc      = this.cfg.getDeviceModelConfig(this.snmpCfg.modelName, this.snmpCfg.fmwareVer);
     this.se      = new DefaultSnmpExecutor(new SnmpConfiger(this.sc, this.mc));
 }
Beispiel #3
0
 private void getbankReading(ref DevModelConfig devinfo, string str)
 {
     string[] array = str.Split(new char[]
     {
         '@'
     });
     devinfo.perbankReading = System.Convert.ToInt32(array[0]) + 1;
 }
Beispiel #4
0
        public static ValueMessage GetValueMessageApcPDU(DevModelConfig modelCfg, System.Collections.Generic.Dictionary <string, string> result)
        {
            ValueMessage valueMessage = new ValueMessage();

            System.Collections.Generic.Dictionary <string, string> dictionary  = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary2 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary3 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.IEnumerator <string>        enumerator  = result.Keys.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if (current.StartsWith(ApcDeviceStatusMib.Entry) || current.StartsWith(ApcPhaseStatusMib.Entry))
                {
                    dictionary.Add(current, text);
                }
                else
                {
                    if (current.StartsWith(ApcBankStatusMib.Entry))
                    {
                        dictionary2.Add(current, text);
                    }
                    else
                    {
                        if (current.StartsWith(ApcPDUBaseMib.Mac))
                        {
                            valueMessage.DeviceReplyMac = text.Replace(" ", ":").Replace("-", ":");
                        }
                        else
                        {
                            if (current.StartsWith(ApcSensorStatusMib.Entry))
                            {
                                dictionary3.Add(current, text);
                            }
                        }
                    }
                }
            }
            if (dictionary != null && dictionary.Count > 0)
            {
                valueMessage.DeviceValue = ApcMibParser.GetDeviceValue(dictionary);
            }
            if (dictionary2 != null && dictionary2.Count > 0)
            {
                valueMessage.BankValue = ApcMibParser.GetBankValue(dictionary2);
            }
            if (dictionary3 != null && dictionary3.Count > 0)
            {
                valueMessage.SensorValue = ApcMibParser.GetSensorValue(dictionary3);
            }
            else
            {
                valueMessage.SensorValue = ApcMibParser.GetSensorValue_Empty(dictionary3);
            }
            return(valueMessage);
        }
Beispiel #5
0
 private void getPopInfo(ref DevModelConfig devinfo, string str)
 {
     string[] array = str.Split(new char[]
     {
         '@'
     });
     devinfo.popReading = System.Convert.ToInt32(array[0]) + 1;
     devinfo.popDefault = System.Convert.ToInt32(array[1]);
     devinfo.popUdefmax = System.Convert.ToInt32(array[2]);
 }
Beispiel #6
0
        public System.Collections.Generic.List <ValueMessage> GetMonitorValues(System.Collections.Generic.List <DevSnmpConfig> configs)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                list.Add(item);
            }
            return(new DefaultSnmpExecutors(list).GetVaules());
        }
Beispiel #7
0
        public DevPortGroupAPI(System.Collections.Generic.List <DevSnmpConfig> devcfgs)
        {
            this.devsnmpconfigs = devcfgs;
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            foreach (DevSnmpConfig current in devcfgs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   snmpConfiger      = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                snmpConfiger.GroupOutlets = current.groupOutlets;
                this.snmpConfigs.Add(snmpConfiger);
            }
            this.se = new DefaultSnmpExecutors(this.snmpConfigs);
        }
Beispiel #8
0
 public SnmpConfiger(SnmpConfig snmpConfig, DevModelConfig modelCfg)
 {
     this.snmpConfig     = snmpConfig;
     this.modelConfig    = modelCfg;
     this.portnumber     = modelCfg.portNum;
     this.deviceModel    = modelCfg.modelName;
     this.switchable     = modelCfg.switchable;
     this.sensornumber   = modelCfg.sensorNum;
     this.banknumber     = modelCfg.bankNum;
     this.linenumber     = modelCfg.lineNum;
     this.perportreading = modelCfg.perportreading;
     this.perbankreading = modelCfg.perbankReading;
     this.perdoorreading = modelCfg.doorReading;
 }
Beispiel #9
0
        public int updateAutoModelList2Database(DBConn conn, string modelName, string fmVersion, string autoBasicInfo, string autoRatingInfo)
        {
            DevModelConfig devModelConfig;

            try
            {
                devModelConfig = this.autoLoader.parseModelConfig(modelName, fmVersion, autoBasicInfo, autoRatingInfo);
            }
            catch (System.Exception)
            {
                int result = -1;
                return(result);
            }
            int    num  = 0;
            string text = modelName + "-" + fmVersion;

            if (DevAccessCfg.autoModelList.ContainsKey(text))
            {
                DevModelConfig devModelConfig2 = DevAccessCfg.autoModelList[text];
                if (devModelConfig2.autoBasicInfo.Equals(autoBasicInfo) && devModelConfig2.autoRatingInfo.Equals(autoRatingInfo))
                {
                    return(0);
                }
                num = 1;
            }
            int num2 = this.autoLoader.updateModelConfig2Database(conn, modelName, fmVersion, autoBasicInfo, autoRatingInfo, num);

            if (num2 <= 0)
            {
                DebugCenter.GetInstance().appendToFile(string.Concat(new object[]
                {
                    "Failed to update auto-detect info: ",
                    text,
                    ", opCode=",
                    num
                }));
                return(-1);
            }
            if (DevAccessCfg.autoModelList.ContainsKey(text))
            {
                DevAccessCfg.autoModelList.Remove(text);
            }
            DevAccessCfg.autoModelList.Add(text, devModelConfig);
            if (DevAccessCfg._cbOnAutoModeUpdated != null)
            {
                DevAccessCfg._cbOnAutoModeUpdated(text, devModelConfig);
            }
            return(1);
        }
Beispiel #10
0
        public System.Collections.Generic.List <ThresholdMessage> GetThresholdsEatonPDU_M2(System.Collections.Generic.List <DevSnmpConfig> configs)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevAccessAPI   devAccessAPI      = new DevAccessAPI(current);
                DevRealConfig  eatonPDUNumber_M  = devAccessAPI.GetEatonPDUNumber_M2();
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID, eatonPDUNumber_M);
                list.Add(item);
            }
            return(new DefaultSnmpExecutors(list).GetThresholdsEatonPDU_M2());
        }
Beispiel #11
0
        public void SetTrapReceiver(System.Collections.Generic.List <DevSnmpConfig> configs, Sys_Para pSys)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                list.Add(item);
            }
            DefaultSnmpExecutors defaultSnmpExecutors = new DefaultSnmpExecutors(list);

            defaultSnmpExecutors.UpdateTrapReceiver(pSys, TrapEnabled.Yes);
        }
Beispiel #12
0
 public SnmpConfiger(SnmpConfig snmpConfig, DevModelConfig modelCfg, string devMac, int devID, DevRealConfig realCfg)
 {
     this.snmpConfig     = snmpConfig;
     this.modelConfig    = modelCfg;
     this.deviceModel    = modelCfg.modelName;
     this.switchable     = modelCfg.switchable;
     this.realConfig     = realCfg;
     this.portnumber     = realCfg.portNum;
     this.banknumber     = realCfg.bankNum;
     this.linenumber     = realCfg.lineNum;
     this.sensornumber   = realCfg.sensorNum;
     this.perdoorreading = realCfg.contactNum;
     this.perportreading = modelCfg.perportreading;
     this.perbankreading = modelCfg.perbankReading;
     this.deviceMac      = devMac;
     this.deviceID       = devID;
 }
Beispiel #13
0
        public System.Collections.Generic.List <ThresholdMessage> GetMonitorThresholds(System.Collections.Generic.List <DevSnmpConfig> configs)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                list.Add(item);
            }
            DefaultSnmpExecutors defaultSnmpExecutors = new DefaultSnmpExecutors(list);

            System.Collections.Generic.List <ThresholdMessage> thresholds = defaultSnmpExecutors.GetThresholds();
            this.retryConfigs = defaultSnmpExecutors.getRetryList();
            return(thresholds);
        }
Beispiel #14
0
 private void getoutletCtrl(ref DevModelConfig devinfo, string str)
 {
     string[] array = str.Split(new char[]
     {
         '@'
     });
     devinfo.switchableOutlets = System.Convert.ToUInt64(array[0], 16);
     if (devinfo.switchableOutlets > 0uL)
     {
         devinfo.switchable = 2;
     }
     else
     {
         devinfo.switchable = 1;
     }
     if (array.Length > 1)
     {
         devinfo.killPowerDisableRebootOutlets = System.Convert.ToUInt64(array[1], 16);
     }
 }
Beispiel #15
0
 private void getbankNumber(ref DevModelConfig devinfo, string str)
 {
     string[] array = str.Split(new char[]
     {
         '@'
     });
     devinfo.bankNum = System.Convert.ToInt32(array[0]);
     if (array.Length > 1)
     {
         devinfo.bankCtrlflg = System.Convert.ToUInt32(array[1], 16);
     }
     if (array.Length > 2)
     {
         string[] array2 = array[2].Split(new char[]
         {
             ','
         });
         if (array2 != null && array2.Length > 1)
         {
             for (int i = 0; i < array2.Length; i++)
             {
                 string[] array3 = array2[i].Split(new char[]
                 {
                     '~'
                 });
                 if (array3 != null && array3.Length > 1)
                 {
                     BankOutlets item = default(BankOutlets);
                     item.fromPort = System.Convert.ToInt32(array3[0]);
                     item.toPort   = System.Convert.ToInt32(array3[1]);
                     devinfo.bankOutlets.Add(item);
                 }
             }
         }
     }
 }
Beispiel #16
0
        public int updateAutoModelList(string modelName, string fmVersion, string autoBasicInfo, string autoRatingInfo)
        {
            string key = modelName + "-" + fmVersion;

            if (DevAccessCfg.autoModelList.ContainsKey(key))
            {
                DevModelConfig devModelConfig = DevAccessCfg.autoModelList[key];
                if (devModelConfig.autoBasicInfo.Equals(autoBasicInfo) && devModelConfig.autoRatingInfo.Equals(autoRatingInfo))
                {
                    return(-1);
                }
                DevAccessCfg.autoModelList.Remove(key);
            }
            try
            {
                DevModelConfig value = this.autoLoader.parseModelConfig(modelName, fmVersion, autoBasicInfo, autoRatingInfo);
                DevAccessCfg.autoModelList.Add(key, value);
            }
            catch (System.Exception)
            {
                return(-1);
            }
            return(0);
        }
Beispiel #17
0
        public static ValueMessage GetValueMessageEatonPDU_M2(DevModelConfig modelCfg, System.Collections.Generic.Dictionary <string, string> result)
        {
            ValueMessage valueMessage = new ValueMessage();

            System.Collections.Generic.Dictionary <string, string> dictionary  = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary2 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary3 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary4 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.IEnumerator <string>        enumerator  = result.Keys.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if (current.StartsWith(EatonInputCurrentMib_M2.Entry) || current.StartsWith(EatonInputVoltageMib_M2.Entry) || current.StartsWith(EatonInputPowerMib_M2.Entry))
                {
                    dictionary.Add(current, text);
                }
                else
                {
                    if (current.StartsWith(EatonSensorTemperatureMib_M2.Entry) || current.StartsWith(EatonSensorHumidityMib_M2.Entry))
                    {
                        dictionary2.Add(current, text);
                    }
                    else
                    {
                        if (current.StartsWith(EatonOutletCurrentMib_M2.Entry) || current.StartsWith(EatonOutletVoltageMib_M2.Entry) || current.StartsWith(EatonOutletPowerMib_M2.Entry))
                        {
                            dictionary3.Add(current, text);
                        }
                        else
                        {
                            if (current.StartsWith(EatonGroupCurrentMib_M2.Entry) || current.StartsWith(EatonGroupVoltageMib_M2.Entry) || current.StartsWith(EatonGroupPowerMib_M2.Entry))
                            {
                                dictionary4.Add(current, text);
                            }
                            else
                            {
                                if (current.StartsWith(EatonPDUBaseMib_M2.Mac))
                                {
                                    valueMessage.DeviceReplyMac = text.Replace(" ", ":").Replace("-", ":");
                                }
                            }
                        }
                    }
                }
            }
            if (dictionary != null && dictionary.Count > 0)
            {
                valueMessage.DeviceValue = EatonMibParser.GetDeviceValue(dictionary);
            }
            if (dictionary3 != null && dictionary3.Count > 0)
            {
                valueMessage.OutletValue = EatonMibParser.GetOutletValue(dictionary3);
            }
            if (dictionary2 != null && dictionary2.Count > 0)
            {
                valueMessage.SensorValue = EatonMibParser.GetSensorValue(dictionary2);
            }
            if (dictionary4 != null && dictionary4.Count > 0)
            {
                valueMessage.BankValue = EatonMibParser.GetBankValue(dictionary4);
            }
            if (modelCfg.doorReading == Constant.DoorSensorNo)
            {
                valueMessage.DeviceValue.DoorSensorStatus = -500;
            }
            if (modelCfg.commonThresholdFlag == Constant.EatonPDU_M2)
            {
                valueMessage.DeviceValue.PowerDissipation = "N/A";
                if (valueMessage.BankValue != null && valueMessage.BankValue.Count > 0)
                {
                    foreach (System.Collections.Generic.KeyValuePair <int, BankValueEntry> current2 in valueMessage.BankValue)
                    {
                        BankValueEntry value = current2.Value;
                        value.PowerDissipation = "N/A";
                        value.Voltage          = valueMessage.DeviceValue.Voltage;
                    }
                }
                if (valueMessage.OutletValue != null && valueMessage.OutletValue.Count > 0)
                {
                    foreach (System.Collections.Generic.KeyValuePair <int, OutletValueEntry> current3 in valueMessage.OutletValue)
                    {
                        OutletValueEntry value2 = current3.Value;
                        value2.PowerDissipation = "N/A";
                    }
                }
            }
            return(valueMessage);
        }
Beispiel #18
0
        public static ThresholdMessage GetThresholdMessageEatonPDU_M2(DevModelConfig modelcfg, System.Collections.Generic.Dictionary <string, string> result)
        {
            ThresholdMessage thresholdMessage = new ThresholdMessage();

            System.Collections.Generic.IEnumerator <string>        enumerator  = result.Keys.GetEnumerator();
            System.Collections.Generic.Dictionary <string, string> dictionary  = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary2 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary3 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary4 = new System.Collections.Generic.Dictionary <string, string>();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if (current.StartsWith(EatonInputCurrentMib_M2.Entry) || current.StartsWith(EatonInputVoltageMib_M2.Entry))
                {
                    dictionary.Add(current, text);
                }
                else
                {
                    if (current.StartsWith(EatonSensorTemperatureMib_M2.Entry) || current.StartsWith(EatonSensorHumidityMib_M2.Entry))
                    {
                        dictionary2.Add(current, text);
                    }
                    else
                    {
                        if (current.StartsWith(EatonOutletCurrentMib_M2.Entry) || current.StartsWith(EatonOutletVoltageMib_M2.Entry) || current.StartsWith(EatonOutletEntryMib_M2.Entry) || current.StartsWith(EatonOutletControlMib_M2.Entry))
                        {
                            dictionary3.Add(current, text);
                        }
                        else
                        {
                            if (current.StartsWith(EatonGroupCurrentMib_M2.Entry) || current.StartsWith(EatonGroupVoltageMib_M2.Entry) || current.StartsWith(EatonGroupEntryMib_M2.Entry))
                            {
                                dictionary4.Add(current, text);
                            }
                            else
                            {
                                if (current.StartsWith(EatonPDUBaseMib_M2.Mac))
                                {
                                    thresholdMessage.DeviceReplyMac = text.Replace(" ", ":").Replace("-", ":");
                                }
                                else
                                {
                                    if (current.StartsWith(EatonPDUBaseMib_M2.FWversion))
                                    {
                                        thresholdMessage.DeviceFWVer = text;
                                    }
                                    else
                                    {
                                        if (current.StartsWith(EatonPDUBaseMib_M2.DeviceName))
                                        {
                                            if ("\0".Equals(text) || string.IsNullOrEmpty(text))
                                            {
                                                text = string.Empty;
                                            }
                                            thresholdMessage.DeviceName = text;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (dictionary != null && dictionary.Count > 0)
            {
                thresholdMessage.DeviceThreshold = EatonMibParser.GetDeviceThreshold(dictionary);
            }
            if (dictionary3 != null && dictionary3.Count > 0)
            {
                thresholdMessage.OutletThreshold = EatonMibParser.GetOutletThreshold(dictionary3);
            }
            if (dictionary2 != null && dictionary2.Count > 0)
            {
                thresholdMessage.SensorThreshold = EatonMibParser.GetSensorThreshold(dictionary2);
            }
            if (dictionary4 != null && dictionary4.Count > 0)
            {
                thresholdMessage.BankThreshold = EatonMibParser.GetBankThreshold(dictionary4);
            }
            return(thresholdMessage);
        }
Beispiel #19
0
        public static System.Collections.Generic.List <LeafVarBinding> GetValuesRequestEatonPDU_M2(DevModelConfig modelcfg, DevRealConfig realcfg)
        {
            int num        = 1;
            int portNum    = realcfg.portNum;
            int bankNum    = realcfg.bankNum;
            int sensorNum  = realcfg.sensorNum;
            int contactNum = realcfg.contactNum;

            System.Collections.Generic.List <LeafVarBinding> list = new System.Collections.Generic.List <LeafVarBinding>();
            LeafVarBinding leafVarBinding = new LeafVarBinding();

            leafVarBinding.Add(EatonPDUBaseMib_M2.Mac);
            for (int l = 1; l <= num; l++)
            {
                EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(l);
                leafVarBinding.Add(eatonInputCurrentMib_M.CurrentValue);
                EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(l);
                leafVarBinding.Add(eatonInputVoltageMib_M.VoltageValue);
                EatonInputPowerMib_M2 eatonInputPowerMib_M = new EatonInputPowerMib_M2(1);
                leafVarBinding.Add(eatonInputPowerMib_M.PowerValue);
                leafVarBinding.Add(eatonInputPowerMib_M.PowerValue_VA);
            }
            for (int j = 1; j <= contactNum; j++)
            {
                EatonSensorContactMib_M2 eatonSensorContactMib_M = new EatonSensorContactMib_M2(j);
                leafVarBinding.Add(eatonSensorContactMib_M.ContactStatus);
            }
            for (int k = 1; k <= sensorNum; k++)
            {
                EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(k);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.TemperatureValue);
                EatonSensorHumidityMib_M2 eatonSensorHumidityMib_M = new EatonSensorHumidityMib_M2(k);
                leafVarBinding.Add(eatonSensorHumidityMib_M.HumidityValue);
            }
            list.Add(leafVarBinding);
            if (portNum > 0)
            {
                LeafVBBuilder leafVBBuilder = new LeafVBBuilder(3, portNum);
                leafVBBuilder.BuildVbByIndex(list, delegate(int i, LeafVarBinding leafVb)
                {
                    EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(i);
                    leafVb.Add(eatonOutletVoltageMib_M.VoltageValue);
                    EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(i);
                    leafVb.Add(eatonOutletCurrentMib_M.CurrentValue);
                    EatonOutletPowerMib_M2 eatonOutletPowerMib_M = new EatonOutletPowerMib_M2(i);
                    leafVb.Add(eatonOutletPowerMib_M.PowerValue);
                });
            }
            if (bankNum > 0)
            {
                LeafVBBuilder leafVBBuilder2 = new LeafVBBuilder(2, bankNum);
                leafVBBuilder2.BuildVbByIndex(list, delegate(int i, LeafVarBinding leafVb)
                {
                    EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(i);
                    leafVb.Add(eatonGroupCurrentMib_M.CurrentValue);
                    EatonGroupPowerMib_M2 eatonGroupPowerMib_M = new EatonGroupPowerMib_M2(i);
                    leafVb.Add(eatonGroupPowerMib_M.PowerValue);
                });
            }
            return(list);
        }
Beispiel #20
0
 private void getThresholds(ref DevModelConfig devinfo, XmlTextReader reader)
 {
     devinfo.devThresholds.ThresholdsFlg       = new System.Collections.Generic.List <ThresholdFlg>();
     devinfo.devThresholds.UIEditFlg           = new System.Collections.Generic.List <ThresholdFlg>();
     devinfo.devThresholds.currentThresholds   = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.voltageThresholds   = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.powerThresholds     = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.powerDissThresholds = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.tempThresholds      = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.HumiThresholds      = new System.Collections.Generic.List <stru_CommRange>();
     devinfo.devThresholds.PressThresholds     = new System.Collections.Generic.List <stru_CommRange>();
     while (reader.Read())
     {
         XmlNodeType nodeType = reader.NodeType;
         if (nodeType != XmlNodeType.Element)
         {
             if (nodeType == XmlNodeType.EndElement)
             {
                 if (reader.Name.Equals("threshold"))
                 {
                     return;
                 }
             }
         }
         else
         {
             if (reader.Name.Equals("readVflag"))
             {
                 ThresholdFlg item = default(ThresholdFlg);
                 item.type = reader.GetAttribute("type");
                 item.flg  = System.Convert.ToInt32(reader.GetAttribute("flag"), 16);
                 devinfo.devThresholds.ThresholdsFlg.Add(item);
             }
             else
             {
                 if (reader.Name.Equals("UIeditflag"))
                 {
                     ThresholdFlg item2 = default(ThresholdFlg);
                     item2.type = reader.GetAttribute("type");
                     item2.flg  = System.Convert.ToInt32(reader.GetAttribute("flag"), 16);
                     devinfo.devThresholds.UIEditFlg.Add(item2);
                 }
                 else
                 {
                     if (reader.Name.Equals("current"))
                     {
                         stru_CommRange item3 = default(stru_CommRange);
                         item3.type  = reader.GetAttribute("type");
                         item3.id    = reader.GetAttribute("id");
                         item3.range = reader.GetAttribute("range");
                         devinfo.devThresholds.currentThresholds.Add(item3);
                     }
                     else
                     {
                         if (reader.Name.Equals("voltage"))
                         {
                             stru_CommRange item4 = default(stru_CommRange);
                             item4.type  = reader.GetAttribute("type");
                             item4.id    = reader.GetAttribute("id");
                             item4.range = reader.GetAttribute("range");
                             devinfo.devThresholds.voltageThresholds.Add(item4);
                         }
                         else
                         {
                             if (reader.Name.Equals("power"))
                             {
                                 stru_CommRange item5 = default(stru_CommRange);
                                 item5.type  = reader.GetAttribute("type");
                                 item5.id    = reader.GetAttribute("id");
                                 item5.range = reader.GetAttribute("range");
                                 devinfo.devThresholds.powerThresholds.Add(item5);
                             }
                             else
                             {
                                 if (reader.Name.Equals("powerDissipation"))
                                 {
                                     stru_CommRange item6 = default(stru_CommRange);
                                     item6.type  = reader.GetAttribute("type");
                                     item6.id    = reader.GetAttribute("id");
                                     item6.range = reader.GetAttribute("range");
                                     devinfo.devThresholds.powerDissThresholds.Add(item6);
                                 }
                                 else
                                 {
                                     if (reader.Name.Equals("temperature"))
                                     {
                                         stru_CommRange item7 = default(stru_CommRange);
                                         item7.type  = reader.GetAttribute("type");
                                         item7.id    = reader.GetAttribute("id");
                                         item7.range = reader.GetAttribute("range");
                                         devinfo.devThresholds.tempThresholds.Add(item7);
                                     }
                                     else
                                     {
                                         if (reader.Name.Equals("humidity"))
                                         {
                                             stru_CommRange item8 = default(stru_CommRange);
                                             item8.type  = reader.GetAttribute("type");
                                             item8.id    = reader.GetAttribute("id");
                                             item8.range = reader.GetAttribute("range");
                                             devinfo.devThresholds.HumiThresholds.Add(item8);
                                         }
                                         else
                                         {
                                             if (reader.Name.Equals("pressure"))
                                             {
                                                 stru_CommRange item9 = default(stru_CommRange);
                                                 item9.type  = reader.GetAttribute("type");
                                                 item9.id    = reader.GetAttribute("id");
                                                 item9.range = reader.GetAttribute("range");
                                                 devinfo.devThresholds.PressThresholds.Add(item9);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #21
0
 private void getDoorInfo(ref DevModelConfig devinfo, string str)
 {
     devinfo.doorReading = System.Convert.ToInt32(str) + 1;
 }
Beispiel #22
0
        private void ReadDevModelInfo(string xmlDir, ref string m_Vesion, ref int m_maxZoneNum, ref int m_maxRackNum, ref int m_maxDevNum, ref bool m_supportISG, ref int m_ISGtimeout, ref bool m_supportBillprot, ref bool m_isdebuglogExport, ref int m_supportOEMDev, ref int m_runEnv_type, ref int m_runEnv_dbusage, ref int m_PeakPowerMethod, ref int m_MySQLUseMajorVersionOnly)
        {
            DevModelConfig     devModelConfig = new DevModelConfig(string.Empty);
            DevCommonThreshold src            = default(DevCommonThreshold);
            string             text           = "";
            XmlTextReader      xmlTextReader  = new XmlTextReader(xmlDir);

            while (xmlTextReader.Read())
            {
                XmlNodeType nodeType = xmlTextReader.NodeType;
                switch (nodeType)
                {
                case XmlNodeType.Element:
                    if (xmlTextReader.Name.Equals("version"))
                    {
                        m_Vesion = xmlTextReader.GetAttribute("value");
                    }
                    else
                    {
                        if (xmlTextReader.Name.Equals("maxZoneNum"))
                        {
                            m_maxZoneNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                        }
                        else
                        {
                            if (xmlTextReader.Name.Equals("maxRackNum"))
                            {
                                m_maxRackNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                            }
                            else
                            {
                                if (xmlTextReader.Name.Equals("maxDevNum"))
                                {
                                    m_maxDevNum = System.Convert.ToInt32(xmlTextReader.GetAttribute("value"));
                                }
                                else
                                {
                                    if (xmlTextReader.Name.Equals("isdebuglogExportTRUE"))
                                    {
                                        m_isdebuglogExport = true;
                                    }
                                    else
                                    {
                                        if (xmlTextReader.Name.Equals("wantISGsupport"))
                                        {
                                            int    num       = 0;
                                            int    num2      = 0;
                                            string attribute = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                string[] array = attribute.Split(new char[]
                                                {
                                                    ','
                                                });
                                                int.TryParse(array[0], out num);
                                                int.TryParse(array[1], out num2);
                                                if (num == 13122)
                                                {
                                                    m_supportISG = true;
                                                    m_ISGtimeout = num2;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("wantBillProtsupport"))
                                        {
                                            int    num        = 0;
                                            string attribute2 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute2, out num);
                                                if (num == 1)
                                                {
                                                    m_supportBillprot = true;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("supportOEMDev"))
                                        {
                                            int    num        = 0;
                                            string attribute3 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute3, out num);
                                                m_supportOEMDev = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("PowerMethod"))
                                        {
                                            int    num        = 0;
                                            string attribute4 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute4, out num);
                                                m_PeakPowerMethod = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("MySQLUseMajorVersionOnly"))
                                        {
                                            int    num        = 0;
                                            string attribute5 = xmlTextReader.GetAttribute("value");
                                            try
                                            {
                                                int.TryParse(attribute5, out num);
                                                m_MySQLUseMajorVersionOnly = num;
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("runenv"))
                                        {
                                            try
                                            {
                                                string attribute6 = xmlTextReader.GetAttribute("type");
                                                if (attribute6 != null)
                                                {
                                                    int num;
                                                    int.TryParse(attribute6, out num);
                                                    m_runEnv_type = num;
                                                }
                                            }
                                            catch (System.Exception)
                                            {
                                            }
                                            try
                                            {
                                                string attribute7 = xmlTextReader.GetAttribute("dbusage");
                                                if (attribute7 != null)
                                                {
                                                    int num;
                                                    int.TryParse(attribute7, out num);
                                                    m_runEnv_dbusage = num;
                                                }
                                                goto IL_35B;
                                            }
                                            catch (System.Exception)
                                            {
                                                goto IL_35B;
                                            }
                                        }
                                        if (xmlTextReader.Name.Equals("public"))
                                        {
                                            src = this.getCommonThresholds(xmlTextReader);
                                        }
                                        else
                                        {
                                            if (xmlTextReader.Name.Equals("device"))
                                            {
                                                devModelConfig = new DevModelConfig(string.Empty);
                                                devModelConfig.devThresholds.commonThresholds.copy(src);
                                                devModelConfig.modelName = xmlTextReader.GetAttribute("name");
                                                devModelConfig.modelName = devModelConfig.modelName.Trim();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
IL_35B:
                    text = xmlTextReader.Name;
                    if (text.Equals("threshold"))
                    {
                        this.getThresholds(ref devModelConfig, xmlTextReader);
                    }
                    else
                    {
                        if (text.Equals("ampcapacity"))
                        {
                            stru_CommRange item = default(stru_CommRange);
                            item.type  = xmlTextReader.GetAttribute("type");
                            item.id    = xmlTextReader.GetAttribute("id");
                            item.range = xmlTextReader.GetAttribute("range");
                            devModelConfig.ampcapicity.Add(item);
                        }
                        else
                        {
                            if (text.Equals("fwupgrade"))
                            {
                                int num;
                                if (int.TryParse(xmlTextReader.GetAttribute("validate"), out num))
                                {
                                    devModelConfig.FWvalidate = num;
                                }
                                devModelConfig.FWnms = ((xmlTextReader.GetAttribute("nms") == null) ? "" : xmlTextReader.GetAttribute("nms"));
                                devModelConfig.FWext = ((xmlTextReader.GetAttribute("ext") == null) ? "" : xmlTextReader.GetAttribute("ext"));
                            }
                        }
                    }
                    break;

                case XmlNodeType.Attribute:
                    break;

                case XmlNodeType.Text:
                    if (text.Equals("outletNumber"))
                    {
                        devModelConfig.portNum = System.Convert.ToInt32(xmlTextReader.Value);
                    }
                    else
                    {
                        if (text.Equals("sensorNumber"))
                        {
                            devModelConfig.sensorNum = System.Convert.ToInt32(xmlTextReader.Value);
                        }
                        else
                        {
                            if (text.Equals("bankNumber"))
                            {
                                this.getbankNumber(ref devModelConfig, xmlTextReader.Value);
                            }
                            else
                            {
                                if (text.Equals("bankOpt"))
                                {
                                    this.getbankOpt(ref devModelConfig, xmlTextReader.Value);
                                }
                                else
                                {
                                    if (text.Equals("outletCtrl"))
                                    {
                                        this.getoutletCtrl(ref devModelConfig, xmlTextReader.Value);
                                    }
                                    else
                                    {
                                        if (text.Equals("outletReading"))
                                        {
                                            devModelConfig.perportreadingOutlets = (ulong)System.Convert.ToUInt32(xmlTextReader.Value, 16);
                                            if (devModelConfig.perportreadingOutlets > 0uL)
                                            {
                                                devModelConfig.perportreading = 2;
                                            }
                                            else
                                            {
                                                devModelConfig.perportreading = 1;
                                            }
                                        }
                                        else
                                        {
                                            if (text.Equals("bankReading"))
                                            {
                                                this.getbankReading(ref devModelConfig, xmlTextReader.Value);
                                            }
                                            else
                                            {
                                                if (text.Equals("popReading"))
                                                {
                                                    this.getPopInfo(ref devModelConfig, xmlTextReader.Value);
                                                }
                                                else
                                                {
                                                    if (text.Equals("doorReading"))
                                                    {
                                                        this.getDoorInfo(ref devModelConfig, xmlTextReader.Value);
                                                    }
                                                    else
                                                    {
                                                        if (text.Equals("devcapacity"))
                                                        {
                                                            devModelConfig.devcapacity = xmlTextReader.Value;
                                                        }
                                                        else
                                                        {
                                                            if (text.Equals("commonThresholdFlag"))
                                                            {
                                                                devModelConfig.commonThresholdFlag = System.Convert.ToInt32(xmlTextReader.Value);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    break;

                default:
                    if (nodeType == XmlNodeType.EndElement)
                    {
                        if (xmlTextReader.Name.Equals("device"))
                        {
                            string   modelName = devModelConfig.modelName;
                            string[] array2    = modelName.Split(new string[]
                            {
                                ","
                            }, System.StringSplitOptions.RemoveEmptyEntries);
                            if (array2.Length == 1)
                            {
                                this.devList.Add(devModelConfig.modelName, devModelConfig);
                            }
                            else
                            {
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    array2[i] = array2[i].Trim();
                                    DevModelConfig value = new DevModelConfig(array2[i]);
                                    value.copy(devModelConfig);
                                    value.modelName = array2[i];
                                    this.devList.Add(value.modelName, value);
                                }
                            }
                            devModelConfig = new DevModelConfig(string.Empty);
                        }
                    }
                    break;
                }
            }
        }
Beispiel #23
0
        public static LeafVarBinding SetOutletThresholdVariablesEatonPDU_M2(OutletThreshold threshold, DevModelConfig modelcfg)
        {
            LeafVarBinding           leafVarBinding          = new LeafVarBinding();
            int                      outletNumber            = threshold.OutletNumber;
            EatonOutletEntryMib_M2   eatonOutletEntryMib_M   = new EatonOutletEntryMib_M2(outletNumber);
            EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(outletNumber);
            EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(outletNumber);

            if (!string.IsNullOrEmpty(threshold.OutletName))
            {
                leafVarBinding.Add(eatonOutletEntryMib_M.OutletName, threshold.OutletName);
            }
            else
            {
                leafVarBinding.Add(eatonOutletEntryMib_M.OutletName, "/empty");
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonOutletCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.MaxVoltageMT, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f));
            }
            if (threshold.MinVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.MinVoltageMt, System.Convert.ToInt32(threshold.MinVoltageMT * 1000f));
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonOutletCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxVoltageMT != -500f)
            {
                leafVarBinding.Add(eatonOutletVoltageMib_M.VoltageUpperCritical, System.Convert.ToInt32(threshold.MaxVoltageMT * 1000f));
            }
            return(leafVarBinding);
        }
Beispiel #24
0
 private void ConvertXmlConfig2AutoConfig()
 {
     System.Collections.Generic.Dictionary <string, DevModelConfig> dictionary = new System.Collections.Generic.Dictionary <string, DevModelConfig>();
     System.Collections.Generic.IEnumerator <string> enumerator = DevAccessCfg.devModelList.Keys.GetEnumerator();
     while (enumerator.MoveNext())
     {
         string         current = enumerator.Current;
         DevModelConfig value   = DevAccessCfg.devModelList[current];
         if (value.commonThresholdFlag == Constant.WithCommonThreshold)
         {
             value.maxDevThresholdOpt  |= 15u;
             value.maxBankThresholdOpt |= 15u;
             value.maxPortThresholdOpt |= 15u;
             value.minDevThresholdOpt  |= 2u;
             value.minBankThresholdOpt |= 2u;
             value.minPortThresholdOpt |= 2u;
             value.deviceMeasureOpt    |= 15u;
         }
         else
         {
             if (value.commonThresholdFlag == Constant.WithoutCommonThreshold)
             {
                 value.maxDevThresholdOpt  |= 1u;
                 value.maxBankThresholdOpt |= 1u;
                 value.maxPortThresholdOpt  = 0u;
                 value.minDevThresholdOpt   = 0u;
                 value.minBankThresholdOpt  = 0u;
                 value.minPortThresholdOpt  = 0u;
                 value.deviceMeasureOpt    |= 1u;
             }
             else
             {
                 if (value.commonThresholdFlag == Constant.WithSpecialThreshold)
                 {
                     value.maxDevThresholdOpt  |= 13u;
                     value.maxBankThresholdOpt |= 15u;
                     value.maxPortThresholdOpt  = 0u;
                     value.minDevThresholdOpt   = 0u;
                     value.minBankThresholdOpt |= 2u;
                     value.minPortThresholdOpt  = 0u;
                     value.deviceMeasureOpt    |= 15u;
                 }
             }
         }
         if (value.perbankReading == Constant.YES)
         {
             if (value.commonThresholdFlag == Constant.WithCommonThreshold)
             {
                 value.bankMeasureOpt = 15u;
             }
             else
             {
                 if (value.commonThresholdFlag == Constant.WithoutCommonThreshold)
                 {
                     value.bankMeasureOpt    = 1u;
                     value.bankStatusSupport = Constant.YES;
                 }
                 else
                 {
                     if (value.commonThresholdFlag == Constant.WithSpecialThreshold)
                     {
                         value.bankMeasureOpt    = 15u;
                         value.bankStatusSupport = Constant.YES;
                     }
                 }
             }
         }
         if (value.perportreading == Constant.YES)
         {
             value.outletMeasureOpt    = 15u;
             value.outletStatusSupport = Constant.YES;
         }
         dictionary.Add(current, value);
     }
     DevAccessCfg.devModelList.Clear();
     DevAccessCfg.devModelList = dictionary;
 }
Beispiel #25
0
        public static System.Collections.Generic.List <VarBinding> GetThresholdsRequestApcPDU(DevModelConfig modelcfg, DevRealConfig realcfg, int sensorNum)
        {
            int num     = 1;
            int bankNum = modelcfg.bankNum;

            System.Collections.Generic.List <VarBinding> list = new System.Collections.Generic.List <VarBinding>();
            LeafVarBinding leafVarBinding = new LeafVarBinding();

            leafVarBinding.Add(ApcPDUBaseMib.Mac);
            leafVarBinding.Add(ApcPDUBaseMib.FWversion);
            leafVarBinding.Add(ApcPDUBaseMib.DeviceName);
            for (int i = 1; i <= num; i++)
            {
                ApcDeviceConfigMib apcDeviceConfigMib = new ApcDeviceConfigMib(i);
                leafVarBinding.Add(apcDeviceConfigMib.MinPowerConfig);
                leafVarBinding.Add(apcDeviceConfigMib.MaxPowerConfig);
                ApcPhaseConfigMib apcPhaseConfigMib = new ApcPhaseConfigMib(i);
                leafVarBinding.Add(apcPhaseConfigMib.MinCurrentConfig);
                leafVarBinding.Add(apcPhaseConfigMib.MaxCurrentConfig);
            }
            for (int j = 1; j <= bankNum; j++)
            {
                ApcBankConfigMib apcBankConfigMib = new ApcBankConfigMib(j);
                leafVarBinding.Add(apcBankConfigMib.MinCurrentConfig);
                leafVarBinding.Add(apcBankConfigMib.MaxCurrentConfig);
            }
            for (int k = 1; k <= sensorNum; k++)
            {
                ApcSensorConfigMib apcSensorConfigMib = new ApcSensorConfigMib(k);
                leafVarBinding.Add(apcSensorConfigMib.MaxTemperature);
                leafVarBinding.Add(apcSensorConfigMib.MinHumidity);
            }
            list.Add(leafVarBinding);
            return(list);
        }
Beispiel #26
0
        public static System.Collections.Generic.List <VarBinding> GetThresholdsRequestEatonPDU_M2(DevModelConfig modelcfg, DevRealConfig realcfg)
        {
            int num       = 1;
            int portNum   = realcfg.portNum;
            int bankNum   = realcfg.bankNum;
            int sensorNum = realcfg.sensorNum;

            System.Collections.Generic.List <VarBinding> list = new System.Collections.Generic.List <VarBinding>();
            LeafVarBinding leafVarBinding = new LeafVarBinding();

            leafVarBinding.Add(EatonPDUBaseMib_M2.Mac);
            leafVarBinding.Add(EatonPDUBaseMib_M2.FWversion);
            leafVarBinding.Add(EatonPDUBaseMib_M2.DeviceName);
            for (int i = 1; i <= num; i++)
            {
                EatonInputCurrentMib_M2 eatonInputCurrentMib_M = new EatonInputCurrentMib_M2(i);
                leafVarBinding.Add(eatonInputCurrentMib_M.MaxCurrentMT);
                EatonInputVoltageMib_M2 eatonInputVoltageMib_M = new EatonInputVoltageMib_M2(i);
                leafVarBinding.Add(eatonInputVoltageMib_M.MinVoltageMt);
                leafVarBinding.Add(eatonInputVoltageMib_M.MaxVoltageMT);
            }
            for (int j = 1; j <= sensorNum; j++)
            {
                EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(j);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.MinTemperatureMt);
                leafVarBinding.Add(eatonSensorTemperatureMib_M.MaxTemperatureMT);
                EatonSensorHumidityMib_M2 eatonSensorHumidityMib_M = new EatonSensorHumidityMib_M2(j);
                leafVarBinding.Add(eatonSensorHumidityMib_M.MinHumidityMt);
                leafVarBinding.Add(eatonSensorHumidityMib_M.MaxHumidityMT);
            }
            list.Add(leafVarBinding);
            LeafVarBinding leafVarBinding2 = new LeafVarBinding();

            for (int k = 1; k <= bankNum; k++)
            {
                EatonGroupEntryMib_M2 eatonGroupEntryMib_M = new EatonGroupEntryMib_M2(k);
                leafVarBinding2.Add(eatonGroupEntryMib_M.GroupName);
                EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(k);
                leafVarBinding2.Add(eatonGroupCurrentMib_M.MaxCurrentMT);
            }
            if (bankNum > 0)
            {
                list.Add(leafVarBinding2);
            }
            if (portNum > 0)
            {
                int           nodes         = 4;
                LeafVBBuilder leafVBBuilder = new LeafVBBuilder(nodes, portNum);
                System.Collections.Generic.List <LeafVarBinding> list2 = new System.Collections.Generic.List <LeafVarBinding>();
                leafVBBuilder.BuildVbByIndex(list2, delegate(int index, LeafVarBinding leafVb)
                {
                    EatonOutletEntryMib_M2 eatonOutletEntryMib_M = new EatonOutletEntryMib_M2(index);
                    leafVb.Add(eatonOutletEntryMib_M.OutletName);
                    EatonOutletVoltageMib_M2 eatonOutletVoltageMib_M = new EatonOutletVoltageMib_M2(index);
                    leafVb.Add(eatonOutletVoltageMib_M.MinVoltageMt);
                    leafVb.Add(eatonOutletVoltageMib_M.MaxVoltageMT);
                    EatonOutletCurrentMib_M2 eatonOutletCurrentMib_M = new EatonOutletCurrentMib_M2(index);
                    leafVb.Add(eatonOutletCurrentMib_M.MaxCurrentMT);
                });
                foreach (LeafVarBinding current in list2)
                {
                    list.Add(current);
                }
            }
            return(list);
        }
Beispiel #27
0
        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);
        }
Beispiel #28
0
 private void getbankOpt(ref DevModelConfig devinfo, string str)
 {
     devinfo.bankOpt_nameempty = System.Convert.ToUInt32(str, 16);
 }
Beispiel #29
0
        public static LeafVarBinding SetBankThresholdVariablesEatonPDU_M2(BankThreshold threshold, DevModelConfig modelcfg)
        {
            LeafVarBinding          leafVarBinding         = new LeafVarBinding();
            int                     bankNumber             = threshold.BankNumber;
            EatonGroupEntryMib_M2   eatonGroupEntryMib_M   = new EatonGroupEntryMib_M2(bankNumber);
            EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(bankNumber);

            if (!string.IsNullOrEmpty(threshold.BankName))
            {
                leafVarBinding.Add(eatonGroupEntryMib_M.GroupName, threshold.BankName);
            }
            else
            {
                leafVarBinding.Add(eatonGroupEntryMib_M.GroupName, "/empty");
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonGroupCurrentMib_M.MaxCurrentMT, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(eatonGroupCurrentMib_M.CurrentUpperCritical, System.Convert.ToInt32(threshold.MaxCurrentMT * 1000f));
            }
            return(leafVarBinding);
        }
Beispiel #30
0
 public void copy(DevModelConfig src)
 {
     this.firmwareVer         = src.firmwareVer;
     this.autoBasicInfo       = src.autoBasicInfo;
     this.autoRatingInfo      = src.autoRatingInfo;
     this.modelName           = src.modelName;
     this.portNum             = src.portNum;
     this.sensorNum           = src.sensorNum;
     this.bankNum             = src.bankNum;
     this.lineNum             = src.lineNum;
     this.bankCtrlflg         = src.bankCtrlflg;
     this.bankOpt_nameempty   = src.bankOpt_nameempty;
     this.switchable          = src.switchable;
     this.perportreading      = src.perportreading;
     this.perbankReading      = src.perbankReading;
     this.perlineReading      = src.perlineReading;
     this.leakCurrent         = src.leakCurrent;
     this.popNewRule          = src.popNewRule;
     this.popPrioritySupport  = src.popPrioritySupport;
     this.popReading          = src.popReading;
     this.popDefault          = src.popDefault;
     this.popUdefmax          = src.popUdefmax;
     this.doorReading         = src.doorReading;
     this.devcapacity         = src.devcapacity;
     this.deviceMeasureOpt    = src.deviceMeasureOpt;
     this.bankMeasureOpt      = src.bankMeasureOpt;
     this.outletMeasureOpt    = src.outletMeasureOpt;
     this.lineMeasureOpt      = src.lineMeasureOpt;
     this.maxDevThresholdOpt  = src.maxDevThresholdOpt;
     this.minDevThresholdOpt  = src.minDevThresholdOpt;
     this.maxBankThresholdOpt = src.maxBankThresholdOpt;
     this.minBankThresholdOpt = src.minBankThresholdOpt;
     this.maxPortThresholdOpt = src.maxPortThresholdOpt;
     this.minPortThresholdOpt = src.minPortThresholdOpt;
     this.maxLineThresholdOpt = src.maxLineThresholdOpt;
     this.minLineThresholdOpt = src.minLineThresholdOpt;
     this.bankStatusSupport   = src.bankStatusSupport;
     this.outletStatusSupport = src.outletStatusSupport;
     this.ampcapicity         = new System.Collections.Generic.List <stru_CommRange>();
     for (int i = 0; i < src.ampcapicity.Count; i++)
     {
         stru_CommRange src2 = src.ampcapicity[i];
         stru_CommRange item = default(stru_CommRange);
         item.copy(src2);
         this.ampcapicity.Add(item);
     }
     this.commonThresholdFlag           = src.commonThresholdFlag;
     this.energyboxVoltage              = src.energyboxVoltage;
     this.switchableOutlets             = src.switchableOutlets;
     this.killPowerDisableRebootOutlets = src.killPowerDisableRebootOutlets;
     this.perportreadingOutlets         = src.perportreadingOutlets;
     this.devThresholds = default(DevThreshold);
     this.devThresholds.copy(src.devThresholds);
     this.bankOutlets = new System.Collections.Generic.List <BankOutlets>();
     for (int j = 0; j < src.bankOutlets.Count; j++)
     {
         BankOutlets src3  = src.bankOutlets[j];
         BankOutlets item2 = default(BankOutlets);
         item2.copy(src3);
         this.bankOutlets.Add(item2);
     }
     this.m_FW = default(FW_stru);
     this.m_FW.copy(src.m_FW);
 }