Android API
一、IOTCamera
1.1 初始化接口
注:调用TK_initIOTC时返回-10000, 是因为privateKey无效导致,遇到该问题时建议:
- 确认当前项目使用的包名与privateKey是否与TUTK提供的一致,如不一致,请修改为TUTK提供的包名与privateKey重新运行;
- 如需更改包名与privateKey,请联系商务或者技术支持人员。
TK_InitIOTCWithLiceseKey
功能:IOTC初始化,确认privateKey和sdkLicensekey的合法性
两个Key值需要向TUTK申请
/**
IOTC初始化
@param licenseKey SDK初始化的Key值
@param privateKey PSC初始化的Key值
@param privatekeyRegion 设备所在区域
@param success 验证成功
@param failure 验证失败
*/
typedef NS_ENUM(NSInteger, TKRegion)
{
TKREGION_ALL,
TKREGION_CN,
TKREGION_EU,
TKREGION_US,
TKREGION_AISA,
TKREGION_COUNT,
};
+ (void)TK_InitIOTCWithLiceseKey:(NSString *)licenseKey
privateKey:(NSString *)privateKey
region:(TKRegion)privatekeyRegion
success:(DictionaryBlock)success
failure:(void (^)(NSError *error))failure;
示例:[Camera TK_InitIOTCWithLiceseKey:LICENSEKEY
privateKey:PRIVATEKEY
region:TKREGION_CN
success:^(NSDictionary * _Nonnull dic){
}
failure:^(NSError *error) {
if (error.code == TUTK_ER_INVALID_ARG)
{
NSLog(@"TK_InitIOTC:false(TUTK_ER_INVALID_ARG)");
}else if (error.code == TUTK_ER_INVALID_LICENSE_KEY) {
NSLog(@"TK_InitIOTC:false(TUTK_ER_INVALID_LICENSE_KEY)");
}else if (error.code == TUTK_ER_MEM_INSUFFICIENT) {
NSLog(@"TK_InitIOTC:false(TUTK_ER_MEM_INSUFFICIENT)");
}
}];TK_uninitIOTC
/**
IOTC反初始化
*/
+ (void)TK_uninitIOTC;
示例:[Camera TK_uninitIOTC];
TK_init
/**
初始化Camera
@return Camera初始化后的实例对象
*/
- (id)TK_init;
示例:self.myCamera = [[MyCamera alloc] TK_init];
TK_getIOTCameraVersion
/**
获取IOTCamera版本号
@return IOTCamera版本号
*/
+ (NSString *)TK_getIOTCameraVersion;
示例:[Camera TK_getIOTCameraVersion];
TK_getIOTCAPIsVersion
/**
获取IOTCAPIs版本号
@return IOTCAPIs版本号
*/
+ (NSString *)TK_getIOTCAPIsVersion;
示例:[Camera TK_getIOTCAPIsVersion];
TK_getAVAPIsVersion
/**
获取AVAPIs版本号
@return AVAPIs版本号
*/
+ (NSString *)TK_getAVAPIsVersion;
示例:[Camera TK_getAVAPIsVersion];
TK_setMasterRegion: (TKRegion) regin
/**
设置分区分流方案的地区
@param regin 设置分流到TKRegion中的哪个地区
*/
+ (void) TK_setMasterRegion: (TKRegion) region;
typedef NS_ENUM(NSInteger, TKRegion)
{
TKREGION_ALL,
TKREGION_CN,
TKREGION_EU,
TKREGION_US ,
};
示例:[Camera TK_setMasterRegion:TKREGION_CN];
TK_setLogLevel
/**
设置Log记录
@param level log等级
@param logPath log路径
@param output 输出模式
设置path后,log沙盒存储路径为
<path>/yyyy-MM-dd/HH_mm_ss_Console.txt
<path>/yyyy-MM-dd/IOTC.txt
<path>/yyyy-MM-dd/AVAPI.txt
<path>/yyyy-MM-dd/RDT.txt
<path>/yyyy-MM-dd/Global.txt
<path>/yyyy-MM-dd/Nebula.txt
+ (void)TK_setLogLevel:(logLevel_t)level
path:(NSString *_Nullable)logPath
output:(TKLogOutPutMode)output;
* 注意事项:
* 1、日志内容:包含p2p连线相关log 和 控制台log,其中p2p连线相关log默认生成AVAPI、IOTC、RDT、Global共四个模块日志;
* 2、写入规则:p2p连线相关log按AVAPI、IOTC、RDT、Global不同模块,分别在不同的txt文件中写入;控制台log在每次启动app时创建一个txt文件并写入;
* 3、日志大小:同一天只产生一个文件夹;每个txt文件大小上限为1G;
* 4、清除规则:日志最多保留7天,每次启动app时,超过7天将自动删除;同时每个txt文件达到上限时,也将自动删除;
*
typedef enum LogLevel {
LEVEL_VERBOSE = 0,
LEVEL_DEBUG = 1,
LEVEL_INFO = 2,
LEVEL_WARNING = 3,
LEVEL_ERROR = 4,
LEVEL_SILENCE = 5,
} logLevel_t;
typedef NS_ENUM(NSInteger, TKLogOutPutMode) {
TKLogOutPutMode_Console = 0,
TKLogOutPutMode_File = 1,
TKLogOutPutMode_Both = 2,
TKLogOutPutMode_None = 3
};
示例: 沙盒文件夹路径可以自行定义,具体参考示例,底层会在路径下面创建日期文件夹,文件夹里面会生成SDK日志文件以及控制台日志文件 NSString *logPath = :@"Log"; [Camera TK_setLogLevel:LEVEL_VERBOSE path:logPath output:TKLogOutPutMode_Both];
TK_setAvInitialize
/**
初始化最大通道数, TK_InitIOTCWithLiceseKey前调用
@param maxChannel 通道数
*/
+ (void)TK_setAvInitialize:(NSInteger)maxChannel;
示例:[Camera TK_setAvInitialize:128];
1.2 回调接口
1.2.1 P2PDelegate
didChangeSessionStatus
/**
连线状态回调
@param camera camera对象
@param status session连线结果 0 成功 other 失败
@param errorCode TK_connect连线返回结果 >=0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didChangeSessionStatus:(NSInteger)status errorCode:(NSInteger)errorCode;
didChangeChannelStatus
/**
指定通道的连线状态回调
@param camera camera对象
@param channel av通道
@param status 连线状态
@param errorCode TK_start av通道返回结果 0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didChangeChannelStatus:(NSInteger)channel ChannelStatus:(NSInteger)status errorCode:(NSInteger)errorCode;
didChangeBindStatus
/**
Bind状态回调
@param camera camera对象
@param status bind结果 0 成功 other 失败
@param credential 连线credential值
@param errorCode TK_nebulaBind返回结果 >=0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didChangeBindStatus:(NSInteger)status credentialInfo:(NSString *)credential errorCode:(NSInteger)errorCode;
didSendIOCtrlWithType
/**
指定通道指令发送回调
@param camera camera对象
@param type 指令类型
@param data 指令数据
@param size 指令数据长度
@param channel av通道
@param errorCode 返回错误码
*/
- (void)camera:(Camera *)camera didSendIOCtrlWithType:(NSInteger)type Data:(const char*)data DataSize:(NSInteger)size Channel:(NSInteger)channel errorCode:(NSInteger)errorCode;
didReceiveIOCtrlWithType
/**
指定通道指令接收回调
@param camera camera对象
@param type 指令类型
@param data 指令数据
@param size 指令数据长度
@param channel av通道
*/
- (void)camera:(Camera *)camera didReceiveIOCtrlWithType:(NSInteger)type Data:(const char*)data DataSize:(NSInteger)size Channel:(NSInteger)channel;
didRecvVideoChannel
/**
指定通道的视频数据接收错误码
@param camera camera对象
@param channel av通道
@param errorCode avRecvFrameData2 返回结果 大于0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didRecvVideoChannel:(NSInteger)channel errorCode:(NSInteger)errorCode;
didRecvAudioChannel
/**
指定通道的音频数据接收错误码
@param camera camera对象
@param channel av通道
@param errorCode avRecvAudioData av通道返回结果 大于0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didRecvAudioChannel:(NSInteger)channel errorCode:(NSInteger)errorCode;
didStartTalkStatus
/**
对讲通道建立成功的回调
@param camera camera对象
@param status 对讲状态
@param errorCode 错误码
*/
- (void)camera:(Camera *)camera didStartTalkStatus:(NSInteger)status ErrorCode:(NSInteger) errorCode;
didStartListenStatus
/**
监听通道建立成功的回调
@param camera camera对象
@param status 监听状态
@param channel av通道
*/
- (void)camera:(Camera *)camera didStartListenStatus:(NSInteger)status Channel:(NSInteger)channel;
didSendVideoStatus
/**
视频发送通道建立的回调
@param camera camera对象
@param status 视频发送状态
@param errorCode 错误码 (success: >=0,表示发送视频数据时需要使用的avIndex; fail: <0)
*/
- (void)camera:(Camera *)camera didSendVideoStatus:(NSInteger)status ErrorCode:(NSInteger) errorCode;
连线状态status
CONNECTION_STATE_NONE = 0; //初始化连线状态
CONNECTION_STATE_CONNECTING = 1; //设备连线中
CONNECTION_STATE_CONNECTED = 2; //设备已连线 >= 0
CONNECTION_STATE_DISCONNECTED = 3; //设备未连线 -22 AV其它
CONNECTION_STATE_UNKNOWN_DEVICE = 4; //未知设备 -15
CONNECTION_STATE_WRONG_PASSWORD = 5; //设备连线密码错误-20009
CONNECTION_STATE_TIMEOUT = 6; //设备连线超时 IOTC -13 -23 AV -20016 -20011
CONNECTION_STATE_UNSUPPORTED = 7; //不支持设备 -40
CONNECTION_STATE_CONNECT_FAILED = 8; //设备连线失败 IOTC其它
CONNECTION_STATE_UNKNOWN_LICENSE = 9; //设备uid未在license中 -10
CONNECTION_STATE_SLEEP = 10; //设备睡眠状态 -64
CONNECTION_STATE_DEVICE_MAX_SESSION = 11; //超过设备最大连线数 -48
CONNECTION_STATE_POOR_NETWORKSIGNA = 12; //网络信号差 返回状态 -19 -42
CONNECTION_STATE_WRONG_AUTHKEY = 13 //authKey错误 返回状态 -46 -68
1.2.2 MediaDelegate
didReceiveFrameInfoWithChannel
/**
指定通道的视频宽高/fps/bps/在线人数/帧数/丢帧数等调试信息回调
@param camera camera对象
@param channel av通道
@param videoWidth 视频宽
@param videoHeight 视频高
@param fps fps
@param videoBps 视频bps
@param audioBps 音频bps
@param onlineNm 在线人数
@param frameCount 帧数
@param incompleteFrameCount 丢帧数
@param isHwDecode 是否是硬解
*/
- (void)camera:(Camera *)camera didReceiveFrameInfoWithChannel:(NSInteger)channel videoWidth:(NSInteger)videoWidth VideoHeight:(NSInteger)videoHeight VideoFPS:(NSInteger)fps VideoBPS:(NSInteger)videoBps AudioBPS:(NSInteger)audioBps OnlineNm:(NSInteger)onlineNm FrameCount:(unsigned int)frameCount IncompleteFrameCount:(unsigned int)incompleteFrameCount isHwDecode:(BOOL)isHwDecode;
onDecodeResultWithFrameNum
/**
当前解码结果相关信息回调
@param camera camera对象
@param frameNum 当前frame的Number
@param isDecodeSuccess 是否解码成功
@param isDropFrame 是否正在丢p帧
@param isIFrame 是否为I帧
@param frameCount 帧数
@param isSoft 是否为软解
@param channel av通道
*/
- (void)camera:(Camera *)camera onDecodeResultWithFrameNum:(NSInteger)frameNum IsDecodeSuccess:(BOOL)isDecodeSuccess IsDropFrame:(BOOL)isDropFrame IsIFrame:(BOOL)isIFrame frameCount:(unsigned int)frameCount IsSoft:(BOOL)isSoft channel:(NSInteger)channel;
outputDecodeVideoData
/**
上抛指定通道解码后的数据
@param camera camera对象
@param data 解码后的数据
@param outWidth 解码后的数据宽度
@param outHeight 解码后的数据高度
@param timestamp 时间戳
@param channel av通道
*/
- (void)camera:(Camera *)camera outputDecodeVideoData:(NSData *)data width:(int)outWidth height:(int)outHeight timestamp:(uint64_t)timestamp channel:(NSInteger)channel;
didReceiveFrameData
/**
指定通道接收的视频帧数据回调
@param camera camera对象
@param frameData 视频帧数据
@param size 视频帧数据长度
@param infoData 视频帧数据信息
@param channel av通道
*/
- (void)camera:(Camera *)camera didReceiveFrameData:(const char *)frameData DataSize:(unsigned int)size FrmInfo:(NSData *)infoData Channel:(NSInteger)channel;
didReceiveAudioData
/**
指定通道接收的音频帧数据回调
@param camera camera对象
@param data 音频帧数据
@param size 音频帧数据长度
@param infoData 音频帧数据信息
@param channel av通道
*/
- (void)camera:(Camera *)camera didReceiveAudioData:(const char *)data DataSize:(unsigned int)size FrmInfo:(NSData *)infoData Channel:(NSInteger)channel;
didreportCodecId
/**
视频帧编码格式回调
@param camera camera对象
@param pointer 编码格式指针
@param channel av通道
*/
- (void)camera:(Camera *)camera didreportCodecId:(NSValue *)pointer Channel:(NSInteger)channel;
outputDecodeAudioData
/**
输出解码后的音频数据
@param camera camera对象
@param pcmData pcm音频数据
@param channel av通道
*/
备注:需要配合设置下面参数使用
camera.TK_setAudioOutPutWithChannel:channel isOutPutSpeakAudio:YES isOutputMicAudio:YES;
- (void)camera:(Camera *)camera outputDecodeAudioData:(NSData *)pcmData Channel:(int)channel;
didSendAudioOutput
/**
输出Mic采集的音频数据
@param camera camera对象
@param audioData 音频数据
@param length 音频数据长度
@param codec 设备端音频编码格式
@param channel av通道
*/
备注:需要配合设置下面参数使用
camera.isUsingAEC = YES;
camera.TK_setAudioOutPutWithChannel:channel isOutPutSpeakAudio:YES isOutputMicAudio:YES;
- (void)camera:(Camera *)camera didSendAudioOutput:(NSData *)audioData Length:(NSInteger)length Codec:(NSInteger)codec Channel:(NSInteger)channel;
downloadUploadOutput
/**
输出文件下载或上传的数据结果
@param camera camera对象
@param fileName 文件名称
@param progress 文件传输进度
@param type 下载或上传
@param result 设备端音频编码格式
@param channel 通道号
*/
- (void)camera:(Camera *)camera fileName:(NSString *)fileName progress:(NSInteger)progress loadType:(FILETransferType)type result:(NSInteger)result Channel:(NSInteger)channel;
outputSendVideoData
/**
上抛采集到的yuv数据
@param camera camera对象
@param data 采集后的yuv数据
@param timestamp 时间戳
@param channel av通道
*/
- (void)camera:(Camera *)camera outputSendVideoData:(NSData *)data
timestamp:(uint64_t)timestamp
channel:(NSInteger)channel;
1.3 连线接口
1.3.1 P2P
TK_connect
/**
开始连接设备
@param uid 设备UID
*/
- (void)TK_connect:(NSString *)uid;
/**
开始连接设备
@param uid 设备UID
@param authKey 设备连线的key
*/
- (void)TK_connect:(NSString *)uid authKey:(NSString *)authKey;
示例:[self.camera TK_connect:@"device uid" authKey:@"device authKey"];
/**
开始连接设备
@param uid 设备UID
@param authKey 设备连线的key
@param region 设备所在区域
*/
region 可填字符串:
static const char REGION_STRING_CN[] = "cn";
static const char REGION_STRING_EU[] = "eu";
static const char REGION_STRING_US[] = "us";
static const char REGION_STRING_ASIA[] = "asia";
static const char REGION_STRING_ALL[] = "all";
- (void)TK_connect:(NSString *)uid authKey:(NSString *)authKey region:(NSString *)region;;
示例:[self.camera TK_connect:@"device uid" authKey:@"device authKey" region:@"all"];
TK_LanSearch
/**
搜索本地局域网内的设备
@param num 搜索到设备的数量
@param timeoutVal 搜索超时时间
@return 搜索到的设备信息结构体
*/
+ (LanSearch_t *)TK_LanSearch:(int *)num timeout:(int)timeoutVal;
示例:[Camera TK_LanSearch:&num timeout:3000];
1.3.2 Nebula
TK_nebulaBind
/**
Nebula bind设备
@param udid 设备udid 40码
@param bindType 绑定类型,PinCode\Credential\Local
@param bindKey 与绑定类型相关,填入数据分别为pin code\ credential \ null
*/
- (void)TK_nebulaBind: (NSString *)udid bindType: (BINDTYPE )bindType bindKey: (NSString *)bindKey;
示例:[self.myControl TK_nebulaBind:uid bindType:AP_BIND bindKey:@"888888ii"];
TK_nebulaConnect
/**
Nebula 连线设备
@param udid 设备udid 40码
@param credential credential
@param identity 认证码
@param deviceToken 设备token
@param realm realm
@param isWakeup 是否自动唤醒
@param isNebulaOnly 是否只支持Nebula
*/
- (void)TK_nebulaConnect: (NSString *)udid credential: (NSString *) credentia identity: (NSString *)identity deviceToken: (NSString *)deviceToken realm: (NSString *)realm isWakeup: (BOOL)isWakeup isNebulaOnly: (BOOL)isNebulaOnly;
示例:[self TK_nebulaConnect:uid credential:self.dev_credential deviceToken:TOKEN realm:REALM isWakeup:YES isNebulaOnly:YES];;
/**
Nebula 连线设备
@param udid 设备udid 40码
@param credential credential
@param deviceToken 设备token
@param realm realm
*/
- (void)TK_NebulaConnect: (NSString *)udid credential: (NSString *)credential deviceToken: (NSString *)deviceToken realm: (NSString *)realm;
示例:[self TK_nebulaConnect:uid credential:self.dev_credential deviceToken:TOKEN realm:REALM];
TK_NebulaLanSearchTimeout
/**
Nebula 局域网扫描设备
@param timeout 超时时间
@param responseBlock 搜索结果
*/
- (void)TK_nebulaLanSearchTimeout:(NSInteger)timeout responseBlock:(nonnull UDIDInfoBlock)responseBlock;
示例:[myCamera TK_nebulaLanSearchTimeout:5 responseBlock:^(st_UDIDInfo * _Nonnull uuidInfo, int num) { dispatch_async(dispatch_get_main_queue(), ^{ if (num <= 0) { if (block) block(nil); return; } NSDictionary *dict = @{ @"uid": [NSString stringWithFormat:@"%s",uuidInfo->udid], }; [dataSource addObject:dict]; if (block) block(dataSource); return; }); }];TK_nebulaSsidListReq
/**
Nebula 获取设备ssid list
@param max_ap_count 最大搜索数量
@param responseBlock 搜索结果
*/
- (void)TK_nebulaSsidListReq:(int)max_ap_count responseBlock:(ArrayBlock)responseBlock;
示例:[self.myCamera TK_nebulaSsidListReq:(int)maxCount responseBlock:^(NSArray * _Nonnull arr) { responseBlock(arr); }];TK_nebulaSetWifiReq
/**
Nebula 设置wifi
@param ssid Wifi名称
@param password 密码
@param enctype 加密类型
*/
- (void)TK_nebulaSetWifiReq:(NSString *)ssid password:(NSString *)password enctype:(int)enctype responseBlock:(DictionaryBlock)responseBlock;
示例:[self.myCamera TK_nebulaSetWifiReq:ssid password:password enctype:(int)enctype responseBlock:^(NSDictionary * _Nonnull dic) { responseBlock(dic); }];TK_nebulaSetRegionReq
/**
Nebula 设置region
@param region 区域设置
@param responseBlock 结果回调
*/
- (void)TK_nebulaSetRegionReq:(int)region responseBlock:(DictionaryBlock)responseBlock;
示例:[self TK_nebulaSetRegionReq:REGION_CN responseBlock:^(NSDictionary * _Nonnull dic) { responseBlock(dic); }];1.3.3 共有接口
TK_disconnect
/**
断开设备连线
*/
- (void)TK_disconnect;
示例:[self.camera TK_disconnect];
TK_start
/**
开启AV通道
@param channel av通道号
@param viewPassword 设备密码
*/
- (void)TK_start:(NSInteger)channel viewPassword:(NSString *)viewPassword;
/**
开启AV通道
@param channel av通道号
@param viewAccount 设备用户名
@param viewPassword 设备密码/token
@param authType 设备密码验证类型
@param mode 加密模式 SIMPLE(0), DTLS(1), AUTO(2);
*/
- (void)TK_start:(NSInteger)channel viewAccount:(NSString *)viewAccount viewPassword:(NSString *)viewPassword authType:(TKAuthType)authType securityMode:(AvSecurityMode)mode;
示例:[self.myCamera TK_start:0 viewAccount:@"admin" viewPassword:@"000000" authType:TKAuthType_Password is_playback:FALSE];
TK_stop
/**
关闭AV通道
@param channel av通道号
*/
- (void)TK_stop:(NSInteger)channel;
示例:[self.myCamera TK_stop:0];
TK_getConnectionStateOfChannel
/**
获取指定通道的连线状态
@param channel av通道
@return 连线状态值
*/
- (NSInteger)TK_getConnectionStateOfChannel:(NSInteger)channel;
示例:[self.myCamera TK_getConnectionStateOfChannel:0];
TK_getViewAccountOfChannel
/**
获取指定通道的用户名
@param channel 指定通道
@return 获取的用户名
*/
- (NSString *)TK_getViewAccountOfChannel:(NSInteger)channel;
示例:[self.myCamera TK_getViewAccountOfChannel:0];
TK_getViewPasswordOfChannel
/**
获取指定通道的密码
@param channel 指定通道
@return 获取的密码
*/
- (NSString *)TK_getViewPasswordOfChannel:(NSInteger)channel;
示例:[self.myCamera TK_getViewPasswordOfChannel:0];
TK_getServiceTypeOfChannel
/**
获取指定通道的ServiceTYpe
@param channel av通道
@return serviceType值
*/
- (unsigned int)TK_getServiceTypeOfChannel:(NSInteger)channel;
typedef NS_ENUM(NSInteger, TKAuthType)
{
TKAuthType_Password = 0, //密码
TKAuthType_Token = 1 //Token
};
示例:[self.myCamera TK_getServiceTypeOfChannel:0];
1.4 视频处理接口
TK_StartAVFilterWithChannel
/**
是否开启解码滤镜
contrast 对比度-2.0-2.0间的浮点数,默认为0
brightness 亮度-1.0-1.0间的浮点数,默认为0
saturation 饱和度0-3.0间的浮点数,默认为1
gamma 0.1-10.0间的浮点数,默认为1
gamma_r 红色值必须是一个0.1-10.0间的浮点数,默认为1
gamma_g 绿色值必须是一个0.1-10.0间的浮点数,默认为1
gamma_b 蓝色值必须是一个0.1-10.0间的浮点数,默认为1
@param channel av通道
@param filterCMD 滤镜命令 (例:eq=contrast=0.9:brightness=0.1:saturation=1 )
@param isOn 是否开启滤镜
*/
- (void)TK_StartAVFilterWithChannel:(NSInteger)channel filterCMD:(NSString *)filterCMD isOn:(BOOL)isOn
示例: [myCamera TK_StartAVFilterWithChannel:selectedChannel filterCMD:@"eq=contrast=0.9:brightness=0.1:saturation=1" isOn:YES];
TK_startShow
/**
开始接收、解码并显示画面
@param channel av通道
@param obScreen 屏幕显示对象
*/
- (void)TK_startShow:(NSInteger)channel ScreenObject:(NSObject*)obScreen;
示例:[myCamera TK_startShow:0 ScreenObject:self];
/**
开始视频接收、解码并播放
@param channel av通道
@param obScreen 屏幕显示对象
@param isDecodeAndRender 是否解码并渲染
@param isSWDecode 是否软解
@param isDropFrame 是否丢P帧
@param type 输出数据类型
@param isSendCommand 是否发送指令1FF/2FF
*/
- (void)TK_startShow:(NSInteger)channel ScreenObject:(NSObject*)obScreen isDecode:(BOOL)isDecodeAndRender isSWDecode:(BOOL)isSWDecode isDropFrame:(BOOL)isDropFrame renderType:(RENDERTYPE)type isSendCommand:(BOOL)isSendCommand;
typedef NS_ENUM(NSInteger, RENDERTYPE)
{
OUTPUT_EMPTY = 0, //仅接收、解码、渲染,输出数据为空
OUTPUT_YUV = 1, //接收、解码、渲染,并输出yuv数据(耗时)
OUTPUT_RGB_8888 = 2,//接收、解码、渲染,并输出RGB_8888数据(耗时)
OUTPUT_RGB_565 = 3,//接收、解码、渲染,并输出RGB_565数据(耗时)
OUTPUT_YUV_NV12 = 4 //接收、解码、渲染,并输出yuv数据nv12(耗时)
};
示例:[myCamera TK_startShow:0 ScreenObject:self isDecode:YES isSWDecode:YES isDropFrame:NO renderType:OUTPUT_YUV isSendCommand:YES];
TK_stopShow
/**
停止接收、解码和画面显示
@param channel av通道
*/
- (void)TK_stopShow:(NSInteger)channel;
示例:[self.myCamera TK_stopShow:0];
/**
停止接收、解码和画面显示
@param channel av通道
@param isSendCommand 是否发送指令2FF
*/
- (void)TK_stopShow:(NSInteger)channel isSendCommand:(BOOL)isSendCommand;
示例:[self.myCamera TK_stopShow:0 isSendCommand:YES];
TK_getVideoCodecId
/**
获取当前视频格式,在调用TK_StartShow并且出图后调用
@param channel av通道
*/
- (NSInteger)TK_getVideoCodecId:(NSInteger)channel;
示例:[self.myCamera TK_getVideoCodecId:0];
TK_setDecocdeDelayTime
/**设置最大延迟时间,调整解码每帧时间间隔@param channel av通道@param delayTime 最大延迟时间(ms)@param durationTime 解码时间间隔(ms) 0 ~ 30*/- (void)TK_setDecocdeDelayTime:(NSInteger)delayTime durationTime:(NSInteger)durationTime channel:(NSInteger)channel;
示例:[self.camera TK_setDecocdeDelayTime:1500 durationTime:15 channel:0];
TK_setVideoDropMode
/**设置视频丢P帧或快进模式@param channel av通道@param mode mode = 0 丢P帧, mode = 1 快进*/typedef NS_ENUM(NSInteger, DropMode){ DROP_P = 0, // 丢P帧 FAST_DECODE = 1, // 快进};- (void)TK_setVideoDropModeWithChannel:(NSInteger)channel mode:(DropMode)mode;示例:[self.camera TK_setVideoDropModeWithChannel:0 channel:DROP_P];
TK_setVideoRotation
/**画面旋转@param channel av通道 @param rotateAngle 旋转角度*/- (void)TK_setVideoRotation:(NSInteger)channel rotateAngel:(NSInteger)rotateAngle;
示例:[self.camera TK_setVideoRotation:0 rotateAngel:90];
1.5 音频处理接口
mfGaPCMAmplifier_Gain_BeforeSpeak
/**
调节手机端监听声音音量
@param mfGaPCMAmplifier_Gain_BeforeSpeak 值从0.0~10.0
示例:self.myCamera.mfGaPCMAmplifier_Gain_BeforeSpeak = 1.0;
mfGaPCMAmplifier_Gain_AfterMIC
/**
调节手机对讲声音音量
@param mfGaPCMAmplifier_Gain_AfterMIC 值从0.0~10.0
示例:self.myCamera.mfGaPCMAmplifier_Gain_AfterMIC = 1.0;
TK_startSoundToPhone
/**
开始接收、解码并监听设备声音
@param channel av通道
*/
- (void)TK_startSoundToPhone:(NSInteger)channel;
示例:[self.myCamera TK_startSoundToPhone:0];
/**
开始接收、解码并监听设备声音
@param channel av通道
@param isDecodeAndPlay 是否解码并播放
@param sendStartCommand 是否发送接收指令(0x0300)
*/
- (void)TK_startSoundToPhone:(NSInteger)channel isDecodeAndPlay:(BOOL)isDecodeAndPlay sendStartCommand:(BOOL)sendStartCommand;
示例:[self.myCamera TK_startSoundToPhone:0 isDecodeAndPlay:YES sendStartCommand:YES];
TK_stopSoundToPhone
/**
停止接收、解码和监听设备声音
@param channel av通道
*/
- (void)TK_stopSoundToPhone:(NSInteger)channel;
示例:[self.myCamera TK_stopSoundToPhone:0];
/**
停止接收、解码和监听设备声音
@param channel av通道
@param sendStopCommand 是否发送停止指令(0x0301)
*/
- (void)TK_stopSoundToPhone:(NSInteger)channel sendStopCommand:(BOOL)sendStopCommand;
示例:[self.myCamera TK_stopSoundToPhone:0 sendStopCommand:YES];
TK_startSoundToDevice
/**
开始对讲(发送声音到设备)
@param channel av通道
@param isResend 是否开启重送
*/
- (void)TK_startSoundToDevice:(NSInteger)channel isResend:(BOOL)isResend;
示例:[self.myCamera TK_stopSoundToPhone:0];
/**
开始对讲(发送声音到设备)
@param channel av通道
@param isResend 是否开取重传
@param captureSize 手机端采集音频的大小
*/
- (void)TK_startSoundToDevice:(NSInteger)channel isResend:(BOOL)isResend captureSize:(NSInteger)captureSize;
示例:[self.myCamera TK_startSoundToDevice:0 isResend:YES];
示例:[self.myCamera TK_startSoundToDevice:0 isResend:YES captureSize:320];
TK_stopSoundToDevice
/**
停止对讲
@param channel av通道
*/
- (void)TK_stopSoundToDevice:(NSInteger)channel;
示例:[self.myCamera TK_stopSoundToDevice:0];
TK_playAudio
/**
播放回音消除后的音频数据
@param audioData 音频数据
@param channel av通道
*/
- (void)TK_playAudio:(NSData *)audioData Channel:(NSInteger)channel;
示例:[self.myCamera TK_playAudio:pcmData Channel:channel];
TK_sendAudio
/**
发送回音消除后的音频数据
@param audioData 音频数据
@param length 音频数据长度
@param codec 设备端音频编码格式
@param channel av通道
*/
- (void)TK_sendAudio:(NSData *)audioData Length:(NSInteger)length Codec:(NSInteger)codec Channel:(NSInteger)channel;
示例:[self.myCamera TK_sendAudio:audioData Length:[audioData length] Codec:codec Channel:channel];
TK_setAudioSessionPlayMode
/**
设置音频播放模式,开启监听(TK_startSoundToPhone)前调用
@param mode 播放模式 // 与AVAudioSessionMode对应
*/
typedef NS_ENUM(NSInteger, TKAudioSessionPlayMode) {
TKAudioSessionPlayModeDefault = 0, //AVAudioSessionModeDefault
TKAudioSessionPlayModeVoiceChat = 1, //AVAudioSessionModeVoiceChat
TKAudioSessionPlayModeGameChat = 2, //AVAudioSessionModeGameChat
TKAudioSessionPlayModeVideoRecording = 3, //AVAudioSessionModeVideoRecording
TKAudioSessionPlayModeMeasurement = 4, //AVAudioSessionModeMeasurement
TKAudioSessionPlayModeMoviePlayback = 5, //AVAudioSessionModeMeasurement
TKAudioSessionPlayModeVideoChat = 6, //AVAudioSessionModeVideoChat
TKAudioSessionPlayModeSpokenAudio = 7, //AVAudioSessionModeSpokenAudio
TKAudioSessionPlayModeVoicePrompt = 8, //AVAudioSessionModeVoicePrompt
};
- (void)TK_setAudioSessionPlayMode:(TKAudioSessionPlayMode)mode;
示例:[self.myCamera TK_setAudioSessionPlayMode:TKAudioSessionPlayModeDefault];
TK_setSoundToDeviceFormatsChannel
/**
设置音频采集格式
@param mChannel av通道
@param mFormatID 音频格式 // ENUM_CODECID | MEDIA_CODEC_AUDIO_PCM
@param mSampleRate 采样率 // ENUM_AUDIO_SAMPLERATE | AUDIO_SAMPLE_8K
@param mChannelsPer 声道数 // ENUM_AUDIO_CHANNEL 0 | 1
@param mBitsPer 采样点占用位数 // ENUM_AUDIO_DATABITS AUDIO_DATABITS_8 | AUDIO_DATABITS_16
*/
- (void)TK_setSoundToDeviceFormatsChannel:(NSInteger)mChannel formatID:(ENUM_CODECID)mFormatID sampleRate:(ENUM_AUDIO_SAMPLERATE)mSampleRate channelsPer:(ENUM_AUDIO_CHANNEL)mChannelsPer bitsPer:(ENUM_AUDIO_DATABITS)mBitsPer;
示例:[self.myCamera TK_setSoundToDeviceFormatsChannel:0 formatID:MEDIA_CODEC_AUDIO_PCM sampleRate:AUDIO_SAMPLE_8K channelsPer:1 bitsPer:AUDIO_DATABITS_16];
TK_getSoundToPhoneCodeId
/**
获取当前监听音频格式,在调用TK_startSoundToPhone后使用
@param channel av通道
*/
- (NSInteger)TK_getSoundToPhoneCodeId:(NSInteger)channel;
示例:[self.myCamera TK_getSoundToPhoneCodeId:0];
TK_getSoundToDeviceCodeId
/**
获取当前对讲音频格式,在发送Command: 32A 后使用
@param channel av通道
*/
- (NSInteger)TK_getSoundToDeviceCodeId:(NSInteger)channel;
示例:[self.myCamera TK_getSoundToDeviceCodeId:0];
TK_setAudioOutPutWithChannel
/**
处理发送音频数据上抛
@param avChannel av通道号
@param isOutPutSpeakAudio 解码后的音频数据上抛
@param isOutputMicAudio 采集到的音频数据上抛
*/
- (NSInteger)TK_setAudioOutPutWithChannel:(NSInteger)channel isOutPutSpeakAudio:(BOOL)isOutPutSpeakAudio isOutputMicAudio:(BOOL)isOutputMicAudio;
示例:[self.myCamera TK_setAudioOutPutWithChannel:0 isOutPutSpeakAudio: YES isOutputMicAudio: NO];
1.6 录像与截图
TK_startRecording
/**
指定通道并开始录像
@param path 沙盒路径
@param channel av通道
*/
-(void)TK_startRecording:(NSString *)path Channel:(NSInteger)channel;
示例: [self.myCamera TK_startRecording:path channel:0];
TK_stopRecording
/**
停止录像
*/
-(void)TK_stopRecording;
示例: [self.myCamera TK_stopRecording:0];
TK_getChannel
/**
填充指定通道的视频数据
@param channel av通道
@param imgData 视频buffer
@param size 视频buffer长度
@param codec_id 视频编码格式
@param width 视频画面宽度
@param height 视频画面长度
@return 实际填充的数据长度
*/
-(unsigned int)TK_getChannel:(NSInteger)channel Snapshot:(char *)imgData DataSize:(unsigned int)size ImageType:(unsigned int*)codec_id WithImageWidth:(unsigned int *)width ImageHeight:(unsigned int *)height;
TK_getSnapShotImageWithChannel
/**
获取截图图片
@param channel av通道
@return 截图图片
*/
- (UIImage *)TK_getSnapShotImageWithChannel:(NSInteger)channel;
示例: [self.myCamera TK_getSnapShotImageWithChannel:0];
TK_setIsSaveToSystemAlbum
/**
设置是否保存到系统相册
@param isSaveToSystemAlbum 是否保存到系统相册 (isSaveToSystemAlbum defult is yes)
@param channel av通道
*/
- (UIImage *)TK_setIsSaveToSystemAlbum:(BOOL)isSaveToSystemAlbum channel:(NSInteger)channel;
示例: [self.myCamera TK_setIsSaveToSystemAlbum:yes channel:0];
1.7 指令发送
1.7.1 P2P
TK_sendIOCtrlToChannel
/**
给指定通道发送指令
@param channel av通道
@param type 指令类型
@param buff 指令内容
@param buffer_size 指令内容大小
*/
- (void)TK_sendIOCtrlToChannel:(NSInteger)channel Type:(NSInteger)type Data:(char *)buff DataSize:(NSInteger)buffer_size;
示例: SMsgAVIoctrlGetSupportStreamReq *s = (SMsgAVIoctrlGetSupportStreamReq *)malloc(sizeof(SMsgAVIoctrlGetSupportStreamReq)); memset(s, 0, sizeof(SMsgAVIoctrlGetSupportStreamReq)); [self.myCamera TK_sendIOCtrlToChannel:channel Type:IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_REQ Data:(char *)s DataSize:sizeof(SMsgAVIoctrlGetSupportStreamReq)]; free(s);
TK_sendJsonIOCtrlToChannel
/**
给指定通道发送指令
@param channel av通道
@param data 指令数据
@param responseBlock 指令回复
@param timeout 超时时间
*/
- (void)TK_sendJsonIOCtrlToChannel:(NSInteger)channel data:(NSData *)data responseBlock:(nonnull DataBlock)responseBlock timeout:(NSInteger)timeout;
示例:NSString *url = [NSString stringWithFormat:@"%@%@?stoken=%@",vsaasURL, self.uid, deviceToken];// NSString *accessToken = [NSString stringWithFormat:@"Bearer %@",amToken]; NSDictionary *header = @{@"Authentication": vsaasToken, @"User-Agent": @"TUTK Device"}; NSDictionary *args = @{@"url": url}; NSDictionary *param = @{@"func": @"setCloudRecordingEndpoint", @"args": args, @"header": header}; NSError *error = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:&error]; NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; NSData *requsetData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; [self.myCamera TK_sendJsonIOCtrlToChannel:channel data:requsetData responseBlock:^(NSData *data) { completion(data); } timeout:5];TK_removeAllCmd
/**
清空指令队列
@param channel av通道号
*/
- (void)TK_removeAllCmd:(NSInteger)channel;
示例:[camera TK_removeAllCmd:0];
1.7.2 Nebula
TK_nebulaSendData
/**
Nebula 发送指令及回调
@param jsonData 指令数据
@param udid 设备udid 40码
@param responseBlock 响应数据
@param timeout 超时时间 单位s
*/
- (void)TK_nebulaSendData: (NSString *)jsonData udid: (NSString *)udid responseBlock: (DataBlock)responseBlock timeout: (NSInteger)timeout;
示例: NSDictionary *func = @{ @"func":@"getChannelNames", }; NSError *error = nil; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:func options:NSJSONWritingPrettyPrinted error:&error]; NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; [self.myCamera TK_nebulaSendData:jsonString udid:uid responseBlock:^(NSData *data) { responseData(data); } timeout:5];1.8 文件下载和上传
TK_startDownload
/**
开始文件下载
@param protocol 传输方式
@param path 文件存储路径
@param channel 通道
*/
- (void)TK_startDownload:(TKTransferProtocol)protocol channel:(NSInteger)channel;
示例:[self.myCamera TK_startDownload:TKTransferProtocol_AVAPI channel:1];
TK_stopDownload
/**
停止文件下载
@param protocol 传输方式
@param channel 通道
*/
- (void)TK_stopDownload:(TKTransferProtocol)protocol channel:(NSInteger)channel;
示例:[self.myCamera TK_stopDownload:TKTransferProtocol_AVAPI channel:1];
TK_startUpload
/**
开始文件上传
@param protocol 传输方式
@fileName 文件名称
@param channel 通道
@param endFlag 文件结束标志
*/
- (void)TK_startUpload:(TKTransferProtocol)protocol fileName:(NSString *)fileName channel:(NSInteger)channel endFlag:(NSInteger)endFlag;
示例:[self.myCamera TK_startUpload:TKTransferProtocol_AVAPI fileName:@"2023041901.mp4" channel:1];
TK_stopUpload
/**
停止文件上传
@param protocol 传输方式
@param channel 通道
*/
- (void)TK_stopUpload:(TKTransferProtocol)protocol channel:(NSInteger)channel;
示例:[self.myCamera TK_stopUpload:TKTransferProtocol_AVAPI channel:1];
1.9 双向视频
TK_startVideoToDevice
/**
开始预览并发送视频数据
@param previewView 预览视图
@param previewFormat 编码格式
@param channel 通道号
@param obScreen 屏幕显示对象
*/
- (void)TK_startVideoToDevice:(UIView *)previewView
previewFormat:(PreviewFormat)previewFormat
channel:(NSInteger)channel
ScreenObject:(NSObject*)obScreen;
示例: PreviewFormat *format = (PreviewFormat *)malloc(sizeof(PreviewFormat)); format->resolution = PreviewResolution_Low; format->fps = PreviewFPS_Low; format->gop = PreviewGOP_Low; format->orientation = AVCaptureVideoOrientationPortrait; format->bitrate = PreviewBitRate_Low;[self.camera TK_startVideoToDevice:self.preView previewFormat:*format channel:self.selectChannel ScreenObject:self];
TK_stopVideoToDevice
/**
停止预览并发送视频数据
@param channel 通道号
*/
- (void)TK_stopVideoToDevice:(NSInteger)channel;
示例:[self.camera TK_stopVideoToDevice:self.selectChannel];
TK_preview_switchCamera
/**
切换前后摄像头
@param positon 设置摄像头
*/
- (void)TK_preview_switchCamera:(AVCaptureDevicePosition)positon;
示例:[self.camera TK_preview_switchCamera:AVCaptureDevicePositionFront];
TK_preview_changePreviewFormat
/**
更改采集的视频质量等级
@param previewFormat 编码格式
@param presetBlock 回调是否支持
*/
- (void)TK_preview_changePreviewFormat:(PreviewFormat)previewFormat
presetBlock:(PresetBlock)presetBlock;
示例: PreviewFormat *format = (PreviewFormat *)malloc(sizeof(PreviewFormat)); format->resolution = PreviewResolution_Low; format->fps = PreviewFPS_Low; format->gop = PreviewGOP_Low; format->orientation = AVCaptureVideoOrientationPortrait; format->bitrate = PreviewBitRate_Low;[self.camera TK_preview_changePreviewFormat:format presetBlock:^{}];TK_preview_setVideoOutPutWithChannel
/** 采集视频数据上抛
@param avChannel av通道号
@param isOutPutVideo 发送上抛
*/
- (void)TK_preview_setVideoOutPutWithChannel:(NSInteger)avChannel
isOutPutVideo:(BOOL)isOutPutVideo;
示例:[self.camera TK_preview_setVideoOutPutWithChannel:0 isOutPutVideo:YES];
TK_sendVideo
/**
client端开启发送视频
@param videoData 视频数据
@param length 视频数据长度
@param codec 视频编码格式
@param isKeyFrame 是否是关键帧
@param channel av通道
*/
- (void) TK_sendVideo:(NSData *)videoData
Length:(NSInteger)length
Codec:(NSInteger)codec
isKeyFrame:(BOOL)isKeyFrame
channel:(NSInteger)channel;
示例:[self.camera TK_sendVideo:data Length:data.length Codec:MEDIA_CODEC_VIDEO_H264 isKeyFrame:isKeyFrame channel:channell];
二、指令封装
2.1 TK_commandNebulaSsidListReq
/** AP获取WiFi列表
@param maxCount 列表数量
@param responseBlock 获取WiFiList回调
*/
-(void)TK_commandNebulaSsidListReq:(NSInteger)maxCount responseWifiListBlock:(void(^)(NSArray *wifiList))responseBlock;
2.2 TK_commandNebulaSetWifiReq
/** AP设置WiFi
@param ssid WiFi ssid
@param password WiFi密码
@param enctype 加密类型
@param responseBlock 设置WiFi回调
*/
-(void)TK_commandNebulaSetWifiReq:(NSString *)ssid password:(NSString *)password enctype:(NSInteger)enctype responseSetWifiBlock:(void(^)(NSDictionary *resultDict))responseBlock;
2.3 TK_commandSupportStreamWithChannel
/** 获取设备通道数
@param channel av通道
@param completion 设备通道回调
*/
-(void)TK_commandSupportStreamWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandSupportStream *))completion;
2.4 TK_commandListWifiWithChannel
/** 获取WiFi列表
@param channel av通道
@param completion WiFi列表回调
*/
-(void)TK_commandListWifiWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandListWifi *))completion;
2.5 TK_commandSetWifiWithChannel
/** 设置设备WiFi网络
@param channel av通道
@param ssid 连接的WiFi SSID
@param password WiFi SSID 密码
@param enctype // 参考ENUM_AP_MODE
@param mode // 参考ENUM_AP_ENCTYPE
@param completion 设备WiFi回调
*/
-(void)TK_commandSetWifiWithChannel:(NSInteger)channel ssid:(NSString *)ssid password:(NSString *)password enctype:(NSInteger)enctype mode:(NSInteger)mode completion:(void(^)(KalayCommandSetWifi *))completion;
2.6 TK_commandGetWifiWithChannel
/** 获取设备当前WiFi网络
@param channel av通道
@param completion 当前WiFi回调
*/
-(void)TK_commandGetWifiWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetWifi *))completion;
2.7 TK_commandGetAudioOutFormatWithChannel
/** 获取设备音频格式
@param channel av通道
*/
-(void)TK_commandGetAudioOutFormatWithChannel:(NSInteger)channel;
2.8 TK_commandCallWithChannel
/** 获取门铃呼叫
@param channel av通道
@param completion 门铃
*/
-(void)TK_commandCallWithChannel:(NSInteger)channel answer:(NSInteger)answer completion:(void(^)(KalayCommandCall *))completion;
2.9 TK_commandDeviceInfoWithChannel
/** 获取设备信息
@param channel av通道
@param completion 设备信息回调
*/
-(void)TK_commandDeviceInfoWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceInfo *))completion;
2.10 TK_commandGetRecordWithChannel
/** 获取设备SD卡录像模式
@param channel av通道
@param completion 获取录像模式回调
*/
-(void)TK_commandGetRecordWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetRecord *))completion;
2.11 TK_commandSetRecordWithChannel
/** 设置设备SD卡录像模式
@param channel av通道
@param parameter 请求参数
@param completion 设置录像模式
*/
-(void)TK_commandSetRecordWithChannel:(NSInteger)channel parameter:(NSDictionary *)parameter completion:(void(^)(KalayCommandSetRecord *))completion;
2.12 TK_commandGetStreamWithChannel
/** 获取设备解析度
@param channel av通道
@param completion 获取解析度回调
*/
-(void)TK_commandGetStreamWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetStream *))completion;
2.13 TK_commandSetStreamWithChannel
/** 设置设备解析度
@param channel av通道
@param quality // 参考ENUM_QUALITY_LEVEL
@param completion 设置解析度回调
*/
-(void)TK_commandSetStreamWithChannel:(NSInteger)channel quality:(NSInteger)quality completion:(void(^)(KalayCommandSetStream *))completion;
2.14 TK_commandGetMotionDetectWithChannel
/** 获取设备位移侦测之灵敏度
@param channel av通道
@param completion 获取移侦测之灵敏度回调
*/
-(void)TK_commandGetMotionDetectWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetMotionDetect *))completion;
2.15 TK_commandSetMotionDetectWithChannel
/** 设置设备位移侦测之灵敏度
@param channel av通道
@param sensitivity 0(禁用) ~ 100(最大)
@param completion 设置位移侦测之灵敏度回调
*/
-(void)TK_commandSetMotionDetectWithChannel:(NSInteger)channel sensitivity:(NSInteger)sensitivity completion:(void(^)(KalayCommandSetMotionDetect *))completion;
2.16 TK_commandSetPasswdWithChannel
/** 设置设备密码
@param channel av通道
@param oldpasswd 旧密码
@param newpasswd 新密码
@param completion 设置设备密码回调
*/
-(void)TK_commandSetPasswdWithChannel:(NSInteger)channel oldpasswd:(NSString *)oldpasswd newpasswd:(NSString *)newpasswd completion:(void(^)(KalayCommandSetPasswd *))completion;
2.17 TK_commandSetVideoModeWithChannel
/** 设置画面镜像/翻转状态
@param channel av通道
@param mode // 参考 ENUM_VIDEO_MODE
@param completion 设置画面翻转状态回调
*/
-(void)TK_commandSetVideoModeWithChannel:(NSInteger)channel mode:(NSInteger)mode completion:(void(^)(KalayCommandSetVideoMode *))completion;
2.18 TK_commandGetVideoModeWithChannel
/** 获取画面镜像/翻转状态
@param channel av通道
@param completion 获取画面翻转状态回调
*/
-(void)TK_commandGetVideoModeWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetVideoMode *))completion;
2.19 TK_commandGetChannelNameWithChannel
/** 格式化SD卡
@param channel av通道
@param storage //(例如sdcard插槽= 0,内部闪存= 1,...)
@param completion 格式化SD卡回调
*/
-(void)TK_commandFormatExtStorageWithChannel:(NSInteger)channel storage:(NSInteger)storage completion:(void(^)(KalayCommandFormatExtStorage *))completion;
/** 获取通道名称
@param channel av通道
@param completion 获取通道名称回调
*/
-(void)TK_commandGetChannelNameWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetChannelName *))completion;
2.20 TK_commandSetChannelNameWithChannel
/** 设置通道名称
@param channel av通道
@param channelName 通道名称
@param completion 设置通道名称回调
*/
-(void)TK_commandSetChannelNameWithChannel:(NSInteger)channel channelName:(NSString *)channelName completion:(void(^)(KalayCommandSetChannelName *))completion;
2.21 TK_commandTimeSyncWithChannel
/** 获取当前设备名称
@param channel av通道
@param deviceName 设备名称
@param completion 获取设备名称回调
*/
-(void)TK_commandPushDeviceNameWithChannel:(NSInteger)channel deviceName:(NSString *)deviceName completion:(void(^)(KalayCommandPushDeviceName *))completion;
2.22 TK_commandTimeSyncWithChannel
/** 同步时间
@param channel av通道
@param completion 同步时间回调
*/
-(void)TK_commandTimeSyncWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandTimeSync *))completion;
2.23 TK_commandPtzWithChannel
/** 设备云台控制
@param channel av通道
@param ptz // 参考ENUM_PTZCMD
@param completion 云台控制回调
*/
-(void)TK_commandPtzWithChannel:(NSInteger)channel ptz:(NSInteger)ptz completion:(void(^)(KalayCommandPtz *))completion;
2.24 TK_commandOTAWithChannel
/** 设备OTA升级
@param channel av通道
@param fileChecksum 文件
@param url 升级URL
@param fileSize 文件大小
@param completion OTA升级回调
*/
-(void)TK_commandOTAWithChannel:(NSInteger)channel fileChecksum:(NSString *)fileChecksum url:(NSString *)url fileSize:(NSInteger)fileSize completion:(void(^)(KalayCommandOTA *))completion;
2.25 TK_commandDeviceSupportOTAWithChannel
/** 获取设备是否支持OTA
@param channel av通道
@param completion 设备OTA回调
*/
-(void)TK_commandDeviceSupportOTAWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceSupportOTA *))completion;
2.26 TK_commandDeviceSupportCloudWithChannel
/** 获取设备是否支持云存储
@param channel av通道
@param completion 设备云存储回调
*/
-(void)TK_commandDeviceSupportCloudWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceSupportCloud *))completion;
2.27 TK_commandSetCloudWithChannel
/** 设置设备云存储录像状态
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置云存储录像状态回调
*/
-(void)TK_commandSetCloudWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetCloud *))completion;
2.28 TK_commandGetCloudWithChannel
/** 获取设备云存储录像状态
@param channel av通道
@param completion 获取云存储录像状态回调
*/
-(void)TK_commandGetCloudWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetCloud *))completion;
2.29 TK_commandSetHumanDetectionWithChannel
/** 设置设备人形侦测开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备人形侦测开关回调
*/
-(void)TK_commandSetHumanDetectionWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetHumanDetection *))completion;
2.30 TK_commandGetHumanDetectionWithChannel
/** 获取设备人形侦测开关
@param channel av通道
@param completion 获取设备人形侦测开关回调
*/
-(void)TK_commandGetHumanDetectionWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetHumanDetection *))completion;
2.31 TK_commandSetNightVisionWithChannel
/** 设置设备夜视开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备夜视回调
*/
-(void)TK_commandSetNightVisionWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetNightVision *))completion;
2.32 TK_commandGetNightVisionWithChannel
/** 获取设备夜视开关
@param channel av通道
@param completion 获取设备夜视回调
*/
-(void)TK_commandGetNightVisionWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetNightVision *))completion;
2.33 TK_commandSetSummerTimeWithChannel
/** 设置设备夏令时开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备夏令时回调
*/
-(void)TK_commandSetSummerTimeWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetSummerTime *))completion;
2.34 TK_commandGetSummerTimeWithChannel
/** 获取设备夏令时开关
@param channel av通道
@param completion 获取设备夏令时回调
*/
-(void)TK_commandGetSummerTimeWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetSummerTime *))completion;
2.35 TK_commandListEventWithChannel
/** 获取事件列表
@param channel av通道
@param event // 参考ENUM_EVENTTYPE
@param stStartTime 开始时间
@param stEndTime 结束时间
@param completion 事件列表回调
*/
-(void)TK_commandListEventWithChannel:(NSInteger)channel event:(NSInteger)event stStartTime:(STimeDay)stStartTime stEndTime:(STimeDay)stEndTime completion:(void(^)(KalayCommandListEvent *))completion;
2.36 TK_commandPlayRecordWithChannel
/** 事件回播控制播放
@param channel av通道
@param parameter 回放参数 /** { 事件时间 & ENUM_PLAYCONTROL }
@param completion 控制播放回调
*/
-(void)TK_commandPlayRecordWithChannel:(NSInteger)channel parameter:(NSDictionary *)parameter completion:(void(^)(KalayCommandPlayRecord *))completion;
2.37 TK_commandGetPlaybackWithChannel
/** 获取事件回放进度控制
@param channel av通道
@param stTimeDay 事件时间
@param completion 获取事件回放进度回调
*/
-(void)TK_commandGetPlaybackWithChannel:(NSInteger)channel stTimeDay:(STimeDay)stTimeDay completion:(void(^)(KalayCommandGetPlayback *))completion;
2.38 TK_commandSetRecordProgessWithChannel
/** 设置事件回放进度控制
@param channel av通道
@param progressTime 时间(秒)
@param completion 设置事件回放进度回调
*/
-(void)TK_commandSetRecordProgessWithChannel:(NSInteger)channel stTimeDay:(STimeDay)stTimeDay progressTime:(NSInteger)progressTime completion:(void(^)(KalayCommandSetRecordProgess *))completion;
2.39 TK_commandGetEventDateWithChannel
/** 获取有SD卡事件的日期
@param channel av通道
@param event // 参考ENUM_EVENTTYPE
@param stStartTime 开始时间
@param stEndTime 结束时间
@param completion 事件的日期回调
*/
-(void)TK_commandGetEventDateWithChannel:(NSInteger)channel event:(NSInteger)event stStartTime:(STimeDay)stStartTime stEndTime:(STimeDay)stEndTime completion:(void(^)(KalayCommandGetEventDate *))completion;
2.40 TK_commandGetStorageInfoWithChannel
/** 获取SD内存大小(4x)使用
@param channel av通道
@param value // ["sdcard", "usb"]
@param completion SD内存回调
*/
-(void)TK_commandGetStorageInfoWithChannel:(NSInteger)channel value:(NSString *)value completion:(void(^)(KalayCommandSDInfo *))completion;
