summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterMgr.cpp
diff options
context:
space:
mode:
authorPatrick Benavoli <patrickx.benavoli@intel.com>2011-08-31 11:23:24 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-10 17:14:54 +0100
commit1387bda01b089d8e8df06339d9c15d53b3de6725 (patch)
treec8dd258fdff344e629433f89976ca573ff828c31 /parameter/ParameterMgr.cpp
parent2ecf900ad8c30ce9f8e81f57977a1a80a6f6d8af (diff)
downloadexternal_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.zip
external_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.tar.gz
external_parameter-framework-1387bda01b089d8e8df06339d9c15d53b3de6725.tar.bz2
Min/max value computation; Tuning lock handling
BZ: 7466 - Min/max values are now correctly computed. They concern integer and fixed point parameters - tuning mode lock issue solved: created an AutoLock class for safe lock handling - added configuration files for a demo on Ubuntu environment - had AMIXER subsystem plugin compliant for derivation - LPE library: add carriage return on logs - removed obsolete files - some cosmetics Change-Id: Ife7a4799fd48dd4a1ca25dae666c4e453815881e Orig-Change-Id: I72fc5c1ff6abf638b43266a75bc00e21ad412349 Signed-off-by: Patrick Benavoli <patrickx.benavoli@intel.com> Reviewed-on: http://android.intel.com:8080/16880 Reviewed-by: Mahe, Erwan <erwan.mahe@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/ParameterMgr.cpp')
-rw-r--r--parameter/ParameterMgr.cpp81
1 files changed, 39 insertions, 42 deletions
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index b27a1b5..87f6662 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -39,7 +39,6 @@
#include "KindElementBuilderTemplate.h"
#include "ElementBuilderTemplate.h"
#include "SelectionCriterionType.h"
-#include "SelectionCriterionDefinition.h"
#include "SubsystemElementBuilder.h"
#include "SelectionCriteria.h"
#include "ComponentType.h"
@@ -71,6 +70,7 @@
#include "SelectionCriterionRule.h"
#include "SimulatedBackSynchronizer.h"
#include "HardwareBackSynchronizer.h"
+#include "AutoLock.h"
#include <strings.h>
#include <dlfcn.h>
#include <assert.h>
@@ -120,7 +120,7 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandPars
{ "getAutoSync", &CParameterMgr::getAutoSyncCommmandProcess, 0, "", "Show Auto Sync state" },
{ "sync", &CParameterMgr::syncCommmandProcess, 0, "", "Synchronize current settings to hardware while in Tuning Mode and Auto Sync off" },
/// Criteria
- { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0, "", "List available selection criteria" },
+ { "listCriteria", &CParameterMgr::listCriteriaCommmandProcess, 0, "", "List selection criteria" },
/// Domains
{ "listDomains", &CParameterMgr::listDomainsCommmandProcess, 0, "", "List configurable domains" },
{ "createDomain", &CParameterMgr::createDomainCommmandProcess, 1, "<domain>", "Create new configurable domain" },
@@ -143,9 +143,9 @@ const CParameterMgr::SRemoteCommandParserItem CParameterMgr::gaRemoteCommandPars
{ "dumpElement", &CParameterMgr::dumpElementCommmandProcess, 1, "<elem path>", "Dump structure and content of element at given path" },
{ "getElementSize", &CParameterMgr::getElementSizeCommmandProcess, 1, "<elem path>", "Show size of element at given path" },
{ "showProperties", &CParameterMgr::showPropertiesCommmandProcess, 1, "<elem path>", "Show properties of element at given path" },
- { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, "<param ath>", "Get value for parameter at given path" },
+ { "getParameter", &CParameterMgr::getParameterCommmandProcess, 1, "<param path>", "Get value for parameter at given path" },
{ "setParameter", &CParameterMgr::setParameterCommmandProcess, 2, "<param path> <value>", "Set value for parameter at given path" },
- { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is contained in" },
+ { "listBelongingDomains", &CParameterMgr::listBelongingDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path belongs to" },
{ "listAssociatedDomains", &CParameterMgr::listAssociatedDomainsCommmandProcess, 1, "<elem path>", "List domain(s) element at given path is associated to" },
/// Browse
{ "listAssociatedElements", &CParameterMgr::listAssociatedElementsCommmandProcess, 0, "", "List element sub-trees associated to at least one configurable domain" },
@@ -273,16 +273,41 @@ bool CParameterMgr::load(string& strError)
return false;
}
- // All is loaded, we're ready to observe selection criteria events
- getSelectionCriteria()->setObserver(this);
+ // Back synchronization for areas in parameter blackboard not covered by any domain
+ CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(strError);
+
+ log("Main blackboard back synchronization");
+
+ // Back-synchronize
+ if (!pBackSynchronizer->sync()) {
+ // Get rid of back synchronizer
+ delete pBackSynchronizer;
- // Load and start Remote processor server if appropriate
- if (!handleRemoteProcessingInterface(strError)) {
+ strError = "Main blackboard back synchronization failed: " + strError;
return false;
}
+ // Get rif of back synchronizer
+ delete pBackSynchronizer;
- return true;
+ // We're done loading the settings and back synchronizing
+ CConfigurableDomains* pConfigurableDomains = getConfigurableDomains();
+
+ // We need to ensure all domains are valid
+ pConfigurableDomains->validate(_pMainParameterBlackboard);
+
+ // Ensure application of currently selected configurations
+ // Force-apply configurations
+ if (!pConfigurableDomains->apply(_pMainParameterBlackboard, true, strError)) {
+
+ return false;
+ }
+
+ // All is loaded, we're ready to observe selection criteria change events
+ getSelectionCriteria()->setObserver(this);
+
+ // Start remote processor server if appropriate
+ return handleRemoteProcessingInterface(strError);
}
bool CParameterMgr::loadFrameworkConfiguration(string& strError)
@@ -456,30 +481,7 @@ bool CParameterMgr::loadSettings(string& strError)
return false;
}
- // Back synchronization for areas in parameter blackboard no covered by any domain
- CBackSynchronizer* pBackSynchronizer = createBackSynchronizer(strError);
-
- log("Main blackboard back synchronization");
-
- // Back-synchronize
- if (!pBackSynchronizer->sync()) {
- // Get rif of back synchronizer
- delete pBackSynchronizer;
-
- strError = "Main blackboard back synchronization failed: " + strError;
-
- return false;
- }
- // Get rif of back synchronizer
- delete pBackSynchronizer;
-
- // We're done loading the settings
- // We need to ensure all domains are valid
- pConfigurableDomains->validate(_pMainParameterBlackboard);
-
- // Ensure application of currently selected configurations
- // Force-apply configuration(s)
- return pConfigurableDomains->apply(_pMainParameterBlackboard, true, strError);
+ return true;
}
// XML parsing
@@ -556,7 +558,7 @@ void CParameterMgr::selectionCriterionChanged(const CSelectionCriterion* pSelect
CAutoLog autoLog(this, "Selection criterion changed event: " + pSelectionCriterion->getFormattedDescription(false));
// Lock state
- pthread_mutex_lock(&_tuningModeMutex);
+ CAutoLock autoLock(&_tuningModeMutex);
if (!_bTuningModeIsOn) {
@@ -568,8 +570,6 @@ void CParameterMgr::selectionCriterionChanged(const CSelectionCriterion* pSelect
log("Failed to apply configurations!");
}
}
- // Unlock state
- pthread_mutex_unlock(&_tuningModeMutex);
}
// Command processing
@@ -1267,13 +1267,13 @@ bool CParameterMgr::setTuningMode(bool bOn, string& strError)
return false;
}
// Lock state
- pthread_mutex_lock(&_tuningModeMutex);
+ CAutoLock autoLock(&_tuningModeMutex);
// Warn domains about exiting tuning mode
if (!bOn && _bTuningModeIsOn) {
// Ensure application of currently selected configurations
- // Force-apply configuration(s)
+ // Force-apply configurations
if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) {
return false;
@@ -1285,9 +1285,6 @@ bool CParameterMgr::setTuningMode(bool bOn, string& strError)
// Store
_bTuningModeIsOn = bOn;
- // Unlock state
- pthread_mutex_unlock(&_tuningModeMutex);
-
return true;
}
@@ -1331,7 +1328,7 @@ bool CParameterMgr::setAutoSync(bool bAutoSyncOn, string& strError)
if (bAutoSyncOn && !_bAutoSyncOn) {
// Ensure application of currently selected configurations
- // Force-apply configuration(s)
+ // Force-apply configurations
if (!getConfigurableDomains()->apply(_pMainParameterBlackboard, true, strError)) {
return false;