| | |
| | | { |
| | | } |
| | | |
| | | #region kaede ___________传感器历史数据__________________ |
| | | /// <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> |
| | | /// <param name="qType">时间查询类型:hour=近24小时、week=近一周、month = 近一月 </param> |
| | | /// <param name="deviceId">设备ID</param> |
| | | /// <param name="deviceKey">功能查询类型:pm25</param> |
| | | /// <returns></returns> |
| | | public ResponsePack GetSensorHistory(int subnetId, int deviceId, int bigClass, int minClass, int queryType, int loopId, int nowMonth, string mac) |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey) |
| | | { |
| | | 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); |
| | | d.Add("type", qType); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceId", new List<string>() { deviceId }); |
| | | d.Add("key", new List<string>() { 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.RegionID); |
| | | 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); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | //public string GetRequestResultMsg(string resultCode) |
| | | //{ |
| | |
| | | /// 刷新Token |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public bool RefreshToken() |
| | | public string RefreshToken() |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj() |
| | | { |
| | |
| | | UserInfo.Current.RefreshToken = revertData.refreshToken; |
| | | UserInfo.Current.LastTime = DateTime.Now; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | return true; |
| | | } |
| | | return false; |
| | | return revertObj.Code; |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// 绑定调试人员提交的住宅,一个住宅只能绑定一次 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew BindingResidence(string key) |
| | | public ResponsePackNew BindingResidence(string strUrl) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | //d.Add("homeId", homeId); |
| | | d.Add("secretKey", key); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindlingResidence, requestJson, HttpUtil.GlobalRequestHttpsHost); |
| | | try |
| | | { |
| | | if (strUrl.Contains("app/home/deliver") == false) |
| | | { |
| | | //非法的URL 返回一个自定义的状态码 |
| | | 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> |
| | | /// <returns></returns> |
| | | public void GetUserInfo(bool bGetHeadImage = true) |
| | | public string GetUserInfo(bool bGetHeadImage = true) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new NullObj()); |
| | | var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson); |
| | |
| | | UserInfo.Current.userEmailInfo = info.memberEmail; |
| | | UserInfo.Current.userMobileInfo = info.memberPhone; |
| | | UserInfo.Current.userName = info.memberName; |
| | | |
| | | if (!string.IsNullOrEmpty(info.memberPhonePrefix)) |
| | | { |
| | | UserInfo.Current.areaCode = info.memberPhonePrefix; |
| | |
| | | //是否需要获取头像 |
| | | if (bGetHeadImage) |
| | | { |
| | | var imageKey = ImageUtlis.Current.GetHeadImageKey(info.memberId); |
| | | |
| | | var headImageBytes = ImageUtlis.Current.DownHeadImage(info.memberId); |
| | | |
| | | if (headImageBytes != null && headImageBytes.Length > 0) |
| | | //2020-12-15 修改头像方案 |
| | | if (!string.IsNullOrEmpty(info.memberHeadIcon)) |
| | | { |
| | | //UserInfo.Current.headImagePageBytes = headImageBytes; |
| | | UserInfo.Current.headImagePagePath = imageKey; |
| | | var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(info.memberHeadIcon); |
| | | |
| | | if (headImageBytes != null && headImageBytes.Length > 0) |
| | | { |
| | | UserInfo.Current.headImagePagePath = info.memberHeadIcon; |
| | | //UserInfo.Current.headImagePagePath = imageKey; |
| | | } |
| | | } |
| | | } |
| | | |
| | | UserInfo.Current.SaveUserInfo(); |
| | | MainPage.Log("获取用户信息成功。"); |
| | | } |
| | | |
| | | |
| | | // 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() == StateCode.SUCCESS) |
| | | //{ |
| | | // var dataStr = JObject.FromObject(revertObj.ResponseData); |
| | | // //"DistributedMark": "96439601-fd26-4768-8440-1d9dfa32c109", < !--帐号Id-- > |
| | | // UserInfo.Current.userEmailInfo = dataStr.GetValue("Email").ToString(); |
| | | // UserInfo.Current.userMobileInfo = dataStr.GetValue("Phone").ToString(); |
| | | // FileStream fs = null; |
| | | // try |
| | | // { |
| | | // var headImageString = dataStr.GetValue("HeadImage").ToString(); |
| | | // if (!string.IsNullOrEmpty(headImageString)) |
| | | // { |
| | | // var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); |
| | | // var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); |
| | | // UserInfo.Current.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(); |
| | | // UserInfo.Current.headImagePagePath = filePath; |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"download headImage error : {ex.Message}"); |
| | | // } |
| | | // finally |
| | | // { |
| | | // if (fs != null) |
| | | // { |
| | | // fs.Close(); |
| | | // } |
| | | // } |
| | | // // "GesturePwd": null, < !--手势密码-- > |
| | | // // "StringPwd": null , < !--字符串密码-- > |
| | | // UserInfo.Current.userName = dataStr.GetValue("UserName").ToString(); |
| | | |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // }); |
| | | |
| | | // UserInfo.Current.SaveUserInfo(); |
| | | // MainPage.Log("获取用户信息成功。"); |
| | | //} |
| | | |
| | | return resultObj.Code; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取用户头像 |
| | | /// </summary> |
| | | /// <param name="userId"></param> |
| | | public void GetUserHeadImage(string userId) |
| | | public void GetUserHeadImageByKey(string imageKey) |
| | | { |
| | | var imageKey = ImageUtlis.Current.GetHeadImageKey(userId); |
| | | |
| | | var headImageBytes = ImageUtlis.Current.DownHeadImage(userId); |
| | | var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(imageKey); |
| | | |
| | | if (headImageBytes != null && headImageBytes.Length > 0) |
| | | { |
| | |
| | | }); |
| | | 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> |
| | | ///// 更新用户头像 |
| | |
| | | IsOthreShare = mHome.IsOtherShare, |
| | | accountType = mHome.accountType, |
| | | isRemoteControl = mHome.isRemoteControl, |
| | | isBindGateway = mHome.isBindGateway, |
| | | longitude = mHome.longitude, |
| | | latitude = mHome.latitude, |
| | | deliverstatus = mHome.deliverstatus, |
| | |
| | | homeRegionName = mHome.homeRegionName, |
| | | homeRegionId = mHome.homeRegionId, |
| | | Address = mHome.homeAddress, |
| | | isAllowCreateScene = mHome.isAllowCreateScene, |
| | | }; |
| | | UserInfo.Current.regionList.Add(home); |
| | | if (home.isBindGateway) |
| | | { |
| | | UserInfo.Current.regionList.Add(home); |
| | | } |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(UserInfo.Current.CurReginID)) |
| | | if(UserInfo.Current.regionList.Count== 0) |
| | | { |
| | | UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; |
| | | //恢复备份 |
| | | //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); |
| | | return "null"; |
| | | } |
| | | //-------如果账号是首次登录 |
| | | if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) |
| | | { |
| | | //刷新当前住宅 |
| | | DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0]; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | UserInfo.Current.SaveUserInfo(); |
| | | //刷新一次住宅网关 |
| | | GetHomeGatewayList(); |
| | | } |
| | | else |
| | | { |
| | | var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID); |
| | | if(curRegion == null) |
| | | //住宅被删除 |
| | | var findHome = UserInfo.Current.regionList.Find((obj) => obj.RegionID == DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | if (findHome == null) |
| | | { |
| | | UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; |
| | | //恢复备份 |
| | | //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | UserInfo.Current.SaveUserInfo(); |
| | | |
| | | //刷新一次住宅网关 |
| | | GetHomeGatewayList(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | var requestObj = new AddOrUpdateHomeObj() |
| | | { |
| | | homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | }; |
| | | |
| | | if (editId == 0) |
| | |
| | | /// <summary> |
| | | /// 获取刷新当前住宅的网关列表 |
| | | /// </summary> |
| | | public void GetHomeGatewayList() |
| | | public string GetHomeGatewayList() |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.residecenInfo.RegionID)) return; |
| | | var nowhomeId = DB_ResidenceData.residenceData.residecenInfo.RegionID; |
| | | if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return ""; |
| | | var nowhomeId = DB_ResidenceData.Instance.CurrentRegion.RegionID; |
| | | 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.residenceData.residecenInfo.RegionID) |
| | | if (nowhomeId == DB_ResidenceData.Instance.CurrentRegion.RegionID) |
| | | { |
| | | if (mHomeGatewayRes != null) |
| | | { |
| | | if (mHomeGatewayRes.Count > 0) |
| | | { |
| | | DB_ResidenceData.residenceData.HomeGateway = mHomeGatewayRes[0]; |
| | | if(mHomeGatewayRes[0].gatewayStatus == "ON_LINE") |
| | | { |
| | | DriverLayer.Control.Ins.IsRemote = true; |
| | | DriverLayer.Control.Ins.GatewayOnline = true; |
| | | } |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | return; |
| | | DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0]; |
| | | DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | return revertObj.Code; |
| | | } |
| | | } |
| | | //其余情况清空网关信息 |
| | | DB_ResidenceData.residenceData.HomeGateway = null; |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | 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.RegionID); |
| | | 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> |
| | |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetResidenceMemberAccount() |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID }); |
| | | var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID }); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_FindAll, requestJson); |
| | | } |
| | | |
| | |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildNickNameObj() |
| | | { |
| | | homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | childAccountId = childAccountId, |
| | | nickName = nickName, |
| | | }); |
| | |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildAllowCreateSceneObj() |
| | | { |
| | | homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | childAccountId = childAccountId, |
| | | isAllowCreateScene = isAllow, |
| | | }); |
| | |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetShareObj() |
| | | { |
| | | homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, |
| | | childAccountId = childAccountId, |
| | | }); |
| | | |
| | |
| | | public ResponsePackNew BindResidenceMemberAccount(string subAccount, string nickName) |
| | | { |
| | | //添加子账号 |
| | | var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, account = subAccount, nickName = nickName }; |
| | | var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, account = subAccount, nickName = nickName }; |
| | | var requestJson = HttpUtil.GetSignRequestJson(requestObj); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Add, requestJson); |
| | | |
| | |
| | | attachClientId = attachClientId, |
| | | homeType = HomeTypeEnum.BUSPRO.ToString() |
| | | }); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetMqttRemoteInfo, requestJson, DB_ResidenceData.residenceData.residecenInfo.regionUrl); |
| | | 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()); |
| | |
| | | public ResponsePackNew GetDeviceList() |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId); |
| | | //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//可控参数,当需要分页获取,怎么知道分页总数 |
| | | //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | |
| | | 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.RegionID); |
| | | d.Add("productPlatform", productPlatform); |
| | | d.Add("productBrand", productBrand); |
| | | 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> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetDeviceInfo(string functionId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | 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.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", functionIds); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew RefreshDeviceStatus(List<string> functionIds) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", functionIds); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | MainPage.Log($"读取设备状态:{requestJson}"); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_RefreshDeviceStatus, requestJson); |
| | | } |
| | | |
| | |
| | | public ResponsePackNew ControlDevice(List<ApiAlinkControlActionObj> actionObjs) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | 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); |
| | |
| | | public ResponsePackNew UpdataDevcieInfo(Function function) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("deviceId", function.deviceId);//DriverLayer.Control.Ins.GatewayId); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceId", function.deviceId); |
| | | d.Add("name", function.name); |
| | | d.Add("collect", function.collect); |
| | | d.Add("roomIds", function.roomIds); |
| | |
| | | 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.RegionID); |
| | | 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.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", deviceIds); |
| | | d.Add("roomIds", roomIds); |
| | | |
| | |
| | | public string UnbindDeviceToRoom(string deviceId, string roomId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", new List<string>() { deviceId }); |
| | | d.Add("roomIds", new List<string>() { roomId }); |
| | | |
| | |
| | | public string EditDeviceName(string deviceId, string deviceName) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("name", deviceName); |
| | | |
| | |
| | | public ResponsePackNew CollectDevice(string deviceId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds",new List<string>() { deviceId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew CancelCollectDevice(string deviceId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", new List<string>() { deviceId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew GetSceneList(string roomId = null) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | if (roomId != null) |
| | | { |
| | | d.Add("roomId", roomId); |
| | |
| | | d.Add("userSceneIds",new List<string>() { seceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson); |
| | | 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> |
| | |
| | | public ResponsePackNew AddScene(Scene scene) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("scenes", new List<Scene>() { scene }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson); |
| | | |
| | | MainPage.Log($"{pack.Data}"); |
| | | |
| | | return pack; |
| | | } |
| | | /// <summary> |
| | | /// 编辑场景 |
| | |
| | | public ResponsePackNew EditScene(Scene scene) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("scenes", new List<Scene>() { scene }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public string DeleteScene(string userSceneId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("userSceneIds", new List<string>() { userSceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public string ExecuteScene(string userSceneId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("userSceneIds", new List<string>() { userSceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public string CollectScene(string userSceneId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("userSceneIds", new List<string>() { userSceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public string CancelCollectScene(string userSceneId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("userSceneIds", new List<string>() { userSceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew GetRoomList(string GetType = "All") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | 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); |
| | | |
| | |
| | | public ResponsePackNew AddRoom(List<SpatialInfo> rooms) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("rooms", rooms); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew UpdateRoom(List<SpatialInfo> rooms) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("rooms", rooms); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | public ResponsePackNew DeleteRoom(List<string> roomIds) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("ids", roomIds); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | |
| | | } |
| | | |
| | | #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.RegionID); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBindBrandList, requestJson); |
| | | |
| | | return pack; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 萤石云SDK相关接口 |
| | | /// <summary> |
| | | /// 河东获取萤石云子账号token的接口 |
| | | /// </summary> |
| | | public ResponsePackNew EZGetChildToken() |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | 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.RegionID); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson); |
| | | return pack; |
| | | } |
| | | #endregion |
| | | } |
| | | } |