From 38a11bcfaf3cf703e38201c9c6cd6631354ea243 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 30 十一月 2021 09:55:09 +0800
Subject: [PATCH] Siri功能完成

---
 SiriIntents/HDLRunSceneIntentHandlder.cs |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs
index 99f94ee..b053f56 100644
--- a/SiriIntents/HDLRunSceneIntentHandlder.cs
+++ b/SiriIntents/HDLRunSceneIntentHandlder.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using Foundation;
 using HDLSceneSiri;
 using ObjCRuntime;
@@ -54,7 +55,20 @@
             {
                 if (Server.HttpServerRequest.Ins.DataManager.IsLgoin)
                 {
-                    var result = Server.HttpServerRequest.Ins.ExecuteScene(intent.SceneId);
+                    var result = "-1";
+                    if (intent.ControlType == "1")
+                    {
+                        result = Server.HttpServerRequest.Ins.ExecuteScene(intent.ControlId);
+                    }
+                    else
+                    {
+
+                        var security = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityState>(intent.ControlJSONStr);
+                        var sendObj = new List<SecurityState>() { new SecurityState() {
+                             gatewayId =security.gatewayId,sid = security.sid, status = security.status, userSecurityId = security.userSecurityId
+                        } };
+                        result = Server.HttpServerRequest.Ins.SetSecurityStatus(sendObj);
+                    }
                     if (result == "0")
                     {
                         var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success, null);
@@ -104,4 +118,29 @@
             }
         }
     }
+
+
+    /// <summary>
+    /// 瀹夐槻鐘舵�侀厤缃�
+    /// </summary>
+    public class SecurityState
+    {
+        /// <summary>
+        /// 瀹夐槻浜戠id
+        /// </summary>
+        public string userSecurityId;
+        /// <summary>
+        /// 缃戝叧id 缃戝叧id 濡傛灉浼犵殑鏄痵id璇ュ瓧娈甸渶瑕佷紶
+        /// </summary>
+        public string gatewayId;
+        /// <summary>
+        /// 瀹夐槻sid
+        /// </summary>
+        public string sid;
+        /// <summary>
+        /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻
+        /// </summary>
+        public string status;
+    }
+
 }

--
Gitblit v1.8.0