From f26d7b01a57fdb53dbe58ad355e3c45e3ec06d60 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 26 二月 2021 16:14:02 +0800
Subject: [PATCH] 2021-2-26-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs |   73 +++++++++++++++++++++++++-----------
 1 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
index 4ec37d4..abb0874 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -32,7 +32,32 @@
             }
         }
         /// <summary>
-        /// 閬ユ帶鍣ㄧ孩澶栫爜瀛︿範
+        /// 閬ユ帶鍣ㄦ坊鍔�
+        /// </summary>
+        /// <returns></returns>
+        public static ResponsePackNew Add(Control control)
+        {
+            var jObject = new JObject { }; 
+            jObject.Add("homeId", HomeId);
+            jObject.Add("deviceId", control.deviceId);
+            jObject.Add("name", control.name);
+            jObject.Add("spk", "ir.module");
+            jObject.Add("type", control.type);
+            if (control.type == "library")
+            {
+                //jObject.Add("group_id", "123");
+                var libraryjay = new JArray { };
+                for (int i = 0; i < control.library.Count; i++)
+                {
+                    libraryjay.Add(control.library[i]);
+                }
+                jObject.Add("library", libraryjay);
+            }
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_Add);
+            return responsePackNew;
+        }
+        /// <summary>
+        /// 绾㈠鐮佸涔�
         /// </summary>
         /// <returns></returns>
         public static void CodeStudy(ButtonObj buttonObj, Action<ResponsePackNew> action)
@@ -44,11 +69,13 @@
             //    var days = whichDayAry[b].ToString();
             //    timer.whichDay.Add(int.Parse(days));
             //}
-
-            var jArray = new JArray { };
             var job = new JObject { };
             job.Add("key", buttonObj.Key);
-            job.Add("value", buttonObj.value);
+            job.Add("data_type", "string");
+            var valuejArray = new JArray { };
+            valuejArray.Add(buttonObj.value);
+            job.Add("value", valuejArray);
+            var jArray = new JArray { };
             jArray.Add(job);
             var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } };
             ResponsePackNew responsePackNew = null;
@@ -73,6 +100,24 @@
             { IsBackground = true }.Start();
         }
         /// <summary>
+        /// 鑷鎸夐敭鍒犻櫎
+        /// </summary>
+        /// <returns></returns>
+        public static ResponsePackNew CodeRemove(ButtonObj buttonObj)
+        {
+            var job = new JObject { };
+            job.Add("key", buttonObj.Key);
+            job.Add("data_type", "string");
+            var valuejArray = new JArray { };
+            valuejArray.Add(buttonObj.value);
+            job.Add("value", valuejArray);
+            var jArray = new JArray { };
+            jArray.Add(job);
+            var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "attributes", jArray } };
+            var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove);
+            return responsePackNew;
+        }
+        /// <summary>
         /// 鑾峰彇閫昏緫
         /// </summary>
         /// <param name="listIdList">閫昏緫ID鍒楄〃</param>
@@ -95,25 +140,7 @@
             return responsePackNew;
         }
 
-
-        public static bool Error(ResponsePackNew responsePackNew)
-        {
-
-            if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-            {
-                return true;
-            }
-            else if (responsePackNew != null && responsePackNew.Code == "14005")
-            {
-                // new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                return false;
-            }
-            else
-            {
-                // new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
-                return false;
-            }
-        }
+       
 
         /// <summary>
         ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� 

--
Gitblit v1.8.0