KalayRN(简中版)

RN版本


IOS API

<p>[TOC]</p> <h1>一、IOTCamera</h1> <h2>1.1 初始化接口</h2> <p>&gt; 注:调用TK_initIOTC时返回-10000, 是因为privateKey无效导致,遇到该问题时建议:</p> <ul> <li>确认当前项目使用的包名与privateKey是否与TUTK提供的一致,如不一致,请修改为TUTK提供的包名与privateKey重新运行;</li> <li>如需更改包名与privateKey,请联系商务或者技术支持人员。</li> </ul> <h3>TK_initIOTC</h3> <pre><code>功能:IOTC初始化,服务端确认privateKey的合法性 (  注意:TK_initIOTC()此方法在SDK 3.3.0.0以上版本废弃请用TK_initIOTCWithLicenseKey()代替) /** IOTC初始化   @param privateKey PSC初始化的Key值   @param success 验证成功   @param failure 验证失败 */ + (void)TK_initIOTC:(NSString *)privateKey</code></pre> <p>                   success:(void (^)(void))success                     failure:(void (^)(NSError *error))failure;</p> <pre><code class="language-objective-c">示例: [Camera TK_InitIOTC:PRIVATEKEY                         success:^{ } failure:^(NSError *error) {         if (error.code == TUTK_ER_INVALID_ARG) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_INVALID_ARG)&amp;quot;);         }else if (error.code == TUTK_ER_INVALID_LICENSE_KEY) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_INVALID_LICENSE_KEY)&amp;quot;);         }else if (error.code == TUTK_ER_MEM_INSUFFICIENT) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_MEM_INSUFFICIENT)&amp;quot;);         }     }];</code></pre> <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:(void (^)(void))success failure:(void (^)(NSError *error))failure;</code></pre> <pre><code class="language-objective-c">示例: [Camera TK_InitIOTCWithLiceseKey:LICENSEKEY privateKey:PRIVATEKEY                              success:^{ } failure:^(NSError *error) {         if (error.code == TUTK_ER_INVALID_ARG) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_INVALID_ARG)&amp;quot;);         }else if (error.code == TUTK_ER_INVALID_LICENSE_KEY) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_INVALID_LICENSE_KEY)&amp;quot;);         }else if (error.code == TUTK_ER_MEM_INSUFFICIENT) {             NSLog(@&amp;quot;TK_InitIOTC:false(TUTK_ER_MEM_INSUFFICIENT)&amp;quot;);         }     }];</code></pre> <p>&gt; 注:调用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 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 viewAccount:@&amp;quot;admin&amp;quot; viewPassword:password];</code></pre> <h3>TK_getIOTCameraVersion</h3> <pre><code>/** 获取IOTCamera版本号 @return IOTCamera版本号 */ + (NSString *)TK_getIOTCameraVersion;</code></pre> <pre><code class="language-objective-c">示例: [Camera 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_setLogEnable</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> <h4>didChangeSessionStatus</h4> <pre><code>/** 指定通道的连线状态回调  @param camera camera对象  @param status 连线状态  */ - (void)camera:(Camera *)camera didChangeSessionStatus:(NSInteger)status;</code></pre> <h4>didChangeChannelStatus</h4> <pre><code>/** 指定通道的连线状态回调 @param camera camera对象 @param channel av通道 @param status 连线状态 */ - (void)camera:(Camera *)camera didChangeChannelStatus:(NSInteger)channel ChannelStatus:(NSInteger)status;</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>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>连线状态status</h4> <pre><code>CONNECTION_STATE_NONE = 0; //初始化连线状态 CONNECTION_STATE_CONNECTING = 1; //设备连线中 CONNECTION_STATE_CONNECTED = 2; //设备已连线 &amp;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> <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>/**  获取FrameInfo帧信息  @param camera camera对象  @param frameData 帧信息(FRAMEINFO_t_video结构体转换的NSData *数据)  @param channel av通道  */ - (void)camera:(Camera *)camera didReceiveFrameDataInfo:(NSData *)frameData Channel:(NSInteger)channel; /** 指定通道接收的视频帧数据回调 @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> <h2>1.3 连线接口</h2> <h4>TK_connect</h4> <pre><code>/** 开始连接设备 @param uid 设备UID */ - (void)TK_connect:(NSString *)uid;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_connect:UID];</code></pre> <pre><code>/** 开始连接设备 @param uid 设备UID @param authKey 设备连线的key */ - (void)TK_connect:(NSString *)uid authKey:(NSString *)authKey;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_connect:UID authKey:self.authkey];</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;amp;num timeout:3000];</code></pre> <h4>TK_disconnect</h4> <pre><code>/** 断开设备连线 */ - (void)TK_disconnect;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_disconnect];</code></pre> <h4>TK_start</h4> <pre><code>/** 开启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:@&amp;quot;admin&amp;quot; viewPassword:@&amp;quot;000000&amp;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_getConnectionStageofChannel: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:@&amp;quot;eq=contrast=0.9:brightness=0.1:saturation=1&amp;quot; isOn:YES];</code></pre> <h3>TK_startShow</h3> <pre><code>/**  开始接收、解码并显示画面  @param channel av通道  @param obScreen 屏幕显示对象  @param isSWDecode 是否软解  @param isSendCommand 是否发送指令1FF/2FF  */ - (void)TK_startShow:(NSInteger)channel ScreenObject:(NSObject*)obScreen isSWDecode:(BOOL)isSWDecode isSendCommand:(BOOL)isSendCommand;</code></pre> <pre><code class="language-objective-c"> 示例: [myCamera TK_startShow:0 ScreenObject:self isSWDecode:NO isSendCommand:YES];</code></pre> <pre><code>/** 开始接收、解码并上抛YUV数据   @param channel av通道 @param isSWDecode 是否软解 */ - (void)TK_startShowWithYUV:(NSInteger)channel isSWDecode:(BOOL)isSWDecode;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_startShowWithYUV:0 isSWDecode:FALSE];</code></pre> <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> <h3>TK_setDecocdeDelayTime</h3> <pre><code>/** 设置最大延迟时间,调整解码每帧时间间隔</code></pre> <p>  @param channel av通道   @param delayTime 最大延迟时间(ms)   @param durationTime 解码时间间隔(ms) 0 ~ 30 */</p> <ul> <li>(void)TK_setDecocdeDelayTime:(NSInteger)delayTime               durationTime:(NSInteger)durationTime                    channel:(NSInteger)channel;</li> </ul> <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> <pre><code>/** 开始接收、解码并监听设备声音 @param channel av通道 */ - (void)TK_startSoundToPhone:(NSInteger)channel;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_startSoundToPhone:0];</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_startSoundToDevice:0 isResend:YES];</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 captureSize:0];</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:0];</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> <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_startSendAudioChannel:1 isResend:YES];</code></pre> <h3>TK_stopSendAudioChannel</h3> <pre><code>/** 关闭对讲发送 @param channel av通道 */ - (void)TK_stopSendAudioChannel:(NSInteger)channel;</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 沙盒路径  @param channel av通道  */ -(void)TK_initVideoGenerator:(NSURL*)url channel:(NSInteger)channel;</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 channel av通道 @param duration 最大录像时长 */ -(void)TK_startRecordingForChannel:(NSInteger)channel withDuration:(NSTimeInterval)duration;</code></pre> <pre><code class="language-objective-c"> 示例: [self.myCamera TK_startRecordingForChannel:0 withDuration:180];</code></pre> <h3>TK_stopRecording</h3> <pre><code>/** 停止录像 @param channel av通道  */ -(void)TK_stopRecording:(NSInteger)channel;</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> <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"> 示例: SMsgAVIoctrlDeviceInfoReq *s = malloc(sizeof(SMsgAVIoctrlDeviceInfoReq)); memset(s, 0, sizeof(SMsgAVIoctrlDeviceInfoReq)); [self TK_sendIOCtrlToChannel:0 Type:IOTYPE_USER_IPCAM_DEVINFO_REQ Data:(char *)s DataSize:sizeof(SMsgAVIoctrlDeviceInfoReq)]; free(s);</code></pre> <h4>TK_sendJsonIOCtrlToChannel</h4> <pre><code>/**  给指定通道发送指令 @param channel av通道 @param type 指令类型 @param data 指令数据 */ - (void)TK_sendJsonIOCtrlToChannel:(NSInteger)channel Type:(NSInteger)type Data:(NSData *)data;</code></pre> <pre><code class="language-objective-c">示例: NSString *startVideo = @&amp;quot;{\&amp;quot;func\&amp;quot;:\&amp;quot;startVideo\&amp;quot;,\&amp;quot;args\&amp;quot;:{\&amp;quot;value\&amp;quot;:true}}&amp;quot; NSData *data = [startVideo dataUsingEncoding:NSUTF8StringEncoding]; [self TK_sendJsonIOCtrlToChannel:0 Type:0 Data:data];</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> <h1>二、指令封装</h1> <h2>2.1 TK_commandCallReq</h2> <pre><code>/**  请求接听指令  */ - (void)TK_commandCallReq;</code></pre> <h2>2.2 TK_commandGetAudioOutFormatWithChannel</h2> <pre><code>/**  获取音频格式  @param channel av通道号  */ - (void)TK_commandGetAudioOutFormatWithChannel:(NSInteger)channel;</code></pre> <h2>2.3 TK_commandGetQVGAWithChannel</h2> <pre><code>/**  获取当前视频质量指令  @param channel av通道号  */ - (void)TK_commandGetQVGAWithChannel:(NSInteger)channel;</code></pre> <h2>2.4 TK_commandGetRecordMode</h2> <pre><code>/**  获取当前录像模式指令  */ - (void)TK_commandGetRecordMode;</code></pre> <h2>2.5 TK_commandGetDeviceInfo</h2> <pre><code>/** 获取设备信息指令 */ - (void)TK_commandGetDeviceInfo;</code></pre> <h2>2.6 TK_commandGetSupportStreamWithChannel</h2> <pre><code>/**  获取支持音视频流的通道数  @param channel av通道号  */ - (void)TK_commandGetSupportStreamWithChannel:(NSInteger)channel;</code></pre> <h2>2.7 TK_commandGetChannelNameWithChannel</h2> <pre><code>/**  获取通道名称  @param channel av通道号  */ - (void)TK_commandGetChannelNameWithChannel:(NSInteger)channel;</code></pre> <h2>2.8 TK_commandGetGuardWithChannel</h2> <pre><code>/**  获取报警布防配置信息  @param channel av通道号  */ - (void)TK_commandGetGuardWithChannel:(NSInteger)channel;</code></pre> <h2>2.9 TK_commandGetMotionDetectWithChannel</h2> <pre><code>/**  获取移动侦测配置信息  @param channel av通道号  */ - (void)TK_commandGetMotionDetectWithChannel:(NSInteger)channel;</code></pre> <h2>2.10 TK_commandGetWifiWithChannel</h2> <pre><code>/**  获取WiFi配置信息  @param channel av通道号  */ - (void)TK_commandGetWifiWithChannel:(NSInteger)channel;</code></pre> <h2>2.11 TK_commandGetListWifiApWithChannel</h2> <pre><code>/**  获取WiFi热点列表  @param channel av通道号  */ - (void)TK_commandGetListWifiApWithChannel:(NSInteger)channel;</code></pre> <h2>2.12 TK_commandGetListEventWithChannel</h2> <pre><code>/**  获取指定时间内的事件列表  @param channel av通道号  @param event 事件类型  @param _start 起始时间  @param _stop 截止时间  */ - (void)TK_commandGetListEventWithChannel:(NSInteger)channel event:(char)event startTime:(STimeDay)_start stopTime:(STimeDay)_stop;</code></pre> <h2>2.13 TK_commandGetPlaybackWithChannel</h2> <pre><code>/**  获取指定时间的事件回放数据  @param channel av通道号  @param stTimeDay 指定的时间点  */ - (void)TK_commandGetPlaybackWithChannel:(int)channel stimeday:(STimeDay)stTimeDay;</code></pre> <h2>2.14 TK_commandGetVideoModeWithChannel</h2> <pre><code>/**</code></pre> <p>  获取当前的视频翻转模式  @param channel av通道号  */</p> <ul> <li>(void)TK_commandGetVideoModeWithChannel:(NSInteger)channel;</li> </ul> <h2>2.15 TK_commandGetDeviceSupportOTA</h2> <pre><code>/** 获取设备是否支持OTA */ - (void)TK_commandGetDeviceSupportOTA;</code></pre> <h2>2.16 TK_commandGetDeviceInfoEx</h2> <pre><code>/**  获取设备信息指令(扩展)  */ - (void)TK_commandGetDeviceInfoEx;</code></pre> <h2>2.17 TK_commandSetQVGAWithLevel</h2> <pre><code>/**  设置视频质量等级  @param level 视频质量等级  @param channel av通道号  */ - (void)TK_commandSetQVGAWithLevel:(NSInteger)level WithChannel:(NSInteger)channel;</code></pre> <h2>2.18 TK_commandSetPasswordWithOld</h2> <pre><code>/**  修改设备密码  @param oldPassword 旧密码  @param newPassword 新密码  */ - (void)TK_commandSetPasswordWithOld:(NSString *)oldPassword new:(NSString *)newPassword;</code></pre> <h2>2.19 TK_commandSetWifiWithSSID</h2> <pre><code>/**</code></pre> <p>  配置设备的WiFi网络  @param ssid WiFi热点的SSID  @param passwordStr WiFi热点的密码  @param enctype WiFi热点的加密方式  @param mode WiFi热点的工作模式  */</p> <ul> <li>(void)TK_commandSetWifiWithSSID:(NSString <em>)ssid Password:(NSString </em>)passwordStr enctype:(char)enctype mode:(char)mode;</li> </ul> <h2>2.20 TK_commandSetRecordWithChannel</h2> <pre><code>/**  配置设备的录像模式  @param channel av通道号  @param newRecordType 新录像模式  */ - (void)TK_commandSetRecordWithChannel:(NSInteger)channel recordType:(unsigned int)newRecordType;</code></pre> <h2>2.21 TK_commandSetMotionDetectWithChannel</h2> <pre><code>/**  配置设备的移动侦测功能  @param channel av通道号  @param motionDetectNum 侦测灵敏值  */ - (void)TK_commandSetMotionDetectWithChannel:(int)channel sensitivity:(int)motionDetectNum;</code></pre> <h2>2.22 TK_commandSetGuardReqWithChannel</h2> <pre><code>/**  配置设备的报警布防功能  @param channel av通道号  @param alarm_motion_armed 侦测开关  @param motionDetectNum 侦测灵敏值  @param alarm_preset 报警联动预置位  @param alarm_mail 报警邮件通知开关  @param alarm_upload_interval 报警上传时间间隔  */ - (void)TK_commandSetGuardReqWithChannel:(int)channel                       alarm_motion_armed:(char)alarm_motion_armed                 alarm_motion_sensitivity:(char)motionDetectNum                            alarm_preset:(char)alarm_preset                           alarm_mail:(char)alarm_mail                    alarm_upload_interval:(int)alarm_upload_interval;</code></pre> <h2>2.23 TK_commandSetRecordProgessWithChannel</h2> <pre><code>/**  设置设备当前播放的时间录像进度  @param channel av通道号  @param stTimeDay 录像的时间点  @param progressTime 进度时间点  */ - (void)TK_commandSetRecordProgessWithChannel:(int)channel</code></pre> <p>                                     stimeday:(STimeDay)stTimeDay                                  progressTime:(int)progressTime;</p> <h2>2.24 TK_commandFormatExtStorageWithStorage</h2> <pre><code>/**</code></pre> <p>  格式化外置存储器  @param storage 外置存储器编号  */</p> <ul> <li>(void)TK_commandFormatExtStorageWithStorage:(int)storage;</li> </ul> <h2>2.25 TK_commandSetVideoModeWithChannel</h2> <pre><code>/**</code></pre> <p>  设置设备的视频翻转模式  @param channel av通道号  @param mode 翻转模式  */</p> <ul> <li>(void)TK_commandSetVideoModeWithChannel:(int)channel                                      mode:(int)mode;</li> </ul> <h2>2.25 TK_commandSetPtzWithChannel</h2> <pre><code>/**  配置设备的PTZ功能  @param channel av通道号  @param control PTZ指令值  */ - (void)TK_commandSetPtzWithChannel:(int)channel</code></pre> <p>                            control:(int)control;</p> <h2>2.26 TK_commandOTA</h2> <pre><code>/**  OTA升级 */ - (void)TK_commandOTA;</code></pre>

页面列表

ITEM_HTML