Setting the Profile Picture Style
SetAvatarStyle
API Description
This API is used to set the profile picture style.
Precautions
- 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 SetAvatarStyle(const HwmAvatarStyle* avatarStyle); |
Callback Function
1
|
virtual void OnSetAvatarStyleResult(hwmsdk::HwmErrCode ret, const char* reason) {}; |
Parameter Description
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
backgroundColor |
Yes |
char[] |
Background color, in ARGB mode, for example, #ff59aaff. |
textColor |
Yes |
char[] |
Entity color, in ARGB mode, for example, #ffffffff. |
phoneIconPath |
Yes |
char[] |
Absolute path of the mobile phone icon. For example, to/path/image.svg. SVG and PNG formats are supported. UTF-8 encoding is required. |
boardIconPath |
Yes |
char[] |
Absolute path of the large display icon. For example, to/path/image.svg. SVG and PNG formats are supported. UTF-8 encoding is required. |
nameShowType |
No |
HwmNameShowType |
Name display style. |
avatarShape |
No |
HwmAvatarShape |
Profile picture shape. |
Enumerated Value |
Description |
---|---|
FIRST_LETTER |
For a Chinese name, the first letter in pinyin is displayed. For an English name, the first letter is displayed. |
FAMILY_NAME |
For a Chinese name, the family name is displayed. For an English name, the first letter is displayed. |
Enumerated Value |
Description |
---|---|
CIRCLE |
Circle. |
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 |
/** * Set the profile picture style. */ void demoSetAvatarStyleDlg::SetAvatarStyle() { hwmsdkagent::HwmAvatarStyle avatarStyle{}; CString contentCStr; m_editBKColor.GetWindowText(contentCStr); std::string content = CTools::UNICODE2UTF(contentCStr.GetString()); errno_t err = strcpy_s(avatarStyle.backgroundColor, sizeof(avatarStyle.backgroundColor), content.c_str()); m_editTextColor.GetWindowText(contentCStr); content = CTools::UNICODE2UTF(contentCStr.GetString()); err += strcpy_s(avatarStyle.textColor, sizeof(avatarStyle.textColor), content.c_str()); m_editPhoneIconPath.GetWindowText(contentCStr); content = CTools::UNICODE2UTF(contentCStr.GetString()); err += strcpy_s(avatarStyle.phoneIconPath, sizeof(avatarStyle.phoneIconPath), content.c_str()); m_editBoardIconPath.GetWindowText(contentCStr); content = CTools::UNICODE2UTF(contentCStr.GetString()); err += strcpy_s(avatarStyle.boardIconPath, sizeof(avatarStyle.boardIconPath), content.c_str()); if (err != S_OK) { AfxMessageBox(_T("String Copy Error!")); } unsigned int nameShowType = hwmsdkagent::HwmNameShowType::FIRST_LETTER; nameShowType = (unsigned int)m_comboboxNameShowType.GetCurSel(); avatarStyle.nameShowType = static_cast<hwmsdkagent::HwmNameShowType>(nameShowType); unsigned int avatarShape = hwmsdkagent::HwmAvatarShape::CIRCLE; avatarShape = (unsigned int)m_comboboxAvatarType.GetCurSel(); avatarStyle.avatarShape = static_cast<hwmsdkagent::HwmAvatarShape>(avatarShape); int ret = hwmsdkagent::SetAvatarStyle(&avatarStyle); return ret; } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot