File was renamed from ZigbeeApp/Shared/Phone/Common/Logic/HdlAlarmsLogic.cs |
| | |
| | | using Shared.Common; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 报警类的逻辑 |
| | |
| | | string fileName = DateTime.Now.ToString("yyyyMMdd"); |
| | | |
| | | //安防报警 |
| | | string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName); |
| | | string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); |
| | | var data1 = HdlFileLogic.Current.ReadFileByteContent(fullName); |
| | | if (data1 != null) |
| | | { |
| | |
| | | } |
| | | |
| | | //门锁记录 |
| | | fullName = System.IO.Path.Combine(HdlFileNameResourse.DoorLockAlarmDirectory, fileName); |
| | | fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName); |
| | | var data2 = HdlFileLogic.Current.ReadFileByteContent(fullName); |
| | | if (data2 != null) |
| | | { |
| | |
| | | |
| | | //限制它的长度 |
| | | this.listSafetyAlarmInfo.Insert(0, data); |
| | | if (this.listSafetyAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | if (this.listSafetyAlarmInfo.Count > UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | { |
| | | this.listSafetyAlarmInfo.RemoveAt(this.listSafetyAlarmInfo.Count - 1); |
| | | } |
| | | |
| | | //保存到本地 |
| | | string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName); |
| | | string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); |
| | | HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo); |
| | | |
| | | var form = HdlFormLogic.Current.GetFormByName("SafetyManagementMainForm"); |
| | | if (form != null) |
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true) |
| | | { |
| | | ((UserCenter.Safety.SafetyManagementMainForm)form).AddSafeguardLogPushRow(device); |
| | | var form = (Phone.UserCenter.Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"]; |
| | | form?.AddSafeguardLogPushRow(device); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | |
| | | //限制它的长度 |
| | | this.listSafetyAlarmInfo.Insert(0, data); |
| | | if (this.listSafetyAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | if (this.listSafetyAlarmInfo.Count > UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | { |
| | | this.listSafetyAlarmInfo.RemoveAt(this.listSafetyAlarmInfo.Count - 1); |
| | | } |
| | | |
| | | //保存到本地 |
| | | string fullName = System.IO.Path.Combine(HdlFileNameResourse.SafeguardAlarmDirectory, fileName); |
| | | string fullName = System.IO.Path.Combine(DirNameResourse.SafeguardAlarmDirectory, fileName); |
| | | HdlFileLogic.Current.SaveFileContent(fullName, this.listSafetyAlarmInfo); |
| | | } |
| | | } |
| | |
| | | { |
| | | lock (listSafetyAlarmInfo) |
| | | { |
| | | string fullPath = HdlFileNameResourse.SafeguardAlarmDirectory; |
| | | string fullPath = DirNameResourse.SafeguardAlarmDirectory; |
| | | //获取指定目录下面的文件 |
| | | List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath); |
| | | //升序 |
| | |
| | | var listInfo = new List<SafeguardAlarmInfo>(); |
| | | for (int j = 0; j < info.Count; j++) |
| | | { |
| | | if (j == HdlUserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | if (j == UserCenterResourse.ResidenceOption.SafetyOnedayMaxAlarmMsgCount) |
| | | { |
| | | //每天最多三十条数据 |
| | | break; |
| | |
| | | } |
| | | dic[listFile[i]] = listInfo; |
| | | |
| | | if (dic.Count == HdlUserCenterResourse.ResidenceOption.SafetyMaxAlarmMsgDay) |
| | | if (dic.Count == UserCenterResourse.ResidenceOption.SafetyMaxAlarmMsgDay) |
| | | { |
| | | //只要三天的量 |
| | | break; |
| | |
| | | { |
| | | return null; |
| | | } |
| | | string mainkey = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(i_device); |
| | | string mainkey = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); |
| | | //因为推送的是虚拟的设备,所以去获取真实物理设备 |
| | | CommonDevice device = HdlDeviceCommonLogic.Current.GetDevice(mainkey); |
| | | CommonDevice device = Common.LocalDevice.Current.GetDevice(mainkey); |
| | | if (device == null) |
| | | { |
| | | return null; |
| | |
| | | /// <param name="jobject"></param> |
| | | public bool SaveDoorLockAlarmInfo(Newtonsoft.Json.Linq.JObject jobject) |
| | | { |
| | | var device = HdlDeviceCommonLogic.Current.GetDevice(jobject.Value<string>("DeviceAddr"), jobject.Value<int>("Epoint")); |
| | | var device = Common.LocalDevice.Current.GetDevice(jobject.Value<string>("DeviceAddr"), jobject.Value<int>("Epoint")); |
| | | if ((device is ZigBee.Device.DoorLock) == false) |
| | | { |
| | | //它不是门锁 |
| | |
| | | |
| | | //限制它的长度 |
| | | this.listDoorLockAlarmInfo.Insert(0, msgInfo); |
| | | if (this.listDoorLockAlarmInfo.Count > HdlUserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount) |
| | | if (this.listDoorLockAlarmInfo.Count > UserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount) |
| | | { |
| | | this.listDoorLockAlarmInfo.RemoveAt(this.listDoorLockAlarmInfo.Count - 1); |
| | | } |
| | | |
| | | //保存到本地 |
| | | string fullName = System.IO.Path.Combine(HdlFileNameResourse.DoorLockAlarmDirectory, fileName); |
| | | string fullName = System.IO.Path.Combine(DirNameResourse.DoorLockAlarmDirectory, fileName); |
| | | HdlFileLogic.Current.SaveFileContent(fullName, this.listDoorLockAlarmInfo); |
| | | |
| | | return true; |
| | |
| | | { |
| | | lock (listDoorLockAlarmInfo) |
| | | { |
| | | string fullPath = HdlFileNameResourse.DoorLockAlarmDirectory; |
| | | string fullPath = DirNameResourse.DoorLockAlarmDirectory; |
| | | //获取指定目录下面的文件 |
| | | List<string> listFile = HdlFileLogic.Current.GetFileFromDirectory(fullPath); |
| | | //升序 |
| | |
| | | var listInfo = new List<DeviceAlarmInfo>(); |
| | | for (int j = 0; j < info.Count; j++) |
| | | { |
| | | if (j == HdlUserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount) |
| | | if (j == UserCenterResourse.ResidenceOption.DoorLockOnedayMaxAlarmMsgCount) |
| | | { |
| | | //每天最多三十条数据 |
| | | break; |
| | |
| | | } |
| | | dic[listFile[i]] = listInfo; |
| | | |
| | | if (dic.Count == HdlUserCenterResourse.ResidenceOption.DoorLockMaxAlarmMsgDay) |
| | | if (dic.Count == UserCenterResourse.ResidenceOption.DoorLockMaxAlarmMsgDay) |
| | | { |
| | | //只要三天的量 |
| | | break; |