From e41577d72b90fcd17999ffdd614072ecf313a733 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期三, 18 三月 2020 14:51:03 +0800
Subject: [PATCH] 2020-03-18-1
---
ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
index 93698ba..30ae20b 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Application.cs
@@ -22,6 +22,10 @@
/// 鏂板彂鐜扮殑缃戝叧閫氱煡
/// </summary>
public static Action<ZigBee.Device.ZbGateway> NewGateWayAction;
+ /// <summary>
+ /// 涓婁竴娆$殑浣忓畢ID
+ /// </summary>
+ private static string oldHomeID = string.Empty;
public static void Init()
{
@@ -35,7 +39,6 @@
{
var gateWayList = new List<ZbGateway> { };
var searchCount = 6;
- var oldHomeID = string.Empty;
var broadBytes = new byte[44];// byteHomeId[0] ,//H
broadBytes[0] = 0xfe;
broadBytes[1] = 0x29;
@@ -50,7 +53,9 @@
try
{
if (string.IsNullOrEmpty(Shared.Common.Config.Instance.HomeId))
- {
+ {
+ //浣忓畢ID涓虹┖鍙湁涓�绉嶅彲鑳藉氨鏄��鍑轰簡鐧诲綍锛岃繖閲岀殑涓婁竴娆′綇瀹匢D瑕佹竻绌�
+ oldHomeID = "?";
System.Threading.Thread.Sleep(1000);
continue;
}
@@ -113,7 +118,7 @@
ZbGateway.IsRemote = true;
for (int i = 0; i < ZbGateway.GateWayList.Count; i++)
{
- ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
+ ZbGateway.GateWayList[i].DisConnectLocalMqttClient("1");
}
}
@@ -202,11 +207,11 @@
{
gateWayList.Add(zbGateWay);
}
- //缃戝叧涓埌浣忓畢ID涓虹┖姝ゆ椂涔熼�氳
- else if (homeID == string.Empty)
- {
- gateWayList.Add(zbGateWay);
- }
+ //缃戝叧涓埌浣忓畢ID涓虹┖姝ゆ椂涔熼�氳 2020.01.14鍙樻洿锛氭病杩欎釜蹇呰,涓婇潰閭d釜鍙橀噺灏辫兘澶勭悊
+ //else if (homeID == string.Empty)
+ //{
+ // gateWayList.Add(zbGateWay);
+ //}
}
//缃戝叧鍒楄〃瀛樺偍澶勭悊
var gateWay = ZbGateway.GateWayList.Find(obj => obj.getGatewayBaseInfo != null && obj.getGatewayBaseInfo.gwID == zbGateWay.getGatewayBaseInfo.gwID);
@@ -253,6 +258,22 @@
//鏍囪褰撳墠缃戝叧鏄富缃戝叧
gateWay.getGatewayBaseInfo.IsMainGateWay = true;
}
+ }
+
+ //娴嬭瘯鑳藉惁骞挎挱寰楀埌缃戝叧,閫氬父鎯呭喌涓嬩笉妫�娴�
+ if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.CheckCanReceiveGateway == 1)
+ {
+ if (Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest.ContainsKey(id) == false)
+ {
+ if (gateWay == null)
+ {
+ Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = zbGateWay;
+ }
+ else
+ {
+ Shared.Phone.UserCenter.UserCenterResourse.DicReceiveGatewayTest[id] = gateWay;
+ }
+ }
}
}
}
@@ -274,13 +295,13 @@
try
{
//瀹氭椂妫�娴嬭繙绋嬭繛鎺ユ儏鍐�
- await ZbGateway.StartRemoteMqtt();
+ await ZbGateway.StartRemoteMqtt();
if (!ZbGateway.IsRemote)
{
System.Threading.Thread.Sleep(500);
continue;
}
- var gateWayList =ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
+ var gateWayList = ZbGateway.GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
if (gateWayList.Count == 1)
{
@@ -324,6 +345,14 @@
{ IsBackground = true }.Start();
}
+ /// <summary>
+ /// 閲嶆柊鎼滅储,娉ㄦ剰锛氳皟鐢ㄨ鏂规硶,鍒欎績浣垮叏閮ㄧ綉鍏崇殑mqtt鍏ㄩ儴鏂紑,鐒跺悗閲嶆柊鎼滅储(鍙兘浼氭湁1绉掑欢杩�)
+ /// </summary>
+ public static void ReSearch()
+ {
+ //涓轰簡閭d箞澶氬皯涓囧垎涔嬩竴鐨勫嚑鐜�,杩欓噷璁剧疆鎴愬埆鐨勫彟涓�绫荤殑鍊�
+ oldHomeID = "**";
+ }
/// <summary>
/// 鎺ユ敹澶勭悊UDP鏁版嵁鍖�
--
Gitblit v1.8.0