wxr
2020-09-01 7d005a7618e3d7a80d8ede3baf6ecc4bf8019cd5
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -38,11 +38,40 @@
        public HttpServerRequest()
        {
#if DEBUG
#if DEBUG1
            severAddress = debugSever;
#else
            severAddress = relaseaSever;
#endif
        }
        /// <summary>
        /// 获取传感器历史数据
        /// </summary>
        /// <param name="subnetId"></param>
        /// <param name="deviceId"></param>
        /// <param name="bigClass"></param>
        /// <param name="minClass"></param>
        /// <param name="queryType"></param>
        /// <param name="loopId"></param>
        /// <param name="nowMonth"></param>
        /// <param name="mac"></param>
        /// <returns></returns>
        public ResponsePack GetSensorHistory(int subnetId,int deviceId,int bigClass,int minClass,int queryType,int loopId,int nowMonth,string mac)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("SubnetID", subnetId);
            d.Add("DeviceID", deviceId);
            d.Add("LargeType", bigClass);
            d.Add("SmallType", minClass);
            d.Add("QueryType", queryType);
            d.Add("loopId", loopId);
            d.Add("NowMonth", nowMonth);
            d.Add("MAC", DB_ResidenceData.residenceData.residenceGatewayMAC);
            d.Add("LocalTimeZone", 8);
            var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString,true);
        }
        public string GetRequestResultMsg(string resultCode)
@@ -68,7 +97,6 @@
            }
            return result;
        }
        #region 注册、登录部分
@@ -138,7 +166,7 @@
                                "\"Account\":" + "\"" + account + "\"" + "," +
                                "\"Password\":" + "\"" + password + "\"" + "," +
                                "\"EnterPassword\":" + "\"" + entryPassword + "\"" + "," +
                                "\"Language\":" + "\"" + MainPage.LoginUser.language.ToLower() + "\"" + "," +
                                "\"Language\":" + "\"" + Language.CurrentLanguage.ToLower() + "\"" + "," +
                                "\"Code\":" + "\"" + code + "\"" + "," +
                                "\"RegisterSoruce\":" + 0 + "," +
                                "\"AreaCode\":" + areaCode +
@@ -150,12 +178,12 @@
        /// <summary>
        /// 获取注册验证码
        /// </summary>
        public ResponsePack GetPhoneRegisterVerCode(string account)
        public ResponsePack GetRegisterVerCode(string account)
        {
            string jsonString = "{" +
                                "\"Account\":" + "\"" + account + "\"" + "," +
                                "\"Company\":" + MainPage.Company + "," +
                                "\"Language\":" + "\"" +  MainPage.LoginUser.language.ToLower() + "\"" + "," +
                                "\"Language\":" + "\"" + Language.CurrentLanguage.ToLower() + "\"" + "," +
                                "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber +
                                "}";
            return RequestHttps($"{severAddress}/ZigbeeUsers/RegisterSendVerCode", jsonString, false);
@@ -168,12 +196,11 @@
        /// <summary>
        /// 获取登录验证码
        /// </summary>
        /// <param name="phoneNum">手机号码</param>
        public ResponsePack GetPhoneLoginVerCode(string phoneNum)
        public ResponsePack GetLoginVerCode(string account)
        {
            string jsonString = "{" +
                                "\"Account\":" + "\"" + phoneNum + "\"" + "," +
                                "\"Account\":" + "\"" + account + "\"" + "," +
                                "\"AreaCode\":" + "86" + 
                                "}";
            return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false);
@@ -247,21 +274,17 @@
                try
                {
                    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(() =>
                    if (!string.IsNullOrEmpty(headImageString))
                    {
                        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;
                        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");
                        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}");
@@ -320,6 +343,18 @@
            var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/UpdateHeadImage", requestJson, true);
            return revertObj.StateCode;
        }
        /// <summary>
        /// 更改绑定账户的邮箱或者手机号
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        public string BindAccount(string account)
        {
            string jsonString = "{" + "\"Account\":" + "\"" + account + "\"" + "}";
            var responsePack = RequestHttps($"{severAddress}/ZigbeeUsers/BindAccount", jsonString, true);
            return responsePack.StateCode;
        }
        #endregion
        #region 住宅部分
@@ -346,6 +381,31 @@
                }
                else
                {
                    //{
                    // {
                    //  "Id": "1107487",
                    //  "HomeStatus": 2,
                    //  "UserGuid": "22980",
                    //  "Name": "啊",
                    //  "Address": null,
                    //  "Longitude": 0.0,
                    //  "Latitude": 0.0,
                    //  "RegionName": null,
                    //  "Company": null,
                    //  "ContactPerson": null,
                    //  "ContactPersonPhone": null,
                    //  "Remarks": null,
                    //  "ChangeDate": null,
                    //  "AccountType": 0,
                    //  "CreatedOnUtc": "2020-05-27T06:52:03",
                    //  "IsOthreShare": false,
                    //  "MainUserDistributedMark": null,
                    //  "HomeGateways": [
                    //    {
                    //      "GatewayUniqueId": "4E47323347591243"
                    //    }
                    //  ]
                    //}}
                    MainPage.LoginUser.regionList = new List<RegionInfoRes>();
                    foreach (var jsonData in dataStr.GetValue("PageData"))
                    {
@@ -356,16 +416,19 @@
                            RegionName = homeJsonStr.GetValue("RegionName").ToString(),
                            Name = homeJsonStr.GetValue("Name").ToString(),
                            Address = homeJsonStr.GetValue("Address").ToString(),
                            IsOthreShare = (bool)homeJsonStr.GetValue("IsOthreShare"),
                        };
                        MainPage.LoginUser.regionList.Add(home);
                        if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
                        {
                            DB_ResidenceData.residenceData.CurReginID = MainPage.LoginUser.regionList[0].RegionID;
                        }
                    }
                    DB_ResidenceData.residenceData.SaveResidenceData();
                    MainPage.LoginUser.SaveUserInfo();
                }
            }
            return responsePack.StateCode;
        }
        /// <summary>
        /// 编辑住宅信息
@@ -390,6 +453,172 @@
            return RequestHttps($"{severAddress}/App/EditHome", jsonString, false);
        }
        /// <summary>
        /// 获取住宅下的成员账号
        /// </summary>
        /// <returns></returns>
        public ResponsePack GetResidenceMemberAccount()
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("DistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountByDistributedMark", jsonString, true);
        }
        /// <summary>
        /// 删除住宅下的成员账号
        /// </summary>
        /// <returns></returns>
        public ResponsePack DeleteResidenceMemberAccount(string memberAccount)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("SubAccount", memberAccount);
            d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/DeletedSubAccount", jsonString, true);
        }
        /// <summary>
        /// 修改子账号昵称
        /// </summary>
        /// <param name="nickName"></param>
        /// <param name="subAccountGuid"></param>
        /// <returns></returns>
        public ResponsePack EditSubAccountNickName(string nickName,string subAccountGuid)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("SubAccountGuid", subAccountGuid);
            d.Add("NickName", nickName);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/EditSubAccountNickName", jsonString, true);
        }
        /// <summary>
        /// 修改子账号创建场景权限
        /// </summary>
        /// <param name="nickName"></param>
        /// <param name="subAccountGuid"></param>
        /// <returns></returns>
        public ResponsePack ChangeCreateSceneState(string homeGuid, string subAccountGuid)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("SubAccountGuid", subAccountGuid);
            d.Add("HomeGuid", homeGuid);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/ChangeCreateSceneState", jsonString, true);
        }
        /// <summary>
        /// 获取住宅下子账号的共享数据列表
        /// </summary>
        /// <returns></returns>
        public ResponsePack GetShareDataByMemberAccount(string memberId)
        {
            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);
        }
        /// <summary>
        /// 获取住宅下子账号的共享数据
        /// </summary>
        /// <returns></returns>
        public ResponsePack GetShareData(string memberId,string hId)
        {
            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);
        }
        /// <summary>
        /// 增加共享数据列表
        /// </summary>
        /// <returns></returns>
        public ResponsePack 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);
        }
        /// <summary>
        /// 增加共享数据
        /// </summary>
        /// <returns></returns>
        public ResponsePack EditShareData(ShareData 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 ResponsePack DeleteShareData(ShareData shareData)
        {
            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 ResponsePack BindResidenceMemberAccount(string subAccount,string nickName)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("SubAccount", subAccount);
            d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
            d.Add("Nickname", nickName);
            d.Add("IsAllowRemoteCtrl", true);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/BindSubAccount", jsonString, true);
        }
        /// <summary>
        /// 获取住宅下的成员账号
        /// </summary>
        /// <returns></returns>
        public ResponsePack GetResidenceMemberAccountInfo(string account)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("Account", account);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
        }
        #endregion
@@ -433,9 +662,11 @@
                            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();
                            break;
                        }
                        catch (Exception ex)
@@ -456,7 +687,6 @@
        }
        #endregion
        #region 备份部分
        /// <summary>
@@ -485,7 +715,7 @@
            }
            return backupList;
        }
        /* 2020-09-01 弃用 恢复旧数据功能在bus软件上实现
        /// <summary>
        /// 获取备份文件列表
        /// </summary>
@@ -616,7 +846,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 +919,8 @@
                /// <summary>
                /// 功能ID
                /// 厂商代码   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 +949,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 +975,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 +1002,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 +1031,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 +1061,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 +1087,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 +1113,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 +1138,7 @@
                            },
                        });
                        break;
                        //Entity.DB_ResidenceData.residenceData.functionList.floorHeatings.Add(new FloorHeating()
                        //Entity.DB_ResidenceData.functionList.floorHeatings.Add(new FloorHeating()
                        //{
                        //    sid = "12341212345678901234560704010004ABCD",
                        //    name = "地热",
@@ -941,7 +1156,7 @@
            }
        }
        */
        #endregion
    }