场景3:预约会议
描述
在使用华为云会议账号登录后,可以调用预约会议接口预约会议。预约会议时,除了填写预约会议所需的会议参数以外,还可以添加与会者。
业务流程
调用BookConf接口预约会议,然后处理回调函数OnBookConfResult和OnConfList通知。
若要预约个人会议ID的会议或者云会议室的会议,则需要先调用GetVmrList接口查询个人会议ID和云会议室信息,然后处理回调函数OnGetVmrList返回的数据,该数据可用于预约会议。
示例代码
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 |
/** * 预约会议 */ int CdemoBookConfDlg::OnBnClickedBookConf() { hwmsdkagent::HwmBookConfParam data = {0}; string confSubject = u8"我的预约会议"; // 此处应是utf-8编码字符串 strncpy_s(data.subject, confSubject.c_str(), HWM_MAX_SUBJECT_LEN); data.confType = hwmsdkagent::HwmConfMediaType::HWM_VIDEO_AND_DATA; data.isNeedConfPwd = true; data.isRecordOn = false; //默认会议不开启允许录制 data.isAutoRecordOn = false; //默认会议不开启自动录制 data.startTime = 1598398920; //utc时间戳,单位秒,如果获取的时间是本地时间,需要转换成utc时间 data.duration = 30; //会议持续时长(分钟) data.timeZone = 56; //时区,56表示东八区 data.joinConfRestrictionType = hwmsdkagent::HwmJoinConfPermissionType::RESTRICTION_CALL_IN_ALL; std::vector<hwmsdkagent::HwmAttendeeInfo> attendeeList; //被邀与会者 hwmsdkagent::HwmAttendeeInfo attendeeInfo = { 0 }; strncpy_s(attendeeInfo.name, GetAttName().c_str(), HWM_MAX_USER_NAME_LEN); strncpy_s(attendeeInfo.number, GetAttNumber().c_str(), HWM_MAX_NUMBER_LEN); strncpy_s(attendeeInfo.email, GetAttEmail().c_str(), HWM_MAX_EMAIL_LEN); strncpy_s(attendeeInfo.sms, GetAttSms().c_str(), HWM_MAX_PHONE_NUM_LEN); strncpy_s(attendeeInfo.thirdUserId, GetAttUserId().c_str(), HWM_MAX_USER_ID_LEN); attendeeInfo.isMute = true; attendeeInfo.isAutoInvite = true; attendeeList.push_back(attendeeInfo); data.attendees = attendeeList.data(); data.attendeeLen = attendeeList.size(); data.isSmsOn = true; data.isMailOn = true; data.isEmailCalendarOn = true; return hwmsdkagent::BookConf(&data); } |
1 2 3 4 5 6 7 8 9 10 11 |
/** * 预约会议接口回调 */ void demoCallbackProc::OnBookConfResult(hwmsdk::HwmErrCode ret, const char* msg) { CString codeStr; codeStr.Format(_T("%d"), ret); string msgStr = CTools::UTF82MultiByte(msg); CString tips = _T("OnBookConfResult code:") + codeStr + _T(", msg:") + CString(msgStr.c_str()); AfxMessageBox(tips); } |
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 |
/** * 会议列表信息通知 */ void demoNotifyProc::OnConfList(HwmConflistUpdateType updateType, const HwmConfListInfo* confInfoList, unsigned int confInfoLen) { if (confInfoLen <= 0 || confInfoList == nullptr) { return; } //登录成功后全量返回会议列表 if (updateType == CONFLIST_UPDTAE_ALL) { //处理全量会议列表 } else { if (updateType == CONFLIST_UPDATE_ADD) { //处理新增的会议或被编辑的会议 } else if (updateType == CONFLIST_UPDATE_DELETE) { //处理取消的会议 } } CString tips = _T("OnConfList"); for (int i = 0; i < confInfoLen; i++) { CString strConfId = CTools::UTF2UNICODE(confInfoList->confId); CString strConfSubject = CTools::UTF2UNICODE(confInfoList->confSubject); CString tip = _T(", confId:") + CString(strConfId) + _T(", subject:") + CString(strConfSubject); tips += tip; confInfoList++; } AfxMessageBox(tips); } |