public BrightnessConfig(SmartLightConfigInfo smartLightConfig)
     : this()
 {
     DisplayUDID = smartLightConfig.ScreenSN;
     //AutoBrightSetting = new AutoBrightnessConfig();
     if (smartLightConfig != null && smartLightConfig.DispaySoftWareConfig != null && smartLightConfig.DispaySoftWareConfig.AutoBrightSetting != null)
     {
         AutoBrightSetting.AutoBrightMappingList = smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList;
         AutoBrightSetting.OpticalFailureInfo    = smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo;
     }
     if (smartLightConfig != null && smartLightConfig.DispaySoftWareConfig != null && smartLightConfig.DispaySoftWareConfig.OneDayConfigList != null)
     {
         OneDayConfigList = smartLightConfig.DispaySoftWareConfig.OneDayConfigList;
     }
     if (smartLightConfig == null ||
         smartLightConfig.DispaySoftWareConfig == null ||
         smartLightConfig.DispaySoftWareConfig.AutoBrightSetting == null ||
         smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList == null ||
         smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList.Count == 0)
     {
         IsSupportAutoBrightness = false;
     }
     else
     {
         IsSupportAutoBrightness = true;
     }
 }
 public BrightnessConfig(SmartLightConfigInfo smartLightConfig)
     : this()
 {
     DisplayUDID = smartLightConfig.ScreenSN;
     //AutoBrightSetting = new AutoBrightnessConfig();
     if (smartLightConfig != null && smartLightConfig.DispaySoftWareConfig != null && smartLightConfig.DispaySoftWareConfig.AutoBrightSetting != null)
     {
         AutoBrightSetting.AutoBrightMappingList = smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList;
         AutoBrightSetting.OpticalFailureInfo = smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo;
     }
     if (smartLightConfig != null && smartLightConfig.DispaySoftWareConfig != null && smartLightConfig.DispaySoftWareConfig.OneDayConfigList != null)
     {
         OneDayConfigList = smartLightConfig.DispaySoftWareConfig.OneDayConfigList;
     }
     if (smartLightConfig == null
         || smartLightConfig.DispaySoftWareConfig == null
         || smartLightConfig.DispaySoftWareConfig.AutoBrightSetting == null
         || smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList == null
         || smartLightConfig.DispaySoftWareConfig.AutoBrightSetting.UseLightSensorList.Count == 0)
     {
         IsSupportAutoBrightness = false;
     }
     else
     {
         IsSupportAutoBrightness = true;
     }
 }
        public frm_OpticalProbeConfig(bool isSoftwareConfig, SmartLightConfigInfo lightConfigInfo)
            : this()
        {
            _lightConfigInfo = lightConfigInfo;
            _isSoftwareConfig = isSoftwareConfig;

            if (_lightConfigInfo == null
                || _lightConfigInfo.DispaySoftWareConfig == null
                || _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting == null
                || _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo == null)
            {
                return;
            }
            if (_isSoftwareConfig)
            {
                enableCheckBox.Checked = _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.IsEnable;
                if (_lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue >= 0 ||
                    _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue <= 100)
                {
                    brightnessNumericUpDown.Value = _lightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue;
                }
            }
            else
            {
                enableCheckBox.Checked = _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.IsEnable;
                if (_lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue >= 0 ||
                    _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue <= 100)
                {
                    brightnessNumericUpDown.Value = _lightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo.BrightnessValue;
                }
            }
        }
 public object Clone()
 {
     SmartLightConfigInfo data = new SmartLightConfigInfo();
     if (!this.CopyTo(data))
     {
         return null;
     }
     return data;
 }
Exemplo n.º 5
0
        public object Clone()
        {
            SmartLightConfigInfo data = new SmartLightConfigInfo();

            if (!this.CopyTo(data))
            {
                return(null);
            }
            return(data);
        }
Exemplo n.º 6
0
        public bool CopyTo(object obj)
        {
            if (!(obj is SmartLightConfigInfo))
            {
                return(false);
            }
            SmartLightConfigInfo config = obj as SmartLightConfigInfo;

            config.DisplayHardcareConfig = new DisplaySmartBrightEasyConfigBase();
            this.DisplayHardcareConfig.CopyTo(config.DisplayHardcareConfig);
            config.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig();
            this.DispaySoftWareConfig.CopyTo(config.DispaySoftWareConfig);
            config.HwExecTypeValue = this.HwExecTypeValue;
            config.ScreenSN        = this.ScreenSN;
            return(true);
        }
Exemplo n.º 7
0
 public BrightnessConfigChangedEventArgs(string sn, SmartLightConfigInfo brightnessValue)
 {
     SN = sn;
     SmartLightConfig = brightnessValue;
 }
Exemplo n.º 8
0
 public bool UpdateSmartBrightEasyConfig(string sn, SmartLightConfigInfo smartLightConfig)
 {
     IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
     //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
     timeConverter.DateTimeFormat = "HH':'mm':'ss";
     //jsonObject是准备转换的对象
     string serializeStr = JsonConvert.SerializeObject(smartLightConfig, Newtonsoft.Json.Formatting.Indented, timeConverter);
     SetSmartLightConfigInfo(serializeStr);
     return SaveSmartLightConfigInfo(sn, serializeStr);
 }
Exemplo n.º 9
0
 public bool SaveSmartLightConfigInfo(string sn, SmartLightConfigInfo smartBrightEasyConfig)
 {
     string serializeStr = JsonConvert.SerializeObject(smartBrightEasyConfig);
     return SaveSmartLightConfigInfo(sn, serializeStr);
 }
Exemplo n.º 10
0
        private void SyncInfoResponse(IRestResponse response)
        {
            if (response.ResponseStatus == ResponseStatus.Completed)
            {
                try
                {
                    var syncInfoResponse = JsonConvert.DeserializeObject<SyncInformation>(response.Content);
                    if (syncInfoResponse == null || syncInfoResponse.SyncDatas == null)
                        return;
                    var currentSyncInfo = _syncInformationManager.GetSyncInformation(syncInfoResponse.Sn);

                    foreach (var syncInfo in syncInfoResponse.SyncDatas)
                    {
                        if (syncInfo.SyncParam == SyncFlag.TerminalNotSynchronized)
                        {
                            _logService.Debug(string.Format("<-{0}|{1}->:{2}", "SyncInfoResponse", SyncFlag.TerminalNotSynchronized, syncInfo.SyncContent));
                            var currentSyncData = currentSyncInfo.SyncDatas.FirstOrDefault(d => d.SyncType == syncInfo.SyncType);
                            if (currentSyncData != null)
                            {
                                currentSyncInfo.SyncDatas.Remove(currentSyncData);
                            }
                            currentSyncInfo.SyncDatas.Add(syncInfo);
                            if (syncInfo.SyncType == SyncType.AlarmConfig)
                            {
                                SaveLedAlarmConfig(syncInfoResponse.Sn.Split(new char[] { '+' })[1], syncInfo.SyncContent, long.Parse(syncInfo.Datestamp));
                                var alarmConfig = JsonConvert.DeserializeObject<LedAlarmConfig>(syncInfo.SyncContent);
                                alarmConfig.SN = syncInfoResponse.Sn.Split(new char[] { '+' })[1];
                                if (AlarmConfigSynchronized != null)
                                {
                                    AlarmConfigSynchronized(this, new AlarmConfigSynchronizedEventArgs(alarmConfig));
                                }
                            }
                            else if (syncInfo.SyncType == SyncType.PeriodicInspectionConfig)
                            {
                                if (SavePeriodicInspectionConfig(syncInfoResponse.Sn.Split(new char[] { '+' })[1], syncInfo.SyncContent, long.Parse(syncInfo.Datestamp)))
                                {
                                    SetPeriodicInspectionConfig(syncInfoResponse.Sn.Split(new char[] { '+' })[1], syncInfo.SyncContent);
                                }
                            }
                            else if (syncInfo.SyncType == SyncType.BrightnessRuleConfig)
                            {
                                SmartLightConfigInfo smartLightConfigInfo = new SmartLightConfigInfo();
                                var brightnessRuleConfig = JsonConvert.DeserializeObject<BrightnessConfig>(syncInfo.SyncContent);
                                string sn = syncInfoResponse.Sn.Split(new char[] { '+' })[1];
                                List<ConfigInfo> configInfoList = MonitorDataAccessor.Instance().GetLightProbeCfg(sn);//读取当前库中的屏亮度配置

                                if (configInfoList.Count == 0)
                                {
                                    smartLightConfigInfo.ScreenSN = sn;
                                    smartLightConfigInfo.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig();
                                    smartLightConfigInfo.DispaySoftWareConfig.DisplayUDID = sn;
                                    smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting = new AutoBrightExtendData();

                                    smartLightConfigInfo.DisplayHardcareConfig = new DisplaySmartBrightEasyConfigBase();
                                    smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting = new AutoBrightExtendData();

                                    if (brightnessRuleConfig.AutoBrightSetting == null)
                                    {
                                        brightnessRuleConfig.AutoBrightSetting = new AutoBrightnessConfig();
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                    }
                                    else
                                    {
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        if (smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList != null)
                                        {
                                            smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList.Sort(CompareBrightnessByValue);
                                        }
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        if (smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList != null)
                                        {
                                            smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList.Sort(CompareBrightnessByValue);
                                        }
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                    }

                                    if (brightnessRuleConfig.OneDayConfigList == null)
                                    {
                                        brightnessRuleConfig.OneDayConfigList = new List<OneSmartBrightEasyConfig>();
                                        smartLightConfigInfo.DispaySoftWareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                        smartLightConfigInfo.DisplayHardcareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                    }
                                    else
                                    {
                                        brightnessRuleConfig.OneDayConfigList.Sort(CompareBrightnessByTime);
                                        smartLightConfigInfo.DispaySoftWareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                        smartLightConfigInfo.DisplayHardcareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                    }

                                }
                                else
                                {
                                    smartLightConfigInfo = JsonConvert.DeserializeObject<SmartLightConfigInfo>(configInfoList[0].Content);

                                    if (smartLightConfigInfo.DispaySoftWareConfig == null)
                                    {
                                        smartLightConfigInfo.DispaySoftWareConfig = new DisplaySmartBrightEasyConfig();
                                    }
                                    if (smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting == null)
                                    {
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting = new AutoBrightExtendData();
                                    }
                                    if (smartLightConfigInfo.DisplayHardcareConfig == null)
                                    {
                                        smartLightConfigInfo.DisplayHardcareConfig = new DisplaySmartBrightEasyConfigBase();
                                    }
                                    if (smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting == null)
                                    {
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting = new AutoBrightExtendData();
                                    }

                                    if (brightnessRuleConfig.AutoBrightSetting == null)
                                    {
                                        brightnessRuleConfig.AutoBrightSetting = new AutoBrightnessConfig();
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                    }
                                    else
                                    {
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        if (smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList != null)
                                        {
                                            smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.AutoBrightMappingList.Sort(CompareBrightnessByValue);
                                        }
                                        smartLightConfigInfo.DispaySoftWareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList = brightnessRuleConfig.AutoBrightSetting.AutoBrightMappingList;
                                        if (smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList != null)
                                        {
                                            smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.AutoBrightMappingList.Sort(CompareBrightnessByValue);
                                        }
                                        smartLightConfigInfo.DisplayHardcareConfig.AutoBrightSetting.OpticalFailureInfo = brightnessRuleConfig.AutoBrightSetting.OpticalFailureInfo;
                                    }

                                    if (brightnessRuleConfig.OneDayConfigList == null)
                                    {
                                        brightnessRuleConfig.OneDayConfigList = new List<OneSmartBrightEasyConfig>();
                                        smartLightConfigInfo.DispaySoftWareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                        smartLightConfigInfo.DisplayHardcareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                    }
                                    else
                                    {
                                        brightnessRuleConfig.OneDayConfigList.Sort(CompareBrightnessByTime);
                                        smartLightConfigInfo.DispaySoftWareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                        smartLightConfigInfo.DisplayHardcareConfig.OneDayConfigList = brightnessRuleConfig.OneDayConfigList;
                                    }
                                    smartLightConfigInfo.DispaySoftWareConfig.DisplayUDID = sn;

                                }
                                smartLightConfigInfo.AdjustType = BrightAdjustType.Smart;
                                string configJson = JsonConvert.SerializeObject(smartLightConfigInfo);
                                if (SaveSmartLightConfigInfo(syncInfoResponse.Sn.Split(new char[] { '+' })[1], configJson, long.Parse(syncInfo.Datestamp)))
                                {
                                    _logService.Debug(string.Format("<-{0}->:ThreadID={1}", "SyncInfoResponse", System.Threading.Thread.GetDomainID().ToString()));
                                    _syncInformationManager.UpdateSyncData(syncInfoResponse.Sn, syncInfo);
                                    SetSmartLightConfigInfo(configJson);
                                    var brightnessConfigList = new List<SmartLightConfigInfo>() { smartLightConfigInfo };
                                    string configListJson = JsonConvert.SerializeObject(brightnessConfigList);
                                    SetBrightnessConfigToLCT(configListJson);
                                    if (BrightnessConfigChanged != null)
                                    {
                                        BrightnessConfigChanged(this, new BrightnessConfigChangedEventArgs(sn, smartLightConfigInfo));
                                    }
                                }
                            }
                        }
                        else if (syncInfo.SyncParam == SyncFlag.CareNotSynchronized)
                        {
                            _logService.Debug(string.Format("<-{0}|{1}->:{2}", "SyncInfoResponse", SyncFlag.CareNotSynchronized, syncInfo.SyncContent));
                            var currentSyncData = currentSyncInfo.SyncDatas.FirstOrDefault(d => d.SyncType == syncInfo.SyncType);
                            RestFulClient.Instance.Post("api/SyncInfo/index", currentSyncData.SyncContent, null);
                        }
                    }

                }
                catch (System.Net.WebException ex)
                {
                    _logService.Error(string.Format("ExistCatch:<-{0}->:{1}", "SyncInfoResponse.Net", ex.ToString()));
                }
                catch (Exception ex)
                {
                    _logService.Error(string.Format("ExistCatch:<-{0}->:{1}", "SyncInfoResponse", ex.ToString()));
                }
                finally
                {
                    _sem.Release();
                }
                _logService.Debug(string.Format("ExistCatch:<-{0}->:{1}", "SyncInfoResponse", "自动同步已完成"));
            }
            else
            {
                _logService.Error(string.Format("<-{0}->:{1}", "SyncInfoResponse.else", response.Content));
                _sem.Release();
            }
        }
Exemplo n.º 11
0
        public bool SaveBrightnessConfig(SmartLightConfigInfo config, bool isSave)
        {
            bool res = false;
            if (isSave == false)
            {
                _fLogService.Info("开始测试保存亮度的配置...");
                DataDispatcher.ClientDispatcher.Instance.SetSmartLightConfigInfo(
                    CommandTextParser.GetJsonSerialization<SmartLightConfigInfo>(config));
                _fLogService.Info("完成测试保存亮度的配置...");
                return true;
            }

            List<SmartLightConfigInfo> configList = new List<SmartLightConfigInfo>();
            if (_brightnessConfigList != null)
            {
                foreach (var item in _brightnessConfigList)
                {
                    configList.Add((SmartLightConfigInfo)item.Clone());
                }
            }
            if (configList == null)
            {
                configList = new List<SmartLightConfigInfo>();
                configList.Add(config);
            }
            else
            {
                int index = configList.FindIndex(a => a.ScreenSN == config.ScreenSN);
                if (index < 0)
                    configList.Add(config);
                else configList[index] = config;
            }
            _fLogService.Info("开始保存亮度的配置...");
            res = DataDispatcher.ClientDispatcher.Instance.UpdateSmartBrightEasyConfig(config.ScreenSN, config);
            if (res)
            {
                _brightnessConfigList = configList;
            }
            _fLogService.Info("完成保存亮度的配置...");
            return res;
        }
Exemplo n.º 12
0
 public bool SaveBrightnessConfig(SmartLightConfigInfo config)
 {
     return SaveBrightnessConfig(config, true);
 }
Exemplo n.º 13
0
        private void TransFerParamsDataHandlerCallBack(TransferParams param, object userToken)
        {
            switch (param.TranType)
            {
                case TransferType.M3_PeripheralsInfo:
                    WriteLog("返回光探头数据");
                    _fLogService.Info("返回光探头数据");
                    SendData("UpdateOpticalProbeInfo", param.Content);
                    break;
                case TransferType.M3_FunctionCardMonitor:
                    WriteLog("返回多功能卡信息");
                    _fLogService.Info("返回多功能卡信息");
                    SendData("UpdateFunctionCardInfo", param.Content);
                    break;
                case TransferType.M3_ReadSmartLightHWConfig:
                    WriteLog("返回硬件亮度配置信息");
                    _fLogService.Info("返回硬件亮度配置信息");
                    SmartLightConfigInfo smartLight = new SmartLightConfigInfo();
                    ReadSmartLightDataParams smartparam = CommandTextParser.GetDeJsonSerialization<ReadSmartLightDataParams>(param.Content);
                    smartLight.DisplayHardcareConfig = smartparam.DisplayConfigBase;
                    smartLight.HwExecTypeValue = smartparam.BrightHWExecType;
                    smartLight.ScreenSN = userToken.ToString().Split('|')[1];
                    if (!_dicHwBrightConfig.ContainsKey(userToken.ToString().Split('|')[0]))
                    {
                        _dicHwBrightConfig.Add(userToken.ToString().Split('|')[0], smartparam);
                    }

                    _autoResetHWEvent.Set();
                    SendData("ReadSmartLightHWconfigInfo", CommandTextParser.GetJsonSerialization<SmartLightConfigInfo>(smartLight));
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 14
0
 public BrightnessConfigChangedEventArgs(string sn, SmartLightConfigInfo brightnessValue)
 {
     SN = sn;
     SmartLightConfig = brightnessValue;
 }