Updated on 2025-07-28 GMT+08:00

Obtaining the Login Status

API Description

This API is used to obtain the login status.

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 GetLoginState();

Callback Function

1
virtual void OnGetLoginStateResult(hwmsdk::HwmErrCode ret, const char* reason, const HwmLoginStateInfo* loginStateInfo) {};

Parameter Description

Table 1 HwmLoginStateInfo description

Parameter

Type

Description

loginState

HwmLoginState

Login status.

Table 2 Enumerated values of HwmLoginState

Enumerated Value

Description

LOGIN_STATUS_UN_LOGIN

Logged out.

LOGIN_STATUS_LOGINING

Logging in.

LOGIN_STATUS_LOGINED

Logged in.

LOGIN_STATUS_LOGOUTING

Logging out.

1
2
3
4
5
6
7
8
9
/**
* Obtain the login status.
*/
int demoGetLoginStateDlg::GetLoginState()
{
    // Call the API for obtaining the login status.
    int ret = hwmsdkagent::GetLoginState();
    return ret;
}