Updated on 2023-03-23 GMT+08:00

Scenario 6: Creating a Meeting

Description

After logging in to Huawei Cloud Meeting using a Huawei Cloud Meeting account, you can call the API for creating an instant meeting. Participant information is optional.

Service Process

To schedule a meeting using a personal meeting ID or a cloud meeting room, call the GetVmrList API to query the personal meeting ID and cloud meeting room information, and then process the data returned by the OnGetVmrList function. The data can be used to schedule the meeting.

When using the SDK to create an instant meeting, call the CreateConf API, and then implement the OnCreateConfResult, OnConfState, and OnConfInfo functions.

  1. Call the API.

    1. Assemble the HwmCreateConfInfo data structure.
    2. Assemble the HwmConfAttendee data structure.
    3. Call the CreateConf API to create a meeting. The data in preceding steps is used as input parameters.

  2. Implement the callback function.

    Implement the OnCreateConfResult function.

  3. Implement the notification function.

    Implement the OnConfState function.

  4. Implement the notification function.

    Implement the OnConfInfo function.

  5. Implement the notification function.

    Implement the OnConfList function.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Create a meeting.
*/
int demoCreateConfWithAttendeeDlg::clickCreatConfWithAttendee()
{
    int ret;
    hwmsdkagent::HwmCreateConfInfo data;
    memset(&data, 0, sizeof(hwmsdkagent::HwmCreateConfInfo));
    
    // Set the meeting topic.
    string meetingSubjectStr = CTools::UNICODE2UTF(CString("My meeting"));
    strncpy_s(data.subject, meetingSubjectStr.c_str(), HWM_MAX_SUBJECT_LEN);
    // Set the meeting type.
    data.mediaType = hwmsdkagent::HWM_VIDEO_AND_DATA
    // Set whether the guest password is required for the meeting.
    data.needPassword = true;
    data.callInRestriction = hwmsdkagent::RESTRICTION_CALL_IN_ALL;
    // Configure vmrId. To create a meeting with a random ID, leave vmrId empty. Here, m_confIdTypeCombo indicates that a meeting with a random ID is preferentially created.
    // Therefore, vmrIdSelect > 0 indicates the personal meeting ID or a cloud meeting room ID is used.
    const auto vrmIdSelect = m_confIdTypeCombo.GetCurSel();
    if (vrmIdSelect > 0 && vrmIdSelect - 1 < vmrList.size())
    {
        strcpy_s(data.vmrId, HWM_MAX_VMR_CONF_ID_LEN, vmrList[vrmIdSelect - 1].vmrId);
    }

    
    // Set participants.
    // Obtain participant details based on site requirements.
    CString tempCString;
    m_attendeesEdit.GetWindowText(tempCString);
    string tempString = CTools::UNICODE2UTF(tempCString);
    vector<string> list = CTools::split(tempString, ';');
    vector<string> temp;
    int count = list.size();
    int realCount = 0;
    if (count > 0)
    {
        // Apply for the structure memory.
        hwmsdkagent::HwmConfAttendee* participants;
        participants = (hwmsdkagent::HwmConfAttendee*)malloc(sizeof(hwmsdkagent::HwmConfAttendee) * count);
        if (participants == NULL)
        {
            return -1;
        }
        memset(participants, 0, sizeof(hwmsdkagent::HwmConfAttendee)*count);
 
        hwmsdkagent::HwmConfAttendee* participantsTemp = participants;
        for (int i = 0; i < count; i++)
        {
            temp = CTools::split(list[i], '-');
            if (temp.size() == 2)
            {
                // Assign a value to name.
                strncpy_s(participantsTemp->name, (char *)temp[0].c_str(), HWM_MAX_DISPLAY_NAME_LEN);
                // Assign a value to number.
                strncpy_s(participantsTemp->number, (char *)temp[1].c_str(), HWM_MAX_NUMBER_LEN);
                // Increase the number of pointers by 1.
                realCount++;
                participantsTemp++;
            }
        }
        // Call the SDK API to create the meeting.
        ret = hwmsdkagent::CreateConf(&data, participants, realCount);
 
        // Release memory space.
        free(participants);
        participants = NULL;
    }
    else
    {
        // Create a meeting without specifying participants.
        ret = hwmsdkagent::CreateConf(&data, NULL, 0);
    }
    return ret;
}

Character string parameters, such as the meeting topic and participant name, in Windows SDK APIs. These parameters must be encoded in UTF-8. Otherwise, an error will be reported.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/**
* Callback of the API for creating a meeting
*/
void demoCallbackProc::OnCreateConfResult(hwmsdk::HwmErrCode ret, const char* msg)
{
    CString codeStr;
    codeStr.Format(_T("%d"), ret);
    string msgStr = CTools::UTF82MultiByte(msg);
    CString tips = _T("OnCreateConfResult code:") + codeStr + _T(", msg:") + CString(msgStr.c_str());
    AfxMessageBox(tips);
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Meeting status notification
*/
void demoNotifyProc::OnConfState(HwmConfStateInfo *confStateInfo)
{
    CString str;
    str.Format(_T("%d"), confStateInfo->state);
    CString reason;
    reason.Format(_T("%d"), confStateInfo->reason);
    CString tips = _T("OnConfState state:") + str + _T(", reason:")+ reason;
    AfxMessageBox(tips);
 
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Meeting details notification
*/
void demoNotifyProc::OnConfInfo(HwmConfInfo *confInfo)
{
    string urlStr = CTools::UTF82MultiByte(confInfo->url);
    string confIdStr = CTools::UTF82MultiByte(confInfo->confId);
    string chairmanPwdStr = CTools::UTF82MultiByte(confInfo->chairmanPwd);
    string generalPwdStr = CTools::UTF82MultiByte(confInfo->generalPwd);
    string subjectStr = CTools::UTF82MultiByte(confInfo->subject);
 
    CString role;
    role.Format(_T("%d"), confInfo->role);
 
    CString tips = _T("OnConfInfo confUrl:") + CString(urlStr.c_str())
        + _T(", confId:") + CString(confIdStr.c_str()) + _T(", confRole:") + CString(role) 
        + _T(", chairmanPwd:") + CString(chairmanPwdStr.c_str())
        + _T(", generalPwd:") + CString(generalPwdStr.c_str())
        + _T(", subject:") + CString(subjectStr.c_str());
    AfxMessageBox(tips);
}

The OnConfList event notification scenario is the same as the meeting scheduling scenario. For details, see Sample Code.

Character strings in Windows SDK functions are encoded in UTF-8.