From 3698c13aba988cd3e41b91b255e1c682c057e565 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期四, 23 三月 2023 11:49:58 +0800
Subject: [PATCH] 1.新增历史记录相关页面及功能 2.修改配网为热点配网 3.设备列表增加过滤门锁功能 4.增加添加设备通知功能

---
 EZSDK/EZSDK/EZSDK.m |  168 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 147 insertions(+), 21 deletions(-)

diff --git a/EZSDK/EZSDK/EZSDK.m b/EZSDK/EZSDK/EZSDK.m
index c813e1e..d7c2c54 100644
--- a/EZSDK/EZSDK/EZSDK.m
+++ b/EZSDK/EZSDK/EZSDK.m
@@ -18,21 +18,34 @@
 #import "EZPlaybackViewController.h"
 #import "EZDeviceTableViewController.h"
 #import "EZHCNetDeviceSDK.h"
-
-
-
-
+#import "EZMessagePhotoViewController.h"
+#import "HDLEZVisitorRecordViewController.h"
+#import "HDLEZDeviceMsgListViewController.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;
 
 /**
  鍒濆鍖朣DK
  浼犲叆鍥藉唴鐗坘ey 鍜屾捣澶栫増globalAppKey
  */
-+ (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey
+- (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey
 {
-    static BOOL isHavelibInit=NO;
     if (!isHavelibInit) {
+        [EZOPENSDK setDebugLogEnable:YES];
         //        isHavelibInit=YES;
         //        NSLog(@"绗竴娆″垵濮嬪寲钀ょ煶搴�");
         if (!LanguageIsChinese) {
@@ -41,13 +54,15 @@
             NSLog(@"娴峰鐗坘ey--%@",globalAppKey);
         }else{
             isHavelibInit = [EZOpenSDK initLibWithAppKey:appKey];
+            [[GlobalKit shareKit] setHdlAppKey:appKey];
             NSLog(@"鍥藉唴鐗坘ey--%@", appKey);
         }
-        
         [EZHCNetDeviceSDK initSDK];
         [EZOPENSDK enableP2P:YES];
-        [EZOPENSDK setDebugLogEnable:YES];
+//        [EZOPENSDK setDebugLogEnable:YES];
         NSLog(@"EZOpenSDK Version = %@", [EZOPENSDK getVersion]);
+//        NSLog(@"EZOpenSDK treamToken= %@", );
+
     }
     return isHavelibInit;
 }
@@ -55,7 +70,7 @@
 /**
  璁剧疆SDK鐨刟ccessToken
  */
-+(void)setEZAccessToken:(NSString *) accessToken
+-(void)setEZAccessToken:(NSString *) accessToken
 {
     [[GlobalKit shareKit] setAccessToken:accessToken];
     [EZOPENSDK setAccessToken:accessToken];
@@ -64,14 +79,22 @@
 /**
  璁剧疆HDLSDK鐨刟ccessToken
  */
-+(void)setHDlAccessToken:(NSString *) accessToken refreshToken:(NSString *) refreshToken
+-(void)setHDlAccessToken:(NSString *) accessToken refreshToken:(NSString *) refreshToken
 {
     [[GlobalKit shareKit] setHdlAccessToken:accessToken];
     [[GlobalKit shareKit] setHdlRefreshToken:refreshToken];
 }
+/**
+ 璁剧疆SDK鐨勬渤涓滄帴鍙g殑requestHttpsHost鍜屽钩鍙� 鏍囪瘑锛�1.on+(榛樿) 2.evoyo
+ */
+-(void)setRequestHttpsHostAndPlatform:(NSString *) requestHttpsHost platform:(int)platform homeId:(NSString *)homeId{
+    [[GlobalKit shareKit] setGlobalRequestHttpsHost:requestHttpsHost];
+    [[GlobalKit shareKit] setHdlPlatform:platform];
+    [[GlobalKit shareKit] setHdlHomeId:homeId];
+}
 
 //鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller   (杩欓噷闈㈣幏鍙栫殑鐩稿綋浜巖ootViewController)
-+(UINavigationController *)getCurrentVC
+-(UINavigationController *)getCurrentVC
 {
     UIWindow * window = [[UIApplication sharedApplication] keyWindow];
     if (window.windowLevel != UIWindowLevelNormal)
@@ -94,57 +117,129 @@
 /**
  鐩存帴璺宠浆鍒拌悿鐭虫憚鍍忓ご鍒楄〃
  */
-+(void)go2EZvizMonitor
+-(void)go2EZvizMonitor
 {
-    //    NSLog(@"go2EZvizMonitor");
+//    [GlobalKit shareKit].deviceType=HDLEZDeviceType_Default;
+//    //    NSLog(@"go2EZvizMonitor");
+//    //鑾峰彇EZMain鐨剆troyboard鏂囦欢
+//    UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+//    //鑾峰彇EZMain.storyboard鐨勫疄渚媀iewController--鑾峰彇鎽勫儚澶村垪琛�
+//    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鐨剆troyboard鏂囦欢
     UIStoryboard *ezMainStoryboard = [UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
     //鑾峰彇EZMain.storyboard鐨勫疄渚媀iewController--鑾峰彇鎽勫儚澶村垪琛�
     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********");
 }
 
 /**
  璺宠浆娣诲姞娣诲姞璁惧
  */
-+(void)addEzvizMonitor
+-(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浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�");
     }
-    
 }
 
 /**
  鏌ョ湅瑙嗛鐩戞帶鐩存挱
  */
-+(void)Play:(NSObject*)deviceInfo
+-(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");
     rootViewController.deviceInfo=(EZDeviceInfo *)deviceInfo;
     NSLog(@"play--iphone--deviceName -%@",rootViewController.deviceInfo.deviceName);
-    //        rootViewController.cameraIndex=0;
+//            rootViewController.cameraIndex=0;
     [[self getCurrentVC] setNavigationBarHidden:NO];
     [[self getCurrentVC] pushViewController:rootViewController animated:YES];
+    
+    
+}
+
+/// 鎸囧畾搴忓垪鍙锋挱鏀�
+/// @param deviceSerial 搴忓垪鍙�
+-(void)PlayWithDeviceSerial:(NSString *)deviceSerial{
+    //鑾峰彇璁惧鍒楄〃鎺ュ彛
+    [EZOpenSDK getDeviceInfo:deviceSerial completion:^(EZDeviceInfo *deviceInfo, NSError *error) {
+        if(error)
+        {
+            NSLog(@"EZ 鏌ヨ璁惧淇℃伅澶辫触");
+            return;
+        }
+        if (deviceInfo) {
+            [self Play:deviceInfo];
+        }
+    }];
+}
+
+/**
+ 鏍规嵁搴忓垪鍙疯繘鍏ラ棬閿佽棰�
+ @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:(NSObject*)deviceInfo
+-(void)setting:(EZDeviceInfo*)deviceInfo
 {
     UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
     EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"];
@@ -156,7 +251,7 @@
 /**
  鍥炴斁鎾斁鍘嗗彶
  */
-+(void)playBackVideo:(NSObject*)deviceInfo
+-(void)playBackVideo:(EZDeviceInfo*)deviceInfo
 {
     UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
     EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"];
@@ -165,7 +260,38 @@
     [[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];
+//    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
 //{
 //    [CommonList login];

--
Gitblit v1.8.0