From e75ccccb370b47305c6eadb321efb27c86cdd28b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 30 十一月 2021 09:57:24 +0800 Subject: [PATCH] 合并 --- SiriIntents/HDLRunSceneIntentHandlder.cs | 146 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 146 insertions(+), 0 deletions(-) diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs new file mode 100644 index 0000000..b053f56 --- /dev/null +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -0,0 +1,146 @@ +锘縰sing System; +using System.Collections.Generic; +using Foundation; +using HDLSceneSiri; +using ObjCRuntime; +using UIKit; +//using HdlSiri; + +namespace SiriIntents +{ + public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling + { + 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.Failure, 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 HandleHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) + { + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + 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); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц鎴愬姛"; + } + else + { + rsp.SuccessMessage = "Successful execution"; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц澶辫触"; + } + else + { + rsp.SuccessMessage = "Execution failed"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, 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