JLChen
2021-08-21 dc6b96a219645c1125de6d6bb5e94d61cf167be1
2021-8-21-1

增加功能
1;输入条件(增加场景)
2;输出目标(增加安防)
2个文件已添加
10个文件已修改
435 ■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Phone/LogicIcon/security.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Phone/LogicIcon/security.png 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -810,43 +810,7 @@
6095=More than 30 add buttons
 
 
7108=Leak/No Leak
7109=Leak
7110=No leak
7111=Water leaking/no water leaking
7112=Water leaking
7113=No water leaking
7114=Someone/Nobody
7115=Someone
7116=Nobody
7117=Open/Close
7118=On
7119=Close
7120=Anti-dismantling function
7121=Online
7122=Not online
7123=Air quality
7124=Excellent
7125=Good
7126=Poor
7127=Send notification
7128=Notification content
7129=(within 100 characters)
7130=Account selection
7131=App push
7132=Automation
7133=Executed
7134=Target State
7135=Tumble
7136=Temperature
7137=Humidity
7138=PM2.5
7139=CO2
7140=TVOC
7141=Exceeding
7142=Serious
7143=High
7144=excellence
 
 
6000=Rename
@@ -975,6 +939,46 @@
7105=Light pollution: 75 ~ 115ug/m3
7106=Moderate pollution: 115 ~ 150ug/m3
7107=Heavy pollution: > 150ug/m3
7108=Leak/No Leak
7109=Leak
7110=No leak
7111=Water leaking/no water leaking
7112=Water leaking
7113=No water leaking
7114=Someone/Nobody
7115=Someone
7116=Nobody
7117=Open/Close
7118=On
7119=Close
7120=Anti-dismantling function
7121=Online
7122=Not online
7123=Air quality
7124=Excellent
7125=Good
7126=Poor
7127=Send notification
7128=Notification content
7129=(within 100 characters)
7130=Account selection
7131=App push
7132=Automation
7133=Executed
7134=Target State
7135=Tumble
7136=Temperature
7137=Humidity
7138=PM2.5
7139=CO2
7140=TVOC
7141=Exceeding
7142=Serious
7143=High
7144=excellence
7145=Security
7146=Add security
7146=添加安防
    
9000=Please sign in with new cell phone number.
9001=Please sign in with new email address.
@@ -2041,6 +2045,7 @@
7142=严重
7143=偏高
7144=优秀
7145=安防
 
9000=请使用新的手机账号登录APP
9001=请使用新的邮箱账号登录APP
HDL-ON_Android/Assets/Phone/LogicIcon/security.png
HDL-ON_iOS/Resources/Language.ini
@@ -823,43 +823,7 @@
6095=More than 30 add buttons
 
 
7108=Leak/No Leak
7109=Leak
7110=No leak
7111=Water leaking/no water leaking
7112=Water leaking
7113=No water leaking
7114=Someone/Nobody
7115=Someone
7116=Nobody
7117=Open/Close
7118=On
7119=Close
7120=Anti-dismantling function
7121=Online
7122=Not online
7123=Air quality
7124=Excellent
7125=Good
7126=Poor
7127=Send notification
7128=Notification content
7129=(within 100 characters)
7130=Account selection
7131=App push
7132=Automation
7133=Executed
7134=Target State
7135=Tumble
7136=Temperature
7137=Humidity
7138=PM2.5
7139=CO2
7140=TVOC
7141=Exceeding
7142=Serious
7143=High
7144=excellence
 
 
6000=Rename
@@ -988,6 +952,47 @@
7105=Light pollution: 75 ~ 115ug/m3
7106=Moderate pollution: 115 ~ 150ug/m3
7107=Heavy pollution: > 150ug/m3
7108=Leak/No Leak
7109=Leak
7110=No leak
7111=Water leaking/no water leaking
7112=Water leaking
7113=No water leaking
7114=Someone/Nobody
7115=Someone
7116=Nobody
7117=Open/Close
7118=On
7119=Close
7120=Anti-dismantling function
7121=Online
7122=Not online
7123=Air quality
7124=Excellent
7125=Good
7126=Poor
7127=Send notification
7128=Notification content
7129=(within 100 characters)
7130=Account selection
7131=App push
7132=Automation
7133=Executed
7134=Target State
7135=Tumble
7136=Temperature
7137=Humidity
7138=PM2.5
7139=CO2
7140=TVOC
7141=Exceeding
7142=Serious
7143=High
7144=excellence
7145=Security
7146=Add security
    
9000=Please sign in with new cell phone number.
9001=Please sign in with new email address.
@@ -2066,6 +2071,9 @@
7142=严重
7143=偏高
7144=优秀
7145=安防
7146=添加安防
 
9000=请使用新的手机账号登录APP
9001=请使用新的邮箱账号登录APP
HDL-ON_iOS/Resources/Phone/LogicIcon/security.png
HDL_ON/Common/R.cs
@@ -2534,6 +2534,14 @@
        /// 优秀
        /// </summary>
        public const int youxiu = 7144;
        /// <summary>
        /// 安防
        /// </summary>
        public const int anfang = 7145;
        /// <summary>
        /// 添加安防
        /// </summary>
        public const int addSecurityLogic = 7046;
        #region LE新增
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -49,9 +49,16 @@
                functionView.frameLayout.Y = Application.GetRealHeight(0);
            }
            //场景
            LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
            sceneView.frameLayout.Y = functionView.frameLayout.Bottom;
            sceneView.btnText.TextID = StringId.Scenes;
            sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
            viewLayout.AddChidren(sceneView.FLayoutView());
            //室外变化
            LogicView.SelectTypeView shiwaiView = new LogicView.SelectTypeView();
            shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom;
            shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom;
            shiwaiView.btnText.TextID = StringId.shiwaibainhua;
            shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
            
@@ -78,6 +85,11 @@
                funTpye.Show(LogicMethod.condition_if);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            //场景点击事件
            sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                SceneMethod();
            };
            //室外变化
            shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => {
                Weather weather = new Weather();
@@ -88,5 +100,70 @@
            #endregion
        }
        /// <summary>
        /// 添加场景
        /// </summary>
        public void SceneMethod()
        {
            var sceneList = LogicMethod.CurrLogicMethod.GetSceneList();
            List<string> nameList = new List<string>();
            for (int i = 0; i < sceneList.Count; i++)
            {
                var scene = sceneList[i];
                nameList.Add(scene.name);
            }
            PublicInterface publicInterface = new PublicInterface();
            publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) =>
            {
                var sceneSelecetd = sceneList[index];
                Input input = new Input();
                input.sid = sceneSelecetd.sid;
                input.condition_type = "10";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene");
                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
                LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on");
                input.condition.Add(dic);
                AddCondition(input);
                LogicMethod.CurrLogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            });
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
        private void AddCondition(Input input)
        {
            ///记录索引值
            int index = -1;
            for (var i = 0; i < Logic.currlogic.input.Count; i++)
            {
                var condition_type = Logic.currlogic.input[i].condition_type;
                if (condition_type == "10")
                {
                    ///找到标记索引,退出循环体
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                //移除旧数据
                Logic.currlogic.input.RemoveAt(index);
                //新数据插入旧数据的位置
                Logic.currlogic.input.Insert(index, input);
            }
            else
            {
                Logic.currlogic.input.Add(input);
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -36,11 +36,18 @@
            viewLayout.AddChidren(functionView.FLayoutView());
            //场景
            LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
            LogicView.SelectTypeView sceneView= new LogicView.SelectTypeView();
            sceneView.frameLayout.Y = functionView.frameLayout.Bottom;
            sceneView.btnText.TextID = StringId.Scenes;
            sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
            viewLayout.AddChidren(sceneView.FLayoutView());
            //安防
            LogicView.SelectTypeView securityView = new LogicView.SelectTypeView();
            securityView.frameLayout.Y = sceneView.frameLayout.Bottom;
            securityView.btnText.TextID = StringId.anfang;
            securityView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
            viewLayout.AddChidren(securityView.FLayoutView());
            //延时
            LogicView.SelectTypeView delayView = new LogicView.SelectTypeView();
@@ -64,6 +71,11 @@
            sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                SceneMethod();
            };
            //安防点击事件
            securityView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                SecurityMethod(this);
            };
            //延时点击事件
            delayView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -92,7 +104,7 @@
                nameList.Add(scene.name);
            }
            PublicInterface publicInterface = new PublicInterface();
            publicInterface.FrameOrVv(this, nameList, StringId.addSceneLogic, (index) =>
            publicInterface.FrameOrVv(this, nameList,new List<string> { }, StringId.addSceneLogic, (index) =>
            {
                var sceneSelecetd = sceneList[index];
                Output outputDevice = new Output();
@@ -108,7 +120,41 @@
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            });
        }
        /// <summary>
        /// 添加安防
        /// </summary>
        public void SecurityMethod(FrameLayout frameLayout, bool edit=false, int index1=-1)
        {
            List<string> stateList = new List<string>();
            if (edit&& index1 != -1) {
                Output output = Logic.currlogic.output[index1];
                var security = LogicMethod.CurrLogicMethod.GetSecurity(output.sid);
                stateList.Add(security.name);
            }
            var securityList = LogicMethod.CurrLogicMethod.GetSecurityList();
            List<string> nameList = new List<string>();
            for (int i = 0; i < securityList.Count; i++)
            {
                var security = securityList[i];
                nameList.Add(security.name);
            }
            PublicInterface publicInterface = new PublicInterface();
            publicInterface.FrameOrVv(frameLayout, nameList, stateList, StringId.addSecurityLogic,(index) =>
            {
                var securitySelecetd = securityList[index];
                Output outputDevice = new Output();
                outputDevice.target_type = "3";
                outputDevice.sid = securitySelecetd.sid;
                //没啥作用,为了发送数据格式统一;
                outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", "0" } } };
                AddOutput(outputDevice,true);
                LogicMethod.CurrLogicMethod.RemoveAllView();
                AddLogic addLogic = new AddLogic();
                MainPage.BasePageView.AddChidren(addLogic);
                addLogic.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            });
        }
        /// <summary>
        /// 延时时间方法
        /// </summary>
@@ -137,7 +183,7 @@
            if (edit)
            {
                Output output = Logic.currlogic.output[index];
                if (output.target_type == "3")
                if (output.target_type == "4")
                {
                    List<Dictionary<string, string>> dicList = output.status as List<Dictionary<string, string>>;
                    foreach (var dic in dicList)
@@ -169,7 +215,7 @@
                }
                Output outputTime= new Output();
                outputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
                outputTime.target_type = "3";
                outputTime.target_type = "4";
                Dictionary<string, string> dic = new Dictionary<string, string>();
                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay");
                LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint);
@@ -195,23 +241,34 @@
            };
        }
        /// <summary>
        /// 添加目标
        /// </summary>
        /// <param name="target"></param>
        private void AddOutput(Output target)
        /// <param name="bool_if">表示启用不同条件</param>
        private void AddOutput(Output target,bool bool_if=false)
        {
            int indexValue = -1;
            for (int i = 0; i < Logic.currlogic.output.Count; i++)
            {
                if (Logic.currlogic.output[i].sid == target.sid)
                if (bool_if)
                {
                    indexValue = i;
                    break;
                    ///安防允许一种
                    if (Logic.currlogic.output[i].target_type == target.target_type)
                    {
                        indexValue = i;
                        break;
                    }
                }
                else
                {
                    if (Logic.currlogic.output[i].sid == target.sid)
                    {
                        indexValue = i;
                        break;
                    }
                }
            }
            if (indexValue != -1)
            {
                Logic.currlogic.output.RemoveAt(indexValue);
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -504,6 +504,17 @@
                            }
                        }
                        break;
                    case "10":
                        {
                            //用sid找到场景;
                            var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
                            inputView.btnNextIcon.Visible = false;
                            inputView.btnClick.Visible = false;
                            //显示场景名称
                            inputView.btnText.Text = scene.name;
                        }
                        break;
                }
                //再次编辑条件状态点击事件
@@ -755,6 +766,7 @@
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                    }
                };
                ///删除控件
@@ -1088,6 +1100,15 @@
                        break;
                    case "3":
                        {
                            //用sid找到安防;
                            var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
                            targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
                            //显示安防名称
                            stateStr = security.name;
                        }
                        break;
                    case "4":
                        {
                            targetView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
                            foreach (var dic in dicList)
                            {
@@ -1139,7 +1160,12 @@
                            break;
                        case "3":
                            {
                                AddTarget addTarget = new AddTarget();
                                addTarget.SecurityMethod(thisView, edit, indexVulae);
                            }
                            break;
                        case "4":
                            {
                                FrameLayout fLayout = new FrameLayout
                                {
                                    BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -93,6 +93,8 @@
        /// 云端天气条件=6;
        /// 某个逻辑/场景的输出条件=7;
        /// 地理围栏=8;
        /// 空气质量=9;
        /// 场景=10;
        /// </summary>
        public string condition_type = "";
        public List<Dictionary<string, string>> condition = new List<Dictionary<string, string>>();
@@ -119,7 +121,8 @@
        /// 逻辑输出目标类型
        /// 设备=1;
        /// 场景=2;
        /// 延时=3;
        /// 安防=3;
        /// 延时=4;
        /// </summary>
        public string target_type = "";
        public List<Dictionary<string, string>> status = new List<Dictionary<string, string>>();
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -179,12 +179,21 @@
            return Entity.FunctionList.List.GetDeviceFunctionList();
        }
        /// <summary>
        /// 获取网关场景列表
        /// 获取场景列表
        /// </summary>
        /// <returns></returns>
        public List<HDL_ON.Entity.Scene> GetSceneList()
        {
            return HDL_ON.Entity.FunctionList.List.scenes;
        }
        /// <summary>
        /// 获取安防列表
        /// </summary>
        /// <returns></returns>
        public List<HDL_ON.Entity.SecurityAlarm> GetSecurityList()
        {
            return FunctionList.List.securities;
        }
        /// <summary>
        /// 获取房间的设备列表
@@ -217,7 +226,7 @@
            return deviceLists;
        }
        /// <summary>
        /// 获取当个设备
        /// 获取设备(功能)对象
        /// </summary>
        /// <param name="sid">设备唯一标识</param>
        /// <returns></returns>
@@ -238,7 +247,7 @@
        }
        /// <summary>
        /// 获取当个场景
        /// 获取场景对象
        /// </summary>
        /// <param name="sid">场景唯一标识</param>
        /// <returns></returns>
@@ -258,6 +267,26 @@
            return scene;
        }
        /// <summary>
        /// 获取安防对象
        /// </summary>
        /// <param name="sid">安防唯一标识</param>
        /// <returns></returns>
        public HDL_ON.Entity.SecurityAlarm GetSecurity(string sid)
        {
            HDL_ON.Entity.SecurityAlarm security = new Entity.SecurityAlarm() { name = "Unknown" };
            List<HDL_ON.Entity.SecurityAlarm> SecurityLists = GetSecurityList();
            for (int i = 0; i < SecurityLists.Count; i++)
            {
                var sce = SecurityLists[i];
                if (sce.sid == sid)
                {
                    security = sce;
                    break;
                }
            }
            return security;
        }
        /// <summary>
        /// 获取房间名(即是=区域名称)
        /// </summary>
        /// <param name="device">设备</param>
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -357,6 +357,8 @@
            //1-10(表示条件图标)自己局部定义为了显示选中条件类型图标
            //1-时间图标
            //2-功能图标
            //3-云端图标
            //4-场景图标
            for (int i = 0; i < logic.input.Count; i++)
            {
                if (logic.input[i] == null)
@@ -386,6 +388,12 @@
                        }
                        break;
                    case 10:
                        {
                            iconInt = 4;
                        }
                        break;
                }
                if (!iconIntValue.Contains(iconInt))
@@ -401,6 +409,7 @@
            //12-20(表示目标图标)自己局部定义为了显示选中目标类型图标
            //12-功能图标
            //13-场景图标
            //14-安防图标
            //14-延时图标
            for (int i = 0; i < logic.output.Count; i++)
            {
@@ -423,6 +432,12 @@
                    case 3:
                        {
                            iconInt = 14;
                        }
                        break;
                    case 4:
                        {
                            iconInt = 15;
                        }
                        break;
@@ -483,6 +498,12 @@
                            strIcon = "LogicIcon/shiwaitianqi.png";
                        }
                        break;
                    case 4:
                        {
                            strIcon = "LogicIcon/selectTheScene.png";
                        }
                        break;
                    case 11:
                        {
                            //分割条件和目标的图标
@@ -502,7 +523,14 @@
                        break;
                    case 14:
                        {
                            strIcon = "LogicIcon/security.png";
                        }
                        break;
                    case 15:
                        {
                            //strIcon = "LogicIcon/timeicon.png";
                        }
                        break;
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -263,7 +263,7 @@
        /// <param name="list">显示数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值索引值</param>
        public void FrameOrVv(FrameLayout frame, List<string> list, int titleText, Action<int> action)
        public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
        {
            int line = 0;
@@ -366,6 +366,11 @@
                {
                    verticalRefresh.AddChidren(checkView.FLayoutView());
                }
                if (stateList.Contains(strName))
                {
                    checkView.btnCheckIcon.IsSelected = true;
                }
                checkView.btnText.Text = strName;
                checkView.btnClick.Tag = i;//标记
                //点击事件
@@ -391,8 +396,7 @@
                frameLayout.RemoveFromParent();
            };
        }
        }
        /// <summary>
        /// 超出5个元素该用滑动控件
        /// </summary>
@@ -400,7 +404,7 @@
        /// <param name="list">显示数据源</param>
        /// <param name="stateList">之前状态数据源</param>
        /// <param name="titleText">标题</param>
        /// <param name="action">返回值索引值</param>
        /// <param name="action">返回值列表</param>
        public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
        {