private void OnCompleteReadAllComHWBaseInfoCallback(CompleteReadAllComHWBaseInfoParams allBaseInfo, object userToken) { #region 组合硬件读取到的数据 _globalParams.AllBaseInfo = allBaseInfo.AllInfo; if (_globalParams.SupperDisplayList != null) { _globalParams.SupperDisplayList.Clear(); } foreach (KeyValuePair<string, OneCOMHWBaseInfo> pair in allBaseInfo.AllInfo.AllInfoDict) { string firstSN = pair.Value.FirstSenderSN; for (int i = 0; i < pair.Value.LEDDisplayInfoList.Count; i++) { string udid = firstSN + i.ToString("x2"); List<OneScreenInSupperDisplay> scrList = new List<OneScreenInSupperDisplay>(); scrList.Add(new OneScreenInSupperDisplay() { ScreenUDID = udid, }); SupperDisplay supper = new SupperDisplay() { DisplayName = "DisplayName", DisplayUDID = udid, ScreenList = scrList }; _globalParams.SupperDisplayList.Add(supper); } } #endregion #region 从数据库读取配置 SQLiteAccessor accessor = SQLiteAccessor.Instance; if (accessor == null) { Debug.WriteLine("数据库对象错误,终止智能亮度"); return; } List<DisplaySmartBrightEasyConfig> cfgList = accessor.GetAllNeedEasyConfig(new SmartBrightSeleCondition() { BrightAdjMode = BrightAdjustMode.SmartBright, DataVersion = -1 }); #endregion #region 开始智能亮度 if (_smartBrightManager != null) { _smartBrightManager.Dispose(); _smartBrightManager = null; } _smartBrightManager = new SmartBright(_proxy, _globalParams.AllBaseInfo, _globalParams.SupperDisplayList); _globalParams.SmartBrightManager = _smartBrightManager; for (int i = 0; i < cfgList.Count; i++) { DisplaySmartBrightEasyConfig cfg = cfgList[i]; if (cfg != null && cfg.OneDayConfigList != null) { int index = _globalParams.SupperDisplayList.FindIndex(delegate(SupperDisplay supperTemp) { if (supperTemp.DisplayUDID == cfg.DisplayUDID) { return true; } else { return false; } }); if (index != -1) { _smartBrightManager.AttachSmartBright(cfg.DisplayUDID, cfg); } } } #endregion }
private void InitializeScreen(AllCOMHWBaseInfo allComBaseInfo) { _allComBaseInfo = allComBaseInfo; ClearScannerDic(); if (allComBaseInfo == null || allComBaseInfo.AllInfoDict == null) { return; } string[] keys = new string[allComBaseInfo.AllInfoDict.Count]; allComBaseInfo.AllInfoDict.Keys.CopyTo(keys, 0); for (int i = 0; i < keys.Length; i++) { if (allComBaseInfo.AllInfoDict[keys[i]].DisplayResult != CommonInfoCompeleteResult.OK) { allComBaseInfo.AllInfoDict.Remove(keys[i]); } } _fLogService.Debug("InitializeScreen Finish Remove"); _allMonitorData = new AllMonitorData(); _comSenderList.Clear(); _supportList.Clear(); _reduInfoList.Clear(); foreach (KeyValuePair<string, OneCOMHWBaseInfo> pair in allComBaseInfo.AllInfoDict) { string firstSenderSN = pair.Value.FirstSenderSN; string udid = ""; int senderCount = -1; int tempCount = 0; for (int i = 0; i < pair.Value.LEDDisplayInfoList.Count; i++) { List<OneScreenInSupperDisplay> list = new List<OneScreenInSupperDisplay>(); udid = GetScreenUdid(firstSenderSN, i); ScreenModnitorData monitorData = new ScreenModnitorData(udid); _allMonitorData.AllScreenMonitorCollection.Add(monitorData); OneScreenInSupperDisplay oneDisplay = new OneScreenInSupperDisplay() { ScreenUDID = udid }; list.Add(oneDisplay); SupperDisplay supper = new SupperDisplay() { DisplayUDID = udid, ScreenList = list }; _supportList.Add(supper); tempCount = GetCommportSenderCount(pair.Value.LEDDisplayInfoList[i]); if (tempCount > senderCount) { senderCount = tempCount; } SetAutoReader(udid, pair.Key, pair.Value.LEDDisplayInfoList[i], pair.Value.ReduInfoList); } if (senderCount >= 0) { _reduInfoList.Add(pair.Key, pair.Value.ReduInfoList); _comSenderList.Add(pair.Key, senderCount + 1); } } _fLogService.Debug("InitializeScreen Finish _comSenderList"); #region 获取点检标识 if (Interlocked.Exchange(ref _isRunning, 1) == 0) { _screenPointDetectIdentify.Clear(); string sn; ChipType cType; ChipInherentProperty chipInherentPro = new ChipInherentProperty(); foreach (var item in allComBaseInfo.AllInfoDict) { for (int i = 0; i < item.Value.LEDDisplayInfoList.Count; i++) { sn = GetScreenUdid(item.Value.FirstSenderSN, i); if (_screenPointDetectIdentify.ContainsKey(sn)) { continue; } cType = ReadChipType(item.Value.LEDDisplayInfoList[i], item.Key); if (!chipInherentPro.ChipInherentPropertyDict.ContainsKey(cType)) { _screenPointDetectIdentify.Add(sn, false); } else { _screenPointDetectIdentify.Add(sn, chipInherentPro.ChipInherentPropertyDict[cType].IsSupportPointDetect); } } } _isRunning = 0; } _fLogService.Debug("InitializeScreen Finish 点检"); #endregion }