Skip to content

Commit

Permalink
删除废弃接口,使用配置才可启动
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleychen committed Jan 16, 2025
1 parent 29a759c commit 806b0b4
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,18 @@ - (void)starP2PServer {
}
}
NSLog(@"_sys_xp2p_info xp2pValue : %@",xp2pValue);
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:self.productId?:@"" dev_name:self.deviceName?:@""];

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:self.productId dev_name:self.deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName xp2pinfo:xp2pValue];

if (errorcode == XP2P_ERR_VERSION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,17 @@ - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName isReconnection:(BOO

- (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString {
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,17 @@ - (void)requestXp2pInfo:(NSString *)deviceName {

- (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfo{
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfo?:@""];
}
/// video 设备列表
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,17 @@ - (void)responseP2PdisConnect:(NSNotification *)notify {

- (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString {
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""];
}

Expand Down
12 changes: 11 additions & 1 deletion Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoSameScreenVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,17 @@ - (void)requestXp2pInfoWithDeviceName:(NSString *)deviceName isReconnection:(BOO

- (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString {
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""];
}

Expand Down
12 changes: 11 additions & 1 deletion Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoCallVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ - (void)viewDidLoad {
- (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""];

if (errorcode == XP2P_ERR_VERSION) {
Expand Down
12 changes: 11 additions & 1 deletion Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoVideoPushVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,17 @@ - (void)getEncoderAACData:(NSData *)data {
- (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""];

if (errorcode == XP2P_ERR_VERSION) {
Expand Down
12 changes: 11 additions & 1 deletion Source/LinkSDKDemo/Video/P2P/Mjpeg/TIoTDemoPreviewMJPEGVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,17 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
[self requestCloudStoreVideoList];

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""];

if (errorcode == XP2P_ERR_VERSION) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,17 @@ - (void)responseLocalP2PdisConnect:(NSNotification *)notify {

- (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString {
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""];
}

Expand Down
24 changes: 22 additions & 2 deletions Source/LinkSDKDemo/Video/PlayBack/TIoTDemoPlaybackVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ - (void)requestDiffDeviceDataWithXp2pInfo:(NSString *)xp2pInfo {
if (self.isNVR == NO) {

TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:self.deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:self.deviceName?:@"" xp2pinfo:xp2pInfo?:@""];

if (errorcode == XP2P_ERR_VERSION) {
Expand Down Expand Up @@ -284,7 +294,17 @@ - (void)responseP2PdisConnect:(NSNotification *)notify {

- (void)resconnectXp2pWithDevicename:(NSString *)deviceName xp2pInfo:(NSString *)xp2pInfoString {
TIoTCoreAppEnvironment *env = [TIoTCoreAppEnvironment shareEnvironment];
[[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@""];

TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = env.appKey; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = env.appSecret; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [[TIoTCoreXP2PBridge sharedInstance] getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;

int errorcode = [[TIoTCoreXP2PBridge sharedInstance] startAppWith:env.cloudProductId dev_name:deviceName?:@"" appconfig:config];
[[TIoTCoreXP2PBridge sharedInstance] setXp2pInfo:deviceName?:@"" xp2pinfo:xp2pInfoString?:@""];
}

Expand Down
1 change: 0 additions & 1 deletion Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
* 启动 sdk 服务,productid和devicename可以从video控制台创建得倒
* type: 默认auto模式,udp探测不通自动切换至tcp
*/
- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name; __attribute__((deprecated("Use -startAppWith: dev_name: appconfig:")));
- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name appconfig:(TIoTP2PAPPConfig *)appconfig;

/*
Expand Down
11 changes: 0 additions & 11 deletions Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,6 @@ - (const char *)dicConvertString:(NSDictionary *)dic {
return jsonString.UTF8String;
}

- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name {
TIoTP2PAPPConfig *config = [TIoTP2PAPPConfig new];
config.appkey = @"appkey"; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.appsecret = @"appsecret"; //为explorer平台注册的应用信息(https://console.cloud.tencent.com/iotexplorer/v2/instance/app/detai) explorer控制台- 应用开发 - 选对应的应用下的 appkey/appsecret
config.userid = [self getAppUUID];

config.autoConfigFromDevice = NO;
config.type = XP2P_PROTOCOL_AUTO;
config.crossStunTurn = NO;
return [self startAppWith:pro_id dev_name:dev_name appconfig:config];
}
- (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name appconfig:(TIoTP2PAPPConfig *)appconfig {
if (!appconfig || appconfig.appkey.length < 1 || appconfig.appsecret.length < 1 || appconfig.userid.length < 1) {
NSLog(@"请输入正确的appconfig");
Expand Down

0 comments on commit 806b0b4

Please sign in to comment.