JLChen
2021-05-18 a869383e163a18cdedcf587383c1eca043129754
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
//  ViewController.m
//  LCOnDemo
//
//  Created by 陈嘉乐 on 2021/4/26.
//
 
#import "ViewController.h"
#import "LCOnIntercomViewController.h"
#import "LCOnMonitorViewController.h"
#import "LCUtlis.h"
#import "LCCallDelegate.h"
#import "LCApiKit.h"
 
@interface ViewController ()<LCCallDelegate>
 
@end
 
@implementation ViewController
 
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
  
}
 
-(void)initLCSDK{
    //初始化LCOpenSDK_Api
    [[LCApiKit sharedInstance] initSDKOpenApi:@"St_0000070a12e995ed44628eeea75a19fc"];
    [[LCApiKit sharedInstance] setCurrentDevicePlayToken:@"5a9cbb4ab2454454ba4995addf3760cc"];
    [[LCApiKit sharedInstance] setCurrentDeviceId:@"6K056CFAAJ8FFA1"];
    [[LCApiKit sharedInstance] setCurrentDeviceName:@"大华可视对讲"];
    [[LCApiKit sharedInstance] setCurrentPsk:@"6K056CFAAJ8FFA1"];
}
 
///监控
- (IBAction)monitoringAction:(id)sender {
    [self initLCSDK];
    
    LCOnMonitorViewController *mVc = [[LCOnMonitorViewController alloc] init];
    
    
 
    [self.navigationController.navigationBar setHidden: YES];
    [self.navigationController pushViewController:mVc animated:YES];
}
 
///来电接听
- (IBAction)callAction:(id)sender {
    [self initLCSDK];
    
    LCOnIntercomViewController *mVc = [[LCOnIntercomViewController alloc] init];
    mVc.mLCCallDelegate = self;
    [self.navigationController.navigationBar setHidden: YES];
    [self.navigationController pushViewController:mVc animated:YES];
}
 
 
 
- (void)onAnswerAction {
    
}
 
- (void)onHangUpAction:(int)callDuration {
    
}
 
- (void)onRejectCallAction {
    
}
 
- (void)onScreenshotSuccessfulAction:(nonnull UIImage *)image {
    
}
 
- (void)onUnlockAction {
    NSLog(@"onUnlockAction:准备开锁");
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        NSLog(@"onUnlockAction:通知开锁成功");
        [[NSNotificationCenter defaultCenter] postNotificationName:LCCallDelegateOpenDoorSuccess
                                                            object:self];
    });
 
}
 
 
@end