Updated on 2024-07-30 GMT+08:00

Obtaining a User Status

GetUserState

API Description

This API is used to obtain the status of the current user terminal.

Precautions

  1. 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

1
HWM_SDK_AGENT_API hwmsdk::HwmErrCode GetUserState();

Callback Function

1
virtual void OnGetUserStateResult(hwmsdk::HwmErrCode ret, const char* reason, HwmUserState userState) {};

Parameter Description

Table 1 Enumerated values of HwmUserState

Enumerated Value

Description

HWM_STATE_IDLE

The user is idle.

HWM_STATE_IN_CONF

The user is in the meeting.

HWM_STATE_IN_CALL

The user is being called.

Return Values

Table 2 Return values

Type

Description

HwmErrCode

If 0 is returned, the operation is successful. If other values are returned, the operation fails. For details about values returned upon failures, see Common Error Codes.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
/**
* Obtaining user status
*/
void demoSetUserSavePathDlg::OnBnClickedGetUserState()
{
    int ret = hwmsdkagent::GetUserState();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("Get user state failed"));
    }
}