File was renamed from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlSafeguardLogic.cs |
| | |
| | | using System.Threading.Tasks; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | namespace Shared.Phone |
| | | { |
| | | /// <summary> |
| | | /// <para>安防本地缓存(代码使用)</para> |
| | |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); |
| | | if (temp != null) |
| | | { |
| | | string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error); |
| | | string msg = HdlCheckLogic.Current.CheckGatewayErrorCode(temp.Error); |
| | | if (msg != null) |
| | | { |
| | | this.ShowTipMsg(msg); |
| | |
| | | //处理设备 |
| | | foreach (var data2 in allData.DeviceList) |
| | | { |
| | | string mainKey = LocalDevice.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint); |
| | | string mainKey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data2.MacAddr, data2.Epoint); |
| | | //传感器设备信息 |
| | | var Deviceinfo = new Safeguard.ZoneDeviceListData(); |
| | | Deviceinfo.IsBypass = data2.IsBypass; |
| | |
| | | zoneInfo.dicSensor[mainKey] = Deviceinfo; |
| | | |
| | | //本地是否有这个设备 |
| | | CommonDevice device = LocalDevice.Current.GetDevice(mainKey); |
| | | CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainKey); |
| | | if (device != null) |
| | | { |
| | | //全部设备 |
| | |
| | | if (data.Type == 0) |
| | | { |
| | | //本地是否有这个设备 |
| | | string mainKey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint); |
| | | string mainKey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint); |
| | | //报警信息 |
| | | zoneInfo.dicAlarmDevice[mainKey] = data; |
| | | CommonDevice device = LocalDevice.Current.GetDevice(mainKey); |
| | | CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainKey); |
| | | if (device != null) |
| | | { |
| | | //全部设备 |
| | |
| | | //向防区添加设备失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uAddDeviceToZoneFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, returnData); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | //一批设备里面,成功添加的 |
| | | if (data.Status == 0) |
| | | { |
| | | listSuccess.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); |
| | | listSuccess.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); |
| | | } |
| | | else if (data.Status == 1) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint); |
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(data.MacAddr, data.Epoint); |
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | //目标设备不存在 |
| | | msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); |
| | | this.ShowTipMsg(msg); |
| | | } |
| | | else if (data.Status == 2) |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(data.MacAddr, data.Epoint); |
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(data.MacAddr, data.Epoint); |
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | //设备已加入其它防区 |
| | | msg += Language.StringByID(R.MyInternationalizationString.uDeviceHadAddToTheOtherGarrison); |
| | | this.ShowTipMsg(msg); |
| | |
| | | //设备删除失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeviceDeleteFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, returnData); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, returnData); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | |
| | |
| | | { |
| | | if (data.Status == 0) |
| | | { |
| | | listKeys.Add(LocalDevice.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); |
| | | listKeys.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(data.MacAddr, data.Epoint)); |
| | | } |
| | | } |
| | | |
| | |
| | | //获取安防密码失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetSafetyPasswordFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, nowPw); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, nowPw); |
| | | |
| | | if (mode == ShowErrorMode.YES) |
| | | { |
| | |
| | | //修改用户密码失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uChangedUserPasswordFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //修改备注信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //添加报警目标失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uAddAlarmTargetFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | |
| | |
| | | { |
| | | if (data.Type == "0") |
| | | { |
| | | var device = Common.LocalDevice.Current.GetDevice(data.DeviceAddr, data.Epoint); |
| | | string msg = Common.LocalDevice.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(data.DeviceAddr, data.Epoint); |
| | | string msg = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device) + "\r\n"; |
| | | //目标设备不存在 |
| | | msg += Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); |
| | | this.ShowTipMsg(msg); |
| | |
| | | //删除报警目标失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteAlarmTargetFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | |
| | |
| | | if (device.Type == "0") |
| | | { |
| | | //删除报警设备 |
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint); |
| | | string mainkeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device.DeviceAddr, device.Epoint); |
| | | if (zoneInfo.dicAlarmDevice.ContainsKey(mainkeys) == false) |
| | | { |
| | | continue; |
| | |
| | | //旁路状态设置失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetByPassStatuFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | |
| | |
| | | |
| | | if (this.UserPassword == null) |
| | | { |
| | | var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword); |
| | | var data = HdlFileLogic.Current.ReadFileByteContent(HdlFileNameResourse.SafeguardUserPassword); |
| | | if (data != null) |
| | | { |
| | | this.UserPassword = System.Text.Encoding.UTF8.GetString(data); |
| | |
| | | if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison) |
| | | { |
| | | //保存加密的密码到本地 |
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | //布防设置失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return GarrisonMode.RemoveGarrison; |
| | |
| | | if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison) |
| | | { |
| | | //保存加密密码到本地 |
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | } |
| | | return result2; |
| | | } |
| | |
| | | //撤防失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | } |
| | |
| | | //布防模式变更失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uChangedGarrisonModeFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | } |
| | |
| | | if (result2 != -1) |
| | | { |
| | | //保存到加密密码本地 |
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SafeguardUserPassword, this.UserPassword); |
| | | } |
| | | return result2; |
| | | } |
| | |
| | | //设置信息推送失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetInformationPushFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //获取延时时间失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetDelayTimeFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | //设置延时时间失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetDelayTimeFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //获取胁迫联系方式信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uGetCoercePhoneNumberFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return null; |
| | |
| | | //修改胁迫联系方式失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uChangedCoercePhoneNumberFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //修改备注信息失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uEditorNoteInformationFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, null, "回复超时"); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, null, "回复超时"); |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | | } |
| | |
| | | //删除胁迫联系方式失败 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uDeleteCoercePhoneNumberFail); |
| | | //拼接上【网关回复超时】的Msg |
| | | msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result); |
| | | msg = HdlCommonLogic.Current.CombineGatewayTimeOutMsg(msg, result); |
| | | |
| | | this.ShowErrorMsg(msg); |
| | | return false; |
| | |
| | | //要考虑它的排列顺序(可以按需求变更编号) |
| | | Dictionary<int, string> dicSort = new Dictionary<int, string>(); |
| | | //最大编号 |
| | | int MaxNo = listTaskInfo.Count > 4 ? listTaskInfo.Count : 4; |
| | | int MaxNo = 4; |
| | | //开关的位置编号 |
| | | int ControlNo = 0; |
| | | //百分比的位置编号 |
| | |
| | | int modelNo = 3; |
| | | //空调风速的位置编号 |
| | | int windNo = 4; |
| | | //其他编号(不理会位置,以列表的顺序为准) |
| | | int otherNo = 100; |
| | | |
| | | foreach (var info in listTaskInfo) |
| | | { |
| | | #region ■ 晾衣架______ |
| | | //★★★★临时处理,后期会删除 |
| | | if (info.Epoint != -1) |
| | | { |
| | | //最高最低处 |
| | | if (info.Epoint == 1) |
| | | { |
| | | dicSort[dicSort.Count + otherNo] = info.Data1 == 0 ? Language.StringByID(R.MyInternationalizationString.uTheHighestPoint) : Language.StringByID(R.MyInternationalizationString.uTheLowestPoint); |
| | | } |
| | | //风干 |
| | | else if (info.Epoint == 3) |
| | | { |
| | | dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenAirdry) : Language.StringByID(R.MyInternationalizationString.uCloseAirdry); |
| | | } |
| | | //烘干 |
| | | else if (info.Epoint == 4) |
| | | { |
| | | dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDry) : Language.StringByID(R.MyInternationalizationString.uCloseDry); |
| | | } |
| | | //消毒 |
| | | else if (info.Epoint == 5) |
| | | { |
| | | dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenDisinfect) : Language.StringByID(R.MyInternationalizationString.uCloseDisinfect); |
| | | } |
| | | //照明 |
| | | else if (info.Epoint == 2) |
| | | { |
| | | dicSort[dicSort.Count + otherNo] = info.Data1 == 1 ? Language.StringByID(R.MyInternationalizationString.uOpenLighting) : Language.StringByID(R.MyInternationalizationString.uCloseLighting); |
| | | } |
| | | //特殊,不能往下走 |
| | | continue; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 开关控制____ |
| | | //开关控制 |
| | | if (info.TaskType == 1) |
| | |
| | | { |
| | | txtvalue += dicSort[i] + " "; |
| | | } |
| | | } |
| | | //其他的 |
| | | MaxNo = otherNo + dicSort.Count; |
| | | for (int i = otherNo; i < MaxNo; i++) |
| | | { |
| | | if (dicSort.ContainsKey(i) == true) |
| | | { |
| | | txtvalue += dicSort[i] + " "; |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | return txtvalue.Trim(); |
| | |
| | | /// <returns></returns> |
| | | private string GetDeviceMainKeys(CommonDevice device) |
| | | { |
| | | return Common.LocalDevice.Current.GetDeviceMainKeys(device); |
| | | return HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device); |
| | | } |
| | | |
| | | /// <summary> |