| | |
| | | { |
| | | try |
| | | { |
| | | if (!Shared.Common.Config.Instance.IsLogin) { |
| | | return; |
| | | } |
| | | if (remoteMqttIsConnecting || Shared.Common.Config.Instance.HomeId == "") |
| | | { |
| | | return; |
| | |
| | | //云端中的当前连接被挤下线,需要通知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; |
| | | } |
| | |
| | | }
|
| | |
|
| | | //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
|
| | | 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); |
| | |
| | | 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) |
| | |
| | | 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;
|
| | | } |
| | | } |
| | | } |
| | |
| | | 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") |
| | | { |