private void SetSmartLightConfig(string content) { _fLogService.Info("开始设置亮度到软硬件..."); SmartLightConfigInfo smartInfo = CommandTextParser.GetDeJsonSerialization<SmartLightConfigInfo>(content); string commPort = string.Empty; ILEDDisplayInfo leds = null; GetScreenInfoByUDID(smartInfo.ScreenSN, out commPort, out leds); if (smartInfo.DisplayHardcareConfig != null) { ReadSmartLightDataParams readparam = new ReadSmartLightDataParams(); readparam.BrightHWExecType = smartInfo.HwExecTypeValue; readparam.DisplayConfigBase = new DisplaySmartBrightEasyConfigBase(); smartInfo.DisplayHardcareConfig.CopyTo(readparam.DisplayConfigBase); SetLightSensorDeleteSNIndex(readparam.DisplayConfigBase.AutoBrightSetting); _smartLightAccessor.WriteHWSmartLightData(commPort, 0, readparam, WriteSmartLightDataCallBack, smartInfo); _fLogService.Debug("HW:" + CommandTextParser.GetJsonSerialization<ReadSmartLightDataParams>(readparam)); } else { if (smartInfo.DispaySoftWareConfig != null) { if (smartInfo.HwExecTypeValue == BrightnessHWExecType.HardWareControl || smartInfo.AdjustType == BrightAdjustType.Mannual) { _smartBright.SetSmartEnableStatus(smartInfo.ScreenSN, false); _smartBright.DetachSmartBright(smartInfo.ScreenSN); SetSensorData(smartInfo.ScreenSN, null, false); } else { _smartBright.SetSmartEnableStatus(smartInfo.ScreenSN, true); SetLightSensorDeleteSNIndex(smartInfo.DispaySoftWareConfig.AutoBrightSetting); _smartBright.AttachSmartBright(smartInfo.ScreenSN, smartInfo.DispaySoftWareConfig); _fLogService.Debug("Soft:" + CommandTextParser.GetJsonSerialization<DisplaySmartBrightEasyConfig>(smartInfo.DispaySoftWareConfig)); SetSensorData(smartInfo.ScreenSN, smartInfo.DispaySoftWareConfig, true); } } OnNotifyExecResEvent( TransferType.M3_BrightConfigSaveResult, string.Format("{0}|{1}", smartInfo.ScreenSN, true), UpdateCfgFileResType.OK); _fLogService.Info("SetSmartLightConfig:Only SoftWare Success!"); } _fLogService.Info("完成设置亮度到软硬件..."); }
private void ReadSmartLightHWConfigCallBack(ReadSmartLightDataParams smartParam, object userToken) { _fLogService.Info("Read HW Bright Callback Start..."); lock (_lockCallBack) { if (smartParam != null && smartParam.DisplayConfigBase != null && smartParam.DisplayConfigBase.AutoBrightSetting != null && smartParam.DisplayConfigBase.AutoBrightSetting.UseLightSensorList != null && (userToken != null && _dicCallBack.ContainsKey(userToken.ToString()))) { string[] strSN = _dicCallBack[userToken.ToString()].UserToKen.ToString().Split('|'); if (strSN.Length == 2) { foreach (PeripheralsLocation perip in smartParam.DisplayConfigBase.AutoBrightSetting.UseLightSensorList) { perip.CommPort = strSN[0]; perip.FirstSenderSN = strSN[1]; } } } } _fLogService.Info("Read HW Bright Callback For Finish..."); TransFerDataHandlerCallback(TransferType.M3_ReadSmartLightHWConfig, CommandTextParser.GetJsonSerialization<ReadSmartLightDataParams>(smartParam), userToken); }