コード例 #1
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);
        }
コード例 #2
0
        private static System.Collections.Generic.Dictionary <int, BankThreshold> GetBankThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, BankThreshold> dictionary = new System.Collections.Generic.Dictionary <int, BankThreshold>();
            System.Collections.Generic.IEnumerator <string>            enumerator = result.Keys.GetEnumerator();
            ApcBankConfigMib apcBankConfigMib = null;
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000);
                }
                else
                {
                    if (text == null || string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-500);
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    dictionary.Add(num2, new BankThreshold(num2)
                    {
                        BankName = "\r\n"
                    });
                }
                if (num != num2)
                {
                    apcBankConfigMib = new ApcBankConfigMib(num2);
                    num = num2;
                }
                BankThreshold bankThreshold = dictionary[num2];
                if (current.StartsWith(apcBankConfigMib.MinCurrentConfig))
                {
                    bankThreshold.MinCurrentMt = (float)System.Convert.ToInt32(text);
                }
                else
                {
                    if (current.StartsWith(apcBankConfigMib.MaxCurrentConfig))
                    {
                        bankThreshold.MaxCurrentMT = (float)System.Convert.ToInt32(text);
                    }
                }
            }
            return(dictionary);
        }
コード例 #3
0
        public static System.Collections.Generic.List <LeafVarBinding> SetBankThresholdVariablesApcPDU(BankThreshold threshold, DevModelConfig modelcfg)
        {
            System.Collections.Generic.List <LeafVarBinding> list = new System.Collections.Generic.List <LeafVarBinding>();
            LeafVarBinding   leafVarBinding   = new LeafVarBinding();
            LeafVarBinding   leafVarBinding2  = new LeafVarBinding();
            int              bankNumber       = threshold.BankNumber;
            ApcBankConfigMib apcBankConfigMib = new ApcBankConfigMib(bankNumber);

            if (threshold.MaxCurrentMT != -500f)
            {
                leafVarBinding.Add(apcBankConfigMib.MinCurrentConfig, 0);
                leafVarBinding.Add(apcBankConfigMib.NearCurrentConfig, 1);
                leafVarBinding2.Add(apcBankConfigMib.MaxCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT));
                leafVarBinding2.Add(apcBankConfigMib.NearCurrentConfig, System.Convert.ToInt32(threshold.MaxCurrentMT));
            }
            if (threshold.MinCurrentMt != -500f)
            {
                leafVarBinding2.Add(apcBankConfigMib.MinCurrentConfig, System.Convert.ToInt32(threshold.MinCurrentMt));
            }
            list.Add(leafVarBinding);
            list.Add(leafVarBinding2);
            return(list);
        }