Aldebaran documentation What's new in NAOqi 2.4.3?

ALUserSession - API

NAOqi Core - Overview | API | Getting Started


Namespace : AL

Event list

ALMemory Keys list

Methods

bool ALUserSession::doesUserExist(int userID) const

Checks if UserSession ID exist in database.

Parameters:
  • userID – the UserSession ID to check.
Returns:

True if the user exists, False otherwise.

bool ALUserSession::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, False otherwise.

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

Gets all UserSession IDs in the database.

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

Gets the number of users in the database.

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

Gets which user has the robot focus.

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

Gets which users have an open session.

Returns:the UserSession IDs of the users with an open session.
bool ALUserSession::isUserSessionOpen(int userID) const

Checks if a given UserSession ID has an open session.

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

True if the user has an open session, False otherwise.

bool ALUserSession::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, False otherwise.

int ALUserSession::getUsidFromPpid(int ppID) const

Gets the UserSession ID of a given PeoplePeople ID.

Parameters:
  • ppID – PeoplePerception ID of the person to check.
Returns:

the UserSession ID of the corresponding user if it exists, -1 otherwise.

int ALUserSession::getPpidFromUsid(int userID) const

Gets the PeoplePerception ID of a given UserSession ID.

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

the PeoplePerception ID of the given user if it exists, -1 otherwise.

std::list<std::string> ALUserSession::getBindingList() const

Gets the list of bindings that have been applied to UserSession.

Returns:the names of the bindings.
bool ALUserSession::doesBindingExist(const std::string bindingName) const

Queries if a particular binding has been applied to UserSession.

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

True if a binding exists, False otherwise.

bool ALUserSession::isUserPermanent(int userID) const

Checks if a given UserSession ID is permanent.

Parameters:
  • userID – UserSession IDs of the user to check.
Returns:

True if the user is permanent, False otherwise.

bool ALUserSession::areUsersPermanent(const std::list<int> userIDs) const

Checks if UserSession IDs are permanent.

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

True if all the users are permanent, False otherwise.

std::vector<int> ALUserSession::getPermanentUserList() const

Gets the list of permanent UserSession IDs.

Returns:List of permanent UserSession IDs.
std::map<std::string, std::string> ALUserSession::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 ALUserSession::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> ALUserSession::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.

std::string ALUserSession::getUserCreationDate(const int userID) const

Gets the date of the creation of a given UserSession ID.

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

The date of the creation of the user. The format of the date is from posix_time:ptime (day+time) turned into a simple string.

std::string ALUserSession::getFirstEncounterDate(const int userID) const

Gets the date of the first encounter of a given UserSession ID with the robot.

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

The date of the first encounter of the user with the robot. The format of the date is from posix_time:ptime (day+time) turned into a simple string. This date is an empty string if the user has never encountered the robot.

std::string ALUserSession::getCurrentEncounterDate(const int userID) const

Gets the date of the current encounter of a given UserSession ID with the robot.

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

The date of the current encounter of the user with the robot. The format of the date is from posix_time:ptime (day+time) turned into a simple string. This date is an empty string if the user does not have an open session.

std::string ALUserSession::getLastEncounterDate(const int userID) const

Gets the date of the last encounter of a given UserSession ID with the robot.

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

The date of the last encounter of the user with the robot. It corresponds to date of the last closed session of the user. The format of the date is from posix_time:ptime (day+time) turned into a simple string. This date is an empty string if the user has never encountered the robot.

int ALUserSession::getSecondsSinceLastEncounter(const int userID) const

Gets the number seconds since the last encounter of a given UserSession ID with the robot.

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

The number of seconds since the last encounter of the user with the robot. It corresponds to the number of seconds since the last closed session of the user. If the user has never encountered the robot, it returns -1. If it is the first time the user encounters the robots, it returns 0.

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

Deprecated since version 2.2: Please use ALUserSession::getBindingList instead.

bool ALUserSession::doesBindingSourceExist(const std::string bindingName) const

Deprecated since version 2.2: Please use ALUserSession::doesBindingExist instead.

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

Deprecated since version 2.2: User data source mechanism has been removed.

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

Deprecated since version 2.2: User data source mechanism has been removed.

AL::ALValue ALUserSession::getUserData(const int userID, const std::string dataName, const std::string sourceName)

Deprecated since version 2.2: Please use ALUserInfo API instead.

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

Deprecated since version 2.2: Please use ALUserInfo API instead.

Signals

qi::Signal<std::vector<int>> ALUserSession::createdUsers

Sent when new users are created in the UserSession database.

  • std::vector<int> IDs: a vector with the UserSession IDs of all the created users.
qi::Signal<std::vector<int>> ALUserSession::deletedUsers

Sent when users are deleted in the UserSession database.

  • std::vector<int> IDs: a vector with the UserSession IDs of all the deleted users.
qi::Signal<std::vector<int>> ALUserSession::openedSessions

Sent when sessions are opened for users.

  • std::vector<int> IDs: a vector with the UserSession IDs of the users whose session have been opened.
qi::Signal<std::vector<int>> ALUserSession::closedSessions

Sent when sessions are closed for users.

  • std::vector<int> IDs: a vector with the UserSession IDs of the users whose session have been closed.
qi::Signal<int> ALUserSession::focusedUser

Sent when a user is focused.

  • int ID: UserSession ID of the focused user, -1 if no user is focused anymore.
qi::Signal<bool> ALUserSession::noOpenSession

Sent when there are no open sessions and when it is not the case anymore.

  • bool state: True if there are no open sessions, False if it is not the case anymore.
qi::Signal<std::vector<int>> ALUserSession::addedPermanentUsers

Sent when permanent users are added.

  • std::vector<int> IDs: a vector with the UserSession IDs of the added permanent users.
qi::Signal<std::vector<int>> ALUserSession::removedPermanentUsers

Sent when permanent users are removed.

  • std::vector<int> IDs: a vector with the UserSession IDs of the removed permanent users.

Events

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.

Event: "UserSession/CreatedUsers"
callback(std::string eventName, AL::ALValue userSessionIDs, std::string subscriberIdentifier)

Deprecated since version 2.3: Please use signal ALUserSession::createdUsers instead.

Parameters:
  • eventName (std::string) – “UserSession/CreatedUsers”
  • userSessionIDs – A list of the UserSession IDs of all the created 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)

Deprecated since version 2.3: Please use signal ALUserSession::deletedUsers instead.

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)

Deprecated since version 2.3: Please use signal ALUserSession::openedSessions instead.

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)

Deprecated since version 2.3: Please use signal ALUserSession::closedSessions instead.

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)

Deprecated since version 2.3: Please use signal ALUserSession::noOpenSession instead.

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)

Deprecated since version 2.3: Please use signal ALUserSession::focusedUser instead.

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.

ALMemory Keys

AL::ALValue UserSession/OpenSessions

Deprecated since version 2.3: Please use method ALUserSession::getOpenUserSessions instead.

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