From a639b63526620ffec824cf51040764151f7c13f8 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 01 三月 2021 14:13:51 +0800
Subject: [PATCH] 2021-03-01 1.对接河东接口方案版本。
---
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.h | 67 +++++
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/GlobalKit.h | 6
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m | 54 ++++
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.m | 13 +
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.h | 31 ++
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h | 20 +
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo.xcodeproj/project.pbxproj | 26 +
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/TableViewCells/DeviceListCell.m | 2
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m | 84 ++++++
Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.m | 462 +++++++++++++++++++++++++++++++++++
10 files changed, 758 insertions(+), 7 deletions(-)
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo.xcodeproj/project.pbxproj b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo.xcodeproj/project.pbxproj
index b11937e..c7eb860 100644
--- a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo.xcodeproj/project.pbxproj
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo.xcodeproj/project.pbxproj
@@ -139,8 +139,11 @@
49AF550D1F44423B007362EA /* EZLocalCameraListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49AF550C1F44423B007362EA /* EZLocalCameraListViewController.m */; };
49D4B40D1F66A44000ADF471 /* EZDdnsDeviceTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 49D4B40C1F66A44000ADF471 /* EZDdnsDeviceTableViewController.m */; };
49D4B4AE1F6BB99900ADF471 /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 49D4B4AD1F6BB99900ADF471 /* libbz2.tbd */; };
+ B91B6E5225EC9DFF00915F73 /* ResponseData.m in Sources */ = {isa = PBXBuildFile; fileRef = B91B6E5125EC9DFF00915F73 /* ResponseData.m */; };
B95004F125B927D0002D3C58 /* com.hri.hpc.mobile.ios.player.metallib in Resources */ = {isa = PBXBuildFile; fileRef = B95004F025B927D0002D3C58 /* com.hri.hpc.mobile.ios.player.metallib */; };
B95004F725B929EF002D3C58 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B95004F625B929EF002D3C58 /* Launch Screen.storyboard */; };
+ B96C125625E8C5EA00B69941 /* EZSDK.m in Sources */ = {isa = PBXBuildFile; fileRef = B96C125525E8C5EA00B69941 /* EZSDK.m */; };
+ B96C126725E8F64800B69941 /* EZHttpUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B96C126625E8F64800B69941 /* EZHttpUtil.m */; };
B9EA4E3825C7E7AB000FFDA2 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = B9EA4E0725C7E7AB000FFDA2 /* LICENSE */; };
B9EA4E3925C7E7AB000FFDA2 /* UIScrollView+MJRefresh.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EA4E0925C7E7AB000FFDA2 /* UIScrollView+MJRefresh.m */; };
B9EA4E3A25C7E7AB000FFDA2 /* MJRefreshConst.m in Sources */ = {isa = PBXBuildFile; fileRef = B9EA4E0A25C7E7AB000FFDA2 /* MJRefreshConst.m */; };
@@ -562,8 +565,14 @@
49D4B40B1F66A44000ADF471 /* EZDdnsDeviceTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZDdnsDeviceTableViewController.h; sourceTree = "<group>"; };
49D4B40C1F66A44000ADF471 /* EZDdnsDeviceTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZDdnsDeviceTableViewController.m; sourceTree = "<group>"; };
49D4B4AD1F6BB99900ADF471 /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; };
+ B91B6E5025EC9DFF00915F73 /* ResponseData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ResponseData.h; sourceTree = "<group>"; };
+ B91B6E5125EC9DFF00915F73 /* ResponseData.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ResponseData.m; sourceTree = "<group>"; };
B95004F025B927D0002D3C58 /* com.hri.hpc.mobile.ios.player.metallib */ = {isa = PBXFileReference; lastKnownFileType = "archive.metal-library"; path = com.hri.hpc.mobile.ios.player.metallib; sourceTree = "<group>"; };
B95004F625B929EF002D3C58 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
+ B96C125425E8C5EA00B69941 /* EZSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZSDK.h; sourceTree = "<group>"; };
+ B96C125525E8C5EA00B69941 /* EZSDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZSDK.m; sourceTree = "<group>"; };
+ B96C126525E8F64800B69941 /* EZHttpUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EZHttpUtil.h; sourceTree = "<group>"; };
+ B96C126625E8F64800B69941 /* EZHttpUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZHttpUtil.m; sourceTree = "<group>"; };
B9EA4E0725C7E7AB000FFDA2 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
B9EA4E0925C7E7AB000FFDA2 /* UIScrollView+MJRefresh.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+MJRefresh.m"; sourceTree = "<group>"; };
B9EA4E0A25C7E7AB000FFDA2 /* MJRefreshConst.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MJRefreshConst.m; sourceTree = "<group>"; };
@@ -1016,8 +1025,14 @@
0D8CF4CD1BDF696900A50266 /* Global */ = {
isa = PBXGroup;
children = (
+ B96C125425E8C5EA00B69941 /* EZSDK.h */,
+ B96C125525E8C5EA00B69941 /* EZSDK.m */,
0D8CF4CE1BDF696900A50266 /* GlobalKit.h */,
0D8CF4CF1BDF696900A50266 /* GlobalKit.m */,
+ B96C126525E8F64800B69941 /* EZHttpUtil.h */,
+ B96C126625E8F64800B69941 /* EZHttpUtil.m */,
+ B91B6E5025EC9DFF00915F73 /* ResponseData.h */,
+ B91B6E5125EC9DFF00915F73 /* ResponseData.m */,
);
path = Global;
sourceTree = "<group>";
@@ -1528,7 +1543,7 @@
0D8CF36B1BDF1ABA00A50266 = {
CreatedOnToolsVersion = 7.1;
DevelopmentTeam = BVTA78PRYA;
- ProvisioningStyle = Automatic;
+ ProvisioningStyle = Manual;
SystemCapabilities = {
com.apple.AccessWiFi = {
enabled = 0;
@@ -1711,6 +1726,7 @@
0DCE0C041BE22761000EA68A /* UIButton+DDKit.m in Sources */,
C4A41D8223D6E7B200D59722 /* EZVideoTalkViewcontroller.mm in Sources */,
0DCFC11B1BF18DD800EE1FA3 /* HIKLoadPercentView.m in Sources */,
+ B91B6E5225EC9DFF00915F73 /* ResponseData.m in Sources */,
0D2E4BAE1C7DB2E200CA948A /* AFHTTPRequestOperationManager.m in Sources */,
0DCFC11D1BF18DD800EE1FA3 /* HIKLoadViewItem.m in Sources */,
0DCE0BD31BE1C9A9000EA68A /* View+MASAdditions.m in Sources */,
@@ -1726,6 +1742,7 @@
0D90A06B1CABC6A100E78C64 /* EZPlayDemoViewController.m in Sources */,
0DCE0C3C1BE2279F000EA68A /* UIImageView+HighlightedWebCache.m in Sources */,
B9EA4E3925C7E7AB000FFDA2 /* UIScrollView+MJRefresh.m in Sources */,
+ B96C125625E8C5EA00B69941 /* EZSDK.m in Sources */,
0D77A3361BE0F38D00B4AD0A /* EZDeviceResultViewController.m in Sources */,
0D5015191BF8B7FF00F13269 /* DALabeledCircularProgressView.m in Sources */,
0D50150C1BF8B77500F13269 /* MWGridViewController.m in Sources */,
@@ -1735,6 +1752,7 @@
0D9ACAEA1C7EE4D100B4DE97 /* UIImageView+AFNetworking.m in Sources */,
0DCE0BD01BE1C9A9000EA68A /* MASViewConstraint.m in Sources */,
0D5015111BF8B77500F13269 /* MWZoomingScrollView.m in Sources */,
+ B96C126725E8F64800B69941 /* EZHttpUtil.m in Sources */,
B9EA4E3E25C7E7AB000FFDA2 /* UIView+MJExtension.m in Sources */,
0D50150A1BF8B77500F13269 /* MWCaptionView.m in Sources */,
0D5015101BF8B77500F13269 /* MWTapDetectingView.m in Sources */,
@@ -1930,9 +1948,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "libc++";
CODE_SIGN_ENTITLEMENTS = EZOpenSDKDemo/EZOpenSDK.entitlements;
- CODE_SIGN_IDENTITY = "Apple Development";
+ CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- CODE_SIGN_STYLE = Automatic;
+ CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 200628;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = BVTA78PRYA;
@@ -1963,7 +1981,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.hdl.onpro;
PRODUCT_NAME = EZOpenSDK;
PROVISIONING_PROFILE = "";
- PROVISIONING_PROFILE_SPECIFIER = "";
+ PROVISIONING_PROFILE_SPECIFIER = "ComHdlOnProDevelopment20210225-1";
VALID_ARCHS = "arm64 armv7 armv7s";
WRAPPER_EXTENSION = app;
};
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h
new file mode 100644
index 0000000..9cf0b38
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.h
@@ -0,0 +1,20 @@
+//
+// EZHttpUtil.h
+// EZOpenSDKDemo
+//
+// Created by 闄堝槈涔� on 2021/2/26.
+// Copyright 漏 2021 hikvision. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface EZHttpUtil : NSObject
+/**
+ * 鍩虹鏈嶅姟鐨勬帴鍙i兘瑕佹牎楠宻ign
+ */
++(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params;
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m
new file mode 100644
index 0000000..d969a2e
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZHttpUtil.m
@@ -0,0 +1,84 @@
+//
+// EZHttpUtil.m
+// EZOpenSDKDemo
+//
+// Created by 闄堝槈涔� on 2021/2/26.
+// Copyright 漏 2021 hikvision. All rights reserved.
+//
+
+#import "EZHttpUtil.h"
+#import <Foundation/Foundation.h>
+#import <CommonCrypto/CommonDigest.h>
+
+#define APP_KEY @"HDL-HOME-APP-TEST"
+#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
+
+@implementation EZHttpUtil
+
+
++(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
+ if(params == NULL){
+ params =[NSMutableDictionary dictionary];
+ }
+ [params setValue:APP_KEY forKey:@"appKey"];
+ [params setValue:@"" forKey:@"timestamp"];
+ //1.瀵筀EY鍗囧簭
+ NSArray *keyArray = [params allKeys];
+ NSArray *sortKeyArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
+ return [obj1 compare:obj2 options:NSNumericSearch];
+ }];
+ //2.2 鎷兼帴鎸塙RL閿�煎
+ NSString *newString = @"";
+ for(NSString *key in sortKeyArray){
+ if(params[key] != NULL){
+ NSString *valueStr = params[key];
+ //妫�娴嬪綋鍓嶅弬鏁版槸鍚﹂渶瑕佸弬涓庢牎楠�
+ if([self IfValueNeedSign:valueStr]){
+ newString = [newString stringByAppendingString:[NSString stringWithFormat:@"%@=%@&", key,valueStr]];
+ }
+ }
+ }
+ //2.3 鎷兼帴SECRET_KEY
+ newString = [newString substringToIndex:[newString length] - 1];
+ newString = [ newString stringByAppendingString: SECRET_KEY];
+ //2.4 MD5杞崲+杞皬鍐�
+ if(newString == nil || newString == NULL){
+ newString = @"";
+ }
+ NSString* signstr = [self signMD5Encrypt:newString];
+ [params setValue:signstr forKey:@"sign"];
+
+ return params;
+}
+
++ (NSString*)signMD5Encrypt:(NSString *)str
+{
+ const char *cStr = [str UTF8String];
+ unsigned char digest[CC_MD5_DIGEST_LENGTH];
+ CC_MD5( cStr, strlen(cStr),digest );
+ NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
+ for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
+ [result appendFormat:@"%02x", digest[i]];
+ return result;
+
+
+}
+
+/// <summary>
+/// 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷�
+/// 绌哄瓧绗︿覆涓嶅弬涓�
+/// 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓�
+/// </summary>
+/// <param name="valueStr"></param>
+/// <returns></returns>
++(bool)IfValueNeedSign:(NSString *)valueStr{
+ if (( (valueStr == nil || [valueStr isKindOfClass:[NSNull class]] || valueStr.length == 0))//鍒ょ┖瀛楃
+ || ([[valueStr substringToIndex:1] isEqual:@"{"])//鍒ゆ柇鏄惁涓哄璞�
+ || ([[valueStr substringToIndex:1] isEqual:@"["])//鍒ゆ柇鏄惁涓烘暟缁�
+ ) {
+ return false;
+ }
+ return true;
+}
+
+@end
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.h b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.h
new file mode 100644
index 0000000..9ae441d
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.h
@@ -0,0 +1,67 @@
+//
+// EZSDK.h
+// EZSDK
+//
+// Created by 闄堝槈涔� on 2021/1/27.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface EZSDK : NSObject
+/**
+ 鍒濆鍖朣DK
+ 浼犲叆鍥藉唴鐗坘ey 鍜屾捣澶栫増globalAppKey
+ */
++ (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey;
+/**
+ 璁剧疆SDK鐨刟ccessToken
+ */
++(void)setEZAccessToken:(NSString *) accessToken;
+/**
+ 鐩存帴璺宠浆鍒拌悿鐭虫憚鍍忓ご鍒楄〃
+ */
++(void)go2EZvizMonitor;
+/**
+ 璺宠浆娣诲姞娣诲姞璁惧
+ */
++(void)addEzvizMonitor;
+/**
+ 鏌ョ湅瑙嗛鐩戞帶鐩存挱
+ */
++(void)Play:(NSObject*)deviceInfo;
+/**
+ 鎵撳紑鎽勫儚澶磋缃〉闈�
+ */
++(void)setting:(NSObject*)deviceInfo;
+/**
+ 鍥炴斁鎾斁鍘嗗彶
+ */
++(void)playBackVideo:(NSObject*)deviceInfo;
+
+
+#pragma mark -鎺ュ彛
+/**
+ * @since 娌充笢鑾峰彇瀛愯处鍙穞oken鐨勬帴鍙�
+ *
+ * @param block 鍥炶皟block
+ */
++ (NSURLSessionDataTask *)getChildToken:(void (^)(NSString *accessToken))block;
+
+/**
+ * @since 娌充笢娣诲姞璁惧鐨勬帴鍙�
+ * 鏍规嵁璁惧搴忓垪鍙峰拰璁惧楠岃瘉鐮佹坊鍔犺澶囨帴鍙�
+ *
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param verifyCode 璁惧楠岃瘉鐮�
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘坊鍔犳垚鍔�
+ *
+ * @return operation
+ */
++ (NSURLSessionDataTask *)addDeviceByHDL:(NSString *)deviceSerial
+ verifyCode:(NSString *)verifyCode
+ completion:(void (^)(NSError *error))completion;
+
+
+
+
+@end
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.m b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.m
new file mode 100644
index 0000000..de120e6
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/EZSDK.m
@@ -0,0 +1,462 @@
+//
+// EZSDK.m
+// EZSDK
+//
+// Created by 闄堝槈涔� on 2021/1/27.
+//
+
+#import "EZSDK.h"
+//#import "DeviceInfo.h"
+#import "EZDeviceInfo.h"
+#import "EZOpenSDK.h"
+#import "GlobalKit.h"
+#import "EZAccessToken.h"
+#import "NSArray+DDKit.h"
+#import "EZAddByQRCodeViewController.h"
+#import "EZLivePlayViewController.h"
+#import "EZSettingViewController.h"
+#import "EZPlaybackViewController.h"
+#import "EZDeviceTableViewController.h"
+#import "EZHCNetDeviceSDK.h"
+#import "AFNetworking.h"
+#import <Foundation/Foundation.h>
+#import <CommonCrypto/CommonDigest.h>
+
+#define API_POST_EZ_AddDevice @"/home-wisdom/platform/child/device/add"
+#define API_POST_EZ_GetChildToken @"/home-wisdom/platform/childToken"
+
+
+#define APP_KEY @"HDL-HOME-APP-TEST"
+#define SECRET_KEY @"WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"
+
+
+@implementation EZSDK
+
+/**
+ 鍒濆鍖朣DK
+ 浼犲叆鍥藉唴鐗坘ey 鍜屾捣澶栫増globalAppKey
+ */
++ (BOOL)initLibWithAppKey:(NSString *)appKey globalAppKey:(NSString *)globalAppKey
+{
+ static BOOL isHavelibInit=NO;
+ if (!isHavelibInit) {
+ // isHavelibInit=YES;
+ // NSLog(@"绗竴娆″垵濮嬪寲钀ょ煶搴�");
+ if (!LanguageIsChinese) {
+ //娴峰鐗�
+ isHavelibInit = [EZGlobalSDK initLibWithAppKey:globalAppKey];
+ NSLog(@"娴峰鐗坘ey--%@",globalAppKey);
+ }else{
+ isHavelibInit = [EZOpenSDK initLibWithAppKey:appKey];
+ NSLog(@"鍥藉唴鐗坘ey--%@", appKey);
+ }
+
+ [EZHCNetDeviceSDK initSDK];
+ [EZOPENSDK enableP2P:YES];
+ [EZOPENSDK setDebugLogEnable:YES];
+ NSLog(@"EZOpenSDK Version = %@", [EZOPENSDK getVersion]);
+ }
+ return isHavelibInit;
+}
+
+/**
+ 璁剧疆SDK鐨刟ccessToken
+ */
++(void)setEZAccessToken:(NSString *) accessToken
+{
+ [[GlobalKit shareKit] setAccessToken:accessToken];
+ [EZOPENSDK setAccessToken:accessToken];
+}
+
+
+
+//鑾峰彇褰撳墠灞忓箷鏄剧ず鐨剉iewcontroller (杩欓噷闈㈣幏鍙栫殑鐩稿綋浜巖ootViewController)
++(UINavigationController *)getCurrentVC
+{
+ UIWindow * window = [[UIApplication sharedApplication] keyWindow];
+ if (window.windowLevel != UIWindowLevelNormal)
+ {
+ NSArray *windows = [[UIApplication sharedApplication] windows];
+ for(UIWindow * tmpWin in windows)
+ {
+ if (tmpWin.windowLevel == UIWindowLevelNormal)
+ {
+ window = tmpWin;
+ break;
+ }
+ }
+ }
+
+ return (UINavigationController *)window.rootViewController;
+}
+
+
+/**
+ 鐩存帴璺宠浆鍒拌悿鐭虫憚鍍忓ご鍒楄〃
+ */
++(void)go2EZvizMonitor
+{
+ // 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********");
+}
+
+/**
+ 璺宠浆娣诲姞娣诲姞璁惧
+ */
++(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浠ヤ笅鎵爜鍔熻兘璇疯嚜琛屽疄鐜�");
+ }
+
+}
+
+/**
+ 鏌ョ湅瑙嗛鐩戞帶鐩存挱
+ */
++(void)Play:(NSObject*)deviceInfo
+{
+ 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;
+ [[self getCurrentVC] setNavigationBarHidden:NO];
+ [[self getCurrentVC] pushViewController:rootViewController animated:YES];
+}
+
+/**
+ 鎵撳紑鎽勫儚澶磋缃〉闈�
+ */
++(void)setting:(NSObject*)deviceInfo
+{
+ UIStoryboard *settingStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+ EZSettingViewController *settingVC=[settingStoryBoard instantiateViewControllerWithIdentifier:@"EZSettingViewController"];
+ settingVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
+ [[self getCurrentVC] setNavigationBarHidden:NO];
+ [[self getCurrentVC] pushViewController:settingVC animated:YES];
+}
+
+/**
+ 鍥炴斁鎾斁鍘嗗彶
+ */
++(void)playBackVideo:(NSObject*)deviceInfo
+{
+ UIStoryboard *playBackStoryBoard=[UIStoryboard storyboardWithName:@"EZMain" bundle:nil];
+ EZPlaybackViewController *playBackVC=[playBackStoryBoard instantiateViewControllerWithIdentifier:@"EZPlaybackViewController"];
+ playBackVC.deviceInfo=(EZDeviceInfo *)deviceInfo;
+ [[self getCurrentVC] setNavigationBarHidden:NO];
+ [[self getCurrentVC] pushViewController:playBackVC animated:YES];
+}
+
+
+//+(void)MonitorPushMessage:(NSString *)MonitorType ID:(NSString *)ID
+//{
+// [CommonList login];
+// [CommonList getlist:0 pageSize:20 listArray:^(NSArray *listArray) {
+// for ( NSObject *info in listArray) {
+// DeviceInfo *ezInfo=(DeviceInfo *)info;
+// if ([ID isEqualToString:ezInfo.DeviceSerial]) {
+// NSLog(@"鐩稿悓id");
+// [CommonList Play:ezInfo.RealObject];
+// }
+// }
+// }];
+//}
+
+//+(void)getlist:(int)pageIndex pageSize:(int)pageSize listArray:(void(^)(NSArray *))listArray
+//{
+//
+// static NSMutableArray *deviceListaArray;
+// deviceListaArray=nil;
+// if ([GlobalKit shareKit].accessToken)
+// {
+// [EZOPENSDK setAccessToken:[GlobalKit shareKit].accessToken];
+// //鑾峰彇鍒楄〃
+// [EZOpenSDK getDeviceList:0 pageSize:20 completion:^(NSArray *deviceList, NSInteger totalCount, NSError *error) {
+// deviceListaArray=[NSMutableArray array];
+// for (int i=0; i<deviceList.count; i++) {
+// DeviceInfo *deviceInfos=[[DeviceInfo alloc]init];
+// EZDeviceInfo *ezDeviceInfo=[deviceList dd_objectAtIndex:i];
+// deviceInfos.DeviceName=ezDeviceInfo.deviceName;
+// deviceInfos.DeviceSerial=ezDeviceInfo.deviceSerial;
+// deviceInfos.DeviceNum=(int)ezDeviceInfo.cameraNum;
+// deviceInfos.DeviceCameraInfoListSize=1;
+// deviceInfos.cameraInfo=ezDeviceInfo.cameraInfo;
+// deviceInfos.RealObject=ezDeviceInfo;
+// [deviceListaArray addObject:deviceInfos];
+// }
+// //block鍥炶皟
+// listArray(deviceListaArray);
+// }];
+// }
+//
+//}
+
+//+(void)CameraList
+//{
+// NSLog(@"鏀跺埌瀹屾垚閫氱煡鍥炶皟");
+// [CommonList go2EZvizMonitor];
+//}
+
+//+(NSMutableArray<MonitorData *> *)getMonitorDatas
+//{
+// static NSMutableArray<MonitorData *> *monitorDataMutableArr;
+// if (monitorDataMutableArr==nil) {
+// monitorDataMutableArr=[[NSMutableArray alloc]init];
+// }
+// return monitorDataMutableArr;
+//}
+//
+//+(ICommon*)EZICommon{
+// static ICommon *ICommons;
+// if(ICommons==nil)
+// {
+// ICommons= [[ICommon alloc]init];
+//
+// }
+// return ICommons;
+//}
+
+
+//+(NSArray *)getDeviceList:(int)pageIndex :(int)pageSize
+//{
+// static NSMutableArray *deviceListaArray;
+// deviceListaArray=nil;
+// //鍒ゆ柇鏈湴淇濆瓨鐨刟ccessToken锛岀劧鍚庡悜SDK璁剧疆AccessToken銆�
+// if ([GlobalKit shareKit].accessToken)
+// {
+// [EZOPENSDK setAccessToken:[GlobalKit shareKit].accessToken];
+// //鑾峰彇鍒楄〃
+// [EZOpenSDK getDeviceList:0 pageSize:20 completion:^(NSArray *deviceList, NSInteger totalCount, NSError *error) {
+// deviceListaArray=[NSMutableArray array];
+// //鎬庝箞灏� 杩欓噷block寰楀埌鐨勬暟鎹畆eturn鍥炲幓
+// NSLog(@"鍘熺敓deviceList.count****%ld",(unsigned long)deviceList.count);
+// for (int i=0; i<deviceList.count; i++) {
+// DeviceInfo *deviceInfos=[[DeviceInfo alloc]init];
+// EZDeviceInfo *ezDeviceInfo=[deviceList dd_objectAtIndex:i];
+// deviceInfos.DeviceName=ezDeviceInfo.deviceName;
+// deviceInfos.DeviceSerial=ezDeviceInfo.deviceSerial;
+// deviceInfos.DeviceNum=(int)ezDeviceInfo.cameraNum;
+// deviceInfos.DeviceCameraInfoListSize=1;
+// deviceInfos.cameraInfo=ezDeviceInfo.cameraInfo;
+// deviceInfos.RealObject=ezDeviceInfo;
+// [deviceListaArray addObject:deviceInfos];
+// }
+// }];
+// }
+// else
+// {
+// return deviceListaArray=[NSMutableArray array];
+// }
+// while (deviceListaArray==nil) {
+// [NSThread sleepForTimeInterval:1];
+// }
+// return deviceListaArray ;
+//}
+
+//+(void)login
+//{
+// if ([GlobalKit shareKit].accessToken)
+// {
+// [EZOPENSDK setAccessToken:[GlobalKit shareKit].accessToken];
+// NSLog(@"login---1");
+// }
+// else
+// {
+// [EZOPENSDK openLoginPage:^(EZAccessToken *accessToken) {
+// [[GlobalKit shareKit] setAccessToken:accessToken.accessToken];
+// [EZOPENSDK setAccessToken:accessToken.accessToken];
+// NSLog(@"login---2");
+// }];
+// }
+//}
+
+#pragma mark -鎺ュ彛璇锋眰閮ㄥ垎
+/**
+ * @since 娌充笢鑾峰彇瀛愯处鍙穞oken鐨勬帴鍙�
+ *
+ * @param block 鍥炶皟block
+ */
++ (NSURLSessionDataTask *)getChildToken:(void (^)(NSString *accessToken))block{
+ //1,鍒涘缓浣犲緱璇锋眰url
+ NSString *URL = @"";
+ if([GlobalKit shareKit].GlobalRequestHttpsHost == NULL){
+ URL = @"https://test-gz.hdlcontrol.com";
+ }
+ URL = [NSString stringWithFormat:@"%@%@", URL, API_POST_EZ_GetChildToken];
+
+ //2.璁剧疆璇锋眰鍙傛暟
+ NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+ parameters = [self GetSignRequestDictionary:parameters];
+
+ NSURLSessionDataTask*task=nil;
+ AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
+ AFHTTPResponseSerializer *responseSerializer = [AFHTTPResponseSerializer serializer];
+ manager.responseSerializer = responseSerializer;
+
+ NSMutableURLRequest * request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"post" URLString:URL parameters:parameters error:nil];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
+ [request setValue:GlobalKit.shareKit.hdlAccessToken forHTTPHeaderField:@"Authorization"];
+
+ [[manager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
+
+ //4.瑙f瀽鎷垮埌鐨勫搷搴旀暟鎹�
+ NSLog(@"%@",[[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding]);
+
+ if (block) {
+ NSString * token = @"";
+ block (token);
+ }
+ }]resume];
+ return task;
+
+
+}
+/**
+ * @since 娌充笢娣诲姞璁惧鐨勬帴鍙�
+ * 鏍规嵁璁惧搴忓垪鍙峰拰璁惧楠岃瘉鐮佹坊鍔犺澶囨帴鍙�
+ *
+ * @param deviceSerial 璁惧搴忓垪鍙�
+ * @param verifyCode 璁惧楠岃瘉鐮�
+ * @param completion 鍥炶皟block锛宔rror涓虹┖鏃惰〃绀烘坊鍔犳垚鍔�
+ *
+ * @return operation
+ */
++ (NSURLSessionDataTask *)addDeviceByHDL:(NSString *)deviceSerial
+ verifyCode:(NSString *)verifyCode
+ completion:(void (^)(NSError *error))completion{
+
+ //1,鍒涘缓浣犲緱璇锋眰url
+ NSString *URL = @"";
+ if([GlobalKit shareKit].GlobalRequestHttpsHost == NULL){
+ URL = @"https://test-gz.hdlcontrol.com";
+ }
+ URL = [NSString stringWithFormat:@"%@%@",URL, @"/smart-footstone/region/regionByAccount"];
+
+ //2.璁剧疆璇锋眰鍙傛暟
+ NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
+ // [parameters setValue:deviceSerial forKey:@"deviceSerial"];
+ // [parameters setValue:verifyCode forKey:@"verifyCode"];
+ // parameters[@"deviceSerial"] = deviceSerial;
+ // parameters[@"verifyCode"] = verifyCode;
+ parameters[@"account"] = @"18824864143";
+
+// parameters = [self GetSignRequestDictionary:parameters];
+
+ NSURLSessionDataTask*task=nil;
+ AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
+ AFHTTPResponseSerializer *responseSerializer = [AFHTTPResponseSerializer serializer];
+ manager.responseSerializer = responseSerializer;
+
+ NSMutableURLRequest * request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"post" URLString:URL parameters:parameters error:nil];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
+ [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
+
+ [[manager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
+
+ // //鎷垮埌鍝嶅簲澶翠俊鎭�
+ // NSHTTPURLResponse *res = (NSHTTPURLResponse *)response;
+
+ //4.瑙f瀽鎷垮埌鐨勫搷搴旀暟鎹�
+ NSLog(@"%@",[[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding]);
+
+ if (completion) {
+// error.code = 105002;
+ completion (error);
+ }
+ }]resume];
+ return task;
+}
+
+#pragma mark HttpUtil
+/**
+ * 鍩虹鏈嶅姟鐨勬帴鍙i兘瑕佹牎楠宻ign
+ */
++(NSMutableDictionary *)GetSignRequestDictionary:(NSMutableDictionary *)params{
+ if(params == NULL){
+ params =[NSMutableDictionary dictionary];
+ }
+ UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000;
+ [params setValue:APP_KEY forKey:@"appKey"];
+ [params setValue:[NSString stringWithFormat:@"%llu",recordTime] forKey:@"timestamp"];
+ //1.瀵筀EY鍗囧簭
+ NSArray *keyArray = [params allKeys];
+ NSArray *sortKeyArray = [keyArray sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) {
+ return [obj1 compare:obj2 options:NSNumericSearch];
+ }];
+ //2.2 鎷兼帴鎸塙RL閿�煎
+ NSString *newString = @"";
+ for(NSString *key in sortKeyArray){
+ if(params[key] != NULL){
+ NSString *valueStr = params[key];
+ //妫�娴嬪綋鍓嶅弬鏁版槸鍚﹂渶瑕佸弬涓庢牎楠�
+ if([self IfValueNeedSign:valueStr]){
+ newString = [newString stringByAppendingString:[NSString stringWithFormat:@"%@=%@&", key,valueStr]];
+ }
+ }
+ }
+ //2.3 鎷兼帴SECRET_KEY
+ newString = [newString substringToIndex:[newString length] - 1];
+ newString = [newString stringByAppendingString: SECRET_KEY];
+ //2.4 MD5杞崲+杞皬鍐�
+ if(newString == nil || newString == NULL){
+ newString = @"";
+ }
+ NSString* signstr = [self signMD5Encrypt:newString];
+ [params setValue:signstr forKey:@"sign"];
+
+ return params;
+}
+
+/**
+ MD5杞崲+杞皬鍐�
+ */
++ (NSString*)signMD5Encrypt:(NSString *)str
+{
+ const char *cStr = [str UTF8String];
+ unsigned char digest[CC_MD5_DIGEST_LENGTH];
+ CC_MD5( cStr, strlen(cStr),digest );
+ NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
+ for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
+ [result appendFormat:@"%02x", digest[i]];
+ return result;
+
+
+}
+
+/// <summary>
+/// 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷�
+/// 绌哄瓧绗︿覆涓嶅弬涓�
+/// 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓�
+/// </summary>
+/// <param name="valueStr"></param>
+/// <returns></returns>
++(bool)IfValueNeedSign:(NSString *)valueStr{
+ if (( (valueStr == nil || [valueStr isKindOfClass:[NSNull class]] || valueStr.length == 0))//鍒ょ┖瀛楃
+ || ([[valueStr substringToIndex:1] isEqual:@"{"])//鍒ゆ柇鏄惁涓哄璞�
+ || ([[valueStr substringToIndex:1] isEqual:@"["])//鍒ゆ柇鏄惁涓烘暟缁�
+ ) {
+ return false;
+ }
+ return true;
+}
+
+@end
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/GlobalKit.h b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/GlobalKit.h
index f498ff8..be7b56a 100644
--- a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/GlobalKit.h
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/GlobalKit.h
@@ -18,6 +18,9 @@
@interface GlobalKit : NSObject
+@property (nonatomic, copy) NSString *GlobalRequestHttpsHost;
+@property (nonatomic, copy) NSString *hdlAccessToken;
+
@property (nonatomic, copy) NSString *accessToken;
@property (nonatomic, copy) NSString *deviceSerialNo; //璁惧搴忓垪鍙�
@property (nonatomic, copy) NSString *deviceModel; //璁惧绫诲瀷瀛楃涓�
@@ -32,4 +35,7 @@
- (void)clearDeviceInfo;
+(void)hello;
+
+
+
@end
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.h b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.h
new file mode 100644
index 0000000..0a92e94
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.h
@@ -0,0 +1,31 @@
+//
+// ResponseData.h
+// EZOpenSDKDemo
+//
+// Created by 闄堝槈涔� on 2021/3/1.
+// Copyright 漏 2021 hikvision. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+/**
+
+ */
+@interface ResponseData : NSObject
+/**
+
+ */
+@property (nonatomic, copy) NSString *code;
+/**
+
+ */
+@property (nonatomic, copy) NSString *message;
+/**
+
+ */
+@property (nonatomic, copy) NSObject *data;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.m b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.m
new file mode 100644
index 0000000..eb4aa3d
--- /dev/null
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Global/ResponseData.m
@@ -0,0 +1,13 @@
+//
+// ResponseData.m
+// EZOpenSDKDemo
+//
+// Created by 闄堝槈涔� on 2021/3/1.
+// Copyright 漏 2021 hikvision. All rights reserved.
+//
+
+#import "ResponseData.h"
+
+@implementation ResponseData
+
+@end
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/TableViewCells/DeviceListCell.m b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/TableViewCells/DeviceListCell.m
index 25db7e2..4b294c4 100644
--- a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/TableViewCells/DeviceListCell.m
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/TableViewCells/DeviceListCell.m
@@ -35,7 +35,7 @@
}
self.nameLabel.text = [NSString stringWithFormat:@"%@",deviceInfo.deviceName];
- [self.cameraImageView sd_setImageWithURL:[NSURL URLWithString:deviceInfo.deviceCover] placeholderImageScale:nil];
+ [self.cameraImageView sd_setImageWithURL:[NSURL URLWithString:deviceInfo.deviceCover] placeholderImage:[UIImage imageNamed:@"device_default"]];
// [EZOPENSDK capturePicture:cameraInfo.deviceSerial channelNo:cameraInfo.channelNo completion:^(NSString *url, NSError *error) {
// if(!error){
// [self.cameraImageView sd_setImageWithURL:[NSURL URLWithString:url]];
diff --git a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m
index 5125452..75f59e1 100644
--- a/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m
+++ b/Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/ViewController.m
@@ -9,6 +9,8 @@
#import "ViewController.h"
#import "EZSupportViewController.h"
#import "DDKit.h"
+#import "EZSDK.h"
+#import "MBProgressHUD.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *ddnsDemoBtn;
@@ -26,6 +28,8 @@
self.ddnsDemoBtn.hidden = YES;
#endif
// Do any additional setup after loading the view, typically from a nib.
+
+
}
- (void)didReceiveMemoryWarning {
@@ -45,6 +49,7 @@
// //push鎽勫儚澶村垪琛ㄧ殑viewController
// [self.navigationController pushViewController:instanceVC animated:YES];
+ [[GlobalKit shareKit] setAccessToken:@"ra.b48ex6o495x0etj76a0a3huh1x91ymvw-8oi8f811ry-15pqyvo-dyuk9nyz4"];
/**
* 涓嬮潰浠g爜鍔熻兘涓庝互涓婄殑娉ㄩ噴鏂规硶鐩稿悓
*/
@@ -54,13 +59,58 @@
- (IBAction)logout:(id)sender
{
- [EZOPENSDK logout:^(NSError *error) {
+// [EZOPENSDK logout:^(NSError *error) {
+// }];
+
+ __weak MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
+ [EZSDK addDeviceByHDL:@"" verifyCode:@"" completion:^(NSError *error) {
+
+ [hud hide:YES];
+
+ if(!error){
+ NSLog(@"璇锋眰鎴愬姛");
+ }else{
+ NSLog(@"璇锋眰澶辫触");
+
+// NSLog(@"璇锋眰澶辫触%@",error.description);
+ }
+ [self handleTheError:error];
}];
}
+- (void)handleTheError:(NSError *)error
+{
+ if (!error)
+ {
+// [self performSegueWithIdentifier:@"go2WifiResult" sender:nil];
+ return;
+ }
+ if (error.code == 105002)
+ {
+ UIAlertView *retryAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"device_verify_code_wrong", @"楠岃瘉鐮侀敊璇�") message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"cancel", @"鍙栨秷") otherButtonTitles:NSLocalizedString(@"retry", @"閲嶈瘯"), nil];
+ retryAlertView.tag = 0xbb;
+ [retryAlertView show];
+ }
+ else if (error.code == 105000)
+ {
+ [UIView dd_showMessage:NSLocalizedString(@"ad_already_added",@"鎮ㄥ凡娣诲姞杩囨璁惧")];
+ }
+ else if (error.code == 105001)
+ {
+ [UIView dd_showMessage:NSLocalizedString(@"ad_added_by_others",@"姝よ澶囧凡琚埆浜烘坊鍔�")];
+ }
+ else
+ {
+ [UIView dd_showMessage:NSLocalizedString(@"wifi_add_fail",@"娣诲姞澶辫触")];
+ }
+}
+
+
- (IBAction)goAPI:(id)sender
{
- [EZOPENSDK gotoEzvizAppPage:EZPageAlarmList appType:EZEzvizInternational];
+
+
+// [EZOPENSDK gotoEzvizAppPage:EZPageAlarmList appType:EZEzvizInternational];
// [self performSegueWithIdentifier:@"go2DemoAPI" sender:nil];
}
--
Gitblit v1.8.0