Skip to content

Commit 8259ab4

Browse files
author
eagleychen
committed
添加2.4.49版本判断是否跟随
1 parent e93120c commit 8259ab4

File tree

14 files changed

+52
-16
lines changed

14 files changed

+52
-16
lines changed

Source/LinkApp/Classes/Module/EquipmentPanel/Controller/TIoTPanelVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ - (void)starP2PServer {
947947
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
948948
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
949949
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
950-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
951950

952951
config.xp2pinfo = xp2pValue;
953952

Source/LinkSDKDemo/Video/Login/Controller/TIoTDeviceInfoVC.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,6 @@ - (void)judgeAutoFillInputInfo {
195195

196196
self.productID.text = [TIoTCoreUserManage shared].demoAreaNetProductID;
197197
self.devicenname.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;
198-
self.xp2pinfo.text = [TIoTCoreUserManage shared].demoAreaNetClientToken;
199-
200198
}
201199

202200
- (void)saveInputInfo {

Source/LinkSDKDemo/Video/NVRList/Controller/TIoTDemoNVRSubDeviceVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *
189189
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
190190
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
191191
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
192-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
193192

194193
config.xp2pinfo = xp2pInfoString;
195194

Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayListVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName xp2pInfo:(NSString
107107
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
108108
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
109109
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
110-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
111110

112111
config.xp2pinfo = xp2pInfo;
113112

Source/LinkSDKDemo/Video/P2P/Controller/PreviousPath/TIoTPlayMovieVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *
213213
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
214214
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
215215
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
216-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
217216

218217
config.xp2pinfo = xp2pInfoString;
219218

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
147147
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
148148
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
149149
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
150-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
151150

152151
config.xp2pinfo = xp2pInfo;
153152

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *
673673
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
674674
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
675675
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
676-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
677676

678677
config.xp2pinfo = xp2pInfoString;
679678

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
114114
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
115115
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
116116
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
117-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
118117

119118
config.xp2pinfo = xp2pInfo;
120119

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
173173
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
174174
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
175175
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
176-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
177176

178177
config.xp2pinfo = xp2pInfo;
179178

Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
147147
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
148148
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
149149
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
150-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
151150

152151
config.xp2pinfo = xp2pInfo;
153152

Source/LinkSDKDemo/Video/PlayBack/LocalPlayBack/Controller/TIoTDemoLocalRecordVC.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,6 @@ - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *
16251625
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
16261626
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
16271627
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
1628-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
16291628

16301629
config.xp2pinfo = xp2pInfoString;
16311630

Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
9696
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
9797
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
9898
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
99-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
10099

101100
config.xp2pinfo = xp2pInfo;
102101

@@ -299,7 +298,6 @@ - (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *
299298
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
300299
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
301300
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
302-
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];
303301

304302
config.xp2pinfo = xp2pInfoString;
305303

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
2121
@interface TIoTP2PAPPConfig : NSObject
2222
@property (nonatomic, strong)NSString *appkey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
2323
@property (nonatomic, strong)NSString *appsecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai)
24-
@property (nonatomic, strong)NSString *userid; //用户纬度(每个手机区分开)使用用户自有的账号系统userid;若无请配置为[TIoTCoreXP2PBridge sharedInstance].getAppUUID; 查找日志是需提供此userid字段
2524

2625
@property (nonatomic, strong)NSString *xp2pinfo; //被连接设备的p2p_info
2726

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
//NSFileHandle *fileHandle;
2121
static BOOL p2p_log_enabled = NO;
2222
static BOOL ops_report_enabled = YES;
23+
@interface TIoTP2PAPPConfig ()
24+
@property (nonatomic, strong)NSString *userid;
25+
@end
2326
@implementation TIoTP2PAPPConfig
2427
@end
2528

29+
2630
@interface TIoTCoreXP2PBridge ()<TIoTAVCaptionFLVDelegate>
2731
@property (nonatomic, strong) NSString *dev_name;
2832
@property (nonatomic, strong) NSString *pro_id;
@@ -241,7 +245,46 @@ - (const char *)dicConvertString:(NSDictionary *)dic {
241245
return jsonString.UTF8String;
242246
}
243247

248+
// 判断版本号是否小于 2.4.49
249+
BOOL isVersionLessThanTarget(NSString *version, NSString *targetVersion) {
250+
// 将版本号拆分为数组
251+
NSArray *versionComponents = [version componentsSeparatedByString:@"."];
252+
NSArray *targetComponents = [targetVersion componentsSeparatedByString:@"."];
253+
254+
// 逐个比较版本号
255+
for (NSInteger i = 0; i < MIN(versionComponents.count, targetComponents.count); i++) {
256+
NSInteger versionPart = [versionComponents[i] integerValue];
257+
NSInteger targetPart = [targetComponents[i] integerValue];
258+
259+
if (versionPart < targetPart) {
260+
return YES; // 当前部分小于目标部分
261+
} else if (versionPart > targetPart) {
262+
return NO; // 当前部分大于目标部分
263+
}
264+
}
265+
266+
// 如果前面的部分都相等,就返回不小于(NO表示大于等于)
267+
return NO;
268+
}
269+
270+
// 提取 % 后面的子字符串并判断版本
271+
BOOL checkVersionAfterPercent(NSString *input) {
272+
// 查找 % 的位置
273+
NSRange percentRange = [input rangeOfString:@"%"];
274+
if (percentRange.location == NSNotFound) {
275+
NSLog(@"未找到 % 符号");
276+
return NO;
277+
}
278+
279+
// 提取 % 后面的子字符串
280+
NSString *versionString = [input substringFromIndex:percentRange.location + 1];
281+
282+
// 判断版本是否小于 2.4.49
283+
return isVersionLessThanTarget(versionString, @"2.4.49");
284+
}
285+
244286
- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name appconfig:(TIoTP2PAPPConfig *)appconfig {
287+
appconfig.userid = [self getAppUUID];
245288
if (!appconfig || appconfig.appkey.length < 1 || appconfig.appsecret.length < 1 || appconfig.userid.length < 1) {
246289
NSLog(@"请输入正确的appconfig");
247290
return XP2P_ERR_INIT_PRM;
@@ -250,6 +293,12 @@ - (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name app
250293
NSLog(@"请输入正确的xp2pInfo");
251294
return XP2P_ERR_INIT_PRM;
252295
}
296+
BOOL result = checkVersionAfterPercent(appconfig.xp2pinfo);
297+
if (result) {
298+
appconfig.autoConfigFromDevice = NO;
299+
}
300+
301+
253302
[self appGetUserConfig:appconfig]; //get config
254303

255304
NSString *bundleid = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]?:@"";
@@ -320,7 +369,9 @@ - (NSString *)signMessage:(NSString *)message withSecret:(NSString *)secret {
320369
// Base64 解码
321370
const char *cKey = [secret cStringUsingEncoding:NSASCIIStringEncoding];
322371
const char *cData = [message cStringUsingEncoding:NSASCIIStringEncoding];
323-
372+
if (cKey == NULL || cData == NULL) {
373+
return nil;
374+
}
324375
//sha1
325376
unsigned char cHMAC[CC_SHA1_DIGEST_LENGTH];
326377
CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), cData, strlen(cData), cHMAC);

0 commit comments

Comments
 (0)