更新时间:2024-04-22 GMT+08:00
分享

场景2:登录

描述

可用华为云会议账号或App ID或登录华为云会议。创建会议等接口不支持在未登录状态下调用,若要使用完整的会议功能,必须先登录华为云会议。

在未登录状态下,只能加入已经创建的会议。

业务流程

使用SDK登录时,先调用Login接口,然后处理回调函数OnLoginResult。

  1. 接口调用

    1. 组装数据结构HwmLoginInfo。
      1. 选择合适的登录类型。
      2. 根据登录类型给对应的变量赋值。
    2. 调用Login进行登录,第1步中的数据作为参数。

  2. 处理回调函数

    处理回调函数OnLoginResult。

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* 登录处理
*/
int demoLoginDlg::Login()
{
    int ret;
    //设置App ID登录参数
   /**
    *.此处省略第三方服务器做的数据转换,最后获取到nonce和signature
    */
    strncpy_s(loginParam.appIdAuthInfo.thirdUserId, GetUserId.c_str(), HWM_MAX_USER_ID_LEN);
    strncpy_s(loginParam.appIdAuthInfo.userName, GetUserName.c_str(), HWM_MAX_USER_NAME_LEN);
    strncpy_s(loginParam.appIdAuthInfo.signature, GetSignature().c_str(), HWM_MAX_SIGNATURE_LEN);
    strncpy_s(loginParam.appIdAuthInfo.nonce, GetNonce().c_str(), HWM_APPID_NONCE_LEN );
    strncpy_s(loginParam.appIdAuthInfo.email, GetEmail.c_str(), HWM_MAX_EMAIL_LEN);
    strncpy_s(loginParam.appIdAuthInfo.phoneNumber, GetPhoneNumber.c_str(), HWM_MAX_PHONE_NUM_LEN);
    loginParam.appIdAuthInfo.expireTime = 1598398920; // utc时间,单位s

    loginParam.authType = hwmsdkagent::HWM_AUTH_TYPE_APPID;
    //调用登录接口
    ret = hwmsdkagent::Login(&loginParam);

    return ret;
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/**
* 登录接口回调
*/
void demoCallbackProc::OnLoginResult(hwmsdk::HwmErrCode ret, const char* msg)
{
    CString codeStr;
    codeStr.Format(_T("%d"), ret);
    string msgStr = CTools::UTF82MultiByte(msg);
    CString tips = _T("OnLoginResult code:") + codeStr + _T(", msg:") + CString(msgStr.c_str());
    AfxMessageBox(tips);
}
分享:

    相关文档

    相关产品