From 10b78a1626106f18a6b2f68bd2b8cafd2a99683c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 12 八月 2020 11:31:59 +0800
Subject: [PATCH] 2020-08-12 4.喜爱页面,增加房间场景添加支持。 5.Alexa,添加设备页面增加修改备注功能,点击OK后,增加设备备注名字不匹配然后自动更新操作。
---
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs | 94 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 91 insertions(+), 3 deletions(-)
diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
index b95835f..34288c5 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
@@ -36,6 +36,8 @@
myLoading.Hide ();
btnCloseLoading.RemoveFromParent ();
WirelessConfig (new byte [] { 1 });//close
+ //2020-07-02 鍏抽棴鑷姩鎼滅储绾跨▼
+ StopSearchDeviceThead ();
if (needRefresh) {
needRefresh = false;
SearchDeviceList ();
@@ -50,6 +52,7 @@
curView = null;
addedCommon.Clear ();
BackgroundColor = SkinStyle.Current.MainColor;
+ //StopSearchDeviceThead ();
base.RemoveFromParent ();
}
@@ -94,8 +97,8 @@
};
var btnSearch = new Button () {
- Width = Application.GetRealWidth (75),
- Height = Application.GetRealHeight (75),
+ Width = Application.GetMinRealAverage (75),
+ Height = Application.GetMinRealAverage (75),
X = Application.GetRealWidth (520),
Y = Application.GetRealHeight (10),
UnSelectedImagePath = "Item/Refresh.png",
@@ -251,6 +254,9 @@
//myLoading.Start ("Waiting for new device, Please touch the here to exit the waiting mode.");
this.AddChidren (btnCloseLoading);
+
+ //2020-07-02 缃戝叧閰嶉妯″紡鏃讹紝寮�鍚嚜鍔ㄦ悳绱㈢嚎绋�
+ StartSearchDeviceThead ();
}
});
});
@@ -1096,6 +1102,88 @@
}
+ #region 2020-07-02
+ /// <summary>
+ /// 瀹氭椂鎼滅储璁惧绾跨▼
+ /// </summary>
+ Thread searchDeviceThead;
+ bool bStartSearch;
+
+ /// <summary>
+ /// 2020-07-02
+ /// 缃戝叧閰嶉妯″紡鏃讹紝寮�鍚嚜鍔ㄦ悳绱㈢嚎绋�
+ /// </summary>
+ void StartSearchDeviceThead ()
+ {
+ StopSearchDeviceThead ();
+ CommonPage.LocalPhoneFindDevice = true;
+ CommonPage.FindGatewayChilren = true;
+ CommonPage.RandomHigh = (byte)new Random ().Next (255);
+ CommonPage.RandomLow = (byte)new Random ().Next (255);
+
+ bStartSearch = true;
+ searchDeviceThead = new Thread ((obj) => {
+ while (bStartSearch) {
+ try {
+ //瀹氭椂4S
+ Thread.Sleep (4000);
+
+ var ms = new System.IO.MemoryStream ();
+ ms.WriteByte (CommonPage.RandomHigh);
+ ms.WriteByte (CommonPage.RandomLow);
+
+ var list = CommonPage.DeviceList;
+ int tempCount = list.Count;
+ string s = ";";
+ for (int i = 0; i < list.Count; i++) {
+ Common common = list [i];
+ if (common.SubnetID != gatewayDeicve.SubnetID)
+ continue;
+ if (s.Contains (";" + common.SubnetID.ToString () + ":" + common.DeviceID.ToString ()))
+ continue;
+ s += common.SubnetID.ToString () + ":" + common.DeviceID.ToString () + ";";
+ ms.WriteByte (common.SubnetID);
+ ms.WriteByte (common.DeviceID);
+ }
+ Utlis.WriteLine ("SearchDeviceThead鎼滅储闈炵綉鍏宠澶囷紝缃戠粶鍦板潃鏄�:" + CommonPage.EndPoint.ToString ());
+ var control = new Control ();
+ control.Send (new Target () {
+ IPEndPoint = CommonPage.EndPoint,
+ Command = Command.ReadDeviceModul,
+ SubnetID = gatewayDeicve.SubnetID,
+ DeviceID = 0xFF,
+ AddData = ms.ToArray ()
+ }, SendCount.Zero, false);
+
+ ms.Close ();
+
+ } catch {
+
+ }
+ }
+ });
+ searchDeviceThead.Start ();
+
+
+ Utlis.WriteLine ("----StartSearchDeviceThead----");
+ }
+
+ /// <summary>
+ /// 鏆傚仠鎼滅储璁惧绾跨▼
+ /// </summary>
+ void StopSearchDeviceThead ()
+ {
+ CommonPage.LocalPhoneFindDevice = false;
+ CommonPage.FindGatewayChilren = false;
+ bStartSearch = false;
+ if (searchDeviceThead != null)
+ searchDeviceThead.Abort ();
+
+ Utlis.WriteLine ("----StopSearchDeviceThead----");
+
+ }
+ #endregion
+
///// <summary>
///// 鏌ヨ褰撳墠浣忓畢 缃戝叧鍒楄〃
///// </summary>
@@ -1235,7 +1323,7 @@
// //Room.InitAllRoom ();
//}
-
+
///// <summary>
///// 淇敼URL
--
Gitblit v1.8.0