Updated on 2024-09-13 GMT+08:00

Setting Login Server Information

SetServerAddress

API Description

This API is used to set login server information.

Precautions

  1. This API is optional. By default, the default login server address and port are used.
  2. This API is an asynchronous API. The return value only indicates whether the API is successfully called. The actual service processing result is returned in the corresponding callback function.

Method Definition

HWM_SDK_AGENT_API hwmsdk::HwmErrCode SetServerAddress(const HwmServerInfo* serverInfo);

Callback Function

virtual void OnSetServerAddressResult(hwmsdk::HwmErrCode ret, const char* reason) {};

Parameter Description

Table 1 HwmServerInfo description

Parameter

Mandatory

Type

Description

serverAddr

No

char[]

Server address. The default value is meeting.huaweicloud.com.

serverPort

No

unsigned short

Server port. The default value is 443.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
*  Set the login server information.
*/
void demoSetServerAddressDlg::SetServerAddress()
{
    CString serverCString;
    CString portCString;
    m_serverEdit.GetWindowText(serverCString);
    m_portEdit.GetWindowText(portCString);

    hwmsdkagent::HwmServerInfo serverInfo{};
    string server = CTools::UNICODE2UTF(serverCString.GetString());
    strncpy_s(serverInfo.serverAddr, server.c_str(), HWM_MAX_URL_LEN);
    serverInfo.serverPort = _ttoi(portCString);
    int ret = hwmsdkagent::SetServerAddress(&serverInfo);
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("set server address error"));
        return;
    }
    CDialogEx::OnOK();
}