//
|
// ViewController.m
|
// HDLSceneSiriDemo
|
//
|
// Created by 陈嘉乐 on 2021/11/17.
|
//
|
|
#import "ViewController.h"
|
#import "HDLSiriSceneListViewController.h"
|
#import "HDLSiriShortcutModel.h"
|
|
@interface ViewController ()
|
|
@end
|
|
@implementation ViewController
|
|
- (void)viewDidLoad {
|
[super viewDidLoad];
|
// Do any additional setup after loading the view.
|
}
|
|
-(void)gotoSiriSceneListViewController{
|
|
|
NSMutableArray *dataList = [NSMutableArray new];
|
//1.场景
|
HDLSiriShortcutModel *sceneModel = [[HDLSiriShortcutModel alloc] init];
|
sceneModel.title = @"场景";
|
sceneModel.content = @"将场景添加到Siri捷径,即可通过Siri语音执行";
|
NSMutableArray *list = [NSMutableArray new];
|
for(int i = 0; i<10; i++){
|
HDLSiriControlModel *model = [[HDLSiriControlModel alloc] init];
|
model.controlType = @"1";
|
model.controlName = [NSString stringWithFormat:@"回家模式%d",i];
|
model.controlId = [NSString stringWithFormat:@"userSceneId%d",i];
|
model.actionName = @"执行场景";
|
model.controlJSONStr = @"2";
|
[list addObject:model];
|
}
|
sceneModel.list = [NSArray arrayWithArray:list];
|
[dataList addObject:sceneModel];
|
|
//2.安防
|
HDLSiriShortcutModel *securityModel = [[HDLSiriShortcutModel alloc] init];
|
securityModel.title = @"安防";
|
securityModel.content =@"将安防添加到Siri捷径,即可通过Siri语音执行";
|
NSMutableArray *list2 = [NSMutableArray new];
|
for(int i = 0; i<10; i++){
|
HDLSiriControlModel *model = [[HDLSiriControlModel alloc] init];
|
model.controlType = @"2";
|
model.controlName = [NSString stringWithFormat:@"外出布防%d",i];
|
model.controlId = [NSString stringWithFormat:@"usecurityId%d",i];
|
model.actionName = @"执行安防";
|
model.controlJSONStr = @"{\"userSecurityId\":\"111111111\",\"gatewayId\":\"2222222\",\"sid\":\"333333\",\"status\":\"enable\"}";
|
// model.sid = [NSString stringWithFormat:@"securityId%d",i];
|
[list2 addObject:model];
|
}
|
securityModel.list = [NSArray arrayWithArray:list2];
|
[dataList addObject:securityModel];
|
|
|
|
HDLSiriSceneListViewController *vc = [[HDLSiriSceneListViewController alloc] init];
|
vc.dataSource = dataList;
|
vc.homeId = @"000000";
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
- (IBAction)gotoSiriPage:(id)sender {
|
[self gotoSiriSceneListViewController];
|
}
|
|
@end
|