From 9ef48d7b2da7c408b53f73be0f6eef3cbac1c84a Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 19 十一月 2020 10:23:45 +0800 Subject: [PATCH] Evoyo.Home1.1.0120111601_Release --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs index 96f45ff..8a341c1 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlACZbGatewayUpdateLogic.cs @@ -41,7 +41,7 @@ /// <summary> /// 璁惧瀵硅薄 /// </summary> - private AC deviceAc = null; + private CommonDevice deviceAc = null; /// <summary> /// 鍓嶄竴娆$殑鏈�缁堢姸鎬� /// </summary> @@ -63,7 +63,7 @@ /// </summary> /// <param name="i_deviceAc">璁惧</param> /// <param name="i_deviceFirmware">璁惧鐨勫浐浠朵俊鎭�</param> - public HdlACZbGatewayUpdateLogic(AC i_deviceAc, FirmwareVersionInfo i_deviceFirmware) + public HdlACZbGatewayUpdateLogic(CommonDevice i_deviceAc, FirmwareVersionInfo i_deviceFirmware) { this.ClassDiv = 2; this.deviceAc = i_deviceAc; @@ -172,8 +172,16 @@ await System.Threading.Tasks.Task.Delay(1000); //涓嬭浇鍥轰欢璧勬簮 - var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = this.deviceFirmware.DistributedMark }; - this.deviceFirmwareByte = await Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra))); + if (this.deviceFirmware.ImagType != "-100") + { + var pra = new { RequestVersion = Common.CommonPage.RequestVersion, DistributedMark = this.deviceFirmware.DistributedMark }; + this.deviceFirmwareByte = Common.CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("FirmwareMana/DownloadPlatformUploadFirmware", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra))); + } + else + { + //鍙栨湰鍦版ā鏉� + this.deviceFirmwareByte = HdlFileLogic.Current.ReadFileByteContent(this.deviceFirmware.Name); + } if (this.deviceFirmwareByte == null) { //璁惧鍥轰欢璧勬簮涓嬭浇澶辫触 @@ -212,7 +220,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 +230,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 +244,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 +256,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 +268,7 @@ this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail; this.zbGateway.ReportAction -= receiveAction; //鍙戦�佸け璐ョ粰璁惧 - deviceAc.SendFinishAsync(1); + HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1); return; } @@ -278,7 +286,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 +306,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湪鍗囩骇鈥� @@ -372,7 +380,7 @@ this.UpdateStatu = UpdateStatuMode.DeviceUpdateFail; this.zbGateway.ReportAction -= receiveAction; //鍙戦�佸け璐ョ粰璁惧 - deviceAc.SendFinishAsync(1); + HdlDeviceAirConditionerLogic.Current.SendFinishAsync(deviceAc, 1); return; } await System.Threading.Tasks.Task.Delay(50); @@ -398,9 +406,9 @@ } } //鍙戦�侀�忎紶鏁版嵁 - 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; @@ -421,7 +429,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