public System.Collections.Generic.List <PropertiesMessage> GetProperties_ATEN()
        {
            System.DateTime createTime = System.DateTime.Now;
            SystemThreadPool <SnmpConfiger, PropertiesMessage> systemThreadPool = new SystemLargeThreadPool <SnmpConfiger, PropertiesMessage>(this.snmpConfigs);

            return(systemThreadPool.GetResults(delegate(System.Collections.ICollection col, object obj)
            {
                SnmpConfiger snmpConfiger = (SnmpConfiger)obj;
                SnmpExecutor snmpExecutor = new DefaultSnmpExecutor(snmpConfiger);
                PropertiesMessage propertiesMessage = null;
                try
                {
                    propertiesMessage = snmpExecutor.GetProperties_ATEN();
                    propertiesMessage.CreateTime = createTime;
                    propertiesMessage.IpAddress = snmpConfiger.SnmpConfig.AgentIp;
                    propertiesMessage.PortNums = snmpConfiger.PortNumbers;
                    propertiesMessage.PerPortReading = snmpConfiger.PerPortReading;
                    propertiesMessage.Switchable = snmpConfiger.Switchable;
                    propertiesMessage.SensorNums = snmpConfiger.SensorNumber;
                }
                catch (System.Exception)
                {
                }
                if (propertiesMessage != null)
                {
                    lock (col)
                    {
                        ((System.Collections.Generic.List <PropertiesMessage>)col).Add(propertiesMessage);
                    }
                }
            }));
        }
Example #2
0
        private void handleTheResult(FirmwareUpgrade.Upgrading upgrading, int status)
        {
            switch (status)
            {
            case 0:
                upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, "");
                return;

            case 2:
                upgrading(UpgradeStatus.Upgrading, this.m_devID, "");
                return;

            case 3:
                upgrading(UpgradeStatus.NoNeedToUpgrade, this.m_devID, "");
                return;

            case 4:
                upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, "");
                return;

            case 5:
                upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, "");
                return;
            }
            string text = string.Empty;
            DefaultSnmpExecutor defaultSnmpExecutor = null;

            try
            {
                DeviceInfo    deviceByID = DeviceOperation.getDeviceByID(this.m_devID);
                DevSnmpConfig sNMPpara   = commUtil.getSNMPpara(deviceByID);
                SnmpConfig    snmpConfig = DevAccessCfg.GetInstance().getSnmpConfig(sNMPpara);
                defaultSnmpExecutor = new DefaultSnmpExecutor(new SnmpConfiger(snmpConfig, 1));
            }
            catch (System.Exception)
            {
            }
            int num = 0;

            while (num++ < 20)
            {
                try
                {
                    PropertiesMessage properties_ATEN = defaultSnmpExecutor.GetProperties_ATEN();
                    text = properties_ATEN.FirwWareVersion;
                    break;
                }
                catch (System.Exception)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            if (text.Equals(string.Empty))
            {
                upgrading(UpgradeStatus.UpgradeFailed, this.m_devID, "");
                return;
            }
            upgrading(UpgradeStatus.UpgradeSucceed, this.m_devID, text);
        }