| | |
| | | |
| | | */ |
| | | |
| | | 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 DEBUG1 |
| | | severAddress = debugSever; |
| | | #else |
| | | severAddress = relaseaSever; |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <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) |
| | | 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("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); |
| | | return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString, true); |
| | | |
| | | } |
| | | |
| | |
| | | result = Language.StringByID(StringId.FailedToSendVerificationCode); |
| | | break; |
| | | case "EXIST": |
| | | result = Language.StringByID(StringId.AccountAlreadyExists); |
| | | result = Language.StringByID(StringId.AccountAlreadyUse); |
| | | break; |
| | | case "Self:Net_Error": |
| | | result = Language.StringByID(StringId.NetworkAnomaly); |
| | |
| | | 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); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新Token |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public bool RefreshToken() |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj() |
| | | { |
| | | refreshToken = MainPage.LoginUser.refreshToken, |
| | | }); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); |
| | | if (revertObj.Code.ToUpper() == HttpUtil.SUCCESS_CODE) |
| | | { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString()); |
| | | MainPage.LoginUser.loginTokenString = revertData.headerPrefix + revertData.accessToken; |
| | | MainPage.LoginUser.lastTime = DateTime.Now; |
| | | MainPage.LoginUser.SaveUserInfo(); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 注册、登录部分 |
| | | /// <summary> |
| | | /// 获取请求提交的语言参数 |
| | | /// </summary> |
| | | public string GetPostLanguageType() |
| | | { |
| | | return Language.CurrentLanguage == "Chinese" ? LanguageTypeEnum.CHINESE.ToString() : LanguageTypeEnum.ENGLISH.ToString(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通用 发送验证码方法 |
| | | /// </summary> |
| | | /// <param name="verifyType">1:注册 2:找回密码 3:登陆 4:绑定</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 = 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\":" + "\"" + Language.CurrentLanguage.ToLower() + "\"" + "," + |
| | | "\"Code\":" + "\"" + code + "\"" + "," + |
| | | "\"RegisterSoruce\":" + 0 + "," + |
| | | "\"AreaCode\":" + areaCode + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/ValidataCodeAndRegisterAccount", requestJson, 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 GetRegisterVerCode(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.ToLower() + "\"" + "," + |
| | | "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/RegisterSendVerCode", 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> |
| | |
| | | |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"AreaCode\":" + "86" + |
| | | "\"AreaCode\":" + "86" + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送验证码 |
| | | /// </summary> |
| | | public ResponsePack SendSms(string account) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Company\":" + MainPage.Company + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | | } |
| | | ///// <summary> |
| | | ///// 发送验证码 |
| | | ///// </summary> |
| | | //public ResponsePack SendSms(string account) |
| | | //{ |
| | | // string jsonString = "{" +
|
| | | // "\"Account\":" + "\"" + account + "\"" + "," + |
| | | // "\"Company\":" + MainPage.Company + "," + |
| | | // "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | // "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber + |
| | | // "}"; |
| | | // return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 验证验证码 |
| | |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/ValidatorCode", jsonString, false); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 重设密码 |
| | |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/GetAccountInfo", requestJson, true); |
| | | |
| | | if (revertObj.StateCode.ToUpper() == "SUCCESS") |
| | | if (revertObj.StateCode.ToUpper() == HttpUtil.SUCCESS_CODE) |
| | | { |
| | | var dataStr = JObject.FromObject(revertObj.ResponseData); |
| | | //"DistributedMark": "96439601-fd26-4768-8440-1d9dfa32c109", < !--帐号Id-- > |
| | |
| | | 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"); |
| | | |
| | | fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); |
| | | fs.Write(headImageBytes, 0, headImageBytes.Length); |
| | | fs.Flush(); |
| | | MainPage.LoginUser.headImagePagePath = filePath; |
| | | } catch (Exception ex) |
| | | if (!string.IsNullOrEmpty(headImageString)) |
| | | { |
| | | 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}"); |
| | | } |
| | |
| | | "\"HomeType\":" + "\"" + "1" + "\"" + "," + |
| | | "\"LoginAccessToken\":" + "\"" + MainPage.LoginUser.loginTokenString + "\"" + |
| | | "}"; |
| | | var responsePack = RequestHttps($"{severAddress}/App/GetHomePager", jsonString,false); |
| | | var responsePack = RequestHttps($"{severAddress}/App/GetHomePager", jsonString, false); |
| | | |
| | | if (responsePack.StateCode.ToUpper() == "SUCCESS") |
| | | if (responsePack.StateCode.ToUpper() == HttpUtil.SUCCESS_CODE) |
| | | { |
| | | var dataStr = JObject.FromObject(responsePack.ResponseData); |
| | | //没有住宅 |
| | |
| | | Name = homeJsonStr.GetValue("Name").ToString(), |
| | | Address = homeJsonStr.GetValue("Address").ToString(), |
| | | IsOthreShare = (bool)homeJsonStr.GetValue("IsOthreShare"), |
| | | homeGateways = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGateways>>(homeJsonStr.GetValue("HomeGateways").ToString()), |
| | | }; |
| | | if (home.IsOthreShare) |
| | | { |
| | | continue; |
| | | } |
| | | MainPage.LoginUser.regionList.Add(home); |
| | | if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID)) |
| | | { |
| | |
| | | /// <param name="nickName"></param> |
| | | /// <param name="subAccountGuid"></param> |
| | | /// <returns></returns> |
| | | public ResponsePack EditSubAccountNickName(string nickName,string subAccountGuid) |
| | | public ResponsePack EditSubAccountNickName(string nickName, string subAccountGuid) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("SubAccountGuid", subAccountGuid); |
| | |
| | | /// 获取住宅下子账号的共享数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePack GetShareData(string memberId,string hId) |
| | | public ResponsePack GetShareData(string memberId, string hId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("DistributedMark", memberId); |
| | |
| | | /// <param name="subAccount"></param> |
| | | /// <param name="nickName"></param> |
| | | /// <returns></returns> |
| | | public ResponsePack BindResidenceMemberAccount(string subAccount,string nickName) |
| | | public ResponsePack BindResidenceMemberAccount(string subAccount, string nickName) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("SubAccount", subAccount); |
| | |
| | | } |
| | | System.Threading.Thread.Sleep(1000); |
| | | } |
| | | Shared.Application.RunOnMainThread(() => { |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | HDL_ON.UI.HomePage.LoadEvent_RefreshAir(); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region mqtt远程连接(旧) |
| | | /// <summary> |
| | | /// 请求Mqtt数据 |
| | | /// </summary> |
| | | /// <param name="dataStringJson">请求的参数.</param> |
| | | public ResponsePack RequestMqttInfo(string dataStringJson) |
| | | { |
| | | ResponsePack revertObj = null; |
| | | |
| | | var webClient = new WebClient(); |
| | | #region |
| | | webClient.Headers.Add("CONTENT-TYPE", "application/json"); |
| | | var url = "https://global.hdlcontrol.com/ProposedProductionApi/EmqMqtt/GetConnMqttInfo"; |
| | | |
| | | byte[] bytes = null; |
| | | try |
| | | { |
| | | bytes = webClient.UploadData(url, Encoding.UTF8.GetBytes(dataStringJson)); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | revertObj = new ResponsePack() { StateCode = "Net_Error" }; |
| | | } |
| | | |
| | | string responseString = null; |
| | | if (bytes != null) |
| | | { |
| | | responseString = Encoding.UTF8.GetString(bytes); |
| | | } |
| | | |
| | | if (responseString != null) |
| | | { |
| | | try |
| | | { |
| | | revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.ToString()); |
| | | } |
| | | } |
| | | return revertObj; |
| | | #endregion |
| | | } |
| | | #endregion |
| | | |
| | | #region 备份部分 |
| | | /// <summary> |
| | | /// 获取住宅备份列表 |
| | | /// </summary> |
| | | public Dictionary<int,string> GetRegionLastBackupId() |
| | | public Dictionary<int, string> GetRegionLastBackupId() |
| | | { |
| | | //Dialog dialog = new Dialog(); |
| | | //dialog.Show(); |
| | |
| | | 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) |
| | | if (revertObj == null || revertObj.ResponseData == null) |
| | | { |
| | | return new Dictionary<int, string>(); |
| | | } |
| | |
| | | } |
| | | return backupList; |
| | | } |
| | | |
| | | /* 2020-09-01 弃用 恢复旧数据功能在bus软件上实现 |
| | | /// <summary> |
| | | /// 获取备份文件列表 |
| | | /// </summary> |
| | |
| | | // 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); |
| | | |
| | | } |
| | |
| | | |
| | | /// <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) |
| | |
| | | { |
| | | 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(), |
| | | function = new List<Trait>() { |
| | | new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off"} }, |
| | | new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off"} }, |
| | | }, |
| | | roomIdList = roomIds, |
| | | bus_Data = new BusData |
| | |
| | | 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(), |
| | | function = new List<Trait>() { |
| | | new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "up","down"} }, |
| | | new Trait { name="brightness", max=100,min = 0, value_key= new List<string> { "up","down"} }, |
| | | }, |
| | | roomIdList = roomIds, |
| | | //roomIdList = new List<string>() { "0001" }, |
| | |
| | | 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(), |
| | | function = 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" } }, |
| | | 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 }, |
| | |
| | | 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(), |
| | | function = 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" } }, |
| | | 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}, |
| | |
| | | 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 }, |
| | | function = new List<Trait>() { |
| | | new Trait { attri="on_off", max=2,min = 0, value= new List<string> { "on","off","stop"} }, |
| | | new Trait { name="on_off", max=2,min = 0, value_key= new List<string> { "on","off","stop"} }, |
| | | },// "curtain", |
| | | lastState = "开", |
| | | bus_Data = new BusData |
| | |
| | | }); |
| | | 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 }, |
| | | function = new List<Trait>() { |
| | | new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off","stop"} }, |
| | | new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off","stop"} }, |
| | | },// "rollingshutter", |
| | | lastState = "20%", |
| | | bus_Data = new BusData |
| | |
| | | }); |
| | | 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 }, |
| | | function = new List<Trait>() { |
| | | new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off","stop"} }, |
| | | new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off","stop"} }, |
| | | }, |
| | | lastState = "20%", |
| | | bus_Data = new BusData |
| | |
| | | }, |
| | | }); |
| | | break; |
| | | //Entity.DB_ResidenceData.residenceData.functionList.floorHeatings.Add(new FloorHeating() |
| | | //Entity.DB_ResidenceData.functionList.floorHeatings.Add(new FloorHeating() |
| | | //{ |
| | | // sid = "12341212345678901234560704010004ABCD", |
| | | // name = "地热", |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | */ |
| | | |
| | | #endregion |
| | | } |