From 132dc0402e0c5e22a7d54cdddc1700a1842304bd Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 十二月 2022 15:42:23 +0800
Subject: [PATCH] Merge branch 'wjc' into dev--wxr

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs                |    3 
 HDL-ON_iOS/Resources/Language.ini                                 |    7 +
 HDL-ON_Android/Assets/Language.ini                                |    9 ++
 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs            |   53 +++++++++++--
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs    |   52 +++++++++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs |   55 ++++++++++---
 HDL_ON/Common/R.cs                                                |   14 +++
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs    |   40 +++++++++
 8 files changed, 202 insertions(+), 31 deletions(-)

diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index eb4c98f..18486ef 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1115,6 +1115,11 @@
 7162=Face to open the door
 7163=Video call
 7164=Manipulator
+7165=Area intrusion alarm
+7166=camera
+7167=main switch
+
+
 
 
 
@@ -2332,6 +2337,10 @@
 7162=浜鸿劯寮�闂�
 7163=瑙嗛閫氳瘽鍛煎彨
 7164=鏈烘鎵�
+7165=鍖哄煙鍏ヤ镜鍛婅
+7166=鎽勫儚澶�
+7167=鎬绘帶寮�鍏�
+
 
 
  
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index eb4c98f..23ba050 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -1115,6 +1115,10 @@
 7162=Face to open the door
 7163=Video call
 7164=Manipulator
+7165=Area intrusion alarm
+7166=camera
+7167=main switch
+
 
 
 
@@ -2332,6 +2336,9 @@
 7162=浜鸿劯寮�闂�
 7163=瑙嗛閫氳瘽鍛煎彨
 7164=鏈烘鎵�
+7165=鍖哄煙鍏ヤ镜鍛婅
+7166=鎽勫儚澶�
+7167=鎬绘帶寮�鍏�
 
 
  
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index ea6da3e..136f9a9 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -3038,7 +3038,19 @@
         /// 鏈烘鎵�
         /// </summary>
         public const int jixieshou = 7164;
-
+        /// <summary>
+        /// 鍖哄煙鍏ヤ镜鍛婅
+        /// </summary>
+        public const int quyuruqingaojing = 7165;
+        /// <summary>
+        /// 鎽勫儚澶�
+        /// </summary>
+        public const int shexiangtou = 7166;
+        /// <summary>
+        /// 鎬绘帶寮�鍏�
+        /// </summary>
+        public const int zongkogkaiguan = 7167;
+        
 
 
         #region LE鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
index 7554d49..064ddef 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/ConditionDeviceFunList.cs
@@ -540,8 +540,8 @@
                         fLayout.AddChidren(view1.FLayoutView());
                         view1.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            identifier = "door_call_cloud_event";
-                            DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
+                            this.identifier = "door_call_cloud_event";
+                            this.DeviceView(device, view1.btnState, StringId.shi, StringId.offLogic, 1);
                         };
 
                         LogicView.FunTypeView view2 = new LogicView.FunTypeView();
@@ -550,7 +550,7 @@
                         fLayout.AddChidren(view2.FLayoutView());
                         view2.btnClick.MouseUpEventHandler += (sender, e) =>
                         {
-                            identifier = "door_pedestrian_records";
+                            this.identifier = "door_pedestrian_records";
                             this.FaceAction(this, device, view2.btnState);
                         };
 
@@ -580,10 +580,30 @@
                         }
                         if (edit)
                         {
-                            GetEditState(device, index, view1.btnState, view2.btnState, null, null);
+                            this.GetEditState(device, index, view1.btnState, view2.btnState, null, null);
                         }
                     }
                     break;
+                //澶у崕鎽勫儚澶�
+                case SPK.IpCam_Imou:
+                    {
+                        LogicView.FunTypeView view = new LogicView.FunTypeView(); 
+                        view.btnText.TextID = StringId.quyuruqingaojing;
+                        view.btnText.Name = Language.StringByID(StringId.shipintonghuahujiao);
+                        fLayout.AddChidren(view.FLayoutView());
+                        view.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            this.identifier = "ipcam_region_alram_event";
+                            this.DeviceView(device, view.btnState, StringId.shi, StringId.offLogic, 1);
+                        };
+
+                        if (edit)
+                        {
+                            this.GetEditState(device, index, view.btnState, null, null, null);
+                        }
+                    }
+                    break;
+                    
             }
             #region  淇濆瓨
             ///淇濆瓨View
@@ -593,7 +613,7 @@
             this.AddChidren(saveView.FLayoutView());
             saveView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
-                Save(device,index, edit);
+                this.SaveInput(device,index, edit);
             };
 
             #endregion
@@ -604,7 +624,7 @@
         /// </summary>
         /// <param name="index">绱㈠紩鍊�</param>
         /// <param name="edit"></param>
-        private void Save(Entity.Function device,int index, bool edit)
+        private void SaveInput(Entity.Function device,int index, bool edit) 
         {
             
             if (selectedState != "unknown")
@@ -623,8 +643,19 @@
                         inputDevice.condition = new List<Dictionary<string, string>>();
                     }
                 }
-               
-               
+                else if (device.spk == SPK.IpCam_Imou)
+                {
+                    //澶у崕鎽勫儚澶�
+                    inputDevice.condition_type = "9";
+                    inputDevice.identifier = this.identifier;
+                    if (this.identifier == "ipcam_region_alram_event")
+                    {
+                        //condition榛樿[]
+                        inputDevice.condition = new List<Dictionary<string, string>>();
+                    }
+                }
+
+
                 if (edit)
                 {
                     //绉婚櫎鏃ф暟鎹�
@@ -855,11 +886,11 @@
                     || (button.Name == Language.StringByID(StringId.diedaobaojing)))
                     {
                         //鍙湁姣背娉紶鎰熷櫒(鑷爺)
-                        Save(device, mIndex, mEdit);
+                        SaveInput(device, mIndex, mEdit);
                     }
                     else if (button.Name == Language.StringByID(StringId.shipintonghuahujiao)) {
                         //鍙湁姣背娉紶鎰熷櫒(鑷爺)
-                        Save(device, mIndex, mEdit);
+                        SaveInput(device, mIndex, mEdit);
                     }
                 }
             
@@ -921,7 +952,7 @@
                 }
                 selectedState = device.spk + "_" + value;
                 AddDictionary(keyValue, value, data_type, comparator);
-                Save(device,index, edit);
+                SaveInput(device,index, edit);
             });
         }
         /// PM2.5,Co2,Tvoc璁剧疆鍊�
@@ -979,7 +1010,7 @@
                            break;
                    }
                    AddDictionary(key, values, "integer", "in");
-                   Save(device, index, edit);
+                   SaveInput(device, index, edit);
                });
         }
         /// <summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index 00c2315..e826f65 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -275,9 +275,10 @@
                         funView.btnLine.X = Application.GetRealWidth(16);
                         funView.btnLine.Width = Application.GetRealWidth(343);
                         verticalScrolView.AddChidren(funView.FLayoutView());
-                        funView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(dev.spk);
+                        funView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(dev);
                         funView.btnDeviceName.Text = dev.name;
                         funView.btnRoomName.Text = dev.GetRoomListName();
+
                         funView.btnClick.MouseUpEventHandler += (sen, e) =>
                         {
                             if (if_Type == LogicMethod.condition_if)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 2a295ff..4d994e1 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -140,7 +140,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(inputCondition.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            inputView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             inputView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -417,6 +417,15 @@
                                             var FaceItem = this.GetFaceItem(userId, device.deviceId);
                                             inputView.btnState.Text = FaceItem.userName;
                                         }
+                                    }
+                                    break;
+                                case SPK.IpCam_Imou:
+                                    {
+                                        if (inputCondition.identifier == "door_caipcam_region_alram_eventll_cloud_event")
+                                        {
+                                            inputView.btnState.Text = Language.StringByID(StringId.quyuruqingaojing);
+                                        }
+                                        
                                     }
                                     break;
                             }
@@ -914,7 +923,7 @@
                             //鐢╯id鎵惧埌璁惧锛�
                             var device = LogicMethod.Current.GetDevice(outputTarget.sid);
                             //鐢ㄨ澶囩殑functionType绫诲瀷鎵惧埌瀵瑰簲鍥炬爣锛�
-                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetIconPath(device.spk);
+                            targetView.btnIcon.UnSelectedImagePath = LogicMethod.Current.GetDeviceIconPath(device);
                             //鏄剧ず璁惧鍚嶇О
                             targetView.btnText.Text = device.name;
                             //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
@@ -923,11 +932,24 @@
                             //鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
                             switch (device.spk)
                             {
-                               
+
+                                //鎻掑骇(鏈塙SB)
+                                case SPK.PanelSocket:
+                                    {
+                                        string on_off = GetKeyValue("on_off_master", dicList);
+                                        if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else
+                                        {
+                                            stateStr = stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                    }
+                                    break;
                                 case SPK.AirSwitch:
                                 case SPK.LightSwitch:
                                 //鎻掑骇
-                                case SPK.PanelSocket:
                                 case SPK.ElectricSocket:
                                 //鏈烘鎵�
                                 case SPK.MechanicalArm:
@@ -1441,8 +1463,23 @@
         {
             switch (device.spk)
             {
-                //鎻掑骇
+                //鎻掑骇(鏈塙SB)
                 case SPK.PanelSocket:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            if (value == "on")
+                            {
+                                button1.Text = Language.StringByID(StringId.onLogic);
+                            }
+                            else
+                            {
+                                button1.Text = Language.StringByID(StringId.offLogic);
+                            }
+                        }
+                    }
+                    break;
                 case SPK.ElectricSocket:
                 //寮�鍏崇伅鍏�
                 case SPK.AirSwitch:
@@ -2106,6 +2143,7 @@
                         button2.Text = this.GetFaceItem(value, device.deviceId).userName;
                     }
                     break;
+              
             }
         }
         /// <summary>
@@ -2399,7 +2437,9 @@
         /// <returns></returns>
         private string GetTimeText(string strTimeValue)
         {
-            var timeValue = int.Parse(strTimeValue);
+            //鍥犱负璋冭瘯杞欢涓婁紶涓虹┖杩�;
+            string intTimeValue = string.IsNullOrEmpty(strTimeValue) ? "0" : strTimeValue;
+            var timeValue = int.Parse(intTimeValue);
             string state = "";
             var minutes = timeValue / 60;
             var seconds = timeValue % 60;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 4c0e435..c4db742 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -187,7 +187,7 @@
             var list2 = this.GetVideoDeviceList();
             list.AddRange(list1);
             list.AddRange(list2);
-            GetTestDevice(ref list, false);
+            GetTestDevice(ref list, true);
             return list;
         }
         /// <summary>
@@ -343,17 +343,39 @@
 
             return roomName.TrimEnd(',');
         }
-        #region   鍔ㄤ竴鏀瑰洓
+
         /// <summary>
         /// 鑾峰彇璁惧绫诲瀷鍥炬爣
         /// </summary>
+        /// <param name="device">璁惧</param>
+        /// <returns></returns>
+        public string GetDeviceIconPath(Function device)  
+        {
+
+            if (SPK.MusicStandard == device.spk
+                || SPK.AvMusic == device.spk)
+            {
+                return "MusicIcon/localMusic.png";
+            }
+            //LogicIcon/heatlogic.png"
+            return $"FunctionIcon/Icon/{device.IconName}.png";
+
+        }
+        /// <summary>
+        /// 鑾峰彇璁惧绫诲瀷鍥炬爣(宸插純鐢� 2022骞�11鏈�25鏃�14:07:30)
+        /// </summary>
         /// <param name="functionType">璁惧绫诲瀷</param>
         /// <returns></returns>
-        public string GetIconPath(string functionType)
+        public string GetIconPath(string spk)
         {
             string strPath = "";
-            switch (functionType)
+            switch (spk)
             {
+                case SPK.IpCam_Imou:
+                    {
+                        strPath = $"FunctionIcon/Icon/{SPK.IpCam_Imou.Replace(".", "")}.png";
+                    }
+                    break;
                 case SPK.MechanicalArm:
                     {
                         strPath = "LogicIcon/lightloguc.png";
@@ -451,10 +473,10 @@
                         strPath = "MusicIcon/localMusic.png";
                     }
                     break;
-
             }
             return strPath;
         }
+        #region   鍔ㄤ竴鏀逛笁
         /// <summary>
         /// 璁惧绫诲瀷鐨勫垪琛�(鐏厜绫伙紝绐楀笜绫汇�傘�傘��)
         /// </summary>
@@ -570,6 +592,13 @@
             {
                 deviceStrTypeList.Add(Language.StringByID(StringId.jixieshou));
             }
+            ///鎽勫儚澶寸被
+            var camera = deviceList.Find((device) =>
+            device.spk == SPK.IpCam_Imou);
+            if (camera != null)
+            {
+                deviceStrTypeList.Add(Language.StringByID(StringId.shexiangtou));
+            }
             return deviceStrTypeList;
 
         }
@@ -669,10 +698,16 @@
             else if (deviceType == Language.StringByID(StringId.VideoIntercom))
             {
                 functionTypeList.Add(SPK.doorgate);
-            }  ///鏈烘鎵嬬被
+            }
+            ///鏈烘鎵嬬被
             else  if (deviceType == Language.StringByID(StringId.jixieshou))
             {
                 functionTypeList.Add(SPK.MechanicalArm);
+            }
+            ///鎽勫儚澶寸被
+            else if (deviceType == Language.StringByID(StringId.shexiangtou))
+            {
+                functionTypeList.Add(SPK.IpCam_Imou);
             }
             else
             {
@@ -727,6 +762,7 @@
                 functionTypeList.Add(SPK.AvMusic);
                 functionTypeList.Add(SPK.doorgate);
                 functionTypeList.Add(SPK.MechanicalArm);
+                functionTypeList.Add(SPK.IpCam_Imou);
 
             }
 
@@ -784,6 +820,7 @@
                         deviceTypeList.Add(SPK.SensorHelp);
                         deviceTypeList.Add(SPK.DoorLock);
                         deviceTypeList.Add(SPK.doorgate);
+                        deviceTypeList.Add(SPK.IpCam_Imou);
 
                     }
                     break;
@@ -851,7 +888,7 @@
             return list;
         }
         /// <summary>
-        /// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
+        /// 缃戝叧ID(鑾峰彇缃戝叧ID)
         /// </summary>
         public string GatewayId
         {
@@ -1126,7 +1163,7 @@
                  // new Entity.Function { sid = "1234567891", name = "娓╁害浼犳劅鍣�", spk = Entity.SPK.SensorTemperature },
                  //  new Entity.Function { sid = "1234567892", name = "婀垮害浼犳劅鍣�", spk = Entity.SPK.SensorHumidity },
                     new Entity.Function { sid = "12345678933456", name = "璋冨厜鐏�", spk = Entity.SPK.LightDimming },
-                      new Entity.Function { sid = "1234567895444", name = "cct", spk = Entity.SPK.LightCCT },
+                      new Entity.Function { sid = "1234567895444", name = "闈㈡澘", spk = Entity.SPK.PanelSocket },
                       //new Entity.Function { sid = "1234567896", name = "姣背娉紶鎰熷櫒", spk = Entity.SPK.SenesorMegahealth },
                       //  new Entity.Function { sid = "1234567897", name = "姣背娉紶鎰熷櫒1", spk = Entity.SPK.SenesorMegahealth2 },
                       // new Entity.Function { sid = "1234567899", name = "闂ㄧ浼犳劅鍣�", spk = Entity.SPK.SensorDoorWindow },
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 0cb5dd3..d9b1b60 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -55,12 +55,35 @@
             #region  缂栬緫璁惧鐘舵��
             switch (device.spk)
             {
-
+                //鎻掑骇(鏈塙SB)
+                case SPK.PanelSocket:
+                    {
+                        #region 鐣岄潰
+                        ///鎬绘帶寮�鍏�
+                        LogicView.FunTypeView view1 = new LogicView.FunTypeView();
+                        view1.btnText.TextID = StringId.zongkogkaiguan;
+                        view1.btnState.Name = "鎬绘帶寮�鍏�";
+                        fLayout.AddChidren(view1.FLayoutView());
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, view1.frameLayout.Bottom);
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///鎬绘帶寮�鍏崇偣鍑讳簨浠�
+                        view1.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            SwitchViewMethod(device, view1.btnState, 2);
+                        };
+                        if (edit)
+                        {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+                            GetEditDeviceState(device, index, view1.btnState, null, null, null);
+                        }
+                        #endregion
+                    }
+                    break;
                 //寮�鍏崇伅鍏� 
                 case SPK.AirSwitch:
                 case SPK.LightSwitch:
-                //鎻掑骇
-                case SPK.PanelSocket:
                 case SPK.ElectricSocket:
                 //鏈烘鎵�
                 case SPK.MechanicalArm:
@@ -820,6 +843,17 @@
                 selectedState = device.spk + "_" + strValue;
                 //璁惧灞炴�у�硷紝浜戦泙涓婂畾涔夊ソ鐨�;
                 string keyVlaue = "on_off";
+                switch (device.spk)
+                {
+                    case SPK.PanelSocket:
+                        {
+                            if (button.Name == "鎬绘帶寮�鍏�")
+                            {
+                                keyVlaue = "on_off_master";
+                            }
+                        }
+                        break;
+                }
                 //鏁版嵁灏佽
                 AddDictionary(keyVlaue, strValue);
             });

--
Gitblit v1.8.0