From 4f0ab0ad21ce450b7856d50f98322a7899361386 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 22 九月 2020 10:30:01 +0800
Subject: [PATCH] 不要下载这个备份
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs | 84 ++++++++++++++++++++++++++----------------
1 files changed, 52 insertions(+), 32 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAirConditionerLogic.cs
index edd1c9e..2193c34 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);
+ //鐩存帴娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetAcModeSupport(device, data, null);
+ 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,18 @@
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);
+
+ //娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetAcModeSupport(device, data, result.JsonData[0]);
return true;
}
@@ -155,22 +166,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);
+ //鐩存帴娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetAcSwingModeSupport(device, data, null);
+ 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 +197,18 @@
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);
+
+ //娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetAcSwingModeSupport(device, data, result.JsonData[0]);
return true;
}
@@ -248,18 +270,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 +433,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")
{
@@ -585,7 +605,7 @@
///璇诲彇IRACC妯″潡鍥轰欢鐗堟湰
/// <para>reserve:0-ff</para>
/// </summary>
- public async void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData)
+ public void UpgradeAsync(CommonDevice device, SendUpgradeData upgradeData)
{
var Gateway = device.Gateway;
if (Gateway == null)
@@ -738,7 +758,7 @@
///璇诲彇IRACC妯″潡鍥轰欢鐗堟湰
/// <para>status:0--鎴愬姛;1--澶辫触;ff--鏃犳晥 .</para>
/// </summary>
- public async void SendFinishAsync(CommonDevice device, int status)
+ public void SendFinishAsync(CommonDevice device, int status)
{
var Gateway = device.Gateway;
if (Gateway == null)
--
Gitblit v1.8.0