From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs | 56 +++++++++++++++++++++++++------------------------------- 1 files changed, 25 insertions(+), 31 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs index b6ef03e..0420de5 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceUpdateLogic.cs @@ -8,7 +8,7 @@ /// <summary> /// HDL璁惧鍗囩骇鐨勯�昏緫 /// </summary> - public class HdlDeviceUpdateLogic + public class HdlDeviceUpdateLogic : HdlDeviceUpdateCommonLogic { #region 鈻� 鍙橀噺澹版槑___________________________ @@ -19,6 +19,7 @@ /// <para> 0:鏇存柊鐘舵�佹甯稿彉鍖�,鍚庨潰鐨勫�间负鐘舵�佸彉鏇寸殑鏂囨湰缈昏瘧</para> /// <para> 1:鍗囩骇鎴愬姛</para> /// <para> 2:涓诲姩缁堟鍗囩骇</para> + /// <para> 3:浠庣瓑寰呬腑鍙栨秷(鐩墠杩樻病鏈夌敤)</para> /// </summary> public Action<int, string> UpdateStatuChangedEvent = null; /// <summary> @@ -26,17 +27,10 @@ /// </summary> public Action<decimal> ProgressEvent = null; /// <summary> - /// 褰撳墠鎵ц鐨勭姸鎬� - /// </summary> - public UpdateStatuMode UpdateStatu = UpdateStatuMode.None; - /// <summary> /// 璁惧鏂扮増鏈殑鍥轰欢淇℃伅(澶氫釜璁惧鍗囩骇鏃�,搴旇浼氶渶瑕佸叕寮�杩欎釜瀵硅薄) /// </summary> public FirmwareVersionInfo deviceFirmware = null; - /// <summary> - /// 鍗囩骇鏄惁瀹屾垚(鍑虹幇閿欒鏃�,瀹冧篃浼氬彉鎴恡rue) - /// </summary> - public bool IsFinishUpdate = true; + /// <summary> /// 缃戝叧 /// </summary> @@ -64,6 +58,7 @@ /// <param name="i_deviceFirmware">璁惧鐨勫浐浠朵俊鎭�</param> public HdlDeviceUpdateLogic(OTADevice i_otaDevice, FirmwareVersionInfo i_deviceFirmware) { + this.ClassDiv = 2; this.otaDevice = i_otaDevice; this.deviceFirmware = i_deviceFirmware; this.zbGateway = i_otaDevice.Gateway; @@ -88,11 +83,13 @@ if (this.UpdateStatu == UpdateStatuMode.Wait) { //濡傛灉鏄瓑寰呮ā寮忥紝鍐嶆鐐瑰嚮鏃讹紝绉婚櫎鍒楄〃 - if (FirmwareUpdateResourse.dicDeviceUpdateList.ContainsKey(otaDevice.DeviceAddr) == true) + if (FirmwareUpdateResourse.dicUpdateList.ContainsKey(otaDevice.DeviceAddr) == true) { - FirmwareUpdateResourse.dicDeviceUpdateList.Remove(otaDevice.DeviceAddr); + FirmwareUpdateResourse.dicUpdateList.Remove(otaDevice.DeviceAddr); } + //鍙栨秷 this.UpdateStatu = UpdateStatuMode.None; + this.UpdateStatuChangedEvent?.Invoke(3, ""); return; } //濡傛灉瀹冩湁鐘舵�侊紝鍒欒〃绀轰箣鍓嶅畠琚粈涔堥敊璇腑鏂簡 @@ -104,7 +101,7 @@ //杩涘叆绛夊緟妯″紡 this.UpdateStatu = UpdateStatuMode.Wait; - FirmwareUpdateResourse.dicDeviceUpdateList[otaDevice.DeviceAddr] = this; + FirmwareUpdateResourse.dicUpdateList[otaDevice.DeviceAddr] = this; //绛夊緟涓�� this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uWaitting)); @@ -114,9 +111,9 @@ } /// <summary> - /// 寮�濮嬫墽琛屾洿鏂版搷浣� + /// 寮�濮嬫墽琛屾洿鏂版搷浣�(FirmwareUpdateLogic璋冪敤) /// </summary> - public void DoStartUpdate() + public override void DoStartUpdate() { //鐘舵�佸彉鏇� this.IsFinishUpdate = false; @@ -207,7 +204,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (tempZb.CurrentGateWayId != HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)) + if (tempZb.GwId != this.zbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -366,7 +363,7 @@ return; } var tempZb = (ZbGateway)objValue; - if (tempZb.CurrentGateWayId != HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)) + if (tempZb.GwId != this.zbGateway.GwId) { //涓嶆槸鑷繁鐨勭綉鍏虫帹閫侊紝鍒欎笉澶勭悊 return; @@ -415,7 +412,7 @@ /// </summary> /// <param name="statusData"></param> /// <returns></returns> - private bool CheckStatusCode(ZbGatewayData.OTAScheduleResponData statusData) + private bool CheckStatusCode(CommonDevice.OTAScheduleResponData statusData) { if (statusData == null) { @@ -502,7 +499,7 @@ this.UpdateStatuChangedEvent?.Invoke(0, Language.StringByID(R.MyInternationalizationString.uDeviceUpdating)); this.SetProgressValue(0); - FirmwareUpdateResourse.dicDeviceUpdateList[otaDevice.DeviceAddr] = this; + FirmwareUpdateResourse.dicUpdateList[otaDevice.DeviceAddr] = this; //鍚屾杩涘害 this.zbGateway.ReportAction += UpdateDeviceProgress; } @@ -577,20 +574,17 @@ //绉婚櫎浜嬩欢 HdlDeviceImageInfoLogic.Current.RemoveDeviceFirmwareVersionThread(otaDevice); - Application.RunOnMainThread(() => - { - //璁剧疆杩涘害鍊肩洿鎺ヤ负100% - this.ProgressEvent?.Invoke(100); - //鐘舵�佸彉鏇� - this.IsFinishUpdate = true; - //鍗囩骇瀹屾垚 - this.UpdateStatu = UpdateStatuMode.UpdateFinish; + //璁剧疆杩涘害鍊肩洿鎺ヤ负100% + this.ProgressEvent?.Invoke(100); + //鐘舵�佸彉鏇� + this.IsFinishUpdate = true; + //鍗囩骇瀹屾垚 + this.UpdateStatu = UpdateStatuMode.UpdateFinish; - HdlFirmwareUpdateLogic.DoUpdateNextFirmware(); + HdlFirmwareUpdateLogic.DoUpdateNextFirmware(); - //璁惧鍗囩骇鎴愬姛! - this.UpdateStatuChangedEvent?.Invoke(1, Language.StringByID(R.MyInternationalizationString.uDeviceUpdateSuccess)); - }); + //璁惧鍗囩骇鎴愬姛! + this.UpdateStatuChangedEvent?.Invoke(1, Language.StringByID(R.MyInternationalizationString.uDeviceUpdateSuccess)); }); } @@ -734,7 +728,7 @@ /// <summary> /// 閲婃斁缂撳瓨 /// </summary> - public void Dispose() + public override void Dispose() { this.ProgressEvent = null; this.UpdateStatuChangedEvent = null; -- Gitblit v1.8.0