ALUserSession API

NAOqi Core - Overview | API

Getting Started 1 - Activity Developer | Getting Started 2 - User Data Provider Developer


Namespace : AL

#include <alproxies/alusersessionproxy.h>

ALMemory Keys list

Methods

bool ALUserSessionProxy::doUsersExist(const std::list<int> userIDs) const

Checks if UserSession IDs exist in database.

Parameters:
  • userIDs – the UserSession IDs to check.
Returns:

true if all users exist, else false.

std::list<int> ALUserSessionProxy::getUserList() const

Gets all UserSession IDs in the database.

Returns:a list of the integer UserSession IDs.
int ALUserSessionProxy::getNumUsers() const

Gets the number of users in the database.

Returns:the number of users.
int ALUserSessionProxy::getFocusedUser() const

Gets which user has the robot focus.

Returns:The UserSession ID of the focused user if there is one, or -1 if no user is focused.
std::list<int> ALUserSessionProxy::getOpenUserSessions() const

Gets which users have an open session.

Returns:the UserSession IDs of the users with an open session.
bool ALUserSessionProxy::areUserSessionsOpen(const std::list<int> userIDs) const

Checks if UserSession IDs have an open session.

Parameters:
  • userIDs – A list of int UserSession IDs of each user to check.
Returns:

true if all users have open sessions, else false.

std::list<std::string> ALUserSessionProxy::getBindingSources() const

Gets the list of binding sources that have been applied to UserSession.

Returns:the names of the binding sources.
bool ALUserSessionProxy::doesBindingSourceExist(const std::string bindingName) const

Queries if a particular binding source has been applied to UserSession.

Parameters:
  • bindingName – name of the binding source.
Returns:

true if a binding source exists, else false.

std::map<std::string, std::string> ALUserSessionProxy::getUserBindings(const int userID) const

Gets the sources a UserSession ID is bound to.

Parameters:
  • userID – UserSession ID of the user.
Returns:

A map of binding sources names and their bound ID.

std::string ALUserSessionProxy::getUserBinding(const int userID, const std::string bindingName) const

Gets the specific source a UserSession ID is bound to.

Parameters:
  • userID – UserSession ID of the user.
  • bindingName – The name of the binding source.
Returns:

Bound ID for the specified user ID and binding source.

std::list<int> ALUserSessionProxy::findUsersWithBinding(const std::string bindingName, const std::string bindingValue) const

Gets the sources a User Session ID is bound to.

Parameters:
  • bindingName – The name of the binding source.
  • bindingValue – The string bound ID of the user at the binding source.
Returns:

The int UserSession IDs of the users with the passed bindingValue.

bool ALUserSessionProxy::doesUserDataSourceExist(const std::string sourceName) const

Checks if a data source has been registered.

Parameters:
  • sourceName – Name of the data source.
Returns:

True if the source has been registered, else false.

std::list<std::string> ALUserSessionProxy::getUserDataSources() const

Gets all registered data sources.

Returns:Names of the registered data sources.
AL::ALValue ALUserSessionProxy::getUserData(const int userID, const std::string dataName, const std::string sourceName)

Gets a specific data about a UserSession ID, for a specific source. Will throw if the specified data type does not exist.

Parameters:
  • userID – UserSession ID of the user whose data to get.
  • dataName – key of the data to get.
  • sourceName – name of the data source.
Returns:

User data for the specified data and source names.

std::map<std::string, AL::ALValue> ALUserSessionProxy::getUserData(const int userID, const std::string dataName)

Gets a specific data about a user, for all sources. Will throw if the specified data type does not exist.

Parameters:
  • userID – User Session ID of the user whose data to get.
  • dataName – key of the data to get.
Returns:

A map which is keyed by the data source name, with the value as the user data.

Events

Event: "UserSession/CreatedUsers"
callback(std::string eventName, AL::ALValue userSessionIDs, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/CreatedUsers”
  • userSessionIDs – A list of the UserSession IDs of all the deleted user sessions.
  • subscriberIdentifier (std::string) –

This event is raised when Users are created in the UserSession database. This could be raised if Autonomous Life thinks the robot just met someone it hasn’t seen before.

Event: "UserSession/DeletedUsers"
callback(std::string eventName, AL::ALValue userSessionIDs, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/DeletedUsers”
  • userSessionIDs – A list of the UserSession IDs of all the deleted user sessions.
  • subscriberIdentifier (std::string) –

This event is raised when Users are deleted from the UserSession database. This could be raised if Autonomous Life is pruning users.

Event: "UserSession/SessionsOpened"
callback(std::string eventName, AL::ALValue userSessionIDs, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/SessionsOpened”
  • userSessionIDs – A list of the UserSession IDs of all newly opened user sessions.
  • subscriberIdentifier (std::string) –

This event is raised when user sessions are opened. It is possible to open multiple sessions simultaneously.

Sessions are opened when a UserSession ID is tracked by Basic Awareness.

Event: "UserSession/SessionsClosed"
callback(std::string eventName, AL::ALValue userSessionIDs, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/SessionsClosed”
  • userSessionIDs – A list of the UserSession IDs of all newly closed user sessions.
  • subscriberIdentifier (std::string) –

This event is raised when user sessions are closed. It is possible to close multiple sessions simultaneously.

A session is closed when the corresponding person is no longer perceived by people perception.

Event: "UserSession/NoOpenSessions"
callback(std::string eventName, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/NoOpenSessions”
  • open – True when no user sessions are open, false if any user sessions are open.
  • subscriberIdentifier (std::string) –

This event is raised when the number of open user sessions transitions from zero to any or any to zero.

Event: "UserSession/FocusedUser"
callback(std::string eventName, int userID, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/FocusedUser”
  • userSessionID – UserSession ID of the focused user, or -1 if no user is focused.
  • subscriberIdentifier (std::string) –

This event is raised when the focused user changes.

Event: "UserSession/ShouldExitInteractiveActivity"
callback(std::string eventName, bool shouldExit, std::string subscriberIdentifier)
Parameters:
  • eventName (std::string) – “UserSession/ShouldExitInteractiveActivity”
  • shouldExit – Always raised as true. The only meaning is in the timing of the event its self.
  • subscriberIdentifier (std::string) –

This event is raised when ALAutonomousLife thinks that there is nobody to interact with, and recommends that the current Interactive Activity exits.

ALMemory Keys

AL::ALValue UserSession/OpenSessions

A list of the UserSession IDs of all currently open user sessions.