File was renamed from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs |
| | |
| | | using System.Threading.Tasks; |
| | | using Newtonsoft.Json.Linq; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | namespace Shared.Phone |
| | | { |
| | | /// <summary> |
| | | /// 干接点的逻辑 |
| | |
| | | Panel.KeyNum keyNum = (Panel.KeyNum)panel.DeviceEpoint; |
| | | var result = this.GetPanelColorInfoAsync(panel, keyNum); |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | Panel.KeyNum keyNum = (Panel.KeyNum)panel.DeviceEpoint; |
| | | var result = this.GetPanelColorInfoAsync(panel, keyNum); |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | //这里特殊,这里是按回路分的 |
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyNum); |
| | | return HdlTemplateDeviceDataLogic.Current.GetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyNum); |
| | | } |
| | | //发送数据 keyNum转为16进制 范围:01~10 |
| | | var passData = "0504040101" + Convert.ToString((int)keyNum, 16).ToUpper().PadLeft(2, '0'); |
| | |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | //这个也是特殊,按回路来分 |
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, null); |
| | | } |
| | | //获取配置按键指示灯颜色的命令字符 |
| | | var sendData = this.GetPanelColorCommandText(device.DeviceAddr, keyColorData, keyNumStatus); |
| | |
| | | tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); |
| | | |
| | | //添加缓存 |
| | | TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, result.JsonData[0]); |
| | | |
| | | return new CommonDevice.ResponseAllData { responseData = tempD }; |
| | | } |
| | |
| | | //如果当前是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceLightSettion(device.DeviceAddr, 200); |
| | | return HdlTemplateDeviceDataLogic.Current.GetDeviceLightSettion(device.DeviceAddr, 200); |
| | | } |
| | | //获取发送的命令字符 |
| | | var passData = "050604010101"; |
| | |
| | | //如果当前是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, null); |
| | | } |
| | | //获取修改面板的亮度调节的命令字符 |
| | | var sendData = this.GetPanelLevelCommadText(device.DeviceAddr, directionsLevel, backlightLevel); |
| | |
| | | //设置亮度调节失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetLightRegulationFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowTipMsg(msg); |
| | | return false; |
| | |
| | | } |
| | | |
| | | //修改缓存 |
| | | TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, result.JsonData[0]); |
| | | |
| | | return true; |
| | | } |
| | |
| | | var result = await panel.GetProximitySensorAsync(); |
| | | panel = null; |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | panel = null; |
| | | |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | //接近传感配置失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SetPannelProximityFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowTipMsg(msg); |
| | | return false; |
| | |
| | | panel = null; |
| | | |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | //矫正温度失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.DataCorrectionFailed); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowTipMsg(msg); |
| | | return false; |
| | |
| | | //如果当前住宅是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device.DeviceAddr, 200); |
| | | return HdlTemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device.DeviceAddr, 200); |
| | | } |
| | | //发送命令 |
| | | string passData = "050804010101"; |
| | |
| | | //获取按键面板节能模式信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetPanelEnergyConservationInfoFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | //如果当前是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, null); |
| | | } |
| | | //获取设置设备的节能模式的命令字符 |
| | | var sendData = this.GetDeviceEnergyConservationModeCommandText(device.DeviceAddr, modeEnable, modeTime, level); |
| | |
| | | //节能模式配置失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetEnergyConservationFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowTipMsg(msg); |
| | | return false; |
| | |
| | | } |
| | | |
| | | //修改缓存 |
| | | TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, result.JsonData[0]); |
| | | |
| | | return true; |
| | | } |
| | |
| | | var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(device); |
| | | |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | //获取设备配置信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetDeviceConfigureInfoFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | /// <returns></returns> |
| | | public async Task<List<int>> GetDryContactFunction(Panel panel, int level1 = -1, int level2 = -1, bool reLevel3 = false) |
| | | { |
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(panel); |
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(panel); |
| | | if (dicDryContactFunction.ContainsKey(mainkeys) == false) |
| | | { |
| | | //创建对象 |
| | |
| | | { |
| | | var result = await panel.GetPanelPrivateFunctionsAsync(parameter); |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | //获取按键功能类信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetPanelFunctionInfoFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | { |
| | | var result = HdlDeviceBindLogic.Current.ConfigureHdlKeyValueAsync(panel, (Panel.KeyMode)i_value); |
| | | //共通错误检测 |
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result); |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowErrorMsg(error); |
| | |
| | | //设备属性变更失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceAttributeChangedFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //如果是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device.DeviceAddr, 200); |
| | | return HdlTemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device.DeviceAddr, 200); |
| | | } |
| | | //发送数据 |
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } }; |
| | |
| | | { |
| | | //获取震动反馈配置信息失败 |
| | | string errorMsg = Language.StringByID(R.MyInternationalizationString.uGetVibrationFeedbackSettionFail); |
| | | errorMsg = UserCenterLogic.CombineGatewayTimeOutMsg(errorMsg, null, "回复超时", false); |
| | | errorMsg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(errorMsg, null, "回复超时", false); |
| | | this.ShowTipMsg(errorMsg); |
| | | return null; |
| | | } |
| | |
| | | //如果是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, null); |
| | | } |
| | | //获取编辑面板震动功能的命令字符 |
| | | var sendData = this.GetPanelVibrationCommandText(device.DeviceAddr, datainfo); |
| | |
| | | { |
| | | //设置震动反馈配置信息失败 |
| | | string errorMsg = Language.StringByID(R.MyInternationalizationString.uSetVibrationFeedbackSettionFail); |
| | | errorMsg = UserCenterLogic.CombineGatewayTimeOutMsg(errorMsg, null, "回复超时", false); |
| | | errorMsg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(errorMsg, null, "回复超时", false); |
| | | this.ShowTipMsg(errorMsg); |
| | | return false; |
| | | } |
| | | //添加缓存 |
| | | TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, result.JsonData[0]); |
| | | |
| | | return true; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | private List<int> GetDryContactFunctionFromLocation(Panel panel, int level1 = -1, int level2 = -1) |
| | | { |
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(panel); |
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(panel); |
| | | if (dicDryContactFunction.ContainsKey(mainkeys) == false) |
| | | { |
| | | return null; |
| | |
| | | /// <param name="level2"></param> |
| | | private void SetDryContactFunctionToMemory(Panel panel, List<int> listLevel, int level1, int level2) |
| | | { |
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(panel); |
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(panel); |
| | | if (dicDryContactFunction.ContainsKey(mainkeys) == false) |
| | | { |
| | | //创建对象 |
| | |
| | | /// </summary> |
| | | private void SaveDryContactFunctionToLocaltion() |
| | | { |
| | | HdlFileLogic.Current.SaveFileContent(DirNameResourse.DryContactFunctionFile, dicDryContactFunction); |
| | | HdlFileLogic.Current.SaveFileContent(HdlFileNameResourse.DryContactFunctionFile, dicDryContactFunction); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | private void LoadDryContactFunctionFromLocaltion() |
| | | { |
| | | this.dicDryContactFunction = new Dictionary<string, DryContactFunctionInfo>(); |
| | | byte[] filebyte = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.DryContactFunctionFile); |
| | | byte[] filebyte = HdlFileLogic.Current.ReadFileByteContent(HdlFileNameResourse.DryContactFunctionFile); |
| | | if (filebyte == null) |
| | | { |
| | | return; |