黄学彪
2019-11-13 8b9ce384b26c414db32f98e94e088f5334869c2d
ZigbeeApp/Shared/Phone/ZigBee/Device/Safeguard.cs
@@ -6613,7 +6613,65 @@
                System.Console.WriteLine($"Security/AddZoneAction(设置胁迫状态下的电话号码)_Actions 退出_{System.DateTime.Now.ToString()}");
                return d;
            });
        }
        /// <summary>
        /// *设置胁迫状态下被通知的联系号码的备注(需要管理员权限). -2:主网关丢失
        /// </summary>
        /// <param name="strPhone">地区码-联系方式</param>
        /// <param name="strNote">备注,最大63byte</param>
        /// <returns></returns>
        public static async System.Threading.Tasks.Task<SetCoercePhoneNumberResponseData> SetCoercePhoneNumberNoteAsync(string strPhone,string strNote)
        {
            SetCoercePhoneNumberResponseData d = null;
            var mainGateway = ZbGateway.MainGateWay;
            if (mainGateway == null)
            {
                d = new SetCoercePhoneNumberResponseData();
                d.Result = -2;
                return d;
            }
            Action<string, string> action = (topic, message) =>
            {
                var gatewayID = topic.Split('/')[0];
                if (topic == gatewayID + "/" + "Security/AddPushNumberNote_Respon")
                {
                    var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
                    d = Newtonsoft.Json.JsonConvert.DeserializeObject<SetCoercePhoneNumberResponseData>(jobject["Data"].ToString());
                }
            };
            mainGateway.Actions += action;
            try
            {
                var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 4038 } };
                var data = new JObject
                    {
                        { "ActionType", 253},
                        { "LoginToken", Shared.Phone.UserCenter.HdlSafeguardLogic.Current.GetLoginToken()},
                        { "PushNumber", strPhone},
                        { "PushNumberNote", strNote}
                    };
                jObject.Add("Data", data);
                mainGateway.Send("Security/AddPushNumberNote", jObject.ToString());
            }
            catch { }
            int timeOut = 0;
            while (timeOut <= 60)
            {
                await System.Threading.Tasks.Task.Delay(50);
                if (d != null)
                {
                    break;
                }
                timeOut++;
            }
            mainGateway.Actions -= action;
            return d;
        }
        /// <summary>
        /// 设置胁迫状态下被通知的联系号码的返回数据 ,网关反馈信息
@@ -6695,7 +6753,10 @@
            /// 推送信息的目标手机号码
            ///</summary>
            public string PushNumber;
            /// <summary>
            /// 备注信息
            /// </summary>
            public string PushNumberNote;
        }
        /// <summary>