Example #1
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);
        }
Example #2
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);
        }