IOS API
<p>[TOC]</p>
<h1>一、IOTCamera</h1>
<h2>1.1 初始化接口</h2>
<p>> 注:调用TK_initIOTC时返回-10000, 是因为privateKey无效导致,遇到该问题时建议:</p>
<ul>
<li>确认当前项目使用的包名与privateKey是否与TUTK提供的一致,如不一致,请修改为TUTK提供的包名与privateKey重新运行;</li>
<li>如需更改包名与privateKey,请联系商务或者技术支持人员。</li>
</ul>
<h3>TK_InitIOTCWithLiceseKey</h3>
<pre><code> 功能:IOTC初始化,确认privateKey和sdkLicensekey的合法性
两个Key值需要向TUTK申请
/**
IOTC初始化
@param licenseKey SDK初始化的Key值
@param privateKey PSC初始化的Key值
@param success 验证成功
@param failure 验证失败
*/
+ (void)TK_InitIOTCWithLiceseKey:(NSString *)licenseKey
privateKey:(NSString *)privateKey
success:(DictionaryBlock)success
failure:(void (^)(NSError *error))failure;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_InitIOTCWithLiceseKey:LICENSEKEY
privateKey:PRIVATEKEY
success:^(NSDictionary * _Nonnull dic){
}
failure:^(NSError *error) {
if (error.code == TUTK_ER_INVALID_ARG) {
NSLog(@&quot;TK_InitIOTC:false(TUTK_ER_INVALID_ARG)&quot;);
}else if (error.code == TUTK_ER_INVALID_LICENSE_KEY) {
NSLog(@&quot;TK_InitIOTC:false(TUTK_ER_INVALID_LICENSE_KEY)&quot;);
}else if (error.code == TUTK_ER_MEM_INSUFFICIENT) {
NSLog(@&quot;TK_InitIOTC:false(TUTK_ER_MEM_INSUFFICIENT)&quot;);
}
}];</code></pre>
<p>> 注:调用TK_InitIOTCWithLiceseKey时返回-10000, 是因为privateKey无效导致,遇到该问题时建议:</p>
<ul>
<li>确认当前项目使用的包名与privateKey是否与TUTK提供的一致,如不一致,请修改为TUTK提供的包名与privateKey重新运行;</li>
<li>如需更改包名与privateKey,请联系商务或者技术支持人员。</li>
</ul>
<h3>TK_uninitIOTC</h3>
<pre><code>/**
IOTC反初始化
*/
+ (void)TK_uninitIOTC;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_uninitIOTC];</code></pre>
<h3>TK_initWithName</h3>
<pre><code>/**
初始化Camera
@param name camera名称
@return Camera初始化后的实例对象
*/
- (id)TK_initWithName:(NSString *)name;</code></pre>
<pre><code class="language-objective-c">示例:
self.myCamera = [[MyCamera alloc] TK_initWithName:name];</code></pre>
<h3>TK_getIOTCameraVersion</h3>
<pre><code>/**
获取IOTCamera版本号
@return IOTCamera版本号
*/
+ (NSString *)TK_getIOTCameraVersion;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_getIOTCameraVersion];</code></pre>
<h3>TK_getIOTCAPIsVersion</h3>
<pre><code>/**
获取IOTCAPIs版本号
@return IOTCAPIs版本号
*/
+ (NSString *)TK_getIOTCAPIsVersion;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_getIOTCAPIsVersion];</code></pre>
<h3>TK_getAVAPIsVersion</h3>
<pre><code>/**
获取AVAPIs版本号
@return AVAPIs版本号
*/
+ (NSString *)TK_getAVAPIsVersion;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_getAVAPIsVersion];</code></pre>
<h3>TK_setMasterRegion: (TKRegion) regin</h3>
<pre><code>/**
设置分区分流方案的地区
@param regin 设置分流到TKRegion中的哪个地区
@return TKRegionResult 设置返回值参照下方结构体TKRegionResult
*/
+ (TKRegionResult) TK_setMasterRegion: (TKRegion) regin;</code></pre>
<hr />
<pre><code>typedef NS_ENUM(NSInteger, TKRegion)
{
TKREGION_ALL,
TKREGION_CN,
TKREGION_EU,
TKREGION_US ,
};</code></pre>
<hr />
<pre><code>typedef NS_ENUM(NSInteger, TKRegionResult)
{
TKREGION_ER_NoERROR = 0,//set success
TKREGION_ER_INVALID_ARG = -46,//the region is invalid
TKREGION_ER_ALREADY_INITIALIZED = -3,//IOTC module is already initialized
};</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_setMasterRegion:TKREGION_CN];</code></pre>
<h3>TK_setLogEnbale</h3>
<pre><code>/**
设置Log记录
@param enable 是否开启log记录
@param level log等级
*/
+ (void) TK_setLogEnbale:(BOOL)enable</code></pre>
<h2> Level:(logLevel_t)level;</h2>
<pre><code>typedef enum LogLevel {</code></pre>
<h2> LEVEL_VERBOSE = 0,
LEVEL_DEBUG = 1,
LEVEL_INFO = 2,
LEVEL_WARNING = 3,
LEVEL_ERROR = 4,
LEVEL_SILENCE = 5,
} logLevel_t;</h2>
<pre><code class="language-objective-c">示例:
[Camera TK_setLogEnbale:false Level:LEVEL_ERROR];</code></pre>
<h2>1.2 回调接口</h2>
<h3>1.2.1 P2PDelegate</h3>
<h4>didChangeSessionStatus</h4>
<pre><code>/**
连线状态回调
@param camera camera对象
@param status session连线结果 0 成功 other 失败
@param errorCode TK_connect连线返回结果 &gt;=0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didChangeSessionStatus:(NSInteger)status errorCode:(NSInteger)errorCode;</code></pre>
<h4>didChangeChannelStatus</h4>
<pre><code>/**
指定通道的连线状态回调
@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;</code></pre>
<h4>didChangeBindStatus</h4>
<pre><code>/**
Bind状态回调
@param camera camera对象
@param status bind结果 0 成功 other 失败
@param credential 连线credential值
@param errorCode TK_nebulaBind返回结果 &gt;=0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didChangeBindStatus:(NSInteger)status credentialInfo:(NSString *)credential errorCode:(NSInteger)errorCode;</code></pre>
<h4>didSendIOCtrlWithType</h4>
<pre><code>/**
指定通道指令发送回调
@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;</code></pre>
<h4>didReceiveIOCtrlWithType</h4>
<pre><code>/**
指定通道指令接收回调
@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;</code></pre>
<h4>didRecvVideoChannel</h4>
<pre><code>/**
指定通道的视频数据接收错误码</code></pre>
<p> @param camera camera对象
@param channel av通道
@param errorCode avRecvFrameData2 返回结果 大于0 成功 , other 失败
*/</p>
<ul>
<li>(void)camera:(Camera *)camera didRecvVideoChannel:(NSInteger)channel errorCode:(NSInteger)errorCode;</li>
</ul>
<h4>didRecvAudioChannel</h4>
<pre><code>/**
指定通道的音频数据接收错误码
@param camera camera对象
@param channel av通道
@param errorCode avRecvAudioData av通道返回结果 大于0 成功 , other 失败
*/
- (void)camera:(Camera *)camera didRecvAudioChannel:(NSInteger)channel errorCode:(NSInteger)errorCode;</code></pre>
<h4>didStartTalkSuccess</h4>
<pre><code>/**
对讲通道建立成功的回调
@param camera camera对象
@param isSuccess 是否建立成功
@param errorCode 错误码
*/
- (void)camera:(Camera *)camera didStartTalkSuccess:(BOOL)isSuccess ErrorCode:(NSInteger) errorCode;</code></pre>
<h4>didStartListenSuccess</h4>
<pre><code>/**
监听通道建立成功的回调
@param camera camera对象
@param isSuccess 是否建立成功
@param channel av通道
*/
- (void)camera:(Camera *)camera didStartListenSuccess:(BOOL)isSuccess Channel:(NSInteger)channel;</code></pre>
<h4>didSendVideoSuccess</h4>
<pre><code>/**
视频发送通道建立的回调
@param camera camera对象
@param isSuccess 是否建立成功
@param errorCode 错误码 (success: &gt;=0,表示发送视频数据时需要使用的avIndex; fail: &lt;0)
*/
- (void)camera:(Camera *)camera didSendVideoSuccess:(BOOL)isSuccess ErrorCode:(NSInteger) errorCode;</code></pre>
<h4>连线状态status</h4>
<pre><code>CONNECTION_STATE_NONE = 0; //初始化连线状态
CONNECTION_STATE_CONNECTING = 1; //设备连线中
CONNECTION_STATE_CONNECTED = 2; //设备已连线 &gt;= 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</code></pre>
<h3>1.2.2 MediaDelegate</h3>
<h4>didReceiveFrameInfoWithChannel</h4>
<pre><code>/**
指定通道的视频宽高/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;</code></pre>
<h4>onDecodeResultWithFrameNum</h4>
<pre><code>/**
当前解码结果相关信息回调
@param camera camera对象
@param frameNum 当前frame的Number
@param isDecodeSuccess 是否解码成功
@param isDropFrame 是否丢掉当前frame
@param isIFrame 是否为I帧
@param isSoft 是否为软解
*/
- (void)camera:(Camera *)camera onDecodeResultWithFrameNum:(NSInteger)frameNum IsDecodeSuccess:(BOOL)isDecodeSuccess IsDropFrame:(BOOL)isDropFrame IsIFrame:(BOOL)isIFrame IsSoft:(BOOL)isSoft;</code></pre>
<h4>outputDecodeVideoYUVData</h4>
<pre><code>/**
上抛指定通道解码后的yuv数据格式为i420
@param camera camera对象
@param data 解码后的yuv数据
@param outWidth 解码后的数据宽度
@param outHeight 解码后的数据高度
@param timestamp 时间戳
@param channel av通道
*/
- (void)camera:(Camera *)camera outputDecodeVideoYUVData:(NSData *)data width:(int)outWidth height:(int)outHeight timestamp:(uint64_t)timestamp channel:(NSInteger)channel;</code></pre>
<h4>didReceiveFrameData</h4>
<pre><code>/**
指定通道接收的视频帧数据回调
@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;</code></pre>
<h4>didReceiveAudioData</h4>
<pre><code>/**
指定通道接收的音频帧数据回调
@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;</code></pre>
<h4>didreportCodecId</h4>
<pre><code>/**
视频帧编码格式回调
@param camera camera对象
@param pointer 编码格式指针
@param channel av通道
*/
- (void)camera:(Camera *)camera didreportCodecId:(NSValue *)pointer Channel:(NSInteger)channel;</code></pre>
<h4>didRecvAudioOutput</h4>
<pre><code>/**
输出解码后的音频数据
@param camera camera对象
@param pcmData pcm音频数据
@param channel av通道
*/
- (void)camera:(Camera *)camera didRecvAudioOutput:(NSData *)pcmData Channel:(int)channel;</code></pre>
<h4>didSendAudioOutput</h4>
<pre><code>/**
输出Mic采集的音频数据
@param camera camera对象
@param audioData 音频数据
@param length 音频数据长度
@param codec 设备端音频编码格式
@param channel av通道
*/
- (void)camera:(Camera *)camera didSendAudioOutput:(NSData *)audioData Length:(NSInteger)length Codec:(NSInteger)codec Channel:(NSInteger)channel;</code></pre>
<h4>downloadUploadOutput</h4>
<pre><code>/**
输出文件下载或上传的数据结果
@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;</code></pre>
<h4>outputVideoData</h4>
<pre><code>/**
上抛采集到的yuv数据
@param camera camera对象
@param data 采集后的yuv数据
@param timestamp 时间戳
@param channel av通道
*/
- (void)camera:(Camera *)camera outputVideoData:(NSData *)data</code></pre>
<p> timestamp:(uint64_t)timestamp
channel:(NSInteger)channel;</p>
<h2>1.3 连线接口</h2>
<h3>1.3.1 P2P</h3>
<h4>TK_connect</h4>
<pre><code>/**
开始连接设备
@param uid 设备UID
*/
- (void)TK_connect:(NSString *)uid;
/**
开始连接设备
@param uid 设备UID
@param authKey 设备连线的key
*/
- (void)TK_connect:(NSString *)uid authKey:(NSString *)authKey;</code></pre>
<pre><code class="language-objective-c">示例:
[self.camera TK_connect:@&quot;device uid&quot; authKey:@&quot;device authKey&quot;];</code></pre>
<h4>TK_LanSearch</h4>
<pre><code>/**
搜索本地局域网内的设备
@param num 搜索到设备的数量
@param timeoutVal 搜索超时时间
@return 搜索到的设备信息结构体
*/
+ (LanSearch_t *)TK_LanSearch:(int *)num timeout:(int)timeoutVal;</code></pre>
<pre><code class="language-objective-c">示例:
[Camera TK_LanSearch:&amp;num timeout:3000];</code></pre>
<h3>1.3.2 Nebula</h3>
<h4>TK_nebulaBind</h4>
<pre><code>/**
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;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myControl TK_nebulaBind:uid bindType:AP_BIND bindKey:@&quot;888888ii&quot;];</code></pre>
<h4>TK_nebulaConnect</h4>
<pre><code>/**
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;</code></pre>
<pre><code class="language-objective-c">示例:
[self TK_nebulaConnect:uid credential:self.dev_credential deviceToken:TOKEN realm:REALM isWakeup:YES isNebulaOnly:YES];;</code></pre>
<pre><code>/**
Nebula 连线设备
@param udid 设备udid 40码
@param credential credential
@param deviceToken 设备token
@param realm realm </code></pre>
<p> */</p>
<ul>
<li>(void)TK_NebulaConnect: (NSString <em>)udid credential: (NSString </em>)credential deviceToken: (NSString <em>)deviceToken realm: (NSString </em>)realm;</li>
</ul>
<pre><code class="language-objective-c">示例:
[self TK_nebulaConnect:uid credential:self.dev_credential deviceToken:TOKEN realm:REALM];</code></pre>
<h3>TK_NebulaLanSearchTimeout</h3>
<pre><code>/**
Nebula 局域网扫描设备
@param timeout 超时时间
@param responseBlock 搜索结果
*/
- (void)TK_nebulaLanSearchTimeout:(NSInteger)timeout responseBlock:(nonnull UDIDInfoBlock)responseBlock;</code></pre>
<pre><code class="language-objective-c">示例:
[myCamera TK_nebulaLanSearchTimeout:5 responseBlock:^(st_UDIDInfo * _Nonnull uuidInfo, int num) {
dispatch_async(dispatch_get_main_queue(), ^{
if (num &lt;= 0) {
if (block) block(nil);
return;
}
NSDictionary *dict = @{
@&quot;uid&quot;: [NSString stringWithFormat:@&quot;%s&quot;,uuidInfo-&gt;udid],
};
[dataSource addObject:dict];
if (block) block(dataSource);
return;
});
}];</code></pre>
<h4>TK_nebulaSsidListReq</h4>
<pre><code>/**
Nebula 获取设备ssid list
@param max_ap_count 最大搜索数量
@param responseBlock 搜索结果</code></pre>
<p> */</p>
<ul>
<li>(void)TK_nebulaSsidListReq:(int)max_ap_count responseBlock:(ArrayBlock)responseBlock;</li>
</ul>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_nebulaSsidListReq:(int)maxCount responseBlock:^(NSArray * _Nonnull arr) {
responseBlock(arr);
}];</code></pre>
<h4>TK_nebulaSetWifiReq</h4>
<pre><code>/**
Nebula 设置wifi
@param ssid Wifi名称
@param password 密码
@param enctype 加密类型
*/
- (void)TK_nebulaSetWifiReq:(NSString *)ssid password:(NSString *)password enctype:(int)enctype responseBlock:(DictionaryBlock)responseBlock;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_nebulaSetWifiReq:ssid password:password enctype:(int)enctype responseBlock:^(NSDictionary * _Nonnull dic) {
responseBlock(dic);
}];</code></pre>
<h4>TK_nebulaSetRegionReq</h4>
<pre><code>/**
Nebula 设置region
@param region 区域设置
@param responseBlock 结果回调</code></pre>
<p> */</p>
<ul>
<li>(void)TK_nebulaSetRegionReq:(int)region responseBlock:(DictionaryBlock)responseBlock;</li>
</ul>
<pre><code class="language-objective-c">示例:
[self TK_nebulaSetRegionReq:REGION_CN responseBlock:^(NSDictionary * _Nonnull dic) {
responseBlock(dic);
}];</code></pre>
<h3>1.3.3 共有接口</h3>
<h4>TK_disconnect</h4>
<pre><code>/**
断开设备连线
*/
- (void)TK_disconnect;</code></pre>
<pre><code class="language-objective-c">示例:
[self.camera TK_disconnect];</code></pre>
<h4>TK_start</h4>
<pre><code>/**
开启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;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_start:0 viewAccount:@&quot;admin&quot; viewPassword:@&quot;000000&quot; authType:TKAuthType_Password is_playback:FALSE];</code></pre>
<h4>TK_stop</h4>
<pre><code>/**
关闭AV通道
@param channel av通道号
*/
- (void)TK_stop:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:[self.myCamera TK_stop:0];</code></pre>
<pre><code>#### TK_getConnectionStateOfChannel
/**
获取指定通道的连线状态
@param channel av通道
@return 连线状态值
*/
- (NSInteger)TK_getConnectionStateOfChannel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:[self.myCamera TK_getConnectionStateOfChannel:0];</code></pre>
<h4>TK_getViewAccountOfChannel</h4>
<pre><code>/**
获取指定通道的用户名
@param channel 指定通道
@return 获取的用户名
*/
- (NSString *)TK_getViewAccountOfChannel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getViewAccountOfChannel:0];</code></pre>
<h4>TK_getViewPasswordOfChannel</h4>
<pre><code>/**
获取指定通道的密码
@param channel 指定通道
@return 获取的密码
*/
- (NSString *)TK_getViewPasswordOfChannel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getViewPasswordOfChannel:0];</code></pre>
<h4>TK_getServiceTypeOfChannel</h4>
<pre><code>/**
获取指定通道的ServiceTYpe
@param channel av通道
@return serviceType值
*/
- (unsigned int)TK_getServiceTypeOfChannel:(NSInteger)channel;</code></pre>
<hr />
<pre><code>typedef NS_ENUM(NSInteger, TKAuthType)
{
TKAuthType_Password = 0, //密码
TKAuthType_Token = 1 //Token
};</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getServiceTypeOfChannel:0];</code></pre>
<h2>1.4 视频处理接口</h2>
<h3>TK_StartAVFilterWithChannel</h3>
<pre><code>/**
是否开启解码滤镜
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</code></pre>
<pre><code class="language-objective-c"> 示例:
[myCamera TK_StartAVFilterWithChannel:selectedChannel
filterCMD:@&quot;eq=contrast=0.9:brightness=0.1:saturation=1&quot;
isOn:YES];</code></pre>
<h3>TK_startShow</h3>
<pre><code>/**
开始接收、解码并显示画面
@param channel av通道
@param obScreen 屏幕显示对象
*/
- (void)TK_startShow:(NSInteger)channel ScreenObject:(NSObject*)obScreen;</code></pre>
<pre><code class="language-objective-c"> 示例:
[myCamera TK_startShow:0 ScreenObject:self];</code></pre>
<pre><code>/**
开始视频接收、解码并播放
@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;</code></pre>
<hr />
<pre><code>typedef NS_ENUM(NSInteger, RENDERTYPE)
{</code></pre>
<p> 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(耗时)
};</p>
<pre><code class="language-objective-c"> 示例:
[myCamera TK_startShow:0 ScreenObject:self isDecode:YES isSWDecode:YES isDropFrame:NO renderType:OUTPUT_YUV isSendCommand:YES];</code></pre>
<hr />
<h3>TK_stopShow</h3>
<pre><code>/**
停止接收、解码和画面显示
@param channel av通道
*/
- (void)TK_stopShow:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopShow:0];</code></pre>
<pre><code>/**
停止接收、解码和画面显示
@param channel av通道
@param isSendCommand 是否发送指令2FF
*/
- (void)TK_stopShow:(NSInteger)channel isSendCommand:(BOOL)isSendCommand;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopShow:0 isSendCommand:YES];</code></pre>
<h3>TK_getVideoCodecId</h3>
<pre><code>/**
获取当前视频格式,在调用TK_StartShow并且出图后调用
@param channel av通道
*/
- (NSInteger)TK_getVideoCodecId:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getVideoCodecId:0];</code></pre>
<h3>TK_setDecocdeDelayTime</h3>
<pre><code>/**
设置最大延迟时间,调整解码每帧时间间隔</code></pre>
<p>@param channel av通道
@param delayTime 最大延迟时间(ms)
@param durationTime 解码时间间隔(ms) 0 ~ 30
*/</p>
<ul>
<li>
<p>(void)TK_setDecocdeDelayTime:(NSInteger)delayTime
durationTime:(NSInteger)durationTime
channel:(NSInteger)channel;</p>
<pre><code class="language-objective-c">示例:
[self.camera TK_setDecocdeDelayTime:1500 durationTime:15 channel:0];</code></pre>
<h2>1.5 音频处理接口</h2>
<h3>TK_startSoundToPhone</h3>
<p>/**
开始接收、解码并监听设备声音</p>
<p>@param channel av通道
*/</p>
</li>
<li>(void)TK_startSoundToPhone:(NSInteger)channel;</li>
</ul>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startSoundToPhone:0];</code></pre>
<pre><code>/**
开始接收、解码并监听设备声音
@param channel av通道
@param isDecodeAndPlay 是否解码并播放
*/</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startSoundToPhone:0 isDecodeAndPlay:YES];</code></pre>
<h3>TK_stopSoundToPhone</h3>
<pre><code>/**
停止接收、解码和监听设备声音
@param channel av通道
*/
- (void)TK_stopSoundToPhone:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopSoundToPhone:0];</code></pre>
<h3>TK_startSoundToDevice</h3>
<pre><code>/**
开始对讲(发送声音到设备)
@param channel av通道
@param isResend 是否开启重送
*/
- (void)TK_startSoundToDevice:(NSInteger)channel isResend:(BOOL)isResend;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopSoundToPhone:0];</code></pre>
<pre><code>/**
开始对讲(发送声音到设备)
@param channel av通道
@param isResend 是否开取重传
@param captureSize 手机端采集音频的大小
*/
- (void)TK_startSoundToDevice:(NSInteger)channel isResend:(BOOL)isResend captureSize:(NSInteger)captureSize;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startSoundToDevice:0 isResend:YES];</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startSoundToDevice:0 isResend:YES captureSize:320];</code></pre>
<h3>TK_stopSoundToDevice</h3>
<pre><code>/**
停止对讲
@param channel av通道
*/
- (void)TK_stopSoundToDevice:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopSoundToDevice:0];</code></pre>
<h3>TK_playAECAudio</h3>
<pre><code>/**
播放回音消除后的音频数据
@param aecData aec音频数据
@param channel av通道
*/
- (void)TK_playAECAudio:(NSData *)aecData Channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_playAECAudio:pcmData Channel:channel];</code></pre>
<h3>TK_sendAecAudio</h3>
<pre><code>/**
发送回音消除后的音频数据
@param aecAudioData aec音频数据
@param length aec音频数据长度
@param codec 设备端音频编码格式
@param channel av通道
*/
- (void)TK_sendAecAudio:(NSData *)aecAudioData Length:(NSInteger)length Codec:(NSInteger)codec Channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_sendAecAudio:audioData Length:[audioData length] Codec:codec Channel:channel];</code></pre>
<h3>TK_startSendAudioChannel</h3>
<pre><code>/**
开启对讲发送
@param channel av通道
*/
- (void)TK_startSendAudioChannel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startSendAudioChannel:1];</code></pre>
<h3>TK_stopSendAudioChannel</h3>
<pre><code>/**
关闭对讲发送
@param channel av通道
@param isResend 是否重送
*/
- (void)TK_startSendAudioChannel:(NSInteger)channel isResend:(BOOL)isResend;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopSendAudioChannel:1];</code></pre>
<h3>TK_setAudioSessionPlayMode</h3>
<pre><code>/**
设置音频播放模式,默认为Speaker
@param mode 播放模式 // TKAudioSessionPlayModeSpeaker | TKAudioSessionPlayModeReceiver
*/
- (void)TK_setAudioSessionPlayMode:(TKAudioSessionPlayMode)mode;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_setAudioSessionPlayMode:TKAudioSessionPlayModeSpeaker];</code></pre>
<h3>TK_setSoundToDeviceFormatsChannel</h3>
<pre><code>/**
设置音频采集格式
@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;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_setSoundToDeviceFormatsChannel:0 formatID:MEDIA_CODEC_AUDIO_PCM sampleRate:AUDIO_SAMPLE_8K channelsPer:1 bitsPer:AUDIO_DATABITS_16];</code></pre>
<h3>TK_getSoundToPhoneCodeId</h3>
<pre><code>/**
获取当前监听音频格式,在调用TK_startSoundToPhone后使用
@param channel av通道
*/
- (NSInteger)TK_getSoundToPhoneCodeId:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getSoundToPhoneCodeId:0];</code></pre>
<h3>TK_getSoundToDeviceCodeId</h3>
<pre><code>/**
获取当前对讲音频格式,在发送Command: 32A 后使用
@param channel av通道
*/
- (NSInteger)TK_getSoundToDeviceCodeId:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getSoundToDeviceCodeId:0];</code></pre>
<h3>TK_isAudioOutputavChannel</h3>
<pre><code>/**
处理发送音频数据上抛
@param avChannel av通道号
@param isRecvAudio 解码上抛
@param isSendAudio 发送上抛
*/
- (NSInteger)TK_isAudioOutputavChannel:(NSInteger)channel isRecvAudio:(BOOL)isRecvAudio isSendAudio:(BOOL)isSendAudio;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_isAudioOutputavChannel:0 isRecvAudio: YES isSendAudio: NO];</code></pre>
<h2>1.6 录像与截图</h2>
<h3>TK_initVideoGenerator</h3>
<pre><code>/**
本地录像功能初始化
@param url 沙盒路径
*/
-(void)TK_initVideoGenerator:(NSURL*)url;</code></pre>
<pre><code class="language-objective-c"> 示例:
NSString *path= [CommonUtility pathForDocumentsResource:recordFileName];
NSURL* url = [NSURL fileURLWithPath:path];
[self.myCamera TK_initVideoGenerator:url channel:selectedChannel];</code></pre>
<h3>TK_startRecordingForChannel</h3>
<pre><code>/**
指定通道并开始录像
@param path 沙盒路径
@param channel av通道
*/
-(void)TK_startRecording:(NSString *)path Channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_startRecordingForChannel:0 withDuration:180];</code></pre>
<h3>TK_stopRecording</h3>
<pre><code>/**
停止录像
*/
-(void)TK_stopRecording;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_stopRecording:0];</code></pre>
<h3>TK_getChannel</h3>
<pre><code>/**
填充指定通道的视频数据
@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;</code></pre>
<h3>TK_getSnapShotImageWithChannel</h3>
<pre><code>/**
获取截图图片
@param channel av通道
@return 截图图片
*/
- (UIImage *)TK_getSnapShotImageWithChannel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c"> 示例:
[self.myCamera TK_getSnapShotImageWithChannel:0];</code></pre>
<h2>1.7 指令发送</h2>
<h3>1.7.1 P2P</h3>
<h4>TK_sendIOCtrlToChannel</h4>
<pre><code>/**
给指定通道发送指令
@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;</code></pre>
<pre><code class="language-objective-c"> 示例:
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);</code></pre>
<h4>TK_sendJsonIOCtrlToChannel</h4>
<pre><code>/**
给指定通道发送指令
@param channel av通道
@param data 指令数据
@param responseBlock 指令回复
@param timeout 超时时间
*/
- (void)TK_sendJsonIOCtrlToChannel:(NSInteger)channel data:(NSData *)data responseBlock:(nonnull DataBlock)responseBlock timeout:(NSInteger)timeout;</code></pre>
<pre><code class="language-objective-c"> 示例:
NSString *url = [NSString stringWithFormat:@&quot;%@%@?stoken=%@&quot;,vsaasURL, self.uid, deviceToken];
// NSString *accessToken = [NSString stringWithFormat:@&quot;Bearer %@&quot;,amToken];
NSDictionary *header = @{@&quot;Authentication&quot;: vsaasToken,
@&quot;User-Agent&quot;: @&quot;TUTK Device&quot;};
NSDictionary *args = @{@&quot;url&quot;: url};
NSDictionary *param = @{@&quot;func&quot;: @&quot;setCloudRecordingEndpoint&quot;,
@&quot;args&quot;: args,
@&quot;header&quot;: header};
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:&amp;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];</code></pre>
<h4>TK_removeAllCmd</h4>
<pre><code>/**
清空指令队列
@param channel av通道号
*/
- (void)TK_removeAllCmd:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c">示例:
[camera TK_removeAllCmd:0];</code></pre>
<h3>1.7.2 Nebula</h3>
<h4>TK_nebulaSendData</h4>
<pre><code>/**
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;</code></pre>
<pre><code class="language-objective-c"> 示例:
NSDictionary *func = @{
@&quot;func&quot;:@&quot;getChannelNames&quot;,
};
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:func options:NSJSONWritingPrettyPrinted error:&amp;error];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[self.myCamera TK_nebulaSendData:jsonString udid:uid responseBlock:^(NSData *data) {
responseData(data);
} timeout:5];</code></pre>
<h2>1.8 文件下载和上传</h2>
<h4>TK_startDownload</h4>
<pre><code>/**
开始文件下载
@param type 传输方式
@param path 文件存储路径
@param channel 通道
*/
- (void)TK_startDownload:(TKTransferType)type channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_startDownload:TKTransferType_AVAPI channel:1];</code></pre>
<h4>TK_stopDownload</h4>
<pre><code>/**
停止文件下载
@param type 传输方式
@param channel 通道
*/
- (void)TK_stopDownload:(TKTransferType)type channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_stopDownload:TKTransferType_AVAPI channel:1];</code></pre>
<h4>TK_startUpload</h4>
<pre><code>/**
开始文件上传
@param type 传输方式
@fileName 文件名称
@param channel 通道
@param endFlag 文件结束标志
*/
- (void)TK_startUpload:(TKTransferType)type fileName:(NSString *)fileName channel:(NSInteger)channel endFlag:(NSInteger)endFlag;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_startUpload:TKTransferType_AVAPI fileName:@&quot;2023041901.mp4&quot; channel:1];</code></pre>
<h4>TK_stopUpload</h4>
<pre><code>/**
停止文件上传
@param type 传输方式
@param channel 通道
*/
- (void)TK_stopUpload:(TKTransferType)type channel:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c">示例:
[self.myCamera TK_stopUpload:TKTransferType_AVAPI channel:1];</code></pre>
<h2>1.9 双向视频</h2>
<h4>TK_startVideoToDevice</h4>
<pre><code>/**
开始预览并发送视频数据
@param previewView 预览视图
@param previewFormat 编码格式
@param channel 通道号
@param obScreen 屏幕显示对象
*/
- (void)TK_startVideoToDevice:(UIView *)previewView</code></pre>
<p> previewFormat:(PreviewFormat)previewFormat
channel:(NSInteger)channel
ScreenObject:(NSObject*)obScreen;</p>
<pre><code class="language-objective-c">示例:
PreviewFormat *format = (PreviewFormat *)malloc(sizeof(PreviewFormat));
format-&gt;resolution = PreviewResolution_Low;
format-&gt;fps = PreviewFPS_Low;
format-&gt;gop = PreviewGOP_Low;
format-&gt;orientation = AVCaptureVideoOrientationPortrait;
format-&gt;bitrate = PreviewBitRate_Low;
[self.camera TK_startVideoToDevice:self.preView previewFormat:*format channel:self.selectChannel ScreenObject:self];</code></pre>
<h4>TK_stopVideoToDevice</h4>
<pre><code>/**
停止预览并发送视频数据
@param channel 通道号
*/
- (void)TK_stopVideoToDevice:(NSInteger)channel;</code></pre>
<pre><code class="language-objective-c">示例:
[self.camera TK_stopVideoToDevice:self.selectChannel];</code></pre>
<h4>TK_preview_switchCamera</h4>
<pre><code>/**
切换前后摄像头
@param positon 设置摄像头
*/
- (void)TK_preview_switchCamera:(AVCaptureDevicePosition)positon;</code></pre>
<pre><code class="language-objective-c">示例:
[self.camera TK_preview_switchCamera:AVCaptureDevicePositionFront];</code></pre>
<h4>TK_preview_changePreviewFormat</h4>
<pre><code>/**</code></pre>
<p> 更改采集的视频质量等级
@param previewFormat 编码格式
@param presetBlock 回调是否支持
*/</p>
<pre><code>- (void)TK_preview_changePreviewFormat:(PreviewFormat)previewFormat
presetBlock:(PresetBlock)presetBlock;</code></pre>
<pre><code class="language-objective-c">示例:
PreviewFormat *format = (PreviewFormat *)malloc(sizeof(PreviewFormat));
format-&gt;resolution = PreviewResolution_Low;
format-&gt;fps = PreviewFPS_Low;
format-&gt;gop = PreviewGOP_Low;
format-&gt;orientation = AVCaptureVideoOrientationPortrait;
format-&gt;bitrate = PreviewBitRate_Low;
[self.camera TK_preview_changePreviewFormat:format presetBlock:^{
}];</code></pre>
<h4>TK_isVideoOutputavChannel</h4>
<pre><code>/** 采集视频数据上抛
@param avChannel av通道号
@param isSendVideo 发送上抛
*/
- (void)TK_isVideoOutputavChannel:(NSInteger)avChannel</code></pre>
<p> isSendVideo:(BOOL)isSendVideo;</p>
<pre><code class="language-objective-c">示例:
[self.camera TK_isVideoOutputavChannel:0 isSendVideo:YES];</code></pre>
<h4>TK_sendVideo</h4>
<pre><code>/**
client端开启发送视频</code></pre>
<p> @param videoData 视频数据
@param length 视频数据长度
@param codec 视频编码格式
@param isKeyFrame 是否是关键帧
@param channel av通道
*/</p>
<ul>
<li>(void) TK_sendVideo:(NSData *)videoData
Length:(NSInteger)length
Codec:(NSInteger)codec
isKeyFrame:(BOOL)isKeyFrame
channel:(NSInteger)channel;
<pre><code class="language-objective-c">示例:
[self.camera TK_sendVideo:data Length:data.length Codec:MEDIA_CODEC_VIDEO_H264 isKeyFrame:isKeyFrame channel:channell];</code></pre></li>
</ul>
<h1>二、指令封装</h1>
<h2>2.1 TK_commandNebulaSsidListReq</h2>
<pre><code>/** AP获取WiFi列表
@param maxCount 列表数量
@param responseBlock 获取WiFiList回调
*/
-(void)TK_commandNebulaSsidListReq:(NSInteger)maxCount responseWifiListBlock:(void(^)(NSArray *wifiList))responseBlock;</code></pre>
<h2>2.2 TK_commandNebulaSetWifiReq</h2>
<pre><code>/** 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;</code></pre>
<h2>2.3 TK_commandSupportStreamWithChannel</h2>
<pre><code>/** 获取设备通道数
@param channel av通道
@param completion 设备通道回调
*/
-(void)TK_commandSupportStreamWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandSupportStream *))completion;</code></pre>
<h2>2.4 TK_commandListWifiWithChannel</h2>
<pre><code>/** 获取WiFi列表
@param channel av通道
@param completion WiFi列表回调
*/
-(void)TK_commandListWifiWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandListWifi *))completion;</code></pre>
<h2>2.5 TK_commandSetWifiWithChannel</h2>
<pre><code>/** 设置设备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;</code></pre>
<h2>2.6 TK_commandGetWifiWithChannel</h2>
<pre><code>/** 获取设备当前WiFi网络
@param channel av通道
@param completion 当前WiFi回调
*/
-(void)TK_commandGetWifiWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetWifi *))completion;</code></pre>
<h2>2.7 TK_commandGetAudioOutFormatWithChannel</h2>
<pre><code>/** 获取设备音频格式
@param channel av通道
*/
-(void)TK_commandGetAudioOutFormatWithChannel:(NSInteger)channel;</code></pre>
<h2>2.8 TK_commandCallWithChannel</h2>
<pre><code>/** 获取门铃呼叫
@param channel av通道
@param completion 门铃
*/
-(void)TK_commandCallWithChannel:(NSInteger)channel answer:(NSInteger)answer completion:(void(^)(KalayCommandCall *))completion;</code></pre>
<h2>2.9 TK_commandDeviceInfoWithChannel</h2>
<pre><code>/** 获取设备信息
@param channel av通道
@param completion 设备信息回调
*/
-(void)TK_commandDeviceInfoWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceInfo *))completion;</code></pre>
<h2>2.10 TK_commandGetRecordWithChannel</h2>
<pre><code>/** 获取设备SD卡录像模式
@param channel av通道
@param completion 获取录像模式回调
*/
-(void)TK_commandGetRecordWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetRecord *))completion;</code></pre>
<h2>2.11 TK_commandSetRecordWithChannel</h2>
<pre><code>/** 设置设备SD卡录像模式
@param channel av通道
@param parameter 请求参数
@param completion 设置录像模式
*/
-(void)TK_commandSetRecordWithChannel:(NSInteger)channel parameter:(NSDictionary *)parameter completion:(void(^)(KalayCommandSetRecord *))completion;</code></pre>
<h2>2.12 TK_commandGetStreamWithChannel</h2>
<pre><code>/** 获取设备解析度
@param channel av通道
@param completion 获取解析度回调
*/
-(void)TK_commandGetStreamWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetStream *))completion;</code></pre>
<h2>2.13 TK_commandSetStreamWithChannel</h2>
<pre><code>/** 设置设备解析度
@param channel av通道
@param quality // 参考ENUM_QUALITY_LEVEL
@param completion 设置解析度回调
*/
-(void)TK_commandSetStreamWithChannel:(NSInteger)channel quality:(NSInteger)quality completion:(void(^)(KalayCommandSetStream *))completion;</code></pre>
<h2>2.14 TK_commandGetMotionDetectWithChannel</h2>
<pre><code>/** 获取设备位移侦测之灵敏度
@param channel av通道
@param completion 获取移侦测之灵敏度回调
*/
-(void)TK_commandGetMotionDetectWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetMotionDetect *))completion;</code></pre>
<h2>2.15 TK_commandSetMotionDetectWithChannel</h2>
<pre><code>/** 设置设备位移侦测之灵敏度
@param channel av通道
@param sensitivity 0(禁用) ~ 100(最大)
@param completion 设置位移侦测之灵敏度回调
*/
-(void)TK_commandSetMotionDetectWithChannel:(NSInteger)channel sensitivity:(NSInteger)sensitivity completion:(void(^)(KalayCommandSetMotionDetect *))completion;</code></pre>
<h2>2.16 TK_commandSetPasswdWithChannel</h2>
<pre><code>/** 设置设备密码
@param channel av通道
@param oldpasswd 旧密码
@param newpasswd 新密码
@param completion 设置设备密码回调
*/
-(void)TK_commandSetPasswdWithChannel:(NSInteger)channel oldpasswd:(NSString *)oldpasswd newpasswd:(NSString *)newpasswd completion:(void(^)(KalayCommandSetPasswd *))completion;</code></pre>
<h2>2.17 TK_commandSetVideoModeWithChannel</h2>
<pre><code>/** 设置画面镜像/翻转状态
@param channel av通道
@param mode // 参考 ENUM_VIDEO_MODE
@param completion 设置画面翻转状态回调
*/
-(void)TK_commandSetVideoModeWithChannel:(NSInteger)channel mode:(NSInteger)mode completion:(void(^)(KalayCommandSetVideoMode *))completion;</code></pre>
<h2>2.18 TK_commandGetVideoModeWithChannel</h2>
<pre><code>/** 获取画面镜像/翻转状态
@param channel av通道
@param completion 获取画面翻转状态回调
*/
-(void)TK_commandGetVideoModeWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetVideoMode *))completion;</code></pre>
<h2>2.19 TK_commandGetChannelNameWithChannel</h2>
<pre><code>/** 格式化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;</code></pre>
<h2>2.20 TK_commandSetChannelNameWithChannel</h2>
<pre><code>/** 设置通道名称
@param channel av通道
@param channelName 通道名称
@param completion 设置通道名称回调
*/
-(void)TK_commandSetChannelNameWithChannel:(NSInteger)channel channelName:(NSString *)channelName completion:(void(^)(KalayCommandSetChannelName *))completion;</code></pre>
<h2>2.21 TK_commandTimeSyncWithChannel</h2>
<pre><code>/** 获取当前设备名称
@param channel av通道
@param deviceName 设备名称
@param completion 获取设备名称回调
*/
-(void)TK_commandPushDeviceNameWithChannel:(NSInteger)channel deviceName:(NSString *)deviceName completion:(void(^)(KalayCommandPushDeviceName *))completion;</code></pre>
<h2>2.22 TK_commandTimeSyncWithChannel</h2>
<pre><code>/** 同步时间
@param channel av通道
@param completion 同步时间回调
*/
-(void)TK_commandTimeSyncWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandTimeSync *))completion;</code></pre>
<h2>2.23 TK_commandPtzWithChannel</h2>
<pre><code>/** 设备云台控制
@param channel av通道
@param ptz // 参考ENUM_PTZCMD
@param completion 云台控制回调
*/
-(void)TK_commandPtzWithChannel:(NSInteger)channel ptz:(NSInteger)ptz completion:(void(^)(KalayCommandPtz *))completion;</code></pre>
<h2>2.24 TK_commandOTAWithChannel</h2>
<pre><code>/** 设备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;</code></pre>
<h2>2.25 TK_commandDeviceSupportOTAWithChannel</h2>
<pre><code>/** 获取设备是否支持OTA
@param channel av通道
@param completion 设备OTA回调
*/
-(void)TK_commandDeviceSupportOTAWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceSupportOTA *))completion;</code></pre>
<h2>2.26 TK_commandDeviceSupportCloudWithChannel</h2>
<pre><code>/** 获取设备是否支持云存储
@param channel av通道
@param completion 设备云存储回调
*/
-(void)TK_commandDeviceSupportCloudWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandDeviceSupportCloud *))completion;</code></pre>
<h2>2.27 TK_commandSetCloudWithChannel</h2>
<pre><code>/** 设置设备云存储录像状态
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置云存储录像状态回调
*/
-(void)TK_commandSetCloudWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetCloud *))completion;</code></pre>
<h2>2.28 TK_commandGetCloudWithChannel</h2>
<pre><code>/** 获取设备云存储录像状态
@param channel av通道
@param completion 获取云存储录像状态回调
*/
-(void)TK_commandGetCloudWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetCloud *))completion;</code></pre>
<h2>2.29 TK_commandSetHumanDetectionWithChannel</h2>
<pre><code>/** 设置设备人形侦测开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备人形侦测开关回调
*/
-(void)TK_commandSetHumanDetectionWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetHumanDetection *))completion;</code></pre>
<h2>2.30 TK_commandGetHumanDetectionWithChannel</h2>
<pre><code>/** 获取设备人形侦测开关
@param channel av通道
@param completion 获取设备人形侦测开关回调
*/
-(void)TK_commandGetHumanDetectionWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetHumanDetection *))completion;</code></pre>
<h2>2.31 TK_commandSetNightVisionWithChannel</h2>
<pre><code>/** 设置设备夜视开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备夜视回调
*/
-(void)TK_commandSetNightVisionWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetNightVision *))completion;</code></pre>
<h2>2.32 TK_commandGetNightVisionWithChannel</h2>
<pre><code>/** 获取设备夜视开关
@param channel av通道
@param completion 获取设备夜视回调
*/
-(void)TK_commandGetNightVisionWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetNightVision *))completion;</code></pre>
<h2>2.33 TK_commandSetSummerTimeWithChannel</h2>
<pre><code>/** 设置设备夏令时开关
@param channel av通道
@param isOn // 1 开启, 0 关闭
@param completion 设置设备夏令时回调
*/
-(void)TK_commandSetSummerTimeWithChannel:(NSInteger)channel isOn:(NSInteger)isOn completion:(void(^)(KalayCommandSetSummerTime *))completion;</code></pre>
<h2>2.34 TK_commandGetSummerTimeWithChannel</h2>
<pre><code>/** 获取设备夏令时开关
@param channel av通道
@param completion 获取设备夏令时回调
*/
-(void)TK_commandGetSummerTimeWithChannel:(NSInteger)channel completion:(void(^)(KalayCommandGetSummerTime *))completion;</code></pre>
<h2>2.35 TK_commandListEventWithChannel</h2>
<pre><code>/** 获取事件列表
@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;</code></pre>
<h2>2.36 TK_commandPlayRecordWithChannel</h2>
<pre><code>/** 事件回播控制播放
@param channel av通道
@param parameter 回放参数 /** { 事件时间 &amp; ENUM_PLAYCONTROL }
@param completion 控制播放回调
*/
-(void)TK_commandPlayRecordWithChannel:(NSInteger)channel parameter:(NSDictionary *)parameter completion:(void(^)(KalayCommandPlayRecord *))completion;</code></pre>
<h2>2.37 TK_commandGetPlaybackWithChannel</h2>
<pre><code>/** 获取事件回放进度控制
@param channel av通道
@param stTimeDay 事件时间
@param completion 获取事件回放进度回调
*/
-(void)TK_commandGetPlaybackWithChannel:(NSInteger)channel stTimeDay:(STimeDay)stTimeDay completion:(void(^)(KalayCommandGetPlayback *))completion;</code></pre>
<h2>2.38 TK_commandSetRecordProgessWithChannel</h2>
<pre><code>/** 设置事件回放进度控制
@param channel av通道
@param progressTime 时间(秒)
@param completion 设置事件回放进度回调
*/
-(void)TK_commandSetRecordProgessWithChannel:(NSInteger)channel stTimeDay:(STimeDay)stTimeDay progressTime:(NSInteger)progressTime completion:(void(^)(KalayCommandSetRecordProgess *))completion;</code></pre>
<h2>2.39 TK_commandGetEventDateWithChannel</h2>
<pre><code>/** 获取有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;</code></pre>
<h2>2.40 TK_commandGetStorageInfoWithChannel</h2>
<pre><code>/** 获取SD内存大小(4x)使用
@param channel av通道
@param value // [&quot;sdcard&quot;, &quot;usb&quot;]
@param completion SD内存回调
*/
-(void)TK_commandGetStorageInfoWithChannel:(NSInteger)channel value:(NSString *)value completion:(void(^)(KalayCommandSDInfo *))completion;</code></pre>