萤石云 iOSSDK,移植跨平台相关工程
EZSDK/EZSDK/EZSDK.m
@@ -19,9 +19,8 @@
#import "EZDeviceTableViewController.h"
#import "EZHCNetDeviceSDK.h"
#import "EZMessagePhotoViewController.h"
#import "HDLEZVisitorRecordViewController.h"
#import "HDLEZDeviceMsgListViewController.h"
@implementation EZSDK
@@ -45,8 +44,8 @@
 */
- (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey
{
    if (!isHavelibInit) {
        [EZOPENSDK setDebugLogEnable:YES];
        //        isHavelibInit=YES;
        //        NSLog(@"第一次初始化萤石库");
        if (!LanguageIsChinese) {
@@ -55,13 +54,15 @@
            NSLog(@"海外版key--%@",globalAppKey);
        }else{
            isHavelibInit = [EZOpenSDK initLibWithAppKey:appKey];
            [[GlobalKit shareKit] setHdlAppKey:appKey];
            NSLog(@"国内版key--%@", appKey);
        }
        [EZHCNetDeviceSDK initSDK];
        [EZOPENSDK enableP2P:YES];
        [EZOPENSDK setDebugLogEnable:YES];
//        [EZOPENSDK setDebugLogEnable:YES];
        NSLog(@"EZOpenSDK Version = %@", [EZOPENSDK getVersion]);
//        NSLog(@"EZOpenSDK treamToken= %@", );
    }
    return isHavelibInit;
}
@@ -118,16 +119,34 @@
 */
-(void)go2EZvizMonitor
{
    //    NSLog(@"go2EZvizMonitor");
//    [GlobalKit shareKit].deviceType=HDLEZDeviceType_Default;
//    //    NSLog(@"go2EZvizMonitor");
//    //获取EZMain的stroyboard文件
//    UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
//    //获取EZMain.storyboard的实例ViewController--获取摄像头列表
//    EZDeviceTableViewController *instanceVC = [ezMainStoryboard instantiateViewControllerWithIdentifier:@"EZCameraList"];
//    //push摄像头列表的viewController
//    [[self getCurrentVC] setNavigationBarHidden:NO];
//    //        NSLog(@"willpush********");
//    [[self getCurrentVC] pushViewController:instanceVC animated:YES];
//    //        NSLog(@"had pushed********");
    [self toEZDeviceListViewWithFilterTypes:@[@""]];
}
/**
 直接跳转到萤石摄像头列表(筛掉门锁设备)
 @param filterTepes 过滤型号数组
 */
- (void)toEZDeviceListViewWithFilterTypes:(NSArray*)filterTepes{
    [GlobalKit shareKit].deviceType=HDLEZDeviceType_Default;
    //获取EZMain的stroyboard文件
    UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
    //获取EZMain.storyboard的实例ViewController--获取摄像头列表
    EZDeviceTableViewController *instanceVC = [ezMainStoryboard instantiateViewControllerWithIdentifier:@"EZCameraList"];
    instanceVC.filterTypes=filterTepes;
    //push摄像头列表的viewController
    [[self getCurrentVC] setNavigationBarHidden:NO];
    //        NSLog(@"willpush********");
    [[self getCurrentVC] pushViewController:instanceVC animated:YES];
    //        NSLog(@"had pushed********");
}
/**
@@ -135,17 +154,36 @@
 */
-(void)addEzvizMonitor
{
//    //    NSLog(@"添加摄像头");
//    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
//        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"AddDevice" bundle:nil];
//        EZAddByQRCodeViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"AddByQRCode"];
//        [[self getCurrentVC] setNavigationBarHidden:NO];
//        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
//    } else {
//        //        [UIView dd_showMessage:@"iOS 7.0以下扫码功能请自行实现"];
//        NSLog(@"iOS 7.0以下扫码功能请自行实现");
//    }
    [self addEzvizMonitorWithDeviceType:@""];
}
/**
 跳转添加添加设备
 @param deviceType 设备类型
 */
- (void)addEzvizMonitorWithDeviceType:(NSString *)deviceType{
    HDLEZDeviceType type=[deviceType isEqualToString:HDLEZ_DOOR_SPK] ? HDLEZDeviceType_Door : HDLEZDeviceType_Default;
    //    NSLog(@"添加摄像头");
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"AddDevice" bundle:nil];
        EZAddByQRCodeViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"AddByQRCode"];
        rootViewController.deviceType=type;
        [[self getCurrentVC] setNavigationBarHidden:NO];
        [[self getCurrentVC] pushViewController:rootViewController animated:YES];
    } else {
        //        [UIView dd_showMessage:@"iOS 7.0以下扫码功能请自行实现"];
        NSLog(@"iOS 7.0以下扫码功能请自行实现");
    }
}
/**
@@ -153,6 +191,7 @@
 */
-(void)Play:(EZDeviceInfo*)deviceInfo
{
    [GlobalKit shareKit].deviceType=HDLEZDeviceType_Default;
    UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
    EZLivePlayViewController *rootViewController = [addDeviceStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"];
    //        NSLog(@"play--iphone--rootViewController");
@@ -182,6 +221,22 @@
}
/**
 根据序列号进入门锁视频
 @param deviceSerial 序列号
 @param deviceId 设备id
 @param deviceType 设备spk(用于区分是否为门锁)
 */
-(void)PlayWithDeviceSerial:(NSString *)deviceSerial deviceId:(NSString*)deviceId deviceType:(NSString *)deviceType{
    [GlobalKit shareKit].deviceType=[deviceType isEqualToString:HDLEZ_DOOR_SPK] ? HDLEZDeviceType_Door : HDLEZDeviceType_Default;
    UIStoryboard *ezMainStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
    EZLivePlayViewController *vc = [ezMainStoryBoard instantiateViewControllerWithIdentifier:@"EZLivePlayViewController"];
    vc.deviceId=deviceId;
    vc.deviceSerial=deviceSerial;
    [[self getCurrentVC] setNavigationBarHidden:NO];
    [[self getCurrentVC] pushViewController:vc animated:YES];
}
/**
 打开摄像头设置页面
 */
-(void)setting:(EZDeviceInfo*)deviceInfo
@@ -205,6 +260,27 @@
    [[self getCurrentVC] pushViewController:playBackVC animated:YES];
}
/**临时密码页
 @param deviceId 设备id
 */
- (void)toTemPassView:(NSString*)deviceId{
    HDLEZVisitorRecordViewController *vc=[[HDLEZVisitorRecordViewController alloc] init];
    vc.deviceId=deviceId;
    [[self getCurrentVC] setNavigationBarHidden:YES];
    [[self getCurrentVC] pushViewController:vc animated:YES];
}
/**设备历史记录页
 @param deviceId 设备id
 */
- (void)toDeviceMsgListView:(NSString*)deviceId{
    HDLEZDeviceMsgListViewController *vc=[[HDLEZDeviceMsgListViewController alloc] init];
    vc.deviceId=deviceId;
    [[self getCurrentVC] setNavigationBarHidden:YES];
    [[self getCurrentVC] pushViewController:vc animated:YES];
}
////
//-(void)goToEZMessagePhotoVC:(EZAlarmInfo*)alarmInfo{
//    UIStoryboard *addDeviceStoryBoard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];