From e71c57108e6dd407c2c6f0361f68150f2ff9aed5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十二月 2021 13:41:16 +0800 Subject: [PATCH] 版本备份 --- SiriIntents/HDLRunSceneIntentHandlder.cs | 153 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 144 insertions(+), 9 deletions(-) diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs index 78adabf..6d260c2 100644 --- a/SiriIntents/HDLRunSceneIntentHandlder.cs +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -1,26 +1,161 @@ 锘縰sing System; +using System.Collections.Generic; +using Foundation; using HDLSceneSiri; using ObjCRuntime; +using UIKit; +//using HdlSiri; namespace SiriIntents { public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling { - public HDLRunSceneIntentHandlder() + public override void ConfirmHDLRunScene (HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) { + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.InProgress, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璇风瓑寰�..."; + } + else + { + rsp.SuccessMessage = "Please wait..."; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app."; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } } - public override void ConfirmRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) + public override void HandleHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) { - Console.WriteLine("asjdkfasdfa"); + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + if(Server.HttpServerRequest.Ins.DataManager.HomeId!= intent.HomeId) + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "浣忓畢涓嶅尮閰�"; + } + else + { + rsp.SuccessMessage = "Residential mismatch."; + } + completion(rsp); + return; + } + var result = "-1"; + if (intent.ControlType == "1") + { + result = Server.HttpServerRequest.Ins.ExecuteScene(intent.ControlId); + } + else + { - base.ConfirmRunScene(intent, completion); - } - - public override void HandleRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) - { - throw new NotImplementedException(); + 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); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц鎴愬姛"; + } + else + { + rsp.SuccessMessage = "Successful execution "; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц澶辫触"; + } + else + { + rsp.SuccessMessage = "Execution failed."; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app."; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } } } + + + /// <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