From 88ce6b0697ccf6ce467545bb1125aefdf5b7130b Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 18 十一月 2019 11:29:04 +0800
Subject: [PATCH] 合并了全部的代码

---
 ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs |   73 ++++++++++++++++++++++++++++++------
 1 files changed, 61 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
index a9bb880..8856f19 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs
@@ -3204,6 +3204,9 @@
             {
                 try
                 {
+                    if (!Shared.Common.Config.Instance.IsLogin) {
+                        return;
+                    }
                     if (remoteMqttIsConnecting || Shared.Common.Config.Instance.HomeId == "")
                     {
                         return;
@@ -3522,7 +3525,7 @@
                     //浜戠涓殑褰撳墠杩炴帴琚尋涓嬬嚎锛岄渶瑕侀�氱煡app
                     //鍏ㄥ眬鎺ユ敹缃戝叧鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�)
                     message = "BeingSqueezedOffline";
-                    Shared.Phone.UserCenter.HdlGatewayReceiveLogic.GatewayOverallMsgReceive("", topic, null);
+                    Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive("", topic, "", null);
                     DebugPrintLog($"琚尋涓嬬嚎閫氱煡:{ topic}_杩滅▼杩斿洖鐨勬暟鎹甠{message}_{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")}");//{System.DateTime.Now.ToString()}");// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")
                     return;
                 }
@@ -3718,7 +3721,7 @@
                 }
 
                 //鍏ㄥ眬鎺ユ敹缃戝叧鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�)
-                Shared.Phone.UserCenter.HdlGatewayReceiveLogic.GatewayOverallMsgReceive(gatewayID, topic, jobject);
+                Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, jobject);
 
                 #region 浜戠閫氱煡
                 var cloudMqttResult = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Common.CloudMqttResponsePack>(message);
@@ -3733,7 +3736,7 @@
                                 gwa.CloudErrorAction("AppNoLogin", "鐧诲綍杩囨湡锛岃閲嶆柊鐧诲綍");
                             }
                             //鍏ㄥ眬鎺ユ敹缃戝叧鎺ㄩ�佺殑鐨勯�昏緫(涓轰簡鎵ц閫熷害,灏藉彲鑳界殑鍒姞鑰楁椂鐨勬搷浣�)
-                            Shared.Phone.UserCenter.HdlGatewayReceiveLogic.GatewayOverallMsgReceive(gatewayID, "AppNoLogin", jobject);
+                            Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, "AppNoLogin", reportStatus, jobject);
                             break;
                         case "AppTimeOut":
                             if (gwa.CloudErrorAction != null)
@@ -3761,17 +3764,15 @@
                         if (gwData != null)
                         {
                             var gwList = GateWayList.FindAll(obj => obj.getGatewayBaseInfo.HomeId == Shared.Common.Config.Instance.HomeId);
-
                             for (int i = 0; i < gwList.Count; i++)
                             {
-                                var gwTemp = gwList[i];
-                                if (gwData.IsDominant == 1)
-                                {
-                                    gwTemp.getGatewayBaseInfo.IsMainGateWay = true;
-                                    for (int j = i + 1; j < gwList.Count; j++)
-                                    {
-                                        gwList[j].getGatewayBaseInfo.IsMainGateWay = false;
-                                    }
+                                if (gwList[i].getGatewayBaseInfo.gwID == gatewayID)
+                                {
+                                    gwList[i].getGatewayBaseInfo.IsMainGateWay = true;
+                                }
+                                else
+                                {
+                                    gwList[i].getGatewayBaseInfo.IsMainGateWay = false;
                                 }
                             }
                         }
@@ -3912,6 +3913,54 @@
                     UpdateDeviceInfo(tempDevice, "DeviceStatusReport");
                 }
                 #endregion
+                #region 闂ㄩ攣鎿嶄綔浜嬩欢閫氱煡
+                else if (topic == gatewayID + "/" + "DoorLock/DoorLockOperatingEventNotificationCommand")
+                {
+                    var deviceID = jobject.Value<int>("Device_ID");
+                    switch ((DeviceType)(deviceID))
+                    {
+                        case DeviceType.DoorLock:
+                            var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gwa.getGatewayBaseInfo.gwID };
+                            var OperatingEventNotificationDatad = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockOperatingEventNotificationCommand>(jobject["Data"].ToString());
+                            if (OperatingEventNotificationDatad != null)
+                            {
+                                doorLock.doorLockOperatingEventNotificationCommand = OperatingEventNotificationDatad;
+                            }
+                            if (gwa.ReportAction != null)
+                            {
+                                DebugPrintLog("DoorLockProgrammingEventNotificationCommand宸茬粡閫氱煡");
+                                gwa.ReportAction("DoorLockProgrammingEventNotificationCommand", doorLock);
+                            }
+                            UpdateDeviceStatus(doorLock);
+                            UpdateDeviceInfo(doorLock, "DoorLockProgrammingEventNotificationCommand");
+                            break;
+                    }
+                }
+                #endregion
+                #region 闂ㄩ攣缂栫▼浜嬩欢閫氱煡
+                else if (topic == gatewayID + "/" + "DoorLock/DoorLockProgrammingEventNotificationCommand")
+                {
+                    var deviceID = jobject.Value<int>("Device_ID");
+                    switch ((DeviceType)(deviceID))
+                    {
+                        case DeviceType.DoorLock:
+                            var doorLock = new DoorLock() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gwa.getGatewayBaseInfo.gwID };
+                            var ProgrammingEventNotificationData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockProgrammingEventNotificationCommand>(jobject["Data"].ToString());
+                            if (ProgrammingEventNotificationData != null)
+                            {
+                                doorLock.doorLockProgrammingEventNotificationCommand = ProgrammingEventNotificationData;
+                            }
+                            if (gwa.ReportAction != null)
+                            {
+                                DebugPrintLog("DoorLockProgrammingEventNotificationCommand宸茬粡閫氱煡");
+                                gwa.ReportAction("DoorLockProgrammingEventNotificationCommand", doorLock);
+                            }
+                            UpdateDeviceStatus(doorLock);
+                            UpdateDeviceInfo(doorLock, "DoorLockProgrammingEventNotificationCommand");
+                            break;
+                    }
+                }
+                #endregion
                 #region IAS瀹夐槻淇℃伅涓婃姤
                 else if (topic == gatewayID + "/" + "IASInfoReport")
                 {

--
Gitblit v1.8.0