ALBehaviorManager API

NAOqi Core - Overview | API


Namespace : AL


#include <alproxies/albehaviormanagerproxy.h>

Methods

void ALBehaviorManagerProxy::addDefaultBehavior(const std::string& prefixedBehavior)

Set the given behavior as default

Parameters:
  • behavior – Behavior name.
std::vector<std::string> ALBehaviorManagerProxy::getBehaviorTags(const std::string& behavior)

Get tags found on the given behavior. For more details about tags, see: ALAnimatedSpeech - Advanced

Parameters:
  • behavior – The local path towards a behavior or a directory.
Returns:

The list of tags found.

std::vector<std::string> ALBehaviorManagerProxy::getBehaviorsByTag(const std::string& tag)

Get installed behaviors directories names and filter it by tag. For more details about tags, see: ALAnimatedSpeech - Advanced

Parameters:
  • tag – A tag to filter the list with.
Returns:

Returns the behaviors list.

std::string ALBehaviorManagerProxy::getBehaviorNature(const std::string& behavior)

Get the nature of the given behavior. For more details about natures, see: Behavior property list

Parameters:
  • tag – Behavior name.
Returns:

Returns the nature name of the behavior.

std::vector<std::string> ALBehaviorManagerProxy::getDefaultBehaviors()

Get default behaviors

Returns: Return default behaviors
std::vector<std::string> ALBehaviorManagerProxy::getInstalledBehaviors()
Returns: Returns the behaviors list
std::vector<std::string> ALBehaviorManagerProxy::getLoadedBehaviors()

Get loaded behaviors

Returns: Returns loaded behaviors
std::vector<std::string> ALBehaviorManagerProxy::getRunningBehaviors()

Get running behaviors

Returns: Return running behaviors
std::vector<std::string> ALBehaviorManagerProxy::getTagList()

Get tags found on installed behaviors. For more details about tags, see: ALAnimatedSpeech - Advanced

Returns: The list of tags found.
bool ALBehaviorManagerProxy::isBehaviorInstalled(const std::string& name)
Parameters:
  • name – The behavior directory name
Returns:

Returns true if it is a valid behavior

bool ALBehaviorManagerProxy::isBehaviorLoaded(const std::string& name)

Tell if supplied name corresponds to a loaded behavior

Parameters:
  • name – Behavior name.
Returns:

Returns true if the name supplied is a loaded behavior

bool ALBehaviorManagerProxy::isBehaviorRunning(const std::string& name)

Tell if supplied name corresponds to a running behavior

Parameters:
  • name – Behavior name.
Returns:

Returns true if the name supplied is a running behavior

void ALBehaviorManagerProxy::playDefaultProject()

Play default behaviors

bool ALBehaviorManagerProxy::preloadBehavior(const std::string& name)

Load a behavior

Parameters:
  • name – Behavior name.
Returns:

Returns true if it was successfully loaded.

void ALBehaviorManagerProxy::removeDefaultBehavior(const std::string& name)

Remove the given behavior from the default behaviors

Parameters:
  • name – Behavior name.
std::string ALBehaviorManagerProxy::resolveBehaviorName(const std::string& behaviorName) const

Find out the actual <package>/<behavior> path behind a behavior name.

Parameters:
  • name – name of a behavior
Returns:

Returns the actual <package>/<behavior> path if found, else an empty string. Throws an ALERROR if two behavior names conflicted.

void ALBehaviorManagerProxy::runBehavior(const std::string& name)

Start a behavior and wait for its end. Return when the behavior is stopped. Throw if the behavior cannot be started or does not exist.

Parameters:
  • name – Behavior name.
void ALBehaviorManagerProxy::startBehavior(const std::string& name)

Start a behavior. Return when the behavior is started. Throw if the behavior cannot be started or does not exist.

Parameters:
  • name – Behavior name.
void ALBehaviorManagerProxy::stopAllBehaviors()

Stop all behaviors

void ALBehaviorManagerProxy::stopBehavior(const std::string& name)

Stop a behavior

Parameters:
  • name – Behavior name.
std::vector<std::string> ALBehaviorManagerProxy::getBehaviorNames()

Deprecated since version 1.14: use ALBehaviorManagerProxy::getInstalledBehaviors() instead

Get behaviors

Returns: Returns the list of behaviors prefixed by their type (User/ or System/).
std::vector<std::string> ALBehaviorManagerProxy::getSystemBehaviorNames()

Deprecated since version 1.18: use Choregraphe Application Manager instead.

Get system behaviors

Returns: Returns the list of system behaviors prefixed by System/.
std::vector<std::string> ALBehaviorManagerProxy::getUserBehaviorNames()

Deprecated since version 1.14: use ALBehaviorManagerProxy::getInstalledBehaviors() instead

Get user’s behaviors

Returns: Returns the list of user’s behaviors prefixed by User/.
bool ALBehaviorManagerProxy::installBehavior(const std::string& absolutePath, const std::string& localPath, const bool& overwrite)

Deprecated since version 1.18: use Choregraphe Application Manager instead.

There are two overloads of this function:

Install a behavior.

Parameters:
  • absolutePath – A path on the local file system of a behavior to install.
  • localPath – The destination path relative to behaviors path.
  • overwrite – Whether to replace existing behaviors if present.
Returns:

true on success, false otherwise.

bool ALBehaviorManagerProxy::installBehavior(const std::string& localPath)

Deprecated since version 1.18: use Choregraphe Application Manager instead.

Install a behavior.

Parameters:
  • localPath – The relative path of the behavior.
Returns:

true on success, false otherwise.

bool ALBehaviorManagerProxy::isBehaviorPresent(const std::string& prefixedBehavior)

Deprecated since version 1.14: use ALBehaviorManagerProxy::isBehaviorInstalled() instead

Tell if the supplied name corresponds to an existing behavior.

Parameters:
  • prefixedBehavior – Prefixed behavior.
Returns:

Returns true if it is an existing behavior

bool ALBehaviorManagerProxy::removeBehavior(const std::string& name)

Deprecated since version 1.18: use Choregraphe Application Manager instead.

Remove a behavior from the filesystem

Parameters:
  • name – Behavior name.
Returns:

Return true if succeeded, else false

Events

Event: "ALBehaviorManager/BehaviorAdded"
callback(std::string eventName, const std::string& behavior, std::string subscriberIdentifier)

Raised when a behavior is installed.

Parameters:
  • eventName (std::string) – “ALBehaviorManager/BehaviorAdded”
  • behavior – the name of the behavior installed
  • subscriberIdentifier (std::string) –
Event: "ALBehaviorManager/BehaviorRemoved"
callback(std::string eventName, const std::string& behavior, std::string subscriberIdentifier)

Raised when a behavior is removed.

Parameters:
  • eventName (std::string) – “ALBehaviorManager/BehaviorRemoved”
  • behavior – the name of the behavior removed
  • subscriberIdentifier (std::string) –
Event: "ALBehaviorManager/BehaviorUpdated"
callback(std::string eventName, const std::string& behavior, std::string subscriberIdentifier)

Raised when a behavior is updated.

Parameters:
  • eventName (std::string) – “ALBehaviorManager/BehaviorUpdated”
  • behavior – the name of the behavior updated
  • subscriberIdentifier (std::string) –
Event: "ALBehaviorManager/BehaviorsAdded"
callback(std::string eventName, const std::string& behavior, std::string subscriberIdentifier)

Raised when a package containing behaviors is installed.

Parameters:
  • eventName (std::string) – “ALBehaviorManager/BehaviorsAdded”
  • behavior – a list containing the names of the behaviors installed
  • subscriberIdentifier (std::string) –
Event: "BehaviorsRun"
callback(std::string eventName, const std::vector<std::string>& runningBehaviorList, std::string subscriberIdentifier)

Raised when the list of running behaviors change.

Parameters:
  • eventName (std::string) – “BehaviorsRun”
  • runningBehaviorList – list of all running behaviors
  • subscriberIdentifier (std::string) –

Signals

Signals are part of the qimessaging framework, see Experimental: qimessaging API.

ALBehaviorManager::behaviorsRemoved(std::vector<std::string> behaviorsRemoved)
Triggered :

When behaviors are removed.

Parameters:
  • behaviorsRemoved – Paths of the removed behaviors.
ALBehaviorManager::behaviorFailed(std::string behaviorName, std::string boxName, std::string error)
Triggered :

When a behavior stops on error.

Parameters:
  • behaviorName – Name of the failing behavior.
  • boxName – Name of the box where the error occurred.
  • error – Error message.
ALBehaviorManager::behaviorsAdded(std::vector<std::string> behaviorsAdded)
Triggered : When behaviors are added.
Param : behaviorsAdded: Paths of the added behaviors.
ALBehaviorManager::behaviorStopped(std::string behaviorName)
Triggered : When a behavior is stopped.
Param : behaviorName: Name of the stopped behavior.
ALBehaviorManager::behaviorStarted(std::string behaviorName)
Triggered : When a behavior is started.
Param : behaviorName: Name of the started behavior.
ALBehaviorManager::behaviorLoaded(std::string behaviorName)
Triggered : When a behavior is loaded.
Param : behaviorName: Name of the loaded behavior.