ALUserSession - Getting Started¶
NAOqi Core - Overview | API | Getting Started
If you are developing an Activity that wants to take advantage of persistent user data, this is for you.
Monitoring the state of users’ sessions¶
At any time, if you want to know what sessions are currently open, use the method
ALUserSession::getOpenUserSessions
.
You can also monitor continously the opening and closing of sessions with the signals
ALUserSession::openedSessions
and ALUserSession::closedSessions
.
Monitoring the focused user¶
At any time, if you want to know who is the currently focused user, use the method
ALUserSession::getFocusedUser
.
You can also monitor continously the changes of focused user with the signal
ALUserSession::focusedUser
.
Getting/Setting user data¶
Specific data about users can be stored or accessed using their UserSession IDs via ALUserInfo API.
Using user sessions to exit an activity¶
If your Activity offers no functionality when there is nobody to talk to,
you could decide to exit it when the event UserSession/ShouldExitInteractiveActivity()
is raised.
Handling the anonymous user¶
If the focused user is 0, they are the anonymous user, meaning ALAutonomousLife failed to identify them. Usually this is because a good facial image could not be acquired. ALAutonomousLife will try every 3 seconds to identify, or create an identification for this user. After that succeeds, the real user will be focused.
If your activity is in a state where it requires verifying accurately who the focused user is, you should ask the user to take a good look at the robot.