|
Tange Cloud for Device
Rev.362 |
探鸽云SDK接口申明 更多...
#include <stdint.h>#include <time.h>#include "TgCloudConst.h"#include "TgCloudCmd.h"#include "TgCloudCmdEx.h"#include "ec_const.h"#include "TgCloudUtil.h"结构体 | |
| struct | TCIDEVICEINFO |
| 设备基本信息 更多... | |
| struct | TCISERVICEINFO |
| 云服务信息 更多... | |
| struct | TransStatUser |
| P2P发送统计数据结构 更多... | |
| struct | TciCB |
| sdk 回调函数结构 更多... | |
| struct | Ipv4Addr |
| IPv4 地址表示(网络字节顺序) 更多... | |
| struct | SIMPLEBUFFER |
| Simple Buffer 更多... | |
| struct | paramf_ops |
| 参数文件读写函数据指针结构 更多... | |
| union | TgfDest |
| 用户文件下载目的地. 更多... | |
| struct | TgfDest::to_file |
| 数据下载到文件 更多... | |
| struct | TgfDest::to_mem |
| 数据下载到内存 更多... | |
| struct | DEVICEOTAINFO |
| 设备升级包信息 更多... | |
| struct | TG4GINFO |
| 4G 设备信息 更多... | |
| struct | TgLogConf |
| 日志上传配置 更多... | |
| struct | ICECONFIG |
| union | TCISERVICEINFO.__unnamed1__ |
宏定义 | |
SDK状态标志 | |
| #define | TGSS_F_CS_INSERVICE 0x00000001 |
| 云文件正在上传或者新文件正在打包 | |
| #define | TGSS_F_P2P_CONNECTED 0x00000002 |
| 有用户连接 | |
| #define | TGSS_F_P2P_STREAMING 0x00000004 |
| 用户正在拉流 | |
| #define | TGSS_F_P2P_INSETTING 0x00000008 |
| 用户处在设置界面 | |
| #define | TGSS_F_BS_UPLOADING 0x00000010 |
| 后备存储正在上传 | |
| #define | TGSS_F_CALL_PENDING 0x00000020 |
| 呼叫正在等待处理 | |
| #define | TGSS_F_IN_CONVERSATION 0x00000040 |
| 呼叫通话中 | |
类型定义 | |
| typedef void * | p2phandle_t |
| p2p连接句柄. | |
| typedef int(* | TGCMDHANDLER) (p2phandle_t handle, int cmd, const void *data, int len) |
| 命令回调类型 | |
| typedef void(* | TCIONLIVEFRAMECB) (int channel, int stream, TCMEDIA mt, const uint8_t *pFrame, uint32_t size, uint32_t ts, int uFrameFlags) |
枚举 | |
| enum | SIMCARDTYPE |
| sim 卡类型 更多... | |
| enum | PMODE |
| 低功耗设备的工作模式 更多... | |
| enum | ETRANSSERVICE |
| 传输内容 更多... | |
| enum | TCSYSOPTION |
| SDK选项常数 更多... | |
函数 | |
| TG_PUBLIC int | TciReportError (const char *name, const char *detail) |
| 上报错误 | |
| TG_PUBLIC void | TciSelectEnvironment (int env) |
| 用于选择调试环境 | |
| void | TciRegisterLiveFrameCB (TCIONLIVEFRAMECB cb) |
| void | TciUnregisterLiveFrameCB (TCIONLIVEFRAMECB cb) |
| void | TciSetParamFileOps (struct paramf_ops *ops) |
| 设置参数文件操作指针. | |
| TG_PUBLIC int | TciSetMaxP2pClientsNum (int num) |
| 设置最大p2p连接数. | |
| char * | TciGetDeviceInfoString (void) |
核心API | |
| TG_PUBLIC int | TciGetRevision (void) |
| 获取SDK版本号 TciInit()之后调用 | |
| TG_PUBLIC int | TciInit (const char *path, const char *uuid) |
| 配置基本参数 在TciStart()之前调用 | |
| TG_PUBLIC int | TciStart (int isBound, unsigned int uCloudBuffSize) |
| 启动服务 | |
| TG_PUBLIC int | TciStart2 (int isBound, unsigned int uCloudBuffSize, const char *uuid) |
| 启动服务. | |
| TG_PUBLIC int | TciStop (void) |
| 停止服务 | |
| TG_PUBLIC int | TciCleanup (void) |
| 释放资源 | |
| TG_PUBLIC int | TciSetCallback (const struct TciCB *cb) |
| 注册回调 – sdk内部事件 | |
| TG_PUBLIC int | TciSetCmdHandler (const TGCMDHANDLER cb) |
| 注册通用命令回调 在回调里处理APP发来的命令请求 | |
| TG_PUBLIC void | TciSetSessionUserData (p2phandle_t handle, void *pUser) |
| 绑定应用私有数据指针到p2p handle | |
| TG_PUBLIC void * | TciGetSessionUserData (p2phandle_t handle) |
| 返回由TciSetSessionUserData()设置的应用私有数据指针 | |
| TG_PUBLIC void | TciSetLogOption (int b_output_to_console, const char *log_path, int max_log_size) |
| 控制日志输出. | |
| TG_PUBLIC void | TciSetLogLevel (int level) |
| 设置SDK日志输出等级. | |
| TG_PUBLIC void | TciSetCloudStream (int channel, int stream) |
| 设置云存储录像通道的码流 | |
| TG_PUBLIC int | TciSetSysOption (TCSYSOPTION opt, const void *pVal) |
| 通用sdk工作选项设置接口. | |
| TG_PUBLIC int | TciGetSysOption (TCSYSOPTION opt, void *pVal) |
| 通用sdk工作选项获取接口. | |
| TG_PUBLIC int | TciStartInTestMode (const char *key_path) |
| 开启p2p功能,进入厂测状态. | |
上报事件/状态/其它数据到平台 | |
| TG_PUBLIC int | TciSetEventEx (EVENTPARAM *evtp) |
| 上报事件。本版本允许附带事件特定参数. | |
| TG_PUBLIC int | TciStopEvent (ECEVENT evt) |
| 停止事件, 仅少数事件才有意义. | |
| TG_PUBLIC int | TciSetLockEvent (int cls, int msg, int usrtyp, int usrid) |
| 门锁事件上报。图片和录像都在内部处理了. | |
| TG_PUBLIC int | TciSetDoorbellEvent () |
| 包装了门铃事件 | |
| TG_PUBLIC int | TciReport4GInfo (const char *imei, const char *iccid, ECG4STATE state) |
| TG_PUBLIC int | TciReport4GInfoEx (const TG4GINFO *info, ECG4STATE state) |
| 上报4G设备信息,代替 TciReport4GInfo() | |
| TG_PUBLIC int | TciReportGpsInfo (const unsigned int time, const double longitude, const double latitude, double speed, int angle, int signal_strength) |
| 上报GPS信息 | |
| TG_PUBLIC int | TciReportBatteryStatus (int qoe, int qoe_low, int charging) |
| 上报电池状态 | |
| TG_PUBLIC void | TciSetRtState (ENUMRTSTATE state, void *pData) |
| 报告系统运行时状态 | |
| TG_PUBLIC int | TciSwitchDeviceStatus (int status) |
| 设置设备开关状态. | |
| TG_PUBLIC int | TciSendUserData (const unsigned char *data, int len) |
| 发送用户自定义数据到第三方平台. | |
配网和注册 | |
| TG_PUBLIC int | TciConfigWifi (int mode) |
| 开始配置WIFI. | |
| TG_PUBLIC int | TciConfigWifiWithoutReset (int mode) |
| 开始配置WIFI. | |
| TG_PUBLIC int | TciCheckRegString (const char *s) |
| 在sdk外部扫二维码. | |
| TG_PUBLIC int | TciStopConfigWifi (int mode) |
| 中止配网. | |
| TG_PUBLIC const void * | TciGetRegisterConfiguration (int *len) |
| 保存wifi注册信息. | |
| SA_BOOL | TciSetRegisterConfiguration (const void *data, int len) |
| 恢复wifi注册信息. | |
| TG_PUBLIC int | TciSetP2pInfo (const char *sss) |
| TG_PUBLIC int | TciProcessRegInfo (const void *data) |
| 处理从蓝牙收到的注册数据 | |
| TG_PUBLIC int | TciSetRegInfo (const char *s) |
| 手动处理注册信息 | |
低功耗相关 | |
| TG_PUBLIC int | TciAllocCloudBuffer (unsigned int uCloudBuffSize) |
| 预分配云存储帧缓存空间. | |
| TG_PUBLIC void | TciFlushCsCache () |
| 等待录像缓冲区中的所有数据被消耗掉. | |
| TG_PUBLIC int | TciSetKeyVideoTime (int channel, int stream, time_t t) |
| 告诉SDK下一个视频关键帧的实际发生时间(UTC). | |
| TG_PUBLIC int | TciPrepareHiberation (int *socks, int size) |
| 准备休眠 本api建立到唤醒服务器的tcp连接,并且返回连接数. | |
| TG_PUBLIC int | TciGetWakeupServers (Ipv4Addr servers[3]) |
| 获取唤醒服务器ip地址 | |
| TG_PUBLIC const uint8_t * | TciPrepareAuthString (const char *randKey, int *len_of_authstring) |
| 生成唤醒服务器登录命令. | |
| TG_PUBLIC void | TciSetPowerMode (PMODE mode) |
| 设置低功耗设备的工作模式. | |
| TG_PUBLIC void | TciSetP2pDown (SA_BOOL bDown) |
| 暂停或继续运行 P2P. | |
| TG_PUBLIC void | TciFastRecoverP2p (void) |
| 从NETDOWN模式下恢复网络后,调用本api使p2p快速上线 | |
| TG_PUBLIC void | TciSetWakeupReason (time_t t_wakeup, int r, const char *user_reason, int sig_lvl, int sdc_rec) |
| 设置低功耗设备唤醒原因, 设备进入休眠时会上报给服务器. | |
| TG_PUBLIC int | TciForceSleeping (SA_BOOL bDiscardFilesInQueue) |
| 设备端准备强制休眠. | |
云存储自动补录 | |
| TG_PUBLIC int | TciSetBackStore (const char *sd_path, ECBUFFERHINT buffer_hint) |
| 设置云存储后备存储目录和缓存策略. | |
| TG_PUBLIC void | TciBackStoreEnableUpload (int en) |
| 允许或禁止后备上传. | |
| TG_PUBLIC void | TciBackStoreEnable (int en) |
| 这个接口用于sd卡格式化前释放backstore, 和格式化后重新开启后备存储 | |
手动OTA&文件上传下载 | |
| TG_PUBLIC int | TciUpgradeOnTheAir (const char *subdev) |
| 下载升级包 | |
| TG_PUBLIC int | TciQueryForOTA (const char *uuid, DEVICEOTAINFO *ota) |
| 查询升级包. | |
| TG_PUBLIC int | TciQueryForOta2 (const char *fw_id, const char *fw_ver, DEVICEOTAINFO *ota) |
| 查询第三方升级包. | |
| TG_PUBLIC int | TciPerformOTA (DEVICEOTAINFO *ota) |
| 执行下载过程,会调用回调里的 ota 接口. | |
下载用户文件 | |
| TG_PUBLIC int | TciGetUserFile (const char *name, SA_BOOL bToFile, union TgfDest *dest, int timeout) |
| 查询并下载用户文件. | |
| TG_PUBLIC int | TciQueryUserFile (const char *name, EcFileLink *flnk) |
| 获取用户文件的下载地址. | |
| TG_PUBLIC int | TciDownloadUserFile (const EcFileLink *flink, SA_BOOL bToFile, union TgfDest *dest, int timeout) |
| 下载用户文件. | |
日志上传工具 | |
以查询的方式上传日志,主要用于低功耗设备. | |
| int | TgQueryUploadReq (const char *uuid, const char *model_id, char **ppUrl) |
| int | TgPostLogFile (const char *url, const char *uuid, const char *path, int timeout) |
| int | TgPostLogMem (const char *url, const char *uuid, const void *mem, int size, const char *name, int timeout) |
| TG_PUBLIC int | TciGetLogConf (struct TgLogConf *pLogConf) |
| 查询日志上传配置 | |
| TG_PUBLIC int | TciPutLogFile (const char *local_path, int timeout) |
| 上传日志文件. | |
| TG_PUBLIC int | TciPutLogMem (const void *mem, int size, const char *name, int timeout) |
| 上传内存中的日志 | |
MCU配网api | |
低功耗设备在MCU端进行配网. | |
| char * | TciGetActivationAttrs (void) |
| 获取设备属性字符串。调用者把该字符串传给MCU,用于在MCU端激活设备. | |
| unsigned char * | TciGetPlatConfig (int *pLen) |
| 返回要同步到MCU的数据. | |
| TG_PUBLIC int | TciSyncPlatConfig (const unsigned char *pData, int len) |
| 同步从MCU来的数据. | |
其它功能 | |
| TG_PUBLIC void | TcnIpChanged () |
| 设备上线后IP发生变化时通知SDK, 用于立即更新长连接 | |
| TG_PUBLIC int | TciLocalStart (const char *url, const ICECONFIG *cfg, int size) |
| 开启本地工作模式. | |
| TG_PUBLIC unsigned int | TciGetSdkState (void) |
| 获取SDK内部状态. | |
| TG_PUBLIC int | TciSetEventRecordLength (int erl) |
| 设置用户定义低功耗设备的事件云录像时长. | |
| TG_PUBLIC int | TciClearCache (SA_BOOL bResetRemote) |
| 清除SDK运行cache. | |
呼入处理 | |
| TG_PUBLIC int | TciAcceptInCall2 (ECALLFLAVOR flavor) |
| 接听. | |
| TG_PUBLIC int | TciRejectInCall2 () |
| 拒接. | |
| TG_PUBLIC int | TciHangup (void) |
| 挂断当前通话 | |
发送音视频和消息 | |
这个数据通过p2p通道传给App。或者,如果有服务,音视频会上传云端 | |
| #define | TciSendPbSyncFrame(handle, utc_time, is_response_to_PLAY_START) |
| 发送回放时间同步帧. | |
| #define | TciSendPbTimelapseFlag(handle, flag) |
| 发送缩时录像回放标志。在进入和退出时发送. | |
| #define | TciSendPbEndOfEvent(handle) |
| 在事件回放结束时发送此标志通知App. | |
| #define | TciSendLiveMsg_ReachPsp(channel, psp_num) |
| 发送预置位到位通知. | |
| #define | TciSendLiveMsg_LensSwitch(channel, stream) |
| 多目摄像机镜头切换时发送的标志帧, 要求在新镜头的第一帧前发送. | |
| #define | TciSendLensSwitchFlag(channel, stream) |
| TG_PUBLIC int | TciSendCmd (p2phandle_t handle, unsigned int cmd, const void *data, int dataSize) |
| 发送p2p命令请求 | |
| TG_PUBLIC int | TciSendCmdResp (p2phandle_t handle, unsigned int cmd, const void *data, int dataSize) |
| 发送p2p命令应答 | |
| TG_PUBLIC int | TciSendCmdRespStatus (p2phandle_t handle, unsigned int cmd, unsigned int status) |
| 发送一个 Tcis_ErrorResp 结构作应答. | |
| TG_PUBLIC int | TciSendPbFrame (p2phandle_t handle, uint32_t id_mt, const uint8_t *frame, int len, uint32_t timestamp, int uFrameFlags) |
| 回放时发送数据帧. | |
| TG_PUBLIC int | TciSendPbMessage (p2phandle_t handle, RTMTYPE type, unsigned int data1, unsigned int data2, const void *data, int data_len) |
| 在回放流中插入消息. | |
| TG_PUBLIC int | TciSendFrameEx (int channel, int stream, TCMEDIA mt, const uint8_t *pFrame, int length, uint32_t ts, int uFrameFlags) |
| 发送实时音视频帧, SDK内部会将数据分发到云端和APP. | |
| TG_PUBLIC int | TciSendLiveMessage (int channel, int stream, RTMTYPE type, unsigned int data1, unsigned int data2, const void *data, int data_len) |
| 发送实时流消息. | |
| TG_PUBLIC int | TciSendRtMsg (p2phandle_t handle, RTMTYPE type, unsigned int data1, unsigned data2, const void *extra_data, int extra_len) |
| 在命令通道上发送通知. | |
用户定义云上传 | |
| #define | TciUduBegin(evt, tRecordStart) |
| void * | TciUduBegin2 (const char *evt, time_t tRecordStart, const char *jpg_pic, int pic_len) |
| 开始一个用户定义上传. | |
| TG_PUBLIC int | TciUduPutFrame (void *hUdu, TCMEDIA mt, uint32_t ts, const uint8_t *pFrame, int size, int uFrameFlags) |
| 自定义上传过程,写入帧. | |
| TG_PUBLIC void | TciUduEnd (void *hUdu) |
| 结束自定义上传 | |
探鸽云SDK接口申明
在文件 TgCloudApi.h 中定义.
| struct TgfDest::to_file |
数据下载到文件
在文件 TgCloudApi.h 第 448 行定义.
| 成员变量 | ||
|---|---|---|
| char * | path | IN: file path |
| struct TgfDest::to_mem |
数据下载到内存
在文件 TgCloudApi.h 第 452 行定义.
| 成员变量 | ||
|---|---|---|
| void * | mem | OUT: 指向sdk分配的内存 |
| int | size | OUT: 数据长度 |