parameter-framework: Sequence
BZ: 13152
- Introduced sequence notion in configurations:
Sequences are configuration specific and are controlled from the Settings
related XML files (order of settings appearance) as well as from the tuning
interface (new commands available to set and get the sequence
(setElementSequence / getElementSequence).
Notes:
- sequences will only matter for domains which new "SequenceAware"
attribute is set to true (false by default). This attribute is also
controlable through the tuning interface (setSequenceAware / getSequenceAware
commands).
- sequence unaware domain configurations will be applied before
sequence aware ones.
To allow for such functionality, the XML for settings format had to be
reworked, leading to an unfortunate compatibility break. However, one benefit
is that now a clear Settings section appears at the bottom of the domain
description, which is easier to maintain than the previous structure where the
settings appeared as sub-nodes of associated elements.
Change-Id: Ic93552fd510ed8847f9c8e7d9d6164f7ea3c8c45
Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com>
Reviewed-on: http://android.intel.com:8080/22558
Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com>
Tested-by: Barthes, FabienX <fabienx.barthes@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
Reviewed-on: http://android.intel.com:8080/26780
Reviewed-by: Barthes, FabienX <fabienx.barthes@intel.com>
diff --git a/parameter/ConfigurableDomains.cpp b/parameter/ConfigurableDomains.cpp
index fa794b3..c65bf3f 100644
--- a/parameter/ConfigurableDomains.cpp
+++ b/parameter/ConfigurableDomains.cpp
@@ -66,7 +66,7 @@
}
// Configuration application if required
-bool CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, bool bForce, string& strError)
+bool CConfigurableDomains::apply(CParameterBlackboard* pParameterBlackboard, bool bForce, string& strError) const
{
CAutoLog autoLog(this, "Applying configurations");
@@ -74,17 +74,38 @@
CSyncerSet syncerSet;
// Delegate to domains
+
+ // Start with sequence unaware domains
uint32_t uiChild;
uint32_t uiNbConfigurableDomains = getNbChildren();
for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
- CConfigurableDomain* pChildConfigurableDomain = static_cast<CConfigurableDomain*>(getChild(uiChild));
+ const CConfigurableDomain* pChildConfigurableDomain = static_cast<const CConfigurableDomain*>(getChild(uiChild));
- pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce);
+ if (!pChildConfigurableDomain->getSequenceAwareness() && !pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce, strError)) {
+
+ return false;
+ }
}
// Synchronize
- return syncerSet.sync(*pParameterBlackboard, false, strError);
+ if (!syncerSet.sync(*pParameterBlackboard, false, strError)) {
+
+ return false;
+ }
+
+ // Then deal with sequence aware domains
+ for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
+
+ const CConfigurableDomain* pChildConfigurableDomain = static_cast<const CConfigurableDomain*>(getChild(uiChild));
+
+ if (pChildConfigurableDomain->getSequenceAwareness() && !pChildConfigurableDomain->apply(pParameterBlackboard, syncerSet, bForce, strError)) {
+
+ return false;
+ }
+ }
+
+ return true;
}
// From IXmlSource
@@ -163,6 +184,38 @@
return pConfigurableDomain->rename(strNewName, strError);
}
+bool CConfigurableDomains::setSequenceAwareness(const string& strDomain, bool bSequenceAware, string& strError)
+{
+ CConfigurableDomain* pConfigurableDomain = static_cast<CConfigurableDomain*>(findChild(strDomain));
+
+ if (!pConfigurableDomain) {
+
+ strError = "Configurable domain not found";
+
+ return false;
+ }
+
+ pConfigurableDomain->setSequenceAwareness(bSequenceAware);
+
+ return true;
+}
+
+bool CConfigurableDomains::getSequenceAwareness(const string& strDomain, bool& bSequenceAware, string& strError) const
+{
+ const CConfigurableDomain* pConfigurableDomain = static_cast<const CConfigurableDomain*>(findChild(strDomain));
+
+ if (!pConfigurableDomain) {
+
+ strError = "Configurable domain not found";
+
+ return false;
+ }
+
+ bSequenceAware = pConfigurableDomain->getSequenceAwareness();
+
+ return true;
+}
+
/// Configurations
bool CConfigurableDomains::listConfigurations(const string& strDomain, string& strResult) const
{
@@ -310,6 +363,29 @@
}
}
+void CConfigurableDomains::listDomains(string& strResult) const
+{
+ strResult = "\n";
+
+ // List domains
+ uint32_t uiChild;
+ uint32_t uiNbConfigurableDomains = getNbChildren();
+
+ for (uiChild = 0; uiChild < uiNbConfigurableDomains; uiChild++) {
+
+ const CConfigurableDomain* pChildConfigurableDomain = static_cast<const CConfigurableDomain*>(getChild(uiChild));
+
+ // Name
+ strResult += pChildConfigurableDomain->getName();
+
+ // Sequence awareness
+ if (pChildConfigurableDomain->getSequenceAwareness()) {
+
+ strResult += " [sequence aware]\n";
+ }
+ }
+}
+
// Gather configurable elements owned by any domain
void CConfigurableDomains::gatherAllOwnedConfigurableElements(set<const CConfigurableElement*>& configurableElementSet) const
{
@@ -357,6 +433,37 @@
return pConfigurableDomain->saveConfiguration(strConfiguration, pMainBlackboard, strError);
}
+bool CConfigurableDomains::setElementSequence(const string& strDomain, const string& strConfiguration, const vector<string>& astrNewElementSequence, string& strError)
+{
+ // Find domain
+ CConfigurableDomain* pConfigurableDomain = static_cast<CConfigurableDomain*>(findChild(strDomain));
+
+ if (!pConfigurableDomain) {
+
+ strError = "Configurable domain " + strDomain + " not found";
+
+ return false;
+ }
+
+ // Delegate to domain
+ return pConfigurableDomain->setElementSequence(strConfiguration, astrNewElementSequence, strError);
+}
+
+bool CConfigurableDomains::getElementSequence(const string& strDomain, const string& strConfiguration, string& strResult) const
+{
+ // Find domain
+ const CConfigurableDomain* pConfigurableDomain = static_cast<const CConfigurableDomain*>(findChild(strDomain));
+
+ if (!pConfigurableDomain) {
+
+ strResult = "Configurable domain " + strDomain + " not found";
+
+ return false;
+ }
+ // Delegate to domain
+ return pConfigurableDomain->getElementSequence(strConfiguration, strResult);
+}
+
// Last applied configurations
void CConfigurableDomains::listLastAppliedConfigurations(string& strResult) const
{