| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared.Phone.TemplateData; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | //添加缓存 |
| | | TemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, null); |
| | | HdlTemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, null); |
| | | return true; |
| | | } |
| | | //获取发送的命令字符 |
| | |
| | | return false; |
| | | } |
| | | //添加缓存 |
| | | TemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetCurtainHandPullControl(device, bolStatu, result.JsonData[0]); |
| | | |
| | | return true; |
| | | } |
| | |
| | | //如果当前是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, null); |
| | | } |
| | | //获取编辑窗帘方向的命令字符 |
| | | var sendData = this.GetCurtainDirectionCommadText(device.DeviceAddr, device.DeviceEpoint, isDirectionReversed); |
| | |
| | | } |
| | | |
| | | //添加缓存 |
| | | TemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetCurtainDirection(device, isDirectionReversed, result.JsonData[0]); |
| | | |
| | | var tempData = JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData); |
| | | return new CommonDevice.SetWritableValueResponAllData { setWritableValueResponData = tempData }; |
| | |
| | | //如果当前是虚拟住宅 |
| | | if (Common.Config.Instance.Home.IsVirtually == true) |
| | | { |
| | | return TemplateData.TemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, null); |
| | | return HdlTemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, null); |
| | | } |
| | | //获取编辑开合帘限位的命令字符 |
| | | var sendData = this.GetAutoOpenCurtainLimitPointCommandText(rollershade.DeviceAddr, rollershade.DeviceEpoint, upLimit, downLimit); |
| | |
| | | } |
| | | |
| | | //添加缓存 |
| | | TemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, result.JsonData[0]); |
| | | HdlTemplateDeviceDataLogic.Current.SetCurtainLimitPoint(rollershade, upLimit, downLimit, curtainLength, result.JsonData[0]); |
| | | |
| | | return true; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="rollershade">窗帘对象</param> |
| | | /// <returns></returns> |
| | | public async Task<bool> RestoreCurtain(Rollershade rollershade) |
| | | public async Task<bool> RestoreCurtain(Rollershade rollershade, ShowErrorMode showError = ShowErrorMode.YES) |
| | | { |
| | | var result = await rollershade.RestoreCurtainLimitAsync(); |
| | | //检测网关返回的共通错误状态码 |
| | | string error = HdlCheckLogic.Current.CheckGatewayErrorCode(result); |
| | | if (error != null) |
| | | { |
| | | this.ShowTipMsg(error); |
| | | if (showError == ShowErrorMode.YES) |
| | | { |
| | | this.ShowTipMsg(error); |
| | | } |
| | | return false; |
| | | } |
| | | if (result == null || result.setWritableValueResponData == null) |
| | |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | this.ShowTipMsg(msg); |
| | | if (showError == ShowErrorMode.YES) |
| | | { |
| | | this.ShowTipMsg(msg); |
| | | } |
| | | return false; |
| | | } |
| | | if (result.setWritableValueResponData.Status != 0) |
| | | { |
| | | //重置窗帘失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRestoreCurtainFail); |
| | | this.ShowTipMsg(msg); |
| | | if (showError == ShowErrorMode.YES) |
| | | { |
| | | this.ShowTipMsg(msg); |
| | | } |
| | | return false; |
| | | } |
| | | return true; |