Пример #1
0
        public int GetEatonPDUBankNumber(DevSnmpConfig cfg)
        {
            this.GetEatonPDUNumber_M2(cfg);
            DevAccessAPI devAccessAPI = new DevAccessAPI(cfg);

            return(devAccessAPI.GetEatonPDUBankNumber());
        }
Пример #2
0
 private void ReportPending(string strSuccessList, string failedList)
 {
     char[] separator = new char[]
     {
         ';'
     };
     string[] array = strSuccessList.Split(separator, System.StringSplitOptions.RemoveEmptyEntries);
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string text = array2[i];
         if (!string.IsNullOrEmpty(text))
         {
             if (stringBuilder.Length + text.Length + 1 > 65023)
             {
                 if (DevAccessAPI.cbOnDeviceChanged != null && stringBuilder.Length > 0)
                 {
                     DevAccessAPI.cbOnDeviceChanged("pending more", stringBuilder.ToString());
                 }
                 stringBuilder = new System.Text.StringBuilder();
             }
             if (stringBuilder.Length > 0)
             {
                 stringBuilder.Append(";");
             }
             stringBuilder.Append(text);
         }
     }
     if (stringBuilder.Length > 0 && DevAccessAPI.cbOnDeviceChanged != null)
     {
         DevAccessAPI.cbOnDeviceChanged("pending", stringBuilder.ToString());
     }
 }
Пример #3
0
        public bool RebootOutlet(int outletIndex)
        {
            bool result = this.se.RebootOutlet(outletIndex);

            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + outletIndex);
            }
            return(result);
        }
Пример #4
0
        public static void GetStatus(object obj)
        {
            bool result = true;

            GroupOPThread.GroupOPContext groupOPContext = (GroupOPThread.GroupOPContext)obj;
            DevSnmpConfig devsnmpcfg   = groupOPContext.devsnmpcfg;
            DevAccessAPI  devAccessAPI = new DevAccessAPI(devsnmpcfg);

            devAccessAPI.GetDeviceOutletsStatus();
            if (groupOPContext.opCallback != null)
            {
                groupOPContext.opCallback(result, devsnmpcfg);
            }
        }
Пример #5
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());
        }
Пример #6
0
        public static void Reboot(object obj)
        {
            bool result = true;

            GroupOPThread.GroupOPContext groupOPContext = (GroupOPThread.GroupOPContext)obj;
            DevSnmpConfig devsnmpcfg   = groupOPContext.devsnmpcfg;
            DevAccessAPI  devAccessAPI = new DevAccessAPI(devsnmpcfg);

            if (!devAccessAPI.RebootGroupOutlets(devsnmpcfg.groupOutlets))
            {
                result = false;
            }
            if (groupOPContext.opCallback != null)
            {
                groupOPContext.opCallback(result, devsnmpcfg);
            }
        }
Пример #7
0
        public bool TurnOnAllOutlets()
        {
            bool result = this.se.TurnOnOutlets();

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            for (int i = 1; i <= this.mc.portNum; i++)
            {
                if (this.mc.isOutletSwitchable(i - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(i.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }
Пример #8
0
        public bool RebootBank_Slave(int bankIndex)
        {
            bool result = this.se.RebootBank(bankIndex);

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            for (int i = this.mc.bankOutlets[bankIndex - 1].fromPort; i <= this.mc.bankOutlets[bankIndex - 1].toPort; i++)
            {
                if (this.mc.isOutletSwitchable(i - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(i.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }
Пример #9
0
        public bool RebootGroupOutlets_Slave(System.Collections.Generic.List <int> outlets)
        {
            bool result = this.se.RebootGroupOutlets(outlets);

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            foreach (int current in outlets)
            {
                if (this.mc.isOutletSwitchable(current - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(current.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }
Пример #10
0
        public DevRealConfig GetEatonPDUNumber_M2(DevSnmpConfig cfg)
        {
            DevAccessAPI devAccessAPI = new DevAccessAPI(cfg);

            return(devAccessAPI.GetEatonPDUNumber_M2());
        }