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