From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 30 十一月 2021 13:14:28 +0800
Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。

---
 HDL_ON/DAL/Server/HttpServerRequest.cs | 2452 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 2,106 insertions(+), 346 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index d7c2587..aec2776 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1,11 +1,10 @@
-锘縰sing System;
+锘縰sing System;
 using System.Collections.Generic;
 using System.IO;
-using System.Net;
+using System.Net;
 using System.Text;
 using HDL_ON.Entity;
 using Newtonsoft.Json.Linq;
-using Shared;
 
 namespace HDL_ON.DAL.Server
 {
@@ -31,199 +30,304 @@
 
               */
 
-        public string relaseaSever = "https://global.hdlcontrol.com/HangZhouHdlCloudApi";
-        public string debugSever = "https://global.hdlcontrol.com/ProposedProductionApi";
 
-        string severAddress;
+        string severAddress = "https://global.hdlcontrol.com/ProposedProductionApi";
 
         public HttpServerRequest()
         {
-#if DEBUG
-            severAddress = debugSever;
-#else
-            severAddress = relaseaSever;
-#endif
         }
 
-        public string GetRequestResultMsg(string resultCode)
+        #region kaede ___________浼犳劅鍣ㄥ巻鍙叉暟鎹甠_________________
+        /// <summary>
+        /// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹�
+        /// </summary>
+        /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈� </param>
+        /// <param name="deviceId">璁惧ID</param>
+        /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey)
         {
-            string result = "";
-            switch (resultCode.ToUpper())
-            {
-                case "USERNAMEORPWDERROR":
-                    result = Language.StringByID(StringId.LoginFailed_AccountOrPasswordError);
-                    break;
-                case "ACCOUNTNOEXISTS":
-                    result = Language.StringByID(StringId.ACCOUNTNOEXISTS);
-                    break;
-                case "SENDFAIL":
-                    result = Language.StringByID(StringId.FailedToSendVerificationCode);
-                    break;
-                case "EXIST":
-                    result = Language.StringByID(StringId.AccountAlreadyExists);
-                    break;
-                case "Self:Net_Error":
-                    result = Language.StringByID(StringId.NetworkAnomaly);
-                    break;
-            }
-            return result;
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("type", qType);
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId",  deviceId );
+            d.Add("key",  deviceKey );
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
+        }
+        /// <summary>
+        /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹�
+        /// </summary>
+        /// <param name="deviceId">璁惧ID</param>
+        /// <param name="pageSize">椤甸潰澶у皬</param>
+        /// <param name="pageNo">椤靛彿</param>
+        /// <returns></returns>
+        public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("pageSize", pageSize);
+            d.Add("pageNo", pageNo);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
+        }
+        /// <summary>
+        /// 璇诲彇鏈�杩戜竴涓湀鐨勬暟鎹�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetLastMonthHistory(string deviceId,string key)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("key", key);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_SensorLastMonthHistoricalData, requestJson);
         }
 
 
+        #endregion
+
+        //public string GetRequestResultMsg(string resultCode)
+        //{
+        //    string result = "";
+        //    switch (resultCode.ToUpper())
+        //    {
+        //        case "USERNAMEORPWDERROR":
+        //            result = Language.StringByID(StringId.LoginFailed_AccountOrPasswordError);
+        //            break;
+        //        case "ACCOUNTNOEXISTS":
+        //            result = Language.StringByID(StringId.ACCOUNTNOEXISTS);
+        //            break;
+        //        case "SENDFAIL":
+        //            result = Language.StringByID(StringId.FailedToSendVerificationCode);
+        //            break;
+        //        case "EXIST":
+        //            result = Language.StringByID(StringId.AccountAlreadyUse);
+        //            break;
+        //        case "Self:Net_Error":
+        //            result = Language.StringByID(StringId.NetworkAnomaly);
+        //            break;
+        //    }
+        //    return result;
+        //}
+
+        #region 鈻� 閫氱敤璇锋眰鎺ュ彛_______________________
+        /// <summary>
+        /// 鏍规鐢ㄦ埛璐﹀彿鑾峰彇娉ㄥ唽鍖哄煙 鍏嶇櫥褰� // 妫�娴嬭处鍙锋槸鍚︽敞鍐屼篃鐢ㄨ繖涓帴鍙�
+        /// </summary>
+        /// <param name="account"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetRegionByAccount(string account)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new RegionByAccountObj() { account = account });
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.GlobalRequestHttpsHost);
+        }
+
+        /// <summary>
+        /// 鍒锋柊Token
+        /// </summary>
+        /// <returns></returns>
+        public string RefreshToken()
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj()
+            {
+                refreshToken = UserInfo.Current.RefreshToken,
+            });
+            var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson);
+            if (revertObj.Code.ToUpper() == StateCode.SUCCESS)
+            {
+                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString());
+                UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
+                UserInfo.Current.RefreshToken = revertData.refreshToken;
+                UserInfo.Current.LastTime = DateTime.Now;
+                UserInfo.Current.SaveUserInfo();
+            }
+            return revertObj.Code;
+        }
+
+        #endregion
+
+        /// <summary>
+        /// 缁戝畾璋冭瘯浜哄憳鎻愪氦鐨勪綇瀹�,涓�涓綇瀹呭彧鑳界粦瀹氫竴娆�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew BindingResidence(string strUrl)
+        {
+            try
+            {
+                if (strUrl.Contains("app/home/deliver") == false)
+                {
+                    //闈炴硶鐨刄RL 杩斿洖涓�涓嚜瀹氫箟鐨勭姸鎬佺爜
+                    return new ResponsePackNew() { Code = "-100" };
+                }
+                var client = new RestSharp.RestClient(strUrl);
+
+                var request = new RestSharp.RestRequest(RestSharp.Method.GET);
+                request.Timeout = 5 * 1000;
+                request.AddHeader("content-type", "application/json");
+                request.AddHeader("Authorization", UserInfo.Current.LoginTokenString);
+
+                var response = client.Execute(request);
+                if (response.StatusCode == HttpStatusCode.OK)
+                {
+                    return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            catch
+            {
+                return null;
+            }
+        }
 
         #region 娉ㄥ唽銆佺櫥褰曢儴鍒�
+
+
+        /// <summary>
+        /// 閫氱敤 鍙戦�侀獙璇佺爜鏂规硶
+        /// </summary>
+        /// <param name="verifyType">1:娉ㄥ唽 2锛氭壘鍥炲瘑鐮� 3锛氱粦瀹�4:楠岃瘉鐮佺櫥闄� 5:鏁忔劅鏁版嵁</param>
+        /// <param name="account">閭鎴栬�呮墜鏈哄彿</param>
+        /// <param name="isPhone">鏄惁鎵嬫満</param>
+        /// <param name="phoneZoneCode">鎵嬫満鍥藉鍖哄彿</param>
+        /// <returns></returns>
+        public ResponsePackNew VerificationCodeSend(VerifyType verifyType, string account, bool isPhone = false, string phoneZoneCode = "86")
+        {
+            var requestObj = new VerifyCodeSendObj()
+            {
+                verifyType = (int)verifyType,
+                languageType = Utlis.GetPostLanguageType()
+            };
+            // 鏄惁鏄墜鏈� 
+            if (isPhone)
+            {
+                requestObj.phone = account;
+                requestObj.phonePrefix = phoneZoneCode;
+            }
+            else
+            {
+                requestObj.mail = account;
+            }
+            // 瓒呮椂鏃堕棿璁剧疆涓�20绉掞紝搴旇娴嬭瘯娴峰鏈嶅姟鍣ㄥ彂閫侀獙璇佺爜鍝嶅簲鏃堕棿寰堜箙
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Verification_Send, requestJson, "", "", HttpUtil.TIME_OUT_LONG);
+        }
+
         /// <summary>
         /// 璐﹀彿鐧诲綍-浣跨敤瀵嗙爜
         /// </summary>
-        public ResponsePack LoginByPassword(string account, string password)
+        /// <param name="account">璐﹀彿</param>
+        /// <param name="password">瀵嗙爜</param>
+        /// <returns></returns>
+        public ResponsePackNew LoginByPassword(string account, string password)
         {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Password\":" + "\"" + password + "\"" + 
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/Login", jsonString, false);
+            var requestJson = HttpUtil.GetSignRequestJson(new LoginObj()
+            {
+                account = account,
+                loginPwd = password
+            });
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson);
         }
 
         /// <summary>
         /// 楠岃瘉鐮佺櫥褰�
         /// </summary>
-        public ResponsePack LoginValidCode(string account,string vCode)
+        /// <param name="account">璐﹀彿</param>
+        /// <param name="vCode">楠岃瘉鐮�</param>
+        /// <returns></returns>
+        public ResponsePackNew LoginValidCode(string account, string vCode)
         {
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            d.Add("Account", account);
-            d.Add("Code", vCode);
-            d.Add("Language", Language.CurrentLanguage);
-            d.Add("AreaCode", "86");
-            var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            return RequestHttps($"{severAddress}/ZigbeeUsers/LoginValidCode", jsonString, false);
-        }
-
-        /// <summary>
-        /// 鎵嬫満鍙风爜娉ㄥ唽
-        /// </summary>
-        /// <param name="mobileNumber"></param>
-        /// <param name="password"></param>
-        /// <param name="language"></param>
-        public ResponsePack RegisterPhone(string mobileNumber, string password, string language)
-        {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + mobileNumber + "\"" + "," +
-                                "\"Password\":" + "\"" + password + "\"" + "," +
-                                "\"Language\":" + "\"" + language + "\"" +
-                                "\"AreaCode\":" + "\"" + "86" + "\"" +
-                                "}";
-            return RequestHttps($"{severAddress}/SignIn", jsonString, false);
-        }
-
-        public ResponsePack GetAreaCode()
-        {
-            string requestJson = "{}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/GetAreaCode", requestJson, false);
+            var requestJson = HttpUtil.GetSignRequestJson(new LoginObj()
+            {
+                account = account,
+                verifyCode = vCode,
+                grantType = "verify"
+            });
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson);
         }
 
         /// <summary>
         /// 楠岃瘉鐭俊鎴栬�呴偖绠遍獙璇佺爜锛屼箣鍚庢敞鍐�
         /// </summary>
-        /// <param name="account">璐﹀彿</param>
+        /// <param name="account">閭鎴栬�呮墜鏈哄彿</param>
         /// <param name="password">瀵嗙爜</param>
-        /// <param name="entryPassword">纭瀵嗙爜</param>
         /// <param name="code">楠岃瘉鐮�</param>
-        /// <param name="areaCode"></param>
+        /// <param name="isPhone">鏄惁鎵嬫満</param>
         /// <returns></returns>
-        public ResponsePack ValidataCodeAndRegister(string account, string password, string entryPassword, string code, int areaCode)
+        public ResponsePackNew ValidataCodeAndRegister(string account, string password, string code, bool isPhone = false)
         {
-            //var requestObj = new ValidateSmsCodeObj() { Phone = accout, Code = code };
-            //var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
-            string requestJson = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Password\":" + "\"" + password + "\"" + "," +
-                                "\"EnterPassword\":" + "\"" + entryPassword + "\"" + "," +
-                                "\"Language\":" + "\"" + MainPage.LoginUser.language.ToLower() + "\"" + "," +
-                                "\"Code\":" + "\"" + code + "\"" + "," +
-                                "\"RegisterSoruce\":" + 0 + "," +
-                                "\"AreaCode\":" + areaCode +
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/ValidataCodeAndRegisterAccount", requestJson, false);
-        }
-
-
-        /// <summary>
-        /// 鑾峰彇娉ㄥ唽楠岃瘉鐮�
-        /// </summary>
-        public ResponsePack GetPhoneRegisterVerCode(string account)
-        {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Company\":" + MainPage.Company + "," +
-                                "\"Language\":" + "\"" +  MainPage.LoginUser.language.ToLower() + "\"" + "," +
-                                "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber +
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/RegisterSendVerCode", jsonString, false);
-
-        }
-
-        
-
-
-        /// <summary>
-        /// 鑾峰彇鐧诲綍楠岃瘉鐮�
-        /// </summary>
-        /// <param name="phoneNum">鎵嬫満鍙风爜</param>
-        public ResponsePack GetPhoneLoginVerCode(string phoneNum)
-        {
-
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + phoneNum + "\"" + "," +
-                                "\"AreaCode\":" + "86" + 
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false);
+            var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code};//, memberName = account 
+            if (isPhone)
+            {
+                requestObj.memberPhone = account;
+            }
+            else
+            {
+                requestObj.memberEmail = account;
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_Register, requestJson);
         }
 
         /// <summary>
-        /// 鍙戦�侀獙璇佺爜
+        /// 蹇樿瀵嗙爜锛岄噸缃瘑鐮�
         /// </summary>
-        public ResponsePack SendSms(string account)
+        /// <param name="account">閭鎴栬�呮墜鏈哄彿</param>
+        /// <param name="password">鏂板瘑鐮�</param>
+        /// <param name="vCode">楠岃瘉鐮�</param>
+        /// <param name="isPhone">鏄惁鎵嬫満璐﹀彿</param>
+        /// <returns></returns>
+        public ResponsePackNew ForgetPassword(string account, string password, string vCode, bool isPhone)
         {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Company\":" + MainPage.Company + "," +
-                                "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," +
-                                "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber +
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false);
+            var requestObj = new ForgetPwdObj() { verifyCode = vCode, loginPwd = password };
+            if (isPhone)
+            {
+                //鎵嬫満蹇樿瀵嗙爜
+                requestObj.memberPhone = account;
+            }
+            else
+            {
+                //閭蹇樿瀵嗙爜
+                requestObj.memberEmail = account;
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_ForgetPwd, requestJson);
         }
 
         /// <summary>
         /// 楠岃瘉楠岃瘉鐮�
         /// </summary>
-        /// <param name="account"></param>
-        /// <param name="code"></param>
+        /// <param name="verifyType">楠岃瘉绫诲瀷</param>
+        /// <param name="account">楠岃瘉璐﹀彿</param>
+        /// <param name="code">楠岃瘉鐮�</param>
+        /// <param name="isPhone">鏄惁鎵嬫満</param>
+        /// <param name="verifySuccessFail">楠岃瘉閫氳繃鍚庯紝楠岃瘉鐮佹槸鍚﹀け鏁�</param>
         /// <returns></returns>
-        public ResponsePack ValidatorCode(string account, string code, int countryIndex)
+        public ResponsePackNew ValidatorCode(VerifyType verifyType, string account, string code, bool isPhone, bool verifySuccessFail = true)
         {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Code\":" + "\"" + code + "\"" + "," +
-                                "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," +
-                                "\"AreaCode\":" + countryIndex +
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/ValidatorCode", jsonString, false);
+            var requestObj = new VerifyCodeCheckObj() { verifyCode = code, verifyType = (int)verifyType, verifySuccessFail = verifySuccessFail };
+            if (isPhone)
+            {
+                //鎵嬫満
+                requestObj.phone = account;
+            }
+            else
+            {
+                //閭
+                requestObj.mail = account;
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Verification_Check, requestJson);
         }
 
-        /// <summary>
-        /// 閲嶈瀵嗙爜
-        /// </summary>
-        /// <returns></returns>
-        public ResponsePack ResetPassword(string account, string password, string rePassword, int countryIndex)
-        {
-            string jsonString = "{" +
-                                "\"Account\":" + "\"" + account + "\"" + "," +
-                                "\"Password\":" + "\"" + password + "\"" + "," +
-                                "\"AgainPassword\":" + "\"" + rePassword + "\"" + "," +
-                                "\"AreaCode\":" + countryIndex +
-                                "}";
-            return RequestHttps($"{severAddress}/ZigbeeUsers/ResetPassword", jsonString, false);
-        }
         #endregion
 
         #region 涓汉淇℃伅閮ㄥ垎
@@ -231,60 +335,56 @@
         /// 鑾峰彇鐢ㄦ埛淇℃伅
         /// </summary>
         /// <returns></returns>
-        public void GetUserInfo()
+        public string GetUserInfo(bool bGetHeadImage = true)
         {
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/GetAccountInfo", requestJson, true);
-
-            if (revertObj.StateCode.ToUpper() == "SUCCESS")
+            var requestJson = HttpUtil.GetSignRequestJson(new NullObj());
+            var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson);
+            if (resultObj.Code == StateCode.SUCCESS)
             {
-                var dataStr = JObject.FromObject(revertObj.ResponseData);
-                //"DistributedMark": "96439601-fd26-4768-8440-1d9dfa32c109",  < !--甯愬彿Id-- >
-                MainPage.LoginUser.userEmailInfo = dataStr.GetValue("Email").ToString();
-                MainPage.LoginUser.userMobileInfo = dataStr.GetValue("Phone").ToString();
-                FileStream fs = null;
-                try
+                var info = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberInfoRes>(resultObj.Data.ToString());
+                UserInfo.Current.userEmailInfo = info.memberEmail;
+                UserInfo.Current.userMobileInfo = info.memberPhone;
+                UserInfo.Current.userName = info.memberName;
+                
+                if (!string.IsNullOrEmpty(info.memberPhonePrefix))
                 {
-                    var headImageString = dataStr.GetValue("HeadImage").ToString();
-                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString);
-                    var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString);
-                    MainPage.LoginUser.headImagePageBytes = headImageBytes;
-                    var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
-
-#if DEBUG
-                    Application.RunOnMainThread(() =>
-                    {
-                        new Tip() { CloseTime = 5, Text = filePath }.Show(MainPage.BasePageView);
-                    });
-#endif
-                    fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
-                    fs.Write(headImageBytes, 0, headImageBytes.Length);
-                    fs.Flush();
-                    MainPage.LoginUser.headImagePagePath = filePath;
-                } catch (Exception ex)
-                {
-                    MainPage.Log($"download headImage error : {ex.Message}");
+                    UserInfo.Current.areaCode = info.memberPhonePrefix;
                 }
-                finally
+                //鏄惁闇�瑕佽幏鍙栧ご鍍�
+                if (bGetHeadImage)
                 {
-                    if (fs != null)
+                    //2020-12-15 淇敼澶村儚鏂规
+                    if (!string.IsNullOrEmpty(info.memberHeadIcon))
                     {
-                        fs.Close();
+                        var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(info.memberHeadIcon);
+
+                        if (headImageBytes != null && headImageBytes.Length > 0)
+                        {
+                            UserInfo.Current.headImagePagePath = info.memberHeadIcon;
+                            //UserInfo.Current.headImagePagePath = imageKey;
+                        }
                     }
                 }
-                // "GesturePwd": null,  < !--鎵嬪娍瀵嗙爜-- >
-                // "StringPwd": null , < !--瀛楃涓插瘑鐮�-- >
-                MainPage.LoginUser.userName = dataStr.GetValue("UserName").ToString();
 
-                Application.RunOnMainThread(() =>
-                {
-                });
-
-                MainPage.LoginUser.SaveUserInfo();
+                UserInfo.Current.SaveUserInfo();
                 MainPage.Log("鑾峰彇鐢ㄦ埛淇℃伅鎴愬姛銆�");
             }
+            return resultObj.Code;
+        }
 
+        /// <summary>
+        /// 鑾峰彇鐢ㄦ埛澶村儚
+        /// </summary>
+        /// <param name="userId"></param>
+        public void GetUserHeadImageByKey(string imageKey)
+        {
+            var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(imageKey);
+
+            if (headImageBytes != null && headImageBytes.Length > 0)
+            {
+                //UserInfo.Current.headImagePageBytes = headImageBytes;
+                UserInfo.Current.headImagePagePath = imageKey;
+            }
         }
 
         /// <summary>
@@ -292,108 +392,920 @@
         /// </summary>
         /// <param name="userName"></param>
         /// <returns></returns>
-        public ResponsePack EditUserName(string userName)
+        public ResponsePackNew EditUserName(string userName)
         {
-            Dictionary<string, string> d = new Dictionary<string, string>();
-            d.Add("UserName", userName);
-            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/UpdateUserName", requestJson, true);
-            return revertObj;
+            var requestJson = HttpUtil.GetSignRequestJson(new UpdateMemberNameRes()
+            {
+                memberName = userName
+            });
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
+        }
 
+        ///// <summary>
+        ///// 鏇存柊鐢ㄦ埛澶村儚
+        ///// </summary>
+        ///// <param name="userName"></param>
+        ///// <returns></returns>
+        //public ResponsePackNew UpdateMemberHeadIcon(string memberHeadIcon)
+        //{
+        //    var requestJson = HttpUtil.GetSignRequestJson(new UpdateMemberHeadIconRes()
+        //    {
+        //        memberHeadIcon = memberHeadIcon
+        //    });
+        //    return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
+        //}
+
+        ///// <summary>
+        ///// 鏇存柊鐢ㄦ埛澶村儚
+        ///// </summary>
+        ///// <param name="vs"></param>
+        ///// <returns></returns>
+        //public string UpdataUserHeadImage(string fileName)
+        //{
+        //    byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
+        //    var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
+        //    return revertObj.Code;
+        //}
+
+        /// <summary>
+        /// 鏇存敼缁戝畾璐︽埛鐨勯偖绠辨垨鑰呮墜鏈哄彿
+        /// 2020-11-16 寰呬慨鏀�
+        /// </summary>
+        /// <param name="account"></param>
+        /// <param name="code"></param>
+        /// <param name="isPhone"></param>
+        /// <returns></returns>
+        public string BindAccount(string account, string code = "", bool isPhone = false)
+        {
+            var requestObj = new BindWithAccountObj() { verifyCode = code };
+            if (isPhone)
+            {
+                //鎵嬫満
+                requestObj.memberPhone = account;
+            }
+            else
+            {
+                //閭
+                requestObj.memberEmail = account;
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_BindWithAccount, requestJson).Code;
         }
 
         /// <summary>
-        /// 鏇存柊鐢ㄦ埛澶村儚
+        /// 瑙g粦鎵嬫満鎴栬�呴偖绠�
         /// </summary>
-        /// <param name="vs"></param>
+        /// <param name="isPhone"></param>
         /// <returns></returns>
-        public string UpdataUserHeadImage(string fileName)
+        public string UnBindAccount(bool isPhone)
         {
-            FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
-            byte[] bytes = new byte[fs.Length];
-            fs.Read(bytes, 0, bytes.Length);
-
-            Dictionary<string, byte[]> d = new Dictionary<string, byte[]>();
-            d.Add("HeadImage", bytes);
-            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-
-            var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/UpdateHeadImage", requestJson, true);
-            return revertObj.StateCode;
+            var requestObj = new UnBindAccountObj() { unBindLabel = isPhone ? "PHONE" : "EMAIL" };
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UnbindWithAccount, requestJson).Code;
         }
+
+        /// <summary>
+        /// 鏍规嵁璐﹀彿,鑾峰彇璐﹀彿淇℃伅
+        /// </summary>
+        /// <param name="i_account">鎸囧畾璐﹀彿</param>
+        /// <returns></returns>
+        public ResponsePackNew GetMemberInfoByAccount(string i_account)
+        {
+            var pra = new { account = i_account };
+            var requestJson = HttpUtil.GetSignRequestJson(pra);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfoByAccount, requestJson);
+        }
+
         #endregion
 
         #region 浣忓畢閮ㄥ垎
         /// <summary>
         /// 鑾峰彇浣忓畢鍒楄〃
         /// </summary>
-        public string GetHomePager()
+        public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL,string homeId = "")
         {
-            string jsonString = "{" +
-                                "\"RequestVersion\":" + "\"" + MainPage.VersionString + "\"" + "," +
-                                "\"RequestSource\":" + "\"" + "2" + "\"" + "," +
-                                "\"HomeType\":" + "\"" + "1" + "\"" + "," +
-                                "\"LoginAccessToken\":" + "\"" + MainPage.LoginUser.loginTokenString + "\"" +
-                                "}";
-            var responsePack = RequestHttps($"{severAddress}/App/GetHomePager", jsonString,false);
-
-            if (responsePack.StateCode.ToUpper() == "SUCCESS")
+            var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() });
+            var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
+            if (resultObj.Code == StateCode.SUCCESS)
             {
-                var dataStr = JObject.FromObject(responsePack.ResponseData);
-                //娌℃湁浣忓畢
-                if (dataStr.GetValue("PageData").ToString() == "[]")
+                UserInfo.Current.regionList = new List<RegionInfoRes>();
+                var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>>(resultObj.Data.ToString());
+                if (homeList == null || homeList.Count == 0)
                 {
-
                 }
                 else
                 {
-                    MainPage.LoginUser.regionList = new List<RegionInfoRes>();
-                    foreach (var jsonData in dataStr.GetValue("PageData"))
+                    foreach (var home in homeList)
                     {
-                        var homeJsonStr = JObject.FromObject(jsonData);
-                        var home = new RegionInfoRes()
+                        if (home.isBindGateway)
                         {
-                            RegionID = homeJsonStr.GetValue("Id").ToString(),
-                            RegionName = homeJsonStr.GetValue("RegionName").ToString(),
-                            Name = homeJsonStr.GetValue("Name").ToString(),
-                            Address = homeJsonStr.GetValue("Address").ToString(),
-                        };
-                        MainPage.LoginUser.regionList.Add(home);
+                            UserInfo.Current.regionList.Add(home);
+                            //鏂扮粦瀹氱殑浣忓畢锛岀洿鎺ュ垏鎹㈠埌鏂颁綇瀹�
+                            if (!string.IsNullOrEmpty(homeId))
+                            {
+                                if (homeId.Contains(home.id))
+                                {
+                                    DB_ResidenceData.Instance.CurrentRegion = home;
+                                }
+                            }
+                        }
                     }
-                    DB_ResidenceData.residenceData.SaveResidenceData();
-                    MainPage.LoginUser.SaveUserInfo();
+                    if(UserInfo.Current.regionList.Count== 0)
+                    {
+                        return "null";
+                    }
+                    //-------濡傛灉璐﹀彿鏄娆$櫥褰�
+                    if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.id))
+                    {
+                        //鍒锋柊褰撳墠浣忓畢
+                        DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
+                        DB_ResidenceData.Instance.SaveResidenceData();
+                        UserInfo.Current.SaveUserInfo();
+                        //鍒锋柊涓�娆′綇瀹呯綉鍏�
+                        GetHomeGatewayList();
+                    }
+                    else
+                    {
+                        //浣忓畢琚垹闄�
+                        var findHome = UserInfo.Current.regionList.Find((obj) => obj.id == DB_ResidenceData.Instance.CurrentRegion.id);
+                        if (findHome == null)
+                        {
+                            Shared.Application.RunOnMainThread(() =>
+                            {
+                                DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
+                                GetHomeGatewayList();
+                                DB_ResidenceData.Instance.SaveResidenceData();
+                                UserInfo.Current.SaveUserInfo();
+                                Action action = () =>
+                                {
+                                    MainPage.GoUserPage(true);
+                                };
+                                new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action);
+                            });
+                        }
+                        else
+                        {
+                            //鍒锋柊褰撳墠浣忓畢
+                            DB_ResidenceData.Instance.CurrentRegion = findHome;
+                            DB_ResidenceData.Instance.SaveResidenceData();
+                            UserInfo.Current.SaveUserInfo();
+                            //鍒锋柊涓�娆′綇瀹呯綉鍏�
+                            GetHomeGatewayList();
+                        }
+                    }
                 }
             }
-            return responsePack.StateCode;
 
-
+            return resultObj.Code;
         }
+
         /// <summary>
         /// 缂栬緫浣忓畢淇℃伅
         /// </summary>
+        /// <param name="editId">0 淇敼浣忓畢鍚嶅瓧銆�1 淇敼浣忓畢鍦板潃</param>
+        /// <param name="editName"></param>
         /// <returns></returns>
-        public ResponsePack EditResidenceInfo()
+        public ResponsePackNew EditResidenceInfo(int editId, string editName)
         {
-            //鍒涘缓瀛楀吀
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            //娣诲姞鍏冪礌
-            d.Add("RequestVersion", MainPage.VersionString);
-            d.Add("RequestSource", "2");
-            d.Add("LoginAccessToken", MainPage.LoginUser.loginTokenString);
-            d.Add("HomeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
-            d.Add("HomeType", 1);
-            d.Add("Name", DB_ResidenceData.residenceData.residecenInfo.Name);
-            d.Add("Address", DB_ResidenceData.residenceData.residecenInfo.Address);
-            //娣诲姞瀹屾垚浠ュ悗鎶婂瓧鍏哥被涓暟鎹牸寮忓寲涓簀son瀛楃涓�
-            //灏嗗璞¤浆涓簀son瀛楃涓�
+            var requestObj = new AddOrUpdateHomeObj()
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+            };
 
-            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            return RequestHttps($"{severAddress}/App/EditHome", jsonString, false);
+            if (editId == 0)
+            {
+                requestObj.homeName = editName;
+            }
+            else if (editId == 1)
+            {
+                requestObj.homeAddress = editName;
+            }
+
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_UpdateHome, requestJson);
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍒锋柊褰撳墠浣忓畢鐨勭綉鍏冲垪琛�
+        /// </summary>
+        public string GetHomeGatewayList()
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.id)) return "";
+                var nowhomeId = DB_ResidenceData.Instance.CurrentRegion.id;
+                var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = nowhomeId });
+                var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGatewayInfo>>(revertObj.Data.ToString());
+                    if (nowhomeId == DB_ResidenceData.Instance.CurrentRegion.id)
+                    {
+                        if (mHomeGatewayRes != null)
+                        {
+                            if (mHomeGatewayRes.Count > 0)
+                            {
+                                DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
+                                DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
+                                DB_ResidenceData.Instance.SaveResidenceData();
+                                return revertObj.Code;
+                            }
+                        }
+                        //鍏朵綑鎯呭喌娓呯┖缃戝叧淇℃伅
+                        DB_ResidenceData.Instance.HomeGateway = null;
+                        DB_ResidenceData.Instance.SaveResidenceData();
+                    }
+                }
+                else
+                {
+                    //鎻愮ず閿欒
+                }
+                return revertObj.Code;
+            }
+            catch
+            {
+                return "";
+            }
+        }
+        /// <summary>
+        /// 鑾峰彇缃戝叧淇℃伅
+        /// </summary>
+        public string GetGatewayInfo()
+        {
+            if (DB_ResidenceData.Instance.HomeGateway == null)
+                return StateCode.NETWORK_ERROR;
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            var jsonString = HttpUtil.GetSignRequestJson(d);
+            var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGatewayInfo, jsonString);
+            if (revertObj.Code == StateCode.SUCCESS)
+            {
+                var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString());
+                if (mHomeGatewayRes != null)
+                {
+                    DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
+                }
+            }
+            return revertObj.Code;
+        }
+
+        /// <summary>
+        /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetResidenceMemberAccount()
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.id });
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_FindAll, requestJson);
+        }
+
+        /// <summary>
+        /// 鍒犻櫎浣忓畢涓嬬殑鎴愬憳璐﹀彿
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew DeleteResidenceMemberAccount(ResidenceMemberInfo subaccount)
+        {
+            var requestObj = new ChildDeleteObj()
+            {
+                childAccountId = subaccount.childAccountId,
+                homeId = subaccount.homeId
+            };
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Delete, requestJson);
+        }
+
+        /// <summary>
+        /// 淇敼瀛愯处鍙锋樀绉�
+        /// </summary>
+        /// <param name="nickName"></param>
+        /// <param name="subAccountGuid"></param>
+        /// <returns></returns>
+        public ResponsePackNew EditSubAccountNickName(string nickName, string childAccountId)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildNickNameObj()
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+                childAccountId = childAccountId,
+                nickName = nickName,
+            });
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
+
+        }
+        /// <summary>
+        /// 淇敼瀛愯处鍙峰垱寤哄満鏅潈闄�
+        /// </summary>
+        /// <param name="nickName"></param>
+        /// <param name="subAccountGuid"></param>
+        /// <returns></returns>
+        public ResponsePackNew ChangeCreateSceneState(bool isAllow, string childAccountId)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildAllowCreateSceneObj()
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+                childAccountId = childAccountId,
+                isAllowCreateScene = isAllow,
+            });
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
+        }
+
+        /// <summary>
+        /// 杩囨埛
+        /// </summary>
+        /// <param name="i_account">瀵规柟璐﹀彿</param>
+        /// <returns></returns>
+        public bool TransferResidence(string i_account)
+        {
+            var pra2 = new
+            {
+                homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id,
+                account = i_account
+            };
+            var requestJson = HttpUtil.GetSignRequestJson(pra2);
+            var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_TransferResidence, requestJson);
+
+            return result != null && result.Code == StateCode.SUCCESS;
+        }
+
+        /// <summary>
+        /// 绠$悊鍛樻潈闄愯縼绉�
+        /// </summary>
+        /// <param name="i_childAccountId">鎴愬憳璐﹀彿id</param>
+        /// <returns></returns>
+        public bool AdminAuthorityMigration(string i_childAccountId)
+        {
+            var pra2 = new
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+                childAccountId = i_childAccountId
+            };
+            var requestJson = HttpUtil.GetSignRequestJson(pra2);
+            var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_AdminAuthorityMigration, requestJson);
+
+            return result != null && result.Code == StateCode.SUCCESS;
+        }
+
+        #region 鏂版暟鎹垎浜�
+        /// <summary>
+        /// 娣诲姞鍒嗕韩
+        /// </summary>
+        /// <param name="addShareObj"></param>
+        /// <returns></returns>
+        public ResponsePackNew AddShareData(AddShareObj addShareObj)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(addShareObj);
+
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_Add, requestJson);
+        }
+
+        /// <summary>
+        /// 鍒犻櫎鍒嗕韩
+        /// </summary>
+        /// <param name="deleteShareObj"></param>
+        /// <returns></returns>
+        public ResponsePackNew DeleteShareData(DeleteShareObj deleteShareObj)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(deleteShareObj);
+
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_Delete, requestJson);
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍒嗕韩
+        /// </summary>
+        /// <param name="addShareObj"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetShareDataByMemberAccount(string childAccountId)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new GetShareObj()
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+                childAccountId = childAccountId,
+            });
+
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson);
+        }
+       
+        #endregion
+
+        ///// <summary>
+        ///// 鑾峰彇浣忓畢涓嬪瓙璐﹀彿鐨勫叡浜暟鎹垪琛�
+        ///// </summary>
+        ///// <returns></returns>
+        //public ResponsePackNew GetShareDataByMemberAccount(string childAccountId)
+        //{
+        //    //Dictionary<string, object> d = new Dictionary<string, object>();
+        //    //d.Add("DistributedMark", memberId);
+        //    //d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+        //    //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetShareDataBySubAccount", jsonString, true);
+
+        //    var requestJson = HttpUtil.GetSignRequestJson(new HomeShareFindAll()
+        //    {
+        //        homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
+        //        childAccountId = childAccountId
+        //    });
+        //    return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_FindAll, requestJson);
+
+        //}
+
+        ///// <summary>
+        ///// 涓嬭浇鍗曚釜鍒嗕韩鏂囦欢
+        ///// </summary>
+        ///// <returns></returns>
+        //public byte[] GetShareData(ShareData shareData)
+        //{
+        //    //Dictionary<string, object> d = new Dictionary<string, object>();
+        //    //d.Add("DistributedMark", memberId);
+        //    //d.Add("HouseDistributedMark", hId);
+        //    //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetOneShareData", jsonString, true);
+
+        //    var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new ShareFileDownObj()
+        //    {
+        //        homeId = shareData.homeId,
+        //        homeShareId = shareData.id
+        //    });
+        //    var replaceToken = "";
+        //    if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
+        //    {
+        //        replaceToken = DB_ResidenceData.residenceData.MasterToken;
+        //    }
+        //    return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Home_Share_DownOne, requestJson, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
+
+        //}
+
+        ///// <summary>
+        ///// 澧炲姞鍏变韩鏁版嵁鍒楄〃
+        ///// </summary>
+        ///// <returns></returns>
+        //public ResponsePackNew AddShareData(ShareData shareData)
+        //{
+        //    //Dictionary<string, object> d = new Dictionary<string, object>();
+        //    //d.Add("ShareName", shareData.ShareName);
+        //    //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+        //    //d.Add("ShareDataBytes", shareData.ShareDataBytes);
+        //    //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
+        //    //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    //return RequestHttps($"{severAddress}/ZigbeeDataShare/AddShareData", jsonString, true);
+
+        //    var queryDic = new Dictionary<string, object>();
+        //    queryDic.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+        //    queryDic.Add("childAccountId", shareData.childAccountId);
+        //    queryDic.Add("fileName", shareData.fileName);
+        //    var replaceToken = "";
+        //    if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
+        //    {
+        //        replaceToken = DB_ResidenceData.residenceData.MasterToken;
+        //    }
+        //    return HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Home_Share_Add, shareData.ShareDataBytes, queryDic, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
+        //}
+
+        ///// <summary>
+        ///// 澧炲姞鍏变韩鏁版嵁
+        ///// </summary>
+        ///// <returns></returns>
+        //public ResponsePackNew EditShareData(ShareData shareData)
+        //{
+        //    return AddShareData(shareData);
+        //    //Dictionary<string, object> d = new Dictionary<string, object>();
+        //    //d.Add("DistributedMark", shareData.DistributedMark);
+        //    //d.Add("ShareName", shareData.ShareName);
+        //    //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+        //    //d.Add("ShareDataBytes", shareData.ShareDataBytes);
+        //    //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
+        //    //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    //return RequestHttps($"{severAddress}/ZigbeeDataShare/EditShareData", jsonString, true);
+        //}
+
+        ///// <summary>
+        ///// 鍒犻櫎鍏变韩鏁版嵁
+        ///// </summary>
+        ///// <param name="shareData"></param>
+        ///// <returns></returns>
+        //public ResponsePackNew DeleteShareData(ShareData shareData)
+        //{
+        //    var requestJson = HttpUtil.GetSignRequestJson(new ShareFileDownObj()
+        //    {
+        //        homeId = shareData.homeId,
+        //        homeShareId = shareData.id
+        //    });
+        //    return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_Delete, requestJson);
+        //    //Dictionary<string, string> d = new Dictionary<string, string>();
+        //    //d.Add("DistributedMark", shareData.DistributedMark);
+        //    //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+        //    //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    //return RequestHttps($"{severAddress}/ZigbeeDataShare/DeleteShareData", jsonString, true);
+        //}
+        ///// <summary>
+        ///// 鍒犻櫎瀛愯处鍙峰綋鍓嶄綇瀹呯殑鎵�鏈夊叡浜暟鎹�
+        ///// </summary>
+        ///// <returns></returns>
+        //public ResponsePack DeleteCurrentResidenceSharedData(ShareData shareData)
+        //{
+        //    Dictionary<string, string> d = new Dictionary<string, string>();
+        //    d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
+        //    d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+        //    string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    return RequestHttps($"{severAddress}/ZigbeeDataShare/DeleteShareData", jsonString, true);
+        //}
+
+        /// <summary>
+        /// 缁戝畾瀛愯处鍙峰埌浣忓畢涓�
+        /// </summary>
+        /// <param name="subAccount"></param>
+        /// <param name="nickName"></param>
+        /// <returns></returns>
+        public ResponsePackNew BindResidenceMemberAccount(string subAccount, string nickName)
+        {
+            //娣诲姞瀛愯处鍙�
+            var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.id, account = subAccount, nickName = nickName };
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Add, requestJson);
+
+        }
+
+        /// <summary>
+        /// 淇敼浣忓畢璋冭瘯鏉冮檺
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew ChangeResidenceDebugPerm(bool debugPerm)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("debugPerm", debugPerm);
+            var jsonString = HttpUtil.GetSignRequestJson(d,d);
+            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString);
+            return pack;
         }
 
 
+
+
+        #endregion
+        /// <summary>
+        /// 鑾峰彇MQTT杩滅▼杩炴帴淇℃伅鎺ュ彛
+        /// </summary>
+        public MqttInfo GetMqttRemoteInfo(string attachClientId)
+        {
+            try
+            {
+                var requestJson = HttpUtil.GetSignRequestJson(new GetMqttRemoteInfoObj()
+                {
+                    attachClientId = attachClientId,
+                    homeType = HomeTypeEnum.BUSPRO.ToString()
+                });
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetMqttRemoteInfo, requestJson, DB_ResidenceData.Instance.CurrentRegion.regionUrl);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    return Newtonsoft.Json.JsonConvert.DeserializeObject<MqttInfo>(revertObj.Data.ToString());
+                }
+                else
+                {
+                    Utlis.WriteLine("GetMqttRemoteInfo error");
+                    return null;
+                }
+            }
+            catch
+            {
+                return null;
+            }
+        }
+
+        #region 鎺ㄩ��
+        /// <summary>
+        /// 鎻愪氦鎺ㄩ�侀渶瑕佺殑鍏抽敭鏍囪瘑淇℃伅
+        /// </summary>
+        public bool PushSerivceAddPushInfo()
+        {
+            try
+            {
+                //鍏堟竻绌烘帹閫両D锛岄伩鍏嶄娇鐢ㄧ紦瀛樼殑PushId涓哄叾瀹冭处鍙风殑鎯呭喌锛屽鑷存煡璇㈠埌鍏跺畠璐﹀彿鐨勬帹閫佽褰�
+                OnAppConfig.Instance.PushId = "";
+
+                string deviceType = PhoneDeviceType.Android.ToString();
+#if __IOS__
+                deviceType = PhoneDeviceType.IOS.ToString();
+#endif
+                //鏄惁鐢熶骇妯″紡
+                bool isProduce = true;
+#if DEBUG
+                isProduce = false;
+#endif
+
+                if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) {
+                    Utlis.WriteLine("PushDeviceToken 涓虹┖");
+                    return false;
+                }
+
+                var mAddpushinfoObj = new AddpushinfoObj()
+                {
+                    pushToken = OnAppConfig.Instance.PushDeviceToken,
+                    deviceName = OnAppConfig.Instance.PhoneName,
+                    deviceType = deviceType,
+                    produce = isProduce,
+                    
+                };
+                mAddpushinfoObj.languageType = Utlis.GetPostLanguageType();
+
+#if DEBUG
+                //List<string> communityCodes = new List<string>();
+                //communityCodes.Add("");
+                //mAddpushinfoObj.communityCodes = communityCodes;
+#endif
+
+                //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj);
+                var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj);
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_AddToken, mAddpushinfoJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    if (revertObj.Data != null)
+                    {
+                        var pushId = revertObj.Data.ToString();
+                        if (!string.IsNullOrEmpty(pushId))
+                        {
+                            OnAppConfig.Instance.PushId = pushId;
+                            OnAppConfig.Instance.SaveConfig();
+                            Utlis.WriteLine("PushId: " + pushId);
+                           
+                            return true;
+                        }
+                    }
+                 
+                }
+                else
+                {
+                    //Utlis.WriteLine("AddToken 澶辫触");
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+
+        /// <summary>
+        /// 鏌ヨ鎺ㄩ�佷俊鎭垪琛�
+        /// </summary>
+        /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅 4鐗╀笟閫氱煡</param>
+        /// <returns></returns>
+        public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0)
+        {
+            string pushType = null;
+
+            if (queryType == 1)
+            {
+                pushType = PushType.Default.ToString();
+            }
+            else if (queryType == 2)
+            {
+                pushType = PushType.Alarm.ToString();
+            }
+            else if (queryType == 3)
+            {
+                pushType = PushType.Prompt.ToString();
+            }
+            else if (queryType == 4)
+            {
+                pushType = PushType.Notice.ToString();
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
+            {
+                pushId = OnAppConfig.Instance.PushId,
+                pushType = pushType,
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+            });
+            //2021-08-28 鏀逛负鍒嗛〉鏌ヨ
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist_Paging, requestJson);
+        }
+
+        /// <summary>
+        /// 娓呯┖娑堟伅璁板綍
+        /// </summary>
+        /// <returns></returns>
+        public bool PushSerivceClearmessagelist()
+        {
+            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+
+            var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
+            {
+                pushId = OnAppConfig.Instance.PushId
+            });
+
+            var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Clearmessagelist, requestJson);
+            if (revertObj.Code == StateCode.SUCCESS)
+            {
+                return true;
+            }
+            else
+            {
+
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 閫�鍑虹櫥褰曪紝娓呯┖鎺ㄩ�佹爣璇�
+        /// </summary>
+        /// <returns></returns>
+        public bool PushSerivceSignOut()
+        {
+            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+            try
+            {
+                var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() {
+                    pushId = OnAppConfig.Instance.PushId
+                });
+               
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_DeleteToken, requestJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    return true;
+                }
+                else
+                {
+
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 鏍囪娑堟伅鍏ㄩ儴宸茶
+        /// </summary>
+        /// <param name="msgId"></param>
+        /// <returns></returns>
+        public bool PushSerivceMarkAllMessageRead()
+        {
+            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+
+            try
+            {
+                var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
+                {
+                    pushId = OnAppConfig.Instance.PushId
+                });
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_ALLMarkread, requestJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    return true;
+                }
+                else
+                {
+
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 鏍囪鎸囧畾娑堟伅宸茶
+        /// </summary>
+        /// <param name="msgId"></param>
+        /// <returns></returns>
+        public bool PushSerivceMarkMessageRead(string msgId)
+        {
+            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+
+            try
+            {
+                var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj()
+                {
+                    msgId = msgId
+                });
+
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Markread, requestJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    return true;
+                }
+                else
+                {
+
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 閫氳繃涓婚敭id鍒犻櫎涓�鏉℃帹閫佽褰�
+        /// </summary>
+        /// <param name="msgId"></param>
+        /// <returns></returns>
+        public bool PushSerivceDeleteMessage(PushMsgIdObj mPushMsgIdObj)
+        {
+            if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+            if (mPushMsgIdObj == null) return false;
+            try
+            {
+                var requestJson = HttpUtil.GetSignRequestJson(mPushMsgIdObj);
+
+                var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Deletepushinfo, requestJson);
+                if (revertObj.Code == StateCode.SUCCESS)
+                {
+                    return true;
+                }
+                else
+                {
+                    IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code);
+                }
+                return false;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 娉ㄥ唽鎺ㄩ��
+        /// </summary>
+        public void RegisteredPush()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var success = PushSerivceAddPushInfo();
+                if (success)
+                {
+                    Utlis.WriteLine("鎺ㄩ�佹敞鍐屾垚鍔�");
+                }
+                else
+                {
+                    Utlis.WriteLine("鎺ㄩ�佹敞鍐屽け璐�");
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
+        /// <summary>
+        /// 娉ㄩ攢鎺ㄩ��
+        /// </summary>
+        public void SignOutPush()
+        {
+            new System.Threading.Thread(() =>
+            {
+                var success = PushSerivceSignOut();
+                if (success)
+                {
+                    Utlis.WriteLine("鎺ㄩ�佹敞閿�鎴愬姛");
+                }
+                else
+                {
+                    Utlis.WriteLine("鎺ㄩ�佹敞閿�澶辫触");
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐗╀笟鍏憡璇︽儏
+        /// </summary>
+        /// <param name="noticeId"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetPropertyNoticeDetails(string noticeId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("noticeId", noticeId);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_GetNoticeInfo, requestJson);
+        }
         #endregion
 
-        #region 鑾峰彇澶╂皵閮ㄥ垎
+        #region 妫�娴嬫洿鏂�
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew CheckAppVersion()
+        {
+            var requestObj = new AppVersionCheckObj()
+            {
+
+            };
+
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_CheckAppVersion, requestJson);
+        }
+
+
+
+#endregion
+
+#region 鑾峰彇澶╂皵閮ㄥ垎
         /// <summary>
         /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅
         /// </summary>
@@ -433,9 +1345,14 @@
                             responseString = Encoding.UTF8.GetString(webClient.DownloadData(url));
                             revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString);
                             jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(revertObj.ResponseData.ToString());
-                            MainPage.cityInfo.temperature = jt.GetValue("Temperature").ToString()+ "掳";
-                            MainPage.cityInfo.humidity = jt.GetValue("Humidity").ToString()+"%";
+                            MainPage.cityInfo.temperature = jt.GetValue("Temperature").ToString();
+                            MainPage.cityInfo.humidity = jt.GetValue("Humidity").ToString();
                             MainPage.cityInfo.pm25 = jt.GetValue("Air_Quality").ToString();
+                            MainPage.cityInfo.windLevel = jt.GetValue("WindLevel").ToString();
+                            MainPage.cityInfo.weather = jt.GetValue("Weather").ToString();
+                            MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString();
+                            MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString();
+
                             break;
                         }
                         catch (Exception ex)
@@ -445,7 +1362,8 @@
                     }
                     System.Threading.Thread.Sleep(1000);
                 }
-                Shared.Application.RunOnMainThread(() => {
+                Shared.Application.RunOnMainThread(() =>
+                {
                     try
                     {
                         HDL_ON.UI.HomePage.LoadEvent_RefreshAir();
@@ -455,37 +1373,38 @@
             });
         }
 
-        #endregion
+#endregion
 
 
-        #region 澶囦唤閮ㄥ垎
-        /// <summary>
-        /// 鑾峰彇浣忓畢澶囦唤鍒楄〃
-        /// </summary>
-        public Dictionary<int,string> GetRegionLastBackupId()
-        {
-            //Dialog dialog = new Dialog();
-            //dialog.Show();
+#region 澶囦唤閮ㄥ垎
+        ///// <summary>
+        ///// 鑾峰彇浣忓畢澶囦唤鍒楄〃
+        ///// </summary>
+        //public Dictionary<int, string> GetRegionLastBackupId()
+        //{
+        //    //Dialog dialog = new Dialog();
+        //    //dialog.Show();
 
-            Dictionary<int, string> backupList = new Dictionary<int, string>();
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            d.Add("LevelID", DB_ResidenceData.residenceData.residecenInfo.RegionID);// 199200);
-            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/GetUserFolder", requestJson, true);
-            if(revertObj == null || revertObj.ResponseData == null)
-            {
-                return new Dictionary<int, string>();
-            }
-            var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString());
-            foreach (var j in jt)
-            {
-                var folderId = (int)j.GetValue("FolderID");
-                var folderName = j.GetValue("FolderName").ToString();
-                backupList.Add(folderId, folderName);
-            }
-            return backupList;
-        }
+        //    Dictionary<int, string> backupList = new Dictionary<int, string>();
+        //    Dictionary<string, object> d = new Dictionary<string, object>();
+        //    d.Add("LevelID", DB_ResidenceData.residenceData.residecenInfo.RegionID);// 199200);
+        //    var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+        //    var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/GetUserFolder", requestJson, true);
+        //    if (revertObj == null || revertObj.ResponseData == null)
+        //    {
+        //        return new Dictionary<int, string>();
+        //    }
+        //    var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString());
+        //    foreach (var j in jt)
+        //    {
+        //        var folderId = (int)j.GetValue("FolderID");
+        //        var folderName = j.GetValue("FolderName").ToString();
+        //        backupList.Add(folderId, folderName);
+        //    }
+        //    return backupList;
+        //}
 
+        /* 2020-09-01 寮冪敤 鎭㈠鏃ф暟鎹姛鑳藉湪bus杞欢涓婂疄鐜�
         /// <summary>
         /// 鑾峰彇澶囦唤鏂囦欢鍒楄〃
         /// </summary>
@@ -503,11 +1422,11 @@
                 var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
                 var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/UserBackupList", requestJson, true);
                 var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString());
-                #region 鎭㈠鎴块棿鏁版嵁
+#region 鎭㈠鎴块棿鏁版嵁
 
 
                 GetBackupRoom(jt,loading);
-                #endregion
+#endregion
                
                 Application.RunOnMainThread(() => {
                     loading.Hide();
@@ -616,7 +1535,7 @@
                 //    backgroundImage = "Classification/Room/Roombg.png",
                 //    //backgroundImage = ss.GetValue("BackGroundImage").ToString() == "Room/r1.png" ? "Classification/Room/Roombg.png" : filePath,
                 //};
-                //DB_ResidenceData.residenceData.rooms.Add(room1);
+                //DB_ResidenceData.rooms.Add(room1);
                 //roomList.Add(ss, room1);
 
             }
@@ -689,23 +1608,8 @@
 
                 /// <summary>
                 /// 鍔熻兘ID
-                /// 鍘傚晢浠g爜	2bytes;     01	HDL
-                /// 閫氳鏂瑰紡	1byte ;     01	HDL Bus; 02	Zigbee;03	KNX;04	Z-Wave
-                /// 浜у搧GUID	8bytes
-                /// 浜у搧绫诲埆	1byte ;     01  璋冨厜鍣�;02缁х數鍣�;03骞叉帴鐐规ā鍧�;04浼犳劅鍣�;05闈㈡澘
-                /// 鐗╂ā鍨嬬被鍨�2bytes      01 寮�鍏崇被    --01寮�鍏�;02鎻掑骇
-                ///		                02	鐓ф槑     --01寮�鍏崇被;02璋冨厜绫�;03鑹叉俯;04LED
-                ///		                03	閬槼     --01绐楀笜鐢垫満;02鐧惧彾绐�;03寮�鍚堝笜;04鍗峰笜
-                ///		                04	鎭掓俯鍣�    --01绌鸿皟;02鍦版殩;03姣涚粏绌鸿皟
-                ///             		05	鏂伴		
-                ///             		06	褰遍煶		
-                ///             		07	闊充箰		
-                ///		                08	鑳芥簮		
-                ///		                09	瀹夐槻
-                /// 閫氶亾鍙�	2bytes
-                /// Key_id  2bytes
                 /// </summary>
-                /// "00010112345678901234560101230123AABB";
+                /// "03010112345678901234560101230123AABB";
                 var buffer = Guid.NewGuid().ToByteArray();
                 string guid = "";
                 if (buffer != null)
@@ -734,19 +1638,19 @@
                 {
                     case "LightSwitch":
                     case "LightMixSwitch":
-                        var light1 = DB_ResidenceData.residenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var light1 = DB_ResidenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                           obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (light1 != null)
                         {
                             //light1.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
+                        DB_ResidenceData.functionList.lights.Add(new Light()
                         {
-                            sid = "000101" + guid + "0102010001AABB",
+                            sid = "030101" + guid + "0102010001AABB",
                             name = ss.GetValue("Name").ToString(),
-                            trait = new List<Trait>() {
-                                    new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off"} },
+                            function = new List<Trait>() {
+                                    new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off"} },
                                 },
                             roomIdList = roomIds,
                             bus_Data = new BusData
@@ -760,19 +1664,19 @@
                     case "LightDimming":
                     case "LightDALI":
                     case "LightMixDimming":
-                        var light2 = DB_ResidenceData.residenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var light2 = DB_ResidenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                           obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (light2 != null)
                         {
                             //light2.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
+                        DB_ResidenceData.functionList.lights.Add(new Light()
                         {
-                            sid = "000101" + guid + "0202020001AABB",
+                            sid = "030101" + guid + "0202020001AABB",
                             name = ss.GetValue("Name").ToString(),
-                            trait = new List<Trait>() {
-                                        new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "up","down"} },
+                            function = new List<Trait>() {
+                                        new Trait { name="brightness", max=100,min = 0, value_key= new List<string> { "up","down"} },
                                     },
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { "0001" },
@@ -787,20 +1691,20 @@
                         break;
                     case "LightLogic":
                     case "LightRGB":
-                        var light3 = DB_ResidenceData.residenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var light3 = DB_ResidenceData.functionList.lights.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                           obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (light3 != null)
                         {
                             //light3.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.lights.Add(new Light()
+                        DB_ResidenceData.functionList.lights.Add(new Light()
                         {
-                            sid = "000101" + guid + "0202040001AABB",
+                            sid = "030101" + guid + "0202040001AABB",
                             name = ss.GetValue("Name").ToString(),
-                            trait = new List<Trait>() {
-                                        new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "on","off"} },
-                                        new Trait { attri="color", max=100,min = 0, value= new List<string> { "255", "255", "255" } },
+                            function = new List<Trait>() {
+                                        new Trait { name="brightness", max=100,min = 0, value_key= new List<string> { "on","off"} },
+                                        new Trait { name="color", max=100,min = 0, value_key= new List<string> { "255", "255", "255" } },
                                     },
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { roomSid },
@@ -816,22 +1720,22 @@
                     case "HVAC":
                     case "ACPanel":
                     case "ACInfrared":
-                        var ac = DB_ResidenceData.residenceData.functionList.aCs.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var ac = DB_ResidenceData.functionList.aCs.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                           obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (ac != null)
                         {
                             //ac.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.aCs.Add(new AC()
+                        DB_ResidenceData.functionList.aCs.Add(new AC()
                         {
-                            sid = "000101" + guid + "0204010001AABB",
+                            sid = "030101" + guid + "0204010001AABB",
                             name = ss.GetValue("Name").ToString(),
-                            trait = new List<Trait>() {
-                                        new Trait { attri="on_off", max=1,min = 0, value= new List<string> { "on","off"} },
-                                        new Trait { attri="mode", max = 2,min =0,value = new List<string>{ "auto", "heat", "cool","dry" } },
-                                        new Trait { attri = "fan",max = 3,min =0,value = new List<string>{ "low", "mid", "high" ,"auto"} },
-                                        new Trait { attri = "temperature", max = 32,min=16,value = new List<string>{"up","down" } },
+                            function = new List<Trait>() {
+                                        new Trait { name="on_off", max=1,min = 0, value_key= new List<string> { "on","off"} },
+                                        new Trait { name="mode", max = 2,min =0,value_key = new List<string>{ "auto", "heat", "cool","dry" } },
+                                        new Trait { name = "fan",max = 3,min =0,value_key = new List<string>{ "low", "mid", "high" ,"auto"} },
+                                        new Trait { name = "temperature", max = 32,min=16,value_key = new List<string>{"up","down" } },
                                     },
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { roomSid},
@@ -846,21 +1750,21 @@
                         break;
                     //Entity.
                     case "CurtainModel":
-                        var curtain1 = DB_ResidenceData.residenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var curtain1 = DB_ResidenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                           obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (curtain1 != null)
                         {
                             //curtain1.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
+                        DB_ResidenceData.functionList.curtains.Add(new Curtain()
                         {
-                            sid = "000101" + guid + "0203010001AABB",
+                            sid = "030101" + guid + "0203010001AABB",
                             name = ss.GetValue("Name").ToString(),
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { roomSid },
-                            trait = new List<Trait>() {
-                                        new Trait { attri="on_off", max=2,min = 0, value= new List<string> { "on","off","stop"} },
+                            function = new List<Trait>() {
+                                        new Trait { name="on_off", max=2,min = 0, value_key= new List<string> { "on","off","stop"} },
                                     },// "curtain",
                             lastState = "寮�",
                             bus_Data = new BusData
@@ -872,21 +1776,21 @@
                         });
                         break;
                     case "CurtainRoller":
-                        var curtain2 = DB_ResidenceData.residenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var curtain2 = DB_ResidenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                          obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (curtain2 != null)
                         {
                             //curtain2.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
+                        DB_ResidenceData.functionList.curtains.Add(new Curtain()
                         {
-                            sid = "000101" + guid + "0203040001AABB",
+                            sid = "030101" + guid + "0203040001AABB",
                             name = ss.GetValue("Name").ToString(),
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { roomSid },
-                            trait = new List<Trait>() {
-                                        new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off","stop"} },
+                            function = new List<Trait>() {
+                                        new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off","stop"} },
                                     },// "rollingshutter",
                             lastState = "20%",
                             bus_Data = new BusData
@@ -898,21 +1802,21 @@
                         });
                         break;
                     case "CurtainTrietex":
-                        var curtain3 = DB_ResidenceData.residenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
+                        var curtain3 = DB_ResidenceData.functionList.curtains.Find((obj) => obj.bus_Data.SubnetID == (byte)ss.GetValue("SubnetID") &&
                          obj.bus_Data.DeviceID == (byte)ss.GetValue("DeviceID") && obj.bus_Data.LoopID == (byte)ss.GetValue("LoopID"));
                         if (curtain3 != null)
                         {
                             //curtain3.roomIdList.Add(roomSid);
                             break;
                         }
-                        DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain()
+                        DB_ResidenceData.functionList.curtains.Add(new Curtain()
                         {
-                            sid = "000101" + guid + "0203030001AABB",
+                            sid = "030101" + guid + "0203030001AABB",
                             name = ss.GetValue("Name").ToString(),
                             roomIdList = roomIds,
                             //roomIdList = new List<string>() { roomSid },
-                            trait = new List<Trait>() {
-                                        new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off","stop"} },
+                            function = new List<Trait>() {
+                                        new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off","stop"} },
                                     },
                             lastState = "20%",
                             bus_Data = new BusData
@@ -923,7 +1827,7 @@
                             },
                         });
                         break;
-                        //Entity.DB_ResidenceData.residenceData.functionList.floorHeatings.Add(new FloorHeating()
+                        //Entity.DB_ResidenceData.functionList.floorHeatings.Add(new FloorHeating()
                         //{
                         //    sid = "12341212345678901234560704010004ABCD",
                         //    name = "鍦扮儹",
@@ -941,8 +1845,864 @@
 
             }
         }
+        */
+
+#endregion
 
 
-        #endregion
+#region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��
+        /// <summary>
+        /// 鑾峰彇璁惧鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetDeviceList()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);
+            //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//鍙帶鍙傛暟锛屽綋闇�瑕佸垎椤佃幏鍙栵紝鎬庝箞鐭ラ亾鍒嗛〉鎬绘暟
+            //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+            //d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+            //d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
+        }
+        /// <summary>
+        /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑缁戝畾杩囩殑璁惧鍒楄〃
+        /// </summary>
+        /// <param name="productPlatform"></param>
+        /// <param name="productBrand"></param>
+        /// <returns></returns>
+        public ResponsePackNew Get3TyBrandBindDeviceList(string productPlatform, string productBrand)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("productPlatform", productPlatform);
+            d.Add("productBrand", productBrand);
+            if (productBrand != "MegaHealth")
+            {
+                d.Add("networkConfig", true);
+            }
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
+        }
+        /// <summary>
+        /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑璁惧鍒楄〃
+        /// </summary>
+        /// <param name="productPlatform"></param>
+        /// <param name="productBrand"></param>
+        /// <returns></returns>
+        public ResponsePackNew Get3TyBrandDeviceList(string productPlatform,string productBrand)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("categoryType", 1);
+            d.Add("productPlatform", productPlatform);
+            d.Add("productBrand", productBrand);
+            d.Add("networkConfig", true);
+            
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson);
+        }
+        /// <summary>
+        /// 娉ㄥ唽绗笁鏂硅澶�
+        /// </summary>
+        /// <param name="productPlatform"></param>
+        /// <param name="productBrand"></param>
+        /// <returns></returns>
+        public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName,string pairCode = "")
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("spk", spk);
+            d.Add("extDevId", extDevId);
+            d.Add("name", deviceName);
+            d.Add("code", pairCode);
+
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson);
+        }
+
+
+
+
+        /// <summary>
+        /// 鑾峰彇璁惧璇︽儏
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetDeviceInfo(string functionId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", new List<string>() { functionId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
+        }
+
+        /// <summary>
+        /// 鑾峰彇璁惧璇︽儏鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetDeviceInfoList(List<string> functionIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", functionIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
+        }
+        /// <summary>
+        /// 鍒锋柊璁惧鐘舵��
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew RefreshDeviceStatus(List<string> functionIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", functionIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            MainPage.Log($"璇诲彇璁惧鐘舵�侊細{requestJson}");
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_RefreshDeviceStatus, requestJson);
+        }
+
+        /// <summary>
+        /// 鎺у埗璁惧
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew ControlDevice(List<ApiAlinkControlActionObj> actionObjs)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway == null ? "0" : DB_ResidenceData.Instance.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId);
+            d.Add("actions", actionObjs);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            MainPage.Log($"api鍔熻兘鎺у埗锛歿requestJson}");
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson);
+        }
+        /// <summary>
+        /// 缂栬緫璁惧淇℃伅
+        /// 缁戝畾鍏崇郴銆佸悕绉般�佹敹钘�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdataDevcieInfo(Function function)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", function.deviceId);
+            d.Add("name", function.name);
+            d.Add("collect", function.collect);
+            d.Add("roomIds", function.roomIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+        }
+        /// <summary>
+        /// 鏇存柊璁惧缁戝畾鎴块棿淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdataDevcieBindRoomInfo(Function function)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", function.deviceId);
+            d.Add("roomIds", function.roomIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+        }
+
+
+        /// <summary>
+        /// 璁惧缁戝畾鎴块棿
+        /// </summary>
+        public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", deviceIds);
+            d.Add("roomIds", roomIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_BindDeviceToRoom, requestJson);
+        }
+        /// <summary>
+        /// 璁惧瑙g粦鎴块棿
+        /// </summary>
+        public string UnbindDeviceToRoom(string deviceId, string roomId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", new List<string>() { deviceId });
+            d.Add("roomIds", new List<string>() { roomId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UnbindDeviceToRoom, requestJson).Code;
+        }
+        /// <summary>
+        /// 璁惧鍚嶇О淇敼
+        /// </summary>
+        public string EditDeviceName(string deviceId, string deviceName)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("name", deviceName);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDeviceName, requestJson).Code;
+        }
+        /// <summary>
+        /// 鏀惰棌璁惧
+        /// </summary>
+        public ResponsePackNew CollectDevice(string deviceId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds",new List<string>() { deviceId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectDevice, requestJson);
+        }
+        /// <summary>
+        /// 鍙栨秷鏀惰棌璁惧
+        /// </summary>
+        public ResponsePackNew CancelCollectDevice(string deviceId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceIds", new List<string>() { deviceId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson);
+        }
+
+#endregion
+
+#region Kaede --鍦烘櫙鍔熻兘--------------------------
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙鍒楄〃
+        /// 鎴块棿ID鍙┖锛岄粯璁ゆ煡璇綇瀹呬笅鎵�鏈夋埧闂�
+        /// </summary>
+        /// <param name="roomId">鎴块棿ID</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSceneList(string roomId = null)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            if (roomId != null)
+            {
+                d.Add("roomId", roomId);
+            }
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
+        }
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙璇︽儏
+        /// </summary>
+        /// <param name="seceneId">鍦烘櫙ID</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSceneInfo(string seceneId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("userSceneIds",new List<string>() { seceneId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙璇︽儏鍒楄〃
+        /// </summary>
+        /// <param name="seceneId">鍦烘櫙ID</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSceneListInfo(List<string> seceneIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("userSceneIds", seceneIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
+        }
+
+        /// <summary>
+        /// 娣诲姞鍦烘櫙
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew AddScene(Scene scene)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("scenes", new List<Scene>() { scene });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson);
+
+            MainPage.Log($"{pack.Data}");
+
+            return pack;
+        }
+        /// <summary>
+        /// 缂栬緫鍦烘櫙
+        /// </summary>
+        /// <param name="scene"></param>
+        /// <returns></returns>
+        public ResponsePackNew EditScene(Scene scene)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("scenes", new List<Scene>() { scene });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditSecne, requestJson);
+        }
+        /// <summary>
+        /// 鍒犻櫎鍦烘櫙
+        /// </summary>
+        /// <returns></returns>
+        public string DeleteScene(string userSceneId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("userSceneIds", new List<string>() { userSceneId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteSecne, requestJson).Code;
+        }
+        /// <summary>
+        /// 鎵ц鍦烘櫙
+        /// </summary>
+        /// <returns></returns>
+        public string ExecuteScene(string userSceneId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("userSceneIds", new List<string>() { userSceneId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ExecuteSecne, requestJson).Code;
+        }
+        /// <summary>
+        /// 鏀惰棌鍦烘櫙
+        /// </summary>
+        /// <param name="userSceneId"></param>
+        /// <returns></returns>
+        public string CollectScene(string userSceneId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("userSceneIds", new List<string>() { userSceneId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectScene, requestJson).Code;
+        }
+        /// <summary>
+        /// 鍙栨秷鏀惰棌鍦烘櫙
+        /// </summary>
+        /// <param name="userSceneId"></param>
+        /// <returns></returns>
+        public string CancelCollectScene(string userSceneId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("userSceneIds", new List<string>() { userSceneId });
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
+        }
+#endregion
+
+#region Kaede --鎴块棿鍔熻兘--------------------------
+        /// <summary>
+        /// 鑾峰彇鎴块棿鍒楄〃
+        /// </summary>
+        /// <param name="GetType">鑾峰彇绫诲瀷锛歊OOM\FLOOR;涓嶈緭鍏ヨ繑鍥炲叏閮�</param>
+        /// <returns></returns>
+        public ResponsePackNew GetRoomList(string GetType = "All")
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            if (GetType != "All")
+            {
+                d.Add("roomType", GetType);
+            }
+            d.Add("pageSize", "1000");
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson);
+            
+            return pack;
+        }
+        /// <summary>
+        /// 娣诲姞鎴块棿\妤煎眰
+        /// 妤煎眰涔熷睘浜庢埧闂�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew AddRoom(List<SpatialInfo> rooms)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("rooms", rooms);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddRoom, requestJson);
+            //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+            //if (revData != null)
+            //{
+            //    SpatialInfo.CurrentSpatial.UpdateSpatialList(revData, OptionType.Update);
+            //}
+            return pack;
+        }
+        /// <summary>
+        /// 淇敼鎴块棿淇℃伅
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdateRoom(List<SpatialInfo> rooms)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("rooms", rooms);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UpdateRoom, requestJson);
+            //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+            //if (revData != null)
+            //{
+            //    SpatialInfo.CurrentSpatial.UpdateSpatialList(revData,OptionType.Update);
+            //}
+            return pack;
+        }
+        /// <summary>
+        /// 鍒犻櫎鎴块棿
+        /// </summary>
+        /// <param name="roomIds"></param>
+        /// <returns></returns>
+        public ResponsePackNew DeleteRoom(List<string> roomIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("ids", roomIds);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DelRoom, requestJson);
+            return pack;
+        }
+
+#endregion
+
+
+#region Kaede -- 瀹夐槻鎺ュ彛____________________________
+        /// <summary>
+        /// 鑾峰彇瀹夐槻鍒楄〃
+        /// </summary>
+        public ResponsePackNew GetSecurityList()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_List, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 鑾峰彇瀹夐槻璇︽儏
+        /// </summary>
+        /// <param name="sidList">瀹夐槻sid闆嗗悎</param>
+        /// <param name="userSecurityIds">瀹夐槻浜戠id</param>
+        /// <returns></returns>
+        public ResponsePackNew GetSecurityInfo(List<string> sidList, List<string> userSecurityIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖
+            d.Add("sids", sidList);
+            d.Add("userSecurityIds", userSecurityIds);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Info, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 娣诲姞瀹夐槻
+        /// </summary>
+        public ResponsePackNew AddSecurity(List<SecurityAlarm> securities)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            d.Add("securitys", securities);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Add, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 缂栬緫瀹夐槻
+        /// </summary>
+        public ResponsePackNew EditSecurity(List<SecurityAlarm> securities)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            d.Add("securitys", securities);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Edit, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 鍒犻櫎瀹夐槻
+        /// </summary>
+        /// <param name="sidList">瀹夐槻sid</param>
+        /// <param name="userSecurityIds">瀹夐槻浜戠id</param>
+        /// <returns></returns>
+        public ResponsePackNew DeleteSecurity(List<string> sidList, List<string> userSecurityIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖
+            d.Add("sids", sidList);
+            d.Add("userSecurityIds", userSecurityIds);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_Delete, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 璇诲彇瀹夐槻闃插尯鐘舵��
+        /// </summary>
+        /// <param name="sidList">瀹夐槻sid</param>
+        /// <param name="userSecurityIds">瀹夐槻浜戠id</param>
+        /// <returns></returns>
+        public ResponsePackNew ReadSecurityStatus(List<string> sidList, List<string> userSecurityIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖
+            d.Add("sids", sidList);
+            d.Add("userSecurityIds", userSecurityIds);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusRead, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 璁剧疆瀹夐槻闃插尯鐘舵��
+        /// </summary>
+        public ResponsePackNew SetSecurityStatus(List<SecurityState> securityStates)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("securitys", securityStates);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            MainPage.Log($"api瀹夐槻鎺у埗锛歿requestJson}");
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusSet, requestJson);
+            return pack;
+        }
+
+        /// <summary>
+        /// 瀹夐槻bypass璁剧疆
+        /// </summary>
+        public ResponsePackNew SetSecurityBypass(List<SecurityBypass> securityBypassStates)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("securitys", securityBypassStates);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_BypassSet, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 瀹夐槻bypass璇诲彇
+        /// </summary>
+        /// <param name="sidList">瀹夐槻sid</param>
+        /// <param name="userSecurityIds">瀹夐槻浜戠id</param>
+        /// <returns></returns>
+        public ResponsePackNew ReadSecurityBypass(List<string> sidList, List<string> userSecurityIds)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+            //sids userSecurityIds 涓嶈兘鍚屾椂涓虹┖
+            d.Add("sids", sidList);
+            d.Add("userSecurityIds", userSecurityIds);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_BypassRead, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 鏌ヨ瀹夐槻鎵�鏈夎褰�
+        /// </summary>
+        public ResponsePackNew GetSecurityLogList(string pageSize,string pageNo)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("pageSize", pageSize);
+            d.Add("pageNo", pageNo);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_ListSecurityLog, requestJson);
+            return pack;
+        }
+        /// <summary>
+        /// 鏌ヨ瀹夐槻鎶ヨ璁板綍
+        /// </summary>
+        public ResponsePackNew GetSecurityAlarmLogList(string pageSize, string pageNo)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("pageSize", pageSize);
+            d.Add("pageNo", pageNo);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_ListAlarmLog, requestJson);
+            return pack;
+        }
+
+#endregion
+
+
+#region Kaede --绗笁鏂瑰搧鐗屽姛鑳�--------------------------
+        /// <summary>
+        /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛�
+        /// </summary>
+        public ResponsePackNew Get3tyBrandList()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList, requestJson);
+
+            return pack;
+        }
+        /// <summary>
+        /// 鑾峰彇缁戝畾鐨勭涓夋柟鍝佺墝鍒楄〃
+        /// </summary>
+        public ResponsePackNew Get3tyBindBrandList()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBindBrandList, requestJson);
+
+            return pack;
+        }
+
+#endregion
+
+#region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________
+        /// <summary>
+        /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙�
+        /// 2021-07-07 鏂版柟妗堟帴鍙h皟鏁村鎺�
+        /// </summary>
+        public ResponsePackNew EZGetChildToken()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("platform", "1");
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson);
+        }
+#endregion
+
+
+#region 鈻� 鍙瀵硅_________________________
+        /// <summary>
+        /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew CheckFlVideo()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson);
+            return pack;
+        }
+#endregion
+
+#region 鈻� 闂ㄩ攣鐩稿叧____________________________
+
+        /// <summary>
+        /// 鑾峰彇闂ㄩ攣鍘嗗彶璁板綍(鎸夋棩鏈熼檷搴�)
+        /// </summary>
+        /// <param name="i_device">璁惧瀵硅薄</param>
+        /// <returns></returns>
+        public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device)
+        {
+            //var dicPra = new Dictionary<string, object>();
+            //dicPra.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            //dicPra.Add("deviceId", i_device.deviceId);
+            //dicPra.Add("logType", "OPEN_DOOR");
+            //dicPra.Add("pageSize", "200");
+            //var requestJson = HttpUtil.GetSignRequestJson(dicPra);
+            //var packData = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_DoorHistory, requestJson);
+            //if (packData.Code != StateCode.SUCCESS)
+            //{
+            //    return null;
+            //}
+
+
+            //娴嬭瘯
+            var listLog = new List<Stan.DoorHistoryLog>();
+            for (int i = 1; i <= 3; i++)
+            {
+                var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+                logInfo.Time = new DateTime(2000, 5, 6, 10, 45, 23).AddDays(i);
+                listLog.Add(logInfo);
+            }
+            for (int i = 1; i <= 3; i++)
+            {
+                var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+                logInfo.Time = new DateTime(2001, 5, 6, 10, 45, 23).AddDays(i);
+                listLog.Add(logInfo);
+            }
+            for (int i = 1; i <= 3; i++)
+            {
+                var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+                logInfo.Time = new DateTime(2002, 5, 6, 10, 45, 23).AddDays(i);
+                listLog.Add(logInfo);
+            }
+
+            //鎸夋椂闂撮檷搴�
+            var listSortLog = new List<Stan.DoorHistoryLog>();
+            foreach (var logInfo in listLog)
+            {
+                bool canAdd = true;
+                for (int i = 0; i < listSortLog.Count; i++)
+                {
+                    if (logInfo.Time > listSortLog[i].Time)
+                    {
+                        //鏃堕棿姣斿綋鍓嶇殑绱㈠紩澶�,鍒欐彃鍏ュ埌瀹冪殑鍓嶉潰
+                        listSortLog.Insert(i, logInfo);
+                        canAdd = false;
+                        break;
+                    }
+                }
+                if (canAdd == true)
+                {
+                    //鏃ユ湡鏈�灏�,鍒欐坊鍔犲埌鏈熬
+                    listSortLog.Add(logInfo);
+                }
+            }
+            //鎻愮ず
+            //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
+            return listSortLog;
+        }
+
+#endregion
+#region 鈻� 闊崇璇█鎺у埗鐩稿叧_________________________
+        /// <summary>
+        /// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetSpeakerList()
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(new GetSpeakerObj
+            {
+                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+            });
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_List_Get, requestJson);
+        }
+
+        /// <summary>
+        /// 缂栬緫闊崇鎺堟潈澶囨敞
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdateSpeakerRemark(UpdateSpeakerRemarkObj remarkObj)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(remarkObj);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Remark_Update, requestJson);
+        }
+
+        /// <summary>
+        /// 瑙i櫎闊崇缁戝畾
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UnbindSpeaker(string tokenId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("tokenId", tokenId);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Unbind, requestJson);
+        }
+
+        /// <summary>
+        /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃
+        /// </summary>
+        /// <param name="getType">0 鏄煡璇㈠叏閮� 1鏄煡璇㈣澶� 2鏄煡璇㈠満鏅�</param>
+        /// <param name="tokenId"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetSpeakerDeviceList(int getType, string tokenId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("tokenId", tokenId);
+            if (getType > 0)
+            {
+                d.Add("isDevice", getType == 1);
+            }
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Get, requestJson);
+        }
+
+        /// <summary>
+        /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdateSpeakerDeviceList(UpdateSpeakerDeviceListObj updateSpeakerDeviceListObj)
+        {
+            var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson);
+        }
+#endregion
+
+
+        /// <summary>
+        /// 浜鸿劯褰曞叆
+        /// </summary>
+        /// <param name="imageBytes"></param>
+        /// <returns></returns>
+        public ResponsePackNew FaceSetting(string imageBytes)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("userFace", @"data:image/jpg;base64,"+imageBytes);
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+
+            //MainPage.Log(imageBytes);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_InputUserFace, requestJson);
+        }
+
+
+        /// <summary>
+        /// 淇敼浣忔埛浜鸿劯鍏抽棴鐘舵��
+        /// 1锛氬紑鍚姸鎬� 2锛氬叧闂姸鎬�
+        /// 3:娓呴櫎浜鸿劯鏁版嵁
+        /// </summary>
+        public ResponsePackNew EditFaceFunction(int status)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("faceClose", status);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SwitchFaceFunction, requestJson);
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇浣忔埛璇︽儏
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetCustomerInfo()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetCustomerInfo, requestJson);
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0