Esempio n. 1
0
        private static System.Collections.Generic.Dictionary <int, SensorValueEntry> GetSensorValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, SensorValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, SensorValueEntry>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string value   = result[current];
                if ("\0".Equals(value) || "n/a".Equals(value) || "N/A".Equals(value))
                {
                    value = System.Convert.ToString(-10000);
                }
                else
                {
                    if (string.IsNullOrEmpty(value))
                    {
                        value = System.Convert.ToString(-5000);
                    }
                }
                string text = ((float)System.Convert.ToInt32(value) / 10f).ToString();
                int    num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    SensorValueEntry value2 = new SensorValueEntry(num2);
                    dictionary.Add(num2, value2);
                }
                if (num != num2)
                {
                    new SensorValueMib(num2);
                    num = num2;
                }
                SensorValueEntry             sensorValueEntry            = dictionary[num2];
                EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(num2);
                EatonSensorHumidityMib_M2    eatonSensorHumidityMib_M    = new EatonSensorHumidityMib_M2(num2);
                if (current.StartsWith(eatonSensorTemperatureMib_M.TemperatureValue))
                {
                    sensorValueEntry.Temperature = text;
                }
                else
                {
                    if (current.StartsWith(eatonSensorHumidityMib_M.HumidityValue))
                    {
                        sensorValueEntry.Humidity = text;
                    }
                }
            }
            return(dictionary);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        private static System.Collections.Generic.Dictionary <int, SensorThreshold> GetSensorThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, SensorThreshold> dictionary = new System.Collections.Generic.Dictionary <int, SensorThreshold>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            EatonSensorTemperatureMib_M2 eatonSensorTemperatureMib_M   = null;
            EatonSensorHumidityMib_M2    eatonSensorHumidityMib_M      = null;
            int num = 0;

            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);
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    SensorThreshold value = new SensorThreshold(num2);
                    dictionary.Add(num2, value);
                }
                SensorThreshold sensorThreshold = dictionary[num2];
                if (num != num2)
                {
                    num = num2;
                    eatonSensorTemperatureMib_M = new EatonSensorTemperatureMib_M2(num2);
                    eatonSensorHumidityMib_M    = new EatonSensorHumidityMib_M2(num2);
                }
                float num3 = (float)System.Convert.ToInt32(text) / 10f;
                if (current.StartsWith(eatonSensorHumidityMib_M.MaxHumidityMT))
                {
                    sensorThreshold.MaxHumidityMT = num3;
                }
                else
                {
                    if (current.StartsWith(eatonSensorTemperatureMib_M.MaxTemperatureMT))
                    {
                        sensorThreshold.MaxTemperatureMT = num3;
                    }
                    else
                    {
                        if (current.StartsWith(eatonSensorHumidityMib_M.MinHumidityMt))
                        {
                            sensorThreshold.MinHumidityMT = num3;
                        }
                        else
                        {
                            if (!current.StartsWith(eatonSensorTemperatureMib_M.MinTemperatureMt))
                            {
                                return(new System.Collections.Generic.Dictionary <int, SensorThreshold>());
                            }
                            sensorThreshold.MinTemperatureMT = num3;
                        }
                    }
                }
            }
            return(dictionary);
        }