黄学彪
2020-04-14 463cf39019aa54e6c1226be4620766a035a0c490
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs
@@ -93,10 +93,10 @@
                });
                return;
            }
            else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted"
                || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData")
            else if (UserCenterResourse.UserInfo.AuthorityNo == 3)
            {
                if (UserCenterResourse.UserInfo.AuthorityNo == 3)
                if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted"
                || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData")
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
@@ -107,9 +107,23 @@
                        UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false);
                    });
                    return;
                }
                return;
                else if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Home.Id + "_" + Common.Config.Instance.Guid + "/PrimaryUserDelYou")
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //分享住宅已更改,请联系管理员!
                        string msg = Language.StringByID(R.MyInternationalizationString.uShardResidenceHadDeletePleaseTakeToAdmin);
                        var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
                        contr.Show();
                        UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false);
                    });
                    return;
                }
            }
            try
            {
                if (HdlGatewayLogic.Current.IsGatewayExist(gatewayId) == false)
@@ -131,7 +145,7 @@
                //门锁上报
                else if (topic == gatewayId + "/Alarms/SendAlarmInform")
                {
                    this.DoorLockDeviceReportPush(null);
                    this.DoorLockDeviceReportPush(JObject.Parse(msgData));
                }
                //通过外部方式布防撤防成功时报告
                else if (topic == gatewayId + "/Security/EnOrWithdrawSucceedReport")
@@ -290,6 +304,24 @@
                            //已经接收到状态
                            locadevice.HadReadDeviceStatu = true;
                        }
                        else if (attData.AttributeId == 4097)
                        {
                            //过虑网清洗标志:42
                            ((AC)locadevice).CleanStatu = attData.AttriButeData == 42;
                        }
                        else if (attData.AttributeId == 4099)
                        {
                            //转换为二进制
                            var value = Convert.ToString(attData.AttriButeData, 2).PadLeft(16, '0');
                            //这五个设置是放在后面的
                            value = value.Substring(value.Length - 5, 5);
                            for (int i = 0; i < value.Length; i++)
                            {
                                //自定义的空调模式
                                ((AC)locadevice).listSupportMode[i] = Convert.ToInt32(value[i].ToString());
                            }
                            locadevice.ReSave();
                        }
                    }
                }
                //空调数据
@@ -312,6 +344,16 @@
                            //已经接收到状态
                            locadevice.HadReadDeviceStatu = true;
                        }
                        else if (attData.AttributeId == 4097)
                        {
                            //转换为二进制
                            var value = Convert.ToString(attData.AttriButeData, 2).PadLeft(16, '0');
                            //这个设置是放在后面的
                            value = value.Substring(value.Length - 1, 1);
                            //启用摆风功能
                            ((AC)locadevice).UseSwingFunction = value == "1";
                            locadevice.ReSave();
                        }
                    }
                }
                #endregion
@@ -321,7 +363,7 @@
                else if (report.DeviceStatusReport.CluterID == 8)
                {
                    locadevice.DeviceStatusReport = report.DeviceStatusReport;
                    if (report.DeviceStatusReport.AttriBute[0].AttributeId == 0)
                    if (locadevice.Type == DeviceType.DimmableLight && report.DeviceStatusReport.AttriBute[0].AttributeId == 0)
                    {
                        //此属性表明当前亮度程度
                        ((DimmableLight)locadevice).Level = report.DeviceStatusReport.AttriBute[0].AttriButeData;
@@ -442,9 +484,25 @@
        /// <param name="receiveData"></param>
        private void DoorLockDeviceReportPush(JObject receiveData)
        {
            //保存门锁信息到本地
            //HdlAlarmsLogic.Current.SaveDoorLockAlarmInfo(receiveData);
            //只有徐梅的门锁界面没有打开的情况下,才会处理这个东西
            if (ControlCommonResourse.IsDoorLockPageOpen == false)
            {
                var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint"));
                if ((device is ZigBee.Device.DoorLock) == false)
                {
                    //它不是门锁
                    return;
                }
                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockAlarmsResult>(receiveData["Data"].ToString());
                if (info.Clusterid == 257)
                {
                    //常开模式开启
                    if (info.AlarmCode == 216)
                    {
                        DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidDialog((ZigBee.Device.DoorLock)device, DoorLock.DoorLockCommonInfo.DoorLockMessType.ServicePush, null);
                    }
                }
            }
            //显示有新消息的特效
            this.ShowHadNewMessageAppeal();
        }