From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs | 49 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
index d137ebb..d243082 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs
@@ -212,7 +212,7 @@
this.zbGateway.ReportAction += receiveAction;
//璇诲彇绌鸿皟妯″潡鐗堟湰
- var result = await deviceAc.ReadACFirewareVersionAsync();
+ var result = await HdlDeviceAirConditionerLogic.Current.ReadACFirewareVersionAsync(deviceAc);
if (result == null || result.readACFirewareVersionResponData == null || result.readACFirewareVersionResponData.Status != 0)
{
//鑾峰彇绌鸿皟妯″潡鐗堟湰澶辫触
@@ -222,11 +222,11 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
//鍙戦�佸崌绾ч�氱煡
- var result2 = await deviceAc.UpggradeACNotificationAsync(result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
+ var result2 = await HdlDeviceAirConditionerLogic.Current.UpggradeACNotificationAsync(deviceAc, result.readACFirewareVersionResponData.FirewareVersion, this.deviceFirmwareByte.Length);
if (result2.responseData == null)
{
//鍙戦�佸崌绾у懡浠ゅけ璐�
@@ -236,7 +236,7 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
else if (result2.responseData.status == 1)
@@ -248,7 +248,7 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
else if (result2.responseData.status != 0)
@@ -260,7 +260,7 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
@@ -278,7 +278,7 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
await System.Threading.Tasks.Task.Delay(1000);
@@ -298,7 +298,7 @@
/// <summary>
/// 鎵ц璁惧鍗囩骇鎿嶄綔
/// </summary>
- private async void DoSetUpdateDevice(string i_offset,int i_dataLength)
+ private async void DoSetUpdateDevice(string i_offset, int i_dataLength)
{
this.UpdateStatu = UpdateStatuMode.DeviceUpdateReady;
//璁惧姝e湪鍗囩骇鈥�
@@ -312,6 +312,8 @@
int startIndex = 0;
int allDataLength = this.deviceFirmwareByte.Length;
int timeOut = 0;
+ //鏄惁鎺ユ敹鍒版垚鍔熷懡浠�
+ bool receiveSuccess = false;
//鎺ユ敹缃戝叧鐨勯�忎紶鏁版嵁
bool hadReceive = true;
@@ -338,14 +340,26 @@
//璁剧疆杩涘害鍊�
this.SetProgressValue(startIndex, allDataLength);
}
+ else if (command == "025e")
+ {
+ //鎴愬姛 璁剧疆杩涘害鍊肩洿鎺�100%
+ this.SetProgressValue(allDataLength, allDataLength);
+ receiveSuccess = true;
+ timeOut = 0;
+ }
}
catch { }
};
this.zbGateway.ReportAction += receiveAction;
//鏈�鍚庝竴娆¢渶瑕佺瓑寰呭洖澶嶇粨鏋滄墠寰�涓嬭蛋
- while (startIndex < allDataLength || hadReceive == false)
+ while (startIndex < allDataLength)
{
+ if (receiveSuccess == true)
+ {
+ //宸茬粡鎺ユ敹鍒版垚鍔熺殑鍛戒护
+ break;
+ }
if (hadReceive == false)
{
timeOut++;
@@ -358,13 +372,20 @@
this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail;
this.zbGateway.ReportAction -= receiveAction;
//鍙戦�佸け璐ョ粰璁惧
- deviceAc.SendFinishAsync(1);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1);
return;
}
await System.Threading.Tasks.Task.Delay(50);
continue;
}
hadReceive = false;
+ //鍥犱负鍋忕Щ閲忔槸楂樹綅鍦ㄥ墠锛屾墍浠ュ�掕繃鏉�
+ string Myoffset = string.Empty;
+ for (int i = 6; i >= 0; i = i - 2)
+ {
+ Myoffset += i_offset.Substring(i, 2);
+ }
+ startIndex = Convert.ToInt32(Myoffset, 16) - i_dataLength;
//鑾峰彇涓�娆¤兘澶熷彂閫佺殑byte
var listData = new List<byte>();
@@ -373,15 +394,13 @@
listData.Add(this.deviceFirmwareByte[startIndex]);
if (listData.Count == i_dataLength)
{
- //寰�涓嬩竴浣嶆帹绉�
- startIndex++;
break;
}
}
//鍙戦�侀�忎紶鏁版嵁
- var sendData = new AC.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
+ var sendData = new HdlDeviceAirConditionerLogic.SendUpgradeData() { dataLength = i_dataLength, offset = i_offset };
sendData.databytes = listData.ToArray();
- deviceAc.UpgradeAsync(sendData);
+ HdlDeviceAirConditionerLogic.Current.UpgradeAsync(deviceAc, sendData);
}
this.zbGateway.ReportAction -= receiveAction;
@@ -402,7 +421,7 @@
this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uSendingFinishUpdateComand));
//鍙戦�佹垚鍔熷懡浠ょ粰璁惧
- deviceAc.SendFinishAsync(0);
+ HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 0);
//绛変釜涓ょ閽熷惂
await System.Threading.Tasks.Task.Delay(2000);
--
Gitblit v1.8.0