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