Tange Cloud for Device
 Rev.333
载入中...
搜索中...
未找到
icam_p2p.h
浏览该文件的文档.
1/** @file icam_p2p.h
2 */
3
4#pragma once
5
6#include "platforms.h"
7#include "icam_const.h"
8#include "TgCloudCmd.h"
9#include "TgCloudCmdEx.h"
10#include "TgCloudConst.h"
11
12#include "icam_struct.h"
13//
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#ifdef WIN32
19#ifdef ICAMP2P_C_EXPORTS
20#define ICAMP2P_C_EXPORTS //__declspec(dllexport)
21#else
22#define ICAMP2P_C_EXPORTS //__declspec(dllimport)
23#endif
24#else
25#define ICAMP2P_C_EXPORTS
26#endif
27
28//不支持此选项,因现有协议回放时的 音频通道 固定为 视频通道+1
29//#define SINGLE_THREAD_FOR_LIVE_AV 0
30
31struct P2PRAW;
32typedef struct P2PRAW *HP2PRAW;
33
34struct P2PCLT;
35typedef struct P2PCLT *HP2PCLT; ///< p2p连接句柄
36
37
38#define P2PCONN_TYPE_LAN 1
39#define P2PCONN_TYPE_P2P 2
40#define P2PCONN_TYPE_RELAY 3
41ICAMP2P_C_EXPORTS const char *iCamP2pGetConnTypeName(int connType);
42
43/** @struct FRAMEHEAD_t
44 * Audio/Video Frame Header Info
45 */
46typedef struct FRAMEHEAD_t
47{
48 /** 非0时, 低8位为 @ref TCMEDIA, 高8位为视频通道号.
49 * 为0时,本结构为 RTMSGHEAD_t
50 */
51 unsigned short codec_id;
52
53 /** For video frame, is of ENUM_FRAMEFLAG.
54 * for Audio Frame: flags = (samplerate << 2) | (databits << 1) | (channel)
55 * @ref audio_sample_fmt "音频采样格式" */
56 unsigned char flags;
57
58 unsigned char cam_index; ///< 0 (>0 may be used in future)
59
60 unsigned char rt_flags; ///< 当帧类型为视频时,bit0 为是否在录像的标志
61 unsigned char seq_no[3]; ///< 1~0xffffff. sequency number for frame, used internally by sdk to detect frame loss.
62
63 unsigned int frame_size; ///< Size of frame
64 unsigned int timestamp; ///< Timestamp of the frame, in milliseconds
66
67/** 音视频视回调.
68 * @param fi 帧信息. 为NULL时, (int)data为错误码(定义在 icam_const.h)
69 * @param data 帧数据, 长度在 fi->frame_size
70 * @param pUser 用户数据指针
71 */
72typedef void (*FRAMECALLBACK)(FRAMEHEAD_t *fi, unsigned char *data, void *pUser);
73
74/** 初始化p2p库. Windows下需要自己调用 WSAStartup() */
75ICAMP2P_C_EXPORTS int iCamP2pInit();
76
77/** 清除p2p库 */
78ICAMP2P_C_EXPORTS void iCamP2pDeinit();
79
80#define MAKE_CONNFLAGS(bLanSearch, iP2pTryTime, bRelay) ((bLanSearch?1:0) | (bRelay?0:0x20) | ( ((iP2pTryTime==0?15:iP2pTryTime) & 0x1f) << 1 ) )
81
82ICAMP2P_C_EXPORTS int iCamRawConnect(const char *server, const char *did, int fConnFlags, HP2PRAW *phP2pRaw);
83ICAMP2P_C_EXPORTS int iCamRawGetConnType(HP2PRAW hRaw);
84ICAMP2P_C_EXPORTS int iCamRawDisconnect(HP2PRAW hRaw);
85/** 检查当前连接是否仍有效 */
86ICAMP2P_C_EXPORTS SA_BOOL iCamRawCheckValid(HP2PRAW hRaw);
87ICAMP2P_C_EXPORTS int iCamRawCheckBuffer(HP2PRAW, int chn, unsigned int to_send, /*out*/int *fill_percent);
88
89ICAMP2P_C_EXPORTS int iCamRawRecv(HP2PRAW hRaw, int avIndex, void *buff, int size, int timeout);
90ICAMP2P_C_EXPORTS int iCamRawSend(HP2PRAW hRaw, int avIndex, const void *buff, size_t len);
91ICAMP2P_C_EXPORTS int iCamRawSendV(HP2PRAW hRaw, int avIndex, struct iovec *v, int size);
92
93/** 带超时读取N字节.
94 *
95 @retval size(>0) 字节数(=size)
96 @retval ICAM_E_TIMEOUTED 超时。读取的字节数为0
97 @retval <0 错误码, 连接已断开
98
99 @note 该操作如果在超时到达时读取了部分字节,会忽略超时断续读,直到读到 size 个字节或者连接断开
100*/
101ICAMP2P_C_EXPORTS int iCamRawRecvN(HP2PRAW handle, int avIndex, void *buff, int size, int timeout);
102
103/** 无超时读取N字节.
104 * @note 本操作会一直循环读直到如下条件之一发生:
105 * 1. 读到了指定字节, 返回 1
106 * 2. 连接断开,返回错误码(<0)
107 * 3. *b_run 在外部被修改为0,返回0
108 */
109ICAMP2P_C_EXPORTS int iCamRawRecvN2(HP2PRAW handle, int avIndex, void *buff, int size, const SA_BOOL *b_run);
110
111/** 命令请求/响应包头 */
112typedef struct RespHdr {
113 uint32_t cmd; //命令
114 uint32_t len; //data length
115} RespHdr;
116
117/**/
118struct RespBuff {
119 RespHdr hdr;
120 union {
121 int cmd_status[2];
122 char buff[2048];
123 };
124};
125
126struct CmdPkt {
127 int size; ///< resp 所指向的缓冲区大小
128 struct RespBuff *resp;
129};
130
131/** 在命令通道上读一个完整包.
132 * @param pkt 如果空间不足,库内部会重新分配
133 * @param timeout 读取到头前的超时时间(ms).
134 * @param pbRun 指向一个变量,当值变为0时会中断读操作。
135 * @return length of packet, or error code(<0)
136 * @note 读到头后会一直循环直到读取到完整包, 或者 *pbRun==0。
137 * 中断后不应该再调用读取操作,因为丢失了包边界。
138 */
139ICAMP2P_C_EXPORTS int iCamRawReadCmdPkt(HP2PRAW hRaw, struct CmdPkt *pkt, int timeout, SA_BOOL *pbRun);
140
141struct FrameBuff {
142 FRAMEHEAD_t fi;
143 uint8_t data[1];
144};
145struct FramePkt {
146 int size; ///< memory size pointed by {frame}
147 struct FrameBuff *frame;
148};
149
150/** 在通道上读一个完整帧.
151 * @param hClt
152 * @param avIndex p2p通道
153 * @param pkt 如果空间不足,库内部会重新分配
154 * @param timeout 读取到头前的超时时间(ms).
155 * @param pbRun 指向一个变量,当值变为0时会中断读操作。
156 * @return length of packet, or error code(<0)
157 * @note 读到头后会一直循环直到读取到完整包, 或者 *pbRun==0。
158 * 中断后不应该再调用读取操作,因为丢失了包边界。
159 */
160ICAMP2P_C_EXPORTS int iCamRawRecvFramePkt(HP2PRAW hRaw, int avIndex, struct FramePkt *pkt, int timeout, SA_BOOL *pbRun);
161
162ICAMP2P_C_EXPORTS int iCamRawSendCmd(HP2PRAW handle, int cmd, const void *req, int len);
163ICAMP2P_C_EXPORTS int iCamRawSendMedia(HP2PRAW hRaw, TCMEDIA mt, uint32_t ts, uint32_t uFrameFlags, const uint8_t *pData, int size);
164//-------------------------------------------------------------------------------------
165ICAMP2P_C_EXPORTS SA_BOOL iCamP2pCheckValid(HP2PCLT hClt);
166//iCamRawCheckValid((HP2PRAW)hClt)
167//#define iCamP2pSendCmd(hClt, cmd, data, len) iCamRawSendCmd((HP2PRAW)hClt, cmd, data, len)
168ICAMP2P_C_EXPORTS int iCamP2pSendCmd(HP2PCLT hClt, int cmd, const void *data, int len);
169//iCamRawSendCmd((HP2PRAW)hClt, cmd, data, len)
170
171
172ICAMP2P_C_EXPORTS const char *iCamP2pGetErrorString(int err);
173
174typedef void (*ICAMEVENTCALLBACK)(const RTMSG_t *msg, int len, HP2PCLT hClt, void *pUser);
175typedef void (*ICAMCMDDATACALLBACK)(const void *data, int len, HP2PCLT hClt, void *pUser);
176/** 连接设备.
177 * @param server 服务器配置字符串
178 * @param did p2p id
179 * @param key 口令
180 * @param fConnFlags 连接标志, 0 for default
181 * @param phP2pClt 用于返回连接句柄
182 * @return 0:success; <0:error code
183 */
184ICAMP2P_C_EXPORTS int iCamP2pConnect(const char *server_cfg, const char *did, const char *key,
185 int fConnFlags, HP2PCLT *phP2pClt);
186
187/** 设备连接的消息/数据回调. 在连接建立后就设置.
188 * @param event_cb 事件消息回调. Can be NULL
189 * @param data_cb 未处理的命令应答数据回调, Can be NULL。基本上只用于代理透传
190 * @param pUser 回调的用户参数
191 */
192ICAMP2P_C_EXPORTS int iCamP2pSetCallback(HP2PCLT hClt, ICAMEVENTCALLBACK event_cb, ICAMCMDDATACALLBACK data_cb, void *pUser);
193
194//ICAMP2P_C_EXPORTS int iCamP2pConnectRaw(const char *server, const char *did, int ffConnFlags, void **ppConn, struct P2pIntf **ppIntf);
195
196/** 连接设备但不执行口令认证.
197 * 要调用 iCamP2pVerifyPassword()
198 * @param server 服务器配置字符串
199 * @param did p2p id
200 * @param fConnFlags 连接标志, 0 for default
201 * @param phP2pClt 用于返回连接句柄
202 * @return 0:success; <0:error code
203 */
204ICAMP2P_C_EXPORTS int iCamP2pConnect2(const char *server_cfg, const char *did, int fConnFlags, HP2PCLT *phP2pClt);
205
206ICAMP2P_C_EXPORTS int iCamP2pConnectByToken(const char *token, int fConnFlags, HP2PCLT *hP2pClt);
207
208/** 断开连接 */
209ICAMP2P_C_EXPORTS int iCamP2pDisconnect(HP2PCLT hClt);
210
211/** 中断当前正在进行中连接过程 */
212ICAMP2P_C_EXPORTS void iCamP2pBreakConnecting(); //中断所有连接过程
213
214typedef struct {
215 int type;
216 union {
217 struct {
218 int n_achn;
219 int n_vchn, n_streams_per_vchn;
220 unsigned char types[32];
221 } mt;
222 } u;
223} __PACKED__ MEDIAINFO;
224ICAMP2P_C_EXPORTS int iCamP2pGetMediaTypeInfo(HP2PCLT hClt, MEDIAINFO *mi);
225
226ICAMP2P_C_EXPORTS int iCamP2pVerifyPassword(HP2PCLT hClt, const char *password);
227
228/** 修改直接模式密码 */
229ICAMP2P_C_EXPORTS int iCamP2pChangePassword(HP2PCLT hClt, const char *oldpasswd, const char *newpasswd);
230
231/** 开启实时图像.
232 * @param hClt p2p连接句柄
233 * @param channel 图像通道
234 * @param cb 视频帧回调函数
235 * @param pUser 传给回调函数的用户数据指针
236 */
237ICAMP2P_C_EXPORTS int iCamP2pStartLiveVideo(HP2PCLT hClt, int channel, FRAMECALLBACK cb, void *pUser);
238
239/** 停止视频传输 */
240ICAMP2P_C_EXPORTS int iCamP2pStopLiveVideo(HP2PCLT hClt, int channel);
241
242/** 选择码流.
243 * 要在 iCamP2pStartLiveVideo 后调用.
244 * @param hClt
245 * @param channel
246 * @param stream
247 * */
248ICAMP2P_C_EXPORTS int iCamP2pSelectStream(HP2PCLT hClt, int channel, int stream/*0:HD; 1:SD*/);
249
250ICAMP2P_C_EXPORTS int iCamP2pPause(HP2PCLT hClt);
251ICAMP2P_C_EXPORTS int iCamP2pContinue(HP2PCLT hClt);
252
253/** 开启实时音频.
254 * @param hClt p2p连接句柄
255 * @param cb 音频帧回调函数
256 * @param pUser 传给回调函数的用户数据指针
257 */
258ICAMP2P_C_EXPORTS int iCamP2pStartLiveAudio(HP2PCLT hClt, FRAMECALLBACK cb, void *pUser);
259
260/** 停止音频传输 */
261ICAMP2P_C_EXPORTS int iCamP2pStopLiveAudio(HP2PCLT hClt);
262
263/** 开始对讲.
264 * 成功返回后可以调用 iCamP2pSendAudio 发送音频帧
265 */
266ICAMP2P_C_EXPORTS int iCamP2pStartTalk(HP2PCLT hClt);
267
268/** 停止对讲 */
269ICAMP2P_C_EXPORTS int iCamP2pStopTalk(HP2PCLT hClt);
270
271/** @deprecated 发送音频包.
272 * @param hClt p2p连接句柄
273 * @param pAudio 音频数据缓冲区。目前只支持 8000/16位/mono g711-a 格式的音频包
274 * @param size 包大小
275 */
276ICAMP2P_C_EXPORTS int iCamP2pSendAudio(HP2PCLT hClt, const uint8_t *pAudio, int size);
277
278/** 发关对讲音视频 */
279ICAMP2P_C_EXPORTS int iCamP2pSendMedia(HP2PCLT hClt, TCMEDIA mt, uint32_t ts, uint32_t uFrameFlags, const uint8_t *pMedia, int size);
280
281/** 开始sd卡回放.
282 * @param hClt p2p连接句柄
283 * @param cb_v 视频数据回调
284 * @param pUser_v 视频回调用户数据
285 * @param cb_a 音频数据回调
286 * @param pUser_a 音频数据回调
287 */
288ICAMP2P_C_EXPORTS void iCamP2pPlaybackStart(HP2PCLT hClt, FRAMECALLBACK cb_v, void *pUser_v, FRAMECALLBACK cb_a, void *pUser_a);
289
290/** sd卡回放定位.
291 * @param t 回放定位, utc时间
292 */
293ICAMP2P_C_EXPORTS int iCamP2pPlaybackLocate(HP2PCLT hClt, time_t t);
294
295/** 停止回放 */
296ICAMP2P_C_EXPORTS void iCamP2pPlaybackStop(HP2PCLT hClt);
297
298/** 回放暂停 */
299ICAMP2P_C_EXPORTS int iCamP2pPlaybackPause(HP2PCLT hClt, int bPause);
300
301/** 设置回放倍速.
302 * @param rate: 0-1倍; 1-2倍; 2-4倍数
303 */
304ICAMP2P_C_EXPORTS int iCamP2pPlaybackSetRate(HP2PCLT hClt, int rate);
305
306/** 查询sd卡录像列表.
307 * @param t_start 起始时间(utc)
308 * @param tlen 时间跨度(秒)
309 * @param ppEvents 用于返回录像列表指针
310 * @param pNEvents 返回的录像列表大小
311 * @return: 0-ok; <0: 错误码
312 * @note 成功返回并且*pNEvents 非0时,调用者要释放列表空间(free(*ppEvents))
313 */
314ICAMP2P_C_EXPORTS int iCamP2pGetRecordList2(HP2PCLT hClt, time_t t_start, int tlen, SAvEvent2 **ppEvents, unsigned int *pNEvents);
315
316/** 获取设备能力集. */
317ICAMP2P_C_EXPORTS int iCamP2pGetFeatures(HP2PCLT hClt, CAMFEATURES *pFeatures);
318
319/* 批命令.
320 * @return >0: Has more; Others: ignored */
321typedef int (*RESPCALLBACK)(const void *body, int len, void *pUser);
322
323/* 响应方式为 回调 状态+数据 之一 */
324typedef struct RespProcessor {
325 int status; ///< 响应状态
326 unsigned char *resp; ///< cb_resp == NULL 时为原始响应数据缓冲区。否则忽略
327 int resp_buf_size; ///< in: size of the buffer pointed by {resp}
328 int resp_size; ///< out: bytes filled in {resp}
329
330 RESPCALLBACK cb_resp; ///< if {cb_resp} is not NULL, {resp} and {resp_size} are passed as the 1st and 2nd parameters
331 void *pUser; ///< Private data for cb_resp
333
334/** 批处理的单条指令描述 */
335typedef struct iCamAutoCmd {
336 int cmd; ///< 命令
337 unsigned char *req; ///< 命令请求数据
338 int req_len; ///< 请求数据长度
339
340 RESPPROCESSOR rspProc; ///< responsed data processor
342
343/** 执行多条命令 */
344ICAMP2P_C_EXPORTS int iCamP2pBatchExecute(HP2PCLT hClt, ICAMAUTOCMD *cmds, int nCmds, int timeout);
345
346struct RespWaitBundle;
347/* 如果 ppPoll 非NULL, 返回一个结构用于Poll 应答 */
348ICAMP2P_C_EXPORTS int _iCamP2pExecute(HP2PCLT hClt, int cmd, const void *pReq, int lenReqData,
349 RESPPROCESSOR *rp, int timeout, struct RespWaitBundle **ppPoll);
350ICAMP2P_C_EXPORTS SA_BOOL RwbPoll(struct RespWaitBundle *rwb, int timeout, int *status);
351ICAMP2P_C_EXPORTS void RwbFree(struct RespWaitBundle *rwb, HP2PCLT hClt);
352
353ICAMP2P_C_EXPORTS int iCamP2pExecute(HP2PCLT hClt, int cmd, const void *pReq, int lenReq, void *pResp, int sizeResp, int timeout);
354
355ICAMP2P_C_EXPORTS int iCamP2pSetBatchMode(HP2PCLT hClt);
356ICAMP2P_C_EXPORTS int iCamP2pBatchModeFlush(HP2PCLT hClt, int timeout);
357
358
359/** 获取云录像清晰度设置 */
360ICAMP2P_C_EXPORTS int iCamP2pGetCloudVideoQuality(HP2PCLT hClt);
361
362/** 设置云录像清晰度 */
363ICAMP2P_C_EXPORTS int iCamP2pSetCloudVideoQuality(HP2PCLT hClt, int quality);
364
365/** 通知低功耗设备app进入设置界面,不要休眠 */
366ICAMP2P_C_EXPORTS int iCamP2pEnterSetup(HP2PCLT hClt);
367/** 通知低功耗设备app离开设置界面,可以休眠 */
368ICAMP2P_C_EXPORTS int iCamP2pLeaveSetup(HP2PCLT hClt);
369
370ICAMP2P_C_EXPORTS int iCamP2pAnswerToCall(HP2PCLT hClt, int state);
371
372/** 设置低功耗摄像头的最大工作时长 */
373ICAMP2P_C_EXPORTS int iCamP2pSetMaxAwakeTime(HP2PCLT hClt, int maxAwakeTime);
374
375/** 获取低功耗摄像同的最大工作时长
376 * @return:> 0工作时长,0 不休眠 <0 err
377 */
378ICAMP2P_C_EXPORTS int iCamP2pGetMaxAwakeTime(HP2PCLT hClt);
379
380/** 设备重启 */
381ICAMP2P_C_EXPORTS int iCamP2pRebootDev(HP2PCLT hClt);
382
383/** 设置设备开关状态.
384 * @param status 1-打开; 0-关闭
385 */
386ICAMP2P_C_EXPORTS int iCamP2pSetDeviceStatus(HP2PCLT hClt, int status);
387
388/** 获取当前设备状态.
389 @return 1:打开; 0:关闭; <0 err
390 */
391ICAMP2P_C_EXPORTS int iCamP2pGetDeviceStatus(HP2PCLT hClt);
392
393#ifdef __cplusplus
394}
395#endif
P2p Commands and Structures
P2p Commands and Structures
实时事件通知
录像条目, 带事件的时间戳
探鸽云SDK常数定义
TCMEDIA
媒体类型枚举常数
Constant Erro Codes
ICAMP2P_C_EXPORTS SA_BOOL iCamRawCheckValid(HP2PRAW hRaw)
检查当前连接是否仍有效
ICAMP2P_C_EXPORTS int iCamP2pDisconnect(HP2PCLT hClt)
断开连接
ICAMP2P_C_EXPORTS void iCamP2pBreakConnecting()
中断当前正在进行中连接过程
ICAMP2P_C_EXPORTS void iCamP2pPlaybackStart(HP2PCLT hClt, FRAMECALLBACK cb_v, void *pUser_v, FRAMECALLBACK cb_a, void *pUser_a)
开始sd卡回放.
ICAMP2P_C_EXPORTS int iCamP2pSetMaxAwakeTime(HP2PCLT hClt, int maxAwakeTime)
设置低功耗摄像头的最大工作时长
ICAMP2P_C_EXPORTS int iCamP2pPlaybackSetRate(HP2PCLT hClt, int rate)
设置回放倍速.
ICAMP2P_C_EXPORTS int iCamP2pRebootDev(HP2PCLT hClt)
设备重启
ICAMP2P_C_EXPORTS int iCamP2pGetCloudVideoQuality(HP2PCLT hClt)
获取云录像清晰度设置
ICAMP2P_C_EXPORTS int iCamP2pStopLiveAudio(HP2PCLT hClt)
停止音频传输
ICAMP2P_C_EXPORTS int iCamP2pEnterSetup(HP2PCLT hClt)
通知低功耗设备app进入设置界面,不要休眠
ICAMP2P_C_EXPORTS int iCamP2pStartLiveVideo(HP2PCLT hClt, int channel, FRAMECALLBACK cb, void *pUser)
开启实时图像.
ICAMP2P_C_EXPORTS int iCamP2pConnect2(const char *server_cfg, const char *did, int fConnFlags, HP2PCLT *phP2pClt)
连接设备但不执行口令认证.
ICAMP2P_C_EXPORTS int iCamP2pSetDeviceStatus(HP2PCLT hClt, int status)
设置设备开关状态.
unsigned char flags
For video frame, is of ENUM_FRAMEFLAG.
ICAMP2P_C_EXPORTS int iCamP2pInit()
初始化p2p库.
ICAMP2P_C_EXPORTS int iCamP2pPlaybackPause(HP2PCLT hClt, int bPause)
回放暂停
int resp_size
out: bytes filled in {resp}
ICAMP2P_C_EXPORTS int iCamRawRecvN2(HP2PRAW handle, int avIndex, void *buff, int size, const SA_BOOL *b_run)
无超时读取N字节.
int size
memory size pointed by {frame}
ICAMP2P_C_EXPORTS int iCamP2pStopLiveVideo(HP2PCLT hClt, int channel)
停止视频传输
ICAMP2P_C_EXPORTS int iCamP2pChangePassword(HP2PCLT hClt, const char *oldpasswd, const char *newpasswd)
修改直接模式密码
ICAMP2P_C_EXPORTS int iCamP2pSetCallback(HP2PCLT hClt, ICAMEVENTCALLBACK event_cb, ICAMCMDDATACALLBACK data_cb, void *pUser)
设备连接的消息/数据回调.
ICAMP2P_C_EXPORTS int iCamP2pStopTalk(HP2PCLT hClt)
停止对讲
ICAMP2P_C_EXPORTS int iCamRawRecvN(HP2PRAW handle, int avIndex, void *buff, int size, int timeout)
带超时读取N字节.
ICAMP2P_C_EXPORTS int iCamP2pStartLiveAudio(HP2PCLT hClt, FRAMECALLBACK cb, void *pUser)
开启实时音频.
unsigned int frame_size
Size of frame
ICAMP2P_C_EXPORTS int iCamP2pSelectStream(HP2PCLT hClt, int channel, int stream)
选择码流.
void * pUser
Private data for cb_resp
ICAMP2P_C_EXPORTS int iCamP2pPlaybackLocate(HP2PCLT hClt, time_t t)
sd卡回放定位.
unsigned char * req
命令请求数据
ICAMP2P_C_EXPORTS int iCamP2pGetRecordList2(HP2PCLT hClt, time_t t_start, int tlen, SAvEvent2 **ppEvents, unsigned int *pNEvents)
查询sd卡录像列表.
ICAMP2P_C_EXPORTS int iCamRawRecvFramePkt(HP2PRAW hRaw, int avIndex, struct FramePkt *pkt, int timeout, SA_BOOL *pbRun)
在通道上读一个完整帧.
int status
响应状态
RESPCALLBACK cb_resp
if {cb_resp} is not NULL, {resp} and {resp_size} are passed as the 1st and 2nd parameters
ICAMP2P_C_EXPORTS int iCamP2pSendMedia(HP2PCLT hClt, TCMEDIA mt, uint32_t ts, uint32_t uFrameFlags, const uint8_t *pMedia, int size)
发关对讲音视频
int resp_buf_size
in: size of the buffer pointed by {resp}
int size
resp 所指向的缓冲区大小
ICAMP2P_C_EXPORTS int iCamP2pStartTalk(HP2PCLT hClt)
开始对讲.
ICAMP2P_C_EXPORTS void iCamP2pPlaybackStop(HP2PCLT hClt)
停止回放
int req_len
请求数据长度
ICAMP2P_C_EXPORTS int iCamP2pGetDeviceStatus(HP2PCLT hClt)
获取当前设备状态.
ICAMP2P_C_EXPORTS int iCamP2pLeaveSetup(HP2PCLT hClt)
通知低功耗设备app离开设置界面,可以休眠
ICAMP2P_C_EXPORTS int iCamRawReadCmdPkt(HP2PRAW hRaw, struct CmdPkt *pkt, int timeout, SA_BOOL *pbRun)
在命令通道上读一个完整包.
ICAMP2P_C_EXPORTS int iCamP2pSetCloudVideoQuality(HP2PCLT hClt, int quality)
设置云录像清晰度
ICAMP2P_C_EXPORTS void iCamP2pDeinit()
清除p2p库
ICAMP2P_C_EXPORTS int iCamP2pGetFeatures(HP2PCLT hClt, CAMFEATURES *pFeatures)
获取设备能力集.
unsigned int timestamp
Timestamp of the frame, in milliseconds
ICAMP2P_C_EXPORTS int iCamP2pConnect(const char *server_cfg, const char *did, const char *key, int fConnFlags, HP2PCLT *phP2pClt)
连接设备.
void(* FRAMECALLBACK)(FRAMEHEAD_t *fi, unsigned char *data, void *pUser)
音视频视回调.
unsigned short codec_id
非0时, 低8位为 TCMEDIA, 高8位为视频通道号.
ICAMP2P_C_EXPORTS int iCamP2pBatchExecute(HP2PCLT hClt, ICAMAUTOCMD *cmds, int nCmds, int timeout)
执行多条命令
unsigned char seq_no[3]
1~0xffffff. sequency number for frame, used internally by sdk to detect frame loss.
struct P2PCLT * HP2PCLT
p2p连接句柄
unsigned char cam_index
0 (>0 may be used in future)
unsigned char rt_flags
当帧类型为视频时,bit0 为是否在录像的标志
RESPPROCESSOR rspProc
responsed data processor
ICAMP2P_C_EXPORTS int iCamP2pGetMaxAwakeTime(HP2PCLT hClt)
获取低功耗摄像同的最大工作时长
unsigned char * resp
cb_resp == NULL 时为原始响应数据缓冲区。否则忽略
ICAMP2P_C_EXPORTS int iCamP2pSendAudio(HP2PCLT hClt, const uint8_t *pAudio, int size)
int cmd
命令
Audio/Video Frame Header Info
批处理的单条指令描述
命令请求/响应包头