Tange Cloud for Device
 Rev.362
载入中...
搜索中...
未找到
wx.h
浏览该文件的文档.
1/** \file wx.h
2 */
3#pragma once
4
5#include "basedef.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11TG_PUBLIC extern int _wx_debug;
12
13#if 0
14/** 设备端使用 wxInit2() */
15int _wxInit(const char *data_path, const char *app_id, const char *model_id);
16
17
18/** 初始化微信voip模块.
19 * @data_path 非易失可写路径,用于保存wxvoip 的注册文件
20 * @note 在 on_status(STATUS_UPDATESERVICE, ...) 回调里收到 ECGS_TYPE_WXVOIP
21 * 服务并且在有效期时调用本接口
22 */
23int _wxInit2(const char *data_path);
24#endif
25
26/** 注册微信Voip模块. 在TciStart()前调用 */
27TG_PUBLIC int wxInit(void);
28
29
30/** Wx VoIP 用户 */
31struct WxUser {
32 char openid[48]; ///< 用户标识
33 char nickname[32]; ///< 昵称
34};
35/** 获取呼叫对象列表.
36 * @param ppWxUser 成功时*ppWxUser中返回用户数组指针,调用者要用 free() 释放
37 * @param pNUsers 成功时*pNUsers返回数组大小
38 * @return 0:成功;其它:错误码定义在 ec_const.h
39 *
40 * @note - 使用带key的uuid,才会返回 nickname
41 * - 使用自己的帐号体系的用户需要使用自己的方式获取呼叫对象,不能调用此接口.
42 */
43TG_PUBLIC int wxGetUsers(struct WxUser **ppWxUser, int *pNUsers);
44
45/** 微信voip内部通知回调.
46 * @param type 类型.见下表
47 * @param data \c type 相关的数据
48 * @param len \c data 指向数据的大小
49 * @return <0 意味出错. >=0表示正常处理, 具体值看下表
50 *
51 * @note
52 * - 获取/更新 sn_ticket. 使用自己的帐号体系的用户才需要实现
53 * - \c type = 0
54 * - \c data 缓冲区用于返回 sn_ticket 字符串, 包括结尾的 \0
55 * - \c len data 指向的缓冲区长度
56 * - 返回值: 成功时,返回 sn_ticket的长度 + 1,否则返回-1
57 * - 说明: 如果不是遇到不可恢复错误(例如帐号无效),该操作应该反复重试直到成功
58 */
59typedef int (*TGWXVOIPCALLBACK)(int type, void *data, int len);
60
61/** 设置回调.
62 * @note 用于使用自用帐号体系的用户。
63 */
65
66/** 呼叫小程序
67 * @param openid 小程序用户标识。
68 * @param openid 小程序用户标识
69 * @param timeout 呼叫超时设置,单位:秒. 取值15~60
70 * @return 参看 wx_err.h
71 * @note 呼叫前要通过别的方式获取到设备可以呼叫的用户列表(通讯录),然后引导操作者 \n
72 * 选择(手动, 或通过人脸识别或刷卡等身份识别方式确定操作者绑定的)呼叫对象.
73 */
74TG_PUBLIC int wxCall2(const char *openid, int timeout);
75TG_PUBLIC int wxCall(const char *openid);
76
77/** 取消小程序外呼或挂断通话 */
78TG_PUBLIC int wxCancelCall();
79
80/** 反初始化wxvoip模块 */
81TG_PUBLIC void wxUninit(void);
82
83TG_PUBLIC const char *wxGetErrStr(int err);
84
85//#define WX_E_CALL_HAS_GONE -30001 ///< wxAnswer/wxReject: 呼入已无效
86#ifdef __cplusplus
87} /* extern "C" */
88#endif
TG_PUBLIC int wxInit(void)
注册微信Voip模块.
TG_PUBLIC void wxUninit(void)
反初始化wxvoip模块
int(* TGWXVOIPCALLBACK)(int type, void *data, int len)
微信voip内部通知回调.
定义 wx.h:59
TG_PUBLIC int wxCancelCall()
取消小程序外呼或挂断通话
char nickname[32]
昵称
定义 wx.h:33
TG_PUBLIC int wxCall2(const char *openid, int timeout)
呼叫小程序
TG_PUBLIC void wxSetCallback(TGWXVOIPCALLBACK cb)
设置回调.
char openid[48]
用户标识
定义 wx.h:32
TG_PUBLIC int wxGetUsers(struct WxUser **ppWxUser, int *pNUsers)
获取呼叫对象列表.
Wx VoIP 用户
定义 wx.h:31