华为云会议 MEETING-场景2:登录:示例代码

时间:2024-04-22 14:27:12

示例代码

 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);
}
support.huaweicloud.com/sdkreference-meeting/windows_initialize.html