From ec35d79add60d1438dff5291389f7e69c579d9f9 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 21 十一月 2019 18:18:25 +0800 Subject: [PATCH] 完成面板楼层显示处理和下拉刷新处理,请合并最新代码 --- ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs | 75 +++++++++++++++++++++++++++++++------ 1 files changed, 62 insertions(+), 13 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs old mode 100755 new mode 100644 index a9bb880..5b71719 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/ZbGateway.cs @@ -3204,6 +3204,10 @@ { try { + if (!Shared.Common.Config.Instance.IsLogin) + { + return; + } if (remoteMqttIsConnecting || Shared.Common.Config.Instance.HomeId == "") { return; @@ -3522,7 +3526,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 +3722,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 +3737,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 +3765,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; } } } @@ -3910,6 +3912,54 @@ tempDevice.DeviceStatusReport = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.DeviceStatusReportData>(jobject["Data"].ToString()); UpdateDeviceStatus(tempDevice); 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瀹夐槻淇℃伅涓婃姤 @@ -4163,7 +4213,6 @@ } } #endregion - DebugPrintLog("缃戝叧杩斿洖鏁版嵁閫氱煡"); } catch (Exception ex) { -- Gitblit v1.8.0