floo::BMXUserServiceListener
User state listener
#include <bmx_user_service_listener.h>
Public Functions
Name | |
---|---|
BMXUserServiceListener() Constructor |
|
virtual | ~BMXUserServiceListener() Destructor |
virtual void | onConnectStatusChanged(BMXConnectStatus status) Channel state changed |
virtual void | onUserSignIn(BMXUserProfilePtr profile) User login |
virtual void | onUserSignOut(BMXErrorCode error, int64_t userId) User logout |
virtual void | onInfoUpdated(BMXUserProfilePtr profile) Synchronize user information updates (when user information changes in other devices) |
virtual void | onOtherDeviceSingIn(int deviceSN) User login on another device |
virtual void | onOtherDeviceSingOut(int deviceSN) User logout on another device |
void | registerUserService(BMXUserService * service) Register BMXUserService to which BMXUserServiceListener is bound (automatic registration in SDK) |
Protected Attributes
Name | |
---|---|
BMXUserService * | mService |
Public Functions Documentation
function BMXUserServiceListener
inline BMXUserServiceListener()
Constructor
Example:
function ~BMXUserServiceListener
inline virtual ~BMXUserServiceListener()
Destructor
Example:
function onConnectStatusChanged
inline virtual void onConnectStatusChanged(
BMXConnectStatus status
)
Channel state changed
Parameters:
- status Connection state
Example:
void UserListener::onConnectStatusChanged(BMXConnectStatus status) {
draw_notify(notifyWindow);
mvwaddstr(notifyWindow, 1, 1, "UserListener onConnectStatusChanged");
switch (status) {
case BMXConnectStatus::Disconnected:
mvwaddstr(notifyWindow, 2, 1, "Disconnected");
break;
case BMXConnectStatus::Connected:
mvwaddstr(notifyWindow, 2, 1, "Connected");
break;
default:
break;
}
touchwin(stdscr);
refresh();
function onUserSignIn
inline virtual void onUserSignIn(
BMXUserProfilePtr profile
)
User login
Parameters:
- profile User profile
Example:
void UserListener::onUserSignIn(BMXUserProfilePtr profile) {
draw_notify(notifyWindow);
mvwaddstr(notifyWindow, 1, 1, "UserListener onUserSignIn");
touchwin(stdscr);
refresh();
function onUserSignOut
inline virtual void onUserSignOut(
BMXErrorCode error,
int64_t userId
)
User logout
Parameters:
- error State error code
Example:
void UserListener::onUserSignOut(BMXErrorCode error) {
draw_notify(notifyWindow);
mvwaddstr(notifyWindow, 1, 1, "UserListener onUserSignOut");
touchwin(stdscr);
refresh();
function onInfoUpdated
inline virtual void onInfoUpdated(
BMXUserProfilePtr profile
)
Synchronize user information updates (when user information changes in other devices)
Parameters:
- profile User profile
Example:
function onOtherDeviceSingIn
inline virtual void onOtherDeviceSingIn(
int deviceSN
)
User login on another device
Parameters:
- deviceSN Device serial number
Example:
void UserListener::onOtherDeviceSingIn(int deviceSN) {
draw_notify(notifyWindow);
mvwaddstr(notifyWindow, 1, 1, "UserListener onOtherDeviceSingIn");
mvwaddstr(notifyWindow, 2, 1, std::to_string(deviceSN).c_str());
touchwin(stdscr);
refresh();
function onOtherDeviceSingOut
inline virtual void onOtherDeviceSingOut(
int deviceSN
)
User logout on another device
Parameters:
- deviceSN Device serial number
Example:
void UserListener::onOtherDeviceSingOut(int deviceSN) {
draw_notify(notifyWindow);
mvwaddstr(notifyWindow, 1, 1, "UserListener onOtherDeviceSingOut");
mvwaddstr(notifyWindow, 2, 1, std::to_string(deviceSN).c_str());
touchwin(stdscr);
refresh();
function registerUserService
inline void registerUserService(
BMXUserService * service
)
Register BMXUserService to which BMXUserServiceListener is bound (automatic registration in SDK)
Parameters:
- service BMXUserService
Protected Attributes Documentation
variable mService
BMXUserService * mService;
Example:
Updated on 2022-01-26 at 17:20:40 +0800