From 2e82c7f03b0833e3a149d02453d66d8db133b2ce Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 29 十一月 2021 13:36:20 +0800 Subject: [PATCH] 2021-11-29 1.实现ON+设计的UI --- HDLSceneSiriDemo/HDLSceneSiri/HDLSceneHandler.m | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/HDLSceneSiriDemo/HDLSceneSiri/HDLSceneHandler.m b/HDLSceneSiriDemo/HDLSceneSiri/HDLSceneHandler.m index 8f18005..39b9b2a 100644 --- a/HDLSceneSiriDemo/HDLSceneSiri/HDLSceneHandler.m +++ b/HDLSceneSiriDemo/HDLSceneSiri/HDLSceneHandler.m @@ -17,6 +17,8 @@ // 寤鸿锛氬彧鐢╮eday鍜宻uccess 杩欎袱涓猚ode - (void)confirmRunScene:(HDLRunSceneIntent *)intent completion:(void (^)(HDLRunSceneIntentResponse *response))completion NS_SWIFT_NAME(confirm(intent:completion:)){ + + HDLRunSceneIntentResponse *rsp = [[HDLRunSceneIntentResponse alloc] initWithCode:HDLRunSceneIntentResponseCodeInProgress userActivity:nil]; rsp.successMessage =@"璇风瓑寰�..."; completion(rsp); @@ -24,10 +26,23 @@ - (void)handleHDLRunScene:(nonnull HDLRunSceneIntent *)intent completion:(nonnull void (^)(HDLRunSceneIntentResponse * _Nonnull))completion { NSLog(@"HDL handleRunScene"); + NSString *text = @"鎵ц鎴愬姛"; + + + NSData *jsonData = [intent.controlJSONStr dataUsingEncoding:NSUTF8StringEncoding]; + NSError *error; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; + if (error) { + //瑙f瀽鍑洪敊 + } + NSLog(@"dic :%@",dic); + text = [NSString stringWithFormat:@"%@ %@",text,intent.controlJSONStr]; + + //鎵ц鎴愬姛 HDLRunSceneIntentResponse *rsp = [[HDLRunSceneIntentResponse alloc] initWithCode:HDLRunSceneIntentResponseCodeSuccess userActivity:nil]; - rsp.sceneName = intent.sceneName; - rsp.successMessage = @"鎵ц鎴愬姛"; + rsp.controlName = intent.controlName; + rsp.successMessage = text; completion(rsp); } -- Gitblit v1.8.0