SoftBank Robotics documentation What's new in NAOqi 2.8?

ALPreferenceManager API

NAOqi Core - Overview | API


Namespace : AL

#include <alproxies/alpreferencemanagerproxy.h>

ALPreferenceManager allows managing the robot preferences. A preference is defined by the tuple:

  • Domain of the preference (for instance ‘com.aldebaran.modules.tts’, ‘com.aldebaran.apps.chess’, ...)

  • Name of the preference (for instance ‘/voice/pitch’, ‘/game/level/default’, ...)

  • Value of the preference (only string data type is currently supported)

    Warning

    Domain names are limited to 512 characters.

    Setting names are limited to 512 characters.

    Values are limited to 1 Mega Bytes.

These preferences are stored on the robot as well as in the Cloud, where they can also be accessed and modified.

Methods

ALPreferenceManager.getDomainList()

Return the list of all Preferences Domains.

Returns:qi.List(qi.String)
ALPreferenceManager.getValues()

Return all Preferences for all Domains with their values.

Returns:qi.List(qi.List(qi.Dynamic))
ALPreferenceManager.getValueList(qi.String)

Return all Preferences for a Domain with its values.

Parameters:domain – Preference Domain
Returns:qi.List(qi.List(qi.Dynamic))
ALPreferenceManager.getValue(qi.String, qi.String)

Return the Preference Value for a Domain and Setting.

Warning

Return None / null if the Preference doesn’t exist.

Parameters:
  • domain – Preference Domain
  • setting – Preference Setting
Returns:

qi.Dynamic

ALPreferenceManager.setValue(qi.String, qi.String, qi.Dynamic)

Set a Preference Value for a Domain and Setting.

If successful, will try to synchronize it with the Cloud directly.

Warning

Only String values are processed, other types are ignored.

Parameters:
  • domain – Preference Domain (Max 512 Bytes)
  • setting – Preference Setting (Max 512 Bytes)
  • value – New Preference Value (Max 1 Mega Bytes)
Returns:

qi.Void

ALPreferenceManager.setValues(qi.Map(qi.String, qi.Map(qi.String, qi.Dynamic)))

Save a list of Preference Domain, Setting and Values.

If successful, will try to synchronize them with the Cloud directly.

Warning

Only String values are processed, other types are ignored.

Domain and Setting are limited to 512 Bytes and Value is limited to 1 Mega Byte

Parameters:values – New Preference Values (ex: {‘PrefDomain’: {‘PrefSetting’: ‘StringValue’}})
Returns:qi.Void
ALPreferenceManager.removeValue(qi.String, qi.String)

Remove a Preference.

If successful, will try to synchronize it with the Cloud directly.

Parameters:
  • domain – Preference Domain
  • setting – Preference Setting
Returns:

qi.Void

ALPreferenceManager.removeDomainValues(qi.String)

Remove a Preference Domain and all its Settings / Values.

If successful, will try to synchronize them with the Cloud directly.

Parameters:domain – Preference Domain
Returns:qi.Void
ALPreferenceManager.importPrefFile(qi.String, qi.String, qi.String, qi.Bool)

Import an old ALPreferences File into ALPreferenceManager.

Warning

Only String values are processed, other types are ignored.

Ex: qicli call ALPreferenceManager.importPrefFile “motion” “naoqi” “ALMotion.xml” 1

Parameters:
  • domain – Domain for the new Preferences (Max 512 Bytes)
  • application – Application name to search the file (ex: ‘naoqi’)
  • filename – ALPreference filename
  • override – Override the values if already exists in ALPreferenceManager
Returns:

qi.Void

ALPreferenceManager.update()

Synchronize Preferences with the Cloud.

Returns:qi.Void

Signals

ALPreferenceManager.preferenceAdded(qi.String, qi.String, qi.Dynamic)

Emitted when a Preference has been added locally or remotely.

Parameters:
  • domain – Domain of the Preference (Max 512 Bytes)
  • setting – Setting of the Preference (Max 512 Bytes)
  • value – Value of the Preference (Max 1 Mega Bytes)
ALPreferenceManager.preferenceDomainRemoved(qi.String)

Emitted when a Preference Domain has been removed locally.

Parameters:domain – Domain of the Preference (Max 512 Bytes)
ALPreferenceManager.preferenceRemoved(qi.String, qi.String)

Emitted when a Preference has been removed locally or remotely.

Parameters:
  • domain – Domain of the Preference (Max 512 Bytes)
  • setting – Setting of the Preference (Max 512 Bytes)
ALPreferenceManager.preferenceUpdated(qi.String, qi.String, qi.Dynamic)

Emitted when a Preference has been updated locally or remotely.

Parameters:
  • domain – Domain of the Preference (Max 512 Bytes)
  • setting – Setting of the Preference (Max 512 Bytes)
  • value – Value of the Preference (Max 1 Mega Bytes)
ALPreferenceManager.preferencesSynchronized()

Emitted when the Preferences have been Synchronized with the Cloud.

Events

Event: "preferenceAdded"
callback(std::string eventName, const AL::ALValue& id, std::string subscriberIdentifier)

Raised when a new preference is added to the system.

Parameters:
  • eventName (std::string) – “preferenceAdded”
  • id – An array of two values identifying the preference:
  • id[0] – The preference domain.
  • id[1] – The preference name.
  • subscriberIdentifier (std::string) –
Event: "preferenceChanged"
callback(std::string eventName, const AL::ALValue& id, std::string subscriberIdentifier)

Raised when the value of a preference has been updated.

Parameters:
  • eventName (std::string) – “preferenceChanged”
  • id – An array of two values identifying the preference:
  • id[0] – The preference domain.
  • id[1] – The preference name.
  • subscriberIdentifier (std::string) –
Event: "preferenceRemoved"
callback(std::string eventName, const AL::ALValue& id, std::string subscriberIdentifier)

Raised when a preference has been removed.

Parameters:
  • eventName (std::string) – “preferenceRemoved”
  • id – An array of two values identifying the preference:
  • id[0] – The preference domain.
  • id[1] – The preference name.
  • subscriberIdentifier (std::string) –
Event: "preferenceDomainRemoved"
callback(std::string eventName, const AL::ALValue& id, std::string subscriberIdentifier)

Raised when an entire preference domain has been removed.

Parameters:
  • eventName (std::string) – “preferenceDomainRemoved”
  • id – The removed domain.
  • subscriberIdentifier (std::string) –
Event: "preferenceSynchronized"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when all preferences have been synchronized from the cloud.