From 20f70e3446df19bf5d0faaae9f7bd58fd0fc4bcc Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 04 八月 2023 12:06:51 +0800
Subject: [PATCH] 轮询备份
---
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ManualUpgradeDialog.cs | 44 +++++++++++---------------------------------
1 files changed, 11 insertions(+), 33 deletions(-)
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ManualUpgradeDialog.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ManualUpgradeDialog.cs
index ee0f157..730861d 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ManualUpgradeDialog.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ManualUpgradeDialog.cs
@@ -14,20 +14,6 @@
bodyView = this;
}
- public static void UpdataInfo(byte inId,byte devId)
- {
- Application.RunOnMainThread (() => {
- if (bodyView == null) {
- return;
- }
- bodyView.subnetId = inId;
- if (devId > 0) {
- return;
- }
- });
- }
-
-
public void ShowDialog ()
{
@@ -67,7 +53,7 @@
Y = Application.GetRealHeight (20),
Width = Application.GetRealWidth (400),
Height = Application.GetRealHeight (80),
- Text = "姝e湪绛夊緟缃戝叧鍗囩骇",
+ Text = "Waiting for gateway upgrade",
TextAlignment = TextAlignment.CenterLeft,
TextColor = SkinStyle.Current.TextColor,
};
@@ -121,43 +107,35 @@
arrayTemp [3] = Convert.ToByte (upgradeData.Count & 0xFF);
-
while (true) {
var ub = MainPage.GatewayStatus.Split ("_");
- if (ub.Length > 3) {
- subnetId = Convert.ToByte( ub [2]);
- }
- if(subnetId == 0) {
- System.Threading.Thread.Sleep (100);
- continue;
- }
if (ub.Length > 1) {
result = Convert.ToInt32 (ub [1]);
- //if (result < result0 && result0 < 100)
{
- //result = result0;
Application.RunOnMainThread (() => {
- btnTipMsg.Text = "姝e湪鍗囩骇缃戝叧 " + result + "/" + upgradeData.Count;
+ btnTipMsg.Text = "Upgrading gateway " + result + "/" + upgradeData.Count;
});
}
+ }
+ if (ub.Length > 3) {
+ byte.TryParse (ub [2], out subnetId);
}
if (MainPage.GatewayStatus.Contains ("upgrading") && result == 0) {
SendUpgradeData (subnetId, 0, arrayTemp);
Application.RunOnMainThread (() => {
- btnTipMsg.Text = "姝e湪鍗囩骇缃戝叧 " + result + "/" + upgradeData.Count;
+ btnTipMsg.Text = "Upgrading gateway " + result + "/" + upgradeData.Count;
});
} else if (result == -99) {
System.Threading.Thread.Sleep (100);
continue;
} else if (result == 100) {
Application.RunOnMainThread (() => {
- btnTipMsg.Text = "缃戝叧鍗囩骇鎴愬姛.姝e湪鍒濆鍖栫綉鍏�";
+ btnTipMsg.Text = "Gateway upgrade succeeded. Initializing gateway.";
btnTipMsg.TextColor = SkinStyle.Current.TextColor;
+ MainPage.GatewayStatus = "";
});
break;
- }
-
- else {
+ } else {
if (upgradeData.Count >= result) {
var listPack = upgradeData [result - 1];//
byte [] packData = new byte [2 + listPack.Count];
@@ -171,12 +149,12 @@
}
}
+
}) { IsBackground = true }.Start ();
#endregion
}
-
/// <summary>
/// 璇诲彇鍥轰欢鏁版嵁
/// </summary>
@@ -185,7 +163,7 @@
{
byte [] buffer = new byte [1024];
List<List<byte>> upgradeData = new List<List<byte>> ();
- System.IO.Stream stream = Application.Activity.Assets.Open ("FW_MCIP-L1_RF.01_V03.01_210712_STM32F107VCT6_U2_india_beta.bin");
+ System.IO.Stream stream = Application.Activity.Assets.Open ("ind_C03.02U_2022-06-22.bin");
int length = 0;
try {
while ((length = stream.Read (buffer, 0, buffer.Length)) != 0) {
--
Gitblit v1.8.0