private void SendBlueBright(ILEDDisplayInfo displayInfo, int blueBright) { List<ScreenPortAddrInfo> addrList; displayInfo.GetScreenPortAddrInfo(out addrList); for (int i = 0; i < addrList.Count; i++) { ScreenPortAddrInfo info = addrList[i]; PackageRequestWriteData writePack = TGProtocolParser.SetBlueBrightness(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, "SetBlueBrightness", false, blueBright, null, CompleteRequestDealing); _serverProxy.SendRequestWriteData(writePack); } }
private void SendCurrentGain(ILEDDisplayInfo displayInfo, int redGain, int greenGain, int blueGain) { if (_chipConfig == null) { return; } #region 获取要发送的数据 ChipRegistorConfigBase chipConfig = _chipConfig; int registor = 0; float curGainPercent = 0; GetRegistorGainFromStep(_curChipInfo, redGain, out registor, out curGainPercent); chipConfig.RedGain = (byte)registor; GetRegistorGainFromStep(_curChipInfo, greenGain, out registor, out curGainPercent); chipConfig.GreenGain = (byte)registor; GetRegistorGainFromStep(_curChipInfo, blueGain, out registor, out curGainPercent); chipConfig.BlueGain = (byte)registor; GetRegistorGainFromStep(_curChipInfo, redGain, out registor, out curGainPercent); chipConfig.VRedGain = (byte)registor; byte[] sendData = chipConfig.ToBytes(); #endregion #region 发送数据 List<ScreenPortAddrInfo> addrList; displayInfo.GetScreenPortAddrInfo(out addrList); for (int i = 0; i < addrList.Count; i++) { ScreenPortAddrInfo info = addrList[i]; PackageRequestWriteData writeDataPack = null; if (!chipConfig.IsExtendCfgCmd) { writeDataPack = TGProtocolParser.SetConfigRegister(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, "SetCurrentGain", false, sendData, null, CompleteRequestDealing); } else { writeDataPack = TGProtocolParser.SetConfigRegisterWriteType2(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, "SetCurrentGain", false, sendData, null, CompleteRequestDealing); } _serverProxy.SendRequestWriteData(writeDataPack); } #endregion }
private void SendGlobalBright(ILEDDisplayInfo displayInfo, int globalBright) { List<ScreenPortAddrInfo> addrList; displayInfo.GetScreenPortAddrInfo(out addrList); //if (!ChipInherentProperty.IsPWMChip(_scanBdProp.StandardLedModuleProp.DriverChipType)) //{ // #region 将低灰模式表按亮度由低到高排序 // LowBrightnessTable lowBrightTable = HWAccessorCalculator.GetUseableLowBrightTable(_scanBdProp, _senderProp); // lowBrightTable.LowBrightInfoList.Sort(delegate(OneLowBrightnessInfo first, OneLowBrightnessInfo second) // { // if (first.BrightnessEfficiency > second.BrightnessEfficiency) // { // return 1; // } // else if (first.BrightnessEfficiency < second.BrightnessEfficiency) // { // return -1; // } // else // { // return 0; // } // }); // #endregion // #region 根据亮度获取要使用的模式表 // int count = lowBrightTable.LowBrightInfoList.Count; // float maxBrightEf = lowBrightTable.LowBrightInfoList[count - 1].BrightnessEfficiency; // float curBrightEf = globalBright / 255.0f * maxBrightEf; // OneLowBrightnessInfo oneInfo = null; // for (int i = 0; i < count; i++) // { // if (curBrightEf > lowBrightTable.LowBrightInfoList[i].BrightnessEfficiency) // { // continue; // } // oneInfo = lowBrightTable.LowBrightInfoList[i]; // } // #endregion //} for (int i = 0; i < addrList.Count; i++) { ScreenPortAddrInfo info = addrList[i]; PackageRequestWriteData writePack = TGProtocolParser.SetGlobalBrightness(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, "SetGlobalBrightness", false, globalBright, null, CompleteRequestDealing); _serverProxy.SendRequestWriteData(writePack); } }
private void SendGamma(ILEDDisplayInfo displayInfo, int gammaValue, bool isCustomGamma, ScreenQuality screenDisplayQuality, GammaABMode gammaABMode) { bool isContrastStrength = false; bool isModeB = false; if (screenDisplayQuality == ScreenQuality.Enhance) { isContrastStrength = true; } if (gammaABMode == GammaABMode.GammaB) { isModeB = true; } //这里的gammaValue是没有添加上自定义信息之前的gamma SaveToGammaTable(gammaValue, isContrastStrength, isModeB); byte sendGamma = CustomTransform.LogicalGammaToRealGamma((byte)gammaValue, isCustomGamma, isContrastStrength, isModeB); List<ScreenPortAddrInfo> addrList; displayInfo.GetScreenPortAddrInfo(out addrList); for (int i = 0; i < addrList.Count; i++) { ScreenPortAddrInfo info = addrList[i]; PackageRequestWriteData writePack = TGProtocolParser.SetGamma(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, "SetGamma", false, sendGamma, null, CompleteRequestDealing); _serverProxy.SendRequestWriteData(writePack); PackageRequestWriteFile writeFilePack = TGProtocolParser.SetRedGammaTable(SelectedPort, info.SenderIndex, info.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYFILE_TIMEOUT, "SetRedGammaTable", false, ConstValue.TEMP_GAMMA_FILE, 0, null, null); _serverProxy.SendRequestWriteFile(writeFilePack); } }
private void SetNormalScreen(TransferType transType, string commPort, ILEDDisplayInfo led, byte value, object userToken) { ReadMonitorDataErrType res = IsExcute(); if (res != ReadMonitorDataErrType.OK) { TransFerDataHandlerCallback(transType, "false", userToken); return; } List<ScreenPortAddrInfo> list = null; led.GetScreenPortAddrInfo(out list); if (list == null || list.Count == 0) { TransFerDataHandlerCallback(transType, "false", userToken); return; } TransFerDataHandlerCallback(transType, "true", userToken); }
private void SetBlackScreen(TransferType transType, string commPort, ILEDDisplayInfo led, byte value, object userToken) { ReadMonitorDataErrType res = IsExcute(); if (res != ReadMonitorDataErrType.OK) { TransFerDataHandlerCallback(transType, "false", userToken); return; } List<ScreenPortAddrInfo> list = null; led.GetScreenPortAddrInfo(out list); if (list == null || list.Count == 0) { TransFerDataHandlerCallback(transType, "false", userToken); return; } TransFerDataHandlerCallback(transType, "true", userToken); //PackageRequestWriteData writeDataPack = null; //foreach (ScreenPortAddrInfo screen in list) //{ // writeDataPack = TGProtocolParser.SetKillMode(commPort, // screen.SenderIndex, // screen.PortIndex, // SystemAddress.SCANBOARD_BROADCAST_ADDRESS, // CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, // "KillBlackScreen", // false, // value, // null, CompleteControlRequst); // //new CompletePackageRequestEventHandler(CompleteScreenControlRequst)); // writeDataPack.UserToken=userToken; // _serverProxy.SendRequestWriteData(writeDataPack); //} }
private void SendBrightToHW(string comName, ILEDDisplayInfo scrInfo, byte bright) { List<ScreenPortAddrInfo> portList; scrInfo.GetScreenPortAddrInfo(out portList); _isWrightDataOK = true; for (int i = 0; i < portList.Count; i++) { string tag = "SendBrightToHW"; if (i == portList.Count - 1) { tag = "SendBrightToHW_Complete"; } ScreenPortAddrInfo addrInfo = portList[i]; _fLogService.Info(string.Format("设置串口:{0},发送卡:{1},网口:{2},亮度:{3}", comName, addrInfo.SenderIndex, addrInfo.PortIndex, bright)); PackageRequestWriteData dataPack = TGProtocolParser.SetGlobalBrightness(comName, addrInfo.SenderIndex, addrInfo.PortIndex, SystemAddress.SCANBOARD_BROADCAST_ADDRESS, CommandTimeOut.SENDER_SIMPLYCOMMAND_TIMEOUT, tag, false, bright, null, CompletedSetBrightness); _serverProxy.SendRequestWriteData(dataPack); } }