| | |
| | | #import "EZPlaybackViewController.h" |
| | | #import "EZDeviceTableViewController.h" |
| | | #import "EZHCNetDeviceSDK.h" |
| | | |
| | | #import "EZMessagePhotoViewController.h" |
| | | |
| | | |
| | | |
| | | |
| | | @implementation EZSDK |
| | | |
| | | /// |
| | | + (instancetype)sharedInstance{ |
| | | static EZSDK *instance = nil; |
| | | static dispatch_once_t onceToken; |
| | | dispatch_once(&onceToken, ^{ |
| | | if (!instance) { |
| | | instance = [[EZSDK alloc] init]; |
| | | } |
| | | }); |
| | | return instance; |
| | | } |
| | | |
| | | static BOOL isHavelibInit=NO; |
| | | |
| | |
| | | 初始化SDK |
| | | 传入国内版key 和海外版globalAppKey |
| | | */ |
| | | + (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey |
| | | - (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey |
| | | { |
| | | |
| | | if (!isHavelibInit) { |
| | |
| | | /** |
| | | 设置SDK的accessToken |
| | | */ |
| | | +(void)setEZAccessToken:(NSString *) accessToken |
| | | -(void)setEZAccessToken:(NSString *) accessToken |
| | | { |
| | | [[GlobalKit shareKit] setAccessToken:accessToken]; |
| | | [EZOPENSDK setAccessToken:accessToken]; |
| | |
| | | /** |
| | | 设置HDLSDK的accessToken |
| | | */ |
| | | +(void)setHDlAccessToken:(NSString *) accessToken refreshToken:(NSString *) refreshToken |
| | | -(void)setHDlAccessToken:(NSString *) accessToken refreshToken:(NSString *) refreshToken |
| | | { |
| | | [[GlobalKit shareKit] setHdlAccessToken:accessToken]; |
| | | [[GlobalKit shareKit] setHdlRefreshToken:refreshToken]; |
| | |
| | | /** |
| | | 设置SDK的河东接口的requestHttpsHost和平台 标识,1.on+(默认) 2.evoyo |
| | | */ |
| | | +(void)setRequestHttpsHostAndPlatform:(NSString *) requestHttpsHost platform:(int)platform homeId:(NSString *)homeId{ |
| | | -(void)setRequestHttpsHostAndPlatform:(NSString *) requestHttpsHost platform:(int)platform homeId:(NSString *)homeId{ |
| | | [[GlobalKit shareKit] setGlobalRequestHttpsHost:requestHttpsHost]; |
| | | [[GlobalKit shareKit] setHdlPlatform:platform]; |
| | | [[GlobalKit shareKit] setHdlHomeId:homeId]; |
| | | } |
| | | |
| | | //获取当前屏幕显示的viewcontroller (这里面获取的相当于rootViewController) |
| | | +(UINavigationController *)getCurrentVC |
| | | -(UINavigationController *)getCurrentVC |
| | | { |
| | | UIWindow * window = [[UIApplication sharedApplication] keyWindow]; |
| | | if (window.windowLevel != UIWindowLevelNormal) |
| | |
| | | /** |
| | | 直接跳转到萤石摄像头列表 |
| | | */ |
| | | +(void)go2EZvizMonitor |
| | | -(void)go2EZvizMonitor |
| | | { |
| | | // NSLog(@"go2EZvizMonitor"); |
| | | //获取EZMain的stroyboard文件 |
| | |
| | | /** |
| | | 跳转添加添加设备 |
| | | */ |
| | | +(void)addEzvizMonitor |
| | | -(void)addEzvizMonitor |
| | | { |
| | | // NSLog(@"添加摄像头"); |
| | | if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { |
| | |
| | | /** |
| | | 查看视频监控直播 |
| | | */ |
| | | +(void)Play:(EZDeviceInfo*)deviceInfo |
| | | -(void)Play:(EZDeviceInfo*)deviceInfo |
| | | { |
| | | UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil]; |
| | | EZLivePlayViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"]; |
| | |
| | | |
| | | /// 指定序列号播放 |
| | | /// @param deviceSerial 序列号 |
| | | +(void)PlayWithDeviceSerial:(NSString *)deviceSerial{ |
| | | -(void)PlayWithDeviceSerial:(NSString *)deviceSerial{ |
| | | //获取设备列表接口 |
| | | [EZOpenSDK getDeviceInfo:deviceSerial completion:^(EZDeviceInfo *deviceInfo, NSError *error) { |
| | | if(error) |
| | |
| | | /** |
| | | 打开摄像头设置页面 |
| | | */ |
| | | +(void)setting:(EZDeviceInfo*)deviceInfo |
| | | -(void)setting:(EZDeviceInfo*)deviceInfo |
| | | { |
| | | UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil]; |
| | | EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"]; |
| | |
| | | /** |
| | | 回放播放历史 |
| | | */ |
| | | +(void)playBackVideo:(EZDeviceInfo*)deviceInfo |
| | | -(void)playBackVideo:(EZDeviceInfo*)deviceInfo |
| | | { |
| | | UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil]; |
| | | EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"]; |
| | |
| | | [[self getCurrentVC] pushViewController:playBackVC animated:YES]; |
| | | } |
| | | |
| | | //// |
| | | //-(void)goToEZMessagePhotoVC:(EZAlarmInfo*)alarmInfo{ |
| | | // UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil]; |
| | | // EZMessagePhotoViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZMessagePhotoViewController"]; |
| | | // // NSLog(@"play--iphone--rootViewController"); |
| | | // rootViewController.info = alarmInfo; |
| | | //// NSLog(@"play--iphone--deviceName -%@",rootViewController.deviceInfo.deviceName); |
| | | //// rootViewController.cameraIndex=0; |
| | | // [[self getCurrentVC] setNavigationBarHidden:NO]; |
| | | // [[self getCurrentVC] pushViewController:rootViewController animated:YES]; |
| | | //} |
| | | |
| | | //+(void)MonitorPushMessage:(NSString *)MonitorType ID:(NSString *)ID |
| | | //{ |