public bool UpdateLedMonitoringConfig(string sn, LedMonitoringConfig ledMonitoringConfig)
 {
     _fLogService.Info("开始更新硬件配置...");
     bool isResult = true;
     if (IsAllScreen(sn))
     {
         _ledMonitorConfigs.Clear();
         foreach (LedBasicInfo ledinfo in LedInfoList)
         {
             if (IsAllScreen(ledinfo.Sn))
             {
                 _ledMonitorConfigs.Add((LedMonitoringConfig)ledMonitoringConfig.Clone());
                 continue;
             }
             LedMonitoringConfig ledmonitor = (LedMonitoringConfig)ledMonitoringConfig.Clone();
             ledmonitor.SN = ledinfo.Sn;
             isResult = isResult && DataDispatcher.ClientDispatcher.Instance.UpdateLedMonitoringConfig(ledinfo.Sn, ledmonitor);
             _ledMonitorConfigs.Add(ledmonitor);
         }
     }
     else
     {
         isResult = DataDispatcher.ClientDispatcher.Instance.UpdateLedMonitoringConfig(sn, (LedMonitoringConfig)ledMonitoringConfig.Clone());
         _ledMonitorConfigs.Remove(_ledMonitorConfigs.Find(a => a.SN == sn));
         _ledMonitorConfigs.Add((LedMonitoringConfig)ledMonitoringConfig.Clone());
     }
     _fLogService.Info("完成更新硬件配置...");
     if (LedMonitoringConfigChangedEvent != null)
         LedMonitoringConfigChangedEvent(null, null);
     return isResult;
 }
 /// <summary>
 /// 更新Led监控配置
 /// </summary>
 /// <param name="sn">Led标识号</param>
 /// <param name="monitoringConfig">监控配置对象</param>
 /// <returns></returns>
 public bool UpdateLedMonitoringConfig(string sn, LedMonitoringConfig monitoringConfig)
 {
     string serializeStr = JsonConvert.SerializeObject(monitoringConfig);
     SetLedMonitoringConfig(serializeStr);
     return SaveLedMonitoringConfig(sn, serializeStr);
 }
Exemple #3
0
        public object Clone()
        {
            LedMonitoringConfig config = new LedMonitoringConfig(this);

            return(config);
        }
        private void ReadHWConfig()
        {
            List<ConfigInfo> cfgList = MonitorDataAccessor.Instance().GetHardWareCfg(string.Empty);
            if (_ledMonitorConfigs == null)
            {
                _ledMonitorConfigs = new List<LedMonitoringConfig>();
            }
            else
            {
                _ledMonitorConfigs.Clear();
            }
            foreach (LedBasicInfo key in LedInfoList)
            {
                LedMonitoringConfig ledMonitor = null;
                if (cfgList.FindIndex(a => a.SN == key.Sn) >= 0)
                {
                    ledMonitor = CommandTextParser.GetDeJsonSerialization<LedMonitoringConfig>(cfgList.Find(a => a.SN == key.Sn).Content);
                    if (ledMonitor != null)
                    {
                        ledMonitor.SN = key.Sn;
                    }
                }
                if (ledMonitor == null)
                {
                    ledMonitor = new LedMonitoringConfig();
                    ledMonitor.MonitoringCardConfig = new MonitoringCardConfig();
                    ledMonitor.MonitoringCardConfig.MonitoringEnable = false;
                    ledMonitor.SN = key.Sn;
                }
                DataDispatcher.ClientDispatcher.Instance.SetLedMonitoringConfig(
                    CommandTextParser.GetJsonSerialization<LedMonitoringConfig>(ledMonitor));
                _ledMonitorConfigs.Add((LedMonitoringConfig)ledMonitor.Clone());
            }

            if (LedInfoList.Count > 1)
            {
                LedMonitoringConfig ledMonitor = (LedMonitoringConfig)_ledMonitorConfigs[0].Clone();
                ledMonitor.SN = ALLScreenName;
                _ledMonitorConfigs.Insert(0, ledMonitor);
            }
        }
 public object Clone()
 {
     LedMonitoringConfig config = new LedMonitoringConfig(this);
     return config;
 }
Exemple #6
0
        private LedMonitoringConfig(LedMonitoringConfig config)
        {
            SN = string.IsNullOrEmpty(config.SN) ? string.Empty : config.SN.Clone() as string;

            MonitoringCardConfig = config.MonitoringCardConfig == null ? null : config.MonitoringCardConfig.Clone() as MonitoringCardConfig;
        }
        private LedMonitoringConfig(LedMonitoringConfig config)
        {
            SN = string.IsNullOrEmpty(config.SN) ? string.Empty : config.SN.Clone() as string;

            MonitoringCardConfig = config.MonitoringCardConfig == null ? null : config.MonitoringCardConfig.Clone() as MonitoringCardConfig;
        }
        public bool OnCmdInitialize()
        {
            IsGetData = false;
            if (MonitorAllConfig.Instance().ScreenMonitorData == null || MonitorAllConfig.Instance().ScreenMonitorData.AllScreenMonitorCollection == null
                || MonitorAllConfig.Instance().ScreenMonitorData.AllScreenMonitorCollection.Count == 0)
            {
                ScreenMonitorData = null;
                _fLogService.Error("获取数据结果为空,导致界面失败");
                return false;
            }
            foreach (ScreenModnitorData oneScreenData in MonitorAllConfig.Instance().ScreenMonitorData.AllScreenMonitorCollection)
            {
                if (oneScreenData.SenderMonitorCollection == null || oneScreenData.SenderMonitorCollection.Count == 0
                    || oneScreenData.ScannerMonitorCollection == null || oneScreenData.ScannerMonitorCollection.Count == 0)
                {
                    _fLogService.Error("获取数据结果不完整,因此不能推送到主界面");
                    return false;
                }
            }
            IsGetData = true;

            ScreenMonitorData = (AllMonitorData)MonitorAllConfig.Instance().ScreenMonitorData.Clone();
            List<string> screenList = new List<string>();

            _lctData = new LCTMainMonitorData();
            foreach (LedMonitoringConfig monitorConfig in MonitorAllConfig.Instance().LedMonitorConfigs)
            {
                _lctData.RefreshTypeInfo.IsUpdateMCStatus = true;
                LedBasicInfo led = MonitorAllConfig.Instance().LedInfoList.FirstOrDefault(a => a.Sn == monitorConfig.SN);
                if (led == null)
                {
                    continue;
                }
                if (monitorConfig.MonitoringCardConfig != null && monitorConfig.MonitoringCardConfig.MonitoringEnable == true
                    && monitorConfig.MonitoringCardConfig.ParameterConfigTable != null)
                {
                    foreach (ParameterMonitoringConfig param in monitorConfig.MonitoringCardConfig.ParameterConfigTable)
                    {
                        if (param.Type == StateQuantityType.FlatCableStatus
                            && _lctData.RefreshTypeInfo.IsUpdateRowLine == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdateRowLine = true;
                        }
                        if (param.Type == StateQuantityType.DoorStatus
                            && _lctData.RefreshTypeInfo.IsUpdateGeneralStatus == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdateGeneralStatus = true;
                        }
                        if (param.Type == StateQuantityType.Humidity
                            && _lctData.RefreshTypeInfo.IsUpdateHumidity == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdateHumidity = true;
                        }
                        if (param.Type == StateQuantityType.Smoke
                            && _lctData.RefreshTypeInfo.IsUpdateSmoke == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdateSmoke = true;
                        }
                        if (param.Type == StateQuantityType.FanSpeed
                            && _lctData.RefreshTypeInfo.IsUpdateFan == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdateFan = true;
                        }
                        if (param.Type == StateQuantityType.Voltage
                            && _lctData.RefreshTypeInfo.IsUpdatePower == false && param.MonitoringEnable)
                        {
                            _lctData.RefreshTypeInfo.IsUpdatePower = true;
                        }
                    }
                }
            }

            foreach (ScreenModnitorData oneScreenData in ScreenMonitorData.AllScreenMonitorCollection)
            {
                screenList.Add(oneScreenData.ScreenUDID);
                MonitorDataFlag monitorFlag = MonitorDataFlags.Find(a => a.SN == oneScreenData.ScreenUDID);
                if (monitorFlag == null)
                {
                    monitorFlag = new MonitorDataFlag();
                    monitorFlag.SN = oneScreenData.ScreenUDID;
                    monitorFlag.SNName = GetSnAlia(oneScreenData.ScreenUDID);
                    MonitorDataFlags.Add(monitorFlag);
                }
                else
                {
                    monitorFlag.SNName = GetSnAlia(oneScreenData.ScreenUDID);
                }
                LedAlarmConfig ledAlarmConfig = MonitorAllConfig.Instance().LedAlarmConfigs.Find(a =>
                    a.SN == oneScreenData.ScreenUDID);

                LedMonitoringConfig ledMonitorConfig = MonitorAllConfig.Instance().LedMonitorConfigs.Find(a =>
                    a.SN == oneScreenData.ScreenUDID);
                if (ledMonitorConfig == null)
                {
                    if (oneScreenData == null || string.IsNullOrEmpty(oneScreenData.ScreenUDID))
                    {
                        _fLogService.Error("获取数据结果:没有硬件配置导致异常");
                    }
                    else
                    {
                        _fLogService.Error("获取数据结果:没有硬件配置导致异常:" + oneScreenData.ScreenUDID);
                    }
                    ledMonitorConfig = new LedMonitoringConfig();
                    ledMonitorConfig.SN = oneScreenData.ScreenUDID;
                    ledMonitorConfig.MonitoringCardConfig = new MonitoringCardConfig();
                    ledMonitorConfig.MonitoringCardConfig.MonitoringEnable = false;
                }

                LedBasicInfo ledInfo = MonitorAllConfig.Instance().LedInfoList.Find(a => a.Sn == oneScreenData.ScreenUDID);
                if (ledInfo == null)
                {
                    continue;
                }
                SetSenderMonitor(ledInfo, oneScreenData.SenderMonitorCollection, monitorFlag);
                SetScannerMonitor(ledInfo, oneScreenData.ScannerMonitorCollection, ledAlarmConfig, monitorFlag);
                SetMonitorCardMonitor(ledInfo, oneScreenData.MonitorCardInfoCollection, ledAlarmConfig, ledMonitorConfig, monitorFlag);
                SetRegisterMonitor(monitorFlag);
            }
            for (int i = 0; i < MonitorDataFlags.Count; )
            {
                if (screenList.Contains(MonitorDataFlags[i].SN))
                {
                    i++;
                }
                else
                {
                    MonitorDataFlags.RemoveAt(i);
                }
            }
            SetRedundantStateInfos();
            MonitorAllConfig.Instance().SendMonitorDataToLCT(_lctData);
            return true;
        }
        private void SetMonitorCardMonitor(LedBasicInfo ledInfo, List<MonitorCardMonitorInfo> monitorCardInfos,
            LedAlarmConfig ledAlarmConfig, LedMonitoringConfig ledMonitorConfig, MonitorDataFlag monitorFlag)
        {
            if (ledMonitorConfig.MonitoringCardConfig == null || ledMonitorConfig.MonitoringCardConfig.MonitoringEnable == false)
            {
                monitorFlag.IsMCStatusValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsFanValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsHumidityValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsPowerValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsRowLineValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsSmokeValid = DeviceWorkStatus.UnAvailable;
                monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.UnAvailable;
                return;
            }

            monitorFlag.IsMCStatusValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsFanValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsHumidityValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsPowerValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsRowLineValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsSmokeValid = DeviceWorkStatus.Unknown;
            monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.Unknown;
            float fanValue = 1000;
            float humValue = 100;
            float valValue = 4;
            if (ledAlarmConfig.ParameterAlarmConfigList != null)
            {
                ParameterAlarmConfig param = ledAlarmConfig.ParameterAlarmConfigList.Find(a =>
                    a.ParameterType == StateQuantityType.FanSpeed);
                if (param != null)
                {
                    fanValue = (float)param.LowThreshold;
                }
                param = ledAlarmConfig.ParameterAlarmConfigList.Find(a =>
                    a.ParameterType == StateQuantityType.Humidity);
                if (param != null)
                {
                    humValue = (float)param.HighThreshold;
                }
            }
            ParameterMonitoringConfig monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.FanSpeed);
            bool isFan = monitorConfig == null ? false : monitorConfig.MonitoringEnable;
            monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.Humidity);
            bool isHumidity = monitorConfig == null ? false : monitorConfig.MonitoringEnable;
            monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.Smoke);
            bool isSmoke = monitorConfig == null ? false : monitorConfig.MonitoringEnable;
            monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.Voltage);
            bool isVoltage = monitorConfig == null ? false : monitorConfig.MonitoringEnable;
            monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.DoorStatus);
            bool isDoorStatus = monitorConfig == null ? false : monitorConfig.MonitoringEnable;
            monitorConfig = ledMonitorConfig.MonitoringCardConfig.ParameterConfigTable.Find
                (a => a.Type == StateQuantityType.FlatCableStatus);
            bool isFlatCableStatus = monitorConfig == null ? false : monitorConfig.MonitoringEnable;

            _lctData.ValidInfo.IsMCStatusValid = true;
            foreach (MonitorCardMonitorInfo monitorCardInfo in monitorCardInfos)
            {
                if (monitorCardInfo.DeviceStatus == DeviceWorkStatus.Error)
                {
                    monitorFlag.IsMCStatusValid = DeviceWorkStatus.Error;
                    if (!_lctData.FaultMonitorInfos.ContainsKey(ledInfo.Commport))
                    {
                        _lctData.FaultMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                    }
                    _lctData.FaultMonitorInfos[ledInfo.Commport].MCStatusErrCount++;
                }
                else if (monitorCardInfo.DeviceStatus == DeviceWorkStatus.OK &&
                    monitorFlag.IsMCStatusValid == DeviceWorkStatus.Unknown)
                {
                    monitorFlag.IsMCStatusValid = DeviceWorkStatus.OK;
                }

                if (isFan == false)
                {
                    monitorFlag.IsFanValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.FansUInfo == null)
                {
                    //if (monitorFlag.IsFanValid == DeviceWorkStatus.OK)
                    //{
                    //    monitorFlag.IsFanValid = DeviceWorkStatus.Error;
                    //}
                }
                else if (monitorCardInfo.FansUInfo.IsUpdate
                    && monitorCardInfo.FansUInfo.FansMonitorInfoCollection != null
                    && monitorCardInfo.FansUInfo.FansMonitorInfoCollection.Count > 0)
                {
                    foreach (int tmpValue in monitorCardInfo.FansUInfo.FansMonitorInfoCollection.Values)
                    {
                        if (tmpValue < fanValue)
                        {
                            monitorFlag.IsFanValid = DeviceWorkStatus.Error;
                            if (!_lctData.AlarmMonitorInfos.ContainsKey(ledInfo.Commport))
                            {
                                _lctData.AlarmMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                            }
                            _lctData.AlarmMonitorInfos[ledInfo.Commport].FanAlarmSwitchCount++;
                        }
                        else if (monitorCardInfo.DeviceStatus == DeviceWorkStatus.OK &&
                            monitorFlag.IsFanValid == DeviceWorkStatus.Unknown)
                        {
                            monitorFlag.IsFanValid = DeviceWorkStatus.OK;
                        }
                    }
                    _lctData.ValidInfo.IsFanValid = true;
                }

                if (isHumidity == false)
                {
                    monitorFlag.IsHumidityValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.HumidityUInfo == null)
                {
                    //if (monitorFlag.IsHumidityValid == DeviceWorkStatus.OK)
                    //{
                    //    monitorFlag.IsHumidityValid = DeviceWorkStatus.Error;
                    //}
                }
                else if (monitorCardInfo.HumidityUInfo.IsUpdate)
                {
                    if (monitorCardInfo.HumidityUInfo.Humidity > humValue)
                    {
                        monitorFlag.IsHumidityValid = DeviceWorkStatus.Error;
                        if (!_lctData.AlarmMonitorInfos.ContainsKey(ledInfo.Commport))
                        {
                            _lctData.AlarmMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                        }
                        _lctData.AlarmMonitorInfos[ledInfo.Commport].HumidityAlarmCount++;
                    }
                    else if (monitorFlag.IsHumidityValid != DeviceWorkStatus.Error)
                    {
                        monitorFlag.IsHumidityValid = DeviceWorkStatus.OK;
                    }
                    _lctData.ValidInfo.IsHumidityValid = true;
                }

                if (isDoorStatus == false)
                {
                    monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.CabinetDoorUInfo == null)
                {
                    //if (monitorFlag.IsGeneralStatusValid == DeviceWorkStatus.OK)
                    //{
                    //    monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.Error;
                    //}
                }
                else if (monitorCardInfo.CabinetDoorUInfo.IsUpdate)
                {
                    if (monitorCardInfo.CabinetDoorUInfo.IsDoorOpen)
                    {
                        monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.Error;
                        if (!_lctData.FaultMonitorInfos.ContainsKey(ledInfo.Commport))
                        {
                            _lctData.FaultMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                        }
                        _lctData.FaultMonitorInfos[ledInfo.Commport].GeneralSwitchErrCount++;
                    }
                    else if (monitorFlag.IsGeneralStatusValid != DeviceWorkStatus.Error)
                    {
                        monitorFlag.IsGeneralStatusValid = DeviceWorkStatus.OK;
                    }
                    _lctData.ValidInfo.IsGeneralStatusValid = true;
                }
                if (isVoltage == false)
                {
                    monitorFlag.IsPowerValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.PowerUInfo == null)
                {
                    //if (monitorFlag.IsPowerValid == DeviceWorkStatus.OK)
                    //{
                    //    monitorFlag.IsPowerValid = DeviceWorkStatus.Error;
                    //}
                }
                else if (monitorCardInfo.PowerUInfo.IsUpdate
                    && monitorCardInfo.PowerUInfo.PowerMonitorInfoCollection != null)
                {
                    foreach (float tmpValue in monitorCardInfo.PowerUInfo.PowerMonitorInfoCollection.Values)
                    {
                        if (tmpValue < valValue)
                        {
                            monitorFlag.IsPowerValid = DeviceWorkStatus.Error;
                            if (!_lctData.FaultMonitorInfos.ContainsKey(ledInfo.Commport))
                            {
                                _lctData.FaultMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                            }
                            _lctData.FaultMonitorInfos[ledInfo.Commport].PowerAlarmSwitchCount++;
                        }
                        else if (monitorCardInfo.DeviceStatus == DeviceWorkStatus.OK &&
                            monitorFlag.IsPowerValid == DeviceWorkStatus.Unknown)
                        {
                            monitorFlag.IsPowerValid = DeviceWorkStatus.OK;
                        }
                    }
                    _lctData.ValidInfo.IsPowerValid = true;
                }
                if (isSmoke == false)
                {
                    monitorFlag.IsSmokeValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.SmokeUInfo == null)
                {
                    //if (monitorFlag.IsSmokeValid == DeviceWorkStatus.OK)
                    //{
                    //    monitorFlag.IsSmokeValid = DeviceWorkStatus.Error;
                    //}
                }
                else if (monitorCardInfo.SmokeUInfo.IsUpdate)
                {
                    if (monitorCardInfo.SmokeUInfo.IsSmokeAlarm)
                    {
                        monitorFlag.IsSmokeValid = DeviceWorkStatus.Error;
                        if (!_lctData.AlarmMonitorInfos.ContainsKey(ledInfo.Commport))
                        {
                            _lctData.AlarmMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                        }
                        _lctData.AlarmMonitorInfos[ledInfo.Commport].SmokeAlarmCount++;
                    }
                    else if (monitorFlag.IsSmokeValid != DeviceWorkStatus.Error)
                    {
                        monitorFlag.IsSmokeValid = DeviceWorkStatus.OK;
                    }
                    _lctData.ValidInfo.IsSmokeValid = true;
                }

                if (isFlatCableStatus == false)
                {
                    monitorFlag.IsRowLineValid = DeviceWorkStatus.UnAvailable;
                }
                else if (monitorCardInfo.SocketCableUInfo == null)
                {
                    //    if (monitorFlag.IsRowLineValid == DeviceWorkStatus.OK)
                    //    {
                    //        monitorFlag.IsRowLineValid = DeviceWorkStatus.Error;
                    //    }
                }
                else if (monitorCardInfo.SocketCableUInfo.IsUpdate
                    && monitorCardInfo.SocketCableUInfo.SocketCableInfoCollection != null
                    && monitorCardInfo.SocketCableUInfo.SocketCableInfoCollection.Count > 0)
                {
                    foreach (SocketCableMonitorInfo socket in monitorCardInfo.SocketCableUInfo.SocketCableInfoCollection)
                    {
                        if (socket.SocketCableInfoDict == null || socket.SocketCableInfoDict.Count == 0)
                        {
                            monitorFlag.IsRowLineValid = DeviceWorkStatus.Error;
                            break;
                        }

                        foreach (List<SocketCableStatus> socketCables in socket.SocketCableInfoDict.Values)
                        {
                            foreach (SocketCableStatus socketcable in socketCables)
                            {
                                if (socketcable.IsCableOK == false)
                                {
                                    monitorFlag.IsRowLineValid = DeviceWorkStatus.Error;
                                    if (!_lctData.AlarmMonitorInfos.ContainsKey(ledInfo.Commport))
                                    {
                                        _lctData.AlarmMonitorInfos.Add(ledInfo.Commport, new MonitorErrData());
                                    }
                                    _lctData.AlarmMonitorInfos[ledInfo.Commport].SoketAlarmCount++;
                                }
                                else if (socketcable.IsCableOK == true &&
                                    monitorFlag.IsRowLineValid == DeviceWorkStatus.Unknown)
                                {
                                    monitorFlag.IsRowLineValid = DeviceWorkStatus.OK;
                                }
                            }
                        }
                        if (monitorFlag.IsRowLineValid == DeviceWorkStatus.Error)
                        {
                            break;
                        }
                    }
                    _lctData.ValidInfo.IsRowLineValid = true;
                }
            }
        }
        private LedMonitoringConfig SetMonitorCfg()
        {
            LedMonitoringConfig ledHWCfg = new LedMonitoringConfig();
            ledHWCfg.SN = _sn;
            ledHWCfg.MonitoringCardConfig = new MonitoringCardConfig();
            ledHWCfg.MonitoringCardConfig.MonitoringEnable = IsMonitorCardConnected;
            if (!IsMonitorCardConnected)
            {
                return ledHWCfg;
            }
            ledHWCfg.MonitoringCardConfig.ParameterConfigTable = new List<ParameterMonitoringConfig>();
            ParameterMonitoringConfig pCfg = new ParameterMonitoringConfig();
            //Humidity
            pCfg.ConfigMode = ParameterConfigMode.NoneExtendedMode;
            pCfg.MonitoringEnable = IsRefreshHumidity;
            pCfg.Type = StateQuantityType.Humidity;
            ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg);
            //smoke
            ParameterMonitoringConfig pCfg1 = new ParameterMonitoringConfig();
            pCfg1.ConfigMode = ParameterConfigMode.NoneExtendedMode;
            pCfg1.Type = StateQuantityType.Smoke;
            pCfg1.MonitoringEnable = IsRefreshSmoke;
            ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg1);
            //cabinet
            ParameterMonitoringConfig pCfg2 = new ParameterMonitoringConfig();
            pCfg2.Type = StateQuantityType.FlatCableStatus;
            pCfg2.ConfigMode = ParameterConfigMode.NoneExtendedMode;
            pCfg2.MonitoringEnable = IsRefreshCabinet;
            ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg2);
            //cabinetdoor
            ParameterMonitoringConfig pCfg3 = new ParameterMonitoringConfig();
            pCfg3.ConfigMode = ParameterConfigMode.NoneExtendedMode;
            pCfg3.Type = StateQuantityType.DoorStatus;
            pCfg3.MonitoringEnable = IsRefreshCabinetDoor;
            ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg3);
            //fan
            ParameterMonitoringConfig pCfg4 = new ParameterMonitoringConfig();
            if (FanInfo != null)
            {
                pCfg4.ReservedConfig = FanInfo.FanSpeed;
                if (FanInfo.IsRefreshFan)
                {
                    if (FanInfo.AllFanOfCabinetSame)
                    {
                        pCfg4.ConfigMode = ParameterConfigMode.GeneralExtendedMode;
                        pCfg4.MonitoringEnable = FanInfo.IsRefreshFan;
                        pCfg4.GeneralExtendedConfig = FanInfo.FanCount;
                    }
                    else if (FanInfo.AllFanOfCabinetDif)
                    {
                        pCfg4.ConfigMode = ParameterConfigMode.AdvanceExtendedMode;
                        pCfg4.ExtendedConfig = new List<ParameterExtendedConfig>();
                        if (FanInfo.AllFanCountDif != null)
                        {
                            foreach (KeyValuePair<string, byte> keyValue in FanInfo.AllFanCountDif)
                            {
                                ParameterExtendedConfig param = new ParameterExtendedConfig();
                                param.ReceiveCardId = keyValue.Key;
                                param.ParameterCount = keyValue.Value;
                                pCfg4.ExtendedConfig.Add(param);
                            }
                        }
                    }
                }
                pCfg4.MonitoringEnable = FanInfo.IsRefreshFan;
                pCfg4.Type = StateQuantityType.FanSpeed;
                ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg4);
            }
            //Power

            ParameterMonitoringConfig pCfg5 = new ParameterMonitoringConfig();
            if (MCPower != null)
            {
                if (MCPower.IsRefreshPower)
                {
                    if (MCPower.AllPowerOfCabinetSame)
                    {
                        pCfg5.ConfigMode = ParameterConfigMode.GeneralExtendedMode;
                        pCfg5.MonitoringEnable = MCPower.IsRefreshPower;
                        pCfg5.GeneralExtendedConfig = MCPower.PowerCount;
                    }
                    else if (MCPower.AllPowerOfCabinetDif)
                    {
                        pCfg5.ConfigMode = ParameterConfigMode.AdvanceExtendedMode;
                        pCfg5.ExtendedConfig = new List<ParameterExtendedConfig>();
                        if (MCPower.AllPowerCountDif != null)
                        {
                            foreach (KeyValuePair<string, byte> keyValue in MCPower.AllPowerCountDif)
                            {
                                ParameterExtendedConfig param = new ParameterExtendedConfig();
                                param.ReceiveCardId = keyValue.Key;
                                param.ParameterCount = keyValue.Value;
                                pCfg5.ExtendedConfig.Add(param);
                            }
                        }
                    }
                }
                pCfg5.MonitoringEnable = MCPower.IsRefreshPower;
                pCfg5.Type = StateQuantityType.Voltage;
                ledHWCfg.MonitoringCardConfig.ParameterConfigTable.Add(pCfg5);
            }
            return ledHWCfg;
        }
        private void InitialHwConfg(LedMonitoringConfig ledMonitorCfg)
        {
            if (ledMonitorCfg == null || ledMonitorCfg.MonitoringCardConfig == null || ledMonitorCfg.SN == null)
            {
                return;
            }
            IsMonitorCardConnected = ledMonitorCfg.MonitoringCardConfig.MonitoringEnable;
            if (ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable == null || ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Count == 0)
            {
                return;
            }

            ParameterMonitoringConfig cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.FlatCableStatus));
            if (cfg != null)
            {
                IsRefreshCabinet = cfg.MonitoringEnable;
            }
            cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.DoorStatus));
            if (cfg != null)
            {
                IsRefreshCabinetDoor = cfg.MonitoringEnable;
            }
            cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.Humidity));
            if (cfg != null)
            {
                IsRefreshHumidity = cfg.MonitoringEnable;
            }
            cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.Smoke));
            if (cfg != null)
            {
                IsRefreshSmoke = cfg.MonitoringEnable;
            }
            cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.FanSpeed));
            FanInfo = new UC_HWConfig_CabinetFanInfo_VM();
            if (cfg != null)
            {
                FanInfo.IsRefreshFan = cfg.MonitoringEnable;
                if (FanInfo.IsRefreshFan)
                {
                    FanInfo.FanSpeed = cfg.ReservedConfig;
                    if (_sn == MonitorAllConfig.Instance().ALLScreenName)
                    {
                        cfg.ConfigMode = ParameterConfigMode.GeneralExtendedMode;
                    }
                    if (cfg.ConfigMode == ParameterConfigMode.GeneralExtendedMode)
                    {
                        FanInfo.AllFanOfCabinetSame = true;
                        FanInfo.AllFanOfCabinetDif = false;
                        FanInfo.FanCount = cfg.GeneralExtendedConfig;
                    }
                    else if (cfg.ConfigMode == ParameterConfigMode.AdvanceExtendedMode)
                    {
                        FanInfo.AllFanOfCabinetSame = false;
                        FanInfo.AllFanOfCabinetDif = true;
                        FanInfo.AllFanCountDif = new SerializableDictionary<string, byte>();
                        foreach (ParameterExtendedConfig param in cfg.ExtendedConfig)
                        {
                            FanInfo.AllFanCountDif.Add(param.ReceiveCardId, (byte)param.ParameterCount);
                        }
                    }
                }
            }
            cfg = ledMonitorCfg.MonitoringCardConfig.ParameterConfigTable.Find(a => a.Type.Equals(StateQuantityType.Voltage));
            MCPower = new UC_HWConfig_MonitorCardPower_VM();
            if (cfg != null)
            {
                MCPower.IsRefreshPower = cfg.MonitoringEnable;
                if (MCPower.IsRefreshPower)
                {
                    if (_sn == MonitorAllConfig.Instance().ALLScreenName)
                    {
                        cfg.ConfigMode = ParameterConfigMode.GeneralExtendedMode;
                    }
                    if (cfg.ConfigMode == ParameterConfigMode.GeneralExtendedMode)
                    {
                        MCPower.AllPowerOfCabinetSame = true;
                        MCPower.AllPowerOfCabinetDif = false;
                        MCPower.PowerCount = cfg.GeneralExtendedConfig;
                    }
                    else if (cfg.ConfigMode == ParameterConfigMode.AdvanceExtendedMode)
                    {
                        MCPower.AllPowerOfCabinetSame = false;
                        MCPower.AllPowerOfCabinetDif = true;
                        MCPower.AllPowerCountDif = new SerializableDictionary<string, byte>();
                        foreach (ParameterExtendedConfig param in cfg.ExtendedConfig)
                        {
                            MCPower.AllPowerCountDif.Add(param.ReceiveCardId, (byte)param.ParameterCount);
                        }
                    }
                }
            }
        }