| | |
| | | #region ■ 设置空调的自定义模式_______________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置空调的自定义模式
|
| | | /// 设置空调的自定义模式 ☆☆☆☆☆
|
| | | /// </summary>
|
| | | /// <param name="device">空调对象</param>
|
| | | /// <param name="data">从二进制转换的十进制值</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> SetAcModeSupport(AC device, int data)
|
| | | public bool SetAcModeSupport(AC device, int data)
|
| | | {
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 513, 4099, 25, data);
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | //如果是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | this.ShowTipMsg(error);
|
| | | //直接添加缓存
|
| | | ModelData.DeviceModelDataLogic.Current.SetAcModeSupport(device, data, "SetWritableValue");
|
| | | return true;
|
| | | }
|
| | | //发送数据
|
| | | string sendData = HdlDeviceAttributeLogic.Current.GetWriteDeviceAttributeText(device.DeviceAddr, device.DeviceEpoint, 513, 4099, 25, data);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "SetWritableValue", sendData, "SetWritableValue_Respon");
|
| | | if (result.ErrorMsg != null)
|
| | | {
|
| | | this.ShowTipMsg(result.ErrorMsg);
|
| | | return false;
|
| | | }
|
| | | if (result == null || result.setWritableValueResponData == null)
|
| | | if (result.ErrorMsgDiv == 0)
|
| | | {
|
| | | //设置空调模式失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAcModeFail);
|
| | |
| | | this.ShowTipMsg(msg); ;
|
| | | return false;
|
| | | }
|
| | | if (result.setWritableValueResponData.Status != 0)
|
| | |
|
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData);
|
| | | if (responeData.Status != 0)
|
| | | {
|
| | | //设置空调模式失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAcModeFail);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A空调自定义模式, data);
|
| | |
|
| | | return true;
|
| | | }
|
| | |
| | | #region ■ 设置启用空调的摆风功能_____________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置启用空调的摆风功能
|
| | | /// 设置启用空调的摆风功能 ☆☆☆☆☆
|
| | | /// </summary>
|
| | | /// <param name="device">空调对象</param>
|
| | | /// <param name="data">从二进制转换的十进制值</param>
|
| | | /// <returns></returns>
|
| | | public async Task<bool> SetUseAcSwingFunctionStatu(AC device, int data)
|
| | | public bool SetUseAcSwingFunctionStatu(AC device, int data)
|
| | | {
|
| | | var result = await HdlDeviceAttributeLogic.Current.WriteDeviceAttribute(device, 514, 4097, 25, data);
|
| | | //检测网关返回的共通错误状态码
|
| | | string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
|
| | | if (error != null)
|
| | | //如果是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | this.ShowTipMsg(error);
|
| | | //直接添加缓存
|
| | | ModelData.DeviceModelDataLogic.Current.SetAcSwingModeSupport(device, data, "SetWritableValue");
|
| | | return true;
|
| | | }
|
| | | //发送数据
|
| | | string sendData = HdlDeviceAttributeLogic.Current.GetWriteDeviceAttributeText(device.DeviceAddr, device.DeviceEpoint, 514, 4097, 25, data);
|
| | | var result = HdlDeviceCommonLogic.Current.SendJobjectDataToGateway(device, "SetWritableValue", sendData, "SetWritableValue_Respon");
|
| | | if (result.ErrorMsg != null)
|
| | | {
|
| | | this.ShowTipMsg(result.ErrorMsg);
|
| | | return false;
|
| | | }
|
| | | if (result == null || result.setWritableValueResponData == null)
|
| | | if (result.ErrorMsgDiv == 0)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | |
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | if (result.setWritableValueResponData.Status != 0)
|
| | |
|
| | | var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.SetWritableValueResponData>(result.ReceiptData);
|
| | | if (responeData.Status != 0)
|
| | | {
|
| | | //设置空调摆风失败
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetAirConditionerSwingFunctionFail);
|
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | await HdlGatewayLogic.Current.UpLoadDeviceBackupDataToGateway(device, GatewayBackupEnum.A空调摆风功能, data);
|
| | |
|
| | | return true;
|
| | | }
|