| | |
| | | /// <param name="useLocalConnect">是否强制使用本地连接发送</param>
|
| | | public bool RefreshSceneUIList(bool useLocalConnect)
|
| | | {
|
| | | if (Config.Instance.Home.TemplateMode == 2 && Config.Instance.Home.SendTemplateSuccess == false)
|
| | | {
|
| | | //如果是有模板有设备模式,但是还没有导入成功的情况下,不允许刷新场景列表
|
| | | return true;
|
| | | }
|
| | | //获取网关存在的场景
|
| | | var sceneList = this.RefreshSceneListFromGateway(useLocalConnect);
|
| | | if (sceneList == null)
|
| | |
| | | //如果当前住宅不是虚拟住宅
|
| | | if (Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | var mainWay = ZbGateway.MainGateWay;
|
| | | if (mainWay == null) { return null; }
|
| | |
|
| | | //获取新建一个场景的命令字符
|
| | | var strCommand = this.GetAddNewSceneCommand(sceneName);
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(ZbGateway.MainGateWay, "Scene/GetNewId", strCommand, "Scene/GetNewId_Respon");
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(mainWay.GwId, "Scene/GetNewId", strCommand, "Scene/GetNewId_Respon");
|
| | | if (result.ErrorMsg != null)
|
| | | {
|
| | | this.ShowTipMsg(result.ErrorMsg);
|
| | |
| | | return listAdjustTarget;
|
| | | }
|
| | | var listSuccess = new List<Scene.DeviceListData>();
|
| | | var mainWay = ZbGateway.MainGateWay;
|
| | | if (mainWay == null) { return listSuccess; }
|
| | |
|
| | | //获取添加执行目标到场景的命令
|
| | | var listCommand = this.GetAddTargetToSceneCommand(sceneId, listAdjustTarget);
|
| | | for (int i = 0; i < listCommand.Count; i++)
|
| | | {
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(ZbGateway.MainGateWay, "Scene/AddMember", listCommand[i], "Scene/AddMember_Respon");
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(mainWay.GwId, "Scene/AddMember", listCommand[i], "Scene/AddMember_Respon");
|
| | | if (result.ErrorMsg != null || result.ErrorMsgDiv == 0)
|
| | | {
|
| | | //出现错误
|
| | |
| | | listAdjustTarget.AddRange(i_scene.AdjustTargetList);
|
| | | return listAdjustTarget;
|
| | | }
|
| | | var mainWay = ZbGateway.MainGateWay;
|
| | | if (mainWay == null) { return null; }
|
| | |
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 806 } };
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "ScenesId", i_scene.Id } };
|
| | | jObject.Add("Data", data);
|
| | | //发送命令
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(ZbGateway.MainGateWay, "Scene/GetDeviceList", jObject.ToString(), "Scene/GetDeviceList_Respon");
|
| | | var result = HdlGatewayLogic.Current.SendJobjectDataToGateway(mainWay.GwId, "Scene/GetDeviceList", jObject.ToString(), "Scene/GetDeviceList_Respon");
|
| | |
|
| | | if (result.ErrorMsg != null)
|
| | | {
|