| | |
| | | this.ShowTipMsg(msg);
|
| | | return false;
|
| | | }
|
| | | var mainWayId = HdlGatewayLogic.Current.GetGatewayId(mainGateway);
|
| | | var mainWayId = mainGateway.GwId;
|
| | |
|
| | | //主题数固定5+3+1
|
| | | int topicCount = 9;
|
| | |
| | | {
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | |
|
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.Safeguard.ErrorResponData>(jobject["Data"].ToString());
|
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString());
|
| | | if (temp != null)
|
| | | {
|
| | | string msg = HdlCheckLogic.Current.CheckCommonErrorCode(temp.Error);
|
| | |
| | | var dateTime = DateTime.Now;
|
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000)
|
| | | {
|
| | | if (topicCount <= 0 || error == true)
|
| | | //if (error == true) { break; }
|
| | | if (topicCount <= 0)
|
| | | {
|
| | | //9次主题全部接收完成
|
| | | await Task.Delay(1000);
|
| | | break;
|
| | | }
|
| | | await Task.Delay(50);
|
| | |
| | | SafeguardZoneInfo zoneInfo = this.dicAllZoneInfo[allData.ZoneId];
|
| | | zoneInfo.ZoneId = allData.ZoneId;
|
| | | zoneInfo.ZoneName = allData.ZoneName;
|
| | |
|
| | | //信息推送
|
| | | zoneInfo.InformationPush = allData.IsDisablePushMessage;
|
| | |
|
| | | //处理设备
|
| | | foreach (var data2 in allData.DeviceList)
|
| | |
| | |
|
| | | zoneInfo.dicAlarmDevice.Clear();
|
| | | zoneInfo.dicScenes.Clear();
|
| | |
|
| | | //信息推送
|
| | | zoneInfo.InformationPush = resData.IsDisablePushMessage;
|
| | |
|
| | | foreach (var data in resData.Actions)
|
| | | {
|
| | |
| | | foreach (var device in listdevice)
|
| | | {
|
| | | int MomentStatus = 1;
|
| | | int TriggerZoneStatus = 1;
|
| | | int TriggerZoneStatus = 3;
|
| | | //获取安防传感器的瞬间状态设定值
|
| | | this.GetSafeguardSensorMomentStatus(device, ref MomentStatus, ref TriggerZoneStatus);
|
| | |
|
| | |
| | | if (device.IasDeviceType == 13)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //烟雾传感器
|
| | | else if (device.IasDeviceType == 40)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //水侵传感器
|
| | | else if (device.IasDeviceType == 42)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //燃气传感器
|
| | | else if (device.IasDeviceType == 43)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //紧急按钮
|
| | | else if (device.IasDeviceType == 44)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //钥匙扣
|
| | | else if (device.IasDeviceType == 277)
|
| | | {
|
| | | MomentStatus = 1;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //门窗传感器
|
| | | else if (device.IasDeviceType == 21 || device.IasDeviceType == 22)
|
| | | {
|
| | | MomentStatus = 0;
|
| | | TriggerZoneStatus = 1;
|
| | | TriggerZoneStatus = 3;
|
| | | }
|
| | | //如果是虚拟设备,则这个东西永恒为0
|
| | | if (device.DriveCode > 0)
|
| | |
| | | }
|
| | | else if (data.Type == "1")
|
| | | {
|
| | | var scene = Common.SceneRoomUI.AllSceneRoomUIList.Find((obj) => obj.sceneUI.Id == data.ScenesId);
|
| | | var scene = HdlSceneLogic.Current.GetSceneUIBySceneId(data.ScenesId);
|
| | | if (scene != null)
|
| | | {
|
| | | string msg = scene.sceneUI.Name + "\r\n";
|
| | | string msg = scene.Name + "\r\n";
|
| | | //目标场景不存在
|
| | | msg += Language.StringByID(R.MyInternationalizationString.uTargetSceneIsNotExsit);
|
| | | this.ShowTipMsg(msg);
|
| | |
| | |
|
| | | if (this.UserPassword == null)
|
| | | {
|
| | | var data = Global.ReadFileByDirectory(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword);
|
| | | var data = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.SafeguardUserPassword);
|
| | | if (data != null)
|
| | | {
|
| | | this.UserPassword = System.Text.Encoding.UTF8.GetString(data);
|
| | |
| | | if (result != GarrisonMode.None && result != GarrisonMode.RemoveGarrison)
|
| | | {
|
| | | //保存加密的密码到本地
|
| | | Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
|
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
| | | if (result2 != GarrisonMode.None && result2 != GarrisonMode.RemoveGarrison)
|
| | | {
|
| | | //保存加密密码到本地
|
| | | Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
|
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
|
| | | }
|
| | | return result2;
|
| | | }
|
| | |
| | | if (result2 != -1)
|
| | | {
|
| | | //保存到加密密码本地
|
| | | Global.WriteFileToDirectoryByBytes(DirNameResourse.LocalMemoryDirectory, DirNameResourse.SafeguardUserPassword, System.Text.Encoding.UTF8.GetBytes(this.UserPassword));
|
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SafeguardUserPassword, this.UserPassword);
|
| | | }
|
| | | return result2;
|
| | | }
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | |
|
| | | if (zoneId > 3)
|
| | | {
|
| | | zoneId = 3;
|
| | | }
|
| | | //状态变更
|
| | | var result = await Safeguard.DisablePushMessageAsync(zoneId, statu);
|
| | | if (result == null || result.disablePushMessageResponseData == null || result.disablePushMessageResponseData.Result == 1)
|
| | |
| | | /// <returns>0:推送 1:不推送</returns>
|
| | | public int GetGarrisonInformationPushStatu(int zoneId)
|
| | | {
|
| | | if (zoneId > 3)
|
| | | {
|
| | | zoneId = 3;
|
| | | }
|
| | | if (this.dicAllZoneInfo.ContainsKey(zoneId) == false)
|
| | | {
|
| | | return 1;
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 报警目标状态的翻译文本_____________
|
| | | #region ■ 执行目标状态的翻译文本_____________
|
| | |
|
| | | /// <summary>
|
| | | /// 获取灯光类型的报警目标的状态文本
|
| | | /// 获取执行目标的状态文本
|
| | | /// </summary>
|
| | | /// <param name="listTaskInfo">动作对象,可以为空</param>
|
| | | /// <returns></returns>
|
| | | public string GetLightAlarmStatuText(List<Safeguard.TaskListInfo> listTaskInfo)
|
| | | public string GetAdjustTargetStatuText(List<Safeguard.TaskListInfo> listTaskInfo)
|
| | | {
|
| | | if (listTaskInfo == null || listTaskInfo.Count == 0)
|
| | | {
|
| | |
| | | }
|
| | | //要考虑它的排列顺序(可以按需求变更编号)
|
| | | Dictionary<int, string> dicSort = new Dictionary<int, string>();
|
| | | //最大编号
|
| | | int MaxNo = 4;
|
| | | //开关的位置编号
|
| | | int ControlNo = 0;
|
| | | //百分比的位置编号
|
| | | int persentNo = 1;
|
| | | //空调温度的位置编号
|
| | | int temparetureNo = 2;
|
| | | //空调模式的位置编号
|
| | | int modelNo = 3;
|
| | | //空调风速的位置编号
|
| | | int windNo = 4;
|
| | |
|
| | | foreach (var info in listTaskInfo)
|
| | | {
|
| | | #region ■ 开关控制____
|
| | | //开关控制
|
| | | if (info.TaskType == 1)
|
| | | {
|
| | |
| | | dicSort[ControlNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 亮度调节____
|
| | | //亮度调节
|
| | | else if (info.TaskType == 3)
|
| | | {
|
| | | dicSort[persentNo] = info.Data1 + "%";
|
| | | if (info.Data1 == 0)
|
| | | {
|
| | | //关
|
| | | dicSort[persentNo] = Language.StringByID(R.MyInternationalizationString.uSimpleClose);
|
| | | }
|
| | | else
|
| | | {
|
| | | dicSort[persentNo] = $"{(int)(info.Data1 * 1.0 / 254 * 100)}%";
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 窗帘设备____
|
| | | //窗帘设备(它的开关和开关控制是反过来的)
|
| | | else if (info.TaskType == 6)
|
| | | {
|
| | |
| | | dicSort[persentNo] = info.Data2 + "%";
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 空调设备____
|
| | | //空调设备
|
| | | else if (info.TaskType == 5)
|
| | | {
|
| | | if (info.Data1 == 3)
|
| | | {
|
| | | if (info.Data2 == 0)
|
| | | {
|
| | | return Language.StringByID(R.MyInternationalizationString.uSimpleClose);
|
| | | }
|
| | | else if (info.Data2 == 1)
|
| | | {
|
| | | //自动
|
| | | dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Auto);
|
| | | }
|
| | | else if (info.Data2 == 3)
|
| | | {
|
| | | //制冷
|
| | | dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Cool);
|
| | | }
|
| | | else if (info.Data2 == 4)
|
| | | {
|
| | | //制热
|
| | | dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Heat);
|
| | | }
|
| | | else if (info.Data2 == 7)
|
| | | {
|
| | | //送风
|
| | | dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly);
|
| | | }
|
| | | else if (info.Data2 == 8)
|
| | | {
|
| | | //除湿
|
| | | dicSort[modelNo] = Language.StringByID(R.MyInternationalizationString.Mode_Dry);
|
| | | }
|
| | | }
|
| | | else if (info.Data1 == 4 || info.Data1 == 5|| info.Data1 == 7)
|
| | | {
|
| | | //温度
|
| | | dicSort[temparetureNo] = $"{ info.Data2 / 100}℃";
|
| | | }
|
| | | else if (info.Data1 == 6)
|
| | | {
|
| | | if (info.Data2 == 1)
|
| | | {
|
| | | //低风
|
| | | dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Low);
|
| | | }
|
| | | else if (info.Data2 == 2)
|
| | | {
|
| | | //中风
|
| | | dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Middle);
|
| | | }
|
| | | else if (info.Data2 == 3)
|
| | | {
|
| | | //高风
|
| | | dicSort[windNo] = Language.StringByID(R.MyInternationalizationString.Fan_Height);
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | //如果开关和百分比一起存在的话,则不显示开关文字
|
| | | if (dicSort.ContainsKey(ControlNo) == true && dicSort.ContainsKey(persentNo) == true)
|
| | | {
|
| | | dicSort.Remove(ControlNo);
|
| | | }
|
| | |
|
| | | //拼接文本
|
| | | string txtvalue = string.Empty;
|
| | | for (int i = 0; i < dicSort.Count; i++)
|
| | | for (int i = 0; i <= MaxNo; i++)
|
| | | {
|
| | | txtvalue += dicSort[i] + " ";
|
| | | if (dicSort.ContainsKey(i) == true)
|
| | | {
|
| | | txtvalue += dicSort[i] + " ";
|
| | | }
|
| | | }
|
| | |
|
| | | return txtvalue.Trim();
|
| | |
| | | bool success = false;
|
| | | //超时时间
|
| | | int TimeOut = 0;
|
| | | string checkTopic = HdlGatewayLogic.Current.GetGatewayId(realWay) + "/Security/AdminSetNewPassword_Respon";
|
| | | string checkTopic = realWay.GwId + "/Security/AdminSetNewPassword_Respon";
|
| | | Action<string, string> getResultAction = (topic, message) =>
|
| | | {
|
| | | try
|
| | |
| | | /// </summary>
|
| | | public string ZoneName;
|
| | | /// <summary>
|
| | | /// 信息推送 0:推送 1:不推送 (只有防区ID:1,2,3才会有。4,5的都归为3,因为它是以防区模式ID(ActionType)为单位的)
|
| | | /// 信息推送 0:推送 1:不推送 |
| | | /// </summary>
|
| | | public int InformationPush = 1;
|
| | | /// <summary>
|