Exemple #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);
 }
Exemple #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));
 }
Exemple #3
0
 public static int GetSensorCount(string str_model, string str_fwversion)
 {
     try
     {
         return(DevAccessCfg.GetInstance().getDeviceModelConfig(str_model, str_fwversion).sensorNum);
     }
     catch
     {
     }
     return(-1);
 }
Exemple #4
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());
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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());
        }
Exemple #9
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);
        }
Exemple #10
0
 public DevDiscoverAPI(DevSnmpConfig snmpSettings)
 {
     this.cfg     = DevAccessCfg.GetInstance();
     this.snmpCfg = snmpSettings;
     this.sc      = this.cfg.getSnmpConfig(this.snmpCfg);
 }