From 627093aca723d4bfb971b97c828e8b3a22dbda78 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 17 七月 2020 17:26:19 +0800
Subject: [PATCH] 2020-07-17-1
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs | 74 ++++++++++++++++++++++---------------
1 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs
index edd1c9e..8ff084f 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs
@@ -114,22 +114,29 @@
#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);
@@ -138,14 +145,15 @@
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;
}
@@ -155,22 +163,29 @@
#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);
@@ -179,14 +194,15 @@
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;
}
@@ -248,18 +264,17 @@
if (topic == gatewayID + "/" + "ZbDataPassthrough")
{
- var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
- gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+ var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
- if (gatewayTemp.clientDataPassthroughResponseData == null)
+ if (clientDataPassthroughResponseData == null)
{
result = new ReadACFirewareVersionResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
}
else
{
- if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+ if (clientDataPassthroughResponseData?.PassData != null)
{
- var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+ var data = clientDataPassthroughResponseData.PassData;
var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
if (command == "0259")
{
@@ -412,18 +427,17 @@
if (topic == gatewayID + "/" + "ZbDataPassthrough")
{
- var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") };
- gatewayTemp.clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
+ var clientDataPassthroughResponseData = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ClientDataPassthroughResponseData>(jobject["Data"].ToString());
- if (gatewayTemp.clientDataPassthroughResponseData == null)
+ if (clientDataPassthroughResponseData == null)
{
result = new ResponseAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" };
}
else
{
- if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null)
+ if (clientDataPassthroughResponseData?.PassData != null)
{
- var data = gatewayTemp.clientDataPassthroughResponseData.PassData;
+ var data = clientDataPassthroughResponseData.PassData;
var command = data[4].ToString() + data[5].ToString() + data[2].ToString() + data[3].ToString();
if (command == "025b")
{
--
Gitblit v1.8.0