初始化接口
更新日期:2025/5/13
目录
初始化接口
KY_InitIOTC
- 功能描述:
- 用于P2P SDK和Kalay SDK的 IOTC初始化。
接口定义
+ (void)KY_InitIOTCWithLicenseKey:(NSString * _Nonnull)licenseKey
privateKey:(NSString * _Nonnull)privateKey
success:(DictionaryBlock)success
failure:(void (^ _Nonnull)(NSError * _Nullable))failure;
参数说明
参数 | 类型 | 说明 |
---|---|---|
privateKey | string | 初始化Kalay SDK所需的授权码(什么是授权码?) |
licenseKey | string | 初始化P2P SDK所需的授权码(什么是授权码?) |
回调说明
回调 | 类型 | 说明 |
---|---|---|
success | string | 初始化成功的回调 |
failure | 初始化失败的回调。NSError中的code返回码,详细定义参考:返回码 |
返回码
返回码 | 说明 |
---|---|
10001 | privateKey 永久有效 |
10002 | privateKey 在有效期内 |
-10000 | privateKey 无效 |
-10003 | privateKey 已过期 |
-1004 | sdk liceseKey 无效 |
-1005 | sdk liceseKey 无效 |
-3 | sdk liceseKey 重复初始化 |
-20031 | sdk liceseKey 重复初始化 |
-40032 | sdk liceseKey 重复初始化 |
代码示例
[Camera KY_InitIOTCWithLiceseKey:LICENSEKEY
privateKey:PRIVATEKEY
success:^(NSDictionary * _Nonnull dic) {
NSLog(@"KY_InitIOTC:success ip: %@ msg: %@", [dic objectForKey:@"ip"], [dic objectForKey:@"msg"]);
}
failure:^(NSError *error) {
if (error.code == KYPrivateKeyErrorNoValid) {
NSLog(@"KY_InitIOTC:false(KYPrivateKeyErrorNoValid) ip: %@ msg: %@ ", [error.userInfo objectForKey:@"ip"], error.userInfo.description);}
else if (error.code == KYPrivateKeyErrorExpire) {
NSLog(@"KY_InitIOTC:false(KYPrivateKeyErrorExpire) ip: %@ msg: %@ ",[error.userInfo objectForKey:@"ip"], error.userInfo.description);}
else {
NSLog(@"KY_InitIOTC:false() ip: %@ msg: %@ ", [error.userInfo objectForKey:@"ip"], error.userInfo.description);}
}];
KY_UninitIOTC
- 功能描述:
- 用于P2P SDK和Kalay SDK的 IOTC反初始化。
接口定义
+ (void)KY_UninitIOTC;
参数说明
暂无
回调说明
暂无
返回码
暂无
代码示例
[KYCamera KY_UninitIOTC];
KY_SetMasterRegion
- 功能描述:
- 设置分区分流方案的地区
接口定义
+ (enum KYError)KY_SetMasterRegion:(TUTKRegion)regon;
参数说明
参数 | 类型 | 说明 |
---|---|---|
region | int | P2P服务挂载的区域。详细区域设定参考:REGION_ENUM |
REGION_ENUM:
ENUM | 说明 |
---|---|
REGION_ALL | 所有区域 |
REGION_CN | 中国大陆地区 |
REGION_EU | 欧洲地区 |
REGION_US | 美洲地区 |
REGION_ASIA | 亚洲地区 |
REGION_COUNT |
回调说明
参数 | 类型 | 说明 |
---|---|---|
KYError | int | 设置返回值参照下方结构体KYError |
返回码
返回码 | 说明 |
---|---|
0 | 设置失败 |
-3 | IOTC模块 重复初始化 |
-46 | 该区域无效 |
代码示例
暂无
KY_LanSearch
- 功能描述:
- 搜索本地局域网内的设备。
接口定义
+ (void)KY_LanSearch:(NSInteger)timeout
block:(void (^ _Nonnull)(NSInteger, NSData * _Nullable))block;
struct st_LanSearchInfo
{
char UID[21]; //!< The UID of discovered device
char IP[16]; //!< The IP address of discovered device
uint16_t port; //!< The port number of discovered device used for IOTC session connection
char Reserved; //!< Reserved, no use
};
参数说明
参数 | 类型 | 说明 |
---|---|---|
timeout | int | 超时时间,单位:ms |
block | array |
|
[st_LanSearchInfo]:
参数 | 类型 | 说明 |
---|---|---|
UID | char | The UID of discovered device |
IP | char | The IP address of discovered device |
port | int64 | The port number of discovered device used for IOTC session connection |
Reserved | char | 保留位 |
回调说明
暂无
返回码
暂无
代码示例
[KYCamera KY_LanSearch];
KY_GetSDKVersion
- 功能描述:
- 获取SDK的版本号信息。
接口定义
+ (NSString * _Nullable)KY_GetSDKVersion;
参数说明
暂无
回调说明
暂无
返回码
暂无
代码示例
[KYCamera KY_GetSDKVersion];
KY_setLogEnable
- 功能描述:
- 设置log记录。
接口定义
+ (void) KY_setLogEnable:(BOOL)enable
Level:(logLevel_t)level;
+ (void) KY_setLogEnable:(BOOL)enable
Level:(logLevel_t)level
path:(NSString *)path;
参数说明
参数 | 类型 | 说明 |
---|---|---|
enable | boolean | 是否开启log记录 |
path | string | 日志文件存储的路径,设置后log沙盒存储路径为:
|
level | log等级。详细定义参考:LOGLEVEL_ENUM |
LOGLEVEL_ENUM:
ENUM | 说明 |
---|---|
0 | LEVEL_VERBOSE |
1 | LEVEL_DEBUG |
2 | LEVEL_INFO |
3 | LEVEL_WARNING |
4 | LEVEL_ERROR |
5 | LEVEL_SILENCE |
回调说明
暂无
返回码
暂无
代码示例
[KYCamera KY_setLogEnbale:YES Level:0];