File was renamed from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs |
| | |
| | | using Newtonsoft.Json.Linq; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | namespace Shared.Phone |
| | | { |
| | | /// <summary> |
| | | /// 全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作) |
| | |
| | | { |
| | | //登录密匙已经过期,请重新登录 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uTokenIsOldAndLoginAgain); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | //此帐号已在别处登录,您被迫下线 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uHadBeenLoginAndOffLine); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | //您当前的IP及端口在云端不存在,请重新登录! |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uYouIpAndPortNoRecord); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | //分享住宅已更改,请联系管理员! |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uShardResidenceHadDeletePleaseTakeToAdmin); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | //您的权限已经变更,请重新登陆 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uYouAccessHadChangedPleaseTakeToAdmin); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | | else if (UserCenterResourse.UserInfo.AuthorityNo == 3) |
| | | else if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3) |
| | | { |
| | | if (topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/Deleted" |
| | | || topic == "ZigbeeGateWayToClient/" + Common.Config.Instance.Guid + "/Push/DeletedShareData") |
| | |
| | | { |
| | | //分享数据已经变更,请重新登陆 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uShardDataIsChangedPleaseLoginAgain); |
| | | var contr = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | contr.Show(); |
| | | HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, msg); |
| | | |
| | | UserCenterLogic.ReLoginAgain(UserCenterResourse.UserInfo.Account, false); |
| | | HdlAccountLogic.Current.ReLoginAgain(HdlUserCenterResourse.UserInfo.Account, false); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | var tempList = Common.LocalDevice.Current.GetDevicesByMac(report.DeviceAddr, false); |
| | | var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); |
| | | if (res.ConcreteType == Common.DeviceConcreteType.Airer) |
| | | { |
| | | //晾衣架特殊处理,本地只存了端点1,其余2~5端点都不存 |
| | | deviceEpoint = 1; |
| | | } |
| | | //处理网关上报的数据,然后变更本地缓存 |
| | | var locadevice = Common.LocalDevice.Current.GetDevice(deviceAddr, deviceEpoint); |
| | | var locadevice = HdlDeviceCommonLogic.Current.GetDevice(deviceAddr, deviceEpoint); |
| | | if (locadevice != null) |
| | | { |
| | | //有反馈,这个设备肯定是在线的 |
| | |
| | | locadevice.LastDateTime = DateTime.Now; |
| | | |
| | | #region ■ 开关功能 |
| | | //晾衣架回路2,3,4,5都是CluterID是6 ,但是功能不是开关 |
| | | if (locadevice.Type == DeviceType.Airer) |
| | | { |
| | | if (report.DeviceStatusReport.CluterID == 6) |
| | | { |
| | | foreach (var attData in report.DeviceStatusReport.AttriBute) |
| | | { |
| | | locadevice.DeviceStatusReport = report.DeviceStatusReport; |
| | | if (attData.AttributeId == 0) |
| | | { |
| | | //注意晾衣架回路上报都端点都是被替换为回路1,所以这里用上报都回路 |
| | | switch (report.DeviceEpoint) |
| | | { |
| | | //照明 |
| | | case 2: |
| | | ((Airer)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | break; |
| | | //风干 |
| | | case 3: |
| | | ((Airer)locadevice).WindOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | break; |
| | | //烘干 |
| | | case 4: |
| | | ((Airer)locadevice).DryOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | break; |
| | | //消毒 |
| | | case 5: |
| | | ((Airer)locadevice).DisinfectOnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //晾衣架(风干/烘干/消毒)设置的默认时间 |
| | | // 注意,第一阶段时间设备不支持而暂停,没有处理剩余多少时间触发,直接上报回复一个属性ID的情况 |
| | | //if (attData.AttributeId == 16385) |
| | | //{ |
| | | // //注意晾衣架回路上报都端点都是被替换为回路1,所以这里用上报都回路 |
| | | // switch (report.DeviceEpoint) |
| | | // { |
| | | // //风干 |
| | | // case 3: |
| | | // ((Airer)locadevice).WindTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // //烘干 |
| | | // case 4: |
| | | // ((Airer)locadevice).DryTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // //消毒 |
| | | // case 5: |
| | | // ((Airer)locadevice).DisinfectTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // } |
| | | //} |
| | | //晾衣架(风干/烘干/消毒)设置的剩余多少时间触发 |
| | | // 注意,第一阶段时间设备不支持而暂停,没有处理剩余多少时间触发,直接上报回复一个属性ID的情况 |
| | | //if (attData.AttributeId == 16386) |
| | | //{ |
| | | // //注意晾衣架回路上报都端点都是被替换为回路1,所以这里用上报都回路 |
| | | // switch (report.DeviceEpoint) |
| | | // { |
| | | // //风干 |
| | | // case 3: |
| | | // ((Airer)locadevice).WindRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // //烘干 |
| | | // case 4: |
| | | // ((Airer)locadevice).DryRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // //消毒 |
| | | // case 5: |
| | | // ((Airer)locadevice).DisinfectRemainTime = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | // break; |
| | | // } |
| | | //} |
| | | |
| | | //已经接收到状态 |
| | | locadevice.HadReadDeviceStatu = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //开关功能 |
| | | if (report.DeviceStatusReport.CluterID == 6) |
| | | { |
| | |
| | | ((LightBase)locadevice).OnOffStatus = report.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | //已经接收到状态 |
| | | locadevice.HadReadDeviceStatu = true; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | else if (report.DeviceStatusReport.CluterID == 1282) |
| | | { |
| | | //mini夜灯 |
| | | if (Common.LocalDevice.Current.IsMiniLight(locadevice) == true) |
| | | if (HdlDeviceCommonLogic.Current.IsMiniLight(locadevice) == true) |
| | | { |
| | | foreach (var attData in report.DeviceStatusReport.AttriBute) |
| | | { |
| | |
| | | foreach (var attData in report.DeviceStatusReport.AttriBute) |
| | | { |
| | | //区分是空调还是新风 |
| | | var device = Shared.Common.LocalDevice.Current.GetDevice(report.DeviceAddr, report.DeviceEpoint); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(report.DeviceAddr, report.DeviceEpoint); |
| | | |
| | | if (device.Type == DeviceType.FreshAir) |
| | | { |
| | |
| | | |
| | | else if (report.DeviceStatusReport.CluterID == 0) |
| | | { |
| | | var listLocalDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false); |
| | | var listLocalDevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr, false); |
| | | //属性都是一样的 |
| | | foreach (var myDevice in listLocalDevice) |
| | | { |
| | |
| | | { |
| | | if (data.AttriButeDataHex.Length > 2) |
| | | { |
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | if (myDevice.ManufacturerName != value) |
| | | { |
| | | //属性变更了 |
| | |
| | | { |
| | | if (data.AttriButeDataHex.Length > 2) |
| | | { |
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | if (myDevice.ModelIdentifier != value) |
| | | { |
| | | //属性变更了 |
| | |
| | | { |
| | | if (data.AttriButeDataHex.Length > 2) |
| | | { |
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | var value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | if (myDevice.ProductionDate != value) |
| | | { |
| | | //属性变更了 |
| | |
| | | if (data.AttriButeDataHex.Length > 2) |
| | | { |
| | | string value; |
| | | if (Common.LocalDevice.Current.IsHdlDevice(myDevice) == false) |
| | | if (HdlDeviceCommonLogic.Current.IsHdlDevice(myDevice) == false) |
| | | { |
| | | //第三方设备 |
| | | value = data.AttriButeDataHex.Substring(2); |
| | |
| | | else |
| | | { |
| | | //河东设备 |
| | | value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | value = HdlCommonLogic.Current.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2)); |
| | | } |
| | | if (myDevice.SerialNumber != value) |
| | | { |
| | |
| | | } |
| | | else if (deviceEpoint == 200) |
| | | { |
| | | var localOta = Common.LocalDevice.Current.GetOTADevice(deviceAddr); |
| | | var localOta = HdlDeviceCommonLogic.Current.GetOTADevice(deviceAddr); |
| | | if (localOta != null) |
| | | { |
| | | #region ■ 固件版本 |
| | |
| | | } |
| | | |
| | | //处理网关上报的数据,然后变更本地缓存 |
| | | var locadevice = Common.LocalDevice.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint); |
| | | var locadevice = HdlDeviceCommonLogic.Current.GetDevice(ias.DeviceAddr, ias.DeviceEpoint); |
| | | if (locadevice != null) |
| | | { |
| | | ((IASZone)locadevice).iASInfo = ias.iASInfo; |
| | |
| | | /// <param name="receiveData"></param> |
| | | private void DoorLockDeviceReportPush(JObject receiveData) |
| | | { |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(receiveData.Value<string>("DeviceAddr"), receiveData.Value<int>("Epoint")); |
| | | if (device.Type != DeviceType.DoorLock) |
| | | { |
| | | //它不是门锁 |
| | |
| | | tempDevice.IsOnline = Convert.ToInt32(receiveData["Data"]["IsOnline"].ToString()); |
| | | |
| | | //处理网关上报的数据,然后变更本地缓存 |
| | | var locadevice = Common.LocalDevice.Current.GetDevicesByMac(tempDevice.DeviceAddr); |
| | | var locadevice = HdlDeviceCommonLogic.Current.GetDevicesByMac(tempDevice.DeviceAddr); |
| | | for (int i = 0; i < locadevice.Count; i++) |
| | | { |
| | | bool onlineChanged = locadevice[i].IsOnline != tempDevice.IsOnline; |
| | |
| | | |
| | | //保存报警信息然后推送到界面上 |
| | | HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison); |
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) |
| | | { |
| | | |
| | | //推送 |
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; |
| | | var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; |
| | | form?.GarrisonModePush(garrison); |
| | | } |
| | | |
| | | //显示有新消息的特效 |
| | | this.ShowHadNewMessageAppeal(); |
| | | } |
| | |
| | | { |
| | | //保存报警信息然后推送到界面上 |
| | | HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(GarrisonMode.RemoveGarrison); |
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) |
| | | { |
| | | |
| | | //推送 |
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; |
| | | var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; |
| | | form?.GarrisonModePush(GarrisonMode.RemoveGarrison); |
| | | } |
| | | |
| | | //显示有新消息的特效 |
| | | this.ShowHadNewMessageAppeal(); |
| | | } |
| | |
| | | |
| | | //保存报警信息然后推送到界面上 |
| | | HdlAlarmsLogic.Current.SaveSafeguardAlarmInfo(garrison, appendText); |
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) |
| | | { |
| | | |
| | | //推送 |
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; |
| | | var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm") as UserCenter.Safety.SafetyManagementMainForm; |
| | | form?.GarrisonModePush(garrison); |
| | | } |
| | | |
| | | //显示有新消息的特效 |
| | | this.ShowHadNewMessageAppeal(); |
| | | } |
| | |
| | | this.ShowHadNewMessageAppeal(); |
| | | |
| | | // 逻辑执行常开模式失效的情况 |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1) |
| | | { |
| | | //自动化执行 常开关闭 |
| | | var data = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicPushResult>(receiveData["Data"].ToString()); |
| | |
| | | if (data.ActionData.Actiontype == 8 && data.ActionData.PassDataString == "055704010113") |
| | | { |
| | | var deviceAddr = data.ActionData.MacStr; |
| | | var device = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false); |
| | | var device = HdlDeviceCommonLogic.Current.GetDevicesByMac(deviceAddr, false); |
| | | if (device.Count > 0 && device[0].Type != DeviceType.DoorLock) |
| | | { |
| | | return; |
| | |
| | | catch (Exception ex) |
| | | { |
| | | //Log出力 |
| | | string msg = "推送错误! 当前激活的界面[" + UserCenterResourse.NowActionFormID + "]"; |
| | | string msg = "推送错误! 当前激活的界面[" + HdlFormLogic.Current.NowActionFormID + "]"; |
| | | HdlLogLogic.Current.WriteLog(ex, msg); |
| | | } |
| | | } |
| | |
| | | private void ShowHadNewMessageAppeal() |
| | | { |
| | | //有新消息(特效还在时,不需要再处理) |
| | | if (ControlCommonResourse.HadNewMessage == false) |
| | | if (HdlControlResourse.HadNewMessage == false) |
| | | { |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | for (int i = 0; i < ControlCommonResourse.listMessageManaContr.Count; i++) |
| | | for (int i = 0; i < HdlControlResourse.listMessageManaContr.Count; i++) |
| | | { |
| | | //显示角标特效 |
| | | ControlCommonResourse.listMessageManaContr[i].IsSelected = true; |
| | | HdlControlResourse.listMessageManaContr[i].IsSelected = true; |
| | | } |
| | | ControlCommonResourse.HadNewMessage = true; |
| | | HdlControlResourse.HadNewMessage = true; |
| | | }); |
| | | } |
| | | } |